@marko/runtime-tags 0.1.22 → 0.1.23
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 +2 -0
- package/dist/debug/dom.js +10 -4
- package/dist/debug/dom.mjs +10 -4
- package/dist/debug/html.js +41 -37
- package/dist/debug/html.mjs +40 -36
- package/dist/dom.js +7 -2
- package/dist/dom.mjs +7 -2
- package/dist/html/writer.d.ts +4 -1
- package/dist/html.d.ts +1 -1
- package/dist/html.js +35 -29
- package/dist/html.mjs +34 -28
- package/package.json +1 -1
package/dist/common/helpers.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function classValue(value: unknown): string;
|
|
2
2
|
export declare function styleValue(value: unknown): string;
|
|
3
|
+
export declare function isEventHandler(name: string): name is `on${string}`;
|
|
4
|
+
export declare function getEventHandlerName(name: `on${string}`): string;
|
|
3
5
|
export declare function isVoid(value: unknown): value is false | null | undefined;
|
|
4
6
|
export declare function alphaEncode(num: number): string;
|
|
5
7
|
export declare function normalizeDynamicRenderer<Renderer>(value: any): Renderer | string | undefined;
|
package/dist/debug/dom.js
CHANGED
|
@@ -769,6 +769,12 @@ function toDelimitedString(val, delimiter, stringify) {
|
|
|
769
769
|
}
|
|
770
770
|
return "";
|
|
771
771
|
}
|
|
772
|
+
function isEventHandler(name) {
|
|
773
|
+
return /^on[A-Z-]/.test(name);
|
|
774
|
+
}
|
|
775
|
+
function getEventHandlerName(name) {
|
|
776
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
777
|
+
}
|
|
772
778
|
function normalizeDynamicRenderer(value2) {
|
|
773
779
|
if (value2) return value2.renderBody || value2.default || value2;
|
|
774
780
|
}
|
|
@@ -1287,7 +1293,6 @@ function parseHTMLOrSingleNode(html2) {
|
|
|
1287
1293
|
}
|
|
1288
1294
|
|
|
1289
1295
|
// src/dom/dom.ts
|
|
1290
|
-
var eventHandlerReg = /^on[A-Z-]/;
|
|
1291
1296
|
function attr(element, name, value2) {
|
|
1292
1297
|
setAttribute(element, name, normalizeAttrValue(value2));
|
|
1293
1298
|
}
|
|
@@ -1416,12 +1421,13 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1416
1421
|
break;
|
|
1417
1422
|
case "renderBody":
|
|
1418
1423
|
break;
|
|
1419
|
-
default:
|
|
1420
|
-
if (
|
|
1421
|
-
(events ||= scope[nodeAccessor + "~" /* EventAttributes */] = {})[
|
|
1424
|
+
default: {
|
|
1425
|
+
if (isEventHandler(name)) {
|
|
1426
|
+
(events ||= scope[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = value2;
|
|
1422
1427
|
} else if (!skip?.test(name)) {
|
|
1423
1428
|
attr(el, name, value2);
|
|
1424
1429
|
}
|
|
1430
|
+
}
|
|
1425
1431
|
}
|
|
1426
1432
|
}
|
|
1427
1433
|
}
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -682,6 +682,12 @@ function toDelimitedString(val, delimiter, stringify) {
|
|
|
682
682
|
}
|
|
683
683
|
return "";
|
|
684
684
|
}
|
|
685
|
+
function isEventHandler(name) {
|
|
686
|
+
return /^on[A-Z-]/.test(name);
|
|
687
|
+
}
|
|
688
|
+
function getEventHandlerName(name) {
|
|
689
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
690
|
+
}
|
|
685
691
|
function normalizeDynamicRenderer(value2) {
|
|
686
692
|
if (value2) return value2.renderBody || value2.default || value2;
|
|
687
693
|
}
|
|
@@ -1200,7 +1206,6 @@ function parseHTMLOrSingleNode(html2) {
|
|
|
1200
1206
|
}
|
|
1201
1207
|
|
|
1202
1208
|
// src/dom/dom.ts
|
|
1203
|
-
var eventHandlerReg = /^on[A-Z-]/;
|
|
1204
1209
|
function attr(element, name, value2) {
|
|
1205
1210
|
setAttribute(element, name, normalizeAttrValue(value2));
|
|
1206
1211
|
}
|
|
@@ -1329,12 +1334,13 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1329
1334
|
break;
|
|
1330
1335
|
case "renderBody":
|
|
1331
1336
|
break;
|
|
1332
|
-
default:
|
|
1333
|
-
if (
|
|
1334
|
-
(events ||= scope[nodeAccessor + "~" /* EventAttributes */] = {})[
|
|
1337
|
+
default: {
|
|
1338
|
+
if (isEventHandler(name)) {
|
|
1339
|
+
(events ||= scope[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = value2;
|
|
1335
1340
|
} else if (!skip?.test(name)) {
|
|
1336
1341
|
attr(el, name, value2);
|
|
1337
1342
|
}
|
|
1343
|
+
}
|
|
1338
1344
|
}
|
|
1339
1345
|
}
|
|
1340
1346
|
}
|
package/dist/debug/html.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/html.ts
|
|
21
21
|
var html_exports = {};
|
|
22
22
|
__export(html_exports, {
|
|
23
|
+
$global: () => $global,
|
|
23
24
|
attr: () => attr,
|
|
24
25
|
attrTag: () => attrTag,
|
|
25
26
|
attrTags: () => attrTags,
|
|
@@ -45,7 +46,6 @@ __export(html_exports, {
|
|
|
45
46
|
forTo: () => forTo,
|
|
46
47
|
fork: () => fork,
|
|
47
48
|
getScopeById: () => getScopeById,
|
|
48
|
-
getStreamData: () => getStreamData,
|
|
49
49
|
markResumeCleanup: () => markResumeCleanup,
|
|
50
50
|
markResumeControlEnd: () => markResumeControlEnd,
|
|
51
51
|
markResumeControlSingleNodeEnd: () => markResumeControlSingleNodeEnd,
|
|
@@ -161,6 +161,12 @@ function toDelimitedString(val, delimiter, stringify) {
|
|
|
161
161
|
}
|
|
162
162
|
return "";
|
|
163
163
|
}
|
|
164
|
+
function isEventHandler(name) {
|
|
165
|
+
return /^on[A-Z-]/.test(name);
|
|
166
|
+
}
|
|
167
|
+
function getEventHandlerName(name) {
|
|
168
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
169
|
+
}
|
|
164
170
|
function isVoid(value) {
|
|
165
171
|
return value == null || value === false;
|
|
166
172
|
}
|
|
@@ -1472,8 +1478,8 @@ function register2(val, id, scopeId) {
|
|
|
1472
1478
|
}
|
|
1473
1479
|
function nextTagId() {
|
|
1474
1480
|
const state = $chunk.boundary.state;
|
|
1475
|
-
const { $global } = state;
|
|
1476
|
-
return "s" + $
|
|
1481
|
+
const { $global: $global2 } = state;
|
|
1482
|
+
return "s" + $global2.runtimeId + $global2.renderId + (state.tagIndex++).toString(36);
|
|
1477
1483
|
}
|
|
1478
1484
|
function nextScopeId() {
|
|
1479
1485
|
return $chunk.boundary.state.scopeIndex++;
|
|
@@ -1557,8 +1563,8 @@ function ensureScopeWithId(scopeId) {
|
|
|
1557
1563
|
}
|
|
1558
1564
|
return scope;
|
|
1559
1565
|
}
|
|
1560
|
-
function
|
|
1561
|
-
return $chunk.boundary.state;
|
|
1566
|
+
function $global() {
|
|
1567
|
+
return $chunk.boundary.state.$global;
|
|
1562
1568
|
}
|
|
1563
1569
|
function fork(promise, renderBody) {
|
|
1564
1570
|
if (!isPromise(promise)) {
|
|
@@ -1658,9 +1664,9 @@ function tryCatch(renderBody, renderCatch) {
|
|
|
1658
1664
|
};
|
|
1659
1665
|
}
|
|
1660
1666
|
var State2 = class {
|
|
1661
|
-
constructor($
|
|
1662
|
-
this.$global = $
|
|
1663
|
-
this.$global = $
|
|
1667
|
+
constructor($global2) {
|
|
1668
|
+
this.$global = $global2;
|
|
1669
|
+
this.$global = $global2;
|
|
1664
1670
|
}
|
|
1665
1671
|
tagIndex = 0;
|
|
1666
1672
|
scopeIndex = 0;
|
|
@@ -1675,12 +1681,12 @@ var State2 = class {
|
|
|
1675
1681
|
scopes = /* @__PURE__ */ new Map();
|
|
1676
1682
|
writeScopes = null;
|
|
1677
1683
|
get runtimePrefix() {
|
|
1678
|
-
const { $global } = this;
|
|
1679
|
-
return $
|
|
1684
|
+
const { $global: $global2 } = this;
|
|
1685
|
+
return $global2.runtimeId + "." + $global2.renderId;
|
|
1680
1686
|
}
|
|
1681
1687
|
get commentPrefix() {
|
|
1682
|
-
const { $global } = this;
|
|
1683
|
-
return $
|
|
1688
|
+
const { $global: $global2 } = this;
|
|
1689
|
+
return $global2.runtimeId + $global2.renderId;
|
|
1684
1690
|
}
|
|
1685
1691
|
reorder(chunk) {
|
|
1686
1692
|
if (this.writeReorders) {
|
|
@@ -1843,8 +1849,8 @@ function prepareChunk(chunk) {
|
|
|
1843
1849
|
const head = chunk.consume();
|
|
1844
1850
|
const { boundary, effects } = head;
|
|
1845
1851
|
const { state } = boundary;
|
|
1846
|
-
const { $global, runtimePrefix, serializer } = state;
|
|
1847
|
-
const nonceAttr = $
|
|
1852
|
+
const { $global: $global2, runtimePrefix, serializer } = state;
|
|
1853
|
+
const nonceAttr = $global2.cspNonce ? " nonce=" + escapeAttrValue($global2.cspNonce + "") : "";
|
|
1848
1854
|
let { html, scripts } = head;
|
|
1849
1855
|
let hasWalk = false;
|
|
1850
1856
|
head.effects = "";
|
|
@@ -1852,7 +1858,7 @@ function prepareChunk(chunk) {
|
|
|
1852
1858
|
state.hasMainRuntime = true;
|
|
1853
1859
|
scripts = concatScripts(
|
|
1854
1860
|
scripts,
|
|
1855
|
-
WALKER_RUNTIME_CODE + '("' + $
|
|
1861
|
+
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
1856
1862
|
);
|
|
1857
1863
|
}
|
|
1858
1864
|
let resumes = "";
|
|
@@ -1980,14 +1986,14 @@ function flushTickQueue() {
|
|
|
1980
1986
|
function isPromise(value) {
|
|
1981
1987
|
return value != null && typeof value.then === "function";
|
|
1982
1988
|
}
|
|
1983
|
-
function getFilteredGlobals($
|
|
1984
|
-
if (!$
|
|
1985
|
-
const serializedGlobals = $
|
|
1989
|
+
function getFilteredGlobals($global2) {
|
|
1990
|
+
if (!$global2) return void 0;
|
|
1991
|
+
const serializedGlobals = $global2.serializedGlobals;
|
|
1986
1992
|
if (!serializedGlobals) return void 0;
|
|
1987
1993
|
let filtered;
|
|
1988
1994
|
if (Array.isArray(serializedGlobals)) {
|
|
1989
1995
|
for (const key of serializedGlobals) {
|
|
1990
|
-
const value = $
|
|
1996
|
+
const value = $global2[key];
|
|
1991
1997
|
if (value !== void 0) {
|
|
1992
1998
|
if (filtered) {
|
|
1993
1999
|
filtered[key] = value;
|
|
@@ -1999,7 +2005,7 @@ function getFilteredGlobals($global) {
|
|
|
1999
2005
|
} else {
|
|
2000
2006
|
for (const key in serializedGlobals) {
|
|
2001
2007
|
if (serializedGlobals[key]) {
|
|
2002
|
-
const value = $
|
|
2008
|
+
const value = $global2[key];
|
|
2003
2009
|
if (value !== void 0) {
|
|
2004
2010
|
if (filtered) {
|
|
2005
2011
|
filtered[key] = value;
|
|
@@ -2088,7 +2094,6 @@ function attr(name, val) {
|
|
|
2088
2094
|
function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
2089
2095
|
let result = "";
|
|
2090
2096
|
let skip = /[\s/>"'=]/;
|
|
2091
|
-
let scope;
|
|
2092
2097
|
let events;
|
|
2093
2098
|
switch (tagName) {
|
|
2094
2099
|
case "input":
|
|
@@ -2158,9 +2163,8 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2158
2163
|
break;
|
|
2159
2164
|
default:
|
|
2160
2165
|
if (!isVoid(val)) {
|
|
2161
|
-
if (
|
|
2162
|
-
events ||=
|
|
2163
|
-
events[name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase()] = val;
|
|
2166
|
+
if (isEventHandler(name)) {
|
|
2167
|
+
(events ||= ensureScopeWithId(scopeId)[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = val;
|
|
2164
2168
|
} else if (!skip.test(name)) {
|
|
2165
2169
|
result += nonVoidAttr(name, val);
|
|
2166
2170
|
}
|
|
@@ -2339,12 +2343,12 @@ var compat = {
|
|
|
2339
2343
|
return compatRegistered;
|
|
2340
2344
|
},
|
|
2341
2345
|
render(renderer, willRerender, classAPIOut, component, input) {
|
|
2342
|
-
const $
|
|
2343
|
-
let state = $
|
|
2346
|
+
const $global2 = classAPIOut.global;
|
|
2347
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
2344
2348
|
if (!state) {
|
|
2345
|
-
$
|
|
2346
|
-
$
|
|
2347
|
-
$
|
|
2349
|
+
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
|
2350
|
+
$global2.renderId ||= $global2.componentIdPrefix || DEFAULT_RENDER_ID;
|
|
2351
|
+
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
|
2348
2352
|
}
|
|
2349
2353
|
const boundary = new Boundary(state);
|
|
2350
2354
|
let head = new Chunk(
|
|
@@ -2401,22 +2405,22 @@ var createTemplate = (templateId, renderer) => {
|
|
|
2401
2405
|
return register2(renderer, templateId);
|
|
2402
2406
|
};
|
|
2403
2407
|
function render(input = {}) {
|
|
2404
|
-
let { $global } = input;
|
|
2405
|
-
if ($
|
|
2406
|
-
({ $global, ...input } = input);
|
|
2407
|
-
$
|
|
2408
|
+
let { $global: $global2 } = input;
|
|
2409
|
+
if ($global2) {
|
|
2410
|
+
({ $global: $global2, ...input } = input);
|
|
2411
|
+
$global2 = {
|
|
2408
2412
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
2409
2413
|
renderId: DEFAULT_RENDER_ID,
|
|
2410
|
-
...$
|
|
2414
|
+
...$global2
|
|
2411
2415
|
};
|
|
2412
2416
|
} else {
|
|
2413
|
-
$
|
|
2417
|
+
$global2 = {
|
|
2414
2418
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
2415
2419
|
renderId: DEFAULT_RENDER_ID
|
|
2416
2420
|
};
|
|
2417
2421
|
}
|
|
2418
2422
|
const head = new Chunk(
|
|
2419
|
-
new Boundary(new State2($
|
|
2423
|
+
new Boundary(new State2($global2), $global2.signal),
|
|
2420
2424
|
null,
|
|
2421
2425
|
null
|
|
2422
2426
|
);
|
|
@@ -2582,6 +2586,7 @@ var ServerRenderResult = class {
|
|
|
2582
2586
|
};
|
|
2583
2587
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2584
2588
|
0 && (module.exports = {
|
|
2589
|
+
$global,
|
|
2585
2590
|
attr,
|
|
2586
2591
|
attrTag,
|
|
2587
2592
|
attrTags,
|
|
@@ -2607,7 +2612,6 @@ var ServerRenderResult = class {
|
|
|
2607
2612
|
forTo,
|
|
2608
2613
|
fork,
|
|
2609
2614
|
getScopeById,
|
|
2610
|
-
getStreamData,
|
|
2611
2615
|
markResumeCleanup,
|
|
2612
2616
|
markResumeControlEnd,
|
|
2613
2617
|
markResumeControlSingleNodeEnd,
|
package/dist/debug/html.mjs
CHANGED
|
@@ -89,6 +89,12 @@ function toDelimitedString(val, delimiter, stringify) {
|
|
|
89
89
|
}
|
|
90
90
|
return "";
|
|
91
91
|
}
|
|
92
|
+
function isEventHandler(name) {
|
|
93
|
+
return /^on[A-Z-]/.test(name);
|
|
94
|
+
}
|
|
95
|
+
function getEventHandlerName(name) {
|
|
96
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
97
|
+
}
|
|
92
98
|
function isVoid(value) {
|
|
93
99
|
return value == null || value === false;
|
|
94
100
|
}
|
|
@@ -1400,8 +1406,8 @@ function register2(val, id, scopeId) {
|
|
|
1400
1406
|
}
|
|
1401
1407
|
function nextTagId() {
|
|
1402
1408
|
const state = $chunk.boundary.state;
|
|
1403
|
-
const { $global } = state;
|
|
1404
|
-
return "s" + $
|
|
1409
|
+
const { $global: $global2 } = state;
|
|
1410
|
+
return "s" + $global2.runtimeId + $global2.renderId + (state.tagIndex++).toString(36);
|
|
1405
1411
|
}
|
|
1406
1412
|
function nextScopeId() {
|
|
1407
1413
|
return $chunk.boundary.state.scopeIndex++;
|
|
@@ -1485,8 +1491,8 @@ function ensureScopeWithId(scopeId) {
|
|
|
1485
1491
|
}
|
|
1486
1492
|
return scope;
|
|
1487
1493
|
}
|
|
1488
|
-
function
|
|
1489
|
-
return $chunk.boundary.state;
|
|
1494
|
+
function $global() {
|
|
1495
|
+
return $chunk.boundary.state.$global;
|
|
1490
1496
|
}
|
|
1491
1497
|
function fork(promise, renderBody) {
|
|
1492
1498
|
if (!isPromise(promise)) {
|
|
@@ -1586,9 +1592,9 @@ function tryCatch(renderBody, renderCatch) {
|
|
|
1586
1592
|
};
|
|
1587
1593
|
}
|
|
1588
1594
|
var State2 = class {
|
|
1589
|
-
constructor($
|
|
1590
|
-
this.$global = $
|
|
1591
|
-
this.$global = $
|
|
1595
|
+
constructor($global2) {
|
|
1596
|
+
this.$global = $global2;
|
|
1597
|
+
this.$global = $global2;
|
|
1592
1598
|
}
|
|
1593
1599
|
tagIndex = 0;
|
|
1594
1600
|
scopeIndex = 0;
|
|
@@ -1603,12 +1609,12 @@ var State2 = class {
|
|
|
1603
1609
|
scopes = /* @__PURE__ */ new Map();
|
|
1604
1610
|
writeScopes = null;
|
|
1605
1611
|
get runtimePrefix() {
|
|
1606
|
-
const { $global } = this;
|
|
1607
|
-
return $
|
|
1612
|
+
const { $global: $global2 } = this;
|
|
1613
|
+
return $global2.runtimeId + "." + $global2.renderId;
|
|
1608
1614
|
}
|
|
1609
1615
|
get commentPrefix() {
|
|
1610
|
-
const { $global } = this;
|
|
1611
|
-
return $
|
|
1616
|
+
const { $global: $global2 } = this;
|
|
1617
|
+
return $global2.runtimeId + $global2.renderId;
|
|
1612
1618
|
}
|
|
1613
1619
|
reorder(chunk) {
|
|
1614
1620
|
if (this.writeReorders) {
|
|
@@ -1771,8 +1777,8 @@ function prepareChunk(chunk) {
|
|
|
1771
1777
|
const head = chunk.consume();
|
|
1772
1778
|
const { boundary, effects } = head;
|
|
1773
1779
|
const { state } = boundary;
|
|
1774
|
-
const { $global, runtimePrefix, serializer } = state;
|
|
1775
|
-
const nonceAttr = $
|
|
1780
|
+
const { $global: $global2, runtimePrefix, serializer } = state;
|
|
1781
|
+
const nonceAttr = $global2.cspNonce ? " nonce=" + escapeAttrValue($global2.cspNonce + "") : "";
|
|
1776
1782
|
let { html, scripts } = head;
|
|
1777
1783
|
let hasWalk = false;
|
|
1778
1784
|
head.effects = "";
|
|
@@ -1780,7 +1786,7 @@ function prepareChunk(chunk) {
|
|
|
1780
1786
|
state.hasMainRuntime = true;
|
|
1781
1787
|
scripts = concatScripts(
|
|
1782
1788
|
scripts,
|
|
1783
|
-
WALKER_RUNTIME_CODE + '("' + $
|
|
1789
|
+
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
1784
1790
|
);
|
|
1785
1791
|
}
|
|
1786
1792
|
let resumes = "";
|
|
@@ -1908,14 +1914,14 @@ function flushTickQueue() {
|
|
|
1908
1914
|
function isPromise(value) {
|
|
1909
1915
|
return value != null && typeof value.then === "function";
|
|
1910
1916
|
}
|
|
1911
|
-
function getFilteredGlobals($
|
|
1912
|
-
if (!$
|
|
1913
|
-
const serializedGlobals = $
|
|
1917
|
+
function getFilteredGlobals($global2) {
|
|
1918
|
+
if (!$global2) return void 0;
|
|
1919
|
+
const serializedGlobals = $global2.serializedGlobals;
|
|
1914
1920
|
if (!serializedGlobals) return void 0;
|
|
1915
1921
|
let filtered;
|
|
1916
1922
|
if (Array.isArray(serializedGlobals)) {
|
|
1917
1923
|
for (const key of serializedGlobals) {
|
|
1918
|
-
const value = $
|
|
1924
|
+
const value = $global2[key];
|
|
1919
1925
|
if (value !== void 0) {
|
|
1920
1926
|
if (filtered) {
|
|
1921
1927
|
filtered[key] = value;
|
|
@@ -1927,7 +1933,7 @@ function getFilteredGlobals($global) {
|
|
|
1927
1933
|
} else {
|
|
1928
1934
|
for (const key in serializedGlobals) {
|
|
1929
1935
|
if (serializedGlobals[key]) {
|
|
1930
|
-
const value = $
|
|
1936
|
+
const value = $global2[key];
|
|
1931
1937
|
if (value !== void 0) {
|
|
1932
1938
|
if (filtered) {
|
|
1933
1939
|
filtered[key] = value;
|
|
@@ -2016,7 +2022,6 @@ function attr(name, val) {
|
|
|
2016
2022
|
function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
2017
2023
|
let result = "";
|
|
2018
2024
|
let skip = /[\s/>"'=]/;
|
|
2019
|
-
let scope;
|
|
2020
2025
|
let events;
|
|
2021
2026
|
switch (tagName) {
|
|
2022
2027
|
case "input":
|
|
@@ -2086,9 +2091,8 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2086
2091
|
break;
|
|
2087
2092
|
default:
|
|
2088
2093
|
if (!isVoid(val)) {
|
|
2089
|
-
if (
|
|
2090
|
-
events ||=
|
|
2091
|
-
events[name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase()] = val;
|
|
2094
|
+
if (isEventHandler(name)) {
|
|
2095
|
+
(events ||= ensureScopeWithId(scopeId)[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = val;
|
|
2092
2096
|
} else if (!skip.test(name)) {
|
|
2093
2097
|
result += nonVoidAttr(name, val);
|
|
2094
2098
|
}
|
|
@@ -2267,12 +2271,12 @@ var compat = {
|
|
|
2267
2271
|
return compatRegistered;
|
|
2268
2272
|
},
|
|
2269
2273
|
render(renderer, willRerender, classAPIOut, component, input) {
|
|
2270
|
-
const $
|
|
2271
|
-
let state = $
|
|
2274
|
+
const $global2 = classAPIOut.global;
|
|
2275
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
2272
2276
|
if (!state) {
|
|
2273
|
-
$
|
|
2274
|
-
$
|
|
2275
|
-
$
|
|
2277
|
+
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
|
2278
|
+
$global2.renderId ||= $global2.componentIdPrefix || DEFAULT_RENDER_ID;
|
|
2279
|
+
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
|
2276
2280
|
}
|
|
2277
2281
|
const boundary = new Boundary(state);
|
|
2278
2282
|
let head = new Chunk(
|
|
@@ -2329,22 +2333,22 @@ var createTemplate = (templateId, renderer) => {
|
|
|
2329
2333
|
return register2(renderer, templateId);
|
|
2330
2334
|
};
|
|
2331
2335
|
function render(input = {}) {
|
|
2332
|
-
let { $global } = input;
|
|
2333
|
-
if ($
|
|
2334
|
-
({ $global, ...input } = input);
|
|
2335
|
-
$
|
|
2336
|
+
let { $global: $global2 } = input;
|
|
2337
|
+
if ($global2) {
|
|
2338
|
+
({ $global: $global2, ...input } = input);
|
|
2339
|
+
$global2 = {
|
|
2336
2340
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
2337
2341
|
renderId: DEFAULT_RENDER_ID,
|
|
2338
|
-
...$
|
|
2342
|
+
...$global2
|
|
2339
2343
|
};
|
|
2340
2344
|
} else {
|
|
2341
|
-
$
|
|
2345
|
+
$global2 = {
|
|
2342
2346
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
2343
2347
|
renderId: DEFAULT_RENDER_ID
|
|
2344
2348
|
};
|
|
2345
2349
|
}
|
|
2346
2350
|
const head = new Chunk(
|
|
2347
|
-
new Boundary(new State2($
|
|
2351
|
+
new Boundary(new State2($global2), $global2.signal),
|
|
2348
2352
|
null,
|
|
2349
2353
|
null
|
|
2350
2354
|
);
|
|
@@ -2509,6 +2513,7 @@ var ServerRenderResult = class {
|
|
|
2509
2513
|
}
|
|
2510
2514
|
};
|
|
2511
2515
|
export {
|
|
2516
|
+
$global,
|
|
2512
2517
|
attr,
|
|
2513
2518
|
attrTag,
|
|
2514
2519
|
attrTags,
|
|
@@ -2534,7 +2539,6 @@ export {
|
|
|
2534
2539
|
forTo,
|
|
2535
2540
|
fork,
|
|
2536
2541
|
getScopeById,
|
|
2537
|
-
getStreamData,
|
|
2538
2542
|
markResumeCleanup,
|
|
2539
2543
|
markResumeControlEnd,
|
|
2540
2544
|
markResumeControlSingleNodeEnd,
|
package/dist/dom.js
CHANGED
|
@@ -500,6 +500,12 @@ function toDelimitedString(val, delimiter, stringify) {
|
|
|
500
500
|
}
|
|
501
501
|
return "";
|
|
502
502
|
}
|
|
503
|
+
function isEventHandler(name) {
|
|
504
|
+
return /^on[A-Z-]/.test(name);
|
|
505
|
+
}
|
|
506
|
+
function getEventHandlerName(name) {
|
|
507
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
508
|
+
}
|
|
503
509
|
function normalizeDynamicRenderer(value2) {
|
|
504
510
|
if (value2) return value2.renderBody || value2.default || value2;
|
|
505
511
|
}
|
|
@@ -806,7 +812,6 @@ function parseHTMLOrSingleNode(html2) {
|
|
|
806
812
|
}
|
|
807
813
|
|
|
808
814
|
// src/dom/dom.ts
|
|
809
|
-
var eventHandlerReg = /^on[A-Z-]/;
|
|
810
815
|
function attr(element, name, value2) {
|
|
811
816
|
setAttribute(element, name, normalizeAttrValue(value2));
|
|
812
817
|
}
|
|
@@ -908,7 +913,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
908
913
|
case "renderBody":
|
|
909
914
|
break;
|
|
910
915
|
default:
|
|
911
|
-
|
|
916
|
+
isEventHandler(name) ? (events ||= scope[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = value2 : skip?.test(name) || attr(el, name, value2);
|
|
912
917
|
}
|
|
913
918
|
}
|
|
914
919
|
}
|
package/dist/dom.mjs
CHANGED
|
@@ -416,6 +416,12 @@ function toDelimitedString(val, delimiter, stringify) {
|
|
|
416
416
|
}
|
|
417
417
|
return "";
|
|
418
418
|
}
|
|
419
|
+
function isEventHandler(name) {
|
|
420
|
+
return /^on[A-Z-]/.test(name);
|
|
421
|
+
}
|
|
422
|
+
function getEventHandlerName(name) {
|
|
423
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
424
|
+
}
|
|
419
425
|
function normalizeDynamicRenderer(value2) {
|
|
420
426
|
if (value2) return value2.renderBody || value2.default || value2;
|
|
421
427
|
}
|
|
@@ -722,7 +728,6 @@ function parseHTMLOrSingleNode(html2) {
|
|
|
722
728
|
}
|
|
723
729
|
|
|
724
730
|
// src/dom/dom.ts
|
|
725
|
-
var eventHandlerReg = /^on[A-Z-]/;
|
|
726
731
|
function attr(element, name, value2) {
|
|
727
732
|
setAttribute(element, name, normalizeAttrValue(value2));
|
|
728
733
|
}
|
|
@@ -824,7 +829,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
824
829
|
case "renderBody":
|
|
825
830
|
break;
|
|
826
831
|
default:
|
|
827
|
-
|
|
832
|
+
isEventHandler(name) ? (events ||= scope[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = value2 : skip?.test(name) || attr(el, name, value2);
|
|
828
833
|
}
|
|
829
834
|
}
|
|
830
835
|
}
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -36,7 +36,10 @@ export declare function markResumeCleanup(scopeId: number): string;
|
|
|
36
36
|
export declare function writeScope(scopeId: number, partialScope: PartialScope): ScopeInternals;
|
|
37
37
|
export declare function writeExistingScope(scope: ScopeInternals): ScopeInternals;
|
|
38
38
|
export declare function ensureScopeWithId(scopeId: number): PartialScope;
|
|
39
|
-
export declare function
|
|
39
|
+
export declare function $global(): Record<string, unknown> & {
|
|
40
|
+
renderId: string;
|
|
41
|
+
runtimeId: string;
|
|
42
|
+
};
|
|
40
43
|
export declare function fork<T>(promise: Promise<T> | T, renderBody: (value: T) => void): void;
|
|
41
44
|
export declare function tryPlaceholder(renderBody: () => void, renderPlaceholder: () => void): void;
|
|
42
45
|
export declare function tryCatch(renderBody: () => void, renderCatch: (err: unknown) => void): void;
|
package/dist/html.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { compat } from "./html/compat";
|
|
|
6
6
|
export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
|
|
7
7
|
export { createRenderer, dynamicTagArgs, dynamicTagInput, } from "./html/dynamic-tag";
|
|
8
8
|
export { createTemplate } from "./html/template";
|
|
9
|
-
export { ensureScopeWithId, fork, getScopeById,
|
|
9
|
+
export { $global, ensureScopeWithId, fork, getScopeById, markResumeCleanup, markResumeControlEnd, markResumeControlSingleNodeEnd, markResumeNode, markResumeScopeStart, nextScopeId, nextTagId, nodeRef, peekNextScope, register, tryCatch, tryPlaceholder, write, writeEffect, writeExistingScope, writeScope, } from "./html/writer";
|
package/dist/html.js
CHANGED
|
@@ -17,6 +17,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0
|
|
|
17
17
|
// src/html.ts
|
|
18
18
|
var html_exports = {};
|
|
19
19
|
__export(html_exports, {
|
|
20
|
+
$global: () => $global,
|
|
20
21
|
attr: () => attr,
|
|
21
22
|
attrTag: () => attrTag,
|
|
22
23
|
attrTags: () => attrTags,
|
|
@@ -42,7 +43,6 @@ __export(html_exports, {
|
|
|
42
43
|
forTo: () => forTo,
|
|
43
44
|
fork: () => fork,
|
|
44
45
|
getScopeById: () => getScopeById,
|
|
45
|
-
getStreamData: () => getStreamData,
|
|
46
46
|
markResumeCleanup: () => markResumeCleanup,
|
|
47
47
|
markResumeControlEnd: () => markResumeControlEnd,
|
|
48
48
|
markResumeControlSingleNodeEnd: () => markResumeControlSingleNodeEnd,
|
|
@@ -133,6 +133,12 @@ function toDelimitedString(val, delimiter, stringify) {
|
|
|
133
133
|
}
|
|
134
134
|
return "";
|
|
135
135
|
}
|
|
136
|
+
function isEventHandler(name) {
|
|
137
|
+
return /^on[A-Z-]/.test(name);
|
|
138
|
+
}
|
|
139
|
+
function getEventHandlerName(name) {
|
|
140
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
141
|
+
}
|
|
136
142
|
function isVoid(value) {
|
|
137
143
|
return value == null || value === !1;
|
|
138
144
|
}
|
|
@@ -991,8 +997,8 @@ function register2(val, id, scopeId) {
|
|
|
991
997
|
return scopeId === void 0 ? register(id, val) : register(id, val, ensureScopeWithId(scopeId));
|
|
992
998
|
}
|
|
993
999
|
function nextTagId() {
|
|
994
|
-
let state = $chunk.boundary.state, { $global } = state;
|
|
995
|
-
return "s" + $
|
|
1000
|
+
let state = $chunk.boundary.state, { $global: $global2 } = state;
|
|
1001
|
+
return "s" + $global2.runtimeId + $global2.renderId + (state.tagIndex++).toString(36);
|
|
996
1002
|
}
|
|
997
1003
|
function nextScopeId() {
|
|
998
1004
|
return $chunk.boundary.state.scopeIndex++;
|
|
@@ -1048,8 +1054,8 @@ function ensureScopeWithId(scopeId) {
|
|
|
1048
1054
|
let { state } = $chunk.boundary, scope = state.scopes.get(scopeId);
|
|
1049
1055
|
return scope || (scope = { [K_SCOPE_ID]: scopeId }, state.scopes.set(scopeId, scope)), scope;
|
|
1050
1056
|
}
|
|
1051
|
-
function
|
|
1052
|
-
return $chunk.boundary.state;
|
|
1057
|
+
function $global() {
|
|
1058
|
+
return $chunk.boundary.state.$global;
|
|
1053
1059
|
}
|
|
1054
1060
|
function fork(promise, renderBody) {
|
|
1055
1061
|
if (!isPromise(promise)) {
|
|
@@ -1101,9 +1107,9 @@ function tryCatch(renderBody, renderCatch) {
|
|
|
1101
1107
|
};
|
|
1102
1108
|
}
|
|
1103
1109
|
var State2 = class {
|
|
1104
|
-
constructor($
|
|
1105
|
-
this.$global = $
|
|
1106
|
-
this.$global = $
|
|
1110
|
+
constructor($global2) {
|
|
1111
|
+
this.$global = $global2;
|
|
1112
|
+
this.$global = $global2;
|
|
1107
1113
|
}
|
|
1108
1114
|
tagIndex = 0;
|
|
1109
1115
|
scopeIndex = 0;
|
|
@@ -1118,12 +1124,12 @@ var State2 = class {
|
|
|
1118
1124
|
scopes = /* @__PURE__ */ new Map();
|
|
1119
1125
|
writeScopes = null;
|
|
1120
1126
|
get runtimePrefix() {
|
|
1121
|
-
let { $global } = this;
|
|
1122
|
-
return $
|
|
1127
|
+
let { $global: $global2 } = this;
|
|
1128
|
+
return $global2.runtimeId + "." + $global2.renderId;
|
|
1123
1129
|
}
|
|
1124
1130
|
get commentPrefix() {
|
|
1125
|
-
let { $global } = this;
|
|
1126
|
-
return $
|
|
1131
|
+
let { $global: $global2 } = this;
|
|
1132
|
+
return $global2.runtimeId + $global2.renderId;
|
|
1127
1133
|
}
|
|
1128
1134
|
reorder(chunk) {
|
|
1129
1135
|
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
|
|
@@ -1227,10 +1233,10 @@ var State2 = class {
|
|
|
1227
1233
|
}
|
|
1228
1234
|
};
|
|
1229
1235
|
function prepareChunk(chunk) {
|
|
1230
|
-
let head = chunk.consume(), { boundary, effects } = head, { state } = boundary, { $global, runtimePrefix, serializer } = state, nonceAttr = $
|
|
1236
|
+
let head = chunk.consume(), { boundary, effects } = head, { state } = boundary, { $global: $global2, runtimePrefix, serializer } = state, nonceAttr = $global2.cspNonce ? " nonce=" + escapeAttrValue($global2.cspNonce + "") : "", { html, scripts } = head, hasWalk = !1;
|
|
1231
1237
|
head.effects = "", state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
|
1232
1238
|
scripts,
|
|
1233
|
-
WALKER_RUNTIME_CODE + '("' + $
|
|
1239
|
+
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
1234
1240
|
));
|
|
1235
1241
|
let resumes = "";
|
|
1236
1242
|
if ((state.writeScopes || serializer.flushed) && (resumes = state.serializer.stringify(state.writeScopes || {}, boundary), state.writeScopes = null), effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), boundary.done && (resumes || state.hasWrittenResume) && (resumes = resumes ? resumes + ",0" : "0"), resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
|
@@ -1292,20 +1298,20 @@ function flushTickQueue() {
|
|
|
1292
1298
|
function isPromise(value) {
|
|
1293
1299
|
return value != null && typeof value.then == "function";
|
|
1294
1300
|
}
|
|
1295
|
-
function getFilteredGlobals($
|
|
1296
|
-
if (!$
|
|
1297
|
-
let serializedGlobals = $
|
|
1301
|
+
function getFilteredGlobals($global2) {
|
|
1302
|
+
if (!$global2) return;
|
|
1303
|
+
let serializedGlobals = $global2.serializedGlobals;
|
|
1298
1304
|
if (!serializedGlobals) return;
|
|
1299
1305
|
let filtered;
|
|
1300
1306
|
if (Array.isArray(serializedGlobals))
|
|
1301
1307
|
for (let key of serializedGlobals) {
|
|
1302
|
-
let value = $
|
|
1308
|
+
let value = $global2[key];
|
|
1303
1309
|
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1304
1310
|
}
|
|
1305
1311
|
else
|
|
1306
1312
|
for (let key in serializedGlobals)
|
|
1307
1313
|
if (serializedGlobals[key]) {
|
|
1308
|
-
let value = $
|
|
1314
|
+
let value = $global2[key];
|
|
1309
1315
|
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1310
1316
|
}
|
|
1311
1317
|
return filtered;
|
|
@@ -1370,7 +1376,7 @@ function attr(name, val) {
|
|
|
1370
1376
|
return isVoid(val) ? "" : nonVoidAttr(name, val);
|
|
1371
1377
|
}
|
|
1372
1378
|
function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1373
|
-
let result = "", skip = /[\s/>"'=]/,
|
|
1379
|
+
let result = "", skip = /[\s/>"'=]/, events;
|
|
1374
1380
|
switch (tagName) {
|
|
1375
1381
|
case "input":
|
|
1376
1382
|
if (data.checkedChange)
|
|
@@ -1429,7 +1435,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1429
1435
|
case "renderBody":
|
|
1430
1436
|
break;
|
|
1431
1437
|
default:
|
|
1432
|
-
isVoid(val) || (
|
|
1438
|
+
isVoid(val) || (isEventHandler(name) ? (events ||= ensureScopeWithId(scopeId)[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = val : skip.test(name) || (result += nonVoidAttr(name, val)));
|
|
1433
1439
|
break;
|
|
1434
1440
|
}
|
|
1435
1441
|
}
|
|
@@ -1541,8 +1547,8 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1541
1547
|
return compatRegistered;
|
|
1542
1548
|
},
|
|
1543
1549
|
render(renderer, willRerender, classAPIOut, component, input) {
|
|
1544
|
-
let $
|
|
1545
|
-
state || ($
|
|
1550
|
+
let $global2 = classAPIOut.global, state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
1551
|
+
state || ($global2.runtimeId ||= DEFAULT_RUNTIME_ID, $global2.renderId ||= $global2.componentIdPrefix || DEFAULT_RENDER_ID, $global2[K_TAGS_API_STATE] = state = new State2($global2));
|
|
1546
1552
|
let boundary = new Boundary(state), head = new Chunk(
|
|
1547
1553
|
boundary,
|
|
1548
1554
|
null,
|
|
@@ -1576,17 +1582,17 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1576
1582
|
// src/html/template.ts
|
|
1577
1583
|
var createTemplate = (templateId, renderer) => (renderer.render = render, renderer._ = renderer, register2(renderer, templateId));
|
|
1578
1584
|
function render(input = {}) {
|
|
1579
|
-
let { $global } = input;
|
|
1580
|
-
$
|
|
1585
|
+
let { $global: $global2 } = input;
|
|
1586
|
+
$global2 ? ({ $global: $global2, ...input } = input, $global2 = {
|
|
1581
1587
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
1582
1588
|
renderId: DEFAULT_RENDER_ID,
|
|
1583
|
-
...$
|
|
1584
|
-
}) : $
|
|
1589
|
+
...$global2
|
|
1590
|
+
}) : $global2 = {
|
|
1585
1591
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
1586
1592
|
renderId: DEFAULT_RENDER_ID
|
|
1587
1593
|
};
|
|
1588
1594
|
let head = new Chunk(
|
|
1589
|
-
new Boundary(new State2($
|
|
1595
|
+
new Boundary(new State2($global2), $global2.signal),
|
|
1590
1596
|
null,
|
|
1591
1597
|
null
|
|
1592
1598
|
);
|
|
@@ -1705,6 +1711,7 @@ var ServerRenderResult = class {
|
|
|
1705
1711
|
};
|
|
1706
1712
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1707
1713
|
0 && (module.exports = {
|
|
1714
|
+
$global,
|
|
1708
1715
|
attr,
|
|
1709
1716
|
attrTag,
|
|
1710
1717
|
attrTags,
|
|
@@ -1730,7 +1737,6 @@ var ServerRenderResult = class {
|
|
|
1730
1737
|
forTo,
|
|
1731
1738
|
fork,
|
|
1732
1739
|
getScopeById,
|
|
1733
|
-
getStreamData,
|
|
1734
1740
|
markResumeCleanup,
|
|
1735
1741
|
markResumeControlEnd,
|
|
1736
1742
|
markResumeControlSingleNodeEnd,
|
package/dist/html.mjs
CHANGED
|
@@ -64,6 +64,12 @@ function toDelimitedString(val, delimiter, stringify) {
|
|
|
64
64
|
}
|
|
65
65
|
return "";
|
|
66
66
|
}
|
|
67
|
+
function isEventHandler(name) {
|
|
68
|
+
return /^on[A-Z-]/.test(name);
|
|
69
|
+
}
|
|
70
|
+
function getEventHandlerName(name) {
|
|
71
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
72
|
+
}
|
|
67
73
|
function isVoid(value) {
|
|
68
74
|
return value == null || value === !1;
|
|
69
75
|
}
|
|
@@ -922,8 +928,8 @@ function register2(val, id, scopeId) {
|
|
|
922
928
|
return scopeId === void 0 ? register(id, val) : register(id, val, ensureScopeWithId(scopeId));
|
|
923
929
|
}
|
|
924
930
|
function nextTagId() {
|
|
925
|
-
let state = $chunk.boundary.state, { $global } = state;
|
|
926
|
-
return "s" + $
|
|
931
|
+
let state = $chunk.boundary.state, { $global: $global2 } = state;
|
|
932
|
+
return "s" + $global2.runtimeId + $global2.renderId + (state.tagIndex++).toString(36);
|
|
927
933
|
}
|
|
928
934
|
function nextScopeId() {
|
|
929
935
|
return $chunk.boundary.state.scopeIndex++;
|
|
@@ -979,8 +985,8 @@ function ensureScopeWithId(scopeId) {
|
|
|
979
985
|
let { state } = $chunk.boundary, scope = state.scopes.get(scopeId);
|
|
980
986
|
return scope || (scope = { [K_SCOPE_ID]: scopeId }, state.scopes.set(scopeId, scope)), scope;
|
|
981
987
|
}
|
|
982
|
-
function
|
|
983
|
-
return $chunk.boundary.state;
|
|
988
|
+
function $global() {
|
|
989
|
+
return $chunk.boundary.state.$global;
|
|
984
990
|
}
|
|
985
991
|
function fork(promise, renderBody) {
|
|
986
992
|
if (!isPromise(promise)) {
|
|
@@ -1032,9 +1038,9 @@ function tryCatch(renderBody, renderCatch) {
|
|
|
1032
1038
|
};
|
|
1033
1039
|
}
|
|
1034
1040
|
var State2 = class {
|
|
1035
|
-
constructor($
|
|
1036
|
-
this.$global = $
|
|
1037
|
-
this.$global = $
|
|
1041
|
+
constructor($global2) {
|
|
1042
|
+
this.$global = $global2;
|
|
1043
|
+
this.$global = $global2;
|
|
1038
1044
|
}
|
|
1039
1045
|
tagIndex = 0;
|
|
1040
1046
|
scopeIndex = 0;
|
|
@@ -1049,12 +1055,12 @@ var State2 = class {
|
|
|
1049
1055
|
scopes = /* @__PURE__ */ new Map();
|
|
1050
1056
|
writeScopes = null;
|
|
1051
1057
|
get runtimePrefix() {
|
|
1052
|
-
let { $global } = this;
|
|
1053
|
-
return $
|
|
1058
|
+
let { $global: $global2 } = this;
|
|
1059
|
+
return $global2.runtimeId + "." + $global2.renderId;
|
|
1054
1060
|
}
|
|
1055
1061
|
get commentPrefix() {
|
|
1056
|
-
let { $global } = this;
|
|
1057
|
-
return $
|
|
1062
|
+
let { $global: $global2 } = this;
|
|
1063
|
+
return $global2.runtimeId + $global2.renderId;
|
|
1058
1064
|
}
|
|
1059
1065
|
reorder(chunk) {
|
|
1060
1066
|
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
|
|
@@ -1158,10 +1164,10 @@ var State2 = class {
|
|
|
1158
1164
|
}
|
|
1159
1165
|
};
|
|
1160
1166
|
function prepareChunk(chunk) {
|
|
1161
|
-
let head = chunk.consume(), { boundary, effects } = head, { state } = boundary, { $global, runtimePrefix, serializer } = state, nonceAttr = $
|
|
1167
|
+
let head = chunk.consume(), { boundary, effects } = head, { state } = boundary, { $global: $global2, runtimePrefix, serializer } = state, nonceAttr = $global2.cspNonce ? " nonce=" + escapeAttrValue($global2.cspNonce + "") : "", { html, scripts } = head, hasWalk = !1;
|
|
1162
1168
|
head.effects = "", state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
|
1163
1169
|
scripts,
|
|
1164
|
-
WALKER_RUNTIME_CODE + '("' + $
|
|
1170
|
+
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
1165
1171
|
));
|
|
1166
1172
|
let resumes = "";
|
|
1167
1173
|
if ((state.writeScopes || serializer.flushed) && (resumes = state.serializer.stringify(state.writeScopes || {}, boundary), state.writeScopes = null), effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), boundary.done && (resumes || state.hasWrittenResume) && (resumes = resumes ? resumes + ",0" : "0"), resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
|
@@ -1223,20 +1229,20 @@ function flushTickQueue() {
|
|
|
1223
1229
|
function isPromise(value) {
|
|
1224
1230
|
return value != null && typeof value.then == "function";
|
|
1225
1231
|
}
|
|
1226
|
-
function getFilteredGlobals($
|
|
1227
|
-
if (!$
|
|
1228
|
-
let serializedGlobals = $
|
|
1232
|
+
function getFilteredGlobals($global2) {
|
|
1233
|
+
if (!$global2) return;
|
|
1234
|
+
let serializedGlobals = $global2.serializedGlobals;
|
|
1229
1235
|
if (!serializedGlobals) return;
|
|
1230
1236
|
let filtered;
|
|
1231
1237
|
if (Array.isArray(serializedGlobals))
|
|
1232
1238
|
for (let key of serializedGlobals) {
|
|
1233
|
-
let value = $
|
|
1239
|
+
let value = $global2[key];
|
|
1234
1240
|
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1235
1241
|
}
|
|
1236
1242
|
else
|
|
1237
1243
|
for (let key in serializedGlobals)
|
|
1238
1244
|
if (serializedGlobals[key]) {
|
|
1239
|
-
let value = $
|
|
1245
|
+
let value = $global2[key];
|
|
1240
1246
|
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1241
1247
|
}
|
|
1242
1248
|
return filtered;
|
|
@@ -1301,7 +1307,7 @@ function attr(name, val) {
|
|
|
1301
1307
|
return isVoid(val) ? "" : nonVoidAttr(name, val);
|
|
1302
1308
|
}
|
|
1303
1309
|
function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1304
|
-
let result = "", skip = /[\s/>"'=]/,
|
|
1310
|
+
let result = "", skip = /[\s/>"'=]/, events;
|
|
1305
1311
|
switch (tagName) {
|
|
1306
1312
|
case "input":
|
|
1307
1313
|
if (data.checkedChange)
|
|
@@ -1360,7 +1366,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1360
1366
|
case "renderBody":
|
|
1361
1367
|
break;
|
|
1362
1368
|
default:
|
|
1363
|
-
isVoid(val) || (
|
|
1369
|
+
isVoid(val) || (isEventHandler(name) ? (events ||= ensureScopeWithId(scopeId)[nodeAccessor + "~" /* EventAttributes */] = {})[getEventHandlerName(name)] = val : skip.test(name) || (result += nonVoidAttr(name, val)));
|
|
1364
1370
|
break;
|
|
1365
1371
|
}
|
|
1366
1372
|
}
|
|
@@ -1472,8 +1478,8 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1472
1478
|
return compatRegistered;
|
|
1473
1479
|
},
|
|
1474
1480
|
render(renderer, willRerender, classAPIOut, component, input) {
|
|
1475
|
-
let $
|
|
1476
|
-
state || ($
|
|
1481
|
+
let $global2 = classAPIOut.global, state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
1482
|
+
state || ($global2.runtimeId ||= DEFAULT_RUNTIME_ID, $global2.renderId ||= $global2.componentIdPrefix || DEFAULT_RENDER_ID, $global2[K_TAGS_API_STATE] = state = new State2($global2));
|
|
1477
1483
|
let boundary = new Boundary(state), head = new Chunk(
|
|
1478
1484
|
boundary,
|
|
1479
1485
|
null,
|
|
@@ -1507,17 +1513,17 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
|
1507
1513
|
// src/html/template.ts
|
|
1508
1514
|
var createTemplate = (templateId, renderer) => (renderer.render = render, renderer._ = renderer, register2(renderer, templateId));
|
|
1509
1515
|
function render(input = {}) {
|
|
1510
|
-
let { $global } = input;
|
|
1511
|
-
$
|
|
1516
|
+
let { $global: $global2 } = input;
|
|
1517
|
+
$global2 ? ({ $global: $global2, ...input } = input, $global2 = {
|
|
1512
1518
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
1513
1519
|
renderId: DEFAULT_RENDER_ID,
|
|
1514
|
-
...$
|
|
1515
|
-
}) : $
|
|
1520
|
+
...$global2
|
|
1521
|
+
}) : $global2 = {
|
|
1516
1522
|
runtimeId: DEFAULT_RUNTIME_ID,
|
|
1517
1523
|
renderId: DEFAULT_RENDER_ID
|
|
1518
1524
|
};
|
|
1519
1525
|
let head = new Chunk(
|
|
1520
|
-
new Boundary(new State2($
|
|
1526
|
+
new Boundary(new State2($global2), $global2.signal),
|
|
1521
1527
|
null,
|
|
1522
1528
|
null
|
|
1523
1529
|
);
|
|
@@ -1635,6 +1641,7 @@ var ServerRenderResult = class {
|
|
|
1635
1641
|
}
|
|
1636
1642
|
};
|
|
1637
1643
|
export {
|
|
1644
|
+
$global,
|
|
1638
1645
|
attr,
|
|
1639
1646
|
attrTag,
|
|
1640
1647
|
attrTags,
|
|
@@ -1660,7 +1667,6 @@ export {
|
|
|
1660
1667
|
forTo,
|
|
1661
1668
|
fork,
|
|
1662
1669
|
getScopeById,
|
|
1663
|
-
getStreamData,
|
|
1664
1670
|
markResumeCleanup,
|
|
1665
1671
|
markResumeControlEnd,
|
|
1666
1672
|
markResumeControlSingleNodeEnd,
|