A functional and reactive JavaScript framework for predictable code
MIT License
Bot releases are hidden (Show)
Published by staltz over 9 years ago
To conform better with web components (such as in the Polymer framework), the API for custom elements in Cycle has been changed from:
h('my-element', {attributes: {age: 30}});
to
h('my-element', {age: 30});
Where the definition of my-element
used to be:
var MyElementComponent = Cycle.createView(function (Attributes) {
// do something with Attributes.get('age')
};
it should now be (this is not part of the breaking change, just a rename of the argument in order to express better the new change in semantics):
var MyElementComponent = Cycle.createView(function (Properties) {
// do something with Properties.get('age')
};
The reason for this breaking change is that: you might want to specify properties that are not under {attributes: ...}
but still use them internally in the component implementation. For instance, in v0.10 you had to do {attributes: {style: {color: color}}
where style would be translated to Attributes.get('style$')
and this doesn't make sense since normal elements in virtual-dom such as div should use the API {attributes: {...}, style: {color: color}}
with style outside of attributes.
Published by staltz over 9 years ago
Published by staltz over 9 years ago
Improved implementation for custom elements: there are no more container elements on the DOM for every custom element.
To register a custom element, you must provide a View, not just a DataFlowNode. This is minor breaking change. You need to replace Cycle.registerCustomElement('my-element', SomeDataFlowNode)
with Cycle.registerCustomElement('my-element', SomeView)
.
Published by staltz over 9 years ago
RxJS updated to 2.3.24
virtual-dom updated to 1.1.0
Published by staltz almost 10 years ago
Fixed bug: replacement mutation leakage from Views #67
Published by staltz almost 10 years ago
Fixes bug where custom elements couldn't be used inside custom elements #64
Breaking change to the API related to custom elements
Register the custom element on Cycle object, not on the Renderer:
// v0.8.x (before)
var renderer = Cycle.createRenderer('.container');
renderer.registerCustomElement('mybutton', dataFlowNode);
// v0.9.0 (now)
Cycle.registerCustomElement('mybutton', dataFlowNode);
This change should persist also when HTMLRenderer arrives, for server-side rendering. Cycle.registerCustomElement()
will instruct all instances of Renderer and all instances of HTMLRenderer to replace the tagName with the dataFlowNode implementation.
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Updated virtual-dom to 1.0.0.
No more interfaces array when declaring DataFlowNodes.
Interfaces are completely removed as a requirement for DataFlowNodes. Instead, use a getter to access properties of input DataFlowNodes, as such model.get('name$')
. When ES6 Proxy is available in browsers, we will use it to implement the getter and recover the original API of model.name$
. For now we must rely on explicit getters.
Removed events
array required output for Views.
Interaction events are dynamically detected whenever they are used by, e.g., Intents.
Removed circularInject()
, enhanced usage of inject()
Cycle.circularInject() was removed, but now a.inject(b)
will return b
so you can make circular dependencies using Intent.inject(View).inject(Model).inject(Intent)
.
Replaced 'ev-click'
with onclick
for exported interaction events in Views.
We now favor the DOM's native way of working rather than virtual-dom jargon. Also the dom-delegator
dependency was removed as consequence.
In summary, before in v0.7.0:
var View = Cycle.createView(['name$'], function (model) {
return {
vtree$: model.name$.map(function (name) {
return h('h1', {'ev-click': 'nameClicks$'}, name);
}),
events: ['nameClicks$']
};
});
Cycle.circularInject(Model, View, Intent);
Now in v0.8.0:
var View = Cycle.createView(function (model) { // no interface array
return {
// notice model.get('name$') instead of model.name$
vtree$: model.get('name$').map(function (name) {
return h('h1', {onclick: 'nameClicks$'}, name); // onclick
})
// no more events array
};
});
Intent.inject(View).inject(Model).inject(Intent); // no more circularInject()
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Published by staltz almost 10 years ago
Breaking changes
define___
functions to create___
in the Cycle APIrenderEvery()
with Cycle.createRenderer().inject()
Improvements
DataFlowSink
for containing side effects, e.g. RendererBug fixes
Published by staltz almost 10 years ago
Breaking changes
BackwardFunction
to DataFlowNode
Cycle.link()
to Cycle.circularInject()
Improvements
Bug fixes
Published by staltz almost 10 years ago