Releases: canjs/canjs
Updating can-debug docs and demos
v5.4.0
New Features
can-debug v2.0.0 - v2.0.0
can-debug now exports a function that can be used like:
import debug from "can-debug";
debug();
or
import { debug } from "can";
debug();
debug.drawGraph has also been removed
This method doesn't work in many build formats (ES modules, bundled global builds, webpack). It also requires the large vis.js
file. Since the graph is available in CanJS devtools, this functionality was removed.
can-vdom v4.4.0 - Set document.defaultView to be the window
Bug Fixes
v5.3.1
v5.3.0
New Features
-
can-component v4.3.0 - element.viewModel
Adds a.viewModel
property to component elements.can-view-model
can take a hike! -
can-query-logic v1.1.0 - Expose set methods and reduce some examples better
import {QueryLogic} from "can-query-logic";
var gt1 = new QueryLogic.GreaterThan(1);
var lte1 = new QueryLogic.LessThanEqual(1);
QueryLogic.intersection(gt1, lte1) //-> QueryLogic.EMPTY
-
can-stache v4.10.0 - Make sure every stache call has its own TemplateContext
-
can-view-scope v4.7.0 - scope.log and able to look up helpers across many TemplateContext
Bug Fixes
- can-assign v1.3.0 - adds 'use strict'
- can-assign v1.3.1
- can-attribute-observable v1.0.1
- can-define v2.5.3 - Includes constructor names with properties in warnings
- can-define v2.5.4
- can-map v4.1.2 - not binding on __keys during setup
- can-map-define v4.3.1
- can-map-define v4.3.2
- can-map-define v4.3.3
- can-reflect v1.17.1
- can-route v4.3.1
- can-route v4.3.2
- can-route v4.3.3 - Improved test consistency
- can-route v4.3.4 - Improving consistency of more tests
- can-route-hash v1.0.1 - Updating HashChange observable to empty string sets URL correctly
- can-route-pushstate v5.0.1 - Improved documentation for urlData.root
- can-route-pushstate v5.0.2
- can-stache v4.10.1
- can-stache v4.10.2
- can-stache v4.10.3 - Address minor documentation issues #504 #429
- can-stache-bindings v4.3.1 - Doc fixes, replacing %event with scope.event
- can-stache-bindings v4.3.2
- can-stache-bindings v4.3.3
- can-stache-route-helpers v1.1.1 - Small documentation updates
- can-value v1.0.1
5.2.2
v5.2.1
This release includes can-component v4.2.4, which fixed adding a programmatically-instantiated component that has already been torn down.
v5.2.0
Notable changes
This release includes:
- Strict mode in more modules
- Bug fixes to make programmatically-instantiated components be torn down correctly
All changes
can-ajax
can-child-nodes
can-cid
can-component
can-data-types
can-diff
can-fragment
can-key
can-make-map
can-query-logic
can-route-mock
can-stache
can-string-to-any
can-view-nodelist
5.1.0
New Features
can-route-mock is now included as an ecosystem package.
import { route, RouteMock } from "//unpkg.com/can@5/ecosystem.mjs";
route.urlData = new RouteMock();
route.register("{page}", { page: "home" });
route.start();
Updates to individual packages
can-define
- can-define v2.5.0 - deleteKey
Adds a deleteKey that can only really delete expandos: canjs/can-define#352
also fixes a problem where type converters were not being called with the right this
#349
This fixes a problem where expando properties were not able to be added again after being deleted.
can-make-map
- can-make-map v1.0.0
- can-make-map v1.0.1 - Updated docs and added cycle detection
- Add a cycle detection script to test process #2
- Update docs with new @parent & @collection #4
canjs/can-make-map@v1.0.0...v1.0.1
can-super-model
Fix documentation to put this pkg into can-ecosystem
can-super-model is an ecosystem package but is listed on the website as
core. This patch release fixes that.
5.0.0
Big changes
This release includes:
- can-query-logic, a simplified replacement for can-set.
- New service layer packages, moving can-connect to an infrastructure project
- Support for tree-shaking.
- Builds of core and ecosystem modules that can be used directly in the browser.
- Routing broken into separate modules, paving the way for future improvements.
can-query-logic
The can-query-logic package exports a constructor function that builds query logic
from:
- an optional schema or type argument, and
- an optional
options
argument used to convert alternate parameters to
the expected query format.
For example, the following builds query logic from a DefineMap:
import { DefineMap, QueryLogic } from "can";
const Todo = DefineMap.extend({
id: {
identity: true,
type: "number"
},
name: "string",
complete: "boolean"
});
var todoQueryLogic = new QueryLogic(Todo);
New service layer packages
can-connect is the backbone for integrating with your service layer. But most never take advantage of the flexibility using can-connect directly provides.
To make things easier, the following new packages were created which bundles together various connect behaviors:
- can-realtime-rest-model. This allows you to build models that are connected to your service layer and can receive realtime updates (using Socket.io, WebSockets, or any other real-time library).
- can-rest-model. Contains the most basic features needed for connecting a map to your service layer. It is like can-realtime-rest-model but without the realtime.
- can-super-model. The kitchen sink. This model layer contains real-time, fall through caching, and everything else that can-connect contains.
Tree-shaking
Using a bundler / module loader capable of tree-shaking, such as steal 2.0, webpack, or rollup you can import items from the can
package directly, and anything not used will be removed from your production build.
import { DefineMap, fixture } from "can";
DefineMap.extend("ViewModel", { ... });
In the above example, can-define, can-fixture, and any packages they rely upon will be included in the build. Other unrelated packages, such as can-observe, will not.
Web compatible ES module builds
The can package now contains 2 modules that can be consumed directly from the browser. They can be used like:
<script type="module">
import { Component } from "//unpkg.com/can@5/core.mjs";
Component.extend({
tag: "my-app",
view: `CanJS {{feels}} modules`,
ViewModel: {
feels: { default: "😍" }
}
});
</script>
Both core and ecosystem packages include these ES module builds (available via can/core.mjs
and can/ecosystem.mjs
respectively). Minified versions are available as well.
This is useful for building demos, demonstrating bugs, or even for small apps. See the Setting Up CanJS guide for more information on using these packages.
route.urlData and can-route-pushstate 5.0
Due to adding support for tree-shaking, we needed a way to make can-route-pushstate not have side-effects, otherwise simply importing can
would result in pushstate routing being enabled.
We added a new .urlData
property that can be set in can-route, that works similarly to the .data
property for connecting a view model. To enable pushstate do this:
import { route, RoutePushstate } from "can";
route.urlData = new RoutePushstate();
route.register("{page}", { page: "home" });
route.start();
Updates to individual packages
can-ajax
- can-ajax v1.2.0-pre.0
- can-ajax v1.2.0 - Let XHR handle FormData object
canjs/can-ajax#31 - can-ajax v1.2.1
- can-ajax v1.3.0
- can-ajax v2.0.0
- can-ajax v2.0.1 - 2.0.1
Removes a few items from .npmignore that are needed for the canjs/canjs tests. - can-ajax v2.0.2 - 2.0.2
Removes a few items from .npmignore that are needed for the canjs/canjs tests.
can-assign
can-attribute-encoder
- can-attribute-encoder v1.0.5 - Encode/decode :raw bindings
This patch release fixes an issue with bindings ending in:raw
not being encoded/decoded like other bindings.
See canjs/can-attribute-encoder#21
can-attribute-observable
- can-attribute-observable v0.2.1 - making sure properties are writable before using them
#4 - can-attribute-observable v0.2.2 - not using cached element in attribute getter/setter
canjs/can-attribute-observable#7 - can-attribute-observable v0.2.3
- can-attribute-observable v0.3.0
- can-attribute-observable v0.3.1
- can-attribute-observable v1.0.0
can-bind
can-child-nodes
can-cid
-
can-cid v1.0.1 - correctly dependency injecting can-namespace
canjs/can-cid#6 -
can-cid v1.0.2 - Upgrade StealJS
Thesteal
,steal-tools
, and related testing plugins have been updated to the latest versions. -
can-cid v1.0.3 - Fixing tests to work with Steal 0.16
canjs/can-cid#11 -
can-cid v1.1.1 - Fixing map and set in IE9 & IE10
canjs/can-cid#27 -
can-cid v1.1.2 - Fixing @module and @parent in set docs
canjs/can-cid#30
can-component
- can-component v4.1.0-pre.2
- can-component v4.1.0 - Remove can-util deps
- can-component v4.1.1
- can-component v4.1.2 - upgrades can-view-nodelist dependency
- can-component v4.1.3 - Register stache bindings using stache.addBindings
- can-component v4.2.0-pre.1
- can-component v4.2.0
- can-component v4.2.1
- can-component v4.2.2
can-compute
- Unbinding temporary computes now uses (polyfilled) setImmediate instead of a 10ms timeout. This is to make dependent events happen in queue more consistently with mutation observer events (which also use setImmediate in vdom, and native immediate timeouts with real DOM).
- COMPUTE.truthy now doesn't automatically evaluate functions if computes return them as values. This supports using "@" expressions (which do not evaluate a reference function to its returned value) with {{#if}} in can-stache.
- So...
v4.3.0
Big changes
This release has three big things:
- Improved compatibility with webpack
- Components can be programmatically instantiated with
new
- Strict mode in modules
Improved compatibility with webpack
Most of the packages are compatible with the process.env.NODE_ENV
checks that other bundlers (like webpack) use to remove code from production builds.
Find more information in this issue: Make CanJS compatible with how webpack strips out dev code.
Components can be programmatically instantiated with new
This release implements everything from the proposal to improve routing to components (and testing), including updates to can-component and can-stache, and a new can-value package.
can-component 4.2.0
In short, the can-component
changes make it possible to create new component instances with new
, without rendering the instances in a template. This is useful when you:
- have complex logic for switching between different components (e.g. routing)
- want to create components without adding them to the page (e.g. testing)
The following defines a MyGreeting
component and creates a my-greeting
element by calling new
on the component’s constructor function:
const HelloWorld = Component.extend({
tag: "hello-world",
view: `
<can-slot name="greetingTemplate" />
<content>world</content>
<ul>{{#each(items)}} {{this}} {{/each}}</ul>
`,
ViewModel: {
items: {}
}
});
// Create a new instance of our component
const componentInstance = new HelloWorld({
// values with which to initialize the component’s view model
viewModel: {
items: ["eat"]
},
// can-stache template to replace any <content> elements in the component’s view
content: "<em>{{message}}</em>",
// <can-template> strings rendered by can-stache with the scope
templates: {
greetingTemplate: "{{greeting}}"
},
// scope with which to render the <content> and templates
scope: {
greeting: "Hello",
message: "friend"
}
});
myGreetingInstance.element; // is like <my-greeting>Hello <em>friend</em> <ul> <li>eat</li> </ul></my-greeting>
myGreetingInstance.viewModel; // is HelloWorld.ViewModel{items: ["eat"]}
Changing the component’s view model will cause its element and any bindings to be updated:
myGreetingInstance.viewModel.items.push("sleep");
myGreetingInstance.element; // is like <my-greeting>Hello <em>friend</em> <ul> <li>eat</li> <li>sleep</li> </ul></my-greeting>
can-stache 4.9.0
This release makes it possible to render component instances in a template with the “unescaped” (triple-curly) tags:
import Component from "can-component";
import stache from "can-stache";
const MyGreeting = Component.extend({
tag: "my-greeting",
view: "<p>Hello {{subject}}</p>",
ViewModel: {
subject: "string"
}
});
const myGreetingInstance = new MyGreeting({
viewModel: {
subject: "friend"
}
});
const template = stache("<div>{{{componentInstance}}}</div>");
const fragment = template({
componentInstance: myGreetingInstance
});
fragment; //-> <div><my-greeting><p>Hello friend</p></my-greeting></div>
can-value 1.0
can-value makes it possible to create new observables:
- from any object or primitive value
- with the return value of a function (that updates when the observables inside it change)
- bound to a specific key in another observable
Find examples in the docs for can-value and each of its methods: bind, from, returnedBy, to, and with.
Strict mode in modules
Almost every module now opts into strict mode with a "use strict"
at the top of the file.
Updates to individual packages
can-ajax
- can-ajax v1.1.3
- can-ajax v1.1.4 - v1.1.4
Change thecan-globals
semver range to<2.0.0
canjs/can-ajax#21 - can-ajax v1.2.0-pre.0
- can-ajax v1.2.0 - Let XHR handle FormData object
canjs/can-ajax#31 - can-ajax v1.2.1
- can-ajax v1.3.0
- can-ajax v2.0.0
- can-ajax v2.0.1 - 2.0.1
Removes a few items from .npmignore that are needed for the canjs/canjs tests. - can-ajax v2.0.2 - 2.0.2
Removes a few items from .npmignore that are needed for the canjs/canjs tests.
can-assign
can-attribute-encoder
- can-attribute-encoder v0.3.3
- can-attribute-encoder v0.3.4
- can-attribute-encoder v1.0.0
- can-attribute-encoder v1.0.1
- can-attribute-encoder v1.0.2
- can-attribute-encoder v1.0.3
- can-attribute-encoder v1.0.4
- can-attribute-encoder v1.0.5 - Encode/decode :raw bindings
This patch release fixes an issue with bindings ending in:raw
not being encoded/decoded like other bindings.
See canjs/can-attribute-encoder#21
can-attribute-observable
- can-attribute-observable v0.1.0
- can-attribute-observable v0.2.0
- can-attribute-observable v0.2.1 - making sure properties are writable before using them
#4 - can-attribute-observable v0.2.2 - not using cached element in attribute getter/setter
canjs/can-attribute-observable#7 - can-attribute-observable v0.2.3
- can-attribute-observable v0.3.0
- can-attribute-observable v0.3.1
- can-attribute-observable v1.0.0
can-bind
can-component
- can-component v4.1.0-pre.2
- can-component v4.1.0 - Remove can-util deps
- can-component v4.1.1
- can-component v4.1.2 - upgrades can-view-nodelist dependency
- can-component v4.1.3 - Register stache bindings using stache.addBindings
- can-component v4.2.0-pre.1
- can-component v4.2.0
- can-component v4.2.1
- can-component v4.2.2
- can-component v5.0.0-pre.0
can-compute
- Unbinding temporary computes now uses (polyfilled) setImmediate instead of a 10ms timeout. This is to make dependent events happen in queue more consistently with mutation observe...