@marko/runtime-tags 0.2.2 → 0.2.4
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/debug/dom.js +18 -5
- package/dist/debug/dom.mjs +18 -5
- package/dist/debug/html.js +113 -49
- package/dist/debug/html.mjs +110 -49
- package/dist/dom/dom.d.ts +1 -0
- package/dist/dom/parse-html.d.ts +2 -2
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +14 -5
- package/dist/dom.mjs +14 -5
- package/dist/html/for.d.ts +4 -0
- package/dist/html/writer.d.ts +1 -0
- package/dist/html.d.ts +1 -1
- package/dist/html.js +91 -52
- package/dist/html.mjs +88 -52
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
|
@@ -83,6 +83,7 @@ __export(dom_exports, {
|
|
|
83
83
|
styleAttr: () => styleAttr,
|
|
84
84
|
tagVarSignal: () => tagVarSignal,
|
|
85
85
|
tagVarSignalChange: () => tagVarSignalChange,
|
|
86
|
+
textContent: () => textContent,
|
|
86
87
|
value: () => value
|
|
87
88
|
});
|
|
88
89
|
module.exports = __toCommonJS(dom_exports);
|
|
@@ -373,6 +374,7 @@ var Render = class {
|
|
|
373
374
|
delete this.___renders[this.___renderId];
|
|
374
375
|
} else {
|
|
375
376
|
registeredValues[resumes[i++]](
|
|
377
|
+
scopeLookup[resumeData],
|
|
376
378
|
scopeLookup[resumeData]
|
|
377
379
|
);
|
|
378
380
|
}
|
|
@@ -447,15 +449,16 @@ var DIRTY = true ? Symbol("dirty") : {};
|
|
|
447
449
|
function state(valueAccessor, fn, getIntersection) {
|
|
448
450
|
const valueSignal = value(valueAccessor, fn, getIntersection);
|
|
449
451
|
const markAccessor = valueAccessor + "#" /* Mark */;
|
|
452
|
+
const valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
|
450
453
|
return (scope, valueOrOp, valueChange) => {
|
|
451
454
|
if (rendering) {
|
|
452
455
|
const valueIsOp = valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY;
|
|
453
456
|
valueSignal(
|
|
454
457
|
scope,
|
|
455
|
-
valueIsOp || valueChange || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
458
|
+
valueIsOp || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
456
459
|
);
|
|
457
|
-
} else if (
|
|
458
|
-
|
|
460
|
+
} else if (scope[valueChangeAccessor]) {
|
|
461
|
+
scope[valueChangeAccessor](valueOrOp);
|
|
459
462
|
} else {
|
|
460
463
|
queueSource(scope, valueSignal, valueOrOp);
|
|
461
464
|
}
|
|
@@ -694,7 +697,7 @@ function runEffects(effects = pendingEffects) {
|
|
|
694
697
|
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
|
695
698
|
const scope = effects[i];
|
|
696
699
|
const fn = effects[i + 1];
|
|
697
|
-
fn(scope);
|
|
700
|
+
fn(scope, scope);
|
|
698
701
|
}
|
|
699
702
|
}
|
|
700
703
|
function runSignals(signals) {
|
|
@@ -1297,7 +1300,11 @@ function parseHTML(html2) {
|
|
|
1297
1300
|
}
|
|
1298
1301
|
function parseHTMLOrSingleNode(html2) {
|
|
1299
1302
|
const content = parseHTML(html2);
|
|
1300
|
-
|
|
1303
|
+
if (!content.firstChild) return fallback;
|
|
1304
|
+
return content.firstChild === content.lastChild && // If the firstChild is a comment it's possible its
|
|
1305
|
+
// a single replaced node, in which case the walker can't replace
|
|
1306
|
+
// the node itself.
|
|
1307
|
+
content.firstChild.nodeType !== 8 ? content.firstChild : content;
|
|
1301
1308
|
}
|
|
1302
1309
|
|
|
1303
1310
|
// src/dom/dom.ts
|
|
@@ -1325,6 +1332,12 @@ function data(node, value2) {
|
|
|
1325
1332
|
node.data = normalizedValue;
|
|
1326
1333
|
}
|
|
1327
1334
|
}
|
|
1335
|
+
function textContent(node, value2) {
|
|
1336
|
+
const normalizedValue = normalizeString(value2);
|
|
1337
|
+
if (node.textContent !== normalizedValue) {
|
|
1338
|
+
node.textContent = normalizedValue;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1328
1341
|
function attrs(scope, nodeAccessor, nextAttrs) {
|
|
1329
1342
|
const el = scope[nodeAccessor];
|
|
1330
1343
|
for (const { name } of el.attributes) {
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -284,6 +284,7 @@ var Render = class {
|
|
|
284
284
|
delete this.___renders[this.___renderId];
|
|
285
285
|
} else {
|
|
286
286
|
registeredValues[resumes[i++]](
|
|
287
|
+
scopeLookup[resumeData],
|
|
287
288
|
scopeLookup[resumeData]
|
|
288
289
|
);
|
|
289
290
|
}
|
|
@@ -358,15 +359,16 @@ var DIRTY = true ? Symbol("dirty") : {};
|
|
|
358
359
|
function state(valueAccessor, fn, getIntersection) {
|
|
359
360
|
const valueSignal = value(valueAccessor, fn, getIntersection);
|
|
360
361
|
const markAccessor = valueAccessor + "#" /* Mark */;
|
|
362
|
+
const valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
|
361
363
|
return (scope, valueOrOp, valueChange) => {
|
|
362
364
|
if (rendering) {
|
|
363
365
|
const valueIsOp = valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY;
|
|
364
366
|
valueSignal(
|
|
365
367
|
scope,
|
|
366
|
-
valueIsOp || valueChange || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
368
|
+
valueIsOp || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
367
369
|
);
|
|
368
|
-
} else if (
|
|
369
|
-
|
|
370
|
+
} else if (scope[valueChangeAccessor]) {
|
|
371
|
+
scope[valueChangeAccessor](valueOrOp);
|
|
370
372
|
} else {
|
|
371
373
|
queueSource(scope, valueSignal, valueOrOp);
|
|
372
374
|
}
|
|
@@ -605,7 +607,7 @@ function runEffects(effects = pendingEffects) {
|
|
|
605
607
|
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
|
606
608
|
const scope = effects[i];
|
|
607
609
|
const fn = effects[i + 1];
|
|
608
|
-
fn(scope);
|
|
610
|
+
fn(scope, scope);
|
|
609
611
|
}
|
|
610
612
|
}
|
|
611
613
|
function runSignals(signals) {
|
|
@@ -1208,7 +1210,11 @@ function parseHTML(html2) {
|
|
|
1208
1210
|
}
|
|
1209
1211
|
function parseHTMLOrSingleNode(html2) {
|
|
1210
1212
|
const content = parseHTML(html2);
|
|
1211
|
-
|
|
1213
|
+
if (!content.firstChild) return fallback;
|
|
1214
|
+
return content.firstChild === content.lastChild && // If the firstChild is a comment it's possible its
|
|
1215
|
+
// a single replaced node, in which case the walker can't replace
|
|
1216
|
+
// the node itself.
|
|
1217
|
+
content.firstChild.nodeType !== 8 ? content.firstChild : content;
|
|
1212
1218
|
}
|
|
1213
1219
|
|
|
1214
1220
|
// src/dom/dom.ts
|
|
@@ -1236,6 +1242,12 @@ function data(node, value2) {
|
|
|
1236
1242
|
node.data = normalizedValue;
|
|
1237
1243
|
}
|
|
1238
1244
|
}
|
|
1245
|
+
function textContent(node, value2) {
|
|
1246
|
+
const normalizedValue = normalizeString(value2);
|
|
1247
|
+
if (node.textContent !== normalizedValue) {
|
|
1248
|
+
node.textContent = normalizedValue;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1239
1251
|
function attrs(scope, nodeAccessor, nextAttrs) {
|
|
1240
1252
|
const el = scope[nodeAccessor];
|
|
1241
1253
|
for (const { name } of el.attributes) {
|
|
@@ -2072,5 +2084,6 @@ export {
|
|
|
2072
2084
|
styleAttr,
|
|
2073
2085
|
tagVarSignal,
|
|
2074
2086
|
tagVarSignalChange,
|
|
2087
|
+
textContent,
|
|
2075
2088
|
value
|
|
2076
2089
|
};
|
package/dist/debug/html.js
CHANGED
|
@@ -42,8 +42,11 @@ __export(html_exports, {
|
|
|
42
42
|
escapeStyle: () => escapeStyle,
|
|
43
43
|
escapeXML: () => escapeXML,
|
|
44
44
|
forIn: () => forIn,
|
|
45
|
+
forInBy: () => forInBy,
|
|
45
46
|
forOf: () => forOf,
|
|
47
|
+
forOfBy: () => forOfBy,
|
|
46
48
|
forTo: () => forTo,
|
|
49
|
+
forToBy: () => forToBy,
|
|
47
50
|
fork: () => fork,
|
|
48
51
|
getScopeById: () => getScopeById,
|
|
49
52
|
markResumeCleanup: () => markResumeCleanup,
|
|
@@ -95,28 +98,6 @@ function* attrTagIterator() {
|
|
|
95
98
|
yield* this[rest];
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
// src/common/for.ts
|
|
99
|
-
function forIn(obj, cb) {
|
|
100
|
-
for (const key in obj) {
|
|
101
|
-
cb(key, obj[key]);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function forOf(list, cb) {
|
|
105
|
-
if (list) {
|
|
106
|
-
let i = 0;
|
|
107
|
-
for (const item of list) {
|
|
108
|
-
cb(item, i++);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function forTo(to, from, step, cb) {
|
|
113
|
-
const start = from || 0;
|
|
114
|
-
const delta = step || 1;
|
|
115
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
|
116
|
-
cb(start + i * delta);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
101
|
// src/common/helpers.ts
|
|
121
102
|
function classValue(value) {
|
|
122
103
|
return toDelimitedString(value, " ", stringifyClassObject);
|
|
@@ -1668,6 +1649,9 @@ var State2 = class {
|
|
|
1668
1649
|
constructor($global2) {
|
|
1669
1650
|
this.$global = $global2;
|
|
1670
1651
|
this.$global = $global2;
|
|
1652
|
+
if ($global2.cspNonce) {
|
|
1653
|
+
this.nonceAttr = " " + escapeAttrValue($global2.cspNonce + "");
|
|
1654
|
+
}
|
|
1671
1655
|
}
|
|
1672
1656
|
tagIndex = 0;
|
|
1673
1657
|
scopeIndex = 0;
|
|
@@ -1678,6 +1662,7 @@ var State2 = class {
|
|
|
1678
1662
|
hasReorderRuntime = false;
|
|
1679
1663
|
hasWrittenResume = false;
|
|
1680
1664
|
trailerHTML = "";
|
|
1665
|
+
nonceAttr = "";
|
|
1681
1666
|
serializer = new Serializer();
|
|
1682
1667
|
writeReorders = null;
|
|
1683
1668
|
scopes = /* @__PURE__ */ new Map();
|
|
@@ -1851,8 +1836,7 @@ function prepareChunk(chunk) {
|
|
|
1851
1836
|
const head = chunk.consume();
|
|
1852
1837
|
const { boundary, effects } = head;
|
|
1853
1838
|
const { state } = boundary;
|
|
1854
|
-
const { $global: $global2, runtimePrefix, serializer } = state;
|
|
1855
|
-
const nonceAttr = $global2.cspNonce ? " nonce=" + escapeAttrValue($global2.cspNonce + "") : "";
|
|
1839
|
+
const { $global: $global2, runtimePrefix, serializer, nonceAttr } = state;
|
|
1856
1840
|
let { html, scripts } = head;
|
|
1857
1841
|
let hasWalk = false;
|
|
1858
1842
|
head.effects = "";
|
|
@@ -1963,7 +1947,7 @@ function flushChunk(head, last) {
|
|
|
1963
1947
|
let result = html;
|
|
1964
1948
|
head.html = head.scripts = "";
|
|
1965
1949
|
if (scripts) {
|
|
1966
|
-
result +=
|
|
1950
|
+
result += "<script" + state.nonceAttr + ">" + scripts + "</script>";
|
|
1967
1951
|
}
|
|
1968
1952
|
if (__flush__) {
|
|
1969
1953
|
$global2.__flush__ = void 0;
|
|
@@ -2053,10 +2037,13 @@ function optionValueAttr(value) {
|
|
|
2053
2037
|
var kSelectedValue = Symbol("selectedValue");
|
|
2054
2038
|
function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
|
|
2055
2039
|
if (valueChange) {
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2040
|
+
writeControlledScope(
|
|
2041
|
+
3 /* SelectValue */,
|
|
2042
|
+
scopeId,
|
|
2043
|
+
nodeAccessor,
|
|
2044
|
+
value,
|
|
2045
|
+
valueChange
|
|
2046
|
+
);
|
|
2060
2047
|
}
|
|
2061
2048
|
if (renderBody) {
|
|
2062
2049
|
withContext(kSelectedValue, value, renderBody);
|
|
@@ -2064,25 +2051,37 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, re
|
|
|
2064
2051
|
}
|
|
2065
2052
|
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2066
2053
|
if (valueChange) {
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2054
|
+
writeControlledScope(
|
|
2055
|
+
2 /* InputValue */,
|
|
2056
|
+
scopeId,
|
|
2057
|
+
nodeAccessor,
|
|
2058
|
+
void 0,
|
|
2059
|
+
valueChange
|
|
2060
|
+
);
|
|
2070
2061
|
}
|
|
2071
2062
|
return escapeTextAreaValue(value);
|
|
2072
2063
|
}
|
|
2073
2064
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2074
2065
|
if (valueChange) {
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2066
|
+
writeControlledScope(
|
|
2067
|
+
2 /* InputValue */,
|
|
2068
|
+
scopeId,
|
|
2069
|
+
nodeAccessor,
|
|
2070
|
+
void 0,
|
|
2071
|
+
valueChange
|
|
2072
|
+
);
|
|
2078
2073
|
}
|
|
2079
2074
|
return attr("value", value);
|
|
2080
2075
|
}
|
|
2081
2076
|
function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
2082
2077
|
if (checkedChange) {
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2078
|
+
writeControlledScope(
|
|
2079
|
+
0 /* InputChecked */,
|
|
2080
|
+
scopeId,
|
|
2081
|
+
nodeAccessor,
|
|
2082
|
+
void 0,
|
|
2083
|
+
checkedChange
|
|
2084
|
+
);
|
|
2086
2085
|
}
|
|
2087
2086
|
return attr("checked", checked);
|
|
2088
2087
|
}
|
|
@@ -2090,21 +2089,25 @@ function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, ch
|
|
|
2090
2089
|
const multiple = Array.isArray(checkedValue);
|
|
2091
2090
|
const valueAttr = attr("value", value);
|
|
2092
2091
|
if (checkedValueChange) {
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2092
|
+
writeControlledScope(
|
|
2093
|
+
1 /* InputCheckedValue */,
|
|
2094
|
+
scopeId,
|
|
2095
|
+
nodeAccessor,
|
|
2096
|
+
multiple ? checkedValue : void 0,
|
|
2097
|
+
checkedValueChange
|
|
2098
|
+
);
|
|
2099
2099
|
}
|
|
2100
2100
|
return (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
|
2101
2101
|
}
|
|
2102
2102
|
function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
2103
2103
|
if (openChange) {
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2104
|
+
writeControlledScope(
|
|
2105
|
+
4 /* DetailsOrDialogOpen */,
|
|
2106
|
+
scopeId,
|
|
2107
|
+
nodeAccessor,
|
|
2108
|
+
open,
|
|
2109
|
+
openChange
|
|
2110
|
+
);
|
|
2108
2111
|
}
|
|
2109
2112
|
return attr("open", open);
|
|
2110
2113
|
}
|
|
@@ -2184,7 +2187,13 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2184
2187
|
default:
|
|
2185
2188
|
if (!isVoid(val)) {
|
|
2186
2189
|
if (isEventHandler(name)) {
|
|
2187
|
-
(events
|
|
2190
|
+
if (!events) {
|
|
2191
|
+
events = {};
|
|
2192
|
+
writeScope(scopeId, {
|
|
2193
|
+
[nodeAccessor + "~" /* EventAttributes */]: events
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
events[getEventHandlerName(name)] = val;
|
|
2188
2197
|
} else if (!skip.test(name)) {
|
|
2189
2198
|
result += nonVoidAttr(name, val);
|
|
2190
2199
|
}
|
|
@@ -2201,6 +2210,13 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
2201
2210
|
}
|
|
2202
2211
|
return attrs(partial, nodeAccessor, scopeId, tagName);
|
|
2203
2212
|
}
|
|
2213
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
2214
|
+
writeScope(scopeId, {
|
|
2215
|
+
[nodeAccessor + "=" /* ControlledType */]: type,
|
|
2216
|
+
[nodeAccessor + ":" /* ControlledValue */]: value,
|
|
2217
|
+
[nodeAccessor + ";" /* ControlledHandler */]: valueChange
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2204
2220
|
function stringAttr(name, val) {
|
|
2205
2221
|
return val && ` ${name}=${escapeAttrValue(val)}`;
|
|
2206
2222
|
}
|
|
@@ -2411,6 +2427,51 @@ var compat = {
|
|
|
2411
2427
|
}
|
|
2412
2428
|
};
|
|
2413
2429
|
|
|
2430
|
+
// src/common/for.ts
|
|
2431
|
+
function forIn(obj, cb) {
|
|
2432
|
+
for (const key in obj) {
|
|
2433
|
+
cb(key, obj[key]);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
function forOf(list, cb) {
|
|
2437
|
+
if (list) {
|
|
2438
|
+
let i = 0;
|
|
2439
|
+
for (const item of list) {
|
|
2440
|
+
cb(item, i++);
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
function forTo(to, from, step, cb) {
|
|
2445
|
+
const start = from || 0;
|
|
2446
|
+
const delta = step || 1;
|
|
2447
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
|
2448
|
+
cb(start + i * delta);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
// src/html/for.ts
|
|
2453
|
+
function forOfBy(by, item, index) {
|
|
2454
|
+
if (by) {
|
|
2455
|
+
if (typeof by === "string") {
|
|
2456
|
+
return item[by];
|
|
2457
|
+
}
|
|
2458
|
+
return by(item, index);
|
|
2459
|
+
}
|
|
2460
|
+
return index;
|
|
2461
|
+
}
|
|
2462
|
+
function forInBy(by, name, value) {
|
|
2463
|
+
if (by) {
|
|
2464
|
+
return by(name, value);
|
|
2465
|
+
}
|
|
2466
|
+
return name;
|
|
2467
|
+
}
|
|
2468
|
+
function forToBy(by, index) {
|
|
2469
|
+
if (by) {
|
|
2470
|
+
return by(index);
|
|
2471
|
+
}
|
|
2472
|
+
return index;
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2414
2475
|
// src/html/template.ts
|
|
2415
2476
|
var createTemplate = (templateId, renderer) => {
|
|
2416
2477
|
renderer.render = render;
|
|
@@ -2647,8 +2708,11 @@ var ServerRenderResult = class {
|
|
|
2647
2708
|
escapeStyle,
|
|
2648
2709
|
escapeXML,
|
|
2649
2710
|
forIn,
|
|
2711
|
+
forInBy,
|
|
2650
2712
|
forOf,
|
|
2713
|
+
forOfBy,
|
|
2651
2714
|
forTo,
|
|
2715
|
+
forToBy,
|
|
2652
2716
|
fork,
|
|
2653
2717
|
getScopeById,
|
|
2654
2718
|
markResumeCleanup,
|
package/dist/debug/html.mjs
CHANGED
|
@@ -22,28 +22,6 @@ function* attrTagIterator() {
|
|
|
22
22
|
yield* this[rest];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// src/common/for.ts
|
|
26
|
-
function forIn(obj, cb) {
|
|
27
|
-
for (const key in obj) {
|
|
28
|
-
cb(key, obj[key]);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function forOf(list, cb) {
|
|
32
|
-
if (list) {
|
|
33
|
-
let i = 0;
|
|
34
|
-
for (const item of list) {
|
|
35
|
-
cb(item, i++);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function forTo(to, from, step, cb) {
|
|
40
|
-
const start = from || 0;
|
|
41
|
-
const delta = step || 1;
|
|
42
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
|
43
|
-
cb(start + i * delta);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
25
|
// src/common/helpers.ts
|
|
48
26
|
function classValue(value) {
|
|
49
27
|
return toDelimitedString(value, " ", stringifyClassObject);
|
|
@@ -1595,6 +1573,9 @@ var State2 = class {
|
|
|
1595
1573
|
constructor($global2) {
|
|
1596
1574
|
this.$global = $global2;
|
|
1597
1575
|
this.$global = $global2;
|
|
1576
|
+
if ($global2.cspNonce) {
|
|
1577
|
+
this.nonceAttr = " " + escapeAttrValue($global2.cspNonce + "");
|
|
1578
|
+
}
|
|
1598
1579
|
}
|
|
1599
1580
|
tagIndex = 0;
|
|
1600
1581
|
scopeIndex = 0;
|
|
@@ -1605,6 +1586,7 @@ var State2 = class {
|
|
|
1605
1586
|
hasReorderRuntime = false;
|
|
1606
1587
|
hasWrittenResume = false;
|
|
1607
1588
|
trailerHTML = "";
|
|
1589
|
+
nonceAttr = "";
|
|
1608
1590
|
serializer = new Serializer();
|
|
1609
1591
|
writeReorders = null;
|
|
1610
1592
|
scopes = /* @__PURE__ */ new Map();
|
|
@@ -1778,8 +1760,7 @@ function prepareChunk(chunk) {
|
|
|
1778
1760
|
const head = chunk.consume();
|
|
1779
1761
|
const { boundary, effects } = head;
|
|
1780
1762
|
const { state } = boundary;
|
|
1781
|
-
const { $global: $global2, runtimePrefix, serializer } = state;
|
|
1782
|
-
const nonceAttr = $global2.cspNonce ? " nonce=" + escapeAttrValue($global2.cspNonce + "") : "";
|
|
1763
|
+
const { $global: $global2, runtimePrefix, serializer, nonceAttr } = state;
|
|
1783
1764
|
let { html, scripts } = head;
|
|
1784
1765
|
let hasWalk = false;
|
|
1785
1766
|
head.effects = "";
|
|
@@ -1890,7 +1871,7 @@ function flushChunk(head, last) {
|
|
|
1890
1871
|
let result = html;
|
|
1891
1872
|
head.html = head.scripts = "";
|
|
1892
1873
|
if (scripts) {
|
|
1893
|
-
result +=
|
|
1874
|
+
result += "<script" + state.nonceAttr + ">" + scripts + "</script>";
|
|
1894
1875
|
}
|
|
1895
1876
|
if (__flush__) {
|
|
1896
1877
|
$global2.__flush__ = void 0;
|
|
@@ -1980,10 +1961,13 @@ function optionValueAttr(value) {
|
|
|
1980
1961
|
var kSelectedValue = Symbol("selectedValue");
|
|
1981
1962
|
function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
|
|
1982
1963
|
if (valueChange) {
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1964
|
+
writeControlledScope(
|
|
1965
|
+
3 /* SelectValue */,
|
|
1966
|
+
scopeId,
|
|
1967
|
+
nodeAccessor,
|
|
1968
|
+
value,
|
|
1969
|
+
valueChange
|
|
1970
|
+
);
|
|
1987
1971
|
}
|
|
1988
1972
|
if (renderBody) {
|
|
1989
1973
|
withContext(kSelectedValue, value, renderBody);
|
|
@@ -1991,25 +1975,37 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, re
|
|
|
1991
1975
|
}
|
|
1992
1976
|
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1993
1977
|
if (valueChange) {
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1978
|
+
writeControlledScope(
|
|
1979
|
+
2 /* InputValue */,
|
|
1980
|
+
scopeId,
|
|
1981
|
+
nodeAccessor,
|
|
1982
|
+
void 0,
|
|
1983
|
+
valueChange
|
|
1984
|
+
);
|
|
1997
1985
|
}
|
|
1998
1986
|
return escapeTextAreaValue(value);
|
|
1999
1987
|
}
|
|
2000
1988
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2001
1989
|
if (valueChange) {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
1990
|
+
writeControlledScope(
|
|
1991
|
+
2 /* InputValue */,
|
|
1992
|
+
scopeId,
|
|
1993
|
+
nodeAccessor,
|
|
1994
|
+
void 0,
|
|
1995
|
+
valueChange
|
|
1996
|
+
);
|
|
2005
1997
|
}
|
|
2006
1998
|
return attr("value", value);
|
|
2007
1999
|
}
|
|
2008
2000
|
function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
2009
2001
|
if (checkedChange) {
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2002
|
+
writeControlledScope(
|
|
2003
|
+
0 /* InputChecked */,
|
|
2004
|
+
scopeId,
|
|
2005
|
+
nodeAccessor,
|
|
2006
|
+
void 0,
|
|
2007
|
+
checkedChange
|
|
2008
|
+
);
|
|
2013
2009
|
}
|
|
2014
2010
|
return attr("checked", checked);
|
|
2015
2011
|
}
|
|
@@ -2017,21 +2013,25 @@ function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, ch
|
|
|
2017
2013
|
const multiple = Array.isArray(checkedValue);
|
|
2018
2014
|
const valueAttr = attr("value", value);
|
|
2019
2015
|
if (checkedValueChange) {
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2016
|
+
writeControlledScope(
|
|
2017
|
+
1 /* InputCheckedValue */,
|
|
2018
|
+
scopeId,
|
|
2019
|
+
nodeAccessor,
|
|
2020
|
+
multiple ? checkedValue : void 0,
|
|
2021
|
+
checkedValueChange
|
|
2022
|
+
);
|
|
2026
2023
|
}
|
|
2027
2024
|
return (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
|
2028
2025
|
}
|
|
2029
2026
|
function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
2030
2027
|
if (openChange) {
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2028
|
+
writeControlledScope(
|
|
2029
|
+
4 /* DetailsOrDialogOpen */,
|
|
2030
|
+
scopeId,
|
|
2031
|
+
nodeAccessor,
|
|
2032
|
+
open,
|
|
2033
|
+
openChange
|
|
2034
|
+
);
|
|
2035
2035
|
}
|
|
2036
2036
|
return attr("open", open);
|
|
2037
2037
|
}
|
|
@@ -2111,7 +2111,13 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2111
2111
|
default:
|
|
2112
2112
|
if (!isVoid(val)) {
|
|
2113
2113
|
if (isEventHandler(name)) {
|
|
2114
|
-
(events
|
|
2114
|
+
if (!events) {
|
|
2115
|
+
events = {};
|
|
2116
|
+
writeScope(scopeId, {
|
|
2117
|
+
[nodeAccessor + "~" /* EventAttributes */]: events
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
events[getEventHandlerName(name)] = val;
|
|
2115
2121
|
} else if (!skip.test(name)) {
|
|
2116
2122
|
result += nonVoidAttr(name, val);
|
|
2117
2123
|
}
|
|
@@ -2128,6 +2134,13 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
2128
2134
|
}
|
|
2129
2135
|
return attrs(partial, nodeAccessor, scopeId, tagName);
|
|
2130
2136
|
}
|
|
2137
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
2138
|
+
writeScope(scopeId, {
|
|
2139
|
+
[nodeAccessor + "=" /* ControlledType */]: type,
|
|
2140
|
+
[nodeAccessor + ":" /* ControlledValue */]: value,
|
|
2141
|
+
[nodeAccessor + ";" /* ControlledHandler */]: valueChange
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2131
2144
|
function stringAttr(name, val) {
|
|
2132
2145
|
return val && ` ${name}=${escapeAttrValue(val)}`;
|
|
2133
2146
|
}
|
|
@@ -2338,6 +2351,51 @@ var compat = {
|
|
|
2338
2351
|
}
|
|
2339
2352
|
};
|
|
2340
2353
|
|
|
2354
|
+
// src/common/for.ts
|
|
2355
|
+
function forIn(obj, cb) {
|
|
2356
|
+
for (const key in obj) {
|
|
2357
|
+
cb(key, obj[key]);
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
function forOf(list, cb) {
|
|
2361
|
+
if (list) {
|
|
2362
|
+
let i = 0;
|
|
2363
|
+
for (const item of list) {
|
|
2364
|
+
cb(item, i++);
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
function forTo(to, from, step, cb) {
|
|
2369
|
+
const start = from || 0;
|
|
2370
|
+
const delta = step || 1;
|
|
2371
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
|
2372
|
+
cb(start + i * delta);
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
// src/html/for.ts
|
|
2377
|
+
function forOfBy(by, item, index) {
|
|
2378
|
+
if (by) {
|
|
2379
|
+
if (typeof by === "string") {
|
|
2380
|
+
return item[by];
|
|
2381
|
+
}
|
|
2382
|
+
return by(item, index);
|
|
2383
|
+
}
|
|
2384
|
+
return index;
|
|
2385
|
+
}
|
|
2386
|
+
function forInBy(by, name, value) {
|
|
2387
|
+
if (by) {
|
|
2388
|
+
return by(name, value);
|
|
2389
|
+
}
|
|
2390
|
+
return name;
|
|
2391
|
+
}
|
|
2392
|
+
function forToBy(by, index) {
|
|
2393
|
+
if (by) {
|
|
2394
|
+
return by(index);
|
|
2395
|
+
}
|
|
2396
|
+
return index;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2341
2399
|
// src/html/template.ts
|
|
2342
2400
|
var createTemplate = (templateId, renderer) => {
|
|
2343
2401
|
renderer.render = render;
|
|
@@ -2573,8 +2631,11 @@ export {
|
|
|
2573
2631
|
escapeStyle,
|
|
2574
2632
|
escapeXML,
|
|
2575
2633
|
forIn,
|
|
2634
|
+
forInBy,
|
|
2576
2635
|
forOf,
|
|
2636
|
+
forOfBy,
|
|
2577
2637
|
forTo,
|
|
2638
|
+
forToBy,
|
|
2578
2639
|
fork,
|
|
2579
2640
|
getScopeById,
|
|
2580
2641
|
markResumeCleanup,
|
package/dist/dom/dom.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare function setAttribute(element: Element, name: string, value: stri
|
|
|
5
5
|
export declare function classAttr(element: Element, value: unknown): void;
|
|
6
6
|
export declare function styleAttr(element: Element, value: unknown): void;
|
|
7
7
|
export declare function data(node: Text | Comment, value: unknown): void;
|
|
8
|
+
export declare function textContent(node: ParentNode, value: unknown): void;
|
|
8
9
|
export declare function attrs(scope: Scope, nodeAccessor: Accessor, nextAttrs: Record<string, unknown>): void;
|
|
9
10
|
export declare function partialAttrs(scope: Scope, nodeAccessor: Accessor, nextAttrs: Record<string, unknown>, skip: Record<string, 1>): void;
|
|
10
11
|
export declare function attrsEvents(scope: Scope, nodeAccessor: Accessor): void;
|
package/dist/dom/parse-html.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function parseHTML(html: string): DocumentFragment;
|
|
2
|
-
export declare function parseHTMLOrSingleNode(html: string): Node & {
|
|
2
|
+
export declare function parseHTMLOrSingleNode(html: string): Text | (Node & {
|
|
3
3
|
firstChild?: ChildNode;
|
|
4
4
|
lastChild?: ChildNode;
|
|
5
|
-
};
|
|
5
|
+
});
|
package/dist/dom.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { getAbortSignal, resetAbortSignal } from "./dom/abort-signal";
|
|
|
5
5
|
export { compat } from "./dom/compat";
|
|
6
6
|
export { conditional, conditionalOnlyChild, inConditionalScope, inLoopScope, loopIn, loopOf, loopTo, } from "./dom/control-flow";
|
|
7
7
|
export { controllable_detailsOrDialog_open, controllable_detailsOrDialog_open_effect, controllable_input_checked, controllable_input_checked_effect, controllable_input_checkedValue, controllable_input_checkedValue_effect, controllable_input_value, controllable_input_value_effect, controllable_select_value, controllable_select_value_effect, controllable_textarea_value, controllable_textarea_value_effect, } from "./dom/controllable";
|
|
8
|
-
export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, partialAttrs, props, styleAttr, } from "./dom/dom";
|
|
8
|
+
export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, partialAttrs, props, styleAttr, textContent, } from "./dom/dom";
|
|
9
9
|
export { on } from "./dom/event";
|
|
10
10
|
export { run } from "./dom/queue";
|
|
11
11
|
export { createRenderer, createRendererWithOwner, dynamicTagAttrs, } from "./dom/renderer";
|
package/dist/dom.js
CHANGED
|
@@ -80,6 +80,7 @@ __export(dom_exports, {
|
|
|
80
80
|
styleAttr: () => styleAttr,
|
|
81
81
|
tagVarSignal: () => tagVarSignal,
|
|
82
82
|
tagVarSignalChange: () => tagVarSignalChange,
|
|
83
|
+
textContent: () => textContent,
|
|
83
84
|
value: () => value
|
|
84
85
|
});
|
|
85
86
|
module.exports = __toCommonJS(dom_exports);
|
|
@@ -254,6 +255,7 @@ var registeredValues = {}, Render = class {
|
|
|
254
255
|
cleanupOwnerId && (scope.d = scopes[cleanupOwnerId], onDestroy(scope));
|
|
255
256
|
}
|
|
256
257
|
} else i === len || typeof resumes[i] != "string" ? delete this.z[this.o] : registeredValues[resumes[i++]](
|
|
258
|
+
scopeLookup[resumeData],
|
|
257
259
|
scopeLookup[resumeData]
|
|
258
260
|
);
|
|
259
261
|
}
|
|
@@ -299,11 +301,11 @@ function nodeRef(id, key) {
|
|
|
299
301
|
// src/dom/signals.ts
|
|
300
302
|
var MARK = {}, CLEAN = {}, DIRTY = {};
|
|
301
303
|
function state(valueAccessor, fn, getIntersection) {
|
|
302
|
-
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */;
|
|
304
|
+
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */, valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
|
303
305
|
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
|
304
306
|
scope,
|
|
305
|
-
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || valueChange || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
306
|
-
) :
|
|
307
|
+
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
308
|
+
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : queueSource(scope, valueSignal, valueOrOp), valueOrOp);
|
|
307
309
|
}
|
|
308
310
|
function value(valueAccessor, fn, getIntersection) {
|
|
309
311
|
let markAccessor = valueAccessor + "#" /* Mark */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
|
@@ -444,7 +446,7 @@ function prepareEffects(fn) {
|
|
|
444
446
|
function runEffects(effects = pendingEffects) {
|
|
445
447
|
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
|
446
448
|
let scope = effects[i], fn = effects[i + 1];
|
|
447
|
-
fn(scope);
|
|
449
|
+
fn(scope, scope);
|
|
448
450
|
}
|
|
449
451
|
}
|
|
450
452
|
function runSignals(signals) {
|
|
@@ -814,7 +816,10 @@ function parseHTML(html2) {
|
|
|
814
816
|
}
|
|
815
817
|
function parseHTMLOrSingleNode(html2) {
|
|
816
818
|
let content = parseHTML(html2);
|
|
817
|
-
return content.firstChild === content.lastChild
|
|
819
|
+
return content.firstChild ? content.firstChild === content.lastChild && // If the firstChild is a comment it's possible its
|
|
820
|
+
// a single replaced node, in which case the walker can't replace
|
|
821
|
+
// the node itself.
|
|
822
|
+
content.firstChild.nodeType !== 8 ? content.firstChild : content : fallback;
|
|
818
823
|
}
|
|
819
824
|
|
|
820
825
|
// src/dom/dom.ts
|
|
@@ -834,6 +839,10 @@ function data(node, value2) {
|
|
|
834
839
|
let normalizedValue = normalizeString(value2);
|
|
835
840
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
|
836
841
|
}
|
|
842
|
+
function textContent(node, value2) {
|
|
843
|
+
let normalizedValue = normalizeString(value2);
|
|
844
|
+
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
|
845
|
+
}
|
|
837
846
|
function attrs(scope, nodeAccessor, nextAttrs) {
|
|
838
847
|
let el = scope[nodeAccessor];
|
|
839
848
|
for (let { name } of el.attributes)
|
package/dist/dom.mjs
CHANGED
|
@@ -168,6 +168,7 @@ var registeredValues = {}, Render = class {
|
|
|
168
168
|
cleanupOwnerId && (scope.d = scopes[cleanupOwnerId], onDestroy(scope));
|
|
169
169
|
}
|
|
170
170
|
} else i === len || typeof resumes[i] != "string" ? delete this.z[this.o] : registeredValues[resumes[i++]](
|
|
171
|
+
scopeLookup[resumeData],
|
|
171
172
|
scopeLookup[resumeData]
|
|
172
173
|
);
|
|
173
174
|
}
|
|
@@ -213,11 +214,11 @@ function nodeRef(id, key) {
|
|
|
213
214
|
// src/dom/signals.ts
|
|
214
215
|
var MARK = {}, CLEAN = {}, DIRTY = {};
|
|
215
216
|
function state(valueAccessor, fn, getIntersection) {
|
|
216
|
-
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */;
|
|
217
|
+
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */, valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
|
217
218
|
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
|
218
219
|
scope,
|
|
219
|
-
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || valueChange || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
220
|
-
) :
|
|
220
|
+
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
221
|
+
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : queueSource(scope, valueSignal, valueOrOp), valueOrOp);
|
|
221
222
|
}
|
|
222
223
|
function value(valueAccessor, fn, getIntersection) {
|
|
223
224
|
let markAccessor = valueAccessor + "#" /* Mark */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
|
@@ -358,7 +359,7 @@ function prepareEffects(fn) {
|
|
|
358
359
|
function runEffects(effects = pendingEffects) {
|
|
359
360
|
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
|
360
361
|
let scope = effects[i], fn = effects[i + 1];
|
|
361
|
-
fn(scope);
|
|
362
|
+
fn(scope, scope);
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
365
|
function runSignals(signals) {
|
|
@@ -728,7 +729,10 @@ function parseHTML(html2) {
|
|
|
728
729
|
}
|
|
729
730
|
function parseHTMLOrSingleNode(html2) {
|
|
730
731
|
let content = parseHTML(html2);
|
|
731
|
-
return content.firstChild === content.lastChild
|
|
732
|
+
return content.firstChild ? content.firstChild === content.lastChild && // If the firstChild is a comment it's possible its
|
|
733
|
+
// a single replaced node, in which case the walker can't replace
|
|
734
|
+
// the node itself.
|
|
735
|
+
content.firstChild.nodeType !== 8 ? content.firstChild : content : fallback;
|
|
732
736
|
}
|
|
733
737
|
|
|
734
738
|
// src/dom/dom.ts
|
|
@@ -748,6 +752,10 @@ function data(node, value2) {
|
|
|
748
752
|
let normalizedValue = normalizeString(value2);
|
|
749
753
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
|
750
754
|
}
|
|
755
|
+
function textContent(node, value2) {
|
|
756
|
+
let normalizedValue = normalizeString(value2);
|
|
757
|
+
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
|
758
|
+
}
|
|
751
759
|
function attrs(scope, nodeAccessor, nextAttrs) {
|
|
752
760
|
let el = scope[nodeAccessor];
|
|
753
761
|
for (let { name } of el.attributes)
|
|
@@ -1337,5 +1345,6 @@ export {
|
|
|
1337
1345
|
styleAttr,
|
|
1338
1346
|
tagVarSignal,
|
|
1339
1347
|
tagVarSignalChange,
|
|
1348
|
+
textContent,
|
|
1340
1349
|
value
|
|
1341
1350
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { forIn, forOf, forTo } from "../common/for";
|
|
2
|
+
export declare function forOfBy(by: unknown, item: any, index: unknown): any;
|
|
3
|
+
export declare function forInBy(by: unknown, name: string, value: unknown): any;
|
|
4
|
+
export declare function forToBy(by: unknown, index: number): any;
|
package/dist/html/writer.d.ts
CHANGED
package/dist/html.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
|
-
export { forIn, forOf, forTo } from "./common/for";
|
|
3
2
|
export { normalizeDynamicRenderer } from "./common/helpers";
|
|
4
3
|
export { attr, attrs, classAttr, controllable_detailsOrDialog_open, controllable_input_checked, controllable_input_checkedValue, controllable_input_value, controllable_select_value, controllable_textarea_value, optionValueAttr, partialAttrs, styleAttr, } from "./html/attrs";
|
|
5
4
|
export { compat } from "./html/compat";
|
|
6
5
|
export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
|
|
7
6
|
export { createRenderer, dynamicTagArgs, dynamicTagInput, } from "./html/dynamic-tag";
|
|
7
|
+
export { forIn, forInBy, forOf, forOfBy, forTo, forToBy } from "./html/for";
|
|
8
8
|
export { createTemplate } from "./html/template";
|
|
9
9
|
export { $global, ensureScopeWithId, fork, getScopeById, markResumeCleanup, markResumeControlEnd, markResumeControlSingleNodeEnd, markResumeNode, markResumeScopeStart, nextScopeId, nextTagId, nodeRef, peekNextScope, register, tryCatch, tryPlaceholder, write, writeEffect, writeExistingScope, writeScope, writeTrailers, } from "./html/writer";
|
package/dist/html.js
CHANGED
|
@@ -39,8 +39,11 @@ __export(html_exports, {
|
|
|
39
39
|
escapeStyle: () => escapeStyle,
|
|
40
40
|
escapeXML: () => escapeXML,
|
|
41
41
|
forIn: () => forIn,
|
|
42
|
+
forInBy: () => forInBy,
|
|
42
43
|
forOf: () => forOf,
|
|
44
|
+
forOfBy: () => forOfBy,
|
|
43
45
|
forTo: () => forTo,
|
|
46
|
+
forToBy: () => forToBy,
|
|
44
47
|
fork: () => fork,
|
|
45
48
|
getScopeById: () => getScopeById,
|
|
46
49
|
markResumeCleanup: () => markResumeCleanup,
|
|
@@ -80,24 +83,6 @@ function* attrTagIterator() {
|
|
|
80
83
|
yield this, yield* this[rest];
|
|
81
84
|
}
|
|
82
85
|
|
|
83
|
-
// src/common/for.ts
|
|
84
|
-
function forIn(obj, cb) {
|
|
85
|
-
for (let key in obj)
|
|
86
|
-
cb(key, obj[key]);
|
|
87
|
-
}
|
|
88
|
-
function forOf(list, cb) {
|
|
89
|
-
if (list) {
|
|
90
|
-
let i = 0;
|
|
91
|
-
for (let item of list)
|
|
92
|
-
cb(item, i++);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function forTo(to, from, step, cb) {
|
|
96
|
-
let start = from || 0, delta = step || 1;
|
|
97
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
|
98
|
-
cb(start + i * delta);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
86
|
// src/common/helpers.ts
|
|
102
87
|
function classValue(value) {
|
|
103
88
|
return toDelimitedString(value, " ", stringifyClassObject);
|
|
@@ -1110,7 +1095,7 @@ function tryCatch(renderBody, renderCatch) {
|
|
|
1110
1095
|
var State2 = class {
|
|
1111
1096
|
constructor($global2) {
|
|
1112
1097
|
this.$global = $global2;
|
|
1113
|
-
this.$global = $global2;
|
|
1098
|
+
this.$global = $global2, $global2.cspNonce && (this.nonceAttr = " " + escapeAttrValue($global2.cspNonce + ""));
|
|
1114
1099
|
}
|
|
1115
1100
|
tagIndex = 0;
|
|
1116
1101
|
scopeIndex = 0;
|
|
@@ -1121,6 +1106,7 @@ var State2 = class {
|
|
|
1121
1106
|
hasReorderRuntime = !1;
|
|
1122
1107
|
hasWrittenResume = !1;
|
|
1123
1108
|
trailerHTML = "";
|
|
1109
|
+
nonceAttr = "";
|
|
1124
1110
|
serializer = new Serializer();
|
|
1125
1111
|
writeReorders = null;
|
|
1126
1112
|
scopes = /* @__PURE__ */ new Map();
|
|
@@ -1235,7 +1221,7 @@ var State2 = class {
|
|
|
1235
1221
|
}
|
|
1236
1222
|
};
|
|
1237
1223
|
function prepareChunk(chunk) {
|
|
1238
|
-
let head = chunk.consume(), { boundary, effects } = head, { state } = boundary, { $global: $global2, runtimePrefix, serializer
|
|
1224
|
+
let head = chunk.consume(), { boundary, effects } = head, { state } = boundary, { $global: $global2, runtimePrefix, serializer, nonceAttr } = state, { html, scripts } = head, hasWalk = !1;
|
|
1239
1225
|
head.effects = "", state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
|
1240
1226
|
scripts,
|
|
1241
1227
|
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
@@ -1276,7 +1262,7 @@ function prepareChunk(chunk) {
|
|
|
1276
1262
|
}
|
|
1277
1263
|
function flushChunk(head, last) {
|
|
1278
1264
|
let { boundary } = head, { state } = boundary, { html, scripts } = head, { $global: $global2 } = state, { __flush__ } = $global2, result = html;
|
|
1279
|
-
return head.html = head.scripts = "", scripts && (result +=
|
|
1265
|
+
return head.html = head.scripts = "", scripts && (result += "<script" + state.nonceAttr + ">" + scripts + "</script>"), __flush__ && ($global2.__flush__ = void 0, result = __flush__($global2, result)), last && state.trailerHTML && (result += state.trailerHTML), result;
|
|
1280
1266
|
}
|
|
1281
1267
|
function writeTrailers(html) {
|
|
1282
1268
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1335,47 +1321,59 @@ function optionValueAttr(value) {
|
|
|
1335
1321
|
}
|
|
1336
1322
|
var kSelectedValue = Symbol("selectedValue");
|
|
1337
1323
|
function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1324
|
+
valueChange && writeControlledScope(
|
|
1325
|
+
3 /* SelectValue */,
|
|
1326
|
+
scopeId,
|
|
1327
|
+
nodeAccessor,
|
|
1328
|
+
value,
|
|
1329
|
+
valueChange
|
|
1330
|
+
), renderBody && withContext(kSelectedValue, value, renderBody);
|
|
1343
1331
|
}
|
|
1344
1332
|
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1333
|
+
return valueChange && writeControlledScope(
|
|
1334
|
+
2 /* InputValue */,
|
|
1335
|
+
scopeId,
|
|
1336
|
+
nodeAccessor,
|
|
1337
|
+
void 0,
|
|
1338
|
+
valueChange
|
|
1339
|
+
), escapeTextAreaValue(value);
|
|
1350
1340
|
}
|
|
1351
1341
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1342
|
+
return valueChange && writeControlledScope(
|
|
1343
|
+
2 /* InputValue */,
|
|
1344
|
+
scopeId,
|
|
1345
|
+
nodeAccessor,
|
|
1346
|
+
void 0,
|
|
1347
|
+
valueChange
|
|
1348
|
+
), attr("value", value);
|
|
1357
1349
|
}
|
|
1358
1350
|
function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1351
|
+
return checkedChange && writeControlledScope(
|
|
1352
|
+
0 /* InputChecked */,
|
|
1353
|
+
scopeId,
|
|
1354
|
+
nodeAccessor,
|
|
1355
|
+
void 0,
|
|
1356
|
+
checkedChange
|
|
1357
|
+
), attr("checked", checked);
|
|
1364
1358
|
}
|
|
1365
1359
|
function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1366
1360
|
let multiple = Array.isArray(checkedValue), valueAttr = attr("value", value);
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1361
|
+
return checkedValueChange && writeControlledScope(
|
|
1362
|
+
1 /* InputCheckedValue */,
|
|
1363
|
+
scopeId,
|
|
1364
|
+
nodeAccessor,
|
|
1365
|
+
multiple ? checkedValue : void 0,
|
|
1366
|
+
checkedValueChange
|
|
1367
|
+
), (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
|
1372
1368
|
}
|
|
1373
1369
|
function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1370
|
+
return openChange && writeControlledScope(
|
|
1371
|
+
4 /* DetailsOrDialogOpen */,
|
|
1372
|
+
scopeId,
|
|
1373
|
+
nodeAccessor,
|
|
1374
|
+
open,
|
|
1375
|
+
openChange
|
|
1376
|
+
), attr("open", open);
|
|
1379
1377
|
}
|
|
1380
1378
|
function attr(name, val) {
|
|
1381
1379
|
return isVoid(val) ? "" : nonVoidAttr(name, val);
|
|
@@ -1440,7 +1438,9 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1440
1438
|
case "renderBody":
|
|
1441
1439
|
break;
|
|
1442
1440
|
default:
|
|
1443
|
-
isVoid(val) || (isEventHandler(name) ? (events
|
|
1441
|
+
isVoid(val) || (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
|
|
1442
|
+
[nodeAccessor + "~" /* EventAttributes */]: events
|
|
1443
|
+
})), events[getEventHandlerName(name)] = val) : skip.test(name) || (result += nonVoidAttr(name, val)));
|
|
1444
1444
|
break;
|
|
1445
1445
|
}
|
|
1446
1446
|
}
|
|
@@ -1452,6 +1452,13 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1452
1452
|
skip[key] || (partial[key] = data[key]);
|
|
1453
1453
|
return attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1454
1454
|
}
|
|
1455
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1456
|
+
writeScope(scopeId, {
|
|
1457
|
+
[nodeAccessor + "=" /* ControlledType */]: type,
|
|
1458
|
+
[nodeAccessor + ":" /* ControlledValue */]: value,
|
|
1459
|
+
[nodeAccessor + ";" /* ControlledHandler */]: valueChange
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1455
1462
|
function stringAttr(name, val) {
|
|
1456
1463
|
return val && ` ${name}=${escapeAttrValue(val)}`;
|
|
1457
1464
|
}
|
|
@@ -1584,6 +1591,35 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1584
1591
|
}
|
|
1585
1592
|
};
|
|
1586
1593
|
|
|
1594
|
+
// src/common/for.ts
|
|
1595
|
+
function forIn(obj, cb) {
|
|
1596
|
+
for (let key in obj)
|
|
1597
|
+
cb(key, obj[key]);
|
|
1598
|
+
}
|
|
1599
|
+
function forOf(list, cb) {
|
|
1600
|
+
if (list) {
|
|
1601
|
+
let i = 0;
|
|
1602
|
+
for (let item of list)
|
|
1603
|
+
cb(item, i++);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
function forTo(to, from, step, cb) {
|
|
1607
|
+
let start = from || 0, delta = step || 1;
|
|
1608
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
|
1609
|
+
cb(start + i * delta);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
// src/html/for.ts
|
|
1613
|
+
function forOfBy(by, item, index) {
|
|
1614
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
|
1615
|
+
}
|
|
1616
|
+
function forInBy(by, name, value) {
|
|
1617
|
+
return by ? by(name, value) : name;
|
|
1618
|
+
}
|
|
1619
|
+
function forToBy(by, index) {
|
|
1620
|
+
return by ? by(index) : index;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1587
1623
|
// src/html/template.ts
|
|
1588
1624
|
var createTemplate = (templateId, renderer) => (renderer.render = render, renderer._ = renderer, register2(renderer, templateId));
|
|
1589
1625
|
function render(input = {}) {
|
|
@@ -1750,8 +1786,11 @@ var ServerRenderResult = class {
|
|
|
1750
1786
|
escapeStyle,
|
|
1751
1787
|
escapeXML,
|
|
1752
1788
|
forIn,
|
|
1789
|
+
forInBy,
|
|
1753
1790
|
forOf,
|
|
1791
|
+
forOfBy,
|
|
1754
1792
|
forTo,
|
|
1793
|
+
forToBy,
|
|
1755
1794
|
fork,
|
|
1756
1795
|
getScopeById,
|
|
1757
1796
|
markResumeCleanup,
|
package/dist/html.mjs
CHANGED
|
@@ -10,24 +10,6 @@ function* attrTagIterator() {
|
|
|
10
10
|
yield this, yield* this[rest];
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
// src/common/for.ts
|
|
14
|
-
function forIn(obj, cb) {
|
|
15
|
-
for (let key in obj)
|
|
16
|
-
cb(key, obj[key]);
|
|
17
|
-
}
|
|
18
|
-
function forOf(list, cb) {
|
|
19
|
-
if (list) {
|
|
20
|
-
let i = 0;
|
|
21
|
-
for (let item of list)
|
|
22
|
-
cb(item, i++);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function forTo(to, from, step, cb) {
|
|
26
|
-
let start = from || 0, delta = step || 1;
|
|
27
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
|
28
|
-
cb(start + i * delta);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
13
|
// src/common/helpers.ts
|
|
32
14
|
function classValue(value) {
|
|
33
15
|
return toDelimitedString(value, " ", stringifyClassObject);
|
|
@@ -1040,7 +1022,7 @@ function tryCatch(renderBody, renderCatch) {
|
|
|
1040
1022
|
var State2 = class {
|
|
1041
1023
|
constructor($global2) {
|
|
1042
1024
|
this.$global = $global2;
|
|
1043
|
-
this.$global = $global2;
|
|
1025
|
+
this.$global = $global2, $global2.cspNonce && (this.nonceAttr = " " + escapeAttrValue($global2.cspNonce + ""));
|
|
1044
1026
|
}
|
|
1045
1027
|
tagIndex = 0;
|
|
1046
1028
|
scopeIndex = 0;
|
|
@@ -1051,6 +1033,7 @@ var State2 = class {
|
|
|
1051
1033
|
hasReorderRuntime = !1;
|
|
1052
1034
|
hasWrittenResume = !1;
|
|
1053
1035
|
trailerHTML = "";
|
|
1036
|
+
nonceAttr = "";
|
|
1054
1037
|
serializer = new Serializer();
|
|
1055
1038
|
writeReorders = null;
|
|
1056
1039
|
scopes = /* @__PURE__ */ new Map();
|
|
@@ -1165,7 +1148,7 @@ var State2 = class {
|
|
|
1165
1148
|
}
|
|
1166
1149
|
};
|
|
1167
1150
|
function prepareChunk(chunk) {
|
|
1168
|
-
let head = chunk.consume(), { boundary, effects } = head, { state } = boundary, { $global: $global2, runtimePrefix, serializer
|
|
1151
|
+
let head = chunk.consume(), { boundary, effects } = head, { state } = boundary, { $global: $global2, runtimePrefix, serializer, nonceAttr } = state, { html, scripts } = head, hasWalk = !1;
|
|
1169
1152
|
head.effects = "", state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
|
1170
1153
|
scripts,
|
|
1171
1154
|
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
@@ -1206,7 +1189,7 @@ function prepareChunk(chunk) {
|
|
|
1206
1189
|
}
|
|
1207
1190
|
function flushChunk(head, last) {
|
|
1208
1191
|
let { boundary } = head, { state } = boundary, { html, scripts } = head, { $global: $global2 } = state, { __flush__ } = $global2, result = html;
|
|
1209
|
-
return head.html = head.scripts = "", scripts && (result +=
|
|
1192
|
+
return head.html = head.scripts = "", scripts && (result += "<script" + state.nonceAttr + ">" + scripts + "</script>"), __flush__ && ($global2.__flush__ = void 0, result = __flush__($global2, result)), last && state.trailerHTML && (result += state.trailerHTML), result;
|
|
1210
1193
|
}
|
|
1211
1194
|
function writeTrailers(html) {
|
|
1212
1195
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1265,47 +1248,59 @@ function optionValueAttr(value) {
|
|
|
1265
1248
|
}
|
|
1266
1249
|
var kSelectedValue = Symbol("selectedValue");
|
|
1267
1250
|
function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1251
|
+
valueChange && writeControlledScope(
|
|
1252
|
+
3 /* SelectValue */,
|
|
1253
|
+
scopeId,
|
|
1254
|
+
nodeAccessor,
|
|
1255
|
+
value,
|
|
1256
|
+
valueChange
|
|
1257
|
+
), renderBody && withContext(kSelectedValue, value, renderBody);
|
|
1273
1258
|
}
|
|
1274
1259
|
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1260
|
+
return valueChange && writeControlledScope(
|
|
1261
|
+
2 /* InputValue */,
|
|
1262
|
+
scopeId,
|
|
1263
|
+
nodeAccessor,
|
|
1264
|
+
void 0,
|
|
1265
|
+
valueChange
|
|
1266
|
+
), escapeTextAreaValue(value);
|
|
1280
1267
|
}
|
|
1281
1268
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1269
|
+
return valueChange && writeControlledScope(
|
|
1270
|
+
2 /* InputValue */,
|
|
1271
|
+
scopeId,
|
|
1272
|
+
nodeAccessor,
|
|
1273
|
+
void 0,
|
|
1274
|
+
valueChange
|
|
1275
|
+
), attr("value", value);
|
|
1287
1276
|
}
|
|
1288
1277
|
function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1278
|
+
return checkedChange && writeControlledScope(
|
|
1279
|
+
0 /* InputChecked */,
|
|
1280
|
+
scopeId,
|
|
1281
|
+
nodeAccessor,
|
|
1282
|
+
void 0,
|
|
1283
|
+
checkedChange
|
|
1284
|
+
), attr("checked", checked);
|
|
1294
1285
|
}
|
|
1295
1286
|
function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1296
1287
|
let multiple = Array.isArray(checkedValue), valueAttr = attr("value", value);
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1288
|
+
return checkedValueChange && writeControlledScope(
|
|
1289
|
+
1 /* InputCheckedValue */,
|
|
1290
|
+
scopeId,
|
|
1291
|
+
nodeAccessor,
|
|
1292
|
+
multiple ? checkedValue : void 0,
|
|
1293
|
+
checkedValueChange
|
|
1294
|
+
), (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
|
1302
1295
|
}
|
|
1303
1296
|
function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1297
|
+
return openChange && writeControlledScope(
|
|
1298
|
+
4 /* DetailsOrDialogOpen */,
|
|
1299
|
+
scopeId,
|
|
1300
|
+
nodeAccessor,
|
|
1301
|
+
open,
|
|
1302
|
+
openChange
|
|
1303
|
+
), attr("open", open);
|
|
1309
1304
|
}
|
|
1310
1305
|
function attr(name, val) {
|
|
1311
1306
|
return isVoid(val) ? "" : nonVoidAttr(name, val);
|
|
@@ -1370,7 +1365,9 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1370
1365
|
case "renderBody":
|
|
1371
1366
|
break;
|
|
1372
1367
|
default:
|
|
1373
|
-
isVoid(val) || (isEventHandler(name) ? (events
|
|
1368
|
+
isVoid(val) || (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
|
|
1369
|
+
[nodeAccessor + "~" /* EventAttributes */]: events
|
|
1370
|
+
})), events[getEventHandlerName(name)] = val) : skip.test(name) || (result += nonVoidAttr(name, val)));
|
|
1374
1371
|
break;
|
|
1375
1372
|
}
|
|
1376
1373
|
}
|
|
@@ -1382,6 +1379,13 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1382
1379
|
skip[key] || (partial[key] = data[key]);
|
|
1383
1380
|
return attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1384
1381
|
}
|
|
1382
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1383
|
+
writeScope(scopeId, {
|
|
1384
|
+
[nodeAccessor + "=" /* ControlledType */]: type,
|
|
1385
|
+
[nodeAccessor + ":" /* ControlledValue */]: value,
|
|
1386
|
+
[nodeAccessor + ";" /* ControlledHandler */]: valueChange
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1385
1389
|
function stringAttr(name, val) {
|
|
1386
1390
|
return val && ` ${name}=${escapeAttrValue(val)}`;
|
|
1387
1391
|
}
|
|
@@ -1514,6 +1518,35 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1514
1518
|
}
|
|
1515
1519
|
};
|
|
1516
1520
|
|
|
1521
|
+
// src/common/for.ts
|
|
1522
|
+
function forIn(obj, cb) {
|
|
1523
|
+
for (let key in obj)
|
|
1524
|
+
cb(key, obj[key]);
|
|
1525
|
+
}
|
|
1526
|
+
function forOf(list, cb) {
|
|
1527
|
+
if (list) {
|
|
1528
|
+
let i = 0;
|
|
1529
|
+
for (let item of list)
|
|
1530
|
+
cb(item, i++);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
function forTo(to, from, step, cb) {
|
|
1534
|
+
let start = from || 0, delta = step || 1;
|
|
1535
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
|
1536
|
+
cb(start + i * delta);
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
// src/html/for.ts
|
|
1540
|
+
function forOfBy(by, item, index) {
|
|
1541
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
|
1542
|
+
}
|
|
1543
|
+
function forInBy(by, name, value) {
|
|
1544
|
+
return by ? by(name, value) : name;
|
|
1545
|
+
}
|
|
1546
|
+
function forToBy(by, index) {
|
|
1547
|
+
return by ? by(index) : index;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1517
1550
|
// src/html/template.ts
|
|
1518
1551
|
var createTemplate = (templateId, renderer) => (renderer.render = render, renderer._ = renderer, register2(renderer, templateId));
|
|
1519
1552
|
function render(input = {}) {
|
|
@@ -1679,8 +1712,11 @@ export {
|
|
|
1679
1712
|
escapeStyle,
|
|
1680
1713
|
escapeXML,
|
|
1681
1714
|
forIn,
|
|
1715
|
+
forInBy,
|
|
1682
1716
|
forOf,
|
|
1717
|
+
forOfBy,
|
|
1683
1718
|
forTo,
|
|
1719
|
+
forToBy,
|
|
1684
1720
|
fork,
|
|
1685
1721
|
getScopeById,
|
|
1686
1722
|
markResumeCleanup,
|