marko 6.0.0-next.3.67 → 6.0.0-next.3.69
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 +1 -8
- package/dist/debug/dom.mjs +1 -8
- package/dist/debug/html.js +239 -187
- package/dist/debug/html.mjs +238 -184
- package/dist/dom.js +3 -7
- package/dist/dom.mjs +3 -7
- package/dist/html/dynamic-tag.d.ts +2 -4
- package/dist/html/writer.d.ts +10 -9
- package/dist/html.d.ts +1 -1
- package/dist/html.js +137 -131
- package/dist/html.mjs +136 -128
- package/dist/translator/index.js +49 -211
- package/package.json +1 -1
package/dist/dom.mjs
CHANGED
@@ -137,7 +137,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
137
137
|
visits.length = 0;
|
138
138
|
let branchEnd = (branchId, reference) => {
|
139
139
|
let branch = scopeLookup[branchId] ||= {}, endNode = reference;
|
140
|
-
for (; visitNodes.has(endNode = endNode.previousSibling); ) ;
|
140
|
+
for (; endNode.previousSibling !== branch.h && visitNodes.has(endNode = endNode.previousSibling); ) ;
|
141
141
|
return endNode === lastEndNode && (endNode = reference.parentNode.insertBefore(
|
142
142
|
new Text(),
|
143
143
|
reference
|
@@ -1027,15 +1027,11 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1027
1027
|
})
|
1028
1028
|
), tryWithPlaceholder && !--tryWithPlaceholder.q)) {
|
1029
1029
|
let placeholderBranch = tryWithPlaceholder.c;
|
1030
|
-
tryWithPlaceholder.c = void 0, placeholderBranch
|
1030
|
+
tryWithPlaceholder.c = void 0, placeholderBranch && (insertBranchBefore(
|
1031
1031
|
tryWithPlaceholder,
|
1032
1032
|
placeholderBranch.h.parentNode,
|
1033
1033
|
placeholderBranch.h
|
1034
|
-
), removeAndDestroyBranch(placeholderBranch))
|
1035
|
-
tryWithPlaceholder,
|
1036
|
-
referenceNode.parentNode,
|
1037
|
-
referenceNode
|
1038
|
-
), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
|
1034
|
+
), removeAndDestroyBranch(placeholderBranch)), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
|
1039
1035
|
}
|
1040
1036
|
}).catch((error) => {
|
1041
1037
|
renderCatch(scope, error, !0);
|
@@ -1,12 +1,10 @@
|
|
1
|
-
import type
|
1
|
+
import { type Accessor } from "../common/types";
|
2
2
|
import type { ServerRenderer } from "./template";
|
3
3
|
interface BodyContentObject {
|
4
4
|
[x: PropertyKey]: unknown;
|
5
5
|
content: ServerRenderer;
|
6
6
|
}
|
7
|
-
export declare
|
8
|
-
export declare let dynamicTagInput: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, input: Record<string, unknown>, content?: () => void) => undefined;
|
9
|
-
export declare let dynamicTagArgs: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, args: unknown[]) => undefined;
|
7
|
+
export declare let dynamicTag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, resume?: 1) => unknown;
|
10
8
|
export declare function createContent(id: string, fn: ServerRenderer): ServerRenderer;
|
11
9
|
export declare function registerContent(id: string, fn: ServerRenderer, scopeId?: number): ServerRenderer;
|
12
10
|
export declare function patchDynamicTag(patch: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject) => unknown): void;
|
package/dist/html/writer.d.ts
CHANGED
@@ -15,7 +15,7 @@ export declare function getScopeId(scope: unknown): number | undefined;
|
|
15
15
|
export declare function write(html: string): void;
|
16
16
|
export declare function writeScript(script: string): void;
|
17
17
|
export declare function writeEffect(scopeId: number, registryId: string): void;
|
18
|
-
export declare function withContext(key: PropertyKey, value: unknown, cb: () =>
|
18
|
+
export declare function withContext<T>(key: PropertyKey, value: unknown, cb: () => T): T;
|
19
19
|
export declare function setTagVar(parentScopeId: number, scopeOffsetAccessor: Accessor, childScope: PartialScope, registryId: string): void;
|
20
20
|
export declare function register<T extends WeakKey>(val: T, id: string, scopeId?: number): T;
|
21
21
|
export declare function nextTagId(): string;
|
@@ -30,14 +30,15 @@ export declare function hoist(scopeId: number, id?: string): {
|
|
30
30
|
[Symbol.iterator]: /*elided*/ any;
|
31
31
|
};
|
32
32
|
export declare function resumeClosestBranch(scopeId: number): void;
|
33
|
-
export declare function
|
34
|
-
export declare function
|
35
|
-
export declare function
|
36
|
-
export declare function
|
37
|
-
export declare function
|
38
|
-
export declare function
|
39
|
-
export declare function
|
40
|
-
export declare function
|
33
|
+
export declare function withBranchId<T>(branchId: number, cb: () => T): T;
|
34
|
+
export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor): void;
|
35
|
+
export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, onlyChildInParent?: 1): void;
|
36
|
+
export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor): void;
|
37
|
+
export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, onlyChild?: 1): void;
|
38
|
+
export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor): void;
|
39
|
+
export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, onlyChild?: 1): void;
|
40
|
+
export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, dynamic?: 1): void;
|
41
|
+
export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, dynamic?: 0 | 1, onlyChild?: 1): void;
|
41
42
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
42
43
|
export { writeScope };
|
43
44
|
export declare function writeExistingScope(scope: ScopeInternals): ScopeInternals;
|
package/dist/html.d.ts
CHANGED
@@ -2,7 +2,7 @@ export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
2
|
export { attr, attrs, classAttr, controllable_detailsOrDialog_open, controllable_input_checked, controllable_input_checkedValue, controllable_input_value, controllable_select_value, controllable_textarea_value, optionValueAttr, partialAttrs, styleAttr, } from "./html/attrs";
|
3
3
|
export { compat } from "./html/compat";
|
4
4
|
export { escapeScript, escapeStyle, escapeXML, toString } from "./html/content";
|
5
|
-
export { createContent,
|
5
|
+
export { createContent, dynamicTag, registerContent } from "./html/dynamic-tag";
|
6
6
|
export { forIn, forInBy, forOf, forOfBy, forTo, forToBy } from "./html/for";
|
7
7
|
export { createTemplate } from "./html/template";
|
8
8
|
export { $global, ensureScopeWithId, fork, getScopeById, hoist, markResumeNode, nextScopeId, nextTagId, nodeRef, peekNextScope, register, resumeClosestBranch, resumeConditional, resumeForIn, resumeForOf, resumeForTo, resumeSingleNodeConditional, resumeSingleNodeForIn, resumeSingleNodeForOf, resumeSingleNodeForTo, setTagVar, tryContent, write, writeEffect, writeExistingScope, writeScope, writeSubscribe, writeTrailers, } from "./html/writer";
|
package/dist/html.js
CHANGED
@@ -32,19 +32,17 @@ __export(html_exports, {
|
|
32
32
|
controllable_textarea_value: () => controllable_textarea_value,
|
33
33
|
createContent: () => createContent,
|
34
34
|
createTemplate: () => createTemplate,
|
35
|
-
|
36
|
-
dynamicTagId: () => dynamicTagId,
|
37
|
-
dynamicTagInput: () => dynamicTagInput,
|
35
|
+
dynamicTag: () => dynamicTag,
|
38
36
|
ensureScopeWithId: () => ensureScopeWithId,
|
39
37
|
escapeScript: () => escapeScript,
|
40
38
|
escapeStyle: () => escapeStyle,
|
41
39
|
escapeXML: () => escapeXML,
|
42
40
|
forIn: () => forIn,
|
43
|
-
forInBy: () =>
|
41
|
+
forInBy: () => forInBy2,
|
44
42
|
forOf: () => forOf,
|
45
|
-
forOfBy: () =>
|
43
|
+
forOfBy: () => forOfBy2,
|
46
44
|
forTo: () => forTo,
|
47
|
-
forToBy: () =>
|
45
|
+
forToBy: () => forToBy2,
|
48
46
|
fork: () => fork,
|
49
47
|
getScopeById: () => getScopeById,
|
50
48
|
hoist: () => hoist,
|
@@ -178,7 +176,7 @@ function forTo(to, from, step, cb) {
|
|
178
176
|
}
|
179
177
|
|
180
178
|
// src/html/inlined-runtimes.ts
|
181
|
-
var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},s=[],f=document,i=f.createTreeWalker(f,129),n=self[e][l]={i:l=e+l,d:f,l:d,v:s,x(){},w(e){for(;e=i.nextNode();)this.x(n=(n=e.data)&&!n.indexOf(l)&&(d[t=n.slice(x+1)]=e,n[x]),t,e),n>"#"&&s.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,t,r
|
179
|
+
var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},s=[],f=document,i=f.createTreeWalker(f,129),n=self[e][l]={i:l=e+l,d:f,l:d,v:s,x(){},w(e){for(;e=i.nextNode();)this.x(n=(n=e.data)&&!n.indexOf(l)&&(d[t=n.slice(x+1)]=e,n[x]),t,e),n>"#"&&s.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
|
182
180
|
|
183
181
|
// src/html/serializer.ts
|
184
182
|
var { hasOwnProperty } = {}, Generator = function* () {
|
@@ -492,10 +490,7 @@ function register(id, val, scope) {
|
|
492
490
|
function getRegistered(val) {
|
493
491
|
let registered = REGISTRY.get(val);
|
494
492
|
if (registered)
|
495
|
-
return {
|
496
|
-
id: registered.id,
|
497
|
-
scope: registered.scope
|
498
|
-
};
|
493
|
+
return { id: registered.id, scope: registered.scope };
|
499
494
|
}
|
500
495
|
function writeRoot(state, root) {
|
501
496
|
let { buf, assigned, mutations } = state, hadBuf = buf.length !== 0, result = "";
|
@@ -591,7 +586,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope, getter }
|
|
591
586
|
return newScopeRef && ensureId(state, newScopeRef), !0;
|
592
587
|
}
|
593
588
|
if (scopeRef) {
|
594
|
-
if (isCircular(parent, scopeRef))
|
589
|
+
if (parent && (state.assigned.has(scopeRef) || isCircular(parent, scopeRef)))
|
595
590
|
return state.assigned.add(parent), state.assigned.add(fnRef), fnRef.init = access + "(" + ensureId(state, scopeRef) + ")", addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor)), !1;
|
596
591
|
state.buf.push(access + "(" + ensureId(state, scopeRef) + ")");
|
597
592
|
} else {
|
@@ -1093,7 +1088,7 @@ function withContext(key, value, cb) {
|
|
1093
1088
|
let ctx = $chunk.context ||= { [kPendingContexts]: 0 }, prev = ctx[key];
|
1094
1089
|
ctx[kPendingContexts]++, ctx[key] = value;
|
1095
1090
|
try {
|
1096
|
-
cb();
|
1091
|
+
return cb();
|
1097
1092
|
} finally {
|
1098
1093
|
ctx[kPendingContexts]--, ctx[key] = prev;
|
1099
1094
|
}
|
@@ -1141,20 +1136,26 @@ function hoist(scopeId, id) {
|
|
1141
1136
|
}
|
1142
1137
|
function resumeClosestBranch(scopeId) {
|
1143
1138
|
let branchId = $chunk.context?.[branchIdKey];
|
1144
|
-
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, {
|
1145
|
-
g: branchId
|
1146
|
-
});
|
1139
|
+
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { g: branchId });
|
1147
1140
|
}
|
1148
1141
|
var branchIdKey = Symbol();
|
1149
|
-
function
|
1150
|
-
|
1142
|
+
function withBranchId(branchId, cb) {
|
1143
|
+
return withContext(branchIdKey, branchId, cb);
|
1144
|
+
}
|
1145
|
+
function resumeForOf(list, cb, by, scopeId, accessor) {
|
1146
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1147
|
+
forOf(list, (item, index) => {
|
1151
1148
|
let branchId = peekNextScopeId();
|
1152
1149
|
$chunk.writeHTML(
|
1153
1150
|
$chunk.boundary.state.mark(
|
1154
1151
|
"[" /* BranchStart */,
|
1155
|
-
branchId + (
|
1152
|
+
branchId + (index ? " " : "")
|
1156
1153
|
)
|
1157
|
-
),
|
1154
|
+
), withBranchId(branchId, () => {
|
1155
|
+
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1156
|
+
});
|
1157
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1158
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1158
1159
|
}), $chunk.writeHTML(
|
1159
1160
|
$chunk.boundary.state.mark(
|
1160
1161
|
"]" /* BranchEnd */,
|
@@ -1162,11 +1163,15 @@ function resumeForOf(list, cb, scopeId, accessor) {
|
|
1162
1163
|
)
|
1163
1164
|
);
|
1164
1165
|
}
|
1165
|
-
function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
|
1166
|
-
let branchIds = "";
|
1166
|
+
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, onlyChildInParent) {
|
1167
|
+
let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
|
1167
1168
|
forOf(list, (item, index) => {
|
1168
1169
|
let branchId = peekNextScopeId();
|
1169
|
-
branchIds = " " + branchId + branchIds,
|
1170
|
+
branchIds = " " + branchId + branchIds, withBranchId(branchId, () => {
|
1171
|
+
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1172
|
+
});
|
1173
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1174
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1170
1175
|
}), $chunk.writeHTML(
|
1171
1176
|
$chunk.boundary.state.mark(
|
1172
1177
|
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1174,13 +1179,20 @@ function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
|
|
1174
1179
|
)
|
1175
1180
|
);
|
1176
1181
|
}
|
1177
|
-
function
|
1178
|
-
|
1182
|
+
function forOfBy(by, item, index) {
|
1183
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
1184
|
+
}
|
1185
|
+
function resumeForIn(obj, cb, by, scopeId, accessor) {
|
1186
|
+
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
1179
1187
|
forIn(obj, (key, value) => {
|
1180
1188
|
let branchId = peekNextScopeId();
|
1181
1189
|
$chunk.writeHTML(
|
1182
1190
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1183
|
-
), sep = " ",
|
1191
|
+
), sep = " ", withBranchId(branchId, () => {
|
1192
|
+
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1193
|
+
});
|
1194
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1195
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1184
1196
|
}), $chunk.writeHTML(
|
1185
1197
|
$chunk.boundary.state.mark(
|
1186
1198
|
"]" /* BranchEnd */,
|
@@ -1188,11 +1200,15 @@ function resumeForIn(obj, cb, scopeId, accessor) {
|
|
1188
1200
|
)
|
1189
1201
|
);
|
1190
1202
|
}
|
1191
|
-
function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
|
1192
|
-
let branchIds = "";
|
1203
|
+
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, onlyChild) {
|
1204
|
+
let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
|
1193
1205
|
forIn(obj, (key, value) => {
|
1194
1206
|
let branchId = peekNextScopeId();
|
1195
|
-
branchIds = " " + branchId + branchIds,
|
1207
|
+
branchIds = " " + branchId + branchIds, withBranchId(branchId, () => {
|
1208
|
+
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1209
|
+
});
|
1210
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1211
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1196
1212
|
}), $chunk.writeHTML(
|
1197
1213
|
$chunk.boundary.state.mark(
|
1198
1214
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1200,13 +1216,20 @@ function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
|
|
1200
1216
|
)
|
1201
1217
|
);
|
1202
1218
|
}
|
1203
|
-
function
|
1204
|
-
|
1219
|
+
function forInBy(by, name, value) {
|
1220
|
+
return by ? by(name, value) : name;
|
1221
|
+
}
|
1222
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor) {
|
1223
|
+
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
1205
1224
|
forTo(to, from, step, (index) => {
|
1206
1225
|
let branchId = peekNextScopeId();
|
1207
1226
|
$chunk.writeHTML(
|
1208
1227
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1209
|
-
), sep = " ",
|
1228
|
+
), sep = " ", withBranchId(branchId, () => {
|
1229
|
+
cb(index), loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1230
|
+
});
|
1231
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1232
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1210
1233
|
}), $chunk.writeHTML(
|
1211
1234
|
$chunk.boundary.state.mark(
|
1212
1235
|
"]" /* BranchEnd */,
|
@@ -1214,11 +1237,15 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
|
|
1214
1237
|
)
|
1215
1238
|
);
|
1216
1239
|
}
|
1217
|
-
function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild) {
|
1218
|
-
let branchIds = "";
|
1240
|
+
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, onlyChild) {
|
1241
|
+
let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
|
1219
1242
|
forTo(to, from, step, (index) => {
|
1220
1243
|
let branchId = peekNextScopeId();
|
1221
|
-
branchIds = " " + branchId + branchIds,
|
1244
|
+
branchIds = " " + branchId + branchIds, withBranchId(branchId, () => {
|
1245
|
+
cb(index), loopScopes.set(forToBy(by, index), writeScope(branchId, {}));
|
1246
|
+
});
|
1247
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1248
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1222
1249
|
}), $chunk.writeHTML(
|
1223
1250
|
$chunk.boundary.state.mark(
|
1224
1251
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
@@ -1226,22 +1253,31 @@ function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild)
|
|
1226
1253
|
)
|
1227
1254
|
);
|
1228
1255
|
}
|
1229
|
-
function
|
1256
|
+
function forToBy(by, index) {
|
1257
|
+
return by ? by(index) : index;
|
1258
|
+
}
|
1259
|
+
function resumeConditional(cb, scopeId, accessor, dynamic) {
|
1230
1260
|
let branchId = peekNextScopeId();
|
1231
|
-
$chunk.writeHTML(
|
1261
|
+
dynamic && $chunk.writeHTML(
|
1232
1262
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1233
|
-
)
|
1263
|
+
);
|
1264
|
+
let branchIndex = withBranchId(branchId, cb);
|
1265
|
+
branchIndex !== void 0 ? writeScope(scopeId, {
|
1266
|
+
["c" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
|
1267
|
+
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1268
|
+
}) : nextScopeId(), dynamic && $chunk.writeHTML(
|
1234
1269
|
$chunk.boundary.state.mark(
|
1235
1270
|
"]" /* BranchEnd */,
|
1236
1271
|
scopeId + " " + accessor
|
1237
1272
|
)
|
1238
1273
|
);
|
1239
1274
|
}
|
1240
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
|
1241
|
-
let branchId = peekNextScopeId();
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1275
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor, dynamic, onlyChild) {
|
1276
|
+
let branchId = peekNextScopeId(), branchIndex = withBranchId(branchId, cb), rendered = branchIndex !== void 0;
|
1277
|
+
rendered ? writeScope(scopeId, {
|
1278
|
+
["c" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
|
1279
|
+
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1280
|
+
}) : nextScopeId(), dynamic && $chunk.writeHTML(
|
1245
1281
|
$chunk.boundary.state.mark(
|
1246
1282
|
onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1247
1283
|
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
@@ -1519,8 +1555,9 @@ function prepareChunk(chunk) {
|
|
1519
1555
|
for (let reorderedChunk of state.writeReorders) {
|
1520
1556
|
let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
1521
1557
|
for (reorderedChunk.reorderId = null; ; ) {
|
1558
|
+
cur.flushPlaceholder();
|
1522
1559
|
let { next } = cur;
|
1523
|
-
if (cur.
|
1560
|
+
if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
|
1524
1561
|
"#" /* ReorderMarker */,
|
1525
1562
|
cur.reorderId = state.nextReorderId()
|
1526
1563
|
), cur.html = cur.effects = cur.scripts = "", cur.next = null), next)
|
@@ -1793,80 +1830,51 @@ var prefix = "$C_", RENDERER_REGISTER_ID = prefix + "r", SET_SCOPE_REGISTER_ID =
|
|
1793
1830
|
var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
|
1794
1831
|
|
1795
1832
|
// src/html/dynamic-tag.ts
|
1796
|
-
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
}
|
1801
|
-
|
1802
|
-
|
1803
|
-
nextScopeId();
|
1804
|
-
return;
|
1805
|
-
}
|
1806
|
-
if (!tag) {
|
1807
|
-
resumeConditional(content, scopeId, accessor);
|
1808
|
-
return;
|
1809
|
-
}
|
1810
|
-
if (typeof tag == "string") {
|
1811
|
-
resumeSingleNodeConditional(
|
1812
|
-
() => {
|
1813
|
-
nextScopeId(), write(`<${tag}${attrs(input, accessor, scopeId, tag)}>`), voidElementsReg.test(tag) || (tag === "textarea" ? write(
|
1814
|
-
controllable_textarea_value(
|
1815
|
-
scopeId,
|
1816
|
-
accessor,
|
1817
|
-
input.value,
|
1818
|
-
input.valueChange
|
1819
|
-
)
|
1820
|
-
) : content && (tag === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
|
1833
|
+
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, resume) => {
|
1834
|
+
let renderer = normalizeDynamicRenderer(tag), chunk = getChunk(), branchId = peekNextScopeId(), result;
|
1835
|
+
if (typeof renderer == "string") {
|
1836
|
+
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
1837
|
+
nextScopeId(), write(`<${renderer}${attrs(input, accessor, scopeId, renderer)}>`), voidElementsReg.test(renderer) || (withBranchId(branchId, () => {
|
1838
|
+
renderer === "textarea" ? write(
|
1839
|
+
controllable_textarea_value(
|
1821
1840
|
scopeId,
|
1822
1841
|
accessor,
|
1823
1842
|
input.value,
|
1824
|
-
input.valueChange
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1843
|
+
input.valueChange
|
1844
|
+
)
|
1845
|
+
) : content && (renderer === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
|
1846
|
+
scopeId,
|
1847
|
+
accessor,
|
1848
|
+
input.value,
|
1849
|
+
input.valueChange,
|
1850
|
+
content
|
1851
|
+
) : content());
|
1852
|
+
}), write(`</${renderer}>`)), resume && chunk.writeHTML(
|
1853
|
+
chunk.boundary.state.mark(
|
1854
|
+
"|" /* BranchSingleNode */,
|
1855
|
+
scopeId + " " + accessor + " " + branchId
|
1856
|
+
)
|
1830
1857
|
);
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
return;
|
1847
|
-
}
|
1848
|
-
if (typeof tag == "string") {
|
1849
|
-
resumeSingleNodeConditional(
|
1850
|
-
() => {
|
1851
|
-
nextScopeId(), write(
|
1852
|
-
`<${tag}${attrs(args[0], accessor, scopeId, tag)}>`
|
1853
|
-
), voidElementsReg.test(tag) || write(`</${tag}>`);
|
1854
|
-
},
|
1855
|
-
scopeId,
|
1856
|
-
accessor
|
1858
|
+
} else
|
1859
|
+
resume && chunk.writeHTML(
|
1860
|
+
chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1861
|
+
), result = withBranchId(branchId, () => {
|
1862
|
+
if (renderer)
|
1863
|
+
return inputIsArgs ? renderer(...inputOrArgs) : renderer(
|
1864
|
+
content ? { ...inputOrArgs, content } : inputOrArgs
|
1865
|
+
);
|
1866
|
+
if (content)
|
1867
|
+
return content();
|
1868
|
+
}), resume && chunk.writeHTML(
|
1869
|
+
chunk.boundary.state.mark(
|
1870
|
+
"]" /* BranchEnd */,
|
1871
|
+
scopeId + " " + accessor
|
1872
|
+
)
|
1857
1873
|
);
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
), result;
|
1863
|
-
return resumeConditional(
|
1864
|
-
() => {
|
1865
|
-
result = renderer(...args);
|
1866
|
-
},
|
1867
|
-
scopeId,
|
1868
|
-
accessor
|
1869
|
-
), result;
|
1874
|
+
return peekNextScopeId() !== branchId ? resume && writeScope(scopeId, {
|
1875
|
+
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {}),
|
1876
|
+
["c" /* ConditionalRenderer */ + accessor]: renderer?.h || renderer
|
1877
|
+
}) : nextScopeId(), result;
|
1870
1878
|
};
|
1871
1879
|
function createContent(id, fn) {
|
1872
1880
|
return fn.h = id, fn;
|
@@ -1875,18 +1883,18 @@ function registerContent(id, fn, scopeId) {
|
|
1875
1883
|
return register2(createContent(id, fn), id, scopeId);
|
1876
1884
|
}
|
1877
1885
|
function patchDynamicTag(patch) {
|
1878
|
-
|
1879
|
-
scopeId,
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
)
|
1886
|
+
dynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
1887
|
+
let patched = patch(scopeId, accessor, tag);
|
1888
|
+
return patched.h = tag, originalDynamicTag(
|
1889
|
+
scopeId,
|
1890
|
+
accessor,
|
1891
|
+
patched,
|
1892
|
+
input,
|
1893
|
+
content,
|
1894
|
+
inputIsArgs,
|
1895
|
+
resume
|
1896
|
+
);
|
1897
|
+
})(dynamicTag);
|
1890
1898
|
}
|
1891
1899
|
|
1892
1900
|
// src/html/compat.ts
|
@@ -1961,13 +1969,13 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
1961
1969
|
};
|
1962
1970
|
|
1963
1971
|
// src/html/for.ts
|
1964
|
-
function
|
1972
|
+
function forOfBy2(by, item, index) {
|
1965
1973
|
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
1966
1974
|
}
|
1967
|
-
function
|
1975
|
+
function forInBy2(by, name, value) {
|
1968
1976
|
return by ? by(name, value) : name;
|
1969
1977
|
}
|
1970
|
-
function
|
1978
|
+
function forToBy2(by, index) {
|
1971
1979
|
return by ? by(index) : index;
|
1972
1980
|
}
|
1973
1981
|
|
@@ -2128,9 +2136,7 @@ function NOOP2() {
|
|
2128
2136
|
controllable_textarea_value,
|
2129
2137
|
createContent,
|
2130
2138
|
createTemplate,
|
2131
|
-
|
2132
|
-
dynamicTagId,
|
2133
|
-
dynamicTagInput,
|
2139
|
+
dynamicTag,
|
2134
2140
|
ensureScopeWithId,
|
2135
2141
|
escapeScript,
|
2136
2142
|
escapeStyle,
|