marko 6.4.1 → 6.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cheatsheet.md +1 -1
- package/dist/common/constants/accessor-prop.d.ts +1 -0
- package/dist/common/constants/accessor-prop.debug.d.ts +1 -0
- package/dist/common/errors.d.ts +1 -0
- package/dist/common/opt.d.ts +1 -0
- package/dist/common/types.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 +6 -2
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +6 -2
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.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-ClV4kVOO.js → dom-C7F3yZTh.js} +119 -24
- package/dist/debug/{dom-LFrKxOk5.mjs → dom-uEY0J_H9.mjs} +78 -25
- package/dist/debug/dom.js +16 -4
- package/dist/debug/dom.mjs +14 -5
- package/dist/debug/html.js +288 -78
- package/dist/debug/html.mjs +288 -79
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +2 -2
- 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/dom.d.ts +1 -0
- 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 +4 -2
- package/dist/dom/dynamic-tag-var.feat.mjs +4 -3
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/load.d.ts +1 -0
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +4 -1
- package/dist/{dom-CNglVi8P.js → dom-CtIT8Mpr.js} +201 -138
- package/dist/{dom-DfP3MCo0.mjs → dom-DHg9YChM.mjs} +60 -27
- package/dist/dom.d.ts +3 -3
- package/dist/dom.js +41 -34
- package/dist/dom.mjs +12 -5
- package/dist/html/assets.d.ts +12 -6
- package/dist/html/attrs.d.ts +1 -0
- package/dist/html/compat.d.ts +10 -2
- package/dist/html/serializer.d.ts +1 -0
- package/dist/html/writer.d.ts +8 -0
- package/dist/html.d.ts +1 -1
- package/dist/html.js +207 -62
- package/dist/html.mjs +207 -62
- package/dist/translator/index.js +432 -213
- package/dist/translator/util/bindings.d.ts +9 -1
- package/dist/translator/util/constants/structure-kind.d.ts +1 -0
- package/dist/translator/util/known-tag.d.ts +2 -1
- package/dist/translator/util/module-read.d.ts +21 -0
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/util/runtime.d.ts +2 -0
- package/dist/translator/util/sections.d.ts +5 -1
- package/dist/translator/util/structure.d.ts +1 -0
- package/package.json +3 -3
- package/tags-html.d.ts +6 -5
package/cheatsheet.md
CHANGED
|
@@ -130,7 +130,7 @@ Don't fetch while rendering: start data loads early, pass the promise through th
|
|
|
130
130
|
- Repeated attr tags (many `<@tab ...>`) arrive as the singular prop `input.tab`: the first tab's attrs, made iterable, not an array: `input.tab[i]` and `input.tab.length` are undefined. To index or count, spread first: `<const/tabs=[...input.tab ?? []]>` then `tabs[active]`/`tabs.length`. Looping directly is fine: `<for|tab| of=input.tab>`.
|
|
131
131
|
- Text: `0` renders; `false`/`null`/`undefined`/`""`/`NaN` render nothing. `$!{html}` inserts raw HTML; it must be a balanced fragment (no truncated excerpts), or updating it after SSR removes the wrong nodes.
|
|
132
132
|
- Conditional attrs: `false`/`null` attrs are omitted from HTML. `aria-selected` etc. want strings: `aria-selected=(i === active && "true")`.
|
|
133
|
-
- `class=` / `style=` accept strings, objects, arrays: `class=["btn", { active }]`, `style={ color }` (single braces). `style=` keys are kebab-case CSS names (`{ "background-color": c }`); camelCase keys are written verbatim. `...input` spreads attrs onto a tag; `content=` passes body content as an attr.
|
|
133
|
+
- `class=` / `style=` accept strings, objects, arrays: `class=["btn", { active }]`, `style={ color }` (single braces). A toggled class may not repeat another name in its `class=` value (`["a", { a: on }]` is an error). `style=` keys are kebab-case CSS names (`{ "background-color": c }`); camelCase keys are written verbatim. `...input` spreads attrs onto a tag; `content=` passes body content as an attr.
|
|
134
134
|
- `<define/Panel|input|>` declares a local tag inline; `<${Toolbar.Undo}/>` renders a dynamic tag (falsy name → content only).
|
|
135
135
|
- `<select value:=picked>`: every `<option>` needs `value=`; `multiple` binds an array.
|
|
136
136
|
- `<id/x>` mints a collision-free id for label/input wiring (`<label for=x>`/`<input id=x>`); don't hardcode ids in reusable tags; `<id/x=input.id>` reuses a caller's.
|
|
@@ -4,6 +4,7 @@ export declare const AbortControllers = "A";
|
|
|
4
4
|
export declare const AbortScopes = "B";
|
|
5
5
|
export declare const AwaitCounter = "O";
|
|
6
6
|
export declare const BranchAccessor = "C";
|
|
7
|
+
export declare const BranchRenders = "BR";
|
|
7
8
|
export declare const BranchScopes = "D";
|
|
8
9
|
export declare const CatchContent = "E";
|
|
9
10
|
export declare const ClosestBranch = "F";
|
|
@@ -4,6 +4,7 @@ export declare const AbortControllers = "#AbortControllers";
|
|
|
4
4
|
export declare const AbortScopes = "#AbortScopes";
|
|
5
5
|
export declare const AwaitCounter = "#AwaitCounter";
|
|
6
6
|
export declare const BranchAccessor = "#BranchAccessor";
|
|
7
|
+
export declare const BranchRenders = "#BranchRenders";
|
|
7
8
|
export declare const BranchScopes = "#BranchScopes";
|
|
8
9
|
export declare const CatchContent = "#CatchContent";
|
|
9
10
|
export declare const ClosestBranch = "#ClosestBranch";
|
package/dist/common/errors.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function assertValidAttrValue(name: string, value: unknown): void;
|
|
2
|
+
export declare function _assert_class_toggles(classes: string, toggles: string[]): void;
|
|
2
3
|
export declare function assertValidTextValue(value: unknown): void;
|
|
3
4
|
export declare function assertValidLoopKey(key: unknown, seenKeys?: Set<unknown>): void;
|
|
4
5
|
export declare function assertValidList(value: unknown): void;
|
package/dist/common/opt.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type Opt<T> = OneMany<T> | undefined | null;
|
|
|
3
3
|
export declare function toArray<T>(oneMany: OneMany<T>): [T, ...T[]];
|
|
4
4
|
export declare function toArray<T>(opt: Opt<T>): T[];
|
|
5
5
|
export declare function forEach<T>(opt: Opt<T>, cb: (item: T) => void): void;
|
|
6
|
+
export declare function reduce<T, R>(opt: Opt<T>, cb: (acc: R, item: T) => R, acc: R): R;
|
|
6
7
|
export declare function push<T>(opt: Opt<T>, item: T): OneMany<T>;
|
|
7
8
|
export declare function push<T>(oneMany: OneMany<T>, item: T): T[];
|
|
8
9
|
export declare function concat<T>(opt: Opt<T>, other: Opt<T>): Opt<T>;
|
package/dist/common/types.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface BranchScope extends Scope {
|
|
|
21
21
|
[AccessorProp.PlaceholderBranch]: BranchScope | undefined | 0;
|
|
22
22
|
[AccessorProp.TryBranch]: BranchScope | undefined;
|
|
23
23
|
[AccessorProp.PendingRenders]: PendingRender[] | 0 | undefined;
|
|
24
|
+
[AccessorProp.BranchRenders]: PendingRender | undefined;
|
|
24
25
|
[AccessorProp.DetachedAwait]: Renderer | 0 | undefined;
|
|
25
26
|
[AccessorProp.PendingScopes]: Scope[] | void;
|
|
26
27
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Hn as PendingEffectScopes, In as ClosestBranch, Mn as Pending, Nn as Scope, Un as PendingEffects, Vn as ParentBranch, Wn as PendingRenders, b as renderCatch, fn as queueAsyncRender, pn as queueEffect, un as installCatch, x as runPendingEffects } from "../dom-uEY0J_H9.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-C7F3yZTh.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 { A as _attr_input_checked_script, F as _attr_input_value_script, O as _attr_input_checkedValue_script, W as controllableScripts } from "../dom-uEY0J_H9.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-C7F3yZTh.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 { W as controllableScripts, w as _attr_details_or_dialog_open_script } from "../dom-uEY0J_H9.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-C7F3yZTh.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 { R as _attr_select_value_script, W as controllableScripts } from "../dom-uEY0J_H9.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-C7F3yZTh.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 { F as _attr_input_value_script, W as controllableScripts } from "../dom-uEY0J_H9.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 { B as
|
|
1
|
+
import { B as _controllable_open, H as _controllable_textarea, U as controllableRenders, V as _controllable_select, z as _controllable_input } from "../dom-uEY0J_H9.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-C7F3yZTh.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 { Dn as withBranches, _ as dynamicTagScript, rn as DYNAMIC_TAG_SCRIPT_REGISTER_ID, wt as _resumed } from "../dom-uEY0J_H9.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,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-C7F3yZTh.js");
|
|
3
3
|
//#region src/dom/dynamic-tag-var.feat.ts
|
|
4
|
-
require_control_flow.
|
|
4
|
+
require_control_flow.installBranchRenders();
|
|
5
|
+
require_control_flow.installDynamicTagVar((scope, branch, scopeKey, renderer) => {
|
|
6
|
+
branch[require_control_flow.BranchRenders] = require_control_flow.createBranchRenders(scope, scopeKey);
|
|
7
|
+
if (typeof renderer === "string") branch[require_control_flow.TagVariable](() => require_control_flow._el_read(branch[require_control_flow.StartNode]));
|
|
8
|
+
});
|
|
5
9
|
//#endregion
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn as BranchRenders, It as _el_read, Kn as StartNode, cn as createBranchRenders, ln as installBranchRenders, qn as TagVariable, v as installDynamicTagVar } from "../dom-uEY0J_H9.mjs";
|
|
2
2
|
//#region src/dom/dynamic-tag-var.feat.ts
|
|
3
|
-
|
|
3
|
+
installBranchRenders();
|
|
4
|
+
installDynamicTagVar((scope, branch, scopeKey, renderer) => {
|
|
5
|
+
branch[BranchRenders] = createBranchRenders(scope, scopeKey);
|
|
6
|
+
if (typeof renderer === "string") branch[TagVariable](() => _el_read(branch[StartNode]));
|
|
7
|
+
});
|
|
4
8
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-C7F3yZTh.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 { $t as destroyBranch, Gn as PlaceholderBranch, in as PLACEHOLDER_DISMISS_REGISTER_ID, wt as _resumed } from "../dom-uEY0J_H9.mjs";
|
|
2
2
|
//#region src/dom/placeholder.feat.ts
|
|
3
3
|
_resumed[PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
|
|
4
4
|
if (tryBranch["#PlaceholderBranch"]) {
|
|
@@ -23,6 +23,7 @@ const AbortControllers = "#AbortControllers";
|
|
|
23
23
|
const AbortScopes = "#AbortScopes";
|
|
24
24
|
const AwaitCounter = "#AwaitCounter";
|
|
25
25
|
const BranchAccessor = "#BranchAccessor";
|
|
26
|
+
const BranchRenders = "#BranchRenders";
|
|
26
27
|
const BranchScopes = "#BranchScopes";
|
|
27
28
|
const CatchContent = "#CatchContent";
|
|
28
29
|
const ClosestBranch = "#ClosestBranch";
|
|
@@ -201,6 +202,16 @@ function assertValidAttrValue(name, value) {
|
|
|
201
202
|
const unrenderable = describeUnrenderable(value);
|
|
202
203
|
if (unrenderable) throw new Error(`The \`${name}\` attribute cannot be ${unrenderable}.`);
|
|
203
204
|
}
|
|
205
|
+
function _assert_class_toggles(classes, toggles) {
|
|
206
|
+
{
|
|
207
|
+
const written = new Set(classes.split(" "));
|
|
208
|
+
for (const toggle of toggles) {
|
|
209
|
+
const names = new Set(toggle.split(" "));
|
|
210
|
+
for (const name of names) if (written.has(name)) throw new Error(`The toggled class \`${name}\` is also written by another part of the \`class\` value; a toggled class may appear only once.`);
|
|
211
|
+
for (const name of names) written.add(name);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
204
215
|
function assertValidTextValue(value) {
|
|
205
216
|
const unrenderable = describeUnrenderable(value);
|
|
206
217
|
if (unrenderable) throw new Error(`Text content cannot be ${unrenderable}.`);
|
|
@@ -332,16 +343,19 @@ let rendering;
|
|
|
332
343
|
let runId = 2;
|
|
333
344
|
let pendingEffects = [];
|
|
334
345
|
let pendingRenders = [];
|
|
335
|
-
const
|
|
346
|
+
const ranRenders = /*@__PURE__*/ new WeakMap();
|
|
336
347
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
337
348
|
let render;
|
|
338
349
|
if (signalKey >= 0 && (render = scope[signalKey])) {
|
|
339
350
|
render[Value] = value;
|
|
340
|
-
if (render["gen"] === runId || catchEnabled && render["pending"])
|
|
351
|
+
if (render["gen"] === runId || catchEnabled && render["pending"]) {
|
|
352
|
+
if (!render["pending"] && ranRenders.get(render) === runId) console.error("A render was queued again after it ran in this update, so its latest value is dropped. This is a bug in Marko.");
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
341
355
|
render["gen"] = runId;
|
|
342
356
|
} else {
|
|
343
357
|
render = {
|
|
344
|
-
["key"]: scopeKey *
|
|
358
|
+
["key"]: scopeKey * 1e6 + signalKey,
|
|
345
359
|
[Scope]: scope,
|
|
346
360
|
[Signal]: signal,
|
|
347
361
|
[Value]: value,
|
|
@@ -351,7 +365,7 @@ function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
|
351
365
|
}
|
|
352
366
|
queuePendingRender(render);
|
|
353
367
|
}
|
|
354
|
-
|
|
368
|
+
let queuePendingRender = (render) => {
|
|
355
369
|
let i = pendingRenders.push(render) - 1;
|
|
356
370
|
while (i) {
|
|
357
371
|
const parentIndex = i - 1 >> 1;
|
|
@@ -361,6 +375,34 @@ function queuePendingRender(render) {
|
|
|
361
375
|
i = parentIndex;
|
|
362
376
|
}
|
|
363
377
|
pendingRenders[i] = render;
|
|
378
|
+
};
|
|
379
|
+
function createBranchRenders(scope, scopeKey) {
|
|
380
|
+
return {
|
|
381
|
+
["key"]: scopeKey * 1e6 - 1,
|
|
382
|
+
[Scope]: scope,
|
|
383
|
+
[Signal]: runBranchRenders,
|
|
384
|
+
[Value]: [],
|
|
385
|
+
["gen"]: 0
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function installBranchRenders() {
|
|
389
|
+
const queue = queuePendingRender;
|
|
390
|
+
queuePendingRender = (render) => {
|
|
391
|
+
const branchRenders = render[Scope][ClosestBranch]?.[BranchRenders];
|
|
392
|
+
if (branchRenders) {
|
|
393
|
+
if (branchRenders["gen"] !== runId && !branchRenders["pending"]) branchRenders[Value] = [];
|
|
394
|
+
branchRenders["gen"] = runId;
|
|
395
|
+
const renders = branchRenders[Value];
|
|
396
|
+
if (!renders.length) queuePendingRender(branchRenders);
|
|
397
|
+
const prev = pendingRenders;
|
|
398
|
+
pendingRenders = renders;
|
|
399
|
+
queue(render);
|
|
400
|
+
pendingRenders = prev;
|
|
401
|
+
} else queue(render);
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function runBranchRenders(_scope, renders) {
|
|
405
|
+
runRenders(renders);
|
|
364
406
|
}
|
|
365
407
|
function queueEffect(scope, fn) {
|
|
366
408
|
pendingEffects.push(fn, scope);
|
|
@@ -412,26 +454,27 @@ function installCatch(catchEffects, wrapRender) {
|
|
|
412
454
|
runEffects = catchEffects;
|
|
413
455
|
runRender = wrapRender(runRender);
|
|
414
456
|
}
|
|
415
|
-
function runRenders() {
|
|
416
|
-
while (
|
|
417
|
-
const render =
|
|
418
|
-
const item =
|
|
457
|
+
function runRenders(renders = pendingRenders) {
|
|
458
|
+
while (renders.length) {
|
|
459
|
+
const render = renders[0];
|
|
460
|
+
const item = renders.pop();
|
|
419
461
|
if (render !== item) {
|
|
420
462
|
let i = 0;
|
|
421
|
-
const mid =
|
|
422
|
-
const key = (
|
|
463
|
+
const mid = renders.length >> 1;
|
|
464
|
+
const key = (renders[0] = item)["key"];
|
|
423
465
|
while (i < mid) {
|
|
424
466
|
let bestChild = (i << 1) + 1;
|
|
425
467
|
const right = bestChild + 1;
|
|
426
|
-
if (right <
|
|
427
|
-
if (
|
|
468
|
+
if (right < renders.length && renders[right]["key"] - renders[bestChild]["key"] < 0) bestChild = right;
|
|
469
|
+
if (renders[bestChild]["key"] - key >= 0) break;
|
|
428
470
|
else {
|
|
429
|
-
|
|
471
|
+
renders[i] = renders[bestChild];
|
|
430
472
|
i = bestChild;
|
|
431
473
|
}
|
|
432
474
|
}
|
|
433
|
-
|
|
475
|
+
renders[i] = item;
|
|
434
476
|
}
|
|
477
|
+
ranRenders.set(render, runId);
|
|
435
478
|
runRender(render);
|
|
436
479
|
}
|
|
437
480
|
}
|
|
@@ -675,9 +718,9 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
675
718
|
const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
|
|
676
719
|
const ownerSignal = (ownerScope) => {
|
|
677
720
|
const scopes = toArray(ownerScope[scopeAccessor]);
|
|
678
|
-
|
|
721
|
+
queueRender(ownerScope, () => {
|
|
679
722
|
for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
|
|
680
|
-
}, -1
|
|
723
|
+
}, -1);
|
|
681
724
|
};
|
|
682
725
|
ownerSignal._ = fn;
|
|
683
726
|
return ownerSignal;
|
|
@@ -687,8 +730,7 @@ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccess
|
|
|
687
730
|
const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
|
|
688
731
|
const prevKeyProp = `${PreviousKey}${ownerValueAccessor}`;
|
|
689
732
|
const ownerSignal = (ownerScope) => {
|
|
690
|
-
|
|
691
|
-
if (ownerScope["#Gen"] < runId && scopes.length) {
|
|
733
|
+
if (ownerScope["#Gen"] < runId) {
|
|
692
734
|
const nextKey = ownerScope[ownerValueAccessor];
|
|
693
735
|
queueRender(ownerScope, () => {
|
|
694
736
|
const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor);
|
|
@@ -701,7 +743,7 @@ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccess
|
|
|
701
743
|
}
|
|
702
744
|
} else for (const scope of toArray(ownerScope[scopeAccessor])) runLiveBranch(scope, fn);
|
|
703
745
|
if (map) map[prevKeyProp] = nextKey;
|
|
704
|
-
}, -1
|
|
746
|
+
}, -1);
|
|
705
747
|
}
|
|
706
748
|
};
|
|
707
749
|
ownerSignal._ = fn;
|
|
@@ -1232,6 +1274,14 @@ function _attr_class_items(element, items) {
|
|
|
1232
1274
|
function _attr_class_item(element, name, value) {
|
|
1233
1275
|
element.classList.toggle(name, !!value);
|
|
1234
1276
|
}
|
|
1277
|
+
function _attr_class_names(element, names, value) {
|
|
1278
|
+
let start = 0;
|
|
1279
|
+
let end;
|
|
1280
|
+
do {
|
|
1281
|
+
end = names.indexOf(" ", start);
|
|
1282
|
+
element.classList.toggle(names.slice(start, end >>> 0), !!value);
|
|
1283
|
+
} while (start = end + 1);
|
|
1284
|
+
}
|
|
1235
1285
|
function _attr_style(element, value) {
|
|
1236
1286
|
setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleObject) || void 0);
|
|
1237
1287
|
}
|
|
@@ -1975,6 +2025,7 @@ function patchDynamicTag(fn) {
|
|
|
1975
2025
|
_dynamic_tag = fn(_dynamic_tag);
|
|
1976
2026
|
}
|
|
1977
2027
|
let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagVar, inputIsArgs) => {
|
|
2028
|
+
const scopeOffsetAccessor = getTagVar && getDebugKey(+nodeAccessor.slice(nodeAccessor.lastIndexOf("/") + 1) + 1, "#scopeOffset");
|
|
1978
2029
|
const childScopeAccessor = BranchScopes$1 + nodeAccessor;
|
|
1979
2030
|
const rendererAccessor = ConditionalRenderer + nodeAccessor;
|
|
1980
2031
|
return (scope, newRenderer, getInput) => {
|
|
@@ -1985,7 +2036,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1985
2036
|
if (getTagVar) {
|
|
1986
2037
|
if (scope[childScopeAccessor]) {
|
|
1987
2038
|
scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
|
|
1988
|
-
|
|
2039
|
+
bindTagVar(scope, scope[childScopeAccessor], scope[scopeOffsetAccessor], normalizedRenderer);
|
|
1989
2040
|
} else getTagVar()(scope, void 0);
|
|
1990
2041
|
}
|
|
1991
2042
|
if (typeof renderer === "string") {
|
|
@@ -1994,7 +2045,10 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
|
|
|
1994
2045
|
setConditionalRenderer(scope[childScopeAccessor], `#${renderer.toLowerCase()}/0`, content, createAndSetupBranch);
|
|
1995
2046
|
if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${renderer.toLowerCase()}/0`]);
|
|
1996
2047
|
}
|
|
1997
|
-
} else if (renderer
|
|
2048
|
+
} else if (renderer) {
|
|
2049
|
+
setupBranch(renderer, scope[childScopeAccessor]);
|
|
2050
|
+
if (renderer["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
|
|
2051
|
+
}
|
|
1998
2052
|
}
|
|
1999
2053
|
if (normalizedRenderer) {
|
|
2000
2054
|
const childScope = scope[childScopeAccessor];
|
|
@@ -2030,9 +2084,9 @@ const _dynamic_tag_content = /*@__PURE__*/ withBranches((nodeAccessor) => {
|
|
|
2030
2084
|
renderer?.[LocalClosures]?.(scope[childScopeAccessor]);
|
|
2031
2085
|
};
|
|
2032
2086
|
});
|
|
2033
|
-
let
|
|
2087
|
+
let bindTagVar;
|
|
2034
2088
|
function installDynamicTagVar(bind) {
|
|
2035
|
-
|
|
2089
|
+
bindTagVar = bind;
|
|
2036
2090
|
}
|
|
2037
2091
|
function dynamicTagScript(branch) {
|
|
2038
2092
|
_attrs_script(branch, `#${branch[Renderer].toLowerCase()}/0`);
|
|
@@ -2185,7 +2239,6 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
|
2185
2239
|
if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
|
|
2186
2240
|
const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
|
|
2187
2241
|
if (typeof tagNameOrRenderer === "string") branch[`#${tagNameOrRenderer.toLowerCase()}/0`] = branch[StartNode] = branch[EndNode] = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer);
|
|
2188
|
-
else setupBranch(tagNameOrRenderer, branch);
|
|
2189
2242
|
return branch;
|
|
2190
2243
|
}
|
|
2191
2244
|
function bySecondArg(_item, index) {
|
|
@@ -2213,6 +2266,12 @@ Object.defineProperty(exports, "AwaitCounter", {
|
|
|
2213
2266
|
return AwaitCounter;
|
|
2214
2267
|
}
|
|
2215
2268
|
});
|
|
2269
|
+
Object.defineProperty(exports, "BranchRenders", {
|
|
2270
|
+
enumerable: true,
|
|
2271
|
+
get: function() {
|
|
2272
|
+
return BranchRenders;
|
|
2273
|
+
}
|
|
2274
|
+
});
|
|
2216
2275
|
Object.defineProperty(exports, "Clone", {
|
|
2217
2276
|
enumerable: true,
|
|
2218
2277
|
get: function() {
|
|
@@ -2333,6 +2392,12 @@ Object.defineProperty(exports, "TagVariable", {
|
|
|
2333
2392
|
return TagVariable;
|
|
2334
2393
|
}
|
|
2335
2394
|
});
|
|
2395
|
+
Object.defineProperty(exports, "_assert_class_toggles", {
|
|
2396
|
+
enumerable: true,
|
|
2397
|
+
get: function() {
|
|
2398
|
+
return _assert_class_toggles;
|
|
2399
|
+
}
|
|
2400
|
+
});
|
|
2336
2401
|
Object.defineProperty(exports, "_assert_hoist", {
|
|
2337
2402
|
enumerable: true,
|
|
2338
2403
|
get: function() {
|
|
@@ -2369,6 +2434,12 @@ Object.defineProperty(exports, "_attr_class_items", {
|
|
|
2369
2434
|
return _attr_class_items;
|
|
2370
2435
|
}
|
|
2371
2436
|
});
|
|
2437
|
+
Object.defineProperty(exports, "_attr_class_names", {
|
|
2438
|
+
enumerable: true,
|
|
2439
|
+
get: function() {
|
|
2440
|
+
return _attr_class_names;
|
|
2441
|
+
}
|
|
2442
|
+
});
|
|
2372
2443
|
Object.defineProperty(exports, "_attr_content", {
|
|
2373
2444
|
enumerable: true,
|
|
2374
2445
|
get: function() {
|
|
@@ -2867,6 +2938,12 @@ Object.defineProperty(exports, "addAwaitCounter", {
|
|
|
2867
2938
|
return addAwaitCounter;
|
|
2868
2939
|
}
|
|
2869
2940
|
});
|
|
2941
|
+
Object.defineProperty(exports, "bindTagVar", {
|
|
2942
|
+
enumerable: true,
|
|
2943
|
+
get: function() {
|
|
2944
|
+
return bindTagVar;
|
|
2945
|
+
}
|
|
2946
|
+
});
|
|
2870
2947
|
Object.defineProperty(exports, "controllableRenders", {
|
|
2871
2948
|
enumerable: true,
|
|
2872
2949
|
get: function() {
|
|
@@ -2891,6 +2968,12 @@ Object.defineProperty(exports, "createBranch", {
|
|
|
2891
2968
|
return createBranch;
|
|
2892
2969
|
}
|
|
2893
2970
|
});
|
|
2971
|
+
Object.defineProperty(exports, "createBranchRenders", {
|
|
2972
|
+
enumerable: true,
|
|
2973
|
+
get: function() {
|
|
2974
|
+
return createBranchRenders;
|
|
2975
|
+
}
|
|
2976
|
+
});
|
|
2894
2977
|
Object.defineProperty(exports, "destroyBranch", {
|
|
2895
2978
|
enumerable: true,
|
|
2896
2979
|
get: function() {
|
|
@@ -2957,6 +3040,12 @@ Object.defineProperty(exports, "insertChildNodes", {
|
|
|
2957
3040
|
return insertChildNodes;
|
|
2958
3041
|
}
|
|
2959
3042
|
});
|
|
3043
|
+
Object.defineProperty(exports, "installBranchRenders", {
|
|
3044
|
+
enumerable: true,
|
|
3045
|
+
get: function() {
|
|
3046
|
+
return installBranchRenders;
|
|
3047
|
+
}
|
|
3048
|
+
});
|
|
2960
3049
|
Object.defineProperty(exports, "installCatch", {
|
|
2961
3050
|
enumerable: true,
|
|
2962
3051
|
get: function() {
|
|
@@ -3053,6 +3142,12 @@ Object.defineProperty(exports, "runPendingEffects", {
|
|
|
3053
3142
|
return runPendingEffects;
|
|
3054
3143
|
}
|
|
3055
3144
|
});
|
|
3145
|
+
Object.defineProperty(exports, "setParentBranch", {
|
|
3146
|
+
enumerable: true,
|
|
3147
|
+
get: function() {
|
|
3148
|
+
return setParentBranch;
|
|
3149
|
+
}
|
|
3150
|
+
});
|
|
3056
3151
|
Object.defineProperty(exports, "setupBranch", {
|
|
3057
3152
|
enumerable: true,
|
|
3058
3153
|
get: function() {
|