marko 6.4.1 → 6.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cheatsheet.md +1 -1
- package/dist/common/errors.d.ts +1 -0
- package/dist/common/opt.d.ts +1 -0
- 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-ClV4kVOO.js → dom-BLbR0hEx.js} +30 -0
- package/dist/debug/{dom-LFrKxOk5.mjs → dom-Cii0IA92.mjs} +19 -1
- package/dist/debug/dom.js +7 -4
- package/dist/debug/dom.mjs +6 -5
- package/dist/debug/html.js +280 -76
- package/dist/debug/html.mjs +280 -77
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- 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/dom.d.ts +1 -0
- 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 +1 -1
- 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/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/{dom-CNglVi8P.js → dom-B8UEYzOz.js} +99 -80
- package/dist/{dom-DfP3MCo0.mjs → dom-BPjLe6YU.mjs} +10 -1
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +34 -33
- package/dist/dom.mjs +6 -5
- package/dist/html/assets.d.ts +12 -6
- package/dist/html/attrs.d.ts +1 -0
- package/dist/html/compat.d.ts +10 -2
- package/dist/html/serializer.d.ts +1 -0
- package/dist/html/writer.d.ts +8 -0
- package/dist/html.d.ts +1 -1
- package/dist/html.js +194 -59
- package/dist/html.mjs +194 -59
- package/dist/translator/index.js +404 -190
- package/dist/translator/util/bindings.d.ts +9 -1
- package/dist/translator/util/constants/structure-kind.d.ts +1 -0
- package/dist/translator/util/known-tag.d.ts +2 -1
- package/dist/translator/util/module-read.d.ts +21 -0
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/util/runtime.d.ts +2 -0
- package/dist/translator/util/sections.d.ts +5 -1
- package/dist/translator/util/structure.d.ts +1 -0
- package/package.json +3 -3
package/dist/html.js
CHANGED
|
@@ -285,8 +285,9 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
285
285
|
let patched = patch(tag, scopeId, accessor);
|
|
286
286
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
287
287
|
};
|
|
288
|
-
})(_dynamic_tag), CONSUMED_RESULT_MESSAGE = "Cannot read from a consumed render result", _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(),
|
|
288
|
+
})(_dynamic_tag), CONSUMED_RESULT_MESSAGE = "Cannot read from a consumed render result", _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kHead = Symbol(), SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
289
289
|
$global,
|
|
290
|
+
writeLoadAsset,
|
|
290
291
|
fork: _await,
|
|
291
292
|
write: _html,
|
|
292
293
|
writeScript,
|
|
@@ -305,7 +306,8 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
305
306
|
onFlush(fn) {
|
|
306
307
|
let { flushHTML } = Chunk.prototype;
|
|
307
308
|
Chunk.prototype.flushHTML = function(boundary) {
|
|
308
|
-
|
|
309
|
+
let { state } = boundary, reorders = swapReorders(state, null);
|
|
310
|
+
return fn(this), swapReorders(state, reorders), flushHTML.call(this, boundary);
|
|
309
311
|
};
|
|
310
312
|
},
|
|
311
313
|
patchDynamicTag,
|
|
@@ -328,24 +330,45 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
328
330
|
return compatRegistered;
|
|
329
331
|
};
|
|
330
332
|
},
|
|
333
|
+
joinChunks(chunks) {
|
|
334
|
+
let joined;
|
|
335
|
+
for (let chunk of chunks) chunk.boundary.aborted || (joined ? joined.append(chunk) : joined = chunk);
|
|
336
|
+
return joined;
|
|
337
|
+
},
|
|
338
|
+
appendChunks(chunks) {
|
|
339
|
+
let chunk = getChunk();
|
|
340
|
+
for (let part of chunks) chunk.append(part), part.effects && (chunk.lastEffect = part.lastEffect);
|
|
341
|
+
},
|
|
342
|
+
deferReorders(reorders) {
|
|
343
|
+
let chunk = getChunk();
|
|
344
|
+
for (let i = reorders.length; i--;) {
|
|
345
|
+
let carrier = chunk.fork(chunk.boundary, chunk.next);
|
|
346
|
+
carrier.deferredReorder = reorders[i], chunk.next = carrier;
|
|
347
|
+
}
|
|
348
|
+
},
|
|
331
349
|
createChunk($global) {
|
|
332
350
|
let state = this.ensureState($global);
|
|
333
351
|
return new Chunk(new Boundary(state), null, null, state);
|
|
334
352
|
},
|
|
335
|
-
flushScript(
|
|
336
|
-
chunk
|
|
337
|
-
|
|
338
|
-
if (boundary.aborted) throw boundary.reason;
|
|
353
|
+
flushScript(chunk, reorders) {
|
|
354
|
+
let { boundary } = chunk, { state } = boundary, html = "", scripts = "";
|
|
355
|
+
if (reorders) for (let reorder of reorders) state.reorder(reorder);
|
|
356
|
+
if (boundary.flush() === 0 && ({html, scripts} = chunk.flushScript(boundary)), boundary.aborted) throw boundary.reason;
|
|
339
357
|
if (boundary.count) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
340
|
-
return
|
|
358
|
+
return {
|
|
359
|
+
html,
|
|
360
|
+
scripts
|
|
361
|
+
};
|
|
341
362
|
},
|
|
342
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
|
343
|
-
|
|
363
|
+
render(renderer, willRerender, classAPIOut, component, input, componentScopes, registerChildScope, parentChunk) {
|
|
364
|
+
if (parentChunk?.boundary.aborted) return;
|
|
365
|
+
let state = this.ensureState(classAPIOut.global), boundary = new Boundary(state, void 0, parentChunk?.boundary), context = getChunk()?.context ?? null, head = new Chunk(boundary, new Chunk(boundary, null, context, state), context, state), normalizedInput = input;
|
|
344
366
|
if ("renderBody" in input) {
|
|
345
367
|
normalizedInput = {};
|
|
346
368
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
347
369
|
}
|
|
348
|
-
|
|
370
|
+
let componentScope = new Chunk(boundary, null, context, state);
|
|
371
|
+
componentScope.render(() => {
|
|
349
372
|
if (this.hasPendingClassFunctions(classAPIOut.global) && drainClassFunctions(classAPIOut.global, (hostId) => {
|
|
350
373
|
let fnScopeId = _scope_id(), scope = writeScope(fnScopeId, {
|
|
351
374
|
m5c: component.id,
|
|
@@ -356,6 +379,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
356
379
|
let scopeId = _peek_scope_id();
|
|
357
380
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
358
381
|
}
|
|
382
|
+
}), head.render(() => {
|
|
359
383
|
_set_scope_reason(willRerender ? CLIENT_ALL : 0);
|
|
360
384
|
try {
|
|
361
385
|
renderer(normalizedInput);
|
|
@@ -368,7 +392,16 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
368
392
|
});
|
|
369
393
|
classAPIOut.onLast((next) => {
|
|
370
394
|
(boundary.onNext = () => {
|
|
371
|
-
|
|
395
|
+
if (boundary.aborted) boundary.onNext = NOOP, parentChunk?.boundary.aborted ? (asyncOut.end(), next()) : asyncOut.error(boundary.reason);
|
|
396
|
+
else if (!boundary.count) {
|
|
397
|
+
boundary.onNext = NOOP;
|
|
398
|
+
let queued = swapReorders(state, null);
|
|
399
|
+
head = head.consume(boundary);
|
|
400
|
+
let reorders = swapReorders(state, queued);
|
|
401
|
+
reorders && asyncOut.writer.get("reorders").push(...reorders);
|
|
402
|
+
let heldEffects = head.takeHeldEffects();
|
|
403
|
+
heldEffects && (head.effects = joinHeldEffects(heldEffects, head.effects), head.lastEffect = ""), asyncOut.write(head.html), asyncOut.script(head.scripts), head.html = head.scripts = "", asyncOut.writer.get("chunks").push(head), asyncOut.end(), componentScopes.push(componentScope), next();
|
|
404
|
+
}
|
|
372
405
|
})();
|
|
373
406
|
});
|
|
374
407
|
});
|
|
@@ -450,6 +483,7 @@ function normalizeDynamicRenderer(value) {
|
|
|
450
483
|
}
|
|
451
484
|
//#endregion
|
|
452
485
|
//#region src/common/errors.ts
|
|
486
|
+
function _assert_class_toggles(classes, toggles) {}
|
|
453
487
|
function _el_read_error() {}
|
|
454
488
|
function _hoist_read_error() {}
|
|
455
489
|
function _assert_hoist(value) {}
|
|
@@ -474,6 +508,13 @@ function forUntil(until, from, step, cb) {
|
|
|
474
508
|
}
|
|
475
509
|
//#endregion
|
|
476
510
|
//#region src/common/opt.ts
|
|
511
|
+
function reduce(opt, cb, acc) {
|
|
512
|
+
if (opt) {
|
|
513
|
+
if (Array.isArray(opt)) for (let item of opt) acc = cb(acc, item);
|
|
514
|
+
else acc = cb(acc, opt);
|
|
515
|
+
}
|
|
516
|
+
return acc;
|
|
517
|
+
}
|
|
477
518
|
function push(opt, item) {
|
|
478
519
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
479
520
|
}
|
|
@@ -546,6 +587,14 @@ var State$1 = class {
|
|
|
546
587
|
channel
|
|
547
588
|
});
|
|
548
589
|
}
|
|
590
|
+
dropCall(value, object, property) {
|
|
591
|
+
let { mutated } = this.#state;
|
|
592
|
+
for (let i = 0; i < mutated.length; i++) {
|
|
593
|
+
let mutation = mutated[i];
|
|
594
|
+
if (mutation.value === value && mutation.object === object && mutation.property === property) return mutated.splice(i, 1), !0;
|
|
595
|
+
}
|
|
596
|
+
return !1;
|
|
597
|
+
}
|
|
549
598
|
};
|
|
550
599
|
function register(id, val, scope, locals) {
|
|
551
600
|
return REGISTRY.set(val, {
|
|
@@ -1486,6 +1535,15 @@ function _html(html) {
|
|
|
1486
1535
|
function writeScript(script) {
|
|
1487
1536
|
$chunk.writeScript(script);
|
|
1488
1537
|
}
|
|
1538
|
+
function catchableBoundary() {
|
|
1539
|
+
let { boundary } = $chunk;
|
|
1540
|
+
return boundary.withinCatch ? boundary : null;
|
|
1541
|
+
}
|
|
1542
|
+
function mayDrop(written) {
|
|
1543
|
+
let { boundary } = $chunk;
|
|
1544
|
+
for (let cur = written; cur && !isWithin(boundary, cur); cur = cur.parent) if (cur.aborted || cur.count) return !0;
|
|
1545
|
+
return !1;
|
|
1546
|
+
}
|
|
1489
1547
|
function _script(scopeId, registryId, markerGuard) {
|
|
1490
1548
|
markerGuard === 0 && ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1491
1549
|
}
|
|
@@ -1635,8 +1693,8 @@ function scopeWithId(state, scopeId) {
|
|
|
1635
1693
|
}
|
|
1636
1694
|
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
1637
1695
|
if (subscribers) {
|
|
1638
|
-
let {
|
|
1639
|
-
|
|
1696
|
+
let { boundary, serializeState } = $chunk, { serializer } = boundary.state;
|
|
1697
|
+
!serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId, markerGuard) : serializer.writeCall(scope, subscribers, "add", serializeState), boundary.withinCatch && (boundary.subscribed ||= []).push(subscribers, scope, serializeState);
|
|
1640
1698
|
}
|
|
1641
1699
|
return scope;
|
|
1642
1700
|
}
|
|
@@ -1713,7 +1771,9 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1713
1771
|
};
|
|
1714
1772
|
}
|
|
1715
1773
|
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
1716
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, void 0, boundary)
|
|
1774
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, void 0, boundary);
|
|
1775
|
+
catchContent && (catchBoundary.withinCatch = !0);
|
|
1776
|
+
let body = chunk.fork(catchBoundary, null), bodyEnd = body.render(() => withBranchId(branchId, content));
|
|
1717
1777
|
if (catchBoundary.aborted) {
|
|
1718
1778
|
if (!catchContent) throw catchBoundary.reason;
|
|
1719
1779
|
return catchContent(catchBoundary.reason), !0;
|
|
@@ -1733,10 +1793,10 @@ function tryBoundary(content, catchContent, branchId, renderers) {
|
|
|
1733
1793
|
return;
|
|
1734
1794
|
}
|
|
1735
1795
|
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
1736
|
-
chunk.catchRange = null;
|
|
1796
|
+
chunk.catchRange = null, renderersAtSettle || catchChunk.render(clearTryRenderers, branchId);
|
|
1737
1797
|
let inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
1738
1798
|
if (boundary.aborted) return;
|
|
1739
|
-
if (bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
1799
|
+
if ((bodyEnd.consumed || !inOrder) && (catchChunk.reorderStart = state.mark("*", branchId + "")), bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
1740
1800
|
else {
|
|
1741
1801
|
let reorder = null;
|
|
1742
1802
|
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
@@ -1749,6 +1809,18 @@ function tryBoundary(content, catchContent, branchId, renderers) {
|
|
|
1749
1809
|
}
|
|
1750
1810
|
}, renderersAtSettle;
|
|
1751
1811
|
}
|
|
1812
|
+
function unsubscribe(subscribed, serializer) {
|
|
1813
|
+
for (let i = 0; i < subscribed.length; i += 3) {
|
|
1814
|
+
let subscribers = subscribed[i], scope = subscribed[i + 1];
|
|
1815
|
+
serializer.written(subscribers) ? serializer.dropCall(scope, subscribers, "add") || serializer.writeCall(scope, subscribers, "delete", subscribed[i + 2]) : subscribers.delete(scope);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
function clearTryRenderers(branchId) {
|
|
1819
|
+
writeScope(branchId, {
|
|
1820
|
+
E: 0,
|
|
1821
|
+
Q: _scope_with_id(branchId).Q && 0
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1752
1824
|
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
1753
1825
|
writeScope(branchId, {
|
|
1754
1826
|
E: catchContent,
|
|
@@ -1833,15 +1905,17 @@ var State = class {
|
|
|
1833
1905
|
parent;
|
|
1834
1906
|
aborted = !1;
|
|
1835
1907
|
reason;
|
|
1908
|
+
subscribed;
|
|
1836
1909
|
pendingReorders;
|
|
1837
1910
|
children;
|
|
1911
|
+
withinCatch = !1;
|
|
1838
1912
|
constructor(state, signal, parent) {
|
|
1839
|
-
this.state = state, this.parent = parent, parent ? parent.aborted ? this.abort(parent.reason) : (parent.children ||= []).push(this) : signal && (signal.aborted ? this.abort(signal.reason) : signal.addEventListener("abort", this));
|
|
1913
|
+
this.state = state, this.parent = parent, parent ? (this.withinCatch = parent.withinCatch, parent.aborted ? this.abort(parent.reason) : (parent.children ||= []).push(this)) : signal && (signal.aborted ? this.abort(signal.reason) : signal.addEventListener("abort", this));
|
|
1840
1914
|
}
|
|
1841
1915
|
abort(reason) {
|
|
1842
1916
|
if (this.aborted) return;
|
|
1843
1917
|
let { state } = this;
|
|
1844
|
-
if (this.aborted = !0, this.reason = reason, this.pendingReorders) {
|
|
1918
|
+
if (this.aborted = !0, this.reason = reason, this.subscribed && unsubscribe(this.subscribed, state.serializer), this.pendingReorders) {
|
|
1845
1919
|
for (let reorder of this.pendingReorders) state.reorder(reorder);
|
|
1846
1920
|
this.pendingReorders = void 0;
|
|
1847
1921
|
}
|
|
@@ -1868,7 +1942,9 @@ var State = class {
|
|
|
1868
1942
|
async = !1;
|
|
1869
1943
|
consumed = !1;
|
|
1870
1944
|
reorderId = null;
|
|
1945
|
+
reorderStart = "";
|
|
1871
1946
|
deferredReady = null;
|
|
1947
|
+
heldEffects = null;
|
|
1872
1948
|
deferredReorder = null;
|
|
1873
1949
|
catchRange = null;
|
|
1874
1950
|
placeholder = null;
|
|
@@ -1886,7 +1962,7 @@ var State = class {
|
|
|
1886
1962
|
this.html += html;
|
|
1887
1963
|
}
|
|
1888
1964
|
writeEffect(scopeId, registryId) {
|
|
1889
|
-
countResumeWrite(this), this.lastEffect === registryId ? this.effects
|
|
1965
|
+
countResumeWrite(this), this.lastEffect === registryId ? this.effects = concatEffects(this.effects, scopeId + "") : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1890
1966
|
}
|
|
1891
1967
|
writeScript(script) {
|
|
1892
1968
|
this.scripts = concatScripts(this.scripts, script);
|
|
@@ -1894,6 +1970,10 @@ var State = class {
|
|
|
1894
1970
|
append(chunk) {
|
|
1895
1971
|
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
|
|
1896
1972
|
}
|
|
1973
|
+
takeHeldEffects() {
|
|
1974
|
+
let { heldEffects } = this;
|
|
1975
|
+
return this.heldEffects = null, heldEffects;
|
|
1976
|
+
}
|
|
1897
1977
|
takeDeferredReady() {
|
|
1898
1978
|
let { deferredReady } = this;
|
|
1899
1979
|
return this.deferredReady = null, deferredReady;
|
|
@@ -1934,12 +2014,12 @@ var State = class {
|
|
|
1934
2014
|
let { body } = placeholder, end = body;
|
|
1935
2015
|
for (; end.next && !end.async;) end = end.next;
|
|
1936
2016
|
if (!end.async) return end.next = this.next, this.next = body, !1;
|
|
1937
|
-
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId
|
|
2017
|
+
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId + "";
|
|
1938
2018
|
this.writeHTML(state.mark("!^", reorderId));
|
|
1939
2019
|
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
1940
2020
|
if (this.render(() => withBranchId(placeholderBranchId, placeholder.render)) !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.boundary.aborted) return !0;
|
|
1941
2021
|
let stateful = this.effects !== effects;
|
|
1942
|
-
return applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(() => writeScope(branchId, { P: scopeWithId(state, placeholderBranchId) })), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), end.writeEffect(branchId, "_f")), this.writeHTML(state.mark("!", reorderId)), this.deferredReorder = body, !1;
|
|
2022
|
+
return applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(() => writeScope(branchId, { P: scopeWithId(state, placeholderBranchId) })), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), dismissChunk(end, body).writeEffect(branchId, "_f")), this.writeHTML(state.mark("!", reorderId)), this.deferredReorder = body, !1;
|
|
1943
2023
|
}
|
|
1944
2024
|
markCatchRange() {
|
|
1945
2025
|
let { catchRange } = this;
|
|
@@ -1954,9 +2034,9 @@ var State = class {
|
|
|
1954
2034
|
}
|
|
1955
2035
|
consume(boundary) {
|
|
1956
2036
|
this.renderPlaceholders(boundary);
|
|
1957
|
-
let cur = this, html = "", effects = "", scripts = "",
|
|
1958
|
-
for (; cur.next && !cur.async;) cur.markCatchRange(), cur.queueDeferredReorder(), html += cur.html, cur.serializeState.readyId ? deferredReady = push(deferredReady, cur) : (effects =
|
|
1959
|
-
return cur.deferOwnReady(), cur.
|
|
2037
|
+
let cur = this, html = "", effects = "", scripts = "", effectsEnd, heldEffects = this.heldEffects, deferredReady;
|
|
2038
|
+
for (this.heldEffects = null, this.serializeState.readyId && this.effects && followHeldEffects(this); cur.next && !cur.async;) cur.markCatchRange(), cur.queueDeferredReorder(), html += cur.html, cur.serializeState.readyId ? deferredReady = push(deferredReady, cur) : (cur.effects && (effectsEnd && effectsEnd.boundary !== cur.boundary && (heldEffects = holdEffectsOn(heldEffects, effectsEnd, effects), effects = ""), effectsEnd = cur, effects = concatEffects(effects, cur.effects)), scripts = concatScripts(scripts, cur.scripts)), deferredReady = concat(deferredReady, cur.takeDeferredReady()), cur.consumed = !0, cur = cur.next;
|
|
2039
|
+
return cur.deferOwnReady(), effects && (cur.serializeState.readyId ? heldEffects = holdEffectsOn(heldEffects, effectsEnd, effects) : effectsEnd.boundary === cur.boundary ? (cur.effects = concatEffects(effects, cur.effects), cur.lastEffect ||= effectsEnd.lastEffect) : (heldEffects = holdEffectsOn(heldEffects, effectsEnd, effects), isWithin(cur.boundary, effectsEnd.boundary) && (cur.lastEffect ||= effectsEnd.lastEffect))), cur.heldEffects = heldEffects, cur.deferredReady = concat(deferredReady, cur.deferredReady), cur.html = html + cur.html, cur.scripts = concatScripts(scripts, cur.scripts), cur;
|
|
1960
2040
|
}
|
|
1961
2041
|
render(content, val) {
|
|
1962
2042
|
let prev = $chunk;
|
|
@@ -1990,32 +2070,32 @@ var State = class {
|
|
|
1990
2070
|
}
|
|
1991
2071
|
flushScript(boundary) {
|
|
1992
2072
|
let { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1993
|
-
needsWalk && (state.walkOnNextFlush = !1);
|
|
2073
|
+
needsWalk && (state.walkOnNextFlush = !1), flushSerializer(boundary, state);
|
|
1994
2074
|
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
1995
2075
|
for (let channel; !boundary.aborted && (channel = state.serializer.pendingReadyChannel());) {
|
|
1996
2076
|
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1997
2077
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1998
2078
|
}
|
|
1999
2079
|
readyResumeScripts && (needsWalk = !0);
|
|
2000
|
-
let effects = this.async ? "" : this.effects, { html, scripts } = this;
|
|
2001
|
-
state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"");
|
|
2080
|
+
let effects = this.async ? "" : joinHeldEffects(this.takeHeldEffects(), this.effects), { html, scripts } = this;
|
|
2081
|
+
html && state.hasReorderRuntime && (html = state.mark("*", "") + html), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"");
|
|
2002
2082
|
let reordered = "", needsResumeArray = !1;
|
|
2003
2083
|
if (state.writeReorders) {
|
|
2004
2084
|
for (let reorderedChunk of state.writeReorders) {
|
|
2005
2085
|
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
2006
|
-
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
2086
|
+
let { reorderId, reorderStart } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", effectsBoundary = reorderedChunk.boundary, reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
2007
2087
|
for (reorderedChunk.reorderId = null; cur;) {
|
|
2008
2088
|
cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
|
|
2009
2089
|
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
2010
|
-
this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady()), cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts)), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), (cur.boundary.pendingReorders ||= /* @__PURE__ */ new Set()).add(cur), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), cur = next;
|
|
2090
|
+
this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady()), cur.consumed = !0, reorderHTML += cur.html, this.async && cur.effects && cur.boundary !== effectsBoundary && (reorderEffects &&= (holdReorderEffects(this, effectsBoundary, reorderEffects), ""), effectsBoundary = cur.boundary), reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts)), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), cur.reorderStart = reorderStart, (cur.boundary.pendingReorders ||= /* @__PURE__ */ new Set()).add(cur), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), cur = next;
|
|
2011
2091
|
}
|
|
2012
|
-
reorderEffects && (this.async ? (this
|
|
2092
|
+
reorderEffects && (this.async ? holdReorderEffects(this, effectsBoundary, reorderEffects) : (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")));
|
|
2013
2093
|
for (let reservation of readyReservations) reordered = concatScripts(reordered, reservation);
|
|
2014
|
-
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
2094
|
+
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderStart + reorderHTML + "</t>";
|
|
2015
2095
|
}
|
|
2016
2096
|
state.writeReorders = null;
|
|
2017
2097
|
}
|
|
2018
|
-
return
|
|
2098
|
+
return (state.resumes || needsResumeArray && !state.hasWrittenResume) && (scripts = concatScripts(scripts, state.resumeScript(state.resumes))), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, state.walkScript())), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
|
|
2019
2099
|
}
|
|
2020
2100
|
flushHTML(boundary) {
|
|
2021
2101
|
let { state } = boundary;
|
|
@@ -2031,6 +2111,33 @@ function renderReorderPlaceholders(reorder, reorders) {
|
|
|
2031
2111
|
}
|
|
2032
2112
|
return reorders;
|
|
2033
2113
|
}
|
|
2114
|
+
function dismissChunk(end, body) {
|
|
2115
|
+
if (end.boundary !== body.boundary) for (; end.next;) end = end.next;
|
|
2116
|
+
return end;
|
|
2117
|
+
}
|
|
2118
|
+
function followHeldEffects(chunk) {
|
|
2119
|
+
let held = reduce(chunk.deferredReady, lastHeldOf, chunk);
|
|
2120
|
+
held !== chunk && (held.effects = concatEffects(held.effects, chunk.effects), chunk.effects = "");
|
|
2121
|
+
}
|
|
2122
|
+
function lastHeldOf(held, cur) {
|
|
2123
|
+
return cur.serializeState === held.serializeState && cur.boundary === held.boundary ? cur : held;
|
|
2124
|
+
}
|
|
2125
|
+
function holdEffectsOn(heldEffects, chunk, effects) {
|
|
2126
|
+
return chunk.effects = effects, push(heldEffects, chunk);
|
|
2127
|
+
}
|
|
2128
|
+
function isWithin(boundary, outer) {
|
|
2129
|
+
for (; boundary && boundary !== outer;) boundary = boundary.parent;
|
|
2130
|
+
return !!boundary;
|
|
2131
|
+
}
|
|
2132
|
+
function holdReorderEffects(head, boundary, effects) {
|
|
2133
|
+
head.serializeState.readyId || (head.effects && (head.heldEffects = holdEffectsOn(head.heldEffects, head.fork(head.boundary, null), head.effects)), head.effects = head.lastEffect = ""), head.heldEffects = holdEffectsOn(head.heldEffects, head.fork(boundary, null), effects);
|
|
2134
|
+
}
|
|
2135
|
+
function joinHeldEffects(heldEffects, effects) {
|
|
2136
|
+
return concatEffects(reduce(heldEffects, joinUncaught, ""), effects);
|
|
2137
|
+
}
|
|
2138
|
+
function joinUncaught(joined, held) {
|
|
2139
|
+
return held.boundary.aborted ? joined : concatEffects(joined, held.effects);
|
|
2140
|
+
}
|
|
2034
2141
|
function flushSerializer(boundary, serializeState) {
|
|
2035
2142
|
let { state } = boundary, { serializer } = state, pending = serializer.pending(serializeState);
|
|
2036
2143
|
if (serializeState.flushScopes || pending) {
|
|
@@ -2338,42 +2445,66 @@ function settle(boundary) {
|
|
|
2338
2445
|
function NOOP$1() {}
|
|
2339
2446
|
//#endregion
|
|
2340
2447
|
//#region src/html/assets.ts
|
|
2341
|
-
function withLoadAssets(renderer, assetId, triggers) {
|
|
2342
|
-
return Object.assign((input) =>
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2448
|
+
function withLoadAssets(renderer, flush, assetId, triggers) {
|
|
2449
|
+
return Object.assign((input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, renderer, input)), renderer);
|
|
2450
|
+
}
|
|
2451
|
+
function writeLoadAsset(assetId, flush, triggers) {
|
|
2452
|
+
let g = $global();
|
|
2453
|
+
writeAsset(g, addAsset(g, assetId, flush, triggers));
|
|
2346
2454
|
}
|
|
2347
2455
|
function withPageAssets(template, runtime, assetId, runtimeId) {
|
|
2348
|
-
return
|
|
2456
|
+
return Object.assign((input) => {
|
|
2349
2457
|
let g = $global();
|
|
2350
|
-
|
|
2458
|
+
runtimeId && (g[kAssets] || (g.runtimeId = runtimeId));
|
|
2459
|
+
let asset = addAsset(g, assetId, runtime);
|
|
2460
|
+
return g.__flush__ ? (writeAsset(g, asset), writeWaitReady(assetId, template, input)) : (g.__flush__ = flushPage, template(input));
|
|
2351
2461
|
}, template);
|
|
2352
2462
|
}
|
|
2353
2463
|
function _flush_head() {
|
|
2354
2464
|
let g = $global();
|
|
2355
|
-
return g[kAssets] ?
|
|
2465
|
+
return g[kAssets] ? (g[kHead] = !0, takeAssets(g, catchableBoundary())) : "";
|
|
2466
|
+
}
|
|
2467
|
+
function flushPage(g, html) {
|
|
2468
|
+
return takeAssets(g, null) + html;
|
|
2469
|
+
}
|
|
2470
|
+
function takeAssets(g, at) {
|
|
2471
|
+
let block = "", defer = "";
|
|
2472
|
+
for (let asset of g[kAssets]) asset.htmlAt === void 0 && (asset.htmlAt = at, block += blockHTML(g, asset), asset.triggers || (defer += deferHTML(g, asset)));
|
|
2473
|
+
return block + defer;
|
|
2356
2474
|
}
|
|
2357
|
-
function
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2475
|
+
function writeAsset(g, asset) {
|
|
2476
|
+
if (needsWrite(asset.htmlAt) && (asset.htmlAt = void 0, g[kHead] || g.__flush__ !== flushPage)) {
|
|
2477
|
+
let block = blockHTML(g, asset);
|
|
2478
|
+
_html(block + (asset.triggers ? "" : deferHTML(g, asset))), block && isInResumedBranch() && writeScript(`document.head.insertAdjacentHTML("beforeend",${_escape_script(JSON.stringify(block))})`), asset.htmlAt = catchableBoundary();
|
|
2479
|
+
}
|
|
2480
|
+
if (asset.triggers && needsWrite(asset.scriptAt)) {
|
|
2481
|
+
let defer = deferHTML(g, asset);
|
|
2482
|
+
defer && writeScript(asset.script ||= triggerScript(asset.id, defer, asset.triggers)), asset.scriptAt = catchableBoundary();
|
|
2363
2483
|
}
|
|
2364
|
-
return g[kBlockIndex] = bi, g[kDeferIndex] = di, result + html;
|
|
2365
2484
|
}
|
|
2366
|
-
function
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
}], g[kBlockIndex] = g[kDeferIndex] = 0);
|
|
2485
|
+
function needsWrite(at) {
|
|
2486
|
+
return at === void 0 || at !== null && mayDrop(at);
|
|
2487
|
+
}
|
|
2488
|
+
function blockHTML(g, asset) {
|
|
2489
|
+
return asset.block ??= asset.flush(g, "block", asset.id);
|
|
2490
|
+
}
|
|
2491
|
+
function deferHTML(g, asset) {
|
|
2492
|
+
return asset.defer ??= asset.flush(g, "defer", asset.id);
|
|
2375
2493
|
}
|
|
2376
|
-
function
|
|
2494
|
+
function addAsset(g, id, flush, triggers) {
|
|
2495
|
+
let assets = g[kAssets] ||= [], asset = assets.find((a) => a.id === id);
|
|
2496
|
+
return asset || assets.push(asset = {
|
|
2497
|
+
id,
|
|
2498
|
+
flush,
|
|
2499
|
+
triggers,
|
|
2500
|
+
block: void 0,
|
|
2501
|
+
defer: void 0,
|
|
2502
|
+
script: void 0,
|
|
2503
|
+
htmlAt: void 0,
|
|
2504
|
+
scriptAt: void 0
|
|
2505
|
+
}), asset;
|
|
2506
|
+
}
|
|
2507
|
+
function triggerScript(id, html, triggers) {
|
|
2377
2508
|
let htmlStr = _escape_script(JSON.stringify(html)), exprs = triggers.map((trigger) => {
|
|
2378
2509
|
let options = trigger.options && toObjectExpression(trigger.options);
|
|
2379
2510
|
switch (trigger.type) {
|
|
@@ -2383,7 +2514,7 @@ function writeTriggerScript(id, html, triggers) {
|
|
|
2383
2514
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2384
2515
|
}
|
|
2385
2516
|
});
|
|
2386
|
-
|
|
2517
|
+
return `((h,d,l=$=>{d||document.head.append(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(${htmlStr})`;
|
|
2387
2518
|
}
|
|
2388
2519
|
function querySelectorOrLoad(selector) {
|
|
2389
2520
|
return `document.querySelector(${JSON.stringify(selector)})||l()`;
|
|
@@ -2402,8 +2533,12 @@ function drainClassFunctions($global, writeScope) {
|
|
|
2402
2533
|
for (let [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
|
|
2403
2534
|
pending.length = 0;
|
|
2404
2535
|
}
|
|
2536
|
+
function swapReorders(state, reorders) {
|
|
2537
|
+
let { writeReorders } = state;
|
|
2538
|
+
return state.writeReorders = reorders, writeReorders;
|
|
2539
|
+
}
|
|
2405
2540
|
function NOOP() {}
|
|
2406
|
-
exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr = _attr, exports._attr_and = _attr_and, exports._attr_class = _attr_class, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_value = _attr_input_value, exports._attr_nonce = _attr_nonce, exports._attr_nullish = _attr_nullish, exports._attr_option_value = _attr_option_value, exports._attr_or = _attr_or, exports._attr_select_value = _attr_select_value, exports._attr_style = _attr_style, exports._attr_textarea_value = _attr_textarea_value, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._attrs_select_value = _attrs_select_value, exports._attrs_textarea_value = _attrs_textarea_value, exports._await = _await, exports._content = _content, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
2541
|
+
exports.$global = $global, exports._assert_class_toggles = _assert_class_toggles, exports._assert_hoist = _assert_hoist, exports._attr = _attr, exports._attr_and = _attr_and, exports._attr_class = _attr_class, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_value = _attr_input_value, exports._attr_nonce = _attr_nonce, exports._attr_nullish = _attr_nullish, exports._attr_option_value = _attr_option_value, exports._attr_or = _attr_or, exports._attr_select_value = _attr_select_value, exports._attr_style = _attr_style, exports._attr_textarea_value = _attr_textarea_value, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._attrs_select_value = _attrs_select_value, exports._attrs_textarea_value = _attrs_textarea_value, exports._await = _await, exports._content = _content, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
2407
2542
|
enumerable: !0,
|
|
2408
2543
|
get: function() {
|
|
2409
2544
|
return _dynamic_tag;
|