marko 6.0.61 → 6.0.62
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/types.d.ts +4 -3
- package/dist/debug/dom.js +72 -82
- package/dist/debug/dom.mjs +72 -82
- package/dist/debug/html.js +52 -47
- package/dist/debug/html.mjs +52 -47
- package/dist/dom.js +31 -40
- package/dist/dom.mjs +31 -40
- package/dist/html.js +59 -50
- package/dist/html.mjs +59 -50
- package/package.json +1 -1
package/dist/dom.mjs
CHANGED
@@ -200,59 +200,50 @@ function init(runtimeId = "M") {
|
|
200
200
|
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
|
201
201
|
defineRuntime({
|
202
202
|
value: resumeRender = ((renderId) => {
|
203
|
-
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w,
|
203
|
+
let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, scopeLookup = render.s = {}, serializeContext = {
|
204
204
|
_: registeredValues
|
205
205
|
}, branches = branchesEnabled && /* @__PURE__ */ (() => {
|
206
|
-
let
|
207
|
-
let
|
208
|
-
for (;
|
209
|
-
|
206
|
+
let branchParents = /* @__PURE__ */ new Map(), branchStarts = [], orphanBranches = [], endBranch = (singleNode) => {
|
207
|
+
let parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, claimed = 0, branchId, branch;
|
208
|
+
for (; branchId = +lastToken; ) {
|
209
|
+
if (branch = scopeLookup[branchId] ||= {}, singleNode) {
|
210
|
+
for (; startVisit.previousSibling && ~visits.indexOf(
|
211
|
+
startVisit = startVisit.previousSibling
|
212
|
+
); ) ;
|
213
|
+
branch.j = branch.h = startVisit, visitType === "'" /* BranchEndNativeTag */ && (branch[0] = startVisit);
|
214
|
+
} else
|
215
|
+
startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.h = startVisit, branch.j = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
216
|
+
for (; i-- && orphanBranches[i] > branchId; )
|
217
|
+
branchParents.set(orphanBranches[i], branchId), claimed++;
|
218
|
+
orphanBranches.push(branchId), branchParents.set(branchId, 0), nextToken();
|
219
|
+
}
|
220
|
+
orphanBranches.splice(i, claimed);
|
210
221
|
};
|
211
222
|
return {
|
212
223
|
K() {
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
).h;
|
220
|
-
visitScope[visitData] = visit, curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
|
221
|
-
} else {
|
222
|
-
let next = visitData.indexOf(" "), curNode = visit;
|
223
|
-
for (visitScope[~next ? visitData.slice(0, next) : visitData] = visitToken === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
224
|
-
let start = next + 1;
|
225
|
-
next = visitData.indexOf(" ", start);
|
226
|
-
let childScopeId = +visitData.slice(
|
227
|
-
start,
|
228
|
-
~next ? next : visitData.length
|
229
|
-
);
|
230
|
-
if (curNode = endBranch(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId), visitToken === "'" /* BranchNativeTag */) {
|
231
|
-
let childBranch = scopeLookup[childScopeId];
|
232
|
-
childBranch[0] = childBranch.h = childBranch.j = curNode;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
}
|
224
|
+
visitType === "[" /* BranchStart */ ? (endBranch(), branchStarts.push(visit)) : (visitScope[
|
225
|
+
nextToken()
|
226
|
+
/* read accessor */
|
227
|
+
] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? visit.parentNode : visit, nextToken(), endBranch(
|
228
|
+
visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */
|
229
|
+
));
|
236
230
|
},
|
237
231
|
t(scope) {
|
238
|
-
|
239
|
-
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
240
|
-
let branch = scope, parentBranch = branch.k;
|
241
|
-
scope.k = branch, parentBranch && (branch.y = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch));
|
242
|
-
}
|
232
|
+
scope.k = scopeLookup[scope.g || branchParents.get(scopeId)], branchParents.has(scopeId) && (scope.k && ((scope.y = scope.k).A ||= /* @__PURE__ */ new Set()).add(scope), scope.k = scope);
|
243
233
|
}
|
244
234
|
};
|
245
|
-
})(), $global, lastScopeId = 0, lastEffect, visits, resumes, scopeId, visit, visitText,
|
235
|
+
})(), $global, lastScopeId = 0, lastEffect, visits, resumes, scopeId, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, nextToken = () => lastToken = visitText.slice(
|
236
|
+
lastTokenIndex,
|
237
|
+
// eslint-disable-next-line no-cond-assign
|
238
|
+
(lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1) ? lastTokenIndex - 1 : visitText.length
|
239
|
+
);
|
246
240
|
return render.w = () => {
|
247
241
|
try {
|
248
242
|
walk2(), isResuming = 1;
|
249
243
|
for (visit of visits = render.v)
|
250
|
-
visitText = visit.data,
|
251
|
-
commentPrefixLen + 1,
|
252
|
-
visitDataIndex ? visitDataIndex - 1 : visitText.length
|
253
|
-
), visitData = visitDataIndex ? visitText.slice(visitDataIndex) : "", visitToken = visitText[commentPrefixLen], visitScope = scopeLookup[scopeId] ||= {
|
244
|
+
lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], (scopeId = +nextToken()) && (visitScope = scopeLookup[scopeId] ||= {
|
254
245
|
l: scopeId
|
255
|
-
},
|
246
|
+
}), visitType === "*" /* Node */ ? visitScope["j" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling) : branchesEnabled && branches.K();
|
256
247
|
for (let serialized of resumes = render.r || [])
|
257
248
|
if (typeof serialized == "string")
|
258
249
|
lastEffect = serialized;
|
@@ -268,7 +259,7 @@ function init(runtimeId = "M") {
|
|
268
259
|
$global ? typeof scope == "number" ? lastScopeId += scope : (scopeId = ++lastScopeId, scope.$global = $global, scope.l = scopeId, scopeLookup[scopeId] !== scope && (scopeLookup[scopeId] = Object.assign(
|
269
260
|
scope,
|
270
261
|
scopeLookup[scopeId]
|
271
|
-
)),
|
262
|
+
)), branchesEnabled && branches.t(scope)) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.p = 1e6);
|
272
263
|
} finally {
|
273
264
|
isResuming = visits.length = resumes.length = 0;
|
274
265
|
}
|
package/dist/html.js
CHANGED
@@ -1189,14 +1189,14 @@ function withBranchId(branchId, cb) {
|
|
1189
1189
|
return withContext(branchIdKey, branchId, cb);
|
1190
1190
|
}
|
1191
1191
|
function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1192
|
-
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0,
|
1192
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, flushBranchIds = "";
|
1193
1193
|
if (resumeBranch) {
|
1194
1194
|
let loopScopes = /* @__PURE__ */ new Map();
|
1195
1195
|
forOf(list, (item, index) => {
|
1196
1196
|
let branchId = _peek_scope_id();
|
1197
|
-
resumeMarker && (singleNode ?
|
1198
|
-
state.mark("[" /* BranchStart */,
|
1199
|
-
)), withBranchId(branchId, () => {
|
1197
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1198
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1199
|
+
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1200
1200
|
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1201
1201
|
});
|
1202
1202
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1207,23 +1207,22 @@ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMark
|
|
1207
1207
|
writeBranchEnd(
|
1208
1208
|
scopeId,
|
1209
1209
|
accessor,
|
1210
|
+
resumeBranch,
|
1210
1211
|
resumeMarker,
|
1211
1212
|
parentEndTag,
|
1212
|
-
|
1213
|
-
|
1214
|
-
scopeId + " " + accessor + singleNodeBranchIds
|
1215
|
-
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1213
|
+
singleNode,
|
1214
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1216
1215
|
);
|
1217
1216
|
}
|
1218
1217
|
function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1219
|
-
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0,
|
1218
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, flushBranchIds = "";
|
1220
1219
|
if (resumeBranch) {
|
1221
|
-
let loopScopes = /* @__PURE__ */ new Map()
|
1220
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1222
1221
|
forIn(obj, (key, value) => {
|
1223
1222
|
let branchId = _peek_scope_id();
|
1224
|
-
resumeMarker && (singleNode ?
|
1225
|
-
state.mark("[" /* BranchStart */,
|
1226
|
-
),
|
1223
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1224
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1225
|
+
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1227
1226
|
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1228
1227
|
});
|
1229
1228
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1234,23 +1233,22 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
|
|
1234
1233
|
writeBranchEnd(
|
1235
1234
|
scopeId,
|
1236
1235
|
accessor,
|
1236
|
+
resumeBranch,
|
1237
1237
|
resumeMarker,
|
1238
1238
|
parentEndTag,
|
1239
|
-
|
1240
|
-
|
1241
|
-
scopeId + " " + accessor + singleNodeBranchIds
|
1242
|
-
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1239
|
+
singleNode,
|
1240
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1243
1241
|
);
|
1244
1242
|
}
|
1245
1243
|
function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1246
|
-
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0,
|
1244
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, flushBranchIds = "";
|
1247
1245
|
if (resumeBranch) {
|
1248
|
-
let loopScopes = /* @__PURE__ */ new Map()
|
1246
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1249
1247
|
forTo(to, from, step, (i) => {
|
1250
1248
|
let branchId = _peek_scope_id();
|
1251
|
-
resumeMarker && (singleNode ?
|
1252
|
-
state.mark("[" /* BranchStart */,
|
1253
|
-
),
|
1249
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1250
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1251
|
+
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1254
1252
|
cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1255
1253
|
});
|
1256
1254
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1261,17 +1259,16 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1261
1259
|
writeBranchEnd(
|
1262
1260
|
scopeId,
|
1263
1261
|
accessor,
|
1262
|
+
resumeBranch,
|
1264
1263
|
resumeMarker,
|
1265
1264
|
parentEndTag,
|
1266
|
-
|
1267
|
-
|
1268
|
-
scopeId + " " + accessor + singleNodeBranchIds
|
1269
|
-
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1265
|
+
singleNode,
|
1266
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1270
1267
|
);
|
1271
1268
|
}
|
1272
1269
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1273
1270
|
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = _peek_scope_id();
|
1274
|
-
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */,
|
1271
|
+
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */, ""));
|
1275
1272
|
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
1276
1273
|
shouldWriteBranch && writeScope(scopeId, {
|
1277
1274
|
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
@@ -1279,17 +1276,29 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndT
|
|
1279
1276
|
}), writeBranchEnd(
|
1280
1277
|
scopeId,
|
1281
1278
|
accessor,
|
1279
|
+
resumeBranch,
|
1282
1280
|
resumeMarker,
|
1283
1281
|
parentEndTag,
|
1284
|
-
|
1285
|
-
|
1286
|
-
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
1287
|
-
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1282
|
+
singleNode,
|
1283
|
+
shouldWriteBranch ? " " + branchId : ""
|
1288
1284
|
);
|
1289
1285
|
}
|
1290
|
-
function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag,
|
1286
|
+
function writeBranchEnd(scopeId, accessor, resumeBranch, resumeMarker, parentEndTag, singleNode, branchIds) {
|
1291
1287
|
let endTag = parentEndTag || "";
|
1292
|
-
|
1288
|
+
if (resumeMarker)
|
1289
|
+
if (!parentEndTag || resumeBranch) {
|
1290
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(
|
1291
|
+
parentEndTag ? "}" /* BranchEndSingleNodeOnlyChildInParent */ : "|" /* BranchEndSingleNode */,
|
1292
|
+
scopeId + " " + accessor + (branchIds || "")
|
1293
|
+
) : state.mark(
|
1294
|
+
parentEndTag ? ")" /* BranchEndOnlyChildInParent */ : "]" /* BranchEnd */,
|
1295
|
+
scopeId + " " + accessor + (branchIds || "")
|
1296
|
+
);
|
1297
|
+
$chunk.writeHTML(mark + endTag);
|
1298
|
+
} else
|
1299
|
+
$chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
1300
|
+
else
|
1301
|
+
$chunk.writeHTML(endTag);
|
1293
1302
|
}
|
1294
1303
|
var writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope);
|
1295
1304
|
function writeScopeToState(state, scopeId, partialScope) {
|
@@ -1312,13 +1321,13 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1312
1321
|
if (resumeMarker) {
|
1313
1322
|
let branchId = _peek_scope_id();
|
1314
1323
|
$chunk.writeHTML(
|
1315
|
-
$chunk.boundary.state.mark("[" /* BranchStart */,
|
1324
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, "")
|
1316
1325
|
), content(promise), writeScope(scopeId, {
|
1317
1326
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1318
1327
|
}), $chunk.writeHTML(
|
1319
1328
|
$chunk.boundary.state.mark(
|
1320
1329
|
"]" /* BranchEnd */,
|
1321
|
-
scopeId + " " + accessor
|
1330
|
+
scopeId + " " + accessor + " " + branchId
|
1322
1331
|
)
|
1323
1332
|
);
|
1324
1333
|
} else
|
@@ -1332,10 +1341,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1332
1341
|
if (resumeMarker) {
|
1333
1342
|
let branchId = _peek_scope_id();
|
1334
1343
|
$chunk.writeHTML(
|
1335
|
-
$chunk.boundary.state.mark(
|
1336
|
-
"[" /* BranchStart */,
|
1337
|
-
branchId + ""
|
1338
|
-
)
|
1344
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, "")
|
1339
1345
|
), content(value), boundary.state.serializer.writeAssign(
|
1340
1346
|
writeScope(branchId, {}),
|
1341
1347
|
_scope_with_id(scopeId),
|
@@ -1343,7 +1349,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1343
1349
|
), $chunk.writeHTML(
|
1344
1350
|
$chunk.boundary.state.mark(
|
1345
1351
|
"]" /* BranchEnd */,
|
1346
|
-
scopeId + " " + accessor
|
1352
|
+
scopeId + " " + accessor + " " + branchId
|
1347
1353
|
)
|
1348
1354
|
);
|
1349
1355
|
} else
|
@@ -1357,9 +1363,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1357
1363
|
}
|
1358
1364
|
function _try(scopeId, accessor, content, input) {
|
1359
1365
|
let branchId = _peek_scope_id();
|
1360
|
-
$chunk.writeHTML(
|
1361
|
-
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1362
|
-
);
|
1366
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[" /* BranchStart */, ""));
|
1363
1367
|
let catchContent = normalizeDynamicRenderer(input.catch), placeholderContent = normalizeDynamicRenderer(input.placeholder);
|
1364
1368
|
catchContent ? tryCatch(
|
1365
1369
|
placeholderContent ? () => tryPlaceholder(content, placeholderContent) : content,
|
@@ -1373,7 +1377,7 @@ function _try(scopeId, accessor, content, input) {
|
|
1373
1377
|
}), $chunk.writeHTML(
|
1374
1378
|
$chunk.boundary.state.mark(
|
1375
1379
|
"]" /* BranchEnd */,
|
1376
|
-
scopeId + " " + accessor
|
1380
|
+
scopeId + " " + accessor + " " + branchId
|
1377
1381
|
)
|
1378
1382
|
);
|
1379
1383
|
}
|
@@ -1999,10 +2003,10 @@ function NOOP2() {
|
|
1999
2003
|
|
2000
2004
|
// src/html/dynamic-tag.ts
|
2001
2005
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
2002
|
-
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), result;
|
2006
|
+
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered = !1, result;
|
2003
2007
|
if (typeof renderer == "string") {
|
2004
2008
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
2005
|
-
if (_scope_id(), _html(
|
2009
|
+
if (rendered = !0, _scope_id(), _html(
|
2006
2010
|
`<${renderer}${_attrs(input, 0, branchId, renderer)}>`
|
2007
2011
|
), !voidElementsReg.test(renderer)) {
|
2008
2012
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
@@ -2040,12 +2044,12 @@ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|p
|
|
2040
2044
|
}
|
2041
2045
|
shouldResume && _html(
|
2042
2046
|
state.mark(
|
2043
|
-
"'" /*
|
2047
|
+
"'" /* BranchEndNativeTag */,
|
2044
2048
|
scopeId + " " + accessor + " " + branchId
|
2045
2049
|
)
|
2046
2050
|
);
|
2047
2051
|
} else {
|
2048
|
-
shouldResume && _html(state.mark("[" /* BranchStart */,
|
2052
|
+
shouldResume && _html(state.mark("[" /* BranchStart */, ""));
|
2049
2053
|
let render2 = () => {
|
2050
2054
|
if (renderer) {
|
2051
2055
|
if (isTemplate(renderer)) {
|
@@ -2061,9 +2065,14 @@ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|p
|
|
2061
2065
|
} else if (content)
|
2062
2066
|
return content();
|
2063
2067
|
};
|
2064
|
-
result = shouldResume ? withBranchId(branchId, render2) : render2(),
|
2068
|
+
result = shouldResume ? withBranchId(branchId, render2) : render2(), rendered = _peek_scope_id() !== branchId, shouldResume && _html(
|
2069
|
+
state.mark(
|
2070
|
+
"]" /* BranchEnd */,
|
2071
|
+
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
2072
|
+
)
|
2073
|
+
);
|
2065
2074
|
}
|
2066
|
-
return
|
2075
|
+
return rendered ? shouldResume && writeScope(scopeId, {
|
2067
2076
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {}),
|
2068
2077
|
["c" /* ConditionalRenderer */ + accessor]: renderer?.h || renderer
|
2069
2078
|
}) : _scope_id(), result;
|
package/dist/html.mjs
CHANGED
@@ -1108,14 +1108,14 @@ function withBranchId(branchId, cb) {
|
|
1108
1108
|
return withContext(branchIdKey, branchId, cb);
|
1109
1109
|
}
|
1110
1110
|
function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1111
|
-
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0,
|
1111
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, flushBranchIds = "";
|
1112
1112
|
if (resumeBranch) {
|
1113
1113
|
let loopScopes = /* @__PURE__ */ new Map();
|
1114
1114
|
forOf(list, (item, index) => {
|
1115
1115
|
let branchId = _peek_scope_id();
|
1116
|
-
resumeMarker && (singleNode ?
|
1117
|
-
state.mark("[" /* BranchStart */,
|
1118
|
-
)), withBranchId(branchId, () => {
|
1116
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1117
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1118
|
+
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1119
1119
|
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1120
1120
|
});
|
1121
1121
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1126,23 +1126,22 @@ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMark
|
|
1126
1126
|
writeBranchEnd(
|
1127
1127
|
scopeId,
|
1128
1128
|
accessor,
|
1129
|
+
resumeBranch,
|
1129
1130
|
resumeMarker,
|
1130
1131
|
parentEndTag,
|
1131
|
-
|
1132
|
-
|
1133
|
-
scopeId + " " + accessor + singleNodeBranchIds
|
1134
|
-
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1132
|
+
singleNode,
|
1133
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1135
1134
|
);
|
1136
1135
|
}
|
1137
1136
|
function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1138
|
-
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0,
|
1137
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, flushBranchIds = "";
|
1139
1138
|
if (resumeBranch) {
|
1140
|
-
let loopScopes = /* @__PURE__ */ new Map()
|
1139
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1141
1140
|
forIn(obj, (key, value) => {
|
1142
1141
|
let branchId = _peek_scope_id();
|
1143
|
-
resumeMarker && (singleNode ?
|
1144
|
-
state.mark("[" /* BranchStart */,
|
1145
|
-
),
|
1142
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1143
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1144
|
+
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1146
1145
|
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1147
1146
|
});
|
1148
1147
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1153,23 +1152,22 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
|
|
1153
1152
|
writeBranchEnd(
|
1154
1153
|
scopeId,
|
1155
1154
|
accessor,
|
1155
|
+
resumeBranch,
|
1156
1156
|
resumeMarker,
|
1157
1157
|
parentEndTag,
|
1158
|
-
|
1159
|
-
|
1160
|
-
scopeId + " " + accessor + singleNodeBranchIds
|
1161
|
-
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1158
|
+
singleNode,
|
1159
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1162
1160
|
);
|
1163
1161
|
}
|
1164
1162
|
function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1165
|
-
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0,
|
1163
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, flushBranchIds = "";
|
1166
1164
|
if (resumeBranch) {
|
1167
|
-
let loopScopes = /* @__PURE__ */ new Map()
|
1165
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1168
1166
|
forTo(to, from, step, (i) => {
|
1169
1167
|
let branchId = _peek_scope_id();
|
1170
|
-
resumeMarker && (singleNode ?
|
1171
|
-
state.mark("[" /* BranchStart */,
|
1172
|
-
),
|
1168
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
|
1169
|
+
state.mark("[" /* BranchStart */, flushBranchIds)
|
1170
|
+
), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
1173
1171
|
cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1174
1172
|
});
|
1175
1173
|
}), loopScopes.size && writeScope(scopeId, {
|
@@ -1180,17 +1178,16 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
|
|
1180
1178
|
writeBranchEnd(
|
1181
1179
|
scopeId,
|
1182
1180
|
accessor,
|
1181
|
+
resumeBranch,
|
1183
1182
|
resumeMarker,
|
1184
1183
|
parentEndTag,
|
1185
|
-
|
1186
|
-
|
1187
|
-
scopeId + " " + accessor + singleNodeBranchIds
|
1188
|
-
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1184
|
+
singleNode,
|
1185
|
+
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
1189
1186
|
);
|
1190
1187
|
}
|
1191
1188
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
|
1192
1189
|
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = _peek_scope_id();
|
1193
|
-
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */,
|
1190
|
+
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */, ""));
|
1194
1191
|
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
1195
1192
|
shouldWriteBranch && writeScope(scopeId, {
|
1196
1193
|
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
@@ -1198,17 +1195,29 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndT
|
|
1198
1195
|
}), writeBranchEnd(
|
1199
1196
|
scopeId,
|
1200
1197
|
accessor,
|
1198
|
+
resumeBranch,
|
1201
1199
|
resumeMarker,
|
1202
1200
|
parentEndTag,
|
1203
|
-
|
1204
|
-
|
1205
|
-
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
1206
|
-
) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
|
1201
|
+
singleNode,
|
1202
|
+
shouldWriteBranch ? " " + branchId : ""
|
1207
1203
|
);
|
1208
1204
|
}
|
1209
|
-
function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag,
|
1205
|
+
function writeBranchEnd(scopeId, accessor, resumeBranch, resumeMarker, parentEndTag, singleNode, branchIds) {
|
1210
1206
|
let endTag = parentEndTag || "";
|
1211
|
-
|
1207
|
+
if (resumeMarker)
|
1208
|
+
if (!parentEndTag || resumeBranch) {
|
1209
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(
|
1210
|
+
parentEndTag ? "}" /* BranchEndSingleNodeOnlyChildInParent */ : "|" /* BranchEndSingleNode */,
|
1211
|
+
scopeId + " " + accessor + (branchIds || "")
|
1212
|
+
) : state.mark(
|
1213
|
+
parentEndTag ? ")" /* BranchEndOnlyChildInParent */ : "]" /* BranchEnd */,
|
1214
|
+
scopeId + " " + accessor + (branchIds || "")
|
1215
|
+
);
|
1216
|
+
$chunk.writeHTML(mark + endTag);
|
1217
|
+
} else
|
1218
|
+
$chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
1219
|
+
else
|
1220
|
+
$chunk.writeHTML(endTag);
|
1212
1221
|
}
|
1213
1222
|
var writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope);
|
1214
1223
|
function writeScopeToState(state, scopeId, partialScope) {
|
@@ -1231,13 +1240,13 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1231
1240
|
if (resumeMarker) {
|
1232
1241
|
let branchId = _peek_scope_id();
|
1233
1242
|
$chunk.writeHTML(
|
1234
|
-
$chunk.boundary.state.mark("[" /* BranchStart */,
|
1243
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, "")
|
1235
1244
|
), content(promise), writeScope(scopeId, {
|
1236
1245
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1237
1246
|
}), $chunk.writeHTML(
|
1238
1247
|
$chunk.boundary.state.mark(
|
1239
1248
|
"]" /* BranchEnd */,
|
1240
|
-
scopeId + " " + accessor
|
1249
|
+
scopeId + " " + accessor + " " + branchId
|
1241
1250
|
)
|
1242
1251
|
);
|
1243
1252
|
} else
|
@@ -1251,10 +1260,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1251
1260
|
if (resumeMarker) {
|
1252
1261
|
let branchId = _peek_scope_id();
|
1253
1262
|
$chunk.writeHTML(
|
1254
|
-
$chunk.boundary.state.mark(
|
1255
|
-
"[" /* BranchStart */,
|
1256
|
-
branchId + ""
|
1257
|
-
)
|
1263
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, "")
|
1258
1264
|
), content(value), boundary.state.serializer.writeAssign(
|
1259
1265
|
writeScope(branchId, {}),
|
1260
1266
|
_scope_with_id(scopeId),
|
@@ -1262,7 +1268,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1262
1268
|
), $chunk.writeHTML(
|
1263
1269
|
$chunk.boundary.state.mark(
|
1264
1270
|
"]" /* BranchEnd */,
|
1265
|
-
scopeId + " " + accessor
|
1271
|
+
scopeId + " " + accessor + " " + branchId
|
1266
1272
|
)
|
1267
1273
|
);
|
1268
1274
|
} else
|
@@ -1276,9 +1282,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1276
1282
|
}
|
1277
1283
|
function _try(scopeId, accessor, content, input) {
|
1278
1284
|
let branchId = _peek_scope_id();
|
1279
|
-
$chunk.writeHTML(
|
1280
|
-
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1281
|
-
);
|
1285
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[" /* BranchStart */, ""));
|
1282
1286
|
let catchContent = normalizeDynamicRenderer(input.catch), placeholderContent = normalizeDynamicRenderer(input.placeholder);
|
1283
1287
|
catchContent ? tryCatch(
|
1284
1288
|
placeholderContent ? () => tryPlaceholder(content, placeholderContent) : content,
|
@@ -1292,7 +1296,7 @@ function _try(scopeId, accessor, content, input) {
|
|
1292
1296
|
}), $chunk.writeHTML(
|
1293
1297
|
$chunk.boundary.state.mark(
|
1294
1298
|
"]" /* BranchEnd */,
|
1295
|
-
scopeId + " " + accessor
|
1299
|
+
scopeId + " " + accessor + " " + branchId
|
1296
1300
|
)
|
1297
1301
|
);
|
1298
1302
|
}
|
@@ -1918,10 +1922,10 @@ function NOOP2() {
|
|
1918
1922
|
|
1919
1923
|
// src/html/dynamic-tag.ts
|
1920
1924
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
1921
|
-
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), result;
|
1925
|
+
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered = !1, result;
|
1922
1926
|
if (typeof renderer == "string") {
|
1923
1927
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
1924
|
-
if (_scope_id(), _html(
|
1928
|
+
if (rendered = !0, _scope_id(), _html(
|
1925
1929
|
`<${renderer}${_attrs(input, 0, branchId, renderer)}>`
|
1926
1930
|
), !voidElementsReg.test(renderer)) {
|
1927
1931
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
@@ -1959,12 +1963,12 @@ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|p
|
|
1959
1963
|
}
|
1960
1964
|
shouldResume && _html(
|
1961
1965
|
state.mark(
|
1962
|
-
"'" /*
|
1966
|
+
"'" /* BranchEndNativeTag */,
|
1963
1967
|
scopeId + " " + accessor + " " + branchId
|
1964
1968
|
)
|
1965
1969
|
);
|
1966
1970
|
} else {
|
1967
|
-
shouldResume && _html(state.mark("[" /* BranchStart */,
|
1971
|
+
shouldResume && _html(state.mark("[" /* BranchStart */, ""));
|
1968
1972
|
let render2 = () => {
|
1969
1973
|
if (renderer) {
|
1970
1974
|
if (isTemplate(renderer)) {
|
@@ -1980,9 +1984,14 @@ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|p
|
|
1980
1984
|
} else if (content)
|
1981
1985
|
return content();
|
1982
1986
|
};
|
1983
|
-
result = shouldResume ? withBranchId(branchId, render2) : render2(),
|
1987
|
+
result = shouldResume ? withBranchId(branchId, render2) : render2(), rendered = _peek_scope_id() !== branchId, shouldResume && _html(
|
1988
|
+
state.mark(
|
1989
|
+
"]" /* BranchEnd */,
|
1990
|
+
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
1991
|
+
)
|
1992
|
+
);
|
1984
1993
|
}
|
1985
|
-
return
|
1994
|
+
return rendered ? shouldResume && writeScope(scopeId, {
|
1986
1995
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {}),
|
1987
1996
|
["c" /* ConditionalRenderer */ + accessor]: renderer?.h || renderer
|
1988
1997
|
}) : _scope_id(), result;
|