📜 ⬆️ ⬇️

Matreshka.js 2 - the easiest framework in the universe

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.



» Repository
» Website


Positioning the framework


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.


General changes



const bindNode = require('matreshka/bindnode'); bindNode(object, key, node); 



Automate the process of releasing new versions


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 .


Other Reformations



API changes


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


What was removed


  1. (!!!) Matreshka.delay
  2. (!!!) Matreshka#delay
  3. (!!!) Matreshka.define
  4. (!!!) Matreshka#define
  5. (!!!) Matreshka.defineSetter
  6. (!!!) Matreshka#defineSetter
  7. (!!!) Matreshka.defineGetter
  8. (!!!) Matreshka#defineGetter
  9. (!!!) Matreshka#getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything
  10. (!!!) Matreshka.trim
  11. (!!!) Matreshka.orderBy
  12. (!!!) Matreshka.noop
  13. (!!!) Matreshka.extend
  14. (!!!) Matreshka.each
  15. (!!!) Matreshka.bound
  16. (!!!) Matreshka#bound
  17. (!!!) Matreshka.$bound
  18. (!!!) Matreshka#$bound
  19. (!!!) Matreshka.boundAll
  20. (!!!) Matreshka#boundAll
  21. (!!!) Matreshka.randomString ( now lives here )
  22. (!!!) Matreshka.get
  23. (!!!) Matreshka#get
  24. (!!!) Matreshka.deepFind
  25. (!!!) Matreshka.setProto
  26. (!!!) Matreshka.toArray
  27. (!!!) Matreshka.version
  28. (!!!) Matreshka#sandbox
  29. (!!!) Matreshka#$sandbox
  30. (!!!) Matreshka.Object#toNative
  31. (!!!) Matreshka.Object#toObject
  32. (!!!) Matreshka.Array#toNative
  33. (!!!) Matreshka.Array#toArray
  34. (!!!) Matreshka.binders.file ( now lives here )
  35. (!!!) Matreshka.binders.dropFile ( now lives here )
  36. (!!!) Matreshka.binders.dragOver ( now lives here )
  37. (!!!) Matreshka.Array#each
  38. (!!!) Matreshka.Array#hasOwnProperty
  39. (!!!) Matreshka.Array#useBindingsParser
  40. (!!!) Matreshka.Object#hasOwnProperty
  41. (!!!) window.Class (use Matreshka.Class instead of global variable)
  42. (!!!) window.$b , Matreshka.$b
  43. (!!!) Matreshka.$
  44. (!!!) matreshka-magic library
  45. (!!!) Matreshka.binders.innerHTML
  46. (!!!) Matreshka.binders.innerText
  47. (!!!) Matreshka.binders.attribute
  48. (!!!) Matreshka.binders.property

Renamed methods and properties


  1. (!!!) Matreshka#linkProps -> Matreshka#calc
  2. (!!!) Matreshka.to -> Matreshka.toMatreshka
  3. (!!!) Matreshka#setClassFor -> Matreshka#instantiate
  4. Matreshka.Object#jset -> Matreshka.Object#setData ( jset not removed)
  5. (!!!) Matreshka#isMK -> Matreshka#isMatreshka
  6. (!!!) Matreshka.Object#isMKObject -> Matreshka.Object#isMatreshkaObject
  7. (!!!) Matreshka.Array#isMKArray -> Matreshka#isMatreshkaArray
  8. (!!!) Matreshka.useAs$ -> Matreshka.useDOMLibrary

Changes in bindNode and unbindNode


  1. (!!!) The syntax { key: [node, binder] } no longer supported.
  2. (!!!) The heap of arguments syntax is no longer supported.
  3. New syntax ([{key, node, binder, event}], commonEventOptions) .
  4. New syntax {key: { node, binder }} and {key: [{ node, binder }]} . (Eureka! This syntax allows you to beautifully hang many bayindings with a single call to bindNode ).
  5. (!) Events bind , bind:KEY are called on each associated node.
  6. (!) unbind , unbind:KEY are called on each untied node.
  7. Flag useExactBinder .
  8. (!!!) The assignDefaultValue flag has assignDefaultValue renamed to getValueOnBind .
  9. Flag setValueOnBind .
  10. (!!!) The debounce flag has been removed.
  11. (!) The debounceSetValue flag.
  12. (!) The debounceGetValue flag.
  13. The debounceSetValueOnBind flag.
  14. The debounceGetValueOnBind flag.
  15. The debounceGetValueDelay flag.
  16. The debounceSetValueDelay flag.
  17. (!!!) exactKey flag instead of deep .

See the bindNode and unbindNode documentation for details.


Binder Changes


  1. New binder method destroy .
  2. (!!!) Binder className no longer supports exclamation mark syntax. Instead, you can pass false as the second argument.
  3. The bindingOptions argument for all binder methods (for example, getValue(bindingOptions) {...} ).

See the bindNode and binders documentation for details.


parseBindings


  1. The method accepts eventOptions second argument.
  2. {{}} not replaced by the span element.
  3. (!!!) The first argument is required.
  4. Spaces can be used inside {{ }} .

See the parseBindings documentation for details.


bindSandbox


  1. Now the method untie the previous sandbox, before tying a new one.

See the bindSandbox documentation for details.


Changes in the calc method (formerly called linkProps )


  1. (!!!) The debounce flag is renamed to debounceCalc .
  2. (!) debounceCalc defaults to true .
  3. Flag debounceCalcOnInit .
  4. exactKey flag.
  5. (!!!) The skipLinks flag has skipLinks renamed skipCalc for use in the set method.
  6. (!!!) Syntax [inst, key, inst, key] removed.
  7. The new syntax { target: {source, event, handler} } (Eureka! You can call the calc method once for many properties).
  8. New syntax [{object, key}] .
  9. The debounceCalcDelay flag.

See the calc documentation for details.


Changes in Matreshka.Array


  1. (!!!) The skipMediator flag has skipMediator renamed to skipItemMediator .
  2. (!) The pull method supports only objects and numbers.
  3. from and of now inherited.
  4. (!!!) The addone event addone contains the added object under the addedItem property instead of the added .
  5. (!!!) The event object removeone contains the deleted object under the removedItem property instead of the removed .
  6. (!) itemRenderer does not turn into a span if it contains several nodes; instead, an exception is thrown.
  7. The useBindingsParser property has useBindingsParser removed.
  8. (!!!) The parser of banding is enabled by default.
  9. The method includes .
  10. find method
  11. The findIndex method.
  12. The fill method.
  13. The copyWithin method.
  14. The keys method.
  15. Method values .
  16. Method entries .

For details, refer to the documentation Matreshka.Array , pull , from , of , itemRenderer , METHOD .


Changes in Matreshka.Object


  1. A set event that is triggered by a change in the properties (but not the deletion) responsible for the data.
  2. The jset method has jset renamed to setData (at the request of the community, the old name will still be present).
  3. The replaceData flag for the setData method.
  4. The isDataKey method.
  5. Method values .
  6. Method entries .

For details, see the Matreshka.Object , setData , isDataKey , values , entries documentation.


Changes in Matreshka.Class


  1. Static methods are inherited.
  2. Properties with symbol type names are supported both as prototype properties and as static properties.

See the Matreshka.Class documentation for details.


Other changes


  1. Static chain method.
  2. (!!!) Getter and setter sandbox properties generate an exception for all objects.
  3. (!!!) The getter and the setter properties of the container generate an exception for Matreshka.Array instances.
  4. (!!!) "The list of keys separated by spaces" is no longer supported by any method.
  5. Fixed some non-obvious bugs
  6. All classes and functions can be imported as a CommonJS module ( import text from 'matreshka/binders/text' )
  7. Understandable errors.

Projects that have appeared thanks to the work on Matreshka.js



Thanks for attention!


')

Source: https://habr.com/ru/post/312274/


All Articles