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/debug/dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_control_flow = require("./dom-
|
|
3
|
+
const require_control_flow = require("./dom-mQ5mPBTF.js");
|
|
4
4
|
// src/common/attr-tag.ts
|
|
5
5
|
const empty = [];
|
|
6
6
|
const rest = Symbol("Attribute Tag");
|
|
@@ -162,9 +162,7 @@ function mount(input = {}, reference, position) {
|
|
|
162
162
|
const args = this[require_control_flow.Params];
|
|
163
163
|
const effects = require_control_flow.prepareEffects((_) => {
|
|
164
164
|
branch = require_control_flow.createBranch($global, this, void 0, parentNode);
|
|
165
|
-
branch[require_control_flow.TagVariable] = (newValue) =>
|
|
166
|
-
curValue = newValue;
|
|
167
|
-
};
|
|
165
|
+
branch[require_control_flow.TagVariable] = (newValue) => curValue = newValue;
|
|
168
166
|
this[require_control_flow.Setup]?.(branch);
|
|
169
167
|
args?.(branch, input);
|
|
170
168
|
});
|
|
@@ -180,9 +178,7 @@ function mount(input = {}, reference, position) {
|
|
|
180
178
|
update(newInput = {}) {
|
|
181
179
|
if (args) {
|
|
182
180
|
if (newInput.$global) ({$global, ...newInput} = newInput);
|
|
183
|
-
require_control_flow.runEffects(require_control_flow.prepareEffects((_) =>
|
|
184
|
-
args(branch, newInput);
|
|
185
|
-
}));
|
|
181
|
+
require_control_flow.runEffects(require_control_flow.prepareEffects((_) => args(branch, newInput)));
|
|
186
182
|
}
|
|
187
183
|
},
|
|
188
184
|
destroy() {
|
|
@@ -233,7 +229,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
233
229
|
awaitCounter?.c();
|
|
234
230
|
};
|
|
235
231
|
let remaining;
|
|
236
|
-
if (remaining = values
|
|
232
|
+
if (remaining = values.size) {
|
|
237
233
|
awaitCounter ||= require_control_flow.startAwait(branch);
|
|
238
234
|
const fail = loadFailed(branch, awaitCounter);
|
|
239
235
|
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.queueAsyncRender(branch, (branch) => {
|
|
@@ -411,6 +407,7 @@ exports.forTo = require_control_flow.forTo;
|
|
|
411
407
|
exports.forUntil = require_control_flow.forUntil;
|
|
412
408
|
exports.init = require_control_flow.init;
|
|
413
409
|
exports.initEmbedded = require_control_flow.initEmbedded;
|
|
410
|
+
exports.onAbort = require_control_flow.onAbort;
|
|
414
411
|
exports.ready = require_control_flow.ready;
|
|
415
412
|
exports.readyFailed = require_control_flow.readyFailed;
|
|
416
413
|
exports.run = require_control_flow.run;
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as _attr_style_items, A as _attr_input_value,
|
|
1
|
+
import { $ as _attr_style_items, A as _attr_input_value, At as _closure_get, B as _controllable_select, Bn as Load, Bt as _let, C as _attr_details_or_dialog_open_script, Cn as _call, Ct as getRegisteredWithScope, D as _attr_input_checkedValue_script, Dn as LocalClosures, Dt as readyFailed, E as _attr_input_checkedValue_default, En as Lazy, 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, Kn as StartNode, Kt as _var, L as _attr_select_value_script, Ln as EndNode, 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, On as Owner, 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, Sn as _hoist_read_error, St as _var_resume, T as _attr_input_checkedValue, Tn as Clone, 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 forOf, _t as createBranch, a as _for_in, at as _html, b as startAwait, bn as _assert_class_toggles, bt as _el, c as _for_to, cn as prepareEffects, ct as _style_shell, d as _for_until_unkeyed, dn as queueRender, dt as _to_text, et as _attrs, f as _if, fn as rendering, ft as _content, gn as forIn, gt as createAndSetupBranch, hn as runId, ht as _return_setup, i as _dynamic_tag_content, in as onAbort, it as _attrs_script, j as _attr_input_value_attribute_default, jn as Setup, jt as _const, k as _attr_input_checked_script, kn as Params, kt as _closure, l as _for_to_unkeyed, ln as queueAsyncRender, lt as _text, m as _try, mn as runEffects, mt as _content_resume, n as _await_promise, nn as $signal, nt as _attrs_partial, o as _for_of, ot as _lifecycle, p as _show, pn as run, pt as _content_closures, q as _attr_class_items, qn as TagVariable, qt as _var_change, r as _dynamic_tag, rn as $signalReset, rt as _attrs_partial_content, s as _for_of_unkeyed, st as _style_rule_item, t as _await_content, tn as _on, tt as _attrs_content, u as _for_until, un as queueEffect, ut as _text_content, v as renderCatch, vn as forTo, vt as setupBranch, w as _attr_input_checked, wt as init, x as _attr_details_or_dialog_open, xn as _assert_hoist, xt as _resumed, yn as forUntil, yt as _dynamic_tag_var_resume, z as _controllable_open, zn as Global, zt as _if_closure } from "./dom-DjUZd-9y.mjs";
|
|
2
2
|
// src/common/attr-tag.ts
|
|
3
3
|
const empty = [];
|
|
4
4
|
const rest = Symbol("Attribute Tag");
|
|
@@ -160,9 +160,7 @@ function mount(input = {}, reference, position) {
|
|
|
160
160
|
const args = this[Params];
|
|
161
161
|
const effects = prepareEffects((_) => {
|
|
162
162
|
branch = createBranch($global, this, void 0, parentNode);
|
|
163
|
-
branch[TagVariable] = (newValue) =>
|
|
164
|
-
curValue = newValue;
|
|
165
|
-
};
|
|
163
|
+
branch[TagVariable] = (newValue) => curValue = newValue;
|
|
166
164
|
this[Setup]?.(branch);
|
|
167
165
|
args?.(branch, input);
|
|
168
166
|
});
|
|
@@ -178,9 +176,7 @@ function mount(input = {}, reference, position) {
|
|
|
178
176
|
update(newInput = {}) {
|
|
179
177
|
if (args) {
|
|
180
178
|
if (newInput.$global) ({$global, ...newInput} = newInput);
|
|
181
|
-
runEffects(prepareEffects((_) =>
|
|
182
|
-
args(branch, newInput);
|
|
183
|
-
}));
|
|
179
|
+
runEffects(prepareEffects((_) => args(branch, newInput)));
|
|
184
180
|
}
|
|
185
181
|
},
|
|
186
182
|
destroy() {
|
|
@@ -231,7 +227,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
231
227
|
awaitCounter?.c();
|
|
232
228
|
};
|
|
233
229
|
let remaining;
|
|
234
|
-
if (remaining = values
|
|
230
|
+
if (remaining = values.size) {
|
|
235
231
|
awaitCounter ||= startAwait(branch);
|
|
236
232
|
const fail = loadFailed(branch, awaitCounter);
|
|
237
233
|
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && queueAsyncRender(branch, (branch) => {
|
|
@@ -288,4 +284,4 @@ function _load_race_trigger(...triggers) {
|
|
|
288
284
|
function getSelectorOrResolve(selector, resolve) {
|
|
289
285
|
return document.querySelector(selector) || (console.warn(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`), resolve());
|
|
290
286
|
}
|
|
291
|
-
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 };
|
|
287
|
+
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/debug/html.js
CHANGED
|
@@ -101,7 +101,7 @@ function escapeStyleValue(str) {
|
|
|
101
101
|
else if (c === closers[0]) closers = closers.slice(1);
|
|
102
102
|
return result + closers;
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
function toDelimitedString(val, delimiter, stringify) {
|
|
105
105
|
let str = "";
|
|
106
106
|
let sep = "";
|
|
107
107
|
let part;
|
|
@@ -123,7 +123,7 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
return str;
|
|
126
|
-
}
|
|
126
|
+
}
|
|
127
127
|
function isEventHandler(name) {
|
|
128
128
|
return /^on[A-Z-]/.test(name);
|
|
129
129
|
}
|
|
@@ -277,6 +277,9 @@ const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
|
|
|
277
277
|
const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
|
|
278
278
|
const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
|
|
279
279
|
// src/common/opt.ts
|
|
280
|
+
function toArray(opt) {
|
|
281
|
+
return opt ? Array.isArray(opt) ? opt : [opt] : [];
|
|
282
|
+
}
|
|
280
283
|
function reduce(opt, cb, acc) {
|
|
281
284
|
if (opt) {
|
|
282
285
|
if (Array.isArray(opt)) for (const item of opt) acc = cb(acc, item);
|
|
@@ -704,7 +707,7 @@ function writeScopesRoot(state, flushes) {
|
|
|
704
707
|
} else buf.pop();
|
|
705
708
|
}
|
|
706
709
|
let extras = "";
|
|
707
|
-
if (state.deferredRefs.size ||
|
|
710
|
+
if (state.deferredRefs.size || hasMatchingCalls(state, state.channel?.readyId)) extras = state.writeTrailing(scopesIndex);
|
|
708
711
|
let result = extras && "(";
|
|
709
712
|
for (const chunk of buf) result += chunk;
|
|
710
713
|
result += extras;
|
|
@@ -798,9 +801,6 @@ function writeCallArg(state, val, valueId) {
|
|
|
798
801
|
}
|
|
799
802
|
} else state.buf.push("void 0");
|
|
800
803
|
}
|
|
801
|
-
function hasChannelCalls(state) {
|
|
802
|
-
return hasMatchingCalls(state, state.channel?.readyId);
|
|
803
|
-
}
|
|
804
804
|
function hasMatchingCalls(state, readyId) {
|
|
805
805
|
if (!readyId) return state.queuedCalls.length > 0;
|
|
806
806
|
for (const call of state.queuedReadyCalls) if (call.channel.readyId === readyId) return true;
|
|
@@ -1321,17 +1321,10 @@ function writeRequest(state, val, ref) {
|
|
|
1321
1321
|
options += sep + "credentials:" + quote(val.credentials, 0);
|
|
1322
1322
|
sep = ",";
|
|
1323
1323
|
}
|
|
1324
|
-
const
|
|
1325
|
-
if (
|
|
1326
|
-
options += sep + "headers:" +
|
|
1324
|
+
const headers = headersOption(state, val.headers, ref);
|
|
1325
|
+
if (headers) {
|
|
1326
|
+
options += sep + "headers:" + headers;
|
|
1327
1327
|
sep = ",";
|
|
1328
|
-
} else {
|
|
1329
|
-
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
1330
|
-
const headers = stringEntriesToHeadersInit(val.headers);
|
|
1331
|
-
if (headers) {
|
|
1332
|
-
options += sep + "headers:" + headers;
|
|
1333
|
-
sep = ",";
|
|
1334
|
-
}
|
|
1335
1328
|
}
|
|
1336
1329
|
if (val.integrity) {
|
|
1337
1330
|
options += sep + "integrity:" + quote(val.integrity, 0);
|
|
@@ -1372,13 +1365,8 @@ function writeResponse(state, val, ref) {
|
|
|
1372
1365
|
options += sep + "statusText:" + quote(val.statusText, 0);
|
|
1373
1366
|
sep = ",";
|
|
1374
1367
|
}
|
|
1375
|
-
const
|
|
1376
|
-
if (
|
|
1377
|
-
else {
|
|
1378
|
-
state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
|
|
1379
|
-
const headers = stringEntriesToHeadersInit(val.headers);
|
|
1380
|
-
if (headers) options += sep + "headers:" + headers;
|
|
1381
|
-
}
|
|
1368
|
+
const headers = headersOption(state, val.headers, ref);
|
|
1369
|
+
if (headers) options += sep + "headers:" + headers;
|
|
1382
1370
|
if (!val.body || val.bodyUsed) state.buf.push("new Response" + (options ? "(null,{" + options + "})" : ""));
|
|
1383
1371
|
else {
|
|
1384
1372
|
state.buf.push("new Response(");
|
|
@@ -1386,6 +1374,12 @@ function writeResponse(state, val, ref) {
|
|
|
1386
1374
|
}
|
|
1387
1375
|
return true;
|
|
1388
1376
|
}
|
|
1377
|
+
function headersOption(state, headers, ref) {
|
|
1378
|
+
const seen = state.refs.get(headers);
|
|
1379
|
+
if (seen) return ensureRefAccess(state, seen);
|
|
1380
|
+
state.refs.set(headers, new Reference(ref, "headers", state.flushId, null));
|
|
1381
|
+
return stringEntriesToHeadersInit(headers);
|
|
1382
|
+
}
|
|
1389
1383
|
function writeIntl(state, val, name, ref) {
|
|
1390
1384
|
const { locale, ...options } = val.resolvedOptions();
|
|
1391
1385
|
state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
|
|
@@ -1913,7 +1907,7 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, s
|
|
|
1913
1907
|
return normalizedOpen ? " open" : "";
|
|
1914
1908
|
}
|
|
1915
1909
|
function _attr_nonce() {
|
|
1916
|
-
return
|
|
1910
|
+
return getState().nonceAttr;
|
|
1917
1911
|
}
|
|
1918
1912
|
function _style_html(decls) {
|
|
1919
1913
|
const id = _id();
|
|
@@ -1977,7 +1971,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1977
1971
|
break;
|
|
1978
1972
|
default:
|
|
1979
1973
|
if (name) assertValidAttrName(name);
|
|
1980
|
-
if (name && !(isNullishOrFalse(value) ||
|
|
1974
|
+
if (name && !(isNullishOrFalse(value) || name === "content" && tagName !== "meta" || skip.test(name))) {
|
|
1981
1975
|
if (isEventHandler(name)) {
|
|
1982
1976
|
if (!events) {
|
|
1983
1977
|
events = {};
|
|
@@ -2191,7 +2185,7 @@ function getScopeId(scope) {
|
|
|
2191
2185
|
return scope[K_SCOPE_ID];
|
|
2192
2186
|
}
|
|
2193
2187
|
function getScopeById(scopeId) {
|
|
2194
|
-
|
|
2188
|
+
return $chunk.boundary.state.scopes.get(scopeId);
|
|
2195
2189
|
}
|
|
2196
2190
|
function $global() {
|
|
2197
2191
|
return $chunk.boundary.state.$global;
|
|
@@ -2253,7 +2247,7 @@ function mayDrop(written) {
|
|
|
2253
2247
|
return false;
|
|
2254
2248
|
}
|
|
2255
2249
|
function _script(scopeId, registryId, markerGuard) {
|
|
2256
|
-
if (markerGuard === 0 && ($chunk.channel.readyId || $chunk
|
|
2250
|
+
if (markerGuard === 0 && ($chunk.channel.readyId || getAsyncContent($chunk))) _resume_branch(scopeId);
|
|
2257
2251
|
$chunk.boundary.state.queueEffect(scopeId, registryId);
|
|
2258
2252
|
}
|
|
2259
2253
|
function _trailers(html) {
|
|
@@ -2297,7 +2291,7 @@ function markText(scopeId, accessor, text, markerGuard) {
|
|
|
2297
2291
|
return text ? (markerGuard === 2 ? "<!>" : "") + text + state.mark("$", scopeId + " " + accessor) : state.mark("%", scopeId + " " + accessor);
|
|
2298
2292
|
}
|
|
2299
2293
|
function _resume_branch(scopeId) {
|
|
2300
|
-
const branchId =
|
|
2294
|
+
const branchId = getContext(kBranchId);
|
|
2301
2295
|
if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { [ClosestBranchId]: branchId });
|
|
2302
2296
|
}
|
|
2303
2297
|
function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
|
|
@@ -2434,7 +2428,6 @@ function unsubscribe(subscribed, serializer) {
|
|
|
2434
2428
|
}
|
|
2435
2429
|
}
|
|
2436
2430
|
}
|
|
2437
|
-
const NOOP$2 = () => {};
|
|
2438
2431
|
function countResumeWrite(chunk) {
|
|
2439
2432
|
for (let boundary = chunk.boundary; boundary; boundary = boundary.parent) boundary.resumeWrites++;
|
|
2440
2433
|
}
|
|
@@ -2556,8 +2549,9 @@ var State = class {
|
|
|
2556
2549
|
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
2557
2550
|
}
|
|
2558
2551
|
};
|
|
2552
|
+
function NOOP() {}
|
|
2559
2553
|
var Boundary = class {
|
|
2560
|
-
onNext = NOOP
|
|
2554
|
+
onNext = NOOP;
|
|
2561
2555
|
count = 0;
|
|
2562
2556
|
resumeWrites = 0;
|
|
2563
2557
|
state;
|
|
@@ -2821,7 +2815,7 @@ var Chunk = class Chunk {
|
|
|
2821
2815
|
const { readyId } = channel;
|
|
2822
2816
|
let scripts = "";
|
|
2823
2817
|
const held = this.takeDeferredReady();
|
|
2824
|
-
if (held) for (const chunk of
|
|
2818
|
+
if (held) for (const chunk of toArray(held)) {
|
|
2825
2819
|
if (chunk.boundary.aborted) continue;
|
|
2826
2820
|
scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects));
|
|
2827
2821
|
if (chunk.effects || chunk.deferredReady) this.deferredReady = push(this.deferredReady, chunk);
|
|
@@ -2874,7 +2868,7 @@ var Chunk = class Chunk {
|
|
|
2874
2868
|
if (effects) {
|
|
2875
2869
|
needsWalk = true;
|
|
2876
2870
|
flushSerializerGlobals(boundary);
|
|
2877
|
-
state.resumes = state.resumes
|
|
2871
|
+
state.resumes = concatSequence(state.resumes, "\"" + effects + "\"");
|
|
2878
2872
|
}
|
|
2879
2873
|
let reordered = "";
|
|
2880
2874
|
let needsResumeArray = false;
|
|
@@ -3058,23 +3052,16 @@ function depsMarker(deps) {
|
|
|
3058
3052
|
return marker;
|
|
3059
3053
|
}
|
|
3060
3054
|
function getFilteredGlobals($global) {
|
|
3061
|
-
if (!$global) return 0;
|
|
3062
3055
|
const serializedGlobals = $global.serializedGlobals;
|
|
3063
3056
|
if (!serializedGlobals) return 0;
|
|
3064
3057
|
let filtered = 0;
|
|
3065
3058
|
if (Array.isArray(serializedGlobals)) for (const key of serializedGlobals) {
|
|
3066
3059
|
const value = $global[key];
|
|
3067
|
-
if (value !== void 0) {
|
|
3068
|
-
if (filtered) filtered[key] = value;
|
|
3069
|
-
else filtered = { [key]: value };
|
|
3070
|
-
}
|
|
3060
|
+
if (value !== void 0) (filtered ||= {})[key] = value;
|
|
3071
3061
|
}
|
|
3072
3062
|
else for (const key in serializedGlobals) if (serializedGlobals[key]) {
|
|
3073
3063
|
const value = $global[key];
|
|
3074
|
-
if (value !== void 0) {
|
|
3075
|
-
if (filtered) filtered[key] = value;
|
|
3076
|
-
else filtered = { [key]: value };
|
|
3077
|
-
}
|
|
3064
|
+
if (value !== void 0) (filtered ||= {})[key] = value;
|
|
3078
3065
|
}
|
|
3079
3066
|
return filtered;
|
|
3080
3067
|
}
|
|
@@ -3124,7 +3111,7 @@ const replaceUnsafeXML = (c) => c === "&" ? "&" : c === "<" ? "<" : "
|
|
|
3124
3111
|
const escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
3125
3112
|
function _escape(val) {
|
|
3126
3113
|
assertValidTextValue(val);
|
|
3127
|
-
return val ?
|
|
3114
|
+
return val || val === 0 ? typeof val === "number" ? val + "" : escapeXMLStr(val + "") : "";
|
|
3128
3115
|
}
|
|
3129
3116
|
const unsafeScriptReg = /<(\/?script|!--)/gi;
|
|
3130
3117
|
const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\u003C$1") : str;
|
|
@@ -3167,34 +3154,31 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, m
|
|
|
3167
3154
|
assertValidTagName(renderer);
|
|
3168
3155
|
const input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
3169
3156
|
rendered = true;
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
if (
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
else if (renderContent) _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0, markerGuard);
|
|
3182
|
-
}
|
|
3183
|
-
_html(`</${renderer}>`);
|
|
3184
|
-
} else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
3185
|
-
const childScope = getScopeById(branchId);
|
|
3186
|
-
const needsScript = childScope && (childScope[`EventAttributes:#${renderer.toLowerCase()}/0`] || childScope[`ControlledHandler:#${renderer.toLowerCase()}/0`]);
|
|
3187
|
-
if (needsScript) {
|
|
3188
|
-
writeScope(branchId, { [Renderer]: renderer });
|
|
3189
|
-
_script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
|
|
3157
|
+
_scope_id();
|
|
3158
|
+
_html(`<${renderer}${_attrs(input, `#${renderer.toLowerCase()}/0`, branchId, renderer)}>`);
|
|
3159
|
+
if (!voidElementsReg.test(renderer)) {
|
|
3160
|
+
const renderContent = content || normalizeDynamicRenderer(input.content);
|
|
3161
|
+
if (renderer === "textarea") {
|
|
3162
|
+
if (renderContent) throw new Error("A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead.");
|
|
3163
|
+
_html(_attrs_textarea_value(branchId, `#${renderer.toLowerCase()}/0`, input));
|
|
3164
|
+
} else {
|
|
3165
|
+
if (renderContent && typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
3166
|
+
if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer.toLowerCase()}/0`, input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0, markerGuard) : void 0, 1);
|
|
3167
|
+
else if (renderContent) _dynamic_tag(branchId, `#${renderer.toLowerCase()}/0`, renderContent, void 0, 0, void 0, markerGuard);
|
|
3190
3168
|
}
|
|
3191
|
-
|
|
3192
|
-
};
|
|
3193
|
-
|
|
3169
|
+
_html(`</${renderer}>`);
|
|
3170
|
+
} else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
3171
|
+
const childScope = getScopeById(branchId);
|
|
3172
|
+
const needsScript = childScope && (childScope[`EventAttributes:#${renderer.toLowerCase()}/0`] || childScope[`ControlledHandler:#${renderer.toLowerCase()}/0`]);
|
|
3173
|
+
if (needsScript) {
|
|
3174
|
+
writeScope(branchId, { [Renderer]: renderer });
|
|
3175
|
+
_script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
|
|
3176
|
+
}
|
|
3177
|
+
if (shouldResume || needsScript) _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
|
|
3194
3178
|
result = _el(scopeId, DYNAMIC_TAG_VAR_REGISTER_ID + accessor);
|
|
3195
3179
|
} else {
|
|
3196
3180
|
if (tagVar && renderer?.["lazy"]) throw new Error(`A dynamic tag with a [tag variable](https://markojs.com/docs/reference/language#tag-variables) rendered \`${renderer["id"]}\`, which is lazily loaded, so it does not support one. Import it without \`load\`, or remove the variable.`);
|
|
3197
|
-
const chunk =
|
|
3181
|
+
const chunk = $chunk;
|
|
3198
3182
|
const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
|
|
3199
3183
|
const render = () => {
|
|
3200
3184
|
if (renderer) try {
|
|
@@ -3496,10 +3480,9 @@ var ServerRendered = class {
|
|
|
3496
3480
|
}
|
|
3497
3481
|
};
|
|
3498
3482
|
function settle(boundary) {
|
|
3499
|
-
boundary.onNext = NOOP
|
|
3483
|
+
boundary.onNext = NOOP;
|
|
3500
3484
|
boundary.state.$global.signal?.removeEventListener("abort", boundary);
|
|
3501
3485
|
}
|
|
3502
|
-
function NOOP$1() {}
|
|
3503
3486
|
// src/html/assets.ts
|
|
3504
3487
|
const kAssets = Symbol();
|
|
3505
3488
|
const kHead = Symbol();
|
|
@@ -3597,17 +3580,18 @@ function addAsset(g, id, flush, triggers) {
|
|
|
3597
3580
|
function triggerScript(id, html, triggers) {
|
|
3598
3581
|
const htmlStr = quoteScriptTemplateLiteral(html);
|
|
3599
3582
|
const insert = `(d=new Range().createContextualFragment(h),d.querySelectorAll("script").forEach(s=>s.onerror=()=>console.error(${quoteScriptTemplateLiteral(`The lazy module for "${id}" failed to load; its server-rendered content cannot become interactive.`)})),document.head.append(d))`;
|
|
3600
|
-
const exprs = triggers.map(
|
|
3601
|
-
const options = trigger.options && toObjectExpression(trigger.options);
|
|
3602
|
-
switch (trigger.type) {
|
|
3603
|
-
case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
|
|
3604
|
-
case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
|
|
3605
|
-
case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
|
|
3606
|
-
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
3607
|
-
}
|
|
3608
|
-
});
|
|
3583
|
+
const exprs = triggers.map(triggerExpression);
|
|
3609
3584
|
return `((h,d,l=$=>{d||${insert}})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(${htmlStr})`;
|
|
3610
3585
|
}
|
|
3586
|
+
function triggerExpression(trigger) {
|
|
3587
|
+
const options = trigger.options && toObjectExpression(trigger.options);
|
|
3588
|
+
switch (trigger.type) {
|
|
3589
|
+
case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
|
|
3590
|
+
case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
|
|
3591
|
+
case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
|
|
3592
|
+
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3611
3595
|
function querySelectorOrLoad(selector) {
|
|
3612
3596
|
return `document.querySelector(${JSON.stringify(selector)})||${`(console.warn(${JSON.stringify(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`)}),l())`}`;
|
|
3613
3597
|
}
|
|
@@ -3742,7 +3726,8 @@ function forBranches(by, cb, iterate, scopeId, accessor, branchGuard, markerGuar
|
|
|
3742
3726
|
flushBranchIds = branchId + "";
|
|
3743
3727
|
}
|
|
3744
3728
|
}
|
|
3745
|
-
withBranchId(branchId, cb, a, b);
|
|
3729
|
+
if (resumeMarker) withBranchId(branchId, cb, a, b);
|
|
3730
|
+
else cb(a, b);
|
|
3746
3731
|
const branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { [LoopKey]: itemKey } : {});
|
|
3747
3732
|
if (!resumeMarker) loopScopes = push(loopScopes, branchScope);
|
|
3748
3733
|
});
|
|
@@ -3755,7 +3740,7 @@ function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, p
|
|
|
3755
3740
|
const branchId = _peek_scope_id();
|
|
3756
3741
|
const chunk = $chunk;
|
|
3757
3742
|
const beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0;
|
|
3758
|
-
const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
|
3743
|
+
const branchIndex = resumeBranch && resumeMarker ? withBranchId(branchId, cb) : cb();
|
|
3759
3744
|
const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
3760
3745
|
if (beforeBranch !== void 0) applyBranchStart(chunk, beforeBranch, shouldWriteBranch);
|
|
3761
3746
|
if (shouldWriteBranch && (branchIndex || !resumeMarker)) writeScope(scopeId, {
|
|
@@ -3769,11 +3754,8 @@ function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
|
|
|
3769
3754
|
}
|
|
3770
3755
|
function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
|
|
3771
3756
|
const endTag = parentEndTag || "";
|
|
3772
|
-
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag))
|
|
3773
|
-
|
|
3774
|
-
const mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
3775
|
-
$chunk.writeHTML(mark + endTag);
|
|
3776
|
-
} else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
|
|
3757
|
+
if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) $chunk.writeHTML($chunk.boundary.state.mark(singleNode ? parentEndTag ? "}" : "|" : parentEndTag ? ")" : "]", scopeId + " " + accessor + branchIds) + endTag);
|
|
3758
|
+
else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
|
|
3777
3759
|
else $chunk.writeHTML(endTag);
|
|
3778
3760
|
}
|
|
3779
3761
|
function _await(scopeId, accessor, promise, content, markerGuard) {
|
|
@@ -4012,14 +3994,14 @@ const compat = {
|
|
|
4012
3994
|
return joined;
|
|
4013
3995
|
},
|
|
4014
3996
|
appendChunks(chunks) {
|
|
4015
|
-
const chunk =
|
|
3997
|
+
const chunk = $chunk;
|
|
4016
3998
|
for (const part of chunks) {
|
|
4017
3999
|
chunk.append(part);
|
|
4018
4000
|
if (part.effects) chunk.lastEffect = part.lastEffect;
|
|
4019
4001
|
}
|
|
4020
4002
|
},
|
|
4021
4003
|
deferReorders(reorders) {
|
|
4022
|
-
const chunk =
|
|
4004
|
+
const chunk = $chunk;
|
|
4023
4005
|
for (let i = reorders.length; i--;) {
|
|
4024
4006
|
const carrier = chunk.fork(chunk.boundary, chunk.next);
|
|
4025
4007
|
carrier.deferredReorder = reorders[i];
|
|
@@ -4150,7 +4132,6 @@ function swapReorders(state, reorders) {
|
|
|
4150
4132
|
state.writeReorders = reorders;
|
|
4151
4133
|
return writeReorders;
|
|
4152
4134
|
}
|
|
4153
|
-
function NOOP() {}
|
|
4154
4135
|
exports.$global = $global;
|
|
4155
4136
|
exports._assert_class_toggles = _assert_class_toggles;
|
|
4156
4137
|
exports._assert_hoist = _assert_hoist;
|