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.esm.js
CHANGED
|
@@ -171,7 +171,7 @@ var rawSymbol = Symbol("raw");
|
|
|
171
171
|
|
|
172
172
|
// src/reactivity/isRef.ts
|
|
173
173
|
var isRef = (value) => {
|
|
174
|
-
return value != null && value[srefSymbol]
|
|
174
|
+
return value != null && value[srefSymbol] > 0;
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
// src/app/propValidators.ts
|
|
@@ -1023,6 +1023,8 @@ var readonlyRefValueDescriptor = {
|
|
|
1023
1023
|
configurable: false
|
|
1024
1024
|
};
|
|
1025
1025
|
var defineRefValue = (result, isReadOnly) => {
|
|
1026
|
+
;
|
|
1027
|
+
result[srefSymbol] = isReadOnly ? 2 : 1;
|
|
1026
1028
|
Object.defineProperty(
|
|
1027
1029
|
result,
|
|
1028
1030
|
"value",
|
|
@@ -1158,9 +1160,24 @@ var observe = (source, observer, init, trackUnmount = true) => {
|
|
|
1158
1160
|
};
|
|
1159
1161
|
|
|
1160
1162
|
// src/reactivity/entangle.ts
|
|
1163
|
+
var isReadonly = (value) => value[srefSymbol] === 2;
|
|
1161
1164
|
var entangle = (r1, r2) => {
|
|
1162
1165
|
if (r1 === r2) return () => {
|
|
1163
1166
|
};
|
|
1167
|
+
const r1Readonly = isReadonly(r1);
|
|
1168
|
+
const r2Readonly = isReadonly(r2);
|
|
1169
|
+
if (r1Readonly && r2Readonly) return () => {
|
|
1170
|
+
};
|
|
1171
|
+
if (r1Readonly) {
|
|
1172
|
+
const stop = observe(r1, () => r2(r1()));
|
|
1173
|
+
r2(r1());
|
|
1174
|
+
return stop;
|
|
1175
|
+
}
|
|
1176
|
+
if (r2Readonly) {
|
|
1177
|
+
const stop = observe(r2, () => r1(r2()));
|
|
1178
|
+
r1(r2());
|
|
1179
|
+
return stop;
|
|
1180
|
+
}
|
|
1164
1181
|
const stop1 = observe(r1, (v) => r2(v));
|
|
1165
1182
|
const stop2 = observe(r2, (v) => r1(v));
|
|
1166
1183
|
r2(r1());
|
|
@@ -1422,7 +1439,6 @@ var sref = (value) => {
|
|
|
1422
1439
|
}
|
|
1423
1440
|
return refObj._value;
|
|
1424
1441
|
};
|
|
1425
|
-
srefFunction[srefSymbol] = 1;
|
|
1426
1442
|
defineRefValue(srefFunction, false);
|
|
1427
1443
|
if (isProxy) attachProxyHandle(value);
|
|
1428
1444
|
return srefFunction;
|
|
@@ -2171,7 +2187,7 @@ var DynamicBinder = class {
|
|
|
2171
2187
|
// src/reactivity/unref.ts
|
|
2172
2188
|
var unref = (value) => {
|
|
2173
2189
|
const anyValue = value;
|
|
2174
|
-
return anyValue != null && anyValue[srefSymbol]
|
|
2190
|
+
return anyValue != null && anyValue[srefSymbol] > 0 ? anyValue() : anyValue;
|
|
2175
2191
|
};
|
|
2176
2192
|
|
|
2177
2193
|
// src/directives/html.ts
|
|
@@ -6102,19 +6118,50 @@ var parseTagNameRange = (tagText, isClosing) => {
|
|
|
6102
6118
|
while (i < tagText.length && (tagText[i] === " " || tagText[i] === "\n")) ++i;
|
|
6103
6119
|
if (i >= tagText.length || !isNameChar(tagText[i])) return null;
|
|
6104
6120
|
const start = i;
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6121
|
+
let hasUppercase = false;
|
|
6122
|
+
while (i < tagText.length && isNameChar(tagText[i])) {
|
|
6123
|
+
const c = tagText.charCodeAt(i);
|
|
6124
|
+
if (c >= 65 && c <= 90) {
|
|
6125
|
+
hasUppercase = true;
|
|
6126
|
+
}
|
|
6127
|
+
++i;
|
|
6128
|
+
}
|
|
6129
|
+
return { start, end: i, hasUppercase };
|
|
6130
|
+
};
|
|
6131
|
+
var isTableScopeTag = (tagName) => {
|
|
6132
|
+
switch (tagName) {
|
|
6133
|
+
case "table":
|
|
6134
|
+
case "thead":
|
|
6135
|
+
case "tbody":
|
|
6136
|
+
case "tfoot":
|
|
6137
|
+
return true;
|
|
6138
|
+
default:
|
|
6139
|
+
return false;
|
|
6140
|
+
}
|
|
6141
|
+
};
|
|
6142
|
+
var isRowParentTag = (tagName) => {
|
|
6143
|
+
switch (tagName) {
|
|
6144
|
+
case "thead":
|
|
6145
|
+
case "tbody":
|
|
6146
|
+
case "tfoot":
|
|
6147
|
+
return true;
|
|
6148
|
+
default:
|
|
6149
|
+
return false;
|
|
6150
|
+
}
|
|
6151
|
+
};
|
|
6152
|
+
var isTableDirectAllowed = (tagName) => {
|
|
6153
|
+
switch (tagName) {
|
|
6154
|
+
case "caption":
|
|
6155
|
+
case "colgroup":
|
|
6156
|
+
case "thead":
|
|
6157
|
+
case "tbody":
|
|
6158
|
+
case "tfoot":
|
|
6159
|
+
case "tr":
|
|
6160
|
+
return true;
|
|
6161
|
+
default:
|
|
6162
|
+
return false;
|
|
6163
|
+
}
|
|
6164
|
+
};
|
|
6118
6165
|
var voidElements = /* @__PURE__ */ new Set([
|
|
6119
6166
|
"area",
|
|
6120
6167
|
"base",
|
|
@@ -6131,11 +6178,61 @@ var voidElements = /* @__PURE__ */ new Set([
|
|
|
6131
6178
|
"track",
|
|
6132
6179
|
"wbr"
|
|
6133
6180
|
]);
|
|
6181
|
+
var getTableAliasHost = (tagName) => {
|
|
6182
|
+
switch (tagName) {
|
|
6183
|
+
case "caption":
|
|
6184
|
+
return "captionx";
|
|
6185
|
+
case "thead":
|
|
6186
|
+
return "theadx";
|
|
6187
|
+
case "tbody":
|
|
6188
|
+
return "tbodyx";
|
|
6189
|
+
case "tfoot":
|
|
6190
|
+
return "tfootx";
|
|
6191
|
+
case "tr":
|
|
6192
|
+
return "trx";
|
|
6193
|
+
case "td":
|
|
6194
|
+
return "tdx";
|
|
6195
|
+
case "th":
|
|
6196
|
+
return "thx";
|
|
6197
|
+
case "colgroup":
|
|
6198
|
+
return "colgroupx";
|
|
6199
|
+
case "col":
|
|
6200
|
+
return "colx";
|
|
6201
|
+
default:
|
|
6202
|
+
return null;
|
|
6203
|
+
}
|
|
6204
|
+
};
|
|
6205
|
+
var getTableAliasTag = (host) => {
|
|
6206
|
+
switch (host) {
|
|
6207
|
+
case "captionx":
|
|
6208
|
+
return "caption";
|
|
6209
|
+
case "theadx":
|
|
6210
|
+
return "thead";
|
|
6211
|
+
case "tbodyx":
|
|
6212
|
+
return "tbody";
|
|
6213
|
+
case "tfootx":
|
|
6214
|
+
return "tfoot";
|
|
6215
|
+
case "trx":
|
|
6216
|
+
return "tr";
|
|
6217
|
+
case "tdx":
|
|
6218
|
+
return "td";
|
|
6219
|
+
case "thx":
|
|
6220
|
+
return "th";
|
|
6221
|
+
case "colgroupx":
|
|
6222
|
+
return "colgroup";
|
|
6223
|
+
case "colx":
|
|
6224
|
+
return "col";
|
|
6225
|
+
default:
|
|
6226
|
+
return void 0;
|
|
6227
|
+
}
|
|
6228
|
+
};
|
|
6229
|
+
var closeTag = (tagText, tagName) => `${tagText}</${tagName}>`;
|
|
6134
6230
|
var expandSelfClosingTag = (tagText, tagName) => `${tagText.slice(0, tagText.length - 2)}></${tagName}>`;
|
|
6135
6231
|
var preprocess = (template) => {
|
|
6136
6232
|
let i = 0;
|
|
6137
6233
|
const out = [];
|
|
6138
6234
|
const stack = [];
|
|
6235
|
+
const ignoredClosingTags = [];
|
|
6139
6236
|
let tableScopeDepth = 0;
|
|
6140
6237
|
while (i < template.length) {
|
|
6141
6238
|
const lt = template.indexOf("<", i);
|
|
@@ -6174,12 +6271,21 @@ var preprocess = (template) => {
|
|
|
6174
6271
|
continue;
|
|
6175
6272
|
}
|
|
6176
6273
|
const tagName = rawTag.slice(range.start, range.end);
|
|
6274
|
+
const nativeTagName = range.hasUppercase ? "" : tagName;
|
|
6177
6275
|
if (isClosing) {
|
|
6276
|
+
const ignoredClosing = ignoredClosingTags[ignoredClosingTags.length - 1];
|
|
6277
|
+
if (ignoredClosing?.tagName === tagName) {
|
|
6278
|
+
ignoredClosingTags.pop();
|
|
6279
|
+
if (ignoredClosing.emit) out.push(rawTag);
|
|
6280
|
+
i = tagEnd + 1;
|
|
6281
|
+
continue;
|
|
6282
|
+
}
|
|
6178
6283
|
const top = stack[stack.length - 1];
|
|
6179
6284
|
if (top) {
|
|
6180
6285
|
stack.pop();
|
|
6181
6286
|
out.push(top.replacementHost ? `</${top.replacementHost}>` : rawTag);
|
|
6182
|
-
if (
|
|
6287
|
+
if (!top.isTableAlias && isTableScopeTag(top.effectiveTag))
|
|
6288
|
+
--tableScopeDepth;
|
|
6183
6289
|
} else {
|
|
6184
6290
|
out.push(rawTag);
|
|
6185
6291
|
}
|
|
@@ -6190,35 +6296,47 @@ var preprocess = (template) => {
|
|
|
6190
6296
|
const parent = stack[stack.length - 1];
|
|
6191
6297
|
let replacementHost = null;
|
|
6192
6298
|
if (tableScopeDepth === 0) {
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
} else if (rowParentTags.has(parent?.effectiveTag ?? "")) {
|
|
6197
|
-
replacementHost = tagName === "tr" ? null : "tr";
|
|
6299
|
+
replacementHost = getTableAliasHost(nativeTagName);
|
|
6300
|
+
} else if (isRowParentTag(parent?.effectiveTag ?? "")) {
|
|
6301
|
+
replacementHost = nativeTagName === "tr" ? null : "tr";
|
|
6198
6302
|
} else if (parent?.effectiveTag === "table") {
|
|
6199
|
-
replacementHost =
|
|
6303
|
+
replacementHost = isTableDirectAllowed(nativeTagName) ? null : "tr";
|
|
6200
6304
|
} else if (parent?.effectiveTag === "tr") {
|
|
6201
|
-
replacementHost =
|
|
6202
|
-
}
|
|
6203
|
-
|
|
6305
|
+
replacementHost = nativeTagName === "td" || nativeTagName === "th" ? null : "td";
|
|
6306
|
+
} else if (parent?.effectiveTag === "colgroup") {
|
|
6307
|
+
replacementHost = nativeTagName === "col" ? null : "col";
|
|
6308
|
+
}
|
|
6309
|
+
const aliasTag = getTableAliasTag(replacementHost);
|
|
6310
|
+
const isTableAlias = aliasTag !== void 0;
|
|
6311
|
+
const shouldExpandSelfClosing = selfClosing && !voidElements.has(replacementHost || nativeTagName);
|
|
6312
|
+
const shouldCloseVoidAlias = !!replacementHost && aliasTag === nativeTagName && voidElements.has(nativeTagName);
|
|
6313
|
+
const shouldIgnoreClosingTag = !selfClosing && !!replacementHost && voidElements.has(replacementHost) && !shouldCloseVoidAlias;
|
|
6314
|
+
const shouldIgnoreNativeVoidClosingTag = !selfClosing && !replacementHost && voidElements.has(nativeTagName);
|
|
6204
6315
|
if (replacementHost) {
|
|
6205
|
-
const
|
|
6206
|
-
const rewrittenTag = `${rawTag.slice(0, range.start)}${replacementHost} is="${isAlias ? `r-${tagName}` : `regor:${tagName}`}"${rawTag.slice(range.end)}`;
|
|
6316
|
+
const rewrittenTag = `${rawTag.slice(0, range.start)}${replacementHost} is="${aliasTag ? `r-${aliasTag}` : `regor:${tagName}`}"${rawTag.slice(range.end)}`;
|
|
6207
6317
|
out.push(
|
|
6208
|
-
shouldExpandSelfClosing ? expandSelfClosingTag(rewrittenTag, replacementHost) : rewrittenTag
|
|
6318
|
+
shouldExpandSelfClosing ? expandSelfClosingTag(rewrittenTag, replacementHost) : shouldCloseVoidAlias ? closeTag(rewrittenTag, replacementHost) : rewrittenTag
|
|
6209
6319
|
);
|
|
6210
6320
|
} else {
|
|
6211
6321
|
out.push(
|
|
6212
6322
|
shouldExpandSelfClosing ? expandSelfClosingTag(rawTag, tagName) : rawTag
|
|
6213
6323
|
);
|
|
6214
6324
|
}
|
|
6215
|
-
if (
|
|
6216
|
-
|
|
6325
|
+
if (shouldIgnoreClosingTag) {
|
|
6326
|
+
ignoredClosingTags.push({ tagName, emit: false });
|
|
6327
|
+
} else if (shouldCloseVoidAlias && !selfClosing) {
|
|
6328
|
+
ignoredClosingTags.push({ tagName, emit: false });
|
|
6329
|
+
} else if (shouldIgnoreNativeVoidClosingTag) {
|
|
6330
|
+
ignoredClosingTags.push({ tagName, emit: true });
|
|
6331
|
+
}
|
|
6332
|
+
if (!selfClosing && !shouldCloseVoidAlias && !shouldIgnoreClosingTag && !shouldIgnoreNativeVoidClosingTag && !voidElements.has(replacementHost ?? nativeTagName)) {
|
|
6333
|
+
const effectiveTag = aliasTag ?? replacementHost ?? (nativeTagName || tagName);
|
|
6217
6334
|
stack.push({
|
|
6218
6335
|
replacementHost,
|
|
6219
|
-
effectiveTag
|
|
6336
|
+
effectiveTag,
|
|
6337
|
+
isTableAlias
|
|
6220
6338
|
});
|
|
6221
|
-
if (
|
|
6339
|
+
if (!isTableAlias && isTableScopeTag(effectiveTag)) ++tableScopeDepth;
|
|
6222
6340
|
}
|
|
6223
6341
|
i = tagEnd + 1;
|
|
6224
6342
|
}
|