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.mjs
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
// src/common/attr-tag.ts
|
2
2
|
var empty = [], rest = Symbol();
|
3
|
-
function attrTag(
|
4
|
-
return
|
3
|
+
function attrTag(attrs) {
|
4
|
+
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
5
5
|
}
|
6
|
-
function attrTags(first,
|
7
|
-
return first ? (first[rest] === empty ? first[rest] = [
|
6
|
+
function attrTags(first, attrs) {
|
7
|
+
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
8
8
|
}
|
9
9
|
function* attrTagIterator() {
|
10
10
|
yield this, yield* this[rest];
|
@@ -32,14 +32,14 @@ function forTo(to, from, step, cb) {
|
|
32
32
|
function classValue(classValue2) {
|
33
33
|
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
34
34
|
}
|
35
|
-
function stringifyClassObject(name,
|
36
|
-
return
|
35
|
+
function stringifyClassObject(name, value) {
|
36
|
+
return value ? name : "";
|
37
37
|
}
|
38
38
|
function styleValue(styleValue2) {
|
39
39
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
40
40
|
}
|
41
|
-
function stringifyStyleObject(name,
|
42
|
-
return
|
41
|
+
function stringifyStyleObject(name, value) {
|
42
|
+
return value || value === 0 ? name + ":" + value : "";
|
43
43
|
}
|
44
44
|
function toDelimitedString(val, delimiter, stringify) {
|
45
45
|
let str = "", sep = "", part;
|
@@ -60,13 +60,13 @@ function isEventHandler(name) {
|
|
60
60
|
function getEventHandlerName(name) {
|
61
61
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
62
62
|
}
|
63
|
-
function normalizeDynamicRenderer(
|
64
|
-
return
|
63
|
+
function normalizeDynamicRenderer(value) {
|
64
|
+
return value ? value.content || value.default || value : void 0;
|
65
65
|
}
|
66
66
|
|
67
67
|
// src/dom/event.ts
|
68
68
|
var defaultDelegator = createDelegator();
|
69
|
-
function
|
69
|
+
function _on(element, type, handler) {
|
70
70
|
element["$" + type] === void 0 && defaultDelegator(element, type, handleDelegated), element["$" + type] = handler || null;
|
71
71
|
}
|
72
72
|
function createDelegator() {
|
@@ -158,36 +158,36 @@ function walk(startNode, walkCodes, branch) {
|
|
158
158
|
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
159
159
|
}
|
160
160
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
161
|
-
let
|
161
|
+
let value, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
162
162
|
for (; currentWalkIndex < walkCodes.length; )
|
163
|
-
if (
|
163
|
+
if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32 /* Get */) {
|
164
164
|
let node = walker.currentNode;
|
165
165
|
scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
|
166
|
-
} else if (
|
166
|
+
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */)
|
167
167
|
walker.currentNode.replaceWith(
|
168
168
|
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
169
|
-
),
|
169
|
+
), value === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
170
170
|
else {
|
171
|
-
if (
|
171
|
+
if (value === 38 /* EndChild */)
|
172
172
|
return currentWalkIndex;
|
173
|
-
if (
|
173
|
+
if (value === 47 /* BeginChild */ || value === 48 /* BeginChildWithVar */)
|
174
174
|
currentWalkIndex = walkInternal(
|
175
175
|
currentWalkIndex,
|
176
176
|
walkCodes,
|
177
177
|
scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
|
178
|
-
),
|
179
|
-
else if (
|
180
|
-
for (
|
178
|
+
), value === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
179
|
+
else if (value < 92)
|
180
|
+
for (value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */; value--; )
|
181
181
|
walker.nextNode();
|
182
|
-
else if (
|
183
|
-
for (
|
182
|
+
else if (value < 107)
|
183
|
+
for (value = 10 /* Over */ * currentMultiplier + value - 97 /* Over */; value--; )
|
184
184
|
walker.nextSibling();
|
185
|
-
else if (
|
186
|
-
for (
|
185
|
+
else if (value < 117) {
|
186
|
+
for (value = 10 /* Out */ * currentMultiplier + value - 107 /* Out */; value--; )
|
187
187
|
walker.parentNode();
|
188
188
|
walker.nextSibling();
|
189
189
|
} else
|
190
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ +
|
190
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value - 117 /* Multiplier */;
|
191
191
|
}
|
192
192
|
}
|
193
193
|
|
@@ -200,59 +200,50 @@ function init(runtimeId = "M") {
|
|
200
200
|
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
|
201
201
|
defineRuntime({
|
202
202
|
value: resumeRender = ((renderId) => {
|
203
|
-
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w,
|
203
|
+
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, scopeLookup = render.s = {}, serializeContext = {
|
204
204
|
_: registeredValues
|
205
205
|
}, branches = branchesEnabled && /* @__PURE__ */ (() => {
|
206
|
-
let
|
207
|
-
let
|
208
|
-
for (;
|
209
|
-
|
206
|
+
let branchParents = /* @__PURE__ */ new Map(), branchStarts = [], orphanBranches = [], endBranch = (singleNode) => {
|
207
|
+
let parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, claimed = 0, branchId, branch;
|
208
|
+
for (; branchId = +lastToken; ) {
|
209
|
+
if (branch = scopeLookup[branchId] ||= {}, singleNode) {
|
210
|
+
for (; startVisit.previousSibling && ~visits.indexOf(
|
211
|
+
startVisit = startVisit.previousSibling
|
212
|
+
); ) ;
|
213
|
+
branch.j = branch.h = startVisit, visitType === "'" /* BranchEndNativeTag */ && (branch[0] = startVisit);
|
214
|
+
} else
|
215
|
+
startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.h = startVisit, branch.j = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
216
|
+
for (; i-- && orphanBranches[i] > branchId; )
|
217
|
+
branchParents.set(orphanBranches[i], branchId), claimed++;
|
218
|
+
orphanBranches.push(branchId), branchParents.set(branchId, 0), nextToken();
|
219
|
+
}
|
220
|
+
orphanBranches.splice(i, claimed);
|
210
221
|
};
|
211
222
|
return {
|
212
223
|
K() {
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
).h;
|
220
|
-
visitScope[visitData] = visit, curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
|
221
|
-
} else {
|
222
|
-
let next = visitData.indexOf(" "), curNode = visit;
|
223
|
-
for (visitScope[~next ? visitData.slice(0, next) : visitData] = visitToken === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
224
|
-
let start = next + 1;
|
225
|
-
next = visitData.indexOf(" ", start);
|
226
|
-
let childScopeId = +visitData.slice(
|
227
|
-
start,
|
228
|
-
~next ? next : visitData.length
|
229
|
-
);
|
230
|
-
if (curNode = endBranch(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId), visitToken === "'" /* BranchNativeTag */) {
|
231
|
-
let childBranch = scopeLookup[childScopeId];
|
232
|
-
childBranch[0] = childBranch.h = childBranch.j = curNode;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
}
|
224
|
+
visitType === "[" /* BranchStart */ ? (endBranch(), branchStarts.push(visit)) : (visitScope[
|
225
|
+
nextToken()
|
226
|
+
/* read accessor */
|
227
|
+
] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit, nextToken(), endBranch(
|
228
|
+
visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */
|
229
|
+
));
|
236
230
|
},
|
237
231
|
t(scope) {
|
238
|
-
|
239
|
-
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
240
|
-
let branch = scope, parentBranch = branch.k;
|
241
|
-
scope.k = branch, parentBranch && (branch.y = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch));
|
242
|
-
}
|
232
|
+
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);
|
243
233
|
}
|
244
234
|
};
|
245
|
-
})(), $global, lastScopeId = 0, lastEffect, visits, resumes, scopeId, visit, visitText,
|
235
|
+
})(), $global, lastScopeId = 0, lastEffect, visits, resumes, scopeId, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, nextToken = () => lastToken = visitText.slice(
|
236
|
+
lastTokenIndex,
|
237
|
+
// eslint-disable-next-line no-cond-assign
|
238
|
+
(lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1) ? lastTokenIndex - 1 : visitText.length
|
239
|
+
);
|
246
240
|
return render.w = () => {
|
247
241
|
try {
|
248
242
|
walk2(), isResuming = 1;
|
249
243
|
for (visit of visits = render.v)
|
250
|
-
visitText = visit.data,
|
251
|
-
commentPrefixLen + 1,
|
252
|
-
visitDataIndex ? visitDataIndex - 1 : visitText.length
|
253
|
-
), visitData = visitDataIndex ? visitText.slice(visitDataIndex) : "", visitToken = visitText[commentPrefixLen], visitScope = scopeLookup[scopeId] ||= {
|
244
|
+
lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], (scopeId = +nextToken()) && (visitScope = scopeLookup[scopeId] ||= {
|
254
245
|
l: scopeId
|
255
|
-
},
|
246
|
+
}), visitType === "*" /* Node */ ? visitScope["j" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && branches.K();
|
256
247
|
for (let serialized of resumes = render.r || [])
|
257
248
|
if (typeof serialized == "string")
|
258
249
|
lastEffect = serialized;
|
@@ -268,7 +259,7 @@ function init(runtimeId = "M") {
|
|
268
259
|
$global ? typeof scope == "number" ? lastScopeId += scope : (scopeId = ++lastScopeId, scope.$global = $global, scope.l = scopeId, scopeLookup[scopeId] !== scope && (scopeLookup[scopeId] = Object.assign(
|
269
260
|
scope,
|
270
261
|
scopeLookup[scopeId]
|
271
|
-
)),
|
262
|
+
)), branchesEnabled && branches.t(scope)) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.p = 1e6);
|
272
263
|
} finally {
|
273
264
|
isResuming = visits.length = resumes.length = 0;
|
274
265
|
}
|
@@ -287,22 +278,22 @@ function init(runtimeId = "M") {
|
|
287
278
|
});
|
288
279
|
}
|
289
280
|
var isResuming;
|
290
|
-
function
|
281
|
+
function _resume(id, obj) {
|
291
282
|
return registeredValues[id] = obj, obj;
|
292
283
|
}
|
293
|
-
function
|
294
|
-
return registeredValues[id] = (scope) => (
|
284
|
+
function _var_resume(id, signal) {
|
285
|
+
return registeredValues[id] = (scope) => (value) => signal(scope, value), signal;
|
295
286
|
}
|
296
287
|
function getRegisteredWithScope(id, scope) {
|
297
288
|
let val = registeredValues[id];
|
298
289
|
return scope ? val(scope) : val;
|
299
290
|
}
|
300
|
-
function
|
301
|
-
return
|
291
|
+
function _el(id, key) {
|
292
|
+
return _resume(id, (scope) => () => scope[key]());
|
302
293
|
}
|
303
294
|
|
304
295
|
// src/dom/controllable.ts
|
305
|
-
function
|
296
|
+
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
306
297
|
setCheckboxValue(
|
307
298
|
scope,
|
308
299
|
nodeAccessor,
|
@@ -311,7 +302,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
311
302
|
checkedChange
|
312
303
|
);
|
313
304
|
}
|
314
|
-
function
|
305
|
+
function _attr_input_checked_script(scope, nodeAccessor) {
|
315
306
|
let el = scope[nodeAccessor];
|
316
307
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
317
308
|
let checkedChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -321,16 +312,16 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
321
312
|
}
|
322
313
|
});
|
323
314
|
}
|
324
|
-
function
|
325
|
-
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue,
|
315
|
+
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
316
|
+
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue, _attr(scope[nodeAccessor], "value", value), setCheckboxValue(
|
326
317
|
scope,
|
327
318
|
nodeAccessor,
|
328
319
|
1 /* InputCheckedValue */,
|
329
|
-
Array.isArray(checkedValue) ? checkedValue.includes(
|
320
|
+
Array.isArray(checkedValue) ? checkedValue.includes(value) : checkedValue === value,
|
330
321
|
checkedValueChange
|
331
322
|
);
|
332
323
|
}
|
333
|
-
function
|
324
|
+
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
334
325
|
let el = scope[nodeAccessor];
|
335
326
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
336
327
|
let checkedValueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -347,11 +338,11 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
347
338
|
}
|
348
339
|
});
|
349
340
|
}
|
350
|
-
function
|
351
|
-
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(
|
352
|
-
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["g" /* ControlledValue */ + nodeAccessor] =
|
341
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
342
|
+
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
|
343
|
+
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);
|
353
344
|
}
|
354
|
-
function
|
345
|
+
function _attr_input_value_script(scope, nodeAccessor) {
|
355
346
|
let el = scope[nodeAccessor];
|
356
347
|
isResuming && (scope["g" /* ControlledValue */ + nodeAccessor] = el.defaultValue), syncControllable(el, "input", hasValueChanged, (ev) => {
|
357
348
|
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -361,17 +352,17 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
361
352
|
), inputType = "");
|
362
353
|
});
|
363
354
|
}
|
364
|
-
function
|
365
|
-
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */, scope["g" /* ControlledValue */ + nodeAccessor] =
|
355
|
+
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
356
|
+
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(
|
366
357
|
() => setSelectOptions(
|
367
358
|
scope[nodeAccessor],
|
368
|
-
|
359
|
+
value,
|
369
360
|
valueChange
|
370
361
|
),
|
371
362
|
scope
|
372
363
|
);
|
373
364
|
}
|
374
|
-
function
|
365
|
+
function _attr_select_value_script(scope, nodeAccessor) {
|
375
366
|
let el = scope[nodeAccessor], onChange = () => {
|
376
367
|
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
377
368
|
if (valueChange) {
|
@@ -386,21 +377,21 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
386
377
|
}
|
387
378
|
};
|
388
379
|
el._ || new MutationObserver(() => {
|
389
|
-
let
|
390
|
-
(Array.isArray(
|
380
|
+
let value = scope["g" /* ControlledValue */ + nodeAccessor];
|
381
|
+
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((value2, i) => value2 != el.selectedOptions[i].value) : el.value != value) && onChange();
|
391
382
|
}).observe(el, {
|
392
383
|
childList: !0,
|
393
384
|
subtree: !0
|
394
385
|
}), syncControllable(el, "input", hasSelectChanged, onChange);
|
395
386
|
}
|
396
|
-
function setSelectOptions(el,
|
397
|
-
if (Array.isArray(
|
387
|
+
function setSelectOptions(el, value, valueChange) {
|
388
|
+
if (Array.isArray(value))
|
398
389
|
for (let opt of el.options) {
|
399
|
-
let selected =
|
390
|
+
let selected = value.includes(opt.value);
|
400
391
|
valueChange ? opt.selected = selected : opt.defaultSelected = selected;
|
401
392
|
}
|
402
393
|
else {
|
403
|
-
let normalizedValue = normalizeStrProp(
|
394
|
+
let normalizedValue = normalizeStrProp(value);
|
404
395
|
if (valueChange)
|
405
396
|
el.value = normalizedValue;
|
406
397
|
else
|
@@ -408,10 +399,10 @@ function setSelectOptions(el, value2, valueChange) {
|
|
408
399
|
opt.defaultSelected = opt.value === normalizedValue;
|
409
400
|
}
|
410
401
|
}
|
411
|
-
function
|
402
|
+
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
412
403
|
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);
|
413
404
|
}
|
414
|
-
function
|
405
|
+
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
415
406
|
let el = scope[nodeAccessor], hasChanged = () => el.open !== scope["g" /* ControlledValue */ + nodeAccessor];
|
416
407
|
syncControllable(
|
417
408
|
el,
|
@@ -427,13 +418,13 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
427
418
|
);
|
428
419
|
}
|
429
420
|
var inputType = "";
|
430
|
-
function setValueAndUpdateSelection(el,
|
431
|
-
if (el.value !==
|
421
|
+
function setValueAndUpdateSelection(el, value) {
|
422
|
+
if (el.value !== value) {
|
432
423
|
let updatedPosition = resolveCursorPosition(
|
433
424
|
inputType,
|
434
425
|
el.getRootNode().activeElement === el && el.selectionStart,
|
435
426
|
el.value,
|
436
|
-
el.value =
|
427
|
+
el.value = value
|
437
428
|
);
|
438
429
|
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
439
430
|
}
|
@@ -472,11 +463,11 @@ function hasSelectChanged(el) {
|
|
472
463
|
function hasFormElementChanged(el) {
|
473
464
|
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
474
465
|
}
|
475
|
-
function normalizeStrProp(
|
476
|
-
return normalizeAttrValue(
|
466
|
+
function normalizeStrProp(value) {
|
467
|
+
return normalizeAttrValue(value) || "";
|
477
468
|
}
|
478
|
-
function normalizeBoolProp(
|
479
|
-
return
|
469
|
+
function normalizeBoolProp(value) {
|
470
|
+
return value != null && value !== !1;
|
480
471
|
}
|
481
472
|
function updateList(arr, val, push) {
|
482
473
|
let index = arr.indexOf(val);
|
@@ -488,9 +479,9 @@ function toValueProp(it) {
|
|
488
479
|
|
489
480
|
// src/dom/parse-html.ts
|
490
481
|
var parsers = {};
|
491
|
-
function parseHTML(
|
482
|
+
function parseHTML(html, ns) {
|
492
483
|
let parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
493
|
-
return parser.innerHTML =
|
484
|
+
return parser.innerHTML = html, parser.content || parser;
|
494
485
|
}
|
495
486
|
|
496
487
|
// src/dom/schedule.ts
|
@@ -508,31 +499,31 @@ function triggerMacroTask() {
|
|
508
499
|
}
|
509
500
|
|
510
501
|
// src/dom/signals.ts
|
511
|
-
function
|
502
|
+
function _let(valueAccessor, fn) {
|
512
503
|
if (0)
|
513
504
|
var id;
|
514
|
-
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope,
|
515
|
-
scope[valueAccessor] !==
|
505
|
+
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope, value) => {
|
506
|
+
scope[valueAccessor] !== value && (scope[valueAccessor] = value, fn(scope, value));
|
516
507
|
};
|
517
|
-
return (scope,
|
508
|
+
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(
|
518
509
|
scope,
|
519
510
|
update,
|
520
511
|
valueAccessor,
|
521
|
-
|
522
|
-
)),
|
512
|
+
value
|
513
|
+
)), value);
|
523
514
|
}
|
524
|
-
function
|
515
|
+
function _const(valueAccessor, fn = () => {
|
525
516
|
}) {
|
526
|
-
return (scope,
|
527
|
-
(!(valueAccessor in scope) || scope[valueAccessor] !==
|
517
|
+
return (scope, value) => {
|
518
|
+
(!(valueAccessor in scope) || scope[valueAccessor] !== value) && (scope[valueAccessor] = value, fn(scope, value));
|
528
519
|
};
|
529
520
|
}
|
530
|
-
function
|
521
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
531
522
|
return (scope) => {
|
532
523
|
scope.q ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
533
524
|
};
|
534
525
|
}
|
535
|
-
function
|
526
|
+
function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
536
527
|
let childSignal = closure(valueAccessor, fn), loopScopeAccessor = "l" /* LoopScopeArray */ + ownerLoopNodeAccessor, loopScopeMapAccessor = "m" /* LoopScopeMap */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
537
528
|
let scopes = ownerScope[loopScopeAccessor] ||= ownerScope[loopScopeMapAccessor] ? [...ownerScope[loopScopeMapAccessor].values()] : [], [firstScope] = scopes;
|
538
529
|
firstScope && queueRender(
|
@@ -548,7 +539,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
548
539
|
};
|
549
540
|
return ownerSignal._ = childSignal, ownerSignal;
|
550
541
|
}
|
551
|
-
function
|
542
|
+
function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
552
543
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
553
544
|
let ifScope = scope[scopeAccessor];
|
554
545
|
ifScope && !ifScope.q && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
@@ -557,12 +548,12 @@ function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch,
|
|
557
548
|
}
|
558
549
|
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
559
550
|
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
560
|
-
subscribers.has(scope) || (subscribers.add(scope),
|
551
|
+
subscribers.has(scope) || (subscribers.add(scope), $signal(scope, -1).addEventListener(
|
561
552
|
"abort",
|
562
553
|
() => ownerScope[accessor].delete(scope)
|
563
554
|
));
|
564
555
|
}
|
565
|
-
function
|
556
|
+
function _closure(...closureSignals) {
|
566
557
|
let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
|
567
558
|
for (let i = closureSignals.length; i--; )
|
568
559
|
closureSignals[i].L = i;
|
@@ -576,7 +567,7 @@ function dynamicClosure(...closureSignals) {
|
|
576
567
|
);
|
577
568
|
};
|
578
569
|
}
|
579
|
-
function
|
570
|
+
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
580
571
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = ((scope) => {
|
581
572
|
scope[closureSignal.F] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
|
582
573
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
@@ -594,20 +585,20 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
594
585
|
);
|
595
586
|
};
|
596
587
|
}
|
597
|
-
function
|
598
|
-
scope[childAccessor].e = (
|
588
|
+
function _var(scope, childAccessor, signal) {
|
589
|
+
scope[childAccessor].e = (value) => signal(scope, value);
|
599
590
|
}
|
600
|
-
var
|
601
|
-
function
|
591
|
+
var _return = (scope, value) => scope.e?.(value);
|
592
|
+
function _return_change(scope, changeHandler) {
|
602
593
|
scope.f = changeHandler;
|
603
594
|
}
|
604
|
-
var
|
605
|
-
function
|
595
|
+
var _var_change = (scope, value) => scope.f?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
596
|
+
function _id({ $global }) {
|
606
597
|
let id = tagIdsByGlobal.get($global) || 0;
|
607
598
|
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
608
599
|
}
|
609
|
-
function
|
610
|
-
return
|
600
|
+
function _script(id, fn) {
|
601
|
+
return _resume(id, fn), (scope) => {
|
611
602
|
queueEffect(scope, fn);
|
612
603
|
};
|
613
604
|
}
|
@@ -618,7 +609,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
618
609
|
yield* traverseAllHoisted(s, path, curIndex);
|
619
610
|
else curIndex ? yield* traverseAllHoisted(scope[path[curIndex]], path, curIndex - 1) : yield scope[path[0]];
|
620
611
|
}
|
621
|
-
function
|
612
|
+
function _hoist(...path) {
|
622
613
|
return (scope) => {
|
623
614
|
let getOne = (...args) => iterator().next().value(...args), iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
624
615
|
return getOne;
|
@@ -642,7 +633,7 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
642
633
|
function setupBranch(renderer, branch) {
|
643
634
|
return renderer.D && queueRender(branch, renderer.D, -1), branch;
|
644
635
|
}
|
645
|
-
function
|
636
|
+
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
646
637
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
|
647
638
|
let clone = template ? (branch, ns) => {
|
648
639
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
@@ -665,27 +656,27 @@ function createContent(id, template, walks, setup, params, dynamicScopesAccessor
|
|
665
656
|
n: dynamicScopesAccessor
|
666
657
|
});
|
667
658
|
}
|
668
|
-
function
|
669
|
-
return
|
659
|
+
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
660
|
+
return _resume(
|
670
661
|
id,
|
671
|
-
|
662
|
+
_content(id, template, walks, setup, params, dynamicScopesAccessor)
|
672
663
|
);
|
673
664
|
}
|
674
|
-
function
|
665
|
+
function _content_closures(renderer, closureFns) {
|
675
666
|
let closureSignals = {};
|
676
667
|
for (let key in closureFns)
|
677
|
-
closureSignals[key] =
|
668
|
+
closureSignals[key] = _const(key, closureFns[key]);
|
678
669
|
return (owner, closureValues) => {
|
679
670
|
let instance = renderer(owner);
|
680
671
|
return instance.G = closureSignals, instance.M = closureValues, instance;
|
681
672
|
};
|
682
673
|
}
|
683
|
-
function
|
684
|
-
return
|
674
|
+
function _content_branch(template, walks, setup, params) {
|
675
|
+
return _content("", template, walks, setup, params)();
|
685
676
|
}
|
686
677
|
var cloneCache = {};
|
687
|
-
function createCloneableHTML(
|
688
|
-
let { firstChild, lastChild } = parseHTML(
|
678
|
+
function createCloneableHTML(html, ns) {
|
679
|
+
let { firstChild, lastChild } = parseHTML(html, ns), parent = document.createElementNS(ns, "t");
|
689
680
|
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
690
681
|
walk(
|
691
682
|
branch.h = branch.j = firstChild.cloneNode(!0),
|
@@ -699,41 +690,41 @@ function createCloneableHTML(html2, ns) {
|
|
699
690
|
}
|
700
691
|
|
701
692
|
// src/dom/dom.ts
|
702
|
-
function
|
703
|
-
setAttribute(element, name, normalizeAttrValue(
|
693
|
+
function _attr(element, name, value) {
|
694
|
+
setAttribute(element, name, normalizeAttrValue(value));
|
704
695
|
}
|
705
|
-
function setAttribute(element, name,
|
706
|
-
element.getAttribute(name) !=
|
696
|
+
function setAttribute(element, name, value) {
|
697
|
+
element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
|
707
698
|
}
|
708
|
-
function
|
709
|
-
setAttribute(element, "class", classValue(
|
699
|
+
function _attr_class(element, value) {
|
700
|
+
setAttribute(element, "class", classValue(value) || void 0);
|
710
701
|
}
|
711
|
-
function
|
702
|
+
function _attr_class_items(element, items) {
|
712
703
|
for (let key in items)
|
713
|
-
|
704
|
+
_attr_class_item(element, key, items[key]);
|
714
705
|
}
|
715
|
-
function
|
716
|
-
element.classList.toggle(name, !!
|
706
|
+
function _attr_class_item(element, name, value) {
|
707
|
+
element.classList.toggle(name, !!value);
|
717
708
|
}
|
718
|
-
function
|
719
|
-
setAttribute(element, "style", styleValue(
|
709
|
+
function _attr_style(element, value) {
|
710
|
+
setAttribute(element, "style", styleValue(value) || void 0);
|
720
711
|
}
|
721
|
-
function
|
712
|
+
function _attr_style_items(element, items) {
|
722
713
|
for (let key in items)
|
723
|
-
|
714
|
+
_attr_style_item(element, key, items[key]);
|
724
715
|
}
|
725
|
-
function
|
726
|
-
element.style.setProperty(name,
|
716
|
+
function _attr_style_item(element, name, value) {
|
717
|
+
element.style.setProperty(name, value || value === 0 ? value + "" : "");
|
727
718
|
}
|
728
|
-
function
|
729
|
-
let normalizedValue = normalizeString(
|
719
|
+
function _text(node, value) {
|
720
|
+
let normalizedValue = normalizeString(value);
|
730
721
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
731
722
|
}
|
732
|
-
function
|
733
|
-
let normalizedValue = normalizeString(
|
723
|
+
function _text_content(node, value) {
|
724
|
+
let normalizedValue = normalizeString(value);
|
734
725
|
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
735
726
|
}
|
736
|
-
function
|
727
|
+
function _attrs(scope, nodeAccessor, nextAttrs) {
|
737
728
|
let el = scope[nodeAccessor];
|
738
729
|
for (let i = el.attributes.length; i--; ) {
|
739
730
|
let { name } = el.attributes.item(i);
|
@@ -741,13 +732,13 @@ function attrs(scope, nodeAccessor, nextAttrs) {
|
|
741
732
|
}
|
742
733
|
attrsInternal(scope, nodeAccessor, nextAttrs);
|
743
734
|
}
|
744
|
-
function
|
745
|
-
|
735
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
736
|
+
_attrs(scope, nodeAccessor, nextAttrs), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
746
737
|
}
|
747
|
-
function hasAttrAlias(element,
|
748
|
-
return
|
738
|
+
function hasAttrAlias(element, attr, nextAttrs) {
|
739
|
+
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
749
740
|
}
|
750
|
-
function
|
741
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
751
742
|
let el = scope[nodeAccessor], partial = {};
|
752
743
|
for (let i = el.attributes.length; i--; ) {
|
753
744
|
let { name } = el.attributes.item(i);
|
@@ -757,22 +748,22 @@ function partialAttrs(scope, nodeAccessor, nextAttrs, skip) {
|
|
757
748
|
skip[key] || (partial[key] = nextAttrs[key]);
|
758
749
|
attrsInternal(scope, nodeAccessor, partial);
|
759
750
|
}
|
760
|
-
function
|
761
|
-
|
751
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
752
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
762
753
|
}
|
763
754
|
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
764
755
|
let el = scope[nodeAccessor], events, skip;
|
765
756
|
switch (el.tagName) {
|
766
757
|
case "INPUT":
|
767
758
|
if ("checked" in nextAttrs || "checkedChange" in nextAttrs)
|
768
|
-
|
759
|
+
_attr_input_checked(
|
769
760
|
scope,
|
770
761
|
nodeAccessor,
|
771
762
|
nextAttrs.checked,
|
772
763
|
nextAttrs.checkedChange
|
773
764
|
);
|
774
765
|
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs)
|
775
|
-
|
766
|
+
_attr_input_checkedValue(
|
776
767
|
scope,
|
777
768
|
nodeAccessor,
|
778
769
|
nextAttrs.checkedValue,
|
@@ -780,7 +771,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
780
771
|
nextAttrs.value
|
781
772
|
);
|
782
773
|
else if ("value" in nextAttrs || "valueChange" in nextAttrs)
|
783
|
-
|
774
|
+
_attr_input_value(
|
784
775
|
scope,
|
785
776
|
nodeAccessor,
|
786
777
|
nextAttrs.value,
|
@@ -791,7 +782,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
791
782
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
792
783
|
break;
|
793
784
|
case "SELECT":
|
794
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (
|
785
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(
|
795
786
|
scope,
|
796
787
|
nodeAccessor,
|
797
788
|
nextAttrs.value,
|
@@ -799,7 +790,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
799
790
|
), skip = /^value(?:Change)?$/);
|
800
791
|
break;
|
801
792
|
case "TEXTAREA":
|
802
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (
|
793
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(
|
803
794
|
scope,
|
804
795
|
nodeAccessor,
|
805
796
|
nextAttrs.value,
|
@@ -808,7 +799,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
808
799
|
break;
|
809
800
|
case "DETAILS":
|
810
801
|
case "DIALOG":
|
811
|
-
("open" in nextAttrs || "openChange" in nextAttrs) && (
|
802
|
+
("open" in nextAttrs || "openChange" in nextAttrs) && (_attr_details_or_dialog_open(
|
812
803
|
scope,
|
813
804
|
nodeAccessor,
|
814
805
|
nextAttrs.open,
|
@@ -817,54 +808,54 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
817
808
|
break;
|
818
809
|
}
|
819
810
|
for (let name in nextAttrs) {
|
820
|
-
let
|
811
|
+
let value = nextAttrs[name];
|
821
812
|
switch (name) {
|
822
813
|
case "class":
|
823
|
-
|
814
|
+
_attr_class(el, value);
|
824
815
|
break;
|
825
816
|
case "style":
|
826
|
-
|
817
|
+
_attr_style(el, value);
|
827
818
|
break;
|
828
819
|
default: {
|
829
|
-
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] =
|
820
|
+
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
830
821
|
break;
|
831
822
|
}
|
832
823
|
}
|
833
824
|
}
|
834
825
|
}
|
835
|
-
function
|
836
|
-
let content = normalizeClientRender(
|
826
|
+
function _attr_content(scope, nodeAccessor, value) {
|
827
|
+
let content = normalizeClientRender(value), rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
837
828
|
scope[rendererAccessor] !== (scope[rendererAccessor] = content?.l) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.n && subscribeToScopeSet(
|
838
829
|
content.u,
|
839
830
|
content.n,
|
840
831
|
scope["d" /* ConditionalScope */ + nodeAccessor]
|
841
832
|
));
|
842
833
|
}
|
843
|
-
function
|
834
|
+
function _attrs_script(scope, nodeAccessor) {
|
844
835
|
let el = scope[nodeAccessor], events = scope["i" /* EventAttributes */ + nodeAccessor];
|
845
836
|
switch (scope["f" /* ControlledType */ + nodeAccessor]) {
|
846
837
|
case 0 /* InputChecked */:
|
847
|
-
|
838
|
+
_attr_input_checked_script(scope, nodeAccessor);
|
848
839
|
break;
|
849
840
|
case 1 /* InputCheckedValue */:
|
850
|
-
|
841
|
+
_attr_input_checkedValue_script(scope, nodeAccessor);
|
851
842
|
break;
|
852
843
|
case 2 /* InputValue */:
|
853
|
-
|
844
|
+
_attr_input_value_script(scope, nodeAccessor);
|
854
845
|
break;
|
855
846
|
case 3 /* SelectValue */:
|
856
|
-
|
847
|
+
_attr_select_value_script(scope, nodeAccessor);
|
857
848
|
break;
|
858
849
|
case 4 /* DetailsOrDialogOpen */:
|
859
|
-
|
850
|
+
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
860
851
|
break;
|
861
852
|
}
|
862
853
|
for (let name in events)
|
863
|
-
|
854
|
+
_on(el, name, events[name]);
|
864
855
|
}
|
865
|
-
function
|
856
|
+
function _html(scope, value, accessor) {
|
866
857
|
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["h" /* DynamicPlaceholderLastChild */ + accessor] || firstChild, newContent = parseHTML(
|
867
|
-
|
858
|
+
value || value === 0 ? value + "" : "",
|
868
859
|
parentNode.namespaceURI
|
869
860
|
);
|
870
861
|
insertChildNodes(
|
@@ -874,33 +865,21 @@ function html(scope, value2, accessor) {
|
|
874
865
|
scope["h" /* DynamicPlaceholderLastChild */ + accessor] = newContent.lastChild
|
875
866
|
), removeChildNodes(firstChild, lastChild);
|
876
867
|
}
|
877
|
-
function normalizeClientRender(
|
878
|
-
let renderer = normalizeDynamicRenderer(
|
868
|
+
function normalizeClientRender(value) {
|
869
|
+
let renderer = normalizeDynamicRenderer(value);
|
879
870
|
if (renderer && renderer.l)
|
880
871
|
return renderer;
|
881
872
|
}
|
882
|
-
function
|
883
|
-
|
884
|
-
|
885
|
-
for (let name in prevProps)
|
886
|
-
name in nextProps || (node[name] = void 0);
|
887
|
-
for (let name in nextProps)
|
888
|
-
node[name] = nextProps[name];
|
889
|
-
scope[index + "-"] = nextProps;
|
873
|
+
function normalizeAttrValue(value) {
|
874
|
+
if (value || value === 0)
|
875
|
+
return value === !0 ? "" : value + "";
|
890
876
|
}
|
891
|
-
function
|
892
|
-
|
893
|
-
return value2 === !0 ? "" : value2 + "";
|
877
|
+
function normalizeString(value) {
|
878
|
+
return value || value === 0 ? value + "" : "\u200D";
|
894
879
|
}
|
895
|
-
function
|
896
|
-
return value2 || value2 === 0 ? value2 + "" : "\u200D";
|
897
|
-
}
|
898
|
-
function lifecycle(scope, index, thisObj) {
|
880
|
+
function _lifecycle(scope, index, thisObj) {
|
899
881
|
let instance = scope[index];
|
900
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(),
|
901
|
-
scope,
|
902
|
-
"k" /* LifecycleAbortController */ + index
|
903
|
-
).onabort = () => thisObj.onDestroy?.());
|
882
|
+
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(), $signal(scope, "k" /* LifecycleAbortController */ + index).onabort = () => thisObj.onDestroy?.());
|
904
883
|
}
|
905
884
|
function removeChildNodes(startNode, endNode) {
|
906
885
|
let stop = endNode.nextSibling, current = startNode;
|
@@ -998,7 +977,7 @@ function longestIncreasingSubsequence(a) {
|
|
998
977
|
}
|
999
978
|
|
1000
979
|
// src/dom/control-flow.ts
|
1001
|
-
function
|
980
|
+
function _await(nodeAccessor, renderer) {
|
1002
981
|
let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1003
982
|
return (scope, promise) => {
|
1004
983
|
let referenceNode = scope[nodeAccessor], tryWithPlaceholder = findBranchWithKey(
|
@@ -1031,7 +1010,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1031
1010
|
awaitBranch.h
|
1032
1011
|
), tempDetachBranch(awaitBranch));
|
1033
1012
|
let thisPromise = scope[promiseAccessor] = promise.then(
|
1034
|
-
(
|
1013
|
+
(data) => {
|
1035
1014
|
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, schedule(), queueRender(
|
1036
1015
|
scope,
|
1037
1016
|
() => {
|
@@ -1046,7 +1025,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1046
1025
|
),
|
1047
1026
|
referenceNode.parentNode,
|
1048
1027
|
referenceNode
|
1049
|
-
), referenceNode.remove()), renderer.m?.(awaitBranch, [
|
1028
|
+
), referenceNode.remove()), renderer.m?.(awaitBranch, [data]), tryWithPlaceholder && (placeholderShown.add(pendingEffects), !--tryWithPlaceholder.o)) {
|
1050
1029
|
let placeholderBranch = tryWithPlaceholder.c;
|
1051
1030
|
tryWithPlaceholder.c = 0, placeholderBranch && (placeholderBranch.h.parentNode.insertBefore(
|
1052
1031
|
tryWithPlaceholder.h.parentNode,
|
@@ -1063,13 +1042,13 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1063
1042
|
);
|
1064
1043
|
};
|
1065
1044
|
}
|
1066
|
-
function
|
1045
|
+
function _try(nodeAccessor, content) {
|
1067
1046
|
let branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1068
1047
|
return (scope, input) => {
|
1069
1048
|
scope[branchAccessor] || setConditionalRenderer(
|
1070
1049
|
scope,
|
1071
1050
|
nodeAccessor,
|
1072
|
-
|
1051
|
+
content,
|
1073
1052
|
createAndSetupBranch
|
1074
1053
|
);
|
1075
1054
|
let branch = scope[branchAccessor];
|
@@ -1094,7 +1073,7 @@ function renderCatch(scope, error) {
|
|
1094
1073
|
} else
|
1095
1074
|
throw error;
|
1096
1075
|
}
|
1097
|
-
function
|
1076
|
+
function _if(nodeAccessor, ...branches) {
|
1098
1077
|
let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1099
1078
|
return enableBranches(), (scope, newBranch) => {
|
1100
1079
|
newBranch !== scope[branchAccessor] && setConditionalRenderer(
|
@@ -1106,9 +1085,9 @@ function conditional(nodeAccessor, ...branches) {
|
|
1106
1085
|
};
|
1107
1086
|
}
|
1108
1087
|
function patchDynamicTag(fn) {
|
1109
|
-
|
1088
|
+
_dynamic_tag = fn(_dynamic_tag);
|
1110
1089
|
}
|
1111
|
-
var
|
1090
|
+
var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1112
1091
|
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1113
1092
|
return enableBranches(), (scope, newRenderer, getInput) => {
|
1114
1093
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
@@ -1118,7 +1097,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1118
1097
|
nodeAccessor,
|
1119
1098
|
normalizedRenderer || (getContent ? getContent(scope) : void 0),
|
1120
1099
|
createBranchWithTagNameOrRenderer
|
1121
|
-
), getTagVar &&
|
1100
|
+
), getTagVar && _var(scope, childScopeAccessor, getTagVar()), typeof normalizedRenderer == "string") {
|
1122
1101
|
if (getContent) {
|
1123
1102
|
let content = getContent(scope);
|
1124
1103
|
setConditionalRenderer(
|
@@ -1140,7 +1119,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1140
1119
|
if (normalizedRenderer) {
|
1141
1120
|
let childScope = scope[childScopeAccessor], args = getInput?.();
|
1142
1121
|
if (typeof normalizedRenderer == "string")
|
1143
|
-
(getContent ?
|
1122
|
+
(getContent ? _attrs : _attrs_content)(
|
1144
1123
|
childScope,
|
1145
1124
|
0,
|
1146
1125
|
(inputIsArgs ? args[0] : args) || {}
|
@@ -1172,7 +1151,7 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2)
|
|
1172
1151
|
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);
|
1173
1152
|
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());
|
1174
1153
|
}
|
1175
|
-
function
|
1154
|
+
function _for_of(nodeAccessor, renderer) {
|
1176
1155
|
return loop(
|
1177
1156
|
nodeAccessor,
|
1178
1157
|
renderer,
|
@@ -1184,14 +1163,14 @@ function loopOf(nodeAccessor, renderer) {
|
|
1184
1163
|
}
|
1185
1164
|
);
|
1186
1165
|
}
|
1187
|
-
function
|
1166
|
+
function _for_in(nodeAccessor, renderer) {
|
1188
1167
|
return loop(
|
1189
1168
|
nodeAccessor,
|
1190
1169
|
renderer,
|
1191
|
-
([obj, by = byFirstArg], cb) => forIn(obj, (key,
|
1170
|
+
([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))
|
1192
1171
|
);
|
1193
1172
|
}
|
1194
|
-
function
|
1173
|
+
function _for_to(nodeAccessor, renderer) {
|
1195
1174
|
return loop(
|
1196
1175
|
nodeAccessor,
|
1197
1176
|
renderer,
|
@@ -1200,11 +1179,11 @@ function loopTo(nodeAccessor, renderer) {
|
|
1200
1179
|
}
|
1201
1180
|
function loop(nodeAccessor, renderer, forEach) {
|
1202
1181
|
let params = renderer.m;
|
1203
|
-
return enableBranches(), (scope,
|
1182
|
+
return enableBranches(), (scope, value) => {
|
1204
1183
|
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1205
1184
|
...oldMap.values()
|
1206
1185
|
] : [], 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] = [];
|
1207
|
-
forEach(
|
1186
|
+
forEach(value, (key, args) => {
|
1208
1187
|
let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1209
1188
|
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1210
1189
|
});
|
@@ -1233,16 +1212,16 @@ function byFirstArg(name) {
|
|
1233
1212
|
|
1234
1213
|
// src/dom/queue.ts
|
1235
1214
|
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, scopeKeyOffset = 1e3;
|
1236
|
-
function queueRender(scope, signal, signalKey,
|
1215
|
+
function queueRender(scope, signal, signalKey, value, scopeKey = scope.l) {
|
1237
1216
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1238
1217
|
if (existingRender)
|
1239
|
-
existingRender.I =
|
1218
|
+
existingRender.I = value;
|
1240
1219
|
else {
|
1241
1220
|
let render = {
|
1242
1221
|
x: key,
|
1243
1222
|
t: scope,
|
1244
1223
|
N: signal,
|
1245
|
-
I:
|
1224
|
+
I: value
|
1246
1225
|
}, i = pendingRenders.push(render) - 1;
|
1247
1226
|
for (; i; ) {
|
1248
1227
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
@@ -1300,8 +1279,8 @@ function runRenders() {
|
|
1300
1279
|
scope.q = 0;
|
1301
1280
|
pendingScopes = [];
|
1302
1281
|
}
|
1303
|
-
var runRender = (render) => render.N(render.t, render.I),
|
1304
|
-
|
1282
|
+
var runRender = (render) => render.N(render.t, render.I), _enable_catch = () => {
|
1283
|
+
_enable_catch = () => {
|
1305
1284
|
}, enableBranches();
|
1306
1285
|
let handlePendingTry = (fn, scope, branch) => {
|
1307
1286
|
for (; branch; ) {
|
@@ -1327,11 +1306,11 @@ var runRender = (render) => render.N(render.t, render.I), enableCatch = () => {
|
|
1327
1306
|
};
|
1328
1307
|
|
1329
1308
|
// src/dom/abort-signal.ts
|
1330
|
-
function
|
1309
|
+
function $signalReset(scope, id) {
|
1331
1310
|
let ctrl = scope.z?.[id];
|
1332
1311
|
ctrl && (queueEffect(ctrl, abort), scope.z[id] = void 0);
|
1333
1312
|
}
|
1334
|
-
function
|
1313
|
+
function $signal(scope, id) {
|
1335
1314
|
return scope.k && (scope.k.J ||= /* @__PURE__ */ new Set()).add(scope), ((scope.z ||= {})[id] ||= new AbortController()).signal;
|
1336
1315
|
}
|
1337
1316
|
function abort(ctrl) {
|
@@ -1346,12 +1325,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1346
1325
|
patchDynamicTag,
|
1347
1326
|
queueEffect,
|
1348
1327
|
init(warp10Noop) {
|
1349
|
-
|
1328
|
+
_resume(SET_SCOPE_REGISTER_ID, (branch) => {
|
1350
1329
|
classIdToBranch.set(branch.m5c, branch);
|
1351
|
-
}),
|
1330
|
+
}), _resume(RENDER_BODY_ID, warp10Noop);
|
1352
1331
|
},
|
1353
1332
|
registerRenderer(fn) {
|
1354
|
-
|
1333
|
+
_resume(RENDERER_REGISTER_ID, fn);
|
1355
1334
|
},
|
1356
1335
|
isRenderer(renderer) {
|
1357
1336
|
return renderer.C;
|
@@ -1368,14 +1347,14 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1368
1347
|
runComponentDestroy() {
|
1369
1348
|
this.scope && destroyBranch(this.scope);
|
1370
1349
|
},
|
1371
|
-
resolveRegistered(
|
1372
|
-
return Array.isArray(
|
1373
|
-
|
1374
|
-
|
1375
|
-
) :
|
1350
|
+
resolveRegistered(value, $global) {
|
1351
|
+
return Array.isArray(value) && typeof value[0] == "string" ? getRegisteredWithScope(
|
1352
|
+
value[0],
|
1353
|
+
value.length === 2 && self[$global.runtimeId]?.[$global.renderId]?.s[value[1]]
|
1354
|
+
) : value;
|
1376
1355
|
},
|
1377
1356
|
createRenderer(params, clone) {
|
1378
|
-
let renderer =
|
1357
|
+
let renderer = _content_branch(0, 0, 0, params);
|
1379
1358
|
return renderer.C = (branch) => {
|
1380
1359
|
let cloned = clone();
|
1381
1360
|
branch.h = cloned.startNode, branch.j = cloned.endNode;
|
@@ -1401,15 +1380,15 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1401
1380
|
};
|
1402
1381
|
|
1403
1382
|
// src/dom/template.ts
|
1404
|
-
var
|
1405
|
-
let renderer =
|
1383
|
+
var _template = (id, template, walks, setup, inputSignal) => {
|
1384
|
+
let renderer = _content(
|
1406
1385
|
id,
|
1407
1386
|
template,
|
1408
1387
|
walks,
|
1409
1388
|
setup,
|
1410
1389
|
inputSignal
|
1411
1390
|
)();
|
1412
|
-
return renderer.mount = mount, renderer._ = renderer,
|
1391
|
+
return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
|
1413
1392
|
};
|
1414
1393
|
function mount(input = {}, reference, position) {
|
1415
1394
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
@@ -1453,7 +1432,7 @@ function mount(input = {}, reference, position) {
|
|
1453
1432
|
return curValue;
|
1454
1433
|
},
|
1455
1434
|
set value(newValue) {
|
1456
|
-
|
1435
|
+
_var_change(branch, newValue);
|
1457
1436
|
},
|
1458
1437
|
update(newInput) {
|
1459
1438
|
args && runEffects(
|
@@ -1468,75 +1447,76 @@ function mount(input = {}, reference, position) {
|
|
1468
1447
|
};
|
1469
1448
|
}
|
1470
1449
|
export {
|
1471
|
-
|
1450
|
+
$signal,
|
1451
|
+
$signalReset,
|
1452
|
+
_attr,
|
1453
|
+
_attr_class,
|
1454
|
+
_attr_class_item,
|
1455
|
+
_attr_class_items,
|
1456
|
+
_attr_content,
|
1457
|
+
_attr_details_or_dialog_open as _attr_details_open,
|
1458
|
+
_attr_details_or_dialog_open_script as _attr_details_open_script,
|
1459
|
+
_attr_details_or_dialog_open as _attr_dialog_open,
|
1460
|
+
_attr_details_or_dialog_open_script as _attr_dialog_open_script,
|
1461
|
+
_attr_input_checked,
|
1462
|
+
_attr_input_checkedValue,
|
1463
|
+
_attr_input_checkedValue_script,
|
1464
|
+
_attr_input_checked_script,
|
1465
|
+
_attr_input_value,
|
1466
|
+
_attr_input_value_script,
|
1467
|
+
_attr_select_value,
|
1468
|
+
_attr_select_value_script,
|
1469
|
+
_attr_style,
|
1470
|
+
_attr_style_item,
|
1471
|
+
_attr_style_items,
|
1472
|
+
_attr_input_value as _attr_textarea_value,
|
1473
|
+
_attr_input_value_script as _attr_textarea_value_script,
|
1474
|
+
_attrs,
|
1475
|
+
_attrs_content,
|
1476
|
+
_attrs_partial,
|
1477
|
+
_attrs_partial_content,
|
1478
|
+
_attrs_script,
|
1479
|
+
_await,
|
1480
|
+
_closure,
|
1481
|
+
_closure_get,
|
1482
|
+
_const,
|
1483
|
+
_content,
|
1484
|
+
_content_branch,
|
1485
|
+
_content_closures,
|
1486
|
+
_content_resume,
|
1487
|
+
_dynamic_tag,
|
1488
|
+
_el,
|
1489
|
+
_enable_catch,
|
1490
|
+
_for_closure,
|
1491
|
+
_for_in,
|
1492
|
+
_for_of,
|
1493
|
+
_for_to,
|
1494
|
+
_hoist,
|
1495
|
+
_html,
|
1496
|
+
_id,
|
1497
|
+
_if,
|
1498
|
+
_if_closure,
|
1499
|
+
_let,
|
1500
|
+
_lifecycle,
|
1501
|
+
_on,
|
1502
|
+
_or,
|
1503
|
+
_resume,
|
1504
|
+
_return,
|
1505
|
+
_return_change,
|
1506
|
+
_script,
|
1507
|
+
_template,
|
1508
|
+
_text,
|
1509
|
+
_text_content,
|
1510
|
+
_try,
|
1511
|
+
_var,
|
1512
|
+
_var_change,
|
1513
|
+
_var_resume,
|
1472
1514
|
attrTag,
|
1473
1515
|
attrTags,
|
1474
|
-
attrs,
|
1475
|
-
attrsAndContent,
|
1476
|
-
attrsEvents,
|
1477
|
-
awaitTag,
|
1478
|
-
classAttr,
|
1479
|
-
classItem,
|
1480
|
-
classItems,
|
1481
1516
|
compat,
|
1482
|
-
conditional,
|
1483
|
-
conditionalClosure,
|
1484
|
-
controllable_detailsOrDialog_open,
|
1485
|
-
controllable_detailsOrDialog_open_effect,
|
1486
|
-
controllable_input_checked,
|
1487
|
-
controllable_input_checkedValue,
|
1488
|
-
controllable_input_checkedValue_effect,
|
1489
|
-
controllable_input_checked_effect,
|
1490
|
-
controllable_input_value,
|
1491
|
-
controllable_input_value_effect,
|
1492
|
-
controllable_select_value,
|
1493
|
-
controllable_select_value_effect,
|
1494
|
-
controllable_input_value as controllable_textarea_value,
|
1495
|
-
controllable_input_value_effect as controllable_textarea_value_effect,
|
1496
|
-
createContent,
|
1497
|
-
createRenderer,
|
1498
|
-
createTemplate,
|
1499
|
-
createTry,
|
1500
|
-
data,
|
1501
|
-
dynamicClosure,
|
1502
|
-
dynamicClosureRead,
|
1503
|
-
dynamicTag,
|
1504
|
-
effect,
|
1505
|
-
enableCatch,
|
1506
1517
|
forIn,
|
1507
1518
|
forOf,
|
1508
1519
|
forTo,
|
1509
|
-
getAbortSignal,
|
1510
|
-
hoist,
|
1511
|
-
html,
|
1512
1520
|
init,
|
1513
|
-
|
1514
|
-
intersection,
|
1515
|
-
lifecycle,
|
1516
|
-
localClosures,
|
1517
|
-
loopClosure,
|
1518
|
-
loopIn,
|
1519
|
-
loopOf,
|
1520
|
-
loopTo,
|
1521
|
-
nextTagId,
|
1522
|
-
nodeRef,
|
1523
|
-
on,
|
1524
|
-
partialAttrs,
|
1525
|
-
partialAttrsAndContent,
|
1526
|
-
props,
|
1527
|
-
register,
|
1528
|
-
registerBoundSignal,
|
1529
|
-
registerContent,
|
1530
|
-
resetAbortSignal,
|
1531
|
-
run,
|
1532
|
-
setTagVar,
|
1533
|
-
setTagVarChange,
|
1534
|
-
state,
|
1535
|
-
styleAttr,
|
1536
|
-
styleItem,
|
1537
|
-
styleItems,
|
1538
|
-
tagVarSignal,
|
1539
|
-
tagVarSignalChange,
|
1540
|
-
textContent,
|
1541
|
-
value
|
1521
|
+
run
|
1542
1522
|
};
|