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.mjs
CHANGED
|
@@ -247,8 +247,8 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
247
247
|
}, 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) => {
|
|
248
248
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
249
249
|
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;
|
|
250
|
-
}, 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,
|
|
251
|
-
let shouldResume =
|
|
250
|
+
}, 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) => {
|
|
251
|
+
let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
252
252
|
if (typeof renderer == "string") {
|
|
253
253
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
254
254
|
rendered = !0, (() => {
|
|
@@ -257,7 +257,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
257
257
|
if (renderer === "textarea") _html(_attrs_textarea_value(branchId, "a", input));
|
|
258
258
|
else {
|
|
259
259
|
if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
260
|
-
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,
|
|
260
|
+
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);
|
|
261
261
|
}
|
|
262
262
|
_html(`</${renderer}>`);
|
|
263
263
|
}
|
|
@@ -267,12 +267,12 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
267
267
|
} else {
|
|
268
268
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
269
269
|
if (renderer) try {
|
|
270
|
-
return
|
|
270
|
+
return _set_scope_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
271
271
|
...inputOrArgs,
|
|
272
272
|
content
|
|
273
273
|
} : inputOrArgs);
|
|
274
274
|
} finally {
|
|
275
|
-
|
|
275
|
+
_set_scope_reason(void 0);
|
|
276
276
|
}
|
|
277
277
|
else if (content) return content();
|
|
278
278
|
};
|
|
@@ -284,8 +284,9 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
284
284
|
let patched = patch(tag, scopeId, accessor);
|
|
285
285
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
286
286
|
};
|
|
287
|
-
})(_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(),
|
|
287
|
+
})(_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 = {
|
|
288
288
|
$global,
|
|
289
|
+
writeLoadAsset,
|
|
289
290
|
fork: _await,
|
|
290
291
|
write: _html,
|
|
291
292
|
writeScript,
|
|
@@ -304,7 +305,8 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
304
305
|
onFlush(fn) {
|
|
305
306
|
let { flushHTML } = Chunk.prototype;
|
|
306
307
|
Chunk.prototype.flushHTML = function(boundary) {
|
|
307
|
-
|
|
308
|
+
let { state } = boundary, reorders = swapReorders(state, null);
|
|
309
|
+
return fn(this), swapReorders(state, reorders), flushHTML.call(this, boundary);
|
|
308
310
|
};
|
|
309
311
|
},
|
|
310
312
|
patchDynamicTag,
|
|
@@ -327,24 +329,45 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
327
329
|
return compatRegistered;
|
|
328
330
|
};
|
|
329
331
|
},
|
|
332
|
+
joinChunks(chunks) {
|
|
333
|
+
let joined;
|
|
334
|
+
for (let chunk of chunks) chunk.boundary.aborted || (joined ? joined.append(chunk) : joined = chunk);
|
|
335
|
+
return joined;
|
|
336
|
+
},
|
|
337
|
+
appendChunks(chunks) {
|
|
338
|
+
let chunk = getChunk();
|
|
339
|
+
for (let part of chunks) chunk.append(part), part.effects && (chunk.lastEffect = part.lastEffect);
|
|
340
|
+
},
|
|
341
|
+
deferReorders(reorders) {
|
|
342
|
+
let chunk = getChunk();
|
|
343
|
+
for (let i = reorders.length; i--;) {
|
|
344
|
+
let carrier = chunk.fork(chunk.boundary, chunk.next);
|
|
345
|
+
carrier.deferredReorder = reorders[i], chunk.next = carrier;
|
|
346
|
+
}
|
|
347
|
+
},
|
|
330
348
|
createChunk($global) {
|
|
331
349
|
let state = this.ensureState($global);
|
|
332
350
|
return new Chunk(new Boundary(state), null, null, state);
|
|
333
351
|
},
|
|
334
|
-
flushScript(
|
|
335
|
-
chunk
|
|
336
|
-
|
|
337
|
-
if (boundary.
|
|
352
|
+
flushScript(chunk, reorders) {
|
|
353
|
+
let { boundary } = chunk, { state } = boundary, html = "", scripts = "";
|
|
354
|
+
if (reorders) for (let reorder of reorders) state.reorder(reorder);
|
|
355
|
+
if (boundary.flush() === 0 && ({html, scripts} = chunk.flushScript(boundary)), boundary.aborted) throw boundary.reason;
|
|
338
356
|
if (boundary.count) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
339
|
-
return
|
|
357
|
+
return {
|
|
358
|
+
html,
|
|
359
|
+
scripts
|
|
360
|
+
};
|
|
340
361
|
},
|
|
341
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
|
342
|
-
|
|
362
|
+
render(renderer, willRerender, classAPIOut, component, input, componentScopes, registerChildScope, parentChunk) {
|
|
363
|
+
if (parentChunk?.boundary.aborted) return;
|
|
364
|
+
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;
|
|
343
365
|
if ("renderBody" in input) {
|
|
344
366
|
normalizedInput = {};
|
|
345
367
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
346
368
|
}
|
|
347
|
-
|
|
369
|
+
let componentScope = new Chunk(boundary, null, context, state);
|
|
370
|
+
componentScope.render(() => {
|
|
348
371
|
if (this.hasPendingClassFunctions(classAPIOut.global) && drainClassFunctions(classAPIOut.global, (hostId) => {
|
|
349
372
|
let fnScopeId = _scope_id(), scope = writeScope(fnScopeId, {
|
|
350
373
|
m5c: component.id,
|
|
@@ -355,11 +378,12 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
355
378
|
let scopeId = _peek_scope_id();
|
|
356
379
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
357
380
|
}
|
|
358
|
-
|
|
381
|
+
}), head.render(() => {
|
|
382
|
+
_set_scope_reason(willRerender ? CLIENT_ALL : 0);
|
|
359
383
|
try {
|
|
360
384
|
renderer(normalizedInput);
|
|
361
385
|
} finally {
|
|
362
|
-
|
|
386
|
+
_set_scope_reason(void 0);
|
|
363
387
|
}
|
|
364
388
|
let asyncOut = classAPIOut.beginAsync({
|
|
365
389
|
last: !0,
|
|
@@ -367,7 +391,16 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
367
391
|
});
|
|
368
392
|
classAPIOut.onLast((next) => {
|
|
369
393
|
(boundary.onNext = () => {
|
|
370
|
-
|
|
394
|
+
if (boundary.aborted) boundary.onNext = NOOP, parentChunk?.boundary.aborted ? (asyncOut.end(), next()) : asyncOut.error(boundary.reason);
|
|
395
|
+
else if (!boundary.count) {
|
|
396
|
+
boundary.onNext = NOOP;
|
|
397
|
+
let queued = swapReorders(state, null);
|
|
398
|
+
head = head.consume(boundary);
|
|
399
|
+
let reorders = swapReorders(state, queued);
|
|
400
|
+
reorders && asyncOut.writer.get("reorders").push(...reorders);
|
|
401
|
+
let heldEffects = head.takeHeldEffects();
|
|
402
|
+
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();
|
|
403
|
+
}
|
|
371
404
|
})();
|
|
372
405
|
});
|
|
373
406
|
});
|
|
@@ -448,6 +481,7 @@ function normalizeDynamicRenderer(value) {
|
|
|
448
481
|
}
|
|
449
482
|
//#endregion
|
|
450
483
|
//#region src/common/errors.ts
|
|
484
|
+
function _assert_class_toggles(classes, toggles) {}
|
|
451
485
|
function _el_read_error() {}
|
|
452
486
|
function _hoist_read_error() {}
|
|
453
487
|
function _assert_hoist(value) {}
|
|
@@ -472,11 +506,12 @@ function forUntil(until, from, step, cb) {
|
|
|
472
506
|
}
|
|
473
507
|
//#endregion
|
|
474
508
|
//#region src/common/opt.ts
|
|
475
|
-
function
|
|
509
|
+
function reduce(opt, cb, acc) {
|
|
476
510
|
if (opt) {
|
|
477
|
-
if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
478
|
-
else cb(opt);
|
|
511
|
+
if (Array.isArray(opt)) for (let item of opt) acc = cb(acc, item);
|
|
512
|
+
else acc = cb(acc, opt);
|
|
479
513
|
}
|
|
514
|
+
return acc;
|
|
480
515
|
}
|
|
481
516
|
function push(opt, item) {
|
|
482
517
|
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
@@ -550,6 +585,14 @@ var State$1 = class {
|
|
|
550
585
|
channel
|
|
551
586
|
});
|
|
552
587
|
}
|
|
588
|
+
dropCall(value, object, property) {
|
|
589
|
+
let { mutated } = this.#state;
|
|
590
|
+
for (let i = 0; i < mutated.length; i++) {
|
|
591
|
+
let mutation = mutated[i];
|
|
592
|
+
if (mutation.value === value && mutation.object === object && mutation.property === property) return mutated.splice(i, 1), !0;
|
|
593
|
+
}
|
|
594
|
+
return !1;
|
|
595
|
+
}
|
|
553
596
|
};
|
|
554
597
|
function register(id, val, scope, locals) {
|
|
555
598
|
return REGISTRY.set(val, {
|
|
@@ -607,13 +650,13 @@ function writeAssigned(state) {
|
|
|
607
650
|
let hasSeen = state.refs.get(mutation.object)?.id, objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
608
651
|
if (writeProp(state, mutation.object, null, "")) {
|
|
609
652
|
let objectRef = state.refs.get(mutation.object);
|
|
610
|
-
objectRef && objectRef.scopeId === void 0 && (objectRef.id ?
|
|
653
|
+
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(")")));
|
|
611
654
|
} else state.buf.push("void 0");
|
|
612
655
|
let valueStartIndex = state.buf.push(toAccess(toObjectKey(mutation.property)) + "(");
|
|
613
656
|
if (mutation.value !== void 0) {
|
|
614
657
|
if (writeProp(state, mutation.value, null, "")) {
|
|
615
658
|
let valueRef = typeof mutation.value == "string" ? state.strs.get(mutation.value) : state.refs.get(mutation.value);
|
|
616
|
-
valueRef && !valueRef.id && valueRef.scopeId === void 0 && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
659
|
+
valueRef && !valueRef.id && valueRef.scopeId === void 0 && !isAncestorChannelRef(state, valueRef) && (valueRef.id = mutation.valueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
617
660
|
} else state.buf.push("void 0");
|
|
618
661
|
}
|
|
619
662
|
state.buf.push(")");
|
|
@@ -626,7 +669,7 @@ function writeCallArg(state, val) {
|
|
|
626
669
|
if (val === void 0) state.wroteUndefined = !0, state.buf.push("$");
|
|
627
670
|
else if (writeProp(state, val, null, "")) {
|
|
628
671
|
let ref = state.refs.get(val) || state.strs.get(val);
|
|
629
|
-
ref &&
|
|
672
|
+
ref && ensureId(state, ref);
|
|
630
673
|
} else state.buf.push("void 0");
|
|
631
674
|
}
|
|
632
675
|
function hasChannelMutations(state) {
|
|
@@ -678,7 +721,7 @@ function writeRegistered(state, val, parent, accessor, registered) {
|
|
|
678
721
|
let locals = registered.locals?.(state.boundary.state.scope);
|
|
679
722
|
if (locals) {
|
|
680
723
|
state.buf.push(registered.access + "(_(" + scopeId + ")");
|
|
681
|
-
for (let local of locals) state.buf.push(","),
|
|
724
|
+
for (let local of locals) state.buf.push(","), writePlainObject(state, local, newArgReference(state, ref, local));
|
|
682
725
|
} else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
|
|
683
726
|
state.buf.push(")");
|
|
684
727
|
} else state.buf.push(registered.access);
|
|
@@ -878,6 +921,16 @@ function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
|
|
|
878
921
|
} else state.buf.push(plainPrefix), writeArray(state, items, new Reference(ref, null, state.flushId, state.buf.length));
|
|
879
922
|
state.buf.push(")");
|
|
880
923
|
}
|
|
924
|
+
function newArgReference(state, parent, val) {
|
|
925
|
+
for (let key in val) {
|
|
926
|
+
let member = val[key];
|
|
927
|
+
if (isDedupedMember(member) && !(typeof member == "string" ? state.strs.has(member) : state.refs.has(member))) {
|
|
928
|
+
let ref = new Reference(parent, null, state.flushId, null, nextRefAccess(state));
|
|
929
|
+
return state.buf.push(ref.id + "="), ref;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
return new Reference(parent, null, state.flushId, state.buf.length);
|
|
933
|
+
}
|
|
881
934
|
function isDedupedMember(val) {
|
|
882
935
|
switch (typeof val) {
|
|
883
936
|
case "object": return val !== null && val[K_SCOPE_ID] === void 0;
|
|
@@ -981,14 +1034,10 @@ function writeResponse(state, val, ref) {
|
|
|
981
1034
|
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;
|
|
982
1035
|
}
|
|
983
1036
|
function writeIntl(state, val, name, ref) {
|
|
984
|
-
let { locale, ...options } = val.resolvedOptions()
|
|
985
|
-
for (let key in options) if (isDedupedMember(options[key])) {
|
|
986
|
-
needsId = !0;
|
|
987
|
-
break;
|
|
988
|
-
}
|
|
1037
|
+
let { locale, ...options } = val.resolvedOptions();
|
|
989
1038
|
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
990
|
-
let optionsRef;
|
|
991
|
-
return
|
|
1039
|
+
let optionsRef = newArgReference(state, ref, options);
|
|
1040
|
+
return state.buf.push("{"), writeObjectProps(state, options, optionsRef), state.buf.push("})"), !0;
|
|
992
1041
|
}
|
|
993
1042
|
function writeIntlLocale(state, val) {
|
|
994
1043
|
return state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")"), !0;
|
|
@@ -999,7 +1048,7 @@ function writeTemporal(state, val, name) {
|
|
|
999
1048
|
function writeReadableStream(state, val, ref) {
|
|
1000
1049
|
if (val.locked) return !1;
|
|
1001
1050
|
let { boundary, channel } = state, reader = val.getReader(), iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1002
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1051
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1003
1052
|
}, onRejected = (reason) => {
|
|
1004
1053
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1005
1054
|
};
|
|
@@ -1025,19 +1074,16 @@ function writeGenerator(state, iter, ref) {
|
|
|
1025
1074
|
if (heldReturn) {
|
|
1026
1075
|
let holder = new Reference(ref, null, state.flushId, null, nextRefAccess(state));
|
|
1027
1076
|
state.buf.push("," + holder.id + "={}"), writeProp(state, returnValue, holder, "v");
|
|
1028
|
-
} else if (returnValue !== void 0) {
|
|
1029
|
-
let
|
|
1030
|
-
|
|
1031
|
-
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1032
|
-
retRef && !retRef.id && retRef.scopeId === void 0 && (retRef.id = nextRefAccess(state), state.buf[sepIndex] = "," + retRef.id + "=");
|
|
1033
|
-
}
|
|
1077
|
+
} else if (returnValue !== void 0 && (state.buf.push(","), writeProp(state, returnValue, ref, "") && isDedupedMember(returnValue))) {
|
|
1078
|
+
let retRef = typeof returnValue == "string" ? state.strs.get(returnValue) : state.refs.get(returnValue);
|
|
1079
|
+
retRef && ensureId(state, retRef);
|
|
1034
1080
|
}
|
|
1035
1081
|
return state.buf.push(")"), !0;
|
|
1036
1082
|
}
|
|
1037
1083
|
function writeAsyncGenerator(state, iter, ref) {
|
|
1038
1084
|
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1039
1085
|
let { boundary, channel } = state, iterId = nextRefAccess(state), handle = newAsyncHandle(state, ref, iterId), onFulfilled = ({ value, done }) => {
|
|
1040
|
-
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.
|
|
1086
|
+
done ? writeAsyncCall(state, boundary, handle, "r", value, channel) : boundary.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, handle, "f", value, channel));
|
|
1041
1087
|
}, onRejected = (reason) => {
|
|
1042
1088
|
writeAsyncCall(state, boundary, handle, "j", reason, channel);
|
|
1043
1089
|
};
|
|
@@ -1068,7 +1114,7 @@ function writeMaybeIterableProps(state, val, ref) {
|
|
|
1068
1114
|
return sep;
|
|
1069
1115
|
}
|
|
1070
1116
|
function writeAsyncCall(state, boundary, handle, method, value, channel, valueId = null) {
|
|
1071
|
-
boundary.
|
|
1117
|
+
boundary.aborted || (state.mutated.push({
|
|
1072
1118
|
value,
|
|
1073
1119
|
object: handle,
|
|
1074
1120
|
property: method,
|
|
@@ -1086,6 +1132,9 @@ function trackChannel(state, ref) {
|
|
|
1086
1132
|
}
|
|
1087
1133
|
return !1;
|
|
1088
1134
|
}
|
|
1135
|
+
function isAncestorChannelRef(state, ref) {
|
|
1136
|
+
return ref.channel?.readyId !== state.channel?.readyId;
|
|
1137
|
+
}
|
|
1089
1138
|
function abortRender(boundary, err) {
|
|
1090
1139
|
for (; boundary.parent;) boundary = boundary.parent;
|
|
1091
1140
|
boundary.abort(err);
|
|
@@ -1169,7 +1218,7 @@ function quote(str, startPos) {
|
|
|
1169
1218
|
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
1170
1219
|
}
|
|
1171
1220
|
function writeRef(state, ref) {
|
|
1172
|
-
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,
|
|
1221
|
+
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));
|
|
1173
1222
|
}
|
|
1174
1223
|
function ensureId(state, ref) {
|
|
1175
1224
|
return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : assignId(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
|
|
@@ -1180,14 +1229,14 @@ function accessId(state, ref) {
|
|
|
1180
1229
|
}
|
|
1181
1230
|
function assignId(state, ref) {
|
|
1182
1231
|
let { pos } = ref;
|
|
1183
|
-
return
|
|
1232
|
+
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)));
|
|
1184
1233
|
}
|
|
1185
1234
|
function accessPath(state, ref) {
|
|
1186
1235
|
let cur = ref, accessPrevValue = "";
|
|
1187
1236
|
do {
|
|
1188
1237
|
accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
|
|
1189
1238
|
let parent = cur.parent;
|
|
1190
|
-
if (parent.id
|
|
1239
|
+
if (parent.id) return trackChannel(state, parent), parent.id + accessPrevValue;
|
|
1191
1240
|
if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
|
|
1192
1241
|
cur = parent;
|
|
1193
1242
|
} while (cur);
|
|
@@ -1339,8 +1388,8 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1339
1388
|
}
|
|
1340
1389
|
return result;
|
|
1341
1390
|
}
|
|
1342
|
-
function _attrs_content(data, nodeAccessor, scopeId, tagName,
|
|
1343
|
-
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content,
|
|
1391
|
+
function _attrs_content(data, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1392
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1344
1393
|
}
|
|
1345
1394
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1346
1395
|
let partial = {};
|
|
@@ -1350,8 +1399,8 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1350
1399
|
}
|
|
1351
1400
|
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1352
1401
|
}
|
|
1353
|
-
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName,
|
|
1354
|
-
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content,
|
|
1402
|
+
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, markerGuard) {
|
|
1403
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, markerGuard);
|
|
1355
1404
|
}
|
|
1356
1405
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1357
1406
|
writeScope(scopeId, serializeType ? {
|
|
@@ -1484,8 +1533,17 @@ function _html(html) {
|
|
|
1484
1533
|
function writeScript(script) {
|
|
1485
1534
|
$chunk.writeScript(script);
|
|
1486
1535
|
}
|
|
1487
|
-
function
|
|
1488
|
-
|
|
1536
|
+
function catchableBoundary() {
|
|
1537
|
+
let { boundary } = $chunk;
|
|
1538
|
+
return boundary.withinCatch ? boundary : null;
|
|
1539
|
+
}
|
|
1540
|
+
function mayDrop(written) {
|
|
1541
|
+
let { boundary } = $chunk;
|
|
1542
|
+
for (let cur = written; cur && !isWithin(boundary, cur); cur = cur.parent) if (cur.aborted || cur.count) return !0;
|
|
1543
|
+
return !1;
|
|
1544
|
+
}
|
|
1545
|
+
function _script(scopeId, registryId, markerGuard) {
|
|
1546
|
+
markerGuard === 0 && ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1489
1547
|
}
|
|
1490
1548
|
function _trailers(html) {
|
|
1491
1549
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1526,8 +1584,8 @@ function _resume_branch(scopeId) {
|
|
|
1526
1584
|
let branchId = $chunk.context?.[kBranchId];
|
|
1527
1585
|
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1528
1586
|
}
|
|
1529
|
-
function _attr_content(nodeAccessor, scopeId, content,
|
|
1530
|
-
let shouldResume =
|
|
1587
|
+
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
1588
|
+
let shouldResume = markerGuard !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1531
1589
|
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1532
1590
|
["A" + nodeAccessor]: writeScope(branchId, {}),
|
|
1533
1591
|
["D" + nodeAccessor]: rendererKey(render)
|
|
@@ -1546,48 +1604,48 @@ function writeScopePassive(scopeId, partialScope) {
|
|
|
1546
1604
|
let target = $chunk.serializeState, scope = _scope_with_id(scopeId), passive = target.passiveScopes ||= {};
|
|
1547
1605
|
return Object.assign(scope, partialScope), passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope), scope;
|
|
1548
1606
|
}
|
|
1549
|
-
function _show_start(display,
|
|
1550
|
-
display ?
|
|
1607
|
+
function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
|
|
1608
|
+
display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1551
1609
|
}
|
|
1552
|
-
function _show_end(scopeId, accessor, display,
|
|
1610
|
+
function _show_end(scopeId, accessor, display, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1553
1611
|
let branchId = _scope_id(), wrap = !display;
|
|
1554
|
-
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor,
|
|
1612
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1555
1613
|
}
|
|
1556
|
-
function _for_of(list, cb, by, scopeId, accessor,
|
|
1614
|
+
function _for_of(list, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1557
1615
|
forBranches(by, (each) => each ? forOf(list, (item, index) => {
|
|
1558
1616
|
let itemKey = forOfBy(by, item, index);
|
|
1559
1617
|
each(itemKey, itemKey === index, () => cb(item, index));
|
|
1560
|
-
}) : forOf(list, cb), scopeId, accessor,
|
|
1618
|
+
}) : forOf(list, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1561
1619
|
}
|
|
1562
|
-
function _for_in(obj, cb, by, scopeId, accessor,
|
|
1620
|
+
function _for_in(obj, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1563
1621
|
forBranches(by, (each) => each ? forIn(obj, (key, value) => {
|
|
1564
1622
|
each(forInBy(by, key, value), !1, () => cb(key, value));
|
|
1565
|
-
}) : forIn(obj, cb), scopeId, accessor,
|
|
1623
|
+
}) : forIn(obj, cb), scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1566
1624
|
}
|
|
1567
|
-
function _for_to(to, from, step, cb, by, scopeId, accessor,
|
|
1625
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1568
1626
|
forBranches(by, (each) => {
|
|
1569
1627
|
let index = 0;
|
|
1570
1628
|
return each ? forTo(to, from, step, (value) => {
|
|
1571
1629
|
let itemKey = forStepBy(by, value);
|
|
1572
1630
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1573
1631
|
}) : forTo(to, from, step, cb);
|
|
1574
|
-
}, scopeId, accessor,
|
|
1632
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1575
1633
|
}
|
|
1576
|
-
function _for_until(to, from, step, cb, by, scopeId, accessor,
|
|
1634
|
+
function _for_until(to, from, step, cb, by, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1577
1635
|
forBranches(by, (each) => {
|
|
1578
1636
|
let index = 0;
|
|
1579
1637
|
return each ? forUntil(to, from, step, (value) => {
|
|
1580
1638
|
let itemKey = forStepBy(by, value);
|
|
1581
1639
|
each(itemKey, itemKey === index++, () => cb(value));
|
|
1582
1640
|
}) : forUntil(to, from, step, cb);
|
|
1583
|
-
}, scopeId, accessor,
|
|
1641
|
+
}, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode);
|
|
1584
1642
|
}
|
|
1585
|
-
function forBranches(by, iterate, scopeId, accessor,
|
|
1586
|
-
if (
|
|
1587
|
-
iterate(0), writeBranchEnd(scopeId, accessor,
|
|
1643
|
+
function forBranches(by, iterate, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1644
|
+
if (branchGuard === 0) {
|
|
1645
|
+
iterate(0), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, "");
|
|
1588
1646
|
return;
|
|
1589
1647
|
}
|
|
1590
|
-
let { state } = $chunk.boundary, resumeKeys =
|
|
1648
|
+
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
1591
1649
|
iterate((itemKey, sameAsIndex, render) => {
|
|
1592
1650
|
let branchId = _peek_scope_id();
|
|
1593
1651
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
@@ -1595,14 +1653,14 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1595
1653
|
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
1596
1654
|
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
1597
1655
|
});
|
|
1598
|
-
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor,
|
|
1656
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1599
1657
|
}
|
|
1600
|
-
function _if(cb, scopeId, accessor,
|
|
1601
|
-
let resumeBranch =
|
|
1658
|
+
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
1659
|
+
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;
|
|
1602
1660
|
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1603
1661
|
["D" + accessor]: branchIndex || void 0,
|
|
1604
1662
|
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1605
|
-
}), writeBranchEnd(scopeId, accessor,
|
|
1663
|
+
}), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1606
1664
|
}
|
|
1607
1665
|
function deferBranchStart(chunk) {
|
|
1608
1666
|
let beforeBranch = chunk.html;
|
|
@@ -1611,14 +1669,15 @@ function deferBranchStart(chunk) {
|
|
|
1611
1669
|
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1612
1670
|
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1613
1671
|
}
|
|
1614
|
-
function
|
|
1672
|
+
function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
1673
|
+
return markerGuard !== 0 && (!parentEndTag || branchExprGuard !== 0);
|
|
1674
|
+
}
|
|
1675
|
+
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
1615
1676
|
let endTag = parentEndTag || "";
|
|
1616
|
-
if (
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1621
|
-
} else $chunk.writeHTML(endTag);
|
|
1677
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
|
|
1678
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1679
|
+
$chunk.writeHTML(mark + endTag);
|
|
1680
|
+
} else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1622
1681
|
}
|
|
1623
1682
|
function _existing_scope(scopeId) {
|
|
1624
1683
|
return writeScope(scopeId, {});
|
|
@@ -1630,28 +1689,28 @@ function scopeWithId(state, scopeId) {
|
|
|
1630
1689
|
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1631
1690
|
return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
|
|
1632
1691
|
}
|
|
1633
|
-
function _subscribe(subscribers, scope, resumeId,
|
|
1692
|
+
function _subscribe(subscribers, scope, resumeId, markerGuard) {
|
|
1634
1693
|
if (subscribers) {
|
|
1635
|
-
let {
|
|
1636
|
-
|
|
1694
|
+
let { boundary, serializeState } = $chunk, { serializer } = boundary.state;
|
|
1695
|
+
!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);
|
|
1637
1696
|
}
|
|
1638
1697
|
return scope;
|
|
1639
1698
|
}
|
|
1640
1699
|
function maskGroup(mask, group) {
|
|
1641
1700
|
return mask === 715827883 ? 1 : typeof mask == "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
|
|
1642
1701
|
}
|
|
1643
|
-
function
|
|
1644
|
-
$chunk.boundary.state.
|
|
1702
|
+
function _set_scope_reason(reason) {
|
|
1703
|
+
$chunk.boundary.state.scopeReason = reason;
|
|
1645
1704
|
}
|
|
1646
1705
|
function _scope_reason() {
|
|
1647
|
-
let reason = $chunk.boundary.state.
|
|
1648
|
-
return $chunk.boundary.state.
|
|
1706
|
+
let reason = $chunk.boundary.state.scopeReason;
|
|
1707
|
+
return $chunk.boundary.state.scopeReason = void 0, reason;
|
|
1649
1708
|
}
|
|
1650
|
-
function
|
|
1709
|
+
function _write_if(condition, key) {
|
|
1651
1710
|
return condition && maskGroup(condition, key) ? 1 : void 0;
|
|
1652
1711
|
}
|
|
1653
|
-
function
|
|
1654
|
-
return
|
|
1712
|
+
function _write_guard(condition, key) {
|
|
1713
|
+
return _write_if(condition, key) || 0;
|
|
1655
1714
|
}
|
|
1656
1715
|
function writeWaitReady(readyId, renderer, input) {
|
|
1657
1716
|
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context, {
|
|
@@ -1661,10 +1720,11 @@ function writeWaitReady(readyId, renderer, input) {
|
|
|
1661
1720
|
writeScopes: {},
|
|
1662
1721
|
flushScopes: !1
|
|
1663
1722
|
}), bodyEnd = body.render(renderer, input);
|
|
1723
|
+
if (boundary.aborted) throw boundary.reason;
|
|
1664
1724
|
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);
|
|
1665
1725
|
}
|
|
1666
|
-
function _await(scopeId, accessor, promise, content,
|
|
1667
|
-
let resumeMarker =
|
|
1726
|
+
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
1727
|
+
let resumeMarker = markerGuard !== 0;
|
|
1668
1728
|
if (!isPromise(promise)) {
|
|
1669
1729
|
if (resumeMarker) {
|
|
1670
1730
|
let branchId = _peek_scope_id();
|
|
@@ -1674,15 +1734,18 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
1674
1734
|
}
|
|
1675
1735
|
let chunk = $chunk, { boundary } = chunk, startId = _peek_scope_id(), after = chunk.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1676
1736
|
chunk.async = !0, captureContext(chunk), boundary.startAsync(), promise.then((value) => {
|
|
1677
|
-
chunk.async && (chunk.async = !1, boundary.
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1737
|
+
if (chunk.async && (chunk.async = !1, !boundary.aborted)) {
|
|
1738
|
+
let { state } = boundary;
|
|
1739
|
+
chunk.render(() => {
|
|
1740
|
+
if (resumeMarker) {
|
|
1741
|
+
let branchId = _peek_scope_id();
|
|
1742
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withBranchId(branchId, () => withIsAsync({ parent: getAsyncContent(chunk) }, content, value)), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1743
|
+
} else {
|
|
1744
|
+
let renderedSince = _peek_scope_id() !== startId, async = { parent: getAsyncContent(chunk) };
|
|
1745
|
+
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;
|
|
1746
|
+
}
|
|
1747
|
+
}), !chunk.async && boundary.pendingReorders?.delete(chunk) && state.reorder(chunk), boundary.endAsync();
|
|
1748
|
+
}
|
|
1686
1749
|
}, (err) => {
|
|
1687
1750
|
chunk.async = !1, boundary.abort(err);
|
|
1688
1751
|
});
|
|
@@ -1706,32 +1769,56 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1706
1769
|
};
|
|
1707
1770
|
}
|
|
1708
1771
|
function tryBoundary(content, catchContent, branchId, renderers) {
|
|
1709
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state,
|
|
1710
|
-
|
|
1772
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, void 0, boundary);
|
|
1773
|
+
catchContent && (catchBoundary.withinCatch = !0);
|
|
1774
|
+
let body = chunk.fork(catchBoundary, null), bodyEnd = body.render(() => withBranchId(branchId, content));
|
|
1775
|
+
if (catchBoundary.aborted) {
|
|
1776
|
+
if (!catchContent) throw catchBoundary.reason;
|
|
1777
|
+
return catchContent(catchBoundary.reason), !0;
|
|
1778
|
+
}
|
|
1711
1779
|
if (body === bodyEnd) return chunk.append(body), !1;
|
|
1712
1780
|
let renderersAtSettle = !catchBoundary.resumeWrites, bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
|
|
1713
1781
|
chunk.next = body, boundary.startAsync();
|
|
1714
|
-
let reorderId = catchContent ? state.nextReorderId() : ""
|
|
1715
|
-
return reorderId && (chunk.
|
|
1716
|
-
|
|
1717
|
-
|
|
1782
|
+
let reorderId = catchContent ? state.nextReorderId() : "";
|
|
1783
|
+
return reorderId && (chunk.catchRange = {
|
|
1784
|
+
id: reorderId,
|
|
1785
|
+
end: bodyEnd
|
|
1786
|
+
}, captureContext(chunk)), catchBoundary.onNext = () => {
|
|
1787
|
+
if (!boundary.aborted) {
|
|
1788
|
+
if (catchBoundary.aborted) {
|
|
1718
1789
|
if (!reorderId) {
|
|
1719
|
-
boundary.abort(catchBoundary.
|
|
1790
|
+
boundary.abort(catchBoundary.reason);
|
|
1720
1791
|
return;
|
|
1721
1792
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1793
|
+
let streamed = !chunk.catchRange, catchChunk = chunk.fork(boundary, null);
|
|
1794
|
+
chunk.catchRange = null, renderersAtSettle || catchChunk.render(clearTryRenderers, branchId);
|
|
1795
|
+
let inOrder = catchChunk === catchChunk.render(catchContent, catchBoundary.reason);
|
|
1796
|
+
if (boundary.aborted) return;
|
|
1797
|
+
if ((bodyEnd.consumed || !inOrder) && (catchChunk.reorderStart = state.mark("*", branchId + "")), bodyEnd.consumed) catchChunk.reorderId = reorderId, state.reorder(catchChunk);
|
|
1798
|
+
else {
|
|
1799
|
+
let reorder = null;
|
|
1800
|
+
inOrder ? streamed && (reorder = chunk.fork(boundary, null)) : reorder = catchChunk, reorder && (reorder.reorderId = reorderId);
|
|
1801
|
+
let endMarker = state.mark("!", reorderId), cut = body;
|
|
1802
|
+
for (; cut.consumed;) cut = cut.next;
|
|
1803
|
+
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);
|
|
1728
1804
|
}
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), boundary.endAsync());
|
|
1805
|
+
boundary.endAsync();
|
|
1806
|
+
} else catchBoundary.count ? boundary.onNext() : (renderersAtSettle && catchBoundary.resumeWrites && bodyEnd.render(renderers), chunk.catchRange = null, boundary.endAsync());
|
|
1732
1807
|
}
|
|
1733
1808
|
}, renderersAtSettle;
|
|
1734
1809
|
}
|
|
1810
|
+
function unsubscribe(subscribed, serializer) {
|
|
1811
|
+
for (let i = 0; i < subscribed.length; i += 3) {
|
|
1812
|
+
let subscribers = subscribed[i], scope = subscribed[i + 1];
|
|
1813
|
+
serializer.written(subscribers) ? serializer.dropCall(scope, subscribers, "add") || serializer.writeCall(scope, subscribers, "delete", subscribed[i + 2]) : subscribers.delete(scope);
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
function clearTryRenderers(branchId) {
|
|
1817
|
+
writeScope(branchId, {
|
|
1818
|
+
E: 0,
|
|
1819
|
+
Q: _scope_with_id(branchId).Q && 0
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1735
1822
|
function writeTryRenderers(branchId, catchContent, placeholderContent) {
|
|
1736
1823
|
writeScope(branchId, {
|
|
1737
1824
|
E: catchContent,
|
|
@@ -1767,7 +1854,7 @@ var State = class {
|
|
|
1767
1854
|
flushScopes = !1;
|
|
1768
1855
|
writeScopes = {};
|
|
1769
1856
|
readyIds = null;
|
|
1770
|
-
|
|
1857
|
+
scopeReason;
|
|
1771
1858
|
$global;
|
|
1772
1859
|
constructor($global) {
|
|
1773
1860
|
this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
@@ -1808,28 +1895,42 @@ var State = class {
|
|
|
1808
1895
|
mark(code, str) {
|
|
1809
1896
|
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1810
1897
|
}
|
|
1811
|
-
}, Boundary = class
|
|
1898
|
+
}, Boundary = class {
|
|
1812
1899
|
onNext = NOOP$2;
|
|
1813
1900
|
count = 0;
|
|
1814
1901
|
resumeWrites = 0;
|
|
1815
1902
|
state;
|
|
1816
1903
|
parent;
|
|
1904
|
+
aborted = !1;
|
|
1905
|
+
reason;
|
|
1906
|
+
subscribed;
|
|
1907
|
+
pendingReorders;
|
|
1908
|
+
children;
|
|
1909
|
+
withinCatch = !1;
|
|
1817
1910
|
constructor(state, signal, parent) {
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1911
|
+
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));
|
|
1912
|
+
}
|
|
1913
|
+
abort(reason) {
|
|
1914
|
+
if (this.aborted) return;
|
|
1915
|
+
let { state } = this;
|
|
1916
|
+
if (this.aborted = !0, this.reason = reason, this.subscribed && unsubscribe(this.subscribed, state.serializer), this.pendingReorders) {
|
|
1917
|
+
for (let reorder of this.pendingReorders) state.reorder(reorder);
|
|
1918
|
+
this.pendingReorders = void 0;
|
|
1919
|
+
}
|
|
1920
|
+
if (this.count = 0, this.state = new State(state.$global), this.children) for (let child of this.children) child.abort(reason);
|
|
1921
|
+
this.onNext();
|
|
1821
1922
|
}
|
|
1822
1923
|
handleEvent(event) {
|
|
1823
1924
|
this.abort(event.target.reason);
|
|
1824
1925
|
}
|
|
1825
1926
|
flush() {
|
|
1826
|
-
return this.
|
|
1927
|
+
return this.aborted || flushSerializer(this, this.state), this.count ? 1 : this.aborted ? 2 : 0;
|
|
1827
1928
|
}
|
|
1828
1929
|
startAsync() {
|
|
1829
|
-
this.
|
|
1930
|
+
this.aborted || this.count++;
|
|
1830
1931
|
}
|
|
1831
1932
|
endAsync() {
|
|
1832
|
-
this.
|
|
1933
|
+
this.aborted || (this.count--, this.onNext());
|
|
1833
1934
|
}
|
|
1834
1935
|
}, Chunk = class Chunk {
|
|
1835
1936
|
html = "";
|
|
@@ -1838,9 +1939,12 @@ var State = class {
|
|
|
1838
1939
|
lastEffect = "";
|
|
1839
1940
|
async = !1;
|
|
1840
1941
|
consumed = !1;
|
|
1841
|
-
needsWalk = !1;
|
|
1842
1942
|
reorderId = null;
|
|
1943
|
+
reorderStart = "";
|
|
1843
1944
|
deferredReady = null;
|
|
1945
|
+
heldEffects = null;
|
|
1946
|
+
deferredReorder = null;
|
|
1947
|
+
catchRange = null;
|
|
1844
1948
|
placeholder = null;
|
|
1845
1949
|
boundary;
|
|
1846
1950
|
next;
|
|
@@ -1856,13 +1960,17 @@ var State = class {
|
|
|
1856
1960
|
this.html += html;
|
|
1857
1961
|
}
|
|
1858
1962
|
writeEffect(scopeId, registryId) {
|
|
1859
|
-
countResumeWrite(this), this.lastEffect === registryId ? this.effects
|
|
1963
|
+
countResumeWrite(this), this.lastEffect === registryId ? this.effects = concatEffects(this.effects, scopeId + "") : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1860
1964
|
}
|
|
1861
1965
|
writeScript(script) {
|
|
1862
1966
|
this.scripts = concatScripts(this.scripts, script);
|
|
1863
1967
|
}
|
|
1864
1968
|
append(chunk) {
|
|
1865
|
-
this.html += chunk.html, this.
|
|
1969
|
+
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());
|
|
1970
|
+
}
|
|
1971
|
+
takeHeldEffects() {
|
|
1972
|
+
let { heldEffects } = this;
|
|
1973
|
+
return this.heldEffects = null, heldEffects;
|
|
1866
1974
|
}
|
|
1867
1975
|
takeDeferredReady() {
|
|
1868
1976
|
let { deferredReady } = this;
|
|
@@ -1874,25 +1982,59 @@ var State = class {
|
|
|
1874
1982
|
deferred.effects = this.effects, deferred.scripts = this.scripts, this.effects = this.scripts = this.lastEffect = "", this.deferredReady = concat(deferred, this.deferredReady);
|
|
1875
1983
|
}
|
|
1876
1984
|
}
|
|
1877
|
-
|
|
1985
|
+
renderPlaceholders(boundary) {
|
|
1986
|
+
let { state } = boundary;
|
|
1987
|
+
restart: for (;;) {
|
|
1988
|
+
let reorders = null;
|
|
1989
|
+
for (let cur = this; cur.next && !cur.async; cur = cur.next) {
|
|
1990
|
+
if (cur.renderPlaceholder(state)) {
|
|
1991
|
+
if (boundary.aborted) return;
|
|
1992
|
+
continue restart;
|
|
1993
|
+
}
|
|
1994
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
1995
|
+
}
|
|
1996
|
+
if (state.writeReorders) {
|
|
1997
|
+
for (let reorder of state.writeReorders) if ((reorders = renderReorderPlaceholders(reorder, reorders)) === !1) {
|
|
1998
|
+
if (boundary.aborted) return;
|
|
1999
|
+
continue restart;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
for (let i = 0; reorders && i < reorders.length; i++) if ((reorders = renderReorderPlaceholders(reorders[i], reorders)) === !1) {
|
|
2003
|
+
if (boundary.aborted) return;
|
|
2004
|
+
continue restart;
|
|
2005
|
+
}
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
renderPlaceholder(state) {
|
|
1878
2010
|
let { placeholder } = this;
|
|
1879
|
-
if (placeholder)
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
2011
|
+
if (!placeholder || (this.placeholder = null, this.boundary.aborted)) return !1;
|
|
2012
|
+
let { body } = placeholder, end = body;
|
|
2013
|
+
for (; end.next && !end.async;) end = end.next;
|
|
2014
|
+
if (!end.async) return end.next = this.next, this.next = body, !1;
|
|
2015
|
+
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId + "";
|
|
2016
|
+
this.writeHTML(state.mark("!^", reorderId));
|
|
2017
|
+
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
2018
|
+
if (this.render(() => withBranchId(placeholderBranchId, placeholder.render)) !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.boundary.aborted) return !0;
|
|
2019
|
+
let stateful = this.effects !== effects;
|
|
2020
|
+
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;
|
|
2021
|
+
}
|
|
2022
|
+
markCatchRange() {
|
|
2023
|
+
let { catchRange } = this;
|
|
2024
|
+
if (catchRange) {
|
|
2025
|
+
let { state } = this.boundary;
|
|
2026
|
+
this.catchRange = null, this.writeHTML(state.mark("!^", catchRange.id)), catchRange.end.writeHTML(state.mark("!", catchRange.id));
|
|
1890
2027
|
}
|
|
1891
2028
|
}
|
|
1892
|
-
|
|
1893
|
-
let
|
|
1894
|
-
|
|
1895
|
-
|
|
2029
|
+
queueDeferredReorder() {
|
|
2030
|
+
let { deferredReorder } = this;
|
|
2031
|
+
deferredReorder && (this.deferredReorder = null, deferredReorder.boundary.state.reorder(deferredReorder));
|
|
2032
|
+
}
|
|
2033
|
+
consume(boundary) {
|
|
2034
|
+
this.renderPlaceholders(boundary);
|
|
2035
|
+
let cur = this, html = "", effects = "", scripts = "", effectsEnd, heldEffects = this.heldEffects, deferredReady;
|
|
2036
|
+
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;
|
|
2037
|
+
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;
|
|
1896
2038
|
}
|
|
1897
2039
|
render(content, val) {
|
|
1898
2040
|
let prev = $chunk;
|
|
@@ -1906,10 +2048,9 @@ var State = class {
|
|
|
1906
2048
|
}
|
|
1907
2049
|
}
|
|
1908
2050
|
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
1909
|
-
let { serializeState } = this, { readyId } = serializeState, scripts = "";
|
|
1910
|
-
if (
|
|
1911
|
-
|
|
1912
|
-
}), readyId && !this.async) {
|
|
2051
|
+
let { serializeState } = this, { readyId } = serializeState, scripts = "", held = this.takeDeferredReady();
|
|
2052
|
+
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)));
|
|
2053
|
+
if (readyId && !this.async) {
|
|
1913
2054
|
let { state } = boundary;
|
|
1914
2055
|
flushSerializer(boundary, serializeState);
|
|
1915
2056
|
let deps = state.serializer.takeChannelDeps(), effects = holdEffects ? "" : this.effects, { resumes } = serializeState, chunkScripts = this.scripts;
|
|
@@ -1927,51 +2068,74 @@ var State = class {
|
|
|
1927
2068
|
}
|
|
1928
2069
|
flushScript(boundary) {
|
|
1929
2070
|
let { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1930
|
-
needsWalk && (state.walkOnNextFlush = !1);
|
|
2071
|
+
needsWalk && (state.walkOnNextFlush = !1), flushSerializer(boundary, state);
|
|
1931
2072
|
let readyResumeScripts = this.flushReadyScripts(boundary, void 0, this.async);
|
|
1932
|
-
for (let channel; !boundary.
|
|
2073
|
+
for (let channel; !boundary.aborted && (channel = state.serializer.pendingReadyChannel());) {
|
|
1933
2074
|
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1934
2075
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1935
2076
|
}
|
|
1936
2077
|
readyResumeScripts && (needsWalk = !0);
|
|
1937
|
-
let effects = this.async ? "" : this.effects, { html, scripts } = this;
|
|
1938
|
-
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 + "\"");
|
|
2078
|
+
let effects = this.async ? "" : joinHeldEffects(this.takeHeldEffects(), this.effects), { html, scripts } = this;
|
|
2079
|
+
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 + "\"");
|
|
1939
2080
|
let reordered = "", needsResumeArray = !1;
|
|
1940
2081
|
if (state.writeReorders) {
|
|
1941
|
-
let carried = null;
|
|
1942
2082
|
for (let reorderedChunk of state.writeReorders) {
|
|
1943
|
-
if (
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
(carried ||= []).push(reorderedChunk);
|
|
1948
|
-
continue;
|
|
1949
|
-
}
|
|
1950
|
-
reorderedChunk.async = !1;
|
|
1951
|
-
}
|
|
1952
|
-
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 + ")"));
|
|
1953
|
-
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1954
|
-
for (reorderedChunk.reorderId = null;;) {
|
|
1955
|
-
cur.flushPlaceholder(), cur.deferOwnReady();
|
|
2083
|
+
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 + ")"));
|
|
2084
|
+
let { reorderId, reorderStart } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", effectsBoundary = reorderedChunk.boundary, reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
2085
|
+
for (reorderedChunk.reorderId = null; cur;) {
|
|
2086
|
+
cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
|
|
1956
2087
|
let { next } = cur, readyResumeScripts = cur.flushReadyScripts(boundary, readyReservations, this.async);
|
|
1957
|
-
|
|
1958
|
-
else break;
|
|
2088
|
+
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;
|
|
1959
2089
|
}
|
|
1960
|
-
reorderEffects && (this.async ? (this
|
|
2090
|
+
reorderEffects && (this.async ? holdReorderEffects(this, effectsBoundary, reorderEffects) : (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")));
|
|
1961
2091
|
for (let reservation of readyReservations) reordered = concatScripts(reordered, reservation);
|
|
1962
|
-
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
2092
|
+
reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderStart + reorderHTML + "</t>";
|
|
1963
2093
|
}
|
|
1964
|
-
state.writeReorders =
|
|
2094
|
+
state.writeReorders = null;
|
|
1965
2095
|
}
|
|
1966
|
-
return
|
|
2096
|
+
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;
|
|
1967
2097
|
}
|
|
1968
2098
|
flushHTML(boundary) {
|
|
1969
2099
|
let { state } = boundary;
|
|
1970
|
-
this.
|
|
2100
|
+
this.flushScript(boundary);
|
|
1971
2101
|
let { html, scripts } = this;
|
|
1972
2102
|
return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
|
|
1973
2103
|
}
|
|
1974
2104
|
};
|
|
2105
|
+
function renderReorderPlaceholders(reorder, reorders) {
|
|
2106
|
+
if (!reorder.boundary.aborted) for (let cur = reorder; cur; cur = cur.next) {
|
|
2107
|
+
if (cur.renderPlaceholder(reorder.boundary.state)) return !1;
|
|
2108
|
+
cur.deferredReorder && (reorders ||= []).push(cur.deferredReorder);
|
|
2109
|
+
}
|
|
2110
|
+
return reorders;
|
|
2111
|
+
}
|
|
2112
|
+
function dismissChunk(end, body) {
|
|
2113
|
+
if (end.boundary !== body.boundary) for (; end.next;) end = end.next;
|
|
2114
|
+
return end;
|
|
2115
|
+
}
|
|
2116
|
+
function followHeldEffects(chunk) {
|
|
2117
|
+
let held = reduce(chunk.deferredReady, lastHeldOf, chunk);
|
|
2118
|
+
held !== chunk && (held.effects = concatEffects(held.effects, chunk.effects), chunk.effects = "");
|
|
2119
|
+
}
|
|
2120
|
+
function lastHeldOf(held, cur) {
|
|
2121
|
+
return cur.serializeState === held.serializeState && cur.boundary === held.boundary ? cur : held;
|
|
2122
|
+
}
|
|
2123
|
+
function holdEffectsOn(heldEffects, chunk, effects) {
|
|
2124
|
+
return chunk.effects = effects, push(heldEffects, chunk);
|
|
2125
|
+
}
|
|
2126
|
+
function isWithin(boundary, outer) {
|
|
2127
|
+
for (; boundary && boundary !== outer;) boundary = boundary.parent;
|
|
2128
|
+
return !!boundary;
|
|
2129
|
+
}
|
|
2130
|
+
function holdReorderEffects(head, boundary, effects) {
|
|
2131
|
+
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);
|
|
2132
|
+
}
|
|
2133
|
+
function joinHeldEffects(heldEffects, effects) {
|
|
2134
|
+
return concatEffects(reduce(heldEffects, joinUncaught, ""), effects);
|
|
2135
|
+
}
|
|
2136
|
+
function joinUncaught(joined, held) {
|
|
2137
|
+
return held.boundary.aborted ? joined : concatEffects(joined, held.effects);
|
|
2138
|
+
}
|
|
1975
2139
|
function flushSerializer(boundary, serializeState) {
|
|
1976
2140
|
let { state } = boundary, { serializer } = state, pending = serializer.pending(serializeState);
|
|
1977
2141
|
if (serializeState.flushScopes || pending) {
|
|
@@ -2222,11 +2386,11 @@ var ServerRendered = class {
|
|
|
2222
2386
|
(boundary.onNext = () => {
|
|
2223
2387
|
switch (!boundary.count && boundary.flush()) {
|
|
2224
2388
|
case 2:
|
|
2225
|
-
settle(boundary), reject(boundary.
|
|
2389
|
+
settle(boundary), reject(boundary.reason);
|
|
2226
2390
|
break;
|
|
2227
2391
|
case 0:
|
|
2228
|
-
if (head = head.consume(), boundary.
|
|
2229
|
-
html += head.flushHTML(boundary), boundary.count || boundary.
|
|
2392
|
+
if (head = head.consume(boundary), boundary.aborted) break;
|
|
2393
|
+
html += head.flushHTML(boundary), boundary.count || boundary.aborted || (settle(boundary), resolve(html));
|
|
2230
2394
|
}
|
|
2231
2395
|
})();
|
|
2232
2396
|
});
|
|
@@ -2247,13 +2411,13 @@ var ServerRendered = class {
|
|
|
2247
2411
|
again = !1;
|
|
2248
2412
|
let status = boundary.flush();
|
|
2249
2413
|
if (status === 2) {
|
|
2250
|
-
tick || offTick(onNext), settle(boundary), onAbort(boundary.
|
|
2414
|
+
tick || offTick(onNext), settle(boundary), onAbort(boundary.reason);
|
|
2251
2415
|
return;
|
|
2252
2416
|
}
|
|
2253
2417
|
if (write || status === 0) {
|
|
2254
|
-
if (head = head.consume(), boundary.
|
|
2418
|
+
if (head = head.consume(boundary), boundary.aborted) continue;
|
|
2255
2419
|
let html = head.flushHTML(boundary);
|
|
2256
|
-
if (boundary.
|
|
2420
|
+
if (boundary.aborted) continue;
|
|
2257
2421
|
if (html && onWrite(html), !boundary.count) {
|
|
2258
2422
|
tick || offTick(onNext), settle(boundary), onClose();
|
|
2259
2423
|
return;
|
|
@@ -2268,8 +2432,8 @@ var ServerRendered = class {
|
|
|
2268
2432
|
toString() {
|
|
2269
2433
|
let head = this.#head;
|
|
2270
2434
|
if (this.#head = null, !head) throw Error(CONSUMED_RESULT_MESSAGE);
|
|
2271
|
-
let { boundary } = head, html = boundary.flush() === 0 ? head.consume().flushHTML(boundary) : "";
|
|
2272
|
-
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.
|
|
2435
|
+
let { boundary } = head, html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
2436
|
+
if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.aborted) throw boundary.reason;
|
|
2273
2437
|
return html;
|
|
2274
2438
|
}
|
|
2275
2439
|
};
|
|
@@ -2279,42 +2443,66 @@ function settle(boundary) {
|
|
|
2279
2443
|
function NOOP$1() {}
|
|
2280
2444
|
//#endregion
|
|
2281
2445
|
//#region src/html/assets.ts
|
|
2282
|
-
function withLoadAssets(renderer, assetId, triggers) {
|
|
2283
|
-
return Object.assign((input) =>
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2446
|
+
function withLoadAssets(renderer, flush, assetId, triggers) {
|
|
2447
|
+
return Object.assign((input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, renderer, input)), renderer);
|
|
2448
|
+
}
|
|
2449
|
+
function writeLoadAsset(assetId, flush, triggers) {
|
|
2450
|
+
let g = $global();
|
|
2451
|
+
writeAsset(g, addAsset(g, assetId, flush, triggers));
|
|
2287
2452
|
}
|
|
2288
2453
|
function withPageAssets(template, runtime, assetId, runtimeId) {
|
|
2289
|
-
return
|
|
2454
|
+
return Object.assign((input) => {
|
|
2290
2455
|
let g = $global();
|
|
2291
|
-
|
|
2456
|
+
runtimeId && (g[kAssets] || (g.runtimeId = runtimeId));
|
|
2457
|
+
let asset = addAsset(g, assetId, runtime);
|
|
2458
|
+
return g.__flush__ ? (writeAsset(g, asset), writeWaitReady(assetId, template, input)) : (g.__flush__ = flushPage, template(input));
|
|
2292
2459
|
}, template);
|
|
2293
2460
|
}
|
|
2294
2461
|
function _flush_head() {
|
|
2295
2462
|
let g = $global();
|
|
2296
|
-
return g[kAssets] ?
|
|
2463
|
+
return g[kAssets] ? (g[kHead] = !0, takeAssets(g, catchableBoundary())) : "";
|
|
2464
|
+
}
|
|
2465
|
+
function flushPage(g, html) {
|
|
2466
|
+
return takeAssets(g, null) + html;
|
|
2297
2467
|
}
|
|
2298
|
-
function
|
|
2299
|
-
let
|
|
2300
|
-
for (
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2468
|
+
function takeAssets(g, at) {
|
|
2469
|
+
let block = "", defer = "";
|
|
2470
|
+
for (let asset of g[kAssets]) asset.htmlAt === void 0 && (asset.htmlAt = at, block += blockHTML(g, asset), asset.triggers || (defer += deferHTML(g, asset)));
|
|
2471
|
+
return block + defer;
|
|
2472
|
+
}
|
|
2473
|
+
function writeAsset(g, asset) {
|
|
2474
|
+
if (needsWrite(asset.htmlAt) && (asset.htmlAt = void 0, g[kHead] || g.__flush__ !== flushPage)) {
|
|
2475
|
+
let block = blockHTML(g, asset);
|
|
2476
|
+
_html(block + (asset.triggers ? "" : deferHTML(g, asset))), block && isInResumedBranch() && writeScript(`document.head.insertAdjacentHTML("beforeend",${_escape_script(JSON.stringify(block))})`), asset.htmlAt = catchableBoundary();
|
|
2477
|
+
}
|
|
2478
|
+
if (asset.triggers && needsWrite(asset.scriptAt)) {
|
|
2479
|
+
let defer = deferHTML(g, asset);
|
|
2480
|
+
defer && writeScript(asset.script ||= triggerScript(asset.id, defer, asset.triggers)), asset.scriptAt = catchableBoundary();
|
|
2304
2481
|
}
|
|
2305
|
-
return g[kBlockIndex] = bi, g[kDeferIndex] = di, result + html;
|
|
2306
2482
|
}
|
|
2307
|
-
function
|
|
2308
|
-
|
|
2309
|
-
assets ? assets.find((a) => a.id === id) || assets.push({
|
|
2310
|
-
id,
|
|
2311
|
-
triggers
|
|
2312
|
-
}) : (g[kAssets] = [{
|
|
2313
|
-
id,
|
|
2314
|
-
triggers
|
|
2315
|
-
}], g[kBlockIndex] = g[kDeferIndex] = 0);
|
|
2483
|
+
function needsWrite(at) {
|
|
2484
|
+
return at === void 0 || at !== null && mayDrop(at);
|
|
2316
2485
|
}
|
|
2317
|
-
function
|
|
2486
|
+
function blockHTML(g, asset) {
|
|
2487
|
+
return asset.block ??= asset.flush(g, "block", asset.id);
|
|
2488
|
+
}
|
|
2489
|
+
function deferHTML(g, asset) {
|
|
2490
|
+
return asset.defer ??= asset.flush(g, "defer", asset.id);
|
|
2491
|
+
}
|
|
2492
|
+
function addAsset(g, id, flush, triggers) {
|
|
2493
|
+
let assets = g[kAssets] ||= [], asset = assets.find((a) => a.id === id);
|
|
2494
|
+
return asset || assets.push(asset = {
|
|
2495
|
+
id,
|
|
2496
|
+
flush,
|
|
2497
|
+
triggers,
|
|
2498
|
+
block: void 0,
|
|
2499
|
+
defer: void 0,
|
|
2500
|
+
script: void 0,
|
|
2501
|
+
htmlAt: void 0,
|
|
2502
|
+
scriptAt: void 0
|
|
2503
|
+
}), asset;
|
|
2504
|
+
}
|
|
2505
|
+
function triggerScript(id, html, triggers) {
|
|
2318
2506
|
let htmlStr = _escape_script(JSON.stringify(html)), exprs = triggers.map((trigger) => {
|
|
2319
2507
|
let options = trigger.options && toObjectExpression(trigger.options);
|
|
2320
2508
|
switch (trigger.type) {
|
|
@@ -2324,7 +2512,7 @@ function writeTriggerScript(id, html, triggers) {
|
|
|
2324
2512
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2325
2513
|
}
|
|
2326
2514
|
});
|
|
2327
|
-
|
|
2515
|
+
return `((h,d,l=$=>{d||document.head.append(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(${htmlStr})`;
|
|
2328
2516
|
}
|
|
2329
2517
|
function querySelectorOrLoad(selector) {
|
|
2330
2518
|
return `document.querySelector(${JSON.stringify(selector)})||l()`;
|
|
@@ -2343,6 +2531,10 @@ function drainClassFunctions($global, writeScope) {
|
|
|
2343
2531
|
for (let [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
|
|
2344
2532
|
pending.length = 0;
|
|
2345
2533
|
}
|
|
2534
|
+
function swapReorders(state, reorders) {
|
|
2535
|
+
let { writeReorders } = state;
|
|
2536
|
+
return state.writeReorders = reorders, writeReorders;
|
|
2537
|
+
}
|
|
2346
2538
|
function NOOP() {}
|
|
2347
2539
|
//#endregion
|
|
2348
|
-
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_resume, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script,
|
|
2540
|
+
export { $global, _assert_class_toggles, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_resume, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _set_scope_reason, _show_end, _show_start, _style_html, _subscribe, _template, _text_resume, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
|