marko 6.0.60 → 6.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/types.d.ts +4 -3
- package/dist/debug/dom.js +350 -378
- package/dist/debug/dom.mjs +350 -378
- package/dist/debug/html.js +268 -263
- package/dist/debug/html.mjs +218 -213
- package/dist/dom/abort-signal.d.ts +2 -2
- package/dist/dom/control-flow.d.ts +8 -8
- package/dist/dom/controllable.d.ts +11 -11
- package/dist/dom/dom.d.ts +17 -18
- package/dist/dom/event.d.ts +1 -1
- package/dist/dom/queue.d.ts +1 -1
- package/dist/dom/renderer.d.ts +4 -4
- package/dist/dom/resume.d.ts +3 -3
- package/dist/dom/signals.d.ts +14 -14
- package/dist/dom/template.d.ts +1 -1
- package/dist/dom.d.ts +10 -10
- package/dist/dom.js +285 -305
- package/dist/dom.mjs +285 -305
- package/dist/html/attrs.d.ts +14 -14
- package/dist/html/compat.d.ts +5 -5
- package/dist/html/content.d.ts +4 -4
- package/dist/html/dynamic-tag.d.ts +3 -3
- package/dist/html/template.d.ts +1 -1
- package/dist/html/writer.d.ts +26 -26
- package/dist/html.d.ts +5 -5
- package/dist/html.js +263 -254
- package/dist/html.mjs +213 -204
- package/dist/translator/index.js +500 -482
- package/dist/translator/util/runtime.d.ts +8 -8
- package/dist/translator/util/signals.d.ts +1 -1
- package/package.json +1 -1
package/dist/dom.js
CHANGED
@@ -17,87 +17,88 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0
|
|
17
17
|
// src/dom.ts
|
18
18
|
var dom_exports = {};
|
19
19
|
__export(dom_exports, {
|
20
|
-
|
20
|
+
$signal: () => $signal,
|
21
|
+
$signalReset: () => $signalReset,
|
22
|
+
_attr: () => _attr,
|
23
|
+
_attr_class: () => _attr_class,
|
24
|
+
_attr_class_item: () => _attr_class_item,
|
25
|
+
_attr_class_items: () => _attr_class_items,
|
26
|
+
_attr_content: () => _attr_content,
|
27
|
+
_attr_details_open: () => _attr_details_or_dialog_open,
|
28
|
+
_attr_details_open_script: () => _attr_details_or_dialog_open_script,
|
29
|
+
_attr_dialog_open: () => _attr_details_or_dialog_open,
|
30
|
+
_attr_dialog_open_script: () => _attr_details_or_dialog_open_script,
|
31
|
+
_attr_input_checked: () => _attr_input_checked,
|
32
|
+
_attr_input_checkedValue: () => _attr_input_checkedValue,
|
33
|
+
_attr_input_checkedValue_script: () => _attr_input_checkedValue_script,
|
34
|
+
_attr_input_checked_script: () => _attr_input_checked_script,
|
35
|
+
_attr_input_value: () => _attr_input_value,
|
36
|
+
_attr_input_value_script: () => _attr_input_value_script,
|
37
|
+
_attr_select_value: () => _attr_select_value,
|
38
|
+
_attr_select_value_script: () => _attr_select_value_script,
|
39
|
+
_attr_style: () => _attr_style,
|
40
|
+
_attr_style_item: () => _attr_style_item,
|
41
|
+
_attr_style_items: () => _attr_style_items,
|
42
|
+
_attr_textarea_value: () => _attr_input_value,
|
43
|
+
_attr_textarea_value_script: () => _attr_input_value_script,
|
44
|
+
_attrs: () => _attrs,
|
45
|
+
_attrs_content: () => _attrs_content,
|
46
|
+
_attrs_partial: () => _attrs_partial,
|
47
|
+
_attrs_partial_content: () => _attrs_partial_content,
|
48
|
+
_attrs_script: () => _attrs_script,
|
49
|
+
_await: () => _await,
|
50
|
+
_closure: () => _closure,
|
51
|
+
_closure_get: () => _closure_get,
|
52
|
+
_const: () => _const,
|
53
|
+
_content: () => _content,
|
54
|
+
_content_branch: () => _content_branch,
|
55
|
+
_content_closures: () => _content_closures,
|
56
|
+
_content_resume: () => _content_resume,
|
57
|
+
_dynamic_tag: () => _dynamic_tag,
|
58
|
+
_el: () => _el,
|
59
|
+
_enable_catch: () => _enable_catch,
|
60
|
+
_for_closure: () => _for_closure,
|
61
|
+
_for_in: () => _for_in,
|
62
|
+
_for_of: () => _for_of,
|
63
|
+
_for_to: () => _for_to,
|
64
|
+
_hoist: () => _hoist,
|
65
|
+
_html: () => _html,
|
66
|
+
_id: () => _id,
|
67
|
+
_if: () => _if,
|
68
|
+
_if_closure: () => _if_closure,
|
69
|
+
_let: () => _let,
|
70
|
+
_lifecycle: () => _lifecycle,
|
71
|
+
_on: () => _on,
|
72
|
+
_or: () => _or,
|
73
|
+
_resume: () => _resume,
|
74
|
+
_return: () => _return,
|
75
|
+
_return_change: () => _return_change,
|
76
|
+
_script: () => _script,
|
77
|
+
_template: () => _template,
|
78
|
+
_text: () => _text,
|
79
|
+
_text_content: () => _text_content,
|
80
|
+
_try: () => _try,
|
81
|
+
_var: () => _var,
|
82
|
+
_var_change: () => _var_change,
|
83
|
+
_var_resume: () => _var_resume,
|
21
84
|
attrTag: () => attrTag,
|
22
85
|
attrTags: () => attrTags,
|
23
|
-
attrs: () => attrs,
|
24
|
-
attrsAndContent: () => attrsAndContent,
|
25
|
-
attrsEvents: () => attrsEvents,
|
26
|
-
awaitTag: () => awaitTag,
|
27
|
-
classAttr: () => classAttr,
|
28
|
-
classItem: () => classItem,
|
29
|
-
classItems: () => classItems,
|
30
86
|
compat: () => compat,
|
31
|
-
conditional: () => conditional,
|
32
|
-
conditionalClosure: () => conditionalClosure,
|
33
|
-
controllable_detailsOrDialog_open: () => controllable_detailsOrDialog_open,
|
34
|
-
controllable_detailsOrDialog_open_effect: () => controllable_detailsOrDialog_open_effect,
|
35
|
-
controllable_input_checked: () => controllable_input_checked,
|
36
|
-
controllable_input_checkedValue: () => controllable_input_checkedValue,
|
37
|
-
controllable_input_checkedValue_effect: () => controllable_input_checkedValue_effect,
|
38
|
-
controllable_input_checked_effect: () => controllable_input_checked_effect,
|
39
|
-
controllable_input_value: () => controllable_input_value,
|
40
|
-
controllable_input_value_effect: () => controllable_input_value_effect,
|
41
|
-
controllable_select_value: () => controllable_select_value,
|
42
|
-
controllable_select_value_effect: () => controllable_select_value_effect,
|
43
|
-
controllable_textarea_value: () => controllable_input_value,
|
44
|
-
controllable_textarea_value_effect: () => controllable_input_value_effect,
|
45
|
-
createContent: () => createContent,
|
46
|
-
createRenderer: () => createRenderer,
|
47
|
-
createTemplate: () => createTemplate,
|
48
|
-
createTry: () => createTry,
|
49
|
-
data: () => data,
|
50
|
-
dynamicClosure: () => dynamicClosure,
|
51
|
-
dynamicClosureRead: () => dynamicClosureRead,
|
52
|
-
dynamicTag: () => dynamicTag,
|
53
|
-
effect: () => effect,
|
54
|
-
enableCatch: () => enableCatch,
|
55
87
|
forIn: () => forIn,
|
56
88
|
forOf: () => forOf,
|
57
89
|
forTo: () => forTo,
|
58
|
-
getAbortSignal: () => getAbortSignal,
|
59
|
-
hoist: () => hoist,
|
60
|
-
html: () => html,
|
61
90
|
init: () => init,
|
62
|
-
|
63
|
-
intersection: () => intersection,
|
64
|
-
lifecycle: () => lifecycle,
|
65
|
-
localClosures: () => localClosures,
|
66
|
-
loopClosure: () => loopClosure,
|
67
|
-
loopIn: () => loopIn,
|
68
|
-
loopOf: () => loopOf,
|
69
|
-
loopTo: () => loopTo,
|
70
|
-
nextTagId: () => nextTagId,
|
71
|
-
nodeRef: () => nodeRef,
|
72
|
-
on: () => on,
|
73
|
-
partialAttrs: () => partialAttrs,
|
74
|
-
partialAttrsAndContent: () => partialAttrsAndContent,
|
75
|
-
props: () => props,
|
76
|
-
register: () => register,
|
77
|
-
registerBoundSignal: () => registerBoundSignal,
|
78
|
-
registerContent: () => registerContent,
|
79
|
-
resetAbortSignal: () => resetAbortSignal,
|
80
|
-
run: () => run,
|
81
|
-
setTagVar: () => setTagVar,
|
82
|
-
setTagVarChange: () => setTagVarChange,
|
83
|
-
state: () => state,
|
84
|
-
styleAttr: () => styleAttr,
|
85
|
-
styleItem: () => styleItem,
|
86
|
-
styleItems: () => styleItems,
|
87
|
-
tagVarSignal: () => tagVarSignal,
|
88
|
-
tagVarSignalChange: () => tagVarSignalChange,
|
89
|
-
textContent: () => textContent,
|
90
|
-
value: () => value
|
91
|
+
run: () => run
|
91
92
|
});
|
92
93
|
module.exports = __toCommonJS(dom_exports);
|
93
94
|
|
94
95
|
// src/common/attr-tag.ts
|
95
96
|
var empty = [], rest = Symbol();
|
96
|
-
function attrTag(
|
97
|
-
return
|
97
|
+
function attrTag(attrs) {
|
98
|
+
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
98
99
|
}
|
99
|
-
function attrTags(first,
|
100
|
-
return first ? (first[rest] === empty ? first[rest] = [
|
100
|
+
function attrTags(first, attrs) {
|
101
|
+
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
101
102
|
}
|
102
103
|
function* attrTagIterator() {
|
103
104
|
yield this, yield* this[rest];
|
@@ -125,14 +126,14 @@ function forTo(to, from, step, cb) {
|
|
125
126
|
function classValue(classValue2) {
|
126
127
|
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
127
128
|
}
|
128
|
-
function stringifyClassObject(name,
|
129
|
-
return
|
129
|
+
function stringifyClassObject(name, value) {
|
130
|
+
return value ? name : "";
|
130
131
|
}
|
131
132
|
function styleValue(styleValue2) {
|
132
133
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
133
134
|
}
|
134
|
-
function stringifyStyleObject(name,
|
135
|
-
return
|
135
|
+
function stringifyStyleObject(name, value) {
|
136
|
+
return value || value === 0 ? name + ":" + value : "";
|
136
137
|
}
|
137
138
|
function toDelimitedString(val, delimiter, stringify) {
|
138
139
|
let str = "", sep = "", part;
|
@@ -153,13 +154,13 @@ function isEventHandler(name) {
|
|
153
154
|
function getEventHandlerName(name) {
|
154
155
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
155
156
|
}
|
156
|
-
function normalizeDynamicRenderer(
|
157
|
-
return
|
157
|
+
function normalizeDynamicRenderer(value) {
|
158
|
+
return value ? value.content || value.default || value : void 0;
|
158
159
|
}
|
159
160
|
|
160
161
|
// src/dom/event.ts
|
161
162
|
var defaultDelegator = createDelegator();
|
162
|
-
function
|
163
|
+
function _on(element, type, handler) {
|
163
164
|
element["$" + type] === void 0 && defaultDelegator(element, type, handleDelegated), element["$" + type] = handler || null;
|
164
165
|
}
|
165
166
|
function createDelegator() {
|
@@ -251,36 +252,36 @@ function walk(startNode, walkCodes, branch) {
|
|
251
252
|
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
252
253
|
}
|
253
254
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
254
|
-
let
|
255
|
+
let value, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
255
256
|
for (; currentWalkIndex < walkCodes.length; )
|
256
|
-
if (
|
257
|
+
if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32 /* Get */) {
|
257
258
|
let node = walker.currentNode;
|
258
259
|
scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
|
259
|
-
} else if (
|
260
|
+
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */)
|
260
261
|
walker.currentNode.replaceWith(
|
261
262
|
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
262
|
-
),
|
263
|
+
), value === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
263
264
|
else {
|
264
|
-
if (
|
265
|
+
if (value === 38 /* EndChild */)
|
265
266
|
return currentWalkIndex;
|
266
|
-
if (
|
267
|
+
if (value === 47 /* BeginChild */ || value === 48 /* BeginChildWithVar */)
|
267
268
|
currentWalkIndex = walkInternal(
|
268
269
|
currentWalkIndex,
|
269
270
|
walkCodes,
|
270
271
|
scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
|
271
|
-
),
|
272
|
-
else if (
|
273
|
-
for (
|
272
|
+
), value === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
273
|
+
else if (value < 92)
|
274
|
+
for (value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */; value--; )
|
274
275
|
walker.nextNode();
|
275
|
-
else if (
|
276
|
-
for (
|
276
|
+
else if (value < 107)
|
277
|
+
for (value = 10 /* Over */ * currentMultiplier + value - 97 /* Over */; value--; )
|
277
278
|
walker.nextSibling();
|
278
|
-
else if (
|
279
|
-
for (
|
279
|
+
else if (value < 117) {
|
280
|
+
for (value = 10 /* Out */ * currentMultiplier + value - 107 /* Out */; value--; )
|
280
281
|
walker.parentNode();
|
281
282
|
walker.nextSibling();
|
282
283
|
} else
|
283
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ +
|
284
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value - 117 /* Multiplier */;
|
284
285
|
}
|
285
286
|
}
|
286
287
|
|
@@ -293,59 +294,50 @@ function init(runtimeId = "M") {
|
|
293
294
|
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
|
294
295
|
defineRuntime({
|
295
296
|
value: resumeRender = ((renderId) => {
|
296
|
-
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w,
|
297
|
+
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, scopeLookup = render.s = {}, serializeContext = {
|
297
298
|
_: registeredValues
|
298
299
|
}, branches = branchesEnabled && /* @__PURE__ */ (() => {
|
299
|
-
let
|
300
|
-
let
|
301
|
-
for (;
|
302
|
-
|
300
|
+
let branchParents = /* @__PURE__ */ new Map(), branchStarts = [], orphanBranches = [], endBranch = (singleNode) => {
|
301
|
+
let parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, claimed = 0, branchId, branch;
|
302
|
+
for (; branchId = +lastToken; ) {
|
303
|
+
if (branch = scopeLookup[branchId] ||= {}, singleNode) {
|
304
|
+
for (; startVisit.previousSibling && ~visits.indexOf(
|
305
|
+
startVisit = startVisit.previousSibling
|
306
|
+
); ) ;
|
307
|
+
branch.j = branch.h = startVisit, visitType === "'" /* BranchEndNativeTag */ && (branch[0] = startVisit);
|
308
|
+
} else
|
309
|
+
startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.h = startVisit, branch.j = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
310
|
+
for (; i-- && orphanBranches[i] > branchId; )
|
311
|
+
branchParents.set(orphanBranches[i], branchId), claimed++;
|
312
|
+
orphanBranches.push(branchId), branchParents.set(branchId, 0), nextToken();
|
313
|
+
}
|
314
|
+
orphanBranches.splice(i, claimed);
|
303
315
|
};
|
304
316
|
return {
|
305
317
|
K() {
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
).h;
|
313
|
-
visitScope[visitData] = visit, curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
|
314
|
-
} else {
|
315
|
-
let next = visitData.indexOf(" "), curNode = visit;
|
316
|
-
for (visitScope[~next ? visitData.slice(0, next) : visitData] = visitToken === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
317
|
-
let start = next + 1;
|
318
|
-
next = visitData.indexOf(" ", start);
|
319
|
-
let childScopeId = +visitData.slice(
|
320
|
-
start,
|
321
|
-
~next ? next : visitData.length
|
322
|
-
);
|
323
|
-
if (curNode = endBranch(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId), visitToken === "'" /* BranchNativeTag */) {
|
324
|
-
let childBranch = scopeLookup[childScopeId];
|
325
|
-
childBranch[0] = childBranch.h = childBranch.j = curNode;
|
326
|
-
}
|
327
|
-
}
|
328
|
-
}
|
318
|
+
visitType === "[" /* BranchStart */ ? (endBranch(), branchStarts.push(visit)) : (visitScope[
|
319
|
+
nextToken()
|
320
|
+
/* read accessor */
|
321
|
+
] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit, nextToken(), endBranch(
|
322
|
+
visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */
|
323
|
+
));
|
329
324
|
},
|
330
325
|
t(scope) {
|
331
|
-
|
332
|
-
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
333
|
-
let branch = scope, parentBranch = branch.k;
|
334
|
-
scope.k = branch, parentBranch && (branch.y = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch));
|
335
|
-
}
|
326
|
+
scope.k = scopeLookup[scope.g || branchParents.get(scopeId)], branchParents.has(scopeId) && (scope.k && ((scope.y = scope.k).A ||= /* @__PURE__ */ new Set()).add(scope), scope.k = scope);
|
336
327
|
}
|
337
328
|
};
|
338
|
-
})(), $global, lastScopeId = 0, lastEffect, visits, resumes, scopeId, visit, visitText,
|
329
|
+
})(), $global, lastScopeId = 0, lastEffect, visits, resumes, scopeId, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, nextToken = () => lastToken = visitText.slice(
|
330
|
+
lastTokenIndex,
|
331
|
+
// eslint-disable-next-line no-cond-assign
|
332
|
+
(lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1) ? lastTokenIndex - 1 : visitText.length
|
333
|
+
);
|
339
334
|
return render.w = () => {
|
340
335
|
try {
|
341
336
|
walk2(), isResuming = 1;
|
342
337
|
for (visit of visits = render.v)
|
343
|
-
visitText = visit.data,
|
344
|
-
commentPrefixLen + 1,
|
345
|
-
visitDataIndex ? visitDataIndex - 1 : visitText.length
|
346
|
-
), visitData = visitDataIndex ? visitText.slice(visitDataIndex) : "", visitToken = visitText[commentPrefixLen], visitScope = scopeLookup[scopeId] ||= {
|
338
|
+
lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], (scopeId = +nextToken()) && (visitScope = scopeLookup[scopeId] ||= {
|
347
339
|
l: scopeId
|
348
|
-
},
|
340
|
+
}), visitType === "*" /* Node */ ? visitScope["j" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && branches.K();
|
349
341
|
for (let serialized of resumes = render.r || [])
|
350
342
|
if (typeof serialized == "string")
|
351
343
|
lastEffect = serialized;
|
@@ -361,7 +353,7 @@ function init(runtimeId = "M") {
|
|
361
353
|
$global ? typeof scope == "number" ? lastScopeId += scope : (scopeId = ++lastScopeId, scope.$global = $global, scope.l = scopeId, scopeLookup[scopeId] !== scope && (scopeLookup[scopeId] = Object.assign(
|
362
354
|
scope,
|
363
355
|
scopeLookup[scopeId]
|
364
|
-
)),
|
356
|
+
)), branchesEnabled && branches.t(scope)) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.p = 1e6);
|
365
357
|
} finally {
|
366
358
|
isResuming = visits.length = resumes.length = 0;
|
367
359
|
}
|
@@ -380,22 +372,22 @@ function init(runtimeId = "M") {
|
|
380
372
|
});
|
381
373
|
}
|
382
374
|
var isResuming;
|
383
|
-
function
|
375
|
+
function _resume(id, obj) {
|
384
376
|
return registeredValues[id] = obj, obj;
|
385
377
|
}
|
386
|
-
function
|
387
|
-
return registeredValues[id] = (scope) => (
|
378
|
+
function _var_resume(id, signal) {
|
379
|
+
return registeredValues[id] = (scope) => (value) => signal(scope, value), signal;
|
388
380
|
}
|
389
381
|
function getRegisteredWithScope(id, scope) {
|
390
382
|
let val = registeredValues[id];
|
391
383
|
return scope ? val(scope) : val;
|
392
384
|
}
|
393
|
-
function
|
394
|
-
return
|
385
|
+
function _el(id, key) {
|
386
|
+
return _resume(id, (scope) => () => scope[key]());
|
395
387
|
}
|
396
388
|
|
397
389
|
// src/dom/controllable.ts
|
398
|
-
function
|
390
|
+
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
399
391
|
setCheckboxValue(
|
400
392
|
scope,
|
401
393
|
nodeAccessor,
|
@@ -404,7 +396,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
404
396
|
checkedChange
|
405
397
|
);
|
406
398
|
}
|
407
|
-
function
|
399
|
+
function _attr_input_checked_script(scope, nodeAccessor) {
|
408
400
|
let el = scope[nodeAccessor];
|
409
401
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
410
402
|
let checkedChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -414,16 +406,16 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
414
406
|
}
|
415
407
|
});
|
416
408
|
}
|
417
|
-
function
|
418
|
-
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue,
|
409
|
+
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
410
|
+
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue, _attr(scope[nodeAccessor], "value", value), setCheckboxValue(
|
419
411
|
scope,
|
420
412
|
nodeAccessor,
|
421
413
|
1 /* InputCheckedValue */,
|
422
|
-
Array.isArray(checkedValue) ? checkedValue.includes(
|
414
|
+
Array.isArray(checkedValue) ? checkedValue.includes(value) : checkedValue === value,
|
423
415
|
checkedValueChange
|
424
416
|
);
|
425
417
|
}
|
426
|
-
function
|
418
|
+
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
427
419
|
let el = scope[nodeAccessor];
|
428
420
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
429
421
|
let checkedValueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -440,11 +432,11 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
440
432
|
}
|
441
433
|
});
|
442
434
|
}
|
443
|
-
function
|
444
|
-
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(
|
445
|
-
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["g" /* ControlledValue */ + nodeAccessor] =
|
435
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
436
|
+
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
|
437
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["g" /* ControlledValue */ + nodeAccessor] = value, el.isConnected ? setValueAndUpdateSelection(el, normalizedValue) : el.defaultValue = normalizedValue) : (scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, el.defaultValue = normalizedValue);
|
446
438
|
}
|
447
|
-
function
|
439
|
+
function _attr_input_value_script(scope, nodeAccessor) {
|
448
440
|
let el = scope[nodeAccessor];
|
449
441
|
isResuming && (scope["g" /* ControlledValue */ + nodeAccessor] = el.defaultValue), syncControllable(el, "input", hasValueChanged, (ev) => {
|
450
442
|
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -454,17 +446,17 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
454
446
|
), inputType = "");
|
455
447
|
});
|
456
448
|
}
|
457
|
-
function
|
458
|
-
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */, scope["g" /* ControlledValue */ + nodeAccessor] =
|
449
|
+
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
450
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */, scope["g" /* ControlledValue */ + nodeAccessor] = value) : scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, pendingEffects.unshift(
|
459
451
|
() => setSelectOptions(
|
460
452
|
scope[nodeAccessor],
|
461
|
-
|
453
|
+
value,
|
462
454
|
valueChange
|
463
455
|
),
|
464
456
|
scope
|
465
457
|
);
|
466
458
|
}
|
467
|
-
function
|
459
|
+
function _attr_select_value_script(scope, nodeAccessor) {
|
468
460
|
let el = scope[nodeAccessor], onChange = () => {
|
469
461
|
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
470
462
|
if (valueChange) {
|
@@ -479,21 +471,21 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
479
471
|
}
|
480
472
|
};
|
481
473
|
el._ || new MutationObserver(() => {
|
482
|
-
let
|
483
|
-
(Array.isArray(
|
474
|
+
let value = scope["g" /* ControlledValue */ + nodeAccessor];
|
475
|
+
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((value2, i) => value2 != el.selectedOptions[i].value) : el.value != value) && onChange();
|
484
476
|
}).observe(el, {
|
485
477
|
childList: !0,
|
486
478
|
subtree: !0
|
487
479
|
}), syncControllable(el, "input", hasSelectChanged, onChange);
|
488
480
|
}
|
489
|
-
function setSelectOptions(el,
|
490
|
-
if (Array.isArray(
|
481
|
+
function setSelectOptions(el, value, valueChange) {
|
482
|
+
if (Array.isArray(value))
|
491
483
|
for (let opt of el.options) {
|
492
|
-
let selected =
|
484
|
+
let selected = value.includes(opt.value);
|
493
485
|
valueChange ? opt.selected = selected : opt.defaultSelected = selected;
|
494
486
|
}
|
495
487
|
else {
|
496
|
-
let normalizedValue = normalizeStrProp(
|
488
|
+
let normalizedValue = normalizeStrProp(value);
|
497
489
|
if (valueChange)
|
498
490
|
el.value = normalizedValue;
|
499
491
|
else
|
@@ -501,10 +493,10 @@ function setSelectOptions(el, value2, valueChange) {
|
|
501
493
|
opt.defaultSelected = opt.value === normalizedValue;
|
502
494
|
}
|
503
495
|
}
|
504
|
-
function
|
496
|
+
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
505
497
|
scope["e" /* ControlledHandler */ + nodeAccessor] = openChange, openChange ? scope["f" /* ControlledType */ + nodeAccessor] = 4 /* DetailsOrDialogOpen */ : scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, scope[nodeAccessor].open = scope["g" /* ControlledValue */ + nodeAccessor] = normalizeBoolProp(open);
|
506
498
|
}
|
507
|
-
function
|
499
|
+
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
508
500
|
let el = scope[nodeAccessor], hasChanged = () => el.open !== scope["g" /* ControlledValue */ + nodeAccessor];
|
509
501
|
syncControllable(
|
510
502
|
el,
|
@@ -520,13 +512,13 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
520
512
|
);
|
521
513
|
}
|
522
514
|
var inputType = "";
|
523
|
-
function setValueAndUpdateSelection(el,
|
524
|
-
if (el.value !==
|
515
|
+
function setValueAndUpdateSelection(el, value) {
|
516
|
+
if (el.value !== value) {
|
525
517
|
let updatedPosition = resolveCursorPosition(
|
526
518
|
inputType,
|
527
519
|
el.getRootNode().activeElement === el && el.selectionStart,
|
528
520
|
el.value,
|
529
|
-
el.value =
|
521
|
+
el.value = value
|
530
522
|
);
|
531
523
|
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
532
524
|
}
|
@@ -565,11 +557,11 @@ function hasSelectChanged(el) {
|
|
565
557
|
function hasFormElementChanged(el) {
|
566
558
|
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
567
559
|
}
|
568
|
-
function normalizeStrProp(
|
569
|
-
return normalizeAttrValue(
|
560
|
+
function normalizeStrProp(value) {
|
561
|
+
return normalizeAttrValue(value) || "";
|
570
562
|
}
|
571
|
-
function normalizeBoolProp(
|
572
|
-
return
|
563
|
+
function normalizeBoolProp(value) {
|
564
|
+
return value != null && value !== !1;
|
573
565
|
}
|
574
566
|
function updateList(arr, val, push) {
|
575
567
|
let index = arr.indexOf(val);
|
@@ -581,9 +573,9 @@ function toValueProp(it) {
|
|
581
573
|
|
582
574
|
// src/dom/parse-html.ts
|
583
575
|
var parsers = {};
|
584
|
-
function parseHTML(
|
576
|
+
function parseHTML(html, ns) {
|
585
577
|
let parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
586
|
-
return parser.innerHTML =
|
578
|
+
return parser.innerHTML = html, parser.content || parser;
|
587
579
|
}
|
588
580
|
|
589
581
|
// src/dom/schedule.ts
|
@@ -601,31 +593,31 @@ function triggerMacroTask() {
|
|
601
593
|
}
|
602
594
|
|
603
595
|
// src/dom/signals.ts
|
604
|
-
function
|
596
|
+
function _let(valueAccessor, fn) {
|
605
597
|
if (0)
|
606
598
|
var id;
|
607
|
-
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope,
|
608
|
-
scope[valueAccessor] !==
|
599
|
+
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope, value) => {
|
600
|
+
scope[valueAccessor] !== value && (scope[valueAccessor] = value, fn(scope, value));
|
609
601
|
};
|
610
|
-
return (scope,
|
602
|
+
return (scope, value, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn(scope, value)) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value) : (schedule(), queueRender(
|
611
603
|
scope,
|
612
604
|
update,
|
613
605
|
valueAccessor,
|
614
|
-
|
615
|
-
)),
|
606
|
+
value
|
607
|
+
)), value);
|
616
608
|
}
|
617
|
-
function
|
609
|
+
function _const(valueAccessor, fn = () => {
|
618
610
|
}) {
|
619
|
-
return (scope,
|
620
|
-
(!(valueAccessor in scope) || scope[valueAccessor] !==
|
611
|
+
return (scope, value) => {
|
612
|
+
(!(valueAccessor in scope) || scope[valueAccessor] !== value) && (scope[valueAccessor] = value, fn(scope, value));
|
621
613
|
};
|
622
614
|
}
|
623
|
-
function
|
615
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
624
616
|
return (scope) => {
|
625
617
|
scope.q ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
626
618
|
};
|
627
619
|
}
|
628
|
-
function
|
620
|
+
function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
629
621
|
let childSignal = closure(valueAccessor, fn), loopScopeAccessor = "l" /* LoopScopeArray */ + ownerLoopNodeAccessor, loopScopeMapAccessor = "m" /* LoopScopeMap */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
630
622
|
let scopes = ownerScope[loopScopeAccessor] ||= ownerScope[loopScopeMapAccessor] ? [...ownerScope[loopScopeMapAccessor].values()] : [], [firstScope] = scopes;
|
631
623
|
firstScope && queueRender(
|
@@ -641,7 +633,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
641
633
|
};
|
642
634
|
return ownerSignal._ = childSignal, ownerSignal;
|
643
635
|
}
|
644
|
-
function
|
636
|
+
function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
645
637
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
646
638
|
let ifScope = scope[scopeAccessor];
|
647
639
|
ifScope && !ifScope.q && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
@@ -650,12 +642,12 @@ function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch,
|
|
650
642
|
}
|
651
643
|
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
652
644
|
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
653
|
-
subscribers.has(scope) || (subscribers.add(scope),
|
645
|
+
subscribers.has(scope) || (subscribers.add(scope), $signal(scope, -1).addEventListener(
|
654
646
|
"abort",
|
655
647
|
() => ownerScope[accessor].delete(scope)
|
656
648
|
));
|
657
649
|
}
|
658
|
-
function
|
650
|
+
function _closure(...closureSignals) {
|
659
651
|
let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
|
660
652
|
for (let i = closureSignals.length; i--; )
|
661
653
|
closureSignals[i].L = i;
|
@@ -669,7 +661,7 @@ function dynamicClosure(...closureSignals) {
|
|
669
661
|
);
|
670
662
|
};
|
671
663
|
}
|
672
|
-
function
|
664
|
+
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
673
665
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = ((scope) => {
|
674
666
|
scope[closureSignal.F] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
|
675
667
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
@@ -687,20 +679,20 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
687
679
|
);
|
688
680
|
};
|
689
681
|
}
|
690
|
-
function
|
691
|
-
scope[childAccessor].e = (
|
682
|
+
function _var(scope, childAccessor, signal) {
|
683
|
+
scope[childAccessor].e = (value) => signal(scope, value);
|
692
684
|
}
|
693
|
-
var
|
694
|
-
function
|
685
|
+
var _return = (scope, value) => scope.e?.(value);
|
686
|
+
function _return_change(scope, changeHandler) {
|
695
687
|
scope.f = changeHandler;
|
696
688
|
}
|
697
|
-
var
|
698
|
-
function
|
689
|
+
var _var_change = (scope, value) => scope.f?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
690
|
+
function _id({ $global }) {
|
699
691
|
let id = tagIdsByGlobal.get($global) || 0;
|
700
692
|
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
701
693
|
}
|
702
|
-
function
|
703
|
-
return
|
694
|
+
function _script(id, fn) {
|
695
|
+
return _resume(id, fn), (scope) => {
|
704
696
|
queueEffect(scope, fn);
|
705
697
|
};
|
706
698
|
}
|
@@ -711,7 +703,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
711
703
|
yield* traverseAllHoisted(s, path, curIndex);
|
712
704
|
else curIndex ? yield* traverseAllHoisted(scope[path[curIndex]], path, curIndex - 1) : yield scope[path[0]];
|
713
705
|
}
|
714
|
-
function
|
706
|
+
function _hoist(...path) {
|
715
707
|
return (scope) => {
|
716
708
|
let getOne = (...args) => iterator().next().value(...args), iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
717
709
|
return getOne;
|
@@ -735,7 +727,7 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
735
727
|
function setupBranch(renderer, branch) {
|
736
728
|
return renderer.D && queueRender(branch, renderer.D, -1), branch;
|
737
729
|
}
|
738
|
-
function
|
730
|
+
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
739
731
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
|
740
732
|
let clone = template ? (branch, ns) => {
|
741
733
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
@@ -758,27 +750,27 @@ function createContent(id, template, walks, setup, params, dynamicScopesAccessor
|
|
758
750
|
n: dynamicScopesAccessor
|
759
751
|
});
|
760
752
|
}
|
761
|
-
function
|
762
|
-
return
|
753
|
+
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
754
|
+
return _resume(
|
763
755
|
id,
|
764
|
-
|
756
|
+
_content(id, template, walks, setup, params, dynamicScopesAccessor)
|
765
757
|
);
|
766
758
|
}
|
767
|
-
function
|
759
|
+
function _content_closures(renderer, closureFns) {
|
768
760
|
let closureSignals = {};
|
769
761
|
for (let key in closureFns)
|
770
|
-
closureSignals[key] =
|
762
|
+
closureSignals[key] = _const(key, closureFns[key]);
|
771
763
|
return (owner, closureValues) => {
|
772
764
|
let instance = renderer(owner);
|
773
765
|
return instance.G = closureSignals, instance.M = closureValues, instance;
|
774
766
|
};
|
775
767
|
}
|
776
|
-
function
|
777
|
-
return
|
768
|
+
function _content_branch(template, walks, setup, params) {
|
769
|
+
return _content("", template, walks, setup, params)();
|
778
770
|
}
|
779
771
|
var cloneCache = {};
|
780
|
-
function createCloneableHTML(
|
781
|
-
let { firstChild, lastChild } = parseHTML(
|
772
|
+
function createCloneableHTML(html, ns) {
|
773
|
+
let { firstChild, lastChild } = parseHTML(html, ns), parent = document.createElementNS(ns, "t");
|
782
774
|
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
783
775
|
walk(
|
784
776
|
branch.h = branch.j = firstChild.cloneNode(!0),
|
@@ -792,41 +784,41 @@ function createCloneableHTML(html2, ns) {
|
|
792
784
|
}
|
793
785
|
|
794
786
|
// src/dom/dom.ts
|
795
|
-
function
|
796
|
-
setAttribute(element, name, normalizeAttrValue(
|
787
|
+
function _attr(element, name, value) {
|
788
|
+
setAttribute(element, name, normalizeAttrValue(value));
|
797
789
|
}
|
798
|
-
function setAttribute(element, name,
|
799
|
-
element.getAttribute(name) !=
|
790
|
+
function setAttribute(element, name, value) {
|
791
|
+
element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
|
800
792
|
}
|
801
|
-
function
|
802
|
-
setAttribute(element, "class", classValue(
|
793
|
+
function _attr_class(element, value) {
|
794
|
+
setAttribute(element, "class", classValue(value) || void 0);
|
803
795
|
}
|
804
|
-
function
|
796
|
+
function _attr_class_items(element, items) {
|
805
797
|
for (let key in items)
|
806
|
-
|
798
|
+
_attr_class_item(element, key, items[key]);
|
807
799
|
}
|
808
|
-
function
|
809
|
-
element.classList.toggle(name, !!
|
800
|
+
function _attr_class_item(element, name, value) {
|
801
|
+
element.classList.toggle(name, !!value);
|
810
802
|
}
|
811
|
-
function
|
812
|
-
setAttribute(element, "style", styleValue(
|
803
|
+
function _attr_style(element, value) {
|
804
|
+
setAttribute(element, "style", styleValue(value) || void 0);
|
813
805
|
}
|
814
|
-
function
|
806
|
+
function _attr_style_items(element, items) {
|
815
807
|
for (let key in items)
|
816
|
-
|
808
|
+
_attr_style_item(element, key, items[key]);
|
817
809
|
}
|
818
|
-
function
|
819
|
-
element.style.setProperty(name,
|
810
|
+
function _attr_style_item(element, name, value) {
|
811
|
+
element.style.setProperty(name, value || value === 0 ? value + "" : "");
|
820
812
|
}
|
821
|
-
function
|
822
|
-
let normalizedValue = normalizeString(
|
813
|
+
function _text(node, value) {
|
814
|
+
let normalizedValue = normalizeString(value);
|
823
815
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
824
816
|
}
|
825
|
-
function
|
826
|
-
let normalizedValue = normalizeString(
|
817
|
+
function _text_content(node, value) {
|
818
|
+
let normalizedValue = normalizeString(value);
|
827
819
|
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
828
820
|
}
|
829
|
-
function
|
821
|
+
function _attrs(scope, nodeAccessor, nextAttrs) {
|
830
822
|
let el = scope[nodeAccessor];
|
831
823
|
for (let i = el.attributes.length; i--; ) {
|
832
824
|
let { name } = el.attributes.item(i);
|
@@ -834,13 +826,13 @@ function attrs(scope, nodeAccessor, nextAttrs) {
|
|
834
826
|
}
|
835
827
|
attrsInternal(scope, nodeAccessor, nextAttrs);
|
836
828
|
}
|
837
|
-
function
|
838
|
-
|
829
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
830
|
+
_attrs(scope, nodeAccessor, nextAttrs), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
839
831
|
}
|
840
|
-
function hasAttrAlias(element,
|
841
|
-
return
|
832
|
+
function hasAttrAlias(element, attr, nextAttrs) {
|
833
|
+
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
842
834
|
}
|
843
|
-
function
|
835
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
844
836
|
let el = scope[nodeAccessor], partial = {};
|
845
837
|
for (let i = el.attributes.length; i--; ) {
|
846
838
|
let { name } = el.attributes.item(i);
|
@@ -850,22 +842,22 @@ function partialAttrs(scope, nodeAccessor, nextAttrs, skip) {
|
|
850
842
|
skip[key] || (partial[key] = nextAttrs[key]);
|
851
843
|
attrsInternal(scope, nodeAccessor, partial);
|
852
844
|
}
|
853
|
-
function
|
854
|
-
|
845
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
846
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
855
847
|
}
|
856
848
|
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
857
849
|
let el = scope[nodeAccessor], events, skip;
|
858
850
|
switch (el.tagName) {
|
859
851
|
case "INPUT":
|
860
852
|
if ("checked" in nextAttrs || "checkedChange" in nextAttrs)
|
861
|
-
|
853
|
+
_attr_input_checked(
|
862
854
|
scope,
|
863
855
|
nodeAccessor,
|
864
856
|
nextAttrs.checked,
|
865
857
|
nextAttrs.checkedChange
|
866
858
|
);
|
867
859
|
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs)
|
868
|
-
|
860
|
+
_attr_input_checkedValue(
|
869
861
|
scope,
|
870
862
|
nodeAccessor,
|
871
863
|
nextAttrs.checkedValue,
|
@@ -873,7 +865,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
873
865
|
nextAttrs.value
|
874
866
|
);
|
875
867
|
else if ("value" in nextAttrs || "valueChange" in nextAttrs)
|
876
|
-
|
868
|
+
_attr_input_value(
|
877
869
|
scope,
|
878
870
|
nodeAccessor,
|
879
871
|
nextAttrs.value,
|
@@ -884,7 +876,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
884
876
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
885
877
|
break;
|
886
878
|
case "SELECT":
|
887
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (
|
879
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(
|
888
880
|
scope,
|
889
881
|
nodeAccessor,
|
890
882
|
nextAttrs.value,
|
@@ -892,7 +884,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
892
884
|
), skip = /^value(?:Change)?$/);
|
893
885
|
break;
|
894
886
|
case "TEXTAREA":
|
895
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (
|
887
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(
|
896
888
|
scope,
|
897
889
|
nodeAccessor,
|
898
890
|
nextAttrs.value,
|
@@ -901,7 +893,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
901
893
|
break;
|
902
894
|
case "DETAILS":
|
903
895
|
case "DIALOG":
|
904
|
-
("open" in nextAttrs || "openChange" in nextAttrs) && (
|
896
|
+
("open" in nextAttrs || "openChange" in nextAttrs) && (_attr_details_or_dialog_open(
|
905
897
|
scope,
|
906
898
|
nodeAccessor,
|
907
899
|
nextAttrs.open,
|
@@ -910,54 +902,54 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
910
902
|
break;
|
911
903
|
}
|
912
904
|
for (let name in nextAttrs) {
|
913
|
-
let
|
905
|
+
let value = nextAttrs[name];
|
914
906
|
switch (name) {
|
915
907
|
case "class":
|
916
|
-
|
908
|
+
_attr_class(el, value);
|
917
909
|
break;
|
918
910
|
case "style":
|
919
|
-
|
911
|
+
_attr_style(el, value);
|
920
912
|
break;
|
921
913
|
default: {
|
922
|
-
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] =
|
914
|
+
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
923
915
|
break;
|
924
916
|
}
|
925
917
|
}
|
926
918
|
}
|
927
919
|
}
|
928
|
-
function
|
929
|
-
let content = normalizeClientRender(
|
920
|
+
function _attr_content(scope, nodeAccessor, value) {
|
921
|
+
let content = normalizeClientRender(value), rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
930
922
|
scope[rendererAccessor] !== (scope[rendererAccessor] = content?.l) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.n && subscribeToScopeSet(
|
931
923
|
content.u,
|
932
924
|
content.n,
|
933
925
|
scope["d" /* ConditionalScope */ + nodeAccessor]
|
934
926
|
));
|
935
927
|
}
|
936
|
-
function
|
928
|
+
function _attrs_script(scope, nodeAccessor) {
|
937
929
|
let el = scope[nodeAccessor], events = scope["i" /* EventAttributes */ + nodeAccessor];
|
938
930
|
switch (scope["f" /* ControlledType */ + nodeAccessor]) {
|
939
931
|
case 0 /* InputChecked */:
|
940
|
-
|
932
|
+
_attr_input_checked_script(scope, nodeAccessor);
|
941
933
|
break;
|
942
934
|
case 1 /* InputCheckedValue */:
|
943
|
-
|
935
|
+
_attr_input_checkedValue_script(scope, nodeAccessor);
|
944
936
|
break;
|
945
937
|
case 2 /* InputValue */:
|
946
|
-
|
938
|
+
_attr_input_value_script(scope, nodeAccessor);
|
947
939
|
break;
|
948
940
|
case 3 /* SelectValue */:
|
949
|
-
|
941
|
+
_attr_select_value_script(scope, nodeAccessor);
|
950
942
|
break;
|
951
943
|
case 4 /* DetailsOrDialogOpen */:
|
952
|
-
|
944
|
+
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
953
945
|
break;
|
954
946
|
}
|
955
947
|
for (let name in events)
|
956
|
-
|
948
|
+
_on(el, name, events[name]);
|
957
949
|
}
|
958
|
-
function
|
950
|
+
function _html(scope, value, accessor) {
|
959
951
|
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["h" /* DynamicPlaceholderLastChild */ + accessor] || firstChild, newContent = parseHTML(
|
960
|
-
|
952
|
+
value || value === 0 ? value + "" : "",
|
961
953
|
parentNode.namespaceURI
|
962
954
|
);
|
963
955
|
insertChildNodes(
|
@@ -967,33 +959,21 @@ function html(scope, value2, accessor) {
|
|
967
959
|
scope["h" /* DynamicPlaceholderLastChild */ + accessor] = newContent.lastChild
|
968
960
|
), removeChildNodes(firstChild, lastChild);
|
969
961
|
}
|
970
|
-
function normalizeClientRender(
|
971
|
-
let renderer = normalizeDynamicRenderer(
|
962
|
+
function normalizeClientRender(value) {
|
963
|
+
let renderer = normalizeDynamicRenderer(value);
|
972
964
|
if (renderer && renderer.l)
|
973
965
|
return renderer;
|
974
966
|
}
|
975
|
-
function
|
976
|
-
|
977
|
-
|
978
|
-
for (let name in prevProps)
|
979
|
-
name in nextProps || (node[name] = void 0);
|
980
|
-
for (let name in nextProps)
|
981
|
-
node[name] = nextProps[name];
|
982
|
-
scope[index + "-"] = nextProps;
|
967
|
+
function normalizeAttrValue(value) {
|
968
|
+
if (value || value === 0)
|
969
|
+
return value === !0 ? "" : value + "";
|
983
970
|
}
|
984
|
-
function
|
985
|
-
|
986
|
-
return value2 === !0 ? "" : value2 + "";
|
971
|
+
function normalizeString(value) {
|
972
|
+
return value || value === 0 ? value + "" : "\u200D";
|
987
973
|
}
|
988
|
-
function
|
989
|
-
return value2 || value2 === 0 ? value2 + "" : "\u200D";
|
990
|
-
}
|
991
|
-
function lifecycle(scope, index, thisObj) {
|
974
|
+
function _lifecycle(scope, index, thisObj) {
|
992
975
|
let instance = scope[index];
|
993
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(),
|
994
|
-
scope,
|
995
|
-
"k" /* LifecycleAbortController */ + index
|
996
|
-
).onabort = () => thisObj.onDestroy?.());
|
976
|
+
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(), $signal(scope, "k" /* LifecycleAbortController */ + index).onabort = () => thisObj.onDestroy?.());
|
997
977
|
}
|
998
978
|
function removeChildNodes(startNode, endNode) {
|
999
979
|
let stop = endNode.nextSibling, current = startNode;
|
@@ -1091,7 +1071,7 @@ function longestIncreasingSubsequence(a) {
|
|
1091
1071
|
}
|
1092
1072
|
|
1093
1073
|
// src/dom/control-flow.ts
|
1094
|
-
function
|
1074
|
+
function _await(nodeAccessor, renderer) {
|
1095
1075
|
let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1096
1076
|
return (scope, promise) => {
|
1097
1077
|
let referenceNode = scope[nodeAccessor], tryWithPlaceholder = findBranchWithKey(
|
@@ -1124,7 +1104,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1124
1104
|
awaitBranch.h
|
1125
1105
|
), tempDetachBranch(awaitBranch));
|
1126
1106
|
let thisPromise = scope[promiseAccessor] = promise.then(
|
1127
|
-
(
|
1107
|
+
(data) => {
|
1128
1108
|
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, schedule(), queueRender(
|
1129
1109
|
scope,
|
1130
1110
|
() => {
|
@@ -1139,7 +1119,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1139
1119
|
),
|
1140
1120
|
referenceNode.parentNode,
|
1141
1121
|
referenceNode
|
1142
|
-
), referenceNode.remove()), renderer.m?.(awaitBranch, [
|
1122
|
+
), referenceNode.remove()), renderer.m?.(awaitBranch, [data]), tryWithPlaceholder && (placeholderShown.add(pendingEffects), !--tryWithPlaceholder.o)) {
|
1143
1123
|
let placeholderBranch = tryWithPlaceholder.c;
|
1144
1124
|
tryWithPlaceholder.c = 0, placeholderBranch && (placeholderBranch.h.parentNode.insertBefore(
|
1145
1125
|
tryWithPlaceholder.h.parentNode,
|
@@ -1156,13 +1136,13 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1156
1136
|
);
|
1157
1137
|
};
|
1158
1138
|
}
|
1159
|
-
function
|
1139
|
+
function _try(nodeAccessor, content) {
|
1160
1140
|
let branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1161
1141
|
return (scope, input) => {
|
1162
1142
|
scope[branchAccessor] || setConditionalRenderer(
|
1163
1143
|
scope,
|
1164
1144
|
nodeAccessor,
|
1165
|
-
|
1145
|
+
content,
|
1166
1146
|
createAndSetupBranch
|
1167
1147
|
);
|
1168
1148
|
let branch = scope[branchAccessor];
|
@@ -1187,7 +1167,7 @@ function renderCatch(scope, error) {
|
|
1187
1167
|
} else
|
1188
1168
|
throw error;
|
1189
1169
|
}
|
1190
|
-
function
|
1170
|
+
function _if(nodeAccessor, ...branches) {
|
1191
1171
|
let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1192
1172
|
return enableBranches(), (scope, newBranch) => {
|
1193
1173
|
newBranch !== scope[branchAccessor] && setConditionalRenderer(
|
@@ -1199,9 +1179,9 @@ function conditional(nodeAccessor, ...branches) {
|
|
1199
1179
|
};
|
1200
1180
|
}
|
1201
1181
|
function patchDynamicTag(fn) {
|
1202
|
-
|
1182
|
+
_dynamic_tag = fn(_dynamic_tag);
|
1203
1183
|
}
|
1204
|
-
var
|
1184
|
+
var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1205
1185
|
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1206
1186
|
return enableBranches(), (scope, newRenderer, getInput) => {
|
1207
1187
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
@@ -1211,7 +1191,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1211
1191
|
nodeAccessor,
|
1212
1192
|
normalizedRenderer || (getContent ? getContent(scope) : void 0),
|
1213
1193
|
createBranchWithTagNameOrRenderer
|
1214
|
-
), getTagVar &&
|
1194
|
+
), getTagVar && _var(scope, childScopeAccessor, getTagVar()), typeof normalizedRenderer == "string") {
|
1215
1195
|
if (getContent) {
|
1216
1196
|
let content = getContent(scope);
|
1217
1197
|
setConditionalRenderer(
|
@@ -1233,7 +1213,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1233
1213
|
if (normalizedRenderer) {
|
1234
1214
|
let childScope = scope[childScopeAccessor], args = getInput?.();
|
1235
1215
|
if (typeof normalizedRenderer == "string")
|
1236
|
-
(getContent ?
|
1216
|
+
(getContent ? _attrs : _attrs_content)(
|
1237
1217
|
childScope,
|
1238
1218
|
0,
|
1239
1219
|
(inputIsArgs ? args[0] : args) || {}
|
@@ -1265,7 +1245,7 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2)
|
|
1265
1245
|
let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.h || referenceNode).parentNode : referenceNode, newBranch = scope["d" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope.$global, newRenderer, scope, parentNode);
|
1266
1246
|
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.h) : parentNode.insertBefore(referenceNode, prevBranch.h), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
|
1267
1247
|
}
|
1268
|
-
function
|
1248
|
+
function _for_of(nodeAccessor, renderer) {
|
1269
1249
|
return loop(
|
1270
1250
|
nodeAccessor,
|
1271
1251
|
renderer,
|
@@ -1277,14 +1257,14 @@ function loopOf(nodeAccessor, renderer) {
|
|
1277
1257
|
}
|
1278
1258
|
);
|
1279
1259
|
}
|
1280
|
-
function
|
1260
|
+
function _for_in(nodeAccessor, renderer) {
|
1281
1261
|
return loop(
|
1282
1262
|
nodeAccessor,
|
1283
1263
|
renderer,
|
1284
|
-
([obj, by = byFirstArg], cb) => forIn(obj, (key,
|
1264
|
+
([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))
|
1285
1265
|
);
|
1286
1266
|
}
|
1287
|
-
function
|
1267
|
+
function _for_to(nodeAccessor, renderer) {
|
1288
1268
|
return loop(
|
1289
1269
|
nodeAccessor,
|
1290
1270
|
renderer,
|
@@ -1293,11 +1273,11 @@ function loopTo(nodeAccessor, renderer) {
|
|
1293
1273
|
}
|
1294
1274
|
function loop(nodeAccessor, renderer, forEach) {
|
1295
1275
|
let params = renderer.m;
|
1296
|
-
return enableBranches(), (scope,
|
1276
|
+
return enableBranches(), (scope, value) => {
|
1297
1277
|
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1298
1278
|
...oldMap.values()
|
1299
1279
|
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].h.parentNode : referenceNode, newMap = scope["m" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map(), newArray = scope["l" /* LoopScopeArray */ + nodeAccessor] = [];
|
1300
|
-
forEach(
|
1280
|
+
forEach(value, (key, args) => {
|
1301
1281
|
let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1302
1282
|
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1303
1283
|
});
|
@@ -1326,16 +1306,16 @@ function byFirstArg(name) {
|
|
1326
1306
|
|
1327
1307
|
// src/dom/queue.ts
|
1328
1308
|
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, scopeKeyOffset = 1e3;
|
1329
|
-
function queueRender(scope, signal, signalKey,
|
1309
|
+
function queueRender(scope, signal, signalKey, value, scopeKey = scope.l) {
|
1330
1310
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1331
1311
|
if (existingRender)
|
1332
|
-
existingRender.I =
|
1312
|
+
existingRender.I = value;
|
1333
1313
|
else {
|
1334
1314
|
let render = {
|
1335
1315
|
x: key,
|
1336
1316
|
t: scope,
|
1337
1317
|
N: signal,
|
1338
|
-
I:
|
1318
|
+
I: value
|
1339
1319
|
}, i = pendingRenders.push(render) - 1;
|
1340
1320
|
for (; i; ) {
|
1341
1321
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
@@ -1393,8 +1373,8 @@ function runRenders() {
|
|
1393
1373
|
scope.q = 0;
|
1394
1374
|
pendingScopes = [];
|
1395
1375
|
}
|
1396
|
-
var runRender = (render) => render.N(render.t, render.I),
|
1397
|
-
|
1376
|
+
var runRender = (render) => render.N(render.t, render.I), _enable_catch = () => {
|
1377
|
+
_enable_catch = () => {
|
1398
1378
|
}, enableBranches();
|
1399
1379
|
let handlePendingTry = (fn, scope, branch) => {
|
1400
1380
|
for (; branch; ) {
|
@@ -1420,11 +1400,11 @@ var runRender = (render) => render.N(render.t, render.I), enableCatch = () => {
|
|
1420
1400
|
};
|
1421
1401
|
|
1422
1402
|
// src/dom/abort-signal.ts
|
1423
|
-
function
|
1403
|
+
function $signalReset(scope, id) {
|
1424
1404
|
let ctrl = scope.z?.[id];
|
1425
1405
|
ctrl && (queueEffect(ctrl, abort), scope.z[id] = void 0);
|
1426
1406
|
}
|
1427
|
-
function
|
1407
|
+
function $signal(scope, id) {
|
1428
1408
|
return scope.k && (scope.k.J ||= /* @__PURE__ */ new Set()).add(scope), ((scope.z ||= {})[id] ||= new AbortController()).signal;
|
1429
1409
|
}
|
1430
1410
|
function abort(ctrl) {
|
@@ -1439,12 +1419,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1439
1419
|
patchDynamicTag,
|
1440
1420
|
queueEffect,
|
1441
1421
|
init(warp10Noop) {
|
1442
|
-
|
1422
|
+
_resume(SET_SCOPE_REGISTER_ID, (branch) => {
|
1443
1423
|
classIdToBranch.set(branch.m5c, branch);
|
1444
|
-
}),
|
1424
|
+
}), _resume(RENDER_BODY_ID, warp10Noop);
|
1445
1425
|
},
|
1446
1426
|
registerRenderer(fn) {
|
1447
|
-
|
1427
|
+
_resume(RENDERER_REGISTER_ID, fn);
|
1448
1428
|
},
|
1449
1429
|
isRenderer(renderer) {
|
1450
1430
|
return renderer.C;
|
@@ -1461,14 +1441,14 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1461
1441
|
runComponentDestroy() {
|
1462
1442
|
this.scope && destroyBranch(this.scope);
|
1463
1443
|
},
|
1464
|
-
resolveRegistered(
|
1465
|
-
return Array.isArray(
|
1466
|
-
|
1467
|
-
|
1468
|
-
) :
|
1444
|
+
resolveRegistered(value, $global) {
|
1445
|
+
return Array.isArray(value) && typeof value[0] == "string" ? getRegisteredWithScope(
|
1446
|
+
value[0],
|
1447
|
+
value.length === 2 && self[$global.runtimeId]?.[$global.renderId]?.s[value[1]]
|
1448
|
+
) : value;
|
1469
1449
|
},
|
1470
1450
|
createRenderer(params, clone) {
|
1471
|
-
let renderer =
|
1451
|
+
let renderer = _content_branch(0, 0, 0, params);
|
1472
1452
|
return renderer.C = (branch) => {
|
1473
1453
|
let cloned = clone();
|
1474
1454
|
branch.h = cloned.startNode, branch.j = cloned.endNode;
|
@@ -1494,15 +1474,15 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1494
1474
|
};
|
1495
1475
|
|
1496
1476
|
// src/dom/template.ts
|
1497
|
-
var
|
1498
|
-
let renderer =
|
1477
|
+
var _template = (id, template, walks, setup, inputSignal) => {
|
1478
|
+
let renderer = _content(
|
1499
1479
|
id,
|
1500
1480
|
template,
|
1501
1481
|
walks,
|
1502
1482
|
setup,
|
1503
1483
|
inputSignal
|
1504
1484
|
)();
|
1505
|
-
return renderer.mount = mount, renderer._ = renderer,
|
1485
|
+
return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
|
1506
1486
|
};
|
1507
1487
|
function mount(input = {}, reference, position) {
|
1508
1488
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
@@ -1546,7 +1526,7 @@ function mount(input = {}, reference, position) {
|
|
1546
1526
|
return curValue;
|
1547
1527
|
},
|
1548
1528
|
set value(newValue) {
|
1549
|
-
|
1529
|
+
_var_change(branch, newValue);
|
1550
1530
|
},
|
1551
1531
|
update(newInput) {
|
1552
1532
|
args && runEffects(
|