rasti 4.1.2 → 4.1.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/rasti.js +26 -5
- package/dist/rasti.js.map +1 -1
- package/dist/rasti.min.js +1 -1
- package/dist/rasti.min.js.map +1 -1
- package/es/Component.js +4 -2
- package/es/Component.js.map +1 -1
- package/es/View.js +4 -2
- package/es/View.js.map +1 -1
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/utils/defineOwn.js +17 -0
- package/es/utils/defineOwn.js.map +1 -0
- package/es/utils/parseHTML.js +5 -1
- package/es/utils/parseHTML.js.map +1 -1
- package/lib/Component.cjs +4 -2
- package/lib/Component.cjs.map +1 -1
- package/lib/View.cjs +4 -2
- package/lib/View.cjs.map +1 -1
- package/lib/index.cjs +1 -0
- package/lib/index.cjs.map +1 -1
- package/lib/utils/defineOwn.cjs +19 -0
- package/lib/utils/defineOwn.cjs.map +1 -0
- package/lib/utils/parseHTML.cjs +5 -1
- package/lib/utils/parseHTML.cjs.map +1 -1
- package/package.json +1 -1
- package/src/Component.js +4 -2
- package/src/View.js +4 -2
- package/src/utils/defineOwn.js +16 -0
- package/src/utils/parseHTML.js +5 -1
- package/types/Component.d.ts +45 -13
- package/types/Model.d.ts +19 -9
- package/types/View.d.ts +70 -20
- package/types/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/8tentaculos/rasti@v4.1.
|
|
4
|
-
<img alt="Rasti.js" src="https://cdn.jsdelivr.net/gh/8tentaculos/rasti@v4.1.
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/8tentaculos/rasti@v4.1.3-alpha.0/docs/logo-dark.svg">
|
|
4
|
+
<img alt="Rasti.js" src="https://cdn.jsdelivr.net/gh/8tentaculos/rasti@v4.1.3-alpha.0/docs/logo.svg" height="120">
|
|
5
5
|
</picture>
|
|
6
6
|
</p>
|
|
7
7
|
|
package/dist/rasti.js
CHANGED
|
@@ -754,6 +754,21 @@
|
|
|
754
754
|
*/
|
|
755
755
|
Model.attributePrefix = '';
|
|
756
756
|
|
|
757
|
+
/**
|
|
758
|
+
* Define `key` on `target` as an own data property. Unlike an assignment, it does not go
|
|
759
|
+
* through an accessor declared on the prototype, so it shadows a getter with no setter
|
|
760
|
+
* instead of throwing.
|
|
761
|
+
* @param {object} target Object to define the property on.
|
|
762
|
+
* @param {string} key Property name.
|
|
763
|
+
* @param {any} value Property value.
|
|
764
|
+
* @return {object} The target object.
|
|
765
|
+
* @module
|
|
766
|
+
* @private
|
|
767
|
+
*/
|
|
768
|
+
const defineOwn = (target, key, value) => Object.defineProperty(target, key, {
|
|
769
|
+
value, writable : true, enumerable : true, configurable : true
|
|
770
|
+
});
|
|
771
|
+
|
|
757
772
|
/*
|
|
758
773
|
* These option keys will be extended on the view instance.
|
|
759
774
|
*/
|
|
@@ -823,10 +838,11 @@
|
|
|
823
838
|
// Mutable array to store handlers to be called on destroy.
|
|
824
839
|
this.destroyQueue = [];
|
|
825
840
|
this.viewOptions = [];
|
|
826
|
-
// Extend "this" with options
|
|
841
|
+
// Extend "this" with options, as own properties so an option overrides
|
|
842
|
+
// a getter declared by a subclass instead of being assigned through it.
|
|
827
843
|
viewOptions.forEach(key => {
|
|
828
844
|
if (key in options) {
|
|
829
|
-
this
|
|
845
|
+
defineOwn(this, key, options[key]);
|
|
830
846
|
this.viewOptions.push(key);
|
|
831
847
|
}
|
|
832
848
|
});
|
|
@@ -1699,6 +1715,10 @@
|
|
|
1699
1715
|
|
|
1700
1716
|
/**
|
|
1701
1717
|
* Parse HTML string to a DocumentFragment.
|
|
1718
|
+
*
|
|
1719
|
+
* The string is parsed as written. A component's markup already reaches here
|
|
1720
|
+
* without surrounding whitespace, and the content of an interpolation is the
|
|
1721
|
+
* rendered value itself, whose leading and trailing whitespace is significant.
|
|
1702
1722
|
* @param {string} html The HTML string to parse.
|
|
1703
1723
|
* @return {DocumentFragment} The parsed DocumentFragment.
|
|
1704
1724
|
* @module
|
|
@@ -1706,7 +1726,7 @@
|
|
|
1706
1726
|
*/
|
|
1707
1727
|
function parseHTML(html) {
|
|
1708
1728
|
const fragment = document.createElement('template');
|
|
1709
|
-
fragment.innerHTML = `${html}
|
|
1729
|
+
fragment.innerHTML = `${html}`;
|
|
1710
1730
|
return fragment.content;
|
|
1711
1731
|
}
|
|
1712
1732
|
|
|
@@ -2404,10 +2424,11 @@
|
|
|
2404
2424
|
constructor(options = {}) {
|
|
2405
2425
|
super(...arguments);
|
|
2406
2426
|
this.componentOptions = [];
|
|
2407
|
-
// Extend "this" with options
|
|
2427
|
+
// Extend "this" with options, as own properties so an option overrides
|
|
2428
|
+
// a getter declared by a subclass instead of being assigned through it.
|
|
2408
2429
|
componentOptions.forEach(key => {
|
|
2409
2430
|
if (key in options) {
|
|
2410
|
-
this
|
|
2431
|
+
defineOwn(this, key, options[key]);
|
|
2411
2432
|
this.componentOptions.push(key);
|
|
2412
2433
|
}
|
|
2413
2434
|
});
|