marko 6.0.3 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/helpers.d.ts +2 -2
- package/dist/debug/dom.js +138 -136
- package/dist/debug/dom.mjs +138 -136
- package/dist/debug/html.js +250 -237
- package/dist/debug/html.mjs +250 -237
- package/dist/dom/dom.d.ts +5 -0
- package/dist/dom/queue.d.ts +1 -0
- package/dist/dom/scope.d.ts +0 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +85 -90
- package/dist/dom.mjs +85 -90
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/writer.d.ts +8 -8
- package/dist/html.js +141 -145
- package/dist/html.mjs +141 -145
- package/dist/translator/index.js +677 -420
- package/dist/translator/util/css-px-props.d.ts +2 -0
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/visitors/program/html.d.ts +1 -1
- package/dist/translator/visitors/tag/native-tag.d.ts +2 -2
- package/package.json +2 -2
package/dist/html.js
CHANGED
@@ -39,11 +39,11 @@ __export(html_exports, {
|
|
39
39
|
escapeStyle: () => escapeStyle,
|
40
40
|
escapeXML: () => escapeXML,
|
41
41
|
forIn: () => forIn,
|
42
|
-
forInBy: () =>
|
42
|
+
forInBy: () => forInBy,
|
43
43
|
forOf: () => forOf,
|
44
|
-
forOfBy: () =>
|
44
|
+
forOfBy: () => forOfBy,
|
45
45
|
forTo: () => forTo,
|
46
|
-
forToBy: () =>
|
46
|
+
forToBy: () => forToBy,
|
47
47
|
fork: () => fork,
|
48
48
|
getScopeById: () => getScopeById,
|
49
49
|
hoist: () => hoist,
|
@@ -93,39 +93,30 @@ function* attrTagIterator() {
|
|
93
93
|
}
|
94
94
|
|
95
95
|
// src/common/helpers.ts
|
96
|
-
function classValue(
|
97
|
-
return toDelimitedString(
|
96
|
+
function classValue(classValue2) {
|
97
|
+
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
98
98
|
}
|
99
99
|
function stringifyClassObject(name, value) {
|
100
100
|
return value ? name : "";
|
101
101
|
}
|
102
|
-
function styleValue(
|
103
|
-
return toDelimitedString(
|
102
|
+
function styleValue(styleValue2) {
|
103
|
+
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
104
104
|
}
|
105
105
|
function stringifyStyleObject(name, value) {
|
106
|
-
return value || value === 0 ? `${name}:${typeof value == "number" &&
|
106
|
+
return value || value === 0 ? `${name}:${value && typeof value == "number" && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value + "px" : value}` : "";
|
107
107
|
}
|
108
108
|
function toDelimitedString(val, delimiter, stringify) {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
else
|
121
|
-
for (let name in val) {
|
122
|
-
let v = val[name], part = stringify(name, v);
|
123
|
-
part !== "" && (result += curDelimiter + part, curDelimiter = delimiter);
|
124
|
-
}
|
125
|
-
return result;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
return "";
|
109
|
+
let str = "", sep = "", part;
|
110
|
+
if (val)
|
111
|
+
if (typeof val != "object")
|
112
|
+
str += val;
|
113
|
+
else if (Array.isArray(val))
|
114
|
+
for (let v of val)
|
115
|
+
part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
116
|
+
else
|
117
|
+
for (let name in val)
|
118
|
+
part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
119
|
+
return str;
|
129
120
|
}
|
130
121
|
function isEventHandler(name) {
|
131
122
|
return /^on[A-Z-]/.test(name);
|
@@ -178,6 +169,17 @@ function forTo(to, from, step, cb) {
|
|
178
169
|
cb(start + i * delta);
|
179
170
|
}
|
180
171
|
|
172
|
+
// src/html/for.ts
|
173
|
+
function forOfBy(by, item, index) {
|
174
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
175
|
+
}
|
176
|
+
function forInBy(by, name, value) {
|
177
|
+
return by ? by(name, value) : name;
|
178
|
+
}
|
179
|
+
function forToBy(by, index) {
|
180
|
+
return by ? by(index) : index;
|
181
|
+
}
|
182
|
+
|
181
183
|
// src/html/inlined-runtimes.ts
|
182
184
|
var WALKER_RUNTIME_CODE = '(e=>(self[e]=(l,t=e+l,d=t.length,f={},s=[],x=document,a=x.createTreeWalker(x,129))=>self[e][l]={i:t,d:x,l:f,v:s,x(){},w(e,l,x){for(;e=a.nextNode();)this.x(l=(l=e.data)&&!l.indexOf(t)&&(f[x=l.slice(d+1)]=e,l[d]),x,e),l>"#"&&s.push(e)}},self[e]))', 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)))}})';
|
183
185
|
|
@@ -1170,161 +1172,166 @@ var branchIdKey = Symbol();
|
|
1170
1172
|
function withBranchId(branchId, cb) {
|
1171
1173
|
return withContext(branchIdKey, branchId, cb);
|
1172
1174
|
}
|
1173
|
-
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch) {
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1175
|
+
function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1176
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1177
|
+
if (resumeBranch) {
|
1178
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1179
|
+
forOf(list, (item, index) => {
|
1180
|
+
let branchId = peekNextScopeId();
|
1181
|
+
resumeMarker && $chunk.writeHTML(
|
1182
|
+
$chunk.boundary.state.mark(
|
1183
|
+
"[" /* BranchStart */,
|
1184
|
+
branchId + (index ? " " : "")
|
1185
|
+
)
|
1186
|
+
), withBranchId(branchId, () => {
|
1187
|
+
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1188
|
+
});
|
1189
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1190
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1186
1191
|
});
|
1187
|
-
}
|
1188
|
-
|
1189
|
-
|
1192
|
+
} else
|
1193
|
+
forOf(list, cb);
|
1194
|
+
resumeMarker && $chunk.writeHTML(
|
1190
1195
|
$chunk.boundary.state.mark(
|
1191
1196
|
"]" /* BranchEnd */,
|
1192
1197
|
scopeId + " " + accessor
|
1193
1198
|
)
|
1194
1199
|
);
|
1195
1200
|
}
|
1196
|
-
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, onlyChildInParent) {
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1201
|
+
function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1202
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1203
|
+
if (resumeBranch) {
|
1204
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1205
|
+
forOf(list, (item, index) => {
|
1206
|
+
let branchId = peekNextScopeId();
|
1207
|
+
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1208
|
+
cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
|
1209
|
+
});
|
1210
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1211
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1204
1212
|
});
|
1205
|
-
}
|
1206
|
-
|
1207
|
-
|
1213
|
+
} else
|
1214
|
+
forOf(list, cb);
|
1215
|
+
resumeMarker && $chunk.writeHTML(
|
1208
1216
|
$chunk.boundary.state.mark(
|
1209
1217
|
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1210
1218
|
scopeId + " " + accessor + branchIds
|
1211
1219
|
)
|
1212
1220
|
);
|
1213
1221
|
}
|
1214
|
-
function
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
),
|
1226
|
-
|
1222
|
+
function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1223
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1224
|
+
if (resumeBranch) {
|
1225
|
+
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
1226
|
+
forIn(obj, (key, value) => {
|
1227
|
+
let branchId = peekNextScopeId();
|
1228
|
+
resumeMarker && ($chunk.writeHTML(
|
1229
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1230
|
+
), sep = " "), withBranchId(branchId, () => {
|
1231
|
+
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1232
|
+
});
|
1233
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1234
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1227
1235
|
});
|
1228
|
-
}
|
1229
|
-
|
1230
|
-
|
1236
|
+
} else
|
1237
|
+
forIn(obj, cb);
|
1238
|
+
resumeMarker && $chunk.writeHTML(
|
1231
1239
|
$chunk.boundary.state.mark(
|
1232
1240
|
"]" /* BranchEnd */,
|
1233
1241
|
scopeId + " " + accessor
|
1234
1242
|
)
|
1235
1243
|
);
|
1236
1244
|
}
|
1237
|
-
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch,
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
+
function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1246
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1247
|
+
if (resumeBranch) {
|
1248
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1249
|
+
forIn(obj, (key, value) => {
|
1250
|
+
let branchId = peekNextScopeId();
|
1251
|
+
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1252
|
+
cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
|
1253
|
+
});
|
1254
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1255
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1245
1256
|
});
|
1246
|
-
}
|
1247
|
-
|
1248
|
-
|
1257
|
+
} else
|
1258
|
+
forIn(obj, cb);
|
1259
|
+
resumeMarker && $chunk.writeHTML(
|
1249
1260
|
$chunk.boundary.state.mark(
|
1250
|
-
|
1261
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1251
1262
|
scopeId + " " + accessor + branchIds
|
1252
1263
|
)
|
1253
1264
|
);
|
1254
1265
|
}
|
1255
|
-
function
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
),
|
1267
|
-
|
1266
|
+
function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker) {
|
1267
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0;
|
1268
|
+
if (resumeBranch) {
|
1269
|
+
let loopScopes = /* @__PURE__ */ new Map(), sep = "";
|
1270
|
+
forTo(to, from, step, (i) => {
|
1271
|
+
let branchId = peekNextScopeId();
|
1272
|
+
resumeMarker && ($chunk.writeHTML(
|
1273
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1274
|
+
), sep = " "), withBranchId(branchId, () => {
|
1275
|
+
cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1276
|
+
});
|
1277
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1278
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1268
1279
|
});
|
1269
|
-
}
|
1270
|
-
|
1271
|
-
|
1280
|
+
} else
|
1281
|
+
forTo(to, from, step, cb);
|
1282
|
+
resumeMarker && $chunk.writeHTML(
|
1272
1283
|
$chunk.boundary.state.mark(
|
1273
1284
|
"]" /* BranchEnd */,
|
1274
1285
|
scopeId + " " + accessor
|
1275
1286
|
)
|
1276
1287
|
);
|
1277
1288
|
}
|
1278
|
-
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1289
|
+
function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1290
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchIds = "";
|
1291
|
+
if (resumeBranch) {
|
1292
|
+
let loopScopes = /* @__PURE__ */ new Map();
|
1293
|
+
forTo(to, from, step, (i) => {
|
1294
|
+
let branchId = peekNextScopeId();
|
1295
|
+
resumeMarker && (branchIds = " " + branchId + branchIds), withBranchId(branchId, () => {
|
1296
|
+
cb(i), loopScopes.set(forToBy(by, i), writeScope(branchId, {}));
|
1297
|
+
});
|
1298
|
+
}), loopScopes.size && writeScope(scopeId, {
|
1299
|
+
["m" /* LoopScopeMap */ + accessor]: loopScopes
|
1286
1300
|
});
|
1287
|
-
}
|
1288
|
-
|
1289
|
-
|
1301
|
+
} else
|
1302
|
+
forTo(to, from, step, cb);
|
1303
|
+
resumeMarker && $chunk.writeHTML(
|
1290
1304
|
$chunk.boundary.state.mark(
|
1291
|
-
|
1305
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1292
1306
|
scopeId + " " + accessor + branchIds
|
1293
1307
|
)
|
1294
1308
|
);
|
1295
1309
|
}
|
1296
|
-
function forToBy(by, index) {
|
1297
|
-
return by ? by(index) : index;
|
1298
|
-
}
|
1299
1310
|
function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
|
1300
|
-
|
1301
|
-
|
1302
|
-
let branchId = peekNextScopeId();
|
1303
|
-
serializeMarker && $chunk.writeHTML(
|
1311
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId();
|
1312
|
+
resumeMarker && resumeBranch && $chunk.writeHTML(
|
1304
1313
|
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1305
1314
|
);
|
1306
|
-
let branchIndex = withBranchId(branchId, cb);
|
1307
|
-
branchIndex !== void 0
|
1308
|
-
["c" /* ConditionalRenderer */ + accessor]:
|
1315
|
+
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
|
1316
|
+
resumeBranch && branchIndex !== void 0 && writeScope(scopeId, {
|
1317
|
+
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1309
1318
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1310
|
-
})
|
1319
|
+
}), resumeMarker && $chunk.writeHTML(
|
1311
1320
|
$chunk.boundary.state.mark(
|
1312
1321
|
"]" /* BranchEnd */,
|
1313
1322
|
scopeId + " " + accessor
|
1314
1323
|
)
|
1315
1324
|
);
|
1316
1325
|
}
|
1317
|
-
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker,
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
rendered ? writeScope(scopeId, {
|
1322
|
-
["c" /* ConditionalRenderer */ + accessor]: serializeMarker ? branchIndex : void 0,
|
1326
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChildInParent) {
|
1327
|
+
let resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0, branchId = peekNextScopeId(), branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
1328
|
+
shouldWriteBranch && writeScope(scopeId, {
|
1329
|
+
["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
|
1323
1330
|
["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
|
1324
|
-
})
|
1331
|
+
}), resumeMarker && $chunk.writeHTML(
|
1325
1332
|
$chunk.boundary.state.mark(
|
1326
|
-
|
1327
|
-
scopeId + " " + accessor + (
|
1333
|
+
onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
|
1334
|
+
scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
|
1328
1335
|
)
|
1329
1336
|
);
|
1330
1337
|
}
|
@@ -2025,8 +2032,8 @@ function NOOP2() {
|
|
2025
2032
|
}
|
2026
2033
|
|
2027
2034
|
// src/html/dynamic-tag.ts
|
2028
|
-
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,
|
2029
|
-
let renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = peekNextScopeId(), result;
|
2035
|
+
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) => {
|
2036
|
+
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = peekNextScopeId(), result;
|
2030
2037
|
if (typeof renderer == "string") {
|
2031
2038
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
2032
2039
|
if (nextScopeId(), write(`<${renderer}${attrs(input, accessor, scopeId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
@@ -2062,7 +2069,7 @@ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|p
|
|
2062
2069
|
let input = inputIsArgs ? inputOrArgs[0] : inputOrArgs;
|
2063
2070
|
return renderer(
|
2064
2071
|
content ? { ...input, content } : input,
|
2065
|
-
shouldResume
|
2072
|
+
shouldResume ? 1 : 0
|
2066
2073
|
);
|
2067
2074
|
}
|
2068
2075
|
return inputIsArgs ? renderer(...inputOrArgs) : renderer(
|
@@ -2171,17 +2178,6 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2171
2178
|
register(RENDER_BODY_ID, fn);
|
2172
2179
|
}
|
2173
2180
|
};
|
2174
|
-
|
2175
|
-
// src/html/for.ts
|
2176
|
-
function forOfBy2(by, item, index) {
|
2177
|
-
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
2178
|
-
}
|
2179
|
-
function forInBy2(by, name, value) {
|
2180
|
-
return by ? by(name, value) : name;
|
2181
|
-
}
|
2182
|
-
function forToBy2(by, index) {
|
2183
|
-
return by ? by(index) : index;
|
2184
|
-
}
|
2185
2181
|
// Annotate the CommonJS export names for ESM import in node:
|
2186
2182
|
0 && (module.exports = {
|
2187
2183
|
$global,
|