marko 6.3.23 → 6.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/constants/accessor-prefix.d.ts +1 -0
- package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
- package/dist/common/constants/walk-range-size.d.ts +1 -1
- package/dist/debug/dom.js +149 -127
- package/dist/debug/dom.mjs +141 -128
- package/dist/debug/html.js +1 -1
- package/dist/debug/html.mjs +1 -1
- package/dist/dom/controllable.d.ts +22 -1
- package/dist/dom/dom.d.ts +5 -4
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +100 -88
- package/dist/dom.mjs +99 -87
- package/dist/html.js +2 -2
- package/dist/html.mjs +2 -2
- package/dist/translator/index.js +72 -11
- package/dist/translator/util/walks.d.ts +3 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +9 -0
- package/package.json +3 -3
|
@@ -2,6 +2,7 @@ export declare const BranchScopes = "A";
|
|
|
2
2
|
export declare const ClosureScopes = "B";
|
|
3
3
|
export declare const ClosureSignalIndex = "C";
|
|
4
4
|
export declare const ConditionalRenderer = "D";
|
|
5
|
+
export declare const ControlledObserver = "N";
|
|
5
6
|
export declare const ControlledHandler = "E";
|
|
6
7
|
export declare const ControlledType = "F";
|
|
7
8
|
export declare const ControlledValue = "G";
|
|
@@ -2,6 +2,7 @@ export declare const BranchScopes = "BranchScopes:";
|
|
|
2
2
|
export declare const ClosureScopes = "ClosureScopes:";
|
|
3
3
|
export declare const ClosureSignalIndex = "ClosureSignalIndex:";
|
|
4
4
|
export declare const ConditionalRenderer = "ConditionalRenderer:";
|
|
5
|
+
export declare const ControlledObserver = "ControlledObserver:";
|
|
5
6
|
export declare const ControlledHandler = "ControlledHandler:";
|
|
6
7
|
export declare const ControlledType = "ControlledType:";
|
|
7
8
|
export declare const ControlledValue = "ControlledValue:";
|
package/dist/debug/dom.js
CHANGED
|
@@ -26,6 +26,7 @@ const BranchScopes$1 = "BranchScopes:";
|
|
|
26
26
|
const ClosureScopes = "ClosureScopes:";
|
|
27
27
|
const ClosureSignalIndex = "ClosureSignalIndex:";
|
|
28
28
|
const ConditionalRenderer = "ConditionalRenderer:";
|
|
29
|
+
const ControlledObserver = "ControlledObserver:";
|
|
29
30
|
const ControlledHandler = "ControlledHandler:";
|
|
30
31
|
const ControlledType = "ControlledType:";
|
|
31
32
|
const ControlledValue = "ControlledValue:";
|
|
@@ -687,7 +688,7 @@ const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
|
687
688
|
currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[getDebugKey(currentScopeIndex++, "#childScope")] = createScope(scope[Global], scope[ClosestBranch]));
|
|
688
689
|
if (value === 48) scope[getDebugKey(currentScopeIndex++, "#scopeOffset")] = skipScope();
|
|
689
690
|
} else if (value < 92) {
|
|
690
|
-
value =
|
|
691
|
+
value = 25 * currentMultiplier + value - 67;
|
|
691
692
|
while (value--) walker.nextNode();
|
|
692
693
|
} else if (value < 107) {
|
|
693
694
|
value = 10 * currentMultiplier + value - 97;
|
|
@@ -1011,6 +1012,36 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
|
1011
1012
|
if (restoreValue !== normalizedChecked) el.checked = restoreValue;
|
|
1012
1013
|
}
|
|
1013
1014
|
}
|
|
1015
|
+
/** Filled by the latches a compiled page emits, so a page carries only the
|
|
1016
|
+
* control kinds its tags can be (`_attrs_script` resolves the kind at run time). */
|
|
1017
|
+
const controllableScripts = {};
|
|
1018
|
+
/** The render pass equivalent, for a tag whose name is only known at run time;
|
|
1019
|
+
* a statically named tag passes its claim to `_attrs` instead. */
|
|
1020
|
+
const controllableRenders = {};
|
|
1021
|
+
function _enable_controllable_input() {
|
|
1022
|
+
controllableScripts[0] = _attr_input_checked_script;
|
|
1023
|
+
controllableScripts[1] = _attr_input_checkedValue_script;
|
|
1024
|
+
controllableScripts[2] = _attr_input_value_script;
|
|
1025
|
+
}
|
|
1026
|
+
function _enable_controllable_textarea() {
|
|
1027
|
+
controllableScripts[2] = _attr_input_value_script;
|
|
1028
|
+
}
|
|
1029
|
+
function _enable_controllable_select() {
|
|
1030
|
+
controllableScripts[3] = _attr_select_value_script;
|
|
1031
|
+
}
|
|
1032
|
+
function _enable_controllable_open() {
|
|
1033
|
+
controllableScripts[4] = _attr_details_or_dialog_open_script;
|
|
1034
|
+
}
|
|
1035
|
+
/** A run-time tag name can be any controllable, so its page enables them all. */
|
|
1036
|
+
function _enable_controllable() {
|
|
1037
|
+
_enable_controllable_input();
|
|
1038
|
+
_enable_controllable_select();
|
|
1039
|
+
_enable_controllable_open();
|
|
1040
|
+
controllableRenders.INPUT = _controllable_input;
|
|
1041
|
+
controllableRenders.TEXTAREA = _controllable_textarea;
|
|
1042
|
+
controllableRenders.SELECT = _controllable_select;
|
|
1043
|
+
controllableRenders.DETAILS = controllableRenders.DIALOG = _controllable_open;
|
|
1044
|
+
}
|
|
1014
1045
|
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
1015
1046
|
const el = scope[nodeAccessor];
|
|
1016
1047
|
const normalizedChecked = isNotVoid(checked);
|
|
@@ -1172,12 +1203,12 @@ function _attr_select_value_script(scope, nodeAccessor) {
|
|
|
1172
1203
|
}
|
|
1173
1204
|
}
|
|
1174
1205
|
syncControllableFormInput(el, hasSelectChanged, onChange);
|
|
1175
|
-
|
|
1176
|
-
const value = scope[ControlledValue + nodeAccessor];
|
|
1177
|
-
if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) onChange();
|
|
1178
|
-
}).observe(el, {
|
|
1206
|
+
observeOnce(scope, nodeAccessor, {
|
|
1179
1207
|
childList: true,
|
|
1180
1208
|
subtree: true
|
|
1209
|
+
}, () => {
|
|
1210
|
+
const value = scope[ControlledValue + nodeAccessor];
|
|
1211
|
+
if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) onChange();
|
|
1181
1212
|
});
|
|
1182
1213
|
}
|
|
1183
1214
|
function setSelectValue(el, value, multiple) {
|
|
@@ -1207,7 +1238,10 @@ function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
|
1207
1238
|
}
|
|
1208
1239
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
1209
1240
|
const el = scope[nodeAccessor];
|
|
1210
|
-
|
|
1241
|
+
observeOnce(scope, nodeAccessor, {
|
|
1242
|
+
attributes: true,
|
|
1243
|
+
attributeFilter: ["open"]
|
|
1244
|
+
}, () => {
|
|
1211
1245
|
const openChange = scope[ControlledHandler + nodeAccessor];
|
|
1212
1246
|
if (openChange && el.open === !scope["ControlledValue:" + nodeAccessor]) {
|
|
1213
1247
|
const newValue = el.open;
|
|
@@ -1215,11 +1249,11 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
|
1215
1249
|
openChange(newValue);
|
|
1216
1250
|
run();
|
|
1217
1251
|
}
|
|
1218
|
-
}).observe(el, {
|
|
1219
|
-
attributes: true,
|
|
1220
|
-
attributeFilter: ["open"]
|
|
1221
1252
|
});
|
|
1222
1253
|
}
|
|
1254
|
+
function observeOnce(scope, nodeAccessor, init, callback) {
|
|
1255
|
+
(scope[ControlledObserver + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
|
|
1256
|
+
}
|
|
1223
1257
|
function syncControllableFormInput(el, hasChanged, onChange) {
|
|
1224
1258
|
el._ = onChange;
|
|
1225
1259
|
delegate("input", handleChange);
|
|
@@ -1255,6 +1289,35 @@ function updateList(arr, val, push) {
|
|
|
1255
1289
|
const index = arr.indexOf(val);
|
|
1256
1290
|
return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
|
|
1257
1291
|
}
|
|
1292
|
+
function _controllable_input(scope, nodeAccessor, nextAttrs) {
|
|
1293
|
+
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
|
|
1294
|
+
_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
|
|
1295
|
+
return /^checked(?:Value)?(?:Change)?$/;
|
|
1296
|
+
}
|
|
1297
|
+
if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
|
|
1298
|
+
_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
|
|
1299
|
+
return /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1300
|
+
}
|
|
1301
|
+
return _controllable_textarea(scope, nodeAccessor, nextAttrs, _attr_input_value_dynamic_default);
|
|
1302
|
+
}
|
|
1303
|
+
function _controllable_textarea(scope, nodeAccessor, nextAttrs, dynamicDefault) {
|
|
1304
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1305
|
+
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, dynamicDefault);
|
|
1306
|
+
return /^value(?:Change)?$/;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
function _controllable_select(scope, nodeAccessor, nextAttrs) {
|
|
1310
|
+
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1311
|
+
_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1312
|
+
return /^value(?:Change)?$/;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
function _controllable_open(scope, nodeAccessor, nextAttrs) {
|
|
1316
|
+
if ("open" in nextAttrs || "openChange" in nextAttrs) {
|
|
1317
|
+
_attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange);
|
|
1318
|
+
return /^open(?:Change)?$/;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1258
1321
|
//#endregion
|
|
1259
1322
|
//#region src/dom/dom.ts
|
|
1260
1323
|
function _to_text(value) {
|
|
@@ -1312,23 +1375,23 @@ function _text_content(node, value) {
|
|
|
1312
1375
|
const normalizedValue = _to_text(value);
|
|
1313
1376
|
if (node.textContent !== normalizedValue) node.textContent = normalizedValue;
|
|
1314
1377
|
}
|
|
1315
|
-
function _attrs(scope, nodeAccessor, nextAttrs) {
|
|
1378
|
+
function _attrs(scope, nodeAccessor, nextAttrs, controllable) {
|
|
1316
1379
|
const el = scope[nodeAccessor];
|
|
1317
1380
|
for (let i = el.attributes.length; i--;) {
|
|
1318
1381
|
const { name } = el.attributes.item(i);
|
|
1319
1382
|
if (!(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) el.removeAttribute(name);
|
|
1320
1383
|
}
|
|
1321
1384
|
assertExclusiveAttrs(nextAttrs);
|
|
1322
|
-
attrsInternal(scope, nodeAccessor, nextAttrs);
|
|
1385
|
+
attrsInternal(scope, nodeAccessor, nextAttrs, controllable);
|
|
1323
1386
|
}
|
|
1324
|
-
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
|
1325
|
-
_attrs(scope, nodeAccessor, nextAttrs);
|
|
1387
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs, controllable) {
|
|
1388
|
+
_attrs(scope, nodeAccessor, nextAttrs, controllable);
|
|
1326
1389
|
_attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
1327
1390
|
}
|
|
1328
1391
|
function hasAttrAlias(element, attr, nextAttrs) {
|
|
1329
1392
|
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
|
1330
1393
|
}
|
|
1331
|
-
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
|
1394
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
1332
1395
|
const el = scope[nodeAccessor];
|
|
1333
1396
|
const partial = {};
|
|
1334
1397
|
for (let i = el.attributes.length; i--;) {
|
|
@@ -1343,52 +1406,19 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
|
|
1343
1406
|
...nextAttrs,
|
|
1344
1407
|
...skip
|
|
1345
1408
|
});
|
|
1346
|
-
attrsInternal(scope, nodeAccessor, partial);
|
|
1409
|
+
attrsInternal(scope, nodeAccessor, partial, controllable);
|
|
1347
1410
|
}
|
|
1348
|
-
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
|
1349
|
-
_attrs_partial(scope, nodeAccessor, nextAttrs, skip);
|
|
1411
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip, controllable) {
|
|
1412
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable);
|
|
1350
1413
|
_attr_content(scope, nodeAccessor, nextAttrs?.content);
|
|
1351
1414
|
}
|
|
1352
|
-
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1415
|
+
function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
|
|
1353
1416
|
const el = scope[nodeAccessor];
|
|
1354
1417
|
let events = scope[EventAttributes + nodeAccessor];
|
|
1355
|
-
let skip;
|
|
1356
1418
|
for (const name in events) events[name] = 0;
|
|
1357
1419
|
scope[ControlledType + nodeAccessor] = 5;
|
|
1358
1420
|
scope[ControlledHandler + nodeAccessor] = 0;
|
|
1359
|
-
|
|
1360
|
-
case "INPUT":
|
|
1361
|
-
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
|
|
1362
|
-
_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
|
|
1363
|
-
skip = /^checked(?:Value)?(?:Change)?$/;
|
|
1364
|
-
} else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
|
|
1365
|
-
_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
|
|
1366
|
-
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
1367
|
-
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1368
|
-
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange, _attr_input_value_dynamic_default);
|
|
1369
|
-
skip = /^value(?:Change)?$/;
|
|
1370
|
-
}
|
|
1371
|
-
break;
|
|
1372
|
-
case "SELECT":
|
|
1373
|
-
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1374
|
-
_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1375
|
-
skip = /^value(?:Change)?$/;
|
|
1376
|
-
}
|
|
1377
|
-
break;
|
|
1378
|
-
case "TEXTAREA":
|
|
1379
|
-
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1380
|
-
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1381
|
-
skip = /^value(?:Change)?$/;
|
|
1382
|
-
}
|
|
1383
|
-
break;
|
|
1384
|
-
case "DETAILS":
|
|
1385
|
-
case "DIALOG":
|
|
1386
|
-
if ("open" in nextAttrs || "openChange" in nextAttrs) {
|
|
1387
|
-
_attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange);
|
|
1388
|
-
skip = /^open(?:Change)?$/;
|
|
1389
|
-
}
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1421
|
+
const skip = nextAttrs && (controllable || controllableRenders[el.tagName])?.(scope, nodeAccessor, nextAttrs);
|
|
1392
1422
|
for (const name in nextAttrs) {
|
|
1393
1423
|
const value = nextAttrs[name];
|
|
1394
1424
|
switch (name) {
|
|
@@ -1417,23 +1447,7 @@ function _attr_content(scope, nodeAccessor, value) {
|
|
|
1417
1447
|
function _attrs_script(scope, nodeAccessor) {
|
|
1418
1448
|
const el = scope[nodeAccessor];
|
|
1419
1449
|
const events = scope[EventAttributes + nodeAccessor];
|
|
1420
|
-
|
|
1421
|
-
case 0:
|
|
1422
|
-
_attr_input_checked_script(scope, nodeAccessor);
|
|
1423
|
-
break;
|
|
1424
|
-
case 1:
|
|
1425
|
-
_attr_input_checkedValue_script(scope, nodeAccessor);
|
|
1426
|
-
break;
|
|
1427
|
-
case 2:
|
|
1428
|
-
_attr_input_value_script(scope, nodeAccessor);
|
|
1429
|
-
break;
|
|
1430
|
-
case 3:
|
|
1431
|
-
_attr_select_value_script(scope, nodeAccessor);
|
|
1432
|
-
break;
|
|
1433
|
-
case 4:
|
|
1434
|
-
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
|
1435
|
-
break;
|
|
1436
|
-
}
|
|
1450
|
+
controllableScripts[scope[ControlledType + nodeAccessor]]?.(scope, nodeAccessor);
|
|
1437
1451
|
for (const name in events) _on(el, name, events[name]);
|
|
1438
1452
|
}
|
|
1439
1453
|
function _html(scope, value, accessor) {
|
|
@@ -1496,58 +1510,64 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1496
1510
|
const promiseAccessor = Promise$1 + nodeAccessor;
|
|
1497
1511
|
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
1498
1512
|
_enable_catch();
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
promise = Promise.resolve(promise);
|
|
1513
|
+
const resolveAwait = (scope, referenceNode, value) => {
|
|
1514
|
+
const awaitBranch = scope[branchAccessor];
|
|
1515
|
+
if (awaitBranch["#DetachedAwait"]) {
|
|
1516
|
+
awaitBranch[PendingScopes] = awaitBranch[PendingScopes]?.forEach(syncGen);
|
|
1517
|
+
setupBranch(awaitBranch[DetachedAwait], awaitBranch);
|
|
1518
|
+
awaitBranch[DetachedAwait] = 0;
|
|
1519
|
+
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
1520
|
+
referenceNode.remove();
|
|
1508
1521
|
}
|
|
1522
|
+
params?.(awaitBranch, [value]);
|
|
1523
|
+
return awaitBranch;
|
|
1524
|
+
};
|
|
1525
|
+
const awaitPromise = (scope, promise) => {
|
|
1526
|
+
if (!isPromise(promise) && scope[promiseAccessor]) promise = Promise.resolve(promise);
|
|
1509
1527
|
let awaitBranch = scope[branchAccessor];
|
|
1510
1528
|
const tryPlaceholder = findBranchWithKey(scope, PlaceholderContent);
|
|
1511
1529
|
const tryBranch = tryPlaceholder || awaitBranch;
|
|
1530
|
+
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
1531
|
+
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1534
|
+
if (!isPromise(promise)) {
|
|
1535
|
+
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1536
|
+
return;
|
|
1537
|
+
}
|
|
1512
1538
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1513
1539
|
placeholderShown.add(pendingEffects);
|
|
1514
|
-
if (tryPlaceholder) {
|
|
1515
|
-
if (
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
i: 0,
|
|
1522
|
-
c() {
|
|
1523
|
-
if (--awaitCounter.i) return 1;
|
|
1524
|
-
if (tryBranch === scope[branchAccessor]) {
|
|
1525
|
-
const anchor = scope[nodeAccessor];
|
|
1526
|
-
if (anchor.parentNode) {
|
|
1527
|
-
const detachedParent = scope[branchAccessor][StartNode].parentNode;
|
|
1528
|
-
if (detachedParent === anchor.parentNode) anchor.remove();
|
|
1529
|
-
else anchor.replaceWith(detachedParent);
|
|
1530
|
-
}
|
|
1531
|
-
} else dismissPlaceholder(tryBranch);
|
|
1532
|
-
queueEffect(tryBranch, runPendingEffects);
|
|
1540
|
+
if (!tryPlaceholder && !awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
1541
|
+
if (tryBranch === scope[branchAccessor]) {
|
|
1542
|
+
const anchor = scope[nodeAccessor];
|
|
1543
|
+
if (anchor.parentNode) {
|
|
1544
|
+
const detachedParent = scope[branchAccessor][StartNode].parentNode;
|
|
1545
|
+
if (detachedParent === anchor.parentNode) anchor.remove();
|
|
1546
|
+
else anchor.replaceWith(detachedParent);
|
|
1533
1547
|
}
|
|
1534
|
-
};
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1548
|
+
} else dismissPlaceholder(tryBranch);
|
|
1549
|
+
});
|
|
1550
|
+
if (!scope[promiseAccessor]) {
|
|
1551
|
+
if (awaitBranch) awaitBranch[PendingRenders] ||= [];
|
|
1552
|
+
if (tryPlaceholder) awaitCounter = addAwaitCounter(scope, tryPlaceholder);
|
|
1553
|
+
else if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
1554
|
+
if (!awaitBranch["#DetachedAwait"]) {
|
|
1555
|
+
awaitBranch["#StartNode"].parentNode.insertBefore(scope[nodeAccessor], awaitBranch["#StartNode"]);
|
|
1556
|
+
tempDetachBranch(tryBranch);
|
|
1557
|
+
}
|
|
1558
|
+
}, -1))));
|
|
1544
1559
|
}
|
|
1545
1560
|
const thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1546
1561
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1547
1562
|
const referenceNode = scope[nodeAccessor];
|
|
1548
1563
|
scope[promiseAccessor] = 0;
|
|
1564
|
+
if (scope["#ClosestBranch"]?.["#Gen"] === 0) {
|
|
1565
|
+
awaitCounter.c();
|
|
1566
|
+
run();
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1549
1569
|
queueAsyncRender(scope, () => {
|
|
1550
|
-
awaitBranch = resolveAwait(scope,
|
|
1570
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1551
1571
|
const pendingRenders = awaitBranch[PendingRenders];
|
|
1552
1572
|
awaitBranch[PendingRenders] = 0;
|
|
1553
1573
|
pendingRenders?.forEach(queuePendingRender);
|
|
@@ -1579,18 +1599,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1579
1599
|
}
|
|
1580
1600
|
});
|
|
1581
1601
|
};
|
|
1582
|
-
|
|
1583
|
-
function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
|
|
1584
|
-
const awaitBranch = scope[branchAccessor];
|
|
1585
|
-
if (awaitBranch["#DetachedAwait"]) {
|
|
1586
|
-
awaitBranch[PendingScopes] = awaitBranch[PendingScopes]?.forEach(syncGen);
|
|
1587
|
-
setupBranch(awaitBranch[DetachedAwait], awaitBranch);
|
|
1588
|
-
awaitBranch[DetachedAwait] = 0;
|
|
1589
|
-
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
1590
|
-
referenceNode.remove();
|
|
1591
|
-
}
|
|
1592
|
-
params?.(awaitBranch, [value]);
|
|
1593
|
-
return awaitBranch;
|
|
1602
|
+
return awaitPromise;
|
|
1594
1603
|
}
|
|
1595
1604
|
function _await_content(nodeAccessor, template, walks, setup) {
|
|
1596
1605
|
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
@@ -1609,19 +1618,23 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1609
1618
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, PlaceholderContent)) {
|
|
1610
1619
|
if (!tryBranch) return;
|
|
1611
1620
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1612
|
-
if (!awaitCounter?.i) awaitCounter = tryBranch
|
|
1621
|
+
if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
|
|
1622
|
+
placeholderShown.add(pendingEffects);
|
|
1623
|
+
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1624
|
+
insertBranchBefore(tryBranch["#PlaceholderBranch"] = createAndSetupBranch(tryBranch["$global"], tryBranch["#PlaceholderContent"], tryBranch["_"], tryBranch["#StartNode"].parentNode), tryBranch["#StartNode"].parentNode, tryBranch["#StartNode"]);
|
|
1625
|
+
tempDetachBranch(tryBranch);
|
|
1626
|
+
}, -1))));
|
|
1627
|
+
return awaitCounter;
|
|
1628
|
+
}
|
|
1629
|
+
function createAwaitCounter(tryBranch, done) {
|
|
1630
|
+
const awaitCounter = tryBranch[AwaitCounter] = {
|
|
1613
1631
|
i: 0,
|
|
1614
1632
|
c() {
|
|
1615
1633
|
if (--awaitCounter.i) return 1;
|
|
1616
|
-
|
|
1634
|
+
done();
|
|
1617
1635
|
queueEffect(tryBranch, runPendingEffects);
|
|
1618
1636
|
}
|
|
1619
1637
|
};
|
|
1620
|
-
placeholderShown.add(pendingEffects);
|
|
1621
|
-
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1622
|
-
insertBranchBefore(tryBranch["#PlaceholderBranch"] = createAndSetupBranch(tryBranch["$global"], tryBranch["#PlaceholderContent"], tryBranch["_"], tryBranch["#StartNode"].parentNode), tryBranch["#StartNode"].parentNode, tryBranch["#StartNode"]);
|
|
1623
|
-
tempDetachBranch(tryBranch);
|
|
1624
|
-
}, -1))));
|
|
1625
1638
|
return awaitCounter;
|
|
1626
1639
|
}
|
|
1627
1640
|
function runPendingEffects(scope) {
|
|
@@ -2388,6 +2401,10 @@ exports._const = _const;
|
|
|
2388
2401
|
exports._content = _content;
|
|
2389
2402
|
exports._content_closures = _content_closures;
|
|
2390
2403
|
exports._content_resume = _content_resume;
|
|
2404
|
+
exports._controllable_input = _controllable_input;
|
|
2405
|
+
exports._controllable_open = _controllable_open;
|
|
2406
|
+
exports._controllable_select = _controllable_select;
|
|
2407
|
+
exports._controllable_textarea = _controllable_textarea;
|
|
2391
2408
|
Object.defineProperty(exports, "_dynamic_tag", {
|
|
2392
2409
|
enumerable: true,
|
|
2393
2410
|
get: function() {
|
|
@@ -2398,6 +2415,11 @@ exports._dynamic_tag_content = _dynamic_tag_content;
|
|
|
2398
2415
|
exports._el = _el;
|
|
2399
2416
|
exports._el_read = _el_read;
|
|
2400
2417
|
exports._enable_catch = _enable_catch;
|
|
2418
|
+
exports._enable_controllable = _enable_controllable;
|
|
2419
|
+
exports._enable_controllable_input = _enable_controllable_input;
|
|
2420
|
+
exports._enable_controllable_open = _enable_controllable_open;
|
|
2421
|
+
exports._enable_controllable_select = _enable_controllable_select;
|
|
2422
|
+
exports._enable_controllable_textarea = _enable_controllable_textarea;
|
|
2401
2423
|
exports._for_closure = _for_closure;
|
|
2402
2424
|
exports._for_in = _for_in;
|
|
2403
2425
|
exports._for_of = _for_of;
|