marko 6.1.24 → 6.2.0
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/helpers.d.ts +1 -0
- package/dist/debug/dom.js +59 -2
- package/dist/debug/dom.mjs +57 -3
- package/dist/debug/html.js +38 -11
- package/dist/debug/html.mjs +35 -12
- package/dist/dom/control-flow.d.ts +1 -0
- package/dist/dom/dom.d.ts +2 -0
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +34 -1
- package/dist/dom.mjs +34 -1
- package/dist/html/attrs.d.ts +1 -0
- package/dist/html/content.d.ts +1 -0
- package/dist/html/inlined-runtimes.d.ts +1 -1
- package/dist/html/inlined-runtimes.debug.d.ts +1 -1
- package/dist/html/writer.d.ts +2 -0
- package/dist/html.d.ts +3 -3
- package/dist/html.js +25 -6
- package/dist/html.mjs +25 -6
- package/dist/translator/core/index.d.ts +1 -0
- package/dist/translator/core/show.d.ts +17 -0
- package/dist/translator/core/style.d.ts +6 -0
- package/dist/translator/index.d.ts +1 -0
- package/dist/translator/index.js +400 -42
- package/dist/translator/util/style-interpolation.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const WALKER_RUNTIME_CODE = "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))";
|
|
2
|
-
export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.
|
|
2
|
+
export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n d: doc,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((lookup[(id = op.slice(prefixLen + 1))] = node), op[prefixLen])),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n, self[runtimeId]))";
|
|
2
|
-
export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.
|
|
2
|
+
export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n c(start = runtime.l[\"^\" + id]) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n (nextSibling =\n runtime.l[id].previousSibling || start).remove(),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ export declare function _for_in(obj: Falsy | {}, cb: (key: string, value: unknow
|
|
|
56
56
|
export declare function _for_to(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
|
57
57
|
export declare function _for_until(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
|
58
58
|
export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
|
59
|
+
export declare function _show_start(display: unknown, mark?: unknown): void;
|
|
60
|
+
export declare function _show_end(scopeId: number, accessor: Accessor, display: unknown, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1 | 0): void;
|
|
59
61
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
|
60
62
|
export { writeScope as _scope };
|
|
61
63
|
export declare function _existing_scope(scopeId: number): ScopeInternals;
|
package/dist/html.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
2
|
export { _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/errors";
|
|
3
3
|
export { _flush_head, withLoadAssets, withPageAssets } from "./html/assets";
|
|
4
|
-
export { _attr, _attr_and, _attr_class, _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, } from "./html/attrs";
|
|
4
|
+
export { _attr, _attr_and, _attr_class, _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, _style_html, } from "./html/attrs";
|
|
5
5
|
export { compat } from "./html/compat";
|
|
6
|
-
export { _escape, _escape_comment, _escape_script, _escape_style, _to_text, _unescaped, } from "./html/content";
|
|
6
|
+
export { _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _to_text, _unescaped, } from "./html/content";
|
|
7
7
|
export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
|
|
8
8
|
export { forIn, forInBy, forOf, forOfBy, forStepBy, 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, _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
|
|
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, _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
|
package/dist/html.js
CHANGED
|
@@ -375,6 +375,11 @@ function stringifyClassObject(name, value) {
|
|
|
375
375
|
function stringifyStyleObject(name, value) {
|
|
376
376
|
return value || value === 0 ? name + ":" + value : "";
|
|
377
377
|
}
|
|
378
|
+
function escapeStyleValue(str) {
|
|
379
|
+
let closers = "", result = str.replace(/[\\"'{};>]|\/(?=\*)/g, "\\$&").replace(/</g, "\\3C ");
|
|
380
|
+
for (let c of result) c === "(" ? closers = ")" + closers : c === "[" ? closers = "]" + closers : c === closers[0] && (closers = closers.slice(1));
|
|
381
|
+
return result + closers;
|
|
382
|
+
}
|
|
378
383
|
function isEventHandler(name) {
|
|
379
384
|
return /^on[A-Z-]/.test(name);
|
|
380
385
|
}
|
|
@@ -419,6 +424,9 @@ function _escape_script(val) {
|
|
|
419
424
|
function _escape_style(val) {
|
|
420
425
|
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
421
426
|
}
|
|
427
|
+
function _escape_style_value(val) {
|
|
428
|
+
return val || val === 0 ? escapeStyleValue(val + "") : "";
|
|
429
|
+
}
|
|
422
430
|
function _escape_comment(val) {
|
|
423
431
|
return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
|
|
424
432
|
}
|
|
@@ -1231,6 +1239,13 @@ function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, p
|
|
|
1231
1239
|
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1232
1240
|
else $chunk.writeHTML(endTag);
|
|
1233
1241
|
}
|
|
1242
|
+
function _show_start(display, mark) {
|
|
1243
|
+
display ? mark && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1244
|
+
}
|
|
1245
|
+
function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1246
|
+
let branchId = _scope_id(), wrap = !display;
|
|
1247
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1248
|
+
}
|
|
1234
1249
|
function _existing_scope(scopeId) {
|
|
1235
1250
|
return writeScope(scopeId, {});
|
|
1236
1251
|
}
|
|
@@ -1480,7 +1495,7 @@ var State = class {
|
|
|
1480
1495
|
return scripts;
|
|
1481
1496
|
}
|
|
1482
1497
|
flushScript() {
|
|
1483
|
-
let { boundary } = this, { state } = boundary, { $global, runtimePrefix
|
|
1498
|
+
let { boundary } = this, { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1484
1499
|
needsWalk && (state.walkOnNextFlush = !1);
|
|
1485
1500
|
let readyResumeScripts = this.flushReadyScripts();
|
|
1486
1501
|
for (let channel; channel = state.serializer.pendingReadyChannel();) {
|
|
@@ -1490,7 +1505,7 @@ var State = class {
|
|
|
1490
1505
|
readyResumeScripts && (needsWalk = !0);
|
|
1491
1506
|
let { effects } = this, { html, scripts } = this;
|
|
1492
1507
|
if (state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]"))), state.writeReorders) {
|
|
1493
|
-
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0,
|
|
1508
|
+
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
1494
1509
|
for (let reorderedChunk of state.writeReorders) {
|
|
1495
1510
|
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1496
1511
|
for (reorderedChunk.reorderId = null;;) {
|
|
@@ -1501,7 +1516,7 @@ var State = class {
|
|
|
1501
1516
|
}
|
|
1502
1517
|
reorderEffects && (state.hasWrittenResume || (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[]")), reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")"));
|
|
1503
1518
|
for (let reservation of readyReservations) scripts = concatScripts(scripts, reservation);
|
|
1504
|
-
scripts = concatScripts(scripts, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1519
|
+
scripts = concatScripts(scripts, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1505
1520
|
}
|
|
1506
1521
|
state.writeReorders = null;
|
|
1507
1522
|
}
|
|
@@ -1644,6 +1659,10 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, s
|
|
|
1644
1659
|
function _attr_nonce() {
|
|
1645
1660
|
return getChunk().boundary.state.nonceAttr;
|
|
1646
1661
|
}
|
|
1662
|
+
function _style_html(decls) {
|
|
1663
|
+
let id = _id();
|
|
1664
|
+
return `<style${_attr_nonce()} class=${id}>.${id} ~ *{${decls}}</style>`;
|
|
1665
|
+
}
|
|
1647
1666
|
function _attr(name, value) {
|
|
1648
1667
|
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
|
1649
1668
|
}
|
|
@@ -1781,8 +1800,8 @@ function render(input = {}) {
|
|
|
1781
1800
|
}
|
|
1782
1801
|
function getDefaultRenderId(template) {
|
|
1783
1802
|
if (template.i) {
|
|
1784
|
-
let ENCODE_CHARS = "
|
|
1785
|
-
for (n = n /
|
|
1803
|
+
let ENCODE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", n = Math.random() * 4294967296 >>> 0, r = ENCODE_CHARS[n % 52];
|
|
1804
|
+
for (n = n / 52 | 0; n; n = n / 63 | 0) r += ENCODE_CHARS[n % 63];
|
|
1786
1805
|
return r;
|
|
1787
1806
|
}
|
|
1788
1807
|
return "_";
|
|
@@ -1984,4 +2003,4 @@ exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr
|
|
|
1984
2003
|
get: function() {
|
|
1985
2004
|
return _dynamic_tag;
|
|
1986
2005
|
}
|
|
1987
|
-
}), 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._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._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._subscribe = _subscribe, exports._template = _template, 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.forInBy = forInBy, exports.forOf = forOf, exports.forOfBy = forOfBy, exports.forStepBy = forStepBy, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|
|
2006
|
+
}), 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._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._sep = _sep, 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._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.forInBy = forInBy, exports.forOf = forOf, exports.forOfBy = forOfBy, exports.forStepBy = forStepBy, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|
package/dist/html.mjs
CHANGED
|
@@ -374,6 +374,11 @@ function stringifyClassObject(name, value) {
|
|
|
374
374
|
function stringifyStyleObject(name, value) {
|
|
375
375
|
return value || value === 0 ? name + ":" + value : "";
|
|
376
376
|
}
|
|
377
|
+
function escapeStyleValue(str) {
|
|
378
|
+
let closers = "", result = str.replace(/[\\"'{};>]|\/(?=\*)/g, "\\$&").replace(/</g, "\\3C ");
|
|
379
|
+
for (let c of result) c === "(" ? closers = ")" + closers : c === "[" ? closers = "]" + closers : c === closers[0] && (closers = closers.slice(1));
|
|
380
|
+
return result + closers;
|
|
381
|
+
}
|
|
377
382
|
function isEventHandler(name) {
|
|
378
383
|
return /^on[A-Z-]/.test(name);
|
|
379
384
|
}
|
|
@@ -418,6 +423,9 @@ function _escape_script(val) {
|
|
|
418
423
|
function _escape_style(val) {
|
|
419
424
|
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
420
425
|
}
|
|
426
|
+
function _escape_style_value(val) {
|
|
427
|
+
return val || val === 0 ? escapeStyleValue(val + "") : "";
|
|
428
|
+
}
|
|
421
429
|
function _escape_comment(val) {
|
|
422
430
|
return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
|
|
423
431
|
}
|
|
@@ -1230,6 +1238,13 @@ function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, p
|
|
|
1230
1238
|
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1231
1239
|
else $chunk.writeHTML(endTag);
|
|
1232
1240
|
}
|
|
1241
|
+
function _show_start(display, mark) {
|
|
1242
|
+
display ? mark && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
|
|
1243
|
+
}
|
|
1244
|
+
function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1245
|
+
let branchId = _scope_id(), wrap = !display;
|
|
1246
|
+
wrap && $chunk.writeHTML("</t>"), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
|
|
1247
|
+
}
|
|
1233
1248
|
function _existing_scope(scopeId) {
|
|
1234
1249
|
return writeScope(scopeId, {});
|
|
1235
1250
|
}
|
|
@@ -1479,7 +1494,7 @@ var State = class {
|
|
|
1479
1494
|
return scripts;
|
|
1480
1495
|
}
|
|
1481
1496
|
flushScript() {
|
|
1482
|
-
let { boundary } = this, { state } = boundary, { $global, runtimePrefix
|
|
1497
|
+
let { boundary } = this, { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
|
|
1483
1498
|
needsWalk && (state.walkOnNextFlush = !1);
|
|
1484
1499
|
let readyResumeScripts = this.flushReadyScripts();
|
|
1485
1500
|
for (let channel; channel = state.serializer.pendingReadyChannel();) {
|
|
@@ -1489,7 +1504,7 @@ var State = class {
|
|
|
1489
1504
|
readyResumeScripts && (needsWalk = !0);
|
|
1490
1505
|
let { effects } = this, { html, scripts } = this;
|
|
1491
1506
|
if (state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]"))), state.writeReorders) {
|
|
1492
|
-
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0,
|
|
1507
|
+
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
1493
1508
|
for (let reorderedChunk of state.writeReorders) {
|
|
1494
1509
|
let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1495
1510
|
for (reorderedChunk.reorderId = null;;) {
|
|
@@ -1500,7 +1515,7 @@ var State = class {
|
|
|
1500
1515
|
}
|
|
1501
1516
|
reorderEffects && (state.hasWrittenResume || (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[]")), reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")"));
|
|
1502
1517
|
for (let reservation of readyReservations) scripts = concatScripts(scripts, reservation);
|
|
1503
|
-
scripts = concatScripts(scripts, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1518
|
+
scripts = concatScripts(scripts, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1504
1519
|
}
|
|
1505
1520
|
state.writeReorders = null;
|
|
1506
1521
|
}
|
|
@@ -1643,6 +1658,10 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, s
|
|
|
1643
1658
|
function _attr_nonce() {
|
|
1644
1659
|
return getChunk().boundary.state.nonceAttr;
|
|
1645
1660
|
}
|
|
1661
|
+
function _style_html(decls) {
|
|
1662
|
+
let id = _id();
|
|
1663
|
+
return `<style${_attr_nonce()} class=${id}>.${id} ~ *{${decls}}</style>`;
|
|
1664
|
+
}
|
|
1646
1665
|
function _attr(name, value) {
|
|
1647
1666
|
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
|
1648
1667
|
}
|
|
@@ -1780,8 +1799,8 @@ function render(input = {}) {
|
|
|
1780
1799
|
}
|
|
1781
1800
|
function getDefaultRenderId(template) {
|
|
1782
1801
|
if (template.i) {
|
|
1783
|
-
let ENCODE_CHARS = "
|
|
1784
|
-
for (n = n /
|
|
1802
|
+
let ENCODE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", n = Math.random() * 4294967296 >>> 0, r = ENCODE_CHARS[n % 52];
|
|
1803
|
+
for (n = n / 52 | 0; n; n = n / 63 | 0) r += ENCODE_CHARS[n % 63];
|
|
1785
1804
|
return r;
|
|
1786
1805
|
}
|
|
1787
1806
|
return "_";
|
|
@@ -1979,4 +1998,4 @@ function toObjectExpression(options) {
|
|
|
1979
1998
|
//#region src/html/compat.ts
|
|
1980
1999
|
function NOOP() {}
|
|
1981
2000
|
//#endregion
|
|
1982
|
-
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, _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, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _template, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
|
|
2001
|
+
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, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
|
|
@@ -106,6 +106,7 @@ declare const _default: {
|
|
|
106
106
|
"<return>": import("@marko/compiler/babel-utils").Tag;
|
|
107
107
|
"<script>": import("@marko/compiler/babel-utils").Tag;
|
|
108
108
|
"<server>": import("@marko/compiler/babel-utils").Tag;
|
|
109
|
+
"<show>": import("@marko/compiler/babel-utils").Tag;
|
|
109
110
|
"<static>": import("@marko/compiler/babel-utils").Tag;
|
|
110
111
|
"<style>": import("@marko/compiler/babel-utils").Tag;
|
|
111
112
|
"<try>": import("@marko/compiler/babel-utils").Tag;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { types as t } from "@marko/compiler";
|
|
2
|
+
import { type Tag } from "@marko/compiler/babel-utils";
|
|
3
|
+
import { type Binding } from "../util/references";
|
|
4
|
+
declare const kStartBinding: unique symbol;
|
|
5
|
+
declare const kStaticDisplay: unique symbol;
|
|
6
|
+
declare const kSingleNodeBody: unique symbol;
|
|
7
|
+
declare const kDisplayRef: unique symbol;
|
|
8
|
+
declare module "@marko/compiler/dist/types" {
|
|
9
|
+
interface NodeExtra {
|
|
10
|
+
[kStartBinding]?: Binding;
|
|
11
|
+
[kStaticDisplay]?: boolean;
|
|
12
|
+
[kSingleNodeBody]?: boolean;
|
|
13
|
+
[kDisplayRef]?: t.Expression;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
declare const _default: Tag;
|
|
17
|
+
export default _default;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { type Tag } from "@marko/compiler/babel-utils";
|
|
2
|
+
import { type Binding } from "../util/references";
|
|
3
|
+
interface DynamicStyle {
|
|
4
|
+
names: string[];
|
|
5
|
+
binding: Binding;
|
|
6
|
+
}
|
|
2
7
|
declare module "@marko/compiler/dist/types" {
|
|
3
8
|
interface NodeExtra {
|
|
4
9
|
styleImportPath?: string | null;
|
|
10
|
+
dynamicStyle?: DynamicStyle;
|
|
5
11
|
}
|
|
6
12
|
}
|
|
7
13
|
declare const _default: Tag;
|
|
@@ -113,6 +113,7 @@ export declare const taglibs: (string | {
|
|
|
113
113
|
"<return>": import("@marko/compiler/babel-utils").Tag;
|
|
114
114
|
"<script>": import("@marko/compiler/babel-utils").Tag;
|
|
115
115
|
"<server>": import("@marko/compiler/babel-utils").Tag;
|
|
116
|
+
"<show>": import("@marko/compiler/babel-utils").Tag;
|
|
116
117
|
"<static>": import("@marko/compiler/babel-utils").Tag;
|
|
117
118
|
"<style>": import("@marko/compiler/babel-utils").Tag;
|
|
118
119
|
"<try>": import("@marko/compiler/babel-utils").Tag;
|