Releases: canjs/canjs
Introducing type.Integer and bug fixes
canjs/canjs 6.1.0 Release Notes
can-observable-array
Add ObservableArray to can-namespace
This patch release adds ObservableArray
to can-namespace
so it is available on the global can
object.
can-observable-object
Add ObservableObject to can-namespace
This patch release adds ObservableObject
to can-namespace
so it is available on the global can
object.
can-stache-element
Add StacheElement to can-namespace
This patch release adds StacheElement
to can-namespace
so it is available on the global can
object.
can-type
Add can-type to can-namespace
This patch release adds can-type
to can-namespace
so it is available on the global can
object.
- can-type v1.0.2 - Improve error message
Improve error message by including the type of the value being set:
class Person extends ObservableObject() {
static get props() {
return {
age: type.check(Number)
};
}
}
var farah = new Person();
farah.age = '4'; // -> Uncaught Error: 4 (String) is not of type Number.
- can-type v1.0.3
- can-type v1.1.0 - type.Integer
This is a minor release that addstype.Integer
as a convenient way to get an integer type. This is useful when you want to convert to whole, non-fractional numbers.
import { Reflect, type } from "can";
let ConvertingInteger = type.convert(type.Integer);
let val = Reflect.convert(12.1, ConvertingInteger);
console.log(val); // -> 12
- can-type v1.1.1 - Prevents running error message tests in production
This is just to fix the canjs/canjs build.
CanJS 6
CanJS 6.0 🎉
CanJS 6.0 is a major step forward for CanJS, fully embracing JavaScript classes, web components and other modern features. The highlights of the release include:
-
ObservableObject and ObservableArray as new simplified replacements for DefineMap and DefineList based on JavaScript class syntax. These new types use proxies so they can react to changes even if properties are not predefined.
import { ObservableObject } from "can"; class Person extends ObservableObject { get fullName() { return this.first + " " + this.last; } } let person = new Person(); person.on("fullName", ({ value }) => { console.log("Full name is", value); }); person.first = "Ada"; person.last = "Lovelace";
-
StacheElement, a new base class for creating web components, a standard way to share components that works in any framework. StacheElement has the same API as [can-observable-object ObservableObject] so you only need to know the one API to use for both [guides/data models] and components.
import { StacheElement } from "can"; class HelloWorld extends StacheElement { static view = `Hello {{ this.name }}!`; } customElements.define("hello-world", HelloWorld); let el = new HelloWorld(); el.name = "world"; document.body.append(el);
-
New package can-type brings a high level of flexibility to defining property types on can-observable-object and can-stache-element. It allows defining strict types, types that can be null/undefined and more.
import { ObservableObject, type } from "can"; class Person extends ObservableObject { static props = { age: type.maybe(Number) }; } let person = new Person({ age: null }); console.log(person.age); // null person.age = 11; console.log(person.age); // 11 person.age = "14"; // throws!!
-
Internet Explorer 11 support (still!)
Although StacheElement, ObservableObject, and ObservableArray use features such as classes and proxies that are not supported in IE11, you can continue to use can-component and DefineMap and DefineList if your application needs to be compatible with IE11.
See the Setup Guide for more details.
Changes
can-attribute-observable
can-component
- can-component v4.6.3 - Include
new Component()
mutations with logStack
Now mutations are visible inqueues.logStack
when a component instantiated programmatically like the following:
var c = new Component({
viewModel : {
foo: value.bind(this,"bar")
}
});
- can-component v5.0.0 - Removes use of nodeLists
This removes the use ofcan-view-nodelist
from this package as nodeLists are no longer supported in CanJS. This is a breaking change, for compatibility with the other CanJS 6 libraries.
can-connect
- can-connect v4.0.0 - Removal of can-connect/tag/
This is a breaking release that movescan-connect/tag/
to its own repo, can-connect-tag.
can-connect-tag
can-control
can-deep-observable
can-define-realtime-rest-model
- can-define-realtime-rest-model v0.1.0
- can-define-realtime-rest-model v0.1.1
- can-define-realtime-rest-model v1.0.0
- can-define-realtime-rest-model v1.0.1
- can-define-realtime-rest-model v1.1.0
- can-define-realtime-rest-model v1.1.1
- can-define-realtime-rest-model v1.2.0
can-dom-mutate
- can-dom-mutate v2.0.0 - onNodeRemoved and onNodeInserted
This adds anonNodeRemoved
and anonNodeInserted
element that let you listen to when an element is removed from any parent or inserted into any parent. By any parent, we mean this works from parents that are in the document (connected) and not in the document. Although you must usedomMutateNode
for elements that are disconnected.
Let's break this down.
The following works:
var div = document.createElement("div");
// CONNECTED
document.body.append(div);
domMutate.onNodeRemoved( div , function(){
// CALLED!
});
div.remove();
The following works too:
// DISCONNECTED
var div = document.createElement("div");
domMutate.onNodeRemoved( div , function(){
// CALLED!
});
// USE domMutateNode
domMutateNode.removeChild.call(document.body, div );
The following does not work
// DISCONNECTED
var div = document.createElement("div");
domMutate.onNodeRemoved( div , function(){
// NOT CALLED!
});
div.remove();
This is NOT a breaking change, but it might affect your application's performance, so it is in a major release.
- can-dom-mutate v2.0.1
- can-dom-mutate v2.0.2
- can-dom-mutate v2.0.3
- can-dom-mutate v2.0.4 - Fixes race condition in tests
Race condition was caused by can-globalsMutationObserver
being turned off in the tests. This restores the listener for that. - can-dom-mutate v2.0.5 - Fix setting of SVG attributes
Change to use node.setAttributeNS for SVG attributes.
can-observable-array
- can-observable-array v1.0.0 - Initial release
This is the first major release of can-observable-array, a package for creating arrays that react to changes. It is the list counterpart to can-observable-object.
import { ObservableArray } from "can";
import Person from "./person";
class PeopleList extends ObservableArray {
static items = Person;
}
can-observable-bindings
- can-observable-bindings v1.0.0 - fromAttribute release
Releasecan-observable-bindings
withfromAttribute
usingattributeChangedCallback
for synchronous property changes.
<my-el name="Matt"></my-el>
Will output:
const element = document.querySelector("my-el")
console.log(element.name) //-> "Matt"
element.setAttribute("name", "Kevin")
console.log(element.name) //-> "Kevin"
- can-observable-bindings v1.0.1 - Removing unused dependency on can-log
canjs/can-observable-bindings#6 - can-observable-bindings v1.0.2
- can-observable-bindings v1.1.0 - Fix signature
Update signature to remove extra function and to allow optional custom attribute name and to add additional tests for camelCase properties. - can-observable-bindings v1.1.1 - Run tests only on browsers that support customElements
Prevent tests from running on browsers that do not support customElements. - can-observable-bindings v1.1.2
- [can-ob...
5.33.2
v5.33.1
v5.33.0
can-connect
can-control
can-fixture-socket
can-map-define
- can-map-define v4.4.0 - Add
resolver
behavior
This adds thevalue
behavior from DefineMap tocan-map-define
. Sincecan-map-define
already has a behavior namedvalue
(to set a starting value to a property), this new behavior has been namedresolver
instead.
can-ndjson-stream
can-reflect
can-simple-observable
can-type
can-vdom
can-view-scope
- can-view-scope v4.13.5 - Improve the “unable to find key” warning
Improves the missing key warning by logging of the property that can read for example:
var context = { foo: true };
var scope = new Scope(context);
var scopeKeyData = scope.computeData("foo.length", {
warnOnMissingKey: true
});
scopeKeyData.read(); // -> Unable to find key "foo.length". Found "foo" with value: true
- can-view-scope v4.13.6 - Handle undefined values on not found key warning
This fixes the not found key warning when a property is not defined in the scope:
var scope = new Scope({});
var scopeKeyData = scope.computeData("foo.length", {
warnOnMissingKey: true
});
scopeKeyData.read(); // -> Unable to find key "foo.length".
v5.32.0
New features
- can-bind v1.5.0 - Bind in domQueue
- can-define v2.8.0 - Add support for value and oldValue in events
- can-diff v1.5.0 - Include new patch-sort function
- can-dom-mutate v1.3.10
- can-observable-array v0.6.0
- can-observable-array v0.7.0
- can-observable-array v0.8.0
- can-observation v4.2.0 - Making it possible to order observation updates by their depth automatically
- can-queues v1.3.0 - Adding dom-queue
- can-simple-dom v1.7.0 - Add Compare document position
- can-type v0.2.0 - 0.2.0
Bug fixes
- can-attribute-observable v1.2.7 - Use getAttributeNS() for SVG properties
- can-bind v1.5.1 - Adding missing can-log dependency
- can-connect v3.2.2 - Remove npm version dependency
- can-dom-mutate v1.3.11 - Fix setting of SVG attributes
- can-event-queue v1.1.7
- can-map v4.3.9
- can-map-define v4.3.9
- can-observable-array v0.6.1 - Handle type definitions
- can-observable-array v0.6.2 - Fix docs
- can-observable-array v0.8.1 - updating docs to show first argument as an array and fixing examples
- can-observable-mixin v0.4.1 - export normalizeTypeDefinition
- can-observable-mixin v0.4.2 - Move export normalizeTypeDefinition
- can-observable-mixin v0.4.3
- can-observable-mixin v0.4.5 - Reverting change that made type conversion not work in production
- can-queues v1.3.1
- can-simple-observable v2.4.3 - Implementing setElement symbol on SetterObservable
- can-stache v4.17.20 - Named Partials render string result in stringOnly state
- can-type v0.2.1 - making type checking do type conversion in production
- can-type v0.2.2
- can-view-callbacks v4.4.1
- can-view-scope v4.13.3 - Implement can.setElement symbol
- can-view-scope v4.13.4 - Add links to scope.root deprecation warning
- can-view-scope v4.13.5 - Improve the “unable to find key” warning
v5.31.0
canjs/canjs v5.31.0 Release Notes
This release highlights an updated can-query-logic with support for new $all
, $and
, and $not
comparisons.
can-define
- can-define v2.7.21
- can-define v2.8.0 - Add support for value and oldValue in events
Dispatched events now have avalue
that represents the new value, and anoldValue
for the old value.
defineMap.listenTo("prop", (ev) => {
console.log("New value", ev.value, "Old value", ev.oldValue);
});
can-query-logic
- can-query-logic v1.2.0 - $all, $not, and $and
This adds support for 3 new comparison operators taken from Mongo's operators.
$all
The $all
comparison matches collections which contain all of the provided values. For example given the dataset:
[
{
"id": "Canada",
"colors": [ "red", "white" ]
},
{
"id": "Mexico",
"colors": [ "red", "white", "green" ]
},
{
"id": "USA",
"colors": [ "red", "white", "blue" ]
}
]
The query { colors: { $all: ["red", "white"] } }
would match all 3 entries. The query { colors: { $all: ["blue"] } }
would match only USA.
$not
The $not
comparison can be used to negate any other comparison. For example given the dataset:
[
{
"name": "Joe",
"age": 45
},
{
"name": "Zoey",
"age": 22
}
]
The query { age: { $not: { $lt: 40 } } }
matches Joe. It is exactly equivalent to { age: { $gte: 40 } }
.
$and
The $and
comparison combines multiple other comparisons into a single grouping. It can be used in combination with the two above comparisons like so. Given the dataset:
[
{
"id": "Canada",
"colors": [ "red", "white" ]
},
{
"id": "Mexico",
"colors": [ "red", "white", "green" ]
},
{
"id": "USA",
"colors": [ "red", "white", "blue" ]
}
]
The query { $and: [ { colors: { $all: ["red, "white"] } }, { colors: { $not: { $all: ["blue"] } } } ] }
matches Canada and Mexico.
- can-query-logic v1.2.1 - Document $all, $and, and $not
This adds docs for the new comparison operators.
v5.30.1
v5.30.0
New Ecosystem Packages
StacheElement, ObservableObject, ObservableArray
These are renamed versions of StacheDefineElement
, DefineObject
, and DefineArray
that support as static props
instead of static define
(static define
is also still aliased for apps that were using this).
class Pet extends ObservableObject {
static props = {
name: {
type: String,
required: true
}
};
}
class Pets extends ObservableArray {
static items = Pet;
}
class PetsApp extends StacheElement {
static view = `
{{#for(pet of pets)}}
<p>{{pet.name}}</p>
{{/for}}
`;
static props = {
pets: {
type: type.convert(Pets),
get default() {
return [{ name: "shadow" }, { name: "marshmallow" }];
}
}
};
}
customElements.define("pets-app", PetsApp);
can-construct-super
This package already existed, but the constructSuper
named export was added to the ecosystem module.
Removed Ecosystem Packages
can-stache-deifne-element
- this was removed but theStacheDefineElement
named export still exists (it is an alias forStacheElement
)can-define-object
- this was removed but theDefineObject
named export still exists (it is an alias forObservableObject
)can-define-array
- this was removed but theDefineArray
named export still exists (it is an alias forObservableArray
)
v5.29.7
Bug fixes
- can-define v2.7.20 - Fix warning code
- can-define-array v0.4.15
- can-define-mixin v0.3.12
- can-define-mixin v0.3.13
- can-define-mixin v0.3.14
- can-define-object v0.1.6
- can-define-object v0.1.7
- can-dom-data v1.0.3
- can-dom-data-state v1.1.2
- can-stache-bindings v4.10.9 - preventing events like on:click from creating viewmodels on normal elements
- can-stache-define-element v0.7.5
- can-stache-define-element v0.7.6
- can-type v0.1.11 - type.maybeConvert(Boolean) returns incorrect Schema
- can-type v0.1.12
- can-type v0.1.13