marko 6.0.50 → 6.0.51
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 +1 -0
- package/dist/debug/dom.js +131 -127
- package/dist/debug/dom.mjs +131 -127
- package/dist/debug/html.js +42 -39
- package/dist/debug/html.mjs +42 -39
- package/dist/dom/walker.d.ts +1 -0
- package/dist/dom.js +105 -102
- package/dist/dom.mjs +105 -102
- package/dist/html.js +36 -27
- package/dist/html.mjs +36 -27
- package/dist/translator/index.js +9 -5
- package/package.json +1 -1
package/dist/dom.mjs
CHANGED
@@ -108,6 +108,89 @@ function stripSpacesAndPunctuation(str) {
|
|
108
108
|
return str.replace(/[^\p{L}\p{N}]/gu, "");
|
109
109
|
}
|
110
110
|
|
111
|
+
// src/dom/scope.ts
|
112
|
+
function createScope($global, closestBranch) {
|
113
|
+
let scope = {
|
114
|
+
l: $global.p++,
|
115
|
+
q: 1,
|
116
|
+
k: closestBranch,
|
117
|
+
$global
|
118
|
+
};
|
119
|
+
return pendingScopes.push(scope), scope;
|
120
|
+
}
|
121
|
+
function skipScope(scope) {
|
122
|
+
return scope.$global.p++;
|
123
|
+
}
|
124
|
+
function findBranchWithKey(scope, key) {
|
125
|
+
let branch = scope.k;
|
126
|
+
for (; branch && !branch[key]; )
|
127
|
+
branch = branch.y;
|
128
|
+
return branch;
|
129
|
+
}
|
130
|
+
function destroyBranch(branch) {
|
131
|
+
branch.y?.A?.delete(branch), destroyNestedBranches(branch);
|
132
|
+
}
|
133
|
+
function destroyNestedBranches(branch) {
|
134
|
+
branch.B = 1, branch.A?.forEach(destroyNestedBranches), branch.J?.forEach((scope) => {
|
135
|
+
for (let id in scope.z)
|
136
|
+
scope.z[id]?.abort();
|
137
|
+
});
|
138
|
+
}
|
139
|
+
function removeAndDestroyBranch(branch) {
|
140
|
+
destroyBranch(branch), removeChildNodes(branch.h, branch.j);
|
141
|
+
}
|
142
|
+
function insertBranchBefore(branch, parentNode, nextSibling) {
|
143
|
+
insertChildNodes(
|
144
|
+
parentNode,
|
145
|
+
nextSibling,
|
146
|
+
branch.h,
|
147
|
+
branch.j
|
148
|
+
);
|
149
|
+
}
|
150
|
+
function tempDetachBranch(branch) {
|
151
|
+
let fragment = new DocumentFragment();
|
152
|
+
fragment.namespaceURI = branch.h.parentNode.namespaceURI, insertChildNodes(fragment, null, branch.h, branch.j);
|
153
|
+
}
|
154
|
+
|
155
|
+
// src/dom/walker.ts
|
156
|
+
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
157
|
+
function walk(startNode, walkCodes, branch) {
|
158
|
+
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
159
|
+
}
|
160
|
+
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
161
|
+
let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
162
|
+
for (; currentWalkIndex < walkCodes.length; )
|
163
|
+
if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */) {
|
164
|
+
let node = walker.currentNode;
|
165
|
+
scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
|
166
|
+
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */)
|
167
|
+
walker.currentNode.replaceWith(
|
168
|
+
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
169
|
+
), value2 === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
170
|
+
else {
|
171
|
+
if (value2 === 38 /* EndChild */)
|
172
|
+
return currentWalkIndex;
|
173
|
+
if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */)
|
174
|
+
currentWalkIndex = walkInternal(
|
175
|
+
currentWalkIndex,
|
176
|
+
walkCodes,
|
177
|
+
scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
|
178
|
+
), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
179
|
+
else if (value2 < 92)
|
180
|
+
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
181
|
+
walker.nextNode();
|
182
|
+
else if (value2 < 107)
|
183
|
+
for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
|
184
|
+
walker.nextSibling();
|
185
|
+
else if (value2 < 117) {
|
186
|
+
for (value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */; value2--; )
|
187
|
+
walker.parentNode();
|
188
|
+
walker.nextSibling();
|
189
|
+
} else
|
190
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
111
194
|
// src/dom/resume.ts
|
112
195
|
var registeredValues = {}, branchesEnabled;
|
113
196
|
function enableBranches() {
|
@@ -126,7 +209,7 @@ function init(runtimeId = "M") {
|
|
126
209
|
return branch.j = lastEndNode = endNode === lastEndNode ? reference.parentNode.insertBefore(new Text(), reference) : endNode, branch.h ||= lastEndNode, branchIds.add(branchId), branch;
|
127
210
|
};
|
128
211
|
return {
|
129
|
-
|
212
|
+
K() {
|
130
213
|
if (visitToken === "[" /* BranchStart */)
|
131
214
|
currentBranchId && visitDataIndex && (endBranch(currentBranchId, visit), currentBranchId = branchStack.pop()), currentBranchId && (branchStack.push(currentBranchId), parentBranchIds.set(scopeId, currentBranchId)), currentBranchId = scopeId, visitScope.h = visit;
|
132
215
|
else if (visitToken === "]" /* BranchEnd */) {
|
@@ -144,11 +227,14 @@ function init(runtimeId = "M") {
|
|
144
227
|
start,
|
145
228
|
~next ? next : visitData.length
|
146
229
|
);
|
147
|
-
curNode = endBranch(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId)
|
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
|
+
}
|
148
234
|
}
|
149
235
|
}
|
150
236
|
},
|
151
|
-
|
237
|
+
t(scope) {
|
152
238
|
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
153
239
|
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
154
240
|
let branch = scope, parentBranch = branch.k;
|
@@ -166,7 +252,7 @@ function init(runtimeId = "M") {
|
|
166
252
|
visitDataIndex ? visitDataIndex - 1 : visitText.length
|
167
253
|
), visitData = visitDataIndex ? visitText.slice(visitDataIndex) : "", visitToken = visitText[commentPrefixLen], visitScope = scopeLookup[scopeId] ||= {
|
168
254
|
l: scopeId
|
169
|
-
}, visitToken === "*" /* Node */ ? visitScope["j" /* Getter */ + visitData] = /* @__PURE__ */ ((node) => () => node)(visitScope[visitData] = visit.previousSibling) : branches && branches.
|
255
|
+
}, visitToken === "*" /* Node */ ? visitScope["j" /* Getter */ + visitData] = /* @__PURE__ */ ((node) => () => node)(visitScope[visitData] = visit.previousSibling) : branches && branches.K();
|
170
256
|
for (let serialized of resumes = render.r || [])
|
171
257
|
if (typeof serialized == "string")
|
172
258
|
lastEffect = serialized;
|
@@ -182,7 +268,7 @@ function init(runtimeId = "M") {
|
|
182
268
|
$global ? typeof scope == "number" ? lastScopeId += scope : (scopeId = ++lastScopeId, scope.$global = $global, scope.l = scopeId, scopeLookup[scopeId] !== scope && (scopeLookup[scopeId] = Object.assign(
|
183
269
|
scope,
|
184
270
|
scopeLookup[scopeId]
|
185
|
-
)), branches && branches.
|
271
|
+
)), branches && branches.t(scope)) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId, $global.p = 1e6);
|
186
272
|
} finally {
|
187
273
|
isResuming = visits.length = resumes.length = 0;
|
188
274
|
}
|
@@ -407,50 +493,6 @@ function parseHTML(html2, ns) {
|
|
407
493
|
return parser.innerHTML = html2, parser.content || parser;
|
408
494
|
}
|
409
495
|
|
410
|
-
// src/dom/scope.ts
|
411
|
-
function createScope($global, closestBranch) {
|
412
|
-
let scope = {
|
413
|
-
l: $global.q++,
|
414
|
-
t: 1,
|
415
|
-
k: closestBranch,
|
416
|
-
$global
|
417
|
-
};
|
418
|
-
return pendingScopes.push(scope), scope;
|
419
|
-
}
|
420
|
-
function skipScope(scope) {
|
421
|
-
return scope.$global.q++;
|
422
|
-
}
|
423
|
-
function findBranchWithKey(scope, key) {
|
424
|
-
let branch = scope.k;
|
425
|
-
for (; branch && !branch[key]; )
|
426
|
-
branch = branch.y;
|
427
|
-
return branch;
|
428
|
-
}
|
429
|
-
function destroyBranch(branch) {
|
430
|
-
branch.y?.A?.delete(branch), destroyNestedBranches(branch);
|
431
|
-
}
|
432
|
-
function destroyNestedBranches(branch) {
|
433
|
-
branch.B = 1, branch.A?.forEach(destroyNestedBranches), branch.K?.forEach((scope) => {
|
434
|
-
for (let id in scope.z)
|
435
|
-
scope.z[id]?.abort();
|
436
|
-
});
|
437
|
-
}
|
438
|
-
function removeAndDestroyBranch(branch) {
|
439
|
-
destroyBranch(branch), removeChildNodes(branch.h, branch.j);
|
440
|
-
}
|
441
|
-
function insertBranchBefore(branch, parentNode, nextSibling) {
|
442
|
-
insertChildNodes(
|
443
|
-
parentNode,
|
444
|
-
nextSibling,
|
445
|
-
branch.h,
|
446
|
-
branch.j
|
447
|
-
);
|
448
|
-
}
|
449
|
-
function tempDetachBranch(branch) {
|
450
|
-
let fragment = new DocumentFragment();
|
451
|
-
fragment.namespaceURI = branch.h.parentNode.namespaceURI, insertChildNodes(fragment, null, branch.h, branch.j);
|
452
|
-
}
|
453
|
-
|
454
496
|
// src/dom/schedule.ts
|
455
497
|
var isScheduled, channel;
|
456
498
|
function schedule() {
|
@@ -487,7 +529,7 @@ function value(valueAccessor, fn = () => {
|
|
487
529
|
}
|
488
530
|
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
489
531
|
return (scope) => {
|
490
|
-
scope.
|
532
|
+
scope.q ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
491
533
|
};
|
492
534
|
}
|
493
535
|
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
@@ -497,7 +539,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
497
539
|
ownerScope,
|
498
540
|
() => {
|
499
541
|
for (let scope of scopes)
|
500
|
-
!scope.
|
542
|
+
!scope.q && !scope.B && childSignal(scope);
|
501
543
|
},
|
502
544
|
-1,
|
503
545
|
0,
|
@@ -509,7 +551,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
509
551
|
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
510
552
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
511
553
|
let ifScope = scope[scopeAccessor];
|
512
|
-
ifScope && !ifScope.
|
554
|
+
ifScope && !ifScope.q && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
513
555
|
};
|
514
556
|
return ownerSignal._ = childSignal, ownerSignal;
|
515
557
|
}
|
@@ -527,7 +569,7 @@ function dynamicClosure(...closureSignals) {
|
|
527
569
|
return (scope) => {
|
528
570
|
if (scope[___scopeInstancesAccessor])
|
529
571
|
for (let childScope of scope[___scopeInstancesAccessor])
|
530
|
-
childScope.
|
572
|
+
childScope.q || queueRender(
|
531
573
|
childScope,
|
532
574
|
closureSignals[childScope[___signalIndexAccessor]],
|
533
575
|
-1
|
@@ -583,45 +625,6 @@ function hoist(...path) {
|
|
583
625
|
};
|
584
626
|
}
|
585
627
|
|
586
|
-
// src/dom/walker.ts
|
587
|
-
var walker = /* @__PURE__ */ document.createTreeWalker(document);
|
588
|
-
function walk(startNode, walkCodes, branch) {
|
589
|
-
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
590
|
-
}
|
591
|
-
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
592
|
-
let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
593
|
-
for (; currentWalkIndex < walkCodes.length; )
|
594
|
-
if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */) {
|
595
|
-
let node = walker.currentNode;
|
596
|
-
scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
|
597
|
-
} else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */)
|
598
|
-
walker.currentNode.replaceWith(
|
599
|
-
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
600
|
-
), value2 === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
601
|
-
else {
|
602
|
-
if (value2 === 38 /* EndChild */)
|
603
|
-
return currentWalkIndex;
|
604
|
-
if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */)
|
605
|
-
currentWalkIndex = walkInternal(
|
606
|
-
currentWalkIndex,
|
607
|
-
walkCodes,
|
608
|
-
scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
|
609
|
-
), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
610
|
-
else if (value2 < 92)
|
611
|
-
for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
|
612
|
-
walker.nextNode();
|
613
|
-
else if (value2 < 107)
|
614
|
-
for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
|
615
|
-
walker.nextSibling();
|
616
|
-
else if (value2 < 117) {
|
617
|
-
for (value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */; value2--; )
|
618
|
-
walker.parentNode();
|
619
|
-
walker.nextSibling();
|
620
|
-
} else
|
621
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
|
622
|
-
}
|
623
|
-
}
|
624
|
-
|
625
628
|
// src/dom/renderer.ts
|
626
629
|
function createBranch($global, renderer, parentScope, parentNode) {
|
627
630
|
let branch = createScope($global), parentBranch = parentScope?.k;
|
@@ -1137,7 +1140,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1137
1140
|
if (normalizedRenderer) {
|
1138
1141
|
let childScope = scope[childScopeAccessor], args = getInput?.();
|
1139
1142
|
if (typeof normalizedRenderer == "string")
|
1140
|
-
attrs(
|
1143
|
+
(getContent ? attrs : attrsAndContent)(
|
1141
1144
|
childScope,
|
1142
1145
|
0,
|
1143
1146
|
(inputIsArgs ? args[0] : args) || {}
|
@@ -1237,7 +1240,7 @@ function queueRender(scope, signal, signalKey, value2, scopeKey = scope.l) {
|
|
1237
1240
|
else {
|
1238
1241
|
let render = {
|
1239
1242
|
x: key,
|
1240
|
-
|
1243
|
+
t: scope,
|
1241
1244
|
N: signal,
|
1242
1245
|
I: value2
|
1243
1246
|
}, i = pendingRenders.push(render) - 1;
|
@@ -1291,13 +1294,13 @@ function runRenders() {
|
|
1291
1294
|
}
|
1292
1295
|
pendingRenders[i] = item;
|
1293
1296
|
}
|
1294
|
-
render.
|
1297
|
+
render.t.k?.B || runRender(render);
|
1295
1298
|
}
|
1296
1299
|
for (let scope of pendingScopes)
|
1297
|
-
scope.
|
1300
|
+
scope.q = 0;
|
1298
1301
|
pendingScopes = [];
|
1299
1302
|
}
|
1300
|
-
var runRender = (render) => render.N(render.
|
1303
|
+
var runRender = (render) => render.N(render.t, render.I), enableCatch = () => {
|
1301
1304
|
enableCatch = () => {
|
1302
1305
|
}, enableBranches();
|
1303
1306
|
let handlePendingTry = (fn, scope, branch) => {
|
@@ -1318,7 +1321,7 @@ var runRender = (render) => render.N(render.p, render.I), enableCatch = () => {
|
|
1318
1321
|
try {
|
1319
1322
|
runRender2(render);
|
1320
1323
|
} catch (error) {
|
1321
|
-
renderCatch(render.
|
1324
|
+
renderCatch(render.t, error);
|
1322
1325
|
}
|
1323
1326
|
})(runRender);
|
1324
1327
|
};
|
@@ -1329,7 +1332,7 @@ function resetAbortSignal(scope, id) {
|
|
1329
1332
|
ctrl && (queueEffect(ctrl, abort), scope.z[id] = void 0);
|
1330
1333
|
}
|
1331
1334
|
function getAbortSignal(scope, id) {
|
1332
|
-
return scope.k && (scope.k.
|
1335
|
+
return scope.k && (scope.k.J ||= /* @__PURE__ */ new Set()).add(scope), ((scope.z ||= {})[id] ||= new AbortController()).signal;
|
1333
1336
|
}
|
1334
1337
|
function abort(ctrl) {
|
1335
1338
|
ctrl.abort();
|
@@ -1388,7 +1391,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1388
1391
|
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
1389
1392
|
}
|
1390
1393
|
if (component.effects = prepareEffects(() => {
|
1391
|
-
branch ? existing = 1 : (out.global.
|
1394
|
+
branch ? existing = 1 : (out.global.p ||= 0, branch = component.scope = createAndSetupBranch(
|
1392
1395
|
out.global,
|
1393
1396
|
renderer,
|
1394
1397
|
renderer.u,
|
@@ -1413,12 +1416,12 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
1413
1416
|
function mount(input = {}, reference, position) {
|
1414
1417
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
1415
1418
|
switch ($global ? ({ $global, ...input } = input, $global = {
|
1416
|
-
|
1419
|
+
p: 0,
|
1417
1420
|
runtimeId: "M",
|
1418
1421
|
renderId: "_",
|
1419
1422
|
...$global
|
1420
1423
|
}) : $global = {
|
1421
|
-
|
1424
|
+
p: 0,
|
1422
1425
|
runtimeId: "M",
|
1423
1426
|
renderId: "_"
|
1424
1427
|
}, position) {
|
package/dist/html.js
CHANGED
@@ -1998,37 +1998,46 @@ function NOOP2() {
|
|
1998
1998
|
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, serializeReason) => {
|
1999
1999
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = peekNextScopeId(), result;
|
2000
2000
|
if (typeof renderer == "string") {
|
2001
|
-
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {}
|
2002
|
-
if (nextScopeId(), write(
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
)
|
2012
|
-
);
|
2013
|
-
else if (renderContent) {
|
2014
|
-
if (typeof renderContent != "function")
|
2015
|
-
throw new Error(
|
2016
|
-
`Body content is not supported for the \`<${renderer}>\` tag.`
|
2017
|
-
);
|
2018
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
|
2019
|
-
scopeId,
|
2020
|
-
accessor,
|
2001
|
+
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
2002
|
+
if (nextScopeId(), write(
|
2003
|
+
`<${renderer}${attrs(input, 0, branchId, renderer)}>`
|
2004
|
+
), !voidElementsReg.test(renderer)) {
|
2005
|
+
let renderContent = content || normalizeDynamicRenderer(input.content);
|
2006
|
+
if (renderer === "textarea")
|
2007
|
+
write(
|
2008
|
+
controllable_textarea_value(
|
2009
|
+
branchId,
|
2010
|
+
0,
|
2021
2011
|
input.value,
|
2022
|
-
input.valueChange
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2012
|
+
input.valueChange
|
2013
|
+
)
|
2014
|
+
);
|
2015
|
+
else if (renderContent) {
|
2016
|
+
if (typeof renderContent != "function")
|
2017
|
+
throw new Error(
|
2018
|
+
`Body content is not supported for the \`<${renderer}>\` tag.`
|
2019
|
+
);
|
2020
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
|
2021
|
+
branchId,
|
2022
|
+
0,
|
2023
|
+
input.value,
|
2024
|
+
input.valueChange,
|
2025
|
+
renderContent
|
2026
|
+
) : dynamicTag(
|
2027
|
+
branchId,
|
2028
|
+
0,
|
2029
|
+
renderContent,
|
2030
|
+
[],
|
2031
|
+
0,
|
2032
|
+
1,
|
2033
|
+
serializeReason
|
2034
|
+
);
|
2035
|
+
}
|
2036
|
+
write(`</${renderer}>`);
|
2028
2037
|
}
|
2029
2038
|
shouldResume && write(
|
2030
2039
|
state.mark(
|
2031
|
-
"
|
2040
|
+
"'" /* BranchNativeTag */,
|
2032
2041
|
scopeId + " " + accessor + " " + branchId
|
2033
2042
|
)
|
2034
2043
|
);
|
package/dist/html.mjs
CHANGED
@@ -1917,37 +1917,46 @@ function NOOP2() {
|
|
1917
1917
|
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, serializeReason) => {
|
1918
1918
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = peekNextScopeId(), result;
|
1919
1919
|
if (typeof renderer == "string") {
|
1920
|
-
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {}
|
1921
|
-
if (nextScopeId(), write(
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
)
|
1931
|
-
);
|
1932
|
-
else if (renderContent) {
|
1933
|
-
if (typeof renderContent != "function")
|
1934
|
-
throw new Error(
|
1935
|
-
`Body content is not supported for the \`<${renderer}>\` tag.`
|
1936
|
-
);
|
1937
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
|
1938
|
-
scopeId,
|
1939
|
-
accessor,
|
1920
|
+
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
1921
|
+
if (nextScopeId(), write(
|
1922
|
+
`<${renderer}${attrs(input, 0, branchId, renderer)}>`
|
1923
|
+
), !voidElementsReg.test(renderer)) {
|
1924
|
+
let renderContent = content || normalizeDynamicRenderer(input.content);
|
1925
|
+
if (renderer === "textarea")
|
1926
|
+
write(
|
1927
|
+
controllable_textarea_value(
|
1928
|
+
branchId,
|
1929
|
+
0,
|
1940
1930
|
input.value,
|
1941
|
-
input.valueChange
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1931
|
+
input.valueChange
|
1932
|
+
)
|
1933
|
+
);
|
1934
|
+
else if (renderContent) {
|
1935
|
+
if (typeof renderContent != "function")
|
1936
|
+
throw new Error(
|
1937
|
+
`Body content is not supported for the \`<${renderer}>\` tag.`
|
1938
|
+
);
|
1939
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
|
1940
|
+
branchId,
|
1941
|
+
0,
|
1942
|
+
input.value,
|
1943
|
+
input.valueChange,
|
1944
|
+
renderContent
|
1945
|
+
) : dynamicTag(
|
1946
|
+
branchId,
|
1947
|
+
0,
|
1948
|
+
renderContent,
|
1949
|
+
[],
|
1950
|
+
0,
|
1951
|
+
1,
|
1952
|
+
serializeReason
|
1953
|
+
);
|
1954
|
+
}
|
1955
|
+
write(`</${renderer}>`);
|
1947
1956
|
}
|
1948
1957
|
shouldResume && write(
|
1949
1958
|
state.mark(
|
1950
|
-
"
|
1959
|
+
"'" /* BranchNativeTag */,
|
1951
1960
|
scopeId + " " + accessor + " " + branchId
|
1952
1961
|
)
|
1953
1962
|
);
|
package/dist/translator/index.js
CHANGED
@@ -3211,11 +3211,11 @@ function getSignalFn(signal) {
|
|
3211
3211
|
const aliasId = import_compiler20.types.identifier(alias.name);
|
3212
3212
|
forEach(alias.excludeProperties, (name2) => {
|
3213
3213
|
const propId = toPropertyName(name2);
|
3214
|
-
const shorthand = propId.type === "Identifier";
|
3214
|
+
const shorthand = propId.type === "Identifier" && import_compiler20.types.isValidIdentifier(name2);
|
3215
3215
|
props.push(
|
3216
3216
|
import_compiler20.types.objectProperty(
|
3217
3217
|
propId,
|
3218
|
-
|
3218
|
+
shorthand ? propId : generateUidIdentifier(name2),
|
3219
3219
|
false,
|
3220
3220
|
shorthand
|
3221
3221
|
)
|
@@ -7375,13 +7375,13 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
|
|
7375
7375
|
}
|
7376
7376
|
}
|
7377
7377
|
if (!seen.has(contentKey) && usesExport(templateExports, contentKey)) {
|
7378
|
-
seen.add(contentKey);
|
7379
7378
|
const contentExpression = buildContent(tag.get("body"));
|
7380
7379
|
if (contentExpression) {
|
7381
7380
|
const contentProp = import_compiler34.types.objectProperty(
|
7382
7381
|
import_compiler34.types.identifier(contentKey),
|
7383
7382
|
contentExpression
|
7384
7383
|
);
|
7384
|
+
seen.add(contentKey);
|
7385
7385
|
contentProps.add(contentProp);
|
7386
7386
|
properties.push(contentProp);
|
7387
7387
|
}
|
@@ -10415,7 +10415,9 @@ var custom_tag_default = {
|
|
10415
10415
|
`Local variables must be in a dynamic tag unless they are PascalCase. Use \`<\${${tagName}}/>\` or rename to \`${tagName.charAt(0).toUpperCase() + tagName.slice(1)}\`.`
|
10416
10416
|
);
|
10417
10417
|
}
|
10418
|
-
throw tag.get("name").buildCodeFrameError(
|
10418
|
+
throw tag.get("name").buildCodeFrameError(
|
10419
|
+
`Unable to find entry point for custom tag \`<${tagName}>\`.`
|
10420
|
+
);
|
10419
10421
|
}
|
10420
10422
|
const section = getOrCreateSection(tag);
|
10421
10423
|
const tagBody = tag.get("body");
|
@@ -10757,7 +10759,9 @@ function getTagRelativePath(tag) {
|
|
10757
10759
|
`Local variables must be in a dynamic tag unless they are PascalCase. Use \`<\${${tagName}}/>\` or rename to \`${tagName.charAt(0).toUpperCase() + tagName.slice(1)}\`.`
|
10758
10760
|
);
|
10759
10761
|
}
|
10760
|
-
throw tag.get("name").buildCodeFrameError(
|
10762
|
+
throw tag.get("name").buildCodeFrameError(
|
10763
|
+
`Unable to find entry point for custom tag \`<${tagName}>\`.`
|
10764
|
+
);
|
10761
10765
|
}
|
10762
10766
|
return relativePath;
|
10763
10767
|
}
|