regor 1.6.6 → 1.6.8
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/README.md +5 -2
- package/dist/regor.d.ts +18 -1
- package/dist/regor.es2015.cjs.js +135 -33
- package/dist/regor.es2015.cjs.prod.js +3 -3
- package/dist/regor.es2015.esm.js +135 -33
- package/dist/regor.es2015.esm.prod.js +3 -3
- package/dist/regor.es2015.iife.js +135 -33
- package/dist/regor.es2015.iife.prod.js +3 -3
- package/dist/regor.es2019.cjs.js +135 -33
- package/dist/regor.es2019.cjs.prod.js +3 -3
- package/dist/regor.es2019.esm.js +135 -33
- package/dist/regor.es2019.esm.prod.js +3 -3
- package/dist/regor.es2019.iife.js +135 -33
- package/dist/regor.es2019.iife.prod.js +3 -3
- package/dist/regor.es2022.cjs.js +134 -32
- package/dist/regor.es2022.cjs.prod.js +3 -3
- package/dist/regor.es2022.esm.js +134 -32
- package/dist/regor.es2022.esm.prod.js +3 -3
- package/dist/regor.es2022.iife.js +134 -32
- package/dist/regor.es2022.iife.prod.js +3 -3
- package/package.json +2 -2
package/dist/regor.es2015.esm.js
CHANGED
|
@@ -4178,7 +4178,7 @@ var isDeepRef = (value) => {
|
|
|
4178
4178
|
};
|
|
4179
4179
|
|
|
4180
4180
|
// src/reactivity/ref.ts
|
|
4181
|
-
|
|
4181
|
+
function ref(value) {
|
|
4182
4182
|
if (isRaw(value)) return value;
|
|
4183
4183
|
let result;
|
|
4184
4184
|
if (isRef(value)) {
|
|
@@ -4209,7 +4209,7 @@ var ref = (value) => {
|
|
|
4209
4209
|
value[key] = ref(val);
|
|
4210
4210
|
}
|
|
4211
4211
|
return result;
|
|
4212
|
-
}
|
|
4212
|
+
}
|
|
4213
4213
|
|
|
4214
4214
|
// src/app/RegorConfig.ts
|
|
4215
4215
|
var _RegorConfig = class _RegorConfig {
|
|
@@ -6211,19 +6211,50 @@ var parseTagNameRange = (tagText, isClosing) => {
|
|
|
6211
6211
|
while (i < tagText.length && (tagText[i] === " " || tagText[i] === "\n")) ++i;
|
|
6212
6212
|
if (i >= tagText.length || !isNameChar(tagText[i])) return null;
|
|
6213
6213
|
const start = i;
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6214
|
+
let hasUppercase = false;
|
|
6215
|
+
while (i < tagText.length && isNameChar(tagText[i])) {
|
|
6216
|
+
const c = tagText.charCodeAt(i);
|
|
6217
|
+
if (c >= 65 && c <= 90) {
|
|
6218
|
+
hasUppercase = true;
|
|
6219
|
+
}
|
|
6220
|
+
++i;
|
|
6221
|
+
}
|
|
6222
|
+
return { start, end: i, hasUppercase };
|
|
6223
|
+
};
|
|
6224
|
+
var isTableScopeTag = (tagName) => {
|
|
6225
|
+
switch (tagName) {
|
|
6226
|
+
case "table":
|
|
6227
|
+
case "thead":
|
|
6228
|
+
case "tbody":
|
|
6229
|
+
case "tfoot":
|
|
6230
|
+
return true;
|
|
6231
|
+
default:
|
|
6232
|
+
return false;
|
|
6233
|
+
}
|
|
6234
|
+
};
|
|
6235
|
+
var isRowParentTag = (tagName) => {
|
|
6236
|
+
switch (tagName) {
|
|
6237
|
+
case "thead":
|
|
6238
|
+
case "tbody":
|
|
6239
|
+
case "tfoot":
|
|
6240
|
+
return true;
|
|
6241
|
+
default:
|
|
6242
|
+
return false;
|
|
6243
|
+
}
|
|
6244
|
+
};
|
|
6245
|
+
var isTableDirectAllowed = (tagName) => {
|
|
6246
|
+
switch (tagName) {
|
|
6247
|
+
case "caption":
|
|
6248
|
+
case "colgroup":
|
|
6249
|
+
case "thead":
|
|
6250
|
+
case "tbody":
|
|
6251
|
+
case "tfoot":
|
|
6252
|
+
case "tr":
|
|
6253
|
+
return true;
|
|
6254
|
+
default:
|
|
6255
|
+
return false;
|
|
6256
|
+
}
|
|
6257
|
+
};
|
|
6227
6258
|
var voidElements = /* @__PURE__ */ new Set([
|
|
6228
6259
|
"area",
|
|
6229
6260
|
"base",
|
|
@@ -6240,12 +6271,62 @@ var voidElements = /* @__PURE__ */ new Set([
|
|
|
6240
6271
|
"track",
|
|
6241
6272
|
"wbr"
|
|
6242
6273
|
]);
|
|
6274
|
+
var getTableAliasHost = (tagName) => {
|
|
6275
|
+
switch (tagName) {
|
|
6276
|
+
case "caption":
|
|
6277
|
+
return "captionx";
|
|
6278
|
+
case "thead":
|
|
6279
|
+
return "theadx";
|
|
6280
|
+
case "tbody":
|
|
6281
|
+
return "tbodyx";
|
|
6282
|
+
case "tfoot":
|
|
6283
|
+
return "tfootx";
|
|
6284
|
+
case "tr":
|
|
6285
|
+
return "trx";
|
|
6286
|
+
case "td":
|
|
6287
|
+
return "tdx";
|
|
6288
|
+
case "th":
|
|
6289
|
+
return "thx";
|
|
6290
|
+
case "colgroup":
|
|
6291
|
+
return "colgroupx";
|
|
6292
|
+
case "col":
|
|
6293
|
+
return "colx";
|
|
6294
|
+
default:
|
|
6295
|
+
return null;
|
|
6296
|
+
}
|
|
6297
|
+
};
|
|
6298
|
+
var getTableAliasTag = (host) => {
|
|
6299
|
+
switch (host) {
|
|
6300
|
+
case "captionx":
|
|
6301
|
+
return "caption";
|
|
6302
|
+
case "theadx":
|
|
6303
|
+
return "thead";
|
|
6304
|
+
case "tbodyx":
|
|
6305
|
+
return "tbody";
|
|
6306
|
+
case "tfootx":
|
|
6307
|
+
return "tfoot";
|
|
6308
|
+
case "trx":
|
|
6309
|
+
return "tr";
|
|
6310
|
+
case "tdx":
|
|
6311
|
+
return "td";
|
|
6312
|
+
case "thx":
|
|
6313
|
+
return "th";
|
|
6314
|
+
case "colgroupx":
|
|
6315
|
+
return "colgroup";
|
|
6316
|
+
case "colx":
|
|
6317
|
+
return "col";
|
|
6318
|
+
default:
|
|
6319
|
+
return void 0;
|
|
6320
|
+
}
|
|
6321
|
+
};
|
|
6322
|
+
var closeTag = (tagText, tagName) => `${tagText}</${tagName}>`;
|
|
6243
6323
|
var expandSelfClosingTag = (tagText, tagName) => `${tagText.slice(0, tagText.length - 2)}></${tagName}>`;
|
|
6244
6324
|
var preprocess = (template) => {
|
|
6245
|
-
var _a;
|
|
6325
|
+
var _a, _b;
|
|
6246
6326
|
let i = 0;
|
|
6247
6327
|
const out = [];
|
|
6248
6328
|
const stack = [];
|
|
6329
|
+
const ignoredClosingTags = [];
|
|
6249
6330
|
let tableScopeDepth = 0;
|
|
6250
6331
|
while (i < template.length) {
|
|
6251
6332
|
const lt = template.indexOf("<", i);
|
|
@@ -6284,12 +6365,21 @@ var preprocess = (template) => {
|
|
|
6284
6365
|
continue;
|
|
6285
6366
|
}
|
|
6286
6367
|
const tagName = rawTag.slice(range.start, range.end);
|
|
6368
|
+
const nativeTagName = range.hasUppercase ? "" : tagName;
|
|
6287
6369
|
if (isClosing) {
|
|
6370
|
+
const ignoredClosing = ignoredClosingTags[ignoredClosingTags.length - 1];
|
|
6371
|
+
if ((ignoredClosing == null ? void 0 : ignoredClosing.tagName) === tagName) {
|
|
6372
|
+
ignoredClosingTags.pop();
|
|
6373
|
+
if (ignoredClosing.emit) out.push(rawTag);
|
|
6374
|
+
i = tagEnd + 1;
|
|
6375
|
+
continue;
|
|
6376
|
+
}
|
|
6288
6377
|
const top = stack[stack.length - 1];
|
|
6289
6378
|
if (top) {
|
|
6290
6379
|
stack.pop();
|
|
6291
6380
|
out.push(top.replacementHost ? `</${top.replacementHost}>` : rawTag);
|
|
6292
|
-
if (
|
|
6381
|
+
if (!top.isTableAlias && isTableScopeTag(top.effectiveTag))
|
|
6382
|
+
--tableScopeDepth;
|
|
6293
6383
|
} else {
|
|
6294
6384
|
out.push(rawTag);
|
|
6295
6385
|
}
|
|
@@ -6300,35 +6390,47 @@ var preprocess = (template) => {
|
|
|
6300
6390
|
const parent = stack[stack.length - 1];
|
|
6301
6391
|
let replacementHost = null;
|
|
6302
6392
|
if (tableScopeDepth === 0) {
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
} else if (rowParentTags.has((_a = parent == null ? void 0 : parent.effectiveTag) != null ? _a : "")) {
|
|
6307
|
-
replacementHost = tagName === "tr" ? null : "tr";
|
|
6393
|
+
replacementHost = getTableAliasHost(nativeTagName);
|
|
6394
|
+
} else if (isRowParentTag((_a = parent == null ? void 0 : parent.effectiveTag) != null ? _a : "")) {
|
|
6395
|
+
replacementHost = nativeTagName === "tr" ? null : "tr";
|
|
6308
6396
|
} else if ((parent == null ? void 0 : parent.effectiveTag) === "table") {
|
|
6309
|
-
replacementHost =
|
|
6397
|
+
replacementHost = isTableDirectAllowed(nativeTagName) ? null : "tr";
|
|
6310
6398
|
} else if ((parent == null ? void 0 : parent.effectiveTag) === "tr") {
|
|
6311
|
-
replacementHost =
|
|
6312
|
-
}
|
|
6313
|
-
|
|
6399
|
+
replacementHost = nativeTagName === "td" || nativeTagName === "th" ? null : "td";
|
|
6400
|
+
} else if ((parent == null ? void 0 : parent.effectiveTag) === "colgroup") {
|
|
6401
|
+
replacementHost = nativeTagName === "col" ? null : "col";
|
|
6402
|
+
}
|
|
6403
|
+
const aliasTag = getTableAliasTag(replacementHost);
|
|
6404
|
+
const isTableAlias = aliasTag !== void 0;
|
|
6405
|
+
const shouldExpandSelfClosing = selfClosing && !voidElements.has(replacementHost || nativeTagName);
|
|
6406
|
+
const shouldCloseVoidAlias = !!replacementHost && aliasTag === nativeTagName && voidElements.has(nativeTagName);
|
|
6407
|
+
const shouldIgnoreClosingTag = !selfClosing && !!replacementHost && voidElements.has(replacementHost) && !shouldCloseVoidAlias;
|
|
6408
|
+
const shouldIgnoreNativeVoidClosingTag = !selfClosing && !replacementHost && voidElements.has(nativeTagName);
|
|
6314
6409
|
if (replacementHost) {
|
|
6315
|
-
const
|
|
6316
|
-
const rewrittenTag = `${rawTag.slice(0, range.start)}${replacementHost} is="${isAlias ? `r-${tagName}` : `regor:${tagName}`}"${rawTag.slice(range.end)}`;
|
|
6410
|
+
const rewrittenTag = `${rawTag.slice(0, range.start)}${replacementHost} is="${aliasTag ? `r-${aliasTag}` : `regor:${tagName}`}"${rawTag.slice(range.end)}`;
|
|
6317
6411
|
out.push(
|
|
6318
|
-
shouldExpandSelfClosing ? expandSelfClosingTag(rewrittenTag, replacementHost) : rewrittenTag
|
|
6412
|
+
shouldExpandSelfClosing ? expandSelfClosingTag(rewrittenTag, replacementHost) : shouldCloseVoidAlias ? closeTag(rewrittenTag, replacementHost) : rewrittenTag
|
|
6319
6413
|
);
|
|
6320
6414
|
} else {
|
|
6321
6415
|
out.push(
|
|
6322
6416
|
shouldExpandSelfClosing ? expandSelfClosingTag(rawTag, tagName) : rawTag
|
|
6323
6417
|
);
|
|
6324
6418
|
}
|
|
6325
|
-
if (
|
|
6326
|
-
|
|
6419
|
+
if (shouldIgnoreClosingTag) {
|
|
6420
|
+
ignoredClosingTags.push({ tagName, emit: false });
|
|
6421
|
+
} else if (shouldCloseVoidAlias && !selfClosing) {
|
|
6422
|
+
ignoredClosingTags.push({ tagName, emit: false });
|
|
6423
|
+
} else if (shouldIgnoreNativeVoidClosingTag) {
|
|
6424
|
+
ignoredClosingTags.push({ tagName, emit: true });
|
|
6425
|
+
}
|
|
6426
|
+
if (!selfClosing && !shouldCloseVoidAlias && !shouldIgnoreClosingTag && !shouldIgnoreNativeVoidClosingTag && !voidElements.has(replacementHost != null ? replacementHost : nativeTagName)) {
|
|
6427
|
+
const effectiveTag = (_b = aliasTag != null ? aliasTag : replacementHost) != null ? _b : nativeTagName || tagName;
|
|
6327
6428
|
stack.push({
|
|
6328
6429
|
replacementHost,
|
|
6329
|
-
effectiveTag
|
|
6430
|
+
effectiveTag,
|
|
6431
|
+
isTableAlias
|
|
6330
6432
|
});
|
|
6331
|
-
if (
|
|
6433
|
+
if (!isTableAlias && isTableScopeTag(effectiveTag)) ++tableScopeDepth;
|
|
6332
6434
|
}
|
|
6333
6435
|
i = tagEnd + 1;
|
|
6334
6436
|
}
|