marko 6.3.53 → 6.3.55
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/cheatsheet.md +1 -0
- package/dist/common/constants/renderer-prop.d.ts +0 -1
- package/dist/common/constants/renderer-prop.debug.d.ts +0 -1
- package/dist/common/helpers.d.ts +1 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-CBLlE8L-.js → dom-CI0Vojyk.js} +119 -78
- package/dist/debug/{dom-DQCODUa1.mjs → dom-tl43c2wO.mjs} +102 -79
- package/dist/debug/dom.js +9 -7
- package/dist/debug/dom.mjs +7 -8
- package/dist/debug/html.js +51 -25
- package/dist/debug/html.mjs +51 -25
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +4 -1
- package/dist/dom/controllable-input.feat.js +2 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +2 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +2 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +2 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/load.d.ts +2 -2
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/renderer.d.ts +2 -3
- package/dist/dom/signals.d.ts +1 -1
- package/dist/{dom-z4IMlmeO.mjs → dom-4udEPZaj.mjs} +71 -58
- package/dist/{dom-vuB05Hnj.js → dom-C1mr-TA7.js} +199 -176
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +40 -42
- package/dist/dom.mjs +6 -8
- package/dist/html/dynamic-tag.d.ts +2 -1
- package/dist/html/serializer.d.ts +3 -2
- package/dist/html/writer.d.ts +6 -5
- package/dist/html.js +34 -19
- package/dist/html.mjs +34 -19
- package/dist/translator/index.js +2890 -2688
- package/dist/translator/util/binding-has-prop.d.ts +1 -0
- package/dist/translator/util/branch-tag.d.ts +6 -1
- package/dist/translator/util/optional.d.ts +2 -0
- package/dist/translator/util/references.d.ts +20 -9
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +11 -6
- package/dist/translator/util/serialize-guard.d.ts +1 -1
- package/dist/translator/util/serialize-reasons.d.ts +3 -0
- package/dist/translator/util/set-tag-sections-downstream.d.ts +1 -1
- package/dist/translator/util/signals.d.ts +4 -1
- package/dist/translator/util/structure.d.ts +1 -1
- package/dist/translator/util/tag-name-type.d.ts +1 -1
- package/dist/translator/visitors/function.d.ts +1 -0
- package/dist/translator/visitors/import-declaration.d.ts +1 -0
- package/dist/translator/visitors/tag/custom-tag.d.ts +5 -0
- package/package.json +4 -4
- package/tags/try.d.marko +2 -0
- package/tags-html.d.ts +6 -0
package/cheatsheet.md
CHANGED
|
@@ -18,6 +18,7 @@ Marko 6 = HTML superset, not JSX and not Marko 4/5 syntax. `.marko` files are co
|
|
|
18
18
|
8. Transform in the handler when needed; number inputs give strings: `<input type="number" value=n valueChange(v) { n = +v }>`, or `value:parseFloat:=n`. Uncommitted edits (debounce, commit on blur) never sync through a `<script>`; that is rule 4's derive-by-effect trap. Pair a controllable `<let/value:=input.value>` with `<let/pending=null>`, show `<const/draft=pending ?? value>`, collect with `valueChange(v) { pending = v }`, and commit by assigning `value = pending; pending = null`. Prefer that to calling `input.valueChange(...)`, which throws unless every caller controls the tag.
|
|
19
19
|
9. Radio/checkbox groups: `checkedValue:=picked` on each input (shared var, distinct `value=`); the match is checked; array var for multi-checkbox. Dropdown: `<select value:=picked>`.
|
|
20
20
|
10. Module-level values, helpers and type aliases need `static`: `static const LIMIT = 10`, `static function fmt(n) {…}`, `static type Row = {…}`. Prefer it to `<const>` for anything that never changes: `<const/LIMIT=10>` runs per instance, `static` hoists it to a module constant. `server`/`client` narrow `static` to one platform (`client import { Chart } from "chart"`); the binding is `undefined` on the other, so read a `client` one only from `<script>`/handlers/`<lifecycle>`. Reading it while rendering throws `is not a function` during SSR.
|
|
21
|
+
11. `$!{html}` and the contents of `<html-script>`/`<html-style>` are written as-is: the latter are escaped only so they can't close the element, and run as code. Never put user-provided content in them.
|
|
21
22
|
|
|
22
23
|
## Canonical component
|
|
23
24
|
|
|
@@ -5,7 +5,6 @@ export declare const Params = "d";
|
|
|
5
5
|
export declare const Owner = "e";
|
|
6
6
|
export declare const Accessor = "f";
|
|
7
7
|
export declare const LocalClosures = "g";
|
|
8
|
-
export declare const LocalClosureValues = "h";
|
|
9
8
|
export declare const Embed = "i";
|
|
10
9
|
type Self = typeof import("./renderer-prop");
|
|
11
10
|
export type Value = Self[keyof Self];
|
|
@@ -5,7 +5,6 @@ export declare const Params = "params";
|
|
|
5
5
|
export declare const Owner = "owner";
|
|
6
6
|
export declare const Accessor = "accessor";
|
|
7
7
|
export declare const LocalClosures = "localClosures";
|
|
8
|
-
export declare const LocalClosureValues = "localClosureValues";
|
|
9
8
|
export declare const Embed = "embed";
|
|
10
9
|
type Self = typeof import("./renderer-prop.debug");
|
|
11
10
|
export type Value = Self[keyof Self];
|
package/dist/common/helpers.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare function escapeStyleValue(str: string): string;
|
|
|
8
8
|
export declare const toDelimitedString: (val: unknown, delimiter: string, stringify: (n: string, v: unknown) => string | undefined) => string;
|
|
9
9
|
export declare function isEventHandler(name: string): name is `on${string}`;
|
|
10
10
|
export declare function getEventHandlerName(name: `on${string}`): string;
|
|
11
|
+
export declare function hasKeys(obj: object): boolean;
|
|
11
12
|
export declare function isVoid(value: unknown): value is false | null | undefined;
|
|
12
13
|
export declare function isNotVoid(value: unknown): boolean;
|
|
13
14
|
export declare function isPromise(value: unknown): value is Promise<unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dn as Scope, En as Pending, Fn as PendingEffects, In as PendingRenders, Pn as ParentBranch, an as installCatch, in as caughtError, kn as ClosestBranch, on as placeholderShown, y as renderCatch } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
//#region src/dom/catch.feat.ts
|
|
3
3
|
const handlePendingTry = (fn, scope, branch) => {
|
|
4
4
|
while (branch) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-CI0Vojyk.js");
|
|
3
3
|
//#region src/dom/controllable-input.feat.ts
|
|
4
4
|
require_control_flow.controllableScripts[0] = require_control_flow._attr_input_checked_script;
|
|
5
5
|
require_control_flow.controllableScripts[1] = require_control_flow._attr_input_checkedValue_script;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as _attr_input_checkedValue_script, H as controllableScripts, N as _attr_input_value_script, O as _attr_input_checked_script } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
//#region src/dom/controllable-input.feat.ts
|
|
3
3
|
controllableScripts[0] = _attr_input_checked_script;
|
|
4
4
|
controllableScripts[1] = _attr_input_checkedValue_script;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-CI0Vojyk.js");
|
|
3
3
|
//#region src/dom/controllable-open.feat.ts
|
|
4
4
|
require_control_flow.controllableScripts[4] = require_control_flow._attr_details_or_dialog_open_script;
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as controllableScripts, S as _attr_details_or_dialog_open_script } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
//#region src/dom/controllable-open.feat.ts
|
|
3
3
|
controllableScripts[4] = _attr_details_or_dialog_open_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-CI0Vojyk.js");
|
|
3
3
|
//#region src/dom/controllable-select.feat.ts
|
|
4
4
|
require_control_flow.controllableScripts[3] = require_control_flow._attr_select_value_script;
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as controllableScripts, I as _attr_select_value_script } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
//#region src/dom/controllable-select.feat.ts
|
|
3
3
|
controllableScripts[3] = _attr_select_value_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-CI0Vojyk.js");
|
|
3
3
|
//#region src/dom/controllable-textarea.feat.ts
|
|
4
4
|
require_control_flow.controllableScripts[2] = require_control_flow._attr_input_value_script;
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as controllableScripts, N as _attr_input_value_script } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
//#region src/dom/controllable-textarea.feat.ts
|
|
3
3
|
controllableScripts[2] = _attr_input_value_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as _controllable_textarea, L as _controllable_input, R as _controllable_open, V as controllableRenders, z as _controllable_select } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
import "./controllable-input.feat.mjs";
|
|
3
3
|
import "./controllable-open.feat.mjs";
|
|
4
4
|
import "./controllable-select.feat.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-CI0Vojyk.js");
|
|
3
3
|
//#region src/dom/dynamic-tag-script.feat.ts
|
|
4
4
|
require_control_flow._resumed[require_control_flow.DYNAMIC_TAG_SCRIPT_REGISTER_ID] = require_control_flow.withBranches(require_control_flow.dynamicTagScript);
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $t as DYNAMIC_TAG_SCRIPT_REGISTER_ID, bt as _resumed, g as dynamicTagScript, xn as withBranches } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
//#region src/dom/dynamic-tag-script.feat.ts
|
|
3
3
|
_resumed[DYNAMIC_TAG_SCRIPT_REGISTER_ID] = withBranches(dynamicTagScript);
|
|
4
4
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-CI0Vojyk.js");
|
|
3
3
|
//#region src/dom/dynamic-tag-var.feat.ts
|
|
4
4
|
require_control_flow.installDynamicTagVar((branch) => branch[require_control_flow.TagVariable](() => require_control_flow._el_read(branch[require_control_flow.StartNode])));
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as _el_read, Rn as StartNode, _ as installDynamicTagVar, zn as TagVariable } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
//#region src/dom/dynamic-tag-var.feat.ts
|
|
3
3
|
installDynamicTagVar((branch) => branch[TagVariable](() => _el_read(branch[StartNode])));
|
|
4
4
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-CI0Vojyk.js");
|
|
3
3
|
//#region src/dom/placeholder.feat.ts
|
|
4
4
|
require_control_flow._resumed[require_control_flow.PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
|
|
5
5
|
if (tryBranch["#PlaceholderBranch"]) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ln as PlaceholderBranch, Yt as destroyBranch, bt as _resumed, en as PLACEHOLDER_DISMISS_REGISTER_ID } from "../dom-tl43c2wO.mjs";
|
|
2
2
|
//#region src/dom/placeholder.feat.ts
|
|
3
3
|
_resumed[PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
|
|
4
4
|
if (tryBranch["#PlaceholderBranch"]) {
|
|
@@ -59,7 +59,6 @@ const Params = "params";
|
|
|
59
59
|
const Owner = "owner";
|
|
60
60
|
const Accessor = "accessor";
|
|
61
61
|
const LocalClosures = "localClosures";
|
|
62
|
-
const LocalClosureValues = "localClosureValues";
|
|
63
62
|
//#endregion
|
|
64
63
|
//#region src/common/helpers.ts
|
|
65
64
|
const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
@@ -731,20 +730,24 @@ function _closure(...closureSignals) {
|
|
|
731
730
|
}
|
|
732
731
|
};
|
|
733
732
|
}
|
|
734
|
-
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
|
|
735
|
-
const closureSignal = ((scope) => {
|
|
733
|
+
function _closure_get(valueAccessor, fn, getOwnerScope, resumeId, ownerValueAccessor) {
|
|
734
|
+
const closureSignal = ((scope, resumed) => {
|
|
735
|
+
const ownerScope = getOwnerScope ? getOwnerScope(scope) : scope["_"];
|
|
736
736
|
scope[closureSignal[SignalIndexAccessor]] = closureSignal[Index];
|
|
737
|
-
fn(scope);
|
|
738
|
-
subscribeToScopeSet(
|
|
737
|
+
if (!resumed || ownerValueAccessor in ownerScope) fn(scope);
|
|
738
|
+
subscribeToScopeSet(ownerScope, closureSignal[ScopeInstancesAccessor], scope);
|
|
739
739
|
});
|
|
740
740
|
closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
|
|
741
741
|
closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
|
|
742
|
-
if (resumeId)
|
|
742
|
+
if (resumeId) {
|
|
743
|
+
ownerValueAccessor = valueAccessor;
|
|
744
|
+
_resumed[resumeId] = (scope) => closureSignal(scope, 1);
|
|
745
|
+
}
|
|
743
746
|
return closureSignal;
|
|
744
747
|
}
|
|
745
748
|
function _child_setup(setup) {
|
|
746
749
|
setup._ = (scope, owner) => {
|
|
747
|
-
scope["_"]
|
|
750
|
+
scope["_"] ||= owner;
|
|
748
751
|
queueRender(scope, setup, -1);
|
|
749
752
|
};
|
|
750
753
|
return setup;
|
|
@@ -788,8 +791,9 @@ function _el_read(value) {
|
|
|
788
791
|
}
|
|
789
792
|
function* traverse(scope, path, args, i = path.length - 1) {
|
|
790
793
|
if (rendering) _hoist_read_error();
|
|
791
|
-
if (scope) if (Symbol.iterator in scope)
|
|
792
|
-
|
|
794
|
+
if (scope) if (Symbol.iterator in scope) {
|
|
795
|
+
for (const childScope of scope.values()) if (childScope["#Gen"] !== 0) yield* traverse(childScope, path, args, i);
|
|
796
|
+
} else {
|
|
793
797
|
const item = scope[path[i]];
|
|
794
798
|
if (i) yield* traverse(item, path, args, i - 1);
|
|
795
799
|
else yield typeof item === "function" ? item(...args) : item;
|
|
@@ -1129,7 +1133,7 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
|
1129
1133
|
} : (branch) => {
|
|
1130
1134
|
walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
|
|
1131
1135
|
};
|
|
1132
|
-
return (owner) => {
|
|
1136
|
+
return _resumed[id] = (owner) => {
|
|
1133
1137
|
return {
|
|
1134
1138
|
["id"]: id,
|
|
1135
1139
|
[Clone]: clone,
|
|
@@ -1140,16 +1144,29 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
|
1140
1144
|
};
|
|
1141
1145
|
};
|
|
1142
1146
|
}
|
|
1143
|
-
function _content_resume(
|
|
1144
|
-
return _resumed[id] =
|
|
1147
|
+
function _content_resume(renderer, hasLocalValues = 0) {
|
|
1148
|
+
return _resumed[renderer()["id"]] = (owner, ...values) => {
|
|
1149
|
+
for (let i = values.length, scope = owner; i > hasLocalValues;) {
|
|
1150
|
+
const closures = values[--i];
|
|
1151
|
+
for (const key in closures) if (!(key in scope)) scope[key] = closures[key];
|
|
1152
|
+
scope = scope["_"];
|
|
1153
|
+
}
|
|
1154
|
+
return renderer(owner, values[hasLocalValues - 1]);
|
|
1155
|
+
};
|
|
1145
1156
|
}
|
|
1146
1157
|
function _content_closures(renderer, closureFns) {
|
|
1147
1158
|
const closureSignals = {};
|
|
1148
1159
|
for (const key in closureFns) closureSignals[key] = _const(key, closureFns[key]);
|
|
1149
1160
|
return (owner, closureValues) => {
|
|
1150
1161
|
const instance = renderer(owner);
|
|
1151
|
-
instance[
|
|
1152
|
-
instance[
|
|
1162
|
+
const clone = instance[Clone];
|
|
1163
|
+
const setClosures = instance[LocalClosures] = (branch) => {
|
|
1164
|
+
for (const key in closureSignals) closureSignals[key](branch, closureValues[key]);
|
|
1165
|
+
};
|
|
1166
|
+
instance[Clone] = (branch, ns) => {
|
|
1167
|
+
clone(branch, ns);
|
|
1168
|
+
setClosures(branch);
|
|
1169
|
+
};
|
|
1153
1170
|
return instance;
|
|
1154
1171
|
};
|
|
1155
1172
|
}
|
|
@@ -1294,7 +1311,7 @@ function _attr_content(scope, nodeAccessor, value) {
|
|
|
1294
1311
|
setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch);
|
|
1295
1312
|
if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
|
|
1296
1313
|
}
|
|
1297
|
-
|
|
1314
|
+
content?.[LocalClosures]?.(scope[BranchScopes$1 + nodeAccessor]);
|
|
1298
1315
|
}
|
|
1299
1316
|
function _attrs_script(scope, nodeAccessor) {
|
|
1300
1317
|
const el = scope[nodeAccessor];
|
|
@@ -1690,18 +1707,20 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1690
1707
|
return awaitBranch;
|
|
1691
1708
|
};
|
|
1692
1709
|
const awaitPromise = (scope, promise) => {
|
|
1693
|
-
if (!isPromise(
|
|
1710
|
+
if (!isPromise(scope[promiseAccessor])) scope[promiseAccessor] = 0;
|
|
1694
1711
|
let awaitBranch = scope[branchAccessor];
|
|
1695
|
-
const tryPlaceholder = findBranchWithKey(scope, PlaceholderContent);
|
|
1712
|
+
const tryPlaceholder = (isPromise(promise) || scope[promiseAccessor]) && findBranchWithKey(scope, "#PlaceholderContent");
|
|
1696
1713
|
const tryBranch = tryPlaceholder || awaitBranch;
|
|
1697
|
-
if (!
|
|
1698
|
-
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1714
|
+
if (!tryBranch) {
|
|
1715
|
+
const replay = scope[promiseAccessor] = () => replay === scope[promiseAccessor] && awaitPromise(scope, promise);
|
|
1716
|
+
const awaitCounter = findBranchWithKey(scope, PlaceholderContent)?.[AwaitCounter];
|
|
1717
|
+
if (awaitCounter?.i) {
|
|
1718
|
+
const complete = awaitCounter.c;
|
|
1719
|
+
awaitCounter.c = () => complete() || queueAsyncRender(scope, replay);
|
|
1720
|
+
}
|
|
1703
1721
|
return;
|
|
1704
1722
|
}
|
|
1723
|
+
if (!isPromise(promise)) return scope[promiseAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1705
1724
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1706
1725
|
placeholderShown.add(pendingEffects);
|
|
1707
1726
|
if (!tryPlaceholder && !awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
@@ -1712,7 +1731,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1712
1731
|
if (detachedParent === anchor.parentNode) anchor.remove();
|
|
1713
1732
|
else anchor.replaceWith(detachedParent);
|
|
1714
1733
|
}
|
|
1715
|
-
}
|
|
1734
|
+
}
|
|
1716
1735
|
});
|
|
1717
1736
|
if (!scope[promiseAccessor]) {
|
|
1718
1737
|
if (awaitBranch) awaitBranch[PendingRenders] ||= [];
|
|
@@ -1728,7 +1747,8 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1728
1747
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1729
1748
|
const referenceNode = scope[nodeAccessor];
|
|
1730
1749
|
scope[promiseAccessor] = 0;
|
|
1731
|
-
if (scope["#ClosestBranch"]?.["#Gen"] === 0) {
|
|
1750
|
+
if (!scope[branchAccessor] || scope["#ClosestBranch"]?.["#Gen"] === 0) {
|
|
1751
|
+
if (!scope[branchAccessor]) awaitPromise(scope, data);
|
|
1732
1752
|
awaitCounter.c();
|
|
1733
1753
|
run();
|
|
1734
1754
|
return;
|
|
@@ -1775,11 +1795,7 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1775
1795
|
return (scope) => {
|
|
1776
1796
|
const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
|
|
1777
1797
|
scope[branchAccessor][PendingScopes] = pendingScopes;
|
|
1778
|
-
|
|
1779
|
-
if (typeof resolveSync === "function") {
|
|
1780
|
-
scope[promiseAccessor] = 0;
|
|
1781
|
-
resolveSync();
|
|
1782
|
-
}
|
|
1798
|
+
if (typeof scope[promiseAccessor] === "function") scope[promiseAccessor]();
|
|
1783
1799
|
};
|
|
1784
1800
|
}
|
|
1785
1801
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, PlaceholderContent)) {
|
|
@@ -1905,18 +1921,19 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1905
1921
|
return (scope, newRenderer, getInput) => {
|
|
1906
1922
|
const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
|
1907
1923
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
|
|
1908
|
-
|
|
1924
|
+
const renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
|
|
1925
|
+
setConditionalRenderer(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer);
|
|
1909
1926
|
if (getTagVar) if (scope[childScopeAccessor]) {
|
|
1910
1927
|
scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
|
|
1911
1928
|
if (typeof normalizedRenderer === "string") bindNativeTagVar?.(scope[childScopeAccessor]);
|
|
1912
1929
|
} else getTagVar()(scope, void 0);
|
|
1913
|
-
if (typeof
|
|
1930
|
+
if (typeof renderer === "string") {
|
|
1914
1931
|
if (getContent) {
|
|
1915
1932
|
const content = getContent(scope);
|
|
1916
|
-
setConditionalRenderer(scope[childScopeAccessor], `#${
|
|
1917
|
-
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${
|
|
1933
|
+
setConditionalRenderer(scope[childScopeAccessor], `#${renderer.toLowerCase()}/0`, content, createAndSetupBranch);
|
|
1934
|
+
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${renderer.toLowerCase()}/0`]);
|
|
1918
1935
|
}
|
|
1919
|
-
} else if (
|
|
1936
|
+
} else if (renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
|
|
1920
1937
|
}
|
|
1921
1938
|
if (normalizedRenderer) {
|
|
1922
1939
|
const childScope = scope[childScopeAccessor];
|
|
@@ -1926,7 +1943,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1926
1943
|
(getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope[nodeAccessor].tagName]);
|
|
1927
1944
|
if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
|
|
1928
1945
|
} else {
|
|
1929
|
-
|
|
1946
|
+
normalizedRenderer[LocalClosures]?.(childScope);
|
|
1930
1947
|
if (normalizedRenderer["params"]) if (inputIsArgs) normalizedRenderer[Params](childScope, normalizedRenderer._ ? args[0] : args);
|
|
1931
1948
|
else {
|
|
1932
1949
|
const inputWithContent = getContent ? {
|
|
@@ -1947,7 +1964,7 @@ const _dynamic_tag_content = /*@__PURE__*/ withBranches((nodeAccessor) => {
|
|
|
1947
1964
|
setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
|
|
1948
1965
|
if (renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
|
|
1949
1966
|
}
|
|
1950
|
-
|
|
1967
|
+
renderer?.[LocalClosures]?.(scope[childScopeAccessor]);
|
|
1951
1968
|
};
|
|
1952
1969
|
});
|
|
1953
1970
|
let bindNativeTagVar;
|
|
@@ -1977,7 +1994,7 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch)
|
|
|
1977
1994
|
referenceNode.remove();
|
|
1978
1995
|
}
|
|
1979
1996
|
}
|
|
1980
|
-
const loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
|
|
1997
|
+
const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, template, walks, setup, params) => {
|
|
1981
1998
|
const scopesAccessor = BranchScopes$1 + nodeAccessor;
|
|
1982
1999
|
const keyedScopesAccessor = KeyedScopes + nodeAccessor;
|
|
1983
2000
|
const renderer = _content("", template, walks, setup)();
|
|
@@ -2038,61 +2055,67 @@ const loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, wa
|
|
|
2038
2055
|
for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
2039
2056
|
return;
|
|
2040
2057
|
}
|
|
2041
|
-
|
|
2042
|
-
const sources = new Array(diffLen);
|
|
2043
|
-
const pred = new Array(diffLen);
|
|
2044
|
-
const tails = [];
|
|
2045
|
-
let tail = -1;
|
|
2046
|
-
let lo;
|
|
2047
|
-
let hi;
|
|
2048
|
-
let mid;
|
|
2049
|
-
for (let i = diffLen; i--;) sources[i] = newScopes[start + i]["#LoopIndex"] ?? -1;
|
|
2050
|
-
for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) {
|
|
2051
|
-
if (~tail) pred[i] = tails[tail];
|
|
2052
|
-
tails[++tail] = i;
|
|
2053
|
-
} else {
|
|
2054
|
-
lo = 0;
|
|
2055
|
-
hi = tail;
|
|
2056
|
-
while (lo < hi) {
|
|
2057
|
-
mid = (lo + hi) / 2 | 0;
|
|
2058
|
-
if (sources[tails[mid]] < sources[i]) lo = mid + 1;
|
|
2059
|
-
else hi = mid;
|
|
2060
|
-
}
|
|
2061
|
-
if (sources[i] < sources[tails[lo]]) {
|
|
2062
|
-
if (lo > 0) pred[i] = tails[lo - 1];
|
|
2063
|
-
tails[lo] = i;
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
hi = tails[tail];
|
|
2067
|
-
lo = tail + 1;
|
|
2068
|
-
while (lo-- > 0) {
|
|
2069
|
-
tails[lo] = hi;
|
|
2070
|
-
hi = pred[hi];
|
|
2071
|
-
}
|
|
2072
|
-
for (let i = diffLen; i--;) {
|
|
2073
|
-
if (~tail && i === tails[tail]) tail--;
|
|
2074
|
-
else insertBranchBefore(newScopes[start + i], parentNode, afterReference);
|
|
2075
|
-
afterReference = newScopes[start + i][StartNode];
|
|
2076
|
-
}
|
|
2058
|
+
reorder(newScopes, start, newEnd, parentNode, afterReference);
|
|
2077
2059
|
};
|
|
2078
2060
|
});
|
|
2079
2061
|
const _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
|
|
2080
2062
|
by ||= bySecondArg;
|
|
2081
2063
|
if (typeof by === "string") forOf(all, (item, i) => cb(item[by], [item, i]));
|
|
2082
2064
|
else forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
2083
|
-
});
|
|
2065
|
+
}, reorderKeyed);
|
|
2084
2066
|
const _for_in = /*@__PURE__*/ loop(([obj, by], cb) => {
|
|
2085
2067
|
by ||= byFirstArg;
|
|
2086
2068
|
forIn(obj, (key, value) => cb(by(key, value), [key, value]));
|
|
2087
|
-
});
|
|
2069
|
+
}, reorderKeyed);
|
|
2088
2070
|
const _for_to = /*@__PURE__*/ loop(([to, from, step, by], cb) => {
|
|
2089
2071
|
by ||= byFirstArg;
|
|
2090
2072
|
forTo(to, from, step, (v) => cb(by(v), [v]));
|
|
2091
|
-
});
|
|
2073
|
+
}, reorderKeyed);
|
|
2092
2074
|
const _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
|
|
2093
2075
|
by ||= byFirstArg;
|
|
2094
2076
|
forUntil(until, from, step, (v) => cb(by(v), [v]));
|
|
2095
|
-
});
|
|
2077
|
+
}, reorderKeyed);
|
|
2078
|
+
const _for_of_unkeyed = /*@__PURE__*/ loop(([all], cb) => forOf(all, (item, i) => cb(i, [item, i])));
|
|
2079
|
+
const _for_to_unkeyed = /*@__PURE__*/ loop(([to, from, step], cb) => forTo(to, from, step, (v) => cb(v, [v])));
|
|
2080
|
+
const _for_until_unkeyed = /*@__PURE__*/ loop(([until, from, step], cb) => forUntil(until, from, step, (v) => cb(v, [v])));
|
|
2081
|
+
function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
|
|
2082
|
+
const diffLen = newEnd - start + 1;
|
|
2083
|
+
const sources = new Array(diffLen);
|
|
2084
|
+
const pred = new Array(diffLen);
|
|
2085
|
+
const tails = [];
|
|
2086
|
+
let tail = -1;
|
|
2087
|
+
let lo;
|
|
2088
|
+
let hi;
|
|
2089
|
+
let mid;
|
|
2090
|
+
for (let i = diffLen; i--;) sources[i] = newScopes[start + i]["#LoopIndex"] ?? -1;
|
|
2091
|
+
for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) {
|
|
2092
|
+
if (~tail) pred[i] = tails[tail];
|
|
2093
|
+
tails[++tail] = i;
|
|
2094
|
+
} else {
|
|
2095
|
+
lo = 0;
|
|
2096
|
+
hi = tail;
|
|
2097
|
+
while (lo < hi) {
|
|
2098
|
+
mid = (lo + hi) / 2 | 0;
|
|
2099
|
+
if (sources[tails[mid]] < sources[i]) lo = mid + 1;
|
|
2100
|
+
else hi = mid;
|
|
2101
|
+
}
|
|
2102
|
+
if (sources[i] < sources[tails[lo]]) {
|
|
2103
|
+
if (lo > 0) pred[i] = tails[lo - 1];
|
|
2104
|
+
tails[lo] = i;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
hi = tails[tail];
|
|
2108
|
+
lo = tail + 1;
|
|
2109
|
+
while (lo-- > 0) {
|
|
2110
|
+
tails[lo] = hi;
|
|
2111
|
+
hi = pred[hi];
|
|
2112
|
+
}
|
|
2113
|
+
for (let i = diffLen; i--;) {
|
|
2114
|
+
if (~tail && i === tails[tail]) tail--;
|
|
2115
|
+
else insertBranchBefore(newScopes[start + i], parentNode, afterReference);
|
|
2116
|
+
afterReference = newScopes[start + i][StartNode];
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2096
2119
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
|
2097
2120
|
if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
|
|
2098
2121
|
const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
|
|
@@ -2563,6 +2586,12 @@ Object.defineProperty(exports, "_for_of", {
|
|
|
2563
2586
|
return _for_of;
|
|
2564
2587
|
}
|
|
2565
2588
|
});
|
|
2589
|
+
Object.defineProperty(exports, "_for_of_unkeyed", {
|
|
2590
|
+
enumerable: true,
|
|
2591
|
+
get: function() {
|
|
2592
|
+
return _for_of_unkeyed;
|
|
2593
|
+
}
|
|
2594
|
+
});
|
|
2566
2595
|
Object.defineProperty(exports, "_for_selector", {
|
|
2567
2596
|
enumerable: true,
|
|
2568
2597
|
get: function() {
|
|
@@ -2575,12 +2604,24 @@ Object.defineProperty(exports, "_for_to", {
|
|
|
2575
2604
|
return _for_to;
|
|
2576
2605
|
}
|
|
2577
2606
|
});
|
|
2607
|
+
Object.defineProperty(exports, "_for_to_unkeyed", {
|
|
2608
|
+
enumerable: true,
|
|
2609
|
+
get: function() {
|
|
2610
|
+
return _for_to_unkeyed;
|
|
2611
|
+
}
|
|
2612
|
+
});
|
|
2578
2613
|
Object.defineProperty(exports, "_for_until", {
|
|
2579
2614
|
enumerable: true,
|
|
2580
2615
|
get: function() {
|
|
2581
2616
|
return _for_until;
|
|
2582
2617
|
}
|
|
2583
2618
|
});
|
|
2619
|
+
Object.defineProperty(exports, "_for_until_unkeyed", {
|
|
2620
|
+
enumerable: true,
|
|
2621
|
+
get: function() {
|
|
2622
|
+
return _for_until_unkeyed;
|
|
2623
|
+
}
|
|
2624
|
+
});
|
|
2584
2625
|
Object.defineProperty(exports, "_global_read", {
|
|
2585
2626
|
enumerable: true,
|
|
2586
2627
|
get: function() {
|