Skip to content

Releases: canjs/canjs

observable.value

25 Sep 16:11
Compare
Choose a tag to compare

can-simple-observable

This adds .value getter and setters for Async/Resolver/Settable/Setter and SimpleObservable:

obs = new SimpleObservable(5);
obs.value // ->5

obs.value = 3;
obs.value // -> 3

can-view-live

If a part of the DOM managed by .html was updated twice within the same "batch", the second update would not work as it would try to replace incorrect oldNodes. This patch fixes this bug.

This bug occurred in situations where two-way bindings would cause cycles.

can-view-scope

Fixes a bug using scope/key to lookup and call functions. For example, the following would work:

{{../../../method()}}

The this was not:

{{scope/method()}}

can-attribute-observable

can-define

can-query-logic

can-route

can-route-pushstate

scope/key support in stache

21 Sep 16:32
Compare
Choose a tag to compare

canjs/canjs v5.10.0 Release Notes

can-stache

can-view-scope

<span>{{scope/person}}</span>

Which is equivalent to:

<span>{{scope.find('person')}}</span>

for(of) fixes

18 Sep 16:45
Compare
Choose a tag to compare

canjs/canjs v5.9.2 Release Notes

can-ajax

can-construct

can-define

can-route

can-stache

Makes this sorta thing work:

    {{# for(thing of this.stuff)}}
       {{let theValue=null}}
       <driver-list selected:to="theValue" on:click='fooName = 3'/>
			 <driver-edit driver:from="theValue"/>
    {{/ for}}
{{# for(items) }}
  {{scope.index}}
{{/ for}}

The above works.

can-view-scope

v5.9.1

13 Sep 15:21
Compare
Choose a tag to compare

Bug Fix

{{#each(objects, object=value)}}
    {{#each(../fields, field=value)}}
        {{../object[field]}}
    {{/each}}
{{/each}}

5.9.0

12 Sep 18:20
Compare
Choose a tag to compare

New Features

can-route

To see how this is useful, consider this example:

import route from "can-route";

route.register("{page}", { page: "home" });
route.start();

console.log(route.data.page); // -> "home"

As you can see, since route.data is a DefineMap we can use the properties on it directly using JavaScript dot notation.

The purpose of this change is to reduce the amount of boilerplate to get started with canjs routing. Usually you create an application ViewModel and then set it as the route.data like below.

import route from "can-route";
import DefineMap from "can-define/map/map";

const AppViewModel = DefineMap.extend({
  page: "string"
});

route.register("{page}", { page: "home" });
route.data = new AppViewModel();
route.start();

console.log(route.data.page); // -> "home"

The above still works, of course, but with can-route 4.2.0 this boilerplate becomes unnecessary.

This also allows you to have better separation between your application state and your route data. No more serialize: false!! Consider the following:

import route from "can-route";
import DefineMap from "can-define/map/map";

const AppViewModel = DefineMap.extend({
  someNonSerializedState: "string",

  routeData: {
    default: () => route.data
  }
});

route.register("{page}", { page: "home" });

Now you have clean separate between your route state and the rest of your application's state. You can use this in your stache like so:

<some-component page:from="routeData.page" />

{{someNonSerializedState}}

v5.8.0

v5.7.0

5.6.1

23 Aug 12:23
Compare
Choose a tag to compare

This is a bug fix release, fixing an issue where development code was not being removed from the core.min.mjs build.

v5.6.0

20 Aug 18:56
Compare
Choose a tag to compare

New Features

A new package, can-map-compat is added to canjs, which makes it easier to migrate away from can-map to newer observable types such as DefineMaps.

import { DefineMap, makeMapCompat } from "can";

const ViewModel = makeMapCompat(DefineMap.extend("ViewModel", {
  page: {
    default: "home"
  }
}));

const vm = new ViewModel();

vm.attr("page"); // -> "home"

vm.attr("page", "cart");
vm.attr("page"); // -> "cart"

vm.removeAttr("page");
vm.attr("page"); // -> undefined

Bug Fixes

can-attribute-observable

can-component

count:from="count" works below:

can.Component.extend({
    tag: "my-counter",
    view: `
        <can-slot name="incrementButton"
            add:from="add">
            <button on:click="add(1)">+1</button>
        </can-slot>
        <can-slot name="countDisplay"
            count:from="count">
            {{count}}
        </can-slot>
    `,
    ViewModel: {
        count: {type: "number", default: 0},
        add(increment){
					debugger;
            this.count += increment;
        }
    }
});

can-construct

can-define

can-dom-data-state

can-dom-mutate

can-map

Adds a _legacyAttrBehavior property, which when set to true, keeps can-map compatible with how it worked before can-reflect ( https://github.com/canjs/can-map/releases/tag/v3.2.0 ).

To use it, you can either:

// Sets the legacy behavior for all Maps
can.Map.prototype._legacyAttrBehavior = true
// Sets the legacy behavior for an individual map type
Type = can.Map.extend({ _legacyAttrBehavior: true}})
// Sets the legacy behavior for a single map instance
var map = new can.Map();
map._legacyAttrBehavior = true;
map.attr({
  prop: new DefineMap()
})

This works with both assign and update forms of attr().

can-map-compat

can-queues

can-reflect

Bugs

can-stache

can-stache-bindings

passes the bindingState which includes information about the binding

can-stache-converters

can-view-callbacks

v5.5.0

15 Aug 21:36
Compare
Choose a tag to compare

New Features

You can now use inserted/removed events with the can package (global or ES Module builds) like:

import { domEvents, domMutateDomEvents, domMutateNode } from "can";

domEvents.addEvent(domMutateDomEvents.inserted);
domEvents.addEvent(domMutateDomEvents.removed);

...

domMutateNode.appendChild.call(document.body, p); 

Adds a _legacyAttrBehavior property, which when set to true, keeps can-map compatible with how it worked before can-reflect ( https://github.com/canjs/can-map/releases/tag/v3.2.0 ).

To use it, you can either:

// Sets the legacy behavior for all Maps
can.Map.prototype._legacyAttrBehavior = true
// Sets the legacy behavior for an individual map type
Type = can.Map.extend({ _legacyAttrBehavior: true}})
// Sets the legacy behavior for a single map instance
var map = new can.Map();
map._legacyAttrBehavior = true;

Bug Fixes