marko 6.4.10 → 6.4.11
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/dist/common/accessor.d.ts +0 -3
- package/dist/common/accessor.debug.d.ts +0 -3
- package/dist/common/helpers.d.ts +1 -1
- package/dist/common/types.d.ts +4 -3
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-C1V5vpFs.mjs → dom-DjUZd-9y.mjs} +198 -214
- package/dist/debug/{dom-DNB5yq3U.js → dom-mQ5mPBTF.js} +203 -213
- package/dist/debug/dom.js +5 -8
- package/dist/debug/dom.mjs +5 -9
- package/dist/debug/html.js +68 -87
- package/dist/debug/html.mjs +68 -87
- package/dist/dom/abort-signal.d.ts +1 -1
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +4 -4
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +3 -3
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/load.d.ts +3 -4
- package/dist/dom/placeholder.feat.js +1 -1
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +1 -2
- package/dist/dom/signals.d.ts +5 -7
- package/dist/{dom-C2-Flitp.js → dom-B8j2453O.js} +143 -155
- package/dist/{dom-DsHYWMCR.mjs → dom-HEWdZCCb.mjs} +119 -136
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +17 -21
- package/dist/dom.mjs +5 -9
- package/dist/html/assets.d.ts +3 -4
- package/dist/html/for.d.ts +0 -1
- package/dist/html/writer.d.ts +2 -2
- package/dist/html.d.ts +1 -1
- package/dist/html.js +60 -72
- package/dist/html.mjs +60 -72
- package/dist/translator/index.d.ts +0 -1
- package/dist/translator/index.js +4629 -4485
- package/dist/translator/interop/out-global.d.ts +5 -0
- package/dist/translator/util/assert.d.ts +4 -0
- package/dist/translator/util/entry-builder.d.ts +1 -1
- package/dist/translator/util/finalize-references.d.ts +2 -1
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +7 -1
- package/dist/translator/util/references.d.ts +11 -5
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +6 -1
- package/dist/translator/util/signals.d.ts +2 -1
- package/dist/translator/util/style-interpolation.d.ts +1 -1
- package/dist/translator/util/tag-name-type.d.ts +1 -0
- package/dist/translator/util/visitors.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +2 -0
- package/dist/translator/visitors/program/index.d.ts +0 -4
- package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
- package/package.json +4 -4
- package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
- package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\",
|
|
2
|
-
let str = "", sep = "", part;
|
|
3
|
-
if (val) {
|
|
4
|
-
if (typeof val != "object") str += val;
|
|
5
|
-
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
6
|
-
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
7
|
-
}
|
|
8
|
-
return str;
|
|
9
|
-
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), branchesEnabled, dynamicHtmlEnabled, rendering, runId = 2, pendingEffects = [], pendingRenders = [], queuePendingRender = (render) => {
|
|
1
|
+
let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), branchesEnabled, dynamicHtmlEnabled, rendering, runId = 2, pendingEffects = [], pendingRenders = [], queuePendingRender = (render) => {
|
|
10
2
|
let i = pendingRenders.push(render) - 1;
|
|
11
3
|
for (; i;) {
|
|
12
4
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
|
@@ -14,29 +6,11 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
14
6
|
pendingRenders[i] = parent, i = parentIndex;
|
|
15
7
|
}
|
|
16
8
|
pendingRenders[i] = render;
|
|
17
|
-
}, runEffects = (
|
|
9
|
+
}, runEffects = (effects) => {
|
|
18
10
|
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
19
|
-
}
|
|
11
|
+
}, runRender = (render) => {
|
|
20
12
|
branchesEnabled && render.b.F?.H === 0 || render.c(render.b, render.d);
|
|
21
|
-
}, catchEnabled, abortsEnabled, subscriptionsEnabled, delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes,
|
|
22
|
-
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
|
|
23
|
-
}, isScheduled, channel, _return = (scope, value) => scope.T ? scope.T(value) : scope.RV = value, _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), currentNode, walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
24
|
-
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
25
|
-
for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) scope[decodeAccessor(currentScopeIndex++)] = currentNode;
|
|
26
|
-
else if (value === 37 || value === 49) currentNode.replaceWith(currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
27
|
-
else if (value === 38) return currentWalkIndex;
|
|
28
|
-
else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
29
|
-
else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;) if (currentNode.firstChild) currentNode = currentNode.firstChild;
|
|
30
|
-
else {
|
|
31
|
-
for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
|
|
32
|
-
walkNextSibling();
|
|
33
|
-
}
|
|
34
|
-
else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walkNextSibling();
|
|
35
|
-
else if (value < 117) {
|
|
36
|
-
for (value = 10 * currentMultiplier + value - 107; value--;) currentNode = currentNode.parentNode || currentNode;
|
|
37
|
-
walkNextSibling();
|
|
38
|
-
} else storedMultiplier = currentMultiplier * 10 + value - 117;
|
|
39
|
-
}, walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, cloneCache = {}, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
|
|
13
|
+
}, catchEnabled, abortsEnabled, subscriptionsEnabled, delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, isScheduled, channel, _return = (scope, value) => scope.T ? scope.T(value) : scope.RV = value, _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), currentNode, walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
|
|
40
14
|
let prevValue = scope["R" + accessor];
|
|
41
15
|
if (prevValue !== (scope["R" + accessor] = _to_text(value))) {
|
|
42
16
|
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(scope["R" + accessor], parentNode.namespaceURI);
|
|
@@ -59,7 +33,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
59
33
|
nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor));
|
|
60
34
|
let rangeAccessor = "A" + nodeAccessor;
|
|
61
35
|
return (scope, display) => {
|
|
62
|
-
let referenceNode = scope[nodeAccessor], onlyChild = referenceNode.nodeType
|
|
36
|
+
let referenceNode = scope[nodeAccessor], onlyChild = referenceNode.nodeType < 3, parentNode = onlyChild ? referenceNode : referenceNode.parentNode, range = scope[rangeAccessor];
|
|
63
37
|
range || (range = scope[rangeAccessor] = {}, range.S = onlyChild ? parentNode.insertBefore(new Text(), parentNode.firstChild) : startNodeAccessor ? scope[startNodeAccessor] : referenceNode.previousSibling);
|
|
64
38
|
let startNode = range.S;
|
|
65
39
|
range.L && startNode.tagName === "T" ? display && startNode.replaceWith(range.S = new Text(), ...startNode.childNodes) : display ? startNode.parentNode !== parentNode && parentNode.insertBefore(startNode.parentNode, onlyChild ? null : referenceNode) : startNode.parentNode === parentNode && (range.K = onlyChild ? parentNode.lastChild : referenceNode.previousSibling, detachBranch(range));
|
|
@@ -112,7 +86,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
112
86
|
let oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves, start = 0;
|
|
113
87
|
forEach(value, (key, args) => {
|
|
114
88
|
let i = newScopes.length, oldScope = oldScopes[i], branch = oldLen && (oldScopesByKey || key !== (oldScope?.M ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope.I = j, map.set(scope.M ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
115
|
-
branch ? (hasPotentialMoves =
|
|
89
|
+
branch ? (hasPotentialMoves = 1, oldScopesByKey?.delete(key), branch.M = key) : ((branch = createBranch(scope.$, renderer, scope, parentNode)).M = key, setupBranch(renderer, branch)), newScopes.push(branch), params?.(branch, args);
|
|
116
90
|
}), scope[scopesAccessor] = newScopes;
|
|
117
91
|
let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1;
|
|
118
92
|
if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
|
|
@@ -153,6 +127,15 @@ function escapeStyleValue(str) {
|
|
|
153
127
|
for (let c of result) c === "(" ? closers = ")" + closers : c === "[" ? closers = "]" + closers : c === closers[0] && (closers = closers.slice(1));
|
|
154
128
|
return result + closers;
|
|
155
129
|
}
|
|
130
|
+
function toDelimitedString(val, delimiter, stringify) {
|
|
131
|
+
let str = "", sep = "", part;
|
|
132
|
+
if (val) {
|
|
133
|
+
if (typeof val != "object") str += val;
|
|
134
|
+
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
135
|
+
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
136
|
+
}
|
|
137
|
+
return str;
|
|
138
|
+
}
|
|
156
139
|
function isEventHandler(name) {
|
|
157
140
|
return /^on[A-Z-]/.test(name);
|
|
158
141
|
}
|
|
@@ -292,7 +275,7 @@ function $signal(scope, id) {
|
|
|
292
275
|
return abortsEnabled = 1, trackCleanup(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
|
|
293
276
|
}
|
|
294
277
|
/** Runs `abort` as a destroyed scope's `$signal` would fire, without creating one. */
|
|
295
|
-
function
|
|
278
|
+
function onAbort(scope, id, abort) {
|
|
296
279
|
abortsEnabled = 1, trackCleanup(scope), (scope.A ||= {})[id] = { abort };
|
|
297
280
|
}
|
|
298
281
|
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
@@ -358,11 +341,14 @@ function skipScope() {
|
|
|
358
341
|
return nextScopeId++;
|
|
359
342
|
}
|
|
360
343
|
function destroyBranch(branch) {
|
|
361
|
-
branch.N?.D
|
|
344
|
+
branch.N?.D.delete(branch), destroyNestedScopes(branch);
|
|
362
345
|
}
|
|
363
346
|
function destroyScope(scope) {
|
|
364
347
|
scope.H && (destroyNestedScopes(scope), cleanupScope(scope));
|
|
365
348
|
}
|
|
349
|
+
function destroyNestedScopes(scope) {
|
|
350
|
+
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
|
|
351
|
+
}
|
|
366
352
|
function cleanupScope(scope) {
|
|
367
353
|
if (subscriptionsEnabled && scope.Z?.forEach(unsubscribe, scope), abortsEnabled) for (let id in scope.A) $signalReset(scope, id);
|
|
368
354
|
}
|
|
@@ -405,34 +391,28 @@ function _const(valueAccessor, fn) {
|
|
|
405
391
|
scope[valueAccessor] === value && valueAccessor in scope || (scope[valueAccessor] = value, fn?.(scope));
|
|
406
392
|
});
|
|
407
393
|
}
|
|
408
|
-
function _or(id, fn, defaultPending = 1, scopeIdAccessor
|
|
409
|
-
return scopeIdAccessor
|
|
394
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor) {
|
|
395
|
+
return scopeIdAccessor = scopeIdAccessor ? decodeAccessor(scopeIdAccessor) : "L", (scope) => {
|
|
410
396
|
scope.H === runId ? ~id in scope ? --scope[~id] || fn(scope) : scope[~id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
411
397
|
};
|
|
412
398
|
}
|
|
413
|
-
function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
414
|
-
ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor);
|
|
415
|
-
let scopeAccessor = "A" + ownerLoopNodeAccessor,
|
|
416
|
-
let
|
|
417
|
-
|
|
418
|
-
for (let scope of scopes) scope.H > 0 && scope.H < runId && fn(scope);
|
|
419
|
-
}, -1);
|
|
420
|
-
};
|
|
399
|
+
function _for_closure(ownerLoopNodeAccessor, fn, id, scopeIdAccessor) {
|
|
400
|
+
ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor), scopeIdAccessor = scopeIdAccessor ? decodeAccessor(scopeIdAccessor) : "L";
|
|
401
|
+
let scopeAccessor = "A" + ownerLoopNodeAccessor, render = (ownerScope) => {
|
|
402
|
+
for (let scope of toArray(ownerScope[scopeAccessor])) scope.H < runId && fn(scope);
|
|
403
|
+
}, ownerSignal = (ownerScope) => queueRender(ownerScope, render, id, 0, ownerScope[scopeIdAccessor]);
|
|
421
404
|
return ownerSignal._ = (scope) => queueRender(scope, fn, -1), ownerSignal;
|
|
422
405
|
}
|
|
423
|
-
function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
|
|
406
|
+
function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn, getValueScope) {
|
|
424
407
|
ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor), ownerValueAccessor = decodeAccessor(ownerValueAccessor);
|
|
425
|
-
let scopeAccessor = "A" + ownerLoopNodeAccessor, mapAccessor = "O" + ownerLoopNodeAccessor,
|
|
408
|
+
let scopeAccessor = "A" + ownerLoopNodeAccessor, mapAccessor = "O" + ownerLoopNodeAccessor, prevKey = Symbol(), ownerSignal = (ownerScope) => {
|
|
426
409
|
if (ownerScope.H < runId) {
|
|
427
|
-
let nextKey = ownerScope[ownerValueAccessor];
|
|
428
|
-
|
|
429
|
-
let
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
} else for (let scope of toArray(ownerScope[scopeAccessor])) runLiveBranch(scope, fn);
|
|
434
|
-
map && (map[prevKeyProp] = nextKey);
|
|
435
|
-
}, -1);
|
|
410
|
+
let nextKey = (getValueScope ? getValueScope(ownerScope) : ownerScope)[ownerValueAccessor], map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
|
|
411
|
+
if (map && prevKey in ownerScope) {
|
|
412
|
+
let prevScope = map.get(ownerScope[prevKey]), nextScope = map.get(nextKey);
|
|
413
|
+
prevScope !== nextScope && (queueLiveBranch(prevScope, fn), queueLiveBranch(nextScope, fn));
|
|
414
|
+
} else for (let scope of toArray(ownerScope[scopeAccessor])) queueLiveBranch(scope, fn);
|
|
415
|
+
ownerScope[prevKey] = nextKey;
|
|
436
416
|
}
|
|
437
417
|
};
|
|
438
418
|
return ownerSignal._ = (scope) => queueRender(scope, fn, -1), ownerSignal;
|
|
@@ -446,8 +426,8 @@ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
|
|
|
446
426
|
}
|
|
447
427
|
return map;
|
|
448
428
|
}
|
|
449
|
-
function
|
|
450
|
-
scope
|
|
429
|
+
function queueLiveBranch(scope, fn) {
|
|
430
|
+
scope?.H < runId && queueRender(scope, fn, -1);
|
|
451
431
|
}
|
|
452
432
|
function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
453
433
|
ownerConditionalNodeAccessor = decodeAccessor(ownerConditionalNodeAccessor);
|
|
@@ -495,9 +475,7 @@ function _id(scope, accessor) {
|
|
|
495
475
|
return id;
|
|
496
476
|
}
|
|
497
477
|
function _script(id, fn) {
|
|
498
|
-
return _resumed[id] = fn, (scope) =>
|
|
499
|
-
queueEffect(scope, fn);
|
|
500
|
-
};
|
|
478
|
+
return _resumed[id] = fn, (scope) => queueEffect(scope, fn);
|
|
501
479
|
}
|
|
502
480
|
function _global_read($global, key) {
|
|
503
481
|
return $global[key];
|
|
@@ -528,6 +506,23 @@ function _hoist_resume(id, ...path) {
|
|
|
528
506
|
function walk(startNode, walkCodes, branch) {
|
|
529
507
|
currentNode = startNode, walkInternal(0, walkCodes, branch);
|
|
530
508
|
}
|
|
509
|
+
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
510
|
+
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
511
|
+
for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) scope[decodeAccessor(currentScopeIndex++)] = currentNode;
|
|
512
|
+
else if (value === 37 || value === 49) currentNode.replaceWith(currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
513
|
+
else if (value === 38) return currentWalkIndex;
|
|
514
|
+
else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
515
|
+
else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;) if (currentNode.firstChild) currentNode = currentNode.firstChild;
|
|
516
|
+
else {
|
|
517
|
+
for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
|
|
518
|
+
walkNextSibling();
|
|
519
|
+
}
|
|
520
|
+
else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walkNextSibling();
|
|
521
|
+
else if (value < 117) {
|
|
522
|
+
for (value = 10 * currentMultiplier + value - 107; value--;) currentNode = currentNode.parentNode || currentNode;
|
|
523
|
+
walkNextSibling();
|
|
524
|
+
} else storedMultiplier = currentMultiplier * 10 + value - 117;
|
|
525
|
+
}
|
|
531
526
|
// src/dom/resume.ts
|
|
532
527
|
function ready(readyId) {
|
|
533
528
|
(readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
|
|
@@ -550,67 +545,65 @@ function initEmbedded(readyId, runtimeId) {
|
|
|
550
545
|
}
|
|
551
546
|
function init(runtimeId = "M") {
|
|
552
547
|
if (curRenders) return;
|
|
553
|
-
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
548
|
+
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => defineRuntime({ value: curRenders = ((renderId) => {
|
|
549
|
+
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = (_) => scopeLookup[0] ||= {
|
|
550
|
+
runtimeId,
|
|
551
|
+
renderId
|
|
552
|
+
}, initScope = (scope) => (scope.H ??= 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
553
|
+
let scopeId = partials[0];
|
|
554
|
+
for (let i = 1; i < partials.length; i++) {
|
|
555
|
+
let partial = partials[i];
|
|
556
|
+
typeof partial == "number" ? scopeId += partial : (scopeId ? initScope(Object.assign(scopeLookup[scopeId] ||= (partial.L = scopeId, partial), partial)) : Object.assign(initGlobal(), partial), scopeId++);
|
|
557
|
+
}
|
|
558
|
+
}, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope.F === scope ? scope !== branch && setParentBranch(scope, branch) : scope.F = branch) => (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
|
|
559
|
+
if (visitType === "*") {
|
|
560
|
+
for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
|
|
561
|
+
(reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
|
|
562
|
+
} else {
|
|
563
|
+
for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
|
|
564
|
+
if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
|
|
565
|
+
for (; startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1;);
|
|
566
|
+
branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
|
|
567
|
+
} else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
568
|
+
for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
|
|
569
|
+
nextToken();
|
|
563
570
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
(reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
|
|
568
|
-
} else {
|
|
569
|
-
for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
|
|
570
|
-
if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
|
|
571
|
-
for (; startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1;);
|
|
572
|
-
branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
|
|
573
|
-
} else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
574
|
-
for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
|
|
575
|
-
nextToken();
|
|
576
|
-
}
|
|
577
|
-
if (endedBranches) {
|
|
578
|
-
for (let ended of endedBranches) pending.push(ended);
|
|
579
|
-
singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
|
|
580
|
-
}
|
|
581
|
-
visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
|
|
571
|
+
if (endedBranches) {
|
|
572
|
+
for (let ended of endedBranches) pending.push(ended);
|
|
573
|
+
singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
|
|
582
574
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
575
|
+
visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
|
|
576
|
+
}
|
|
577
|
+
}, nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
|
|
578
|
+
let i = 0;
|
|
579
|
+
for (; i < resumes.length; i++) {
|
|
580
|
+
let serialized = resumes[i];
|
|
581
|
+
if (typeof serialized == "string") for (lastTokenIndex = 0, visitText = serialized; nextToken();) /\D/.test(lastToken) ? lastEffect = _resumed[lastToken] : effects.push(lastEffect, getScope(lastToken));
|
|
582
|
+
else if (Array.isArray(serialized)) {
|
|
583
|
+
if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
|
|
584
|
+
} else if (readyIds && typeof serialized == "number") break;
|
|
585
|
+
else {
|
|
586
|
+
let scopes = serialized(serializeContext);
|
|
587
|
+
Array.isArray(scopes) && applyScopes(scopes);
|
|
595
588
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
589
|
+
}
|
|
590
|
+
return resumes.splice(0, i), i;
|
|
591
|
+
}, lastEffect, visits, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, visitBranches, htmlStart, embedAnchor;
|
|
592
|
+
return serializeContext._ = _resumed, render.m = (effects) => {
|
|
593
|
+
if (processResumes(render.r, effects), readyIds && render.b) for (let progress = 1; progress;) {
|
|
594
|
+
progress = 0;
|
|
595
|
+
for (let readyId of readyIds) {
|
|
596
|
+
let resumes = render.b[readyId];
|
|
597
|
+
resumes && processResumes(resumes, effects) && (progress = 1);
|
|
605
598
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
613
|
-
};
|
|
599
|
+
}
|
|
600
|
+
let retained = 0;
|
|
601
|
+
for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : (visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)), embedRenders && !embedAnchor && visit.parentNode && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
|
|
602
|
+
return branchesEnabled && visitBranches && (visitType = "*", lastToken = "", visitBranches()), visits.length = retained, effects;
|
|
603
|
+
}, render.w = (_) => {
|
|
604
|
+
walk(), runResumeEffects(render);
|
|
605
|
+
}, render;
|
|
606
|
+
}) });
|
|
614
607
|
if (renders) {
|
|
615
608
|
initRuntime(renders);
|
|
616
609
|
for (let renderId in renders) runResumeEffects(curRenders(renderId));
|
|
@@ -638,7 +631,7 @@ function _el(id, accessor) {
|
|
|
638
631
|
function _dynamic_tag_var_resume(accessor) {
|
|
639
632
|
accessor = decodeAccessor(accessor), _resumed["-" + accessor] = (scope) => (_) => {
|
|
640
633
|
let node = scope[accessor];
|
|
641
|
-
return node.nodeType
|
|
634
|
+
return node.nodeType > 1 ? node.previousSibling : node;
|
|
642
635
|
};
|
|
643
636
|
}
|
|
644
637
|
// src/dom/renderer.ts
|
|
@@ -660,11 +653,7 @@ function _return_setup(setup) {
|
|
|
660
653
|
}
|
|
661
654
|
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
662
655
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
|
|
663
|
-
let clone = template ? (branch, ns) =>
|
|
664
|
-
((cloneCache[ns] ||= {})[1 + template] ||= createCloneableHTML(template, ns))(branch, walks);
|
|
665
|
-
} : (branch) => {
|
|
666
|
-
walk(branch.S = branch.K = new Text(), walks, branch);
|
|
667
|
-
};
|
|
656
|
+
let cloneables = {}, clone = template ? (branch, ns) => (cloneables[ns] ||= createCloneableHTML(template, walks, ns))(branch) : (branch) => walk(branch.S = branch.K = new Text(), walks, branch);
|
|
668
657
|
return _resumed[id] = (owner) => ({
|
|
669
658
|
a: id,
|
|
670
659
|
b: clone,
|
|
@@ -696,11 +685,9 @@ function _content_closures(renderer, closureFns) {
|
|
|
696
685
|
}, instance;
|
|
697
686
|
};
|
|
698
687
|
}
|
|
699
|
-
function createCloneableHTML(html, ns) {
|
|
688
|
+
function createCloneableHTML(html, walks, ns) {
|
|
700
689
|
let { firstChild, lastChild } = parseHTML(html, ns), parent = new DocumentFragment();
|
|
701
|
-
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
|
|
702
|
-
walk(branch.S = branch.K = firstChild.cloneNode(!0), walks, branch);
|
|
703
|
-
} : (branch, walks) => {
|
|
690
|
+
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 ? (branch) => walk(branch.S = branch.K = firstChild.cloneNode(!0), walks, branch) : (branch) => {
|
|
704
691
|
let clone = parent.cloneNode(!0);
|
|
705
692
|
clone.namespaceURI = ns, walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
|
|
706
693
|
};
|
|
@@ -805,24 +792,20 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
805
792
|
}
|
|
806
793
|
}
|
|
807
794
|
function _attr_content(scope, nodeAccessor, value) {
|
|
808
|
-
let
|
|
809
|
-
scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setBranch(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor])), content?.g?.(scope["A" + nodeAccessor]);
|
|
795
|
+
let renderer = normalizeDynamicRenderer(value), content;
|
|
796
|
+
renderer && renderer.a && (content = renderer), scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setBranch(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor])), content?.g?.(scope["A" + nodeAccessor]);
|
|
810
797
|
}
|
|
811
798
|
function _attrs_script(scope, nodeAccessor) {
|
|
812
799
|
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
|
|
813
800
|
controllableScripts[scope["F" + nodeAccessor]]?.(scope, nodeAccessor);
|
|
814
801
|
for (let name in events) _on(el, name, events[name]);
|
|
815
802
|
}
|
|
816
|
-
function normalizeClientRender(value) {
|
|
817
|
-
let renderer = normalizeDynamicRenderer(value);
|
|
818
|
-
if (renderer && renderer.a) return renderer;
|
|
819
|
-
}
|
|
820
803
|
function normalizeAttrValue(value) {
|
|
821
804
|
if (isNotNullishOrFalse(value)) return value === !0 ? "" : value + "";
|
|
822
805
|
}
|
|
823
806
|
function _lifecycle(scope, thisObj, index = 0) {
|
|
824
807
|
let accessor = "K" + index, instance = scope[accessor];
|
|
825
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()),
|
|
808
|
+
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), onAbort(scope, accessor, (_) => thisObj.onDestroy?.()));
|
|
826
809
|
}
|
|
827
810
|
function removeChildNodes(startNode, endNode) {
|
|
828
811
|
for (endNode = endNode.nextSibling; startNode !== endNode;) {
|
|
@@ -1058,7 +1041,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1058
1041
|
}
|
|
1059
1042
|
if (!isPromise(promise)) return scope[tryAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1060
1043
|
let awaitCounter = tryBranch.O;
|
|
1061
|
-
scope[tryAccessor] || (scope[tryAccessor] = tryBranch,
|
|
1044
|
+
scope[tryAccessor] || (scope[tryAccessor] = tryBranch, onAbort(scope, promiseAccessor, (_) => {
|
|
1062
1045
|
scope[promiseAccessor] = 0, scope[tryAccessor] && queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
|
|
1063
1046
|
}), awaitBranch && (awaitBranch.W ||= []), tryBranch === awaitBranch ? (awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, (_) => {
|
|
1064
1047
|
if (tryBranch === scope[branchAccessor]) {
|
|
@@ -1204,4 +1187,4 @@ function bySecondArg(_item, index) {
|
|
|
1204
1187
|
function byFirstArg(name) {
|
|
1205
1188
|
return name;
|
|
1206
1189
|
}
|
|
1207
|
-
export { _attr_style_items as $, _on as $t, _attr_input_value as A, _closure_get as At, _controllable_select as B, _let as Bt, _attr_details_or_dialog_open_script as C, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, readyFailed as Dt, _attr_input_checkedValue_default as E, ready as Et, _attr_select_value as F, _global_read as Ft, _attr_class as G, _script as Gt, controllableScripts as H, _or as Ht, _attr_select_value_default as I, _hoist as It, _attr_class_names as J, _assert_init as Jt, _attr_class_item as K, _var as Kt, _attr_select_value_script as L, _hoist_resume as Lt, _attr_input_value_default as M, _el_read as Mt, _attr_input_value_dynamic_default as N, _for_closure as Nt, _attr_input_checked_default as O, withLazy as Ot, _attr_input_value_script as P, _for_selector as Pt, _attr_style_item as Q, syncGen as Qt, _controllable_input as R, _id as Rt, _attr_details_or_dialog_open_default as S, _var_resume as St, _attr_input_checkedValue as T, initEmbedded as Tt, controllableSpreadHelpers as U, _return as Ut, _controllable_textarea as V, _let_change as Vt, _attr as W, _return_change as Wt, _attr_nonce as X, insertBranchBefore as Xt, _attr_content as Y, destroyBranch as Yt, _attr_style as Z, removeAndDestroyBranch as Zt, patchDynamicTag as _,
|
|
1190
|
+
export { _attr_style_items as $, _on as $t, _attr_input_value as A, _closure_get as At, _controllable_select as B, _let as Bt, _attr_details_or_dialog_open_script as C, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, readyFailed as Dt, _attr_input_checkedValue_default as E, ready as Et, _attr_select_value as F, _global_read as Ft, _attr_class as G, _script as Gt, controllableScripts as H, _or as Ht, _attr_select_value_default as I, _hoist as It, _attr_class_names as J, _assert_init as Jt, _attr_class_item as K, _var as Kt, _attr_select_value_script as L, _hoist_resume as Lt, _attr_input_value_default as M, _el_read as Mt, _attr_input_value_dynamic_default as N, _for_closure as Nt, _attr_input_checked_default as O, withLazy as Ot, _attr_input_value_script as P, _for_selector as Pt, _attr_style_item as Q, syncGen as Qt, _controllable_input as R, _id as Rt, _attr_details_or_dialog_open_default as S, withBranches as Sn, _var_resume as St, _attr_input_checkedValue as T, initEmbedded as Tt, controllableSpreadHelpers as U, _return as Ut, _controllable_textarea as V, _let_change as Vt, _attr as W, _return_change as Wt, _attr_nonce as X, insertBranchBefore as Xt, _attr_content as Y, destroyBranch as Yt, _attr_style as Z, removeAndDestroyBranch as Zt, patchDynamicTag as _, forUntil as _n, createBranch as _t, _for_in as a, installCatch as an, _html as at, startAwait as b, _hoist_read_error as bn, _el as bt, _for_to as c, queueEffect as cn, _style_shell as ct, _for_until_unkeyed as d, run as dn, _to_text as dt, $signal as en, _attrs as et, _if as f, runEffects as fn, _content as ft, installDynamicTagVar as g, forTo as gn, createAndSetupBranch as gt, dynamicTagScript as h, forOf as hn, _return_setup as ht, _dynamic_tag_content as i, installBranchRenders as in, _attrs_script as it, _attr_input_value_attribute_default as j, _const as jt, _attr_input_checked_script as k, _closure as kt, _for_to_unkeyed as l, queueRender as ln, _text as lt, _try as m, forIn as mn, _content_resume as mt, _await_promise as n, onAbort as nn, _attrs_partial as nt, _for_of as o, prepareEffects as on, _lifecycle as ot, _show as p, runId as pn, _content_closures as pt, _attr_class_items as q, _var_change as qt, _dynamic_tag as r, createBranchRenders as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, queueAsyncRender as sn, _style_rule_item as st, _await_content as t, $signalReset as tn, _attrs_content as tt, _for_until as u, rendering as un, _text_content as ut, renderCatch as v, _assert_class_toggles as vn, setupBranch as vt, _attr_input_checked as w, init as wt, _attr_details_or_dialog_open as x, _call as xn, _resumed as xt, runPendingEffects as y, _assert_hoist as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, _if_closure as zt };
|
package/dist/dom.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { attrTag, attrTags } from "./common/attr-tag";
|
|
|
2
2
|
export { _assert_class_toggles, _assert_hoist, _hoist_read_error, } from "./common/errors";
|
|
3
3
|
export { forIn, forOf, forTo, forUntil } from "./common/for";
|
|
4
4
|
export { _call } from "./common/helpers";
|
|
5
|
-
export { $signal, $signalReset } from "./dom/abort-signal";
|
|
5
|
+
export { $signal, $signalReset, onAbort } from "./dom/abort-signal";
|
|
6
6
|
export { compat } from "./dom/compat";
|
|
7
7
|
export { _await_content, _await_promise, _dynamic_tag, _dynamic_tag_content, _for_in, _for_of, _for_of_unkeyed, _for_to, _for_to_unkeyed, _for_until, _for_until_unkeyed, _if, _show, _try, } from "./dom/control-flow";
|
|
8
8
|
export { _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checked_default, _attr_input_checked_script, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_input_value as _attr_textarea_value, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script as _attr_textarea_value_script, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, } from "./dom/controllable";
|
package/dist/dom.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
let require_control_flow = require("./dom-
|
|
2
|
+
let require_control_flow = require("./dom-B8j2453O.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
|
|
3
3
|
require_control_flow.wt($global.runtimeId);
|
|
4
4
|
let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
|
|
5
5
|
return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
|
|
6
6
|
}, compat = {
|
|
7
7
|
patchDynamicTag: require_control_flow._,
|
|
8
|
-
queueEffect: require_control_flow.
|
|
8
|
+
queueEffect: require_control_flow.cn,
|
|
9
9
|
init(warp10Noop) {
|
|
10
10
|
require_control_flow.xt.$C_s = (scope) => {
|
|
11
11
|
if (getRenderScopes(scope.$)[scope.L] = scope, scope.m5c && classIdToBranch.set(scope.m5c, scope), classEventResolver) for (let key in scope) {
|
|
@@ -39,7 +39,7 @@ let require_control_flow = require("./dom-C2-Flitp.js"), empty = [], rest = Symb
|
|
|
39
39
|
branch.S = startNode, branch.K = endNode;
|
|
40
40
|
},
|
|
41
41
|
runComponentEffects() {
|
|
42
|
-
this.effects && require_control_flow.
|
|
42
|
+
this.effects && require_control_flow.fn(this.effects);
|
|
43
43
|
},
|
|
44
44
|
runComponentDestroy() {
|
|
45
45
|
this.scope && require_control_flow.Yt(this.scope);
|
|
@@ -64,7 +64,7 @@ let require_control_flow = require("./dom-C2-Flitp.js"), empty = [], rest = Symb
|
|
|
64
64
|
let renderBranch = (_) => {
|
|
65
65
|
branch ||= (created = 1, component.scope = require_control_flow.gt(out.global, renderer, renderer.e, document.body)), renderer.g?.(branch), renderer.d?.(branch, renderer._ ? args[0] : args);
|
|
66
66
|
};
|
|
67
|
-
if (component.effects = require_control_flow.
|
|
67
|
+
if (component.effects = require_control_flow.un ? renderBranch() : require_control_flow.on(renderBranch), created) return branch.S.parentNode || branch.S;
|
|
68
68
|
}
|
|
69
69
|
}, _template = (id, template, walks, setup, inputSignal) => {
|
|
70
70
|
let renderer = require_control_flow.ft(id, template, walks, setup, inputSignal)();
|
|
@@ -102,12 +102,10 @@ function mount(input = {}, reference, position) {
|
|
|
102
102
|
break;
|
|
103
103
|
case "afterend": parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
|
104
104
|
}
|
|
105
|
-
let curValue, args = this.d, effects = require_control_flow.
|
|
106
|
-
branch = require_control_flow._t($global, this, void 0, parentNode), branch.T = (newValue) =>
|
|
107
|
-
curValue = newValue;
|
|
108
|
-
}, this.c?.(branch), args?.(branch, input);
|
|
105
|
+
let curValue, args = this.d, effects = require_control_flow.on((_) => {
|
|
106
|
+
branch = require_control_flow._t($global, this, void 0, parentNode), branch.T = (newValue) => curValue = newValue, this.c?.(branch), args?.(branch, input);
|
|
109
107
|
});
|
|
110
|
-
return require_control_flow.Xt(branch, parentNode, nextSibling), require_control_flow.
|
|
108
|
+
return require_control_flow.Xt(branch, parentNode, nextSibling), require_control_flow.fn(effects), {
|
|
111
109
|
get value() {
|
|
112
110
|
return curValue;
|
|
113
111
|
},
|
|
@@ -115,9 +113,7 @@ function mount(input = {}, reference, position) {
|
|
|
115
113
|
require_control_flow.qt(branch, newValue);
|
|
116
114
|
},
|
|
117
115
|
update(newInput = {}) {
|
|
118
|
-
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.
|
|
119
|
-
args(branch, newInput);
|
|
120
|
-
})));
|
|
116
|
+
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.fn(require_control_flow.on((_) => args(branch, newInput))));
|
|
121
117
|
},
|
|
122
118
|
destroy() {
|
|
123
119
|
require_control_flow.Zt(branch);
|
|
@@ -129,7 +125,7 @@ function _load_template(id, load) {
|
|
|
129
125
|
let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
130
126
|
let awaitCounter = require_control_flow.b(branch);
|
|
131
127
|
branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
|
|
132
|
-
Object.assign(lazyTemplate, renderer), require_control_flow.
|
|
128
|
+
Object.assign(lazyTemplate, renderer), require_control_flow.sn(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
|
|
133
129
|
}, loadFailed(branch, awaitCounter));
|
|
134
130
|
}, _load_signal((_) => (pending ||= load()).then((r) => ({ _: r.d || noop }))));
|
|
135
131
|
return lazyTemplate;
|
|
@@ -137,11 +133,11 @@ function _load_template(id, load) {
|
|
|
137
133
|
function _load_setup(load) {
|
|
138
134
|
let pending, renderer, insertCached = (child, marker) => insertLoaded(renderer, child, marker);
|
|
139
135
|
return (owner, child, marker) => {
|
|
140
|
-
if (child.X ||= /* @__PURE__ */ new Map(), renderer) require_control_flow.
|
|
136
|
+
if (child.X ||= /* @__PURE__ */ new Map(), renderer) require_control_flow.ln(child, insertCached, -1, marker);
|
|
141
137
|
else {
|
|
142
138
|
let awaitCounter = require_control_flow.b(owner);
|
|
143
139
|
(pending ||= load()).then((mod) => {
|
|
144
|
-
renderer ||= require_control_flow.ft("", ...mod._)(), require_control_flow.
|
|
140
|
+
renderer ||= require_control_flow.ft("", ...mod._)(), require_control_flow.sn(child, (child) => insertLoaded(renderer, child, marker, awaitCounter));
|
|
145
141
|
}, loadFailed(child, awaitCounter));
|
|
146
142
|
}
|
|
147
143
|
};
|
|
@@ -152,22 +148,22 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
152
148
|
}, insert = (_) => {
|
|
153
149
|
require_control_flow.Xt(branch, parent(), marker), marker.remove(), awaitCounter?.c();
|
|
154
150
|
}, remaining;
|
|
155
|
-
if (remaining = values
|
|
151
|
+
if (remaining = values.size) {
|
|
156
152
|
awaitCounter ||= require_control_flow.b(branch);
|
|
157
153
|
let fail = loadFailed(branch, awaitCounter);
|
|
158
|
-
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.
|
|
154
|
+
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.sn(branch, (branch) => {
|
|
159
155
|
create(), values.forEach(([value, apply]) => apply(branch, value)), insert();
|
|
160
156
|
}), (error) => remaining > 0 && (remaining = 0, fail(error))));
|
|
161
157
|
} else create(), insert();
|
|
162
158
|
}
|
|
163
159
|
function loadFailed(scope, awaitCounter) {
|
|
164
160
|
return (error) => {
|
|
165
|
-
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.i && awaitCounter.c()), require_control_flow.
|
|
161
|
+
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.i && awaitCounter.c()), require_control_flow.sn(scope, require_control_flow.v, error);
|
|
166
162
|
};
|
|
167
163
|
}
|
|
168
164
|
function _load_signal(load) {
|
|
169
165
|
let pending, apply = (scope, value) => {
|
|
170
|
-
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.
|
|
166
|
+
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.pn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => require_control_flow.sn(scope, apply._ = mod._, value), noop);
|
|
171
167
|
};
|
|
172
168
|
return apply;
|
|
173
169
|
}
|
|
@@ -194,9 +190,9 @@ function _load_race_trigger(...triggers) {
|
|
|
194
190
|
function getSelectorOrResolve(selector, resolve) {
|
|
195
191
|
return document.querySelector(selector) || resolve();
|
|
196
192
|
}
|
|
197
|
-
exports.$signal = require_control_flow.en, exports.$signalReset = require_control_flow.tn, exports._assert_class_toggles = require_control_flow.
|
|
193
|
+
exports.$signal = require_control_flow.en, exports.$signalReset = require_control_flow.tn, exports._assert_class_toggles = require_control_flow.vn, exports._assert_hoist = require_control_flow.yn, exports._assert_init = require_control_flow.Jt, exports._attr = require_control_flow.W, exports._attr_class = require_control_flow.G, exports._attr_class_item = require_control_flow.K, exports._attr_class_items = require_control_flow.q, exports._attr_class_names = require_control_flow.J, exports._attr_content = require_control_flow.Y, exports._attr_details_open = require_control_flow.x, exports._attr_dialog_open = require_control_flow.x, exports._attr_details_open_default = require_control_flow.S, exports._attr_dialog_open_default = require_control_flow.S, exports._attr_details_open_script = require_control_flow.C, exports._attr_dialog_open_script = require_control_flow.C, exports._attr_input_checked = require_control_flow.w, exports._attr_input_checkedValue = require_control_flow.T, exports._attr_input_checkedValue_default = require_control_flow.E, exports._attr_input_checkedValue_script = require_control_flow.D, exports._attr_input_checked_default = require_control_flow.O, exports._attr_input_checked_script = require_control_flow.k, exports._attr_input_value = require_control_flow.A, exports._attr_textarea_value = require_control_flow.A, exports._attr_input_value_attribute_default = require_control_flow.j, exports._attr_input_value_default = require_control_flow.M, exports._attr_textarea_value_default = require_control_flow.M, exports._attr_input_value_dynamic_default = require_control_flow.N, exports._attr_input_value_script = require_control_flow.P, exports._attr_textarea_value_script = require_control_flow.P, exports._attr_nonce = require_control_flow.X, exports._attr_select_value = require_control_flow.F, exports._attr_select_value_default = require_control_flow.I, exports._attr_select_value_script = require_control_flow.L, exports._attr_style = require_control_flow.Z, exports._attr_style_item = require_control_flow.Q, exports._attr_style_items = require_control_flow.$, exports._attrs = require_control_flow.et, exports._attrs_content = require_control_flow.tt, exports._attrs_partial = require_control_flow.nt, exports._attrs_partial_content = require_control_flow.rt, exports._attrs_script = require_control_flow.it, exports._await_content = require_control_flow.t, exports._await_promise = require_control_flow.n, exports._call = require_control_flow.xn, exports._closure = require_control_flow.kt, exports._closure_get = require_control_flow.At, exports._const = require_control_flow.jt, exports._content = require_control_flow.ft, exports._content_closures = require_control_flow.pt, exports._content_resume = require_control_flow.mt, exports._controllable_input = require_control_flow.R, exports._controllable_open = require_control_flow.z, exports._controllable_select = require_control_flow.B, exports._controllable_textarea = require_control_flow.V, Object.defineProperty(exports, "_dynamic_tag", {
|
|
198
194
|
enumerable: !0,
|
|
199
195
|
get: function() {
|
|
200
196
|
return require_control_flow.r;
|
|
201
197
|
}
|
|
202
|
-
}), exports._dynamic_tag_content = require_control_flow.i, exports._dynamic_tag_var_resume = require_control_flow.yt, exports._el = require_control_flow.bt, exports._el_read = require_control_flow.Mt, exports._for_closure = require_control_flow.Nt, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_of_unkeyed = require_control_flow.s, exports._for_selector = require_control_flow.Pt, exports._for_to = require_control_flow.c, exports._for_to_unkeyed = require_control_flow.l, exports._for_until = require_control_flow.u, exports._for_until_unkeyed = require_control_flow.d, exports._global_read = require_control_flow.Ft, exports._hoist = require_control_flow.It, exports._hoist_read_error = require_control_flow.
|
|
198
|
+
}), exports._dynamic_tag_content = require_control_flow.i, exports._dynamic_tag_var_resume = require_control_flow.yt, exports._el = require_control_flow.bt, exports._el_read = require_control_flow.Mt, exports._for_closure = require_control_flow.Nt, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_of_unkeyed = require_control_flow.s, exports._for_selector = require_control_flow.Pt, exports._for_to = require_control_flow.c, exports._for_to_unkeyed = require_control_flow.l, exports._for_until = require_control_flow.u, exports._for_until_unkeyed = require_control_flow.d, exports._global_read = require_control_flow.Ft, exports._hoist = require_control_flow.It, exports._hoist_read_error = require_control_flow.bn, exports._hoist_resume = require_control_flow.Lt, exports._html = require_control_flow.at, exports._id = require_control_flow.Rt, exports._if = require_control_flow.f, exports._if_closure = require_control_flow.zt, exports._let = require_control_flow.Bt, exports._let_change = require_control_flow.Vt, exports._lifecycle = require_control_flow.ot, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = require_control_flow.$t, exports._or = require_control_flow.Ht, exports._resumed = require_control_flow.xt, exports._return = require_control_flow.Ut, exports._return_change = require_control_flow.Wt, exports._return_setup = require_control_flow.ht, exports._script = require_control_flow.Gt, exports._show = require_control_flow.p, exports._style_rule_item = require_control_flow.st, exports._style_shell = require_control_flow.ct, exports._template = _template, exports._text = require_control_flow.lt, exports._text_content = require_control_flow.ut, exports._to_text = require_control_flow.dt, exports._try = require_control_flow.m, exports._var = require_control_flow.Kt, exports._var_change = require_control_flow.qt, exports._var_resume = require_control_flow.St, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.mn, exports.forOf = require_control_flow.hn, exports.forTo = require_control_flow.gn, exports.forUntil = require_control_flow._n, exports.init = require_control_flow.wt, exports.initEmbedded = require_control_flow.Tt, exports.onAbort = require_control_flow.nn, exports.ready = require_control_flow.Et, exports.readyFailed = require_control_flow.Dt, exports.run = require_control_flow.dn;
|