marko 6.4.10 → 6.4.11
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 +0 -3
- package/dist/common/accessor.debug.d.ts +0 -3
- package/dist/common/helpers.d.ts +1 -1
- package/dist/common/types.d.ts +4 -3
- 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/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-C1V5vpFs.mjs → dom-DjUZd-9y.mjs} +198 -214
- package/dist/debug/{dom-DNB5yq3U.js → dom-mQ5mPBTF.js} +203 -213
- package/dist/debug/dom.js +5 -8
- package/dist/debug/dom.mjs +5 -9
- package/dist/debug/html.js +68 -87
- package/dist/debug/html.mjs +68 -87
- package/dist/dom/abort-signal.d.ts +1 -1
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +4 -4
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- 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 +3 -3
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/load.d.ts +3 -4
- package/dist/dom/placeholder.feat.js +1 -1
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +1 -2
- package/dist/dom/signals.d.ts +5 -7
- package/dist/{dom-C2-Flitp.js → dom-B8j2453O.js} +143 -155
- package/dist/{dom-DsHYWMCR.mjs → dom-HEWdZCCb.mjs} +119 -136
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +17 -21
- package/dist/dom.mjs +5 -9
- package/dist/html/assets.d.ts +3 -4
- package/dist/html/for.d.ts +0 -1
- package/dist/html/writer.d.ts +2 -2
- package/dist/html.d.ts +1 -1
- package/dist/html.js +60 -72
- package/dist/html.mjs +60 -72
- package/dist/translator/index.d.ts +0 -1
- package/dist/translator/index.js +4629 -4485
- package/dist/translator/interop/out-global.d.ts +5 -0
- package/dist/translator/util/assert.d.ts +4 -0
- package/dist/translator/util/entry-builder.d.ts +1 -1
- package/dist/translator/util/finalize-references.d.ts +2 -1
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/known-tag.d.ts +7 -1
- package/dist/translator/util/references.d.ts +11 -5
- package/dist/translator/util/runtime.d.ts +1 -0
- package/dist/translator/util/sections.d.ts +6 -1
- package/dist/translator/util/signals.d.ts +2 -1
- package/dist/translator/util/style-interpolation.d.ts +1 -1
- package/dist/translator/util/tag-name-type.d.ts +1 -0
- package/dist/translator/util/visitors.d.ts +1 -1
- package/dist/translator/util/write-guard.d.ts +2 -0
- package/dist/translator/visitors/program/index.d.ts +0 -4
- package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
- package/package.json +4 -4
- package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
- package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
package/dist/dom.mjs
CHANGED
|
@@ -69,7 +69,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
|
|
|
69
69
|
let renderer = _content(id, template, walks, setup, inputSignal)();
|
|
70
70
|
return renderer.mount = mount, renderer._ = renderer, _resumed[id] = renderer;
|
|
71
71
|
}, noop = (_) => 0;
|
|
72
|
-
import { $ as _attr_style_items, $t as _on, A as _attr_input_value, At as _closure_get, B as _controllable_select, Bt as _let, C as _attr_details_or_dialog_open_script, Ct as getRegisteredWithScope, D as _attr_input_checkedValue_script, Dt as readyFailed, E as _attr_input_checkedValue_default, Et as ready, F as _attr_select_value, Ft as _global_read, G as _attr_class, Gt as _script, Ht as _or, I as _attr_select_value_default, It as _hoist, J as _attr_class_names, Jt as _assert_init, K as _attr_class_item, Kt as _var, L as _attr_select_value_script, Lt as _hoist_resume, M as _attr_input_value_default, Mt as _el_read, N as _attr_input_value_dynamic_default, Nt as _for_closure, O as _attr_input_checked_default, P as _attr_input_value_script, Pt as _for_selector, Q as _attr_style_item, Qt as syncGen, R as _controllable_input, Rt as _id, S as _attr_details_or_dialog_open_default, St as _var_resume, T as _attr_input_checkedValue, Tt as initEmbedded, Ut as _return, V as _controllable_textarea, Vt as _let_change, W as _attr, Wt as _return_change, X as _attr_nonce, Xt as insertBranchBefore, Y as _attr_content, Yt as destroyBranch, Z as _attr_style, Zt as removeAndDestroyBranch, _ as patchDynamicTag, _n as
|
|
72
|
+
import { $ as _attr_style_items, $t as _on, A as _attr_input_value, At as _closure_get, B as _controllable_select, Bt as _let, C as _attr_details_or_dialog_open_script, Ct as getRegisteredWithScope, D as _attr_input_checkedValue_script, Dt as readyFailed, E as _attr_input_checkedValue_default, Et as ready, F as _attr_select_value, Ft as _global_read, G as _attr_class, Gt as _script, Ht as _or, I as _attr_select_value_default, It as _hoist, J as _attr_class_names, Jt as _assert_init, K as _attr_class_item, Kt as _var, L as _attr_select_value_script, Lt as _hoist_resume, M as _attr_input_value_default, Mt as _el_read, N as _attr_input_value_dynamic_default, Nt as _for_closure, O as _attr_input_checked_default, P as _attr_input_value_script, Pt as _for_selector, Q as _attr_style_item, Qt as syncGen, R as _controllable_input, Rt as _id, S as _attr_details_or_dialog_open_default, St as _var_resume, T as _attr_input_checkedValue, Tt as initEmbedded, Ut as _return, V as _controllable_textarea, Vt as _let_change, W as _attr, Wt as _return_change, X as _attr_nonce, Xt as insertBranchBefore, Y as _attr_content, Yt as destroyBranch, Z as _attr_style, Zt as removeAndDestroyBranch, _ as patchDynamicTag, _n as forUntil, _t as createBranch, a as _for_in, at as _html, b as startAwait, bn as _hoist_read_error, bt as _el, c as _for_to, cn as queueEffect, ct as _style_shell, d as _for_until_unkeyed, dn as run, dt as _to_text, en as $signal, et as _attrs, f as _if, fn as runEffects, ft as _content, gn as forTo, gt as createAndSetupBranch, hn as forOf, ht as _return_setup, i as _dynamic_tag_content, it as _attrs_script, j as _attr_input_value_attribute_default, jt as _const, k as _attr_input_checked_script, kt as _closure, l as _for_to_unkeyed, ln as queueRender, lt as _text, m as _try, mn as forIn, mt as _content_resume, n as _await_promise, nn as onAbort, nt as _attrs_partial, o as _for_of, on as prepareEffects, ot as _lifecycle, p as _show, pn as runId, pt as _content_closures, q as _attr_class_items, qt as _var_change, r as _dynamic_tag, rt as _attrs_partial_content, s as _for_of_unkeyed, sn as queueAsyncRender, st as _style_rule_item, t as _await_content, tn as $signalReset, tt as _attrs_content, u as _for_until, un as rendering, ut as _text_content, v as renderCatch, vn as _assert_class_toggles, vt as setupBranch, w as _attr_input_checked, wt as init, x as _attr_details_or_dialog_open, xn as _call, xt as _resumed, yn as _assert_hoist, yt as _dynamic_tag_var_resume, z as _controllable_open, zt as _if_closure } from "./dom-HEWdZCCb.mjs";
|
|
73
73
|
// src/common/attr-tag.ts
|
|
74
74
|
function attrTag(attrs) {
|
|
75
75
|
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
@@ -102,9 +102,7 @@ function mount(input = {}, reference, position) {
|
|
|
102
102
|
case "afterend": parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
|
103
103
|
}
|
|
104
104
|
let curValue, args = this.d, effects = prepareEffects((_) => {
|
|
105
|
-
branch = createBranch($global, this, void 0, parentNode), branch.T = (newValue) =>
|
|
106
|
-
curValue = newValue;
|
|
107
|
-
}, this.c?.(branch), args?.(branch, input);
|
|
105
|
+
branch = createBranch($global, this, void 0, parentNode), branch.T = (newValue) => curValue = newValue, this.c?.(branch), args?.(branch, input);
|
|
108
106
|
});
|
|
109
107
|
return insertBranchBefore(branch, parentNode, nextSibling), runEffects(effects), {
|
|
110
108
|
get value() {
|
|
@@ -114,9 +112,7 @@ function mount(input = {}, reference, position) {
|
|
|
114
112
|
_var_change(branch, newValue);
|
|
115
113
|
},
|
|
116
114
|
update(newInput = {}) {
|
|
117
|
-
args && (newInput.$global && ({$global, ...newInput} = newInput), runEffects(prepareEffects((_) =>
|
|
118
|
-
args(branch, newInput);
|
|
119
|
-
})));
|
|
115
|
+
args && (newInput.$global && ({$global, ...newInput} = newInput), runEffects(prepareEffects((_) => args(branch, newInput))));
|
|
120
116
|
},
|
|
121
117
|
destroy() {
|
|
122
118
|
removeAndDestroyBranch(branch);
|
|
@@ -151,7 +147,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
151
147
|
}, insert = (_) => {
|
|
152
148
|
insertBranchBefore(branch, parent(), marker), marker.remove(), awaitCounter?.c();
|
|
153
149
|
}, remaining;
|
|
154
|
-
if (remaining = values
|
|
150
|
+
if (remaining = values.size) {
|
|
155
151
|
awaitCounter ||= startAwait(branch);
|
|
156
152
|
let fail = loadFailed(branch, awaitCounter);
|
|
157
153
|
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && queueAsyncRender(branch, (branch) => {
|
|
@@ -193,4 +189,4 @@ function _load_race_trigger(...triggers) {
|
|
|
193
189
|
function getSelectorOrResolve(selector, resolve) {
|
|
194
190
|
return document.querySelector(selector) || resolve();
|
|
195
191
|
}
|
|
196
|
-
export { $signal, $signalReset, _assert_class_toggles, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_class_names, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _dynamic_tag_var_resume, _el, _el_read, _for_closure, _for_in, _for_of, _for_of_unkeyed, _for_selector, _for_to, _for_to_unkeyed, _for_until, _for_until_unkeyed, _global_read, _hoist, _hoist_read_error, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resumed, _return, _return_change, _return_setup, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, readyFailed, run };
|
|
192
|
+
export { $signal, $signalReset, _assert_class_toggles, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_class_names, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _dynamic_tag_var_resume, _el, _el_read, _for_closure, _for_in, _for_of, _for_of_unkeyed, _for_selector, _for_to, _for_to_unkeyed, _for_until, _for_until_unkeyed, _global_read, _hoist, _hoist_read_error, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resumed, _return, _return_change, _return_setup, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, onAbort, ready, readyFailed, run };
|
package/dist/html/assets.d.ts
CHANGED
|
@@ -28,11 +28,10 @@ export interface EventTrigger {
|
|
|
28
28
|
options?: never;
|
|
29
29
|
}
|
|
30
30
|
export type LoadTrigger = VisibleTrigger | IdleTrigger | MediaTrigger | EventTrigger;
|
|
31
|
-
type Trigger = LoadTrigger;
|
|
32
31
|
interface Asset {
|
|
33
32
|
id: string;
|
|
34
33
|
flush: AssetFlush;
|
|
35
|
-
triggers:
|
|
34
|
+
triggers: LoadTrigger[] | undefined;
|
|
36
35
|
block: string | undefined;
|
|
37
36
|
defer: string | undefined;
|
|
38
37
|
script: string | undefined;
|
|
@@ -46,8 +45,8 @@ declare module "../common/types" {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
type AssetFlush = (g: $Global, type: "block" | "defer", asset: string) => string;
|
|
49
|
-
export declare function withLoadAssets(template: () => ServerRenderer, id: string, flush: AssetFlush, assetId: string, triggers?:
|
|
50
|
-
export declare function writeLoadAsset(assetId: string, flush: AssetFlush, triggers?:
|
|
48
|
+
export declare function withLoadAssets(template: () => ServerRenderer, id: string, flush: AssetFlush, assetId: string, triggers?: LoadTrigger[]): ServerRenderer;
|
|
49
|
+
export declare function writeLoadAsset(assetId: string, flush: AssetFlush, triggers?: LoadTrigger[]): void;
|
|
51
50
|
export declare function withPageAssets(template: ServerRenderer & Template, flush: AssetFlush, assetId: string, runtimeId?: string): Template;
|
|
52
51
|
export declare function _flush_head(): string;
|
|
53
52
|
export {};
|
package/dist/html/for.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { forIn, forOf, forTo, forUntil } from "../common/for";
|
|
2
1
|
import type { Falsy } from "../common/types";
|
|
3
2
|
export declare function forOfBy(by: Falsy | string | ((item: unknown, index: number) => unknown), item: unknown, index: number): unknown;
|
|
4
3
|
export declare function forInBy(by: Falsy | ((key: string, value: unknown) => unknown), name: string, value: unknown): unknown;
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare function getContext(key: keyof NonNullable<Chunk["context"]>): un
|
|
|
23
23
|
export declare function getState(): State;
|
|
24
24
|
export declare function rendererKey(renderer: unknown): unknown;
|
|
25
25
|
export declare function getScopeId(scope: unknown): number | undefined;
|
|
26
|
-
export declare function getScopeById(scopeId: number
|
|
26
|
+
export declare function getScopeById(scopeId: number): ScopeInternals | undefined;
|
|
27
27
|
export declare function $global(): $Global & {
|
|
28
28
|
renderId: string;
|
|
29
29
|
runtimeId: string;
|
|
@@ -81,7 +81,6 @@ export declare function _write_guard(reason: GroupMask, group: number): 0 | 1;
|
|
|
81
81
|
export declare function writeWaitReady(readyId: string, renderer: ServerRenderer, input: unknown): void;
|
|
82
82
|
export declare function deferBranchStart(chunk: Chunk): string;
|
|
83
83
|
export declare function applyBranchStart(chunk: Chunk, beforeBranch: string, rendered: boolean): void;
|
|
84
|
-
declare const NOOP: () => void;
|
|
85
84
|
export declare function getAsyncContent(chunk: Chunk): AsyncContent | undefined;
|
|
86
85
|
type Mark = Mark.Value;
|
|
87
86
|
export declare class State implements Channel {
|
|
@@ -135,6 +134,7 @@ export declare class State implements Channel {
|
|
|
135
134
|
}
|
|
136
135
|
type FlushStatus = FlushStatus.Value;
|
|
137
136
|
export { FlushStatus };
|
|
137
|
+
export declare function NOOP(): void;
|
|
138
138
|
export declare class Boundary {
|
|
139
139
|
onNext: typeof NOOP;
|
|
140
140
|
count: number;
|
package/dist/html.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export { compat } from "./html/compat";
|
|
|
6
6
|
export { _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _to_text, _unescaped, } from "./html/content";
|
|
7
7
|
export { _await, _for_in, _for_of, _for_to, _for_until, _if, _show_end, _show_start, _try, } from "./html/control-flow";
|
|
8
8
|
export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
|
|
9
|
-
export { forIn, forOf, forTo, forUntil } from "./
|
|
9
|
+
export { forIn, forOf, forTo, forUntil } from "./common/for";
|
|
10
10
|
export { _template } from "./html/template";
|
|
11
11
|
export { _attr_content, _el, _el_mark, _existing_scope, _hoist, _html, _id, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _html_mark, _scope_with_id, _script, _write_guard, _write_if, _set_scope_reason, _text_mark, _subscribe, _trailers, _var, $global, } from "./html/writer";
|
package/dist/html.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\",
|
|
3
|
-
let str = "", sep = "", part;
|
|
4
|
-
if (val) {
|
|
5
|
-
if (typeof val != "object") str += val;
|
|
6
|
-
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
7
|
-
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
8
|
-
}
|
|
9
|
-
return str;
|
|
10
|
-
}, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (/* @__PURE__ */ (function* () {})()).constructor, AsyncGenerator = (/* @__PURE__ */ (async function* () {})()).constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = /* @__PURE__ */ (() => {
|
|
2
|
+
let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (/* @__PURE__ */ (function* () {})()).constructor, AsyncGenerator = (/* @__PURE__ */ (async function* () {})()).constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = /* @__PURE__ */ (() => {
|
|
11
3
|
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
12
4
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
13
5
|
let symbol = Symbol[name];
|
|
@@ -248,20 +240,18 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
248
240
|
}, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kAsyncContent = Symbol("Async Content"), writeScope = (scopeId, partialScope) => {
|
|
249
241
|
let { state } = $chunk.boundary, target = $chunk.channel, scope = scopeWithId(state, scopeId);
|
|
250
242
|
return state.needsWalkerRuntime = !0, countResumeWrite($chunk), writeAsyncVisits($chunk), Object.assign(scope, partialScope), state.queueScope(target, scopeId, partialScope), scope;
|
|
251
|
-
}, ALL_GROUPS = 715827883,
|
|
243
|
+
}, ALL_GROUPS = 715827883, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : c === "<" ? "<" : " ", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\u003C$1") : str, unsafeScriptTemplateLiteralReg = /[`\\\r]|\$\{|<(?=\/?script|!--)/gi, replaceUnsafeScriptTemplateLiteral = (c) => c === "<" ? "\\x3C" : c === "\r" ? "\\r" : "\\" + c, quoteScriptTemplateLiteral = (str) => "`" + (unsafeScriptTemplateLiteralReg.test(str) ? str.replace(unsafeScriptTemplateLiteralReg, replaceUnsafeScriptTemplateLiteral) : str) + "`", unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) => {
|
|
252
244
|
let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
253
245
|
if (typeof renderer == "string") {
|
|
254
246
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
255
|
-
rendered = !0, (()
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
|
|
262
|
-
})(), result = _el(scopeId, "-" + accessor);
|
|
247
|
+
if (rendered = !0, _scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
248
|
+
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
249
|
+
renderer === "textarea" ? _html(_attrs_textarea_value(branchId, "a", input)) : renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard), _html(`</${renderer}>`);
|
|
250
|
+
}
|
|
251
|
+
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
252
|
+
needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId)), result = _el(scopeId, "-" + accessor);
|
|
263
253
|
} else {
|
|
264
|
-
let chunk =
|
|
254
|
+
let chunk = $chunk, beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
265
255
|
if (renderer) try {
|
|
266
256
|
return _set_scope_reason(shouldResume ? ALL_GROUPS : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
267
257
|
...inputOrArgs,
|
|
@@ -334,11 +324,11 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
334
324
|
return joined;
|
|
335
325
|
},
|
|
336
326
|
appendChunks(chunks) {
|
|
337
|
-
let chunk =
|
|
327
|
+
let chunk = $chunk;
|
|
338
328
|
for (let part of chunks) chunk.append(part), part.effects && (chunk.lastEffect = part.lastEffect);
|
|
339
329
|
},
|
|
340
330
|
deferReorders(reorders) {
|
|
341
|
-
let chunk =
|
|
331
|
+
let chunk = $chunk;
|
|
342
332
|
for (let i = reorders.length; i--;) {
|
|
343
333
|
let carrier = chunk.fork(chunk.boundary, chunk.next);
|
|
344
334
|
carrier.deferredReorder = reorders[i], chunk.next = carrier;
|
|
@@ -452,6 +442,15 @@ function escapeStyleValue(str) {
|
|
|
452
442
|
for (let c of result) c === "(" ? closers = ")" + closers : c === "[" ? closers = "]" + closers : c === closers[0] && (closers = closers.slice(1));
|
|
453
443
|
return result + closers;
|
|
454
444
|
}
|
|
445
|
+
function toDelimitedString(val, delimiter, stringify) {
|
|
446
|
+
let str = "", sep = "", part;
|
|
447
|
+
if (val) {
|
|
448
|
+
if (typeof val != "object") str += val;
|
|
449
|
+
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
450
|
+
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
451
|
+
}
|
|
452
|
+
return str;
|
|
453
|
+
}
|
|
455
454
|
function isEventHandler(name) {
|
|
456
455
|
return /^on[A-Z-]/.test(name);
|
|
457
456
|
}
|
|
@@ -485,6 +484,9 @@ function _hoist_read_error() {}
|
|
|
485
484
|
function _signal_read_error() {}
|
|
486
485
|
function _assert_hoist(value) {}
|
|
487
486
|
// src/common/opt.ts
|
|
487
|
+
function toArray(opt) {
|
|
488
|
+
return opt ? Array.isArray(opt) ? opt : [opt] : [];
|
|
489
|
+
}
|
|
488
490
|
function reduce(opt, cb, acc) {
|
|
489
491
|
if (opt) {
|
|
490
492
|
if (Array.isArray(opt)) for (let item of opt) acc = cb(acc, item);
|
|
@@ -612,7 +614,7 @@ function writeScopesRoot(state, flushes) {
|
|
|
612
614
|
state.writeScopeProps(flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? state.scopesCursor(scopeId) + "{" : (scopeId === nextSlotId ? "" : "," + (scopeId - nextSlotId)) + ",{", scopesIndex === -1 && (scopesIndex = openIndex), nextSlotId = scopeId + 1, buf.push("}")) : buf.pop();
|
|
613
615
|
}
|
|
614
616
|
let extras = "";
|
|
615
|
-
(state.deferredRefs.size ||
|
|
617
|
+
(state.deferredRefs.size || hasMatchingCalls(state, state.channel?.readyId)) && (extras = state.writeTrailing(scopesIndex));
|
|
616
618
|
let result = extras && "(";
|
|
617
619
|
for (let chunk of buf) result += chunk;
|
|
618
620
|
return result += extras, result ? state.wrapPayload(result, extras) : "";
|
|
@@ -669,9 +671,6 @@ function writeCallArg(state, val, valueId) {
|
|
|
669
671
|
ref && !ref.id && ref.scopeId === void 0 && !isAncestorChannelRef(state, ref) && (ref.id = valueId || nextRefAccess(state), state.buf[startIndex] = ref.id + "=" + state.buf[startIndex]);
|
|
670
672
|
} else state.buf.push("void 0");
|
|
671
673
|
}
|
|
672
|
-
function hasChannelCalls(state) {
|
|
673
|
-
return hasMatchingCalls(state, state.channel?.readyId);
|
|
674
|
-
}
|
|
675
674
|
function hasMatchingCalls(state, readyId) {
|
|
676
675
|
if (!readyId) return state.queuedCalls.length > 0;
|
|
677
676
|
for (let call of state.queuedReadyCalls) if (call.channel.readyId === readyId) return !0;
|
|
@@ -998,26 +997,18 @@ function writeRequest(state, val, ref) {
|
|
|
998
997
|
state.buf.push("new Request(" + quote(val.url, 0)), hasBody && (state.buf.push(",{body:"), writeProp(state, val.body, ref, "body") ? (state.buf.push(",duplex:\"half\""), sep = ",", bodySerialized = !0) : state.buf.pop());
|
|
999
998
|
let options = "";
|
|
1000
999
|
val.cache !== "default" && (options += sep + "cache:" + quote(val.cache, 0), sep = ","), val.credentials !== "same-origin" && (options += sep + "credentials:" + quote(val.credentials, 0), sep = ",");
|
|
1001
|
-
let
|
|
1002
|
-
|
|
1003
|
-
else {
|
|
1004
|
-
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
1005
|
-
let headers = stringEntriesToHeadersInit(val.headers);
|
|
1006
|
-
headers && (options += sep + "headers:" + headers, sep = ",");
|
|
1007
|
-
}
|
|
1008
|
-
return val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)), state.buf.push(bodySerialized ? options + "})" : options ? ",{" + options + "})" : ")"), !0;
|
|
1000
|
+
let headers = headersOption(state, val.headers, ref);
|
|
1001
|
+
return headers && (options += sep + "headers:" + headers, sep = ","), val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)), state.buf.push(bodySerialized ? options + "})" : options ? ",{" + options + "})" : ")"), !0;
|
|
1009
1002
|
}
|
|
1010
1003
|
function writeResponse(state, val, ref) {
|
|
1011
1004
|
let sep = "", options = "";
|
|
1012
1005
|
val.status !== 200 && (options += "status:" + val.status, sep = ","), val.statusText && (options += sep + "statusText:" + quote(val.statusText, 0), sep = ",");
|
|
1013
|
-
let
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
}
|
|
1020
|
-
return !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
|
|
1006
|
+
let headers = headersOption(state, val.headers, ref);
|
|
1007
|
+
return headers && (options += sep + "headers:" + headers), !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
|
|
1008
|
+
}
|
|
1009
|
+
function headersOption(state, headers, ref) {
|
|
1010
|
+
let seen = state.refs.get(headers);
|
|
1011
|
+
return seen ? ensureRefAccess(state, seen) : (state.refs.set(headers, new Reference(ref, "headers", state.flushId, null)), stringEntriesToHeadersInit(headers));
|
|
1021
1012
|
}
|
|
1022
1013
|
function writeIntl(state, val, name, ref) {
|
|
1023
1014
|
let { locale, ...options } = val.resolvedOptions();
|
|
@@ -1325,7 +1316,7 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, s
|
|
|
1325
1316
|
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1326
1317
|
}
|
|
1327
1318
|
function _attr_nonce() {
|
|
1328
|
-
return
|
|
1319
|
+
return getState().nonceAttr;
|
|
1329
1320
|
}
|
|
1330
1321
|
function _style_html(decls) {
|
|
1331
1322
|
let id = _id();
|
|
@@ -1368,7 +1359,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1368
1359
|
case "style":
|
|
1369
1360
|
result += _attr_style(value);
|
|
1370
1361
|
break;
|
|
1371
|
-
default: name && !(isNullishOrFalse(value) ||
|
|
1362
|
+
default: name && !(isNullishOrFalse(value) || name === "content" && tagName !== "meta" || skip.test(name)) && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, { ["I" + nodeAccessor]: events })), events[getEventType(name)] = value) : result += stringifyAttr(name, value));
|
|
1372
1363
|
}
|
|
1373
1364
|
}
|
|
1374
1365
|
return result;
|
|
@@ -1460,7 +1451,7 @@ function getScopeId(scope) {
|
|
|
1460
1451
|
return scope[K_SCOPE_ID];
|
|
1461
1452
|
}
|
|
1462
1453
|
function getScopeById(scopeId) {
|
|
1463
|
-
|
|
1454
|
+
return $chunk.boundary.state.scopes.get(scopeId);
|
|
1464
1455
|
}
|
|
1465
1456
|
function $global() {
|
|
1466
1457
|
return $chunk.boundary.state.$global;
|
|
@@ -1515,7 +1506,7 @@ function mayDrop(written) {
|
|
|
1515
1506
|
return !1;
|
|
1516
1507
|
}
|
|
1517
1508
|
function _script(scopeId, registryId, markerGuard) {
|
|
1518
|
-
markerGuard === 0 && ($chunk.channel.readyId || $chunk
|
|
1509
|
+
markerGuard === 0 && ($chunk.channel.readyId || getAsyncContent($chunk)) && _resume_branch(scopeId), $chunk.boundary.state.queueEffect(scopeId, registryId);
|
|
1519
1510
|
}
|
|
1520
1511
|
function _trailers(html) {
|
|
1521
1512
|
$chunk.boundary.state.trailerHTML += html;
|
|
@@ -1553,7 +1544,7 @@ function markText(scopeId, accessor, text, markerGuard) {
|
|
|
1553
1544
|
return state.needsWalkerRuntime = !0, text ? (markerGuard === 2 ? "<!>" : "") + text + state.mark("$", scopeId + " " + accessor) : state.mark("%", scopeId + " " + accessor);
|
|
1554
1545
|
}
|
|
1555
1546
|
function _resume_branch(scopeId) {
|
|
1556
|
-
let branchId =
|
|
1547
|
+
let branchId = getContext(kBranchId);
|
|
1557
1548
|
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1558
1549
|
}
|
|
1559
1550
|
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
@@ -1737,8 +1728,10 @@ var State = class {
|
|
|
1737
1728
|
mark(code, str) {
|
|
1738
1729
|
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1739
1730
|
}
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1731
|
+
};
|
|
1732
|
+
function NOOP() {}
|
|
1733
|
+
var Boundary = class {
|
|
1734
|
+
onNext = NOOP;
|
|
1742
1735
|
count = 0;
|
|
1743
1736
|
resumeWrites = 0;
|
|
1744
1737
|
state;
|
|
@@ -1894,7 +1887,7 @@ var State = class {
|
|
|
1894
1887
|
}
|
|
1895
1888
|
flushReadyScripts(boundary, reservations, holdEffects) {
|
|
1896
1889
|
let { channel } = this, { readyId } = channel, scripts = "", held = this.takeDeferredReady();
|
|
1897
|
-
if (held) for (let chunk of
|
|
1890
|
+
if (held) for (let chunk of toArray(held)) chunk.boundary.aborted || (scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk)));
|
|
1898
1891
|
if (readyId && !this.async) {
|
|
1899
1892
|
let { state } = boundary, effects = holdEffects ? "" : this.effects;
|
|
1900
1893
|
effects && flushSerializerGlobals(boundary), flushSerializer(boundary, channel);
|
|
@@ -1921,7 +1914,7 @@ var State = class {
|
|
|
1921
1914
|
}
|
|
1922
1915
|
readyResumeScripts && (needsWalk = !0);
|
|
1923
1916
|
let effects = this.async ? "" : joinHeldEffects(this.takeHeldEffects(), this.effects), { html, scripts } = this;
|
|
1924
|
-
html && state.hasReorderRuntime && (html = state.mark("*", "") + html), state.needsWalkerRuntime && !state.hasWalkerRuntime && (state.hasWalkerRuntime = !0, scripts = concatScripts(scripts, state.runtimeScript())), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, flushSerializerGlobals(boundary), state.resumes = state.resumes
|
|
1917
|
+
html && state.hasReorderRuntime && (html = state.mark("*", "") + html), state.needsWalkerRuntime && !state.hasWalkerRuntime && (state.hasWalkerRuntime = !0, scripts = concatScripts(scripts, state.runtimeScript())), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, flushSerializerGlobals(boundary), state.resumes = concatSequence(state.resumes, "\"" + effects + "\""));
|
|
1925
1918
|
let reordered = "", needsResumeArray = !1;
|
|
1926
1919
|
if (state.writeReorders) {
|
|
1927
1920
|
for (let reorderedChunk of state.writeReorders) {
|
|
@@ -2034,17 +2027,16 @@ function depsMarker(deps) {
|
|
|
2034
2027
|
return marker;
|
|
2035
2028
|
}
|
|
2036
2029
|
function getFilteredGlobals($global) {
|
|
2037
|
-
if (!$global) return 0;
|
|
2038
2030
|
let serializedGlobals = $global.serializedGlobals;
|
|
2039
2031
|
if (!serializedGlobals) return 0;
|
|
2040
2032
|
let filtered = 0;
|
|
2041
2033
|
if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
|
|
2042
2034
|
let value = $global[key];
|
|
2043
|
-
value !== void 0 && (filtered
|
|
2035
|
+
value !== void 0 && ((filtered ||= {})[key] = value);
|
|
2044
2036
|
}
|
|
2045
2037
|
else for (let key in serializedGlobals) if (serializedGlobals[key]) {
|
|
2046
2038
|
let value = $global[key];
|
|
2047
|
-
value !== void 0 && (filtered
|
|
2039
|
+
value !== void 0 && ((filtered ||= {})[key] = value);
|
|
2048
2040
|
}
|
|
2049
2041
|
return filtered;
|
|
2050
2042
|
}
|
|
@@ -2082,7 +2074,7 @@ function _unescaped(val) {
|
|
|
2082
2074
|
return val ? val + "" : val === 0 ? "0" : "";
|
|
2083
2075
|
}
|
|
2084
2076
|
function _escape(val) {
|
|
2085
|
-
return val ?
|
|
2077
|
+
return val || val === 0 ? typeof val == "number" ? val + "" : escapeXMLStr(val + "") : "";
|
|
2086
2078
|
}
|
|
2087
2079
|
function _escape_script(val) {
|
|
2088
2080
|
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
@@ -2287,9 +2279,8 @@ var ServerRendered = class {
|
|
|
2287
2279
|
}
|
|
2288
2280
|
};
|
|
2289
2281
|
function settle(boundary) {
|
|
2290
|
-
boundary.onNext = NOOP
|
|
2282
|
+
boundary.onNext = NOOP, boundary.state.$global.signal?.removeEventListener("abort", boundary);
|
|
2291
2283
|
}
|
|
2292
|
-
function NOOP$1() {}
|
|
2293
2284
|
// src/html/assets.ts
|
|
2294
2285
|
function withLoadAssets(template, id, flush, assetId, triggers) {
|
|
2295
2286
|
let renderer = (input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, template(), input));
|
|
@@ -2352,17 +2343,18 @@ function addAsset(g, id, flush, triggers) {
|
|
|
2352
2343
|
}), asset;
|
|
2353
2344
|
}
|
|
2354
2345
|
function triggerScript(id, html, triggers) {
|
|
2355
|
-
let htmlStr = quoteScriptTemplateLiteral(html), exprs = triggers.map(
|
|
2356
|
-
let options = trigger.options && toObjectExpression(trigger.options);
|
|
2357
|
-
switch (trigger.type) {
|
|
2358
|
-
case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2359
|
-
case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
|
|
2360
|
-
case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
|
|
2361
|
-
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2362
|
-
}
|
|
2363
|
-
});
|
|
2346
|
+
let htmlStr = quoteScriptTemplateLiteral(html), exprs = triggers.map(triggerExpression);
|
|
2364
2347
|
return `((h,d,l=$=>{d||document.head.append(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(${htmlStr})`;
|
|
2365
2348
|
}
|
|
2349
|
+
function triggerExpression(trigger) {
|
|
2350
|
+
let options = trigger.options && toObjectExpression(trigger.options);
|
|
2351
|
+
switch (trigger.type) {
|
|
2352
|
+
case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2353
|
+
case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
|
|
2354
|
+
case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
|
|
2355
|
+
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2366
2358
|
function querySelectorOrLoad(selector) {
|
|
2367
2359
|
return `document.querySelector(${JSON.stringify(selector)})||l()`;
|
|
2368
2360
|
}
|
|
@@ -2457,13 +2449,13 @@ function forBranches(by, cb, iterate, scopeId, accessor, branchGuard, markerGuar
|
|
|
2457
2449
|
let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
|
|
2458
2450
|
iterate((itemKey, sameAsIndex, a, b) => {
|
|
2459
2451
|
let branchId = _peek_scope_id();
|
|
2460
|
-
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, cb, a, b);
|
|
2452
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), resumeMarker ? withBranchId(branchId, cb, a, b) : cb(a, b);
|
|
2461
2453
|
let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
|
|
2462
2454
|
resumeMarker || (loopScopes = push(loopScopes, branchScope));
|
|
2463
2455
|
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
2464
2456
|
}
|
|
2465
2457
|
function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
|
|
2466
|
-
let resumeBranch = branchGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), branchId = _peek_scope_id(), chunk = $chunk, beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0, branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
2458
|
+
let resumeBranch = branchGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), branchId = _peek_scope_id(), chunk = $chunk, beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0, branchIndex = resumeBranch && resumeMarker ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
2467
2459
|
beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
2468
2460
|
["D" + accessor]: branchIndex || void 0,
|
|
2469
2461
|
["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
|
|
@@ -2474,10 +2466,7 @@ function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
|
2474
2466
|
}
|
|
2475
2467
|
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
2476
2468
|
let endTag = parentEndTag || "";
|
|
2477
|
-
|
|
2478
|
-
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
2479
|
-
$chunk.writeHTML(mark + endTag);
|
|
2480
|
-
} else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
|
|
2469
|
+
resumesMarker(markerGuard, branchExprGuard, parentEndTag) ? $chunk.writeHTML($chunk.boundary.state.mark(singleNode ? parentEndTag ? "}" : "|" : parentEndTag ? ")" : "]", scopeId + " " + accessor + branchIds) + endTag) : markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
|
|
2481
2470
|
}
|
|
2482
2471
|
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
2483
2472
|
let resumeMarker = markerGuard !== 0;
|
|
@@ -2581,7 +2570,6 @@ function swapReorders(state, reorders) {
|
|
|
2581
2570
|
let { writeReorders } = state;
|
|
2582
2571
|
return state.writeReorders = reorders, writeReorders;
|
|
2583
2572
|
}
|
|
2584
|
-
function NOOP() {}
|
|
2585
2573
|
exports.$global = $global, exports._assert_class_toggles = _assert_class_toggles, exports._assert_hoist = _assert_hoist, exports._attr = _attr, exports._attr_and = _attr_and, exports._attr_class = _attr_class, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_value = _attr_input_value, exports._attr_nonce = _attr_nonce, exports._attr_nullish = _attr_nullish, exports._attr_option_value = _attr_option_value, exports._attr_or = _attr_or, exports._attr_select_value = _attr_select_value, exports._attr_style = _attr_style, exports._attr_textarea_value = _attr_textarea_value, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._attrs_select_value = _attrs_select_value, exports._attrs_textarea_value = _attrs_textarea_value, exports._await = _await, exports._content = _content, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
2586
2574
|
enumerable: !0,
|
|
2587
2575
|
get: function() {
|