marko 6.3.45 → 6.3.47
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/constants/resume-symbol.d.ts +5 -2
- package/dist/common/helpers.d.ts +2 -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-var.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-DBuLwSOh.js → dom-BheMBjYT.js} +29 -8
- package/dist/debug/{dom-ky42a_qY.mjs → dom-DyBeisho.mjs} +24 -9
- package/dist/debug/dom.js +2 -1
- package/dist/debug/dom.mjs +2 -2
- package/dist/debug/html.js +33 -18
- package/dist/debug/html.mjs +32 -18
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- 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/dom.d.ts +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/resume.d.ts +1 -0
- package/dist/{dom-BSAs0ur8.mjs → dom-BbknkVDz.mjs} +13 -13
- package/dist/{dom-DHJCbngT.js → dom-DprILxYO.js} +64 -59
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +24 -24
- package/dist/dom.mjs +2 -2
- package/dist/html/writer.d.ts +2 -1
- package/dist/html.d.ts +1 -1
- package/dist/html.js +21 -10
- package/dist/html.mjs +21 -10
- package/dist/translator/index.js +36 -419
- package/dist/translator/util/signals.d.ts +4 -1
- package/dist/translator/visitors/constants/sibling-text.d.ts +0 -1
- package/package.json +3 -3
package/dist/dom.mjs
CHANGED
|
@@ -94,7 +94,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
|
|
|
94
94
|
pending ||= load(), scope.X || !("X" in scope) && scope.H === runId ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => queueAsyncRender(scope, signal = mod._, value), () => 0);
|
|
95
95
|
};
|
|
96
96
|
});
|
|
97
|
-
import { $ as _attrs_script, A as _attr_input_value_script, At as
|
|
97
|
+
import { $ as _attrs_script, A as _attr_input_value_script, At as _for_closure, B as _attr, Bt as _return, C as _attr_input_checkedValue_script, D as _attr_input_value_attribute_default, Dt as _closure_get, E as _attr_input_value, Et as _closure, F as _controllable_open, Ft as _id, G as _attr_nonce, Gt as _assert_init, H as _attr_class_item, Ht as _script, I as _controllable_select, It as _if_closure, J as _attr_style_items, Jt as removeAndDestroyBranch, K as _attr_style, Kt as destroyBranch, L as _controllable_textarea, Lt as _let, M as _attr_select_value_default, Mt as _global_read, N as _attr_select_value_script, Nt as _hoist, O as _attr_input_value_default, Ot as _const, P as _controllable_input, Pt as _hoist_resume, Q as _attrs_partial_content, Qt as $signalReset, Rt as _let_change, S as _attr_input_checkedValue_default, St as readyFailed, T as _attr_input_checked_script, Tt as _child_setup, U as _attr_class_items, Ut as _var, V as _attr_class, Vt as _return_change, W as _attr_content, Wt as _var_change, X as _attrs_content, Xt as _on, Y as _attrs, Yt as syncGen, Z as _attrs_partial, Zt as $signal, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as run, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as forIn, ct as toInsertNode, d as _show, dn as forUntil, dt as _content_resume, et as _html, f as _try, fn as _assert_hoist, ft as createAndSetupBranch, g as renderCatch, gt as _resume, h as patchDynamicTag, hn as decodeAccessor, ht as _el, i as _dynamic_tag_content, in as queueEffect, it as _text, j as _attr_select_value, jt as _for_selector, k as _attr_input_value_dynamic_default, kt as _el_read, l as _if, ln as forOf, lt as _content, mn as _call, mt as setupBranch, n as _await_promise, nn as prepareEffects, nt as _style_rule_item, o as _for_of, on as runEffects, ot as _to_text, p as addAwaitCounter, pn as _hoist_read_error, pt as createBranch, q as _attr_style_item, qt as insertBranchBefore, r as _dynamic_tag, rn as queueAsyncRender, rt as _style_shell, s as _for_to, sn as runId, st as insertChildNodes, t as _await_content, tt as _lifecycle, u as _resume_dynamic_tag, un as forTo, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as withLazy, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _or } from "./dom-BbknkVDz.mjs";
|
|
98
98
|
//#region src/common/attr-tag.ts
|
|
99
99
|
function attrTag(attrs) {
|
|
100
100
|
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
@@ -197,4 +197,4 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
197
197
|
return document.querySelector(selector) || resolve();
|
|
198
198
|
}
|
|
199
199
|
//#endregion
|
|
200
|
-
export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _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, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _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, _resume, _resume_dynamic_tag, _return, _return_change, _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, run };
|
|
200
|
+
export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _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, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _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, _resume, _resume_dynamic_tag, _return, _return_change, _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 };
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -47,7 +47,8 @@ export declare function _hoist(scopeId: number, id: string): {
|
|
|
47
47
|
[Symbol.iterator]: typeof _hoist_read_error;
|
|
48
48
|
};
|
|
49
49
|
export declare function _el_resume(scopeId: number, accessor: Accessor, shouldResume?: number): string;
|
|
50
|
-
export declare function
|
|
50
|
+
export declare function _text_resume(scopeId: number, accessor: Accessor, val: unknown, shouldResume?: number): string;
|
|
51
|
+
export declare function _html_resume(scopeId: number, accessor: Accessor, val: unknown, shouldResume?: number): string;
|
|
51
52
|
export declare function _resume_branch(scopeId: number): void;
|
|
52
53
|
export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: unknown, serializeReason?: number): void;
|
|
53
54
|
export declare function _var(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string, nodeAccessor?: Accessor): void;
|
package/dist/html.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export { _escape, _escape_comment, _escape_script, _escape_style, _escape_style_
|
|
|
7
7
|
export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
|
|
8
8
|
export { forIn, forOf, forTo, forUntil } from "./html/for";
|
|
9
9
|
export { _template } from "./html/template";
|
|
10
|
-
export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _scope_with_id, _script,
|
|
10
|
+
export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _html_resume, _scope_with_id, _script, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _text_resume, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
|
package/dist/html.js
CHANGED
|
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
|
-
}, 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, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
7
|
+
}, 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, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, 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__ */ (() => {
|
|
8
8
|
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
9
9
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
10
10
|
let symbol = Symbol[name];
|
|
@@ -262,7 +262,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
262
262
|
_html(`</${renderer}>`);
|
|
263
263
|
}
|
|
264
264
|
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
265
|
-
needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("
|
|
265
|
+
needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
|
|
266
266
|
})(), result = _el(branchId, "_e");
|
|
267
267
|
} else {
|
|
268
268
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
@@ -279,7 +279,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
279
279
|
result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId, beforeBranch !== void 0 && (applyBranchStart(chunk, beforeBranch, rendered), _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : ""))));
|
|
280
280
|
}
|
|
281
281
|
return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: rendererKey(renderer) }) : _scope_id(), result;
|
|
282
|
-
}, patchDynamicTag = ((originalDynamicTag) => (patch) => {
|
|
282
|
+
}, patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
|
|
283
283
|
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
|
284
284
|
let patched = patch(tag, scopeId, accessor);
|
|
285
285
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
@@ -1349,10 +1349,21 @@ function _hoist(scopeId, id) {
|
|
|
1349
1349
|
function _el_resume(scopeId, accessor, shouldResume) {
|
|
1350
1350
|
if (shouldResume === 0) return "";
|
|
1351
1351
|
let { state } = $chunk.boundary;
|
|
1352
|
-
return state.needsMainRuntime = !0, state.mark("
|
|
1352
|
+
return state.needsMainRuntime = !0, state.mark("$", scopeId + " " + accessor);
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1355
|
-
return
|
|
1354
|
+
function _text_resume(scopeId, accessor, val, shouldResume) {
|
|
1355
|
+
return markText(scopeId, accessor, _escape(val), shouldResume);
|
|
1356
|
+
}
|
|
1357
|
+
function _html_resume(scopeId, accessor, val, shouldResume) {
|
|
1358
|
+
let html = _unescaped(val);
|
|
1359
|
+
if (shouldResume === 0 || !~html.indexOf("<")) return markText(scopeId, accessor, html, shouldResume);
|
|
1360
|
+
let { state } = $chunk.boundary;
|
|
1361
|
+
return state.needsMainRuntime = !0, state.mark("&", "") + html + state.mark("'", scopeId + " " + accessor);
|
|
1362
|
+
}
|
|
1363
|
+
function markText(scopeId, accessor, text, shouldResume) {
|
|
1364
|
+
if (shouldResume === 0) return text;
|
|
1365
|
+
let { state } = $chunk.boundary;
|
|
1366
|
+
return state.needsMainRuntime = !0, text ? (shouldResume === 2 ? "<!>" : "") + text + state.mark("$", scopeId + " " + accessor) : state.mark("%", scopeId + " " + accessor);
|
|
1356
1367
|
}
|
|
1357
1368
|
function _resume_branch(scopeId) {
|
|
1358
1369
|
let branchId = $chunk.context?.[kBranchId];
|
|
@@ -1538,7 +1549,7 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1538
1549
|
};
|
|
1539
1550
|
}
|
|
1540
1551
|
function tryCatch(content, catchContent) {
|
|
1541
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state,
|
|
1552
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, boundary.signal, boundary), body = chunk.fork(catchBoundary, null), bodyEnd = body.render(content);
|
|
1542
1553
|
if (catchBoundary.signal.aborted) {
|
|
1543
1554
|
catchContent(catchBoundary.signal.reason);
|
|
1544
1555
|
return;
|
|
@@ -2211,7 +2222,7 @@ function flush(g, html) {
|
|
|
2211
2222
|
for (; bi < length; bi++) result += assetFlush(g, "block", assets[bi].id);
|
|
2212
2223
|
for (; di < length; di++) {
|
|
2213
2224
|
let { id, triggers } = assets[di], deferHTML = assetFlush(g, "defer", id);
|
|
2214
|
-
triggers ? deferHTML && writeTriggerScript(deferHTML, triggers) : result += deferHTML;
|
|
2225
|
+
triggers ? deferHTML && writeTriggerScript(id, deferHTML, triggers) : result += deferHTML;
|
|
2215
2226
|
}
|
|
2216
2227
|
return g[kBlockIndex] = bi, g[kDeferIndex] = di, result + html;
|
|
2217
2228
|
}
|
|
@@ -2225,7 +2236,7 @@ function addAsset(g, id, triggers) {
|
|
|
2225
2236
|
triggers
|
|
2226
2237
|
}], g[kBlockIndex] = g[kDeferIndex] = 0);
|
|
2227
2238
|
}
|
|
2228
|
-
function writeTriggerScript(html, triggers) {
|
|
2239
|
+
function writeTriggerScript(id, html, triggers) {
|
|
2229
2240
|
let htmlStr = _escape_script(JSON.stringify(html)), exprs = triggers.map((trigger) => {
|
|
2230
2241
|
let options = trigger.options && toObjectExpression(trigger.options);
|
|
2231
2242
|
switch (trigger.type) {
|
|
@@ -2260,4 +2271,4 @@ exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr
|
|
|
2260
2271
|
get: function() {
|
|
2261
2272
|
return _dynamic_tag;
|
|
2262
2273
|
}
|
|
2263
|
-
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports.
|
|
2274
|
+
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._text_resume = _text_resume, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|
package/dist/html.mjs
CHANGED
|
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
|
-
}, 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, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
7
|
+
}, 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, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, 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__ */ (() => {
|
|
8
8
|
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
9
9
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
10
10
|
let symbol = Symbol[name];
|
|
@@ -262,7 +262,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
262
262
|
_html(`</${renderer}>`);
|
|
263
263
|
}
|
|
264
264
|
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
265
|
-
needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("
|
|
265
|
+
needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
|
|
266
266
|
})(), result = _el(branchId, "_e");
|
|
267
267
|
} else {
|
|
268
268
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
@@ -279,7 +279,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
279
279
|
result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId, beforeBranch !== void 0 && (applyBranchStart(chunk, beforeBranch, rendered), _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : ""))));
|
|
280
280
|
}
|
|
281
281
|
return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: rendererKey(renderer) }) : _scope_id(), result;
|
|
282
|
-
}, patchDynamicTag = ((originalDynamicTag) => (patch) => {
|
|
282
|
+
}, patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
|
|
283
283
|
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
|
284
284
|
let patched = patch(tag, scopeId, accessor);
|
|
285
285
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
@@ -1348,10 +1348,21 @@ function _hoist(scopeId, id) {
|
|
|
1348
1348
|
function _el_resume(scopeId, accessor, shouldResume) {
|
|
1349
1349
|
if (shouldResume === 0) return "";
|
|
1350
1350
|
let { state } = $chunk.boundary;
|
|
1351
|
-
return state.needsMainRuntime = !0, state.mark("
|
|
1351
|
+
return state.needsMainRuntime = !0, state.mark("$", scopeId + " " + accessor);
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1354
|
-
return
|
|
1353
|
+
function _text_resume(scopeId, accessor, val, shouldResume) {
|
|
1354
|
+
return markText(scopeId, accessor, _escape(val), shouldResume);
|
|
1355
|
+
}
|
|
1356
|
+
function _html_resume(scopeId, accessor, val, shouldResume) {
|
|
1357
|
+
let html = _unescaped(val);
|
|
1358
|
+
if (shouldResume === 0 || !~html.indexOf("<")) return markText(scopeId, accessor, html, shouldResume);
|
|
1359
|
+
let { state } = $chunk.boundary;
|
|
1360
|
+
return state.needsMainRuntime = !0, state.mark("&", "") + html + state.mark("'", scopeId + " " + accessor);
|
|
1361
|
+
}
|
|
1362
|
+
function markText(scopeId, accessor, text, shouldResume) {
|
|
1363
|
+
if (shouldResume === 0) return text;
|
|
1364
|
+
let { state } = $chunk.boundary;
|
|
1365
|
+
return state.needsMainRuntime = !0, text ? (shouldResume === 2 ? "<!>" : "") + text + state.mark("$", scopeId + " " + accessor) : state.mark("%", scopeId + " " + accessor);
|
|
1355
1366
|
}
|
|
1356
1367
|
function _resume_branch(scopeId) {
|
|
1357
1368
|
let branchId = $chunk.context?.[kBranchId];
|
|
@@ -1537,7 +1548,7 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
|
|
|
1537
1548
|
};
|
|
1538
1549
|
}
|
|
1539
1550
|
function tryCatch(content, catchContent) {
|
|
1540
|
-
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state,
|
|
1551
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state, boundary.signal, boundary), body = chunk.fork(catchBoundary, null), bodyEnd = body.render(content);
|
|
1541
1552
|
if (catchBoundary.signal.aborted) {
|
|
1542
1553
|
catchContent(catchBoundary.signal.reason);
|
|
1543
1554
|
return;
|
|
@@ -2210,7 +2221,7 @@ function flush(g, html) {
|
|
|
2210
2221
|
for (; bi < length; bi++) result += assetFlush(g, "block", assets[bi].id);
|
|
2211
2222
|
for (; di < length; di++) {
|
|
2212
2223
|
let { id, triggers } = assets[di], deferHTML = assetFlush(g, "defer", id);
|
|
2213
|
-
triggers ? deferHTML && writeTriggerScript(deferHTML, triggers) : result += deferHTML;
|
|
2224
|
+
triggers ? deferHTML && writeTriggerScript(id, deferHTML, triggers) : result += deferHTML;
|
|
2214
2225
|
}
|
|
2215
2226
|
return g[kBlockIndex] = bi, g[kDeferIndex] = di, result + html;
|
|
2216
2227
|
}
|
|
@@ -2224,7 +2235,7 @@ function addAsset(g, id, triggers) {
|
|
|
2224
2235
|
triggers
|
|
2225
2236
|
}], g[kBlockIndex] = g[kDeferIndex] = 0);
|
|
2226
2237
|
}
|
|
2227
|
-
function writeTriggerScript(html, triggers) {
|
|
2238
|
+
function writeTriggerScript(id, html, triggers) {
|
|
2228
2239
|
let htmlStr = _escape_script(JSON.stringify(html)), exprs = triggers.map((trigger) => {
|
|
2229
2240
|
let options = trigger.options && toObjectExpression(trigger.options);
|
|
2230
2241
|
switch (trigger.type) {
|
|
@@ -2255,4 +2266,4 @@ function drainClassFunctions($global, writeScope) {
|
|
|
2255
2266
|
}
|
|
2256
2267
|
function NOOP() {}
|
|
2257
2268
|
//#endregion
|
|
2258
|
-
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script,
|
|
2269
|
+
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_resume, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _text_resume, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
|