@matthewp matthewp released this Aug 20, 2018 · 256 commits to master since this release

Assets 2

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