marko 6.0.7 → 6.0.9
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 +60 -52
- package/dist/debug/dom.mjs +60 -52
- package/dist/debug/html.js +1 -1
- package/dist/debug/html.mjs +1 -1
- package/dist/dom/dom.d.ts +0 -1
- package/dist/dom/resume.d.ts +2 -0
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +39 -37
- package/dist/dom.mjs +39 -37
- package/dist/html.js +1 -1
- package/dist/html.mjs +1 -1
- package/dist/translator/index.js +725 -637
- package/dist/translator/util/optional.d.ts +1 -0
- package/dist/translator/util/references.d.ts +16 -5
- package/dist/translator/util/serialize-reasons.d.ts +10 -12
- package/dist/translator/util/with-comment.d.ts +2 -0
- package/dist/translator/visitors/program/html.d.ts +4 -3
- package/dist/translator/visitors/program/index.d.ts +9 -5
- package/package.json +1 -1
- package/dist/translator/util/css-px-props.d.ts +0 -2
package/dist/dom.mjs
CHANGED
@@ -39,7 +39,7 @@ function styleValue(styleValue2) {
|
|
39
39
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
40
40
|
}
|
41
41
|
function stringifyStyleObject(name, value2) {
|
42
|
-
return value2 || value2 === 0 ?
|
42
|
+
return value2 || value2 === 0 ? name + ":" + value2 : "";
|
43
43
|
}
|
44
44
|
function toDelimitedString(val, delimiter, stringify) {
|
45
45
|
let str = "", sep = "", part;
|
@@ -112,7 +112,10 @@ function stripSpacesAndPunctuation(str) {
|
|
112
112
|
var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
|
113
113
|
|
114
114
|
// src/dom/resume.ts
|
115
|
-
var registeredValues = {};
|
115
|
+
var registeredValues = {}, branchesEnabled;
|
116
|
+
function enableBranches() {
|
117
|
+
branchesEnabled = 1;
|
118
|
+
}
|
116
119
|
function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
117
120
|
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
|
118
121
|
defineRuntime({
|
@@ -137,25 +140,27 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
137
140
|
if (token === "*" /* Node */) {
|
138
141
|
let node = scope[data2] = visit.previousSibling;
|
139
142
|
scope["j" /* Getter */ + data2] = () => node;
|
140
|
-
} else if (
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
143
|
+
} else if (branchesEnabled) {
|
144
|
+
if (token === "[" /* BranchStart */)
|
145
|
+
currentBranchId && dataIndex && (branchEnd(currentBranchId, visit), currentBranchId = branchStack.pop()), currentBranchId && (branchStack.push(currentBranchId), parentBranchIds.set(scopeId, currentBranchId)), currentBranchId = scopeId, scope.h = visit;
|
146
|
+
else if (token === "]" /* BranchEnd */) {
|
147
|
+
scope[data2] = visit;
|
148
|
+
let curParent = visit.parentNode, startNode = branchEnd(
|
149
|
+
currentBranchId,
|
150
|
+
visit
|
151
|
+
).h;
|
152
|
+
curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
|
153
|
+
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
154
|
+
let next = data2.indexOf(" "), curNode = visit;
|
155
|
+
for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
|
156
|
+
let start = next + 1;
|
157
|
+
next = data2.indexOf(" ", start);
|
158
|
+
let childScopeId = +data2.slice(
|
159
|
+
start,
|
160
|
+
~next ? next : data2.length
|
161
|
+
);
|
162
|
+
curNode = branchEnd(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId);
|
163
|
+
}
|
159
164
|
}
|
160
165
|
}
|
161
166
|
}
|
@@ -175,16 +180,17 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
175
180
|
lastScopeId += scope;
|
176
181
|
else {
|
177
182
|
let scopeId = ++lastScopeId, prevScope = scopeLookup[scopeId];
|
178
|
-
scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
183
|
+
if (scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
|
179
184
|
scope,
|
180
185
|
prevScope
|
181
|
-
))
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
186
|
+
)), branchesEnabled) {
|
187
|
+
let parentBranchId = scope.g || parentBranchIds.get(scopeId);
|
188
|
+
if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
|
189
|
+
let branch = scope, parentBranch = branch.k;
|
190
|
+
scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
|
191
|
+
branch
|
192
|
+
));
|
193
|
+
}
|
188
194
|
}
|
189
195
|
}
|
190
196
|
} finally {
|
@@ -438,9 +444,6 @@ function styleItems(element, items) {
|
|
438
444
|
function styleItem(element, name, value2) {
|
439
445
|
element.style.setProperty(name, value2 || value2 === 0 ? value2 + "" : "");
|
440
446
|
}
|
441
|
-
function styleItemValue(value2) {
|
442
|
-
return value2 && typeof value2 == "number" ? value2 + "px" : value2;
|
443
|
-
}
|
444
447
|
function data(node, value2) {
|
445
448
|
let normalizedValue = normalizeString(value2);
|
446
449
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
@@ -1087,7 +1090,7 @@ function renderCatch(scope, error) {
|
|
1087
1090
|
}
|
1088
1091
|
function conditional(nodeAccessor, ...branches) {
|
1089
1092
|
let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1090
|
-
return (scope, newBranch) => {
|
1093
|
+
return enableBranches(), (scope, newBranch) => {
|
1091
1094
|
newBranch !== scope[branchAccessor] && setConditionalRenderer(
|
1092
1095
|
scope,
|
1093
1096
|
nodeAccessor,
|
@@ -1101,7 +1104,7 @@ function patchDynamicTag(fn) {
|
|
1101
1104
|
}
|
1102
1105
|
var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1103
1106
|
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1104
|
-
return (scope, newRenderer, getInput) => {
|
1107
|
+
return enableBranches(), (scope, newRenderer, getInput) => {
|
1105
1108
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
1106
1109
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.m || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
|
1107
1110
|
if (setConditionalRenderer(
|
@@ -1184,7 +1187,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
1184
1187
|
}
|
1185
1188
|
function loop(nodeAccessor, renderer, forEach) {
|
1186
1189
|
let params = renderer.l;
|
1187
|
-
return (scope, value2) => {
|
1190
|
+
return enableBranches(), (scope, value2) => {
|
1188
1191
|
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1189
1192
|
...oldMap.values()
|
1190
1193
|
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].h.parentNode : referenceNode, newMap = scope["m" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map(), newArray = scope["l" /* LoopScopeArray */ + nodeAccessor] = [];
|
@@ -1286,7 +1289,7 @@ function runRenders() {
|
|
1286
1289
|
}
|
1287
1290
|
var runRender = (render) => render.L(render.D, render.I), enableCatch = () => {
|
1288
1291
|
enableCatch = () => {
|
1289
|
-
};
|
1292
|
+
}, enableBranches();
|
1290
1293
|
let handlePendingTry = (fn, scope, branch) => {
|
1291
1294
|
for (; branch; ) {
|
1292
1295
|
if (branch.n)
|
@@ -1511,7 +1514,6 @@ export {
|
|
1511
1514
|
state,
|
1512
1515
|
styleAttr,
|
1513
1516
|
styleItem,
|
1514
|
-
styleItemValue,
|
1515
1517
|
styleItems,
|
1516
1518
|
tagVarSignal,
|
1517
1519
|
tagVarSignalChange,
|
package/dist/html.js
CHANGED
@@ -103,7 +103,7 @@ function styleValue(styleValue2) {
|
|
103
103
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
104
104
|
}
|
105
105
|
function stringifyStyleObject(name, value) {
|
106
|
-
return value || value === 0 ?
|
106
|
+
return value || value === 0 ? name + ":" + value : "";
|
107
107
|
}
|
108
108
|
function toDelimitedString(val, delimiter, stringify) {
|
109
109
|
let str = "", sep = "", part;
|
package/dist/html.mjs
CHANGED
@@ -21,7 +21,7 @@ function styleValue(styleValue2) {
|
|
21
21
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
22
22
|
}
|
23
23
|
function stringifyStyleObject(name, value) {
|
24
|
-
return value || value === 0 ?
|
24
|
+
return value || value === 0 ? name + ":" + value : "";
|
25
25
|
}
|
26
26
|
function toDelimitedString(val, delimiter, stringify) {
|
27
27
|
let str = "", sep = "", part;
|