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.csp.esm.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
|
*/
|
|
@@ -10738,7 +10738,7 @@ function processModel(element, scope, root) {
|
|
|
10738
10738
|
// Set initial value (no pipes in v-model)
|
|
10739
10739
|
const initialValue = evaluateExpression(expr, currentScope, false);
|
|
10740
10740
|
if (inputElement.type === 'checkbox') {
|
|
10741
|
-
inputElement.checked = !!initialValue;
|
|
10741
|
+
inputElement.checked = !!unref(initialValue);
|
|
10742
10742
|
}
|
|
10743
10743
|
else if (inputElement.type === 'radio') {
|
|
10744
10744
|
inputElement.checked = String(unref(initialValue)) === inputElement.value;
|
|
@@ -10784,7 +10784,7 @@ function processModel(element, scope, root) {
|
|
|
10784
10784
|
// No pipes in v-model reactive updates
|
|
10785
10785
|
const newValue = evaluateExpression(expr, currentScope, false);
|
|
10786
10786
|
if (inputElement.type === 'checkbox') {
|
|
10787
|
-
inputElement.checked = !!newValue;
|
|
10787
|
+
inputElement.checked = !!unref(newValue);
|
|
10788
10788
|
}
|
|
10789
10789
|
else if (inputElement.type === 'radio') {
|
|
10790
10790
|
inputElement.checked = String(unref(newValue)) === inputElement.value;
|
|
@@ -11015,6 +11015,15 @@ function reactive(raw) {
|
|
|
11015
11015
|
// It's a getter - just return value, getter will track its own dependencies
|
|
11016
11016
|
return value;
|
|
11017
11017
|
}
|
|
11018
|
+
// Callable reactive values are data, not methods. Binding would drop
|
|
11019
|
+
// their identity and metadata used by g-model and the public APIs.
|
|
11020
|
+
if (isSignal(value) || isComputed(value)) {
|
|
11021
|
+
// Track the field as well as reads of its value so replacing the
|
|
11022
|
+
// signal/computed switches effects away from the old source.
|
|
11023
|
+
if (hasCurrentEffect())
|
|
11024
|
+
getFieldSignal(target, key, value).value;
|
|
11025
|
+
return value;
|
|
11026
|
+
}
|
|
11018
11027
|
// function -> bind this = proxy
|
|
11019
11028
|
if (typeof value === "function") {
|
|
11020
11029
|
return value.bind(proxy);
|
|
@@ -11164,6 +11173,79 @@ function getScopeVersion(target) {
|
|
|
11164
11173
|
return scopeVersionMap.get(target);
|
|
11165
11174
|
}
|
|
11166
11175
|
|
|
11176
|
+
/** Keep the longest already-ordered run of rows connected; move only the rest. */
|
|
11177
|
+
function placeKeyedRows(placeholder, rows) {
|
|
11178
|
+
const parent = placeholder.parentNode;
|
|
11179
|
+
if (!parent || rows.length === 0)
|
|
11180
|
+
return;
|
|
11181
|
+
const managed = new Set(rows);
|
|
11182
|
+
const positions = new Map();
|
|
11183
|
+
let boundary = placeholder.nextSibling;
|
|
11184
|
+
while (boundary && managed.has(boundary)) {
|
|
11185
|
+
positions.set(boundary, positions.size);
|
|
11186
|
+
boundary = boundary.nextSibling;
|
|
11187
|
+
}
|
|
11188
|
+
const active = placeholder.ownerDocument.activeElement;
|
|
11189
|
+
const ownsFocus = !!active && rows.some((row) => row === active || row.contains(active));
|
|
11190
|
+
const selection = ownsFocus && (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement)
|
|
11191
|
+
? { start: active.selectionStart, end: active.selectionEnd, direction: active.selectionDirection }
|
|
11192
|
+
: null;
|
|
11193
|
+
if (positions.size !== rows.length) {
|
|
11194
|
+
// Leaving transition nodes, foreign siblings or externally detached rows:
|
|
11195
|
+
// preserve the established contiguous-after-placeholder placement contract.
|
|
11196
|
+
let previous = placeholder;
|
|
11197
|
+
for (const row of rows) {
|
|
11198
|
+
if (row !== previous.nextSibling)
|
|
11199
|
+
parent.insertBefore(row, previous.nextSibling);
|
|
11200
|
+
previous = row;
|
|
11201
|
+
}
|
|
11202
|
+
}
|
|
11203
|
+
else {
|
|
11204
|
+
const order = rows.map((row) => positions.get(row));
|
|
11205
|
+
let sorted = true;
|
|
11206
|
+
for (let i = 1; i < order.length; i++)
|
|
11207
|
+
if (order[i] < order[i - 1]) {
|
|
11208
|
+
sorted = false;
|
|
11209
|
+
break;
|
|
11210
|
+
}
|
|
11211
|
+
if (sorted)
|
|
11212
|
+
return;
|
|
11213
|
+
// Patience sorting: indices of a longest increasing subsequence, O(n log n).
|
|
11214
|
+
const tails = [], predecessors = new Array(order.length).fill(-1);
|
|
11215
|
+
for (let i = 0; i < order.length; i++) {
|
|
11216
|
+
let low = 0, high = tails.length;
|
|
11217
|
+
while (low < high) {
|
|
11218
|
+
const middle = (low + high) >>> 1;
|
|
11219
|
+
if (order[tails[middle]] < order[i])
|
|
11220
|
+
low = middle + 1;
|
|
11221
|
+
else
|
|
11222
|
+
high = middle;
|
|
11223
|
+
}
|
|
11224
|
+
if (low > 0)
|
|
11225
|
+
predecessors[i] = tails[low - 1];
|
|
11226
|
+
tails[low] = i;
|
|
11227
|
+
}
|
|
11228
|
+
const retained = new Set();
|
|
11229
|
+
for (let i = tails[tails.length - 1]; i >= 0; i = predecessors[i])
|
|
11230
|
+
retained.add(i);
|
|
11231
|
+
for (let i = rows.length - 1; i >= 0; i--) {
|
|
11232
|
+
const row = rows[i];
|
|
11233
|
+
if (!retained.has(i) && row.nextSibling !== boundary)
|
|
11234
|
+
parent.insertBefore(row, boundary);
|
|
11235
|
+
boundary = row;
|
|
11236
|
+
}
|
|
11237
|
+
}
|
|
11238
|
+
// insertBefore can blur a moved input. Restore only a surviving owned focus,
|
|
11239
|
+
// and never steal focus assigned to another control by application callbacks.
|
|
11240
|
+
const document = placeholder.ownerDocument;
|
|
11241
|
+
if (ownsFocus && active.isConnected && document.activeElement === document.body) {
|
|
11242
|
+
active.focus({ preventScroll: true });
|
|
11243
|
+
if (selection?.start != null && selection.end != null) {
|
|
11244
|
+
active.setSelectionRange(selection.start, selection.end, selection.direction || undefined);
|
|
11245
|
+
}
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
|
|
11167
11249
|
/**
|
|
11168
11250
|
* Structural Directives (*if, *for)
|
|
11169
11251
|
* Single-pass parser for conditional and list rendering with transitions
|
|
@@ -11344,6 +11426,7 @@ function processForWithKeys(placeholder, template, list, itemVar, keyExpr, curre
|
|
|
11344
11426
|
});
|
|
11345
11427
|
// Add/reorder items immediately (parallel with remove animations)
|
|
11346
11428
|
let lastPlacedNode = placeholder;
|
|
11429
|
+
const rows = [];
|
|
11347
11430
|
orderedKeys.forEach((key) => {
|
|
11348
11431
|
const newItemData = newItemsMap.get(key);
|
|
11349
11432
|
const { index } = newItemData;
|
|
@@ -11395,13 +11478,10 @@ function processForWithKeys(placeholder, template, list, itemVar, keyExpr, curre
|
|
|
11395
11478
|
});
|
|
11396
11479
|
}
|
|
11397
11480
|
}
|
|
11398
|
-
|
|
11399
|
-
// depend on formatting whitespace or unrelated sibling nodes.
|
|
11400
|
-
if (itemElement !== lastPlacedNode.nextSibling) {
|
|
11401
|
-
placeholder.parentNode?.insertBefore(itemElement, lastPlacedNode.nextSibling);
|
|
11402
|
-
}
|
|
11481
|
+
rows.push(itemElement);
|
|
11403
11482
|
lastPlacedNode = itemElement;
|
|
11404
11483
|
});
|
|
11484
|
+
placeKeyedRows(placeholder, rows);
|
|
11405
11485
|
}
|
|
11406
11486
|
/**
|
|
11407
11487
|
* Process *for without keys (simple re-render)
|
|
@@ -15503,7 +15583,7 @@ const Gyos = {
|
|
|
15503
15583
|
portalCreate,
|
|
15504
15584
|
portalDestroy,
|
|
15505
15585
|
setCspNonce,
|
|
15506
|
-
version: '0.5.
|
|
15586
|
+
version: '0.5.2'
|
|
15507
15587
|
};
|
|
15508
15588
|
|
|
15509
15589
|
setExpressionRuntime(cspExpressionRuntime);
|