@marko/runtime-tags 0.1.19 → 0.1.20
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 +24 -11
- package/dist/debug/dom.mjs +24 -11
- package/dist/debug/html.js +50 -22
- package/dist/debug/html.mjs +49 -22
- package/dist/dom/controllable.d.ts +1 -0
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +16 -11
- package/dist/dom.mjs +16 -11
- package/dist/html/attrs.d.ts +1 -0
- package/dist/html/content.d.ts +1 -0
- package/dist/html.d.ts +1 -1
- package/dist/html.js +38 -18
- package/dist/html.mjs +37 -18
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
|
@@ -42,6 +42,8 @@ __export(dom_exports, {
|
|
|
42
42
|
controllable_input_value_effect: () => controllable_input_value_effect,
|
|
43
43
|
controllable_select_value: () => controllable_select_value,
|
|
44
44
|
controllable_select_value_effect: () => controllable_select_value_effect,
|
|
45
|
+
controllable_textarea_value: () => controllable_input_value,
|
|
46
|
+
controllable_textarea_value_effect: () => controllable_input_value_effect,
|
|
45
47
|
createRenderer: () => createRenderer,
|
|
46
48
|
createRendererWithOwner: () => createRendererWithOwner,
|
|
47
49
|
createScope: () => createScope,
|
|
@@ -1289,12 +1291,7 @@ function hasSelectChanged(el) {
|
|
|
1289
1291
|
}
|
|
1290
1292
|
}
|
|
1291
1293
|
function hasFormElementChanged(el) {
|
|
1292
|
-
|
|
1293
|
-
case "INPUT":
|
|
1294
|
-
return hasValueChanged(el) || hasCheckboxChanged(el);
|
|
1295
|
-
case "SELECT":
|
|
1296
|
-
return hasSelectChanged(el);
|
|
1297
|
-
}
|
|
1294
|
+
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
|
1298
1295
|
}
|
|
1299
1296
|
function normalizeStrProp(value2) {
|
|
1300
1297
|
return normalizeAttrValue(value2) || "";
|
|
@@ -1378,14 +1375,14 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1378
1375
|
let skip;
|
|
1379
1376
|
switch (el.tagName) {
|
|
1380
1377
|
case "INPUT":
|
|
1381
|
-
if (nextAttrs
|
|
1378
|
+
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
|
|
1382
1379
|
controllable_input_checked(
|
|
1383
1380
|
scope,
|
|
1384
1381
|
nodeAccessor,
|
|
1385
1382
|
nextAttrs.checked,
|
|
1386
1383
|
nextAttrs.checkedChange
|
|
1387
1384
|
);
|
|
1388
|
-
} else if (
|
|
1385
|
+
} else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
|
|
1389
1386
|
controllable_input_checkedValue(
|
|
1390
1387
|
scope,
|
|
1391
1388
|
nodeAccessor,
|
|
@@ -1393,7 +1390,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1393
1390
|
nextAttrs.checkedValueChange,
|
|
1394
1391
|
nextAttrs.value
|
|
1395
1392
|
);
|
|
1396
|
-
} else if (nextAttrs
|
|
1393
|
+
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1397
1394
|
controllable_input_value(
|
|
1398
1395
|
scope,
|
|
1399
1396
|
nodeAccessor,
|
|
@@ -1406,7 +1403,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1406
1403
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1407
1404
|
break;
|
|
1408
1405
|
case "SELECT":
|
|
1409
|
-
if (
|
|
1406
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1410
1407
|
controllable_select_value(
|
|
1411
1408
|
scope,
|
|
1412
1409
|
nodeAccessor,
|
|
@@ -1416,9 +1413,20 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1416
1413
|
skip = /^value(?:Change)?$/;
|
|
1417
1414
|
}
|
|
1418
1415
|
break;
|
|
1416
|
+
case "TEXTAREA":
|
|
1417
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1418
|
+
controllable_input_value(
|
|
1419
|
+
scope,
|
|
1420
|
+
nodeAccessor,
|
|
1421
|
+
nextAttrs.value,
|
|
1422
|
+
nextAttrs.valueChange
|
|
1423
|
+
);
|
|
1424
|
+
skip = /^value(?:Change)?$/;
|
|
1425
|
+
}
|
|
1426
|
+
break;
|
|
1419
1427
|
case "DETAILS":
|
|
1420
1428
|
case "DIALOG":
|
|
1421
|
-
if (nextAttrs
|
|
1429
|
+
if ("open" in nextAttrs || "openChange" in nextAttrs) {
|
|
1422
1430
|
controllable_detailsOrDialog_open(
|
|
1423
1431
|
scope,
|
|
1424
1432
|
nodeAccessor,
|
|
@@ -1655,6 +1663,11 @@ function dynamicTagAttrs(nodeAccessor, getRenderBody, inputIsArgs) {
|
|
|
1655
1663
|
const renderBody = getRenderBody?.(scope);
|
|
1656
1664
|
if (typeof renderer === "string") {
|
|
1657
1665
|
const nodeAccessor2 = true ? `#${renderer}/0` : 0;
|
|
1666
|
+
if (renderer === "textarea" && renderBody) {
|
|
1667
|
+
throw new Error(
|
|
1668
|
+
"A dynamic tag rendering a `<textarea>` cannot have a `renderBody` and must use the `value` attribute instead."
|
|
1669
|
+
);
|
|
1670
|
+
}
|
|
1658
1671
|
setConditionalRendererOnlyChild(childScope, nodeAccessor2, renderBody);
|
|
1659
1672
|
attrs(childScope, nodeAccessor2, attrsOrOp());
|
|
1660
1673
|
} else if (renderer.___args) {
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -1199,12 +1199,7 @@ function hasSelectChanged(el) {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
function hasFormElementChanged(el) {
|
|
1202
|
-
|
|
1203
|
-
case "INPUT":
|
|
1204
|
-
return hasValueChanged(el) || hasCheckboxChanged(el);
|
|
1205
|
-
case "SELECT":
|
|
1206
|
-
return hasSelectChanged(el);
|
|
1207
|
-
}
|
|
1202
|
+
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
|
1208
1203
|
}
|
|
1209
1204
|
function normalizeStrProp(value2) {
|
|
1210
1205
|
return normalizeAttrValue(value2) || "";
|
|
@@ -1288,14 +1283,14 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1288
1283
|
let skip;
|
|
1289
1284
|
switch (el.tagName) {
|
|
1290
1285
|
case "INPUT":
|
|
1291
|
-
if (nextAttrs
|
|
1286
|
+
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
|
|
1292
1287
|
controllable_input_checked(
|
|
1293
1288
|
scope,
|
|
1294
1289
|
nodeAccessor,
|
|
1295
1290
|
nextAttrs.checked,
|
|
1296
1291
|
nextAttrs.checkedChange
|
|
1297
1292
|
);
|
|
1298
|
-
} else if (
|
|
1293
|
+
} else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
|
|
1299
1294
|
controllable_input_checkedValue(
|
|
1300
1295
|
scope,
|
|
1301
1296
|
nodeAccessor,
|
|
@@ -1303,7 +1298,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1303
1298
|
nextAttrs.checkedValueChange,
|
|
1304
1299
|
nextAttrs.value
|
|
1305
1300
|
);
|
|
1306
|
-
} else if (nextAttrs
|
|
1301
|
+
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1307
1302
|
controllable_input_value(
|
|
1308
1303
|
scope,
|
|
1309
1304
|
nodeAccessor,
|
|
@@ -1316,7 +1311,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1316
1311
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1317
1312
|
break;
|
|
1318
1313
|
case "SELECT":
|
|
1319
|
-
if (
|
|
1314
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1320
1315
|
controllable_select_value(
|
|
1321
1316
|
scope,
|
|
1322
1317
|
nodeAccessor,
|
|
@@ -1326,9 +1321,20 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1326
1321
|
skip = /^value(?:Change)?$/;
|
|
1327
1322
|
}
|
|
1328
1323
|
break;
|
|
1324
|
+
case "TEXTAREA":
|
|
1325
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1326
|
+
controllable_input_value(
|
|
1327
|
+
scope,
|
|
1328
|
+
nodeAccessor,
|
|
1329
|
+
nextAttrs.value,
|
|
1330
|
+
nextAttrs.valueChange
|
|
1331
|
+
);
|
|
1332
|
+
skip = /^value(?:Change)?$/;
|
|
1333
|
+
}
|
|
1334
|
+
break;
|
|
1329
1335
|
case "DETAILS":
|
|
1330
1336
|
case "DIALOG":
|
|
1331
|
-
if (nextAttrs
|
|
1337
|
+
if ("open" in nextAttrs || "openChange" in nextAttrs) {
|
|
1332
1338
|
controllable_detailsOrDialog_open(
|
|
1333
1339
|
scope,
|
|
1334
1340
|
nodeAccessor,
|
|
@@ -1565,6 +1571,11 @@ function dynamicTagAttrs(nodeAccessor, getRenderBody, inputIsArgs) {
|
|
|
1565
1571
|
const renderBody = getRenderBody?.(scope);
|
|
1566
1572
|
if (typeof renderer === "string") {
|
|
1567
1573
|
const nodeAccessor2 = true ? `#${renderer}/0` : 0;
|
|
1574
|
+
if (renderer === "textarea" && renderBody) {
|
|
1575
|
+
throw new Error(
|
|
1576
|
+
"A dynamic tag rendering a `<textarea>` cannot have a `renderBody` and must use the `value` attribute instead."
|
|
1577
|
+
);
|
|
1578
|
+
}
|
|
1568
1579
|
setConditionalRendererOnlyChild(childScope, nodeAccessor2, renderBody);
|
|
1569
1580
|
attrs(childScope, nodeAccessor2, attrsOrOp());
|
|
1570
1581
|
} else if (renderer.___args) {
|
|
@@ -2039,6 +2050,8 @@ export {
|
|
|
2039
2050
|
controllable_input_value_effect,
|
|
2040
2051
|
controllable_select_value,
|
|
2041
2052
|
controllable_select_value_effect,
|
|
2053
|
+
controllable_input_value as controllable_textarea_value,
|
|
2054
|
+
controllable_input_value_effect as controllable_textarea_value_effect,
|
|
2042
2055
|
createRenderer,
|
|
2043
2056
|
createRendererWithOwner,
|
|
2044
2057
|
createScope,
|
package/dist/debug/html.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(html_exports, {
|
|
|
31
31
|
controllable_input_checkedValue: () => controllable_input_checkedValue,
|
|
32
32
|
controllable_input_value: () => controllable_input_value,
|
|
33
33
|
controllable_select_value: () => controllable_select_value,
|
|
34
|
+
controllable_textarea_value: () => controllable_textarea_value,
|
|
34
35
|
createRenderer: () => createRenderer,
|
|
35
36
|
createTemplate: () => createTemplate,
|
|
36
37
|
dynamicTagArgs: () => dynamicTagArgs,
|
|
@@ -167,6 +168,30 @@ function normalizeDynamicRenderer(value) {
|
|
|
167
168
|
if (value) return value.renderBody || value.default || value;
|
|
168
169
|
}
|
|
169
170
|
|
|
171
|
+
// src/html/content.ts
|
|
172
|
+
function toString(val) {
|
|
173
|
+
return val ? val + "" : val === 0 ? "0" : "";
|
|
174
|
+
}
|
|
175
|
+
var unsafeXMLReg = /[<&]/g;
|
|
176
|
+
var replaceUnsafeXML = (c) => c === "&" ? "&" : "<";
|
|
177
|
+
var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
178
|
+
function escapeXML(val) {
|
|
179
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
|
180
|
+
}
|
|
181
|
+
function escapeTextAreaValue(val) {
|
|
182
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
|
183
|
+
}
|
|
184
|
+
var unsafeScriptReg = /<\/script/g;
|
|
185
|
+
var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
186
|
+
function escapeScript(val) {
|
|
187
|
+
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
188
|
+
}
|
|
189
|
+
var unsafeStyleReg = /<\/style/g;
|
|
190
|
+
var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
191
|
+
function escapeStyle(val) {
|
|
192
|
+
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
193
|
+
}
|
|
194
|
+
|
|
170
195
|
// src/html/inlined-runtimes.ts
|
|
171
196
|
var WALKER_RUNTIME_CODE = true ? `((runtimeId) =>
|
|
172
197
|
(self[runtimeId] =
|
|
@@ -2011,6 +2036,14 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, re
|
|
|
2011
2036
|
withContext(kSelectedValue, value, renderBody);
|
|
2012
2037
|
}
|
|
2013
2038
|
}
|
|
2039
|
+
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2040
|
+
if (valueChange) {
|
|
2041
|
+
const scope = ensureScopeWithId(scopeId);
|
|
2042
|
+
scope[nodeAccessor + ";" /* ControlledHandler */] = valueChange;
|
|
2043
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 2 /* InputValue */;
|
|
2044
|
+
}
|
|
2045
|
+
return escapeTextAreaValue(value);
|
|
2046
|
+
}
|
|
2014
2047
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2015
2048
|
if (valueChange) {
|
|
2016
2049
|
const scope = ensureScopeWithId(scopeId);
|
|
@@ -2087,6 +2120,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2087
2120
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
2088
2121
|
break;
|
|
2089
2122
|
case "select":
|
|
2123
|
+
case "textarea":
|
|
2090
2124
|
if (data.value || data.valueChange) {
|
|
2091
2125
|
skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
2092
2126
|
}
|
|
@@ -2200,7 +2234,21 @@ function dynamicTagInput(scope, tag, input, renderBody, tagVar) {
|
|
|
2200
2234
|
`<${tag}${attrs(input, true ? `#${tag}/0` : 0, scopeId, tag)}>`
|
|
2201
2235
|
);
|
|
2202
2236
|
if (!voidElementsReg.test(tag)) {
|
|
2203
|
-
if (
|
|
2237
|
+
if (tag === "textarea") {
|
|
2238
|
+
if (renderBody) {
|
|
2239
|
+
throw new Error(
|
|
2240
|
+
"A dynamic tag rendering a `<textarea>` cannot have a `renderBody` and must use the `value` attribute instead."
|
|
2241
|
+
);
|
|
2242
|
+
}
|
|
2243
|
+
write(
|
|
2244
|
+
controllable_textarea_value(
|
|
2245
|
+
scopeId,
|
|
2246
|
+
true ? `#${tag}/0` : 0,
|
|
2247
|
+
input.value,
|
|
2248
|
+
input.valueChange
|
|
2249
|
+
)
|
|
2250
|
+
);
|
|
2251
|
+
} else if (renderBody) {
|
|
2204
2252
|
if (tag === "select" && ("value" in input || "valueChange" in input)) {
|
|
2205
2253
|
controllable_select_value(
|
|
2206
2254
|
scopeId,
|
|
@@ -2339,27 +2387,6 @@ var compat = {
|
|
|
2339
2387
|
}
|
|
2340
2388
|
};
|
|
2341
2389
|
|
|
2342
|
-
// src/html/content.ts
|
|
2343
|
-
function toString(val) {
|
|
2344
|
-
return val ? val + "" : val === 0 ? "0" : "";
|
|
2345
|
-
}
|
|
2346
|
-
var unsafeXMLReg = /[<&]/g;
|
|
2347
|
-
var replaceUnsafeXML = (c) => c === "&" ? "&" : "<";
|
|
2348
|
-
var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
2349
|
-
function escapeXML(val) {
|
|
2350
|
-
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
|
2351
|
-
}
|
|
2352
|
-
var unsafeScriptReg = /<\/script/g;
|
|
2353
|
-
var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
2354
|
-
function escapeScript(val) {
|
|
2355
|
-
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
2356
|
-
}
|
|
2357
|
-
var unsafeStyleReg = /<\/style/g;
|
|
2358
|
-
var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
2359
|
-
function escapeStyle(val) {
|
|
2360
|
-
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
2390
|
// src/html/template.ts
|
|
2364
2391
|
var createTemplate = (renderer, templateId) => {
|
|
2365
2392
|
renderer.render = render;
|
|
@@ -2566,6 +2593,7 @@ var ServerRenderResult = class {
|
|
|
2566
2593
|
controllable_input_checkedValue,
|
|
2567
2594
|
controllable_input_value,
|
|
2568
2595
|
controllable_select_value,
|
|
2596
|
+
controllable_textarea_value,
|
|
2569
2597
|
createRenderer,
|
|
2570
2598
|
createTemplate,
|
|
2571
2599
|
dynamicTagArgs,
|
package/dist/debug/html.mjs
CHANGED
|
@@ -96,6 +96,30 @@ function normalizeDynamicRenderer(value) {
|
|
|
96
96
|
if (value) return value.renderBody || value.default || value;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// src/html/content.ts
|
|
100
|
+
function toString(val) {
|
|
101
|
+
return val ? val + "" : val === 0 ? "0" : "";
|
|
102
|
+
}
|
|
103
|
+
var unsafeXMLReg = /[<&]/g;
|
|
104
|
+
var replaceUnsafeXML = (c) => c === "&" ? "&" : "<";
|
|
105
|
+
var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
106
|
+
function escapeXML(val) {
|
|
107
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
|
108
|
+
}
|
|
109
|
+
function escapeTextAreaValue(val) {
|
|
110
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
|
111
|
+
}
|
|
112
|
+
var unsafeScriptReg = /<\/script/g;
|
|
113
|
+
var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
114
|
+
function escapeScript(val) {
|
|
115
|
+
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
116
|
+
}
|
|
117
|
+
var unsafeStyleReg = /<\/style/g;
|
|
118
|
+
var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
119
|
+
function escapeStyle(val) {
|
|
120
|
+
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
121
|
+
}
|
|
122
|
+
|
|
99
123
|
// src/html/inlined-runtimes.ts
|
|
100
124
|
var WALKER_RUNTIME_CODE = true ? `((runtimeId) =>
|
|
101
125
|
(self[runtimeId] =
|
|
@@ -1940,6 +1964,14 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, re
|
|
|
1940
1964
|
withContext(kSelectedValue, value, renderBody);
|
|
1941
1965
|
}
|
|
1942
1966
|
}
|
|
1967
|
+
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1968
|
+
if (valueChange) {
|
|
1969
|
+
const scope = ensureScopeWithId(scopeId);
|
|
1970
|
+
scope[nodeAccessor + ";" /* ControlledHandler */] = valueChange;
|
|
1971
|
+
scope[nodeAccessor + "=" /* ControlledType */] = 2 /* InputValue */;
|
|
1972
|
+
}
|
|
1973
|
+
return escapeTextAreaValue(value);
|
|
1974
|
+
}
|
|
1943
1975
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1944
1976
|
if (valueChange) {
|
|
1945
1977
|
const scope = ensureScopeWithId(scopeId);
|
|
@@ -2016,6 +2048,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2016
2048
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
2017
2049
|
break;
|
|
2018
2050
|
case "select":
|
|
2051
|
+
case "textarea":
|
|
2019
2052
|
if (data.value || data.valueChange) {
|
|
2020
2053
|
skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
2021
2054
|
}
|
|
@@ -2129,7 +2162,21 @@ function dynamicTagInput(scope, tag, input, renderBody, tagVar) {
|
|
|
2129
2162
|
`<${tag}${attrs(input, true ? `#${tag}/0` : 0, scopeId, tag)}>`
|
|
2130
2163
|
);
|
|
2131
2164
|
if (!voidElementsReg.test(tag)) {
|
|
2132
|
-
if (
|
|
2165
|
+
if (tag === "textarea") {
|
|
2166
|
+
if (renderBody) {
|
|
2167
|
+
throw new Error(
|
|
2168
|
+
"A dynamic tag rendering a `<textarea>` cannot have a `renderBody` and must use the `value` attribute instead."
|
|
2169
|
+
);
|
|
2170
|
+
}
|
|
2171
|
+
write(
|
|
2172
|
+
controllable_textarea_value(
|
|
2173
|
+
scopeId,
|
|
2174
|
+
true ? `#${tag}/0` : 0,
|
|
2175
|
+
input.value,
|
|
2176
|
+
input.valueChange
|
|
2177
|
+
)
|
|
2178
|
+
);
|
|
2179
|
+
} else if (renderBody) {
|
|
2133
2180
|
if (tag === "select" && ("value" in input || "valueChange" in input)) {
|
|
2134
2181
|
controllable_select_value(
|
|
2135
2182
|
scopeId,
|
|
@@ -2268,27 +2315,6 @@ var compat = {
|
|
|
2268
2315
|
}
|
|
2269
2316
|
};
|
|
2270
2317
|
|
|
2271
|
-
// src/html/content.ts
|
|
2272
|
-
function toString(val) {
|
|
2273
|
-
return val ? val + "" : val === 0 ? "0" : "";
|
|
2274
|
-
}
|
|
2275
|
-
var unsafeXMLReg = /[<&]/g;
|
|
2276
|
-
var replaceUnsafeXML = (c) => c === "&" ? "&" : "<";
|
|
2277
|
-
var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
2278
|
-
function escapeXML(val) {
|
|
2279
|
-
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
|
2280
|
-
}
|
|
2281
|
-
var unsafeScriptReg = /<\/script/g;
|
|
2282
|
-
var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
2283
|
-
function escapeScript(val) {
|
|
2284
|
-
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
2285
|
-
}
|
|
2286
|
-
var unsafeStyleReg = /<\/style/g;
|
|
2287
|
-
var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
2288
|
-
function escapeStyle(val) {
|
|
2289
|
-
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
2318
|
// src/html/template.ts
|
|
2293
2319
|
var createTemplate = (renderer, templateId) => {
|
|
2294
2320
|
renderer.render = render;
|
|
@@ -2494,6 +2520,7 @@ export {
|
|
|
2494
2520
|
controllable_input_checkedValue,
|
|
2495
2521
|
controllable_input_value,
|
|
2496
2522
|
controllable_select_value,
|
|
2523
|
+
controllable_textarea_value,
|
|
2497
2524
|
createRenderer,
|
|
2498
2525
|
createTemplate,
|
|
2499
2526
|
dynamicTagArgs,
|
|
@@ -5,6 +5,7 @@ export declare function controllable_input_checkedValue(scope: Scope, nodeAccess
|
|
|
5
5
|
export declare function controllable_input_checkedValue_effect(scope: Scope, nodeAccessor: Accessor): void;
|
|
6
6
|
export declare function controllable_input_value(scope: Scope, nodeAccessor: Accessor, value: unknown, valueChange: unknown): void;
|
|
7
7
|
export declare function controllable_input_value_effect(scope: Scope, nodeAccessor: Accessor): void;
|
|
8
|
+
export { controllable_input_value as controllable_textarea_value, controllable_input_value_effect as controllable_textarea_value_effect, };
|
|
8
9
|
export declare function controllable_select_value(scope: Scope, nodeAccessor: Accessor, value: unknown, valueChange: unknown): void;
|
|
9
10
|
export declare function controllable_select_value_effect(scope: Scope, nodeAccessor: Accessor): void;
|
|
10
11
|
export declare function controllable_detailsOrDialog_open(scope: Scope, nodeAccessor: Accessor, open: unknown, openChange: unknown): void;
|
package/dist/dom.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { Scope } from "./common/types";
|
|
|
4
4
|
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
|
-
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, } from "./dom/controllable";
|
|
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
8
|
export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, partialAttrs, props, styleAttr, } from "./dom/dom";
|
|
9
9
|
export { on } from "./dom/event";
|
|
10
10
|
export { prepare, queueControllableSource, queueEffect, queueSource, run, runEffects, } from "./dom/queue";
|
package/dist/dom.js
CHANGED
|
@@ -39,6 +39,8 @@ __export(dom_exports, {
|
|
|
39
39
|
controllable_input_value_effect: () => controllable_input_value_effect,
|
|
40
40
|
controllable_select_value: () => controllable_select_value,
|
|
41
41
|
controllable_select_value_effect: () => controllable_select_value_effect,
|
|
42
|
+
controllable_textarea_value: () => controllable_input_value,
|
|
43
|
+
controllable_textarea_value_effect: () => controllable_input_value_effect,
|
|
42
44
|
createRenderer: () => createRenderer,
|
|
43
45
|
createRendererWithOwner: () => createRendererWithOwner,
|
|
44
46
|
createScope: () => createScope,
|
|
@@ -803,12 +805,7 @@ function hasSelectChanged(el) {
|
|
|
803
805
|
return !0;
|
|
804
806
|
}
|
|
805
807
|
function hasFormElementChanged(el) {
|
|
806
|
-
|
|
807
|
-
case "INPUT":
|
|
808
|
-
return hasValueChanged(el) || hasCheckboxChanged(el);
|
|
809
|
-
case "SELECT":
|
|
810
|
-
return hasSelectChanged(el);
|
|
811
|
-
}
|
|
808
|
+
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
|
812
809
|
}
|
|
813
810
|
function normalizeStrProp(value2) {
|
|
814
811
|
return normalizeAttrValue(value2) || "";
|
|
@@ -873,14 +870,14 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
873
870
|
let el = scope[nodeAccessor], events, skip;
|
|
874
871
|
switch (el.tagName) {
|
|
875
872
|
case "INPUT":
|
|
876
|
-
if (nextAttrs
|
|
873
|
+
if ("checked" in nextAttrs || "checkedChange" in nextAttrs)
|
|
877
874
|
controllable_input_checked(
|
|
878
875
|
scope,
|
|
879
876
|
nodeAccessor,
|
|
880
877
|
nextAttrs.checked,
|
|
881
878
|
nextAttrs.checkedChange
|
|
882
879
|
);
|
|
883
|
-
else if (
|
|
880
|
+
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs)
|
|
884
881
|
controllable_input_checkedValue(
|
|
885
882
|
scope,
|
|
886
883
|
nodeAccessor,
|
|
@@ -888,7 +885,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
888
885
|
nextAttrs.checkedValueChange,
|
|
889
886
|
nextAttrs.value
|
|
890
887
|
);
|
|
891
|
-
else if (nextAttrs
|
|
888
|
+
else if ("value" in nextAttrs || "valueChange" in nextAttrs)
|
|
892
889
|
controllable_input_value(
|
|
893
890
|
scope,
|
|
894
891
|
nodeAccessor,
|
|
@@ -900,7 +897,15 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
900
897
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
901
898
|
break;
|
|
902
899
|
case "SELECT":
|
|
903
|
-
(
|
|
900
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (controllable_select_value(
|
|
901
|
+
scope,
|
|
902
|
+
nodeAccessor,
|
|
903
|
+
nextAttrs.value,
|
|
904
|
+
nextAttrs.valueChange
|
|
905
|
+
), skip = /^value(?:Change)?$/);
|
|
906
|
+
break;
|
|
907
|
+
case "TEXTAREA":
|
|
908
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (controllable_input_value(
|
|
904
909
|
scope,
|
|
905
910
|
nodeAccessor,
|
|
906
911
|
nextAttrs.value,
|
|
@@ -909,7 +914,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
909
914
|
break;
|
|
910
915
|
case "DETAILS":
|
|
911
916
|
case "DIALOG":
|
|
912
|
-
nextAttrs
|
|
917
|
+
("open" in nextAttrs || "openChange" in nextAttrs) && (controllable_detailsOrDialog_open(
|
|
913
918
|
scope,
|
|
914
919
|
nodeAccessor,
|
|
915
920
|
nextAttrs.open,
|
package/dist/dom.mjs
CHANGED
|
@@ -716,12 +716,7 @@ function hasSelectChanged(el) {
|
|
|
716
716
|
return !0;
|
|
717
717
|
}
|
|
718
718
|
function hasFormElementChanged(el) {
|
|
719
|
-
|
|
720
|
-
case "INPUT":
|
|
721
|
-
return hasValueChanged(el) || hasCheckboxChanged(el);
|
|
722
|
-
case "SELECT":
|
|
723
|
-
return hasSelectChanged(el);
|
|
724
|
-
}
|
|
719
|
+
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
|
725
720
|
}
|
|
726
721
|
function normalizeStrProp(value2) {
|
|
727
722
|
return normalizeAttrValue(value2) || "";
|
|
@@ -786,14 +781,14 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
786
781
|
let el = scope[nodeAccessor], events, skip;
|
|
787
782
|
switch (el.tagName) {
|
|
788
783
|
case "INPUT":
|
|
789
|
-
if (nextAttrs
|
|
784
|
+
if ("checked" in nextAttrs || "checkedChange" in nextAttrs)
|
|
790
785
|
controllable_input_checked(
|
|
791
786
|
scope,
|
|
792
787
|
nodeAccessor,
|
|
793
788
|
nextAttrs.checked,
|
|
794
789
|
nextAttrs.checkedChange
|
|
795
790
|
);
|
|
796
|
-
else if (
|
|
791
|
+
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs)
|
|
797
792
|
controllable_input_checkedValue(
|
|
798
793
|
scope,
|
|
799
794
|
nodeAccessor,
|
|
@@ -801,7 +796,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
801
796
|
nextAttrs.checkedValueChange,
|
|
802
797
|
nextAttrs.value
|
|
803
798
|
);
|
|
804
|
-
else if (nextAttrs
|
|
799
|
+
else if ("value" in nextAttrs || "valueChange" in nextAttrs)
|
|
805
800
|
controllable_input_value(
|
|
806
801
|
scope,
|
|
807
802
|
nodeAccessor,
|
|
@@ -813,7 +808,15 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
813
808
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
814
809
|
break;
|
|
815
810
|
case "SELECT":
|
|
816
|
-
(
|
|
811
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (controllable_select_value(
|
|
812
|
+
scope,
|
|
813
|
+
nodeAccessor,
|
|
814
|
+
nextAttrs.value,
|
|
815
|
+
nextAttrs.valueChange
|
|
816
|
+
), skip = /^value(?:Change)?$/);
|
|
817
|
+
break;
|
|
818
|
+
case "TEXTAREA":
|
|
819
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (controllable_input_value(
|
|
817
820
|
scope,
|
|
818
821
|
nodeAccessor,
|
|
819
822
|
nextAttrs.value,
|
|
@@ -822,7 +825,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
822
825
|
break;
|
|
823
826
|
case "DETAILS":
|
|
824
827
|
case "DIALOG":
|
|
825
|
-
nextAttrs
|
|
828
|
+
("open" in nextAttrs || "openChange" in nextAttrs) && (controllable_detailsOrDialog_open(
|
|
826
829
|
scope,
|
|
827
830
|
nodeAccessor,
|
|
828
831
|
nextAttrs.open,
|
|
@@ -1312,6 +1315,8 @@ export {
|
|
|
1312
1315
|
controllable_input_value_effect,
|
|
1313
1316
|
controllable_select_value,
|
|
1314
1317
|
controllable_select_value_effect,
|
|
1318
|
+
controllable_input_value as controllable_textarea_value,
|
|
1319
|
+
controllable_input_value_effect as controllable_textarea_value_effect,
|
|
1315
1320
|
createRenderer,
|
|
1316
1321
|
createRendererWithOwner,
|
|
1317
1322
|
createScope,
|
package/dist/html/attrs.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare function classAttr(val: unknown): string;
|
|
|
3
3
|
export declare function styleAttr(val: unknown): string;
|
|
4
4
|
export declare function optionValueAttr(value: unknown): string;
|
|
5
5
|
export declare function controllable_select_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown, renderBody?: () => void): void;
|
|
6
|
+
export declare function controllable_textarea_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown): string;
|
|
6
7
|
export declare function controllable_input_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown): string;
|
|
7
8
|
export declare function controllable_input_checked(scopeId: number, nodeAccessor: Accessor, checked: unknown, checkedChange: unknown): string;
|
|
8
9
|
export declare function controllable_input_checkedValue(scopeId: number, nodeAccessor: Accessor, checkedValue: unknown, checkedValueChange: unknown, value: unknown): string;
|
package/dist/html/content.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function toString(val: unknown): string;
|
|
2
2
|
export declare function escapeXML(val: unknown): string;
|
|
3
|
+
export declare function escapeTextAreaValue(val: unknown): string;
|
|
3
4
|
export declare function escapeScript(val: unknown): string;
|
|
4
5
|
export declare function escapeStyle(val: unknown): string;
|
package/dist/html.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
2
|
export { forIn, forOf, forTo } from "./common/for";
|
|
3
3
|
export { normalizeDynamicRenderer } from "./common/helpers";
|
|
4
|
-
export { attr, attrs, classAttr, controllable_detailsOrDialog_open, controllable_input_checked, controllable_input_checkedValue, controllable_input_value, controllable_select_value, optionValueAttr, partialAttrs, styleAttr, } from "./html/attrs";
|
|
4
|
+
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
5
|
export { compat } from "./html/compat";
|
|
6
6
|
export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
|
|
7
7
|
export { createRenderer, dynamicTagArgs, dynamicTagInput, } from "./html/dynamic-tag";
|
package/dist/html.js
CHANGED
|
@@ -28,6 +28,7 @@ __export(html_exports, {
|
|
|
28
28
|
controllable_input_checkedValue: () => controllable_input_checkedValue,
|
|
29
29
|
controllable_input_value: () => controllable_input_value,
|
|
30
30
|
controllable_select_value: () => controllable_select_value,
|
|
31
|
+
controllable_textarea_value: () => controllable_textarea_value,
|
|
31
32
|
createRenderer: () => createRenderer,
|
|
32
33
|
createTemplate: () => createTemplate,
|
|
33
34
|
dynamicTagArgs: () => dynamicTagArgs,
|
|
@@ -139,6 +140,26 @@ function normalizeDynamicRenderer(value) {
|
|
|
139
140
|
if (value) return value.renderBody || value.default || value;
|
|
140
141
|
}
|
|
141
142
|
|
|
143
|
+
// src/html/content.ts
|
|
144
|
+
function toString(val) {
|
|
145
|
+
return val ? val + "" : val === 0 ? "0" : "";
|
|
146
|
+
}
|
|
147
|
+
var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
148
|
+
function escapeXML(val) {
|
|
149
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
|
150
|
+
}
|
|
151
|
+
function escapeTextAreaValue(val) {
|
|
152
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
|
153
|
+
}
|
|
154
|
+
var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
155
|
+
function escapeScript(val) {
|
|
156
|
+
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
157
|
+
}
|
|
158
|
+
var unsafeStyleReg = /<\/style/g, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
159
|
+
function escapeStyle(val) {
|
|
160
|
+
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
161
|
+
}
|
|
162
|
+
|
|
142
163
|
// src/html/inlined-runtimes.ts
|
|
143
164
|
var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},f=[],s=document,a=s.createTreeWalker(s,129),r=self[e][l]={i:l=e+l,d:s,l:d,v:f,x(){},w(e){for(;e=a.nextNode();)this.x(r=(r=e.data)&&!r.indexOf(l)&&(d[t=r.slice(x+1)]=e,r[x]),t,e),r>"#"&&f.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,t,r,l,d={},n=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(o,a,c,p,b)=>{"#"==o?(d[a]=t).i++:c==r&&i(),"T"==c.tagName&&(a=c.getAttribute(e.i))&&((p=e.l["^"+a])?t=d[a]={i:0,c(i=e.l[a]||l||c){for(;i.parentNode!==p.parentNode;)i=i.parentNode;for(;i!=r;(r=p.nextSibling).remove());n(p,c)}}:(i=()=>{l=c.previousSibling,n(e.l[a],c),--p.i||p.c()},p=t=d[a],r=c.nextElementSibling||i()),b=t.c,(o=e.j[a])&&(t.c=()=>b()+o(e)),c.attributes.c&&t.c())}})';
|
|
144
165
|
|
|
@@ -1309,6 +1330,13 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, re
|
|
|
1309
1330
|
}
|
|
1310
1331
|
renderBody && withContext(kSelectedValue, value, renderBody);
|
|
1311
1332
|
}
|
|
1333
|
+
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1334
|
+
if (valueChange) {
|
|
1335
|
+
let scope = ensureScopeWithId(scopeId);
|
|
1336
|
+
scope[nodeAccessor + ";" /* ControlledHandler */] = valueChange, scope[nodeAccessor + "=" /* ControlledType */] = 2 /* InputValue */;
|
|
1337
|
+
}
|
|
1338
|
+
return escapeTextAreaValue(value);
|
|
1339
|
+
}
|
|
1312
1340
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1313
1341
|
if (valueChange) {
|
|
1314
1342
|
let scope = ensureScopeWithId(scopeId);
|
|
@@ -1372,6 +1400,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1372
1400
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1373
1401
|
break;
|
|
1374
1402
|
case "select":
|
|
1403
|
+
case "textarea":
|
|
1375
1404
|
(data.value || data.valueChange) && (skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1376
1405
|
break;
|
|
1377
1406
|
case "option":
|
|
@@ -1455,7 +1484,14 @@ function dynamicTagInput(scope, tag, input, renderBody, tagVar) {
|
|
|
1455
1484
|
let scopeId = getScopeId(scope);
|
|
1456
1485
|
return write(`${markResumeScopeStart(scopeId)}`), writeScope(scopeId, scope), tag ? typeof tag == "string" ? (nextScopeId(), write(
|
|
1457
1486
|
`<${tag}${attrs(input, 0, scopeId, tag)}>`
|
|
1458
|
-
), voidElementsReg.test(tag) || (
|
|
1487
|
+
), voidElementsReg.test(tag) || (tag === "textarea" ? write(
|
|
1488
|
+
controllable_textarea_value(
|
|
1489
|
+
scopeId,
|
|
1490
|
+
0,
|
|
1491
|
+
input.value,
|
|
1492
|
+
input.valueChange
|
|
1493
|
+
)
|
|
1494
|
+
) : renderBody && (tag === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
|
|
1459
1495
|
scopeId,
|
|
1460
1496
|
0,
|
|
1461
1497
|
input.value,
|
|
@@ -1537,23 +1573,6 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1537
1573
|
}
|
|
1538
1574
|
};
|
|
1539
1575
|
|
|
1540
|
-
// src/html/content.ts
|
|
1541
|
-
function toString(val) {
|
|
1542
|
-
return val ? val + "" : val === 0 ? "0" : "";
|
|
1543
|
-
}
|
|
1544
|
-
var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
1545
|
-
function escapeXML(val) {
|
|
1546
|
-
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
|
1547
|
-
}
|
|
1548
|
-
var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
1549
|
-
function escapeScript(val) {
|
|
1550
|
-
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
1551
|
-
}
|
|
1552
|
-
var unsafeStyleReg = /<\/style/g, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
1553
|
-
function escapeStyle(val) {
|
|
1554
|
-
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
1576
|
// src/html/template.ts
|
|
1558
1577
|
var createTemplate = (renderer, templateId) => (renderer.render = render, renderer._ = renderer, register2(renderer, templateId));
|
|
1559
1578
|
function render(input = {}) {
|
|
@@ -1697,6 +1716,7 @@ var ServerRenderResult = class {
|
|
|
1697
1716
|
controllable_input_checkedValue,
|
|
1698
1717
|
controllable_input_value,
|
|
1699
1718
|
controllable_select_value,
|
|
1719
|
+
controllable_textarea_value,
|
|
1700
1720
|
createRenderer,
|
|
1701
1721
|
createTemplate,
|
|
1702
1722
|
dynamicTagArgs,
|
package/dist/html.mjs
CHANGED
|
@@ -71,6 +71,26 @@ function normalizeDynamicRenderer(value) {
|
|
|
71
71
|
if (value) return value.renderBody || value.default || value;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
// src/html/content.ts
|
|
75
|
+
function toString(val) {
|
|
76
|
+
return val ? val + "" : val === 0 ? "0" : "";
|
|
77
|
+
}
|
|
78
|
+
var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
79
|
+
function escapeXML(val) {
|
|
80
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
|
81
|
+
}
|
|
82
|
+
function escapeTextAreaValue(val) {
|
|
83
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
|
84
|
+
}
|
|
85
|
+
var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
86
|
+
function escapeScript(val) {
|
|
87
|
+
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
88
|
+
}
|
|
89
|
+
var unsafeStyleReg = /<\/style/g, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
90
|
+
function escapeStyle(val) {
|
|
91
|
+
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
92
|
+
}
|
|
93
|
+
|
|
74
94
|
// src/html/inlined-runtimes.ts
|
|
75
95
|
var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},f=[],s=document,a=s.createTreeWalker(s,129),r=self[e][l]={i:l=e+l,d:s,l:d,v:f,x(){},w(e){for(;e=a.nextNode();)this.x(r=(r=e.data)&&!r.indexOf(l)&&(d[t=r.slice(x+1)]=e,r[x]),t,e),r>"#"&&f.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,t,r,l,d={},n=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(o,a,c,p,b)=>{"#"==o?(d[a]=t).i++:c==r&&i(),"T"==c.tagName&&(a=c.getAttribute(e.i))&&((p=e.l["^"+a])?t=d[a]={i:0,c(i=e.l[a]||l||c){for(;i.parentNode!==p.parentNode;)i=i.parentNode;for(;i!=r;(r=p.nextSibling).remove());n(p,c)}}:(i=()=>{l=c.previousSibling,n(e.l[a],c),--p.i||p.c()},p=t=d[a],r=c.nextElementSibling||i()),b=t.c,(o=e.j[a])&&(t.c=()=>b()+o(e)),c.attributes.c&&t.c())}})';
|
|
76
96
|
|
|
@@ -1241,6 +1261,13 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, re
|
|
|
1241
1261
|
}
|
|
1242
1262
|
renderBody && withContext(kSelectedValue, value, renderBody);
|
|
1243
1263
|
}
|
|
1264
|
+
function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1265
|
+
if (valueChange) {
|
|
1266
|
+
let scope = ensureScopeWithId(scopeId);
|
|
1267
|
+
scope[nodeAccessor + ";" /* ControlledHandler */] = valueChange, scope[nodeAccessor + "=" /* ControlledType */] = 2 /* InputValue */;
|
|
1268
|
+
}
|
|
1269
|
+
return escapeTextAreaValue(value);
|
|
1270
|
+
}
|
|
1244
1271
|
function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1245
1272
|
if (valueChange) {
|
|
1246
1273
|
let scope = ensureScopeWithId(scopeId);
|
|
@@ -1304,6 +1331,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1304
1331
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1305
1332
|
break;
|
|
1306
1333
|
case "select":
|
|
1334
|
+
case "textarea":
|
|
1307
1335
|
(data.value || data.valueChange) && (skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1308
1336
|
break;
|
|
1309
1337
|
case "option":
|
|
@@ -1387,7 +1415,14 @@ function dynamicTagInput(scope, tag, input, renderBody, tagVar) {
|
|
|
1387
1415
|
let scopeId = getScopeId(scope);
|
|
1388
1416
|
return write(`${markResumeScopeStart(scopeId)}`), writeScope(scopeId, scope), tag ? typeof tag == "string" ? (nextScopeId(), write(
|
|
1389
1417
|
`<${tag}${attrs(input, 0, scopeId, tag)}>`
|
|
1390
|
-
), voidElementsReg.test(tag) || (
|
|
1418
|
+
), voidElementsReg.test(tag) || (tag === "textarea" ? write(
|
|
1419
|
+
controllable_textarea_value(
|
|
1420
|
+
scopeId,
|
|
1421
|
+
0,
|
|
1422
|
+
input.value,
|
|
1423
|
+
input.valueChange
|
|
1424
|
+
)
|
|
1425
|
+
) : renderBody && (tag === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
|
|
1391
1426
|
scopeId,
|
|
1392
1427
|
0,
|
|
1393
1428
|
input.value,
|
|
@@ -1469,23 +1504,6 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1469
1504
|
}
|
|
1470
1505
|
};
|
|
1471
1506
|
|
|
1472
|
-
// src/html/content.ts
|
|
1473
|
-
function toString(val) {
|
|
1474
|
-
return val ? val + "" : val === 0 ? "0" : "";
|
|
1475
|
-
}
|
|
1476
|
-
var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
1477
|
-
function escapeXML(val) {
|
|
1478
|
-
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
|
1479
|
-
}
|
|
1480
|
-
var unsafeScriptReg = /<\/script/g, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
1481
|
-
function escapeScript(val) {
|
|
1482
|
-
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
1483
|
-
}
|
|
1484
|
-
var unsafeStyleReg = /<\/style/g, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
1485
|
-
function escapeStyle(val) {
|
|
1486
|
-
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
1507
|
// src/html/template.ts
|
|
1490
1508
|
var createTemplate = (renderer, templateId) => (renderer.render = render, renderer._ = renderer, register2(renderer, templateId));
|
|
1491
1509
|
function render(input = {}) {
|
|
@@ -1628,6 +1646,7 @@ export {
|
|
|
1628
1646
|
controllable_input_checkedValue,
|
|
1629
1647
|
controllable_input_value,
|
|
1630
1648
|
controllable_select_value,
|
|
1649
|
+
controllable_textarea_value,
|
|
1631
1650
|
createRenderer,
|
|
1632
1651
|
createTemplate,
|
|
1633
1652
|
dynamicTagArgs,
|