regor 1.7.0 → 1.7.2
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 +3 -2
- package/dist/regor.d.ts +24 -0
- package/dist/regor.es2015.cjs.js +141 -121
- package/dist/regor.es2015.cjs.prod.js +3 -3
- package/dist/regor.es2015.esm.js +141 -121
- package/dist/regor.es2015.esm.prod.js +3 -3
- package/dist/regor.es2015.iife.js +141 -121
- package/dist/regor.es2015.iife.prod.js +3 -3
- package/dist/regor.es2019.cjs.js +141 -121
- package/dist/regor.es2019.cjs.prod.js +3 -3
- package/dist/regor.es2019.esm.js +141 -121
- package/dist/regor.es2019.esm.prod.js +3 -3
- package/dist/regor.es2019.iife.js +141 -121
- package/dist/regor.es2019.iife.prod.js +3 -3
- package/dist/regor.es2022.cjs.js +140 -120
- package/dist/regor.es2022.cjs.prod.js +3 -3
- package/dist/regor.es2022.esm.js +140 -120
- package/dist/regor.es2022.esm.prod.js +3 -3
- package/dist/regor.es2022.iife.js +140 -120
- package/dist/regor.es2022.iife.prod.js +3 -3
- package/package.json +1 -1
package/dist/regor.es2019.esm.js
CHANGED
|
@@ -1125,6 +1125,132 @@ var isScope = (value) => {
|
|
|
1125
1125
|
return scopeSymbol2 in value;
|
|
1126
1126
|
};
|
|
1127
1127
|
|
|
1128
|
+
// src/reactivity/unref.ts
|
|
1129
|
+
var unref = (value) => {
|
|
1130
|
+
const anyValue = value;
|
|
1131
|
+
return anyValue != null && anyValue[srefSymbol] > 0 ? anyValue() : anyValue;
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
// src/directives/attr.ts
|
|
1135
|
+
var xlinkNS = "http://www.w3.org/1999/xlink";
|
|
1136
|
+
var booleanAttributes = {
|
|
1137
|
+
itemscope: 2,
|
|
1138
|
+
allowfullscreen: 2,
|
|
1139
|
+
formnovalidate: 2,
|
|
1140
|
+
ismap: 2,
|
|
1141
|
+
nomodule: 2,
|
|
1142
|
+
novalidate: 2,
|
|
1143
|
+
readonly: 2,
|
|
1144
|
+
async: 1,
|
|
1145
|
+
autofocus: 1,
|
|
1146
|
+
autoplay: 1,
|
|
1147
|
+
controls: 1,
|
|
1148
|
+
default: 1,
|
|
1149
|
+
defer: 1,
|
|
1150
|
+
disabled: 1,
|
|
1151
|
+
hidden: 1,
|
|
1152
|
+
inert: 1,
|
|
1153
|
+
loop: 1,
|
|
1154
|
+
open: 1,
|
|
1155
|
+
required: 1,
|
|
1156
|
+
reversed: 1,
|
|
1157
|
+
scoped: 1,
|
|
1158
|
+
seamless: 1,
|
|
1159
|
+
checked: 1,
|
|
1160
|
+
muted: 1,
|
|
1161
|
+
multiple: 1,
|
|
1162
|
+
selected: 1
|
|
1163
|
+
};
|
|
1164
|
+
var updateAttr = (el, values, previousValues, option, previousOption, flags) => {
|
|
1165
|
+
var _a;
|
|
1166
|
+
if (option) {
|
|
1167
|
+
option = unref(option);
|
|
1168
|
+
if (flags && flags.includes("camel")) option = camelize(option);
|
|
1169
|
+
patchAttr(
|
|
1170
|
+
el,
|
|
1171
|
+
option,
|
|
1172
|
+
unref(values[0]),
|
|
1173
|
+
unref(previousOption)
|
|
1174
|
+
);
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
const len = values.length;
|
|
1178
|
+
for (let i = 0; i < len; ++i) {
|
|
1179
|
+
const next = values[i];
|
|
1180
|
+
if (isArray(next)) {
|
|
1181
|
+
const previousKey = unref((_a = previousValues == null ? void 0 : previousValues[i]) == null ? void 0 : _a[0]);
|
|
1182
|
+
const key = unref(next[0]);
|
|
1183
|
+
const value = unref(next[1]);
|
|
1184
|
+
patchAttr(el, key, value, previousKey);
|
|
1185
|
+
} else if (isObject(next)) {
|
|
1186
|
+
for (const item of Object.entries(next)) {
|
|
1187
|
+
const key = item[0];
|
|
1188
|
+
const value = unref(item[1]);
|
|
1189
|
+
const p = unref(previousValues == null ? void 0 : previousValues[i]);
|
|
1190
|
+
const previousKey = p && key in p ? key : void 0;
|
|
1191
|
+
patchAttr(el, key, value, previousKey);
|
|
1192
|
+
}
|
|
1193
|
+
} else {
|
|
1194
|
+
const previousKey = unref(previousValues == null ? void 0 : previousValues[i]);
|
|
1195
|
+
const key = unref(values[i++]);
|
|
1196
|
+
const value = unref(values[i]);
|
|
1197
|
+
patchAttr(el, key, value, previousKey);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
var attrDirective = {
|
|
1202
|
+
mount: () => ({
|
|
1203
|
+
update: ({ el, values, previousValues, option, previousOption, flags }) => {
|
|
1204
|
+
updateAttr(
|
|
1205
|
+
el,
|
|
1206
|
+
values,
|
|
1207
|
+
previousValues,
|
|
1208
|
+
option,
|
|
1209
|
+
previousOption,
|
|
1210
|
+
flags
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
})
|
|
1214
|
+
};
|
|
1215
|
+
var patchAttr = (el, key, value, previousKey) => {
|
|
1216
|
+
if (previousKey && previousKey !== key) {
|
|
1217
|
+
el.removeAttribute(previousKey);
|
|
1218
|
+
}
|
|
1219
|
+
if (isNullOrUndefined(key)) {
|
|
1220
|
+
warning(3 /* KeyIsEmpty */, "r-bind", el);
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
if (!isString(key)) {
|
|
1224
|
+
warning(
|
|
1225
|
+
6 /* ErrorLog */,
|
|
1226
|
+
`Attribute key is not string at ${el.outerHTML}`,
|
|
1227
|
+
key
|
|
1228
|
+
);
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
if (key.startsWith("xlink:")) {
|
|
1232
|
+
if (isNullOrUndefined(value)) {
|
|
1233
|
+
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
1234
|
+
} else {
|
|
1235
|
+
el.setAttributeNS(xlinkNS, key, value);
|
|
1236
|
+
}
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
if (isNullOrUndefined(value)) {
|
|
1240
|
+
el.removeAttribute(key);
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
if (key in booleanAttributes) {
|
|
1244
|
+
if (toBoolean(value)) {
|
|
1245
|
+
el.setAttribute(key, "");
|
|
1246
|
+
} else {
|
|
1247
|
+
el.removeAttribute(key);
|
|
1248
|
+
}
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1251
|
+
el.setAttribute(key, value);
|
|
1252
|
+
};
|
|
1253
|
+
|
|
1128
1254
|
// src/directives/context.ts
|
|
1129
1255
|
var contextDirective = {
|
|
1130
1256
|
collectRefObj: true,
|
|
@@ -1863,10 +1989,11 @@ var ComponentBinder = class {
|
|
|
1863
1989
|
} else if (attrName === ":style" || attrName === bindStyleName) {
|
|
1864
1990
|
mergeBinding(":style", bindStyleName, value);
|
|
1865
1991
|
} else {
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1992
|
+
const normalizedName = normalizeAttributeName(
|
|
1993
|
+
attrName,
|
|
1994
|
+
binder.__config
|
|
1869
1995
|
);
|
|
1996
|
+
patchAttr(inheritor, normalizedName, value);
|
|
1870
1997
|
}
|
|
1871
1998
|
};
|
|
1872
1999
|
for (const { name, value } of inheritedPropAttrs) {
|
|
@@ -2208,12 +2335,6 @@ var DynamicBinder = class {
|
|
|
2208
2335
|
}
|
|
2209
2336
|
};
|
|
2210
2337
|
|
|
2211
|
-
// src/reactivity/unref.ts
|
|
2212
|
-
var unref = (value) => {
|
|
2213
|
-
const anyValue = value;
|
|
2214
|
-
return anyValue != null && anyValue[srefSymbol] > 0 ? anyValue() : anyValue;
|
|
2215
|
-
};
|
|
2216
|
-
|
|
2217
2338
|
// src/directives/html.ts
|
|
2218
2339
|
var updateHtml = (el, values) => {
|
|
2219
2340
|
const [value, replacer] = values;
|
|
@@ -3163,116 +3284,6 @@ var Binder = class {
|
|
|
3163
3284
|
}
|
|
3164
3285
|
};
|
|
3165
3286
|
|
|
3166
|
-
// src/directives/attr.ts
|
|
3167
|
-
var xlinkNS = "http://www.w3.org/1999/xlink";
|
|
3168
|
-
var booleanAttributes = {
|
|
3169
|
-
itemscope: 2,
|
|
3170
|
-
allowfullscreen: 2,
|
|
3171
|
-
formnovalidate: 2,
|
|
3172
|
-
ismap: 2,
|
|
3173
|
-
nomodule: 2,
|
|
3174
|
-
novalidate: 2,
|
|
3175
|
-
readonly: 2,
|
|
3176
|
-
async: 1,
|
|
3177
|
-
autofocus: 1,
|
|
3178
|
-
autoplay: 1,
|
|
3179
|
-
controls: 1,
|
|
3180
|
-
default: 1,
|
|
3181
|
-
defer: 1,
|
|
3182
|
-
disabled: 1,
|
|
3183
|
-
hidden: 1,
|
|
3184
|
-
inert: 1,
|
|
3185
|
-
loop: 1,
|
|
3186
|
-
open: 1,
|
|
3187
|
-
required: 1,
|
|
3188
|
-
reversed: 1,
|
|
3189
|
-
scoped: 1,
|
|
3190
|
-
seamless: 1,
|
|
3191
|
-
checked: 1,
|
|
3192
|
-
muted: 1,
|
|
3193
|
-
multiple: 1,
|
|
3194
|
-
selected: 1
|
|
3195
|
-
};
|
|
3196
|
-
function includeBooleanAttr(value) {
|
|
3197
|
-
return !!value || value === "";
|
|
3198
|
-
}
|
|
3199
|
-
var updateAttr = (el, values, previousValues, option, previousOption, flags) => {
|
|
3200
|
-
var _a;
|
|
3201
|
-
if (option) {
|
|
3202
|
-
if (flags && flags.includes("camel")) option = camelize(option);
|
|
3203
|
-
patchAttribute(el, option, values[0], previousOption);
|
|
3204
|
-
return;
|
|
3205
|
-
}
|
|
3206
|
-
const len = values.length;
|
|
3207
|
-
for (let i = 0; i < len; ++i) {
|
|
3208
|
-
const next = values[i];
|
|
3209
|
-
if (isArray(next)) {
|
|
3210
|
-
const previousKey = (_a = previousValues == null ? void 0 : previousValues[i]) == null ? void 0 : _a[0];
|
|
3211
|
-
const key = next[0];
|
|
3212
|
-
const value = next[1];
|
|
3213
|
-
patchAttribute(el, key, value, previousKey);
|
|
3214
|
-
} else if (isObject(next)) {
|
|
3215
|
-
for (const item of Object.entries(next)) {
|
|
3216
|
-
const key = item[0];
|
|
3217
|
-
const value = item[1];
|
|
3218
|
-
const p = previousValues == null ? void 0 : previousValues[i];
|
|
3219
|
-
const previousKey = p && key in p ? key : void 0;
|
|
3220
|
-
patchAttribute(el, key, value, previousKey);
|
|
3221
|
-
}
|
|
3222
|
-
} else {
|
|
3223
|
-
const previousKey = previousValues == null ? void 0 : previousValues[i];
|
|
3224
|
-
const key = values[i++];
|
|
3225
|
-
const value = values[i];
|
|
3226
|
-
patchAttribute(el, key, value, previousKey);
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
};
|
|
3230
|
-
var attrDirective = {
|
|
3231
|
-
mount: () => ({
|
|
3232
|
-
update: ({ el, values, previousValues, option, previousOption, flags }) => {
|
|
3233
|
-
updateAttr(
|
|
3234
|
-
el,
|
|
3235
|
-
values,
|
|
3236
|
-
previousValues,
|
|
3237
|
-
option,
|
|
3238
|
-
previousOption,
|
|
3239
|
-
flags
|
|
3240
|
-
);
|
|
3241
|
-
}
|
|
3242
|
-
})
|
|
3243
|
-
};
|
|
3244
|
-
var patchAttribute = (el, key, value, previousKey) => {
|
|
3245
|
-
if (previousKey && previousKey !== key) {
|
|
3246
|
-
el.removeAttribute(previousKey);
|
|
3247
|
-
}
|
|
3248
|
-
if (isNullOrUndefined(key)) {
|
|
3249
|
-
warning(3 /* KeyIsEmpty */, "r-bind", el);
|
|
3250
|
-
return;
|
|
3251
|
-
}
|
|
3252
|
-
if (!isString(key)) {
|
|
3253
|
-
warning(
|
|
3254
|
-
6 /* ErrorLog */,
|
|
3255
|
-
`Attribute key is not string at ${el.outerHTML}`,
|
|
3256
|
-
key
|
|
3257
|
-
);
|
|
3258
|
-
return;
|
|
3259
|
-
}
|
|
3260
|
-
if (key.startsWith("xlink:")) {
|
|
3261
|
-
if (isNullOrUndefined(value)) {
|
|
3262
|
-
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
3263
|
-
} else {
|
|
3264
|
-
el.setAttributeNS(xlinkNS, key, value);
|
|
3265
|
-
}
|
|
3266
|
-
return;
|
|
3267
|
-
}
|
|
3268
|
-
const isBoolean2 = key in booleanAttributes;
|
|
3269
|
-
if (isNullOrUndefined(value) || isBoolean2 && !includeBooleanAttr(value)) {
|
|
3270
|
-
el.removeAttribute(key);
|
|
3271
|
-
} else {
|
|
3272
|
-
el.setAttribute(key, isBoolean2 ? "" : value);
|
|
3273
|
-
}
|
|
3274
|
-
};
|
|
3275
|
-
|
|
3276
3287
|
// src/directives/class.ts
|
|
3277
3288
|
var updateClass = (el, values, previousValues) => {
|
|
3278
3289
|
const len = values.length;
|
|
@@ -3919,7 +3930,7 @@ var propDirective = {
|
|
|
3919
3930
|
}
|
|
3920
3931
|
})
|
|
3921
3932
|
};
|
|
3922
|
-
function
|
|
3933
|
+
function includeBooleanAttr(value) {
|
|
3923
3934
|
return !!value || value === "";
|
|
3924
3935
|
}
|
|
3925
3936
|
var patchProp = (el, key, value) => {
|
|
@@ -3951,7 +3962,7 @@ var patchProp = (el, key, value) => {
|
|
|
3951
3962
|
if (value === "" || value == null) {
|
|
3952
3963
|
const type = typeof el[key];
|
|
3953
3964
|
if (type === "boolean") {
|
|
3954
|
-
value =
|
|
3965
|
+
value = includeBooleanAttr(value);
|
|
3955
3966
|
} else if (value == null && type === "string") {
|
|
3956
3967
|
value = "";
|
|
3957
3968
|
needRemove = true;
|
|
@@ -4117,6 +4128,8 @@ var flatten = (reference) => {
|
|
|
4117
4128
|
var flattenContent = (value, weakMap = /* @__PURE__ */ new WeakMap()) => {
|
|
4118
4129
|
if (!value) return value;
|
|
4119
4130
|
if (!isObject(value)) return value;
|
|
4131
|
+
if (value instanceof Node || value instanceof Date || value instanceof RegExp || value instanceof Promise || value instanceof Error)
|
|
4132
|
+
return value;
|
|
4120
4133
|
if (isArray(value)) {
|
|
4121
4134
|
return value.map(flatten);
|
|
4122
4135
|
}
|
|
@@ -4205,6 +4218,11 @@ function ref(value) {
|
|
|
4205
4218
|
return result;
|
|
4206
4219
|
}
|
|
4207
4220
|
|
|
4221
|
+
// src/reactivity/cref.ts
|
|
4222
|
+
function cref(value) {
|
|
4223
|
+
return ref(flatten(value));
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4208
4226
|
// src/app/RegorConfig.ts
|
|
4209
4227
|
var _RegorConfig = class _RegorConfig {
|
|
4210
4228
|
constructor(globalContext) {
|
|
@@ -4265,6 +4283,7 @@ var _RegorConfig = class _RegorConfig {
|
|
|
4265
4283
|
obj[key] = global[key];
|
|
4266
4284
|
}
|
|
4267
4285
|
obj.ref = ref;
|
|
4286
|
+
obj.cref = cref;
|
|
4268
4287
|
obj.sref = sref;
|
|
4269
4288
|
obj.flatten = flatten;
|
|
4270
4289
|
return obj;
|
|
@@ -6961,6 +6980,7 @@ export {
|
|
|
6961
6980
|
computeRef,
|
|
6962
6981
|
computed,
|
|
6963
6982
|
createApp,
|
|
6983
|
+
cref,
|
|
6964
6984
|
defineComponent,
|
|
6965
6985
|
drainUnbind,
|
|
6966
6986
|
endBatch,
|