@mintjamsinc/ichigojs 0.1.73 → 0.1.74
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 +1 -1
- package/dist/ichigo.cjs +42 -7
- package/dist/ichigo.cjs.map +1 -1
- package/dist/ichigo.esm.js +42 -7
- package/dist/ichigo.esm.js.map +1 -1
- package/dist/ichigo.esm.min.js +1 -1
- package/dist/ichigo.min.cjs +1 -1
- package/dist/ichigo.umd.js +42 -7
- package/dist/ichigo.umd.js.map +1 -1
- package/dist/ichigo.umd.min.js +1 -1
- package/dist/types/ichigo/VBindings.d.ts +11 -0
- package/package.json +1 -1
package/dist/ichigo.umd.js
CHANGED
|
@@ -8440,6 +8440,13 @@
|
|
|
8440
8440
|
* Flag to suppress onChange callbacks temporarily.
|
|
8441
8441
|
*/
|
|
8442
8442
|
#suppressOnChange = false;
|
|
8443
|
+
/**
|
|
8444
|
+
* Flag forcing the next write through the `set` trap to stay in THIS scope's own
|
|
8445
|
+
* local store instead of walking up to an inherited binding of the same name.
|
|
8446
|
+
* Set only by {@link setLocal} for scope-local variables (e.g. v-for loop items),
|
|
8447
|
+
* which must shadow — never overwrite — a parent binding with the same key.
|
|
8448
|
+
*/
|
|
8449
|
+
#localWrite = false;
|
|
8443
8450
|
/**
|
|
8444
8451
|
* Per-instance path aliases. Maps local variable names to their reactive source paths.
|
|
8445
8452
|
* Scoped here instead of the global ReactiveProxy map so that v-for items each maintain
|
|
@@ -8518,8 +8525,13 @@
|
|
|
8518
8525
|
setter(value);
|
|
8519
8526
|
return true;
|
|
8520
8527
|
}
|
|
8528
|
+
// For a key that is not local to this scope, an assignment normally
|
|
8529
|
+
// retargets to the nearest parent that owns it, so reassignments
|
|
8530
|
+
// (e.g. `count = count + 1` in a handler) mutate the original binding.
|
|
8531
|
+
// A scope-local write (setLocal — used for v-for loop variables) skips
|
|
8532
|
+
// this walk so the variable shadows, never clobbers, an inherited key.
|
|
8521
8533
|
let target = obj;
|
|
8522
|
-
if (!Reflect.has(target, key)) {
|
|
8534
|
+
if (!this.#localWrite && !Reflect.has(target, key)) {
|
|
8523
8535
|
for (let parent = this.#parent; parent; parent = parent.#parent) {
|
|
8524
8536
|
if (Reflect.has(parent.#local, key)) {
|
|
8525
8537
|
target = parent.#local;
|
|
@@ -8694,6 +8706,25 @@
|
|
|
8694
8706
|
set(key, value) {
|
|
8695
8707
|
this.#local[key] = value;
|
|
8696
8708
|
}
|
|
8709
|
+
/**
|
|
8710
|
+
* Sets a binding value in THIS scope's own local store, without walking up to a
|
|
8711
|
+
* parent scope. Used for scope-local variables (e.g. v-for loop items) that must
|
|
8712
|
+
* shadow — never overwrite — an inherited binding of the same name. Contrast with
|
|
8713
|
+
* {@link set}, which retargets a write of an inherited key to the owning parent so
|
|
8714
|
+
* that reassignments mutate the original; a loop variable named like a root data /
|
|
8715
|
+
* method / computed key (e.g. `t`) would otherwise clobber it.
|
|
8716
|
+
* @param key The binding name.
|
|
8717
|
+
* @param value The binding value.
|
|
8718
|
+
*/
|
|
8719
|
+
setLocal(key, value) {
|
|
8720
|
+
this.#localWrite = true;
|
|
8721
|
+
try {
|
|
8722
|
+
this.#local[key] = value;
|
|
8723
|
+
}
|
|
8724
|
+
finally {
|
|
8725
|
+
this.#localWrite = false;
|
|
8726
|
+
}
|
|
8727
|
+
}
|
|
8697
8728
|
/**
|
|
8698
8729
|
* Gets a binding value.
|
|
8699
8730
|
* @param key The binding name.
|
|
@@ -10789,26 +10820,30 @@
|
|
|
10789
10820
|
* Sets item bindings for a VNode, handling nested destructuring if needed.
|
|
10790
10821
|
*/
|
|
10791
10822
|
#setItemBindings(bindings, context) {
|
|
10823
|
+
// Loop variables are scope-local: they must shadow, never overwrite, an
|
|
10824
|
+
// inherited binding of the same name (a data / method / computed key on a
|
|
10825
|
+
// parent scope). setLocal writes to this iteration's own store so a loop
|
|
10826
|
+
// variable named like e.g. the i18n helper `t` cannot clobber it.
|
|
10792
10827
|
if (this.#itemDestructure && Array.isArray(context.item)) {
|
|
10793
10828
|
// Nested destructuring: spread array items to individual bindings
|
|
10794
10829
|
// e.g., item = ['alice', 1] with itemDestructure = ['k', 'v']
|
|
10795
|
-
// bindings.
|
|
10796
|
-
// bindings.
|
|
10830
|
+
// bindings.setLocal('k', 'alice')
|
|
10831
|
+
// bindings.setLocal('v', 1)
|
|
10797
10832
|
this.#itemDestructure.forEach((name, i) => {
|
|
10798
|
-
bindings.
|
|
10833
|
+
bindings.setLocal(name, context.item[i]);
|
|
10799
10834
|
});
|
|
10800
10835
|
}
|
|
10801
10836
|
else if (this.#itemName) {
|
|
10802
10837
|
// Simple item binding
|
|
10803
|
-
bindings.
|
|
10838
|
+
bindings.setLocal(this.#itemName, context.item);
|
|
10804
10839
|
}
|
|
10805
10840
|
if (this.#indexName) {
|
|
10806
10841
|
// For objects, use objectKey if available; otherwise use numeric index
|
|
10807
|
-
bindings.
|
|
10842
|
+
bindings.setLocal(this.#indexName, context.objectKey ?? context.index);
|
|
10808
10843
|
}
|
|
10809
10844
|
if (this.#thirdName) {
|
|
10810
10845
|
// Third argument is always the numeric index
|
|
10811
|
-
bindings.
|
|
10846
|
+
bindings.setLocal(this.#thirdName, context.index);
|
|
10812
10847
|
}
|
|
10813
10848
|
}
|
|
10814
10849
|
/**
|