essor 0.0.17-beta.6 → 0.0.17-beta.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/dist/essor.browser.dev.js +45 -32
- 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.7
|
|
3
|
+
* build time 2026-06-27T06:24:37.846Z
|
|
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.7";
|
|
10
10
|
|
|
11
11
|
// ../shared/dist/shared.dev.js
|
|
12
12
|
var isObject = (val) => val !== null && typeof val === "object";
|
|
@@ -3337,17 +3337,18 @@ function triggerUpdateHooks(scope) {
|
|
|
3337
3337
|
return runWithScope(scope, () => executeHooks(scope.onUpdate, scope.id, "update"));
|
|
3338
3338
|
}
|
|
3339
3339
|
function syncDescriptors(target, source, pruneMissing = false) {
|
|
3340
|
-
|
|
3340
|
+
const sourceKeys = Reflect.ownKeys(source);
|
|
3341
|
+
for (const key of sourceKeys) {
|
|
3341
3342
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3342
3343
|
}
|
|
3343
3344
|
if (pruneMissing) {
|
|
3344
|
-
const sourceKeySet = new Set(
|
|
3345
|
-
for (const key of
|
|
3345
|
+
const sourceKeySet = new Set(sourceKeys);
|
|
3346
|
+
for (const key of Reflect.ownKeys(target)) {
|
|
3346
3347
|
if (!sourceKeySet.has(key)) delete target[key];
|
|
3347
3348
|
}
|
|
3348
3349
|
}
|
|
3349
3350
|
}
|
|
3350
|
-
function
|
|
3351
|
+
function readDescriptorValue(source, key) {
|
|
3351
3352
|
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
3352
3353
|
return descriptor.get ? descriptor.get.call(source) : descriptor.value;
|
|
3353
3354
|
}
|
|
@@ -3366,9 +3367,9 @@ var Component = class {
|
|
|
3366
3367
|
this.parentNode = void 0;
|
|
3367
3368
|
this.rootEventCleanups = [];
|
|
3368
3369
|
this.parentScope = getActiveScope();
|
|
3369
|
-
const
|
|
3370
|
-
syncDescriptors(
|
|
3371
|
-
this.reactiveProps = shallowReactive(
|
|
3370
|
+
const reactiveProps = /* @__PURE__ */ Object.create(null);
|
|
3371
|
+
syncDescriptors(reactiveProps, props);
|
|
3372
|
+
this.reactiveProps = shallowReactive(reactiveProps);
|
|
3372
3373
|
}
|
|
3373
3374
|
/**
|
|
3374
3375
|
* Mount the component into `parentNode` (optionally before `beforeNode`).
|
|
@@ -3416,14 +3417,14 @@ var Component = class {
|
|
|
3416
3417
|
*/
|
|
3417
3418
|
update(props) {
|
|
3418
3419
|
this.props = props;
|
|
3419
|
-
const scope = this.scope;
|
|
3420
|
-
if (!scope || scope.isDestroyed) return;
|
|
3421
3420
|
syncDescriptors(
|
|
3422
3421
|
this.reactiveProps,
|
|
3423
3422
|
props != null ? props : {},
|
|
3424
3423
|
/* pruneMissing */
|
|
3425
3424
|
true
|
|
3426
3425
|
);
|
|
3426
|
+
const scope = this.scope;
|
|
3427
|
+
if (!scope || scope.isDestroyed) return;
|
|
3427
3428
|
this.syncSpecialProps(props);
|
|
3428
3429
|
triggerUpdateHooks(scope);
|
|
3429
3430
|
}
|
|
@@ -3435,7 +3436,10 @@ var Component = class {
|
|
|
3435
3436
|
if (!this.parentNode) return;
|
|
3436
3437
|
const parent = this.parentNode;
|
|
3437
3438
|
const before = this.beforeNode;
|
|
3439
|
+
const savedProps = /* @__PURE__ */ Object.create(null);
|
|
3440
|
+
syncDescriptors(savedProps, this.reactiveProps);
|
|
3438
3441
|
this.destroy();
|
|
3442
|
+
syncDescriptors(this.reactiveProps, savedProps);
|
|
3439
3443
|
this.mount(parent, before);
|
|
3440
3444
|
}
|
|
3441
3445
|
/**
|
|
@@ -3452,7 +3456,7 @@ var Component = class {
|
|
|
3452
3456
|
this.renderedNodes = [];
|
|
3453
3457
|
this.firstChild = void 0;
|
|
3454
3458
|
this.parentNode = void 0;
|
|
3455
|
-
for (const key of
|
|
3459
|
+
for (const key of Reflect.ownKeys(this.reactiveProps)) {
|
|
3456
3460
|
delete this.reactiveProps[key];
|
|
3457
3461
|
}
|
|
3458
3462
|
this.state = 0;
|
|
@@ -3468,35 +3472,42 @@ var Component = class {
|
|
|
3468
3472
|
const root = this.firstChild;
|
|
3469
3473
|
if (!root || !(root instanceof Element)) return;
|
|
3470
3474
|
this.releaseSpecialProps();
|
|
3471
|
-
for (const key of
|
|
3475
|
+
for (const key of Reflect.ownKeys(props)) {
|
|
3476
|
+
if (!isString(key)) continue;
|
|
3472
3477
|
if (key === REF_KEY) {
|
|
3473
|
-
const value =
|
|
3478
|
+
const value = readDescriptorValue(props, key);
|
|
3474
3479
|
this.rootRefCleanup = this.bindRootRef(value, root);
|
|
3475
3480
|
continue;
|
|
3476
3481
|
}
|
|
3477
3482
|
if (isOn(key)) {
|
|
3478
|
-
const value =
|
|
3483
|
+
const value = readDescriptorValue(props, key);
|
|
3479
3484
|
if (!isFunction(value)) continue;
|
|
3480
3485
|
const eventName = key.slice(2).toLowerCase();
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
this.rootEventCleanups.push(() => {
|
|
3487
|
-
if (target[slot] === value) target[slot] = prev;
|
|
3488
|
-
});
|
|
3489
|
-
continue;
|
|
3490
|
-
}
|
|
3491
|
-
const fn = value;
|
|
3492
|
-
const handler = (event) => {
|
|
3493
|
-
if (target.disabled) return;
|
|
3494
|
-
fn.call(target, event);
|
|
3495
|
-
};
|
|
3496
|
-
this.rootEventCleanups.push(addEvent(target, eventName, handler));
|
|
3486
|
+
this.bindRootEvent(
|
|
3487
|
+
root,
|
|
3488
|
+
eventName,
|
|
3489
|
+
value
|
|
3490
|
+
);
|
|
3497
3491
|
}
|
|
3498
3492
|
}
|
|
3499
3493
|
}
|
|
3494
|
+
bindRootEvent(target, eventName, handler) {
|
|
3495
|
+
const slot = `_$${eventName}`;
|
|
3496
|
+
const prev = target[slot];
|
|
3497
|
+
if (isFunction(prev)) {
|
|
3498
|
+
target[slot] = handler;
|
|
3499
|
+
this.rootEventCleanups.push(() => {
|
|
3500
|
+
if (target[slot] === handler) target[slot] = prev;
|
|
3501
|
+
});
|
|
3502
|
+
return;
|
|
3503
|
+
}
|
|
3504
|
+
this.rootEventCleanups.push(
|
|
3505
|
+
addEvent(target, eventName, (event) => {
|
|
3506
|
+
if (target.disabled) return;
|
|
3507
|
+
handler.call(target, event);
|
|
3508
|
+
})
|
|
3509
|
+
);
|
|
3510
|
+
}
|
|
3500
3511
|
/**
|
|
3501
3512
|
* Remove all listeners/ref bindings currently attached to the root element.
|
|
3502
3513
|
*/
|
|
@@ -3719,6 +3730,7 @@ function eventHandler(e) {
|
|
|
3719
3730
|
}
|
|
3720
3731
|
var $EVENTS = /* @__PURE__ */ Symbol("_$EVENTS");
|
|
3721
3732
|
function delegateEvents(eventNames, document2 = globalThis.document) {
|
|
3733
|
+
if (!document2) return;
|
|
3722
3734
|
const docWithEvents = document2;
|
|
3723
3735
|
const eventSet = docWithEvents[$EVENTS] || (docWithEvents[$EVENTS] = /* @__PURE__ */ new Set());
|
|
3724
3736
|
for (const name of eventNames) {
|
|
@@ -3729,6 +3741,7 @@ function delegateEvents(eventNames, document2 = globalThis.document) {
|
|
|
3729
3741
|
}
|
|
3730
3742
|
}
|
|
3731
3743
|
function clearDelegatedEvents(document2 = globalThis.document) {
|
|
3744
|
+
if (!document2) return;
|
|
3732
3745
|
const docWithEvents = document2;
|
|
3733
3746
|
const eventSet = docWithEvents[$EVENTS];
|
|
3734
3747
|
if (eventSet) {
|