marko 6.4.11 → 6.4.12
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/dist/common/attr-tag.d.ts +1 -0
- package/dist/common/errors.d.ts +2 -0
- package/dist/common/helpers.d.ts +2 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/compat.feat.js +143 -0
- package/dist/debug/dom/compat.feat.mjs +141 -0
- 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-mQ5mPBTF.js → dom-CtXOr4Nm.js} +68 -31
- package/dist/debug/{dom-DjUZd-9y.mjs → dom-DaHYZpf2.mjs} +51 -26
- package/dist/debug/dom.js +4 -127
- package/dist/debug/dom.mjs +2 -119
- package/dist/debug/html/compat.feat.js +222 -0
- package/dist/debug/html/compat.feat.mjs +220 -0
- package/dist/debug/html-DMo6pc_h.mjs +3931 -0
- package/dist/debug/html-DfZjMkhx.js +4513 -0
- package/dist/debug/html.js +83 -4220
- package/dist/debug/html.mjs +1 -4133
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
- package/dist/dom/compat.feat.js +101 -0
- package/dist/dom/compat.feat.mjs +100 -0
- package/dist/dom/control-flow.d.ts +0 -1
- package/dist/dom/controllable-input.feat.js +2 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +2 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +2 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +2 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dom.d.ts +2 -1
- 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 +3 -3
- 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/resume.d.ts +3 -1
- package/dist/{dom-B8j2453O.js → dom-BB-Te-3z.js} +125 -130
- package/dist/{dom-HEWdZCCb.mjs → dom-BO-0hzLZ.mjs} +13 -18
- package/dist/dom.d.ts +0 -1
- package/dist/dom.js +21 -95
- package/dist/dom.mjs +3 -72
- package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
- package/dist/html/compat.feat.js +165 -0
- package/dist/html/compat.feat.mjs +164 -0
- package/dist/html/dynamic-tag.d.ts +1 -2
- package/dist/html/writer.d.ts +2 -1
- package/dist/html-DMDc0zKs.mjs +2404 -0
- package/dist/html-DrHsybFm.js +2880 -0
- package/dist/html.d.ts +0 -1
- package/dist/html.js +2 -2566
- package/dist/html.mjs +3 -2561
- package/dist/translator/index.js +297 -285
- package/dist/translator/util/assert.d.ts +2 -0
- package/dist/translator/util/branch-tag.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +4 -1
- package/dist/translator/util/optional.d.ts +0 -1
- package/dist/translator/util/reasons.d.ts +0 -1
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +5 -1
- package/dist/translator/util/tag-facts.d.ts +2 -0
- package/dist/translator/util/translate-attrs.d.ts +1 -4
- package/dist/translator/visitors/program/index.d.ts +2 -2
- package/index.d.ts +2 -7
- package/package.json +4 -4
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
// src/common/attr-tag.ts
|
|
2
|
+
const empty = [];
|
|
3
|
+
const rest = Symbol("Attribute Tag");
|
|
4
|
+
function attrTag(attrs) {
|
|
5
|
+
attrs[Symbol.iterator] = attrTagIterator;
|
|
6
|
+
attrs[rest] = empty;
|
|
7
|
+
return attrs;
|
|
8
|
+
}
|
|
9
|
+
function attrTags(first, attrs) {
|
|
10
|
+
if (first) {
|
|
11
|
+
if (first[rest] === empty) first[rest] = [attrs];
|
|
12
|
+
else first[rest].push(attrs);
|
|
13
|
+
return first;
|
|
14
|
+
}
|
|
15
|
+
return attrTag(attrs);
|
|
16
|
+
}
|
|
17
|
+
function isAttrTag(value) {
|
|
18
|
+
return !!value?.[rest];
|
|
19
|
+
}
|
|
20
|
+
function* attrTagIterator() {
|
|
21
|
+
yield this;
|
|
22
|
+
yield* this[rest];
|
|
23
|
+
}
|
|
1
24
|
// src/common/constants/accessor-prefix.debug.ts
|
|
2
25
|
const BranchScopes$1 = "BranchScopes:";
|
|
3
26
|
const ClosureScopes = "ClosureScopes:";
|
|
@@ -166,15 +189,20 @@ function isNotNullishOrFalse(value) {
|
|
|
166
189
|
function isPromise(value) {
|
|
167
190
|
return value != null && typeof value.then === "function";
|
|
168
191
|
}
|
|
192
|
+
let classAPIRenderer;
|
|
193
|
+
function setClassAPIRenderer(render) {
|
|
194
|
+
classAPIRenderer = render;
|
|
195
|
+
}
|
|
169
196
|
function normalizeDynamicRenderer(value) {
|
|
170
197
|
if (value) {
|
|
171
198
|
if (typeof value === "string") return value;
|
|
172
199
|
const normalized = value.content || value.default || value;
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if ("id" in normalized) return normalized;
|
|
200
|
+
if (typeof normalized !== "object" && typeof normalized !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received ${normalized === value ? `a ${typeof value}` : `an object whose \`content\` or \`default\` is a ${typeof normalized}`}.`);
|
|
201
|
+
if (classAPIRenderer) {
|
|
202
|
+
const renderer = classAPIRenderer(normalized);
|
|
203
|
+
if (renderer || false) return renderer;
|
|
204
|
+
} else if ("id" in normalized) return normalized;
|
|
205
|
+
if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
|
|
178
206
|
}
|
|
179
207
|
}
|
|
180
208
|
let branchesEnabled;
|
|
@@ -285,6 +313,12 @@ function assertNoValueBindingOnCheckable(type, valueChange) {
|
|
|
285
313
|
function assertHandlerIsFunction(name, value) {
|
|
286
314
|
if (value && typeof value !== "function") throw new Error(`The \`${name}\` handler must be a function or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
|
|
287
315
|
}
|
|
316
|
+
function assertNoNativeAttrTags(tagName, input) {
|
|
317
|
+
for (const name in input) if (name !== "content" && isAttrTag(input[name])) throw new Error(`A dynamic tag passed the native \`<${tagName}>\` tag an [attribute tag](https://markojs.com/docs/reference/language#attribute-tags) as \`${name}\`, but [native tags](https://markojs.com/docs/reference/native-tag) do not support attribute tags.`);
|
|
318
|
+
}
|
|
319
|
+
function assertValidContent(value, renderer) {
|
|
320
|
+
if (value && !renderer?.["id"]) throw new Error(`The \`content\` attribute on a [native tag](https://markojs.com/docs/reference/native-tag#content) must be body content, a \`<define>\` tag variable or attribute tag holding it, or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
|
|
321
|
+
}
|
|
288
322
|
function assertValidTagName(tagName) {
|
|
289
323
|
if (!/^[a-z][a-z0-9._-]*$/i.test(tagName)) throw new Error(`Invalid tag name: "${tagName}". Tag names must start with a letter and contain only letters, numbers, periods, hyphens, and underscores.`);
|
|
290
324
|
}
|
|
@@ -1027,10 +1061,10 @@ function init(runtimeId = "M") {
|
|
|
1027
1061
|
visitText = serialized;
|
|
1028
1062
|
while (nextToken()) if (/\D/.test(lastToken)) lastEffect = _resumed[lastToken];
|
|
1029
1063
|
else effects.push(lastEffect, getScope(lastToken));
|
|
1030
|
-
} else if (
|
|
1031
|
-
if (!(
|
|
1032
|
-
} else
|
|
1033
|
-
|
|
1064
|
+
} else if (readyIds && typeof serialized !== "function") {
|
|
1065
|
+
if (typeof serialized === "number" || !Object.keys(serialized).every((dep) => readyIds.has(dep) && (render.b[dep]?.n || 0) >= serialized[dep])) break;
|
|
1066
|
+
} else {
|
|
1067
|
+
if (readyIds) resumes.n = (resumes.n || 0) + 1;
|
|
1034
1068
|
const scopes = serialized(serializeContext);
|
|
1035
1069
|
if (Array.isArray(scopes)) applyScopes(scopes);
|
|
1036
1070
|
}
|
|
@@ -1343,13 +1377,11 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
|
1343
1377
|
}
|
|
1344
1378
|
}
|
|
1345
1379
|
}
|
|
1346
|
-
function _attr_content(scope, nodeAccessor,
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
if (
|
|
1350
|
-
|
|
1351
|
-
else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
|
|
1352
|
-
}
|
|
1380
|
+
function _attr_content(scope, nodeAccessor, content) {
|
|
1381
|
+
var value = content;
|
|
1382
|
+
content = content?.content || content;
|
|
1383
|
+
if (classAPIRenderer && content) content = classAPIRenderer(content);
|
|
1384
|
+
assertValidContent(value, content);
|
|
1353
1385
|
if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
|
|
1354
1386
|
setBranch(scope, nodeAccessor, content, createAndSetupBranch);
|
|
1355
1387
|
if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
|
|
@@ -1961,9 +1993,6 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
|
|
|
1961
1993
|
function rendererKey(renderer) {
|
|
1962
1994
|
return renderer?.["owner"] ? renderer["id"] + " " + renderer[Owner]["#Id"] : renderer?.["id"] || renderer;
|
|
1963
1995
|
}
|
|
1964
|
-
function patchDynamicTag(fn) {
|
|
1965
|
-
_dynamic_tag = fn(_dynamic_tag);
|
|
1966
|
-
}
|
|
1967
1996
|
let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagVar, inputIsArgs) => {
|
|
1968
1997
|
const scopeOffsetAccessor = getTagVar && getDebugKey(+nodeAccessor.slice(nodeAccessor.lastIndexOf("/") + 1) + 1, "#scopeOffset");
|
|
1969
1998
|
const childScopeAccessor = BranchScopes$1 + nodeAccessor;
|
|
@@ -1977,12 +2006,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1977
2006
|
bindTagVar(scope, branch, scope[scopeOffsetAccessor], tagNameOrRenderer);
|
|
1978
2007
|
}
|
|
1979
2008
|
if (typeof tagNameOrRenderer !== "string") setupBranch(tagNameOrRenderer, branch);
|
|
1980
|
-
else if (getContent) {
|
|
1981
|
-
const content = getContent(scope);
|
|
1982
|
-
const elementAccessor = `#${tagNameOrRenderer.toLowerCase()}/0`;
|
|
1983
|
-
setBranch(branch, elementAccessor, content, createAndSetupBranch);
|
|
1984
|
-
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], branch[BranchScopes$1 + elementAccessor]);
|
|
1985
|
-
}
|
|
2009
|
+
else if (getContent) _attr_content(branch, `#${tagNameOrRenderer.toLowerCase()}/0`, getContent(scope));
|
|
1986
2010
|
return branch;
|
|
1987
2011
|
};
|
|
1988
2012
|
return (scope, newRenderer, getInput) => {
|
|
@@ -2001,6 +2025,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
2001
2025
|
const args = getInput?.();
|
|
2002
2026
|
if (typeof normalizedRenderer === "string") {
|
|
2003
2027
|
const nodeAccessor = `#${normalizedRenderer.toLowerCase()}/0`;
|
|
2028
|
+
assertNoNativeAttrTags(normalizedRenderer, inputIsArgs ? args[0] : args);
|
|
2004
2029
|
(getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableSpreadHelpers[childScope[nodeAccessor].tagName]);
|
|
2005
2030
|
if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
|
|
2006
2031
|
} else {
|
|
@@ -2194,4 +2219,4 @@ function bySecondArg(_item, index) {
|
|
|
2194
2219
|
function byFirstArg(name) {
|
|
2195
2220
|
return name;
|
|
2196
2221
|
}
|
|
2197
|
-
export {
|
|
2222
|
+
export { _attrs as $, PLACEHOLDER_DISMISS_REGISTER_ID as $t, _attr_input_value_attribute_default as A, Returns as An, _const as At, _controllable_textarea as B, Load as Bn, _let_change as Bt, _attr_input_checked as C, setClassAPIRenderer as Cn, init as Ct, _attr_input_checked_default as D, LocalClosures as Dn, withLazy as Dt, _attr_input_checkedValue_script as E, Lazy as En, readyFailed as Et, _attr_select_value_default as F, BranchRenders as Fn, _hoist as Ft, _attr_class_item as G, PlaceholderBranch as Gn, _var as Gt, controllableSpreadHelpers as H, PendingEffectScopes as Hn, _return as Ht, _attr_select_value_script as I, ClosestBranch as In, _hoist_resume as It, _attr_content as J, attrTag as Jn, destroyBranch as Jt, _attr_class_items as K, StartNode as Kn, _var_change as Kt, _controllable_input as L, EndNode as Ln, _id as Lt, _attr_input_value_dynamic_default as M, Pending as Mn, _for_closure as Mt, _attr_input_value_script as N, Scope as Nn, _for_selector as Nt, _attr_input_checked_script as O, Owner as On, _closure as Ot, _attr_select_value as P, AwaitCounter as Pn, _global_read as Pt, _attr_style_items as Q, DYNAMIC_TAG_SCRIPT_REGISTER_ID as Qt, _controllable_open as R, Gen$1 as Rn, _if_closure as Rt, _attr_details_or_dialog_open_script as S, _call as Sn, getRegisteredWithScope as St, _attr_input_checkedValue_default as T, Clone as Tn, ready as Tt, _attr as U, PendingEffects as Un, _return_change as Ut, controllableScripts as V, ParentBranch as Vn, _or as Vt, _attr_class as W, PendingRenders as Wn, _script as Wt, _attr_style as X, removeAndDestroyBranch as Xt, _attr_nonce as Y, attrTags as Yn, insertBranchBefore as Yt, _attr_style_item as Z, syncGen as Zt, renderCatch as _, forTo as _n, setupBranch as _t, _for_in as a, installBranchRenders as an, _lifecycle as at, _attr_details_or_dialog_open as b, _assert_hoist as bn, _resumed as bt, _for_to as c, queueAsyncRender as cn, _text as ct, _for_until_unkeyed as d, rendering as dn, _content as dt, _on as en, _attrs_content as et, _if as f, run as fn, _content_closures as ft, installDynamicTagVar as g, forOf as gn, createBranch as gt, dynamicTagScript as h, forIn as hn, createAndSetupBranch as ht, _dynamic_tag_content as i, createBranchRenders as in, _html as it, _attr_input_value_default as j, Setup as jn, _el_read as jt, _attr_input_value as k, Params as kn, _closure_get as kt, _for_to_unkeyed as l, queueEffect as ln, _text_content as lt, _try as m, runId as mn, _return_setup as mt, _await_promise as n, $signalReset as nn, _attrs_partial_content as nt, _for_of as o, installCatch as on, _style_rule_item as ot, _show as p, runEffects as pn, _content_resume as pt, _attr_class_names as q, TagVariable as qn, _assert_init as qt, _dynamic_tag as r, onAbort as rn, _attrs_script as rt, _for_of_unkeyed as s, prepareEffects as sn, _style_shell as st, _await_content as t, $signal as tn, _attrs_partial as tt, _for_until as u, queueRender as un, _to_text as ut, runPendingEffects as v, forUntil as vn, _dynamic_tag_var_resume as vt, _attr_input_checkedValue as w, withBranches as wn, initEmbedded as wt, _attr_details_or_dialog_open_default as x, _hoist_read_error as xn, _var_resume as xt, startAwait as y, _assert_class_toggles as yn, _el as yt, _controllable_select as z, Global as zn, _let as zt };
|
package/dist/debug/dom.js
CHANGED
|
@@ -1,123 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_control_flow = require("./dom-
|
|
4
|
-
// src/common/attr-tag.ts
|
|
5
|
-
const empty = [];
|
|
6
|
-
const rest = Symbol("Attribute Tag");
|
|
7
|
-
function attrTag(attrs) {
|
|
8
|
-
attrs[Symbol.iterator] = attrTagIterator;
|
|
9
|
-
attrs[rest] = empty;
|
|
10
|
-
return attrs;
|
|
11
|
-
}
|
|
12
|
-
function attrTags(first, attrs) {
|
|
13
|
-
if (first) {
|
|
14
|
-
if (first[rest] === empty) first[rest] = [attrs];
|
|
15
|
-
else first[rest].push(attrs);
|
|
16
|
-
return first;
|
|
17
|
-
}
|
|
18
|
-
return attrTag(attrs);
|
|
19
|
-
}
|
|
20
|
-
function* attrTagIterator() {
|
|
21
|
-
yield this;
|
|
22
|
-
yield* this[rest];
|
|
23
|
-
}
|
|
24
|
-
// src/common/compat-meta.ts
|
|
25
|
-
const SET_SCOPE_REGISTER_ID = "$compat_setScope";
|
|
26
|
-
const RENDER_BODY_ID = "$compat_renderBody";
|
|
27
|
-
// src/dom/compat.ts
|
|
28
|
-
const classIdToBranch = /* @__PURE__ */ new Map();
|
|
29
|
-
let classEventResolver;
|
|
30
|
-
const scopesByRender = /* @__PURE__ */ new WeakMap();
|
|
31
|
-
const getRenderScopes = ($global) => {
|
|
32
|
-
require_control_flow.init($global.runtimeId);
|
|
33
|
-
const render = self[$global.runtimeId]?.[$global.renderId];
|
|
34
|
-
let scopes = render && scopesByRender.get(render);
|
|
35
|
-
if (render && !scopes) scopesByRender.set(render, scopes = {});
|
|
36
|
-
return scopes;
|
|
37
|
-
};
|
|
38
|
-
const compat = {
|
|
39
|
-
patchDynamicTag: require_control_flow.patchDynamicTag,
|
|
40
|
-
queueEffect: require_control_flow.queueEffect,
|
|
41
|
-
init(warp10Noop) {
|
|
42
|
-
require_control_flow._resumed[SET_SCOPE_REGISTER_ID] = (scope) => {
|
|
43
|
-
getRenderScopes(scope[require_control_flow.Global])[scope["#Id"]] = scope;
|
|
44
|
-
if (scope.m5c) classIdToBranch.set(scope.m5c, scope);
|
|
45
|
-
if (classEventResolver) for (const key in scope) {
|
|
46
|
-
const resolved = classEventResolver(scope[key], scope);
|
|
47
|
-
if (resolved !== scope[key]) scope[key] = resolved;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
require_control_flow._resumed[RENDER_BODY_ID] = warp10Noop;
|
|
51
|
-
},
|
|
52
|
-
setClassEventResolver(fn) {
|
|
53
|
-
classEventResolver = fn;
|
|
54
|
-
},
|
|
55
|
-
resumeClassFunction(id, build) {
|
|
56
|
-
require_control_flow._resumed[id] = build;
|
|
57
|
-
},
|
|
58
|
-
getScope($global, scopeId) {
|
|
59
|
-
return getRenderScopes($global)?.[scopeId];
|
|
60
|
-
},
|
|
61
|
-
setRendererId(renderer, id) {
|
|
62
|
-
renderer["id"] = id;
|
|
63
|
-
},
|
|
64
|
-
isRenderer(renderer) {
|
|
65
|
-
return renderer[require_control_flow.Clone];
|
|
66
|
-
},
|
|
67
|
-
getStartNode(branch) {
|
|
68
|
-
return branch[require_control_flow.StartNode];
|
|
69
|
-
},
|
|
70
|
-
getEndNode(branch) {
|
|
71
|
-
return branch[require_control_flow.EndNode];
|
|
72
|
-
},
|
|
73
|
-
setScopeNodes(branch, startNode, endNode) {
|
|
74
|
-
branch[require_control_flow.StartNode] = startNode;
|
|
75
|
-
branch[require_control_flow.EndNode] = endNode;
|
|
76
|
-
},
|
|
77
|
-
runComponentEffects() {
|
|
78
|
-
if (this.effects) require_control_flow.runEffects(this.effects);
|
|
79
|
-
},
|
|
80
|
-
runComponentDestroy() {
|
|
81
|
-
if (this.scope) require_control_flow.destroyBranch(this.scope);
|
|
82
|
-
},
|
|
83
|
-
resolveRegistered(value, $global) {
|
|
84
|
-
if (Array.isArray(value) && typeof value[0] === "string") return require_control_flow.getRegisteredWithScope(getRenderScopes($global)?.[value[1]], value[0]);
|
|
85
|
-
return value;
|
|
86
|
-
},
|
|
87
|
-
createRenderer(params, clone) {
|
|
88
|
-
const renderer = require_control_flow._content("", 0, 0, 0, params)();
|
|
89
|
-
renderer[require_control_flow.Clone] = (branch) => {
|
|
90
|
-
const cloned = clone();
|
|
91
|
-
branch[require_control_flow.StartNode] = cloned.startNode;
|
|
92
|
-
branch[require_control_flow.EndNode] = cloned.endNode;
|
|
93
|
-
};
|
|
94
|
-
return renderer;
|
|
95
|
-
},
|
|
96
|
-
render(out, component, renderer, args) {
|
|
97
|
-
require_control_flow.init(out.global.runtimeId);
|
|
98
|
-
let branch = component.scope;
|
|
99
|
-
let created = 0;
|
|
100
|
-
if (!branch && (branch = classIdToBranch.get(component.id))) {
|
|
101
|
-
component.scope = branch;
|
|
102
|
-
classIdToBranch.delete(component.id);
|
|
103
|
-
}
|
|
104
|
-
if (args[0] && typeof args[0] === "object" && "renderBody" in args[0]) {
|
|
105
|
-
const input = args[0];
|
|
106
|
-
const normalizedInput = args[0] = {};
|
|
107
|
-
for (const key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
108
|
-
}
|
|
109
|
-
const renderBranch = (_) => {
|
|
110
|
-
if (!branch) {
|
|
111
|
-
created = 1;
|
|
112
|
-
branch = component.scope = require_control_flow.createAndSetupBranch(out.global, renderer, renderer[require_control_flow.Owner], document.body);
|
|
113
|
-
}
|
|
114
|
-
renderer[require_control_flow.LocalClosures]?.(branch);
|
|
115
|
-
renderer[require_control_flow.Params]?.(branch, renderer._ ? args[0] : args);
|
|
116
|
-
};
|
|
117
|
-
component.effects = require_control_flow.rendering ? renderBranch() : require_control_flow.prepareEffects(renderBranch);
|
|
118
|
-
if (created) return branch["#StartNode"].parentNode || branch["#StartNode"];
|
|
119
|
-
}
|
|
120
|
-
};
|
|
3
|
+
const require_control_flow = require("./dom-CtXOr4Nm.js");
|
|
121
4
|
// src/dom/template.ts
|
|
122
5
|
const _template = (id, template, walks, setup, inputSignal) => {
|
|
123
6
|
const renderer = require_control_flow._content(id, template, walks, setup, inputSignal)();
|
|
@@ -342,12 +225,7 @@ exports._controllable_input = require_control_flow._controllable_input;
|
|
|
342
225
|
exports._controllable_open = require_control_flow._controllable_open;
|
|
343
226
|
exports._controllable_select = require_control_flow._controllable_select;
|
|
344
227
|
exports._controllable_textarea = require_control_flow._controllable_textarea;
|
|
345
|
-
|
|
346
|
-
enumerable: true,
|
|
347
|
-
get: function() {
|
|
348
|
-
return require_control_flow._dynamic_tag;
|
|
349
|
-
}
|
|
350
|
-
});
|
|
228
|
+
exports._dynamic_tag = require_control_flow._dynamic_tag;
|
|
351
229
|
exports._dynamic_tag_content = require_control_flow._dynamic_tag_content;
|
|
352
230
|
exports._dynamic_tag_var_resume = require_control_flow._dynamic_tag_var_resume;
|
|
353
231
|
exports._el = require_control_flow._el;
|
|
@@ -398,9 +276,8 @@ exports._try = require_control_flow._try;
|
|
|
398
276
|
exports._var = require_control_flow._var;
|
|
399
277
|
exports._var_change = require_control_flow._var_change;
|
|
400
278
|
exports._var_resume = require_control_flow._var_resume;
|
|
401
|
-
exports.attrTag = attrTag;
|
|
402
|
-
exports.attrTags = attrTags;
|
|
403
|
-
exports.compat = compat;
|
|
279
|
+
exports.attrTag = require_control_flow.attrTag;
|
|
280
|
+
exports.attrTags = require_control_flow.attrTags;
|
|
404
281
|
exports.forIn = require_control_flow.forIn;
|
|
405
282
|
exports.forOf = require_control_flow.forOf;
|
|
406
283
|
exports.forTo = require_control_flow.forTo;
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -1,121 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
// src/common/attr-tag.ts
|
|
3
|
-
const empty = [];
|
|
4
|
-
const rest = Symbol("Attribute Tag");
|
|
5
|
-
function attrTag(attrs) {
|
|
6
|
-
attrs[Symbol.iterator] = attrTagIterator;
|
|
7
|
-
attrs[rest] = empty;
|
|
8
|
-
return attrs;
|
|
9
|
-
}
|
|
10
|
-
function attrTags(first, attrs) {
|
|
11
|
-
if (first) {
|
|
12
|
-
if (first[rest] === empty) first[rest] = [attrs];
|
|
13
|
-
else first[rest].push(attrs);
|
|
14
|
-
return first;
|
|
15
|
-
}
|
|
16
|
-
return attrTag(attrs);
|
|
17
|
-
}
|
|
18
|
-
function* attrTagIterator() {
|
|
19
|
-
yield this;
|
|
20
|
-
yield* this[rest];
|
|
21
|
-
}
|
|
22
|
-
// src/common/compat-meta.ts
|
|
23
|
-
const SET_SCOPE_REGISTER_ID = "$compat_setScope";
|
|
24
|
-
const RENDER_BODY_ID = "$compat_renderBody";
|
|
25
|
-
// src/dom/compat.ts
|
|
26
|
-
const classIdToBranch = /* @__PURE__ */ new Map();
|
|
27
|
-
let classEventResolver;
|
|
28
|
-
const scopesByRender = /* @__PURE__ */ new WeakMap();
|
|
29
|
-
const getRenderScopes = ($global) => {
|
|
30
|
-
init($global.runtimeId);
|
|
31
|
-
const render = self[$global.runtimeId]?.[$global.renderId];
|
|
32
|
-
let scopes = render && scopesByRender.get(render);
|
|
33
|
-
if (render && !scopes) scopesByRender.set(render, scopes = {});
|
|
34
|
-
return scopes;
|
|
35
|
-
};
|
|
36
|
-
const compat = {
|
|
37
|
-
patchDynamicTag,
|
|
38
|
-
queueEffect,
|
|
39
|
-
init(warp10Noop) {
|
|
40
|
-
_resumed[SET_SCOPE_REGISTER_ID] = (scope) => {
|
|
41
|
-
getRenderScopes(scope[Global])[scope["#Id"]] = scope;
|
|
42
|
-
if (scope.m5c) classIdToBranch.set(scope.m5c, scope);
|
|
43
|
-
if (classEventResolver) for (const key in scope) {
|
|
44
|
-
const resolved = classEventResolver(scope[key], scope);
|
|
45
|
-
if (resolved !== scope[key]) scope[key] = resolved;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
_resumed[RENDER_BODY_ID] = warp10Noop;
|
|
49
|
-
},
|
|
50
|
-
setClassEventResolver(fn) {
|
|
51
|
-
classEventResolver = fn;
|
|
52
|
-
},
|
|
53
|
-
resumeClassFunction(id, build) {
|
|
54
|
-
_resumed[id] = build;
|
|
55
|
-
},
|
|
56
|
-
getScope($global, scopeId) {
|
|
57
|
-
return getRenderScopes($global)?.[scopeId];
|
|
58
|
-
},
|
|
59
|
-
setRendererId(renderer, id) {
|
|
60
|
-
renderer["id"] = id;
|
|
61
|
-
},
|
|
62
|
-
isRenderer(renderer) {
|
|
63
|
-
return renderer[Clone];
|
|
64
|
-
},
|
|
65
|
-
getStartNode(branch) {
|
|
66
|
-
return branch[StartNode];
|
|
67
|
-
},
|
|
68
|
-
getEndNode(branch) {
|
|
69
|
-
return branch[EndNode];
|
|
70
|
-
},
|
|
71
|
-
setScopeNodes(branch, startNode, endNode) {
|
|
72
|
-
branch[StartNode] = startNode;
|
|
73
|
-
branch[EndNode] = endNode;
|
|
74
|
-
},
|
|
75
|
-
runComponentEffects() {
|
|
76
|
-
if (this.effects) runEffects(this.effects);
|
|
77
|
-
},
|
|
78
|
-
runComponentDestroy() {
|
|
79
|
-
if (this.scope) destroyBranch(this.scope);
|
|
80
|
-
},
|
|
81
|
-
resolveRegistered(value, $global) {
|
|
82
|
-
if (Array.isArray(value) && typeof value[0] === "string") return getRegisteredWithScope(getRenderScopes($global)?.[value[1]], value[0]);
|
|
83
|
-
return value;
|
|
84
|
-
},
|
|
85
|
-
createRenderer(params, clone) {
|
|
86
|
-
const renderer = _content("", 0, 0, 0, params)();
|
|
87
|
-
renderer[Clone] = (branch) => {
|
|
88
|
-
const cloned = clone();
|
|
89
|
-
branch[StartNode] = cloned.startNode;
|
|
90
|
-
branch[EndNode] = cloned.endNode;
|
|
91
|
-
};
|
|
92
|
-
return renderer;
|
|
93
|
-
},
|
|
94
|
-
render(out, component, renderer, args) {
|
|
95
|
-
init(out.global.runtimeId);
|
|
96
|
-
let branch = component.scope;
|
|
97
|
-
let created = 0;
|
|
98
|
-
if (!branch && (branch = classIdToBranch.get(component.id))) {
|
|
99
|
-
component.scope = branch;
|
|
100
|
-
classIdToBranch.delete(component.id);
|
|
101
|
-
}
|
|
102
|
-
if (args[0] && typeof args[0] === "object" && "renderBody" in args[0]) {
|
|
103
|
-
const input = args[0];
|
|
104
|
-
const normalizedInput = args[0] = {};
|
|
105
|
-
for (const key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
106
|
-
}
|
|
107
|
-
const renderBranch = (_) => {
|
|
108
|
-
if (!branch) {
|
|
109
|
-
created = 1;
|
|
110
|
-
branch = component.scope = createAndSetupBranch(out.global, renderer, renderer[Owner], document.body);
|
|
111
|
-
}
|
|
112
|
-
renderer[LocalClosures]?.(branch);
|
|
113
|
-
renderer[Params]?.(branch, renderer._ ? args[0] : args);
|
|
114
|
-
};
|
|
115
|
-
component.effects = rendering ? renderBranch() : prepareEffects(renderBranch);
|
|
116
|
-
if (created) return branch["#StartNode"].parentNode || branch["#StartNode"];
|
|
117
|
-
}
|
|
118
|
-
};
|
|
1
|
+
import { $ as _attrs, A as _attr_input_value_attribute_default, At as _const, B as _controllable_textarea, Bn as Load, Bt as _let_change, C as _attr_input_checked, Ct as init, D as _attr_input_checked_default, E as _attr_input_checkedValue_script, En as Lazy, Et as readyFailed, F as _attr_select_value_default, Ft as _hoist, G as _attr_class_item, Gt as _var, Ht as _return, I as _attr_select_value_script, It as _hoist_resume, J as _attr_content, Jn as attrTag, K as _attr_class_items, Kn as StartNode, Kt as _var_change, L as _controllable_input, Lt as _id, M as _attr_input_value_dynamic_default, Mt as _for_closure, N as _attr_input_value_script, Nt as _for_selector, O as _attr_input_checked_script, Ot as _closure, P as _attr_select_value, Pt as _global_read, Q as _attr_style_items, R as _controllable_open, Rt as _if_closure, S as _attr_details_or_dialog_open_script, Sn as _call, T as _attr_input_checkedValue_default, Tn as Clone, Tt as ready, U as _attr, Ut as _return_change, Vt as _or, W as _attr_class, Wt as _script, X as _attr_style, Xt as removeAndDestroyBranch, Y as _attr_nonce, Yn as attrTags, Yt as insertBranchBefore, Z as _attr_style_item, Zt as syncGen, _ as renderCatch, _n as forTo, _t as setupBranch, a as _for_in, at as _lifecycle, b as _attr_details_or_dialog_open, bn as _assert_hoist, bt as _resumed, c as _for_to, cn as queueAsyncRender, ct as _text, d as _for_until_unkeyed, dt as _content, en as _on, et as _attrs_content, f as _if, fn as run, ft as _content_closures, gn as forOf, gt as createBranch, hn as forIn, i as _dynamic_tag_content, it as _html, j as _attr_input_value_default, jn as Setup, jt as _el_read, k as _attr_input_value, kn as Params, kt as _closure_get, l as _for_to_unkeyed, lt as _text_content, m as _try, mn as runId, mt as _return_setup, n as _await_promise, nn as $signalReset, nt as _attrs_partial_content, o as _for_of, ot as _style_rule_item, p as _show, pn as runEffects, pt as _content_resume, q as _attr_class_names, qn as TagVariable, qt as _assert_init, r as _dynamic_tag, rn as onAbort, rt as _attrs_script, s as _for_of_unkeyed, sn as prepareEffects, st as _style_shell, t as _await_content, tn as $signal, tt as _attrs_partial, u as _for_until, un as queueRender, ut as _to_text, vn as forUntil, vt as _dynamic_tag_var_resume, w as _attr_input_checkedValue, wt as initEmbedded, x as _attr_details_or_dialog_open_default, xn as _hoist_read_error, xt as _var_resume, y as startAwait, yn as _assert_class_toggles, yt as _el, z as _controllable_select, zt as _let } from "./dom-DaHYZpf2.mjs";
|
|
119
2
|
// src/dom/template.ts
|
|
120
3
|
const _template = (id, template, walks, setup, inputSignal) => {
|
|
121
4
|
const renderer = _content(id, template, walks, setup, inputSignal)();
|
|
@@ -284,4 +167,4 @@ function _load_race_trigger(...triggers) {
|
|
|
284
167
|
function getSelectorOrResolve(selector, resolve) {
|
|
285
168
|
return document.querySelector(selector) || (console.warn(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`), resolve());
|
|
286
169
|
}
|
|
287
|
-
export { $signal, $signalReset, _assert_class_toggles, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_class_names, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _dynamic_tag_var_resume, _el, _el_read, _for_closure, _for_in, _for_of, _for_of_unkeyed, _for_selector, _for_to, _for_to_unkeyed, _for_until, _for_until_unkeyed, _global_read, _hoist, _hoist_read_error, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resumed, _return, _return_change, _return_setup, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags,
|
|
170
|
+
export { $signal, $signalReset, _assert_class_toggles, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_class_names, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _dynamic_tag_var_resume, _el, _el_read, _for_closure, _for_in, _for_of, _for_of_unkeyed, _for_selector, _for_to, _for_to_unkeyed, _for_until, _for_until_unkeyed, _global_read, _hoist, _hoist_read_error, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resumed, _return, _return_change, _return_setup, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, forIn, forOf, forTo, forUntil, init, initEmbedded, onAbort, ready, readyFailed, run };
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_control_flow = require("../html-DfZjMkhx.js");
|
|
4
|
+
// src/common/compat-meta.ts
|
|
5
|
+
const SET_SCOPE_REGISTER_ID = "$compat_setScope";
|
|
6
|
+
const RENDER_BODY_ID = "$compat_renderBody";
|
|
7
|
+
// src/html/compat.feat.ts
|
|
8
|
+
const K_TAGS_API_STATE = Symbol();
|
|
9
|
+
const COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
const compat = {
|
|
11
|
+
$global: require_control_flow.$global,
|
|
12
|
+
writeLoadAsset: require_control_flow.writeLoadAsset,
|
|
13
|
+
fork(scopeId, promise, content) {
|
|
14
|
+
require_control_flow._await(scopeId, "#text/0", promise, (value) => {
|
|
15
|
+
const branchId = require_control_flow._peek_scope_id();
|
|
16
|
+
content(value);
|
|
17
|
+
if (require_control_flow._peek_scope_id() === branchId) require_control_flow._scope_id();
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
write: require_control_flow._html,
|
|
21
|
+
writeScript: require_control_flow.writeScript,
|
|
22
|
+
nextScopeId: require_control_flow._scope_id,
|
|
23
|
+
peekNextScopeId: require_control_flow._peek_scope_id,
|
|
24
|
+
isInResumedBranch: require_control_flow.isInResumedBranch,
|
|
25
|
+
withChunk: require_control_flow.withChunk,
|
|
26
|
+
getChunk: require_control_flow.getChunk,
|
|
27
|
+
ensureState($global) {
|
|
28
|
+
let state = $global[K_TAGS_API_STATE] ||= require_control_flow.getChunk()?.boundary.state;
|
|
29
|
+
if (!state) {
|
|
30
|
+
$global.runtimeId ||= "M";
|
|
31
|
+
$global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_";
|
|
32
|
+
$global[K_TAGS_API_STATE] = state = new require_control_flow.State($global);
|
|
33
|
+
}
|
|
34
|
+
return state;
|
|
35
|
+
},
|
|
36
|
+
isRenderer(value) {
|
|
37
|
+
return typeof value === "function" && "id" in value;
|
|
38
|
+
},
|
|
39
|
+
setRendererId(renderer, id) {
|
|
40
|
+
renderer["id"] = id;
|
|
41
|
+
},
|
|
42
|
+
onFlush(fn) {
|
|
43
|
+
const { flushHTML } = require_control_flow.Chunk.prototype;
|
|
44
|
+
require_control_flow.Chunk.prototype.flushHTML = function(boundary) {
|
|
45
|
+
const { state } = boundary;
|
|
46
|
+
const reorders = swapReorders(state, null);
|
|
47
|
+
fn(this);
|
|
48
|
+
swapReorders(state, reorders);
|
|
49
|
+
return flushHTML.call(this, boundary);
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
setClassAPIRenderer: require_control_flow.setClassAPIRenderer,
|
|
53
|
+
writeSetScopeForComponent(branchId, m5c, m5i) {
|
|
54
|
+
require_control_flow.writeScope(branchId, {
|
|
55
|
+
m5c,
|
|
56
|
+
m5i
|
|
57
|
+
});
|
|
58
|
+
require_control_flow._script(branchId, SET_SCOPE_REGISTER_ID);
|
|
59
|
+
},
|
|
60
|
+
toJSON() {
|
|
61
|
+
return function toJSON() {
|
|
62
|
+
let compatRegistered = COMPAT_REGISTRY.get(this);
|
|
63
|
+
if (!compatRegistered) {
|
|
64
|
+
const registered = require_control_flow.REGISTRY.get(this);
|
|
65
|
+
if (registered) {
|
|
66
|
+
const scopeId = registered.scope ? require_control_flow.getScopeId(registered.scope) : void 0;
|
|
67
|
+
if (scopeId !== void 0) require_control_flow._script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
68
|
+
COMPAT_REGISTRY.set(this, compatRegistered = [registered.id, scopeId]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return compatRegistered;
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
joinChunks(chunks) {
|
|
75
|
+
let joined;
|
|
76
|
+
for (const chunk of chunks) {
|
|
77
|
+
if (chunk.boundary.aborted) continue;
|
|
78
|
+
if (joined) joined.append(chunk);
|
|
79
|
+
else joined = chunk;
|
|
80
|
+
}
|
|
81
|
+
return joined;
|
|
82
|
+
},
|
|
83
|
+
appendChunks(chunks) {
|
|
84
|
+
const chunk = require_control_flow.$chunk;
|
|
85
|
+
for (const part of chunks) {
|
|
86
|
+
chunk.append(part);
|
|
87
|
+
if (part.effects) chunk.lastEffect = part.lastEffect;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
deferReorders(reorders) {
|
|
91
|
+
const chunk = require_control_flow.$chunk;
|
|
92
|
+
for (let i = reorders.length; i--;) {
|
|
93
|
+
const carrier = chunk.fork(chunk.boundary, chunk.next);
|
|
94
|
+
carrier.deferredReorder = reorders[i];
|
|
95
|
+
chunk.next = carrier;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
createChunk($global) {
|
|
99
|
+
const state = this.ensureState($global);
|
|
100
|
+
return new require_control_flow.Chunk(new require_control_flow.Boundary(state), null, null, state);
|
|
101
|
+
},
|
|
102
|
+
flushScript(chunk, reorders) {
|
|
103
|
+
const { boundary } = chunk;
|
|
104
|
+
const { state } = boundary;
|
|
105
|
+
let html = "";
|
|
106
|
+
let scripts = "";
|
|
107
|
+
if (reorders) for (const reorder of reorders) state.reorder(reorder);
|
|
108
|
+
if (boundary.flush() === 0) ({html, scripts} = chunk.flush(boundary));
|
|
109
|
+
if (boundary.aborted) throw boundary.reason;
|
|
110
|
+
if (boundary.count) throw /* @__PURE__ */ new Error("Cannot serialize promise across tags/class compat layer.");
|
|
111
|
+
return {
|
|
112
|
+
html,
|
|
113
|
+
scripts
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
render(renderer, willRerender, classAPIOut, component, input, componentScopes, registerChildScope, parentChunk) {
|
|
117
|
+
if (parentChunk?.boundary.aborted) return;
|
|
118
|
+
const state = this.ensureState(classAPIOut.global);
|
|
119
|
+
const boundary = new require_control_flow.Boundary(state, void 0, parentChunk?.boundary);
|
|
120
|
+
const context = require_control_flow.getChunk()?.context ?? null;
|
|
121
|
+
let head = new require_control_flow.Chunk(boundary, new require_control_flow.Chunk(boundary, null, context, state), context, state);
|
|
122
|
+
let normalizedInput = input;
|
|
123
|
+
if ("renderBody" in input) {
|
|
124
|
+
normalizedInput = {};
|
|
125
|
+
for (const key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
126
|
+
}
|
|
127
|
+
const componentScope = new require_control_flow.Chunk(boundary, null, context, state);
|
|
128
|
+
componentScope.render(() => {
|
|
129
|
+
if (this.hasPendingClassFunctions(classAPIOut.global)) drainClassFunctions(classAPIOut.global, (hostId) => {
|
|
130
|
+
const fnScopeId = require_control_flow._scope_id();
|
|
131
|
+
const scope = require_control_flow.writeScope(fnScopeId, {
|
|
132
|
+
m5c: component.id,
|
|
133
|
+
m5h: hostId
|
|
134
|
+
});
|
|
135
|
+
require_control_flow._script(fnScopeId, SET_SCOPE_REGISTER_ID);
|
|
136
|
+
return scope;
|
|
137
|
+
});
|
|
138
|
+
if (willRerender || registerChildScope) {
|
|
139
|
+
const scopeId = require_control_flow._peek_scope_id();
|
|
140
|
+
require_control_flow.writeScope(scopeId, { m5c: component.id });
|
|
141
|
+
require_control_flow._script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
head.render(() => {
|
|
145
|
+
require_control_flow._set_scope_reason(willRerender ? require_control_flow.ALL_GROUPS : 0);
|
|
146
|
+
try {
|
|
147
|
+
renderer(normalizedInput);
|
|
148
|
+
} finally {
|
|
149
|
+
require_control_flow._set_scope_reason(void 0);
|
|
150
|
+
}
|
|
151
|
+
const asyncOut = classAPIOut.beginAsync({
|
|
152
|
+
last: true,
|
|
153
|
+
timeout: -1
|
|
154
|
+
});
|
|
155
|
+
classAPIOut.onLast((next) => {
|
|
156
|
+
(boundary.onNext = () => {
|
|
157
|
+
if (boundary.aborted) {
|
|
158
|
+
boundary.onNext = require_control_flow.NOOP;
|
|
159
|
+
if (parentChunk?.boundary.aborted) {
|
|
160
|
+
asyncOut.end();
|
|
161
|
+
next();
|
|
162
|
+
} else asyncOut.error(boundary.reason);
|
|
163
|
+
} else if (!boundary.count) {
|
|
164
|
+
boundary.onNext = require_control_flow.NOOP;
|
|
165
|
+
const queued = swapReorders(state, null);
|
|
166
|
+
head = head.consume(boundary);
|
|
167
|
+
const reorders = swapReorders(state, queued);
|
|
168
|
+
if (reorders) asyncOut.writer.get("reorders").push(...reorders);
|
|
169
|
+
const heldEffects = head.takeHeldEffects();
|
|
170
|
+
if (heldEffects) {
|
|
171
|
+
head.effects = require_control_flow.joinHeldEffects(heldEffects, head.effects);
|
|
172
|
+
head.lastEffect = "";
|
|
173
|
+
}
|
|
174
|
+
asyncOut.write(head.html);
|
|
175
|
+
asyncOut.script(head.scripts);
|
|
176
|
+
head.html = head.scripts = "";
|
|
177
|
+
asyncOut.writer.get("chunks").push(head);
|
|
178
|
+
asyncOut.end();
|
|
179
|
+
componentScopes.push(componentScope);
|
|
180
|
+
next();
|
|
181
|
+
}
|
|
182
|
+
})();
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
register: require_control_flow.register,
|
|
187
|
+
registerRenderBody(fn) {
|
|
188
|
+
require_control_flow.register(RENDER_BODY_ID, fn);
|
|
189
|
+
},
|
|
190
|
+
registerClassFunctions(input) {
|
|
191
|
+
for (const key in input) {
|
|
192
|
+
const value = input[key];
|
|
193
|
+
if (typeof value === "function" && !require_control_flow.REGISTRY.has(value)) require_control_flow.register(RENDER_BODY_ID, value);
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
registerClassFunction($global, id, fn, hostId) {
|
|
197
|
+
let pending = pendingClassFunctions.get($global);
|
|
198
|
+
if (!pending) pendingClassFunctions.set($global, pending = []);
|
|
199
|
+
pending.push([
|
|
200
|
+
id,
|
|
201
|
+
fn,
|
|
202
|
+
hostId
|
|
203
|
+
]);
|
|
204
|
+
return fn;
|
|
205
|
+
},
|
|
206
|
+
hasPendingClassFunctions($global) {
|
|
207
|
+
return !!pendingClassFunctions.get($global)?.length;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const pendingClassFunctions = /* @__PURE__ */ new WeakMap();
|
|
211
|
+
function drainClassFunctions($global, writeScope) {
|
|
212
|
+
const pending = pendingClassFunctions.get($global);
|
|
213
|
+
const scopeByHost = {};
|
|
214
|
+
for (const [id, fn, hostId] of pending) require_control_flow.register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
|
|
215
|
+
pending.length = 0;
|
|
216
|
+
}
|
|
217
|
+
function swapReorders(state, reorders) {
|
|
218
|
+
const { writeReorders } = state;
|
|
219
|
+
state.writeReorders = reorders;
|
|
220
|
+
return writeReorders;
|
|
221
|
+
}
|
|
222
|
+
exports.compat = compat;
|