marko 6.3.30 → 6.3.32
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 +36 -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 -2245
- package/dist/debug/dom.mjs +6 -2089
- 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/walker.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 -1221
- package/dist/dom.mjs +4 -1188
- package/dist/translator/index.js +628 -534
- 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/{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/package.json +3 -3
package/dist/debug/dom.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_control_flow = require("./dom-CiFITSPN.js");
|
|
3
4
|
//#region src/common/attr-tag.ts
|
|
4
5
|
const empty = [];
|
|
5
6
|
const rest = Symbol("Attribute Tag");
|
|
@@ -21,2091 +22,9 @@ function* attrTagIterator() {
|
|
|
21
22
|
yield* this[rest];
|
|
22
23
|
}
|
|
23
24
|
//#endregion
|
|
24
|
-
//#region src/common/constants/accessor-prefix.debug.ts
|
|
25
|
-
const BranchScopes$1 = "BranchScopes:";
|
|
26
|
-
const ClosureScopes = "ClosureScopes:";
|
|
27
|
-
const ClosureSignalIndex = "ClosureSignalIndex:";
|
|
28
|
-
const ConditionalRenderer = "ConditionalRenderer:";
|
|
29
|
-
const ControlledObserver = "ControlledObserver:";
|
|
30
|
-
const ControlledHandler = "ControlledHandler:";
|
|
31
|
-
const ControlledType = "ControlledType:";
|
|
32
|
-
const ControlledValue = "ControlledValue:";
|
|
33
|
-
const DynamicHTMLLastChild = "DynamicHTMLLastChild:";
|
|
34
|
-
const EventAttributes = "EventAttributes:";
|
|
35
|
-
const KeyedScopes = "KeyedScopes:";
|
|
36
|
-
const Lifecycle = "Lifecycle:";
|
|
37
|
-
const Promise$1 = "Promise:";
|
|
38
|
-
const TagVariableChange$1 = "TagVariableChange:";
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/common/constants/accessor-prop.debug.ts
|
|
41
|
-
const Global = "$global";
|
|
42
|
-
const AbortControllers = "#AbortControllers";
|
|
43
|
-
const AbortScopes = "#AbortScopes";
|
|
44
|
-
const AwaitCounter = "#AwaitCounter";
|
|
45
|
-
const BranchAccessor = "#BranchAccessor";
|
|
46
|
-
const BranchScopes = "#BranchScopes";
|
|
47
|
-
const CatchContent = "#CatchContent";
|
|
48
|
-
const ClosestBranch = "#ClosestBranch";
|
|
49
|
-
const ClosestBranchId = "#ClosestBranchId";
|
|
50
|
-
const Gen$1 = "#Gen";
|
|
51
|
-
const DetachedAwait = "#DetachedAwait";
|
|
52
|
-
const EndNode = "#EndNode";
|
|
53
|
-
const Load = "#Load";
|
|
54
|
-
const LoopKey = "#LoopKey";
|
|
55
|
-
const ParentBranch = "#ParentBranch";
|
|
56
|
-
const PendingEffects = "#PendingEffects";
|
|
57
|
-
const PendingRenders = "#PendingRenders";
|
|
58
|
-
const PendingScopes = "#PendingScopes";
|
|
59
|
-
const PlaceholderBranch = "#PlaceholderBranch";
|
|
60
|
-
const PlaceholderContent = "#PlaceholderContent";
|
|
61
|
-
const Renderer = "#Renderer";
|
|
62
|
-
const StartNode = "#StartNode";
|
|
63
|
-
const Subscriptions = "#Subscriptions";
|
|
64
|
-
const TagVariable = "#TagVariable";
|
|
65
|
-
const TagVariableChange = "#TagVariableChange";
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/common/constants/closure-signal-prop.debug.ts
|
|
68
|
-
const ScopeInstancesAccessor = "scopeInstancesAccessor";
|
|
69
|
-
const SignalIndexAccessor = "signalIndexAccessor";
|
|
70
|
-
const Index = "index";
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/common/constants/keyed-scopes-prop.debug.ts
|
|
73
|
-
const PreviousKey = "PreviousKey:";
|
|
74
|
-
//#endregion
|
|
75
25
|
//#region src/common/constants/load-signal-value.debug.ts
|
|
76
|
-
const Value$1 = "value";
|
|
77
|
-
const Signal$1 = "signal";
|
|
78
|
-
const Scope = "scope";
|
|
79
|
-
const Signal = "signal";
|
|
80
26
|
const Value = "value";
|
|
81
|
-
const
|
|
82
|
-
const Clone = "clone";
|
|
83
|
-
const Setup = "setup";
|
|
84
|
-
const Params = "params";
|
|
85
|
-
const Owner = "owner";
|
|
86
|
-
const Accessor = "accessor";
|
|
87
|
-
const LocalClosures = "localClosures";
|
|
88
|
-
const LocalClosureValues = "localClosureValues";
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/common/helpers.ts
|
|
91
|
-
const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
92
|
-
const knownWrongAttrs = {
|
|
93
|
-
className: "class",
|
|
94
|
-
classList: "class",
|
|
95
|
-
htmlFor: "for",
|
|
96
|
-
acceptCharset: "accept-charset",
|
|
97
|
-
httpEquiv: "http-equiv",
|
|
98
|
-
defaultValue: "value",
|
|
99
|
-
defaultChecked: "checked",
|
|
100
|
-
dangerouslySetInnerHTML: "$!{html}",
|
|
101
|
-
key: "<for by>",
|
|
102
|
-
ref: "<tag/ref>",
|
|
103
|
-
"v-if": "<if>",
|
|
104
|
-
"v-else": "<else>",
|
|
105
|
-
"v-else-if": "<else if>",
|
|
106
|
-
"v-for": "<for>",
|
|
107
|
-
"v-show": "<if>",
|
|
108
|
-
"v-model": "value:=state",
|
|
109
|
-
"v-bind": "...attrs",
|
|
110
|
-
"v-html": "$!{html}",
|
|
111
|
-
"v-text": "${text}"
|
|
112
|
-
};
|
|
113
|
-
function getWrongAttrSuggestion(name) {
|
|
114
|
-
if (Object.hasOwn(knownWrongAttrs, name)) return knownWrongAttrs[name];
|
|
115
|
-
const colon = name.indexOf(":");
|
|
116
|
-
if (colon > 0) {
|
|
117
|
-
const rest = name.slice(colon + 1);
|
|
118
|
-
switch (name.slice(0, colon)) {
|
|
119
|
-
case "class": return `class={ ${rest}: condition }`;
|
|
120
|
-
case "style": return `style={ ${rest}: value }`;
|
|
121
|
-
case "on":
|
|
122
|
-
case "v-on": return `on${rest.charAt(0).toUpperCase()}${rest.slice(1)}`;
|
|
123
|
-
case "bind":
|
|
124
|
-
case "v-model": return `${rest}:=state`;
|
|
125
|
-
case "v-bind": return rest;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
function _call(fn, v) {
|
|
130
|
-
fn(v);
|
|
131
|
-
return v;
|
|
132
|
-
}
|
|
133
|
-
function stringifyClassObject(name, value) {
|
|
134
|
-
return value ? name : "";
|
|
135
|
-
}
|
|
136
|
-
const warnedStyleKeys = /* @__PURE__ */ new Set();
|
|
137
|
-
function stringifyStyleObject(name, value) {
|
|
138
|
-
if (/[A-Z]/.test(name) && !name.includes("-") && !warnedStyleKeys.has(name)) {
|
|
139
|
-
warnedStyleKeys.add(name);
|
|
140
|
-
console.warn(`\`${name}\` is not a CSS property name; \`style\` object keys are written verbatim, so it renders as invalid CSS. Use \`${name.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^ms-/, "-ms-")}\`.`);
|
|
141
|
-
}
|
|
142
|
-
return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
|
|
143
|
-
}
|
|
144
|
-
const unsafeStyleAttrReg = /[\\;]/g;
|
|
145
|
-
const replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\";
|
|
146
|
-
function escapeStyleAttr(str) {
|
|
147
|
-
return unsafeStyleAttrReg.test(str) ? str.replace(unsafeStyleAttrReg, replaceUnsafeStyleAttr) : str;
|
|
148
|
-
}
|
|
149
|
-
function escapeStyleValue(str) {
|
|
150
|
-
let closers = "";
|
|
151
|
-
const result = str.replace(/[\\"'{};<>]|\/(?=\*)/g, (c) => c === "<" ? "\\3C " : c === ";" ? "\\3B " : c === "{" ? "\\7B " : "\\" + c);
|
|
152
|
-
for (const c of result) if (c === "(") closers = ")" + closers;
|
|
153
|
-
else if (c === "[") closers = "]" + closers;
|
|
154
|
-
else if (c === closers[0]) closers = closers.slice(1);
|
|
155
|
-
return result + closers;
|
|
156
|
-
}
|
|
157
|
-
const toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
|
|
158
|
-
let str = "";
|
|
159
|
-
let sep = "";
|
|
160
|
-
let part;
|
|
161
|
-
if (val) if (typeof val !== "object") str += val;
|
|
162
|
-
else if (Array.isArray(val)) for (const v of val) {
|
|
163
|
-
part = toDelimitedString(v, delimiter, stringify);
|
|
164
|
-
if (part) {
|
|
165
|
-
str += sep + part;
|
|
166
|
-
sep = delimiter;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else for (const name in val) {
|
|
170
|
-
part = stringify(name, val[name]);
|
|
171
|
-
if (part) {
|
|
172
|
-
str += sep + part;
|
|
173
|
-
sep = delimiter;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return str;
|
|
177
|
-
};
|
|
178
|
-
function isEventHandler(name) {
|
|
179
|
-
return /^on[A-Z-]/.test(name);
|
|
180
|
-
}
|
|
181
|
-
function getEventHandlerName(name) {
|
|
182
|
-
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
183
|
-
}
|
|
184
|
-
function isNotVoid(value) {
|
|
185
|
-
return value != null && value !== false;
|
|
186
|
-
}
|
|
187
|
-
function isPromise(value) {
|
|
188
|
-
return value != null && typeof value.then === "function";
|
|
189
|
-
}
|
|
190
|
-
function normalizeDynamicRenderer(value) {
|
|
191
|
-
if (value) {
|
|
192
|
-
if (typeof value === "string") return value;
|
|
193
|
-
const normalized = value.content || value.default || value;
|
|
194
|
-
if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
|
|
195
|
-
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.`);
|
|
196
|
-
if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
|
|
197
|
-
}
|
|
198
|
-
if ("id" in normalized) return normalized;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region src/common/errors.ts
|
|
203
|
-
const lowercaseEventHandlerReg = /^on[a-z]/;
|
|
204
|
-
function assertValidAttrValue(name, value) {
|
|
205
|
-
if (value && typeof value !== "string" && lowercaseEventHandlerReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
|
|
206
|
-
if (typeof value === "function") throw new Error(`The \`${name}\` attribute cannot be a function.${/Change$/.test(name) ? " A change handler is only used when its matching controllable attribute combination applies." : ""}`);
|
|
207
|
-
const unrenderable = describeUnrenderable(value);
|
|
208
|
-
if (unrenderable) throw new Error(`The \`${name}\` attribute cannot be ${unrenderable}.`);
|
|
209
|
-
}
|
|
210
|
-
function assertValidTextValue(value) {
|
|
211
|
-
const unrenderable = describeUnrenderable(value);
|
|
212
|
-
if (unrenderable) throw new Error(`Text content cannot be ${unrenderable}.`);
|
|
213
|
-
}
|
|
214
|
-
function describeUnrenderable(value) {
|
|
215
|
-
if (typeof value === "symbol") return "a symbol";
|
|
216
|
-
if (typeof value === "object" && value !== null) {
|
|
217
|
-
let stringified;
|
|
218
|
-
try {
|
|
219
|
-
stringified = `${value}`;
|
|
220
|
-
} catch {
|
|
221
|
-
stringified = "[object Object]";
|
|
222
|
-
}
|
|
223
|
-
if (/^\[object \w+\]$/.test(stringified)) return stringified === "[object Promise]" ? "a promise (use the `<await>` tag to render its resolved value)" : stringified === "[object Object]" ? "a plain object (it would render as `[object Object]`)" : `a value that renders as \`${stringified}\``;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function assertValidLoopKey(key, seenKeys) {
|
|
227
|
-
if (typeof key !== "string" && typeof key !== "number") throw new Error(`A \`<for>\` tag's \`by\` attribute must return a string or number for each item, but received ${key === null ? "null" : `type "${typeof key}"`}.`);
|
|
228
|
-
if (seenKeys) {
|
|
229
|
-
if (seenKeys.has(key)) throw new Error(`A \`<for>\` tag's \`by\` attribute must return a unique value for each item, but \`${key}\` was used more than once.`);
|
|
230
|
-
seenKeys.add(key);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
function assertValidList(value) {
|
|
234
|
-
if (value && typeof value[Symbol.iterator] !== "function") throw new Error(`A \`<for>\` tag's \`of\` attribute must be an iterable, such as an array, but received ${describeForValue(value)}.`);
|
|
235
|
-
}
|
|
236
|
-
function assertValidRangeBound(name, value) {
|
|
237
|
-
if (!isFinite(value)) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
|
|
238
|
-
}
|
|
239
|
-
function describeForValue(value) {
|
|
240
|
-
return typeof value === "number" || typeof value === "bigint" ? `\`${value}\`` : value === null ? "null" : `type "${typeof value}"`;
|
|
241
|
-
}
|
|
242
|
-
function assertValidAttrName(name) {
|
|
243
|
-
if (htmlAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
|
|
244
|
-
const suggestion = getWrongAttrSuggestion(name);
|
|
245
|
-
if (suggestion) throw new Error(`\`${name}\` is not a valid attribute, did you mean \`${suggestion}\`?`);
|
|
246
|
-
}
|
|
247
|
-
function _el_read_error() {
|
|
248
|
-
throw new Error("Element references can only be read in scripts and event handlers.");
|
|
249
|
-
}
|
|
250
|
-
function _hoist_read_error() {
|
|
251
|
-
throw new Error("Hoisted values can only be read in scripts and event handlers.");
|
|
252
|
-
}
|
|
253
|
-
function _assert_hoist(value) {
|
|
254
|
-
if (typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
|
|
255
|
-
}
|
|
256
|
-
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
257
|
-
if (attrs) {
|
|
258
|
-
let exclusiveAttrs;
|
|
259
|
-
if (attrs.checkedChange) (exclusiveAttrs ||= []).push("checkedChange");
|
|
260
|
-
if ("checkedValue" in attrs) {
|
|
261
|
-
(exclusiveAttrs ||= []).push("checkedValue");
|
|
262
|
-
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
263
|
-
} else if (attrs.checkedValueChange) {
|
|
264
|
-
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
265
|
-
if ("checked" in attrs) exclusiveAttrs.push("checked");
|
|
266
|
-
}
|
|
267
|
-
if (attrs.valueChange) (exclusiveAttrs ||= []).push("valueChange");
|
|
268
|
-
if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
function assertHandlerIsFunction(name, value) {
|
|
272
|
-
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}".`);
|
|
273
|
-
}
|
|
274
|
-
function assertValidTagName(tagName) {
|
|
275
|
-
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.`);
|
|
276
|
-
}
|
|
277
|
-
function throwErr(msg) {
|
|
278
|
-
throw new Error(msg);
|
|
279
|
-
}
|
|
280
|
-
function joinWithAnd(a) {
|
|
281
|
-
switch (a.length) {
|
|
282
|
-
case 0: return "";
|
|
283
|
-
case 1: return a[0];
|
|
284
|
-
case 2: return `${a[0]} and ${a[1]}`;
|
|
285
|
-
default: return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
//#endregion
|
|
289
|
-
//#region src/common/for.ts
|
|
290
|
-
function forIn(obj, cb) {
|
|
291
|
-
for (const key in obj) cb(key, obj[key]);
|
|
292
|
-
}
|
|
293
|
-
function forOf(list, cb) {
|
|
294
|
-
assertValidList(list);
|
|
295
|
-
if (list) {
|
|
296
|
-
let i = 0;
|
|
297
|
-
for (const item of list) cb(item, i++);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
function forTo(to, from, step, cb) {
|
|
301
|
-
assertValidRangeBound("to", to);
|
|
302
|
-
const start = from || 0;
|
|
303
|
-
const delta = step || 1;
|
|
304
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
305
|
-
}
|
|
306
|
-
function forUntil(until, from, step, cb) {
|
|
307
|
-
assertValidRangeBound("until", until);
|
|
308
|
-
const start = from || 0;
|
|
309
|
-
const delta = step || 1;
|
|
310
|
-
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
311
|
-
}
|
|
312
|
-
//#endregion
|
|
313
|
-
//#region src/common/meta.ts
|
|
314
|
-
const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
|
|
315
|
-
//#endregion
|
|
316
|
-
//#region src/common/opt.ts
|
|
317
|
-
function toArray(opt) {
|
|
318
|
-
return opt ? Array.isArray(opt) ? opt : [opt] : [];
|
|
319
|
-
}
|
|
320
|
-
function forEach(opt, cb) {
|
|
321
|
-
if (opt) if (Array.isArray(opt)) for (const item of opt) cb(item);
|
|
322
|
-
else cb(opt);
|
|
323
|
-
}
|
|
324
|
-
function push(opt, item) {
|
|
325
|
-
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
326
|
-
}
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region src/dom/event.ts
|
|
329
|
-
function _on(element, type, handler) {
|
|
330
|
-
assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
|
|
331
|
-
if (element["$" + type] === void 0) delegate(type, handleDelegated);
|
|
332
|
-
element["$" + type] = handler || null;
|
|
333
|
-
}
|
|
334
|
-
const delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, true), 1);
|
|
335
|
-
function handleDelegated(ev) {
|
|
336
|
-
let target = !rendering && ev.target;
|
|
337
|
-
Object.defineProperty(ev, "currentTarget", {
|
|
338
|
-
configurable: true,
|
|
339
|
-
get() {
|
|
340
|
-
console.error("Event.currentTarget is not supported in Marko's delegated events. Instead use an element reference or the second parameter of the event handler.");
|
|
341
|
-
return null;
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
while (target) {
|
|
345
|
-
target["$" + ev.type]?.(ev, target);
|
|
346
|
-
target = ev.bubbles && !ev.cancelBubble && target.parentNode;
|
|
347
|
-
}
|
|
348
|
-
delete ev.currentTarget;
|
|
349
|
-
}
|
|
350
|
-
//#endregion
|
|
351
|
-
//#region src/dom/parse-html.ts
|
|
352
|
-
const parsers = {};
|
|
353
|
-
function parseHTML(html, ns) {
|
|
354
|
-
const parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
|
355
|
-
parser.innerHTML = html;
|
|
356
|
-
return parser.content || parser;
|
|
357
|
-
}
|
|
358
|
-
//#endregion
|
|
359
|
-
//#region src/dom/scope.ts
|
|
360
|
-
let nextScopeId = 1e6;
|
|
361
|
-
let collectingScopes;
|
|
362
|
-
function createScope($global, closestBranch) {
|
|
363
|
-
const scope = {
|
|
364
|
-
["#Id"]: nextScopeId++,
|
|
365
|
-
[Gen$1]: runId,
|
|
366
|
-
[ClosestBranch]: closestBranch,
|
|
367
|
-
[Global]: $global
|
|
368
|
-
};
|
|
369
|
-
collectingScopes?.push(scope);
|
|
370
|
-
return scope;
|
|
371
|
-
}
|
|
372
|
-
function syncGen(scope) {
|
|
373
|
-
scope[Gen$1] = runId;
|
|
374
|
-
}
|
|
375
|
-
function _assert_init(scope, accessor) {
|
|
376
|
-
if (scope["#Gen"] === runId || !(accessor in scope)) throw new ReferenceError(`Cannot access '${accessor}' before initialization`);
|
|
377
|
-
return scope[accessor];
|
|
378
|
-
}
|
|
379
|
-
function collectScopes(fn) {
|
|
380
|
-
const prev = collectingScopes;
|
|
381
|
-
collectingScopes = [];
|
|
382
|
-
try {
|
|
383
|
-
fn();
|
|
384
|
-
return collectingScopes;
|
|
385
|
-
} finally {
|
|
386
|
-
collectingScopes = prev;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
function skipScope() {
|
|
390
|
-
return nextScopeId++;
|
|
391
|
-
}
|
|
392
|
-
function findBranchWithKey(scope, key) {
|
|
393
|
-
let branch = scope[ClosestBranch];
|
|
394
|
-
while (branch && branch[key] == null) branch = branch[ParentBranch];
|
|
395
|
-
return branch;
|
|
396
|
-
}
|
|
397
|
-
function destroyBranch(branch) {
|
|
398
|
-
branch[ParentBranch]?.[BranchScopes]?.delete(branch);
|
|
399
|
-
destroyNestedScopes(branch);
|
|
400
|
-
}
|
|
401
|
-
function destroyScope(scope) {
|
|
402
|
-
if (scope["#Gen"]) {
|
|
403
|
-
destroyNestedScopes(scope);
|
|
404
|
-
cleanupScope(scope);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
const destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
408
|
-
scope[Gen$1] = 0;
|
|
409
|
-
scope[BranchScopes]?.forEach(destroyNestedScopes);
|
|
410
|
-
scope[AbortScopes]?.forEach(cleanupScope);
|
|
411
|
-
};
|
|
412
|
-
function cleanupScope(scope) {
|
|
413
|
-
scope[Subscriptions]?.forEach(unsubscribe, scope);
|
|
414
|
-
for (const id in scope[AbortControllers]) $signalReset(scope, id);
|
|
415
|
-
}
|
|
416
|
-
function unsubscribe(subscribers) {
|
|
417
|
-
subscribers.delete(this);
|
|
418
|
-
}
|
|
419
|
-
function removeAndDestroyBranch(branch) {
|
|
420
|
-
destroyBranch(branch);
|
|
421
|
-
removeChildNodes(branch[StartNode], branch[EndNode]);
|
|
422
|
-
}
|
|
423
|
-
function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
424
|
-
insertChildNodes(parentNode, nextSibling, branch[StartNode], branch[EndNode]);
|
|
425
|
-
}
|
|
426
|
-
function tempDetachBranch(branch) {
|
|
427
|
-
const fragment = new DocumentFragment();
|
|
428
|
-
fragment.namespaceURI = branch[StartNode].parentNode.namespaceURI;
|
|
429
|
-
insertChildNodes(fragment, null, branch[StartNode], branch[EndNode]);
|
|
430
|
-
}
|
|
431
|
-
//#endregion
|
|
432
|
-
//#region src/dom/schedule.ts
|
|
433
|
-
let runTask;
|
|
434
|
-
let isScheduled;
|
|
435
|
-
let channel;
|
|
436
|
-
function schedule() {
|
|
437
|
-
if (!isScheduled) {
|
|
438
|
-
if (console.createTask) {
|
|
439
|
-
const task = console.createTask("queue");
|
|
440
|
-
runTask = () => task.run(run);
|
|
441
|
-
} else runTask = run;
|
|
442
|
-
isScheduled = 1;
|
|
443
|
-
queueMicrotask(flushAndWaitFrame);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
function flushAndWaitFrame() {
|
|
447
|
-
requestAnimationFrame(triggerMacroTask);
|
|
448
|
-
runTask();
|
|
449
|
-
}
|
|
450
|
-
function triggerMacroTask() {
|
|
451
|
-
if (!channel) {
|
|
452
|
-
channel = new MessageChannel();
|
|
453
|
-
channel.port1.onmessage = () => {
|
|
454
|
-
isScheduled = 0;
|
|
455
|
-
{
|
|
456
|
-
const run = runTask;
|
|
457
|
-
runTask = void 0;
|
|
458
|
-
run();
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
channel.port2.postMessage(0);
|
|
463
|
-
}
|
|
464
|
-
//#endregion
|
|
465
|
-
//#region src/dom/signals.ts
|
|
466
|
-
function _let(id, fn) {
|
|
467
|
-
const valueAccessor = id.slice(0, id.lastIndexOf("/"));
|
|
468
|
-
id = +id.slice(id.lastIndexOf("/") + 1);
|
|
469
|
-
return (scope, value) => {
|
|
470
|
-
if (rendering) {
|
|
471
|
-
if (scope["#Gen"] === runId) {
|
|
472
|
-
scope[valueAccessor] = value;
|
|
473
|
-
fn?.(scope);
|
|
474
|
-
}
|
|
475
|
-
} else if ((scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn)) {
|
|
476
|
-
schedule();
|
|
477
|
-
queueRender(scope, fn, id);
|
|
478
|
-
}
|
|
479
|
-
return value;
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
function _let_change(id, fn) {
|
|
483
|
-
const valueAccessor = id.slice(0, id.lastIndexOf("/"));
|
|
484
|
-
const valueChangeAccessor = TagVariableChange$1 + valueAccessor;
|
|
485
|
-
const base = _let(id, fn);
|
|
486
|
-
return (scope, value, valueChange) => {
|
|
487
|
-
if (rendering) if ((scope[valueChangeAccessor] = valueChange) && (scope[valueAccessor] !== value || !(valueAccessor in scope))) {
|
|
488
|
-
scope[valueAccessor] = value;
|
|
489
|
-
fn?.(scope);
|
|
490
|
-
} else base(scope, value);
|
|
491
|
-
else if (scope[valueChangeAccessor]) scope[valueChangeAccessor](value);
|
|
492
|
-
else base(scope, value);
|
|
493
|
-
return value;
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
function _const(valueAccessor, fn) {
|
|
497
|
-
return ((scope, value) => {
|
|
498
|
-
if (scope[valueAccessor] !== value || !(valueAccessor in scope)) {
|
|
499
|
-
scope[valueAccessor] = value;
|
|
500
|
-
fn?.(scope);
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
|
|
505
|
-
return (scope) => {
|
|
506
|
-
if (scope["#Gen"] === runId) if (~id in scope) {
|
|
507
|
-
if (!--scope[~id]) fn(scope);
|
|
508
|
-
} else scope[~id] = defaultPending;
|
|
509
|
-
else queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
513
|
-
const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
|
|
514
|
-
const ownerSignal = (ownerScope) => {
|
|
515
|
-
const scopes = toArray(ownerScope[scopeAccessor]);
|
|
516
|
-
if (scopes.length) queueRender(ownerScope, () => {
|
|
517
|
-
for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
|
|
518
|
-
}, -1, 0, scopes[0]["#Id"]);
|
|
519
|
-
};
|
|
520
|
-
ownerSignal._ = fn;
|
|
521
|
-
return ownerSignal;
|
|
522
|
-
}
|
|
523
|
-
function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccessor, fn) {
|
|
524
|
-
const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
|
|
525
|
-
const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
|
|
526
|
-
const prevKeyProp = `${PreviousKey}${ownerValueAccessor}`;
|
|
527
|
-
const ownerSignal = (ownerScope) => {
|
|
528
|
-
const scopes = toArray(ownerScope[scopeAccessor]);
|
|
529
|
-
if (ownerScope["#Gen"] < runId && scopes.length) {
|
|
530
|
-
const nextKey = ownerScope[ownerValueAccessor];
|
|
531
|
-
queueRender(ownerScope, () => {
|
|
532
|
-
const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor);
|
|
533
|
-
if (map && prevKeyProp in map) {
|
|
534
|
-
const prevScope = map.get(map[prevKeyProp]);
|
|
535
|
-
const nextScope = map.get(nextKey);
|
|
536
|
-
if (prevScope !== nextScope) {
|
|
537
|
-
runLiveBranch(prevScope, fn);
|
|
538
|
-
runLiveBranch(nextScope, fn);
|
|
539
|
-
}
|
|
540
|
-
} else for (const scope of toArray(ownerScope[scopeAccessor])) runLiveBranch(scope, fn);
|
|
541
|
-
if (map) map[prevKeyProp] = nextKey;
|
|
542
|
-
}, -1, 0, scopes[0]["#Id"]);
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
ownerSignal._ = fn;
|
|
546
|
-
return ownerSignal;
|
|
547
|
-
}
|
|
548
|
-
function keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor) {
|
|
549
|
-
const map = ownerScope[mapAccessor] ||= /* @__PURE__ */ new Map();
|
|
550
|
-
if (!map.size) for (const scope of toArray(ownerScope[scopeAccessor])) {
|
|
551
|
-
const key = scope["#LoopKey"] ?? scope[keyValueAccessor];
|
|
552
|
-
if (key === void 0) return ownerScope[mapAccessor] = null;
|
|
553
|
-
scope[LoopKey] = key;
|
|
554
|
-
map.set(key, scope);
|
|
555
|
-
}
|
|
556
|
-
return map;
|
|
557
|
-
}
|
|
558
|
-
function runLiveBranch(scope, fn) {
|
|
559
|
-
if (scope && scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
|
|
560
|
-
}
|
|
561
|
-
function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
562
|
-
const scopeAccessor = BranchScopes$1 + ownerConditionalNodeAccessor;
|
|
563
|
-
const branchAccessor = ConditionalRenderer + ownerConditionalNodeAccessor;
|
|
564
|
-
const ownerSignal = (scope) => {
|
|
565
|
-
const ifScope = scope[scopeAccessor];
|
|
566
|
-
if (ifScope && ifScope["#Gen"] > 0 && ifScope["#Gen"] < runId && (scope[branchAccessor] || 0) === branch) queueRender(ifScope, fn, -1);
|
|
567
|
-
};
|
|
568
|
-
ownerSignal._ = fn;
|
|
569
|
-
return ownerSignal;
|
|
570
|
-
}
|
|
571
|
-
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
572
|
-
const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
|
573
|
-
const { size } = subscribers;
|
|
574
|
-
if (subscribers.add(scope).size !== size) trackCleanup(scope, subscribers);
|
|
575
|
-
}
|
|
576
|
-
function _closure(...closureSignals) {
|
|
577
|
-
const [firstSignal] = closureSignals;
|
|
578
|
-
const scopeInstances = firstSignal[ScopeInstancesAccessor];
|
|
579
|
-
const signalIndex = firstSignal[SignalIndexAccessor];
|
|
580
|
-
for (let i = closureSignals.length; i--;) closureSignals[i][Index] = i;
|
|
581
|
-
return (scope) => {
|
|
582
|
-
if (scope[scopeInstances]) {
|
|
583
|
-
for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
588
|
-
const closureSignal = ((scope) => {
|
|
589
|
-
scope[closureSignal[SignalIndexAccessor]] = closureSignal[Index];
|
|
590
|
-
fn(scope);
|
|
591
|
-
subscribeToScopeSet(getOwnerScope ? getOwnerScope(scope) : scope["_"], closureSignal[ScopeInstancesAccessor], scope);
|
|
592
|
-
});
|
|
593
|
-
closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
|
|
594
|
-
closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
|
|
595
|
-
resumeId && _resume(resumeId, closureSignal);
|
|
596
|
-
return closureSignal;
|
|
597
|
-
}
|
|
598
|
-
function _child_setup(setup) {
|
|
599
|
-
setup._ = (scope, owner) => {
|
|
600
|
-
scope["_"] = owner;
|
|
601
|
-
queueRender(scope, setup, -1);
|
|
602
|
-
};
|
|
603
|
-
return setup;
|
|
604
|
-
}
|
|
605
|
-
function _var(scope, childAccessor, signal) {
|
|
606
|
-
scope[childAccessor][TagVariable] = (value) => signal(scope, value);
|
|
607
|
-
}
|
|
608
|
-
const _return = (scope, value) => scope[TagVariable]?.(value);
|
|
609
|
-
function _return_change(scope, changeHandler) {
|
|
610
|
-
if (changeHandler) scope[TagVariableChange] = changeHandler;
|
|
611
|
-
}
|
|
612
|
-
const _var_change = (scope, value, name = "This") => {
|
|
613
|
-
if (typeof scope["#TagVariableChange"] !== "function") throw new TypeError(`${name} is a readonly tag variable.`);
|
|
614
|
-
scope[TagVariableChange](value);
|
|
615
|
-
};
|
|
616
|
-
const tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
|
617
|
-
function _id({ [Global]: $global }) {
|
|
618
|
-
const id = tagIdsByGlobal.get($global) || 0;
|
|
619
|
-
tagIdsByGlobal.set($global, id + 1);
|
|
620
|
-
return "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
|
621
|
-
}
|
|
622
|
-
function _script(id, fn) {
|
|
623
|
-
_resume(id, fn);
|
|
624
|
-
return (scope) => {
|
|
625
|
-
queueEffect(scope, fn);
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
function _el_read(value) {
|
|
629
|
-
if (rendering) _el_read_error();
|
|
630
|
-
return value;
|
|
631
|
-
}
|
|
632
|
-
function* traverse(scope, path, i = path.length - 1) {
|
|
633
|
-
if (rendering) _hoist_read_error();
|
|
634
|
-
if (scope) if (Symbol.iterator in scope) for (const childScope of scope.values()) yield* traverse(childScope, path, i);
|
|
635
|
-
else {
|
|
636
|
-
const item = scope[path[i]];
|
|
637
|
-
if (i) yield* traverse(item, path, i - 1);
|
|
638
|
-
else yield typeof item === "function" ? item() : item;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
function _hoist(...path) {
|
|
642
|
-
return (scope) => {
|
|
643
|
-
const fn = () => traverse(scope, path).next().value;
|
|
644
|
-
fn[Symbol.iterator] = () => traverse(scope, path);
|
|
645
|
-
return fn;
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
function _hoist_resume(id, ...path) {
|
|
649
|
-
return _resume(id, _hoist(...path));
|
|
650
|
-
}
|
|
651
|
-
//#endregion
|
|
652
|
-
//#region src/dom/walker.ts
|
|
653
|
-
const walker = /* @__PURE__ */ document.createTreeWalker(document);
|
|
654
|
-
function walk(startNode, walkCodes, branch) {
|
|
655
|
-
walker.currentNode = startNode;
|
|
656
|
-
walkInternal(0, walkCodes, branch);
|
|
657
|
-
}
|
|
658
|
-
const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
659
|
-
let value;
|
|
660
|
-
let currentMultiplier;
|
|
661
|
-
let storedMultiplier = 0;
|
|
662
|
-
let currentScopeIndex = 0;
|
|
663
|
-
for (; currentWalkIndex < walkCodes.length;) {
|
|
664
|
-
value = walkCodes.charCodeAt(currentWalkIndex++);
|
|
665
|
-
currentMultiplier = storedMultiplier;
|
|
666
|
-
storedMultiplier = 0;
|
|
667
|
-
if (value === 32) {
|
|
668
|
-
const node = walker.currentNode;
|
|
669
|
-
scope[getDebugKey(currentScopeIndex++, node)] = node;
|
|
670
|
-
} else if (value === 37 || value === 49) {
|
|
671
|
-
walker.currentNode.replaceWith(walker.currentNode = scope[getDebugKey(currentScopeIndex++, "#text")] = new Text());
|
|
672
|
-
if (value === 49) scope[getDebugKey(currentScopeIndex++, "#scopeOffset")] = skipScope();
|
|
673
|
-
} else if (value === 38) return currentWalkIndex;
|
|
674
|
-
else if (value === 47 || value === 48) {
|
|
675
|
-
currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[getDebugKey(currentScopeIndex++, "#childScope")] = createScope(scope[Global], scope[ClosestBranch]));
|
|
676
|
-
if (value === 48) scope[getDebugKey(currentScopeIndex++, "#scopeOffset")] = skipScope();
|
|
677
|
-
} else if (value < 92) {
|
|
678
|
-
value = 25 * currentMultiplier + value - 67;
|
|
679
|
-
while (value--) walker.nextNode();
|
|
680
|
-
} else if (value < 107) {
|
|
681
|
-
value = 10 * currentMultiplier + value - 97;
|
|
682
|
-
while (value--) walker.nextSibling();
|
|
683
|
-
} else if (value < 117) {
|
|
684
|
-
value = 10 * currentMultiplier + value - 107;
|
|
685
|
-
while (value--) walker.parentNode();
|
|
686
|
-
walker.nextSibling();
|
|
687
|
-
} else {
|
|
688
|
-
if (value < 117 || value > 126) throw new Error(`Unknown walk code: ${value}`);
|
|
689
|
-
storedMultiplier = currentMultiplier * 10 + value - 117;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
function getDebugKey(index, node) {
|
|
694
|
-
if (typeof node === "string") return `${node}/${index}`;
|
|
695
|
-
else if (node.nodeType === 3) return `#text/${index}`;
|
|
696
|
-
else if (node.nodeType === 8) return `#comment/${index}`;
|
|
697
|
-
else if (node.nodeType === 1) return `#${node.tagName.toLowerCase()}/${index}`;
|
|
698
|
-
return index;
|
|
699
|
-
}
|
|
700
|
-
//#endregion
|
|
701
|
-
//#region src/dom/resume.ts
|
|
702
|
-
const registeredValues = {};
|
|
703
|
-
let curRenders;
|
|
704
|
-
let branchesEnabled;
|
|
705
|
-
let embedRenders;
|
|
706
|
-
let readyIds;
|
|
707
|
-
function enableBranches() {
|
|
708
|
-
if (!branchesEnabled) {
|
|
709
|
-
branchesEnabled = 1;
|
|
710
|
-
skipDestroyedRenders();
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
function ready(readyId) {
|
|
714
|
-
(readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
|
|
715
|
-
for (const renderId in curRenders) runResumeEffects(curRenders[renderId]);
|
|
716
|
-
}
|
|
717
|
-
function initEmbedded(readyId, runtimeId) {
|
|
718
|
-
if (!embedRenders) {
|
|
719
|
-
embedRenders = /* @__PURE__ */ new Map();
|
|
720
|
-
new MutationObserver(() => {
|
|
721
|
-
for (const [anchor, [renderId, scopes]] of embedRenders) if (!anchor.isConnected) {
|
|
722
|
-
embedRenders.delete(anchor);
|
|
723
|
-
delete curRenders[renderId];
|
|
724
|
-
for (const id in scopes) destroyScope(scopes[id]);
|
|
725
|
-
}
|
|
726
|
-
}).observe(document, {
|
|
727
|
-
childList: true,
|
|
728
|
-
subtree: true
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
ready(readyId);
|
|
732
|
-
init(runtimeId);
|
|
733
|
-
}
|
|
734
|
-
function init(runtimeId = "M") {
|
|
735
|
-
if (curRenders) {
|
|
736
|
-
if (curRenders !== self[runtimeId]) throw new Error(`Marko initialized multiple times with different $global.runtimeId's.`);
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
const renders = self[runtimeId];
|
|
740
|
-
const defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc);
|
|
741
|
-
const initRuntime = (renders) => {
|
|
742
|
-
defineRuntime({ value: curRenders = ((renderId) => {
|
|
743
|
-
const render = curRenders[renderId] = renders[renderId] || renders(renderId);
|
|
744
|
-
const walk = render.w;
|
|
745
|
-
const scopeLookup = {};
|
|
746
|
-
const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
|
|
747
|
-
const initGlobal = () => scopeLookup[0] ||= {
|
|
748
|
-
runtimeId,
|
|
749
|
-
renderId
|
|
750
|
-
};
|
|
751
|
-
const initScope = (scope) => {
|
|
752
|
-
scope[Gen$1] = 1;
|
|
753
|
-
scope[Global] = initGlobal();
|
|
754
|
-
if (branchesEnabled && scope["#ClosestBranchId"]) scope[ClosestBranch] = getScope(scope[ClosestBranchId]);
|
|
755
|
-
return scope;
|
|
756
|
-
};
|
|
757
|
-
const applyScopes = (partials) => {
|
|
758
|
-
let scopeId = partials[0];
|
|
759
|
-
for (let i = 1; i < partials.length; i++) {
|
|
760
|
-
const partial = partials[i];
|
|
761
|
-
if (typeof partial === "number") scopeId += partial;
|
|
762
|
-
else {
|
|
763
|
-
if (scopeId) initScope(Object.assign(scopeLookup[scopeId] ||= (partial["#Id"] = scopeId, partial), partial));
|
|
764
|
-
else Object.assign(initGlobal(), partial);
|
|
765
|
-
scopeId++;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data));
|
|
770
|
-
const createVisitBranches = (branchScopesStack = [], branchStarts = [], orphanBranches = [], deferredOwners = [], curBranchScopes) => {
|
|
771
|
-
return (branchId, branch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, j = deferredOwners.length) => {
|
|
772
|
-
if (visitType !== "[") {
|
|
773
|
-
visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit;
|
|
774
|
-
accessor = BranchScopes$1 + lastToken;
|
|
775
|
-
singleNode = visitType !== "]" && visitType !== ")";
|
|
776
|
-
nextToken();
|
|
777
|
-
}
|
|
778
|
-
while (branchId = +lastToken) {
|
|
779
|
-
(endedBranches ||= []).push(branch = getScope(branchId));
|
|
780
|
-
setParentBranch(branch, branch[ClosestBranch]);
|
|
781
|
-
if (branch["#AwaitCounter"] = render.p?.[branchId]) branch[AwaitCounter].m = render.m;
|
|
782
|
-
if (singleNode) {
|
|
783
|
-
while (startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling));
|
|
784
|
-
branch["_"] ??= visitScope;
|
|
785
|
-
branch[EndNode] = branch[StartNode] = startVisit;
|
|
786
|
-
if (visitType === "'") branch[getDebugKey(0, startVisit)] = startVisit;
|
|
787
|
-
} else {
|
|
788
|
-
curBranchScopes = push(curBranchScopes, branch);
|
|
789
|
-
if (accessor) {
|
|
790
|
-
visitScope[accessor] = curBranchScopes;
|
|
791
|
-
forEach(curBranchScopes, (scope) => scope["_"] ??= visitScope);
|
|
792
|
-
curBranchScopes = branchScopesStack.pop();
|
|
793
|
-
}
|
|
794
|
-
startVisit = branchStarts.pop();
|
|
795
|
-
if (parent !== startVisit.parentNode) parent.prepend(startVisit);
|
|
796
|
-
branch[StartNode] = startVisit;
|
|
797
|
-
branch[EndNode] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
798
|
-
}
|
|
799
|
-
while (i && orphanBranches[i - 1]["#Id"] > branchId) {
|
|
800
|
-
i--;
|
|
801
|
-
setParentBranch(orphanBranches.pop(), branch);
|
|
802
|
-
}
|
|
803
|
-
while (j && deferredOwners[j - 1]["#Id"] > branchId) {
|
|
804
|
-
j--;
|
|
805
|
-
const owner = deferredOwners.pop();
|
|
806
|
-
if (owner["#ClosestBranch"] !== owner) owner[ClosestBranch] = branch;
|
|
807
|
-
}
|
|
808
|
-
nextToken();
|
|
809
|
-
}
|
|
810
|
-
if (endedBranches) {
|
|
811
|
-
for (const ended of endedBranches) orphanBranches.push(ended);
|
|
812
|
-
if (singleNode) visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0];
|
|
813
|
-
}
|
|
814
|
-
if (visitType === "[") {
|
|
815
|
-
if (!endedBranches) {
|
|
816
|
-
branchScopesStack.push(curBranchScopes);
|
|
817
|
-
curBranchScopes = void 0;
|
|
818
|
-
}
|
|
819
|
-
branchStarts.push(visit);
|
|
820
|
-
} else deferredOwners.push(visitScope);
|
|
821
|
-
};
|
|
822
|
-
};
|
|
823
|
-
const nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
|
|
824
|
-
const processResumes = (resumes = [], effects) => {
|
|
825
|
-
let i = 0;
|
|
826
|
-
for (; i < resumes.length; i++) {
|
|
827
|
-
const serialized = resumes[i];
|
|
828
|
-
if (typeof serialized === "string") {
|
|
829
|
-
lastTokenIndex = 0;
|
|
830
|
-
visitText = serialized;
|
|
831
|
-
while (nextToken()) if (/\D/.test(lastToken)) lastEffect = registeredValues[lastToken];
|
|
832
|
-
else effects.push(lastEffect, getScope(lastToken));
|
|
833
|
-
} else if (Array.isArray(serialized)) {
|
|
834
|
-
if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
|
|
835
|
-
} else if (readyIds && typeof serialized === "number") break;
|
|
836
|
-
else {
|
|
837
|
-
const scopes = serialized(serializeContext);
|
|
838
|
-
if (Array.isArray(scopes)) applyScopes(scopes);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
resumes.splice(0, i);
|
|
842
|
-
return i;
|
|
843
|
-
};
|
|
844
|
-
let lastEffect;
|
|
845
|
-
let visits;
|
|
846
|
-
let visit;
|
|
847
|
-
let visitText;
|
|
848
|
-
let visitType;
|
|
849
|
-
let visitScope;
|
|
850
|
-
let lastToken;
|
|
851
|
-
let lastTokenIndex;
|
|
852
|
-
let visitBranches;
|
|
853
|
-
let embedAnchor;
|
|
854
|
-
serializeContext._ = registeredValues;
|
|
855
|
-
if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
|
|
856
|
-
render.m = (effects) => {
|
|
857
|
-
processResumes(render.r, effects);
|
|
858
|
-
if (readyIds && render.b) for (let progress = 1; progress;) {
|
|
859
|
-
progress = 0;
|
|
860
|
-
for (const readyId of readyIds) {
|
|
861
|
-
const resumes = render.b[readyId];
|
|
862
|
-
if (resumes && processResumes(resumes, effects)) progress = 1;
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
let retained = 0;
|
|
866
|
-
for (visit of visits = render.v) {
|
|
867
|
-
lastTokenIndex = render.i.length;
|
|
868
|
-
visitText = visit.data;
|
|
869
|
-
visitType = visitText[lastTokenIndex++];
|
|
870
|
-
visitScope = getScope(nextToken());
|
|
871
|
-
if (visitType === "*") {
|
|
872
|
-
const prev = visit.previousSibling;
|
|
873
|
-
visitScope[nextToken()] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
|
|
874
|
-
} else if (branchesEnabled) (visitBranches ||= createVisitBranches())();
|
|
875
|
-
else if (render.b) visits[retained++] = visit;
|
|
876
|
-
}
|
|
877
|
-
if (embedRenders && !embedAnchor && visit) embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]);
|
|
878
|
-
visits.length = retained;
|
|
879
|
-
return effects;
|
|
880
|
-
};
|
|
881
|
-
render.w = () => {
|
|
882
|
-
walk();
|
|
883
|
-
runResumeEffects(render);
|
|
884
|
-
};
|
|
885
|
-
return render;
|
|
886
|
-
}) });
|
|
887
|
-
};
|
|
888
|
-
if (renders) {
|
|
889
|
-
initRuntime(renders);
|
|
890
|
-
for (const renderId in renders) runResumeEffects(curRenders(renderId));
|
|
891
|
-
} else defineRuntime({
|
|
892
|
-
configurable: true,
|
|
893
|
-
set: initRuntime
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
let isResuming;
|
|
897
|
-
function runResumeEffects(render) {
|
|
898
|
-
try {
|
|
899
|
-
isResuming = 1;
|
|
900
|
-
runEffects(render.m([]), 1);
|
|
901
|
-
} finally {
|
|
902
|
-
isResuming = 0;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
function getRegisteredWithScope(id, scope) {
|
|
906
|
-
const val = registeredValues[id];
|
|
907
|
-
return scope ? val(scope) : val;
|
|
908
|
-
}
|
|
909
|
-
function _resume(id, obj) {
|
|
910
|
-
return registeredValues[id] = obj;
|
|
911
|
-
}
|
|
912
|
-
function _var_resume(id, signal) {
|
|
913
|
-
_resume(id, (scope) => (value) => signal(scope, value));
|
|
914
|
-
return signal;
|
|
915
|
-
}
|
|
916
|
-
function _el(id, accessor) {
|
|
917
|
-
return _resume(id, (scope) => () => _el_read(scope[accessor]));
|
|
918
|
-
}
|
|
919
|
-
//#endregion
|
|
920
|
-
//#region src/dom/renderer.ts
|
|
921
|
-
function createBranch($global, renderer, parentScope, parentNode) {
|
|
922
|
-
const branch = createScope($global);
|
|
923
|
-
branch["_"] = renderer["owner"] || parentScope;
|
|
924
|
-
setParentBranch(branch, parentScope?.[ClosestBranch]);
|
|
925
|
-
branch[Renderer] = renderer;
|
|
926
|
-
renderer[Clone]?.(branch, parentNode.namespaceURI);
|
|
927
|
-
return branch;
|
|
928
|
-
}
|
|
929
|
-
function setParentBranch(branch, parentBranch) {
|
|
930
|
-
if (parentBranch) {
|
|
931
|
-
branch[ParentBranch] = parentBranch;
|
|
932
|
-
(parentBranch[BranchScopes] ||= /* @__PURE__ */ new Set()).add(branch);
|
|
933
|
-
}
|
|
934
|
-
branch[ClosestBranch] = branch;
|
|
935
|
-
}
|
|
936
|
-
function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
937
|
-
return setupBranch(renderer, createBranch($global, renderer, parentScope, parentNode));
|
|
938
|
-
}
|
|
939
|
-
function setupBranch(renderer, branch) {
|
|
940
|
-
if (renderer["setup"]) queueRender(branch, renderer[Setup], -1);
|
|
941
|
-
return branch;
|
|
942
|
-
}
|
|
943
|
-
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
944
|
-
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
|
945
|
-
setup = setup ? setup._ || setup : void 0;
|
|
946
|
-
params ||= void 0;
|
|
947
|
-
const clone = template ? (branch, ns) => {
|
|
948
|
-
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(template, ns))(branch, walks);
|
|
949
|
-
} : (branch) => {
|
|
950
|
-
walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
|
|
951
|
-
};
|
|
952
|
-
return (owner) => {
|
|
953
|
-
return {
|
|
954
|
-
["id"]: id,
|
|
955
|
-
[Clone]: clone,
|
|
956
|
-
[Owner]: owner,
|
|
957
|
-
[Setup]: setup,
|
|
958
|
-
[Params]: params,
|
|
959
|
-
[Accessor]: dynamicScopesAccessor
|
|
960
|
-
};
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
964
|
-
return _resume(id, _content(id, template, walks, setup, params, dynamicScopesAccessor));
|
|
965
|
-
}
|
|
966
|
-
function _content_closures(renderer, closureFns) {
|
|
967
|
-
const closureSignals = {};
|
|
968
|
-
for (const key in closureFns) closureSignals[key] = _const(key, closureFns[key]);
|
|
969
|
-
return (owner, closureValues) => {
|
|
970
|
-
const instance = renderer(owner);
|
|
971
|
-
instance[LocalClosures] = closureSignals;
|
|
972
|
-
instance[LocalClosureValues] = closureValues;
|
|
973
|
-
return instance;
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
const cloneCache = {};
|
|
977
|
-
function createCloneableHTML(html, ns) {
|
|
978
|
-
const { firstChild, lastChild } = parseHTML(html, ns);
|
|
979
|
-
const parent = document.createElementNS(ns, "t");
|
|
980
|
-
insertChildNodes(parent, null, firstChild, lastChild);
|
|
981
|
-
return firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
|
|
982
|
-
walk(branch[StartNode] = branch[EndNode] = firstChild.cloneNode(true), walks, branch);
|
|
983
|
-
} : (branch, walks) => {
|
|
984
|
-
const clone = parent.cloneNode(true);
|
|
985
|
-
walk(clone.firstChild, walks, branch);
|
|
986
|
-
branch[StartNode] = clone.firstChild;
|
|
987
|
-
branch[EndNode] = clone.lastChild;
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
//#endregion
|
|
991
|
-
//#region src/dom/dom.ts
|
|
992
|
-
function _to_text(value) {
|
|
993
|
-
assertValidTextValue(value);
|
|
994
|
-
return value || value === 0 ? value + "" : "";
|
|
995
|
-
}
|
|
996
|
-
function _attr(element, name, value) {
|
|
997
|
-
assertValidAttrValue(name, value);
|
|
998
|
-
setAttribute(element, name, normalizeAttrValue(value));
|
|
999
|
-
}
|
|
1000
|
-
function setAttribute(element, name, value) {
|
|
1001
|
-
if (element.getAttribute(name) != value) if (value === void 0) element.removeAttribute(name);
|
|
1002
|
-
else element.setAttribute(name, value);
|
|
1003
|
-
}
|
|
1004
|
-
function _attr_class(element, value) {
|
|
1005
|
-
setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassObject) || void 0);
|
|
1006
|
-
}
|
|
1007
|
-
function _attr_class_items(element, items) {
|
|
1008
|
-
for (const key in items) _attr_class_item(element, key, items[key]);
|
|
1009
|
-
}
|
|
1010
|
-
function _attr_class_item(element, name, value) {
|
|
1011
|
-
element.classList.toggle(name, !!value);
|
|
1012
|
-
}
|
|
1013
|
-
function _attr_style(element, value) {
|
|
1014
|
-
setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleObject) || void 0);
|
|
1015
|
-
}
|
|
1016
|
-
function _attr_style_items(element, items) {
|
|
1017
|
-
for (const key in items) _attr_style_item(element, key, items[key]);
|
|
1018
|
-
}
|
|
1019
|
-
function _attr_style_item(element, name, value) {
|
|
1020
|
-
element.style.setProperty(name, _to_text(value));
|
|
1021
|
-
}
|
|
1022
|
-
function _style_shell(scope, nodeAccessor) {
|
|
1023
|
-
const element = scope[nodeAccessor];
|
|
1024
|
-
const id = _id(scope);
|
|
1025
|
-
_attr_nonce(scope, nodeAccessor);
|
|
1026
|
-
element.className = id;
|
|
1027
|
-
_text_content(element, "." + id + "~*{}");
|
|
1028
|
-
}
|
|
1029
|
-
function _style_rule_item(element, name, value) {
|
|
1030
|
-
const text = element.textContent;
|
|
1031
|
-
const decl = name + ":" + escapeStyleValue(_to_text(value)) + ";";
|
|
1032
|
-
let start = text.indexOf("{" + name + ":");
|
|
1033
|
-
if (!~start) start = text.indexOf(";" + name + ":");
|
|
1034
|
-
_text_content(element, ~start ? text.slice(0, ++start) + decl + text.slice(text.indexOf(";", start) + 1) : text.slice(0, -1) + decl + "}");
|
|
1035
|
-
}
|
|
1036
|
-
function _attr_nonce(scope, nodeAccessor) {
|
|
1037
|
-
_attr(scope[nodeAccessor], "nonce", scope[Global].cspNonce);
|
|
1038
|
-
}
|
|
1039
|
-
function _text(node, value) {
|
|
1040
|
-
const normalizedValue = _to_text(value);
|
|
1041
|
-
if (node.data !== normalizedValue) node.data = normalizedValue;
|
|
1042
|
-
}
|
|
1043
|
-
function _text_content(node, value) {
|
|
1044
|
-
const normalizedValue = _to_text(value);
|
|
1045
|
-
if (node.textContent !== normalizedValue) node.textContent = normalizedValue;
|
|
1046
|
-
}
|
|
1047
|
-
function _attrs(scope, nodeAccessor, nextAttrs, controllable) {
|
|
1048
|
-
const el = scope[nodeAccessor];
|
|
1049
|
-
for (let i = el.attributes.length; i--;) {
|
|
1050
|
-
const { name } = el.attributes.item(i);
|
|
1051
|
-
if (!(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) el.removeAttribute(name);
|
|
1052
|
-
}
|
|
1053
|
-
assertExclusiveAttrs(nextAttrs);
|
|
1054
|
-
attrsInternal(scope, nodeAccessor, nextAttrs, controllable);
|
|
1055
|
-
}
|
|
1056
|
-
function _attrs_content(scope, nodeAccessor, nextAttrs, controllable) {
|
|
1057
|
-
_attrs(scope, nodeAccessor, nextAttrs, controllable);
|
|
1058
|
-
_attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
1059
|
-
}
|
|
1060
|
-
function hasAttrAlias(element, attr, nextAttrs) {
|
|
1061
|
-
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
|
1062
|
-
}
|
|
1063
|
-
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
1064
|
-
const el = scope[nodeAccessor];
|
|
1065
|
-
const partial = {};
|
|
1066
|
-
for (let i = el.attributes.length; i--;) {
|
|
1067
|
-
const { name } = el.attributes.item(i);
|
|
1068
|
-
if (!skip[name] && !(nextAttrs && name in nextAttrs)) el.removeAttribute(name);
|
|
1069
|
-
}
|
|
1070
|
-
for (const name in nextAttrs) {
|
|
1071
|
-
const key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
1072
|
-
if (!skip[key]) partial[key] = nextAttrs[name];
|
|
1073
|
-
}
|
|
1074
|
-
assertExclusiveAttrs({
|
|
1075
|
-
...nextAttrs,
|
|
1076
|
-
...skip
|
|
1077
|
-
});
|
|
1078
|
-
attrsInternal(scope, nodeAccessor, partial, controllable);
|
|
1079
|
-
}
|
|
1080
|
-
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
1081
|
-
_attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable);
|
|
1082
|
-
_attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
1083
|
-
}
|
|
1084
|
-
function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
1085
|
-
const el = scope[nodeAccessor];
|
|
1086
|
-
let events = scope[EventAttributes + nodeAccessor];
|
|
1087
|
-
let skip = void 0;
|
|
1088
|
-
for (const name in events) events[name] = 0;
|
|
1089
|
-
if (controllable) {
|
|
1090
|
-
scope[ControlledType + nodeAccessor] = 5;
|
|
1091
|
-
scope[ControlledHandler + nodeAccessor] = 0;
|
|
1092
|
-
if (nextAttrs) skip = controllable(scope, nodeAccessor, nextAttrs);
|
|
1093
|
-
}
|
|
1094
|
-
for (const name in nextAttrs) {
|
|
1095
|
-
const value = nextAttrs[name];
|
|
1096
|
-
switch (name) {
|
|
1097
|
-
case "class":
|
|
1098
|
-
_attr_class(el, value);
|
|
1099
|
-
break;
|
|
1100
|
-
case "style":
|
|
1101
|
-
_attr_style(el, value);
|
|
1102
|
-
break;
|
|
1103
|
-
default:
|
|
1104
|
-
assertValidAttrName(name);
|
|
1105
|
-
if (isEventHandler(name)) (events ||= scope[EventAttributes + nodeAccessor] = {})[getEventHandlerName(name)] = value;
|
|
1106
|
-
else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) _attr(el, name, value);
|
|
1107
|
-
break;
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
function _attr_content(scope, nodeAccessor, value) {
|
|
1112
|
-
const content = normalizeClientRender(value);
|
|
1113
|
-
if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = content?.["id"])) {
|
|
1114
|
-
setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch);
|
|
1115
|
-
if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
|
|
1116
|
-
}
|
|
1117
|
-
for (const accessor in content?.[LocalClosures]) content[LocalClosures][accessor](scope[BranchScopes$1 + nodeAccessor], content[LocalClosureValues][accessor]);
|
|
1118
|
-
}
|
|
1119
|
-
function _attrs_script(scope, nodeAccessor) {
|
|
1120
|
-
const el = scope[nodeAccessor];
|
|
1121
|
-
const events = scope[EventAttributes + nodeAccessor];
|
|
1122
|
-
controllableScripts[scope[ControlledType + nodeAccessor]]?.(scope, nodeAccessor);
|
|
1123
|
-
for (const name in events) _on(el, name, events[name]);
|
|
1124
|
-
}
|
|
1125
|
-
function _html(scope, value, accessor) {
|
|
1126
|
-
const firstChild = scope[accessor];
|
|
1127
|
-
const parentNode = firstChild.parentNode;
|
|
1128
|
-
const lastChild = scope["DynamicHTMLLastChild:" + accessor] || firstChild;
|
|
1129
|
-
const newContent = parseHTML(_to_text(value), parentNode.namespaceURI);
|
|
1130
|
-
insertChildNodes(parentNode, firstChild, scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), scope[DynamicHTMLLastChild + accessor] = newContent.lastChild);
|
|
1131
|
-
removeChildNodes(firstChild, lastChild);
|
|
1132
|
-
}
|
|
1133
|
-
function normalizeClientRender(value) {
|
|
1134
|
-
const renderer = normalizeDynamicRenderer(value);
|
|
1135
|
-
if (renderer) if (renderer["id"]) return renderer;
|
|
1136
|
-
else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
|
|
1137
|
-
}
|
|
1138
|
-
function normalizeAttrValue(value) {
|
|
1139
|
-
if (isNotVoid(value)) return value === true ? "" : value + "";
|
|
1140
|
-
}
|
|
1141
|
-
function _lifecycle(scope, thisObj, index = 0) {
|
|
1142
|
-
const accessor = Lifecycle + index;
|
|
1143
|
-
const instance = scope[accessor];
|
|
1144
|
-
if (instance) {
|
|
1145
|
-
Object.assign(instance, thisObj);
|
|
1146
|
-
instance.onUpdate?.();
|
|
1147
|
-
} else {
|
|
1148
|
-
scope[accessor] = thisObj;
|
|
1149
|
-
{
|
|
1150
|
-
const snapshot = { ...thisObj };
|
|
1151
|
-
Object.assign(thisObj, thisObj.onMount?.());
|
|
1152
|
-
for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
|
|
1153
|
-
}
|
|
1154
|
-
$signal(scope, accessor).onabort = () => thisObj.onDestroy?.();
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
function removeChildNodes(startNode, endNode) {
|
|
1158
|
-
const stop = endNode.nextSibling;
|
|
1159
|
-
while (startNode !== stop) {
|
|
1160
|
-
const next = startNode.nextSibling;
|
|
1161
|
-
startNode.remove();
|
|
1162
|
-
startNode = next;
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
1166
|
-
if (parentNode.isConnected) parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
1167
|
-
else {
|
|
1168
|
-
const stop = endNode.nextSibling;
|
|
1169
|
-
while (startNode !== stop) {
|
|
1170
|
-
const next = startNode.nextSibling;
|
|
1171
|
-
parentNode.insertBefore(startNode, referenceNode);
|
|
1172
|
-
startNode = next;
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
return parentNode;
|
|
1176
|
-
}
|
|
1177
|
-
function toInsertNode(startNode, endNode) {
|
|
1178
|
-
return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
|
|
1179
|
-
}
|
|
1180
|
-
//#endregion
|
|
1181
|
-
//#region src/dom/resolve-cursor-position.ts
|
|
1182
|
-
const R = /[^\p{L}\p{N}]/gu;
|
|
1183
|
-
function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
|
|
1184
|
-
if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
|
|
1185
|
-
const before = initialValue.slice(0, initialPosition);
|
|
1186
|
-
const after = initialValue.slice(initialPosition);
|
|
1187
|
-
if (updatedValue.startsWith(before)) return initialPosition;
|
|
1188
|
-
if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
|
|
1189
|
-
let count = before.replace(R, "").length;
|
|
1190
|
-
let pos = 0;
|
|
1191
|
-
while (count && updatedValue[pos]) if (updatedValue[pos++].replace(R, "")) count--;
|
|
1192
|
-
return pos;
|
|
1193
|
-
}
|
|
1194
|
-
return -1;
|
|
1195
|
-
}
|
|
1196
|
-
//#endregion
|
|
1197
|
-
//#region src/dom/controllable.ts
|
|
1198
|
-
let inputType = "";
|
|
1199
|
-
function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
1200
|
-
const el = scope[nodeAccessor];
|
|
1201
|
-
const normalizedChecked = isNotVoid(checked);
|
|
1202
|
-
if (el.defaultChecked !== normalizedChecked) {
|
|
1203
|
-
const restoreValue = scope["#Gen"] < runId ? el.checked : normalizedChecked;
|
|
1204
|
-
el.defaultChecked = normalizedChecked;
|
|
1205
|
-
if (restoreValue !== normalizedChecked) el.checked = restoreValue;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
/** Filled by the latches a compiled page emits, so a page carries only the
|
|
1209
|
-
* control kinds its tags can be (`_attrs_script` resolves the kind at run time). */
|
|
1210
|
-
const controllableScripts = {};
|
|
1211
|
-
/** The render pass equivalent, for a tag whose name is only known at run time;
|
|
1212
|
-
* a statically named tag passes its claim to `_attrs` instead. */
|
|
1213
|
-
const controllableRenders = {};
|
|
1214
|
-
function _enable_controllable_input() {
|
|
1215
|
-
controllableScripts[0] = _attr_input_checked_script;
|
|
1216
|
-
controllableScripts[1] = _attr_input_checkedValue_script;
|
|
1217
|
-
controllableScripts[2] = _attr_input_value_script;
|
|
1218
|
-
}
|
|
1219
|
-
function _enable_controllable_textarea() {
|
|
1220
|
-
controllableScripts[2] = _attr_input_value_script;
|
|
1221
|
-
}
|
|
1222
|
-
function _enable_controllable_select() {
|
|
1223
|
-
controllableScripts[3] = _attr_select_value_script;
|
|
1224
|
-
}
|
|
1225
|
-
function _enable_controllable_open() {
|
|
1226
|
-
controllableScripts[4] = _attr_details_or_dialog_open_script;
|
|
1227
|
-
}
|
|
1228
|
-
/** A run-time tag name can be any controllable, so its page enables them all. */
|
|
1229
|
-
function _enable_controllable() {
|
|
1230
|
-
_enable_controllable_input();
|
|
1231
|
-
_enable_controllable_select();
|
|
1232
|
-
_enable_controllable_open();
|
|
1233
|
-
controllableRenders.INPUT = _controllable_input;
|
|
1234
|
-
controllableRenders.TEXTAREA = _controllable_textarea;
|
|
1235
|
-
controllableRenders.SELECT = _controllable_select;
|
|
1236
|
-
controllableRenders.DETAILS = controllableRenders.DIALOG = _controllable_open;
|
|
1237
|
-
}
|
|
1238
|
-
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
1239
|
-
const el = scope[nodeAccessor];
|
|
1240
|
-
const normalizedChecked = isNotVoid(checked);
|
|
1241
|
-
assertHandlerIsFunction("checkedChange", checkedChange);
|
|
1242
|
-
scope[ControlledHandler + nodeAccessor] = checkedChange;
|
|
1243
|
-
scope[ControlledType + nodeAccessor] = checkedChange ? 0 : 5;
|
|
1244
|
-
if (checkedChange && scope["#Gen"] < runId) el.checked = normalizedChecked;
|
|
1245
|
-
else _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
1246
|
-
}
|
|
1247
|
-
function _attr_input_checked_script(scope, nodeAccessor) {
|
|
1248
|
-
const el = scope[nodeAccessor];
|
|
1249
|
-
syncControllableFormInput(el, hasCheckboxChanged, () => {
|
|
1250
|
-
const checkedChange = scope[ControlledHandler + nodeAccessor];
|
|
1251
|
-
if (checkedChange) {
|
|
1252
|
-
const newValue = el.checked;
|
|
1253
|
-
el.checked = !newValue;
|
|
1254
|
-
checkedChange(newValue);
|
|
1255
|
-
run();
|
|
1256
|
-
}
|
|
1257
|
-
});
|
|
1258
|
-
}
|
|
1259
|
-
function _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, value) {
|
|
1260
|
-
const multiple = Array.isArray(checkedValue);
|
|
1261
|
-
const normalizedValue = normalizeStrProp(value);
|
|
1262
|
-
const normalizedCheckedValue = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
1263
|
-
_attr(scope[nodeAccessor], "value", value);
|
|
1264
|
-
_attr_input_checked_default(scope, nodeAccessor, multiple ? normalizedCheckedValue.includes(normalizedValue) : normalizedValue === normalizedCheckedValue);
|
|
1265
|
-
}
|
|
1266
|
-
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1267
|
-
const el = scope[nodeAccessor];
|
|
1268
|
-
const multiple = Array.isArray(checkedValue);
|
|
1269
|
-
const normalizedCheckedValue = scope[ControlledValue + nodeAccessor] = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
1270
|
-
assertHandlerIsFunction("checkedValueChange", checkedValueChange);
|
|
1271
|
-
scope[ControlledHandler + nodeAccessor] = checkedValueChange;
|
|
1272
|
-
scope[ControlledType + nodeAccessor] = checkedValueChange ? 1 : 5;
|
|
1273
|
-
if (checkedValueChange && scope["#Gen"] < runId) {
|
|
1274
|
-
el.checked = multiple ? normalizedCheckedValue.includes(normalizeStrProp(value)) : normalizeStrProp(value) === normalizedCheckedValue;
|
|
1275
|
-
_attr(el, "value", value);
|
|
1276
|
-
} else _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, value);
|
|
1277
|
-
}
|
|
1278
|
-
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
1279
|
-
const el = scope[nodeAccessor];
|
|
1280
|
-
if (isResuming && el.defaultChecked) if (scope["ControlledValue:" + nodeAccessor]) scope[ControlledValue + nodeAccessor].push(el.value);
|
|
1281
|
-
else scope[ControlledValue + nodeAccessor] = el.value;
|
|
1282
|
-
syncControllableFormInput(el, hasCheckboxChanged, () => {
|
|
1283
|
-
const checkedValueChange = scope[ControlledHandler + nodeAccessor];
|
|
1284
|
-
if (checkedValueChange) {
|
|
1285
|
-
const controlledValueKey = ControlledValue + nodeAccessor;
|
|
1286
|
-
const oldValue = scope[controlledValueKey];
|
|
1287
|
-
let newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
1288
|
-
if (el.name && el.type[0] === "r") {
|
|
1289
|
-
for (const radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) if (radio.form === el.form) {
|
|
1290
|
-
if (newValue === void 0 && radio.defaultChecked) newValue = radio.value;
|
|
1291
|
-
radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : controlledValueKey in scope ? oldValue === radio.value : radio.defaultChecked;
|
|
1292
|
-
}
|
|
1293
|
-
} else el.checked = !el.checked;
|
|
1294
|
-
checkedValueChange(newValue);
|
|
1295
|
-
run();
|
|
1296
|
-
}
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
1300
|
-
const el = scope[nodeAccessor];
|
|
1301
|
-
const normalizedValue = normalizeAttrValue(value) || "";
|
|
1302
|
-
if (el.defaultValue !== normalizedValue) {
|
|
1303
|
-
const restoreValue = scope["#Gen"] < runId ? el.value : normalizedValue;
|
|
1304
|
-
el.defaultValue = normalizedValue;
|
|
1305
|
-
setInputValue(el, restoreValue);
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
1309
|
-
const el = scope[nodeAccessor];
|
|
1310
|
-
if (/i[ot]|e[cns]|^[bi]/.test(el.type)) _attr(el, "value", value);
|
|
1311
|
-
else _attr_input_value_default(scope, nodeAccessor, value);
|
|
1312
|
-
}
|
|
1313
|
-
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
1314
|
-
const el = scope[nodeAccessor];
|
|
1315
|
-
const normalizedValue = normalizeAttrValue(value) || "";
|
|
1316
|
-
assertHandlerIsFunction("valueChange", valueChange);
|
|
1317
|
-
scope[ControlledHandler + nodeAccessor] = valueChange;
|
|
1318
|
-
scope[ControlledValue + nodeAccessor] = normalizedValue;
|
|
1319
|
-
scope[ControlledType + nodeAccessor] = valueChange ? 2 : 5;
|
|
1320
|
-
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
1321
|
-
else setDefault(scope, nodeAccessor, normalizedValue);
|
|
1322
|
-
}
|
|
1323
|
-
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
1324
|
-
_attr(scope[nodeAccessor], "value", value);
|
|
1325
|
-
}
|
|
1326
|
-
function _attr_input_value_script(scope, nodeAccessor) {
|
|
1327
|
-
const el = scope[nodeAccessor];
|
|
1328
|
-
if (isResuming) scope[ControlledValue + nodeAccessor] = el.defaultValue;
|
|
1329
|
-
syncControllableFormInput(el, hasValueChanged, (ev) => {
|
|
1330
|
-
const valueChange = scope[ControlledHandler + nodeAccessor];
|
|
1331
|
-
if (valueChange) {
|
|
1332
|
-
inputType = ev?.inputType;
|
|
1333
|
-
valueChange(el.value);
|
|
1334
|
-
run();
|
|
1335
|
-
setInputValue(el, scope[ControlledValue + nodeAccessor]);
|
|
1336
|
-
inputType = "";
|
|
1337
|
-
}
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
function setInputValue(el, value) {
|
|
1341
|
-
if (el.value !== value) {
|
|
1342
|
-
const updatedPosition = resolveCursorPosition(inputType, document.activeElement === el && el.selectionStart, el.value, el.value = value);
|
|
1343
|
-
if (~updatedPosition) el.setSelectionRange(updatedPosition, updatedPosition);
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
1347
|
-
let restoreValue;
|
|
1348
|
-
const el = scope[nodeAccessor];
|
|
1349
|
-
const live = scope[Gen$1] < runId;
|
|
1350
|
-
const multiple = Array.isArray(value);
|
|
1351
|
-
const normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
1352
|
-
pendingEffects.unshift(() => {
|
|
1353
|
-
for (const opt of el.options) {
|
|
1354
|
-
const selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
|
|
1355
|
-
if (opt.defaultSelected !== selected) {
|
|
1356
|
-
if (live) restoreValue ??= getSelectValue(el, multiple);
|
|
1357
|
-
opt.defaultSelected = selected;
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
if (restoreValue !== void 0) setSelectValue(el, restoreValue, multiple);
|
|
1361
|
-
}, scope);
|
|
1362
|
-
}
|
|
1363
|
-
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
|
1364
|
-
const el = scope[nodeAccessor];
|
|
1365
|
-
const existing = scope[Gen$1] < runId;
|
|
1366
|
-
const multiple = Array.isArray(value);
|
|
1367
|
-
const normalizedValue = scope[ControlledValue + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
1368
|
-
assertHandlerIsFunction("valueChange", valueChange);
|
|
1369
|
-
scope[ControlledHandler + nodeAccessor] = valueChange;
|
|
1370
|
-
scope[ControlledType + nodeAccessor] = valueChange ? 3 : 5;
|
|
1371
|
-
if (valueChange) pendingEffects.unshift(() => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
|
|
1372
|
-
if (valueChange && existing) pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope);
|
|
1373
|
-
else _attr_select_value_default(scope, nodeAccessor, normalizedValue);
|
|
1374
|
-
}
|
|
1375
|
-
function _attr_select_value_script(scope, nodeAccessor) {
|
|
1376
|
-
const el = scope[nodeAccessor];
|
|
1377
|
-
const onChange = () => {
|
|
1378
|
-
const valueChange = scope[ControlledHandler + nodeAccessor];
|
|
1379
|
-
if (valueChange) {
|
|
1380
|
-
const oldValue = scope[ControlledValue + nodeAccessor];
|
|
1381
|
-
const multiple = Array.isArray(oldValue);
|
|
1382
|
-
const newValue = getSelectValue(el, multiple);
|
|
1383
|
-
setSelectValue(el, oldValue, multiple);
|
|
1384
|
-
valueChange(newValue);
|
|
1385
|
-
run();
|
|
1386
|
-
}
|
|
1387
|
-
};
|
|
1388
|
-
if (isResuming) if (el.multiple) {
|
|
1389
|
-
scope[ControlledValue + nodeAccessor] = [];
|
|
1390
|
-
for (const opt of el.options) if (opt.defaultSelected) scope[ControlledValue + nodeAccessor].push(opt.value);
|
|
1391
|
-
} else {
|
|
1392
|
-
scope[ControlledValue + nodeAccessor] = "";
|
|
1393
|
-
for (const opt of el.options) if (opt.defaultSelected) {
|
|
1394
|
-
scope[ControlledValue + nodeAccessor] = opt.value;
|
|
1395
|
-
break;
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
syncControllableFormInput(el, hasSelectChanged, onChange);
|
|
1399
|
-
observeOnce(scope, nodeAccessor, {
|
|
1400
|
-
childList: true,
|
|
1401
|
-
subtree: true
|
|
1402
|
-
}, () => {
|
|
1403
|
-
const value = scope[ControlledValue + nodeAccessor];
|
|
1404
|
-
if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) onChange();
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
function setSelectValue(el, value, multiple) {
|
|
1408
|
-
if (multiple) for (const opt of el.options) opt.selected = value.includes(opt.value);
|
|
1409
|
-
else el.value = value;
|
|
1410
|
-
}
|
|
1411
|
-
function getSelectValue(el, multiple) {
|
|
1412
|
-
return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
|
|
1413
|
-
}
|
|
1414
|
-
function assertSelectValueMatchesOption(el, normalizedValue, value) {
|
|
1415
|
-
const multiple = Array.isArray(normalizedValue);
|
|
1416
|
-
if (multiple ? normalizedValue.some(Boolean) : normalizedValue) {
|
|
1417
|
-
for (const opt of el.options) if (multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue) return;
|
|
1418
|
-
console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
|
|
1422
|
-
if (scope["#Gen"] === runId) scope[nodeAccessor].open = isNotVoid(open);
|
|
1423
|
-
}
|
|
1424
|
-
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
1425
|
-
const normalizedOpen = scope[ControlledValue + nodeAccessor] = isNotVoid(open);
|
|
1426
|
-
assertHandlerIsFunction("openChange", openChange);
|
|
1427
|
-
scope[ControlledHandler + nodeAccessor] = openChange;
|
|
1428
|
-
scope[ControlledType + nodeAccessor] = openChange ? 4 : 5;
|
|
1429
|
-
if (openChange && scope["#Gen"] < runId) scope[nodeAccessor].open = normalizedOpen;
|
|
1430
|
-
else _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
|
|
1431
|
-
}
|
|
1432
|
-
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
1433
|
-
const el = scope[nodeAccessor];
|
|
1434
|
-
observeOnce(scope, nodeAccessor, {
|
|
1435
|
-
attributes: true,
|
|
1436
|
-
attributeFilter: ["open"]
|
|
1437
|
-
}, () => {
|
|
1438
|
-
const openChange = scope[ControlledHandler + nodeAccessor];
|
|
1439
|
-
if (openChange && el.open === !scope["ControlledValue:" + nodeAccessor]) {
|
|
1440
|
-
const newValue = el.open;
|
|
1441
|
-
el.open = !newValue;
|
|
1442
|
-
openChange(newValue);
|
|
1443
|
-
run();
|
|
1444
|
-
}
|
|
1445
|
-
});
|
|
1446
|
-
}
|
|
1447
|
-
function observeOnce(scope, nodeAccessor, init, callback) {
|
|
1448
|
-
(scope[ControlledObserver + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
|
|
1449
|
-
}
|
|
1450
|
-
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
1451
|
-
el._ = onChange;
|
|
1452
|
-
delegate("input", handleChange);
|
|
1453
|
-
if (el.form) delegate("reset", handleFormReset);
|
|
1454
|
-
if (isResuming && hasChanged(el)) queueMicrotask(onChange);
|
|
1455
|
-
}
|
|
1456
|
-
function handleChange(ev) {
|
|
1457
|
-
ev.target._?.(ev);
|
|
1458
|
-
}
|
|
1459
|
-
function handleFormReset(ev) {
|
|
1460
|
-
const handlers = [];
|
|
1461
|
-
for (const el of ev.target.elements) if (el._ && hasFormElementChanged(el)) handlers.push(el._);
|
|
1462
|
-
requestAnimationFrame(() => {
|
|
1463
|
-
if (!ev.defaultPrevented) for (const change of handlers) change();
|
|
1464
|
-
});
|
|
1465
|
-
}
|
|
1466
|
-
function hasValueChanged(el) {
|
|
1467
|
-
return el.value !== el.defaultValue;
|
|
1468
|
-
}
|
|
1469
|
-
function hasCheckboxChanged(el) {
|
|
1470
|
-
return el.checked !== el.defaultChecked;
|
|
1471
|
-
}
|
|
1472
|
-
function hasSelectChanged(el) {
|
|
1473
|
-
for (const opt of el.options) if (opt.selected !== opt.defaultSelected) return true;
|
|
1474
|
-
}
|
|
1475
|
-
function hasFormElementChanged(el) {
|
|
1476
|
-
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
|
1477
|
-
}
|
|
1478
|
-
function normalizeStrProp(value) {
|
|
1479
|
-
return normalizeAttrValue(value) || "";
|
|
1480
|
-
}
|
|
1481
|
-
function updateList(arr, val, push) {
|
|
1482
|
-
const index = arr.indexOf(val);
|
|
1483
|
-
return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
|
|
1484
|
-
}
|
|
1485
|
-
function _controllable_input(scope, nodeAccessor, nextAttrs) {
|
|
1486
|
-
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
|
|
1487
|
-
_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
|
|
1488
|
-
return /^checked(?:Value)?(?:Change)?$/;
|
|
1489
|
-
}
|
|
1490
|
-
if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
|
|
1491
|
-
_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
|
|
1492
|
-
return /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1493
|
-
}
|
|
1494
|
-
return _controllable_textarea(scope, nodeAccessor, nextAttrs, _attr_input_value_dynamic_default);
|
|
1495
|
-
}
|
|
1496
|
-
function _controllable_textarea(scope, nodeAccessor, nextAttrs, dynamicDefault) {
|
|
1497
|
-
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1498
|
-
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, dynamicDefault);
|
|
1499
|
-
return /^value(?:Change)?$/;
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
function _controllable_select(scope, nodeAccessor, nextAttrs) {
|
|
1503
|
-
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1504
|
-
_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1505
|
-
return /^value(?:Change)?$/;
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
1509
|
-
if ("open" in nextAttrs || "openChange" in nextAttrs) {
|
|
1510
|
-
_attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange);
|
|
1511
|
-
return /^open(?:Change)?$/;
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
//#endregion
|
|
1515
|
-
//#region src/dom/control-flow.ts
|
|
1516
|
-
function _await_promise(nodeAccessor, params) {
|
|
1517
|
-
const promiseAccessor = Promise$1 + nodeAccessor;
|
|
1518
|
-
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
1519
|
-
_enable_catch();
|
|
1520
|
-
const resolveAwait = (scope, referenceNode, value) => {
|
|
1521
|
-
const awaitBranch = scope[branchAccessor];
|
|
1522
|
-
if (awaitBranch["#DetachedAwait"]) {
|
|
1523
|
-
awaitBranch[PendingScopes] = awaitBranch[PendingScopes]?.forEach(syncGen);
|
|
1524
|
-
setupBranch(awaitBranch[DetachedAwait], awaitBranch);
|
|
1525
|
-
awaitBranch[DetachedAwait] = 0;
|
|
1526
|
-
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
1527
|
-
referenceNode.remove();
|
|
1528
|
-
}
|
|
1529
|
-
params?.(awaitBranch, [value]);
|
|
1530
|
-
return awaitBranch;
|
|
1531
|
-
};
|
|
1532
|
-
const awaitPromise = (scope, promise) => {
|
|
1533
|
-
if (!isPromise(promise) && scope[promiseAccessor]) promise = Promise.resolve(promise);
|
|
1534
|
-
let awaitBranch = scope[branchAccessor];
|
|
1535
|
-
const tryPlaceholder = findBranchWithKey(scope, PlaceholderContent);
|
|
1536
|
-
const tryBranch = tryPlaceholder || awaitBranch;
|
|
1537
|
-
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
1538
|
-
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
1539
|
-
return;
|
|
1540
|
-
}
|
|
1541
|
-
if (!isPromise(promise)) {
|
|
1542
|
-
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1543
|
-
return;
|
|
1544
|
-
}
|
|
1545
|
-
let awaitCounter = tryBranch[AwaitCounter];
|
|
1546
|
-
placeholderShown.add(pendingEffects);
|
|
1547
|
-
if (!tryPlaceholder && !awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
1548
|
-
if (tryBranch === scope[branchAccessor]) {
|
|
1549
|
-
const anchor = scope[nodeAccessor];
|
|
1550
|
-
if (anchor.parentNode) {
|
|
1551
|
-
const detachedParent = scope[branchAccessor][StartNode].parentNode;
|
|
1552
|
-
if (detachedParent === anchor.parentNode) anchor.remove();
|
|
1553
|
-
else anchor.replaceWith(detachedParent);
|
|
1554
|
-
}
|
|
1555
|
-
} else dismissPlaceholder(tryBranch);
|
|
1556
|
-
});
|
|
1557
|
-
if (!scope[promiseAccessor]) {
|
|
1558
|
-
if (awaitBranch) awaitBranch[PendingRenders] ||= [];
|
|
1559
|
-
if (tryPlaceholder) awaitCounter = addAwaitCounter(scope, tryPlaceholder);
|
|
1560
|
-
else if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
1561
|
-
if (!awaitBranch["#DetachedAwait"]) {
|
|
1562
|
-
awaitBranch["#StartNode"].parentNode.insertBefore(scope[nodeAccessor], awaitBranch["#StartNode"]);
|
|
1563
|
-
tempDetachBranch(tryBranch);
|
|
1564
|
-
}
|
|
1565
|
-
}, -1))));
|
|
1566
|
-
}
|
|
1567
|
-
const thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1568
|
-
if (thisPromise === scope[promiseAccessor]) {
|
|
1569
|
-
const referenceNode = scope[nodeAccessor];
|
|
1570
|
-
scope[promiseAccessor] = 0;
|
|
1571
|
-
if (scope["#ClosestBranch"]?.["#Gen"] === 0) {
|
|
1572
|
-
awaitCounter.c();
|
|
1573
|
-
run();
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
queueAsyncRender(scope, () => {
|
|
1577
|
-
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1578
|
-
const pendingRenders = awaitBranch[PendingRenders];
|
|
1579
|
-
awaitBranch[PendingRenders] = 0;
|
|
1580
|
-
pendingRenders?.forEach(queuePendingRender);
|
|
1581
|
-
placeholderShown.add(pendingEffects);
|
|
1582
|
-
awaitCounter.c();
|
|
1583
|
-
if (awaitCounter.m) {
|
|
1584
|
-
const fnScopes = /* @__PURE__ */ new Map();
|
|
1585
|
-
const effects = awaitCounter.m([]);
|
|
1586
|
-
for (let i = 0; i < pendingEffects.length;) {
|
|
1587
|
-
const fn = pendingEffects[i++];
|
|
1588
|
-
let scopes = fnScopes.get(fn);
|
|
1589
|
-
if (!scopes) fnScopes.set(fn, scopes = /* @__PURE__ */ new Set());
|
|
1590
|
-
scopes.add(pendingEffects[i++]);
|
|
1591
|
-
}
|
|
1592
|
-
for (let i = 0; i < effects.length;) {
|
|
1593
|
-
const fn = effects[i++];
|
|
1594
|
-
const scope = effects[i++];
|
|
1595
|
-
if (!fnScopes.get(fn)?.has(scope)) queueEffect(scope, fn);
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
});
|
|
1599
|
-
}
|
|
1600
|
-
}, (error) => {
|
|
1601
|
-
if (thisPromise === scope[promiseAccessor]) {
|
|
1602
|
-
scope[promiseAccessor] = 0;
|
|
1603
|
-
if (tryPlaceholder && !awaitCounter.m) awaitCounter.c();
|
|
1604
|
-
else awaitCounter.i = 0;
|
|
1605
|
-
queueAsyncRender(scope, renderCatch, error);
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
};
|
|
1609
|
-
return awaitPromise;
|
|
1610
|
-
}
|
|
1611
|
-
function _await_content(nodeAccessor, template, walks, setup) {
|
|
1612
|
-
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
1613
|
-
const promiseAccessor = Promise$1 + nodeAccessor;
|
|
1614
|
-
const renderer = _content("", template, walks, setup)();
|
|
1615
|
-
return (scope) => {
|
|
1616
|
-
const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
|
|
1617
|
-
scope[branchAccessor][PendingScopes] = pendingScopes;
|
|
1618
|
-
const resolveSync = scope[promiseAccessor];
|
|
1619
|
-
if (typeof resolveSync === "function") {
|
|
1620
|
-
scope[promiseAccessor] = 0;
|
|
1621
|
-
resolveSync();
|
|
1622
|
-
}
|
|
1623
|
-
};
|
|
1624
|
-
}
|
|
1625
|
-
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, PlaceholderContent)) {
|
|
1626
|
-
if (!tryBranch) return;
|
|
1627
|
-
let awaitCounter = tryBranch[AwaitCounter];
|
|
1628
|
-
if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
|
|
1629
|
-
placeholderShown.add(pendingEffects);
|
|
1630
|
-
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1631
|
-
insertBranchBefore(tryBranch["#PlaceholderBranch"] = createAndSetupBranch(tryBranch["$global"], tryBranch["#PlaceholderContent"], tryBranch["_"], tryBranch["#StartNode"].parentNode), tryBranch["#StartNode"].parentNode, tryBranch["#StartNode"]);
|
|
1632
|
-
tempDetachBranch(tryBranch);
|
|
1633
|
-
}, -1))));
|
|
1634
|
-
return awaitCounter;
|
|
1635
|
-
}
|
|
1636
|
-
function createAwaitCounter(tryBranch, done) {
|
|
1637
|
-
const awaitCounter = tryBranch[AwaitCounter] = {
|
|
1638
|
-
i: 0,
|
|
1639
|
-
c() {
|
|
1640
|
-
if (--awaitCounter.i) return 1;
|
|
1641
|
-
done();
|
|
1642
|
-
queueEffect(tryBranch, runPendingEffects);
|
|
1643
|
-
}
|
|
1644
|
-
};
|
|
1645
|
-
return awaitCounter;
|
|
1646
|
-
}
|
|
1647
|
-
function runPendingEffects(scope) {
|
|
1648
|
-
const effects = scope[PendingEffects];
|
|
1649
|
-
if (effects) {
|
|
1650
|
-
scope[PendingEffects] = [];
|
|
1651
|
-
runEffects(effects, 1);
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
function dismissPlaceholder(tryBranch) {
|
|
1655
|
-
const placeholderBranch = tryBranch[PlaceholderBranch];
|
|
1656
|
-
if (placeholderBranch) {
|
|
1657
|
-
tryBranch[PlaceholderBranch] = 0;
|
|
1658
|
-
placeholderBranch[StartNode].parentNode.insertBefore(tryBranch[StartNode].parentNode, placeholderBranch[StartNode]);
|
|
1659
|
-
removeAndDestroyBranch(placeholderBranch);
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
function _try(nodeAccessor, template, walks, setup) {
|
|
1663
|
-
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
1664
|
-
const renderer = _content("", template, walks, setup)();
|
|
1665
|
-
return (scope, input) => {
|
|
1666
|
-
if (!scope[branchAccessor]) setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1667
|
-
const branch = scope[branchAccessor];
|
|
1668
|
-
if (branch) {
|
|
1669
|
-
branch[BranchAccessor] = nodeAccessor;
|
|
1670
|
-
branch[CatchContent] = input.catch && (normalizeDynamicRenderer(input.catch) || 0);
|
|
1671
|
-
branch[PlaceholderContent] = normalizeDynamicRenderer(input.placeholder);
|
|
1672
|
-
}
|
|
1673
|
-
};
|
|
1674
|
-
}
|
|
1675
|
-
function renderCatch(scope, error) {
|
|
1676
|
-
const tryWithCatch = findBranchWithKey(scope, CatchContent);
|
|
1677
|
-
if (!tryWithCatch) throw error;
|
|
1678
|
-
else {
|
|
1679
|
-
const owner = tryWithCatch["_"];
|
|
1680
|
-
const placeholderBranch = tryWithCatch[PlaceholderBranch];
|
|
1681
|
-
if (placeholderBranch) {
|
|
1682
|
-
if (tryWithCatch["#AwaitCounter"]) tryWithCatch[AwaitCounter].i = 0;
|
|
1683
|
-
owner[BranchScopes$1 + tryWithCatch[BranchAccessor]] = placeholderBranch;
|
|
1684
|
-
destroyBranch(tryWithCatch);
|
|
1685
|
-
}
|
|
1686
|
-
caughtError.add(pendingEffects);
|
|
1687
|
-
setConditionalRenderer(owner, tryWithCatch[BranchAccessor], tryWithCatch[CatchContent], createAndSetupBranch);
|
|
1688
|
-
tryWithCatch[CatchContent]?.[Params]?.(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], [error]);
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
function _if(nodeAccessor, ...branchesArgs) {
|
|
1692
|
-
const branchAccessor = ConditionalRenderer + nodeAccessor;
|
|
1693
|
-
const branches = [];
|
|
1694
|
-
let i = 0;
|
|
1695
|
-
while (i < branchesArgs.length) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
|
|
1696
|
-
enableBranches();
|
|
1697
|
-
return (scope, newBranch) => {
|
|
1698
|
-
if (newBranch !== (scope[branchAccessor] ?? (scope["BranchScopes:" + nodeAccessor] && 0))) setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
|
|
1699
|
-
};
|
|
1700
|
-
}
|
|
1701
|
-
function _show(nodeAccessor, startNodeAccessor, endNodeAccessor) {
|
|
1702
|
-
const rangeAccessor = BranchScopes$1 + nodeAccessor;
|
|
1703
|
-
enableBranches();
|
|
1704
|
-
return (scope, display) => {
|
|
1705
|
-
const referenceNode = scope[nodeAccessor];
|
|
1706
|
-
const onlyChild = referenceNode.nodeType === 1;
|
|
1707
|
-
const parentNode = onlyChild ? referenceNode : referenceNode.parentNode;
|
|
1708
|
-
let range = scope[rangeAccessor];
|
|
1709
|
-
if (!range) {
|
|
1710
|
-
range = scope[rangeAccessor] = {};
|
|
1711
|
-
range[StartNode] = onlyChild ? parentNode.firstChild : scope[startNodeAccessor];
|
|
1712
|
-
range[EndNode] = onlyChild ? parentNode.lastChild : endNodeAccessor === void 0 ? referenceNode.previousSibling : scope[endNodeAccessor];
|
|
1713
|
-
}
|
|
1714
|
-
let startNode = range[StartNode];
|
|
1715
|
-
if (range["#Id"] && startNode === range["#EndNode"] && startNode.tagName === "T") {
|
|
1716
|
-
const wrapper = startNode;
|
|
1717
|
-
if (!wrapper.firstChild) wrapper.appendChild(new Text());
|
|
1718
|
-
range = scope[rangeAccessor] = {};
|
|
1719
|
-
range[StartNode] = startNode = wrapper.firstChild;
|
|
1720
|
-
range[EndNode] = wrapper.lastChild;
|
|
1721
|
-
wrapper.replaceWith(...wrapper.childNodes);
|
|
1722
|
-
}
|
|
1723
|
-
const inDom = onlyChild ? !!parentNode.firstChild : startNode.parentNode === parentNode;
|
|
1724
|
-
if (display) {
|
|
1725
|
-
if (!inDom) insertBranchBefore(range, parentNode, onlyChild ? null : referenceNode);
|
|
1726
|
-
} else if (inDom) {
|
|
1727
|
-
if (onlyChild) {
|
|
1728
|
-
range[StartNode] = parentNode.firstChild;
|
|
1729
|
-
range[EndNode] = parentNode.lastChild;
|
|
1730
|
-
}
|
|
1731
|
-
tempDetachBranch(range);
|
|
1732
|
-
}
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
function patchDynamicTag(fn) {
|
|
1736
|
-
_dynamic_tag = fn(_dynamic_tag);
|
|
1737
|
-
}
|
|
1738
|
-
let _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1739
|
-
const childScopeAccessor = BranchScopes$1 + nodeAccessor;
|
|
1740
|
-
const rendererAccessor = ConditionalRenderer + nodeAccessor;
|
|
1741
|
-
enableBranches();
|
|
1742
|
-
return (scope, newRenderer, getInput) => {
|
|
1743
|
-
const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
|
1744
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.["id"] || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
|
|
1745
|
-
setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer);
|
|
1746
|
-
if (getTagVar) scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
|
|
1747
|
-
if (typeof normalizedRenderer === "string") {
|
|
1748
|
-
if (getContent) {
|
|
1749
|
-
const content = getContent(scope);
|
|
1750
|
-
setConditionalRenderer(scope[childScopeAccessor], `#${normalizedRenderer}/0`, content, createAndSetupBranch);
|
|
1751
|
-
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${normalizedRenderer}/0`]);
|
|
1752
|
-
}
|
|
1753
|
-
} else if (normalizedRenderer?.["accessor"]) subscribeToScopeSet(normalizedRenderer[Owner], normalizedRenderer[Accessor], scope[childScopeAccessor]);
|
|
1754
|
-
}
|
|
1755
|
-
if (normalizedRenderer) {
|
|
1756
|
-
const childScope = scope[childScopeAccessor];
|
|
1757
|
-
const args = getInput?.();
|
|
1758
|
-
if (typeof normalizedRenderer === "string") {
|
|
1759
|
-
const nodeAccessor = `#${normalizedRenderer}/0`;
|
|
1760
|
-
(getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope[nodeAccessor].tagName]);
|
|
1761
|
-
if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
|
|
1762
|
-
} else {
|
|
1763
|
-
for (const accessor in normalizedRenderer[LocalClosures]) normalizedRenderer[LocalClosures][accessor](childScope, normalizedRenderer[LocalClosureValues][accessor]);
|
|
1764
|
-
if (normalizedRenderer["params"]) if (inputIsArgs) normalizedRenderer[Params](childScope, normalizedRenderer._ ? args[0] : args);
|
|
1765
|
-
else {
|
|
1766
|
-
const inputWithContent = getContent ? {
|
|
1767
|
-
...args,
|
|
1768
|
-
content: getContent(scope)
|
|
1769
|
-
} : args || {};
|
|
1770
|
-
normalizedRenderer[Params](childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
};
|
|
1775
|
-
};
|
|
1776
|
-
function _dynamic_tag_content(nodeAccessor) {
|
|
1777
|
-
const childScopeAccessor = BranchScopes$1 + nodeAccessor;
|
|
1778
|
-
const rendererAccessor = ConditionalRenderer + nodeAccessor;
|
|
1779
|
-
enableBranches();
|
|
1780
|
-
return (scope, renderer) => {
|
|
1781
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.["id"] || renderer)) {
|
|
1782
|
-
setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1783
|
-
if (renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
|
|
1784
|
-
}
|
|
1785
|
-
if (renderer) for (const accessor in renderer[LocalClosures]) renderer[LocalClosures][accessor](scope[childScopeAccessor], renderer[LocalClosureValues][accessor]);
|
|
1786
|
-
};
|
|
1787
|
-
}
|
|
1788
|
-
function _resume_dynamic_tag() {
|
|
1789
|
-
_resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
|
|
1790
|
-
}
|
|
1791
|
-
function dynamicTagScript(branch) {
|
|
1792
|
-
_attrs_script(branch, `#${branch[Renderer]}/0`);
|
|
1793
|
-
}
|
|
1794
|
-
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch) {
|
|
1795
|
-
const referenceNode = scope[nodeAccessor];
|
|
1796
|
-
const prevBranch = scope[BranchScopes$1 + nodeAccessor];
|
|
1797
|
-
const parentNode = referenceNode.nodeType > 1 ? (prevBranch?.["#StartNode"] || referenceNode).parentNode : referenceNode;
|
|
1798
|
-
const newBranch = scope[BranchScopes$1 + nodeAccessor] = newRenderer && createBranch(scope["$global"], newRenderer, scope, parentNode);
|
|
1799
|
-
if (referenceNode === parentNode) {
|
|
1800
|
-
if (prevBranch) {
|
|
1801
|
-
destroyBranch(prevBranch);
|
|
1802
|
-
referenceNode.textContent = "";
|
|
1803
|
-
}
|
|
1804
|
-
if (newBranch) insertBranchBefore(newBranch, parentNode, null);
|
|
1805
|
-
} else if (prevBranch) {
|
|
1806
|
-
if (newBranch) insertBranchBefore(newBranch, parentNode, prevBranch[StartNode]);
|
|
1807
|
-
else parentNode.insertBefore(referenceNode, prevBranch[StartNode]);
|
|
1808
|
-
removeAndDestroyBranch(prevBranch);
|
|
1809
|
-
} else if (newBranch) {
|
|
1810
|
-
insertBranchBefore(newBranch, parentNode, referenceNode);
|
|
1811
|
-
referenceNode.remove();
|
|
1812
|
-
}
|
|
1813
|
-
}
|
|
1814
|
-
const _for_of = /* @__PURE__ */ loop(([all, by = bySecondArg], cb) => {
|
|
1815
|
-
if (typeof by === "string") forOf(all, (item, i) => cb(item[by], [item, i]));
|
|
1816
|
-
else forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
1817
|
-
});
|
|
1818
|
-
const _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value])));
|
|
1819
|
-
const _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v])));
|
|
1820
|
-
const _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v])));
|
|
1821
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1822
|
-
function loop(forEach) {
|
|
1823
|
-
return (nodeAccessor, template, walks, setup, params) => {
|
|
1824
|
-
const scopesAccessor = BranchScopes$1 + nodeAccessor;
|
|
1825
|
-
const keyedScopesAccessor = KeyedScopes + nodeAccessor;
|
|
1826
|
-
const renderer = _content("", template, walks, setup)();
|
|
1827
|
-
enableBranches();
|
|
1828
|
-
return (scope, value) => {
|
|
1829
|
-
const referenceNode = scope[nodeAccessor];
|
|
1830
|
-
const oldScopes = toArray(scope[scopesAccessor]);
|
|
1831
|
-
const newScopes = scope[scopesAccessor] = [];
|
|
1832
|
-
scope[keyedScopesAccessor] = null;
|
|
1833
|
-
const oldLen = oldScopes.length;
|
|
1834
|
-
const parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.["#StartNode"].parentNode : referenceNode;
|
|
1835
|
-
let oldScopesByKey;
|
|
1836
|
-
let hasPotentialMoves;
|
|
1837
|
-
let start = 0;
|
|
1838
|
-
var seenKeys = /* @__PURE__ */ new Set();
|
|
1839
|
-
forEach(value, (key, args) => {
|
|
1840
|
-
assertValidLoopKey(key, seenKeys);
|
|
1841
|
-
const i = newScopes.length;
|
|
1842
|
-
const oldScope = oldScopes[i];
|
|
1843
|
-
let branch = oldLen && (oldScopesByKey || key !== (oldScope?.["#LoopKey"] ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope["#LoopIndex"] = j, map.set(scope["#LoopKey"] ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
1844
|
-
if (branch) {
|
|
1845
|
-
hasPotentialMoves = true;
|
|
1846
|
-
oldScopesByKey?.delete(key);
|
|
1847
|
-
} else branch = createAndSetupBranch(scope[Global], renderer, scope, parentNode);
|
|
1848
|
-
branch[LoopKey] = key;
|
|
1849
|
-
newScopes.push(branch);
|
|
1850
|
-
params?.(branch, args);
|
|
1851
|
-
});
|
|
1852
|
-
const newLen = newScopes.length;
|
|
1853
|
-
const hasSiblings = referenceNode !== parentNode;
|
|
1854
|
-
let afterReference = null;
|
|
1855
|
-
let oldEnd = oldLen - 1;
|
|
1856
|
-
let newEnd = newLen - 1;
|
|
1857
|
-
if (hasSiblings) {
|
|
1858
|
-
if (oldLen) {
|
|
1859
|
-
afterReference = oldScopes[oldEnd][EndNode].nextSibling;
|
|
1860
|
-
if (!newLen) parentNode.insertBefore(referenceNode, afterReference);
|
|
1861
|
-
} else if (newLen) {
|
|
1862
|
-
afterReference = referenceNode.nextSibling;
|
|
1863
|
-
referenceNode.remove();
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
if (!hasPotentialMoves) {
|
|
1867
|
-
if (oldLen) {
|
|
1868
|
-
oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch);
|
|
1869
|
-
if (!hasSiblings) parentNode.textContent = "";
|
|
1870
|
-
}
|
|
1871
|
-
for (const newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
|
|
1872
|
-
return;
|
|
1873
|
-
}
|
|
1874
|
-
if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
|
|
1875
|
-
else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
|
|
1876
|
-
while (oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd]) {
|
|
1877
|
-
oldEnd--;
|
|
1878
|
-
newEnd--;
|
|
1879
|
-
}
|
|
1880
|
-
if (oldEnd + 1 < oldLen) afterReference = oldScopes[oldEnd + 1][StartNode];
|
|
1881
|
-
if (start > oldEnd || start > newEnd) {
|
|
1882
|
-
for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
1883
|
-
return;
|
|
1884
|
-
}
|
|
1885
|
-
const diffLen = newEnd - start + 1;
|
|
1886
|
-
const sources = new Array(diffLen);
|
|
1887
|
-
const pred = new Array(diffLen);
|
|
1888
|
-
const tails = [];
|
|
1889
|
-
let tail = -1;
|
|
1890
|
-
let lo;
|
|
1891
|
-
let hi;
|
|
1892
|
-
let mid;
|
|
1893
|
-
for (let i = diffLen; i--;) sources[i] = newScopes[start + i]["#LoopIndex"] ?? -1;
|
|
1894
|
-
for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) {
|
|
1895
|
-
if (~tail) pred[i] = tails[tail];
|
|
1896
|
-
tails[++tail] = i;
|
|
1897
|
-
} else {
|
|
1898
|
-
lo = 0;
|
|
1899
|
-
hi = tail;
|
|
1900
|
-
while (lo < hi) {
|
|
1901
|
-
mid = (lo + hi) / 2 | 0;
|
|
1902
|
-
if (sources[tails[mid]] < sources[i]) lo = mid + 1;
|
|
1903
|
-
else hi = mid;
|
|
1904
|
-
}
|
|
1905
|
-
if (sources[i] < sources[tails[lo]]) {
|
|
1906
|
-
if (lo > 0) pred[i] = tails[lo - 1];
|
|
1907
|
-
tails[lo] = i;
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
hi = tails[tail];
|
|
1911
|
-
lo = tail + 1;
|
|
1912
|
-
while (lo-- > 0) {
|
|
1913
|
-
tails[lo] = hi;
|
|
1914
|
-
hi = pred[hi];
|
|
1915
|
-
}
|
|
1916
|
-
for (let i = diffLen; i--;) {
|
|
1917
|
-
if (~tail && i === tails[tail]) tail--;
|
|
1918
|
-
else insertBranchBefore(newScopes[start + i], parentNode, afterReference);
|
|
1919
|
-
afterReference = newScopes[start + i][StartNode];
|
|
1920
|
-
}
|
|
1921
|
-
};
|
|
1922
|
-
};
|
|
1923
|
-
}
|
|
1924
|
-
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
|
1925
|
-
if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
|
|
1926
|
-
const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
|
|
1927
|
-
if (typeof tagNameOrRenderer === "string") branch[`#${tagNameOrRenderer}/0`] = branch[StartNode] = branch[EndNode] = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer);
|
|
1928
|
-
else setupBranch(tagNameOrRenderer, branch);
|
|
1929
|
-
return branch;
|
|
1930
|
-
}
|
|
1931
|
-
function bySecondArg(_item, index) {
|
|
1932
|
-
return index;
|
|
1933
|
-
}
|
|
1934
|
-
function byFirstArg(name) {
|
|
1935
|
-
return name;
|
|
1936
|
-
}
|
|
1937
|
-
//#endregion
|
|
1938
|
-
//#region src/dom/queue.ts
|
|
1939
|
-
let rendering;
|
|
1940
|
-
let runId = 2;
|
|
1941
|
-
const caughtError = /* @__PURE__ */ new WeakSet();
|
|
1942
|
-
const placeholderShown = /* @__PURE__ */ new WeakSet();
|
|
1943
|
-
let pendingEffects = [];
|
|
1944
|
-
let pendingRenders = [];
|
|
1945
|
-
const scopeKeyOffset = 1e6;
|
|
1946
|
-
function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
1947
|
-
let render;
|
|
1948
|
-
if (signalKey >= 0 && (render = scope[signalKey])) {
|
|
1949
|
-
render[Value] = value;
|
|
1950
|
-
if (render["gen"] === runId || catchEnabled && render["pending"]) return;
|
|
1951
|
-
render["gen"] = runId;
|
|
1952
|
-
} else {
|
|
1953
|
-
render = {
|
|
1954
|
-
["key"]: scopeKey * scopeKeyOffset + signalKey,
|
|
1955
|
-
[Scope]: scope,
|
|
1956
|
-
[Signal]: signal,
|
|
1957
|
-
[Value]: value,
|
|
1958
|
-
["gen"]: runId
|
|
1959
|
-
};
|
|
1960
|
-
if (signalKey >= 0) scope[signalKey] = render;
|
|
1961
|
-
}
|
|
1962
|
-
queuePendingRender(render);
|
|
1963
|
-
}
|
|
1964
|
-
function queuePendingRender(render) {
|
|
1965
|
-
let i = pendingRenders.push(render) - 1;
|
|
1966
|
-
while (i) {
|
|
1967
|
-
const parentIndex = i - 1 >> 1;
|
|
1968
|
-
const parent = pendingRenders[parentIndex];
|
|
1969
|
-
if (render["key"] - parent["key"] >= 0) break;
|
|
1970
|
-
pendingRenders[i] = parent;
|
|
1971
|
-
i = parentIndex;
|
|
1972
|
-
}
|
|
1973
|
-
pendingRenders[i] = render;
|
|
1974
|
-
}
|
|
1975
|
-
function queueEffect(scope, fn) {
|
|
1976
|
-
pendingEffects.push(fn, scope);
|
|
1977
|
-
}
|
|
1978
|
-
function run() {
|
|
1979
|
-
const effects = pendingEffects;
|
|
1980
|
-
try {
|
|
1981
|
-
rendering = 1;
|
|
1982
|
-
runRenders();
|
|
1983
|
-
} finally {
|
|
1984
|
-
runId++;
|
|
1985
|
-
rendering = 0;
|
|
1986
|
-
pendingRenders = [];
|
|
1987
|
-
pendingEffects = [];
|
|
1988
|
-
}
|
|
1989
|
-
runEffects(effects);
|
|
1990
|
-
}
|
|
1991
|
-
function queueAsyncRender(scope, signal, value) {
|
|
1992
|
-
queueRender(scope, signal, -1, value);
|
|
1993
|
-
queueMicrotask(run);
|
|
1994
|
-
}
|
|
1995
|
-
function prepareEffects(fn) {
|
|
1996
|
-
const prevRenders = pendingRenders;
|
|
1997
|
-
const prevEffects = pendingEffects;
|
|
1998
|
-
const preparedEffects = pendingEffects = [];
|
|
1999
|
-
pendingRenders = [];
|
|
2000
|
-
try {
|
|
2001
|
-
rendering = 1;
|
|
2002
|
-
fn();
|
|
2003
|
-
runRenders();
|
|
2004
|
-
} finally {
|
|
2005
|
-
runId++;
|
|
2006
|
-
rendering = 0;
|
|
2007
|
-
pendingRenders = prevRenders;
|
|
2008
|
-
pendingEffects = prevEffects;
|
|
2009
|
-
}
|
|
2010
|
-
return preparedEffects;
|
|
2011
|
-
}
|
|
2012
|
-
let runEffects = ((effects) => {
|
|
2013
|
-
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
2014
|
-
});
|
|
2015
|
-
function runRenders() {
|
|
2016
|
-
while (pendingRenders.length) {
|
|
2017
|
-
const render = pendingRenders[0];
|
|
2018
|
-
const item = pendingRenders.pop();
|
|
2019
|
-
if (render !== item) {
|
|
2020
|
-
let i = 0;
|
|
2021
|
-
const mid = pendingRenders.length >> 1;
|
|
2022
|
-
const key = (pendingRenders[0] = item)["key"];
|
|
2023
|
-
while (i < mid) {
|
|
2024
|
-
let bestChild = (i << 1) + 1;
|
|
2025
|
-
const right = bestChild + 1;
|
|
2026
|
-
if (right < pendingRenders.length && pendingRenders[right]["key"] - pendingRenders[bestChild]["key"] < 0) bestChild = right;
|
|
2027
|
-
if (pendingRenders[bestChild]["key"] - key >= 0) break;
|
|
2028
|
-
else {
|
|
2029
|
-
pendingRenders[i] = pendingRenders[bestChild];
|
|
2030
|
-
i = bestChild;
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
pendingRenders[i] = item;
|
|
2034
|
-
}
|
|
2035
|
-
runRender(render);
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
let runRender = (render) => render[Signal](render[Scope], render[Value]);
|
|
2039
|
-
function skipDestroyedRenders() {
|
|
2040
|
-
runRender = ((runRender) => (render) => {
|
|
2041
|
-
if (render["scope"]["#ClosestBranch"]?.["#Gen"] !== 0) runRender(render);
|
|
2042
|
-
})(runRender);
|
|
2043
|
-
}
|
|
2044
|
-
let catchEnabled;
|
|
2045
|
-
function _enable_catch() {
|
|
2046
|
-
if (!catchEnabled) {
|
|
2047
|
-
catchEnabled = 1;
|
|
2048
|
-
enableBranches();
|
|
2049
|
-
const handlePendingTry = (fn, scope, branch) => {
|
|
2050
|
-
while (branch) {
|
|
2051
|
-
if (branch["#AwaitCounter"]?.i) return (branch[PendingEffects] ||= []).push(fn, scope);
|
|
2052
|
-
branch = branch[ParentBranch];
|
|
2053
|
-
}
|
|
2054
|
-
};
|
|
2055
|
-
runEffects = ((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
|
|
2056
|
-
if (checkPending || caughtError.has(effects)) {
|
|
2057
|
-
let i = 0;
|
|
2058
|
-
let fn;
|
|
2059
|
-
let scope;
|
|
2060
|
-
let branch;
|
|
2061
|
-
for (; i < effects.length;) {
|
|
2062
|
-
fn = effects[i++];
|
|
2063
|
-
scope = effects[i++];
|
|
2064
|
-
if ((branch = scope["#ClosestBranch"])?.["#Gen"] !== 0 && !(checkPending && handlePendingTry(fn, scope, branch))) fn(scope);
|
|
2065
|
-
}
|
|
2066
|
-
} else runEffects(effects);
|
|
2067
|
-
})(runEffects);
|
|
2068
|
-
runRender = ((runRender) => (render) => {
|
|
2069
|
-
try {
|
|
2070
|
-
let branch = render[Scope][ClosestBranch];
|
|
2071
|
-
while (branch) {
|
|
2072
|
-
if (branch["#PendingRenders"]) {
|
|
2073
|
-
render[Pending] = 1;
|
|
2074
|
-
return branch[PendingRenders].push(render);
|
|
2075
|
-
}
|
|
2076
|
-
branch = branch[ParentBranch];
|
|
2077
|
-
}
|
|
2078
|
-
render[Pending] = 0;
|
|
2079
|
-
runRender(render);
|
|
2080
|
-
} catch (error) {
|
|
2081
|
-
renderCatch(render[Scope], error);
|
|
2082
|
-
}
|
|
2083
|
-
})(runRender);
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
//#endregion
|
|
2087
|
-
//#region src/dom/abort-signal.ts
|
|
2088
|
-
function $signalReset(scope, id) {
|
|
2089
|
-
const ctrl = scope[AbortControllers]?.[id];
|
|
2090
|
-
if (ctrl) {
|
|
2091
|
-
scope[AbortControllers][id] = void 0;
|
|
2092
|
-
if (rendering) queueEffect(ctrl, abort);
|
|
2093
|
-
else abort(ctrl);
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
function $signal(scope, id) {
|
|
2097
|
-
trackCleanup(scope);
|
|
2098
|
-
return ((scope[AbortControllers] ||= {})[id] ||= new AbortController()).signal;
|
|
2099
|
-
}
|
|
2100
|
-
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
2101
|
-
function trackCleanup(scope, subscribers) {
|
|
2102
|
-
const branch = scope[ClosestBranch];
|
|
2103
|
-
if (branch) (branch[AbortScopes] ||= /* @__PURE__ */ new Set()).add(scope);
|
|
2104
|
-
if (subscribers) (scope[Subscriptions] ||= []).push(subscribers);
|
|
2105
|
-
}
|
|
2106
|
-
function abort(ctrl) {
|
|
2107
|
-
ctrl.abort();
|
|
2108
|
-
}
|
|
27
|
+
const Signal = "signal";
|
|
2109
28
|
//#endregion
|
|
2110
29
|
//#region src/common/compat-meta.ts
|
|
2111
30
|
const SET_SCOPE_REGISTER_ID = "$compat_setScope";
|
|
@@ -2122,18 +41,18 @@ const getRenderScopes = ($global) => {
|
|
|
2122
41
|
return scopes;
|
|
2123
42
|
};
|
|
2124
43
|
const compat = {
|
|
2125
|
-
patchDynamicTag,
|
|
2126
|
-
queueEffect,
|
|
44
|
+
patchDynamicTag: require_control_flow.patchDynamicTag,
|
|
45
|
+
queueEffect: require_control_flow.queueEffect,
|
|
2127
46
|
init(warp10Noop) {
|
|
2128
|
-
_resume(SET_SCOPE_REGISTER_ID, (scope) => {
|
|
2129
|
-
getRenderScopes(scope[Global])[scope["#Id"]] = scope;
|
|
47
|
+
require_control_flow._resume(SET_SCOPE_REGISTER_ID, (scope) => {
|
|
48
|
+
getRenderScopes(scope[require_control_flow.Global])[scope["#Id"]] = scope;
|
|
2130
49
|
if (scope.m5c) classIdToBranch.set(scope.m5c, scope);
|
|
2131
50
|
if (classEventResolver) for (const key in scope) {
|
|
2132
51
|
const resolved = classEventResolver(scope[key], scope);
|
|
2133
52
|
if (resolved !== scope[key]) scope[key] = resolved;
|
|
2134
53
|
}
|
|
2135
54
|
});
|
|
2136
|
-
_resume(RENDER_BODY_ID, warp10Noop);
|
|
55
|
+
require_control_flow._resume(RENDER_BODY_ID, warp10Noop);
|
|
2137
56
|
},
|
|
2138
57
|
setClassEventResolver(fn) {
|
|
2139
58
|
classEventResolver = fn;
|
|
@@ -2145,34 +64,34 @@ const compat = {
|
|
|
2145
64
|
renderer["id"] = id;
|
|
2146
65
|
},
|
|
2147
66
|
isRenderer(renderer) {
|
|
2148
|
-
return renderer[Clone];
|
|
67
|
+
return renderer[require_control_flow.Clone];
|
|
2149
68
|
},
|
|
2150
69
|
getStartNode(branch) {
|
|
2151
|
-
return branch[StartNode];
|
|
70
|
+
return branch[require_control_flow.StartNode];
|
|
2152
71
|
},
|
|
2153
72
|
getEndNode(branch) {
|
|
2154
|
-
return branch[EndNode];
|
|
73
|
+
return branch[require_control_flow.EndNode];
|
|
2155
74
|
},
|
|
2156
75
|
setScopeNodes(branch, startNode, endNode) {
|
|
2157
|
-
branch[StartNode] = startNode;
|
|
2158
|
-
branch[EndNode] = endNode;
|
|
76
|
+
branch[require_control_flow.StartNode] = startNode;
|
|
77
|
+
branch[require_control_flow.EndNode] = endNode;
|
|
2159
78
|
},
|
|
2160
79
|
runComponentEffects() {
|
|
2161
|
-
if (this.effects) runEffects(this.effects);
|
|
80
|
+
if (this.effects) require_control_flow.runEffects(this.effects);
|
|
2162
81
|
},
|
|
2163
82
|
runComponentDestroy() {
|
|
2164
|
-
if (this.scope) destroyBranch(this.scope);
|
|
83
|
+
if (this.scope) require_control_flow.destroyBranch(this.scope);
|
|
2165
84
|
},
|
|
2166
85
|
resolveRegistered(value, $global) {
|
|
2167
|
-
if (Array.isArray(value) && typeof value[0] === "string") return getRegisteredWithScope(value[0], getRenderScopes($global)?.[value[1]]);
|
|
86
|
+
if (Array.isArray(value) && typeof value[0] === "string") return require_control_flow.getRegisteredWithScope(value[0], getRenderScopes($global)?.[value[1]]);
|
|
2168
87
|
return value;
|
|
2169
88
|
},
|
|
2170
89
|
createRenderer(params, clone) {
|
|
2171
|
-
const renderer = _content("", 0, 0, 0, params)();
|
|
2172
|
-
renderer[Clone] = (branch) => {
|
|
90
|
+
const renderer = require_control_flow._content("", 0, 0, 0, params)();
|
|
91
|
+
renderer[require_control_flow.Clone] = (branch) => {
|
|
2173
92
|
const cloned = clone();
|
|
2174
|
-
branch[StartNode] = cloned.startNode;
|
|
2175
|
-
branch[EndNode] = cloned.endNode;
|
|
93
|
+
branch[require_control_flow.StartNode] = cloned.startNode;
|
|
94
|
+
branch[require_control_flow.EndNode] = cloned.endNode;
|
|
2176
95
|
};
|
|
2177
96
|
return renderer;
|
|
2178
97
|
},
|
|
@@ -2188,26 +107,26 @@ const compat = {
|
|
|
2188
107
|
const normalizedInput = args[0] = {};
|
|
2189
108
|
for (const key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
2190
109
|
}
|
|
2191
|
-
component.effects = prepareEffects(() => {
|
|
110
|
+
component.effects = require_control_flow.prepareEffects(() => {
|
|
2192
111
|
if (!branch) {
|
|
2193
112
|
created = 1;
|
|
2194
|
-
branch = component.scope = createAndSetupBranch(out.global, renderer, renderer[Owner], document.body);
|
|
113
|
+
branch = component.scope = require_control_flow.createAndSetupBranch(out.global, renderer, renderer[require_control_flow.Owner], document.body);
|
|
2195
114
|
}
|
|
2196
|
-
renderer[Params]?.(branch, renderer._ ? args[0] : args);
|
|
115
|
+
renderer[require_control_flow.Params]?.(branch, renderer._ ? args[0] : args);
|
|
2197
116
|
});
|
|
2198
|
-
if (created) return toInsertNode(branch[StartNode], branch[EndNode]);
|
|
117
|
+
if (created) return require_control_flow.toInsertNode(branch[require_control_flow.StartNode], branch[require_control_flow.EndNode]);
|
|
2199
118
|
}
|
|
2200
119
|
};
|
|
2201
120
|
//#endregion
|
|
2202
121
|
//#region src/dom/template.ts
|
|
2203
122
|
const _template = (id, template, walks, setup, inputSignal) => {
|
|
2204
|
-
const renderer = _content(id, template, walks, setup, inputSignal)();
|
|
123
|
+
const renderer = require_control_flow._content(id, template, walks, setup, inputSignal)();
|
|
2205
124
|
renderer.mount = mount;
|
|
2206
125
|
renderer._ = renderer;
|
|
2207
126
|
renderer.render = () => {
|
|
2208
127
|
throw new Error(`render() is not implemented for the DOM compilation of a Marko template`);
|
|
2209
128
|
};
|
|
2210
|
-
return _resume(id, renderer);
|
|
129
|
+
return require_control_flow._resume(id, renderer);
|
|
2211
130
|
};
|
|
2212
131
|
function mount(input = {}, reference, position) {
|
|
2213
132
|
let branch;
|
|
@@ -2241,92 +160,90 @@ function mount(input = {}, reference, position) {
|
|
|
2241
160
|
break;
|
|
2242
161
|
}
|
|
2243
162
|
let curValue;
|
|
2244
|
-
const args = this[Params];
|
|
2245
|
-
const effects = prepareEffects(() => {
|
|
2246
|
-
branch = createBranch($global, this, void 0, parentNode);
|
|
2247
|
-
branch[TagVariable] = (newValue) => {
|
|
163
|
+
const args = this[require_control_flow.Params];
|
|
164
|
+
const effects = require_control_flow.prepareEffects(() => {
|
|
165
|
+
branch = require_control_flow.createBranch($global, this, void 0, parentNode);
|
|
166
|
+
branch[require_control_flow.TagVariable] = (newValue) => {
|
|
2248
167
|
curValue = newValue;
|
|
2249
168
|
};
|
|
2250
|
-
this[Setup]?.(branch);
|
|
169
|
+
this[require_control_flow.Setup]?.(branch);
|
|
2251
170
|
args?.(branch, input);
|
|
2252
171
|
});
|
|
2253
|
-
insertChildNodes(parentNode, nextSibling, branch[StartNode], branch[EndNode]);
|
|
2254
|
-
runEffects(effects);
|
|
172
|
+
require_control_flow.insertChildNodes(parentNode, nextSibling, branch[require_control_flow.StartNode], branch[require_control_flow.EndNode]);
|
|
173
|
+
require_control_flow.runEffects(effects);
|
|
2255
174
|
return {
|
|
2256
175
|
get value() {
|
|
2257
176
|
return curValue;
|
|
2258
177
|
},
|
|
2259
178
|
set value(newValue) {
|
|
2260
|
-
_var_change(branch, newValue);
|
|
179
|
+
require_control_flow._var_change(branch, newValue);
|
|
2261
180
|
},
|
|
2262
181
|
update(newInput = {}) {
|
|
2263
182
|
if (args) {
|
|
2264
183
|
if (newInput.$global) ({$global, ...newInput} = newInput);
|
|
2265
|
-
runEffects(prepareEffects(() => {
|
|
184
|
+
require_control_flow.runEffects(require_control_flow.prepareEffects(() => {
|
|
2266
185
|
args(branch, newInput);
|
|
2267
186
|
}));
|
|
2268
187
|
}
|
|
2269
188
|
},
|
|
2270
189
|
destroy() {
|
|
2271
|
-
removeAndDestroyBranch(branch);
|
|
190
|
+
require_control_flow.removeAndDestroyBranch(branch);
|
|
2272
191
|
}
|
|
2273
192
|
};
|
|
2274
193
|
}
|
|
2275
194
|
//#endregion
|
|
2276
195
|
//#region src/dom/load.ts
|
|
2277
196
|
function _load_template(id, load) {
|
|
2278
|
-
_enable_catch();
|
|
2279
197
|
let pending;
|
|
2280
198
|
const lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
2281
|
-
const awaitCounter = addAwaitCounter(branch);
|
|
2282
|
-
branch[Load] ||= /* @__PURE__ */ new Map();
|
|
199
|
+
const awaitCounter = require_control_flow.addAwaitCounter(branch);
|
|
200
|
+
branch[require_control_flow.Load] ||= /* @__PURE__ */ new Map();
|
|
2283
201
|
(pending ||= load()).then((renderer) => {
|
|
2284
202
|
Object.assign(lazyTemplate, renderer);
|
|
2285
|
-
queueAsyncRender(branch, (branch) => insertLoaded(renderer, branch, branch[StartNode], awaitCounter));
|
|
203
|
+
require_control_flow.queueAsyncRender(branch, (branch) => insertLoaded(renderer, branch, branch[require_control_flow.StartNode], awaitCounter));
|
|
2286
204
|
}, loadFailed(branch, awaitCounter));
|
|
2287
|
-
}, _load_signal(() => (pending ||= load()).then((r) => ({ _: r[Params] }))));
|
|
205
|
+
}, _load_signal(() => (pending ||= load()).then((r) => ({ _: r[require_control_flow.Params] }))));
|
|
2288
206
|
return lazyTemplate;
|
|
2289
207
|
}
|
|
2290
208
|
function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
2291
209
|
let pending;
|
|
2292
210
|
let renderer;
|
|
2293
|
-
_enable_catch();
|
|
2294
211
|
return (owner) => {
|
|
2295
212
|
const child = owner[childScopeAccessor];
|
|
2296
213
|
if (renderer) insertLoaded(renderer, child, owner[nodeAccessor]);
|
|
2297
214
|
else {
|
|
2298
|
-
const awaitCounter = addAwaitCounter(owner);
|
|
2299
|
-
child[Load] ||= /* @__PURE__ */ new Map();
|
|
215
|
+
const awaitCounter = require_control_flow.addAwaitCounter(owner);
|
|
216
|
+
child[require_control_flow.Load] ||= /* @__PURE__ */ new Map();
|
|
2300
217
|
(pending ||= load()).then((mod) => {
|
|
2301
|
-
renderer = _content("", ...mod._)();
|
|
2302
|
-
queueAsyncRender(child, (child) => insertLoaded(renderer, child, owner[nodeAccessor], awaitCounter));
|
|
218
|
+
renderer = require_control_flow._content("", ...mod._)();
|
|
219
|
+
require_control_flow.queueAsyncRender(child, (child) => insertLoaded(renderer, child, owner[nodeAccessor], awaitCounter));
|
|
2303
220
|
}, loadFailed(child, awaitCounter));
|
|
2304
221
|
}
|
|
2305
222
|
};
|
|
2306
223
|
}
|
|
2307
224
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
2308
|
-
const parent = marker.parentNode, values = branch[Load], insert = () => {
|
|
2309
|
-
insertBranchBefore(branch, parent, marker);
|
|
225
|
+
const parent = marker.parentNode, values = branch[require_control_flow.Load], insert = () => {
|
|
226
|
+
require_control_flow.insertBranchBefore(branch, parent, marker);
|
|
2310
227
|
marker.remove();
|
|
2311
228
|
awaitCounter?.c();
|
|
2312
229
|
};
|
|
2313
230
|
let remaining;
|
|
2314
|
-
syncGen(branch);
|
|
2315
|
-
renderer[Clone](branch, parent.namespaceURI);
|
|
2316
|
-
branch[Load] = 0;
|
|
231
|
+
require_control_flow.syncGen(branch);
|
|
232
|
+
renderer[require_control_flow.Clone](branch, parent.namespaceURI);
|
|
233
|
+
branch[require_control_flow.Load] = 0;
|
|
2317
234
|
if (remaining = values?.size) {
|
|
2318
235
|
const fail = loadFailed(branch, awaitCounter);
|
|
2319
236
|
for (const [promise, entry] of values) promise.then((signal) => {
|
|
2320
|
-
entry[Signal
|
|
2321
|
-
if (!--remaining) queueAsyncRender(branch, (branch) => {
|
|
2322
|
-
syncGen(branch);
|
|
2323
|
-
renderer[Setup]?.(branch);
|
|
2324
|
-
values.forEach((e) => e[Signal
|
|
237
|
+
entry[Signal] = signal;
|
|
238
|
+
if (!--remaining) require_control_flow.queueAsyncRender(branch, (branch) => {
|
|
239
|
+
require_control_flow.syncGen(branch);
|
|
240
|
+
renderer[require_control_flow.Setup]?.(branch);
|
|
241
|
+
values.forEach((e) => e[Signal]._(branch, e[Value]));
|
|
2325
242
|
insert();
|
|
2326
243
|
});
|
|
2327
244
|
}, (error) => remaining > 0 && (remaining = 0, fail(error)));
|
|
2328
245
|
} else {
|
|
2329
|
-
setupBranch(renderer, branch);
|
|
246
|
+
require_control_flow.setupBranch(renderer, branch);
|
|
2330
247
|
insert();
|
|
2331
248
|
}
|
|
2332
249
|
}
|
|
@@ -2334,7 +251,7 @@ function loadFailed(scope, awaitCounter) {
|
|
|
2334
251
|
return (error) => {
|
|
2335
252
|
if (awaitCounter) if (awaitCounter.m) awaitCounter.i = 0;
|
|
2336
253
|
else awaitCounter.c();
|
|
2337
|
-
queueAsyncRender(scope, renderCatch, error);
|
|
254
|
+
require_control_flow.queueAsyncRender(scope, require_control_flow.renderCatch, error);
|
|
2338
255
|
};
|
|
2339
256
|
}
|
|
2340
257
|
function _load_signal(load) {
|
|
@@ -2342,9 +259,9 @@ function _load_signal(load) {
|
|
|
2342
259
|
let signal;
|
|
2343
260
|
return (scope, value) => {
|
|
2344
261
|
pending ||= load();
|
|
2345
|
-
if (scope["#Load"] || !("#Load" in scope) && scope["#Gen"] === runId) (scope[Load] ||= /* @__PURE__ */ new Map()).set(pending, { [Value
|
|
262
|
+
if (scope["#Load"] || !("#Load" in scope) && scope["#Gen"] === require_control_flow.runId) (scope[require_control_flow.Load] ||= /* @__PURE__ */ new Map()).set(pending, { [Value]: value });
|
|
2346
263
|
else if (signal) signal(scope, value);
|
|
2347
|
-
else pending.then((mod) => queueAsyncRender(scope, signal = mod._, value), () => 0);
|
|
264
|
+
else pending.then((mod) => require_control_flow.queueAsyncRender(scope, signal = mod._, value), () => 0);
|
|
2348
265
|
};
|
|
2349
266
|
}
|
|
2350
267
|
function _load_visible_trigger(selector, options) {
|
|
@@ -2374,91 +291,85 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
2374
291
|
return document.querySelector(selector) || (console.warn(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`), resolve());
|
|
2375
292
|
}
|
|
2376
293
|
//#endregion
|
|
2377
|
-
exports.$signal =
|
|
2378
|
-
exports.$signalReset =
|
|
2379
|
-
exports._assert_hoist = _assert_hoist;
|
|
2380
|
-
exports._assert_init = _assert_init;
|
|
2381
|
-
exports._attr = _attr;
|
|
2382
|
-
exports._attr_class = _attr_class;
|
|
2383
|
-
exports._attr_class_item = _attr_class_item;
|
|
2384
|
-
exports._attr_class_items = _attr_class_items;
|
|
2385
|
-
exports._attr_content = _attr_content;
|
|
2386
|
-
exports._attr_details_open = _attr_details_or_dialog_open;
|
|
2387
|
-
exports._attr_details_open_default = _attr_details_or_dialog_open_default;
|
|
2388
|
-
exports._attr_details_open_script = _attr_details_or_dialog_open_script;
|
|
2389
|
-
exports._attr_dialog_open = _attr_details_or_dialog_open;
|
|
2390
|
-
exports._attr_dialog_open_default = _attr_details_or_dialog_open_default;
|
|
2391
|
-
exports._attr_dialog_open_script = _attr_details_or_dialog_open_script;
|
|
2392
|
-
exports._attr_input_checked = _attr_input_checked;
|
|
2393
|
-
exports._attr_input_checkedValue = _attr_input_checkedValue;
|
|
2394
|
-
exports._attr_input_checkedValue_default = _attr_input_checkedValue_default;
|
|
2395
|
-
exports._attr_input_checkedValue_script = _attr_input_checkedValue_script;
|
|
2396
|
-
exports._attr_input_checked_default = _attr_input_checked_default;
|
|
2397
|
-
exports._attr_input_checked_script = _attr_input_checked_script;
|
|
2398
|
-
exports._attr_input_value = _attr_input_value;
|
|
2399
|
-
exports._attr_input_value_attribute_default = _attr_input_value_attribute_default;
|
|
2400
|
-
exports._attr_input_value_default = _attr_input_value_default;
|
|
2401
|
-
exports._attr_input_value_dynamic_default = _attr_input_value_dynamic_default;
|
|
2402
|
-
exports._attr_input_value_script = _attr_input_value_script;
|
|
2403
|
-
exports._attr_nonce = _attr_nonce;
|
|
2404
|
-
exports._attr_select_value = _attr_select_value;
|
|
2405
|
-
exports._attr_select_value_default = _attr_select_value_default;
|
|
2406
|
-
exports._attr_select_value_script = _attr_select_value_script;
|
|
2407
|
-
exports._attr_style = _attr_style;
|
|
2408
|
-
exports._attr_style_item = _attr_style_item;
|
|
2409
|
-
exports._attr_style_items = _attr_style_items;
|
|
2410
|
-
exports._attr_textarea_value = _attr_input_value;
|
|
2411
|
-
exports._attr_textarea_value_default = _attr_input_value_default;
|
|
2412
|
-
exports._attr_textarea_value_script = _attr_input_value_script;
|
|
2413
|
-
exports._attrs = _attrs;
|
|
2414
|
-
exports._attrs_content = _attrs_content;
|
|
2415
|
-
exports._attrs_partial = _attrs_partial;
|
|
2416
|
-
exports._attrs_partial_content = _attrs_partial_content;
|
|
2417
|
-
exports._attrs_script = _attrs_script;
|
|
2418
|
-
exports._await_content = _await_content;
|
|
2419
|
-
exports._await_promise = _await_promise;
|
|
2420
|
-
exports._call = _call;
|
|
2421
|
-
exports._child_setup = _child_setup;
|
|
2422
|
-
exports._closure = _closure;
|
|
2423
|
-
exports._closure_get = _closure_get;
|
|
2424
|
-
exports._const = _const;
|
|
2425
|
-
exports._content = _content;
|
|
2426
|
-
exports._content_closures = _content_closures;
|
|
2427
|
-
exports._content_resume = _content_resume;
|
|
2428
|
-
exports._controllable_input = _controllable_input;
|
|
2429
|
-
exports._controllable_open = _controllable_open;
|
|
2430
|
-
exports._controllable_select = _controllable_select;
|
|
2431
|
-
exports._controllable_textarea = _controllable_textarea;
|
|
294
|
+
exports.$signal = require_control_flow.$signal;
|
|
295
|
+
exports.$signalReset = require_control_flow.$signalReset;
|
|
296
|
+
exports._assert_hoist = require_control_flow._assert_hoist;
|
|
297
|
+
exports._assert_init = require_control_flow._assert_init;
|
|
298
|
+
exports._attr = require_control_flow._attr;
|
|
299
|
+
exports._attr_class = require_control_flow._attr_class;
|
|
300
|
+
exports._attr_class_item = require_control_flow._attr_class_item;
|
|
301
|
+
exports._attr_class_items = require_control_flow._attr_class_items;
|
|
302
|
+
exports._attr_content = require_control_flow._attr_content;
|
|
303
|
+
exports._attr_details_open = require_control_flow._attr_details_or_dialog_open;
|
|
304
|
+
exports._attr_details_open_default = require_control_flow._attr_details_or_dialog_open_default;
|
|
305
|
+
exports._attr_details_open_script = require_control_flow._attr_details_or_dialog_open_script;
|
|
306
|
+
exports._attr_dialog_open = require_control_flow._attr_details_or_dialog_open;
|
|
307
|
+
exports._attr_dialog_open_default = require_control_flow._attr_details_or_dialog_open_default;
|
|
308
|
+
exports._attr_dialog_open_script = require_control_flow._attr_details_or_dialog_open_script;
|
|
309
|
+
exports._attr_input_checked = require_control_flow._attr_input_checked;
|
|
310
|
+
exports._attr_input_checkedValue = require_control_flow._attr_input_checkedValue;
|
|
311
|
+
exports._attr_input_checkedValue_default = require_control_flow._attr_input_checkedValue_default;
|
|
312
|
+
exports._attr_input_checkedValue_script = require_control_flow._attr_input_checkedValue_script;
|
|
313
|
+
exports._attr_input_checked_default = require_control_flow._attr_input_checked_default;
|
|
314
|
+
exports._attr_input_checked_script = require_control_flow._attr_input_checked_script;
|
|
315
|
+
exports._attr_input_value = require_control_flow._attr_input_value;
|
|
316
|
+
exports._attr_input_value_attribute_default = require_control_flow._attr_input_value_attribute_default;
|
|
317
|
+
exports._attr_input_value_default = require_control_flow._attr_input_value_default;
|
|
318
|
+
exports._attr_input_value_dynamic_default = require_control_flow._attr_input_value_dynamic_default;
|
|
319
|
+
exports._attr_input_value_script = require_control_flow._attr_input_value_script;
|
|
320
|
+
exports._attr_nonce = require_control_flow._attr_nonce;
|
|
321
|
+
exports._attr_select_value = require_control_flow._attr_select_value;
|
|
322
|
+
exports._attr_select_value_default = require_control_flow._attr_select_value_default;
|
|
323
|
+
exports._attr_select_value_script = require_control_flow._attr_select_value_script;
|
|
324
|
+
exports._attr_style = require_control_flow._attr_style;
|
|
325
|
+
exports._attr_style_item = require_control_flow._attr_style_item;
|
|
326
|
+
exports._attr_style_items = require_control_flow._attr_style_items;
|
|
327
|
+
exports._attr_textarea_value = require_control_flow._attr_input_value;
|
|
328
|
+
exports._attr_textarea_value_default = require_control_flow._attr_input_value_default;
|
|
329
|
+
exports._attr_textarea_value_script = require_control_flow._attr_input_value_script;
|
|
330
|
+
exports._attrs = require_control_flow._attrs;
|
|
331
|
+
exports._attrs_content = require_control_flow._attrs_content;
|
|
332
|
+
exports._attrs_partial = require_control_flow._attrs_partial;
|
|
333
|
+
exports._attrs_partial_content = require_control_flow._attrs_partial_content;
|
|
334
|
+
exports._attrs_script = require_control_flow._attrs_script;
|
|
335
|
+
exports._await_content = require_control_flow._await_content;
|
|
336
|
+
exports._await_promise = require_control_flow._await_promise;
|
|
337
|
+
exports._call = require_control_flow._call;
|
|
338
|
+
exports._child_setup = require_control_flow._child_setup;
|
|
339
|
+
exports._closure = require_control_flow._closure;
|
|
340
|
+
exports._closure_get = require_control_flow._closure_get;
|
|
341
|
+
exports._const = require_control_flow._const;
|
|
342
|
+
exports._content = require_control_flow._content;
|
|
343
|
+
exports._content_closures = require_control_flow._content_closures;
|
|
344
|
+
exports._content_resume = require_control_flow._content_resume;
|
|
345
|
+
exports._controllable_input = require_control_flow._controllable_input;
|
|
346
|
+
exports._controllable_open = require_control_flow._controllable_open;
|
|
347
|
+
exports._controllable_select = require_control_flow._controllable_select;
|
|
348
|
+
exports._controllable_textarea = require_control_flow._controllable_textarea;
|
|
2432
349
|
Object.defineProperty(exports, "_dynamic_tag", {
|
|
2433
350
|
enumerable: true,
|
|
2434
351
|
get: function() {
|
|
2435
|
-
return _dynamic_tag;
|
|
352
|
+
return require_control_flow._dynamic_tag;
|
|
2436
353
|
}
|
|
2437
354
|
});
|
|
2438
|
-
exports._dynamic_tag_content = _dynamic_tag_content;
|
|
2439
|
-
exports._el = _el;
|
|
2440
|
-
exports._el_read = _el_read;
|
|
2441
|
-
exports.
|
|
2442
|
-
exports.
|
|
2443
|
-
exports.
|
|
2444
|
-
exports.
|
|
2445
|
-
exports.
|
|
2446
|
-
exports.
|
|
2447
|
-
exports.
|
|
2448
|
-
exports.
|
|
2449
|
-
exports.
|
|
2450
|
-
exports.
|
|
2451
|
-
exports.
|
|
2452
|
-
exports.
|
|
2453
|
-
exports.
|
|
2454
|
-
exports.
|
|
2455
|
-
exports.
|
|
2456
|
-
exports._id = _id;
|
|
2457
|
-
exports._if = _if;
|
|
2458
|
-
exports._if_closure = _if_closure;
|
|
2459
|
-
exports._let = _let;
|
|
2460
|
-
exports._let_change = _let_change;
|
|
2461
|
-
exports._lifecycle = _lifecycle;
|
|
355
|
+
exports._dynamic_tag_content = require_control_flow._dynamic_tag_content;
|
|
356
|
+
exports._el = require_control_flow._el;
|
|
357
|
+
exports._el_read = require_control_flow._el_read;
|
|
358
|
+
exports._for_closure = require_control_flow._for_closure;
|
|
359
|
+
exports._for_in = require_control_flow._for_in;
|
|
360
|
+
exports._for_of = require_control_flow._for_of;
|
|
361
|
+
exports._for_selector = require_control_flow._for_selector;
|
|
362
|
+
exports._for_to = require_control_flow._for_to;
|
|
363
|
+
exports._for_until = require_control_flow._for_until;
|
|
364
|
+
exports._hoist = require_control_flow._hoist;
|
|
365
|
+
exports._hoist_resume = require_control_flow._hoist_resume;
|
|
366
|
+
exports._html = require_control_flow._html;
|
|
367
|
+
exports._id = require_control_flow._id;
|
|
368
|
+
exports._if = require_control_flow._if;
|
|
369
|
+
exports._if_closure = require_control_flow._if_closure;
|
|
370
|
+
exports._let = require_control_flow._let;
|
|
371
|
+
exports._let_change = require_control_flow._let_change;
|
|
372
|
+
exports._lifecycle = require_control_flow._lifecycle;
|
|
2462
373
|
exports._load_event_trigger = _load_event_trigger;
|
|
2463
374
|
exports._load_idle_trigger = _load_idle_trigger;
|
|
2464
375
|
exports._load_media_trigger = _load_media_trigger;
|
|
@@ -2467,32 +378,32 @@ exports._load_setup = _load_setup;
|
|
|
2467
378
|
exports._load_signal = _load_signal;
|
|
2468
379
|
exports._load_template = _load_template;
|
|
2469
380
|
exports._load_visible_trigger = _load_visible_trigger;
|
|
2470
|
-
exports._on = _on;
|
|
2471
|
-
exports._or = _or;
|
|
2472
|
-
exports._resume = _resume;
|
|
2473
|
-
exports._resume_dynamic_tag = _resume_dynamic_tag;
|
|
2474
|
-
exports._return = _return;
|
|
2475
|
-
exports._return_change = _return_change;
|
|
2476
|
-
exports._script = _script;
|
|
2477
|
-
exports._show = _show;
|
|
2478
|
-
exports._style_rule_item = _style_rule_item;
|
|
2479
|
-
exports._style_shell = _style_shell;
|
|
381
|
+
exports._on = require_control_flow._on;
|
|
382
|
+
exports._or = require_control_flow._or;
|
|
383
|
+
exports._resume = require_control_flow._resume;
|
|
384
|
+
exports._resume_dynamic_tag = require_control_flow._resume_dynamic_tag;
|
|
385
|
+
exports._return = require_control_flow._return;
|
|
386
|
+
exports._return_change = require_control_flow._return_change;
|
|
387
|
+
exports._script = require_control_flow._script;
|
|
388
|
+
exports._show = require_control_flow._show;
|
|
389
|
+
exports._style_rule_item = require_control_flow._style_rule_item;
|
|
390
|
+
exports._style_shell = require_control_flow._style_shell;
|
|
2480
391
|
exports._template = _template;
|
|
2481
|
-
exports._text = _text;
|
|
2482
|
-
exports._text_content = _text_content;
|
|
2483
|
-
exports._to_text = _to_text;
|
|
2484
|
-
exports._try = _try;
|
|
2485
|
-
exports._var = _var;
|
|
2486
|
-
exports._var_change = _var_change;
|
|
2487
|
-
exports._var_resume = _var_resume;
|
|
392
|
+
exports._text = require_control_flow._text;
|
|
393
|
+
exports._text_content = require_control_flow._text_content;
|
|
394
|
+
exports._to_text = require_control_flow._to_text;
|
|
395
|
+
exports._try = require_control_flow._try;
|
|
396
|
+
exports._var = require_control_flow._var;
|
|
397
|
+
exports._var_change = require_control_flow._var_change;
|
|
398
|
+
exports._var_resume = require_control_flow._var_resume;
|
|
2488
399
|
exports.attrTag = attrTag;
|
|
2489
400
|
exports.attrTags = attrTags;
|
|
2490
401
|
exports.compat = compat;
|
|
2491
|
-
exports.forIn = forIn;
|
|
2492
|
-
exports.forOf = forOf;
|
|
2493
|
-
exports.forTo = forTo;
|
|
2494
|
-
exports.forUntil = forUntil;
|
|
2495
|
-
exports.init = init;
|
|
2496
|
-
exports.initEmbedded = initEmbedded;
|
|
2497
|
-
exports.ready = ready;
|
|
2498
|
-
exports.run = run;
|
|
402
|
+
exports.forIn = require_control_flow.forIn;
|
|
403
|
+
exports.forOf = require_control_flow.forOf;
|
|
404
|
+
exports.forTo = require_control_flow.forTo;
|
|
405
|
+
exports.forUntil = require_control_flow.forUntil;
|
|
406
|
+
exports.init = require_control_flow.init;
|
|
407
|
+
exports.initEmbedded = require_control_flow.initEmbedded;
|
|
408
|
+
exports.ready = require_control_flow.ready;
|
|
409
|
+
exports.run = require_control_flow.run;
|