marko 6.1.10 → 6.1.12
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/accessor.d.ts +2 -2
- package/dist/common/accessor.debug.d.ts +2 -2
- package/dist/common/errors.d.ts +0 -2
- package/dist/common/helpers.d.ts +1 -0
- package/dist/common/types.d.ts +2 -2
- package/dist/debug/dom.js +66 -59
- package/dist/debug/dom.mjs +66 -59
- package/dist/debug/html.js +9 -9
- package/dist/debug/html.mjs +9 -9
- package/dist/dom/queue.d.ts +2 -2
- package/dist/dom/scope.d.ts +3 -0
- package/dist/dom.d.ts +2 -1
- package/dist/dom.js +59 -48
- package/dist/dom.mjs +59 -48
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.js +9 -9
- package/dist/html.mjs +9 -9
- package/dist/translator/index.js +99 -22
- package/dist/translator/util/references.d.ts +4 -0
- package/dist/translator/util/sections.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/dom.mjs
CHANGED
|
@@ -29,10 +29,6 @@ function _hoist_read_error() {
|
|
|
29
29
|
function _assert_hoist(value) {
|
|
30
30
|
if (typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
|
|
31
31
|
}
|
|
32
|
-
function _assert_init(scope, accessor) {
|
|
33
|
-
if (scope["#Creating"] || !(accessor in scope)) throw new ReferenceError(`Cannot access '${accessor}' before initialization`);
|
|
34
|
-
return scope[accessor];
|
|
35
|
-
}
|
|
36
32
|
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
37
33
|
if (attrs) {
|
|
38
34
|
let exclusiveAttrs;
|
|
@@ -123,6 +119,9 @@ function isEventHandler(name) {
|
|
|
123
119
|
function getEventHandlerName(name) {
|
|
124
120
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
125
121
|
}
|
|
122
|
+
function isNotVoid(value) {
|
|
123
|
+
return value != null && value !== false;
|
|
124
|
+
}
|
|
126
125
|
function normalizeDynamicRenderer(value) {
|
|
127
126
|
if (value) {
|
|
128
127
|
if (typeof value === "string") return value;
|
|
@@ -197,16 +196,34 @@ function parseHTML(html, ns) {
|
|
|
197
196
|
//#endregion
|
|
198
197
|
//#region src/dom/scope.ts
|
|
199
198
|
let nextScopeId = 1e6;
|
|
199
|
+
let collectingScopes;
|
|
200
200
|
function createScope($global, closestBranch) {
|
|
201
201
|
const scope = {
|
|
202
202
|
["#Id"]: nextScopeId++,
|
|
203
|
-
["#
|
|
203
|
+
["#Gen"]: runId,
|
|
204
204
|
["#ClosestBranch"]: closestBranch,
|
|
205
205
|
["$global"]: $global
|
|
206
206
|
};
|
|
207
|
-
|
|
207
|
+
collectingScopes?.push(scope);
|
|
208
208
|
return scope;
|
|
209
209
|
}
|
|
210
|
+
function syncGen(scope) {
|
|
211
|
+
scope["#Gen"] = runId;
|
|
212
|
+
}
|
|
213
|
+
function _assert_init(scope, accessor) {
|
|
214
|
+
if (scope["#Gen"] === runId || !(accessor in scope)) throw new ReferenceError(`Cannot access '${accessor}' before initialization`);
|
|
215
|
+
return scope[accessor];
|
|
216
|
+
}
|
|
217
|
+
function collectScopes(fn) {
|
|
218
|
+
const prev = collectingScopes;
|
|
219
|
+
collectingScopes = [];
|
|
220
|
+
try {
|
|
221
|
+
fn();
|
|
222
|
+
return collectingScopes;
|
|
223
|
+
} finally {
|
|
224
|
+
collectingScopes = prev;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
210
227
|
function skipScope() {
|
|
211
228
|
return nextScopeId++;
|
|
212
229
|
}
|
|
@@ -220,13 +237,13 @@ function destroyBranch(branch) {
|
|
|
220
237
|
destroyNestedScopes(branch);
|
|
221
238
|
}
|
|
222
239
|
function destroyScope(scope) {
|
|
223
|
-
if (
|
|
240
|
+
if (scope["#Gen"]) {
|
|
224
241
|
destroyNestedScopes(scope);
|
|
225
242
|
resetControllers(scope);
|
|
226
243
|
}
|
|
227
244
|
}
|
|
228
245
|
const destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
229
|
-
scope["#
|
|
246
|
+
scope["#Gen"] = 0;
|
|
230
247
|
scope["#BranchScopes"]?.forEach(destroyNestedScopes);
|
|
231
248
|
scope["#AbortScopes"]?.forEach(resetControllers);
|
|
232
249
|
};
|
|
@@ -285,7 +302,7 @@ function _let(id, fn) {
|
|
|
285
302
|
id = +id.slice(id.lastIndexOf("/") + 1);
|
|
286
303
|
return (scope, value) => {
|
|
287
304
|
if (rendering) {
|
|
288
|
-
if (scope["#
|
|
305
|
+
if (scope["#Gen"] === runId) {
|
|
289
306
|
scope[valueAccessor] = value;
|
|
290
307
|
fn?.(scope);
|
|
291
308
|
}
|
|
@@ -320,7 +337,7 @@ function _const(valueAccessor, fn) {
|
|
|
320
337
|
}
|
|
321
338
|
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
|
|
322
339
|
return (scope) => {
|
|
323
|
-
if (scope["#
|
|
340
|
+
if (scope["#Gen"] === runId) if (id in scope) {
|
|
324
341
|
if (!--scope[id]) fn(scope);
|
|
325
342
|
} else scope[id] = defaultPending;
|
|
326
343
|
else queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
@@ -331,7 +348,7 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
331
348
|
const ownerSignal = (ownerScope) => {
|
|
332
349
|
const scopes = toArray(ownerScope[scopeAccessor]);
|
|
333
350
|
if (scopes.length) queueRender(ownerScope, () => {
|
|
334
|
-
for (const scope of scopes) if (
|
|
351
|
+
for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
|
|
335
352
|
}, -1, 0, scopes[0]["#Id"]);
|
|
336
353
|
};
|
|
337
354
|
ownerSignal._ = fn;
|
|
@@ -342,7 +359,7 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
342
359
|
const branchAccessor = "ConditionalRenderer:" + ownerConditionalNodeAccessor;
|
|
343
360
|
const ownerSignal = (scope) => {
|
|
344
361
|
const ifScope = scope[scopeAccessor];
|
|
345
|
-
if (ifScope &&
|
|
362
|
+
if (ifScope && ifScope["#Gen"] > 0 && ifScope["#Gen"] < runId && (scope[branchAccessor] || 0) === branch) queueRender(ifScope, fn, -1);
|
|
346
363
|
};
|
|
347
364
|
ownerSignal._ = fn;
|
|
348
365
|
return ownerSignal;
|
|
@@ -361,7 +378,7 @@ function _closure(...closureSignals) {
|
|
|
361
378
|
for (let i = closureSignals.length; i--;) closureSignals[i]["index"] = i;
|
|
362
379
|
return (scope) => {
|
|
363
380
|
if (scope[scopeInstances]) {
|
|
364
|
-
for (const childScope of scope[scopeInstances]) if (
|
|
381
|
+
for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
|
|
365
382
|
}
|
|
366
383
|
};
|
|
367
384
|
}
|
|
@@ -601,6 +618,7 @@ function init(runtimeId = "M") {
|
|
|
601
618
|
renderId
|
|
602
619
|
};
|
|
603
620
|
const initScope = (scope) => {
|
|
621
|
+
scope["#Gen"] = 1;
|
|
604
622
|
scope["$global"] = initGlobal();
|
|
605
623
|
if (branchesEnabled && scope["#ClosestBranchId"]) scope["#ClosestBranch"] = getScope(scope["#ClosestBranchId"]);
|
|
606
624
|
return scope;
|
|
@@ -763,19 +781,19 @@ let inputType = "";
|
|
|
763
781
|
const controllableDelegate = /* @__PURE__ */ createDelegator();
|
|
764
782
|
function _attr_input_checked_default(scope, nodeAccessor, checked) {
|
|
765
783
|
const el = scope[nodeAccessor];
|
|
766
|
-
const normalizedChecked =
|
|
784
|
+
const normalizedChecked = isNotVoid(checked);
|
|
767
785
|
if (el.defaultChecked !== normalizedChecked) {
|
|
768
|
-
const restoreValue = scope["#
|
|
786
|
+
const restoreValue = scope["#Gen"] < runId ? el.checked : normalizedChecked;
|
|
769
787
|
el.defaultChecked = normalizedChecked;
|
|
770
788
|
if (restoreValue !== normalizedChecked) el.checked = restoreValue;
|
|
771
789
|
}
|
|
772
790
|
}
|
|
773
791
|
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
|
774
792
|
const el = scope[nodeAccessor];
|
|
775
|
-
const normalizedChecked =
|
|
793
|
+
const normalizedChecked = isNotVoid(checked);
|
|
776
794
|
scope["ControlledHandler:" + nodeAccessor] = checkedChange;
|
|
777
795
|
scope["ControlledType:" + nodeAccessor] = checkedChange ? 0 : 5;
|
|
778
|
-
if (checkedChange &&
|
|
796
|
+
if (checkedChange && scope["#Gen"] < runId) el.checked = normalizedChecked;
|
|
779
797
|
else _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
|
|
780
798
|
}
|
|
781
799
|
function _attr_input_checked_script(scope, nodeAccessor) {
|
|
@@ -794,19 +812,19 @@ function _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, val
|
|
|
794
812
|
const multiple = Array.isArray(checkedValue);
|
|
795
813
|
const normalizedValue = normalizeStrProp(value);
|
|
796
814
|
const normalizedCheckedValue = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
797
|
-
_attr(scope[nodeAccessor], "value",
|
|
815
|
+
_attr(scope[nodeAccessor], "value", value);
|
|
798
816
|
_attr_input_checked_default(scope, nodeAccessor, multiple ? normalizedCheckedValue.includes(normalizedValue) : normalizedValue === normalizedCheckedValue);
|
|
799
817
|
}
|
|
800
818
|
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
801
819
|
const el = scope[nodeAccessor];
|
|
802
820
|
const multiple = Array.isArray(checkedValue);
|
|
803
|
-
const normalizedValue = normalizeStrProp(value);
|
|
804
821
|
const normalizedCheckedValue = scope["ControlledValue:" + nodeAccessor] = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
|
|
805
|
-
_attr(el, "value", normalizedValue);
|
|
806
822
|
scope["ControlledHandler:" + nodeAccessor] = checkedValueChange;
|
|
807
823
|
scope["ControlledType:" + nodeAccessor] = checkedValueChange ? 1 : 5;
|
|
808
|
-
if (checkedValueChange &&
|
|
809
|
-
|
|
824
|
+
if (checkedValueChange && scope["#Gen"] < runId) {
|
|
825
|
+
el.checked = multiple ? normalizedCheckedValue.includes(normalizeStrProp(value)) : normalizeStrProp(value) === normalizedCheckedValue;
|
|
826
|
+
_attr(el, "value", value);
|
|
827
|
+
} else _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, value);
|
|
810
828
|
}
|
|
811
829
|
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
812
830
|
const el = scope[nodeAccessor];
|
|
@@ -827,20 +845,20 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
827
845
|
}
|
|
828
846
|
function _attr_input_value_default(scope, nodeAccessor, value) {
|
|
829
847
|
const el = scope[nodeAccessor];
|
|
830
|
-
const normalizedValue =
|
|
848
|
+
const normalizedValue = normalizeAttrValue(value) || "";
|
|
831
849
|
if (el.defaultValue !== normalizedValue) {
|
|
832
|
-
const restoreValue = scope["#
|
|
850
|
+
const restoreValue = scope["#Gen"] < runId ? el.value : normalizedValue;
|
|
833
851
|
el.defaultValue = normalizedValue;
|
|
834
852
|
setInputValue(el, restoreValue);
|
|
835
853
|
}
|
|
836
854
|
}
|
|
837
855
|
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
|
838
856
|
const el = scope[nodeAccessor];
|
|
839
|
-
const normalizedValue =
|
|
857
|
+
const normalizedValue = normalizeAttrValue(value) || "";
|
|
840
858
|
scope["ControlledHandler:" + nodeAccessor] = valueChange;
|
|
841
859
|
scope["ControlledValue:" + nodeAccessor] = normalizedValue;
|
|
842
860
|
scope["ControlledType:" + nodeAccessor] = valueChange ? 2 : 5;
|
|
843
|
-
if (valueChange &&
|
|
861
|
+
if (valueChange && scope["#Gen"] < runId) setInputValue(el, normalizedValue);
|
|
844
862
|
else _attr_input_value_default(scope, nodeAccessor, normalizedValue);
|
|
845
863
|
}
|
|
846
864
|
function _attr_input_value_script(scope, nodeAccessor) {
|
|
@@ -866,14 +884,14 @@ function setInputValue(el, value) {
|
|
|
866
884
|
function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
867
885
|
let restoreValue;
|
|
868
886
|
const el = scope[nodeAccessor];
|
|
869
|
-
const
|
|
887
|
+
const live = scope["#Gen"] < runId;
|
|
870
888
|
const multiple = Array.isArray(value);
|
|
871
889
|
const normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
872
890
|
pendingEffects.unshift(() => {
|
|
873
891
|
for (const opt of el.options) {
|
|
874
892
|
const selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
|
|
875
893
|
if (opt.defaultSelected !== selected) {
|
|
876
|
-
if (
|
|
894
|
+
if (live) restoreValue ??= getSelectValue(el, multiple);
|
|
877
895
|
opt.defaultSelected = selected;
|
|
878
896
|
}
|
|
879
897
|
}
|
|
@@ -882,7 +900,7 @@ function _attr_select_value_default(scope, nodeAccessor, value) {
|
|
|
882
900
|
}
|
|
883
901
|
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
|
884
902
|
const el = scope[nodeAccessor];
|
|
885
|
-
const existing =
|
|
903
|
+
const existing = scope["#Gen"] < runId;
|
|
886
904
|
const multiple = Array.isArray(value);
|
|
887
905
|
const normalizedValue = scope["ControlledValue:" + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
|
|
888
906
|
scope["ControlledHandler:" + nodeAccessor] = valueChange;
|
|
@@ -930,13 +948,13 @@ function getSelectValue(el, multiple) {
|
|
|
930
948
|
return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
|
|
931
949
|
}
|
|
932
950
|
function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
|
|
933
|
-
if (scope["#
|
|
951
|
+
if (scope["#Gen"] === runId) scope[nodeAccessor].open = isNotVoid(open);
|
|
934
952
|
}
|
|
935
953
|
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
|
936
|
-
const normalizedOpen = scope["ControlledValue:" + nodeAccessor] =
|
|
954
|
+
const normalizedOpen = scope["ControlledValue:" + nodeAccessor] = isNotVoid(open);
|
|
937
955
|
scope["ControlledHandler:" + nodeAccessor] = openChange;
|
|
938
956
|
scope["ControlledType:" + nodeAccessor] = openChange ? 4 : 5;
|
|
939
|
-
if (openChange &&
|
|
957
|
+
if (openChange && scope["#Gen"] < runId) scope[nodeAccessor].open = normalizedOpen;
|
|
940
958
|
else _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
|
|
941
959
|
}
|
|
942
960
|
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
|
@@ -985,9 +1003,6 @@ function hasFormElementChanged(el) {
|
|
|
985
1003
|
function normalizeStrProp(value) {
|
|
986
1004
|
return normalizeAttrValue(value) || "";
|
|
987
1005
|
}
|
|
988
|
-
function normalizeBoolProp(value) {
|
|
989
|
-
return value != null && value !== false;
|
|
990
|
-
}
|
|
991
1006
|
function updateList(arr, val, push) {
|
|
992
1007
|
const index = arr.indexOf(val);
|
|
993
1008
|
return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
|
|
@@ -1163,7 +1178,7 @@ function normalizeClientRender(value) {
|
|
|
1163
1178
|
else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
|
|
1164
1179
|
}
|
|
1165
1180
|
function normalizeAttrValue(value) {
|
|
1166
|
-
if (value
|
|
1181
|
+
if (isNotVoid(value)) return value === true ? "" : value + "";
|
|
1167
1182
|
}
|
|
1168
1183
|
function _lifecycle(scope, thisObj, index = 0) {
|
|
1169
1184
|
const accessor = "Lifecycle:" + index;
|
|
@@ -1243,7 +1258,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1243
1258
|
scope[promiseAccessor] = 0;
|
|
1244
1259
|
queueAsyncRender(scope, () => {
|
|
1245
1260
|
if ((awaitBranch = scope[branchAccessor])["#DetachedAwait"]) {
|
|
1246
|
-
|
|
1261
|
+
awaitBranch["#PendingScopes"] = awaitBranch["#PendingScopes"]?.forEach(syncGen);
|
|
1247
1262
|
setupBranch(awaitBranch["#DetachedAwait"], awaitBranch);
|
|
1248
1263
|
awaitBranch["#DetachedAwait"] = 0;
|
|
1249
1264
|
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
@@ -1284,8 +1299,8 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1284
1299
|
const branchAccessor = "BranchScopes:" + nodeAccessor;
|
|
1285
1300
|
const renderer = _content("", template, walks, setup)();
|
|
1286
1301
|
return (scope) => {
|
|
1287
|
-
(scope[branchAccessor] = createBranch(scope["$global"], renderer, scope, scope[nodeAccessor].parentNode))["#DetachedAwait"] = renderer;
|
|
1288
|
-
pendingScopes
|
|
1302
|
+
const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope["$global"], renderer, scope, scope[nodeAccessor].parentNode))["#DetachedAwait"] = renderer);
|
|
1303
|
+
scope[branchAccessor]["#PendingScopes"] = pendingScopes;
|
|
1289
1304
|
};
|
|
1290
1305
|
}
|
|
1291
1306
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "#PlaceholderContent")) {
|
|
@@ -1548,13 +1563,12 @@ function byFirstArg(name) {
|
|
|
1548
1563
|
}
|
|
1549
1564
|
//#endregion
|
|
1550
1565
|
//#region src/dom/queue.ts
|
|
1551
|
-
let
|
|
1552
|
-
let
|
|
1566
|
+
let rendering;
|
|
1567
|
+
let runId = 2;
|
|
1553
1568
|
const caughtError = /* @__PURE__ */ new WeakSet();
|
|
1554
1569
|
const placeholderShown = /* @__PURE__ */ new WeakSet();
|
|
1555
1570
|
let pendingEffects = [];
|
|
1556
|
-
let
|
|
1557
|
-
let rendering;
|
|
1571
|
+
let pendingRenders = [];
|
|
1558
1572
|
const scopeKeyOffset = 1e3;
|
|
1559
1573
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
1560
1574
|
let render;
|
|
@@ -1647,13 +1661,11 @@ function runRenders() {
|
|
|
1647
1661
|
}
|
|
1648
1662
|
runRender(render);
|
|
1649
1663
|
}
|
|
1650
|
-
for (const scope of pendingScopes) scope["#Creating"] = 0;
|
|
1651
|
-
pendingScopes = [];
|
|
1652
1664
|
}
|
|
1653
1665
|
let runRender = (render) => render["signal"](render["scope"], render["value"]);
|
|
1654
1666
|
function skipDestroyedRenders() {
|
|
1655
1667
|
runRender = ((runRender) => (render) => {
|
|
1656
|
-
if (
|
|
1668
|
+
if (render["scope"]["#ClosestBranch"]?.["#Gen"] !== 0) runRender(render);
|
|
1657
1669
|
})(runRender);
|
|
1658
1670
|
}
|
|
1659
1671
|
let catchEnabled;
|
|
@@ -1676,8 +1688,7 @@ function _enable_catch() {
|
|
|
1676
1688
|
for (; i < effects.length;) {
|
|
1677
1689
|
fn = effects[i++];
|
|
1678
1690
|
scope = effects[i++];
|
|
1679
|
-
branch = scope["#ClosestBranch"];
|
|
1680
|
-
if (!branch?.["#Destroyed"] && !(checkPending && handlePendingTry(fn, scope, branch))) fn(scope);
|
|
1691
|
+
if ((branch = scope["#ClosestBranch"])?.["#Gen"] !== 0 && !(checkPending && handlePendingTry(fn, scope, branch))) fn(scope);
|
|
1681
1692
|
}
|
|
1682
1693
|
} else runEffects(effects);
|
|
1683
1694
|
})(runEffects);
|
|
@@ -1901,13 +1912,12 @@ function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
|
1901
1912
|
}
|
|
1902
1913
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
1903
1914
|
const parent = marker.parentNode;
|
|
1904
|
-
branch
|
|
1915
|
+
syncGen(branch);
|
|
1905
1916
|
renderer["clone"](branch, parent.namespaceURI);
|
|
1906
1917
|
setupBranch(renderer, branch);
|
|
1907
1918
|
applyLoad(branch, () => {
|
|
1908
1919
|
insertBranchBefore(branch, parent, marker);
|
|
1909
1920
|
marker.remove();
|
|
1910
|
-
pendingScopes.push(branch);
|
|
1911
1921
|
awaitCounter?.c();
|
|
1912
1922
|
});
|
|
1913
1923
|
}
|
|
@@ -1923,14 +1933,11 @@ function applyLoad(scope, insert) {
|
|
|
1923
1933
|
scope["#Load"] = 0;
|
|
1924
1934
|
if (remaining = values?.size) for (const [promise, entry] of values) promise.then((signal) => {
|
|
1925
1935
|
entry["signal"] = signal;
|
|
1926
|
-
if (!--remaining) {
|
|
1927
|
-
scope
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
insert();
|
|
1932
|
-
});
|
|
1933
|
-
}
|
|
1936
|
+
if (!--remaining) queueAsyncRender(scope, (scope) => {
|
|
1937
|
+
syncGen(scope);
|
|
1938
|
+
values.forEach((e) => e["signal"]._(scope, e["value"]));
|
|
1939
|
+
insert();
|
|
1940
|
+
});
|
|
1934
1941
|
}, () => 0);
|
|
1935
1942
|
else insert();
|
|
1936
1943
|
}
|
|
@@ -1939,7 +1946,7 @@ function _load_signal(load) {
|
|
|
1939
1946
|
let signal;
|
|
1940
1947
|
return (scope, value) => {
|
|
1941
1948
|
pending ||= load();
|
|
1942
|
-
if (scope["#Load"] || !("#Load" in scope) && scope["#
|
|
1949
|
+
if (scope["#Load"] || !("#Load" in scope) && scope["#Gen"] === runId) (scope["#Load"] ||= /* @__PURE__ */ new Map()).set(pending, { ["value"]: value });
|
|
1943
1950
|
else if (signal) signal(scope, value);
|
|
1944
1951
|
else pending.then((mod) => queueAsyncRender(scope, signal = mod._, value), () => 0);
|
|
1945
1952
|
};
|
package/dist/debug/html.js
CHANGED
|
@@ -1344,6 +1344,9 @@ function getEventHandlerName(name) {
|
|
|
1344
1344
|
function isVoid(value) {
|
|
1345
1345
|
return value == null || value === false;
|
|
1346
1346
|
}
|
|
1347
|
+
function isNotVoid(value) {
|
|
1348
|
+
return value != null && value !== false;
|
|
1349
|
+
}
|
|
1347
1350
|
function normalizeDynamicRenderer(value) {
|
|
1348
1351
|
if (value) {
|
|
1349
1352
|
if (typeof value === "string") return value;
|
|
@@ -2384,7 +2387,7 @@ function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
|
2384
2387
|
}
|
|
2385
2388
|
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
2386
2389
|
if (checkedChange) writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange);
|
|
2387
|
-
return
|
|
2390
|
+
return isNotVoid(checked) ? " checked" : "";
|
|
2388
2391
|
}
|
|
2389
2392
|
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
2390
2393
|
const valueAttr = _attr("value", value);
|
|
@@ -2403,8 +2406,8 @@ function getCheckedValueRef(checkedValue) {
|
|
|
2403
2406
|
}
|
|
2404
2407
|
}
|
|
2405
2408
|
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
2406
|
-
const normalizedOpen =
|
|
2407
|
-
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen, openChange);
|
|
2409
|
+
const normalizedOpen = isNotVoid(open);
|
|
2410
|
+
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange);
|
|
2408
2411
|
return normalizedOpen ? " open" : "";
|
|
2409
2412
|
}
|
|
2410
2413
|
function _attr_nonce() {
|
|
@@ -2421,17 +2424,17 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2421
2424
|
case "input":
|
|
2422
2425
|
assertExclusiveAttrs(data);
|
|
2423
2426
|
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange);
|
|
2424
|
-
else if (
|
|
2427
|
+
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value);
|
|
2425
2428
|
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange);
|
|
2426
2429
|
else break;
|
|
2427
2430
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
2428
2431
|
break;
|
|
2429
2432
|
case "select":
|
|
2430
2433
|
case "textarea":
|
|
2431
|
-
if (
|
|
2434
|
+
if ("value" in data || data.valueChange) skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
2432
2435
|
break;
|
|
2433
2436
|
case "option":
|
|
2434
|
-
if (data
|
|
2437
|
+
if ("value" in data) {
|
|
2435
2438
|
result += _attr_option_value(data.value);
|
|
2436
2439
|
skip = /^value$|[\s/>"'=]/;
|
|
2437
2440
|
}
|
|
@@ -2534,9 +2537,6 @@ function normalizedValueMatches(a, b) {
|
|
|
2534
2537
|
function normalizeStrAttrValue(value) {
|
|
2535
2538
|
return value && value !== true || value === 0 ? value + "" : "";
|
|
2536
2539
|
}
|
|
2537
|
-
function normalizeBoolAttrValue(value) {
|
|
2538
|
-
if (value != null && value !== false) return true;
|
|
2539
|
-
}
|
|
2540
2540
|
//#endregion
|
|
2541
2541
|
//#region src/html/dynamic-tag.ts
|
|
2542
2542
|
const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
package/dist/debug/html.mjs
CHANGED
|
@@ -1342,6 +1342,9 @@ function getEventHandlerName(name) {
|
|
|
1342
1342
|
function isVoid(value) {
|
|
1343
1343
|
return value == null || value === false;
|
|
1344
1344
|
}
|
|
1345
|
+
function isNotVoid(value) {
|
|
1346
|
+
return value != null && value !== false;
|
|
1347
|
+
}
|
|
1345
1348
|
function normalizeDynamicRenderer(value) {
|
|
1346
1349
|
if (value) {
|
|
1347
1350
|
if (typeof value === "string") return value;
|
|
@@ -2382,7 +2385,7 @@ function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
|
2382
2385
|
}
|
|
2383
2386
|
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
2384
2387
|
if (checkedChange) writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange);
|
|
2385
|
-
return
|
|
2388
|
+
return isNotVoid(checked) ? " checked" : "";
|
|
2386
2389
|
}
|
|
2387
2390
|
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
2388
2391
|
const valueAttr = _attr("value", value);
|
|
@@ -2401,8 +2404,8 @@ function getCheckedValueRef(checkedValue) {
|
|
|
2401
2404
|
}
|
|
2402
2405
|
}
|
|
2403
2406
|
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
2404
|
-
const normalizedOpen =
|
|
2405
|
-
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen, openChange);
|
|
2407
|
+
const normalizedOpen = isNotVoid(open);
|
|
2408
|
+
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange);
|
|
2406
2409
|
return normalizedOpen ? " open" : "";
|
|
2407
2410
|
}
|
|
2408
2411
|
function _attr_nonce() {
|
|
@@ -2419,17 +2422,17 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2419
2422
|
case "input":
|
|
2420
2423
|
assertExclusiveAttrs(data);
|
|
2421
2424
|
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange);
|
|
2422
|
-
else if (
|
|
2425
|
+
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value);
|
|
2423
2426
|
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange);
|
|
2424
2427
|
else break;
|
|
2425
2428
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
2426
2429
|
break;
|
|
2427
2430
|
case "select":
|
|
2428
2431
|
case "textarea":
|
|
2429
|
-
if (
|
|
2432
|
+
if ("value" in data || data.valueChange) skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
2430
2433
|
break;
|
|
2431
2434
|
case "option":
|
|
2432
|
-
if (data
|
|
2435
|
+
if ("value" in data) {
|
|
2433
2436
|
result += _attr_option_value(data.value);
|
|
2434
2437
|
skip = /^value$|[\s/>"'=]/;
|
|
2435
2438
|
}
|
|
@@ -2532,9 +2535,6 @@ function normalizedValueMatches(a, b) {
|
|
|
2532
2535
|
function normalizeStrAttrValue(value) {
|
|
2533
2536
|
return value && value !== true || value === 0 ? value + "" : "";
|
|
2534
2537
|
}
|
|
2535
|
-
function normalizeBoolAttrValue(value) {
|
|
2536
|
-
if (value != null && value !== false) return true;
|
|
2537
|
-
}
|
|
2538
2538
|
//#endregion
|
|
2539
2539
|
//#region src/html/dynamic-tag.ts
|
|
2540
2540
|
const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
package/dist/dom/queue.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export type PendingRender = {
|
|
|
9
9
|
[PendingRenderProp.Gen]: number;
|
|
10
10
|
[PendingRenderProp.Pending]?: 0 | 1;
|
|
11
11
|
};
|
|
12
|
+
export declare let rendering: undefined | 0 | 1;
|
|
13
|
+
export declare let runId: number;
|
|
12
14
|
export declare const caughtError: WeakSet<unknown[]>;
|
|
13
15
|
export declare const placeholderShown: WeakSet<unknown[]>;
|
|
14
16
|
export declare let pendingEffects: unknown[];
|
|
15
|
-
export declare let pendingScopes: Scope[];
|
|
16
|
-
export declare let rendering: undefined | 0 | 1;
|
|
17
17
|
export declare function queueRender<T, U extends Scope = Scope>(scope: U, signal: Signal<T, U>, signalKey: number, value?: T, scopeKey?: number): void;
|
|
18
18
|
export declare function queuePendingRender(render: PendingRender): void;
|
|
19
19
|
export declare function queueEffect<S extends Scope, T extends ExecFn<S>>(scope: S, fn: T): void;
|
package/dist/dom/scope.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { AccessorProp, type BranchScope, type Scope } from "../common/types";
|
|
2
2
|
export declare function createScope($global: Scope[AccessorProp.Global], closestBranch?: BranchScope): Scope;
|
|
3
|
+
export declare function syncGen(scope: Scope): void;
|
|
4
|
+
export declare function _assert_init(scope: Scope, accessor: string): any;
|
|
5
|
+
export declare function collectScopes(fn: () => void): Scope[];
|
|
3
6
|
export declare function skipScope(): number;
|
|
4
7
|
export declare function findBranchWithKey(scope: Scope, key: string): BranchScope | undefined;
|
|
5
8
|
export declare function destroyBranch(branch: BranchScope): void;
|
package/dist/dom.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
|
-
export { _assert_hoist
|
|
2
|
+
export { _assert_hoist } from "./common/errors";
|
|
3
3
|
export { forIn, forOf, forTo, forUntil } from "./common/for";
|
|
4
4
|
export { _call } from "./common/helpers";
|
|
5
5
|
export { $signal, $signalReset } from "./dom/abort-signal";
|
|
@@ -12,5 +12,6 @@ export { _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_rac
|
|
|
12
12
|
export { _enable_catch, run } from "./dom/queue";
|
|
13
13
|
export { _content, _content_closures, _content_resume } from "./dom/renderer";
|
|
14
14
|
export { _el, _resume, _var_resume, init, initEmbedded, ready, } from "./dom/resume";
|
|
15
|
+
export { _assert_init } from "./dom/scope";
|
|
15
16
|
export { _child_setup, _closure, _closure_get, _const, _el_read, _for_closure, _hoist, _hoist_resume, _id, _if_closure, _let, _let_change, _or, _return, _return_change, _script, _var, _var_change, } from "./dom/signals";
|
|
16
17
|
export { _template } from "./dom/template";
|