marko 6.4.8 → 6.4.10
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/cheatsheet.md +1 -1
- package/dist/common/constants/closure-signal-prop.d.ts +1 -1
- package/dist/common/constants/closure-signal-prop.debug.d.ts +1 -1
- package/dist/debug/dom/catch.feat.js +2 -3
- package/dist/debug/dom/catch.feat.mjs +2 -3
- package/dist/debug/dom/controllable-input.feat.js +2 -3
- package/dist/debug/dom/controllable-input.feat.mjs +2 -3
- package/dist/debug/dom/controllable-open.feat.js +2 -3
- package/dist/debug/dom/controllable-open.feat.mjs +2 -3
- package/dist/debug/dom/controllable-select.feat.js +2 -3
- package/dist/debug/dom/controllable-select.feat.mjs +2 -3
- package/dist/debug/dom/controllable-textarea.feat.js +2 -3
- package/dist/debug/dom/controllable-textarea.feat.mjs +2 -3
- package/dist/debug/dom/controllable.feat.js +2 -3
- package/dist/debug/dom/controllable.feat.mjs +2 -3
- package/dist/debug/dom/dynamic-tag-script.feat.js +2 -3
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +2 -3
- package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
- package/dist/debug/dom/lazy.feat.js +2 -3
- package/dist/debug/dom/lazy.feat.mjs +2 -3
- package/dist/debug/dom/placeholder.feat.js +2 -3
- package/dist/debug/dom/placeholder.feat.mjs +2 -3
- package/dist/debug/{dom-CFCBDift.mjs → dom-C1V5vpFs.mjs} +60 -98
- package/dist/debug/{dom-D8znnhpf.js → dom-DNB5yq3U.js} +59 -109
- package/dist/debug/dom.js +9 -14
- package/dist/debug/dom.mjs +9 -14
- package/dist/debug/html.js +39 -51
- package/dist/debug/html.mjs +37 -49
- package/dist/dom/catch.feat.js +4 -5
- package/dist/dom/catch.feat.mjs +2 -3
- package/dist/dom/compat.d.ts +1 -1
- package/dist/dom/control-flow.d.ts +1 -1
- package/dist/dom/controllable-input.feat.js +1 -2
- package/dist/dom/controllable-input.feat.mjs +1 -2
- package/dist/dom/controllable-open.feat.js +2 -3
- package/dist/dom/controllable-open.feat.mjs +2 -3
- package/dist/dom/controllable-select.feat.js +2 -3
- package/dist/dom/controllable-select.feat.mjs +2 -3
- package/dist/dom/controllable-textarea.feat.js +2 -3
- package/dist/dom/controllable-textarea.feat.mjs +2 -3
- package/dist/dom/controllable.feat.js +1 -2
- package/dist/dom/controllable.feat.mjs +1 -2
- package/dist/dom/dom.d.ts +2 -3
- package/dist/dom/dynamic-tag-script.feat.js +3 -4
- package/dist/dom/dynamic-tag-script.feat.mjs +2 -3
- package/dist/dom/dynamic-tag-var.feat.js +3 -4
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -2
- package/dist/dom/lazy.feat.js +2 -3
- package/dist/dom/lazy.feat.mjs +2 -3
- package/dist/dom/placeholder.feat.js +4 -5
- package/dist/dom/placeholder.feat.mjs +2 -3
- package/dist/dom/resume.d.ts +1 -1
- package/dist/dom/scope.d.ts +1 -1
- package/dist/dom/signals.d.ts +1 -1
- package/dist/{dom-Bpkm72vV.js → dom-C2-Flitp.js} +122 -166
- package/dist/{dom-CVAevsbz.mjs → dom-DsHYWMCR.mjs} +59 -94
- package/dist/dom.js +36 -40
- package/dist/dom.mjs +9 -14
- package/dist/html/serializer.d.ts +1 -1
- package/dist/html/writer.d.ts +3 -3
- package/dist/html.d.ts +1 -1
- package/dist/html.js +60 -74
- package/dist/html.mjs +60 -75
- package/dist/translator/core/show.d.ts +3 -4
- package/dist/translator/index.js +1193 -1295
- package/dist/translator/util/assert.d.ts +9 -2
- package/dist/translator/util/bindings.d.ts +6 -5
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/constants/slot-kind.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +3 -0
- package/dist/translator/util/module-registrations.d.ts +1 -1
- package/dist/translator/util/optional.d.ts +1 -0
- package/dist/translator/util/params-tree.d.ts +3 -3
- package/dist/translator/util/reasons.d.ts +2 -2
- package/dist/translator/util/references.d.ts +13 -10
- package/dist/translator/util/replace-with-statements.d.ts +4 -0
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/scope-accessor.d.ts +1 -1
- package/dist/translator/util/sections.d.ts +38 -14
- package/dist/translator/util/signals.d.ts +3 -11
- package/dist/translator/util/slots.d.ts +1 -1
- package/dist/translator/util/solve-reasons.d.ts +5 -0
- package/dist/translator/util/sources.d.ts +1 -1
- package/dist/translator/util/static-text.d.ts +1 -0
- package/dist/translator/util/structure.d.ts +3 -2
- package/dist/translator/util/tag-import.d.ts +0 -2
- package/dist/translator/util/tag-name-type.d.ts +3 -0
- package/dist/translator/util/write-guard.d.ts +2 -0
- package/dist/translator/visitors/placeholder.d.ts +4 -4
- package/package.json +6 -6
- package/tags/lifecycle.d.marko +2 -0
- package/dist/translator/visitors/constants/sibling-text.d.ts +0 -6
|
@@ -17,7 +17,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
17
17
|
}, runEffects = ((effects) => {
|
|
18
18
|
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
19
19
|
}), runRender = (render) => {
|
|
20
|
-
|
|
20
|
+
branchesEnabled && render.b.F?.H === 0 || render.c(render.b, render.d);
|
|
21
21
|
}, catchEnabled, abortsEnabled, subscriptionsEnabled, delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
22
22
|
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
|
|
23
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) {
|
|
@@ -46,7 +46,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
46
46
|
if (node === lastChild && !newNode) return;
|
|
47
47
|
}
|
|
48
48
|
let newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
|
|
49
|
-
branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild),
|
|
49
|
+
branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), firstChild.before(...newContent.childNodes), removeChildNodes(firstChild, lastChild);
|
|
50
50
|
}
|
|
51
51
|
}), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableSpreadHelpers = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
|
|
52
52
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
@@ -55,19 +55,14 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
55
55
|
return (scope, newBranch) => {
|
|
56
56
|
newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) && setBranch(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
|
|
57
57
|
};
|
|
58
|
-
}), _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor
|
|
59
|
-
nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor))
|
|
58
|
+
}), _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
|
|
59
|
+
nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor));
|
|
60
60
|
let rangeAccessor = "A" + nodeAccessor;
|
|
61
61
|
return (scope, display) => {
|
|
62
62
|
let referenceNode = scope[nodeAccessor], onlyChild = referenceNode.nodeType === 1, parentNode = onlyChild ? referenceNode : referenceNode.parentNode, range = scope[rangeAccessor];
|
|
63
|
-
range || (range = scope[rangeAccessor] = {}, range.S = onlyChild ? parentNode.
|
|
63
|
+
range || (range = scope[rangeAccessor] = {}, range.S = onlyChild ? parentNode.insertBefore(new Text(), parentNode.firstChild) : startNodeAccessor ? scope[startNodeAccessor] : referenceNode.previousSibling);
|
|
64
64
|
let startNode = range.S;
|
|
65
|
-
|
|
66
|
-
let wrapper = startNode;
|
|
67
|
-
wrapper.firstChild || wrapper.appendChild(new Text()), range = scope[rangeAccessor] = {}, range.S = startNode = wrapper.firstChild, range.K = wrapper.lastChild, wrapper.replaceWith(...wrapper.childNodes);
|
|
68
|
-
}
|
|
69
|
-
let inDom = onlyChild ? !!parentNode.firstChild : startNode.parentNode === parentNode;
|
|
70
|
-
display ? inDom || insertBranchBefore(range, parentNode, onlyChild ? null : referenceNode) : inDom && (onlyChild && (range.S = parentNode.firstChild, range.K = parentNode.lastChild), tempDetachBranch(range));
|
|
65
|
+
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));
|
|
71
66
|
};
|
|
72
67
|
}), _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagVar, inputIsArgs) => {
|
|
73
68
|
let scopeOffsetAccessor = getTagVar && decodeAccessor(nodeAccessor + 1);
|
|
@@ -123,16 +118,13 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
123
118
|
if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
|
|
124
119
|
oldLen && (oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch), hasSiblings || (parentNode.textContent = ""));
|
|
125
120
|
for (let newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
133
|
-
return;
|
|
121
|
+
} else {
|
|
122
|
+
if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
|
|
123
|
+
else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
|
|
124
|
+
for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd];) oldEnd--, newEnd--;
|
|
125
|
+
if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd || start > newEnd) for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
126
|
+
else reorder(newScopes, start, newEnd, parentNode, afterReference);
|
|
134
127
|
}
|
|
135
|
-
reorder(newScopes, start, newEnd, parentNode, afterReference);
|
|
136
128
|
};
|
|
137
129
|
}), _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
|
|
138
130
|
by ||= bySecondArg, typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
@@ -143,7 +135,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
143
135
|
}, reorderKeyed), _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
|
|
144
136
|
by ||= byFirstArg, forUntil(until, from, step, (v) => cb(by(v), [v]));
|
|
145
137
|
}, reorderKeyed), _for_of_unkeyed = /*@__PURE__*/ loop(([all], cb) => forOf(all, (item, i) => cb(i, [item, i]))), _for_to_unkeyed = /*@__PURE__*/ loop(([to, from, step], cb) => forTo(to, from, step, (v) => cb(v, [v]))), _for_until_unkeyed = /*@__PURE__*/ loop(([until, from, step], cb) => forUntil(until, from, step, (v) => cb(v, [v])));
|
|
146
|
-
|
|
138
|
+
// src/common/helpers.ts
|
|
147
139
|
function _call(fn, v) {
|
|
148
140
|
return fn(v), v;
|
|
149
141
|
}
|
|
@@ -186,13 +178,11 @@ function withBranches(runtime) {
|
|
|
186
178
|
function withDynamicHtml(runtime) {
|
|
187
179
|
return dynamicHtmlEnabled = 1, runtime;
|
|
188
180
|
}
|
|
189
|
-
|
|
190
|
-
//#region src/common/errors.ts
|
|
181
|
+
// src/common/errors.ts
|
|
191
182
|
function _assert_class_toggles(classes, toggles) {}
|
|
192
183
|
function _hoist_read_error() {}
|
|
193
184
|
function _assert_hoist(value) {}
|
|
194
|
-
|
|
195
|
-
//#region src/common/for.ts
|
|
185
|
+
// src/common/for.ts
|
|
196
186
|
function forIn(obj, cb) {
|
|
197
187
|
for (let key in obj) cb(key, obj[key]);
|
|
198
188
|
}
|
|
@@ -210,8 +200,7 @@ function forUntil(until, from, step, cb) {
|
|
|
210
200
|
let start = from || 0, delta = step || 1;
|
|
211
201
|
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
212
202
|
}
|
|
213
|
-
|
|
214
|
-
//#region src/dom/queue.ts
|
|
203
|
+
// src/dom/queue.ts
|
|
215
204
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope.L) {
|
|
216
205
|
let render;
|
|
217
206
|
if (signalKey >= 0 && (render = scope[signalKey])) {
|
|
@@ -294,8 +283,7 @@ function runRenders(renders = pendingRenders) {
|
|
|
294
283
|
runRender(render);
|
|
295
284
|
}
|
|
296
285
|
}
|
|
297
|
-
|
|
298
|
-
//#region src/dom/abort-signal.ts
|
|
286
|
+
// src/dom/abort-signal.ts
|
|
299
287
|
function $signalReset(scope, id) {
|
|
300
288
|
let ctrl = scope.A?.[id];
|
|
301
289
|
ctrl && (scope.A[id] = void 0, rendering ? queueEffect(ctrl, abort) : abort(ctrl));
|
|
@@ -315,8 +303,7 @@ function trackCleanup(scope, subscribers) {
|
|
|
315
303
|
function abort(ctrl) {
|
|
316
304
|
ctrl.abort();
|
|
317
305
|
}
|
|
318
|
-
|
|
319
|
-
//#region src/common/opt.ts
|
|
306
|
+
// src/common/opt.ts
|
|
320
307
|
function toArray(opt) {
|
|
321
308
|
return opt ? Array.isArray(opt) ? opt : [opt] : [];
|
|
322
309
|
}
|
|
@@ -329,8 +316,7 @@ function forEach(opt, cb) {
|
|
|
329
316
|
function push(opt, item) {
|
|
330
317
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
331
318
|
}
|
|
332
|
-
|
|
333
|
-
//#region src/dom/event.ts
|
|
319
|
+
// src/dom/event.ts
|
|
334
320
|
function _on(element, type, handler) {
|
|
335
321
|
delegate(type, handleDelegated), element[1 + type] = handler || null;
|
|
336
322
|
}
|
|
@@ -338,14 +324,12 @@ function handleDelegated(ev) {
|
|
|
338
324
|
let target = !rendering && ev.target;
|
|
339
325
|
for (; target;) target[1 + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
|
|
340
326
|
}
|
|
341
|
-
|
|
342
|
-
//#region src/dom/parse-html.ts
|
|
327
|
+
// src/dom/parse-html.ts
|
|
343
328
|
function parseHTML(html, ns) {
|
|
344
329
|
let parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
|
345
330
|
return parser.innerHTML = html, parser.content || parser;
|
|
346
331
|
}
|
|
347
|
-
|
|
348
|
-
//#region src/dom/scope.ts
|
|
332
|
+
// src/dom/scope.ts
|
|
349
333
|
function createScope($global, closestBranch) {
|
|
350
334
|
let scope = {
|
|
351
335
|
L: nextScopeId++,
|
|
@@ -389,14 +373,13 @@ function removeAndDestroyBranch(branch) {
|
|
|
389
373
|
destroyBranch(branch), removeChildNodes(branch.S, branch.K);
|
|
390
374
|
}
|
|
391
375
|
function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
392
|
-
|
|
376
|
+
parentNode.insertBefore(branch.S.parentNode || branch.S, nextSibling);
|
|
393
377
|
}
|
|
394
|
-
function
|
|
378
|
+
function detachBranch(branch) {
|
|
395
379
|
let fragment = new DocumentFragment();
|
|
396
380
|
fragment.namespaceURI = branch.S.parentNode.namespaceURI, insertChildNodes(fragment, null, branch.S, branch.K);
|
|
397
381
|
}
|
|
398
|
-
|
|
399
|
-
//#region src/dom/schedule.ts
|
|
382
|
+
// src/dom/schedule.ts
|
|
400
383
|
function schedule() {
|
|
401
384
|
isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
|
|
402
385
|
}
|
|
@@ -408,8 +391,7 @@ function triggerMacroTask() {
|
|
|
408
391
|
isScheduled = 0, run();
|
|
409
392
|
}), channel.port2.postMessage(0);
|
|
410
393
|
}
|
|
411
|
-
|
|
412
|
-
//#region src/dom/signals.ts
|
|
394
|
+
// src/dom/signals.ts
|
|
413
395
|
function _let(id, fn) {
|
|
414
396
|
let valueAccessor = decodeAccessor(id);
|
|
415
397
|
return (scope, value) => (rendering ? scope.H === runId && (scope[valueAccessor] = value, fn?.(scope)) : (scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn) && (schedule(), queueRender(scope, fn, id)), value);
|
|
@@ -420,7 +402,7 @@ function _let_change(id, fn) {
|
|
|
420
402
|
}
|
|
421
403
|
function _const(valueAccessor, fn) {
|
|
422
404
|
return valueAccessor = decodeAccessor(valueAccessor), ((scope, value) => {
|
|
423
|
-
|
|
405
|
+
scope[valueAccessor] === value && valueAccessor in scope || (scope[valueAccessor] = value, fn?.(scope));
|
|
424
406
|
});
|
|
425
407
|
}
|
|
426
408
|
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
|
|
@@ -541,14 +523,12 @@ function _hoist(...path) {
|
|
|
541
523
|
function _hoist_resume(id, ...path) {
|
|
542
524
|
return _resumed[id] = _hoist(...path);
|
|
543
525
|
}
|
|
544
|
-
|
|
545
|
-
//#region src/dom/walker.ts
|
|
526
|
+
// src/dom/walker.ts
|
|
546
527
|
/** Cloned templates are small, where a TreeWalker's per-step cost dominates. */
|
|
547
528
|
function walk(startNode, walkCodes, branch) {
|
|
548
529
|
currentNode = startNode, walkInternal(0, walkCodes, branch);
|
|
549
530
|
}
|
|
550
|
-
|
|
551
|
-
//#region src/dom/resume.ts
|
|
531
|
+
// src/dom/resume.ts
|
|
552
532
|
function ready(readyId) {
|
|
553
533
|
(readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
|
|
554
534
|
for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
|
|
@@ -585,21 +565,21 @@ function init(runtimeId = "M") {
|
|
|
585
565
|
if (visitType === "*") {
|
|
586
566
|
for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
|
|
587
567
|
(reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
branch._ ??= visitScope,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
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);
|
|
601
582
|
}
|
|
602
|
-
visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
|
|
603
583
|
}, nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
|
|
604
584
|
let i = 0;
|
|
605
585
|
for (; i < resumes.length; i++) {
|
|
@@ -646,7 +626,7 @@ function runResumeEffects(render) {
|
|
|
646
626
|
isResuming = 0;
|
|
647
627
|
}
|
|
648
628
|
}
|
|
649
|
-
function getRegisteredWithScope(
|
|
629
|
+
function getRegisteredWithScope(scope, id) {
|
|
650
630
|
return scope ? _resumed[id](scope) : _resumed[id];
|
|
651
631
|
}
|
|
652
632
|
function _var_resume(id, signal) {
|
|
@@ -661,8 +641,7 @@ function _dynamic_tag_var_resume(accessor) {
|
|
|
661
641
|
return node.nodeType === 8 ? node.previousSibling : node;
|
|
662
642
|
};
|
|
663
643
|
}
|
|
664
|
-
|
|
665
|
-
//#region src/dom/renderer.ts
|
|
644
|
+
// src/dom/renderer.ts
|
|
666
645
|
function createBranch($global, renderer, parentScope, parentNode) {
|
|
667
646
|
let branch = createScope($global);
|
|
668
647
|
return branch._ = renderer.e || parentScope, setParentBranch(branch, parentScope?.F), renderer.b?.(branch, parentNode.namespaceURI), branch;
|
|
@@ -718,16 +697,15 @@ function _content_closures(renderer, closureFns) {
|
|
|
718
697
|
};
|
|
719
698
|
}
|
|
720
699
|
function createCloneableHTML(html, ns) {
|
|
721
|
-
let { firstChild, lastChild } = parseHTML(html, ns), parent =
|
|
700
|
+
let { firstChild, lastChild } = parseHTML(html, ns), parent = new DocumentFragment();
|
|
722
701
|
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
|
|
723
702
|
walk(branch.S = branch.K = firstChild.cloneNode(!0), walks, branch);
|
|
724
703
|
} : (branch, walks) => {
|
|
725
704
|
let clone = parent.cloneNode(!0);
|
|
726
|
-
walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
|
|
705
|
+
clone.namespaceURI = ns, walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
|
|
727
706
|
};
|
|
728
707
|
}
|
|
729
|
-
|
|
730
|
-
//#region src/dom/dom.ts
|
|
708
|
+
// src/dom/dom.ts
|
|
731
709
|
function _to_text(value) {
|
|
732
710
|
return value || value === 0 ? value + "" : "";
|
|
733
711
|
}
|
|
@@ -847,28 +825,18 @@ function _lifecycle(scope, thisObj, index = 0) {
|
|
|
847
825
|
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), trackAbort(scope, accessor, (_) => thisObj.onDestroy?.()));
|
|
848
826
|
}
|
|
849
827
|
function removeChildNodes(startNode, endNode) {
|
|
850
|
-
|
|
851
|
-
for (; startNode !== stop;) {
|
|
828
|
+
for (endNode = endNode.nextSibling; startNode !== endNode;) {
|
|
852
829
|
let next = startNode.nextSibling;
|
|
853
830
|
startNode.remove(), startNode = next;
|
|
854
831
|
}
|
|
855
832
|
}
|
|
856
833
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
for (; startNode !== stop;) {
|
|
861
|
-
let next = startNode.nextSibling;
|
|
862
|
-
parentNode.insertBefore(startNode, referenceNode), startNode = next;
|
|
863
|
-
}
|
|
834
|
+
for (endNode = endNode.nextSibling; startNode !== endNode;) {
|
|
835
|
+
let next = startNode.nextSibling;
|
|
836
|
+
parentNode.insertBefore(startNode, referenceNode), startNode = next;
|
|
864
837
|
}
|
|
865
|
-
return parentNode;
|
|
866
|
-
}
|
|
867
|
-
function toInsertNode(startNode, endNode) {
|
|
868
|
-
return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
|
|
869
838
|
}
|
|
870
|
-
|
|
871
|
-
//#region src/dom/resolve-cursor-position.ts
|
|
839
|
+
// src/dom/resolve-cursor-position.ts
|
|
872
840
|
function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
|
|
873
841
|
if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
|
|
874
842
|
let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
|
|
@@ -880,8 +848,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
|
|
|
880
848
|
}
|
|
881
849
|
return -1;
|
|
882
850
|
}
|
|
883
|
-
|
|
884
|
-
//#region src/dom/controllable.ts
|
|
851
|
+
// src/dom/controllable.ts
|
|
885
852
|
function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
886
853
|
let el = scope[nodeAccessor], normalizedChecked = isNotNullishOrFalse(checked);
|
|
887
854
|
if (el.defaultChecked !== normalizedChecked) {
|
|
@@ -1072,8 +1039,7 @@ function _controllable_select(scope, nodeAccessor, nextAttrs) {
|
|
|
1072
1039
|
function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
1073
1040
|
if ("open" in nextAttrs || "openChange" in nextAttrs) return _attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), /^open(?:Change)?$/;
|
|
1074
1041
|
}
|
|
1075
|
-
|
|
1076
|
-
//#region src/dom/control-flow.ts
|
|
1042
|
+
// src/dom/control-flow.ts
|
|
1077
1043
|
function _await_promise(nodeAccessor, params) {
|
|
1078
1044
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1079
1045
|
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor, tryAccessor = "Q" + nodeAccessor, resolveAwait = (scope, referenceNode, value) => {
|
|
@@ -1103,7 +1069,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1103
1069
|
}
|
|
1104
1070
|
}
|
|
1105
1071
|
})), countAwait(awaitCounter, scope, (_) => {
|
|
1106
|
-
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S),
|
|
1072
|
+
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), detachBranch(tryBranch));
|
|
1107
1073
|
})) : awaitCounter = startAwait(scope, tryBranch));
|
|
1108
1074
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1109
1075
|
if (thisPromise === scope[promiseAccessor]) {
|
|
@@ -1134,7 +1100,7 @@ function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
|
|
|
1134
1100
|
if (!tryBranch) return;
|
|
1135
1101
|
let awaitCounter = tryBranch.O;
|
|
1136
1102
|
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, (_) => dismissPlaceholder(tryBranch))), countAwait(awaitCounter, tryBranch, (_) => {
|
|
1137
|
-
(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q(), tryBranch._, tryBranch.S.parentNode)).PT = tryBranch, insertBranchBefore(tryBranch.P, tryBranch.S.parentNode, tryBranch.S),
|
|
1103
|
+
(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q(), tryBranch._, tryBranch.S.parentNode)).PT = tryBranch, insertBranchBefore(tryBranch.P, tryBranch.S.parentNode, tryBranch.S), detachBranch(tryBranch);
|
|
1138
1104
|
}), awaitCounter;
|
|
1139
1105
|
}
|
|
1140
1106
|
function countAwait(awaitCounter, scope, render) {
|
|
@@ -1171,7 +1137,7 @@ function runPendingEffects(tryBranch) {
|
|
|
1171
1137
|
}
|
|
1172
1138
|
function dismissPlaceholder(tryBranch) {
|
|
1173
1139
|
let placeholderBranch = tryBranch.P;
|
|
1174
|
-
placeholderBranch && (tryBranch.P = 0,
|
|
1140
|
+
placeholderBranch && (tryBranch.P = 0, insertBranchBefore(tryBranch, placeholderBranch.S.parentNode, placeholderBranch.S), removeAndDestroyBranch(placeholderBranch));
|
|
1175
1141
|
}
|
|
1176
1142
|
function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
|
|
1177
1143
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
@@ -1230,7 +1196,7 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
|
|
|
1230
1196
|
}
|
|
1231
1197
|
}
|
|
1232
1198
|
for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
|
|
1233
|
-
for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
|
|
1199
|
+
for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : (~sources[i] && detachBranch(newScopes[start + i]), insertBranchBefore(newScopes[start + i], parentNode, afterReference)), afterReference = newScopes[start + i].S;
|
|
1234
1200
|
}
|
|
1235
1201
|
function bySecondArg(_item, index) {
|
|
1236
1202
|
return index;
|
|
@@ -1238,5 +1204,4 @@ function bySecondArg(_item, index) {
|
|
|
1238
1204
|
function byFirstArg(name) {
|
|
1239
1205
|
return name;
|
|
1240
1206
|
}
|
|
1241
|
-
|
|
1242
|
-
export { _attr_style_items as $, removeAndDestroyBranch as $t, _attr_input_value as A, withLazy as At, _controllable_select as B, _id as Bt, _attr_details_or_dialog_open_script as C, withBranches as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, initEmbedded as Dt, _attr_input_checkedValue_default as E, init as Et, _attr_select_value as F, _for_closure as Ft, _attr_class as G, _return as Gt, controllableScripts as H, _let as Ht, _attr_select_value_default as I, _for_selector as It, _attr_class_names as J, _var as Jt, _attr_class_item as K, _return_change as Kt, _attr_select_value_script as L, _global_read as Lt, _attr_input_value_default as M, _closure_get as Mt, _attr_input_value_dynamic_default as N, _const as Nt, _attr_input_checked_default as O, ready as Ot, _attr_input_value_script as P, _el_read as Pt, _attr_style_item as Q, insertBranchBefore as Qt, _controllable_input as R, _hoist as Rt, _attr_details_or_dialog_open_default as S, _call as Sn, _el as St, _attr_input_checkedValue as T, getRegisteredWithScope as Tt, controllableSpreadHelpers as U, _let_change as Ut, _controllable_textarea as V, _if_closure as Vt, _attr as W, _or as Wt, _attr_nonce as X, _assert_init as Xt, _attr_content as Y, _var_change as Yt, _attr_style as Z, destroyBranch as Zt, patchDynamicTag as _, forTo as _n, _return_setup as _t, _for_in as a, installBranchRenders as an, _html as at, startAwait as b, _assert_hoist as bn, setupBranch as bt, _for_to as c, queueAsyncRender as cn, _style_shell as ct, _for_until_unkeyed as d, rendering as dn, _to_text as dt, syncGen as en, _attrs as et, _if as f, run as fn, insertChildNodes as ft, installDynamicTagVar as g, forOf as gn, _content_resume as gt, dynamicTagScript as h, forIn as hn, _content_closures as ht, _dynamic_tag_content as i, createBranchRenders as in, _attrs_script as it, _attr_input_value_attribute_default as j, _closure as jt, _attr_input_checked_script as k, readyFailed as kt, _for_to_unkeyed as l, queueEffect as ln, _text as lt, _try as m, runId as mn, _content as mt, _await_promise as n, $signal as nn, _attrs_partial as nt, _for_of as o, installCatch as on, _lifecycle as ot, _show as p, runEffects as pn, toInsertNode as pt, _attr_class_items as q, _script as qt, _dynamic_tag as r, $signalReset as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, prepareEffects as sn, _style_rule_item as st, _await_content as t, _on as tn, _attrs_content as tt, _for_until as u, queueRender as un, _text_content as ut, renderCatch as v, forUntil as vn, createAndSetupBranch as vt, _attr_input_checked as w, _var_resume as wt, _attr_details_or_dialog_open as x, _hoist_read_error as xn, _dynamic_tag_var_resume as xt, runPendingEffects as y, _assert_class_toggles as yn, createBranch as yt, _controllable_open as z, _hoist_resume as zt };
|
|
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 _, _assert_class_toggles as _n, createBranch as _t, _for_in as a, prepareEffects as an, _html as at, startAwait as b, _call as bn, _el as bt, _for_to as c, queueRender as cn, _style_shell as ct, _for_until_unkeyed as d, runEffects as dn, _to_text as dt, $signal as en, _attrs as et, _if as f, runId as fn, _content as ft, installDynamicTagVar as g, forUntil as gn, createAndSetupBranch as gt, dynamicTagScript as h, forTo as hn, _return_setup as ht, _dynamic_tag_content as i, installCatch 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, rendering as ln, _text as lt, _try as m, forOf as mn, _content_resume as mt, _await_promise as n, createBranchRenders as nn, _attrs_partial as nt, _for_of as o, queueAsyncRender as on, _lifecycle as ot, _show as p, forIn as pn, _content_closures as pt, _attr_class_items as q, _var_change as qt, _dynamic_tag as r, installBranchRenders as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, queueEffect as sn, _style_rule_item as st, _await_content as t, $signalReset as tn, _attrs_content as tt, _for_until as u, run as un, _text_content as ut, renderCatch as v, _assert_hoist as vn, setupBranch as vt, _attr_input_checked as w, init as wt, _attr_details_or_dialog_open as x, withBranches as xn, _resumed as xt, runPendingEffects as y, _hoist_read_error as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, _if_closure as zt };
|
package/dist/dom.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
let require_control_flow = require("./dom-
|
|
3
|
-
require_control_flow.
|
|
2
|
+
let require_control_flow = require("./dom-C2-Flitp.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
|
|
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.sn,
|
|
9
9
|
init(warp10Noop) {
|
|
10
|
-
require_control_flow.
|
|
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) {
|
|
12
12
|
let resolved = classEventResolver(scope[key], scope);
|
|
13
13
|
resolved !== scope[key] && (scope[key] = resolved);
|
|
14
14
|
}
|
|
15
|
-
}, require_control_flow.
|
|
15
|
+
}, require_control_flow.xt.$C_b = warp10Noop;
|
|
16
16
|
},
|
|
17
17
|
setClassEventResolver(fn) {
|
|
18
18
|
classEventResolver = fn;
|
|
19
19
|
},
|
|
20
20
|
resumeClassFunction(id, build) {
|
|
21
|
-
require_control_flow.
|
|
21
|
+
require_control_flow.xt[id] = build;
|
|
22
22
|
},
|
|
23
23
|
getScope($global, scopeId) {
|
|
24
24
|
return getRenderScopes($global)?.[scopeId];
|
|
@@ -39,39 +39,39 @@ let require_control_flow = require("./dom-Bpkm72vV.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.dn(this.effects);
|
|
43
43
|
},
|
|
44
44
|
runComponentDestroy() {
|
|
45
|
-
this.scope && require_control_flow.
|
|
45
|
+
this.scope && require_control_flow.Yt(this.scope);
|
|
46
46
|
},
|
|
47
47
|
resolveRegistered(value, $global) {
|
|
48
|
-
return Array.isArray(value) && typeof value[0] == "string" ? require_control_flow.
|
|
48
|
+
return Array.isArray(value) && typeof value[0] == "string" ? require_control_flow.Ct(getRenderScopes($global)?.[value[1]], value[0]) : value;
|
|
49
49
|
},
|
|
50
50
|
createRenderer(params, clone) {
|
|
51
|
-
let renderer = require_control_flow.
|
|
51
|
+
let renderer = require_control_flow.ft("", 0, 0, 0, params)();
|
|
52
52
|
return renderer.b = (branch) => {
|
|
53
53
|
let cloned = clone();
|
|
54
54
|
branch.S = cloned.startNode, branch.K = cloned.endNode;
|
|
55
55
|
}, renderer;
|
|
56
56
|
},
|
|
57
57
|
render(out, component, renderer, args) {
|
|
58
|
-
require_control_flow.
|
|
58
|
+
require_control_flow.wt(out.global.runtimeId);
|
|
59
59
|
let branch = component.scope, created = 0;
|
|
60
60
|
if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), args[0] && typeof args[0] == "object" && "renderBody" in args[0]) {
|
|
61
61
|
let input = args[0], normalizedInput = args[0] = {};
|
|
62
62
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
63
63
|
}
|
|
64
64
|
let renderBranch = (_) => {
|
|
65
|
-
branch ||= (created = 1, component.scope = require_control_flow.
|
|
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.ln ? renderBranch() : require_control_flow.an(renderBranch), created) return branch.S.parentNode || branch.S;
|
|
68
68
|
}
|
|
69
69
|
}, _template = (id, template, walks, setup, inputSignal) => {
|
|
70
|
-
let renderer = require_control_flow.
|
|
71
|
-
return renderer.mount = mount, renderer._ = renderer, require_control_flow.
|
|
70
|
+
let renderer = require_control_flow.ft(id, template, walks, setup, inputSignal)();
|
|
71
|
+
return renderer.mount = mount, renderer._ = renderer, require_control_flow.xt[id] = renderer;
|
|
72
72
|
}, noop = (_) => 0;
|
|
73
73
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
74
|
-
|
|
74
|
+
// src/common/attr-tag.ts
|
|
75
75
|
function attrTag(attrs) {
|
|
76
76
|
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
77
77
|
}
|
|
@@ -81,12 +81,9 @@ function attrTags(first, attrs) {
|
|
|
81
81
|
function* attrTagIterator() {
|
|
82
82
|
yield this, yield* this[rest];
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
//#region src/dom/compat.ts
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/dom/template.ts
|
|
84
|
+
// src/common/compat-meta.ts
|
|
85
|
+
// src/dom/compat.ts
|
|
86
|
+
// src/dom/template.ts
|
|
90
87
|
function mount(input = {}, reference, position) {
|
|
91
88
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
|
92
89
|
switch ($global ? ({$global, ...input} = input, $global = {
|
|
@@ -105,35 +102,34 @@ function mount(input = {}, reference, position) {
|
|
|
105
102
|
break;
|
|
106
103
|
case "afterend": parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
|
107
104
|
}
|
|
108
|
-
let curValue, args = this.d, effects = require_control_flow.
|
|
109
|
-
branch = require_control_flow.
|
|
105
|
+
let curValue, args = this.d, effects = require_control_flow.an((_) => {
|
|
106
|
+
branch = require_control_flow._t($global, this, void 0, parentNode), branch.T = (newValue) => {
|
|
110
107
|
curValue = newValue;
|
|
111
108
|
}, this.c?.(branch), args?.(branch, input);
|
|
112
109
|
});
|
|
113
|
-
return require_control_flow.
|
|
110
|
+
return require_control_flow.Xt(branch, parentNode, nextSibling), require_control_flow.dn(effects), {
|
|
114
111
|
get value() {
|
|
115
112
|
return curValue;
|
|
116
113
|
},
|
|
117
114
|
set value(newValue) {
|
|
118
|
-
require_control_flow.
|
|
115
|
+
require_control_flow.qt(branch, newValue);
|
|
119
116
|
},
|
|
120
117
|
update(newInput = {}) {
|
|
121
|
-
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.
|
|
118
|
+
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.dn(require_control_flow.an((_) => {
|
|
122
119
|
args(branch, newInput);
|
|
123
120
|
})));
|
|
124
121
|
},
|
|
125
122
|
destroy() {
|
|
126
|
-
require_control_flow
|
|
123
|
+
require_control_flow.Zt(branch);
|
|
127
124
|
}
|
|
128
125
|
};
|
|
129
126
|
}
|
|
130
|
-
|
|
131
|
-
//#region src/dom/load.ts
|
|
127
|
+
// src/dom/load.ts
|
|
132
128
|
function _load_template(id, load) {
|
|
133
129
|
let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
134
130
|
let awaitCounter = require_control_flow.b(branch);
|
|
135
131
|
branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
|
|
136
|
-
Object.assign(lazyTemplate, renderer), require_control_flow.
|
|
132
|
+
Object.assign(lazyTemplate, renderer), require_control_flow.on(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
|
|
137
133
|
}, loadFailed(branch, awaitCounter));
|
|
138
134
|
}, _load_signal((_) => (pending ||= load()).then((r) => ({ _: r.d || noop }))));
|
|
139
135
|
return lazyTemplate;
|
|
@@ -141,37 +137,37 @@ function _load_template(id, load) {
|
|
|
141
137
|
function _load_setup(load) {
|
|
142
138
|
let pending, renderer, insertCached = (child, marker) => insertLoaded(renderer, child, marker);
|
|
143
139
|
return (owner, child, marker) => {
|
|
144
|
-
if (child.X ||= /* @__PURE__ */ new Map(), renderer) require_control_flow.
|
|
140
|
+
if (child.X ||= /* @__PURE__ */ new Map(), renderer) require_control_flow.cn(child, insertCached, -1, marker);
|
|
145
141
|
else {
|
|
146
142
|
let awaitCounter = require_control_flow.b(owner);
|
|
147
143
|
(pending ||= load()).then((mod) => {
|
|
148
|
-
renderer ||= require_control_flow.
|
|
144
|
+
renderer ||= require_control_flow.ft("", ...mod._)(), require_control_flow.on(child, (child) => insertLoaded(renderer, child, marker, awaitCounter));
|
|
149
145
|
}, loadFailed(child, awaitCounter));
|
|
150
146
|
}
|
|
151
147
|
};
|
|
152
148
|
}
|
|
153
149
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
154
150
|
let parent = (_) => marker.parentNode, values = branch.X, create = (_) => {
|
|
155
|
-
require_control_flow.
|
|
151
|
+
require_control_flow.Qt(branch), renderer.b(branch, parent().namespaceURI), branch.X = 0, require_control_flow.vt(renderer, branch);
|
|
156
152
|
}, insert = (_) => {
|
|
157
|
-
require_control_flow.
|
|
153
|
+
require_control_flow.Xt(branch, parent(), marker), marker.remove(), awaitCounter?.c();
|
|
158
154
|
}, remaining;
|
|
159
155
|
if (remaining = values?.size) {
|
|
160
156
|
awaitCounter ||= require_control_flow.b(branch);
|
|
161
157
|
let fail = loadFailed(branch, awaitCounter);
|
|
162
|
-
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.
|
|
158
|
+
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.on(branch, (branch) => {
|
|
163
159
|
create(), values.forEach(([value, apply]) => apply(branch, value)), insert();
|
|
164
160
|
}), (error) => remaining > 0 && (remaining = 0, fail(error))));
|
|
165
161
|
} else create(), insert();
|
|
166
162
|
}
|
|
167
163
|
function loadFailed(scope, awaitCounter) {
|
|
168
164
|
return (error) => {
|
|
169
|
-
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.i && awaitCounter.c()), require_control_flow.
|
|
165
|
+
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.i && awaitCounter.c()), require_control_flow.on(scope, require_control_flow.v, error);
|
|
170
166
|
};
|
|
171
167
|
}
|
|
172
168
|
function _load_signal(load) {
|
|
173
169
|
let pending, apply = (scope, value) => {
|
|
174
|
-
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.
|
|
170
|
+
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.fn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => require_control_flow.on(scope, apply._ = mod._, value), noop);
|
|
175
171
|
};
|
|
176
172
|
return apply;
|
|
177
173
|
}
|
|
@@ -198,9 +194,9 @@ function _load_race_trigger(...triggers) {
|
|
|
198
194
|
function getSelectorOrResolve(selector, resolve) {
|
|
199
195
|
return document.querySelector(selector) || resolve();
|
|
200
196
|
}
|
|
201
|
-
exports.$signal = require_control_flow.
|
|
197
|
+
exports.$signal = require_control_flow.en, exports.$signalReset = require_control_flow.tn, exports._assert_class_toggles = require_control_flow._n, exports._assert_hoist = require_control_flow.vn, 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.bn, 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", {
|
|
202
198
|
enumerable: !0,
|
|
203
199
|
get: function() {
|
|
204
200
|
return require_control_flow.r;
|
|
205
201
|
}
|
|
206
|
-
}), exports._dynamic_tag_content = require_control_flow.i, exports._dynamic_tag_var_resume = require_control_flow.
|
|
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.yn, 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.pn, exports.forOf = require_control_flow.mn, exports.forTo = require_control_flow.hn, exports.forUntil = require_control_flow.gn, exports.init = require_control_flow.wt, exports.initEmbedded = require_control_flow.Tt, exports.ready = require_control_flow.Et, exports.readyFailed = require_control_flow.Dt, exports.run = require_control_flow.un;
|