regor 1.6.5 → 1.6.7
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.es2015.cjs.js +152 -34
- package/dist/regor.es2015.cjs.prod.js +3 -3
- package/dist/regor.es2015.esm.js +152 -34
- package/dist/regor.es2015.esm.prod.js +3 -3
- package/dist/regor.es2015.iife.js +152 -34
- package/dist/regor.es2015.iife.prod.js +3 -3
- package/dist/regor.es2019.cjs.js +152 -34
- package/dist/regor.es2019.cjs.prod.js +3 -3
- package/dist/regor.es2019.esm.js +152 -34
- package/dist/regor.es2019.esm.prod.js +3 -3
- package/dist/regor.es2019.iife.js +152 -34
- package/dist/regor.es2019.iife.prod.js +3 -3
- package/dist/regor.es2022.cjs.js +151 -33
- package/dist/regor.es2022.cjs.prod.js +3 -3
- package/dist/regor.es2022.esm.js +151 -33
- package/dist/regor.es2022.esm.prod.js +3 -3
- package/dist/regor.es2022.iife.js +151 -33
- package/dist/regor.es2022.iife.prod.js +3 -3
- package/package.json +1 -1
package/dist/regor.es2022.cjs.js
CHANGED
|
@@ -241,7 +241,7 @@ var rawSymbol = Symbol("raw");
|
|
|
241
241
|
|
|
242
242
|
// src/reactivity/isRef.ts
|
|
243
243
|
var isRef = (value) => {
|
|
244
|
-
return value != null && value[srefSymbol]
|
|
244
|
+
return value != null && value[srefSymbol] > 0;
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
// src/app/propValidators.ts
|
|
@@ -1093,6 +1093,8 @@ var readonlyRefValueDescriptor = {
|
|
|
1093
1093
|
configurable: false
|
|
1094
1094
|
};
|
|
1095
1095
|
var defineRefValue = (result, isReadOnly) => {
|
|
1096
|
+
;
|
|
1097
|
+
result[srefSymbol] = isReadOnly ? 2 : 1;
|
|
1096
1098
|
Object.defineProperty(
|
|
1097
1099
|
result,
|
|
1098
1100
|
"value",
|
|
@@ -1228,9 +1230,24 @@ var observe = (source, observer, init, trackUnmount = true) => {
|
|
|
1228
1230
|
};
|
|
1229
1231
|
|
|
1230
1232
|
// src/reactivity/entangle.ts
|
|
1233
|
+
var isReadonly = (value) => value[srefSymbol] === 2;
|
|
1231
1234
|
var entangle = (r1, r2) => {
|
|
1232
1235
|
if (r1 === r2) return () => {
|
|
1233
1236
|
};
|
|
1237
|
+
const r1Readonly = isReadonly(r1);
|
|
1238
|
+
const r2Readonly = isReadonly(r2);
|
|
1239
|
+
if (r1Readonly && r2Readonly) return () => {
|
|
1240
|
+
};
|
|
1241
|
+
if (r1Readonly) {
|
|
1242
|
+
const stop = observe(r1, () => r2(r1()));
|
|
1243
|
+
r2(r1());
|
|
1244
|
+
return stop;
|
|
1245
|
+
}
|
|
1246
|
+
if (r2Readonly) {
|
|
1247
|
+
const stop = observe(r2, () => r1(r2()));
|
|
1248
|
+
r1(r2());
|
|
1249
|
+
return stop;
|
|
1250
|
+
}
|
|
1234
1251
|
const stop1 = observe(r1, (v) => r2(v));
|
|
1235
1252
|
const stop2 = observe(r2, (v) => r1(v));
|
|
1236
1253
|
r2(r1());
|
|
@@ -1492,7 +1509,6 @@ var sref = (value) => {
|
|
|
1492
1509
|
}
|
|
1493
1510
|
return refObj._value;
|
|
1494
1511
|
};
|
|
1495
|
-
srefFunction[srefSymbol] = 1;
|
|
1496
1512
|
defineRefValue(srefFunction, false);
|
|
1497
1513
|
if (isProxy) attachProxyHandle(value);
|
|
1498
1514
|
return srefFunction;
|
|
@@ -2241,7 +2257,7 @@ var DynamicBinder = class {
|
|
|
2241
2257
|
// src/reactivity/unref.ts
|
|
2242
2258
|
var unref = (value) => {
|
|
2243
2259
|
const anyValue = value;
|
|
2244
|
-
return anyValue != null && anyValue[srefSymbol]
|
|
2260
|
+
return anyValue != null && anyValue[srefSymbol] > 0 ? anyValue() : anyValue;
|
|
2245
2261
|
};
|
|
2246
2262
|
|
|
2247
2263
|
// src/directives/html.ts
|
|
@@ -6172,19 +6188,50 @@ var parseTagNameRange = (tagText, isClosing) => {
|
|
|
6172
6188
|
while (i < tagText.length && (tagText[i] === " " || tagText[i] === "\n")) ++i;
|
|
6173
6189
|
if (i >= tagText.length || !isNameChar(tagText[i])) return null;
|
|
6174
6190
|
const start = i;
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6191
|
+
let hasUppercase = false;
|
|
6192
|
+
while (i < tagText.length && isNameChar(tagText[i])) {
|
|
6193
|
+
const c = tagText.charCodeAt(i);
|
|
6194
|
+
if (c >= 65 && c <= 90) {
|
|
6195
|
+
hasUppercase = true;
|
|
6196
|
+
}
|
|
6197
|
+
++i;
|
|
6198
|
+
}
|
|
6199
|
+
return { start, end: i, hasUppercase };
|
|
6200
|
+
};
|
|
6201
|
+
var isTableScopeTag = (tagName) => {
|
|
6202
|
+
switch (tagName) {
|
|
6203
|
+
case "table":
|
|
6204
|
+
case "thead":
|
|
6205
|
+
case "tbody":
|
|
6206
|
+
case "tfoot":
|
|
6207
|
+
return true;
|
|
6208
|
+
default:
|
|
6209
|
+
return false;
|
|
6210
|
+
}
|
|
6211
|
+
};
|
|
6212
|
+
var isRowParentTag = (tagName) => {
|
|
6213
|
+
switch (tagName) {
|
|
6214
|
+
case "thead":
|
|
6215
|
+
case "tbody":
|
|
6216
|
+
case "tfoot":
|
|
6217
|
+
return true;
|
|
6218
|
+
default:
|
|
6219
|
+
return false;
|
|
6220
|
+
}
|
|
6221
|
+
};
|
|
6222
|
+
var isTableDirectAllowed = (tagName) => {
|
|
6223
|
+
switch (tagName) {
|
|
6224
|
+
case "caption":
|
|
6225
|
+
case "colgroup":
|
|
6226
|
+
case "thead":
|
|
6227
|
+
case "tbody":
|
|
6228
|
+
case "tfoot":
|
|
6229
|
+
case "tr":
|
|
6230
|
+
return true;
|
|
6231
|
+
default:
|
|
6232
|
+
return false;
|
|
6233
|
+
}
|
|
6234
|
+
};
|
|
6188
6235
|
var voidElements = /* @__PURE__ */ new Set([
|
|
6189
6236
|
"area",
|
|
6190
6237
|
"base",
|
|
@@ -6201,11 +6248,61 @@ var voidElements = /* @__PURE__ */ new Set([
|
|
|
6201
6248
|
"track",
|
|
6202
6249
|
"wbr"
|
|
6203
6250
|
]);
|
|
6251
|
+
var getTableAliasHost = (tagName) => {
|
|
6252
|
+
switch (tagName) {
|
|
6253
|
+
case "caption":
|
|
6254
|
+
return "captionx";
|
|
6255
|
+
case "thead":
|
|
6256
|
+
return "theadx";
|
|
6257
|
+
case "tbody":
|
|
6258
|
+
return "tbodyx";
|
|
6259
|
+
case "tfoot":
|
|
6260
|
+
return "tfootx";
|
|
6261
|
+
case "tr":
|
|
6262
|
+
return "trx";
|
|
6263
|
+
case "td":
|
|
6264
|
+
return "tdx";
|
|
6265
|
+
case "th":
|
|
6266
|
+
return "thx";
|
|
6267
|
+
case "colgroup":
|
|
6268
|
+
return "colgroupx";
|
|
6269
|
+
case "col":
|
|
6270
|
+
return "colx";
|
|
6271
|
+
default:
|
|
6272
|
+
return null;
|
|
6273
|
+
}
|
|
6274
|
+
};
|
|
6275
|
+
var getTableAliasTag = (host) => {
|
|
6276
|
+
switch (host) {
|
|
6277
|
+
case "captionx":
|
|
6278
|
+
return "caption";
|
|
6279
|
+
case "theadx":
|
|
6280
|
+
return "thead";
|
|
6281
|
+
case "tbodyx":
|
|
6282
|
+
return "tbody";
|
|
6283
|
+
case "tfootx":
|
|
6284
|
+
return "tfoot";
|
|
6285
|
+
case "trx":
|
|
6286
|
+
return "tr";
|
|
6287
|
+
case "tdx":
|
|
6288
|
+
return "td";
|
|
6289
|
+
case "thx":
|
|
6290
|
+
return "th";
|
|
6291
|
+
case "colgroupx":
|
|
6292
|
+
return "colgroup";
|
|
6293
|
+
case "colx":
|
|
6294
|
+
return "col";
|
|
6295
|
+
default:
|
|
6296
|
+
return void 0;
|
|
6297
|
+
}
|
|
6298
|
+
};
|
|
6299
|
+
var closeTag = (tagText, tagName) => `${tagText}</${tagName}>`;
|
|
6204
6300
|
var expandSelfClosingTag = (tagText, tagName) => `${tagText.slice(0, tagText.length - 2)}></${tagName}>`;
|
|
6205
6301
|
var preprocess = (template) => {
|
|
6206
6302
|
let i = 0;
|
|
6207
6303
|
const out = [];
|
|
6208
6304
|
const stack = [];
|
|
6305
|
+
const ignoredClosingTags = [];
|
|
6209
6306
|
let tableScopeDepth = 0;
|
|
6210
6307
|
while (i < template.length) {
|
|
6211
6308
|
const lt = template.indexOf("<", i);
|
|
@@ -6244,12 +6341,21 @@ var preprocess = (template) => {
|
|
|
6244
6341
|
continue;
|
|
6245
6342
|
}
|
|
6246
6343
|
const tagName = rawTag.slice(range.start, range.end);
|
|
6344
|
+
const nativeTagName = range.hasUppercase ? "" : tagName;
|
|
6247
6345
|
if (isClosing) {
|
|
6346
|
+
const ignoredClosing = ignoredClosingTags[ignoredClosingTags.length - 1];
|
|
6347
|
+
if (ignoredClosing?.tagName === tagName) {
|
|
6348
|
+
ignoredClosingTags.pop();
|
|
6349
|
+
if (ignoredClosing.emit) out.push(rawTag);
|
|
6350
|
+
i = tagEnd + 1;
|
|
6351
|
+
continue;
|
|
6352
|
+
}
|
|
6248
6353
|
const top = stack[stack.length - 1];
|
|
6249
6354
|
if (top) {
|
|
6250
6355
|
stack.pop();
|
|
6251
6356
|
out.push(top.replacementHost ? `</${top.replacementHost}>` : rawTag);
|
|
6252
|
-
if (
|
|
6357
|
+
if (!top.isTableAlias && isTableScopeTag(top.effectiveTag))
|
|
6358
|
+
--tableScopeDepth;
|
|
6253
6359
|
} else {
|
|
6254
6360
|
out.push(rawTag);
|
|
6255
6361
|
}
|
|
@@ -6260,35 +6366,47 @@ var preprocess = (template) => {
|
|
|
6260
6366
|
const parent = stack[stack.length - 1];
|
|
6261
6367
|
let replacementHost = null;
|
|
6262
6368
|
if (tableScopeDepth === 0) {
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
} else if (rowParentTags.has(parent?.effectiveTag ?? "")) {
|
|
6267
|
-
replacementHost = tagName === "tr" ? null : "tr";
|
|
6369
|
+
replacementHost = getTableAliasHost(nativeTagName);
|
|
6370
|
+
} else if (isRowParentTag(parent?.effectiveTag ?? "")) {
|
|
6371
|
+
replacementHost = nativeTagName === "tr" ? null : "tr";
|
|
6268
6372
|
} else if (parent?.effectiveTag === "table") {
|
|
6269
|
-
replacementHost =
|
|
6373
|
+
replacementHost = isTableDirectAllowed(nativeTagName) ? null : "tr";
|
|
6270
6374
|
} else if (parent?.effectiveTag === "tr") {
|
|
6271
|
-
replacementHost =
|
|
6272
|
-
}
|
|
6273
|
-
|
|
6375
|
+
replacementHost = nativeTagName === "td" || nativeTagName === "th" ? null : "td";
|
|
6376
|
+
} else if (parent?.effectiveTag === "colgroup") {
|
|
6377
|
+
replacementHost = nativeTagName === "col" ? null : "col";
|
|
6378
|
+
}
|
|
6379
|
+
const aliasTag = getTableAliasTag(replacementHost);
|
|
6380
|
+
const isTableAlias = aliasTag !== void 0;
|
|
6381
|
+
const shouldExpandSelfClosing = selfClosing && !voidElements.has(replacementHost || nativeTagName);
|
|
6382
|
+
const shouldCloseVoidAlias = !!replacementHost && aliasTag === nativeTagName && voidElements.has(nativeTagName);
|
|
6383
|
+
const shouldIgnoreClosingTag = !selfClosing && !!replacementHost && voidElements.has(replacementHost) && !shouldCloseVoidAlias;
|
|
6384
|
+
const shouldIgnoreNativeVoidClosingTag = !selfClosing && !replacementHost && voidElements.has(nativeTagName);
|
|
6274
6385
|
if (replacementHost) {
|
|
6275
|
-
const
|
|
6276
|
-
const rewrittenTag = `${rawTag.slice(0, range.start)}${replacementHost} is="${isAlias ? `r-${tagName}` : `regor:${tagName}`}"${rawTag.slice(range.end)}`;
|
|
6386
|
+
const rewrittenTag = `${rawTag.slice(0, range.start)}${replacementHost} is="${aliasTag ? `r-${aliasTag}` : `regor:${tagName}`}"${rawTag.slice(range.end)}`;
|
|
6277
6387
|
out.push(
|
|
6278
|
-
shouldExpandSelfClosing ? expandSelfClosingTag(rewrittenTag, replacementHost) : rewrittenTag
|
|
6388
|
+
shouldExpandSelfClosing ? expandSelfClosingTag(rewrittenTag, replacementHost) : shouldCloseVoidAlias ? closeTag(rewrittenTag, replacementHost) : rewrittenTag
|
|
6279
6389
|
);
|
|
6280
6390
|
} else {
|
|
6281
6391
|
out.push(
|
|
6282
6392
|
shouldExpandSelfClosing ? expandSelfClosingTag(rawTag, tagName) : rawTag
|
|
6283
6393
|
);
|
|
6284
6394
|
}
|
|
6285
|
-
if (
|
|
6286
|
-
|
|
6395
|
+
if (shouldIgnoreClosingTag) {
|
|
6396
|
+
ignoredClosingTags.push({ tagName, emit: false });
|
|
6397
|
+
} else if (shouldCloseVoidAlias && !selfClosing) {
|
|
6398
|
+
ignoredClosingTags.push({ tagName, emit: false });
|
|
6399
|
+
} else if (shouldIgnoreNativeVoidClosingTag) {
|
|
6400
|
+
ignoredClosingTags.push({ tagName, emit: true });
|
|
6401
|
+
}
|
|
6402
|
+
if (!selfClosing && !shouldCloseVoidAlias && !shouldIgnoreClosingTag && !shouldIgnoreNativeVoidClosingTag && !voidElements.has(replacementHost ?? nativeTagName)) {
|
|
6403
|
+
const effectiveTag = aliasTag ?? replacementHost ?? (nativeTagName || tagName);
|
|
6287
6404
|
stack.push({
|
|
6288
6405
|
replacementHost,
|
|
6289
|
-
effectiveTag
|
|
6406
|
+
effectiveTag,
|
|
6407
|
+
isTableAlias
|
|
6290
6408
|
});
|
|
6291
|
-
if (
|
|
6409
|
+
if (!isTableAlias && isTableScopeTag(effectiveTag)) ++tableScopeDepth;
|
|
6292
6410
|
}
|
|
6293
6411
|
i = tagEnd + 1;
|
|
6294
6412
|
}
|