rasti 4.2.0 → 4.2.1
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 +22 -13
- 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 -4
- package/es/Component.js.map +1 -1
- package/es/View.js +4 -4
- package/es/View.js.map +1 -1
- package/es/index.js +1 -1
- package/es/utils/assignOption.js +26 -0
- package/es/utils/assignOption.js.map +1 -0
- package/lib/Component.cjs +4 -4
- package/lib/Component.cjs.map +1 -1
- package/lib/View.cjs +4 -4
- package/lib/View.cjs.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/utils/assignOption.cjs +28 -0
- package/lib/utils/assignOption.cjs.map +1 -0
- package/package.json +1 -1
- package/src/Component.js +4 -4
- package/src/View.js +4 -4
- package/src/utils/assignOption.js +25 -0
- package/es/utils/defineOwn.js +0 -17
- package/es/utils/defineOwn.js.map +0 -1
- package/lib/utils/defineOwn.cjs +0 -19
- package/lib/utils/defineOwn.cjs.map +0 -1
- package/src/utils/defineOwn.js +0 -16
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.2.
|
|
4
|
-
<img alt="Rasti.js" src="https://cdn.jsdelivr.net/gh/8tentaculos/rasti@v4.2.
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/8tentaculos/rasti@v4.2.1/docs/logo-dark.svg">
|
|
4
|
+
<img alt="Rasti.js" src="https://cdn.jsdelivr.net/gh/8tentaculos/rasti@v4.2.1/docs/logo.svg" height="120">
|
|
5
5
|
</picture>
|
|
6
6
|
</p>
|
|
7
7
|
|
package/dist/rasti.js
CHANGED
|
@@ -755,19 +755,28 @@
|
|
|
755
755
|
Model.attributePrefix = '';
|
|
756
756
|
|
|
757
757
|
/**
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
761
|
-
* @param {object} target Object to
|
|
758
|
+
* Assign an option to `target`. A getter with no setter on the prototype would make the
|
|
759
|
+
* assignment throw, so in that case `key` is defined as an own data property, which
|
|
760
|
+
* shadows the getter. Any other accessor receives the value through its setter.
|
|
761
|
+
* @param {object} target Object to assign the option to.
|
|
762
762
|
* @param {string} key Property name.
|
|
763
763
|
* @param {any} value Property value.
|
|
764
764
|
* @return {object} The target object.
|
|
765
765
|
* @module
|
|
766
766
|
* @private
|
|
767
767
|
*/
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
|
|
768
|
+
const assignOption = (target, key, value) => {
|
|
769
|
+
try {
|
|
770
|
+
target[key] = value;
|
|
771
|
+
} catch (error) {
|
|
772
|
+
// Assigning to a getter with no setter throws a TypeError; anything else propagates.
|
|
773
|
+
if (!(error instanceof TypeError)) throw error;
|
|
774
|
+
Object.defineProperty(target, key, {
|
|
775
|
+
value, writable : true, enumerable : true, configurable : true
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
return target;
|
|
779
|
+
};
|
|
771
780
|
|
|
772
781
|
/*
|
|
773
782
|
* These option keys will be extended on the view instance.
|
|
@@ -838,11 +847,11 @@
|
|
|
838
847
|
// Mutable array to store handlers to be called on destroy.
|
|
839
848
|
this.destroyQueue = [];
|
|
840
849
|
this.viewOptions = [];
|
|
841
|
-
// Extend "this" with options
|
|
842
|
-
//
|
|
850
|
+
// Extend "this" with options. An option overrides a getter declared by a
|
|
851
|
+
// subclass even when the getter has no setter.
|
|
843
852
|
viewOptions.forEach(key => {
|
|
844
853
|
if (key in options) {
|
|
845
|
-
|
|
854
|
+
assignOption(this, key, options[key]);
|
|
846
855
|
this.viewOptions.push(key);
|
|
847
856
|
}
|
|
848
857
|
});
|
|
@@ -2424,11 +2433,11 @@
|
|
|
2424
2433
|
constructor(options = {}) {
|
|
2425
2434
|
super(...arguments);
|
|
2426
2435
|
this.componentOptions = [];
|
|
2427
|
-
// Extend "this" with options
|
|
2428
|
-
//
|
|
2436
|
+
// Extend "this" with options. An option overrides a getter declared by a
|
|
2437
|
+
// subclass even when the getter has no setter.
|
|
2429
2438
|
componentOptions.forEach(key => {
|
|
2430
2439
|
if (key in options) {
|
|
2431
|
-
|
|
2440
|
+
assignOption(this, key, options[key]);
|
|
2432
2441
|
this.componentOptions.push(key);
|
|
2433
2442
|
}
|
|
2434
2443
|
});
|