Matreshka.js fills the gap between juna and seigneur formed in recent years
A beta of the second version of the framework Matreshka.js has been released. The release will be released in a week (plus a couple of days) after the last patch, the report begins with the release of this post. The version can be considered stable, and the beta status - pure formality, since the project was in prealpha / alpha status for quite a long time and without major changes and was tested in real projects.
Instead of the naive "JavaScript framework for all", Matreshka.js is now positioned as the "Simple June Framework". Let me, instead of duplicating the text from the site, place a link to the text explaining this point in more detail.
const bindNode = require('matreshka/bindnode'); bindNode(object, key, node);
Previously, for the release of a new release, we had to perform several repetitive actions:
Therefore, I was in no hurry to make a release if the change corrected the problem, which can be regarded as "minor", but preferred to accumulate a list of changes and release a new version on the weekend (of course, fixes for critical problems came out as soon as possible).
Due to the inclusion of a semantic-release project, the use of Travis CI and other changes (for example, the removal of the Russian-language changelog), releases are made using a very simple scheme.
Moreover, getting new features into the framework itself is unlikely (more on that below), so the last and penultimate paragraphs can be ignored.
After a commit with the fix prefix or feat gets on Github, the following happens:
Do not be surprised if you see several patches made on the same day (I hope that such cases will be rare).
In turn, for any commit to the site repository , Travis will automatically deploy the site to the server using PM2 .
The biggest change was the removal of many functions that were not to the village, not to the city (for example, the trim
function).
Why did these functions even exist? The motivation was simple: they were needed for the internal mechanisms of the framework and, if these functions are already there, why not add them to the framework's public API?
As a result, the documentation has become very bloated, which not very pleasantly affected the ease of familiarization with the framework, many useful methods were lost in information noise, and the ability to remove such functions was lost (since this is a breaking change).
Starting from the second version of Matreshka.js includes features specific to the framework itself, but does not include any "common" functions. About the specific reasons for the removal of some methods, I wrote on the forum .
New features, rather, will come out in the form of additional plug-ins and libraries than fall into the framework itself (although the latter is not excluded).
API changes are described below very briefly, so as not to duplicate the text of the documentation.
(!!!) - breaking changes
(!) - breaking changes that most likely will not affect old applications
Matreshka.delay
Matreshka#delay
Matreshka.define
Matreshka#define
Matreshka.defineSetter
Matreshka#defineSetter
Matreshka.defineGetter
Matreshka#defineGetter
Matreshka#getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything
Matreshka.trim
Matreshka.orderBy
Matreshka.noop
Matreshka.extend
Matreshka.each
Matreshka.bound
Matreshka#bound
Matreshka.$bound
Matreshka#$bound
Matreshka.boundAll
Matreshka#boundAll
Matreshka.randomString
( now lives here )Matreshka.get
Matreshka#get
Matreshka.deepFind
Matreshka.setProto
Matreshka.toArray
Matreshka.version
Matreshka#sandbox
Matreshka#$sandbox
Matreshka.Object#toNative
Matreshka.Object#toObject
Matreshka.Array#toNative
Matreshka.Array#toArray
Matreshka.binders.file
( now lives here )Matreshka.binders.dropFile
( now lives here )Matreshka.binders.dragOver
( now lives here )Matreshka.Array#each
Matreshka.Array#hasOwnProperty
Matreshka.Array#useBindingsParser
Matreshka.Object#hasOwnProperty
window.Class
(use Matreshka.Class
instead of global variable)window.$b
, Matreshka.$b
Matreshka.$
matreshka-magic
libraryMatreshka.binders.innerHTML
Matreshka.binders.innerText
Matreshka.binders.attribute
Matreshka.binders.property
Matreshka#linkProps
-> Matreshka#calc
Matreshka.to
-> Matreshka.toMatreshka
Matreshka#setClassFor
-> Matreshka#instantiate
Matreshka.Object#jset
-> Matreshka.Object#setData
( jset
not removed)Matreshka#isMK
-> Matreshka#isMatreshka
Matreshka.Object#isMKObject
-> Matreshka.Object#isMatreshkaObject
Matreshka.Array#isMKArray
-> Matreshka#isMatreshkaArray
Matreshka.useAs$
-> Matreshka.useDOMLibrary
bindNode
and unbindNode
{ key: [node, binder] }
no longer supported.([{key, node, binder, event}], commonEventOptions)
.{key: { node, binder }}
and {key: [{ node, binder }]}
. (Eureka! This syntax allows you to beautifully hang many bayindings with a single call to bindNode
).bind
, bind:KEY
are called on each associated node.unbind
, unbind:KEY
are called on each untied node.useExactBinder
.assignDefaultValue
flag has assignDefaultValue
renamed to getValueOnBind
.setValueOnBind
.debounce
flag has been removed.debounceSetValue
flag.debounceGetValue
flag.debounceSetValueOnBind
flag.debounceGetValueOnBind
flag.debounceGetValueDelay
flag.debounceSetValueDelay
flag.exactKey
flag instead of deep
.See the bindNode and unbindNode documentation for details.
destroy
.className
no longer supports exclamation mark syntax. Instead, you can pass false
as the second argument.bindingOptions
argument for all binder methods (for example, getValue(bindingOptions) {...}
).See the bindNode and binders documentation for details.
parseBindings
eventOptions
second argument.{{}}
not replaced by the span
element.{{ }}
.See the parseBindings documentation for details.
bindSandbox
See the bindSandbox documentation for details.
calc
method (formerly called linkProps
)debounce
flag is renamed to debounceCalc
.debounceCalc
defaults to true
.debounceCalcOnInit
.exactKey
flag.skipLinks
flag has skipLinks
renamed skipCalc
for use in the set
method.[inst, key, inst, key]
removed.{ target: {source, event, handler} }
(Eureka! You can call the calc
method once for many properties).[{object, key}]
.debounceCalcDelay
flag.See the calc documentation for details.
Matreshka.Array
skipMediator
flag has skipMediator
renamed to skipItemMediator
.pull
method supports only objects and numbers.from
and of
now inherited.addone
event addone
contains the added object under the addedItem
property instead of the added
.removeone
contains the deleted object under the removedItem
property instead of the removed
.itemRenderer
does not turn into a span
if it contains several nodes; instead, an exception is thrown.useBindingsParser
property has useBindingsParser
removed.includes
.find
methodfindIndex
method.fill
method.copyWithin
method.keys
method.values
.entries
.For details, refer to the documentation Matreshka.Array , pull , from , of , itemRenderer , METHOD .
Matreshka.Object
set
event that is triggered by a change in the properties (but not the deletion) responsible for the data.jset
method has jset
renamed to setData
(at the request of the community, the old name will still be present).replaceData
flag for the setData
method.isDataKey
method.values
.entries
.For details, see the Matreshka.Object , setData , isDataKey , values , entries documentation.
Matreshka.Class
symbol
type names are supported both as prototype properties and as static properties.See the Matreshka.Class documentation for details.
sandbox
properties generate an exception for all objects.container
generate an exception for Matreshka.Array
instances.import text from 'matreshka/binders/text'
)for
loop instead of calling Object.assign
.for
loop.Matreshka.randomString
).Matreshka.$b.create
).Thanks for attention!
Source: https://habr.com/ru/post/312274/
All Articles