marko 6.0.59 → 6.0.61
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/debug/dom.js +278 -296
- package/dist/debug/dom.mjs +278 -296
- package/dist/debug/html.js +219 -219
- package/dist/debug/html.mjs +169 -169
- package/dist/dom/abort-signal.d.ts +2 -2
- package/dist/dom/control-flow.d.ts +8 -8
- package/dist/dom/controllable.d.ts +11 -11
- package/dist/dom/dom.d.ts +17 -18
- package/dist/dom/event.d.ts +1 -1
- package/dist/dom/queue.d.ts +1 -1
- package/dist/dom/renderer.d.ts +4 -4
- package/dist/dom/resume.d.ts +3 -3
- package/dist/dom/signals.d.ts +14 -14
- package/dist/dom/template.d.ts +1 -1
- package/dist/dom.d.ts +10 -10
- package/dist/dom.js +254 -265
- package/dist/dom.mjs +254 -265
- package/dist/html/attrs.d.ts +14 -14
- package/dist/html/compat.d.ts +5 -5
- package/dist/html/content.d.ts +4 -4
- package/dist/html/dynamic-tag.d.ts +3 -3
- package/dist/html/template.d.ts +1 -1
- package/dist/html/writer.d.ts +26 -26
- package/dist/html.d.ts +5 -5
- package/dist/html.js +210 -210
- package/dist/html.mjs +160 -160
- package/dist/translator/index.js +501 -483
- package/dist/translator/util/runtime.d.ts +8 -8
- package/dist/translator/util/signals.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/html.mjs
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
// src/common/attr-tag.ts
|
2
2
|
var empty = [];
|
3
3
|
var rest = true ? Symbol("Attribute Tag") : Symbol();
|
4
|
-
function attrTag(
|
5
|
-
|
6
|
-
|
7
|
-
return
|
4
|
+
function attrTag(attrs) {
|
5
|
+
attrs[Symbol.iterator] = attrTagIterator;
|
6
|
+
attrs[rest] = empty;
|
7
|
+
return attrs;
|
8
8
|
}
|
9
|
-
function attrTags(first,
|
9
|
+
function attrTags(first, attrs) {
|
10
10
|
if (first) {
|
11
11
|
if (first[rest] === empty) {
|
12
|
-
first[rest] = [
|
12
|
+
first[rest] = [attrs];
|
13
13
|
} else {
|
14
|
-
first[rest].push(
|
14
|
+
first[rest].push(attrs);
|
15
15
|
}
|
16
16
|
return first;
|
17
17
|
}
|
18
|
-
return attrTag(
|
18
|
+
return attrTag(attrs);
|
19
19
|
}
|
20
20
|
function* attrTagIterator() {
|
21
21
|
yield this;
|
@@ -76,13 +76,13 @@ function normalizeDynamicRenderer(value) {
|
|
76
76
|
}
|
77
77
|
|
78
78
|
// src/html/content.ts
|
79
|
-
function
|
79
|
+
function _unescaped(val) {
|
80
80
|
return val ? val + "" : val === 0 ? "0" : "";
|
81
81
|
}
|
82
82
|
var unsafeXMLReg = /[<&]/g;
|
83
83
|
var replaceUnsafeXML = (c) => c === "&" ? "&" : "<";
|
84
84
|
var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
85
|
-
function
|
85
|
+
function _escape(val) {
|
86
86
|
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "‍";
|
87
87
|
}
|
88
88
|
function escapeTextAreaValue(val) {
|
@@ -90,12 +90,12 @@ function escapeTextAreaValue(val) {
|
|
90
90
|
}
|
91
91
|
var unsafeScriptReg = /<\/script/g;
|
92
92
|
var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
93
|
-
function
|
93
|
+
function _escape_script(val) {
|
94
94
|
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
95
95
|
}
|
96
96
|
var unsafeStyleReg = /<\/style/g;
|
97
97
|
var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
98
|
-
function
|
98
|
+
function _escape_style(val) {
|
99
99
|
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
100
100
|
}
|
101
101
|
|
@@ -701,7 +701,7 @@ function writeProp(state, val, parent, accessor) {
|
|
701
701
|
return false;
|
702
702
|
}
|
703
703
|
}
|
704
|
-
function writeReferenceOr(state,
|
704
|
+
function writeReferenceOr(state, write, val, parent, accessor) {
|
705
705
|
let ref = state.refs.get(val);
|
706
706
|
if (ref) {
|
707
707
|
if (ref.init) {
|
@@ -729,7 +729,7 @@ function writeReferenceOr(state, write2, val, parent, accessor) {
|
|
729
729
|
if (true) {
|
730
730
|
ref.debug = DEBUG.get(val);
|
731
731
|
}
|
732
|
-
if (
|
732
|
+
if (write(state, val, ref)) return true;
|
733
733
|
state.refs.delete(ref);
|
734
734
|
return false;
|
735
735
|
}
|
@@ -1610,20 +1610,20 @@ function getState() {
|
|
1610
1610
|
function getScopeId(scope) {
|
1611
1611
|
return scope[K_SCOPE_ID];
|
1612
1612
|
}
|
1613
|
-
function
|
1613
|
+
function _html(html) {
|
1614
1614
|
$chunk.writeHTML(html);
|
1615
1615
|
}
|
1616
1616
|
function writeScript(script) {
|
1617
1617
|
$chunk.writeScript(script);
|
1618
1618
|
}
|
1619
|
-
function
|
1619
|
+
function _script(scopeId, registryId) {
|
1620
1620
|
$chunk.boundary.state.needsMainRuntime = true;
|
1621
1621
|
$chunk.writeEffect(scopeId, registryId);
|
1622
1622
|
}
|
1623
|
-
function
|
1623
|
+
function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
|
1624
1624
|
const shouldResume = serializeReason !== 0;
|
1625
1625
|
const render2 = normalizeServerRender(content);
|
1626
|
-
const branchId =
|
1626
|
+
const branchId = _peek_scope_id();
|
1627
1627
|
if (render2) {
|
1628
1628
|
if (shouldResume) {
|
1629
1629
|
withBranchId(branchId, render2);
|
@@ -1631,7 +1631,7 @@ function writeContent(nodeAccessor, scopeId, content, serializeReason) {
|
|
1631
1631
|
render2();
|
1632
1632
|
}
|
1633
1633
|
}
|
1634
|
-
const rendered =
|
1634
|
+
const rendered = _peek_scope_id() !== branchId;
|
1635
1635
|
if (rendered) {
|
1636
1636
|
if (shouldResume) {
|
1637
1637
|
writeScope(scopeId, {
|
@@ -1643,7 +1643,7 @@ function writeContent(nodeAccessor, scopeId, content, serializeReason) {
|
|
1643
1643
|
});
|
1644
1644
|
}
|
1645
1645
|
} else {
|
1646
|
-
|
1646
|
+
_scope_id();
|
1647
1647
|
}
|
1648
1648
|
}
|
1649
1649
|
function normalizeServerRender(value) {
|
@@ -1671,26 +1671,26 @@ function withContext(key, value, cb) {
|
|
1671
1671
|
ctx[key] = prev;
|
1672
1672
|
}
|
1673
1673
|
}
|
1674
|
-
function
|
1675
|
-
|
1676
|
-
|
1674
|
+
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
|
1675
|
+
_scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id();
|
1676
|
+
_scope_with_id(childScopeId)["#TagVariable" /* TagVariable */] = _resume(
|
1677
1677
|
{},
|
1678
1678
|
registryId,
|
1679
1679
|
parentScopeId
|
1680
1680
|
);
|
1681
1681
|
}
|
1682
|
-
function
|
1683
|
-
return scopeId === void 0 ? register(id, val) : register(id, val,
|
1682
|
+
function _resume(val, id, scopeId) {
|
1683
|
+
return scopeId === void 0 ? register(id, val) : register(id, val, _scope_with_id(scopeId));
|
1684
1684
|
}
|
1685
|
-
function
|
1685
|
+
function _id() {
|
1686
1686
|
const state = $chunk.boundary.state;
|
1687
1687
|
const { $global: $global2 } = state;
|
1688
1688
|
return "s" + $global2.runtimeId + $global2.renderId + (state.tagId++).toString(36);
|
1689
1689
|
}
|
1690
|
-
function
|
1690
|
+
function _scope_id() {
|
1691
1691
|
return $chunk.boundary.state.scopeId++;
|
1692
1692
|
}
|
1693
|
-
function
|
1693
|
+
function _peek_scope_id() {
|
1694
1694
|
return $chunk.boundary.state.scopeId;
|
1695
1695
|
}
|
1696
1696
|
function getScopeById(scopeId) {
|
@@ -1698,39 +1698,39 @@ function getScopeById(scopeId) {
|
|
1698
1698
|
return $chunk.boundary.state.scopes.get(scopeId);
|
1699
1699
|
}
|
1700
1700
|
}
|
1701
|
-
function
|
1701
|
+
function _serialize_if(condition, key) {
|
1702
1702
|
return condition && (condition === 1 || condition[key]) ? 1 : void 0;
|
1703
1703
|
}
|
1704
|
-
function
|
1704
|
+
function _serialize_guard(condition, key) {
|
1705
1705
|
return condition && (condition === 1 || condition[key]) ? 1 : 0;
|
1706
1706
|
}
|
1707
|
-
function
|
1707
|
+
function _el_resume(scopeId, accessor, shouldResume) {
|
1708
1708
|
if (shouldResume === 0) return "";
|
1709
1709
|
const { state } = $chunk.boundary;
|
1710
1710
|
state.needsMainRuntime = true;
|
1711
1711
|
return state.mark("*" /* Node */, scopeId + " " + accessor);
|
1712
1712
|
}
|
1713
|
-
function
|
1713
|
+
function _sep(shouldResume) {
|
1714
1714
|
return shouldResume === 0 ? "" : "<!>";
|
1715
1715
|
}
|
1716
|
-
function
|
1716
|
+
function _el(scopeId, id) {
|
1717
1717
|
const getter = () => {
|
1718
1718
|
if (true) {
|
1719
1719
|
throw new Error("Cannot read a node reference on the server.");
|
1720
1720
|
}
|
1721
1721
|
};
|
1722
|
-
return id ?
|
1722
|
+
return id ? _resume(getter, id, scopeId) : getter;
|
1723
1723
|
}
|
1724
|
-
function
|
1724
|
+
function _hoist(scopeId, id) {
|
1725
1725
|
const getter = () => {
|
1726
1726
|
if (true) {
|
1727
1727
|
throw new Error("Cannot read a hoisted value on the server.");
|
1728
1728
|
}
|
1729
1729
|
};
|
1730
1730
|
getter[Symbol.iterator] = getter;
|
1731
|
-
return id ?
|
1731
|
+
return id ? _resume(getter, id, scopeId) : getter;
|
1732
1732
|
}
|
1733
|
-
function
|
1733
|
+
function _resume_branch(scopeId) {
|
1734
1734
|
const branchId = $chunk.context?.[branchIdKey];
|
1735
1735
|
if (branchId !== void 0 && branchId !== scopeId) {
|
1736
1736
|
writeScope(scopeId, { ["#ClosestBranchId" /* ClosestBranchId */]: branchId });
|
@@ -1743,7 +1743,7 @@ function isInResumedBranch() {
|
|
1743
1743
|
function withBranchId(branchId, cb) {
|
1744
1744
|
return withContext(branchIdKey, branchId, cb);
|
1745
1745
|
}
|
1746
|
-
function
|
1746
|
+
function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1747
1747
|
const { state } = $chunk.boundary;
|
1748
1748
|
const resumeBranch = serializeBranch !== 0;
|
1749
1749
|
const resumeMarker = serializeMarker !== 0;
|
@@ -1751,7 +1751,7 @@ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serialize
|
|
1751
1751
|
if (resumeBranch) {
|
1752
1752
|
const loopScopes = /* @__PURE__ */ new Map();
|
1753
1753
|
forOf(list, (item, index) => {
|
1754
|
-
const branchId =
|
1754
|
+
const branchId = _peek_scope_id();
|
1755
1755
|
if (resumeMarker) {
|
1756
1756
|
if (singleNode) {
|
1757
1757
|
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
@@ -1785,7 +1785,7 @@ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serialize
|
|
1785
1785
|
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1786
1786
|
);
|
1787
1787
|
}
|
1788
|
-
function
|
1788
|
+
function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1789
1789
|
const { state } = $chunk.boundary;
|
1790
1790
|
const resumeBranch = serializeBranch !== 0;
|
1791
1791
|
const resumeMarker = serializeMarker !== 0;
|
@@ -1794,7 +1794,7 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
|
|
1794
1794
|
const loopScopes = /* @__PURE__ */ new Map();
|
1795
1795
|
let sep = "";
|
1796
1796
|
forIn(obj, (key, value) => {
|
1797
|
-
const branchId =
|
1797
|
+
const branchId = _peek_scope_id();
|
1798
1798
|
if (resumeMarker) {
|
1799
1799
|
if (singleNode) {
|
1800
1800
|
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
@@ -1829,7 +1829,7 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
|
|
1829
1829
|
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1830
1830
|
);
|
1831
1831
|
}
|
1832
|
-
function
|
1832
|
+
function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1833
1833
|
const { state } = $chunk.boundary;
|
1834
1834
|
const resumeBranch = serializeBranch !== 0;
|
1835
1835
|
const resumeMarker = serializeMarker !== 0;
|
@@ -1838,7 +1838,7 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
|
|
1838
1838
|
const loopScopes = /* @__PURE__ */ new Map();
|
1839
1839
|
let sep = "";
|
1840
1840
|
forTo(to, from, step, (i) => {
|
1841
|
-
const branchId =
|
1841
|
+
const branchId = _peek_scope_id();
|
1842
1842
|
if (resumeMarker) {
|
1843
1843
|
if (singleNode) {
|
1844
1844
|
singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
|
@@ -1873,11 +1873,11 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
|
|
1873
1873
|
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1874
1874
|
);
|
1875
1875
|
}
|
1876
|
-
function
|
1876
|
+
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1877
1877
|
const { state } = $chunk.boundary;
|
1878
1878
|
const resumeBranch = serializeBranch !== 0;
|
1879
1879
|
const resumeMarker = serializeMarker !== 0;
|
1880
|
-
const branchId =
|
1880
|
+
const branchId = _peek_scope_id();
|
1881
1881
|
if (resumeMarker && resumeBranch && !singleNode) {
|
1882
1882
|
$chunk.writeHTML(state.mark("[" /* BranchStart */, branchId + ""));
|
1883
1883
|
}
|
@@ -1906,7 +1906,7 @@ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
|
1906
1906
|
if (mark) {
|
1907
1907
|
$chunk.writeHTML(mark + endTag);
|
1908
1908
|
} else {
|
1909
|
-
$chunk.writeHTML(endTag +
|
1909
|
+
$chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
1910
1910
|
}
|
1911
1911
|
} else {
|
1912
1912
|
$chunk.writeHTML(endTag);
|
@@ -1942,10 +1942,10 @@ if (true) {
|
|
1942
1942
|
return scope;
|
1943
1943
|
})(writeScope);
|
1944
1944
|
}
|
1945
|
-
function
|
1946
|
-
return writeScope(scopeId,
|
1945
|
+
function _existing_scope(scopeId) {
|
1946
|
+
return writeScope(scopeId, _scope_with_id(scopeId));
|
1947
1947
|
}
|
1948
|
-
function
|
1948
|
+
function _scope_with_id(scopeId) {
|
1949
1949
|
const { state } = $chunk.boundary;
|
1950
1950
|
let scope = state.scopes.get(scopeId);
|
1951
1951
|
if (!scope) {
|
@@ -1957,11 +1957,11 @@ function ensureScopeWithId(scopeId) {
|
|
1957
1957
|
function $global() {
|
1958
1958
|
return $chunk.boundary.state.$global;
|
1959
1959
|
}
|
1960
|
-
function
|
1960
|
+
function _await(scopeId, accessor, promise, content, serializeMarker) {
|
1961
1961
|
const resumeMarker = serializeMarker !== 0;
|
1962
1962
|
if (!isPromise(promise)) {
|
1963
1963
|
if (resumeMarker) {
|
1964
|
-
const branchId =
|
1964
|
+
const branchId = _peek_scope_id();
|
1965
1965
|
$chunk.writeHTML(
|
1966
1966
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1967
1967
|
);
|
@@ -1995,7 +1995,7 @@ function fork(scopeId, accessor, promise, content, serializeMarker) {
|
|
1995
1995
|
if (!boundary.signal.aborted) {
|
1996
1996
|
chunk.render(() => {
|
1997
1997
|
if (resumeMarker) {
|
1998
|
-
const branchId =
|
1998
|
+
const branchId = _peek_scope_id();
|
1999
1999
|
$chunk.writeHTML(
|
2000
2000
|
$chunk.boundary.state.mark(
|
2001
2001
|
"[" /* BranchStart */,
|
@@ -2005,7 +2005,7 @@ function fork(scopeId, accessor, promise, content, serializeMarker) {
|
|
2005
2005
|
content(value);
|
2006
2006
|
boundary.state.serializer.writeAssign(
|
2007
2007
|
writeScope(branchId, {}),
|
2008
|
-
|
2008
|
+
_scope_with_id(scopeId),
|
2009
2009
|
"ConditionalScope:" /* ConditionalScope */ + accessor
|
2010
2010
|
);
|
2011
2011
|
$chunk.writeHTML(
|
@@ -2028,8 +2028,8 @@ function fork(scopeId, accessor, promise, content, serializeMarker) {
|
|
2028
2028
|
}
|
2029
2029
|
);
|
2030
2030
|
}
|
2031
|
-
function
|
2032
|
-
const branchId =
|
2031
|
+
function _try(scopeId, accessor, content, input) {
|
2032
|
+
const branchId = _peek_scope_id();
|
2033
2033
|
$chunk.writeHTML(
|
2034
2034
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
2035
2035
|
);
|
@@ -2472,7 +2472,7 @@ function flushSerializer(boundary) {
|
|
2472
2472
|
}
|
2473
2473
|
}
|
2474
2474
|
}
|
2475
|
-
function
|
2475
|
+
function _trailers(html) {
|
2476
2476
|
$chunk.boundary.state.trailerHTML += html;
|
2477
2477
|
}
|
2478
2478
|
function concatEffects(a, b) {
|
@@ -2536,24 +2536,24 @@ function getFilteredGlobals($global2) {
|
|
2536
2536
|
}
|
2537
2537
|
return filtered;
|
2538
2538
|
}
|
2539
|
-
function
|
2539
|
+
function _subscribe(subscribers, scope) {
|
2540
2540
|
$chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
2541
2541
|
return scope;
|
2542
2542
|
}
|
2543
2543
|
|
2544
2544
|
// src/html/attrs.ts
|
2545
|
-
function
|
2545
|
+
function _attr_class(value) {
|
2546
2546
|
return stringAttr("class", classValue(value));
|
2547
2547
|
}
|
2548
|
-
function
|
2548
|
+
function _attr_style(value) {
|
2549
2549
|
return stringAttr("style", styleValue(value));
|
2550
2550
|
}
|
2551
|
-
function
|
2551
|
+
function _attr_option_value(value) {
|
2552
2552
|
const selectedValue = getContext(kSelectedValue);
|
2553
|
-
return
|
2553
|
+
return _attr("value", value) + (!isVoid(value) && (Array.isArray(selectedValue) ? selectedValue.includes(value) : selectedValue === value) ? " selected" : "");
|
2554
2554
|
}
|
2555
2555
|
var kSelectedValue = Symbol("selectedValue");
|
2556
|
-
function
|
2556
|
+
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
2557
2557
|
if (valueChange) {
|
2558
2558
|
writeControlledScope(
|
2559
2559
|
3 /* SelectValue */,
|
@@ -2567,7 +2567,7 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, co
|
|
2567
2567
|
withContext(kSelectedValue, value, content);
|
2568
2568
|
}
|
2569
2569
|
}
|
2570
|
-
function
|
2570
|
+
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
2571
2571
|
if (valueChange) {
|
2572
2572
|
writeControlledScope(
|
2573
2573
|
2 /* InputValue */,
|
@@ -2579,7 +2579,7 @@ function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange)
|
|
2579
2579
|
}
|
2580
2580
|
return escapeTextAreaValue(value);
|
2581
2581
|
}
|
2582
|
-
function
|
2582
|
+
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
2583
2583
|
if (valueChange) {
|
2584
2584
|
writeControlledScope(
|
2585
2585
|
2 /* InputValue */,
|
@@ -2589,9 +2589,9 @@ function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2589
2589
|
valueChange
|
2590
2590
|
);
|
2591
2591
|
}
|
2592
|
-
return
|
2592
|
+
return _attr("value", value);
|
2593
2593
|
}
|
2594
|
-
function
|
2594
|
+
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
2595
2595
|
if (checkedChange) {
|
2596
2596
|
writeControlledScope(
|
2597
2597
|
0 /* InputChecked */,
|
@@ -2601,11 +2601,11 @@ function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChang
|
|
2601
2601
|
checkedChange
|
2602
2602
|
);
|
2603
2603
|
}
|
2604
|
-
return
|
2604
|
+
return _attr("checked", checked);
|
2605
2605
|
}
|
2606
|
-
function
|
2606
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
2607
2607
|
const multiple = Array.isArray(checkedValue);
|
2608
|
-
const valueAttr =
|
2608
|
+
const valueAttr = _attr("value", value);
|
2609
2609
|
if (checkedValueChange) {
|
2610
2610
|
writeControlledScope(
|
2611
2611
|
1 /* InputCheckedValue */,
|
@@ -2617,7 +2617,7 @@ function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, ch
|
|
2617
2617
|
}
|
2618
2618
|
return (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
|
2619
2619
|
}
|
2620
|
-
function
|
2620
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
2621
2621
|
if (openChange) {
|
2622
2622
|
writeControlledScope(
|
2623
2623
|
4 /* DetailsOrDialogOpen */,
|
@@ -2627,26 +2627,26 @@ function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChan
|
|
2627
2627
|
openChange
|
2628
2628
|
);
|
2629
2629
|
}
|
2630
|
-
return
|
2630
|
+
return _attr("open", open);
|
2631
2631
|
}
|
2632
|
-
function
|
2632
|
+
function _attr(name, value) {
|
2633
2633
|
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
2634
2634
|
}
|
2635
|
-
function
|
2635
|
+
function _attrs(data, nodeAccessor, scopeId, tagName) {
|
2636
2636
|
let result = "";
|
2637
2637
|
let skip = /[\s/>"'=]/;
|
2638
2638
|
let events;
|
2639
2639
|
switch (tagName) {
|
2640
2640
|
case "input":
|
2641
2641
|
if (data.checkedChange) {
|
2642
|
-
result +=
|
2642
|
+
result += _attr_input_checked(
|
2643
2643
|
scopeId,
|
2644
2644
|
nodeAccessor,
|
2645
2645
|
data.checked,
|
2646
2646
|
data.checkedChange
|
2647
2647
|
);
|
2648
2648
|
} else if (data.checkedValue || data.checkedValueChange) {
|
2649
|
-
result +=
|
2649
|
+
result += _attr_input_checkedValue(
|
2650
2650
|
scopeId,
|
2651
2651
|
nodeAccessor,
|
2652
2652
|
data.checkedValue,
|
@@ -2654,7 +2654,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
2654
2654
|
data.value
|
2655
2655
|
);
|
2656
2656
|
} else if (data.valueChange) {
|
2657
|
-
result +=
|
2657
|
+
result += _attr_input_value(
|
2658
2658
|
scopeId,
|
2659
2659
|
nodeAccessor,
|
2660
2660
|
data.value,
|
@@ -2673,14 +2673,14 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
2673
2673
|
break;
|
2674
2674
|
case "option":
|
2675
2675
|
if (data.value) {
|
2676
|
-
result +=
|
2676
|
+
result += _attr_option_value(data.value);
|
2677
2677
|
skip = /^value$|[\s/>"'=]/;
|
2678
2678
|
}
|
2679
2679
|
break;
|
2680
2680
|
case "details":
|
2681
2681
|
case "dialog":
|
2682
2682
|
if (data.openChange) {
|
2683
|
-
result +=
|
2683
|
+
result += _attr_details_or_dialog_open(
|
2684
2684
|
scopeId,
|
2685
2685
|
nodeAccessor,
|
2686
2686
|
data.open,
|
@@ -2694,10 +2694,10 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
2694
2694
|
const value = data[name];
|
2695
2695
|
switch (name) {
|
2696
2696
|
case "class":
|
2697
|
-
result +=
|
2697
|
+
result += _attr_class(value);
|
2698
2698
|
break;
|
2699
2699
|
case "style":
|
2700
|
-
result +=
|
2700
|
+
result += _attr_style(value);
|
2701
2701
|
break;
|
2702
2702
|
default:
|
2703
2703
|
if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
|
@@ -2718,20 +2718,20 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
2718
2718
|
}
|
2719
2719
|
return result;
|
2720
2720
|
}
|
2721
|
-
function
|
2722
|
-
|
2723
|
-
|
2721
|
+
function _attrs_content(data, nodeAccessor, scopeId, tagName, serializeReason) {
|
2722
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`);
|
2723
|
+
_attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
2724
2724
|
}
|
2725
|
-
function
|
2725
|
+
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
2726
2726
|
const partial = {};
|
2727
2727
|
for (const key in data) {
|
2728
2728
|
if (!skip[key]) partial[key] = data[key];
|
2729
2729
|
}
|
2730
|
-
return
|
2730
|
+
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
2731
2731
|
}
|
2732
|
-
function
|
2733
|
-
|
2734
|
-
|
2732
|
+
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
2733
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`);
|
2734
|
+
_attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
2735
2735
|
}
|
2736
2736
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
2737
2737
|
writeScope(scopeId, {
|
@@ -2795,7 +2795,7 @@ var DEFAULT_RUNTIME_ID = "M";
|
|
2795
2795
|
var DEFAULT_RENDER_ID = "_";
|
2796
2796
|
|
2797
2797
|
// src/html/template.ts
|
2798
|
-
var
|
2798
|
+
var _template = (templateId, renderer) => {
|
2799
2799
|
renderer.render = render;
|
2800
2800
|
renderer._ = renderer;
|
2801
2801
|
if (true) {
|
@@ -2805,7 +2805,7 @@ var createTemplate = (templateId, renderer) => {
|
|
2805
2805
|
);
|
2806
2806
|
};
|
2807
2807
|
}
|
2808
|
-
return
|
2808
|
+
return _content_resume(templateId, renderer);
|
2809
2809
|
};
|
2810
2810
|
function isTemplate(renderer) {
|
2811
2811
|
return !!renderer._;
|
@@ -2993,14 +2993,14 @@ var ServerRendered = class {
|
|
2993
2993
|
return;
|
2994
2994
|
}
|
2995
2995
|
const { boundary } = head;
|
2996
|
-
const onNext = boundary.onNext = (
|
2996
|
+
const onNext = boundary.onNext = (write) => {
|
2997
2997
|
if (boundary.signal.aborted) {
|
2998
2998
|
if (!tick2) offTick(onNext);
|
2999
2999
|
boundary.onNext = NOOP2;
|
3000
3000
|
onAbort(boundary.signal.reason);
|
3001
3001
|
} else {
|
3002
3002
|
const { done } = boundary;
|
3003
|
-
if (done ||
|
3003
|
+
if (done || write) {
|
3004
3004
|
const html = (head = head.consume()).flushHTML();
|
3005
3005
|
if (html) onWrite(html);
|
3006
3006
|
if (done) {
|
@@ -3035,7 +3035,7 @@ function NOOP2() {
|
|
3035
3035
|
|
3036
3036
|
// src/html/dynamic-tag.ts
|
3037
3037
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
3038
|
-
var
|
3038
|
+
var _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
3039
3039
|
const shouldResume = serializeReason !== 0;
|
3040
3040
|
const renderer = normalizeDynamicRenderer(tag);
|
3041
3041
|
if (true) {
|
@@ -3044,13 +3044,13 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
|
|
3044
3044
|
}
|
3045
3045
|
}
|
3046
3046
|
const state = getState();
|
3047
|
-
const branchId =
|
3047
|
+
const branchId = _peek_scope_id();
|
3048
3048
|
let result;
|
3049
3049
|
if (typeof renderer === "string") {
|
3050
3050
|
const input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
3051
|
-
|
3052
|
-
|
3053
|
-
`<${renderer}${
|
3051
|
+
_scope_id();
|
3052
|
+
_html(
|
3053
|
+
`<${renderer}${_attrs(input, true ? `#${renderer}/0` : 0, branchId, renderer)}>`
|
3054
3054
|
);
|
3055
3055
|
if (!voidElementsReg.test(renderer)) {
|
3056
3056
|
const renderContent = content || normalizeDynamicRenderer(input.content);
|
@@ -3060,8 +3060,8 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
|
|
3060
3060
|
"A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
|
3061
3061
|
);
|
3062
3062
|
}
|
3063
|
-
|
3064
|
-
|
3063
|
+
_html(
|
3064
|
+
_attr_textarea_value(
|
3065
3065
|
branchId,
|
3066
3066
|
true ? `#${renderer}/0` : 0,
|
3067
3067
|
input.value,
|
@@ -3075,7 +3075,7 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
|
|
3075
3075
|
);
|
3076
3076
|
}
|
3077
3077
|
if (renderer === "select" && ("value" in input || "valueChange" in input)) {
|
3078
|
-
|
3078
|
+
_attr_select_value(
|
3079
3079
|
branchId,
|
3080
3080
|
true ? `#${renderer}/0` : 0,
|
3081
3081
|
input.value,
|
@@ -3083,7 +3083,7 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
|
|
3083
3083
|
renderContent
|
3084
3084
|
);
|
3085
3085
|
} else {
|
3086
|
-
|
3086
|
+
_dynamic_tag(
|
3087
3087
|
branchId,
|
3088
3088
|
true ? `#${renderer}/0` : 0,
|
3089
3089
|
renderContent,
|
@@ -3094,14 +3094,14 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
|
|
3094
3094
|
);
|
3095
3095
|
}
|
3096
3096
|
}
|
3097
|
-
|
3097
|
+
_html(`</${renderer}>`);
|
3098
3098
|
} else if (content) {
|
3099
3099
|
throw new Error(
|
3100
3100
|
`Body content is not supported for the \`<${renderer}>\` tag.`
|
3101
3101
|
);
|
3102
3102
|
}
|
3103
3103
|
if (shouldResume) {
|
3104
|
-
|
3104
|
+
_html(
|
3105
3105
|
state.mark(
|
3106
3106
|
"'" /* BranchNativeTag */,
|
3107
3107
|
scopeId + " " + accessor + " " + branchId
|
@@ -3110,7 +3110,7 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
|
|
3110
3110
|
}
|
3111
3111
|
} else {
|
3112
3112
|
if (shouldResume) {
|
3113
|
-
|
3113
|
+
_html(state.mark("[" /* BranchStart */, branchId + ""));
|
3114
3114
|
}
|
3115
3115
|
const render2 = () => {
|
3116
3116
|
if (renderer) {
|
@@ -3130,10 +3130,10 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
|
|
3130
3130
|
};
|
3131
3131
|
result = shouldResume ? withBranchId(branchId, render2) : render2();
|
3132
3132
|
if (shouldResume) {
|
3133
|
-
|
3133
|
+
_html(state.mark("]" /* BranchEnd */, scopeId + " " + accessor));
|
3134
3134
|
}
|
3135
3135
|
}
|
3136
|
-
const rendered =
|
3136
|
+
const rendered = _peek_scope_id() !== branchId;
|
3137
3137
|
if (rendered) {
|
3138
3138
|
if (shouldResume) {
|
3139
3139
|
writeScope(scopeId, {
|
@@ -3142,19 +3142,19 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
|
|
3142
3142
|
});
|
3143
3143
|
}
|
3144
3144
|
} else {
|
3145
|
-
|
3145
|
+
_scope_id();
|
3146
3146
|
}
|
3147
3147
|
return result;
|
3148
3148
|
};
|
3149
|
-
function
|
3149
|
+
function _content(id, fn) {
|
3150
3150
|
fn.___id = id;
|
3151
3151
|
return fn;
|
3152
3152
|
}
|
3153
|
-
function
|
3154
|
-
return
|
3153
|
+
function _content_resume(id, fn, scopeId) {
|
3154
|
+
return _resume(_content(id, fn), id, scopeId);
|
3155
3155
|
}
|
3156
3156
|
function patchDynamicTag(patch) {
|
3157
|
-
|
3157
|
+
_dynamic_tag = /* @__PURE__ */ ((originalDynamicTag) => (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
3158
3158
|
const patched = patch(scopeId, accessor, tag);
|
3159
3159
|
if (patched !== tag) patched.___id = tag;
|
3160
3160
|
return originalDynamicTag(
|
@@ -3166,7 +3166,7 @@ function patchDynamicTag(patch) {
|
|
3166
3166
|
inputIsArgs,
|
3167
3167
|
resume
|
3168
3168
|
);
|
3169
|
-
})(
|
3169
|
+
})(_dynamic_tag);
|
3170
3170
|
}
|
3171
3171
|
|
3172
3172
|
// src/html/compat.ts
|
@@ -3174,11 +3174,11 @@ var K_TAGS_API_STATE = Symbol();
|
|
3174
3174
|
var COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
|
3175
3175
|
var compat = {
|
3176
3176
|
$global,
|
3177
|
-
fork,
|
3178
|
-
write,
|
3177
|
+
fork: _await,
|
3178
|
+
write: _html,
|
3179
3179
|
writeScript,
|
3180
|
-
nextScopeId,
|
3181
|
-
peekNextScopeId,
|
3180
|
+
nextScopeId: _scope_id,
|
3181
|
+
peekNextScopeId: _peek_scope_id,
|
3182
3182
|
isInResumedBranch,
|
3183
3183
|
ensureState($global2) {
|
3184
3184
|
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
@@ -3202,7 +3202,7 @@ var compat = {
|
|
3202
3202
|
patchDynamicTag,
|
3203
3203
|
writeSetScopeForComponent(branchId, m5c) {
|
3204
3204
|
writeScope(branchId, { m5c });
|
3205
|
-
|
3205
|
+
_script(branchId, SET_SCOPE_REGISTER_ID);
|
3206
3206
|
},
|
3207
3207
|
toJSON(state) {
|
3208
3208
|
return function toJSON() {
|
@@ -3248,9 +3248,9 @@ var compat = {
|
|
3248
3248
|
}
|
3249
3249
|
head.render(() => {
|
3250
3250
|
if (willRerender) {
|
3251
|
-
const scopeId =
|
3251
|
+
const scopeId = _peek_scope_id();
|
3252
3252
|
writeScope(scopeId, { m5c: component.id });
|
3253
|
-
|
3253
|
+
_script(scopeId, SET_SCOPE_REGISTER_ID);
|
3254
3254
|
}
|
3255
3255
|
if (isTemplate(renderer) && willRerender) {
|
3256
3256
|
renderer(normalizedInput, 1);
|
@@ -3288,62 +3288,62 @@ function NOOP3() {
|
|
3288
3288
|
}
|
3289
3289
|
export {
|
3290
3290
|
$global,
|
3291
|
-
|
3291
|
+
_attr,
|
3292
|
+
_attr_class,
|
3293
|
+
_attr_content,
|
3294
|
+
_attr_details_or_dialog_open as _attr_details_open,
|
3295
|
+
_attr_details_or_dialog_open as _attr_dialog_open,
|
3296
|
+
_attr_input_checked,
|
3297
|
+
_attr_input_checkedValue,
|
3298
|
+
_attr_input_value,
|
3299
|
+
_attr_option_value,
|
3300
|
+
_attr_select_value,
|
3301
|
+
_attr_style,
|
3302
|
+
_attr_textarea_value,
|
3303
|
+
_attrs,
|
3304
|
+
_attrs_content,
|
3305
|
+
_attrs_partial,
|
3306
|
+
_attrs_partial_content,
|
3307
|
+
_await,
|
3308
|
+
_content,
|
3309
|
+
_content_resume,
|
3310
|
+
_dynamic_tag,
|
3311
|
+
_el,
|
3312
|
+
_el_resume,
|
3313
|
+
_escape,
|
3314
|
+
_escape_script,
|
3315
|
+
_escape_style,
|
3316
|
+
_existing_scope,
|
3317
|
+
_for_in,
|
3318
|
+
_for_of,
|
3319
|
+
_for_to,
|
3320
|
+
_hoist,
|
3321
|
+
_html,
|
3322
|
+
_id,
|
3323
|
+
_if,
|
3324
|
+
_peek_scope_id,
|
3325
|
+
_resume,
|
3326
|
+
_resume_branch,
|
3327
|
+
writeScope as _scope,
|
3328
|
+
_scope_id,
|
3329
|
+
_scope_with_id,
|
3330
|
+
_script,
|
3331
|
+
_sep,
|
3332
|
+
_serialize_guard,
|
3333
|
+
_serialize_if,
|
3334
|
+
_subscribe,
|
3335
|
+
_template,
|
3336
|
+
_trailers,
|
3337
|
+
_try,
|
3338
|
+
_unescaped,
|
3339
|
+
_var,
|
3292
3340
|
attrTag,
|
3293
3341
|
attrTags,
|
3294
|
-
attrs,
|
3295
|
-
classAttr,
|
3296
|
-
commentSeparator,
|
3297
3342
|
compat,
|
3298
|
-
controllable_detailsOrDialog_open,
|
3299
|
-
controllable_input_checked,
|
3300
|
-
controllable_input_checkedValue,
|
3301
|
-
controllable_input_value,
|
3302
|
-
controllable_select_value,
|
3303
|
-
controllable_textarea_value,
|
3304
|
-
createContent,
|
3305
|
-
createTemplate,
|
3306
|
-
dynamicTag,
|
3307
|
-
ensureScopeWithId,
|
3308
|
-
escapeScript,
|
3309
|
-
escapeStyle,
|
3310
|
-
escapeXML,
|
3311
3343
|
forIn,
|
3312
3344
|
forInBy,
|
3313
3345
|
forOf,
|
3314
3346
|
forOfBy,
|
3315
3347
|
forTo,
|
3316
|
-
forToBy
|
3317
|
-
fork,
|
3318
|
-
getScopeById,
|
3319
|
-
hoist,
|
3320
|
-
markResumeNode,
|
3321
|
-
nextScopeId,
|
3322
|
-
nextTagId,
|
3323
|
-
nodeRef,
|
3324
|
-
optionValueAttr,
|
3325
|
-
partialAttrs,
|
3326
|
-
peekNextScopeId,
|
3327
|
-
register2 as register,
|
3328
|
-
registerContent,
|
3329
|
-
resumeClosestBranch,
|
3330
|
-
resumeConditional,
|
3331
|
-
resumeForIn,
|
3332
|
-
resumeForOf,
|
3333
|
-
resumeForTo,
|
3334
|
-
serializeGuard,
|
3335
|
-
serializeIf,
|
3336
|
-
setTagVar,
|
3337
|
-
styleAttr,
|
3338
|
-
toString,
|
3339
|
-
tryContent,
|
3340
|
-
write,
|
3341
|
-
writeAttrsAndContent,
|
3342
|
-
writeContent,
|
3343
|
-
writeEffect,
|
3344
|
-
writeExistingScope,
|
3345
|
-
writePartialAttrsAndContent,
|
3346
|
-
writeScope,
|
3347
|
-
writeSubscribe,
|
3348
|
-
writeTrailers
|
3348
|
+
forToBy
|
3349
3349
|
};
|