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
|
@@ -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
|
*/
|
|
@@ -4089,7 +4089,7 @@ function processModel(element, scope, root) {
|
|
|
4089
4089
|
// Set initial value (no pipes in v-model)
|
|
4090
4090
|
const initialValue = evaluateExpression(expr, currentScope, false);
|
|
4091
4091
|
if (inputElement.type === 'checkbox') {
|
|
4092
|
-
inputElement.checked = !!initialValue;
|
|
4092
|
+
inputElement.checked = !!unref(initialValue);
|
|
4093
4093
|
}
|
|
4094
4094
|
else if (inputElement.type === 'radio') {
|
|
4095
4095
|
inputElement.checked = String(unref(initialValue)) === inputElement.value;
|
|
@@ -4135,7 +4135,7 @@ function processModel(element, scope, root) {
|
|
|
4135
4135
|
// No pipes in v-model reactive updates
|
|
4136
4136
|
const newValue = evaluateExpression(expr, currentScope, false);
|
|
4137
4137
|
if (inputElement.type === 'checkbox') {
|
|
4138
|
-
inputElement.checked = !!newValue;
|
|
4138
|
+
inputElement.checked = !!unref(newValue);
|
|
4139
4139
|
}
|
|
4140
4140
|
else if (inputElement.type === 'radio') {
|
|
4141
4141
|
inputElement.checked = String(unref(newValue)) === inputElement.value;
|
|
@@ -4366,6 +4366,15 @@ function reactive(raw) {
|
|
|
4366
4366
|
// It's a getter - just return value, getter will track its own dependencies
|
|
4367
4367
|
return value;
|
|
4368
4368
|
}
|
|
4369
|
+
// Callable reactive values are data, not methods. Binding would drop
|
|
4370
|
+
// their identity and metadata used by g-model and the public APIs.
|
|
4371
|
+
if (isSignal(value) || isComputed(value)) {
|
|
4372
|
+
// Track the field as well as reads of its value so replacing the
|
|
4373
|
+
// signal/computed switches effects away from the old source.
|
|
4374
|
+
if (hasCurrentEffect())
|
|
4375
|
+
getFieldSignal(target, key, value).value;
|
|
4376
|
+
return value;
|
|
4377
|
+
}
|
|
4369
4378
|
// function -> bind this = proxy
|
|
4370
4379
|
if (typeof value === "function") {
|
|
4371
4380
|
return value.bind(proxy);
|
|
@@ -4515,6 +4524,79 @@ function getScopeVersion(target) {
|
|
|
4515
4524
|
return scopeVersionMap.get(target);
|
|
4516
4525
|
}
|
|
4517
4526
|
|
|
4527
|
+
/** Keep the longest already-ordered run of rows connected; move only the rest. */
|
|
4528
|
+
function placeKeyedRows(placeholder, rows) {
|
|
4529
|
+
const parent = placeholder.parentNode;
|
|
4530
|
+
if (!parent || rows.length === 0)
|
|
4531
|
+
return;
|
|
4532
|
+
const managed = new Set(rows);
|
|
4533
|
+
const positions = new Map();
|
|
4534
|
+
let boundary = placeholder.nextSibling;
|
|
4535
|
+
while (boundary && managed.has(boundary)) {
|
|
4536
|
+
positions.set(boundary, positions.size);
|
|
4537
|
+
boundary = boundary.nextSibling;
|
|
4538
|
+
}
|
|
4539
|
+
const active = placeholder.ownerDocument.activeElement;
|
|
4540
|
+
const ownsFocus = !!active && rows.some((row) => row === active || row.contains(active));
|
|
4541
|
+
const selection = ownsFocus && (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement)
|
|
4542
|
+
? { start: active.selectionStart, end: active.selectionEnd, direction: active.selectionDirection }
|
|
4543
|
+
: null;
|
|
4544
|
+
if (positions.size !== rows.length) {
|
|
4545
|
+
// Leaving transition nodes, foreign siblings or externally detached rows:
|
|
4546
|
+
// preserve the established contiguous-after-placeholder placement contract.
|
|
4547
|
+
let previous = placeholder;
|
|
4548
|
+
for (const row of rows) {
|
|
4549
|
+
if (row !== previous.nextSibling)
|
|
4550
|
+
parent.insertBefore(row, previous.nextSibling);
|
|
4551
|
+
previous = row;
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
else {
|
|
4555
|
+
const order = rows.map((row) => positions.get(row));
|
|
4556
|
+
let sorted = true;
|
|
4557
|
+
for (let i = 1; i < order.length; i++)
|
|
4558
|
+
if (order[i] < order[i - 1]) {
|
|
4559
|
+
sorted = false;
|
|
4560
|
+
break;
|
|
4561
|
+
}
|
|
4562
|
+
if (sorted)
|
|
4563
|
+
return;
|
|
4564
|
+
// Patience sorting: indices of a longest increasing subsequence, O(n log n).
|
|
4565
|
+
const tails = [], predecessors = new Array(order.length).fill(-1);
|
|
4566
|
+
for (let i = 0; i < order.length; i++) {
|
|
4567
|
+
let low = 0, high = tails.length;
|
|
4568
|
+
while (low < high) {
|
|
4569
|
+
const middle = (low + high) >>> 1;
|
|
4570
|
+
if (order[tails[middle]] < order[i])
|
|
4571
|
+
low = middle + 1;
|
|
4572
|
+
else
|
|
4573
|
+
high = middle;
|
|
4574
|
+
}
|
|
4575
|
+
if (low > 0)
|
|
4576
|
+
predecessors[i] = tails[low - 1];
|
|
4577
|
+
tails[low] = i;
|
|
4578
|
+
}
|
|
4579
|
+
const retained = new Set();
|
|
4580
|
+
for (let i = tails[tails.length - 1]; i >= 0; i = predecessors[i])
|
|
4581
|
+
retained.add(i);
|
|
4582
|
+
for (let i = rows.length - 1; i >= 0; i--) {
|
|
4583
|
+
const row = rows[i];
|
|
4584
|
+
if (!retained.has(i) && row.nextSibling !== boundary)
|
|
4585
|
+
parent.insertBefore(row, boundary);
|
|
4586
|
+
boundary = row;
|
|
4587
|
+
}
|
|
4588
|
+
}
|
|
4589
|
+
// insertBefore can blur a moved input. Restore only a surviving owned focus,
|
|
4590
|
+
// and never steal focus assigned to another control by application callbacks.
|
|
4591
|
+
const document = placeholder.ownerDocument;
|
|
4592
|
+
if (ownsFocus && active.isConnected && document.activeElement === document.body) {
|
|
4593
|
+
active.focus({ preventScroll: true });
|
|
4594
|
+
if (selection?.start != null && selection.end != null) {
|
|
4595
|
+
active.setSelectionRange(selection.start, selection.end, selection.direction || undefined);
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
|
|
4518
4600
|
/**
|
|
4519
4601
|
* Structural Directives (*if, *for)
|
|
4520
4602
|
* Single-pass parser for conditional and list rendering with transitions
|
|
@@ -4695,6 +4777,7 @@ function processForWithKeys(placeholder, template, list, itemVar, keyExpr, curre
|
|
|
4695
4777
|
});
|
|
4696
4778
|
// Add/reorder items immediately (parallel with remove animations)
|
|
4697
4779
|
let lastPlacedNode = placeholder;
|
|
4780
|
+
const rows = [];
|
|
4698
4781
|
orderedKeys.forEach((key) => {
|
|
4699
4782
|
const newItemData = newItemsMap.get(key);
|
|
4700
4783
|
const { index } = newItemData;
|
|
@@ -4746,13 +4829,10 @@ function processForWithKeys(placeholder, template, list, itemVar, keyExpr, curre
|
|
|
4746
4829
|
});
|
|
4747
4830
|
}
|
|
4748
4831
|
}
|
|
4749
|
-
|
|
4750
|
-
// depend on formatting whitespace or unrelated sibling nodes.
|
|
4751
|
-
if (itemElement !== lastPlacedNode.nextSibling) {
|
|
4752
|
-
placeholder.parentNode?.insertBefore(itemElement, lastPlacedNode.nextSibling);
|
|
4753
|
-
}
|
|
4832
|
+
rows.push(itemElement);
|
|
4754
4833
|
lastPlacedNode = itemElement;
|
|
4755
4834
|
});
|
|
4835
|
+
placeKeyedRows(placeholder, rows);
|
|
4756
4836
|
}
|
|
4757
4837
|
/**
|
|
4758
4838
|
* Process *for without keys (simple re-render)
|
|
@@ -8868,7 +8948,7 @@ const Gyos = {
|
|
|
8868
8948
|
portalCreate,
|
|
8869
8949
|
portalDestroy,
|
|
8870
8950
|
setCspNonce,
|
|
8871
|
-
version: '0.5.
|
|
8951
|
+
version: '0.5.2'
|
|
8872
8952
|
};
|
|
8873
8953
|
|
|
8874
8954
|
// This file was generated. Do not modify manually!
|