essor 0.0.17-beta.4 → 0.0.17-beta.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/essor.browser.dev.js +123 -72
- package/dist/essor.browser.dev.js.map +1 -1
- package/dist/essor.browser.js +7 -7
- package/dist/essor.cjs +3 -3
- package/dist/essor.d.cts +1 -1
- package/dist/essor.d.ts +1 -1
- package/dist/essor.dev.cjs +3 -3
- package/dist/essor.dev.cjs.map +1 -1
- package/dist/essor.dev.js +3 -3
- package/dist/essor.dev.js.map +1 -1
- package/dist/essor.js +3 -3
- package/package.json +4 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* essor v0.0.17-beta.
|
|
3
|
-
* build time 2026-06-
|
|
2
|
+
* essor v0.0.17-beta.5
|
|
3
|
+
* build time 2026-06-16T09:16:05.600Z
|
|
4
4
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
5
5
|
* @license MIT
|
|
6
6
|
**/
|
|
7
7
|
|
|
8
8
|
// src/version.ts
|
|
9
|
-
var __version = "0.0.17-beta.
|
|
9
|
+
var __version = "0.0.17-beta.5";
|
|
10
10
|
|
|
11
11
|
// ../shared/dist/shared.dev.js
|
|
12
12
|
var isObject = (val) => val !== null && typeof val === "object";
|
|
@@ -17,6 +17,9 @@ var isArray = Array.isArray;
|
|
|
17
17
|
function isString(val) {
|
|
18
18
|
return typeof val === "string";
|
|
19
19
|
}
|
|
20
|
+
function isNumber(val) {
|
|
21
|
+
return typeof val === "number";
|
|
22
|
+
}
|
|
20
23
|
function isSymbol(val) {
|
|
21
24
|
return typeof val === "symbol";
|
|
22
25
|
}
|
|
@@ -129,22 +132,6 @@ function normalizeClassName(classValue) {
|
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
// ../signals/dist/signals.dev.js
|
|
132
|
-
var __defProp = Object.defineProperty;
|
|
133
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
134
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
135
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
136
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
137
|
-
var __spreadValues = (a, b) => {
|
|
138
|
-
for (var prop in b || (b = {}))
|
|
139
|
-
if (__hasOwnProp.call(b, prop))
|
|
140
|
-
__defNormalProp(a, prop, b[prop]);
|
|
141
|
-
if (__getOwnPropSymbols)
|
|
142
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
143
|
-
if (__propIsEnum.call(b, prop))
|
|
144
|
-
__defNormalProp(a, prop, b[prop]);
|
|
145
|
-
}
|
|
146
|
-
return a;
|
|
147
|
-
};
|
|
148
135
|
var TriggerOpTypes = {
|
|
149
136
|
SET: "SET",
|
|
150
137
|
ADD: "ADD",
|
|
@@ -1053,11 +1040,12 @@ var objectHandlers = (shallow) => ({
|
|
|
1053
1040
|
return valueUnwrapped;
|
|
1054
1041
|
},
|
|
1055
1042
|
set: (target, key, value, receiver) => {
|
|
1043
|
+
const hadKey = hasOwn(target, key);
|
|
1056
1044
|
const oldValue = Reflect.get(target, key, receiver);
|
|
1057
1045
|
const rawValue = toRaw(value);
|
|
1058
1046
|
const result = Reflect.set(target, key, rawValue, receiver);
|
|
1059
1047
|
if (hasStoredValueChanged(rawValue, oldValue)) {
|
|
1060
|
-
trigger(target, TriggerOpTypes.SET, key, rawValue);
|
|
1048
|
+
trigger(target, hadKey ? TriggerOpTypes.SET : TriggerOpTypes.ADD, key, rawValue);
|
|
1061
1049
|
}
|
|
1062
1050
|
return result;
|
|
1063
1051
|
},
|
|
@@ -1068,6 +1056,10 @@ var objectHandlers = (shallow) => ({
|
|
|
1068
1056
|
trigger(target, TriggerOpTypes.DELETE, key, void 0);
|
|
1069
1057
|
}
|
|
1070
1058
|
return result;
|
|
1059
|
+
},
|
|
1060
|
+
ownKeys: (target) => {
|
|
1061
|
+
track(target, ITERATE_KEY);
|
|
1062
|
+
return Reflect.ownKeys(target);
|
|
1071
1063
|
}
|
|
1072
1064
|
});
|
|
1073
1065
|
var shallowObjectHandlers = objectHandlers(true);
|
|
@@ -1808,7 +1800,6 @@ var ComputedImpl = class {
|
|
|
1808
1800
|
this.setter = setter;
|
|
1809
1801
|
this.onTrack = onTrack;
|
|
1810
1802
|
this.onTrigger = onTrigger;
|
|
1811
|
-
this.flag |= 16;
|
|
1812
1803
|
recordDisposable(this);
|
|
1813
1804
|
}
|
|
1814
1805
|
/**
|
|
@@ -2010,13 +2001,61 @@ function isComputed(value) {
|
|
|
2010
2001
|
/* IS_COMPUTED */
|
|
2011
2002
|
];
|
|
2012
2003
|
}
|
|
2004
|
+
function cloneInitialState(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
2005
|
+
if (!isObject(value)) {
|
|
2006
|
+
return value;
|
|
2007
|
+
}
|
|
2008
|
+
if (seen.has(value)) {
|
|
2009
|
+
return seen.get(value);
|
|
2010
|
+
}
|
|
2011
|
+
if (value instanceof Date) {
|
|
2012
|
+
return new Date(value.getTime());
|
|
2013
|
+
}
|
|
2014
|
+
if (value instanceof RegExp) {
|
|
2015
|
+
return new RegExp(value.source, value.flags);
|
|
2016
|
+
}
|
|
2017
|
+
if (value instanceof Map) {
|
|
2018
|
+
const clone2 = /* @__PURE__ */ new Map();
|
|
2019
|
+
seen.set(value, clone2);
|
|
2020
|
+
value.forEach((mapValue, mapKey) => {
|
|
2021
|
+
clone2.set(cloneInitialState(mapKey, seen), cloneInitialState(mapValue, seen));
|
|
2022
|
+
});
|
|
2023
|
+
return clone2;
|
|
2024
|
+
}
|
|
2025
|
+
if (value instanceof Set) {
|
|
2026
|
+
const clone2 = /* @__PURE__ */ new Set();
|
|
2027
|
+
seen.set(value, clone2);
|
|
2028
|
+
value.forEach((setValue) => {
|
|
2029
|
+
clone2.add(cloneInitialState(setValue, seen));
|
|
2030
|
+
});
|
|
2031
|
+
return clone2;
|
|
2032
|
+
}
|
|
2033
|
+
if (Array.isArray(value)) {
|
|
2034
|
+
const clone2 = [];
|
|
2035
|
+
seen.set(value, clone2);
|
|
2036
|
+
value.forEach((item, index) => {
|
|
2037
|
+
clone2[index] = cloneInitialState(item, seen);
|
|
2038
|
+
});
|
|
2039
|
+
return clone2;
|
|
2040
|
+
}
|
|
2041
|
+
const prototype = Object.getPrototypeOf(value);
|
|
2042
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
2043
|
+
return value;
|
|
2044
|
+
}
|
|
2045
|
+
const clone = Object.create(prototype);
|
|
2046
|
+
seen.set(value, clone);
|
|
2047
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
2048
|
+
clone[key] = cloneInitialState(value[key], seen);
|
|
2049
|
+
}
|
|
2050
|
+
return clone;
|
|
2051
|
+
}
|
|
2013
2052
|
function createOptionsStore(options) {
|
|
2014
2053
|
if (!options.state) {
|
|
2015
2054
|
warn("Store state is required");
|
|
2016
2055
|
throw new Error("Store state is required");
|
|
2017
2056
|
}
|
|
2018
2057
|
const { state, getters, actions } = options;
|
|
2019
|
-
const initState =
|
|
2058
|
+
const initState = cloneInitialState(state);
|
|
2020
2059
|
const reactiveState = reactive(state);
|
|
2021
2060
|
const subscriptions = /* @__PURE__ */ new Set();
|
|
2022
2061
|
const actionCallbacks = /* @__PURE__ */ new Set();
|
|
@@ -2340,17 +2379,17 @@ function watch(source, callback, options = {}) {
|
|
|
2340
2379
|
}
|
|
2341
2380
|
|
|
2342
2381
|
// ../template/dist/chunk-PYFF2HI3.dev.js
|
|
2343
|
-
var
|
|
2344
|
-
var
|
|
2345
|
-
var
|
|
2382
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2383
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2384
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2346
2385
|
var __objRest = (source, exclude) => {
|
|
2347
2386
|
var target = {};
|
|
2348
2387
|
for (var prop in source)
|
|
2349
|
-
if (
|
|
2388
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2350
2389
|
target[prop] = source[prop];
|
|
2351
|
-
if (source != null &&
|
|
2352
|
-
for (var prop of
|
|
2353
|
-
if (exclude.indexOf(prop) < 0 &&
|
|
2390
|
+
if (source != null && __getOwnPropSymbols)
|
|
2391
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
2392
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
2354
2393
|
target[prop] = source[prop];
|
|
2355
2394
|
}
|
|
2356
2395
|
return target;
|
|
@@ -2634,6 +2673,7 @@ function patchClass(el, prev, next2, isSVG = false) {
|
|
|
2634
2673
|
}
|
|
2635
2674
|
var normalizeClass = normalizeClassName;
|
|
2636
2675
|
var importantRE = /\s*!important$/;
|
|
2676
|
+
var styleDeclRE = /(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi;
|
|
2637
2677
|
var prefixes = ["Webkit", "Moz", "ms"];
|
|
2638
2678
|
var prefixCache = {};
|
|
2639
2679
|
function patchStyle(el, prev, next2) {
|
|
@@ -2658,9 +2698,9 @@ function patchStyle(el, prev, next2) {
|
|
|
2658
2698
|
}
|
|
2659
2699
|
}
|
|
2660
2700
|
} else if (prev && isString(prev)) {
|
|
2661
|
-
|
|
2701
|
+
styleDeclRE.lastIndex = 0;
|
|
2662
2702
|
let match;
|
|
2663
|
-
while ((match =
|
|
2703
|
+
while ((match = styleDeclRE.exec(prev)) !== null) {
|
|
2664
2704
|
const key = match[1].trim();
|
|
2665
2705
|
if (key && next2 && isObject(next2) && next2[key] == null) {
|
|
2666
2706
|
setStyle(style, key, "");
|
|
@@ -3125,7 +3165,7 @@ function normalizeNode(node) {
|
|
|
3125
3165
|
}
|
|
3126
3166
|
function insert(parent, nodeFactory, before) {
|
|
3127
3167
|
if (!parent) return;
|
|
3128
|
-
|
|
3168
|
+
let parentScope = getActiveScope();
|
|
3129
3169
|
let renderedNodes = [];
|
|
3130
3170
|
let isFirstRun = true;
|
|
3131
3171
|
const resolveNodes = (raw) => {
|
|
@@ -3167,6 +3207,7 @@ function insert(parent, nodeFactory, before) {
|
|
|
3167
3207
|
effectRunner.stop();
|
|
3168
3208
|
for (const node of renderedNodes) removeNode(node);
|
|
3169
3209
|
renderedNodes = [];
|
|
3210
|
+
parentScope = null;
|
|
3170
3211
|
});
|
|
3171
3212
|
return renderedNodes;
|
|
3172
3213
|
}
|
|
@@ -3300,9 +3341,9 @@ function syncDescriptors(target, source, pruneMissing = false) {
|
|
|
3300
3341
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3301
3342
|
}
|
|
3302
3343
|
if (pruneMissing) {
|
|
3303
|
-
const
|
|
3344
|
+
const sourceKeySet = new Set(Object.getOwnPropertyNames(source));
|
|
3304
3345
|
for (const key of Object.getOwnPropertyNames(target)) {
|
|
3305
|
-
if (!
|
|
3346
|
+
if (!sourceKeySet.has(key)) delete target[key];
|
|
3306
3347
|
}
|
|
3307
3348
|
}
|
|
3308
3349
|
}
|
|
@@ -3866,7 +3907,7 @@ function bindElement(node, prop, getter, setter, modifiers = {}) {
|
|
|
3866
3907
|
function unwrapSlotValue(raw) {
|
|
3867
3908
|
let v = raw;
|
|
3868
3909
|
if (Array.isArray(v) && v.length === 1) v = v[0];
|
|
3869
|
-
return
|
|
3910
|
+
return isFunction(v) ? v() : v;
|
|
3870
3911
|
}
|
|
3871
3912
|
function useChildren(props) {
|
|
3872
3913
|
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
@@ -4184,49 +4225,50 @@ function createResource(fetcher, options) {
|
|
|
4184
4225
|
const error4 = signal(null);
|
|
4185
4226
|
const state = signal("pending");
|
|
4186
4227
|
let fetchId = 0;
|
|
4187
|
-
let
|
|
4188
|
-
let suspenseRegistered = false;
|
|
4228
|
+
let controller = null;
|
|
4189
4229
|
const suspenseContext = inject(SuspenseContext, null);
|
|
4190
|
-
const
|
|
4191
|
-
const
|
|
4230
|
+
const doFetch = () => __async(null, null, function* () {
|
|
4231
|
+
const id = ++fetchId;
|
|
4232
|
+
controller == null ? void 0 : controller.abort();
|
|
4233
|
+
controller = new AbortController();
|
|
4192
4234
|
loading.value = true;
|
|
4193
4235
|
state.value = "pending";
|
|
4194
4236
|
error4.value = null;
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4237
|
+
let promise;
|
|
4238
|
+
try {
|
|
4239
|
+
promise = Promise.resolve(fetcher(controller.signal));
|
|
4240
|
+
} catch (error_) {
|
|
4241
|
+
error4.value = error_ instanceof Error ? error_ : new Error(String(error_));
|
|
4242
|
+
state.value = "errored";
|
|
4243
|
+
loading.value = false;
|
|
4244
|
+
return;
|
|
4198
4245
|
}
|
|
4246
|
+
suspenseContext == null ? void 0 : suspenseContext.register(promise);
|
|
4199
4247
|
try {
|
|
4200
|
-
const promise = fetcher();
|
|
4201
|
-
currentPromise = promise;
|
|
4202
|
-
promise.catch(() => {
|
|
4203
|
-
});
|
|
4204
4248
|
const result = yield promise;
|
|
4205
|
-
if (
|
|
4249
|
+
if (id === fetchId) {
|
|
4206
4250
|
value.value = result;
|
|
4207
4251
|
state.value = "ready";
|
|
4208
4252
|
loading.value = false;
|
|
4209
4253
|
}
|
|
4210
4254
|
} catch (error_) {
|
|
4211
|
-
if (
|
|
4212
|
-
|
|
4213
|
-
state.value = "errored";
|
|
4255
|
+
if (id !== fetchId) return;
|
|
4256
|
+
if (error_ instanceof DOMException && error_.name === "AbortError") {
|
|
4214
4257
|
loading.value = false;
|
|
4258
|
+
return;
|
|
4215
4259
|
}
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
}
|
|
4260
|
+
error4.value = error_ instanceof Error ? error_ : new Error(String(error_));
|
|
4261
|
+
state.value = "errored";
|
|
4262
|
+
loading.value = false;
|
|
4220
4263
|
}
|
|
4221
4264
|
});
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
}
|
|
4228
|
-
return value.value;
|
|
4265
|
+
doFetch();
|
|
4266
|
+
onCleanup(() => {
|
|
4267
|
+
fetchId++;
|
|
4268
|
+
controller == null ? void 0 : controller.abort();
|
|
4269
|
+
controller = null;
|
|
4229
4270
|
});
|
|
4271
|
+
const resource = (() => value.value);
|
|
4230
4272
|
resource.loading = loading;
|
|
4231
4273
|
resource.error = error4;
|
|
4232
4274
|
resource.state = state;
|
|
@@ -4237,9 +4279,7 @@ function createResource(fetcher, options) {
|
|
|
4237
4279
|
loading.value = false;
|
|
4238
4280
|
error4.value = null;
|
|
4239
4281
|
},
|
|
4240
|
-
refetch: () =>
|
|
4241
|
-
yield fetch();
|
|
4242
|
-
})
|
|
4282
|
+
refetch: () => doFetch()
|
|
4243
4283
|
};
|
|
4244
4284
|
return [resource, actions];
|
|
4245
4285
|
}
|
|
@@ -4423,9 +4463,14 @@ function For(props) {
|
|
|
4423
4463
|
const parentScope = (_a22 = getActiveScope()) != null ? _a22 : ownerScope;
|
|
4424
4464
|
const scope = createScope(parentScope);
|
|
4425
4465
|
let mountedNodes = [];
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4466
|
+
try {
|
|
4467
|
+
runWithScope(scope, () => {
|
|
4468
|
+
mountedNodes = mountValue(renderFn(item, index), parent, before);
|
|
4469
|
+
});
|
|
4470
|
+
} catch (error4) {
|
|
4471
|
+
disposeScope(scope);
|
|
4472
|
+
throw error4;
|
|
4473
|
+
}
|
|
4429
4474
|
return { key, item, nodes: mountedNodes, scope };
|
|
4430
4475
|
};
|
|
4431
4476
|
const disposeItem = (entry) => {
|
|
@@ -4626,16 +4671,17 @@ function whenTransitionEnds(el, type, explicit, resolve2) {
|
|
|
4626
4671
|
const finish = () => {
|
|
4627
4672
|
if (done) return;
|
|
4628
4673
|
done = true;
|
|
4674
|
+
clearTimeout(timer);
|
|
4629
4675
|
el.removeEventListener(info.event, onEnd);
|
|
4630
4676
|
resolve2();
|
|
4631
4677
|
};
|
|
4632
4678
|
const onEnd = () => finish();
|
|
4633
4679
|
el.addEventListener(info.event, onEnd);
|
|
4634
|
-
setTimeout(finish, info.timeout + 1);
|
|
4680
|
+
const timer = setTimeout(finish, info.timeout + 1);
|
|
4635
4681
|
}
|
|
4636
4682
|
function resolveDuration(d, dir) {
|
|
4637
4683
|
if (d == null) return null;
|
|
4638
|
-
if (
|
|
4684
|
+
if (isNumber(d)) return d;
|
|
4639
4685
|
return d[dir];
|
|
4640
4686
|
}
|
|
4641
4687
|
function validateSlot(value) {
|
|
@@ -4952,9 +4998,14 @@ function TransitionGroup(props) {
|
|
|
4952
4998
|
const parentScope = getActiveScope();
|
|
4953
4999
|
const scope = createScope(parentScope);
|
|
4954
5000
|
let raw;
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
5001
|
+
try {
|
|
5002
|
+
runWithScope(scope, () => {
|
|
5003
|
+
raw = childrenFn(item, index);
|
|
5004
|
+
});
|
|
5005
|
+
} catch (error4) {
|
|
5006
|
+
disposeScope(scope);
|
|
5007
|
+
throw error4;
|
|
5008
|
+
}
|
|
4958
5009
|
const { el, comp } = resolveItemElement(raw, wrapper);
|
|
4959
5010
|
if (!el) {
|
|
4960
5011
|
disposeScope(scope);
|