marko 6.3.31 → 6.3.33
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 +39 -18
- package/dist/common/helpers.d.ts +2 -0
- package/dist/debug/dom/catch.feat.js +38 -0
- package/dist/debug/dom/catch.feat.mjs +37 -0
- package/dist/debug/dom/controllable-input.feat.js +7 -0
- package/dist/debug/dom/controllable-input.feat.mjs +6 -0
- package/dist/debug/dom/controllable-open.feat.js +5 -0
- package/dist/debug/dom/controllable-open.feat.mjs +4 -0
- package/dist/debug/dom/controllable-select.feat.js +5 -0
- package/dist/debug/dom/controllable-select.feat.mjs +4 -0
- package/dist/debug/dom/controllable-textarea.feat.js +5 -0
- package/dist/debug/dom/controllable-textarea.feat.mjs +4 -0
- package/dist/debug/dom/controllable.feat.js +11 -0
- package/dist/debug/dom/controllable.feat.mjs +10 -0
- package/dist/debug/dom-BJ93mcSe.mjs +2016 -0
- package/dist/debug/dom-CiFITSPN.js +2814 -0
- package/dist/debug/dom.js +156 -2250
- package/dist/debug/dom.mjs +6 -2094
- package/dist/debug/html.js +35 -7
- package/dist/debug/html.mjs +36 -5
- package/dist/dom/catch.feat.d.ts +1 -0
- package/dist/dom/catch.feat.js +25 -0
- package/dist/dom/catch.feat.mjs +26 -0
- package/dist/dom/control-flow.d.ts +3 -3
- package/dist/dom/controllable-input.feat.d.ts +1 -0
- package/dist/dom/controllable-input.feat.js +3 -0
- package/dist/dom/controllable-input.feat.mjs +3 -0
- package/dist/dom/controllable-open.feat.d.ts +1 -0
- package/dist/dom/controllable-open.feat.js +4 -0
- package/dist/dom/controllable-open.feat.mjs +4 -0
- package/dist/dom/controllable-select.feat.d.ts +1 -0
- package/dist/dom/controllable-select.feat.js +4 -0
- package/dist/dom/controllable-select.feat.mjs +4 -0
- package/dist/dom/controllable-textarea.feat.d.ts +1 -0
- package/dist/dom/controllable-textarea.feat.js +4 -0
- package/dist/dom/controllable-textarea.feat.mjs +4 -0
- package/dist/dom/controllable.d.ts +3 -8
- package/dist/dom/controllable.feat.d.ts +3 -0
- package/dist/dom/controllable.feat.js +3 -0
- package/dist/dom/controllable.feat.mjs +6 -0
- package/dist/dom/queue.d.ts +2 -2
- package/dist/dom/resume.d.ts +0 -1
- package/dist/dom-CI-06TZb.js +1721 -0
- package/dist/dom-Cj4HQ7T_.mjs +1137 -0
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +36 -1224
- package/dist/dom.mjs +4 -1191
- package/dist/html/compat.d.ts +3 -1
- package/dist/html/writer.d.ts +3 -0
- package/dist/html.d.ts +1 -1
- package/dist/html.js +31 -11
- package/dist/html.mjs +31 -11
- package/dist/translator/index.js +680 -583
- package/dist/translator/util/branch-tag.d.ts +5 -0
- package/dist/translator/util/constants/structure-kind.d.ts +7 -0
- package/dist/translator/util/get-tag-name.d.ts +2 -1
- package/dist/translator/util/import-reference.d.ts +3 -0
- package/dist/translator/util/runtime.d.ts +2 -0
- package/dist/translator/util/sections.d.ts +28 -1
- package/dist/translator/util/signals.d.ts +1 -3
- package/dist/translator/util/{walks.d.ts → structure.d.ts} +20 -9
- package/dist/translator/util/writer.d.ts +0 -8
- package/dist/translator/visitors/placeholder.d.ts +4 -3
- package/dist/translator/visitors/tag/native-tag.d.ts +9 -6
- package/dist/translator/visitors/text.d.ts +3 -7
- package/index.d.ts +19 -1
- package/package.json +4 -4
package/dist/html/compat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { register } from "./serializer";
|
|
2
2
|
import type { ServerRenderer } from "./template";
|
|
3
|
-
import { _await, _html, _peek_scope_id, _scope_id, $global, Chunk, isInResumedBranch, State, writeScript } from "./writer";
|
|
3
|
+
import { _await, _html, _peek_scope_id, _scope_id, $global, Chunk, isInResumedBranch, State, withChunk, writeScript } from "./writer";
|
|
4
4
|
export declare const compat: {
|
|
5
5
|
$global: typeof $global;
|
|
6
6
|
fork: typeof _await;
|
|
@@ -9,6 +9,7 @@ export declare const compat: {
|
|
|
9
9
|
nextScopeId: typeof _scope_id;
|
|
10
10
|
peekNextScopeId: typeof _peek_scope_id;
|
|
11
11
|
isInResumedBranch: typeof isInResumedBranch;
|
|
12
|
+
withChunk: typeof withChunk;
|
|
12
13
|
ensureState($global: any): State;
|
|
13
14
|
isTagsAPI(fn: any): boolean;
|
|
14
15
|
onFlush(fn: (chunk: Chunk) => void): void;
|
|
@@ -19,4 +20,5 @@ export declare const compat: {
|
|
|
19
20
|
render(renderer: ServerRenderer, willRerender: boolean, classAPIOut: any, component: any, input: any, completeChunks: Chunk[], registerChildScope?: boolean): void;
|
|
20
21
|
register: typeof register;
|
|
21
22
|
registerRenderBody(fn: any): void;
|
|
23
|
+
registerClassFunctions(input: any): void;
|
|
22
24
|
};
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ type ScopeInternals = PartialScope & {
|
|
|
18
18
|
[K_SCOPE_ID]?: number;
|
|
19
19
|
};
|
|
20
20
|
export declare function getChunk(): Chunk | undefined;
|
|
21
|
+
export declare function withChunk<T>(chunk: Chunk, cb: () => T): T;
|
|
21
22
|
export declare function getContext(key: keyof NonNullable<Chunk["context"]>): unknown;
|
|
22
23
|
export declare function getState(): State;
|
|
23
24
|
export declare function getScopeId(scope: unknown): number | undefined;
|
|
@@ -56,6 +57,8 @@ export declare function _for_in(obj: Falsy | {}, cb: (key: string, value: unknow
|
|
|
56
57
|
export declare function _for_to(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
|
|
57
58
|
export declare function _for_until(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
|
|
58
59
|
export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
|
|
60
|
+
export declare function deferBranchStart(chunk: Chunk): string;
|
|
61
|
+
export declare function applyBranchStart(chunk: Chunk, beforeBranch: string, rendered: boolean): void;
|
|
59
62
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
|
60
63
|
export { writeScope as _scope };
|
|
61
64
|
export declare function _existing_scope(scopeId: number): ScopeInternals;
|
package/dist/html.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export { _attr, _attr_and, _attr_class, _attr_details_or_dialog_open as _attr_de
|
|
|
5
5
|
export { compat } from "./html/compat";
|
|
6
6
|
export { _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _to_text, _unescaped, } from "./html/content";
|
|
7
7
|
export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
|
|
8
|
-
export { forIn,
|
|
8
|
+
export { forIn, forOf, forTo, forUntil } from "./html/for";
|
|
9
9
|
export { _template } from "./html/template";
|
|
10
10
|
export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
|
package/dist/html.js
CHANGED
|
@@ -265,8 +265,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
265
265
|
needsScript && _script(branchId, "d"), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
266
266
|
})();
|
|
267
267
|
} else {
|
|
268
|
-
shouldResume
|
|
269
|
-
let render = () => {
|
|
268
|
+
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
270
269
|
if (renderer) try {
|
|
271
270
|
return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? 1 : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
272
271
|
...inputOrArgs,
|
|
@@ -277,7 +276,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
277
276
|
}
|
|
278
277
|
else if (content) return content();
|
|
279
278
|
};
|
|
280
|
-
result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId,
|
|
279
|
+
result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId, beforeBranch !== void 0 && (applyBranchStart(chunk, beforeBranch, rendered), _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : ""))));
|
|
281
280
|
}
|
|
282
281
|
return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: renderer?.a || renderer }) : _scope_id(), result;
|
|
283
282
|
}, patchDynamicTag = ((originalDynamicTag) => (patch) => {
|
|
@@ -285,7 +284,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
285
284
|
let patched = patch(tag, scopeId, accessor);
|
|
286
285
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
287
286
|
};
|
|
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(), kBlockIndex = Symbol(), kDeferIndex = Symbol(), assetFlush, SET_SCOPE_REGISTER_ID = "$C_s", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
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(), kBlockIndex = Symbol(), kDeferIndex = Symbol(), assetFlush, SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
289
288
|
$global,
|
|
290
289
|
fork: _await,
|
|
291
290
|
write: _html,
|
|
@@ -293,6 +292,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
293
292
|
nextScopeId: _scope_id,
|
|
294
293
|
peekNextScopeId: _peek_scope_id,
|
|
295
294
|
isInResumedBranch,
|
|
295
|
+
withChunk,
|
|
296
296
|
ensureState($global) {
|
|
297
297
|
let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
298
298
|
return state || ($global.runtimeId ||= "M", $global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_", $global[K_TAGS_API_STATE] = state = new State($global)), state;
|
|
@@ -361,7 +361,13 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
361
361
|
},
|
|
362
362
|
register,
|
|
363
363
|
registerRenderBody(fn) {
|
|
364
|
-
register(
|
|
364
|
+
register(RENDER_BODY_ID, fn);
|
|
365
|
+
},
|
|
366
|
+
registerClassFunctions(input) {
|
|
367
|
+
for (let key in input) {
|
|
368
|
+
let value = input[key];
|
|
369
|
+
typeof value == "function" && !getRegistered(value) && register(RENDER_BODY_ID, value);
|
|
370
|
+
}
|
|
365
371
|
}
|
|
366
372
|
};
|
|
367
373
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -1230,6 +1236,15 @@ function forStepBy(by, index) {
|
|
|
1230
1236
|
function getChunk() {
|
|
1231
1237
|
return $chunk;
|
|
1232
1238
|
}
|
|
1239
|
+
function withChunk(chunk, cb) {
|
|
1240
|
+
let prev = $chunk;
|
|
1241
|
+
$chunk = chunk;
|
|
1242
|
+
try {
|
|
1243
|
+
return cb();
|
|
1244
|
+
} finally {
|
|
1245
|
+
$chunk = prev;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1233
1248
|
function getContext(key) {
|
|
1234
1249
|
return $chunk.context?.[key];
|
|
1235
1250
|
}
|
|
@@ -1382,14 +1397,19 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1382
1397
|
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1383
1398
|
}
|
|
1384
1399
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1385
|
-
let
|
|
1386
|
-
|
|
1387
|
-
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1388
|
-
shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1400
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), 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;
|
|
1401
|
+
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1389
1402
|
["D" + accessor]: branchIndex || void 0,
|
|
1390
1403
|
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1391
1404
|
}), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1392
1405
|
}
|
|
1406
|
+
function deferBranchStart(chunk) {
|
|
1407
|
+
let beforeBranch = chunk.html;
|
|
1408
|
+
return chunk.html = "", beforeBranch;
|
|
1409
|
+
}
|
|
1410
|
+
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1411
|
+
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1412
|
+
}
|
|
1393
1413
|
function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, branchIds) {
|
|
1394
1414
|
let endTag = parentEndTag || "";
|
|
1395
1415
|
if (serializeMarker !== 0) if (!parentEndTag || serializeStateful !== 0) {
|
|
@@ -2050,7 +2070,7 @@ var ServerRendered = class {
|
|
|
2050
2070
|
stream.write(html), stream.flush?.();
|
|
2051
2071
|
}, (err) => {
|
|
2052
2072
|
let socket = "socket" in stream && stream.socket;
|
|
2053
|
-
if (socket && typeof socket.destroySoon == "function"
|
|
2073
|
+
if (socket && typeof socket.destroySoon == "function" ? socket.destroySoon() : stream.destroy ? stream.destroy() : stream.end(), !stream.emit?.("error", err)) throw err;
|
|
2054
2074
|
}, () => {
|
|
2055
2075
|
stream.end();
|
|
2056
2076
|
});
|
|
@@ -2193,4 +2213,4 @@ exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr
|
|
|
2193
2213
|
get: function() {
|
|
2194
2214
|
return _dynamic_tag;
|
|
2195
2215
|
}
|
|
2196
|
-
}), 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._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._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.
|
|
2216
|
+
}), 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._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._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, 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;
|
package/dist/html.mjs
CHANGED
|
@@ -265,8 +265,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
265
265
|
needsScript && _script(branchId, "d"), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
266
266
|
})();
|
|
267
267
|
} else {
|
|
268
|
-
shouldResume
|
|
269
|
-
let render = () => {
|
|
268
|
+
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
270
269
|
if (renderer) try {
|
|
271
270
|
return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? 1 : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
272
271
|
...inputOrArgs,
|
|
@@ -277,7 +276,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
277
276
|
}
|
|
278
277
|
else if (content) return content();
|
|
279
278
|
};
|
|
280
|
-
result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId,
|
|
279
|
+
result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId, beforeBranch !== void 0 && (applyBranchStart(chunk, beforeBranch, rendered), _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : ""))));
|
|
281
280
|
}
|
|
282
281
|
return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: renderer?.a || renderer }) : _scope_id(), result;
|
|
283
282
|
}, patchDynamicTag = ((originalDynamicTag) => (patch) => {
|
|
@@ -285,7 +284,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
285
284
|
let patched = patch(tag, scopeId, accessor);
|
|
286
285
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
287
286
|
};
|
|
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(), kBlockIndex = Symbol(), kDeferIndex = Symbol(), assetFlush, SET_SCOPE_REGISTER_ID = "$C_s", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
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(), kBlockIndex = Symbol(), kDeferIndex = Symbol(), assetFlush, SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
289
288
|
$global,
|
|
290
289
|
fork: _await,
|
|
291
290
|
write: _html,
|
|
@@ -293,6 +292,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
293
292
|
nextScopeId: _scope_id,
|
|
294
293
|
peekNextScopeId: _peek_scope_id,
|
|
295
294
|
isInResumedBranch,
|
|
295
|
+
withChunk,
|
|
296
296
|
ensureState($global) {
|
|
297
297
|
let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
298
298
|
return state || ($global.runtimeId ||= "M", $global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_", $global[K_TAGS_API_STATE] = state = new State($global)), state;
|
|
@@ -361,7 +361,13 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
361
361
|
},
|
|
362
362
|
register,
|
|
363
363
|
registerRenderBody(fn) {
|
|
364
|
-
register(
|
|
364
|
+
register(RENDER_BODY_ID, fn);
|
|
365
|
+
},
|
|
366
|
+
registerClassFunctions(input) {
|
|
367
|
+
for (let key in input) {
|
|
368
|
+
let value = input[key];
|
|
369
|
+
typeof value == "function" && !getRegistered(value) && register(RENDER_BODY_ID, value);
|
|
370
|
+
}
|
|
365
371
|
}
|
|
366
372
|
};
|
|
367
373
|
//#region src/common/attr-tag.ts
|
|
@@ -1229,6 +1235,15 @@ function forStepBy(by, index) {
|
|
|
1229
1235
|
function getChunk() {
|
|
1230
1236
|
return $chunk;
|
|
1231
1237
|
}
|
|
1238
|
+
function withChunk(chunk, cb) {
|
|
1239
|
+
let prev = $chunk;
|
|
1240
|
+
$chunk = chunk;
|
|
1241
|
+
try {
|
|
1242
|
+
return cb();
|
|
1243
|
+
} finally {
|
|
1244
|
+
$chunk = prev;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1232
1247
|
function getContext(key) {
|
|
1233
1248
|
return $chunk.context?.[key];
|
|
1234
1249
|
}
|
|
@@ -1381,14 +1396,19 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1381
1396
|
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1382
1397
|
}
|
|
1383
1398
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1384
|
-
let
|
|
1385
|
-
|
|
1386
|
-
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1387
|
-
shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1399
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), 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;
|
|
1400
|
+
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1388
1401
|
["D" + accessor]: branchIndex || void 0,
|
|
1389
1402
|
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
1390
1403
|
}), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1391
1404
|
}
|
|
1405
|
+
function deferBranchStart(chunk) {
|
|
1406
|
+
let beforeBranch = chunk.html;
|
|
1407
|
+
return chunk.html = "", beforeBranch;
|
|
1408
|
+
}
|
|
1409
|
+
function applyBranchStart(chunk, beforeBranch, rendered) {
|
|
1410
|
+
chunk.html = beforeBranch + (rendered ? chunk.boundary.state.mark("[", "") : "") + chunk.html;
|
|
1411
|
+
}
|
|
1392
1412
|
function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, branchIds) {
|
|
1393
1413
|
let endTag = parentEndTag || "";
|
|
1394
1414
|
if (serializeMarker !== 0) if (!parentEndTag || serializeStateful !== 0) {
|
|
@@ -2049,7 +2069,7 @@ var ServerRendered = class {
|
|
|
2049
2069
|
stream.write(html), stream.flush?.();
|
|
2050
2070
|
}, (err) => {
|
|
2051
2071
|
let socket = "socket" in stream && stream.socket;
|
|
2052
|
-
if (socket && typeof socket.destroySoon == "function"
|
|
2072
|
+
if (socket && typeof socket.destroySoon == "function" ? socket.destroySoon() : stream.destroy ? stream.destroy() : stream.end(), !stream.emit?.("error", err)) throw err;
|
|
2053
2073
|
}, () => {
|
|
2054
2074
|
stream.end();
|
|
2055
2075
|
});
|
|
@@ -2188,4 +2208,4 @@ function toObjectExpression(options) {
|
|
|
2188
2208
|
//#region src/html/compat.ts
|
|
2189
2209
|
function NOOP() {}
|
|
2190
2210
|
//#endregion
|
|
2191
|
-
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, _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, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn,
|
|
2211
|
+
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, _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, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
|