gyosjs 0.5.0 → 0.5.2
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/core/reactive.d.ts.map +1 -1
- package/dist/gyos.auto.esm.js +89 -9
- package/dist/gyos.auto.esm.js.map +1 -1
- package/dist/gyos.auto.js +89 -9
- package/dist/gyos.auto.js.map +1 -1
- package/dist/gyos.auto.min.js +2 -2
- package/dist/gyos.csp.auto.esm.js +89 -9
- package/dist/gyos.csp.auto.esm.js.map +1 -1
- package/dist/gyos.csp.auto.js +89 -9
- package/dist/gyos.csp.auto.js.map +1 -1
- package/dist/gyos.csp.auto.min.js +2 -2
- package/dist/gyos.csp.esm.js +89 -9
- package/dist/gyos.csp.esm.js.map +1 -1
- package/dist/gyos.csp.js +89 -9
- package/dist/gyos.csp.js.map +1 -1
- package/dist/gyos.csp.min.js +2 -2
- package/dist/gyos.esm.js +89 -9
- package/dist/gyos.esm.js.map +1 -1
- package/dist/gyos.js +89 -9
- package/dist/gyos.js.map +1 -1
- package/dist/gyos.min.js +2 -2
- package/dist/template/structurals/keyed-placement.d.ts +3 -0
- package/dist/template/structurals/keyed-placement.d.ts.map +1 -0
- package/dist/template/structurals/structural.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/gyos.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* GyosJS v0.5.
|
|
2
|
+
* GyosJS v0.5.2
|
|
3
3
|
* (c) 2026
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -4127,7 +4127,7 @@
|
|
|
4127
4127
|
// Set initial value (no pipes in v-model)
|
|
4128
4128
|
const initialValue = evaluateExpression(expr, currentScope, false);
|
|
4129
4129
|
if (inputElement.type === 'checkbox') {
|
|
4130
|
-
inputElement.checked = !!initialValue;
|
|
4130
|
+
inputElement.checked = !!unref(initialValue);
|
|
4131
4131
|
}
|
|
4132
4132
|
else if (inputElement.type === 'radio') {
|
|
4133
4133
|
inputElement.checked = String(unref(initialValue)) === inputElement.value;
|
|
@@ -4173,7 +4173,7 @@
|
|
|
4173
4173
|
// No pipes in v-model reactive updates
|
|
4174
4174
|
const newValue = evaluateExpression(expr, currentScope, false);
|
|
4175
4175
|
if (inputElement.type === 'checkbox') {
|
|
4176
|
-
inputElement.checked = !!newValue;
|
|
4176
|
+
inputElement.checked = !!unref(newValue);
|
|
4177
4177
|
}
|
|
4178
4178
|
else if (inputElement.type === 'radio') {
|
|
4179
4179
|
inputElement.checked = String(unref(newValue)) === inputElement.value;
|
|
@@ -4404,6 +4404,15 @@
|
|
|
4404
4404
|
// It's a getter - just return value, getter will track its own dependencies
|
|
4405
4405
|
return value;
|
|
4406
4406
|
}
|
|
4407
|
+
// Callable reactive values are data, not methods. Binding would drop
|
|
4408
|
+
// their identity and metadata used by g-model and the public APIs.
|
|
4409
|
+
if (isSignal(value) || isComputed(value)) {
|
|
4410
|
+
// Track the field as well as reads of its value so replacing the
|
|
4411
|
+
// signal/computed switches effects away from the old source.
|
|
4412
|
+
if (hasCurrentEffect())
|
|
4413
|
+
getFieldSignal(target, key, value).value;
|
|
4414
|
+
return value;
|
|
4415
|
+
}
|
|
4407
4416
|
// function -> bind this = proxy
|
|
4408
4417
|
if (typeof value === "function") {
|
|
4409
4418
|
return value.bind(proxy);
|
|
@@ -4553,6 +4562,79 @@
|
|
|
4553
4562
|
return scopeVersionMap.get(target);
|
|
4554
4563
|
}
|
|
4555
4564
|
|
|
4565
|
+
/** Keep the longest already-ordered run of rows connected; move only the rest. */
|
|
4566
|
+
function placeKeyedRows(placeholder, rows) {
|
|
4567
|
+
const parent = placeholder.parentNode;
|
|
4568
|
+
if (!parent || rows.length === 0)
|
|
4569
|
+
return;
|
|
4570
|
+
const managed = new Set(rows);
|
|
4571
|
+
const positions = new Map();
|
|
4572
|
+
let boundary = placeholder.nextSibling;
|
|
4573
|
+
while (boundary && managed.has(boundary)) {
|
|
4574
|
+
positions.set(boundary, positions.size);
|
|
4575
|
+
boundary = boundary.nextSibling;
|
|
4576
|
+
}
|
|
4577
|
+
const active = placeholder.ownerDocument.activeElement;
|
|
4578
|
+
const ownsFocus = !!active && rows.some((row) => row === active || row.contains(active));
|
|
4579
|
+
const selection = ownsFocus && (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement)
|
|
4580
|
+
? { start: active.selectionStart, end: active.selectionEnd, direction: active.selectionDirection }
|
|
4581
|
+
: null;
|
|
4582
|
+
if (positions.size !== rows.length) {
|
|
4583
|
+
// Leaving transition nodes, foreign siblings or externally detached rows:
|
|
4584
|
+
// preserve the established contiguous-after-placeholder placement contract.
|
|
4585
|
+
let previous = placeholder;
|
|
4586
|
+
for (const row of rows) {
|
|
4587
|
+
if (row !== previous.nextSibling)
|
|
4588
|
+
parent.insertBefore(row, previous.nextSibling);
|
|
4589
|
+
previous = row;
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
else {
|
|
4593
|
+
const order = rows.map((row) => positions.get(row));
|
|
4594
|
+
let sorted = true;
|
|
4595
|
+
for (let i = 1; i < order.length; i++)
|
|
4596
|
+
if (order[i] < order[i - 1]) {
|
|
4597
|
+
sorted = false;
|
|
4598
|
+
break;
|
|
4599
|
+
}
|
|
4600
|
+
if (sorted)
|
|
4601
|
+
return;
|
|
4602
|
+
// Patience sorting: indices of a longest increasing subsequence, O(n log n).
|
|
4603
|
+
const tails = [], predecessors = new Array(order.length).fill(-1);
|
|
4604
|
+
for (let i = 0; i < order.length; i++) {
|
|
4605
|
+
let low = 0, high = tails.length;
|
|
4606
|
+
while (low < high) {
|
|
4607
|
+
const middle = (low + high) >>> 1;
|
|
4608
|
+
if (order[tails[middle]] < order[i])
|
|
4609
|
+
low = middle + 1;
|
|
4610
|
+
else
|
|
4611
|
+
high = middle;
|
|
4612
|
+
}
|
|
4613
|
+
if (low > 0)
|
|
4614
|
+
predecessors[i] = tails[low - 1];
|
|
4615
|
+
tails[low] = i;
|
|
4616
|
+
}
|
|
4617
|
+
const retained = new Set();
|
|
4618
|
+
for (let i = tails[tails.length - 1]; i >= 0; i = predecessors[i])
|
|
4619
|
+
retained.add(i);
|
|
4620
|
+
for (let i = rows.length - 1; i >= 0; i--) {
|
|
4621
|
+
const row = rows[i];
|
|
4622
|
+
if (!retained.has(i) && row.nextSibling !== boundary)
|
|
4623
|
+
parent.insertBefore(row, boundary);
|
|
4624
|
+
boundary = row;
|
|
4625
|
+
}
|
|
4626
|
+
}
|
|
4627
|
+
// insertBefore can blur a moved input. Restore only a surviving owned focus,
|
|
4628
|
+
// and never steal focus assigned to another control by application callbacks.
|
|
4629
|
+
const document = placeholder.ownerDocument;
|
|
4630
|
+
if (ownsFocus && active.isConnected && document.activeElement === document.body) {
|
|
4631
|
+
active.focus({ preventScroll: true });
|
|
4632
|
+
if (selection?.start != null && selection.end != null) {
|
|
4633
|
+
active.setSelectionRange(selection.start, selection.end, selection.direction || undefined);
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
}
|
|
4637
|
+
|
|
4556
4638
|
/**
|
|
4557
4639
|
* Structural Directives (*if, *for)
|
|
4558
4640
|
* Single-pass parser for conditional and list rendering with transitions
|
|
@@ -4733,6 +4815,7 @@
|
|
|
4733
4815
|
});
|
|
4734
4816
|
// Add/reorder items immediately (parallel with remove animations)
|
|
4735
4817
|
let lastPlacedNode = placeholder;
|
|
4818
|
+
const rows = [];
|
|
4736
4819
|
orderedKeys.forEach((key) => {
|
|
4737
4820
|
const newItemData = newItemsMap.get(key);
|
|
4738
4821
|
const { index } = newItemData;
|
|
@@ -4784,13 +4867,10 @@
|
|
|
4784
4867
|
});
|
|
4785
4868
|
}
|
|
4786
4869
|
}
|
|
4787
|
-
|
|
4788
|
-
// depend on formatting whitespace or unrelated sibling nodes.
|
|
4789
|
-
if (itemElement !== lastPlacedNode.nextSibling) {
|
|
4790
|
-
placeholder.parentNode?.insertBefore(itemElement, lastPlacedNode.nextSibling);
|
|
4791
|
-
}
|
|
4870
|
+
rows.push(itemElement);
|
|
4792
4871
|
lastPlacedNode = itemElement;
|
|
4793
4872
|
});
|
|
4873
|
+
placeKeyedRows(placeholder, rows);
|
|
4794
4874
|
}
|
|
4795
4875
|
/**
|
|
4796
4876
|
* Process *for without keys (simple re-render)
|
|
@@ -8892,7 +8972,7 @@
|
|
|
8892
8972
|
portalCreate,
|
|
8893
8973
|
portalDestroy,
|
|
8894
8974
|
setCspNonce,
|
|
8895
|
-
version: '0.5.
|
|
8975
|
+
version: '0.5.2'
|
|
8896
8976
|
};
|
|
8897
8977
|
|
|
8898
8978
|
setExpressionRuntime(standardExpressionRuntime);
|