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.auto.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
|
*/
|
|
@@ -4095,7 +4095,7 @@
|
|
|
4095
4095
|
// Set initial value (no pipes in v-model)
|
|
4096
4096
|
const initialValue = evaluateExpression(expr, currentScope, false);
|
|
4097
4097
|
if (inputElement.type === 'checkbox') {
|
|
4098
|
-
inputElement.checked = !!initialValue;
|
|
4098
|
+
inputElement.checked = !!unref(initialValue);
|
|
4099
4099
|
}
|
|
4100
4100
|
else if (inputElement.type === 'radio') {
|
|
4101
4101
|
inputElement.checked = String(unref(initialValue)) === inputElement.value;
|
|
@@ -4141,7 +4141,7 @@
|
|
|
4141
4141
|
// No pipes in v-model reactive updates
|
|
4142
4142
|
const newValue = evaluateExpression(expr, currentScope, false);
|
|
4143
4143
|
if (inputElement.type === 'checkbox') {
|
|
4144
|
-
inputElement.checked = !!newValue;
|
|
4144
|
+
inputElement.checked = !!unref(newValue);
|
|
4145
4145
|
}
|
|
4146
4146
|
else if (inputElement.type === 'radio') {
|
|
4147
4147
|
inputElement.checked = String(unref(newValue)) === inputElement.value;
|
|
@@ -4372,6 +4372,15 @@
|
|
|
4372
4372
|
// It's a getter - just return value, getter will track its own dependencies
|
|
4373
4373
|
return value;
|
|
4374
4374
|
}
|
|
4375
|
+
// Callable reactive values are data, not methods. Binding would drop
|
|
4376
|
+
// their identity and metadata used by g-model and the public APIs.
|
|
4377
|
+
if (isSignal(value) || isComputed(value)) {
|
|
4378
|
+
// Track the field as well as reads of its value so replacing the
|
|
4379
|
+
// signal/computed switches effects away from the old source.
|
|
4380
|
+
if (hasCurrentEffect())
|
|
4381
|
+
getFieldSignal(target, key, value).value;
|
|
4382
|
+
return value;
|
|
4383
|
+
}
|
|
4375
4384
|
// function -> bind this = proxy
|
|
4376
4385
|
if (typeof value === "function") {
|
|
4377
4386
|
return value.bind(proxy);
|
|
@@ -4521,6 +4530,79 @@
|
|
|
4521
4530
|
return scopeVersionMap.get(target);
|
|
4522
4531
|
}
|
|
4523
4532
|
|
|
4533
|
+
/** Keep the longest already-ordered run of rows connected; move only the rest. */
|
|
4534
|
+
function placeKeyedRows(placeholder, rows) {
|
|
4535
|
+
const parent = placeholder.parentNode;
|
|
4536
|
+
if (!parent || rows.length === 0)
|
|
4537
|
+
return;
|
|
4538
|
+
const managed = new Set(rows);
|
|
4539
|
+
const positions = new Map();
|
|
4540
|
+
let boundary = placeholder.nextSibling;
|
|
4541
|
+
while (boundary && managed.has(boundary)) {
|
|
4542
|
+
positions.set(boundary, positions.size);
|
|
4543
|
+
boundary = boundary.nextSibling;
|
|
4544
|
+
}
|
|
4545
|
+
const active = placeholder.ownerDocument.activeElement;
|
|
4546
|
+
const ownsFocus = !!active && rows.some((row) => row === active || row.contains(active));
|
|
4547
|
+
const selection = ownsFocus && (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement)
|
|
4548
|
+
? { start: active.selectionStart, end: active.selectionEnd, direction: active.selectionDirection }
|
|
4549
|
+
: null;
|
|
4550
|
+
if (positions.size !== rows.length) {
|
|
4551
|
+
// Leaving transition nodes, foreign siblings or externally detached rows:
|
|
4552
|
+
// preserve the established contiguous-after-placeholder placement contract.
|
|
4553
|
+
let previous = placeholder;
|
|
4554
|
+
for (const row of rows) {
|
|
4555
|
+
if (row !== previous.nextSibling)
|
|
4556
|
+
parent.insertBefore(row, previous.nextSibling);
|
|
4557
|
+
previous = row;
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
else {
|
|
4561
|
+
const order = rows.map((row) => positions.get(row));
|
|
4562
|
+
let sorted = true;
|
|
4563
|
+
for (let i = 1; i < order.length; i++)
|
|
4564
|
+
if (order[i] < order[i - 1]) {
|
|
4565
|
+
sorted = false;
|
|
4566
|
+
break;
|
|
4567
|
+
}
|
|
4568
|
+
if (sorted)
|
|
4569
|
+
return;
|
|
4570
|
+
// Patience sorting: indices of a longest increasing subsequence, O(n log n).
|
|
4571
|
+
const tails = [], predecessors = new Array(order.length).fill(-1);
|
|
4572
|
+
for (let i = 0; i < order.length; i++) {
|
|
4573
|
+
let low = 0, high = tails.length;
|
|
4574
|
+
while (low < high) {
|
|
4575
|
+
const middle = (low + high) >>> 1;
|
|
4576
|
+
if (order[tails[middle]] < order[i])
|
|
4577
|
+
low = middle + 1;
|
|
4578
|
+
else
|
|
4579
|
+
high = middle;
|
|
4580
|
+
}
|
|
4581
|
+
if (low > 0)
|
|
4582
|
+
predecessors[i] = tails[low - 1];
|
|
4583
|
+
tails[low] = i;
|
|
4584
|
+
}
|
|
4585
|
+
const retained = new Set();
|
|
4586
|
+
for (let i = tails[tails.length - 1]; i >= 0; i = predecessors[i])
|
|
4587
|
+
retained.add(i);
|
|
4588
|
+
for (let i = rows.length - 1; i >= 0; i--) {
|
|
4589
|
+
const row = rows[i];
|
|
4590
|
+
if (!retained.has(i) && row.nextSibling !== boundary)
|
|
4591
|
+
parent.insertBefore(row, boundary);
|
|
4592
|
+
boundary = row;
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
// insertBefore can blur a moved input. Restore only a surviving owned focus,
|
|
4596
|
+
// and never steal focus assigned to another control by application callbacks.
|
|
4597
|
+
const document = placeholder.ownerDocument;
|
|
4598
|
+
if (ownsFocus && active.isConnected && document.activeElement === document.body) {
|
|
4599
|
+
active.focus({ preventScroll: true });
|
|
4600
|
+
if (selection?.start != null && selection.end != null) {
|
|
4601
|
+
active.setSelectionRange(selection.start, selection.end, selection.direction || undefined);
|
|
4602
|
+
}
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
|
|
4524
4606
|
/**
|
|
4525
4607
|
* Structural Directives (*if, *for)
|
|
4526
4608
|
* Single-pass parser for conditional and list rendering with transitions
|
|
@@ -4701,6 +4783,7 @@
|
|
|
4701
4783
|
});
|
|
4702
4784
|
// Add/reorder items immediately (parallel with remove animations)
|
|
4703
4785
|
let lastPlacedNode = placeholder;
|
|
4786
|
+
const rows = [];
|
|
4704
4787
|
orderedKeys.forEach((key) => {
|
|
4705
4788
|
const newItemData = newItemsMap.get(key);
|
|
4706
4789
|
const { index } = newItemData;
|
|
@@ -4752,13 +4835,10 @@
|
|
|
4752
4835
|
});
|
|
4753
4836
|
}
|
|
4754
4837
|
}
|
|
4755
|
-
|
|
4756
|
-
// depend on formatting whitespace or unrelated sibling nodes.
|
|
4757
|
-
if (itemElement !== lastPlacedNode.nextSibling) {
|
|
4758
|
-
placeholder.parentNode?.insertBefore(itemElement, lastPlacedNode.nextSibling);
|
|
4759
|
-
}
|
|
4838
|
+
rows.push(itemElement);
|
|
4760
4839
|
lastPlacedNode = itemElement;
|
|
4761
4840
|
});
|
|
4841
|
+
placeKeyedRows(placeholder, rows);
|
|
4762
4842
|
}
|
|
4763
4843
|
/**
|
|
4764
4844
|
* Process *for without keys (simple re-render)
|
|
@@ -8860,7 +8940,7 @@
|
|
|
8860
8940
|
portalCreate,
|
|
8861
8941
|
portalDestroy,
|
|
8862
8942
|
setCspNonce,
|
|
8863
|
-
version: '0.5.
|
|
8943
|
+
version: '0.5.2'
|
|
8864
8944
|
};
|
|
8865
8945
|
|
|
8866
8946
|
const standardExpressionRuntime = {
|