marko 6.4.0 → 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 +2 -2
- package/dist/common/constants/accessor-prefix.d.ts +1 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
- package/dist/common/constants/reserved-id.d.ts +5 -0
- package/dist/common/errors.d.ts +2 -1
- package/dist/common/opt.d.ts +1 -0
- package/dist/common/types.d.ts +3 -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-BRO5aArp.js → dom-BLbR0hEx.js} +62 -16
- package/dist/debug/{dom-Btj2QJhk.mjs → dom-Cii0IA92.mjs} +51 -17
- package/dist/debug/dom.js +7 -4
- package/dist/debug/dom.mjs +6 -5
- package/dist/debug/html.js +551 -292
- package/dist/debug/html.mjs +548 -290
- 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/signals.d.ts +3 -2
- package/dist/{dom-BSsI9OPC.js → dom-B8UEYzOz.js} +112 -84
- package/dist/{dom-B-v8Gw6T.mjs → dom-BPjLe6YU.mjs} +23 -5
- 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 +3 -2
- package/dist/html/compat.d.ts +10 -2
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/inlined-runtimes.d.ts +1 -1
- package/dist/html/inlined-runtimes.debug.d.ts +1 -1
- package/dist/html/serializer.d.ts +2 -1
- package/dist/html/writer.d.ts +42 -22
- package/dist/html.d.ts +2 -2
- package/dist/html.js +400 -208
- package/dist/html.mjs +399 -207
- package/dist/translator/core/html-comment.d.ts +0 -7
- package/dist/translator/core/let.d.ts +0 -5
- package/dist/translator/core/show.d.ts +2 -5
- package/dist/translator/core/style.d.ts +6 -8
- package/dist/translator/index.d.ts +9 -0
- package/dist/translator/index.js +8429 -8100
- package/dist/translator/util/binding-has-prop.d.ts +1 -1
- package/dist/translator/util/binding-prop-tree.d.ts +4 -4
- package/dist/translator/util/bindings.d.ts +135 -0
- package/dist/translator/util/body-to-text-literal.d.ts +1 -2
- package/dist/translator/util/branch-tag.d.ts +7 -7
- package/dist/translator/util/constants/binding-type.d.ts +5 -6
- package/dist/translator/util/constants/slot-kind.d.ts +14 -0
- package/dist/translator/util/constants/structure-kind.d.ts +2 -1
- package/dist/translator/util/evaluate.d.ts +11 -10
- package/dist/translator/util/finalize-references.d.ts +4 -0
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/generate-uid.d.ts +3 -1
- package/dist/translator/util/get-declared-binding-expression.d.ts +2 -2
- package/dist/translator/util/is-core-tag.d.ts +0 -3
- package/dist/translator/util/is-only-child-in-parent.d.ts +2 -7
- package/dist/translator/util/known-tag.d.ts +10 -8
- package/dist/translator/util/module-read.d.ts +21 -0
- package/dist/translator/util/read-replacement.d.ts +3 -0
- package/dist/translator/util/reasons.d.ts +32 -0
- package/dist/translator/util/references.d.ts +68 -166
- package/dist/translator/util/runtime.d.ts +2 -0
- package/dist/translator/util/scope-accessor.d.ts +14 -0
- package/dist/translator/util/scope-read.d.ts +1 -1
- package/dist/translator/util/sections.d.ts +52 -48
- package/dist/translator/util/set-tag-derived-from.d.ts +7 -0
- package/dist/translator/util/setup-work.d.ts +1 -2
- package/dist/translator/util/signals.d.ts +3 -5
- package/dist/translator/util/slots.d.ts +50 -0
- package/dist/translator/util/solve-reasons.d.ts +10 -0
- package/dist/translator/util/sources.d.ts +21 -0
- package/dist/translator/util/structure.d.ts +6 -2
- package/dist/translator/util/tag-facts.d.ts +21 -0
- package/dist/translator/util/tag-name-type.d.ts +4 -1
- package/dist/translator/util/translate-attrs.d.ts +2 -0
- package/dist/translator/util/translate-var.d.ts +3 -0
- package/dist/translator/util/write-guard.d.ts +12 -0
- package/dist/translator/util/writer.d.ts +3 -3
- package/dist/translator/visitors/export-declaration.d.ts +9 -0
- package/dist/translator/visitors/function.d.ts +5 -4
- package/dist/translator/visitors/import-declaration.d.ts +2 -2
- package/dist/translator/visitors/placeholder.d.ts +0 -3
- package/dist/translator/visitors/program/index.d.ts +13 -3
- package/dist/translator/visitors/referenced-identifier.d.ts +2 -1
- package/dist/translator/visitors/tag/custom-tag.d.ts +1 -1
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -3
- package/dist/translator/visitors/tag/index.d.ts +2 -1
- package/dist/translator/visitors/tag/native-tag.d.ts +26 -12
- package/package.json +3 -3
- package/dist/translator/util/insertion-context.d.ts +0 -1
- package/dist/translator/util/is-non-html-text.d.ts +0 -3
- package/dist/translator/util/serialize-guard.d.ts +0 -11
- package/dist/translator/util/serialize-reasons.d.ts +0 -37
- package/dist/translator/util/set-tag-sections-downstream.d.ts +0 -6
package/dist/html.js
CHANGED
|
@@ -248,8 +248,8 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
248
248
|
}, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
249
249
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
250
250
|
return state.needsMainRuntime = !0, countResumeWrite($chunk), Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
251
|
-
}, CLIENT_ALL = 715827883, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : c === "<" ? "<" : " ", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs,
|
|
252
|
-
let shouldResume =
|
|
251
|
+
}, CLIENT_ALL = 715827883, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : c === "<" ? "<" : " ", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard) => {
|
|
252
|
+
let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
253
253
|
if (typeof renderer == "string") {
|
|
254
254
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
255
255
|
rendered = !0, (() => {
|
|
@@ -258,7 +258,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
258
258
|
if (renderer === "textarea") _html(_attrs_textarea_value(branchId, "a", input));
|
|
259
259
|
else {
|
|
260
260
|
if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
261
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0,
|
|
261
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard);
|
|
262
262
|
}
|
|
263
263
|
_html(`</${renderer}>`);
|
|
264
264
|
}
|
|
@@ -268,12 +268,12 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
268
268
|
} else {
|
|
269
269
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
270
270
|
if (renderer) try {
|
|
271
|
-
return
|
|
271
|
+
return _set_scope_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
272
272
|
...inputOrArgs,
|
|
273
273
|
content
|
|
274
274
|
} : inputOrArgs);
|
|
275
275
|
} finally {
|
|
276
|
-
|
|
276
|
+
_set_scope_reason(void 0);
|
|
277
277
|
}
|
|
278
278
|
else if (content) return content();
|
|
279
279
|
};
|
|
@@ -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.
|
|
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,11 +379,12 @@ 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
|
}
|
|
359
|
-
|
|
382
|
+
}), head.render(() => {
|
|
383
|
+
_set_scope_reason(willRerender ? CLIENT_ALL : 0);
|
|
360
384
|
try {
|
|
361
385
|
renderer(normalizedInput);
|
|
362
386
|
} finally {
|
|
363
|
-
|
|
387
|
+
_set_scope_reason(void 0);
|
|
364
388
|
}
|
|
365
389
|
let asyncOut = classAPIOut.beginAsync({
|
|
366
390
|
last: !0,
|
|
@@ -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,11 +508,12 @@ function forUntil(until, from, step, cb) {
|
|
|
474
508
|
}
|
|
475
509
|
//#endregion
|
|
476
510
|
//#region src/common/opt.ts
|
|
477
|
-
function
|
|
511
|
+
function reduce(opt, cb, acc) {
|
|
478
512
|
if (opt) {
|
|
479
|
-
if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
480
|
-
else cb(opt);
|
|
513
|
+
if (Array.isArray(opt)) for (let item of opt) acc = cb(acc, item);
|
|
514
|
+
else acc = cb(acc, opt);
|
|
481
515
|
}
|
|
516
|
+
return acc;
|
|
482
517
|
}
|
|
483
518
|
function push(opt, item) {
|
|
484
519
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
@@ -552,6 +587,14 @@ var State$1 = class {
|
|
|
552
587
|
channel
|
|
553
588
|
});
|
|
554
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
|
+
}
|
|
555
598
|
};
|
|
556
599
|
function register(id, val, scope, locals) {
|
|
557
600
|
return REGISTRY.set(val, {
|
|
@@ -609,13 +652,13 @@ function writeAssigned(state) {
|
|
|
609
652
|
let hasSeen = state.refs.get(mutation.object)?.id, objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
610
653
|
if (writeProp(state, mutation.object, null, "")) {
|
|
611
654
|
let objectRef = state.refs.get(mutation.object);
|
|
612
|
-
objectRef && objectRef.scopeId === void 0 && (objectRef.id ?
|
|
655
|
+
objectRef && objectRef.scopeId === void 0 && (!objectRef.id && !isAncestorChannelRef(state, objectRef) ? (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex], state.buf.push(")")) : hasSeen || (state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex], state.buf.push(")")));
|
|
613
656
|
} else state.buf.push("void 0");
|
|
614
657
|
let valueStartIndex = state.buf.push(toAccess(toObjectKey(mutation.property)) + "(");
|
|
615
658
|
if (mutation.value !== void 0) {
|
|
616
659
|
if (writeProp(state, mutation.value, null, "")) {
|
|
617
660
|
let valueRef = typeof mutation.value == "string" ? state.strs.get(mutation.value) : state.refs.get(mutation.value);
|
|
618
|
-
valueRef && !valueRef.id && valueRef.scopeId === void 0 && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
661
|
+
valueRef && !valueRef.id && valueRef.scopeId === void 0 && !isAncestorChannelRef(state, valueRef) && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
619
662
|
} else state.buf.push("void 0");
|
|
620
663
|
}
|
|
621
664
|
state.buf.push(")");
|
|
@@ -628,7 +671,7 @@ function writeCallArg(state, val) {
|
|
|
628
671
|
if (val === void 0) state.wroteUndefined = !0, state.buf.push("$");
|
|
629
672
|
else if (writeProp(state, val, null, "")) {
|
|
630
673
|
let ref = state.refs.get(val) || state.strs.get(val);
|
|
631
|
-
ref &&
|
|
674
|
+
ref && ensureId(state, ref);
|
|
632
675
|
} else state.buf.push("void 0");
|
|
633
676
|
}
|
|
634
677
|
function hasChannelMutations(state) {
|
|
@@ -680,7 +723,7 @@ function writeRegistered(state, val, parent, accessor, registered) {
|
|
|
680
723
|
let locals = registered.locals?.(state.boundary.state.scope);
|
|
681
724
|
if (locals) {
|
|
682
725
|
state.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
683
|
-
for (let local of locals) state.buf.push(","),
|
|
726
|
+
for (let local of locals) state.buf.push(","), writePlainObject(state, local, newArgReference(state, ref, local));
|
|
684
727
|
} else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
685
728
|
state.buf.push(")");
|
|
686
729
|
} else state.buf.push(registered.access);
|
|
@@ -880,6 +923,16 @@ function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
|
880
923
|
} else state.buf.push(plainPrefix), writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
|
|
881
924
|
state.buf.push(")");
|
|
882
925
|
}
|
|
926
|
+
function newArgReference(state, parent, val) {
|
|
927
|
+
for (let key in val) {
|
|
928
|
+
let member = val[key];
|
|
929
|
+
if (isDedupedMember(member) && !(typeof member == "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
930
|
+
let ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
931
|
+
return state.buf.push(ref.id + "="), ref;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
935
|
+
}
|
|
883
936
|
function isDedupedMember(val) {
|
|
884
937
|
switch (typeof val) {
|
|
885
938
|
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
@@ -983,14 +1036,10 @@ function writeResponse(state, val, ref) {
|
|
|
983
1036
|
return !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
|
|
984
1037
|
}
|
|
985
1038
|
function writeIntl(state, val, name, ref) {
|
|
986
|
-
let { locale, ...options } = val.resolvedOptions()
|
|
987
|
-
for (let key in options) if (isDedupedMember(options[key])) {
|
|
988
|
-
needsId = !0;
|
|
989
|
-
break;
|
|
990
|
-
}
|
|
1039
|
+
let { locale, ...options } = val.resolvedOptions();
|
|
991
1040
|
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
992
|
-
let optionsRef;
|
|
993
|
-
return
|
|
1041
|
+
let optionsRef = newArgReference(state, ref, options);
|
|
1042
|
+
return state.buf.push("{"), writeObjectProps(state, options, optionsRef), state.buf.push("})"), !0;
|
|
994
1043
|
}
|
|
995
1044
|
function writeIntlLocale(state, val) {
|
|
996
1045
|
return state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")"), !0;
|
|
@@ -1001,7 +1050,7 @@ function writeTemporal(state, val, name) {
|
|
|
1001
1050
|
function writeReadableStream(state, val, ref) {
|
|
1002
1051
|
if (val.locked) return !1;
|
|
1003
1052
|
let { boundary, channel } = state, reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1004
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1053
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1005
1054
|
}, onRejected = (reason) => {
|
|
1006
1055
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1007
1056
|
};
|
|
@@ -1027,19 +1076,16 @@ function writeGenerator(state, iter, ref) {
|
|
|
1027
1076
|
if (heldReturn) {
|
|
1028
1077
|
let holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
1029
1078
|
state.buf.push("," + holder.id + "={}"), writeProp(state, returnValue, holder, "v");
|
|
1030
|
-
} else if (returnValue !== void 0) {
|
|
1031
|
-
let
|
|
1032
|
-
|
|
1033
|
-
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1034
|
-
retRef && !retRef.id && retRef.scopeId === void 0 && (retRef.id = nextRefAccess(state), state.buf[sepIndex] = "," + retRef.id + "=");
|
|
1035
|
-
}
|
|
1079
|
+
} else if (returnValue !== void 0 && (state.buf.push(","), writeProp(state, returnValue, ref, "") && isDedupedMember(returnValue))) {
|
|
1080
|
+
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1081
|
+
retRef && ensureId(state, retRef);
|
|
1036
1082
|
}
|
|
1037
1083
|
return state.buf.push(")"), !0;
|
|
1038
1084
|
}
|
|
1039
1085
|
function writeAsyncGenerator(state, iter, ref) {
|
|
1040
1086
|
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1041
1087
|
let { boundary, channel } = state, iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1042
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1088
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1043
1089
|
}, onRejected = (reason) => {
|
|
1044
1090
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1045
1091
|
};
|
|
@@ -1070,7 +1116,7 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1070
1116
|
return sep;
|
|
1071
1117
|
}
|
|
1072
1118
|
function writeAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
1073
|
-
boundary.
|
|
1119
|
+
boundary.aborted || (state.mutated.push({
|
|
1074
1120
|
value,
|
|
1075
1121
|
object: handle,
|
|
1076
1122
|
property: method,
|
|
@@ -1088,6 +1134,9 @@ function trackChannel(state, ref) {
|
|
|
1088
1134
|
}
|
|
1089
1135
|
return !1;
|
|
1090
1136
|
}
|
|
1137
|
+
function isAncestorChannelRef(state, ref) {
|
|
1138
|
+
return ref.channel?.readyId !== state.channel?.readyId;
|
|
1139
|
+
}
|
|
1091
1140
|
function abortRender(boundary, err) {
|
|
1092
1141
|
for (; boundary.parent;) boundary = boundary.parent;
|
|
1093
1142
|
boundary.abort(err);
|
|
@@ -1171,7 +1220,7 @@ function quote(str, startPos) {
|
|
|
1171
1220
|
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
1172
1221
|
}
|
|
1173
1222
|
function writeRef(state, ref) {
|
|
1174
|
-
ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId,
|
|
1223
|
+
ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) && !isAncestorChannelRef(state, ref) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId, state.buf.push(ref.path)) : state.buf.push(ensureId(state, ref));
|
|
1175
1224
|
}
|
|
1176
1225
|
function ensureId(state, ref) {
|
|
1177
1226
|
return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : assignId(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
|
|
@@ -1182,14 +1231,14 @@ function accessId(state, ref) {
|
|
|
1182
1231
|
}
|
|
1183
1232
|
function assignId(state, ref) {
|
|
1184
1233
|
let { pos } = ref;
|
|
1185
|
-
return
|
|
1234
|
+
return pos !== null && ref.flushId === state.flushId ? (ref.id = nextRefAccess(state), pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id) : isAncestorChannelRef(state, ref) ? ref.path || accessPath(state, ref) : (ref.id = nextRefAccess(state), ref.id + "=" + (ref.path || accessPath(state, ref)));
|
|
1186
1235
|
}
|
|
1187
1236
|
function accessPath(state, ref) {
|
|
1188
1237
|
let cur = ref, accessPrevValue = "";
|
|
1189
1238
|
do {
|
|
1190
1239
|
accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
|
|
1191
1240
|
let parent = cur.parent;
|
|
1192
|
-
if (parent.id
|
|
1241
|
+
if (parent.id) return trackChannel(state, parent), parent.id + accessPrevValue;
|
|
1193
1242
|
if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
|
|
1194
1243
|
cur = parent;
|
|
1195
1244
|
} while (cur);
|
|
@@ -1341,8 +1390,8 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1341
1390
|
}
|
|
1342
1391
|
return result;
|
|
1343
1392
|
}
|
|
1344
|
-
function _attrs_content(data, nodeAccessor, scopeId, tagName,
|
|
1345
|
-
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content,
|
|
1393
|
+
function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1394
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1346
1395
|
}
|
|
1347
1396
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1348
1397
|
let partial = {};
|
|
@@ -1352,8 +1401,8 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1352
1401
|
}
|
|
1353
1402
|
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1354
1403
|
}
|
|
1355
|
-
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName,
|
|
1356
|
-
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content,
|
|
1404
|
+
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1405
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1357
1406
|
}
|
|
1358
1407
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1359
1408
|
writeScope(scopeId, serializeType ? {
|
|
@@ -1486,8 +1535,17 @@ function _html(html) {
|
|
|
1486
1535
|
function writeScript(script) {
|
|
1487
1536
|
$chunk.writeScript(script);
|
|
1488
1537
|
}
|
|
1489
|
-
function
|
|
1490
|
-
|
|
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
|
+
}
|
|
1547
|
+
function _script(scopeId, registryId, markerGuard) {
|
|
1548
|
+
markerGuard === 0 && ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1491
1549
|
}
|
|
1492
1550
|
function _trailers(html) {
|
|
1493
1551
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1528,8 +1586,8 @@ function _resume_branch(scopeId) {
|
|
|
1528
1586
|
let branchId = $chunk.context?.[kBranchId];
|
|
1529
1587
|
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1530
1588
|
}
|
|
1531
|
-
function _attr_content(nodeAccessor, scopeId, content,
|
|
1532
|
-
let shouldResume =
|
|
1589
|
+
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
1590
|
+
let shouldResume = markerGuard !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1533
1591
|
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1534
1592
|
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1535
1593
|
["D" + nodeAccessor]: rendererKey(render)
|
|
@@ -1548,48 +1606,48 @@ function writeScopePassive(scopeId, partialScope) {
|
|
|
1548
1606
|
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1549
1607
|
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1550
1608
|
}
|
|
1551
|
-
function _show_start(display,
|
|
1552
|
-
display ?
|
|
1609
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
1610
|
+
display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1553
1611
|
}
|
|
1554
|
-
function _show_end(scopeId, accessor, display,
|
|
1612
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1555
1613
|
let branchId = _scope_id(), wrap = !display;
|
|
1556
|
-
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor,
|
|
1614
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1557
1615
|
}
|
|
1558
|
-
function _for_of(list, cb, by, scopeId, accessor,
|
|
1616
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1559
1617
|
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
1560
1618
|
let itemKey = forOfBy(by, item, index);
|
|
1561
1619
|
each(itemKey, itemKey === index, () => cb(item, index));
|
|
1562
|
-
}) : forOf(list, cb), scopeId, accessor,
|
|
1620
|
+
}) : forOf(list, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1563
1621
|
}
|
|
1564
|
-
function _for_in(obj, cb, by, scopeId, accessor,
|
|
1622
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1565
1623
|
forBranches(by, (each) => each ? forIn(obj, (key, value) => {
|
|
1566
1624
|
each(forInBy(by, key, value), !1, () => cb(key, value));
|
|
1567
|
-
}) : forIn(obj, cb), scopeId, accessor,
|
|
1625
|
+
}) : forIn(obj, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1568
1626
|
}
|
|
1569
|
-
function _for_to(to, from, step, cb, by, scopeId, accessor,
|
|
1627
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1570
1628
|
forBranches(by, (each) => {
|
|
1571
1629
|
let index = 0;
|
|
1572
1630
|
return each ? forTo(to, from, step, (value) => {
|
|
1573
1631
|
let itemKey = forStepBy(by, value);
|
|
1574
1632
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1575
1633
|
}) : forTo(to, from, step, cb);
|
|
1576
|
-
}, scopeId, accessor,
|
|
1634
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1577
1635
|
}
|
|
1578
|
-
function _for_until(to, from, step, cb, by, scopeId, accessor,
|
|
1636
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1579
1637
|
forBranches(by, (each) => {
|
|
1580
1638
|
let index = 0;
|
|
1581
1639
|
return each ? forUntil(to, from, step, (value) => {
|
|
1582
1640
|
let itemKey = forStepBy(by, value);
|
|
1583
1641
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1584
1642
|
}) : forUntil(to, from, step, cb);
|
|
1585
|
-
}, scopeId, accessor,
|
|
1643
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1586
1644
|
}
|
|
1587
|
-
function forBranches(by, iterate, scopeId, accessor,
|
|
1588
|
-
if (
|
|
1589
|
-
iterate(0), writeBranchEnd(scopeId, accessor,
|
|
1645
|
+
function forBranches(by, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1646
|
+
if (branchGuard === 0) {
|
|
1647
|
+
iterate(0), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
1590
1648
|
return;
|
|
1591
1649
|
}
|
|
1592
|
-
let { state } = $chunk.boundary, resumeKeys =
|
|
1650
|
+
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
1593
1651
|
iterate((itemKey, sameAsIndex, render) => {
|
|
1594
1652
|
let branchId = _peek_scope_id();
|
|
1595
1653
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
@@ -1597,14 +1655,14 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1597
1655
|
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
1598
1656
|
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
1599
1657
|
});
|
|
1600
|
-
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor,
|
|
1658
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1601
1659
|
}
|
|
1602
|
-
function _if(cb, scopeId, accessor,
|
|
1603
|
-
let resumeBranch =
|
|
1660
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1661
|
+
let resumeBranch = branchGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), branchId = _peek_scope_id(), chunk = $chunk, beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0, branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1604
1662
|
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1605
1663
|
["D" + accessor]: branchIndex || void 0,
|
|
1606
1664
|
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1607
|
-
}), writeBranchEnd(scopeId, accessor,
|
|
1665
|
+
}), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1608
1666
|
}
|
|
1609
1667
|
function deferBranchStart(chunk) {
|
|
1610
1668
|
let beforeBranch = chunk.html;
|
|
@@ -1613,14 +1671,15 @@ function deferBranchStart(chunk) {
|
|
|
1613
1671
|
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1614
1672
|
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1615
1673
|
}
|
|
1616
|
-
function
|
|
1674
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
1675
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
1676
|
+
}
|
|
1677
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
1617
1678
|
let endTag = parentEndTag || "";
|
|
1618
|
-
if (
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1623
|
-
} else $chunk.writeHTML(endTag);
|
|
1679
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
1680
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1681
|
+
$chunk.writeHTML(mark + endTag);
|
|
1682
|
+
} else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1624
1683
|
}
|
|
1625
1684
|
function _existing_scope(scopeId) {
|
|
1626
1685
|
return writeScope(scopeId, {});
|
|
@@ -1632,28 +1691,28 @@ function scopeWithId(state, scopeId) {
|
|
|
1632
1691
|
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1633
1692
|
return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
|
|
1634
1693
|
}
|
|
1635
|
-
function _subscribe(subscribers, scope, resumeId,
|
|
1694
|
+
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
1636
1695
|
if (subscribers) {
|
|
1637
|
-
let {
|
|
1638
|
-
|
|
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);
|
|
1639
1698
|
}
|
|
1640
1699
|
return scope;
|
|
1641
1700
|
}
|
|
1642
1701
|
function maskGroup(mask, group) {
|
|
1643
1702
|
return mask === 715827883 ? 1 : typeof mask == "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
|
|
1644
1703
|
}
|
|
1645
|
-
function
|
|
1646
|
-
$chunk.boundary.state.
|
|
1704
|
+
function _set_scope_reason(reason) {
|
|
1705
|
+
$chunk.boundary.state.scopeReason = reason;
|
|
1647
1706
|
}
|
|
1648
1707
|
function _scope_reason() {
|
|
1649
|
-
let reason = $chunk.boundary.state.
|
|
1650
|
-
return $chunk.boundary.state.
|
|
1708
|
+
let reason = $chunk.boundary.state.scopeReason;
|
|
1709
|
+
return $chunk.boundary.state.scopeReason = void 0, reason;
|
|
1651
1710
|
}
|
|
1652
|
-
function
|
|
1711
|
+
function _write_if(condition, key) {
|
|
1653
1712
|
return condition && maskGroup(condition, key) ? 1 : void 0;
|
|
1654
1713
|
}
|
|
1655
|
-
function
|
|
1656
|
-
return
|
|
1714
|
+
function _write_guard(condition, key) {
|
|
1715
|
+
return _write_if(condition, key) || 0;
|
|
1657
1716
|
}
|
|
1658
1717
|
function writeWaitReady(readyId, renderer, input) {
|
|
1659
1718
|
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
@@ -1663,10 +1722,11 @@ function writeWaitReady(readyId, renderer, input) {
|
|
|
1663
1722
|
writeScopes: {},
|
|
1664
1723
|
flushScopes: !1
|
|
1665
1724
|
}), bodyEnd = body.render(renderer, input);
|
|
1725
|
+
if (boundary.aborted) throw boundary.reason;
|
|
1666
1726
|
body === bodyEnd ? (chunk.writeHTML(body.html), body.deferOwnReady(), chunk.deferredReady = push(chunk.deferredReady, body)) : (bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next), chunk.next = body);
|
|
1667
1727
|
}
|
|
1668
|
-
function _await(scopeId, accessor, promise, content,
|
|
1669
|
-
let resumeMarker =
|
|
1728
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
1729
|
+
let resumeMarker = markerGuard !== 0;
|
|
1670
1730
|
if (!isPromise(promise)) {
|
|
1671
1731
|
if (resumeMarker) {
|
|
1672
1732
|
let branchId = _peek_scope_id();
|
|
@@ -1676,15 +1736,18 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
1676
1736
|
}
|
|
1677
1737
|
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1678
1738
|
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
1679
|
-
chunk.async && (chunk.async = !1, boundary.
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1739
|
+
if (chunk.async && (chunk.async = !1, !boundary.aborted)) {
|
|
1740
|
+
let { state } = boundary;
|
|
1741
|
+
chunk.render(() => {
|
|
1742
|
+
if (resumeMarker) {
|
|
1743
|
+
let branchId = _peek_scope_id();
|
|
1744
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withIsAsync({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1745
|
+
} else {
|
|
1746
|
+
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
1747
|
+
withIsAsync(async, content, value), async.visit = renderedSince && (after.html || after.next) ? $chunk.boundary.state.mark("]", scopeId + " " + accessor) : "", async.resumed && $chunk.writeHTML(async.visit), async.end = $chunk;
|
|
1748
|
+
}
|
|
1749
|
+
}), !chunk.async && boundary.pendingReorders?.delete(chunk) && state.reorder(chunk), boundary.endAsync();
|
|
1750
|
+
}
|
|
1688
1751
|
}, (err) => {
|
|
1689
1752
|
chunk.async = !1, boundary.abort(err);
|
|
1690
1753
|
});
|
|
@@ -1708,32 +1771,56 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1708
1771
|
};
|
|
1709
1772
|
}
|
|
1710
1773
|
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
1711
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state,
|
|
1712
|
-
|
|
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));
|
|
1777
|
+
if (catchBoundary.aborted) {
|
|
1778
|
+
if (!catchContent) throw catchBoundary.reason;
|
|
1779
|
+
return catchContent(catchBoundary.reason), !0;
|
|
1780
|
+
}
|
|
1713
1781
|
if (body === bodyEnd) return chunk.append(body), !1;
|
|
1714
1782
|
let renderersAtSettle = !catchBoundary.resumeWrites, bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1715
1783
|
chunk.next = body, boundary.startAsync();
|
|
1716
|
-
let reorderId = catchContent ? state.nextReorderId() : ""
|
|
1717
|
-
return reorderId && (chunk.
|
|
1718
|
-
|
|
1719
|
-
|
|
1784
|
+
let reorderId = catchContent ? state.nextReorderId() : "";
|
|
1785
|
+
return reorderId && (chunk.catchRange = {
|
|
1786
|
+
id: reorderId,
|
|
1787
|
+
end: bodyEnd
|
|
1788
|
+
}, captureContext(chunk)), catchBoundary.onNext = () => {
|
|
1789
|
+
if (!boundary.aborted) {
|
|
1790
|
+
if (catchBoundary.aborted) {
|
|
1720
1791
|
if (!reorderId) {
|
|
1721
|
-
boundary.abort(catchBoundary.
|
|
1792
|
+
boundary.abort(catchBoundary.reason);
|
|
1722
1793
|
return;
|
|
1723
1794
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1795
|
+
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
1796
|
+
chunk.catchRange = null, renderersAtSettle || catchChunk.render(clearTryRenderers, branchId);
|
|
1797
|
+
let inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
1798
|
+
if (boundary.aborted) return;
|
|
1799
|
+
if ((bodyEnd.consumed || !inOrder) && (catchChunk.reorderStart = state.mark("*", branchId + "")), bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
1800
|
+
else {
|
|
1801
|
+
let reorder = null;
|
|
1802
|
+
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
1803
|
+
let endMarker = state.mark("!", reorderId), cut = body;
|
|
1804
|
+
for (; cut.consumed;) cut = cut.next;
|
|
1805
|
+
cut.async = !1, cut.next = inOrder ? catchChunk : bodyNext, cut.html = streamed ? endMarker : inOrder ? "" : state.mark("!^", reorderId) + endMarker, cut.scripts = cut.effects = cut.lastEffect = "", cut.placeholder = cut.reorderId = cut.catchRange = null, cut.deferredReorder = reorder, inOrder && (catchChunk.next = bodyNext);
|
|
1730
1806
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), boundary.endAsync());
|
|
1807
|
+
boundary.endAsync();
|
|
1808
|
+
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), chunk.catchRange = null, boundary.endAsync());
|
|
1734
1809
|
}
|
|
1735
1810
|
}, renderersAtSettle;
|
|
1736
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
|
+
}
|
|
1737
1824
|
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
1738
1825
|
writeScope(branchId, {
|
|
1739
1826
|
E: catchContent,
|
|
@@ -1769,7 +1856,7 @@ var State = class {
|
|
|
1769
1856
|
flushScopes = !1;
|
|
1770
1857
|
writeScopes = {};
|
|
1771
1858
|
readyIds = null;
|
|
1772
|
-
|
|
1859
|
+
scopeReason;
|
|
1773
1860
|
$global;
|
|
1774
1861
|
constructor($global) {
|
|
1775
1862
|
this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
@@ -1810,28 +1897,42 @@ var State = class {
|
|
|
1810
1897
|
mark(code, str) {
|
|
1811
1898
|
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1812
1899
|
}
|
|
1813
|
-
}, Boundary = class
|
|
1900
|
+
}, Boundary = class {
|
|
1814
1901
|
onNext = NOOP$2;
|
|
1815
1902
|
count = 0;
|
|
1816
1903
|
resumeWrites = 0;
|
|
1817
1904
|
state;
|
|
1818
1905
|
parent;
|
|
1906
|
+
aborted = !1;
|
|
1907
|
+
reason;
|
|
1908
|
+
subscribed;
|
|
1909
|
+
pendingReorders;
|
|
1910
|
+
children;
|
|
1911
|
+
withinCatch = !1;
|
|
1819
1912
|
constructor(state, signal, parent) {
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
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));
|
|
1914
|
+
}
|
|
1915
|
+
abort(reason) {
|
|
1916
|
+
if (this.aborted) return;
|
|
1917
|
+
let { state } = this;
|
|
1918
|
+
if (this.aborted = !0, this.reason = reason, this.subscribed && unsubscribe(this.subscribed, state.serializer), this.pendingReorders) {
|
|
1919
|
+
for (let reorder of this.pendingReorders) state.reorder(reorder);
|
|
1920
|
+
this.pendingReorders = void 0;
|
|
1921
|
+
}
|
|
1922
|
+
if (this.count = 0, this.state = new State(state.$global), this.children) for (let child of this.children) child.abort(reason);
|
|
1923
|
+
this.onNext();
|
|
1823
1924
|
}
|
|
1824
1925
|
handleEvent(event) {
|
|
1825
1926
|
this.abort(event.target.reason);
|
|
1826
1927
|
}
|
|
1827
1928
|
flush() {
|
|
1828
|
-
return this.
|
|
1929
|
+
return this.aborted || flushSerializer(this, this.state), this.count ? 1 : this.aborted ? 2 : 0;
|
|
1829
1930
|
}
|
|
1830
1931
|
startAsync() {
|
|
1831
|
-
this.
|
|
1932
|
+
this.aborted || this.count++;
|
|
1832
1933
|
}
|
|
1833
1934
|
endAsync() {
|
|
1834
|
-
this.
|
|
1935
|
+
this.aborted || (this.count--, this.onNext());
|
|
1835
1936
|
}
|
|
1836
1937
|
}, Chunk = class Chunk {
|
|
1837
1938
|
html = "";
|
|
@@ -1840,9 +1941,12 @@ var State = class {
|
|
|
1840
1941
|
lastEffect = "";
|
|
1841
1942
|
async = !1;
|
|
1842
1943
|
consumed = !1;
|
|
1843
|
-
needsWalk = !1;
|
|
1844
1944
|
reorderId = null;
|
|
1945
|
+
reorderStart = "";
|
|
1845
1946
|
deferredReady = null;
|
|
1947
|
+
heldEffects = null;
|
|
1948
|
+
deferredReorder = null;
|
|
1949
|
+
catchRange = null;
|
|
1846
1950
|
placeholder = null;
|
|
1847
1951
|
boundary;
|
|
1848
1952
|
next;
|
|
@@ -1858,13 +1962,17 @@ var State = class {
|
|
|
1858
1962
|
this.html += html;
|
|
1859
1963
|
}
|
|
1860
1964
|
writeEffect(scopeId, registryId) {
|
|
1861
|
-
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));
|
|
1862
1966
|
}
|
|
1863
1967
|
writeScript(script) {
|
|
1864
1968
|
this.scripts = concatScripts(this.scripts, script);
|
|
1865
1969
|
}
|
|
1866
1970
|
append(chunk) {
|
|
1867
|
-
this.html += chunk.html, this.
|
|
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());
|
|
1972
|
+
}
|
|
1973
|
+
takeHeldEffects() {
|
|
1974
|
+
let { heldEffects } = this;
|
|
1975
|
+
return this.heldEffects = null, heldEffects;
|
|
1868
1976
|
}
|
|
1869
1977
|
takeDeferredReady() {
|
|
1870
1978
|
let { deferredReady } = this;
|
|
@@ -1876,25 +1984,59 @@ var State = class {
|
|
|
1876
1984
|
deferred.effects = this.effects, deferred.scripts = this.scripts, this.effects = this.scripts = this.lastEffect = "", this.deferredReady = concat(deferred, this.deferredReady);
|
|
1877
1985
|
}
|
|
1878
1986
|
}
|
|
1879
|
-
|
|
1987
|
+
renderPlaceholders(boundary) {
|
|
1988
|
+
let { state } = boundary;
|
|
1989
|
+
restart: for (;;) {
|
|
1990
|
+
let reorders = null;
|
|
1991
|
+
for (let cur = this; cur.next && !cur.async; cur = cur.next) {
|
|
1992
|
+
if (cur.renderPlaceholder(state)) {
|
|
1993
|
+
if (boundary.aborted) return;
|
|
1994
|
+
continue restart;
|
|
1995
|
+
}
|
|
1996
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
1997
|
+
}
|
|
1998
|
+
if (state.writeReorders) {
|
|
1999
|
+
for (let reorder of state.writeReorders) if ((reorders = renderReorderPlaceholders(reorder, reorders)) === !1) {
|
|
2000
|
+
if (boundary.aborted) return;
|
|
2001
|
+
continue restart;
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
for (let i = 0; reorders && i < reorders.length; i++) if ((reorders = renderReorderPlaceholders(reorders[i], reorders)) === !1) {
|
|
2005
|
+
if (boundary.aborted) return;
|
|
2006
|
+
continue restart;
|
|
2007
|
+
}
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
renderPlaceholder(state) {
|
|
1880
2012
|
let { placeholder } = this;
|
|
1881
|
-
if (placeholder)
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
2013
|
+
if (!placeholder || (this.placeholder = null, this.boundary.aborted)) return !1;
|
|
2014
|
+
let { body } = placeholder, end = body;
|
|
2015
|
+
for (; end.next && !end.async;) end = end.next;
|
|
2016
|
+
if (!end.async) return end.next = this.next, this.next = body, !1;
|
|
2017
|
+
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId + "";
|
|
2018
|
+
this.writeHTML(state.mark("!^", reorderId));
|
|
2019
|
+
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
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;
|
|
2021
|
+
let stateful = this.effects !== effects;
|
|
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;
|
|
2023
|
+
}
|
|
2024
|
+
markCatchRange() {
|
|
2025
|
+
let { catchRange } = this;
|
|
2026
|
+
if (catchRange) {
|
|
2027
|
+
let { state } = this.boundary;
|
|
2028
|
+
this.catchRange = null, this.writeHTML(state.mark("!^", catchRange.id)), catchRange.end.writeHTML(state.mark("!", catchRange.id));
|
|
1892
2029
|
}
|
|
1893
2030
|
}
|
|
1894
|
-
|
|
1895
|
-
let
|
|
1896
|
-
|
|
1897
|
-
|
|
2031
|
+
queueDeferredReorder() {
|
|
2032
|
+
let { deferredReorder } = this;
|
|
2033
|
+
deferredReorder && (this.deferredReorder = null, deferredReorder.boundary.state.reorder(deferredReorder));
|
|
2034
|
+
}
|
|
2035
|
+
consume(boundary) {
|
|
2036
|
+
this.renderPlaceholders(boundary);
|
|
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;
|
|
1898
2040
|
}
|
|
1899
2041
|
render(content, val) {
|
|
1900
2042
|
let prev = $chunk;
|
|
@@ -1908,10 +2050,9 @@ var State = class {
|
|
|
1908
2050
|
}
|
|
1909
2051
|
}
|
|
1910
2052
|
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
1911
|
-
let { serializeState } = this, { readyId } = serializeState, scripts = "";
|
|
1912
|
-
if (
|
|
1913
|
-
|
|
1914
|
-
}), readyId && !this.async) {
|
|
2053
|
+
let { serializeState } = this, { readyId } = serializeState, scripts = "", held = this.takeDeferredReady();
|
|
2054
|
+
if (held) for (let chunk of Array.isArray(held) ? held : [held]) chunk.boundary.aborted || (scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk)));
|
|
2055
|
+
if (readyId && !this.async) {
|
|
1915
2056
|
let { state } = boundary;
|
|
1916
2057
|
flushSerializer(boundary, serializeState);
|
|
1917
2058
|
let deps = state.serializer.takeChannelDeps(), effects = holdEffects ? "" : this.effects, { resumes } = serializeState, chunkScripts = this.scripts;
|
|
@@ -1929,51 +2070,74 @@ var State = class {
|
|
|
1929
2070
|
}
|
|
1930
2071
|
flushScript(boundary) {
|
|
1931
2072
|
let { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1932
|
-
needsWalk && (state.walkOnNextFlush = !1);
|
|
2073
|
+
needsWalk && (state.walkOnNextFlush = !1), flushSerializer(boundary, state);
|
|
1933
2074
|
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
1934
|
-
for (let channel; !boundary.
|
|
2075
|
+
for (let channel; !boundary.aborted && (channel = state.serializer.pendingReadyChannel());) {
|
|
1935
2076
|
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1936
2077
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1937
2078
|
}
|
|
1938
2079
|
readyResumeScripts && (needsWalk = !0);
|
|
1939
|
-
let effects = this.async ? "" : this.effects, { html, scripts } = this;
|
|
1940
|
-
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 + "\"");
|
|
1941
2082
|
let reordered = "", needsResumeArray = !1;
|
|
1942
2083
|
if (state.writeReorders) {
|
|
1943
|
-
let carried = null;
|
|
1944
2084
|
for (let reorderedChunk of state.writeReorders) {
|
|
1945
|
-
if (
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
(carried ||= []).push(reorderedChunk);
|
|
1950
|
-
continue;
|
|
1951
|
-
}
|
|
1952
|
-
reorderedChunk.async = !1;
|
|
1953
|
-
}
|
|
1954
|
-
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++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"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:e.l[a]?1:2,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 + ")"));
|
|
1955
|
-
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1956
|
-
for (reorderedChunk.reorderId = null;;) {
|
|
1957
|
-
cur.flushPlaceholder(), cur.deferOwnReady();
|
|
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 + ")"));
|
|
2086
|
+
let { reorderId, reorderStart } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", effectsBoundary = reorderedChunk.boundary, reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
2087
|
+
for (reorderedChunk.reorderId = null; cur;) {
|
|
2088
|
+
cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
|
|
1958
2089
|
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
1959
|
-
|
|
1960
|
-
else break;
|
|
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;
|
|
1961
2091
|
}
|
|
1962
|
-
reorderEffects && (this.async ? (this
|
|
2092
|
+
reorderEffects && (this.async ? holdReorderEffects(this, effectsBoundary, reorderEffects) : (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")));
|
|
1963
2093
|
for (let reservation of readyReservations) reordered = concatScripts(reordered, reservation);
|
|
1964
|
-
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>";
|
|
1965
2095
|
}
|
|
1966
|
-
state.writeReorders =
|
|
2096
|
+
state.writeReorders = null;
|
|
1967
2097
|
}
|
|
1968
|
-
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;
|
|
1969
2099
|
}
|
|
1970
2100
|
flushHTML(boundary) {
|
|
1971
2101
|
let { state } = boundary;
|
|
1972
|
-
this.
|
|
2102
|
+
this.flushScript(boundary);
|
|
1973
2103
|
let { html, scripts } = this;
|
|
1974
2104
|
return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
|
|
1975
2105
|
}
|
|
1976
2106
|
};
|
|
2107
|
+
function renderReorderPlaceholders(reorder, reorders) {
|
|
2108
|
+
if (!reorder.boundary.aborted) for (let cur = reorder; cur; cur = cur.next) {
|
|
2109
|
+
if (cur.renderPlaceholder(reorder.boundary.state)) return !1;
|
|
2110
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
2111
|
+
}
|
|
2112
|
+
return reorders;
|
|
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
|
+
}
|
|
1977
2141
|
function flushSerializer(boundary, serializeState) {
|
|
1978
2142
|
let { state } = boundary, { serializer } = state, pending = serializer.pending(serializeState);
|
|
1979
2143
|
if (serializeState.flushScopes || pending) {
|
|
@@ -2224,11 +2388,11 @@ var ServerRendered = class {
|
|
|
2224
2388
|
(boundary.onNext = () => {
|
|
2225
2389
|
switch (!boundary.count && boundary.flush()) {
|
|
2226
2390
|
case 2:
|
|
2227
|
-
settle(boundary), reject(boundary.
|
|
2391
|
+
settle(boundary), reject(boundary.reason);
|
|
2228
2392
|
break;
|
|
2229
2393
|
case 0:
|
|
2230
|
-
if (head = head.consume(), boundary.
|
|
2231
|
-
html += head.flushHTML(boundary), boundary.count || boundary.
|
|
2394
|
+
if (head = head.consume(boundary), boundary.aborted) break;
|
|
2395
|
+
html += head.flushHTML(boundary), boundary.count || boundary.aborted || (settle(boundary), resolve(html));
|
|
2232
2396
|
}
|
|
2233
2397
|
})();
|
|
2234
2398
|
});
|
|
@@ -2249,13 +2413,13 @@ var ServerRendered = class {
|
|
|
2249
2413
|
again = !1;
|
|
2250
2414
|
let status = boundary.flush();
|
|
2251
2415
|
if (status === 2) {
|
|
2252
|
-
tick || offTick(onNext), settle(boundary), onAbort(boundary.
|
|
2416
|
+
tick || offTick(onNext), settle(boundary), onAbort(boundary.reason);
|
|
2253
2417
|
return;
|
|
2254
2418
|
}
|
|
2255
2419
|
if (write || status === 0) {
|
|
2256
|
-
if (head = head.consume(), boundary.
|
|
2420
|
+
if (head = head.consume(boundary), boundary.aborted) continue;
|
|
2257
2421
|
let html = head.flushHTML(boundary);
|
|
2258
|
-
if (boundary.
|
|
2422
|
+
if (boundary.aborted) continue;
|
|
2259
2423
|
if (html && onWrite(html), !boundary.count) {
|
|
2260
2424
|
tick || offTick(onNext), settle(boundary), onClose();
|
|
2261
2425
|
return;
|
|
@@ -2270,8 +2434,8 @@ var ServerRendered = class {
|
|
|
2270
2434
|
toString() {
|
|
2271
2435
|
let head = this.#head;
|
|
2272
2436
|
if (this.#head = null, !head) throw Error(CONSUMED_RESULT_MESSAGE);
|
|
2273
|
-
let { boundary } = head, html = boundary.flush() === 0 ? head.consume().flushHTML(boundary) : "";
|
|
2274
|
-
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.
|
|
2437
|
+
let { boundary } = head, html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
2438
|
+
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.aborted) throw boundary.reason;
|
|
2275
2439
|
return html;
|
|
2276
2440
|
}
|
|
2277
2441
|
};
|
|
@@ -2281,42 +2445,66 @@ function settle(boundary) {
|
|
|
2281
2445
|
function NOOP$1() {}
|
|
2282
2446
|
//#endregion
|
|
2283
2447
|
//#region src/html/assets.ts
|
|
2284
|
-
function withLoadAssets(renderer, assetId, triggers) {
|
|
2285
|
-
return Object.assign((input) =>
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
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));
|
|
2289
2454
|
}
|
|
2290
2455
|
function withPageAssets(template, runtime, assetId, runtimeId) {
|
|
2291
|
-
return
|
|
2456
|
+
return Object.assign((input) => {
|
|
2292
2457
|
let g = $global();
|
|
2293
|
-
|
|
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));
|
|
2294
2461
|
}, template);
|
|
2295
2462
|
}
|
|
2296
2463
|
function _flush_head() {
|
|
2297
2464
|
let g = $global();
|
|
2298
|
-
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;
|
|
2299
2469
|
}
|
|
2300
|
-
function
|
|
2301
|
-
let
|
|
2302
|
-
for (
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
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;
|
|
2474
|
+
}
|
|
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();
|
|
2306
2483
|
}
|
|
2307
|
-
return g[kBlockIndex] = bi, g[kDeferIndex] = di, result + html;
|
|
2308
2484
|
}
|
|
2309
|
-
function
|
|
2310
|
-
|
|
2311
|
-
assets ? assets.find((a) => a.id === id) || assets.push({
|
|
2312
|
-
id,
|
|
2313
|
-
triggers
|
|
2314
|
-
}) : (g[kAssets] = [{
|
|
2315
|
-
id,
|
|
2316
|
-
triggers
|
|
2317
|
-
}], g[kBlockIndex] = g[kDeferIndex] = 0);
|
|
2485
|
+
function needsWrite(at) {
|
|
2486
|
+
return at === void 0 || at !== null && mayDrop(at);
|
|
2318
2487
|
}
|
|
2319
|
-
function
|
|
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);
|
|
2493
|
+
}
|
|
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) {
|
|
2320
2508
|
let htmlStr = _escape_script(JSON.stringify(html)), exprs = triggers.map((trigger) => {
|
|
2321
2509
|
let options = trigger.options && toObjectExpression(trigger.options);
|
|
2322
2510
|
switch (trigger.type) {
|
|
@@ -2326,7 +2514,7 @@ function writeTriggerScript(id, html, triggers) {
|
|
|
2326
2514
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2327
2515
|
}
|
|
2328
2516
|
});
|
|
2329
|
-
|
|
2517
|
+
return `((h,d,l=$=>{d||document.head.append(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(${htmlStr})`;
|
|
2330
2518
|
}
|
|
2331
2519
|
function querySelectorOrLoad(selector) {
|
|
2332
2520
|
return `document.querySelector(${JSON.stringify(selector)})||l()`;
|
|
@@ -2345,10 +2533,14 @@ function drainClassFunctions($global, writeScope) {
|
|
|
2345
2533
|
for (let [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
|
|
2346
2534
|
pending.length = 0;
|
|
2347
2535
|
}
|
|
2536
|
+
function swapReorders(state, reorders) {
|
|
2537
|
+
let { writeReorders } = state;
|
|
2538
|
+
return state.writeReorders = reorders, writeReorders;
|
|
2539
|
+
}
|
|
2348
2540
|
function NOOP() {}
|
|
2349
|
-
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", {
|
|
2350
2542
|
enumerable: !0,
|
|
2351
2543
|
get: function() {
|
|
2352
2544
|
return _dynamic_tag;
|
|
2353
2545
|
}
|
|
2354
|
-
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports.
|
|
2546
|
+
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._set_scope_reason = _set_scope_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._text_resume = _text_resume, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports._write_guard = _write_guard, exports._write_if = _write_if, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|