@marko/runtime-tags 0.2.2 → 0.2.3
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 +4 -3
- package/dist/debug/dom.mjs +4 -3
- package/dist/debug/html.js +107 -46
- package/dist/debug/html.mjs +104 -46
- package/dist/dom.js +3 -3
- package/dist/dom.mjs +3 -3
- package/dist/html/for.d.ts +4 -0
- package/dist/html.d.ts +1 -1
- package/dist/html.js +87 -49
- package/dist/html.mjs +84 -49
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
|
@@ -447,15 +447,16 @@ var DIRTY = true ? Symbol("dirty") : {};
|
|
|
447
447
|
function state(valueAccessor, fn, getIntersection) {
|
|
448
448
|
const valueSignal = value(valueAccessor, fn, getIntersection);
|
|
449
449
|
const markAccessor = valueAccessor + "#" /* Mark */;
|
|
450
|
+
const valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
|
450
451
|
return (scope, valueOrOp, valueChange) => {
|
|
451
452
|
if (rendering) {
|
|
452
453
|
const valueIsOp = valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY;
|
|
453
454
|
valueSignal(
|
|
454
455
|
scope,
|
|
455
|
-
valueIsOp || valueChange || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
456
|
+
valueIsOp || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
456
457
|
);
|
|
457
|
-
} else if (
|
|
458
|
-
|
|
458
|
+
} else if (scope[valueChangeAccessor]) {
|
|
459
|
+
scope[valueChangeAccessor](valueOrOp);
|
|
459
460
|
} else {
|
|
460
461
|
queueSource(scope, valueSignal, valueOrOp);
|
|
461
462
|
}
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -358,15 +358,16 @@ var DIRTY = true ? Symbol("dirty") : {};
|
|
|
358
358
|
function state(valueAccessor, fn, getIntersection) {
|
|
359
359
|
const valueSignal = value(valueAccessor, fn, getIntersection);
|
|
360
360
|
const markAccessor = valueAccessor + "#" /* Mark */;
|
|
361
|
+
const valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
|
361
362
|
return (scope, valueOrOp, valueChange) => {
|
|
362
363
|
if (rendering) {
|
|
363
364
|
const valueIsOp = valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY;
|
|
364
365
|
valueSignal(
|
|
365
366
|
scope,
|
|
366
|
-
valueIsOp || valueChange || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
367
|
+
valueIsOp || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
367
368
|
);
|
|
368
|
-
} else if (
|
|
369
|
-
|
|
369
|
+
} else if (scope[valueChangeAccessor]) {
|
|
370
|
+
scope[valueChangeAccessor](valueOrOp);
|
|
370
371
|
} else {
|
|
371
372
|
queueSource(scope, valueSignal, valueOrOp);
|
|
372
373
|
}
|
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);
|
|
@@ -2053,10 +2034,13 @@ function optionValueAttr(value) {
|
|
|
2053
2034
|
var kSelectedValue = Symbol("selectedValue");
|
|
2054
2035
|
function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
|
|
2055
2036
|
if (valueChange) {
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2037
|
+
writeControlledScope(
|
|
2038
|
+
3 /* SelectValue */,
|
|
2039
|
+
scopeId,
|
|
2040
|
+
nodeAccessor,
|
|
2041
|
+
value,
|
|
2042
|
+
valueChange
|
|
2043
|
+
);
|
|
2060
2044
|
}
|
|
2061
2045
|
if (renderBody) {
|
|
2062
2046
|
withContext(kSelectedValue, value, renderBody);
|
|
@@ -2064,25 +2048,37 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, re
|
|
|
2064
2048
|
}
|
|
2065
2049
|
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2066
2050
|
if (valueChange) {
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2051
|
+
writeControlledScope(
|
|
2052
|
+
2 /* InputValue */,
|
|
2053
|
+
scopeId,
|
|
2054
|
+
nodeAccessor,
|
|
2055
|
+
void 0,
|
|
2056
|
+
valueChange
|
|
2057
|
+
);
|
|
2070
2058
|
}
|
|
2071
2059
|
return escapeTextAreaValue(value);
|
|
2072
2060
|
}
|
|
2073
2061
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2074
2062
|
if (valueChange) {
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2063
|
+
writeControlledScope(
|
|
2064
|
+
2 /* InputValue */,
|
|
2065
|
+
scopeId,
|
|
2066
|
+
nodeAccessor,
|
|
2067
|
+
void 0,
|
|
2068
|
+
valueChange
|
|
2069
|
+
);
|
|
2078
2070
|
}
|
|
2079
2071
|
return attr("value", value);
|
|
2080
2072
|
}
|
|
2081
2073
|
function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
2082
2074
|
if (checkedChange) {
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2075
|
+
writeControlledScope(
|
|
2076
|
+
0 /* InputChecked */,
|
|
2077
|
+
scopeId,
|
|
2078
|
+
nodeAccessor,
|
|
2079
|
+
void 0,
|
|
2080
|
+
checkedChange
|
|
2081
|
+
);
|
|
2086
2082
|
}
|
|
2087
2083
|
return attr("checked", checked);
|
|
2088
2084
|
}
|
|
@@ -2090,21 +2086,25 @@ function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, ch
|
|
|
2090
2086
|
const multiple = Array.isArray(checkedValue);
|
|
2091
2087
|
const valueAttr = attr("value", value);
|
|
2092
2088
|
if (checkedValueChange) {
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2089
|
+
writeControlledScope(
|
|
2090
|
+
1 /* InputCheckedValue */,
|
|
2091
|
+
scopeId,
|
|
2092
|
+
nodeAccessor,
|
|
2093
|
+
multiple ? checkedValue : void 0,
|
|
2094
|
+
checkedValueChange
|
|
2095
|
+
);
|
|
2099
2096
|
}
|
|
2100
2097
|
return (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
|
2101
2098
|
}
|
|
2102
2099
|
function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
2103
2100
|
if (openChange) {
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2101
|
+
writeControlledScope(
|
|
2102
|
+
4 /* DetailsOrDialogOpen */,
|
|
2103
|
+
scopeId,
|
|
2104
|
+
nodeAccessor,
|
|
2105
|
+
open,
|
|
2106
|
+
openChange
|
|
2107
|
+
);
|
|
2108
2108
|
}
|
|
2109
2109
|
return attr("open", open);
|
|
2110
2110
|
}
|
|
@@ -2184,7 +2184,13 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2184
2184
|
default:
|
|
2185
2185
|
if (!isVoid(val)) {
|
|
2186
2186
|
if (isEventHandler(name)) {
|
|
2187
|
-
(events
|
|
2187
|
+
if (!events) {
|
|
2188
|
+
events = {};
|
|
2189
|
+
writeScope(scopeId, {
|
|
2190
|
+
[nodeAccessor + "~" /* EventAttributes */]: events
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
events[getEventHandlerName(name)] = val;
|
|
2188
2194
|
} else if (!skip.test(name)) {
|
|
2189
2195
|
result += nonVoidAttr(name, val);
|
|
2190
2196
|
}
|
|
@@ -2201,6 +2207,13 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
2201
2207
|
}
|
|
2202
2208
|
return attrs(partial, nodeAccessor, scopeId, tagName);
|
|
2203
2209
|
}
|
|
2210
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
2211
|
+
writeScope(scopeId, {
|
|
2212
|
+
[nodeAccessor + "=" /* ControlledType */]: type,
|
|
2213
|
+
[nodeAccessor + ":" /* ControlledValue */]: value,
|
|
2214
|
+
[nodeAccessor + ";" /* ControlledHandler */]: valueChange
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2204
2217
|
function stringAttr(name, val) {
|
|
2205
2218
|
return val && ` ${name}=${escapeAttrValue(val)}`;
|
|
2206
2219
|
}
|
|
@@ -2411,6 +2424,51 @@ var compat = {
|
|
|
2411
2424
|
}
|
|
2412
2425
|
};
|
|
2413
2426
|
|
|
2427
|
+
// src/common/for.ts
|
|
2428
|
+
function forIn(obj, cb) {
|
|
2429
|
+
for (const key in obj) {
|
|
2430
|
+
cb(key, obj[key]);
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
function forOf(list, cb) {
|
|
2434
|
+
if (list) {
|
|
2435
|
+
let i = 0;
|
|
2436
|
+
for (const item of list) {
|
|
2437
|
+
cb(item, i++);
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
function forTo(to, from, step, cb) {
|
|
2442
|
+
const start = from || 0;
|
|
2443
|
+
const delta = step || 1;
|
|
2444
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
|
2445
|
+
cb(start + i * delta);
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
// src/html/for.ts
|
|
2450
|
+
function forOfBy(by, item, index) {
|
|
2451
|
+
if (by) {
|
|
2452
|
+
if (typeof by === "string") {
|
|
2453
|
+
return item[by];
|
|
2454
|
+
}
|
|
2455
|
+
return by(item, index);
|
|
2456
|
+
}
|
|
2457
|
+
return index;
|
|
2458
|
+
}
|
|
2459
|
+
function forInBy(by, name, value) {
|
|
2460
|
+
if (by) {
|
|
2461
|
+
return by(name, value);
|
|
2462
|
+
}
|
|
2463
|
+
return name;
|
|
2464
|
+
}
|
|
2465
|
+
function forToBy(by, index) {
|
|
2466
|
+
if (by) {
|
|
2467
|
+
return by(index);
|
|
2468
|
+
}
|
|
2469
|
+
return index;
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2414
2472
|
// src/html/template.ts
|
|
2415
2473
|
var createTemplate = (templateId, renderer) => {
|
|
2416
2474
|
renderer.render = render;
|
|
@@ -2647,8 +2705,11 @@ var ServerRenderResult = class {
|
|
|
2647
2705
|
escapeStyle,
|
|
2648
2706
|
escapeXML,
|
|
2649
2707
|
forIn,
|
|
2708
|
+
forInBy,
|
|
2650
2709
|
forOf,
|
|
2710
|
+
forOfBy,
|
|
2651
2711
|
forTo,
|
|
2712
|
+
forToBy,
|
|
2652
2713
|
fork,
|
|
2653
2714
|
getScopeById,
|
|
2654
2715
|
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);
|
|
@@ -1980,10 +1958,13 @@ function optionValueAttr(value) {
|
|
|
1980
1958
|
var kSelectedValue = Symbol("selectedValue");
|
|
1981
1959
|
function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
|
|
1982
1960
|
if (valueChange) {
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1961
|
+
writeControlledScope(
|
|
1962
|
+
3 /* SelectValue */,
|
|
1963
|
+
scopeId,
|
|
1964
|
+
nodeAccessor,
|
|
1965
|
+
value,
|
|
1966
|
+
valueChange
|
|
1967
|
+
);
|
|
1987
1968
|
}
|
|
1988
1969
|
if (renderBody) {
|
|
1989
1970
|
withContext(kSelectedValue, value, renderBody);
|
|
@@ -1991,25 +1972,37 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, re
|
|
|
1991
1972
|
}
|
|
1992
1973
|
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1993
1974
|
if (valueChange) {
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1975
|
+
writeControlledScope(
|
|
1976
|
+
2 /* InputValue */,
|
|
1977
|
+
scopeId,
|
|
1978
|
+
nodeAccessor,
|
|
1979
|
+
void 0,
|
|
1980
|
+
valueChange
|
|
1981
|
+
);
|
|
1997
1982
|
}
|
|
1998
1983
|
return escapeTextAreaValue(value);
|
|
1999
1984
|
}
|
|
2000
1985
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2001
1986
|
if (valueChange) {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
1987
|
+
writeControlledScope(
|
|
1988
|
+
2 /* InputValue */,
|
|
1989
|
+
scopeId,
|
|
1990
|
+
nodeAccessor,
|
|
1991
|
+
void 0,
|
|
1992
|
+
valueChange
|
|
1993
|
+
);
|
|
2005
1994
|
}
|
|
2006
1995
|
return attr("value", value);
|
|
2007
1996
|
}
|
|
2008
1997
|
function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
2009
1998
|
if (checkedChange) {
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
1999
|
+
writeControlledScope(
|
|
2000
|
+
0 /* InputChecked */,
|
|
2001
|
+
scopeId,
|
|
2002
|
+
nodeAccessor,
|
|
2003
|
+
void 0,
|
|
2004
|
+
checkedChange
|
|
2005
|
+
);
|
|
2013
2006
|
}
|
|
2014
2007
|
return attr("checked", checked);
|
|
2015
2008
|
}
|
|
@@ -2017,21 +2010,25 @@ function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, ch
|
|
|
2017
2010
|
const multiple = Array.isArray(checkedValue);
|
|
2018
2011
|
const valueAttr = attr("value", value);
|
|
2019
2012
|
if (checkedValueChange) {
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2013
|
+
writeControlledScope(
|
|
2014
|
+
1 /* InputCheckedValue */,
|
|
2015
|
+
scopeId,
|
|
2016
|
+
nodeAccessor,
|
|
2017
|
+
multiple ? checkedValue : void 0,
|
|
2018
|
+
checkedValueChange
|
|
2019
|
+
);
|
|
2026
2020
|
}
|
|
2027
2021
|
return (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
|
2028
2022
|
}
|
|
2029
2023
|
function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
2030
2024
|
if (openChange) {
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2025
|
+
writeControlledScope(
|
|
2026
|
+
4 /* DetailsOrDialogOpen */,
|
|
2027
|
+
scopeId,
|
|
2028
|
+
nodeAccessor,
|
|
2029
|
+
open,
|
|
2030
|
+
openChange
|
|
2031
|
+
);
|
|
2035
2032
|
}
|
|
2036
2033
|
return attr("open", open);
|
|
2037
2034
|
}
|
|
@@ -2111,7 +2108,13 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2111
2108
|
default:
|
|
2112
2109
|
if (!isVoid(val)) {
|
|
2113
2110
|
if (isEventHandler(name)) {
|
|
2114
|
-
(events
|
|
2111
|
+
if (!events) {
|
|
2112
|
+
events = {};
|
|
2113
|
+
writeScope(scopeId, {
|
|
2114
|
+
[nodeAccessor + "~" /* EventAttributes */]: events
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
events[getEventHandlerName(name)] = val;
|
|
2115
2118
|
} else if (!skip.test(name)) {
|
|
2116
2119
|
result += nonVoidAttr(name, val);
|
|
2117
2120
|
}
|
|
@@ -2128,6 +2131,13 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
2128
2131
|
}
|
|
2129
2132
|
return attrs(partial, nodeAccessor, scopeId, tagName);
|
|
2130
2133
|
}
|
|
2134
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
2135
|
+
writeScope(scopeId, {
|
|
2136
|
+
[nodeAccessor + "=" /* ControlledType */]: type,
|
|
2137
|
+
[nodeAccessor + ":" /* ControlledValue */]: value,
|
|
2138
|
+
[nodeAccessor + ";" /* ControlledHandler */]: valueChange
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2131
2141
|
function stringAttr(name, val) {
|
|
2132
2142
|
return val && ` ${name}=${escapeAttrValue(val)}`;
|
|
2133
2143
|
}
|
|
@@ -2338,6 +2348,51 @@ var compat = {
|
|
|
2338
2348
|
}
|
|
2339
2349
|
};
|
|
2340
2350
|
|
|
2351
|
+
// src/common/for.ts
|
|
2352
|
+
function forIn(obj, cb) {
|
|
2353
|
+
for (const key in obj) {
|
|
2354
|
+
cb(key, obj[key]);
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
function forOf(list, cb) {
|
|
2358
|
+
if (list) {
|
|
2359
|
+
let i = 0;
|
|
2360
|
+
for (const item of list) {
|
|
2361
|
+
cb(item, i++);
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
function forTo(to, from, step, cb) {
|
|
2366
|
+
const start = from || 0;
|
|
2367
|
+
const delta = step || 1;
|
|
2368
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
|
2369
|
+
cb(start + i * delta);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
// src/html/for.ts
|
|
2374
|
+
function forOfBy(by, item, index) {
|
|
2375
|
+
if (by) {
|
|
2376
|
+
if (typeof by === "string") {
|
|
2377
|
+
return item[by];
|
|
2378
|
+
}
|
|
2379
|
+
return by(item, index);
|
|
2380
|
+
}
|
|
2381
|
+
return index;
|
|
2382
|
+
}
|
|
2383
|
+
function forInBy(by, name, value) {
|
|
2384
|
+
if (by) {
|
|
2385
|
+
return by(name, value);
|
|
2386
|
+
}
|
|
2387
|
+
return name;
|
|
2388
|
+
}
|
|
2389
|
+
function forToBy(by, index) {
|
|
2390
|
+
if (by) {
|
|
2391
|
+
return by(index);
|
|
2392
|
+
}
|
|
2393
|
+
return index;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2341
2396
|
// src/html/template.ts
|
|
2342
2397
|
var createTemplate = (templateId, renderer) => {
|
|
2343
2398
|
renderer.render = render;
|
|
@@ -2573,8 +2628,11 @@ export {
|
|
|
2573
2628
|
escapeStyle,
|
|
2574
2629
|
escapeXML,
|
|
2575
2630
|
forIn,
|
|
2631
|
+
forInBy,
|
|
2576
2632
|
forOf,
|
|
2633
|
+
forOfBy,
|
|
2577
2634
|
forTo,
|
|
2635
|
+
forToBy,
|
|
2578
2636
|
fork,
|
|
2579
2637
|
getScopeById,
|
|
2580
2638
|
markResumeCleanup,
|
package/dist/dom.js
CHANGED
|
@@ -299,11 +299,11 @@ function nodeRef(id, key) {
|
|
|
299
299
|
// src/dom/signals.ts
|
|
300
300
|
var MARK = {}, CLEAN = {}, DIRTY = {};
|
|
301
301
|
function state(valueAccessor, fn, getIntersection) {
|
|
302
|
-
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */;
|
|
302
|
+
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */, valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
|
303
303
|
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
|
304
304
|
scope,
|
|
305
|
-
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || valueChange || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
306
|
-
) :
|
|
305
|
+
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
306
|
+
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : queueSource(scope, valueSignal, valueOrOp), valueOrOp);
|
|
307
307
|
}
|
|
308
308
|
function value(valueAccessor, fn, getIntersection) {
|
|
309
309
|
let markAccessor = valueAccessor + "#" /* Mark */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
package/dist/dom.mjs
CHANGED
|
@@ -213,11 +213,11 @@ function nodeRef(id, key) {
|
|
|
213
213
|
// src/dom/signals.ts
|
|
214
214
|
var MARK = {}, CLEAN = {}, DIRTY = {};
|
|
215
215
|
function state(valueAccessor, fn, getIntersection) {
|
|
216
|
-
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */;
|
|
216
|
+
let valueSignal = value(valueAccessor, fn, getIntersection), markAccessor = valueAccessor + "#" /* Mark */, valueChangeAccessor = valueAccessor + "@" /* TagVariableChange */;
|
|
217
217
|
return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
|
|
218
218
|
scope,
|
|
219
|
-
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || valueChange || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
220
|
-
) :
|
|
219
|
+
valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
|
|
220
|
+
) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : queueSource(scope, valueSignal, valueOrOp), valueOrOp);
|
|
221
221
|
}
|
|
222
222
|
function value(valueAccessor, fn, getIntersection) {
|
|
223
223
|
let markAccessor = valueAccessor + "#" /* Mark */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
|
@@ -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.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);
|
|
@@ -1335,47 +1320,59 @@ function optionValueAttr(value) {
|
|
|
1335
1320
|
}
|
|
1336
1321
|
var kSelectedValue = Symbol("selectedValue");
|
|
1337
1322
|
function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1323
|
+
valueChange && writeControlledScope(
|
|
1324
|
+
3 /* SelectValue */,
|
|
1325
|
+
scopeId,
|
|
1326
|
+
nodeAccessor,
|
|
1327
|
+
value,
|
|
1328
|
+
valueChange
|
|
1329
|
+
), renderBody && withContext(kSelectedValue, value, renderBody);
|
|
1343
1330
|
}
|
|
1344
1331
|
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1332
|
+
return valueChange && writeControlledScope(
|
|
1333
|
+
2 /* InputValue */,
|
|
1334
|
+
scopeId,
|
|
1335
|
+
nodeAccessor,
|
|
1336
|
+
void 0,
|
|
1337
|
+
valueChange
|
|
1338
|
+
), escapeTextAreaValue(value);
|
|
1350
1339
|
}
|
|
1351
1340
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1341
|
+
return valueChange && writeControlledScope(
|
|
1342
|
+
2 /* InputValue */,
|
|
1343
|
+
scopeId,
|
|
1344
|
+
nodeAccessor,
|
|
1345
|
+
void 0,
|
|
1346
|
+
valueChange
|
|
1347
|
+
), attr("value", value);
|
|
1357
1348
|
}
|
|
1358
1349
|
function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1350
|
+
return checkedChange && writeControlledScope(
|
|
1351
|
+
0 /* InputChecked */,
|
|
1352
|
+
scopeId,
|
|
1353
|
+
nodeAccessor,
|
|
1354
|
+
void 0,
|
|
1355
|
+
checkedChange
|
|
1356
|
+
), attr("checked", checked);
|
|
1364
1357
|
}
|
|
1365
1358
|
function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1366
1359
|
let multiple = Array.isArray(checkedValue), valueAttr = attr("value", value);
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1360
|
+
return checkedValueChange && writeControlledScope(
|
|
1361
|
+
1 /* InputCheckedValue */,
|
|
1362
|
+
scopeId,
|
|
1363
|
+
nodeAccessor,
|
|
1364
|
+
multiple ? checkedValue : void 0,
|
|
1365
|
+
checkedValueChange
|
|
1366
|
+
), (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
|
1372
1367
|
}
|
|
1373
1368
|
function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1369
|
+
return openChange && writeControlledScope(
|
|
1370
|
+
4 /* DetailsOrDialogOpen */,
|
|
1371
|
+
scopeId,
|
|
1372
|
+
nodeAccessor,
|
|
1373
|
+
open,
|
|
1374
|
+
openChange
|
|
1375
|
+
), attr("open", open);
|
|
1379
1376
|
}
|
|
1380
1377
|
function attr(name, val) {
|
|
1381
1378
|
return isVoid(val) ? "" : nonVoidAttr(name, val);
|
|
@@ -1440,7 +1437,9 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1440
1437
|
case "renderBody":
|
|
1441
1438
|
break;
|
|
1442
1439
|
default:
|
|
1443
|
-
isVoid(val) || (isEventHandler(name) ? (events
|
|
1440
|
+
isVoid(val) || (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
|
|
1441
|
+
[nodeAccessor + "~" /* EventAttributes */]: events
|
|
1442
|
+
})), events[getEventHandlerName(name)] = val) : skip.test(name) || (result += nonVoidAttr(name, val)));
|
|
1444
1443
|
break;
|
|
1445
1444
|
}
|
|
1446
1445
|
}
|
|
@@ -1452,6 +1451,13 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1452
1451
|
skip[key] || (partial[key] = data[key]);
|
|
1453
1452
|
return attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1454
1453
|
}
|
|
1454
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1455
|
+
writeScope(scopeId, {
|
|
1456
|
+
[nodeAccessor + "=" /* ControlledType */]: type,
|
|
1457
|
+
[nodeAccessor + ":" /* ControlledValue */]: value,
|
|
1458
|
+
[nodeAccessor + ";" /* ControlledHandler */]: valueChange
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1455
1461
|
function stringAttr(name, val) {
|
|
1456
1462
|
return val && ` ${name}=${escapeAttrValue(val)}`;
|
|
1457
1463
|
}
|
|
@@ -1584,6 +1590,35 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1584
1590
|
}
|
|
1585
1591
|
};
|
|
1586
1592
|
|
|
1593
|
+
// src/common/for.ts
|
|
1594
|
+
function forIn(obj, cb) {
|
|
1595
|
+
for (let key in obj)
|
|
1596
|
+
cb(key, obj[key]);
|
|
1597
|
+
}
|
|
1598
|
+
function forOf(list, cb) {
|
|
1599
|
+
if (list) {
|
|
1600
|
+
let i = 0;
|
|
1601
|
+
for (let item of list)
|
|
1602
|
+
cb(item, i++);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
function forTo(to, from, step, cb) {
|
|
1606
|
+
let start = from || 0, delta = step || 1;
|
|
1607
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
|
1608
|
+
cb(start + i * delta);
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
// src/html/for.ts
|
|
1612
|
+
function forOfBy(by, item, index) {
|
|
1613
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
|
1614
|
+
}
|
|
1615
|
+
function forInBy(by, name, value) {
|
|
1616
|
+
return by ? by(name, value) : name;
|
|
1617
|
+
}
|
|
1618
|
+
function forToBy(by, index) {
|
|
1619
|
+
return by ? by(index) : index;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1587
1622
|
// src/html/template.ts
|
|
1588
1623
|
var createTemplate = (templateId, renderer) => (renderer.render = render, renderer._ = renderer, register2(renderer, templateId));
|
|
1589
1624
|
function render(input = {}) {
|
|
@@ -1750,8 +1785,11 @@ var ServerRenderResult = class {
|
|
|
1750
1785
|
escapeStyle,
|
|
1751
1786
|
escapeXML,
|
|
1752
1787
|
forIn,
|
|
1788
|
+
forInBy,
|
|
1753
1789
|
forOf,
|
|
1790
|
+
forOfBy,
|
|
1754
1791
|
forTo,
|
|
1792
|
+
forToBy,
|
|
1755
1793
|
fork,
|
|
1756
1794
|
getScopeById,
|
|
1757
1795
|
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);
|
|
@@ -1265,47 +1247,59 @@ function optionValueAttr(value) {
|
|
|
1265
1247
|
}
|
|
1266
1248
|
var kSelectedValue = Symbol("selectedValue");
|
|
1267
1249
|
function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1250
|
+
valueChange && writeControlledScope(
|
|
1251
|
+
3 /* SelectValue */,
|
|
1252
|
+
scopeId,
|
|
1253
|
+
nodeAccessor,
|
|
1254
|
+
value,
|
|
1255
|
+
valueChange
|
|
1256
|
+
), renderBody && withContext(kSelectedValue, value, renderBody);
|
|
1273
1257
|
}
|
|
1274
1258
|
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1259
|
+
return valueChange && writeControlledScope(
|
|
1260
|
+
2 /* InputValue */,
|
|
1261
|
+
scopeId,
|
|
1262
|
+
nodeAccessor,
|
|
1263
|
+
void 0,
|
|
1264
|
+
valueChange
|
|
1265
|
+
), escapeTextAreaValue(value);
|
|
1280
1266
|
}
|
|
1281
1267
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1268
|
+
return valueChange && writeControlledScope(
|
|
1269
|
+
2 /* InputValue */,
|
|
1270
|
+
scopeId,
|
|
1271
|
+
nodeAccessor,
|
|
1272
|
+
void 0,
|
|
1273
|
+
valueChange
|
|
1274
|
+
), attr("value", value);
|
|
1287
1275
|
}
|
|
1288
1276
|
function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1277
|
+
return checkedChange && writeControlledScope(
|
|
1278
|
+
0 /* InputChecked */,
|
|
1279
|
+
scopeId,
|
|
1280
|
+
nodeAccessor,
|
|
1281
|
+
void 0,
|
|
1282
|
+
checkedChange
|
|
1283
|
+
), attr("checked", checked);
|
|
1294
1284
|
}
|
|
1295
1285
|
function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1296
1286
|
let multiple = Array.isArray(checkedValue), valueAttr = attr("value", value);
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1287
|
+
return checkedValueChange && writeControlledScope(
|
|
1288
|
+
1 /* InputCheckedValue */,
|
|
1289
|
+
scopeId,
|
|
1290
|
+
nodeAccessor,
|
|
1291
|
+
multiple ? checkedValue : void 0,
|
|
1292
|
+
checkedValueChange
|
|
1293
|
+
), (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
|
1302
1294
|
}
|
|
1303
1295
|
function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1296
|
+
return openChange && writeControlledScope(
|
|
1297
|
+
4 /* DetailsOrDialogOpen */,
|
|
1298
|
+
scopeId,
|
|
1299
|
+
nodeAccessor,
|
|
1300
|
+
open,
|
|
1301
|
+
openChange
|
|
1302
|
+
), attr("open", open);
|
|
1309
1303
|
}
|
|
1310
1304
|
function attr(name, val) {
|
|
1311
1305
|
return isVoid(val) ? "" : nonVoidAttr(name, val);
|
|
@@ -1370,7 +1364,9 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1370
1364
|
case "renderBody":
|
|
1371
1365
|
break;
|
|
1372
1366
|
default:
|
|
1373
|
-
isVoid(val) || (isEventHandler(name) ? (events
|
|
1367
|
+
isVoid(val) || (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
|
|
1368
|
+
[nodeAccessor + "~" /* EventAttributes */]: events
|
|
1369
|
+
})), events[getEventHandlerName(name)] = val) : skip.test(name) || (result += nonVoidAttr(name, val)));
|
|
1374
1370
|
break;
|
|
1375
1371
|
}
|
|
1376
1372
|
}
|
|
@@ -1382,6 +1378,13 @@ function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1382
1378
|
skip[key] || (partial[key] = data[key]);
|
|
1383
1379
|
return attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1384
1380
|
}
|
|
1381
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1382
|
+
writeScope(scopeId, {
|
|
1383
|
+
[nodeAccessor + "=" /* ControlledType */]: type,
|
|
1384
|
+
[nodeAccessor + ":" /* ControlledValue */]: value,
|
|
1385
|
+
[nodeAccessor + ";" /* ControlledHandler */]: valueChange
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1385
1388
|
function stringAttr(name, val) {
|
|
1386
1389
|
return val && ` ${name}=${escapeAttrValue(val)}`;
|
|
1387
1390
|
}
|
|
@@ -1514,6 +1517,35 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1514
1517
|
}
|
|
1515
1518
|
};
|
|
1516
1519
|
|
|
1520
|
+
// src/common/for.ts
|
|
1521
|
+
function forIn(obj, cb) {
|
|
1522
|
+
for (let key in obj)
|
|
1523
|
+
cb(key, obj[key]);
|
|
1524
|
+
}
|
|
1525
|
+
function forOf(list, cb) {
|
|
1526
|
+
if (list) {
|
|
1527
|
+
let i = 0;
|
|
1528
|
+
for (let item of list)
|
|
1529
|
+
cb(item, i++);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
function forTo(to, from, step, cb) {
|
|
1533
|
+
let start = from || 0, delta = step || 1;
|
|
1534
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
|
|
1535
|
+
cb(start + i * delta);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
// src/html/for.ts
|
|
1539
|
+
function forOfBy(by, item, index) {
|
|
1540
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
|
1541
|
+
}
|
|
1542
|
+
function forInBy(by, name, value) {
|
|
1543
|
+
return by ? by(name, value) : name;
|
|
1544
|
+
}
|
|
1545
|
+
function forToBy(by, index) {
|
|
1546
|
+
return by ? by(index) : index;
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1517
1549
|
// src/html/template.ts
|
|
1518
1550
|
var createTemplate = (templateId, renderer) => (renderer.render = render, renderer._ = renderer, register2(renderer, templateId));
|
|
1519
1551
|
function render(input = {}) {
|
|
@@ -1679,8 +1711,11 @@ export {
|
|
|
1679
1711
|
escapeStyle,
|
|
1680
1712
|
escapeXML,
|
|
1681
1713
|
forIn,
|
|
1714
|
+
forInBy,
|
|
1682
1715
|
forOf,
|
|
1716
|
+
forOfBy,
|
|
1683
1717
|
forTo,
|
|
1718
|
+
forToBy,
|
|
1684
1719
|
fork,
|
|
1685
1720
|
getScopeById,
|
|
1686
1721
|
markResumeCleanup,
|