marko 6.3.31 → 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 -2250
- package/dist/debug/dom.mjs +6 -2094
- package/dist/dom/catch.feat.d.ts +1 -0
- package/dist/dom/catch.feat.js +25 -0
- package/dist/dom/catch.feat.mjs +26 -0
- package/dist/dom/control-flow.d.ts +3 -3
- package/dist/dom/controllable-input.feat.d.ts +1 -0
- package/dist/dom/controllable-input.feat.js +3 -0
- package/dist/dom/controllable-input.feat.mjs +3 -0
- package/dist/dom/controllable-open.feat.d.ts +1 -0
- package/dist/dom/controllable-open.feat.js +4 -0
- package/dist/dom/controllable-open.feat.mjs +4 -0
- package/dist/dom/controllable-select.feat.d.ts +1 -0
- package/dist/dom/controllable-select.feat.js +4 -0
- package/dist/dom/controllable-select.feat.mjs +4 -0
- package/dist/dom/controllable-textarea.feat.d.ts +1 -0
- package/dist/dom/controllable-textarea.feat.js +4 -0
- package/dist/dom/controllable-textarea.feat.mjs +4 -0
- package/dist/dom/controllable.d.ts +3 -8
- package/dist/dom/controllable.feat.d.ts +3 -0
- package/dist/dom/controllable.feat.js +3 -0
- package/dist/dom/controllable.feat.mjs +6 -0
- package/dist/dom/queue.d.ts +2 -2
- package/dist/dom/resume.d.ts +0 -1
- package/dist/dom-CI-06TZb.js +1721 -0
- package/dist/dom-Cj4HQ7T_.mjs +1137 -0
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +36 -1224
- package/dist/dom.mjs +4 -1191
- package/dist/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/dom.js
CHANGED
|
@@ -1,71 +1,16 @@
|
|
|
1
|
-
let empty = [], rest = Symbol(),
|
|
2
|
-
let str = "", sep = "", part;
|
|
3
|
-
if (val) if (typeof val != "object") str += val;
|
|
4
|
-
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
|
-
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
|
-
return str;
|
|
7
|
-
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
8
|
-
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
|
|
9
|
-
}, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), currentNode, walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
10
|
-
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
11
|
-
for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) scope[decodeAccessor(currentScopeIndex++)] = currentNode;
|
|
12
|
-
else if (value === 37 || value === 49) currentNode.replaceWith(currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
13
|
-
else if (value === 38) return currentWalkIndex;
|
|
14
|
-
else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
|
|
15
|
-
else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;) walkNextNode();
|
|
16
|
-
else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walkNextSibling();
|
|
17
|
-
else if (value < 117) {
|
|
18
|
-
for (value = 10 * currentMultiplier + value - 107; value--;) currentNode = currentNode.parentNode || currentNode;
|
|
19
|
-
walkNextSibling();
|
|
20
|
-
} else storedMultiplier = currentMultiplier * 10 + value - 117;
|
|
21
|
-
}, walkNextNode = () => {
|
|
22
|
-
if (currentNode.firstChild) return currentNode = currentNode.firstChild;
|
|
23
|
-
for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
|
|
24
|
-
walkNextSibling();
|
|
25
|
-
}, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, registeredValues = {}, curRenders, branchesEnabled, embedRenders, readyIds, isResuming, cloneCache = {}, R = /[^\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
26
|
-
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
27
|
-
let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
|
|
28
|
-
return enableBranches(), (scope, newRenderer, getInput) => {
|
|
29
|
-
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
|
30
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.a || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value)), typeof normalizedRenderer == "string") {
|
|
31
|
-
if (getContent) {
|
|
32
|
-
let content = getContent(scope);
|
|
33
|
-
setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
|
|
34
|
-
}
|
|
35
|
-
} else normalizedRenderer?.f && subscribeToScopeSet(normalizedRenderer.e, normalizedRenderer.f, scope[childScopeAccessor]);
|
|
36
|
-
if (normalizedRenderer) {
|
|
37
|
-
let childScope = scope[childScopeAccessor], args = getInput?.();
|
|
38
|
-
if (typeof normalizedRenderer == "string") (getContent ? _attrs : _attrs_content)(childScope, "a", (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope.a.tagName]), (childScope.Ia || childScope.Ea) && queueEffect(childScope, dynamicTagScript);
|
|
39
|
-
else {
|
|
40
|
-
for (let accessor in normalizedRenderer.g) normalizedRenderer.g[accessor](childScope, normalizedRenderer.h[accessor]);
|
|
41
|
-
if (normalizedRenderer.d) if (inputIsArgs) normalizedRenderer.d(childScope, normalizedRenderer._ ? args[0] : args);
|
|
42
|
-
else {
|
|
43
|
-
let inputWithContent = getContent ? {
|
|
44
|
-
...args,
|
|
45
|
-
content: getContent(scope)
|
|
46
|
-
} : args || {};
|
|
47
|
-
normalizedRenderer.d(childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}, _for_of = /* @__PURE__ */ loop(([all, by = bySecondArg], cb) => {
|
|
53
|
-
typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
54
|
-
}), _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))), rendering, runId = 2, caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingRenders = [], runEffects = ((effects) => {
|
|
55
|
-
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
56
|
-
}), runRender = (render) => render.c(render.b, render.d), catchEnabled, classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
|
|
1
|
+
let require_control_flow = require("./dom-CI-06TZb.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
|
|
57
2
|
let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
|
|
58
3
|
return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
|
|
59
4
|
}, compat = {
|
|
60
|
-
patchDynamicTag,
|
|
61
|
-
queueEffect,
|
|
5
|
+
patchDynamicTag: require_control_flow.m,
|
|
6
|
+
queueEffect: require_control_flow.$t,
|
|
62
7
|
init(warp10Noop) {
|
|
63
|
-
|
|
8
|
+
require_control_flow.ht("$C_s", (scope) => {
|
|
64
9
|
if (getRenderScopes(scope.$)[scope.L] = scope, scope.m5c && classIdToBranch.set(scope.m5c, scope), classEventResolver) for (let key in scope) {
|
|
65
10
|
let resolved = classEventResolver(scope[key], scope);
|
|
66
11
|
resolved !== scope[key] && (scope[key] = resolved);
|
|
67
12
|
}
|
|
68
|
-
}),
|
|
13
|
+
}), require_control_flow.ht("$C_b", warp10Noop);
|
|
69
14
|
},
|
|
70
15
|
setClassEventResolver(fn) {
|
|
71
16
|
classEventResolver = fn;
|
|
@@ -89,16 +34,16 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
89
34
|
branch.S = startNode, branch.K = endNode;
|
|
90
35
|
},
|
|
91
36
|
runComponentEffects() {
|
|
92
|
-
this.effects &&
|
|
37
|
+
this.effects && require_control_flow.tn(this.effects);
|
|
93
38
|
},
|
|
94
39
|
runComponentDestroy() {
|
|
95
|
-
this.scope &&
|
|
40
|
+
this.scope && require_control_flow.Vt(this.scope);
|
|
96
41
|
},
|
|
97
42
|
resolveRegistered(value, $global) {
|
|
98
|
-
return Array.isArray(value) && typeof value[0] == "string" ?
|
|
43
|
+
return Array.isArray(value) && typeof value[0] == "string" ? require_control_flow._t(value[0], getRenderScopes($global)?.[value[1]]) : value;
|
|
99
44
|
},
|
|
100
45
|
createRenderer(params, clone) {
|
|
101
|
-
let renderer =
|
|
46
|
+
let renderer = require_control_flow.ct("", 0, 0, 0, params)();
|
|
102
47
|
return renderer.b = (branch) => {
|
|
103
48
|
let cloned = clone();
|
|
104
49
|
branch.S = cloned.startNode, branch.K = cloned.endNode;
|
|
@@ -110,13 +55,13 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
110
55
|
let input = args[0], normalizedInput = args[0] = {};
|
|
111
56
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
112
57
|
}
|
|
113
|
-
if (component.effects =
|
|
114
|
-
branch ||= (created = 1, component.scope =
|
|
115
|
-
}), created) return
|
|
58
|
+
if (component.effects = require_control_flow.Zt(() => {
|
|
59
|
+
branch ||= (created = 1, component.scope = require_control_flow.dt(out.global, renderer, renderer.e, document.body)), renderer.d?.(branch, renderer._ ? args[0] : args);
|
|
60
|
+
}), created) return require_control_flow.st(branch.S, branch.K);
|
|
116
61
|
}
|
|
117
62
|
}, _template = (id, template, walks, setup, inputSignal) => {
|
|
118
|
-
let renderer =
|
|
119
|
-
return renderer.mount = mount, renderer._ = renderer,
|
|
63
|
+
let renderer = require_control_flow.ct(id, template, walks, setup, inputSignal)();
|
|
64
|
+
return renderer.mount = mount, renderer._ = renderer, require_control_flow.ht(id, renderer);
|
|
120
65
|
};
|
|
121
66
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
122
67
|
//#region src/common/attr-tag.ts
|
|
@@ -130,1138 +75,6 @@ function* attrTagIterator() {
|
|
|
130
75
|
yield this, yield* this[rest];
|
|
131
76
|
}
|
|
132
77
|
//#endregion
|
|
133
|
-
//#region src/common/helpers.ts
|
|
134
|
-
function _call(fn, v) {
|
|
135
|
-
return fn(v), v;
|
|
136
|
-
}
|
|
137
|
-
function stringifyClassObject(name, value) {
|
|
138
|
-
return value ? name : "";
|
|
139
|
-
}
|
|
140
|
-
function stringifyStyleObject(name, value) {
|
|
141
|
-
return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
|
|
142
|
-
}
|
|
143
|
-
function escapeStyleAttr(str) {
|
|
144
|
-
return unsafeStyleAttrReg.test(str) ? str.replace(unsafeStyleAttrReg, replaceUnsafeStyleAttr) : str;
|
|
145
|
-
}
|
|
146
|
-
function escapeStyleValue(str) {
|
|
147
|
-
let closers = "", result = str.replace(/[\\"'{};<>]|\/(?=\*)/g, (c) => c === "<" ? "\\3C " : c === ";" ? "\\3B " : c === "{" ? "\\7B " : "\\" + c);
|
|
148
|
-
for (let c of result) c === "(" ? closers = ")" + closers : c === "[" ? closers = "]" + closers : c === closers[0] && (closers = closers.slice(1));
|
|
149
|
-
return result + closers;
|
|
150
|
-
}
|
|
151
|
-
function isEventHandler(name) {
|
|
152
|
-
return /^on[A-Z-]/.test(name);
|
|
153
|
-
}
|
|
154
|
-
function getEventHandlerName(name) {
|
|
155
|
-
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
156
|
-
}
|
|
157
|
-
function isNotVoid(value) {
|
|
158
|
-
return value != null && value !== !1;
|
|
159
|
-
}
|
|
160
|
-
function isPromise(value) {
|
|
161
|
-
return value != null && typeof value.then == "function";
|
|
162
|
-
}
|
|
163
|
-
function normalizeDynamicRenderer(value) {
|
|
164
|
-
if (value) {
|
|
165
|
-
if (typeof value == "string") return value;
|
|
166
|
-
let normalized = value.content || value.default || value;
|
|
167
|
-
if ("a" in normalized) return normalized;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function _assert_hoist(value) {}
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/common/for.ts
|
|
173
|
-
function forIn(obj, cb) {
|
|
174
|
-
for (let key in obj) cb(key, obj[key]);
|
|
175
|
-
}
|
|
176
|
-
function forOf(list, cb) {
|
|
177
|
-
if (list) {
|
|
178
|
-
let i = 0;
|
|
179
|
-
for (let item of list) cb(item, i++);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function forTo(to, from, step, cb) {
|
|
183
|
-
let start = from || 0, delta = step || 1;
|
|
184
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
185
|
-
}
|
|
186
|
-
function forUntil(until, from, step, cb) {
|
|
187
|
-
let start = from || 0, delta = step || 1;
|
|
188
|
-
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
189
|
-
}
|
|
190
|
-
//#endregion
|
|
191
|
-
//#region src/common/opt.ts
|
|
192
|
-
function toArray(opt) {
|
|
193
|
-
return opt ? Array.isArray(opt) ? opt : [opt] : [];
|
|
194
|
-
}
|
|
195
|
-
function forEach(opt, cb) {
|
|
196
|
-
if (opt) if (Array.isArray(opt)) for (let item of opt) cb(item);
|
|
197
|
-
else cb(opt);
|
|
198
|
-
}
|
|
199
|
-
function push(opt, item) {
|
|
200
|
-
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
201
|
-
}
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region src/dom/event.ts
|
|
204
|
-
function _on(element, type, handler) {
|
|
205
|
-
element["$" + type] === void 0 && delegate(type, handleDelegated), element["$" + type] = handler || null;
|
|
206
|
-
}
|
|
207
|
-
function handleDelegated(ev) {
|
|
208
|
-
let target = !rendering && ev.target;
|
|
209
|
-
for (; target;) target["$" + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
|
|
210
|
-
}
|
|
211
|
-
//#endregion
|
|
212
|
-
//#region src/dom/parse-html.ts
|
|
213
|
-
function parseHTML(html, ns) {
|
|
214
|
-
let parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
|
215
|
-
return parser.innerHTML = html, parser.content || parser;
|
|
216
|
-
}
|
|
217
|
-
//#endregion
|
|
218
|
-
//#region src/dom/scope.ts
|
|
219
|
-
function createScope($global, closestBranch) {
|
|
220
|
-
let scope = {
|
|
221
|
-
L: nextScopeId++,
|
|
222
|
-
H: runId,
|
|
223
|
-
F: closestBranch,
|
|
224
|
-
$: $global
|
|
225
|
-
};
|
|
226
|
-
return collectingScopes?.push(scope), scope;
|
|
227
|
-
}
|
|
228
|
-
function syncGen(scope) {
|
|
229
|
-
scope.H = runId;
|
|
230
|
-
}
|
|
231
|
-
function _assert_init(scope, accessor) {
|
|
232
|
-
return scope[accessor];
|
|
233
|
-
}
|
|
234
|
-
function collectScopes(fn) {
|
|
235
|
-
let prev = collectingScopes;
|
|
236
|
-
collectingScopes = [];
|
|
237
|
-
try {
|
|
238
|
-
return fn(), collectingScopes;
|
|
239
|
-
} finally {
|
|
240
|
-
collectingScopes = prev;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function skipScope() {
|
|
244
|
-
return nextScopeId++;
|
|
245
|
-
}
|
|
246
|
-
function findBranchWithKey(scope, key) {
|
|
247
|
-
let branch = scope.F;
|
|
248
|
-
for (; branch && branch[key] == null;) branch = branch.N;
|
|
249
|
-
return branch;
|
|
250
|
-
}
|
|
251
|
-
function destroyBranch(branch) {
|
|
252
|
-
branch.N?.D?.delete(branch), destroyNestedScopes(branch);
|
|
253
|
-
}
|
|
254
|
-
function destroyScope(scope) {
|
|
255
|
-
scope.H && (destroyNestedScopes(scope), cleanupScope(scope));
|
|
256
|
-
}
|
|
257
|
-
function cleanupScope(scope) {
|
|
258
|
-
scope.Z?.forEach(unsubscribe, scope);
|
|
259
|
-
for (let id in scope.A) $signalReset(scope, id);
|
|
260
|
-
}
|
|
261
|
-
function unsubscribe(subscribers) {
|
|
262
|
-
subscribers.delete(this);
|
|
263
|
-
}
|
|
264
|
-
function removeAndDestroyBranch(branch) {
|
|
265
|
-
destroyBranch(branch), removeChildNodes(branch.S, branch.K);
|
|
266
|
-
}
|
|
267
|
-
function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
268
|
-
insertChildNodes(parentNode, nextSibling, branch.S, branch.K);
|
|
269
|
-
}
|
|
270
|
-
function tempDetachBranch(branch) {
|
|
271
|
-
let fragment = new DocumentFragment();
|
|
272
|
-
fragment.namespaceURI = branch.S.parentNode.namespaceURI, insertChildNodes(fragment, null, branch.S, branch.K);
|
|
273
|
-
}
|
|
274
|
-
//#endregion
|
|
275
|
-
//#region src/dom/schedule.ts
|
|
276
|
-
function schedule() {
|
|
277
|
-
isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
|
|
278
|
-
}
|
|
279
|
-
function flushAndWaitFrame() {
|
|
280
|
-
requestAnimationFrame(triggerMacroTask), run();
|
|
281
|
-
}
|
|
282
|
-
function triggerMacroTask() {
|
|
283
|
-
channel || (channel = new MessageChannel(), channel.port1.onmessage = () => {
|
|
284
|
-
isScheduled = 0, run();
|
|
285
|
-
}), channel.port2.postMessage(0);
|
|
286
|
-
}
|
|
287
|
-
//#endregion
|
|
288
|
-
//#region src/dom/signals.ts
|
|
289
|
-
function _let(id, fn) {
|
|
290
|
-
let valueAccessor = decodeAccessor(id);
|
|
291
|
-
return (scope, value) => (rendering ? scope.H === runId && (scope[valueAccessor] = value, fn?.(scope)) : (scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn) && (schedule(), queueRender(scope, fn, id)), value);
|
|
292
|
-
}
|
|
293
|
-
function _let_change(id, fn) {
|
|
294
|
-
let valueAccessor = decodeAccessor(id), valueChangeAccessor = decodeAccessor(id + 1), base = _let(id, fn);
|
|
295
|
-
return (scope, value, valueChange) => (rendering ? (scope[valueChangeAccessor] = valueChange) && (scope[valueAccessor] !== value || !(valueAccessor in scope)) ? (scope[valueAccessor] = value, fn?.(scope)) : base(scope, value) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value) : base(scope, value), value);
|
|
296
|
-
}
|
|
297
|
-
function _const(valueAccessor, fn) {
|
|
298
|
-
return valueAccessor = decodeAccessor(valueAccessor), ((scope, value) => {
|
|
299
|
-
(scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn?.(scope));
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
|
|
303
|
-
return scopeIdAccessor !== "L" && (scopeIdAccessor = decodeAccessor(scopeIdAccessor)), (scope) => {
|
|
304
|
-
scope.H === runId ? ~id in scope ? --scope[~id] || fn(scope) : scope[~id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
308
|
-
ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor);
|
|
309
|
-
let scopeAccessor = "A" + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
|
310
|
-
let scopes = toArray(ownerScope[scopeAccessor]);
|
|
311
|
-
scopes.length && queueRender(ownerScope, () => {
|
|
312
|
-
for (let scope of scopes) scope.H > 0 && scope.H < runId && fn(scope);
|
|
313
|
-
}, -1, 0, scopes[0].L);
|
|
314
|
-
};
|
|
315
|
-
return ownerSignal._ = fn, ownerSignal;
|
|
316
|
-
}
|
|
317
|
-
function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccessor, fn) {
|
|
318
|
-
ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor), ownerValueAccessor = decodeAccessor(ownerValueAccessor), keyValueAccessor !== "M" && (keyValueAccessor = decodeAccessor(keyValueAccessor));
|
|
319
|
-
let scopeAccessor = "A" + ownerLoopNodeAccessor, mapAccessor = "O" + ownerLoopNodeAccessor, prevKeyProp = `_${ownerValueAccessor}`, ownerSignal = (ownerScope) => {
|
|
320
|
-
let scopes = toArray(ownerScope[scopeAccessor]);
|
|
321
|
-
if (ownerScope.H < runId && scopes.length) {
|
|
322
|
-
let nextKey = ownerScope[ownerValueAccessor];
|
|
323
|
-
queueRender(ownerScope, () => {
|
|
324
|
-
let map = keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor);
|
|
325
|
-
if (map && prevKeyProp in map) {
|
|
326
|
-
let prevScope = map.get(map[prevKeyProp]), nextScope = map.get(nextKey);
|
|
327
|
-
prevScope !== nextScope && (runLiveBranch(prevScope, fn), runLiveBranch(nextScope, fn));
|
|
328
|
-
} else for (let scope of toArray(ownerScope[scopeAccessor])) runLiveBranch(scope, fn);
|
|
329
|
-
map && (map[prevKeyProp] = nextKey);
|
|
330
|
-
}, -1, 0, scopes[0].L);
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
return ownerSignal._ = fn, ownerSignal;
|
|
334
|
-
}
|
|
335
|
-
function keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor) {
|
|
336
|
-
let map = ownerScope[mapAccessor] ||= /* @__PURE__ */ new Map();
|
|
337
|
-
if (!map.size) for (let scope of toArray(ownerScope[scopeAccessor])) {
|
|
338
|
-
let key = scope.M ?? scope[keyValueAccessor];
|
|
339
|
-
if (key === void 0) return ownerScope[mapAccessor] = null;
|
|
340
|
-
scope.M = key, map.set(key, scope);
|
|
341
|
-
}
|
|
342
|
-
return map;
|
|
343
|
-
}
|
|
344
|
-
function runLiveBranch(scope, fn) {
|
|
345
|
-
scope && scope.H > 0 && scope.H < runId && fn(scope);
|
|
346
|
-
}
|
|
347
|
-
function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
348
|
-
ownerConditionalNodeAccessor = decodeAccessor(ownerConditionalNodeAccessor);
|
|
349
|
-
let scopeAccessor = "A" + ownerConditionalNodeAccessor, branchAccessor = "D" + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
|
350
|
-
let ifScope = scope[scopeAccessor];
|
|
351
|
-
ifScope && ifScope.H > 0 && ifScope.H < runId && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, fn, -1);
|
|
352
|
-
};
|
|
353
|
-
return ownerSignal._ = fn, ownerSignal;
|
|
354
|
-
}
|
|
355
|
-
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
356
|
-
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set(), { size } = subscribers;
|
|
357
|
-
subscribers.add(scope).size !== size && trackCleanup(scope, subscribers);
|
|
358
|
-
}
|
|
359
|
-
function _closure(...closureSignals) {
|
|
360
|
-
let [firstSignal] = closureSignals, scopeInstances = firstSignal.a, signalIndex = firstSignal.b;
|
|
361
|
-
for (let i = closureSignals.length; i--;) closureSignals[i].c = i;
|
|
362
|
-
return (scope) => {
|
|
363
|
-
if (scope[scopeInstances]) for (let childScope of scope[scopeInstances]) childScope.H > 0 && childScope.H < runId && queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
367
|
-
valueAccessor = decodeAccessor(valueAccessor);
|
|
368
|
-
let closureSignal = ((scope) => {
|
|
369
|
-
scope[closureSignal.b] = closureSignal.c, fn(scope), subscribeToScopeSet(getOwnerScope ? getOwnerScope(scope) : scope._, closureSignal.a, scope);
|
|
370
|
-
});
|
|
371
|
-
return closureSignal.a = valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && _resume(resumeId, closureSignal), closureSignal;
|
|
372
|
-
}
|
|
373
|
-
function _child_setup(setup) {
|
|
374
|
-
return setup._ = (scope, owner) => {
|
|
375
|
-
scope._ = owner, queueRender(scope, setup, -1);
|
|
376
|
-
}, setup;
|
|
377
|
-
}
|
|
378
|
-
function _var(scope, childAccessor, signal) {
|
|
379
|
-
scope[decodeAccessor(childAccessor)].T = (value) => signal(scope, value);
|
|
380
|
-
}
|
|
381
|
-
function _return_change(scope, changeHandler) {
|
|
382
|
-
changeHandler && (scope.U = changeHandler);
|
|
383
|
-
}
|
|
384
|
-
function _id({ $: $global }) {
|
|
385
|
-
let id = tagIdsByGlobal.get($global) || 0;
|
|
386
|
-
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
|
387
|
-
}
|
|
388
|
-
function _script(id, fn) {
|
|
389
|
-
return _resume(id, fn), (scope) => {
|
|
390
|
-
queueEffect(scope, fn);
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
function _el_read(value) {
|
|
394
|
-
return value;
|
|
395
|
-
}
|
|
396
|
-
function* traverse(scope, path, i = path.length - 1) {
|
|
397
|
-
if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, i);
|
|
398
|
-
else {
|
|
399
|
-
let item = scope[path[i]];
|
|
400
|
-
i ? yield* traverse(item, path, i - 1) : yield typeof item == "function" ? item() : item;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
function _hoist(...path) {
|
|
404
|
-
return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
|
|
405
|
-
let fn = () => traverse(scope, path).next().value;
|
|
406
|
-
return fn[Symbol.iterator] = () => traverse(scope, path), fn;
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
function _hoist_resume(id, ...path) {
|
|
410
|
-
return _resume(id, _hoist(...path));
|
|
411
|
-
}
|
|
412
|
-
//#endregion
|
|
413
|
-
//#region src/dom/walker.ts
|
|
414
|
-
/** Cloned templates are small, where a TreeWalker's per-step cost dominates. */
|
|
415
|
-
function walk(startNode, walkCodes, branch) {
|
|
416
|
-
currentNode = startNode, walkInternal(0, walkCodes, branch);
|
|
417
|
-
}
|
|
418
|
-
//#endregion
|
|
419
|
-
//#region src/dom/resume.ts
|
|
420
|
-
function enableBranches() {
|
|
421
|
-
branchesEnabled || (branchesEnabled = 1, skipDestroyedRenders());
|
|
422
|
-
}
|
|
423
|
-
function ready(readyId) {
|
|
424
|
-
(readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
|
|
425
|
-
for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
|
|
426
|
-
}
|
|
427
|
-
function initEmbedded(readyId, runtimeId) {
|
|
428
|
-
embedRenders || (embedRenders = /* @__PURE__ */ new Map(), new MutationObserver(() => {
|
|
429
|
-
for (let [anchor, [renderId, scopes]] of embedRenders) if (!anchor.isConnected) {
|
|
430
|
-
embedRenders.delete(anchor), delete curRenders[renderId];
|
|
431
|
-
for (let id in scopes) destroyScope(scopes[id]);
|
|
432
|
-
}
|
|
433
|
-
}).observe(document, {
|
|
434
|
-
childList: !0,
|
|
435
|
-
subtree: !0
|
|
436
|
-
})), ready(readyId), init(runtimeId);
|
|
437
|
-
}
|
|
438
|
-
function init(runtimeId = "M") {
|
|
439
|
-
if (curRenders) return;
|
|
440
|
-
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
|
|
441
|
-
defineRuntime({ value: curRenders = ((renderId) => {
|
|
442
|
-
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
|
|
443
|
-
runtimeId,
|
|
444
|
-
renderId
|
|
445
|
-
}, initScope = (scope) => (scope.H = 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
446
|
-
let scopeId = partials[0];
|
|
447
|
-
for (let i = 1; i < partials.length; i++) {
|
|
448
|
-
let partial = partials[i];
|
|
449
|
-
typeof partial == "number" ? scopeId += partial : (scopeId ? initScope(Object.assign(scopeLookup[scopeId] ||= (partial.L = scopeId, partial), partial)) : Object.assign(initGlobal(), partial), scopeId++);
|
|
450
|
-
}
|
|
451
|
-
}, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], orphanBranches = [], deferredOwners = [], curBranchScopes) => (branchId, branch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, j = deferredOwners.length) => {
|
|
452
|
-
for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + lastToken, singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
|
|
453
|
-
if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
|
|
454
|
-
for (; startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling););
|
|
455
|
-
branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "'" && (branch.a = startVisit);
|
|
456
|
-
} else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
457
|
-
for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
|
|
458
|
-
for (; j && deferredOwners[j - 1].L > branchId;) {
|
|
459
|
-
j--;
|
|
460
|
-
let owner = deferredOwners.pop();
|
|
461
|
-
owner.F !== owner && (owner.F = branch);
|
|
462
|
-
}
|
|
463
|
-
nextToken();
|
|
464
|
-
}
|
|
465
|
-
if (endedBranches) {
|
|
466
|
-
for (let ended of endedBranches) orphanBranches.push(ended);
|
|
467
|
-
singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
|
|
468
|
-
}
|
|
469
|
-
visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : deferredOwners.push(visitScope);
|
|
470
|
-
}, nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
|
|
471
|
-
let i = 0;
|
|
472
|
-
for (; i < resumes.length; i++) {
|
|
473
|
-
let serialized = resumes[i];
|
|
474
|
-
if (typeof serialized == "string") for (lastTokenIndex = 0, visitText = serialized; nextToken();) /\D/.test(lastToken) ? lastEffect = registeredValues[lastToken] : effects.push(lastEffect, getScope(lastToken));
|
|
475
|
-
else if (Array.isArray(serialized)) {
|
|
476
|
-
if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
|
|
477
|
-
} else if (readyIds && typeof serialized == "number") break;
|
|
478
|
-
else {
|
|
479
|
-
let scopes = serialized(serializeContext);
|
|
480
|
-
Array.isArray(scopes) && applyScopes(scopes);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return resumes.splice(0, i), i;
|
|
484
|
-
}, lastEffect, visits, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, visitBranches, embedAnchor;
|
|
485
|
-
return serializeContext._ = registeredValues, render.m = (effects) => {
|
|
486
|
-
if (processResumes(render.r, effects), readyIds && render.b) for (let progress = 1; progress;) {
|
|
487
|
-
progress = 0;
|
|
488
|
-
for (let readyId of readyIds) {
|
|
489
|
-
let resumes = render.b[readyId];
|
|
490
|
-
resumes && processResumes(resumes, effects) && (progress = 1);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
let retained = 0;
|
|
494
|
-
for (visit of visits = render.v) if (lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), visitType === "*") {
|
|
495
|
-
let prev = visit.previousSibling;
|
|
496
|
-
visitScope[nextToken()] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
|
|
497
|
-
} else branchesEnabled ? (visitBranches ||= createVisitBranches())() : render.b && (visits[retained++] = visit);
|
|
498
|
-
return embedRenders && !embedAnchor && visit && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
|
|
499
|
-
}, render.w = () => {
|
|
500
|
-
walk(), runResumeEffects(render);
|
|
501
|
-
}, render;
|
|
502
|
-
}) });
|
|
503
|
-
};
|
|
504
|
-
if (renders) {
|
|
505
|
-
initRuntime(renders);
|
|
506
|
-
for (let renderId in renders) runResumeEffects(curRenders(renderId));
|
|
507
|
-
} else defineRuntime({
|
|
508
|
-
configurable: !0,
|
|
509
|
-
set: initRuntime
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
function runResumeEffects(render) {
|
|
513
|
-
try {
|
|
514
|
-
isResuming = 1, runEffects(render.m([]), 1);
|
|
515
|
-
} finally {
|
|
516
|
-
isResuming = 0;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
function getRegisteredWithScope(id, scope) {
|
|
520
|
-
let val = registeredValues[id];
|
|
521
|
-
return scope ? val(scope) : val;
|
|
522
|
-
}
|
|
523
|
-
function _resume(id, obj) {
|
|
524
|
-
return registeredValues[id] = obj;
|
|
525
|
-
}
|
|
526
|
-
function _var_resume(id, signal) {
|
|
527
|
-
return _resume(id, (scope) => (value) => signal(scope, value)), signal;
|
|
528
|
-
}
|
|
529
|
-
function _el(id, accessor) {
|
|
530
|
-
return accessor = decodeAccessor(accessor), _resume(id, (scope) => () => scope[accessor]);
|
|
531
|
-
}
|
|
532
|
-
//#endregion
|
|
533
|
-
//#region src/dom/renderer.ts
|
|
534
|
-
function createBranch($global, renderer, parentScope, parentNode) {
|
|
535
|
-
let branch = createScope($global);
|
|
536
|
-
return branch._ = renderer.e || parentScope, setParentBranch(branch, parentScope?.F), renderer.b?.(branch, parentNode.namespaceURI), branch;
|
|
537
|
-
}
|
|
538
|
-
function setParentBranch(branch, parentBranch) {
|
|
539
|
-
parentBranch && (branch.N = parentBranch, (parentBranch.D ||= /* @__PURE__ */ new Set()).add(branch)), branch.F = branch;
|
|
540
|
-
}
|
|
541
|
-
function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
542
|
-
return setupBranch(renderer, createBranch($global, renderer, parentScope, parentNode));
|
|
543
|
-
}
|
|
544
|
-
function setupBranch(renderer, branch) {
|
|
545
|
-
return renderer.c && queueRender(branch, renderer.c, -1), branch;
|
|
546
|
-
}
|
|
547
|
-
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
548
|
-
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
|
|
549
|
-
let clone = template ? (branch, ns) => {
|
|
550
|
-
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(template, ns))(branch, walks);
|
|
551
|
-
} : (branch) => {
|
|
552
|
-
walk(branch.S = branch.K = new Text(), walks, branch);
|
|
553
|
-
};
|
|
554
|
-
return (owner) => ({
|
|
555
|
-
a: id,
|
|
556
|
-
b: clone,
|
|
557
|
-
e: owner,
|
|
558
|
-
c: setup,
|
|
559
|
-
d: params,
|
|
560
|
-
f: dynamicScopesAccessor
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
564
|
-
return _resume(id, _content(id, template, walks, setup, params, dynamicScopesAccessor));
|
|
565
|
-
}
|
|
566
|
-
function _content_closures(renderer, closureFns) {
|
|
567
|
-
let closureSignals = {};
|
|
568
|
-
for (let key in closureFns) closureSignals[key] = _const(+key, closureFns[key]);
|
|
569
|
-
return (owner, closureValues) => {
|
|
570
|
-
let instance = renderer(owner);
|
|
571
|
-
return instance.g = closureSignals, instance.h = closureValues, instance;
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
function createCloneableHTML(html, ns) {
|
|
575
|
-
let { firstChild, lastChild } = parseHTML(html, ns), parent = document.createElementNS(ns, "t");
|
|
576
|
-
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
|
|
577
|
-
walk(branch.S = branch.K = firstChild.cloneNode(!0), walks, branch);
|
|
578
|
-
} : (branch, walks) => {
|
|
579
|
-
let clone = parent.cloneNode(!0);
|
|
580
|
-
walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
//#endregion
|
|
584
|
-
//#region src/dom/dom.ts
|
|
585
|
-
function _to_text(value) {
|
|
586
|
-
return value || value === 0 ? value + "" : "";
|
|
587
|
-
}
|
|
588
|
-
function _attr(element, name, value) {
|
|
589
|
-
setAttribute(element, name, normalizeAttrValue(value));
|
|
590
|
-
}
|
|
591
|
-
function setAttribute(element, name, value) {
|
|
592
|
-
element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
|
|
593
|
-
}
|
|
594
|
-
function _attr_class(element, value) {
|
|
595
|
-
setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassObject) || void 0);
|
|
596
|
-
}
|
|
597
|
-
function _attr_class_items(element, items) {
|
|
598
|
-
for (let key in items) _attr_class_item(element, key, items[key]);
|
|
599
|
-
}
|
|
600
|
-
function _attr_class_item(element, name, value) {
|
|
601
|
-
element.classList.toggle(name, !!value);
|
|
602
|
-
}
|
|
603
|
-
function _attr_style(element, value) {
|
|
604
|
-
setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleObject) || void 0);
|
|
605
|
-
}
|
|
606
|
-
function _attr_style_items(element, items) {
|
|
607
|
-
for (let key in items) _attr_style_item(element, key, items[key]);
|
|
608
|
-
}
|
|
609
|
-
function _attr_style_item(element, name, value) {
|
|
610
|
-
element.style.setProperty(name, _to_text(value));
|
|
611
|
-
}
|
|
612
|
-
function _style_shell(scope, nodeAccessor) {
|
|
613
|
-
let element = scope[nodeAccessor], id = _id(scope);
|
|
614
|
-
_attr_nonce(scope, nodeAccessor), element.className = id, _text_content(element, "." + id + "~*{}");
|
|
615
|
-
}
|
|
616
|
-
function _style_rule_item(element, name, value) {
|
|
617
|
-
let text = element.textContent, decl = name + ":" + escapeStyleValue(_to_text(value)) + ";", start = text.indexOf("{" + name + ":");
|
|
618
|
-
~start || (start = text.indexOf(";" + name + ":")), _text_content(element, ~start ? text.slice(0, ++start) + decl + text.slice(text.indexOf(";", start) + 1) : text.slice(0, -1) + decl + "}");
|
|
619
|
-
}
|
|
620
|
-
function _attr_nonce(scope, nodeAccessor) {
|
|
621
|
-
_attr(scope[nodeAccessor], "nonce", scope.$.cspNonce);
|
|
622
|
-
}
|
|
623
|
-
function _text(node, value) {
|
|
624
|
-
let normalizedValue = _to_text(value);
|
|
625
|
-
node.data !== normalizedValue && (node.data = normalizedValue);
|
|
626
|
-
}
|
|
627
|
-
function _text_content(node, value) {
|
|
628
|
-
let normalizedValue = _to_text(value);
|
|
629
|
-
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
|
630
|
-
}
|
|
631
|
-
function _attrs(scope, nodeAccessor, nextAttrs, controllable) {
|
|
632
|
-
let el = scope[nodeAccessor];
|
|
633
|
-
for (let i = el.attributes.length; i--;) {
|
|
634
|
-
let { name } = el.attributes.item(i);
|
|
635
|
-
nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)) || el.removeAttribute(name);
|
|
636
|
-
}
|
|
637
|
-
attrsInternal(scope, nodeAccessor, nextAttrs, controllable);
|
|
638
|
-
}
|
|
639
|
-
function _attrs_content(scope, nodeAccessor, nextAttrs, controllable) {
|
|
640
|
-
_attrs(scope, nodeAccessor, nextAttrs, controllable), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
641
|
-
}
|
|
642
|
-
function hasAttrAlias(element, attr, nextAttrs) {
|
|
643
|
-
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
|
644
|
-
}
|
|
645
|
-
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
646
|
-
let el = scope[nodeAccessor], partial = {};
|
|
647
|
-
for (let i = el.attributes.length; i--;) {
|
|
648
|
-
let { name } = el.attributes.item(i);
|
|
649
|
-
!skip[name] && !(nextAttrs && name in nextAttrs) && el.removeAttribute(name);
|
|
650
|
-
}
|
|
651
|
-
for (let name in nextAttrs) {
|
|
652
|
-
let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
653
|
-
skip[key] || (partial[key] = nextAttrs[name]);
|
|
654
|
-
}
|
|
655
|
-
attrsInternal(scope, nodeAccessor, partial, controllable);
|
|
656
|
-
}
|
|
657
|
-
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
658
|
-
_attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
659
|
-
}
|
|
660
|
-
function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
661
|
-
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor], skip;
|
|
662
|
-
for (let name in events) events[name] = 0;
|
|
663
|
-
controllable && (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, nextAttrs && (skip = controllable(scope, nodeAccessor, nextAttrs)));
|
|
664
|
-
for (let name in nextAttrs) {
|
|
665
|
-
let value = nextAttrs[name];
|
|
666
|
-
switch (name) {
|
|
667
|
-
case "class":
|
|
668
|
-
_attr_class(el, value);
|
|
669
|
-
break;
|
|
670
|
-
case "style":
|
|
671
|
-
_attr_style(el, value);
|
|
672
|
-
break;
|
|
673
|
-
default:
|
|
674
|
-
isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
function _attr_content(scope, nodeAccessor, value) {
|
|
680
|
-
let content = normalizeClientRender(value);
|
|
681
|
-
scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = content?.a) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
|
|
682
|
-
for (let accessor in content?.g) content.g[accessor](scope["A" + nodeAccessor], content.h[accessor]);
|
|
683
|
-
}
|
|
684
|
-
function _attrs_script(scope, nodeAccessor) {
|
|
685
|
-
let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
|
|
686
|
-
controllableScripts[scope["F" + nodeAccessor]]?.(scope, nodeAccessor);
|
|
687
|
-
for (let name in events) _on(el, name, events[name]);
|
|
688
|
-
}
|
|
689
|
-
function _html(scope, value, accessor) {
|
|
690
|
-
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(_to_text(value), parentNode.namespaceURI);
|
|
691
|
-
insertChildNodes(parentNode, firstChild, scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), scope["H" + accessor] = newContent.lastChild), removeChildNodes(firstChild, lastChild);
|
|
692
|
-
}
|
|
693
|
-
function normalizeClientRender(value) {
|
|
694
|
-
let renderer = normalizeDynamicRenderer(value);
|
|
695
|
-
if (renderer && renderer.a) return renderer;
|
|
696
|
-
}
|
|
697
|
-
function normalizeAttrValue(value) {
|
|
698
|
-
if (isNotVoid(value)) return value === !0 ? "" : value + "";
|
|
699
|
-
}
|
|
700
|
-
function _lifecycle(scope, thisObj, index = 0) {
|
|
701
|
-
let accessor = "K" + index, instance = scope[accessor];
|
|
702
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), $signal(scope, accessor).onabort = () => thisObj.onDestroy?.());
|
|
703
|
-
}
|
|
704
|
-
function removeChildNodes(startNode, endNode) {
|
|
705
|
-
let stop = endNode.nextSibling;
|
|
706
|
-
for (; startNode !== stop;) {
|
|
707
|
-
let next = startNode.nextSibling;
|
|
708
|
-
startNode.remove(), startNode = next;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
712
|
-
if (parentNode.isConnected) parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
713
|
-
else {
|
|
714
|
-
let stop = endNode.nextSibling;
|
|
715
|
-
for (; startNode !== stop;) {
|
|
716
|
-
let next = startNode.nextSibling;
|
|
717
|
-
parentNode.insertBefore(startNode, referenceNode), startNode = next;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
return parentNode;
|
|
721
|
-
}
|
|
722
|
-
function toInsertNode(startNode, endNode) {
|
|
723
|
-
return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
|
|
724
|
-
}
|
|
725
|
-
//#endregion
|
|
726
|
-
//#region src/dom/resolve-cursor-position.ts
|
|
727
|
-
function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
|
|
728
|
-
if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
|
|
729
|
-
let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
|
|
730
|
-
if (updatedValue.startsWith(before)) return initialPosition;
|
|
731
|
-
if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
|
|
732
|
-
let count = before.replace(R, "").length, pos = 0;
|
|
733
|
-
for (; count && updatedValue[pos];) updatedValue[pos++].replace(R, "") && count--;
|
|
734
|
-
return pos;
|
|
735
|
-
}
|
|
736
|
-
return -1;
|
|
737
|
-
}
|
|
738
|
-
//#endregion
|
|
739
|
-
//#region src/dom/controllable.ts
|
|
740
|
-
function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
741
|
-
let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
|
|
742
|
-
if (el.defaultChecked !== normalizedChecked) {
|
|
743
|
-
let restoreValue = scope.H < runId ? el.checked : normalizedChecked;
|
|
744
|
-
el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
/** Filled by the latches a compiled page emits, so a page carries only the
|
|
748
|
-
* control kinds its tags can be (`_attrs_script` resolves the kind at run time). */
|
|
749
|
-
/** The render pass equivalent, for a tag whose name is only known at run time;
|
|
750
|
-
* a statically named tag passes its claim to `_attrs` instead. */
|
|
751
|
-
function _enable_controllable_input() {
|
|
752
|
-
controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
|
|
753
|
-
}
|
|
754
|
-
function _enable_controllable_textarea() {
|
|
755
|
-
controllableScripts[2] = _attr_input_value_script;
|
|
756
|
-
}
|
|
757
|
-
function _enable_controllable_select() {
|
|
758
|
-
controllableScripts[3] = _attr_select_value_script;
|
|
759
|
-
}
|
|
760
|
-
function _enable_controllable_open() {
|
|
761
|
-
controllableScripts[4] = _attr_details_or_dialog_open_script;
|
|
762
|
-
}
|
|
763
|
-
/** A run-time tag name can be any controllable, so its page enables them all. */
|
|
764
|
-
function _enable_controllable() {
|
|
765
|
-
_enable_controllable_input(), _enable_controllable_select(), _enable_controllable_open(), controllableRenders.INPUT = _controllable_input, controllableRenders.TEXTAREA = _controllable_textarea, controllableRenders.SELECT = _controllable_select, controllableRenders.DETAILS = controllableRenders.DIALOG = _controllable_open;
|
|
766
|
-
}
|
|
767
|
-
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
768
|
-
let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
|
|
769
|
-
scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange && scope.H < runId ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
770
|
-
}
|
|
771
|
-
function _attr_input_checked_script(scope, nodeAccessor) {
|
|
772
|
-
let el = scope[nodeAccessor];
|
|
773
|
-
syncControllableFormInput(el, hasCheckboxChanged, () => {
|
|
774
|
-
let checkedChange = scope["E" + nodeAccessor];
|
|
775
|
-
if (checkedChange) {
|
|
776
|
-
let newValue = el.checked;
|
|
777
|
-
el.checked = !newValue, checkedChange(newValue), run();
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
function _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, value) {
|
|
782
|
-
let multiple = Array.isArray(checkedValue), normalizedValue = normalizeStrProp(value), normalizedCheckedValue = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
783
|
-
_attr(scope[nodeAccessor], "value", value), _attr_input_checked_default(scope, nodeAccessor, multiple ? normalizedCheckedValue.includes(normalizedValue) : normalizedValue === normalizedCheckedValue);
|
|
784
|
-
}
|
|
785
|
-
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
786
|
-
let el = scope[nodeAccessor], multiple = Array.isArray(checkedValue), normalizedCheckedValue = scope["G" + nodeAccessor] = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
787
|
-
scope["E" + nodeAccessor] = checkedValueChange, scope["F" + nodeAccessor] = checkedValueChange ? 1 : 5, checkedValueChange && scope.H < runId ? (el.checked = multiple ? normalizedCheckedValue.includes(normalizeStrProp(value)) : normalizeStrProp(value) === normalizedCheckedValue, _attr(el, "value", value)) : _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, value);
|
|
788
|
-
}
|
|
789
|
-
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
790
|
-
let el = scope[nodeAccessor];
|
|
791
|
-
isResuming && el.defaultChecked && (scope["G" + nodeAccessor] ? scope["G" + nodeAccessor].push(el.value) : scope["G" + nodeAccessor] = el.value), syncControllableFormInput(el, hasCheckboxChanged, () => {
|
|
792
|
-
let checkedValueChange = scope["E" + nodeAccessor];
|
|
793
|
-
if (checkedValueChange) {
|
|
794
|
-
let controlledValueKey = "G" + nodeAccessor, oldValue = scope[controlledValueKey], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
795
|
-
if (el.name && el.type[0] === "r") for (let radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) radio.form === el.form && (newValue === void 0 && radio.defaultChecked && (newValue = radio.value), radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : controlledValueKey in scope ? oldValue === radio.value : radio.defaultChecked);
|
|
796
|
-
else el.checked = !el.checked;
|
|
797
|
-
checkedValueChange(newValue), run();
|
|
798
|
-
}
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
802
|
-
let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
|
|
803
|
-
if (el.defaultValue !== normalizedValue) {
|
|
804
|
-
let restoreValue = scope.H < runId ? el.value : normalizedValue;
|
|
805
|
-
el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
|
|
809
|
-
let el = scope[nodeAccessor];
|
|
810
|
-
/i[ot]|e[cns]|^[bi]/.test(el.type) ? _attr(el, "value", value) : _attr_input_value_default(scope, nodeAccessor, value);
|
|
811
|
-
}
|
|
812
|
-
function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
|
|
813
|
-
let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
|
|
814
|
-
scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, normalizedValue);
|
|
815
|
-
}
|
|
816
|
-
function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
|
|
817
|
-
_attr(scope[nodeAccessor], "value", value);
|
|
818
|
-
}
|
|
819
|
-
function _attr_input_value_script(scope, nodeAccessor) {
|
|
820
|
-
let el = scope[nodeAccessor];
|
|
821
|
-
isResuming && (scope["G" + nodeAccessor] = el.defaultValue), syncControllableFormInput(el, hasValueChanged, (ev) => {
|
|
822
|
-
let valueChange = scope["E" + nodeAccessor];
|
|
823
|
-
valueChange && (inputType = ev?.inputType, valueChange(el.value), run(), setInputValue(el, scope["G" + nodeAccessor]), inputType = "");
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
function setInputValue(el, value) {
|
|
827
|
-
if (el.value !== value) {
|
|
828
|
-
let updatedPosition = resolveCursorPosition(inputType, document.activeElement === el && el.selectionStart, el.value, el.value = value);
|
|
829
|
-
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
833
|
-
let restoreValue, el = scope[nodeAccessor], live = scope.H < runId, multiple = Array.isArray(value), normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
834
|
-
pendingEffects.unshift(() => {
|
|
835
|
-
for (let opt of el.options) {
|
|
836
|
-
let selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
|
|
837
|
-
opt.defaultSelected !== selected && (live && (restoreValue ??= getSelectValue(el, multiple)), opt.defaultSelected = selected);
|
|
838
|
-
}
|
|
839
|
-
restoreValue !== void 0 && setSelectValue(el, restoreValue, multiple);
|
|
840
|
-
}, scope);
|
|
841
|
-
}
|
|
842
|
-
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
|
843
|
-
let el = scope[nodeAccessor], existing = scope.H < runId, multiple = Array.isArray(value), normalizedValue = scope["G" + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
844
|
-
scope["E" + nodeAccessor] = valueChange, scope["F" + nodeAccessor] = valueChange ? 3 : 5, valueChange && existing ? pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope) : _attr_select_value_default(scope, nodeAccessor, normalizedValue);
|
|
845
|
-
}
|
|
846
|
-
function _attr_select_value_script(scope, nodeAccessor) {
|
|
847
|
-
let el = scope[nodeAccessor], onChange = () => {
|
|
848
|
-
let valueChange = scope["E" + nodeAccessor];
|
|
849
|
-
if (valueChange) {
|
|
850
|
-
let oldValue = scope["G" + nodeAccessor], multiple = Array.isArray(oldValue), newValue = getSelectValue(el, multiple);
|
|
851
|
-
setSelectValue(el, oldValue, multiple), valueChange(newValue), run();
|
|
852
|
-
}
|
|
853
|
-
};
|
|
854
|
-
if (isResuming) if (el.multiple) {
|
|
855
|
-
scope["G" + nodeAccessor] = [];
|
|
856
|
-
for (let opt of el.options) opt.defaultSelected && scope["G" + nodeAccessor].push(opt.value);
|
|
857
|
-
} else {
|
|
858
|
-
scope["G" + nodeAccessor] = "";
|
|
859
|
-
for (let opt of el.options) if (opt.defaultSelected) {
|
|
860
|
-
scope["G" + nodeAccessor] = opt.value;
|
|
861
|
-
break;
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
syncControllableFormInput(el, hasSelectChanged, onChange), observeOnce(scope, nodeAccessor, {
|
|
865
|
-
childList: !0,
|
|
866
|
-
subtree: !0
|
|
867
|
-
}, () => {
|
|
868
|
-
let value = scope["G" + nodeAccessor];
|
|
869
|
-
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) && onChange();
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
function setSelectValue(el, value, multiple) {
|
|
873
|
-
if (multiple) for (let opt of el.options) opt.selected = value.includes(opt.value);
|
|
874
|
-
else el.value = value;
|
|
875
|
-
}
|
|
876
|
-
function getSelectValue(el, multiple) {
|
|
877
|
-
return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
|
|
878
|
-
}
|
|
879
|
-
function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
|
|
880
|
-
scope.H === runId && (scope[nodeAccessor].open = isNotVoid(open));
|
|
881
|
-
}
|
|
882
|
-
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
883
|
-
let normalizedOpen = scope["G" + nodeAccessor] = isNotVoid(open);
|
|
884
|
-
scope["E" + nodeAccessor] = openChange, scope["F" + nodeAccessor] = openChange ? 4 : 5, openChange && scope.H < runId ? scope[nodeAccessor].open = normalizedOpen : _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
|
|
885
|
-
}
|
|
886
|
-
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
887
|
-
let el = scope[nodeAccessor];
|
|
888
|
-
observeOnce(scope, nodeAccessor, {
|
|
889
|
-
attributes: !0,
|
|
890
|
-
attributeFilter: ["open"]
|
|
891
|
-
}, () => {
|
|
892
|
-
let openChange = scope["E" + nodeAccessor];
|
|
893
|
-
if (openChange && el.open === !scope["G" + nodeAccessor]) {
|
|
894
|
-
let newValue = el.open;
|
|
895
|
-
el.open = !newValue, openChange(newValue), run();
|
|
896
|
-
}
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
function observeOnce(scope, nodeAccessor, init, callback) {
|
|
900
|
-
(scope["N" + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
|
|
901
|
-
}
|
|
902
|
-
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
903
|
-
el._ = onChange, delegate("input", handleChange), el.form && delegate("reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange);
|
|
904
|
-
}
|
|
905
|
-
function handleChange(ev) {
|
|
906
|
-
ev.target._?.(ev);
|
|
907
|
-
}
|
|
908
|
-
function handleFormReset(ev) {
|
|
909
|
-
let handlers = [];
|
|
910
|
-
for (let el of ev.target.elements) el._ && hasFormElementChanged(el) && handlers.push(el._);
|
|
911
|
-
requestAnimationFrame(() => {
|
|
912
|
-
if (!ev.defaultPrevented) for (let change of handlers) change();
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
function hasValueChanged(el) {
|
|
916
|
-
return el.value !== el.defaultValue;
|
|
917
|
-
}
|
|
918
|
-
function hasCheckboxChanged(el) {
|
|
919
|
-
return el.checked !== el.defaultChecked;
|
|
920
|
-
}
|
|
921
|
-
function hasSelectChanged(el) {
|
|
922
|
-
for (let opt of el.options) if (opt.selected !== opt.defaultSelected) return !0;
|
|
923
|
-
}
|
|
924
|
-
function hasFormElementChanged(el) {
|
|
925
|
-
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
|
926
|
-
}
|
|
927
|
-
function normalizeStrProp(value) {
|
|
928
|
-
return normalizeAttrValue(value) || "";
|
|
929
|
-
}
|
|
930
|
-
function updateList(arr, val, push) {
|
|
931
|
-
let index = arr.indexOf(val);
|
|
932
|
-
return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
|
|
933
|
-
}
|
|
934
|
-
function _controllable_input(scope, nodeAccessor, nextAttrs) {
|
|
935
|
-
return "checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), /^(?:value|checked(?:Value)?)(?:Change)?$/) : _controllable_textarea(scope, nodeAccessor, nextAttrs, _attr_input_value_dynamic_default);
|
|
936
|
-
}
|
|
937
|
-
function _controllable_textarea(scope, nodeAccessor, nextAttrs, dynamicDefault) {
|
|
938
|
-
if ("value" in nextAttrs || "valueChange" in nextAttrs) return _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, dynamicDefault), /^value(?:Change)?$/;
|
|
939
|
-
}
|
|
940
|
-
function _controllable_select(scope, nodeAccessor, nextAttrs) {
|
|
941
|
-
if ("value" in nextAttrs || "valueChange" in nextAttrs) return _attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), /^value(?:Change)?$/;
|
|
942
|
-
}
|
|
943
|
-
function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
944
|
-
if ("open" in nextAttrs || "openChange" in nextAttrs) return _attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), /^open(?:Change)?$/;
|
|
945
|
-
}
|
|
946
|
-
//#endregion
|
|
947
|
-
//#region src/dom/control-flow.ts
|
|
948
|
-
function _await_promise(nodeAccessor, params) {
|
|
949
|
-
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
950
|
-
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor;
|
|
951
|
-
_enable_catch();
|
|
952
|
-
let resolveAwait = (scope, referenceNode, value) => {
|
|
953
|
-
let awaitBranch = scope[branchAccessor];
|
|
954
|
-
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
955
|
-
}, awaitPromise = (scope, promise) => {
|
|
956
|
-
!isPromise(promise) && scope[promiseAccessor] && (promise = Promise.resolve(promise));
|
|
957
|
-
let awaitBranch = scope[branchAccessor], tryPlaceholder = findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch;
|
|
958
|
-
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
959
|
-
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
960
|
-
return;
|
|
961
|
-
}
|
|
962
|
-
if (!isPromise(promise)) {
|
|
963
|
-
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
let awaitCounter = tryBranch.O;
|
|
967
|
-
placeholderShown.add(pendingEffects), !tryPlaceholder && !awaitCounter?.i && (awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
968
|
-
if (tryBranch === scope[branchAccessor]) {
|
|
969
|
-
let anchor = scope[nodeAccessor];
|
|
970
|
-
if (anchor.parentNode) {
|
|
971
|
-
let detachedParent = scope[branchAccessor].S.parentNode;
|
|
972
|
-
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
973
|
-
}
|
|
974
|
-
} else dismissPlaceholder(tryBranch);
|
|
975
|
-
})), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
976
|
-
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
977
|
-
}, -1)))));
|
|
978
|
-
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
979
|
-
if (thisPromise === scope[promiseAccessor]) {
|
|
980
|
-
let referenceNode = scope[nodeAccessor];
|
|
981
|
-
if (scope[promiseAccessor] = 0, scope.F?.H === 0) {
|
|
982
|
-
awaitCounter.c(), run();
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
queueAsyncRender(scope, () => {
|
|
986
|
-
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
987
|
-
let pendingRenders = awaitBranch.W;
|
|
988
|
-
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
989
|
-
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
990
|
-
for (let i = 0; i < pendingEffects.length;) {
|
|
991
|
-
let fn = pendingEffects[i++], scopes = fnScopes.get(fn);
|
|
992
|
-
scopes || fnScopes.set(fn, scopes = /* @__PURE__ */ new Set()), scopes.add(pendingEffects[i++]);
|
|
993
|
-
}
|
|
994
|
-
for (let i = 0; i < effects.length;) {
|
|
995
|
-
let fn = effects[i++], scope = effects[i++];
|
|
996
|
-
fnScopes.get(fn)?.has(scope) || queueEffect(scope, fn);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
}, (error) => {
|
|
1002
|
-
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, tryPlaceholder && !awaitCounter.m ? awaitCounter.c() : awaitCounter.i = 0, queueAsyncRender(scope, renderCatch, error));
|
|
1003
|
-
});
|
|
1004
|
-
};
|
|
1005
|
-
return awaitPromise;
|
|
1006
|
-
}
|
|
1007
|
-
function _await_content(nodeAccessor, template, walks, setup) {
|
|
1008
|
-
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1009
|
-
let branchAccessor = "A" + nodeAccessor, promiseAccessor = "L" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
1010
|
-
return (scope) => {
|
|
1011
|
-
let pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer);
|
|
1012
|
-
scope[branchAccessor].Y = pendingScopes;
|
|
1013
|
-
let resolveSync = scope[promiseAccessor];
|
|
1014
|
-
typeof resolveSync == "function" && (scope[promiseAccessor] = 0, resolveSync());
|
|
1015
|
-
};
|
|
1016
|
-
}
|
|
1017
|
-
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
|
|
1018
|
-
if (!tryBranch) return;
|
|
1019
|
-
let awaitCounter = tryBranch.O;
|
|
1020
|
-
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1021
|
-
insertBranchBefore(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q, tryBranch._, tryBranch.S.parentNode), tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
|
|
1022
|
-
}, -1)))), awaitCounter;
|
|
1023
|
-
}
|
|
1024
|
-
function createAwaitCounter(tryBranch, done) {
|
|
1025
|
-
let awaitCounter = tryBranch.O = {
|
|
1026
|
-
i: 0,
|
|
1027
|
-
c() {
|
|
1028
|
-
if (--awaitCounter.i) return 1;
|
|
1029
|
-
done(), queueEffect(tryBranch, runPendingEffects);
|
|
1030
|
-
}
|
|
1031
|
-
};
|
|
1032
|
-
return awaitCounter;
|
|
1033
|
-
}
|
|
1034
|
-
function runPendingEffects(scope) {
|
|
1035
|
-
let effects = scope.J;
|
|
1036
|
-
effects && (scope.J = [], runEffects(effects, 1));
|
|
1037
|
-
}
|
|
1038
|
-
function dismissPlaceholder(tryBranch) {
|
|
1039
|
-
let placeholderBranch = tryBranch.P;
|
|
1040
|
-
placeholderBranch && (tryBranch.P = 0, placeholderBranch.S.parentNode.insertBefore(tryBranch.S.parentNode, placeholderBranch.S), removeAndDestroyBranch(placeholderBranch));
|
|
1041
|
-
}
|
|
1042
|
-
function _try(nodeAccessor, template, walks, setup) {
|
|
1043
|
-
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1044
|
-
let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
1045
|
-
return (scope, input) => {
|
|
1046
|
-
scope[branchAccessor] || setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1047
|
-
let branch = scope[branchAccessor];
|
|
1048
|
-
branch && (branch.C = nodeAccessor, branch.E = input.catch && (normalizeDynamicRenderer(input.catch) || 0), branch.Q = normalizeDynamicRenderer(input.placeholder));
|
|
1049
|
-
};
|
|
1050
|
-
}
|
|
1051
|
-
function renderCatch(scope, error) {
|
|
1052
|
-
let tryWithCatch = findBranchWithKey(scope, "E");
|
|
1053
|
-
if (tryWithCatch) {
|
|
1054
|
-
let owner = tryWithCatch._, placeholderBranch = tryWithCatch.P;
|
|
1055
|
-
placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(owner, tryWithCatch.C, tryWithCatch.E, createAndSetupBranch), tryWithCatch.E?.d?.(owner["A" + tryWithCatch.C], [error]);
|
|
1056
|
-
} else throw error;
|
|
1057
|
-
}
|
|
1058
|
-
function _if(nodeAccessor, ...branchesArgs) {
|
|
1059
|
-
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1060
|
-
let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
|
|
1061
|
-
for (; i < branchesArgs.length;) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
|
|
1062
|
-
return enableBranches(), (scope, newBranch) => {
|
|
1063
|
-
newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) && setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
|
|
1064
|
-
};
|
|
1065
|
-
}
|
|
1066
|
-
function _show(nodeAccessor, startNodeAccessor, endNodeAccessor) {
|
|
1067
|
-
nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor)), endNodeAccessor !== void 0 && (endNodeAccessor = decodeAccessor(endNodeAccessor));
|
|
1068
|
-
let rangeAccessor = "A" + nodeAccessor;
|
|
1069
|
-
return enableBranches(), (scope, display) => {
|
|
1070
|
-
let referenceNode = scope[nodeAccessor], onlyChild = referenceNode.nodeType === 1, parentNode = onlyChild ? referenceNode : referenceNode.parentNode, range = scope[rangeAccessor];
|
|
1071
|
-
range || (range = scope[rangeAccessor] = {}, range.S = onlyChild ? parentNode.firstChild : scope[startNodeAccessor], range.K = onlyChild ? parentNode.lastChild : endNodeAccessor === void 0 ? referenceNode.previousSibling : scope[endNodeAccessor]);
|
|
1072
|
-
let startNode = range.S;
|
|
1073
|
-
if (range.L && startNode === range.K && startNode.tagName === "T") {
|
|
1074
|
-
let wrapper = startNode;
|
|
1075
|
-
wrapper.firstChild || wrapper.appendChild(new Text()), range = scope[rangeAccessor] = {}, range.S = startNode = wrapper.firstChild, range.K = wrapper.lastChild, wrapper.replaceWith(...wrapper.childNodes);
|
|
1076
|
-
}
|
|
1077
|
-
let inDom = onlyChild ? !!parentNode.firstChild : startNode.parentNode === parentNode;
|
|
1078
|
-
display ? inDom || insertBranchBefore(range, parentNode, onlyChild ? null : referenceNode) : inDom && (onlyChild && (range.S = parentNode.firstChild, range.K = parentNode.lastChild), tempDetachBranch(range));
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1081
|
-
function patchDynamicTag(fn) {
|
|
1082
|
-
_dynamic_tag = fn(_dynamic_tag);
|
|
1083
|
-
}
|
|
1084
|
-
function _dynamic_tag_content(nodeAccessor) {
|
|
1085
|
-
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1086
|
-
let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
|
|
1087
|
-
return enableBranches(), (scope, renderer) => {
|
|
1088
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.a || renderer) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
function _resume_dynamic_tag() {
|
|
1092
|
-
_resume("d", dynamicTagScript);
|
|
1093
|
-
}
|
|
1094
|
-
function dynamicTagScript(branch) {
|
|
1095
|
-
_attrs_script(branch, "a");
|
|
1096
|
-
}
|
|
1097
|
-
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch) {
|
|
1098
|
-
let referenceNode = scope[nodeAccessor], prevBranch = scope["A" + nodeAccessor], parentNode = referenceNode.nodeType > 1 ? (prevBranch?.S || referenceNode).parentNode : referenceNode, newBranch = scope["A" + nodeAccessor] = newRenderer && createBranch(scope.$, newRenderer, scope, parentNode);
|
|
1099
|
-
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.S) : parentNode.insertBefore(referenceNode, prevBranch.S), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
|
|
1100
|
-
}
|
|
1101
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1102
|
-
function loop(forEach) {
|
|
1103
|
-
return (nodeAccessor, template, walks, setup, params) => {
|
|
1104
|
-
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
1105
|
-
let scopesAccessor = "A" + nodeAccessor, keyedScopesAccessor = "O" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
1106
|
-
return enableBranches(), (scope, value) => {
|
|
1107
|
-
let referenceNode = scope[nodeAccessor], oldScopes = toArray(scope[scopesAccessor]), newScopes = scope[scopesAccessor] = [];
|
|
1108
|
-
scope[keyedScopesAccessor] = null;
|
|
1109
|
-
let oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves, start = 0;
|
|
1110
|
-
forEach(value, (key, args) => {
|
|
1111
|
-
let i = newScopes.length, oldScope = oldScopes[i], branch = oldLen && (oldScopesByKey || key !== (oldScope?.M ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope.I = j, map.set(scope.M ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
1112
|
-
branch ? (hasPotentialMoves = !0, oldScopesByKey?.delete(key)) : branch = createAndSetupBranch(scope.$, renderer, scope, parentNode), branch.M = key, newScopes.push(branch), params?.(branch, args);
|
|
1113
|
-
});
|
|
1114
|
-
let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1;
|
|
1115
|
-
if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
|
|
1116
|
-
oldLen && (oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch), hasSiblings || (parentNode.textContent = ""));
|
|
1117
|
-
for (let newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
|
|
1118
|
-
return;
|
|
1119
|
-
}
|
|
1120
|
-
if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
|
|
1121
|
-
else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
|
|
1122
|
-
for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd];) oldEnd--, newEnd--;
|
|
1123
|
-
if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd || start > newEnd) {
|
|
1124
|
-
for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
1125
|
-
return;
|
|
1126
|
-
}
|
|
1127
|
-
let diffLen = newEnd - start + 1, sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
|
|
1128
|
-
for (let i = diffLen; i--;) sources[i] = newScopes[start + i].I ?? -1;
|
|
1129
|
-
for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
|
|
1130
|
-
else {
|
|
1131
|
-
for (lo = 0, hi = tail; lo < hi;) mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
|
|
1132
|
-
sources[i] < sources[tails[lo]] && (lo > 0 && (pred[i] = tails[lo - 1]), tails[lo] = i);
|
|
1133
|
-
}
|
|
1134
|
-
for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
|
|
1135
|
-
for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
|
|
1136
|
-
};
|
|
1137
|
-
};
|
|
1138
|
-
}
|
|
1139
|
-
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
|
1140
|
-
let branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
|
|
1141
|
-
return typeof tagNameOrRenderer == "string" ? branch.a = branch.S = branch.K = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer) : setupBranch(tagNameOrRenderer, branch), branch;
|
|
1142
|
-
}
|
|
1143
|
-
function bySecondArg(_item, index) {
|
|
1144
|
-
return index;
|
|
1145
|
-
}
|
|
1146
|
-
function byFirstArg(name) {
|
|
1147
|
-
return name;
|
|
1148
|
-
}
|
|
1149
|
-
//#endregion
|
|
1150
|
-
//#region src/dom/queue.ts
|
|
1151
|
-
function queueRender(scope, signal, signalKey, value, scopeKey = scope.L) {
|
|
1152
|
-
let render;
|
|
1153
|
-
if (signalKey >= 0 && (render = scope[signalKey])) {
|
|
1154
|
-
if (render.d = value, render.e === runId || catchEnabled && render.f) return;
|
|
1155
|
-
render.e = runId;
|
|
1156
|
-
} else render = {
|
|
1157
|
-
a: scopeKey * 1e6 + signalKey,
|
|
1158
|
-
b: scope,
|
|
1159
|
-
c: signal,
|
|
1160
|
-
d: value,
|
|
1161
|
-
e: runId
|
|
1162
|
-
}, signalKey >= 0 && (scope[signalKey] = render);
|
|
1163
|
-
queuePendingRender(render);
|
|
1164
|
-
}
|
|
1165
|
-
function queuePendingRender(render) {
|
|
1166
|
-
let i = pendingRenders.push(render) - 1;
|
|
1167
|
-
for (; i;) {
|
|
1168
|
-
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
|
1169
|
-
if (render.a - parent.a >= 0) break;
|
|
1170
|
-
pendingRenders[i] = parent, i = parentIndex;
|
|
1171
|
-
}
|
|
1172
|
-
pendingRenders[i] = render;
|
|
1173
|
-
}
|
|
1174
|
-
function queueEffect(scope, fn) {
|
|
1175
|
-
pendingEffects.push(fn, scope);
|
|
1176
|
-
}
|
|
1177
|
-
function run() {
|
|
1178
|
-
let effects = pendingEffects;
|
|
1179
|
-
try {
|
|
1180
|
-
rendering = 1, runRenders();
|
|
1181
|
-
} finally {
|
|
1182
|
-
runId++, rendering = 0, pendingRenders = [], pendingEffects = [];
|
|
1183
|
-
}
|
|
1184
|
-
runEffects(effects);
|
|
1185
|
-
}
|
|
1186
|
-
function queueAsyncRender(scope, signal, value) {
|
|
1187
|
-
queueRender(scope, signal, -1, value), queueMicrotask(run);
|
|
1188
|
-
}
|
|
1189
|
-
function prepareEffects(fn) {
|
|
1190
|
-
let prevRenders = pendingRenders, prevEffects = pendingEffects, preparedEffects = pendingEffects = [];
|
|
1191
|
-
pendingRenders = [];
|
|
1192
|
-
try {
|
|
1193
|
-
rendering = 1, fn(), runRenders();
|
|
1194
|
-
} finally {
|
|
1195
|
-
runId++, rendering = 0, pendingRenders = prevRenders, pendingEffects = prevEffects;
|
|
1196
|
-
}
|
|
1197
|
-
return preparedEffects;
|
|
1198
|
-
}
|
|
1199
|
-
function runRenders() {
|
|
1200
|
-
for (; pendingRenders.length;) {
|
|
1201
|
-
let render = pendingRenders[0], item = pendingRenders.pop();
|
|
1202
|
-
if (render !== item) {
|
|
1203
|
-
let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).a;
|
|
1204
|
-
for (; i < mid;) {
|
|
1205
|
-
let bestChild = (i << 1) + 1, right = bestChild + 1;
|
|
1206
|
-
if (right < pendingRenders.length && pendingRenders[right].a - pendingRenders[bestChild].a < 0 && (bestChild = right), pendingRenders[bestChild].a - key >= 0) break;
|
|
1207
|
-
pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
|
|
1208
|
-
}
|
|
1209
|
-
pendingRenders[i] = item;
|
|
1210
|
-
}
|
|
1211
|
-
runRender(render);
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
function skipDestroyedRenders() {
|
|
1215
|
-
runRender = ((runRender) => (render) => {
|
|
1216
|
-
render.b.F?.H !== 0 && runRender(render);
|
|
1217
|
-
})(runRender);
|
|
1218
|
-
}
|
|
1219
|
-
function _enable_catch() {
|
|
1220
|
-
if (!catchEnabled) {
|
|
1221
|
-
catchEnabled = 1, enableBranches();
|
|
1222
|
-
let handlePendingTry = (fn, scope, branch) => {
|
|
1223
|
-
for (; branch;) {
|
|
1224
|
-
if (branch.O?.i) return (branch.J ||= []).push(fn, scope);
|
|
1225
|
-
branch = branch.N;
|
|
1226
|
-
}
|
|
1227
|
-
};
|
|
1228
|
-
runEffects = ((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
|
|
1229
|
-
if (checkPending || caughtError.has(effects)) {
|
|
1230
|
-
let i = 0, fn, scope, branch;
|
|
1231
|
-
for (; i < effects.length;) fn = effects[i++], scope = effects[i++], (branch = scope.F)?.H !== 0 && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope);
|
|
1232
|
-
} else runEffects(effects);
|
|
1233
|
-
})(runEffects), runRender = ((runRender) => (render) => {
|
|
1234
|
-
try {
|
|
1235
|
-
let branch = render.b.F;
|
|
1236
|
-
for (; branch;) {
|
|
1237
|
-
if (branch.W) return render.f = 1, branch.W.push(render);
|
|
1238
|
-
branch = branch.N;
|
|
1239
|
-
}
|
|
1240
|
-
render.f = 0, runRender(render);
|
|
1241
|
-
} catch (error) {
|
|
1242
|
-
renderCatch(render.b, error);
|
|
1243
|
-
}
|
|
1244
|
-
})(runRender);
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
//#endregion
|
|
1248
|
-
//#region src/dom/abort-signal.ts
|
|
1249
|
-
function $signalReset(scope, id) {
|
|
1250
|
-
let ctrl = scope.A?.[id];
|
|
1251
|
-
ctrl && (scope.A[id] = void 0, rendering ? queueEffect(ctrl, abort) : abort(ctrl));
|
|
1252
|
-
}
|
|
1253
|
-
function $signal(scope, id) {
|
|
1254
|
-
return trackCleanup(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
|
|
1255
|
-
}
|
|
1256
|
-
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
1257
|
-
function trackCleanup(scope, subscribers) {
|
|
1258
|
-
let branch = scope.F;
|
|
1259
|
-
branch && (branch.B ||= /* @__PURE__ */ new Set()).add(scope), subscribers && (scope.Z ||= []).push(subscribers);
|
|
1260
|
-
}
|
|
1261
|
-
function abort(ctrl) {
|
|
1262
|
-
ctrl.abort();
|
|
1263
|
-
}
|
|
1264
|
-
//#endregion
|
|
1265
78
|
//#region src/common/compat-meta.ts
|
|
1266
79
|
//#endregion
|
|
1267
80
|
//#region src/dom/compat.ts
|
|
@@ -1287,76 +100,75 @@ function mount(input = {}, reference, position) {
|
|
|
1287
100
|
parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
|
1288
101
|
break;
|
|
1289
102
|
}
|
|
1290
|
-
let curValue, args = this.d, effects =
|
|
1291
|
-
branch =
|
|
103
|
+
let curValue, args = this.d, effects = require_control_flow.Zt(() => {
|
|
104
|
+
branch = require_control_flow.ft($global, this, void 0, parentNode), branch.T = (newValue) => {
|
|
1292
105
|
curValue = newValue;
|
|
1293
106
|
}, this.c?.(branch), args?.(branch, input);
|
|
1294
107
|
});
|
|
1295
|
-
return
|
|
108
|
+
return require_control_flow.ot(parentNode, nextSibling, branch.S, branch.K), require_control_flow.tn(effects), {
|
|
1296
109
|
get value() {
|
|
1297
110
|
return curValue;
|
|
1298
111
|
},
|
|
1299
112
|
set value(newValue) {
|
|
1300
|
-
|
|
113
|
+
require_control_flow.zt(branch, newValue);
|
|
1301
114
|
},
|
|
1302
115
|
update(newInput = {}) {
|
|
1303
|
-
args && (newInput.$global && ({$global, ...newInput} = newInput),
|
|
116
|
+
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.tn(require_control_flow.Zt(() => {
|
|
1304
117
|
args(branch, newInput);
|
|
1305
118
|
})));
|
|
1306
119
|
},
|
|
1307
120
|
destroy() {
|
|
1308
|
-
|
|
121
|
+
require_control_flow.Ut(branch);
|
|
1309
122
|
}
|
|
1310
123
|
};
|
|
1311
124
|
}
|
|
1312
125
|
//#endregion
|
|
1313
126
|
//#region src/dom/load.ts
|
|
1314
127
|
function _load_template(id, load) {
|
|
1315
|
-
_enable_catch();
|
|
1316
128
|
let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
1317
|
-
let awaitCounter =
|
|
129
|
+
let awaitCounter = require_control_flow.p(branch);
|
|
1318
130
|
branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
|
|
1319
|
-
Object.assign(lazyTemplate, renderer),
|
|
131
|
+
Object.assign(lazyTemplate, renderer), require_control_flow.Qt(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
|
|
1320
132
|
}, loadFailed(branch, awaitCounter));
|
|
1321
133
|
}, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d }))));
|
|
1322
134
|
return lazyTemplate;
|
|
1323
135
|
}
|
|
1324
136
|
function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
1325
|
-
nodeAccessor =
|
|
137
|
+
nodeAccessor = require_control_flow.ln(nodeAccessor), childScopeAccessor = require_control_flow.ln(childScopeAccessor);
|
|
1326
138
|
let pending, renderer;
|
|
1327
|
-
return
|
|
139
|
+
return (owner) => {
|
|
1328
140
|
let child = owner[childScopeAccessor];
|
|
1329
141
|
if (renderer) insertLoaded(renderer, child, owner[nodeAccessor]);
|
|
1330
142
|
else {
|
|
1331
|
-
let awaitCounter =
|
|
143
|
+
let awaitCounter = require_control_flow.p(owner);
|
|
1332
144
|
child.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((mod) => {
|
|
1333
|
-
renderer =
|
|
145
|
+
renderer = require_control_flow.ct("", ...mod._)(), require_control_flow.Qt(child, (child) => insertLoaded(renderer, child, owner[nodeAccessor], awaitCounter));
|
|
1334
146
|
}, loadFailed(child, awaitCounter));
|
|
1335
147
|
}
|
|
1336
148
|
};
|
|
1337
149
|
}
|
|
1338
150
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
1339
151
|
let parent = marker.parentNode, values = branch.X, insert = () => {
|
|
1340
|
-
|
|
152
|
+
require_control_flow.Ht(branch, parent, marker), marker.remove(), awaitCounter?.c();
|
|
1341
153
|
}, remaining;
|
|
1342
|
-
if (
|
|
154
|
+
if (require_control_flow.Wt(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0, remaining = values?.size) {
|
|
1343
155
|
let fail = loadFailed(branch, awaitCounter);
|
|
1344
156
|
for (let [promise, entry] of values) promise.then((signal) => {
|
|
1345
|
-
entry.b = signal, --remaining ||
|
|
1346
|
-
|
|
157
|
+
entry.b = signal, --remaining || require_control_flow.Qt(branch, (branch) => {
|
|
158
|
+
require_control_flow.Wt(branch), renderer.c?.(branch), values.forEach((e) => e.b._(branch, e.a)), insert();
|
|
1347
159
|
});
|
|
1348
160
|
}, (error) => remaining > 0 && (remaining = 0, fail(error)));
|
|
1349
|
-
} else
|
|
161
|
+
} else require_control_flow.pt(renderer, branch), insert();
|
|
1350
162
|
}
|
|
1351
163
|
function loadFailed(scope, awaitCounter) {
|
|
1352
164
|
return (error) => {
|
|
1353
|
-
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()),
|
|
165
|
+
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), require_control_flow.Qt(scope, require_control_flow.h, error);
|
|
1354
166
|
};
|
|
1355
167
|
}
|
|
1356
168
|
function _load_signal(load) {
|
|
1357
169
|
let pending, signal;
|
|
1358
170
|
return (scope, value) => {
|
|
1359
|
-
pending ||= load(), scope.X || !("X" in scope) && scope.H ===
|
|
171
|
+
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.nn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => require_control_flow.Qt(scope, signal = mod._, value), () => 0);
|
|
1360
172
|
};
|
|
1361
173
|
}
|
|
1362
174
|
function _load_visible_trigger(selector, options) {
|
|
@@ -1382,9 +194,9 @@ function _load_race_trigger(...triggers) {
|
|
|
1382
194
|
function getSelectorOrResolve(selector, resolve) {
|
|
1383
195
|
return document.querySelector(selector) || resolve();
|
|
1384
196
|
}
|
|
1385
|
-
exports.$signal =
|
|
197
|
+
exports.$signal = require_control_flow.Kt, exports.$signalReset = require_control_flow.qt, exports._assert_hoist = require_control_flow.sn, exports._assert_init = require_control_flow.Bt, exports._attr = require_control_flow.z, exports._attr_class = require_control_flow.B, exports._attr_class_item = require_control_flow.V, exports._attr_class_items = require_control_flow.H, exports._attr_content = require_control_flow.U, exports._attr_details_open = require_control_flow.g, exports._attr_dialog_open = require_control_flow.g, exports._attr_details_open_default = require_control_flow._, exports._attr_dialog_open_default = require_control_flow._, exports._attr_details_open_script = require_control_flow.v, exports._attr_dialog_open_script = require_control_flow.v, exports._attr_input_checked = require_control_flow.y, exports._attr_input_checkedValue = require_control_flow.b, exports._attr_input_checkedValue_default = require_control_flow.x, exports._attr_input_checkedValue_script = require_control_flow.S, exports._attr_input_checked_default = require_control_flow.C, exports._attr_input_checked_script = require_control_flow.w, exports._attr_input_value = require_control_flow.T, exports._attr_textarea_value = require_control_flow.T, exports._attr_input_value_attribute_default = require_control_flow.E, exports._attr_input_value_default = require_control_flow.D, exports._attr_textarea_value_default = require_control_flow.D, exports._attr_input_value_dynamic_default = require_control_flow.O, exports._attr_input_value_script = require_control_flow.k, exports._attr_textarea_value_script = require_control_flow.k, exports._attr_nonce = require_control_flow.W, exports._attr_select_value = require_control_flow.A, exports._attr_select_value_default = require_control_flow.j, exports._attr_select_value_script = require_control_flow.M, exports._attr_style = require_control_flow.G, exports._attr_style_item = require_control_flow.K, exports._attr_style_items = require_control_flow.q, exports._attrs = require_control_flow.J, exports._attrs_content = require_control_flow.Y, exports._attrs_partial = require_control_flow.X, exports._attrs_partial_content = require_control_flow.Z, exports._attrs_script = require_control_flow.Q, exports._await_content = require_control_flow.t, exports._await_promise = require_control_flow.n, exports._call = require_control_flow.cn, exports._child_setup = require_control_flow.xt, exports._closure = require_control_flow.St, exports._closure_get = require_control_flow.Ct, exports._const = require_control_flow.wt, exports._content = require_control_flow.ct, exports._content_closures = require_control_flow.lt, exports._content_resume = require_control_flow.ut, exports._controllable_input = require_control_flow.N, exports._controllable_open = require_control_flow.P, exports._controllable_select = require_control_flow.F, exports._controllable_textarea = require_control_flow.I, Object.defineProperty(exports, "_dynamic_tag", {
|
|
1386
198
|
enumerable: !0,
|
|
1387
199
|
get: function() {
|
|
1388
|
-
return
|
|
200
|
+
return require_control_flow.r;
|
|
1389
201
|
}
|
|
1390
|
-
}), exports._dynamic_tag_content =
|
|
202
|
+
}), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.mt, exports._el_read = require_control_flow.Tt, exports._for_closure = require_control_flow.Et, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_selector = require_control_flow.Dt, exports._for_to = require_control_flow.s, exports._for_until = require_control_flow.c, exports._hoist = require_control_flow.Ot, exports._hoist_resume = require_control_flow.kt, exports._html = require_control_flow.$, exports._id = require_control_flow.At, exports._if = require_control_flow.l, exports._if_closure = require_control_flow.jt, exports._let = require_control_flow.Mt, exports._let_change = require_control_flow.Nt, exports._lifecycle = require_control_flow.et, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = require_control_flow.Gt, exports._or = require_control_flow.Pt, exports._resume = require_control_flow.ht, exports._resume_dynamic_tag = require_control_flow.u, exports._return = require_control_flow.Ft, exports._return_change = require_control_flow.It, exports._script = require_control_flow.Lt, exports._show = require_control_flow.d, exports._style_rule_item = require_control_flow.tt, exports._style_shell = require_control_flow.nt, exports._template = _template, exports._text = require_control_flow.rt, exports._text_content = require_control_flow.it, exports._to_text = require_control_flow.at, exports._try = require_control_flow.f, exports._var = require_control_flow.Rt, exports._var_change = require_control_flow.zt, exports._var_resume = require_control_flow.gt, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.rn, exports.forOf = require_control_flow.in, exports.forTo = require_control_flow.an, exports.forUntil = require_control_flow.on, exports.init = require_control_flow.vt, exports.initEmbedded = require_control_flow.yt, exports.ready = require_control_flow.bt, exports.run = require_control_flow.en;
|