@vue/reactivity 3.3.4 → 3.3.6
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/reactivity.cjs.js +52 -64
- package/dist/reactivity.cjs.prod.js +52 -64
- package/dist/reactivity.d.ts +50 -74
- package/dist/reactivity.esm-browser.js +55 -67
- package/dist/reactivity.esm-browser.prod.js +1 -1
- package/dist/reactivity.esm-bundler.js +53 -65
- package/dist/reactivity.global.js +55 -67
- package/dist/reactivity.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/reactivity.cjs.js
CHANGED
|
@@ -215,7 +215,7 @@ function cleanupEffect(effect2) {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
function effect(fn, options) {
|
|
218
|
-
if (fn.effect) {
|
|
218
|
+
if (fn.effect instanceof ReactiveEffect) {
|
|
219
219
|
fn = fn.effect.fn;
|
|
220
220
|
}
|
|
221
221
|
const _effect = new ReactiveEffect(fn);
|
|
@@ -385,10 +385,6 @@ const isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,_
|
|
|
385
385
|
const builtInSymbols = new Set(
|
|
386
386
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol)
|
|
387
387
|
);
|
|
388
|
-
const get$1 = /* @__PURE__ */ createGetter();
|
|
389
|
-
const shallowGet = /* @__PURE__ */ createGetter(false, true);
|
|
390
|
-
const readonlyGet = /* @__PURE__ */ createGetter(true);
|
|
391
|
-
const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
|
|
392
388
|
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
393
389
|
function createArrayInstrumentations() {
|
|
394
390
|
const instrumentations = {};
|
|
@@ -421,8 +417,13 @@ function hasOwnProperty(key) {
|
|
|
421
417
|
track(obj, "has", key);
|
|
422
418
|
return obj.hasOwnProperty(key);
|
|
423
419
|
}
|
|
424
|
-
|
|
425
|
-
|
|
420
|
+
class BaseReactiveHandler {
|
|
421
|
+
constructor(_isReadonly = false, _shallow = false) {
|
|
422
|
+
this._isReadonly = _isReadonly;
|
|
423
|
+
this._shallow = _shallow;
|
|
424
|
+
}
|
|
425
|
+
get(target, key, receiver) {
|
|
426
|
+
const isReadonly2 = this._isReadonly, shallow = this._shallow;
|
|
426
427
|
if (key === "__v_isReactive") {
|
|
427
428
|
return !isReadonly2;
|
|
428
429
|
} else if (key === "__v_isReadonly") {
|
|
@@ -458,17 +459,18 @@ function createGetter(isReadonly2 = false, shallow = false) {
|
|
|
458
459
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
459
460
|
}
|
|
460
461
|
return res;
|
|
461
|
-
}
|
|
462
|
+
}
|
|
462
463
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
464
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
465
|
+
constructor(shallow = false) {
|
|
466
|
+
super(false, shallow);
|
|
467
|
+
}
|
|
468
|
+
set(target, key, value, receiver) {
|
|
467
469
|
let oldValue = target[key];
|
|
468
470
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
469
471
|
return false;
|
|
470
472
|
}
|
|
471
|
-
if (!
|
|
473
|
+
if (!this._shallow) {
|
|
472
474
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
473
475
|
oldValue = toRaw(oldValue);
|
|
474
476
|
value = toRaw(value);
|
|
@@ -488,37 +490,36 @@ function createSetter(shallow = false) {
|
|
|
488
490
|
}
|
|
489
491
|
}
|
|
490
492
|
return result;
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
function deleteProperty(target, key) {
|
|
494
|
-
const hadKey = shared.hasOwn(target, key);
|
|
495
|
-
const oldValue = target[key];
|
|
496
|
-
const result = Reflect.deleteProperty(target, key);
|
|
497
|
-
if (result && hadKey) {
|
|
498
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
499
493
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
494
|
+
deleteProperty(target, key) {
|
|
495
|
+
const hadKey = shared.hasOwn(target, key);
|
|
496
|
+
const oldValue = target[key];
|
|
497
|
+
const result = Reflect.deleteProperty(target, key);
|
|
498
|
+
if (result && hadKey) {
|
|
499
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
500
|
+
}
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
has(target, key) {
|
|
504
|
+
const result = Reflect.has(target, key);
|
|
505
|
+
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
|
|
506
|
+
track(target, "has", key);
|
|
507
|
+
}
|
|
508
|
+
return result;
|
|
509
|
+
}
|
|
510
|
+
ownKeys(target) {
|
|
511
|
+
track(
|
|
512
|
+
target,
|
|
513
|
+
"iterate",
|
|
514
|
+
shared.isArray(target) ? "length" : ITERATE_KEY
|
|
515
|
+
);
|
|
516
|
+
return Reflect.ownKeys(target);
|
|
506
517
|
}
|
|
507
|
-
return result;
|
|
508
|
-
}
|
|
509
|
-
function ownKeys(target) {
|
|
510
|
-
track(target, "iterate", shared.isArray(target) ? "length" : ITERATE_KEY);
|
|
511
|
-
return Reflect.ownKeys(target);
|
|
512
518
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
has: has$1,
|
|
518
|
-
ownKeys
|
|
519
|
-
};
|
|
520
|
-
const readonlyHandlers = {
|
|
521
|
-
get: readonlyGet,
|
|
519
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
520
|
+
constructor(shallow = false) {
|
|
521
|
+
super(true, shallow);
|
|
522
|
+
}
|
|
522
523
|
set(target, key) {
|
|
523
524
|
{
|
|
524
525
|
warn(
|
|
@@ -527,7 +528,7 @@ const readonlyHandlers = {
|
|
|
527
528
|
);
|
|
528
529
|
}
|
|
529
530
|
return true;
|
|
530
|
-
}
|
|
531
|
+
}
|
|
531
532
|
deleteProperty(target, key) {
|
|
532
533
|
{
|
|
533
534
|
warn(
|
|
@@ -537,22 +538,13 @@ const readonlyHandlers = {
|
|
|
537
538
|
}
|
|
538
539
|
return true;
|
|
539
540
|
}
|
|
540
|
-
}
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
get: shallowGet,
|
|
546
|
-
set: shallowSet
|
|
547
|
-
}
|
|
548
|
-
);
|
|
549
|
-
const shallowReadonlyHandlers = /* @__PURE__ */ shared.extend(
|
|
550
|
-
{},
|
|
551
|
-
readonlyHandlers,
|
|
552
|
-
{
|
|
553
|
-
get: shallowReadonlyGet
|
|
554
|
-
}
|
|
541
|
+
}
|
|
542
|
+
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
543
|
+
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
544
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
545
|
+
true
|
|
555
546
|
);
|
|
547
|
+
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
556
548
|
|
|
557
549
|
const toShallow = (value) => value;
|
|
558
550
|
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
@@ -561,7 +553,7 @@ function get(target, key, isReadonly = false, isShallow = false) {
|
|
|
561
553
|
const rawTarget = toRaw(target);
|
|
562
554
|
const rawKey = toRaw(key);
|
|
563
555
|
if (!isReadonly) {
|
|
564
|
-
if (key
|
|
556
|
+
if (shared.hasChanged(key, rawKey)) {
|
|
565
557
|
track(rawTarget, "get", key);
|
|
566
558
|
}
|
|
567
559
|
track(rawTarget, "get", rawKey);
|
|
@@ -581,7 +573,7 @@ function has(key, isReadonly = false) {
|
|
|
581
573
|
const rawTarget = toRaw(target);
|
|
582
574
|
const rawKey = toRaw(key);
|
|
583
575
|
if (!isReadonly) {
|
|
584
|
-
if (key
|
|
576
|
+
if (shared.hasChanged(key, rawKey)) {
|
|
585
577
|
track(rawTarget, "has", key);
|
|
586
578
|
}
|
|
587
579
|
track(rawTarget, "has", rawKey);
|
|
@@ -1111,11 +1103,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1111
1103
|
}
|
|
1112
1104
|
function propertyToRef(source, key, defaultValue) {
|
|
1113
1105
|
const val = source[key];
|
|
1114
|
-
return isRef(val) ? val : new ObjectRefImpl(
|
|
1115
|
-
source,
|
|
1116
|
-
key,
|
|
1117
|
-
defaultValue
|
|
1118
|
-
);
|
|
1106
|
+
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1119
1107
|
}
|
|
1120
1108
|
|
|
1121
1109
|
class ComputedRefImpl {
|
|
@@ -205,7 +205,7 @@ function cleanupEffect(effect2) {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
function effect(fn, options) {
|
|
208
|
-
if (fn.effect) {
|
|
208
|
+
if (fn.effect instanceof ReactiveEffect) {
|
|
209
209
|
fn = fn.effect.fn;
|
|
210
210
|
}
|
|
211
211
|
const _effect = new ReactiveEffect(fn);
|
|
@@ -360,10 +360,6 @@ const isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,_
|
|
|
360
360
|
const builtInSymbols = new Set(
|
|
361
361
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol)
|
|
362
362
|
);
|
|
363
|
-
const get$1 = /* @__PURE__ */ createGetter();
|
|
364
|
-
const shallowGet = /* @__PURE__ */ createGetter(false, true);
|
|
365
|
-
const readonlyGet = /* @__PURE__ */ createGetter(true);
|
|
366
|
-
const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
|
|
367
363
|
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
368
364
|
function createArrayInstrumentations() {
|
|
369
365
|
const instrumentations = {};
|
|
@@ -396,8 +392,13 @@ function hasOwnProperty(key) {
|
|
|
396
392
|
track(obj, "has", key);
|
|
397
393
|
return obj.hasOwnProperty(key);
|
|
398
394
|
}
|
|
399
|
-
|
|
400
|
-
|
|
395
|
+
class BaseReactiveHandler {
|
|
396
|
+
constructor(_isReadonly = false, _shallow = false) {
|
|
397
|
+
this._isReadonly = _isReadonly;
|
|
398
|
+
this._shallow = _shallow;
|
|
399
|
+
}
|
|
400
|
+
get(target, key, receiver) {
|
|
401
|
+
const isReadonly2 = this._isReadonly, shallow = this._shallow;
|
|
401
402
|
if (key === "__v_isReactive") {
|
|
402
403
|
return !isReadonly2;
|
|
403
404
|
} else if (key === "__v_isReadonly") {
|
|
@@ -433,17 +434,18 @@ function createGetter(isReadonly2 = false, shallow = false) {
|
|
|
433
434
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
434
435
|
}
|
|
435
436
|
return res;
|
|
436
|
-
}
|
|
437
|
+
}
|
|
437
438
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
439
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
440
|
+
constructor(shallow = false) {
|
|
441
|
+
super(false, shallow);
|
|
442
|
+
}
|
|
443
|
+
set(target, key, value, receiver) {
|
|
442
444
|
let oldValue = target[key];
|
|
443
445
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
444
446
|
return false;
|
|
445
447
|
}
|
|
446
|
-
if (!
|
|
448
|
+
if (!this._shallow) {
|
|
447
449
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
448
450
|
oldValue = toRaw(oldValue);
|
|
449
451
|
value = toRaw(value);
|
|
@@ -463,59 +465,49 @@ function createSetter(shallow = false) {
|
|
|
463
465
|
}
|
|
464
466
|
}
|
|
465
467
|
return result;
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
function deleteProperty(target, key) {
|
|
469
|
-
const hadKey = shared.hasOwn(target, key);
|
|
470
|
-
target[key];
|
|
471
|
-
const result = Reflect.deleteProperty(target, key);
|
|
472
|
-
if (result && hadKey) {
|
|
473
|
-
trigger(target, "delete", key, void 0);
|
|
474
468
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
469
|
+
deleteProperty(target, key) {
|
|
470
|
+
const hadKey = shared.hasOwn(target, key);
|
|
471
|
+
target[key];
|
|
472
|
+
const result = Reflect.deleteProperty(target, key);
|
|
473
|
+
if (result && hadKey) {
|
|
474
|
+
trigger(target, "delete", key, void 0);
|
|
475
|
+
}
|
|
476
|
+
return result;
|
|
477
|
+
}
|
|
478
|
+
has(target, key) {
|
|
479
|
+
const result = Reflect.has(target, key);
|
|
480
|
+
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
|
|
481
|
+
track(target, "has", key);
|
|
482
|
+
}
|
|
483
|
+
return result;
|
|
484
|
+
}
|
|
485
|
+
ownKeys(target) {
|
|
486
|
+
track(
|
|
487
|
+
target,
|
|
488
|
+
"iterate",
|
|
489
|
+
shared.isArray(target) ? "length" : ITERATE_KEY
|
|
490
|
+
);
|
|
491
|
+
return Reflect.ownKeys(target);
|
|
481
492
|
}
|
|
482
|
-
return result;
|
|
483
|
-
}
|
|
484
|
-
function ownKeys(target) {
|
|
485
|
-
track(target, "iterate", shared.isArray(target) ? "length" : ITERATE_KEY);
|
|
486
|
-
return Reflect.ownKeys(target);
|
|
487
493
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
has: has$1,
|
|
493
|
-
ownKeys
|
|
494
|
-
};
|
|
495
|
-
const readonlyHandlers = {
|
|
496
|
-
get: readonlyGet,
|
|
494
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
495
|
+
constructor(shallow = false) {
|
|
496
|
+
super(true, shallow);
|
|
497
|
+
}
|
|
497
498
|
set(target, key) {
|
|
498
499
|
return true;
|
|
499
|
-
}
|
|
500
|
+
}
|
|
500
501
|
deleteProperty(target, key) {
|
|
501
502
|
return true;
|
|
502
503
|
}
|
|
503
|
-
}
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
get: shallowGet,
|
|
509
|
-
set: shallowSet
|
|
510
|
-
}
|
|
511
|
-
);
|
|
512
|
-
const shallowReadonlyHandlers = /* @__PURE__ */ shared.extend(
|
|
513
|
-
{},
|
|
514
|
-
readonlyHandlers,
|
|
515
|
-
{
|
|
516
|
-
get: shallowReadonlyGet
|
|
517
|
-
}
|
|
504
|
+
}
|
|
505
|
+
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
506
|
+
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
507
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
508
|
+
true
|
|
518
509
|
);
|
|
510
|
+
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
519
511
|
|
|
520
512
|
const toShallow = (value) => value;
|
|
521
513
|
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
@@ -524,7 +516,7 @@ function get(target, key, isReadonly = false, isShallow = false) {
|
|
|
524
516
|
const rawTarget = toRaw(target);
|
|
525
517
|
const rawKey = toRaw(key);
|
|
526
518
|
if (!isReadonly) {
|
|
527
|
-
if (key
|
|
519
|
+
if (shared.hasChanged(key, rawKey)) {
|
|
528
520
|
track(rawTarget, "get", key);
|
|
529
521
|
}
|
|
530
522
|
track(rawTarget, "get", rawKey);
|
|
@@ -544,7 +536,7 @@ function has(key, isReadonly = false) {
|
|
|
544
536
|
const rawTarget = toRaw(target);
|
|
545
537
|
const rawKey = toRaw(key);
|
|
546
538
|
if (!isReadonly) {
|
|
547
|
-
if (key
|
|
539
|
+
if (shared.hasChanged(key, rawKey)) {
|
|
548
540
|
track(rawTarget, "has", key);
|
|
549
541
|
}
|
|
550
542
|
track(rawTarget, "has", rawKey);
|
|
@@ -1038,11 +1030,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1038
1030
|
}
|
|
1039
1031
|
function propertyToRef(source, key, defaultValue) {
|
|
1040
1032
|
const val = source[key];
|
|
1041
|
-
return isRef(val) ? val : new ObjectRefImpl(
|
|
1042
|
-
source,
|
|
1043
|
-
key,
|
|
1044
|
-
defaultValue
|
|
1045
|
-
);
|
|
1033
|
+
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1046
1034
|
}
|
|
1047
1035
|
|
|
1048
1036
|
class ComputedRefImpl {
|
package/dist/reactivity.d.ts
CHANGED
|
@@ -234,17 +234,9 @@ export declare const enum TriggerOpTypes {
|
|
|
234
234
|
|
|
235
235
|
export declare class EffectScope {
|
|
236
236
|
detached: boolean;
|
|
237
|
-
/* removed internal: _active */
|
|
238
|
-
/* removed internal: effects */
|
|
239
|
-
/* removed internal: cleanups */
|
|
240
|
-
/* removed internal: parent */
|
|
241
|
-
/* removed internal: scopes */
|
|
242
|
-
/* removed internal: index */
|
|
243
237
|
constructor(detached?: boolean);
|
|
244
238
|
get active(): boolean;
|
|
245
239
|
run<T>(fn: () => T): T | undefined;
|
|
246
|
-
/* removed internal: on */
|
|
247
|
-
/* removed internal: off */
|
|
248
240
|
stop(fromParent?: boolean): void;
|
|
249
241
|
}
|
|
250
242
|
/**
|
|
@@ -272,69 +264,6 @@ export declare function getCurrentScope(): EffectScope | undefined;
|
|
|
272
264
|
*/
|
|
273
265
|
export declare function onScopeDispose(fn: () => void): void;
|
|
274
266
|
|
|
275
|
-
declare const ComputedRefSymbol: unique symbol;
|
|
276
|
-
export interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
|
277
|
-
readonly value: T;
|
|
278
|
-
[ComputedRefSymbol]: true;
|
|
279
|
-
}
|
|
280
|
-
export interface WritableComputedRef<T> extends Ref<T> {
|
|
281
|
-
readonly effect: ReactiveEffect<T>;
|
|
282
|
-
}
|
|
283
|
-
export type ComputedGetter<T> = (...args: any[]) => T;
|
|
284
|
-
export type ComputedSetter<T> = (v: T) => void;
|
|
285
|
-
export interface WritableComputedOptions<T> {
|
|
286
|
-
get: ComputedGetter<T>;
|
|
287
|
-
set: ComputedSetter<T>;
|
|
288
|
-
}
|
|
289
|
-
declare class ComputedRefImpl<T> {
|
|
290
|
-
private readonly _setter;
|
|
291
|
-
dep?: Dep;
|
|
292
|
-
private _value;
|
|
293
|
-
readonly effect: ReactiveEffect<T>;
|
|
294
|
-
readonly __v_isRef = true;
|
|
295
|
-
readonly [ReactiveFlags.IS_READONLY]: boolean;
|
|
296
|
-
_dirty: boolean;
|
|
297
|
-
_cacheable: boolean;
|
|
298
|
-
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean);
|
|
299
|
-
get value(): T;
|
|
300
|
-
set value(newValue: T);
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Takes a getter function and returns a readonly reactive ref object for the
|
|
304
|
-
* returned value from the getter. It can also take an object with get and set
|
|
305
|
-
* functions to create a writable ref object.
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* ```js
|
|
309
|
-
* // Creating a readonly computed ref:
|
|
310
|
-
* const count = ref(1)
|
|
311
|
-
* const plusOne = computed(() => count.value + 1)
|
|
312
|
-
*
|
|
313
|
-
* console.log(plusOne.value) // 2
|
|
314
|
-
* plusOne.value++ // error
|
|
315
|
-
* ```
|
|
316
|
-
*
|
|
317
|
-
* ```js
|
|
318
|
-
* // Creating a writable computed ref:
|
|
319
|
-
* const count = ref(1)
|
|
320
|
-
* const plusOne = computed({
|
|
321
|
-
* get: () => count.value + 1,
|
|
322
|
-
* set: (val) => {
|
|
323
|
-
* count.value = val - 1
|
|
324
|
-
* }
|
|
325
|
-
* })
|
|
326
|
-
*
|
|
327
|
-
* plusOne.value = 1
|
|
328
|
-
* console.log(count.value) // 0
|
|
329
|
-
* ```
|
|
330
|
-
*
|
|
331
|
-
* @param getter - Function that produces the next value.
|
|
332
|
-
* @param debugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.
|
|
333
|
-
* @see {@link https://vuejs.org/api/reactivity-core.html#computed}
|
|
334
|
-
*/
|
|
335
|
-
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
|
336
|
-
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
|
337
|
-
|
|
338
267
|
export type EffectScheduler = (...args: any[]) => any;
|
|
339
268
|
export type DebuggerEvent = {
|
|
340
269
|
effect: ReactiveEffect;
|
|
@@ -354,9 +283,6 @@ export declare class ReactiveEffect<T = any> {
|
|
|
354
283
|
active: boolean;
|
|
355
284
|
deps: Dep[];
|
|
356
285
|
parent: ReactiveEffect | undefined;
|
|
357
|
-
/* removed internal: computed */
|
|
358
|
-
/* removed internal: allowRecurse */
|
|
359
|
-
/* removed internal: deferStop */
|
|
360
286
|
onStop?: () => void;
|
|
361
287
|
onTrack?: (event: DebuggerEvent) => void;
|
|
362
288
|
onTrigger?: (event: DebuggerEvent) => void;
|
|
@@ -672,5 +598,55 @@ type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref
|
|
|
672
598
|
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
|
673
599
|
} : T;
|
|
674
600
|
|
|
601
|
+
declare const ComputedRefSymbol: unique symbol;
|
|
602
|
+
export interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
|
603
|
+
readonly value: T;
|
|
604
|
+
[ComputedRefSymbol]: true;
|
|
605
|
+
}
|
|
606
|
+
export interface WritableComputedRef<T> extends Ref<T> {
|
|
607
|
+
readonly effect: ReactiveEffect<T>;
|
|
608
|
+
}
|
|
609
|
+
export type ComputedGetter<T> = (...args: any[]) => T;
|
|
610
|
+
export type ComputedSetter<T> = (v: T) => void;
|
|
611
|
+
export interface WritableComputedOptions<T> {
|
|
612
|
+
get: ComputedGetter<T>;
|
|
613
|
+
set: ComputedSetter<T>;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Takes a getter function and returns a readonly reactive ref object for the
|
|
617
|
+
* returned value from the getter. It can also take an object with get and set
|
|
618
|
+
* functions to create a writable ref object.
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```js
|
|
622
|
+
* // Creating a readonly computed ref:
|
|
623
|
+
* const count = ref(1)
|
|
624
|
+
* const plusOne = computed(() => count.value + 1)
|
|
625
|
+
*
|
|
626
|
+
* console.log(plusOne.value) // 2
|
|
627
|
+
* plusOne.value++ // error
|
|
628
|
+
* ```
|
|
629
|
+
*
|
|
630
|
+
* ```js
|
|
631
|
+
* // Creating a writable computed ref:
|
|
632
|
+
* const count = ref(1)
|
|
633
|
+
* const plusOne = computed({
|
|
634
|
+
* get: () => count.value + 1,
|
|
635
|
+
* set: (val) => {
|
|
636
|
+
* count.value = val - 1
|
|
637
|
+
* }
|
|
638
|
+
* })
|
|
639
|
+
*
|
|
640
|
+
* plusOne.value = 1
|
|
641
|
+
* console.log(count.value) // 0
|
|
642
|
+
* ```
|
|
643
|
+
*
|
|
644
|
+
* @param getter - Function that produces the next value.
|
|
645
|
+
* @param debugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.
|
|
646
|
+
* @see {@link https://vuejs.org/api/reactivity-core.html#computed}
|
|
647
|
+
*/
|
|
648
|
+
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
|
649
|
+
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
|
650
|
+
|
|
675
651
|
export declare function deferredComputed<T>(getter: () => T): ComputedRef<T>;
|
|
676
652
|
|
|
@@ -29,9 +29,9 @@ const cacheStringFunction = (fn) => {
|
|
|
29
29
|
return hit || (cache[str] = fn(str));
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
const capitalize = cacheStringFunction(
|
|
33
|
-
|
|
34
|
-
);
|
|
32
|
+
const capitalize = cacheStringFunction((str) => {
|
|
33
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
34
|
+
});
|
|
35
35
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
36
36
|
const def = (obj, key, value) => {
|
|
37
37
|
Object.defineProperty(obj, key, {
|
|
@@ -252,7 +252,7 @@ function cleanupEffect(effect2) {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
function effect(fn, options) {
|
|
255
|
-
if (fn.effect) {
|
|
255
|
+
if (fn.effect instanceof ReactiveEffect) {
|
|
256
256
|
fn = fn.effect.fn;
|
|
257
257
|
}
|
|
258
258
|
const _effect = new ReactiveEffect(fn);
|
|
@@ -422,10 +422,6 @@ const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`
|
|
|
422
422
|
const builtInSymbols = new Set(
|
|
423
423
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
424
424
|
);
|
|
425
|
-
const get$1 = /* @__PURE__ */ createGetter();
|
|
426
|
-
const shallowGet = /* @__PURE__ */ createGetter(false, true);
|
|
427
|
-
const readonlyGet = /* @__PURE__ */ createGetter(true);
|
|
428
|
-
const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
|
|
429
425
|
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
430
426
|
function createArrayInstrumentations() {
|
|
431
427
|
const instrumentations = {};
|
|
@@ -458,8 +454,13 @@ function hasOwnProperty(key) {
|
|
|
458
454
|
track(obj, "has", key);
|
|
459
455
|
return obj.hasOwnProperty(key);
|
|
460
456
|
}
|
|
461
|
-
|
|
462
|
-
|
|
457
|
+
class BaseReactiveHandler {
|
|
458
|
+
constructor(_isReadonly = false, _shallow = false) {
|
|
459
|
+
this._isReadonly = _isReadonly;
|
|
460
|
+
this._shallow = _shallow;
|
|
461
|
+
}
|
|
462
|
+
get(target, key, receiver) {
|
|
463
|
+
const isReadonly2 = this._isReadonly, shallow = this._shallow;
|
|
463
464
|
if (key === "__v_isReactive") {
|
|
464
465
|
return !isReadonly2;
|
|
465
466
|
} else if (key === "__v_isReadonly") {
|
|
@@ -495,17 +496,18 @@ function createGetter(isReadonly2 = false, shallow = false) {
|
|
|
495
496
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
496
497
|
}
|
|
497
498
|
return res;
|
|
498
|
-
}
|
|
499
|
+
}
|
|
499
500
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
501
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
502
|
+
constructor(shallow = false) {
|
|
503
|
+
super(false, shallow);
|
|
504
|
+
}
|
|
505
|
+
set(target, key, value, receiver) {
|
|
504
506
|
let oldValue = target[key];
|
|
505
507
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
506
508
|
return false;
|
|
507
509
|
}
|
|
508
|
-
if (!
|
|
510
|
+
if (!this._shallow) {
|
|
509
511
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
510
512
|
oldValue = toRaw(oldValue);
|
|
511
513
|
value = toRaw(value);
|
|
@@ -525,37 +527,36 @@ function createSetter(shallow = false) {
|
|
|
525
527
|
}
|
|
526
528
|
}
|
|
527
529
|
return result;
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
function deleteProperty(target, key) {
|
|
531
|
-
const hadKey = hasOwn(target, key);
|
|
532
|
-
const oldValue = target[key];
|
|
533
|
-
const result = Reflect.deleteProperty(target, key);
|
|
534
|
-
if (result && hadKey) {
|
|
535
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
536
530
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
531
|
+
deleteProperty(target, key) {
|
|
532
|
+
const hadKey = hasOwn(target, key);
|
|
533
|
+
const oldValue = target[key];
|
|
534
|
+
const result = Reflect.deleteProperty(target, key);
|
|
535
|
+
if (result && hadKey) {
|
|
536
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
537
|
+
}
|
|
538
|
+
return result;
|
|
539
|
+
}
|
|
540
|
+
has(target, key) {
|
|
541
|
+
const result = Reflect.has(target, key);
|
|
542
|
+
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
543
|
+
track(target, "has", key);
|
|
544
|
+
}
|
|
545
|
+
return result;
|
|
546
|
+
}
|
|
547
|
+
ownKeys(target) {
|
|
548
|
+
track(
|
|
549
|
+
target,
|
|
550
|
+
"iterate",
|
|
551
|
+
isArray(target) ? "length" : ITERATE_KEY
|
|
552
|
+
);
|
|
553
|
+
return Reflect.ownKeys(target);
|
|
543
554
|
}
|
|
544
|
-
return result;
|
|
545
|
-
}
|
|
546
|
-
function ownKeys(target) {
|
|
547
|
-
track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
|
|
548
|
-
return Reflect.ownKeys(target);
|
|
549
555
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
has: has$1,
|
|
555
|
-
ownKeys
|
|
556
|
-
};
|
|
557
|
-
const readonlyHandlers = {
|
|
558
|
-
get: readonlyGet,
|
|
556
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
557
|
+
constructor(shallow = false) {
|
|
558
|
+
super(true, shallow);
|
|
559
|
+
}
|
|
559
560
|
set(target, key) {
|
|
560
561
|
{
|
|
561
562
|
warn(
|
|
@@ -564,7 +565,7 @@ const readonlyHandlers = {
|
|
|
564
565
|
);
|
|
565
566
|
}
|
|
566
567
|
return true;
|
|
567
|
-
}
|
|
568
|
+
}
|
|
568
569
|
deleteProperty(target, key) {
|
|
569
570
|
{
|
|
570
571
|
warn(
|
|
@@ -574,22 +575,13 @@ const readonlyHandlers = {
|
|
|
574
575
|
}
|
|
575
576
|
return true;
|
|
576
577
|
}
|
|
577
|
-
}
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
get: shallowGet,
|
|
583
|
-
set: shallowSet
|
|
584
|
-
}
|
|
585
|
-
);
|
|
586
|
-
const shallowReadonlyHandlers = /* @__PURE__ */ extend(
|
|
587
|
-
{},
|
|
588
|
-
readonlyHandlers,
|
|
589
|
-
{
|
|
590
|
-
get: shallowReadonlyGet
|
|
591
|
-
}
|
|
578
|
+
}
|
|
579
|
+
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
580
|
+
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
581
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
582
|
+
true
|
|
592
583
|
);
|
|
584
|
+
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
593
585
|
|
|
594
586
|
const toShallow = (value) => value;
|
|
595
587
|
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
@@ -598,7 +590,7 @@ function get(target, key, isReadonly = false, isShallow = false) {
|
|
|
598
590
|
const rawTarget = toRaw(target);
|
|
599
591
|
const rawKey = toRaw(key);
|
|
600
592
|
if (!isReadonly) {
|
|
601
|
-
if (key
|
|
593
|
+
if (hasChanged(key, rawKey)) {
|
|
602
594
|
track(rawTarget, "get", key);
|
|
603
595
|
}
|
|
604
596
|
track(rawTarget, "get", rawKey);
|
|
@@ -618,7 +610,7 @@ function has(key, isReadonly = false) {
|
|
|
618
610
|
const rawTarget = toRaw(target);
|
|
619
611
|
const rawKey = toRaw(key);
|
|
620
612
|
if (!isReadonly) {
|
|
621
|
-
if (key
|
|
613
|
+
if (hasChanged(key, rawKey)) {
|
|
622
614
|
track(rawTarget, "has", key);
|
|
623
615
|
}
|
|
624
616
|
track(rawTarget, "has", rawKey);
|
|
@@ -1148,11 +1140,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1148
1140
|
}
|
|
1149
1141
|
function propertyToRef(source, key, defaultValue) {
|
|
1150
1142
|
const val = source[key];
|
|
1151
|
-
return isRef(val) ? val : new ObjectRefImpl(
|
|
1152
|
-
source,
|
|
1153
|
-
key,
|
|
1154
|
-
defaultValue
|
|
1155
|
-
);
|
|
1143
|
+
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1156
1144
|
}
|
|
1157
1145
|
|
|
1158
1146
|
class ComputedRefImpl {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"function"==typeof t,u=t=>"symbol"==typeof t,h=t=>null!==t&&"object"==typeof t,a=Object.prototype.toString,l=t=>a.call(t),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>!Object.is(t,e);let d;class p{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=d,!t&&d&&(this.index=(d.scopes||(d.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=d;try{return d=this,t()}finally{d=e}}}on(){d=this}off(){d=this.parent}stop(t){if(this._active){let e,n;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].stop();for(e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function v(t){return new p(t)}function g(t,e=d){e&&e.active&&e.effects.push(t)}function y(){return d}function w(t){d&&d.cleanups.push(t)}const b=t=>{const e=new Set(t);return e.w=0,e.n=0,e},R=t=>(t.w&O)>0,m=t=>(t.n&O)>0,S=new WeakMap;let k=0,O=1;let j;const x=Symbol(""),P=Symbol("");class E{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,g(this,n)}run(){if(!this.active)return this.fn();let t=j,e=V;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=j,j=this,V=!0,O=1<<++k,k<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=O})(this):M(this),this.fn()}finally{k<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];R(i)&&!m(i)?i.delete(t):e[n++]=i,i.w&=~O,i.n&=~O}e.length=n}})(this),O=1<<--k,j=this.parent,V=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){j===this?this.deferStop=!0:this.active&&(M(this),this.onStop&&this.onStop(),this.active=!1)}}function M(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function z(t,e){t.effect&&(t=t.effect.fn);const s=new E(t);e&&(n(s,e),e.scope&&g(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i}function W(t){t.effect.stop()}let V=!0;const N=[];function A(){N.push(V),V=!1}function I(){N.push(V),V=!0}function K(){const t=N.pop();V=void 0===t||t}function C(t,e,n){if(V&&j){let e=S.get(t);e||S.set(t,e=new Map);let s=e.get(n);s||e.set(n,s=b()),L(s)}}function L(t,e){let n=!1;k<=30?m(t)||(t.n|=O,n=!R(t)):n=!t.has(j),n&&(t.add(j),j.deps.push(t))}function q(t,e,n,s,i,o){const u=S.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===n&&r(t)){const t=Number(s);u.forEach(((e,n)=>{("length"===n||n>=t)&&h.push(e)}))}else switch(void 0!==n&&h.push(u.get(n)),e){case"add":r(t)?f(n)&&h.push(u.get("length")):(h.push(u.get(x)),c(t)&&h.push(u.get(P)));break;case"delete":r(t)||(h.push(u.get(x)),c(t)&&h.push(u.get(P)));break;case"set":c(t)&&h.push(u.get(x))}if(1===h.length)h[0]&&B(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);B(b(t))}}function B(t,e){const n=r(t)?t:[...t];for(const s of n)s.computed&&D(s);for(const s of n)s.computed||D(s)}function D(t,e){(t!==j||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const F=t("__proto__,__v_isRef,__isVue"),G=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(u)),H=Z(),J=Z(!1,!0),Q=Z(!0),T=Z(!0,!0),U=X();function X(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=qt(this);for(let e=0,i=this.length;e<i;e++)C(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(qt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){A();const n=qt(this)[e].apply(this,t);return K(),n}})),t}function Y(t){const e=qt(this);return C(e,0,t),e.hasOwnProperty(t)}function Z(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_isShallow"===s)return e;if("__v_raw"===s&&c===(t?e?Et:Pt:e?xt:jt).get(n))return n;const o=r(n);if(!t){if(o&&i(U,s))return Reflect.get(U,s,c);if("hasOwnProperty"===s)return Y}const a=Reflect.get(n,s,c);return(u(s)?G.has(s):F(s))?a:(t||C(n,0,s),e?a:Jt(a)?o&&f(s)?a:a.value:h(a)?t?Vt(a):zt(a):a)}}function $(t=!1){return function(e,n,s,c){let o=e[n];if(Kt(o)&&Jt(o)&&!Jt(s))return!1;if(!t&&(Ct(s)||Kt(s)||(o=qt(o),s=qt(s)),!r(e)&&Jt(o)&&!Jt(s)))return o.value=s,!0;const u=r(e)&&f(n)?Number(n)<e.length:i(e,n),h=Reflect.set(e,n,s,c);return e===qt(c)&&(u?_(s,o)&&q(e,"set",n,s):q(e,"add",n,s)),h}}const tt={get:H,set:$(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&q(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return u(e)&&G.has(e)||C(t,0,e),n},ownKeys:function(t){return C(t,0,r(t)?"length":x),Reflect.ownKeys(t)}},et={get:Q,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},nt=n({},tt,{get:J,set:$(!0)}),st=n({},et,{get:T}),it=t=>t,rt=t=>Reflect.getPrototypeOf(t);function ct(t,e,n=!1,s=!1){const i=qt(t=t.__v_raw),r=qt(e);n||(e!==r&&C(i,0,e),C(i,0,r));const{has:c}=rt(i),o=s?it:n?Ft:Dt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function ot(t,e=!1){const n=this.__v_raw,s=qt(n),i=qt(t);return e||(t!==i&&C(s,0,t),C(s,0,i)),t===i?n.has(t):n.has(t)||n.has(i)}function ut(t,e=!1){return t=t.__v_raw,!e&&C(qt(t),0,x),Reflect.get(t,"size",t)}function ht(t){t=qt(t);const e=qt(this);return rt(e).has.call(e,t)||(e.add(t),q(e,"add",t,t)),this}function at(t,e){e=qt(e);const n=qt(this),{has:s,get:i}=rt(n);let r=s.call(n,t);r||(t=qt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?_(e,c)&&q(n,"set",t,e):q(n,"add",t,e),this}function lt(t){const e=qt(this),{has:n,get:s}=rt(e);let i=n.call(e,t);i||(t=qt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&q(e,"delete",t,void 0),r}function ft(){const t=qt(this),e=0!==t.size,n=t.clear();return e&&q(t,"clear",void 0,void 0),n}function _t(t,e){return function(n,s){const i=this,r=i.__v_raw,c=qt(r),o=e?it:t?Ft:Dt;return!t&&C(c,0,x),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function dt(t,e,n){return function(...s){const i=this.__v_raw,r=qt(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,a=i[t](...s),l=n?it:e?Ft:Dt;return!e&&C(r,0,h?P:x),{next(){const{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:u?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function pt(t){return function(...e){return"delete"!==t&&this}}function vt(){const t={get(t){return ct(this,t)},get size(){return ut(this)},has:ot,add:ht,set:at,delete:lt,clear:ft,forEach:_t(!1,!1)},e={get(t){return ct(this,t,!1,!0)},get size(){return ut(this)},has:ot,add:ht,set:at,delete:lt,clear:ft,forEach:_t(!1,!0)},n={get(t){return ct(this,t,!0)},get size(){return ut(this,!0)},has(t){return ot.call(this,t,!0)},add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear"),forEach:_t(!0,!1)},s={get(t){return ct(this,t,!0,!0)},get size(){return ut(this,!0)},has(t){return ot.call(this,t,!0)},add:pt("add"),set:pt("set"),delete:pt("delete"),clear:pt("clear"),forEach:_t(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=dt(i,!1,!1),n[i]=dt(i,!0,!1),e[i]=dt(i,!1,!0),s[i]=dt(i,!0,!0)})),[t,n,e,s]}const[gt,yt,wt,bt]=vt();function Rt(t,e){const n=e?t?bt:wt:t?yt:gt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const mt={get:Rt(!1,!1)},St={get:Rt(!1,!0)},kt={get:Rt(!0,!1)},Ot={get:Rt(!0,!0)},jt=new WeakMap,xt=new WeakMap,Pt=new WeakMap,Et=new WeakMap;function Mt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>l(t).slice(8,-1))(t))}function zt(t){return Kt(t)?t:At(t,!1,tt,mt,jt)}function Wt(t){return At(t,!1,nt,St,xt)}function Vt(t){return At(t,!0,et,kt,Pt)}function Nt(t){return At(t,!0,st,Ot,Et)}function At(t,e,n,s,i){if(!h(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=Mt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function It(t){return Kt(t)?It(t.__v_raw):!(!t||!t.__v_isReactive)}function Kt(t){return!(!t||!t.__v_isReadonly)}function Ct(t){return!(!t||!t.__v_isShallow)}function Lt(t){return It(t)||Kt(t)}function qt(t){const e=t&&t.__v_raw;return e?qt(e):t}function Bt(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const Dt=t=>h(t)?zt(t):t,Ft=t=>h(t)?Vt(t):t;function Gt(t){V&&j&&L((t=qt(t)).dep||(t.dep=b()))}function Ht(t,e){const n=(t=qt(t)).dep;n&&B(n)}function Jt(t){return!(!t||!0!==t.__v_isRef)}function Qt(t){return Ut(t,!1)}function Tt(t){return Ut(t,!0)}function Ut(t,e){return Jt(t)?t:new Xt(t,e)}class Xt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:qt(t),this._value=e?t:Dt(t)}get value(){return Gt(this),this._value}set value(t){const e=this.__v_isShallow||Ct(t)||Kt(t);t=e?t:qt(t),_(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:Dt(t),Ht(this))}}function Yt(t){Ht(t)}function Zt(t){return Jt(t)?t.value:t}function $t(t){return o(t)?t():Zt(t)}const te={get:(t,e,n)=>Zt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Jt(i)&&!Jt(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};function ee(t){return It(t)?t:new Proxy(t,te)}class ne{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Gt(this)),(()=>Ht(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function se(t){return new ne(t)}function ie(t){const e=r(t)?new Array(t.length):{};for(const n in t)e[n]=ue(t,n);return e}class re{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return t=qt(this._object),e=this._key,null==(n=S.get(t))?void 0:n.get(e);var t,e,n}}class ce{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function oe(t,e,n){return Jt(t)?t:o(t)?new ce(t):h(t)&&arguments.length>1?ue(t,e,n):Qt(t)}function ue(t,e,n){const s=t[e];return Jt(s)?s:new re(t,e,n)}class he{constructor(t,e,n,s){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new E(t,(()=>{this._dirty||(this._dirty=!0,Ht(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=n}get value(){const t=qt(this);return Gt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function ae(t,n,s=!1){let i,r;const c=o(t);c?(i=t,r=e):(i=t.get,r=t.set);return new he(i,r,c||!r,s)}const le=Promise.resolve(),fe=[];let _e=!1;const de=()=>{for(let t=0;t<fe.length;t++)fe[t]();fe.length=0,_e=!1};class pe{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.__v_isReadonly=!0;let n=!1,s=!1;this.effect=new E(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,fe.push((()=>{this.effect.active&&this._get()!==t&&Ht(this),s=!1})),_e||(_e=!0,le.then(de))}for(const t of this.dep)t.computed instanceof pe&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Gt(this),qt(this)._get()}}function ve(t){return new pe(t)}export{p as EffectScope,x as ITERATE_KEY,E as ReactiveEffect,ae as computed,se as customRef,ve as deferredComputed,z as effect,v as effectScope,I as enableTracking,y as getCurrentScope,Lt as isProxy,It as isReactive,Kt as isReadonly,Jt as isRef,Ct as isShallow,Bt as markRaw,w as onScopeDispose,A as pauseTracking,ee as proxyRefs,zt as reactive,Vt as readonly,Qt as ref,K as resetTracking,Wt as shallowReactive,Nt as shallowReadonly,Tt as shallowRef,W as stop,qt as toRaw,oe as toRef,ie as toRefs,$t as toValue,C as track,q as trigger,Yt as triggerRef,Zt as unref};
|
|
1
|
+
function t(t,e){const s=Object.create(null),n=t.split(",");for(let i=0;i<n.length;i++)s[n[i]]=!0;return e?t=>!!s[t.toLowerCase()]:t=>!!s[t]}const e=()=>{},s=Object.assign,n=Object.prototype.hasOwnProperty,i=(t,e)=>n.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"function"==typeof t,u=t=>"symbol"==typeof t,h=t=>null!==t&&"object"==typeof t,a=Object.prototype.toString,l=t=>a.call(t),f=t=>l(t).slice(8,-1),_=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,d=(t,e)=>!Object.is(t,e);let p;class v{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=p,!t&&p&&(this.index=(p.scopes||(p.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=p;try{return p=this,t()}finally{p=e}}}on(){p=this}off(){p=this.parent}stop(t){if(this._active){let e,s;for(e=0,s=this.effects.length;e<s;e++)this.effects[e].stop();for(e=0,s=this.cleanups.length;e<s;e++)this.cleanups[e]();if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function g(t){return new v(t)}function y(t,e=p){e&&e.active&&e.effects.push(t)}function w(){return p}function b(t){p&&p.cleanups.push(t)}const R=t=>{const e=new Set(t);return e.w=0,e.n=0,e},m=t=>(t.w&j)>0,S=t=>(t.n&j)>0,k=new WeakMap;let O=0,j=1;const x=30;let P;const E=Symbol(""),M=Symbol("");class z{constructor(t,e=null,s){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,y(this,s)}run(){if(!this.active)return this.fn();let t=P,e=A;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=P,P=this,A=!0,j=1<<++O,O<=x?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=j})(this):W(this),this.fn()}finally{O<=x&&(t=>{const{deps:e}=t;if(e.length){let s=0;for(let n=0;n<e.length;n++){const i=e[n];m(i)&&!S(i)?i.delete(t):e[s++]=i,i.w&=~j,i.n&=~j}e.length=s}})(this),j=1<<--O,P=this.parent,A=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){P===this?this.deferStop=!0:this.active&&(W(this),this.onStop&&this.onStop(),this.active=!1)}}function W(t){const{deps:e}=t;if(e.length){for(let s=0;s<e.length;s++)e[s].delete(t);e.length=0}}function V(t,e){t.effect instanceof z&&(t=t.effect.fn);const n=new z(t);e&&(s(n,e),e.scope&&y(n,e.scope)),e&&e.lazy||n.run();const i=n.run.bind(n);return i.effect=n,i}function N(t){t.effect.stop()}let A=!0;const I=[];function K(){I.push(A),A=!1}function C(){I.push(A),A=!0}function L(){const t=I.pop();A=void 0===t||t}function q(t,e,s){if(A&&P){let e=k.get(t);e||k.set(t,e=new Map);let n=e.get(s);n||e.set(s,n=R()),B(n)}}function B(t,e){let s=!1;O<=x?S(t)||(t.n|=j,s=!m(t)):s=!t.has(P),s&&(t.add(P),P.deps.push(t))}function D(t,e,s,n,i,o){const u=k.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===s&&r(t)){const t=Number(n);u.forEach(((e,s)=>{("length"===s||s>=t)&&h.push(e)}))}else switch(void 0!==s&&h.push(u.get(s)),e){case"add":r(t)?_(s)&&h.push(u.get("length")):(h.push(u.get(E)),c(t)&&h.push(u.get(M)));break;case"delete":r(t)||(h.push(u.get(E)),c(t)&&h.push(u.get(M)));break;case"set":c(t)&&h.push(u.get(E))}if(1===h.length)h[0]&&F(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);F(R(t))}}function F(t,e){const s=r(t)?t:[...t];for(const n of s)n.computed&&G(n);for(const n of s)n.computed||G(n)}function G(t,e){(t!==P||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const H=t("__proto__,__v_isRef,__isVue"),J=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(u)),Q=T();function T(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const s=Ct(this);for(let e=0,i=this.length;e<i;e++)q(s,0,e+"");const n=s[e](...t);return-1===n||!1===n?s[e](...t.map(Ct)):n}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){K();const s=Ct(this)[e].apply(this,t);return L(),s}})),t}function U(t){const e=Ct(this);return q(e,0,t),e.hasOwnProperty(t)}class X{constructor(t=!1,e=!1){this._isReadonly=t,this._shallow=e}get(t,e,s){const n=this._isReadonly,c=this._shallow;if("__v_isReactive"===e)return!n;if("__v_isReadonly"===e)return n;if("__v_isShallow"===e)return c;if("__v_raw"===e&&s===(n?c?Pt:xt:c?jt:Ot).get(t))return t;const o=r(t);if(!n){if(o&&i(Q,e))return Reflect.get(Q,e,s);if("hasOwnProperty"===e)return U}const a=Reflect.get(t,e,s);return(u(e)?J.has(e):H(e))?a:(n||q(t,0,e),c?a:Gt(a)?o&&_(e)?a:a.value:h(a)?n?zt(a):Et(a):a)}}class Y extends X{constructor(t=!1){super(!1,t)}set(t,e,s,n){let c=t[e];if(At(c)&&Gt(c)&&!Gt(s))return!1;if(!this._shallow&&(It(s)||At(s)||(c=Ct(c),s=Ct(s)),!r(t)&&Gt(c)&&!Gt(s)))return c.value=s,!0;const o=r(t)&&_(e)?Number(e)<t.length:i(t,e),u=Reflect.set(t,e,s,n);return t===Ct(n)&&(o?d(s,c)&&D(t,"set",e,s):D(t,"add",e,s)),u}deleteProperty(t,e){const s=i(t,e),n=Reflect.deleteProperty(t,e);return n&&s&&D(t,"delete",e,void 0),n}has(t,e){const s=Reflect.has(t,e);return u(e)&&J.has(e)||q(t,0,e),s}ownKeys(t){return q(t,0,r(t)?"length":E),Reflect.ownKeys(t)}}class Z extends X{constructor(t=!1){super(!0,t)}set(t,e){return!0}deleteProperty(t,e){return!0}}const $=new Y,tt=new Z,et=new Y(!0),st=new Z(!0),nt=t=>t,it=t=>Reflect.getPrototypeOf(t);function rt(t,e,s=!1,n=!1){const i=Ct(t=t.__v_raw),r=Ct(e);s||(d(e,r)&&q(i,0,e),q(i,0,r));const{has:c}=it(i),o=n?nt:s?Bt:qt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function ct(t,e=!1){const s=this.__v_raw,n=Ct(s),i=Ct(t);return e||(d(t,i)&&q(n,0,t),q(n,0,i)),t===i?s.has(t):s.has(t)||s.has(i)}function ot(t,e=!1){return t=t.__v_raw,!e&&q(Ct(t),0,E),Reflect.get(t,"size",t)}function ut(t){t=Ct(t);const e=Ct(this);return it(e).has.call(e,t)||(e.add(t),D(e,"add",t,t)),this}function ht(t,e){e=Ct(e);const s=Ct(this),{has:n,get:i}=it(s);let r=n.call(s,t);r||(t=Ct(t),r=n.call(s,t));const c=i.call(s,t);return s.set(t,e),r?d(e,c)&&D(s,"set",t,e):D(s,"add",t,e),this}function at(t){const e=Ct(this),{has:s,get:n}=it(e);let i=s.call(e,t);i||(t=Ct(t),i=s.call(e,t)),n&&n.call(e,t);const r=e.delete(t);return i&&D(e,"delete",t,void 0),r}function lt(){const t=Ct(this),e=0!==t.size,s=t.clear();return e&&D(t,"clear",void 0,void 0),s}function ft(t,e){return function(s,n){const i=this,r=i.__v_raw,c=Ct(r),o=e?nt:t?Bt:qt;return!t&&q(c,0,E),r.forEach(((t,e)=>s.call(n,o(t),o(e),i)))}}function _t(t,e,s){return function(...n){const i=this.__v_raw,r=Ct(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,a=i[t](...n),l=s?nt:e?Bt:qt;return!e&&q(r,0,h?M:E),{next(){const{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:u?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function dt(t){return function(...e){return"delete"!==t&&this}}function pt(){const t={get(t){return rt(this,t)},get size(){return ot(this)},has:ct,add:ut,set:ht,delete:at,clear:lt,forEach:ft(!1,!1)},e={get(t){return rt(this,t,!1,!0)},get size(){return ot(this)},has:ct,add:ut,set:ht,delete:at,clear:lt,forEach:ft(!1,!0)},s={get(t){return rt(this,t,!0)},get size(){return ot(this,!0)},has(t){return ct.call(this,t,!0)},add:dt("add"),set:dt("set"),delete:dt("delete"),clear:dt("clear"),forEach:ft(!0,!1)},n={get(t){return rt(this,t,!0,!0)},get size(){return ot(this,!0)},has(t){return ct.call(this,t,!0)},add:dt("add"),set:dt("set"),delete:dt("delete"),clear:dt("clear"),forEach:ft(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=_t(i,!1,!1),s[i]=_t(i,!0,!1),e[i]=_t(i,!1,!0),n[i]=_t(i,!0,!0)})),[t,s,e,n]}const[vt,gt,yt,wt]=pt();function bt(t,e){const s=e?t?wt:yt:t?gt:vt;return(e,n,r)=>"__v_isReactive"===n?!t:"__v_isReadonly"===n?t:"__v_raw"===n?e:Reflect.get(i(s,n)&&n in e?s:e,n,r)}const Rt={get:bt(!1,!1)},mt={get:bt(!1,!0)},St={get:bt(!0,!1)},kt={get:bt(!0,!0)},Ot=new WeakMap,jt=new WeakMap,xt=new WeakMap,Pt=new WeakMap;function Et(t){return At(t)?t:Vt(t,!1,$,Rt,Ot)}function Mt(t){return Vt(t,!1,et,mt,jt)}function zt(t){return Vt(t,!0,tt,St,xt)}function Wt(t){return Vt(t,!0,st,kt,Pt)}function Vt(t,e,s,n,i){if(!h(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=(o=t).__v_skip||!Object.isExtensible(o)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(f(o));var o;if(0===c)return t;const u=new Proxy(t,2===c?n:s);return i.set(t,u),u}function Nt(t){return At(t)?Nt(t.__v_raw):!(!t||!t.__v_isReactive)}function At(t){return!(!t||!t.__v_isReadonly)}function It(t){return!(!t||!t.__v_isShallow)}function Kt(t){return Nt(t)||At(t)}function Ct(t){const e=t&&t.__v_raw;return e?Ct(e):t}function Lt(t){return((t,e,s)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:s})})(t,"__v_skip",!0),t}const qt=t=>h(t)?Et(t):t,Bt=t=>h(t)?zt(t):t;function Dt(t){A&&P&&B((t=Ct(t)).dep||(t.dep=R()))}function Ft(t,e){const s=(t=Ct(t)).dep;s&&F(s)}function Gt(t){return!(!t||!0!==t.__v_isRef)}function Ht(t){return Qt(t,!1)}function Jt(t){return Qt(t,!0)}function Qt(t,e){return Gt(t)?t:new Tt(t,e)}class Tt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Ct(t),this._value=e?t:qt(t)}get value(){return Dt(this),this._value}set value(t){const e=this.__v_isShallow||It(t)||At(t);t=e?t:Ct(t),d(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:qt(t),Ft(this))}}function Ut(t){Ft(t)}function Xt(t){return Gt(t)?t.value:t}function Yt(t){return o(t)?t():Xt(t)}const Zt={get:(t,e,s)=>Xt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return Gt(i)&&!Gt(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};function $t(t){return Nt(t)?t:new Proxy(t,Zt)}class te{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:s}=t((()=>Dt(this)),(()=>Ft(this)));this._get=e,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}function ee(t){return new te(t)}function se(t){const e=r(t)?new Array(t.length):{};for(const s in t)e[s]=ce(t,s);return e}class ne{constructor(t,e,s){this._object=t,this._key=e,this._defaultValue=s,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return t=Ct(this._object),e=this._key,null==(s=k.get(t))?void 0:s.get(e);var t,e,s}}class ie{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function re(t,e,s){return Gt(t)?t:o(t)?new ie(t):h(t)&&arguments.length>1?ce(t,e,s):Ht(t)}function ce(t,e,s){const n=t[e];return Gt(n)?n:new ne(t,e,s)}class oe{constructor(t,e,s,n){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new z(t,(()=>{this._dirty||(this._dirty=!0,Ft(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s}get value(){const t=Ct(this);return Dt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function ue(t,s,n=!1){let i,r;const c=o(t);c?(i=t,r=e):(i=t.get,r=t.set);return new oe(i,r,c||!r,n)}const he=Promise.resolve(),ae=[];let le=!1;const fe=()=>{for(let t=0;t<ae.length;t++)ae[t]();ae.length=0,le=!1};class _e{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.__v_isReadonly=!0;let s=!1,n=!1;this.effect=new z(t,(t=>{if(this.dep){if(t)e=this._value,s=!0;else if(!n){const t=s?e:this._value;n=!0,s=!1,ae.push((()=>{this.effect.active&&this._get()!==t&&Ft(this),n=!1})),le||(le=!0,he.then(fe))}for(const t of this.dep)t.computed instanceof _e&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Dt(this),Ct(this)._get()}}function de(t){return new _e(t)}export{v as EffectScope,E as ITERATE_KEY,z as ReactiveEffect,ue as computed,ee as customRef,de as deferredComputed,V as effect,g as effectScope,C as enableTracking,w as getCurrentScope,Kt as isProxy,Nt as isReactive,At as isReadonly,Gt as isRef,It as isShallow,Lt as markRaw,b as onScopeDispose,K as pauseTracking,$t as proxyRefs,Et as reactive,zt as readonly,Ht as ref,L as resetTracking,Mt as shallowReactive,Wt as shallowReadonly,Jt as shallowRef,N as stop,Ct as toRaw,re as toRef,se as toRefs,Yt as toValue,q as track,D as trigger,Ut as triggerRef,Xt as unref};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extend, isArray, isMap, isIntegerKey, hasOwn,
|
|
1
|
+
import { extend, isArray, isMap, isIntegerKey, isSymbol, hasOwn, hasChanged, isObject, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';
|
|
2
2
|
|
|
3
3
|
function warn(msg, ...args) {
|
|
4
4
|
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
@@ -211,7 +211,7 @@ function cleanupEffect(effect2) {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
function effect(fn, options) {
|
|
214
|
-
if (fn.effect) {
|
|
214
|
+
if (fn.effect instanceof ReactiveEffect) {
|
|
215
215
|
fn = fn.effect.fn;
|
|
216
216
|
}
|
|
217
217
|
const _effect = new ReactiveEffect(fn);
|
|
@@ -385,10 +385,6 @@ const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`
|
|
|
385
385
|
const builtInSymbols = new Set(
|
|
386
386
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
387
387
|
);
|
|
388
|
-
const get$1 = /* @__PURE__ */ createGetter();
|
|
389
|
-
const shallowGet = /* @__PURE__ */ createGetter(false, true);
|
|
390
|
-
const readonlyGet = /* @__PURE__ */ createGetter(true);
|
|
391
|
-
const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
|
|
392
388
|
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
393
389
|
function createArrayInstrumentations() {
|
|
394
390
|
const instrumentations = {};
|
|
@@ -421,8 +417,13 @@ function hasOwnProperty(key) {
|
|
|
421
417
|
track(obj, "has", key);
|
|
422
418
|
return obj.hasOwnProperty(key);
|
|
423
419
|
}
|
|
424
|
-
|
|
425
|
-
|
|
420
|
+
class BaseReactiveHandler {
|
|
421
|
+
constructor(_isReadonly = false, _shallow = false) {
|
|
422
|
+
this._isReadonly = _isReadonly;
|
|
423
|
+
this._shallow = _shallow;
|
|
424
|
+
}
|
|
425
|
+
get(target, key, receiver) {
|
|
426
|
+
const isReadonly2 = this._isReadonly, shallow = this._shallow;
|
|
426
427
|
if (key === "__v_isReactive") {
|
|
427
428
|
return !isReadonly2;
|
|
428
429
|
} else if (key === "__v_isReadonly") {
|
|
@@ -458,17 +459,18 @@ function createGetter(isReadonly2 = false, shallow = false) {
|
|
|
458
459
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
459
460
|
}
|
|
460
461
|
return res;
|
|
461
|
-
}
|
|
462
|
+
}
|
|
462
463
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
464
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
465
|
+
constructor(shallow = false) {
|
|
466
|
+
super(false, shallow);
|
|
467
|
+
}
|
|
468
|
+
set(target, key, value, receiver) {
|
|
467
469
|
let oldValue = target[key];
|
|
468
470
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
469
471
|
return false;
|
|
470
472
|
}
|
|
471
|
-
if (!
|
|
473
|
+
if (!this._shallow) {
|
|
472
474
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
473
475
|
oldValue = toRaw(oldValue);
|
|
474
476
|
value = toRaw(value);
|
|
@@ -488,37 +490,36 @@ function createSetter(shallow = false) {
|
|
|
488
490
|
}
|
|
489
491
|
}
|
|
490
492
|
return result;
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
function deleteProperty(target, key) {
|
|
494
|
-
const hadKey = hasOwn(target, key);
|
|
495
|
-
const oldValue = target[key];
|
|
496
|
-
const result = Reflect.deleteProperty(target, key);
|
|
497
|
-
if (result && hadKey) {
|
|
498
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
499
493
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
494
|
+
deleteProperty(target, key) {
|
|
495
|
+
const hadKey = hasOwn(target, key);
|
|
496
|
+
const oldValue = target[key];
|
|
497
|
+
const result = Reflect.deleteProperty(target, key);
|
|
498
|
+
if (result && hadKey) {
|
|
499
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
500
|
+
}
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
has(target, key) {
|
|
504
|
+
const result = Reflect.has(target, key);
|
|
505
|
+
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
506
|
+
track(target, "has", key);
|
|
507
|
+
}
|
|
508
|
+
return result;
|
|
509
|
+
}
|
|
510
|
+
ownKeys(target) {
|
|
511
|
+
track(
|
|
512
|
+
target,
|
|
513
|
+
"iterate",
|
|
514
|
+
isArray(target) ? "length" : ITERATE_KEY
|
|
515
|
+
);
|
|
516
|
+
return Reflect.ownKeys(target);
|
|
506
517
|
}
|
|
507
|
-
return result;
|
|
508
|
-
}
|
|
509
|
-
function ownKeys(target) {
|
|
510
|
-
track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
|
|
511
|
-
return Reflect.ownKeys(target);
|
|
512
518
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
has: has$1,
|
|
518
|
-
ownKeys
|
|
519
|
-
};
|
|
520
|
-
const readonlyHandlers = {
|
|
521
|
-
get: readonlyGet,
|
|
519
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
520
|
+
constructor(shallow = false) {
|
|
521
|
+
super(true, shallow);
|
|
522
|
+
}
|
|
522
523
|
set(target, key) {
|
|
523
524
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
524
525
|
warn(
|
|
@@ -527,7 +528,7 @@ const readonlyHandlers = {
|
|
|
527
528
|
);
|
|
528
529
|
}
|
|
529
530
|
return true;
|
|
530
|
-
}
|
|
531
|
+
}
|
|
531
532
|
deleteProperty(target, key) {
|
|
532
533
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
533
534
|
warn(
|
|
@@ -537,22 +538,13 @@ const readonlyHandlers = {
|
|
|
537
538
|
}
|
|
538
539
|
return true;
|
|
539
540
|
}
|
|
540
|
-
}
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
get: shallowGet,
|
|
546
|
-
set: shallowSet
|
|
547
|
-
}
|
|
548
|
-
);
|
|
549
|
-
const shallowReadonlyHandlers = /* @__PURE__ */ extend(
|
|
550
|
-
{},
|
|
551
|
-
readonlyHandlers,
|
|
552
|
-
{
|
|
553
|
-
get: shallowReadonlyGet
|
|
554
|
-
}
|
|
541
|
+
}
|
|
542
|
+
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
543
|
+
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
544
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
545
|
+
true
|
|
555
546
|
);
|
|
547
|
+
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
556
548
|
|
|
557
549
|
const toShallow = (value) => value;
|
|
558
550
|
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
@@ -561,7 +553,7 @@ function get(target, key, isReadonly = false, isShallow = false) {
|
|
|
561
553
|
const rawTarget = toRaw(target);
|
|
562
554
|
const rawKey = toRaw(key);
|
|
563
555
|
if (!isReadonly) {
|
|
564
|
-
if (key
|
|
556
|
+
if (hasChanged(key, rawKey)) {
|
|
565
557
|
track(rawTarget, "get", key);
|
|
566
558
|
}
|
|
567
559
|
track(rawTarget, "get", rawKey);
|
|
@@ -581,7 +573,7 @@ function has(key, isReadonly = false) {
|
|
|
581
573
|
const rawTarget = toRaw(target);
|
|
582
574
|
const rawKey = toRaw(key);
|
|
583
575
|
if (!isReadonly) {
|
|
584
|
-
if (key
|
|
576
|
+
if (hasChanged(key, rawKey)) {
|
|
585
577
|
track(rawTarget, "has", key);
|
|
586
578
|
}
|
|
587
579
|
track(rawTarget, "has", rawKey);
|
|
@@ -1115,11 +1107,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1115
1107
|
}
|
|
1116
1108
|
function propertyToRef(source, key, defaultValue) {
|
|
1117
1109
|
const val = source[key];
|
|
1118
|
-
return isRef(val) ? val : new ObjectRefImpl(
|
|
1119
|
-
source,
|
|
1120
|
-
key,
|
|
1121
|
-
defaultValue
|
|
1122
|
-
);
|
|
1110
|
+
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1123
1111
|
}
|
|
1124
1112
|
|
|
1125
1113
|
class ComputedRefImpl {
|
|
@@ -32,9 +32,9 @@ var VueReactivity = (function (exports) {
|
|
|
32
32
|
return hit || (cache[str] = fn(str));
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
-
const capitalize = cacheStringFunction(
|
|
36
|
-
|
|
37
|
-
);
|
|
35
|
+
const capitalize = cacheStringFunction((str) => {
|
|
36
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
37
|
+
});
|
|
38
38
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
39
39
|
const def = (obj, key, value) => {
|
|
40
40
|
Object.defineProperty(obj, key, {
|
|
@@ -255,7 +255,7 @@ var VueReactivity = (function (exports) {
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
function effect(fn, options) {
|
|
258
|
-
if (fn.effect) {
|
|
258
|
+
if (fn.effect instanceof ReactiveEffect) {
|
|
259
259
|
fn = fn.effect.fn;
|
|
260
260
|
}
|
|
261
261
|
const _effect = new ReactiveEffect(fn);
|
|
@@ -425,10 +425,6 @@ var VueReactivity = (function (exports) {
|
|
|
425
425
|
const builtInSymbols = new Set(
|
|
426
426
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
427
427
|
);
|
|
428
|
-
const get$1 = /* @__PURE__ */ createGetter();
|
|
429
|
-
const shallowGet = /* @__PURE__ */ createGetter(false, true);
|
|
430
|
-
const readonlyGet = /* @__PURE__ */ createGetter(true);
|
|
431
|
-
const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
|
|
432
428
|
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
433
429
|
function createArrayInstrumentations() {
|
|
434
430
|
const instrumentations = {};
|
|
@@ -461,8 +457,13 @@ var VueReactivity = (function (exports) {
|
|
|
461
457
|
track(obj, "has", key);
|
|
462
458
|
return obj.hasOwnProperty(key);
|
|
463
459
|
}
|
|
464
|
-
|
|
465
|
-
|
|
460
|
+
class BaseReactiveHandler {
|
|
461
|
+
constructor(_isReadonly = false, _shallow = false) {
|
|
462
|
+
this._isReadonly = _isReadonly;
|
|
463
|
+
this._shallow = _shallow;
|
|
464
|
+
}
|
|
465
|
+
get(target, key, receiver) {
|
|
466
|
+
const isReadonly2 = this._isReadonly, shallow = this._shallow;
|
|
466
467
|
if (key === "__v_isReactive") {
|
|
467
468
|
return !isReadonly2;
|
|
468
469
|
} else if (key === "__v_isReadonly") {
|
|
@@ -498,17 +499,18 @@ var VueReactivity = (function (exports) {
|
|
|
498
499
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
499
500
|
}
|
|
500
501
|
return res;
|
|
501
|
-
}
|
|
502
|
+
}
|
|
502
503
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
504
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
505
|
+
constructor(shallow = false) {
|
|
506
|
+
super(false, shallow);
|
|
507
|
+
}
|
|
508
|
+
set(target, key, value, receiver) {
|
|
507
509
|
let oldValue = target[key];
|
|
508
510
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
509
511
|
return false;
|
|
510
512
|
}
|
|
511
|
-
if (!
|
|
513
|
+
if (!this._shallow) {
|
|
512
514
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
513
515
|
oldValue = toRaw(oldValue);
|
|
514
516
|
value = toRaw(value);
|
|
@@ -528,37 +530,36 @@ var VueReactivity = (function (exports) {
|
|
|
528
530
|
}
|
|
529
531
|
}
|
|
530
532
|
return result;
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
function deleteProperty(target, key) {
|
|
534
|
-
const hadKey = hasOwn(target, key);
|
|
535
|
-
const oldValue = target[key];
|
|
536
|
-
const result = Reflect.deleteProperty(target, key);
|
|
537
|
-
if (result && hadKey) {
|
|
538
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
539
533
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
534
|
+
deleteProperty(target, key) {
|
|
535
|
+
const hadKey = hasOwn(target, key);
|
|
536
|
+
const oldValue = target[key];
|
|
537
|
+
const result = Reflect.deleteProperty(target, key);
|
|
538
|
+
if (result && hadKey) {
|
|
539
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
540
|
+
}
|
|
541
|
+
return result;
|
|
542
|
+
}
|
|
543
|
+
has(target, key) {
|
|
544
|
+
const result = Reflect.has(target, key);
|
|
545
|
+
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
546
|
+
track(target, "has", key);
|
|
547
|
+
}
|
|
548
|
+
return result;
|
|
549
|
+
}
|
|
550
|
+
ownKeys(target) {
|
|
551
|
+
track(
|
|
552
|
+
target,
|
|
553
|
+
"iterate",
|
|
554
|
+
isArray(target) ? "length" : ITERATE_KEY
|
|
555
|
+
);
|
|
556
|
+
return Reflect.ownKeys(target);
|
|
546
557
|
}
|
|
547
|
-
return result;
|
|
548
|
-
}
|
|
549
|
-
function ownKeys(target) {
|
|
550
|
-
track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
|
|
551
|
-
return Reflect.ownKeys(target);
|
|
552
558
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
has: has$1,
|
|
558
|
-
ownKeys
|
|
559
|
-
};
|
|
560
|
-
const readonlyHandlers = {
|
|
561
|
-
get: readonlyGet,
|
|
559
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
560
|
+
constructor(shallow = false) {
|
|
561
|
+
super(true, shallow);
|
|
562
|
+
}
|
|
562
563
|
set(target, key) {
|
|
563
564
|
{
|
|
564
565
|
warn(
|
|
@@ -567,7 +568,7 @@ var VueReactivity = (function (exports) {
|
|
|
567
568
|
);
|
|
568
569
|
}
|
|
569
570
|
return true;
|
|
570
|
-
}
|
|
571
|
+
}
|
|
571
572
|
deleteProperty(target, key) {
|
|
572
573
|
{
|
|
573
574
|
warn(
|
|
@@ -577,22 +578,13 @@ var VueReactivity = (function (exports) {
|
|
|
577
578
|
}
|
|
578
579
|
return true;
|
|
579
580
|
}
|
|
580
|
-
}
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
get: shallowGet,
|
|
586
|
-
set: shallowSet
|
|
587
|
-
}
|
|
588
|
-
);
|
|
589
|
-
const shallowReadonlyHandlers = /* @__PURE__ */ extend(
|
|
590
|
-
{},
|
|
591
|
-
readonlyHandlers,
|
|
592
|
-
{
|
|
593
|
-
get: shallowReadonlyGet
|
|
594
|
-
}
|
|
581
|
+
}
|
|
582
|
+
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
583
|
+
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
584
|
+
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
|
|
585
|
+
true
|
|
595
586
|
);
|
|
587
|
+
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
596
588
|
|
|
597
589
|
const toShallow = (value) => value;
|
|
598
590
|
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
@@ -601,7 +593,7 @@ var VueReactivity = (function (exports) {
|
|
|
601
593
|
const rawTarget = toRaw(target);
|
|
602
594
|
const rawKey = toRaw(key);
|
|
603
595
|
if (!isReadonly) {
|
|
604
|
-
if (key
|
|
596
|
+
if (hasChanged(key, rawKey)) {
|
|
605
597
|
track(rawTarget, "get", key);
|
|
606
598
|
}
|
|
607
599
|
track(rawTarget, "get", rawKey);
|
|
@@ -621,7 +613,7 @@ var VueReactivity = (function (exports) {
|
|
|
621
613
|
const rawTarget = toRaw(target);
|
|
622
614
|
const rawKey = toRaw(key);
|
|
623
615
|
if (!isReadonly) {
|
|
624
|
-
if (key
|
|
616
|
+
if (hasChanged(key, rawKey)) {
|
|
625
617
|
track(rawTarget, "has", key);
|
|
626
618
|
}
|
|
627
619
|
track(rawTarget, "has", rawKey);
|
|
@@ -1151,11 +1143,7 @@ var VueReactivity = (function (exports) {
|
|
|
1151
1143
|
}
|
|
1152
1144
|
function propertyToRef(source, key, defaultValue) {
|
|
1153
1145
|
const val = source[key];
|
|
1154
|
-
return isRef(val) ? val : new ObjectRefImpl(
|
|
1155
|
-
source,
|
|
1156
|
-
key,
|
|
1157
|
-
defaultValue
|
|
1158
|
-
);
|
|
1146
|
+
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1159
1147
|
}
|
|
1160
1148
|
|
|
1161
1149
|
class ComputedRefImpl {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n=()=>{},s=Object.assign,i=Object.prototype.hasOwnProperty,r=(t,e)=>i.call(t,e),c=Array.isArray,o=t=>"[object Map]"===f(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,h=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,f=t=>l.call(t),_=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,d=(t,e)=>!Object.is(t,e);let p;class v{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=p,!t&&p&&(this.index=(p.scopes||(p.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=p;try{return p=this,t()}finally{p=e}}}on(){p=this}off(){p=this.parent}stop(t){if(this._active){let e,n;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].stop();for(e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function g(t,e=p){e&&e.active&&e.effects.push(t)}const y=t=>{const e=new Set(t);return e.w=0,e.n=0,e},w=t=>(t.w&S)>0,R=t=>(t.n&S)>0,b=new WeakMap;let m=0,S=1;let k;const O=Symbol(""),j=Symbol("");class E{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,g(this,n)}run(){if(!this.active)return this.fn();let t=k,e=P;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=k,k=this,P=!0,S=1<<++m,m<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=S})(this):x(this),this.fn()}finally{m<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];w(i)&&!R(i)?i.delete(t):e[n++]=i,i.w&=~S,i.n&=~S}e.length=n}})(this),S=1<<--m,k=this.parent,P=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){k===this?this.deferStop=!0:this.active&&(x(this),this.onStop&&this.onStop(),this.active=!1)}}function x(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let P=!0;const M=[];function V(){M.push(P),P=!1}function z(){const t=M.pop();P=void 0===t||t}function W(t,e,n){if(P&&k){let e=b.get(t);e||b.set(t,e=new Map);let s=e.get(n);s||e.set(n,s=y()),A(s)}}function A(t,e){let n=!1;m<=30?R(t)||(t.n|=S,n=!w(t)):n=!t.has(k),n&&(t.add(k),k.deps.push(t))}function N(t,e,n,s,i,r){const u=b.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===n&&c(t)){const t=Number(s);u.forEach(((e,n)=>{("length"===n||n>=t)&&a.push(e)}))}else switch(void 0!==n&&a.push(u.get(n)),e){case"add":c(t)?_(n)&&a.push(u.get("length")):(a.push(u.get(O)),o(t)&&a.push(u.get(j)));break;case"delete":c(t)||(a.push(u.get(O)),o(t)&&a.push(u.get(j)));break;case"set":o(t)&&a.push(u.get(O))}if(1===a.length)a[0]&&T(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);T(y(t))}}function T(t,e){const n=c(t)?t:[...t];for(const s of n)s.computed&&C(s);for(const s of n)s.computed||C(s)}function C(t,e){(t!==k||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const I=e("__proto__,__v_isRef,__isVue"),K=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(a)),D=H(),L=H(!1,!0),Y=H(!0),q=H(!0,!0),B=F();function F(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=zt(this);for(let e=0,i=this.length;e<i;e++)W(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(zt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){V();const n=zt(this)[e].apply(this,t);return z(),n}})),t}function G(t){const e=zt(this);return W(e,0,t),e.hasOwnProperty(t)}function H(t=!1,e=!1){return function(n,s,i){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_isShallow"===s)return e;if("__v_raw"===s&&i===(t?e?kt:St:e?mt:bt).get(n))return n;const o=c(n);if(!t){if(o&&r(B,s))return Reflect.get(B,s,i);if("hasOwnProperty"===s)return G}const u=Reflect.get(n,s,i);return(a(s)?K.has(s):I(s))?u:(t||W(n,0,s),e?u:Ct(u)?o&&_(s)?u:u.value:h(u)?t?Et(u):jt(u):u)}}function J(t=!1){return function(e,n,s,i){let o=e[n];if(Mt(o)&&Ct(o)&&!Ct(s))return!1;if(!t&&(Vt(s)||Mt(s)||(o=zt(o),s=zt(s)),!c(e)&&Ct(o)&&!Ct(s)))return o.value=s,!0;const u=c(e)&&_(n)?Number(n)<e.length:r(e,n),a=Reflect.set(e,n,s,i);return e===zt(i)&&(u?d(s,o)&&N(e,"set",n,s):N(e,"add",n,s)),a}}const Q={get:D,set:J(),deleteProperty:function(t,e){const n=r(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&N(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return a(e)&&K.has(e)||W(t,0,e),n},ownKeys:function(t){return W(t,0,c(t)?"length":O),Reflect.ownKeys(t)}},U={get:Y,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},X=s({},Q,{get:L,set:J(!0)}),Z=s({},U,{get:q}),$=t=>t,tt=t=>Reflect.getPrototypeOf(t);function et(t,e,n=!1,s=!1){const i=zt(t=t.__v_raw),r=zt(e);n||(e!==r&&W(i,0,e),W(i,0,r));const{has:c}=tt(i),o=s?$:n?At:Wt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function nt(t,e=!1){const n=this.__v_raw,s=zt(n),i=zt(t);return e||(t!==i&&W(s,0,t),W(s,0,i)),t===i?n.has(t):n.has(t)||n.has(i)}function st(t,e=!1){return t=t.__v_raw,!e&&W(zt(t),0,O),Reflect.get(t,"size",t)}function it(t){t=zt(t);const e=zt(this);return tt(e).has.call(e,t)||(e.add(t),N(e,"add",t,t)),this}function rt(t,e){e=zt(e);const n=zt(this),{has:s,get:i}=tt(n);let r=s.call(n,t);r||(t=zt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?d(e,c)&&N(n,"set",t,e):N(n,"add",t,e),this}function ct(t){const e=zt(this),{has:n,get:s}=tt(e);let i=n.call(e,t);i||(t=zt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&N(e,"delete",t,void 0),r}function ot(){const t=zt(this),e=0!==t.size,n=t.clear();return e&&N(t,"clear",void 0,void 0),n}function ut(t,e){return function(n,s){const i=this,r=i.__v_raw,c=zt(r),o=e?$:t?At:Wt;return!t&&W(c,0,O),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function at(t,e,n){return function(...s){const i=this.__v_raw,r=zt(i),c=o(r),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,h=i[t](...s),l=n?$:e?At:Wt;return!e&&W(r,0,a?j:O),{next(){const{value:t,done:e}=h.next();return e?{value:t,done:e}:{value:u?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function ht(t){return function(...e){return"delete"!==t&&this}}function lt(){const t={get(t){return et(this,t)},get size(){return st(this)},has:nt,add:it,set:rt,delete:ct,clear:ot,forEach:ut(!1,!1)},e={get(t){return et(this,t,!1,!0)},get size(){return st(this)},has:nt,add:it,set:rt,delete:ct,clear:ot,forEach:ut(!1,!0)},n={get(t){return et(this,t,!0)},get size(){return st(this,!0)},has(t){return nt.call(this,t,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:ut(!0,!1)},s={get(t){return et(this,t,!0,!0)},get size(){return st(this,!0)},has(t){return nt.call(this,t,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:ut(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=at(i,!1,!1),n[i]=at(i,!0,!1),e[i]=at(i,!1,!0),s[i]=at(i,!0,!0)})),[t,n,e,s]}const[ft,_t,dt,pt]=lt();function vt(t,e){const n=e?t?pt:dt:t?_t:ft;return(e,s,i)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(r(n,s)&&s in e?n:e,s,i)}const gt={get:vt(!1,!1)},yt={get:vt(!1,!0)},wt={get:vt(!0,!1)},Rt={get:vt(!0,!0)},bt=new WeakMap,mt=new WeakMap,St=new WeakMap,kt=new WeakMap;function Ot(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>f(t).slice(8,-1))(t))}function jt(t){return Mt(t)?t:xt(t,!1,Q,gt,bt)}function Et(t){return xt(t,!0,U,wt,St)}function xt(t,e,n,s,i){if(!h(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=Ot(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function Pt(t){return Mt(t)?Pt(t.__v_raw):!(!t||!t.__v_isReactive)}function Mt(t){return!(!t||!t.__v_isReadonly)}function Vt(t){return!(!t||!t.__v_isShallow)}function zt(t){const e=t&&t.__v_raw;return e?zt(e):t}const Wt=t=>h(t)?jt(t):t,At=t=>h(t)?Et(t):t;function Nt(t){P&&k&&A((t=zt(t)).dep||(t.dep=y()))}function Tt(t,e){const n=(t=zt(t)).dep;n&&T(n)}function Ct(t){return!(!t||!0!==t.__v_isRef)}function It(t){return Kt(t,!1)}function Kt(t,e){return Ct(t)?t:new Dt(t,e)}class Dt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:zt(t),this._value=e?t:Wt(t)}get value(){return Nt(this),this._value}set value(t){const e=this.__v_isShallow||Vt(t)||Mt(t);t=e?t:zt(t),d(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:Wt(t),Tt(this))}}function Lt(t){return Ct(t)?t.value:t}const Yt={get:(t,e,n)=>Lt(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Ct(i)&&!Ct(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};class qt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Nt(this)),(()=>Tt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Bt{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return t=zt(this._object),e=this._key,null==(n=b.get(t))?void 0:n.get(e);var t,e,n}}class Ft{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Gt(t,e,n){const s=t[e];return Ct(s)?s:new Bt(t,e,n)}class Ht{constructor(t,e,n,s){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new E(t,(()=>{this._dirty||(this._dirty=!0,Tt(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=n}get value(){const t=zt(this);return Nt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}const Jt=Promise.resolve(),Qt=[];let Ut=!1;const Xt=()=>{for(let t=0;t<Qt.length;t++)Qt[t]();Qt.length=0,Ut=!1};class Zt{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.__v_isReadonly=!0;let n=!1,s=!1;this.effect=new E(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,Qt.push((()=>{this.effect.active&&this._get()!==t&&Tt(this),s=!1})),Ut||(Ut=!0,Jt.then(Xt))}for(const t of this.dep)t.computed instanceof Zt&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Nt(this),zt(this)._get()}}return t.EffectScope=v,t.ITERATE_KEY=O,t.ReactiveEffect=E,t.computed=function(t,e,s=!1){let i,r;const c=u(t);return c?(i=t,r=n):(i=t.get,r=t.set),new Ht(i,r,c||!r,s)},t.customRef=function(t){return new qt(t)},t.deferredComputed=function(t){return new Zt(t)},t.effect=function(t,e){t.effect&&(t=t.effect.fn);const n=new E(t);e&&(s(n,e),e.scope&&g(n,e.scope)),e&&e.lazy||n.run();const i=n.run.bind(n);return i.effect=n,i},t.effectScope=function(t){return new v(t)},t.enableTracking=function(){M.push(P),P=!0},t.getCurrentScope=function(){return p},t.isProxy=function(t){return Pt(t)||Mt(t)},t.isReactive=Pt,t.isReadonly=Mt,t.isRef=Ct,t.isShallow=Vt,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){p&&p.cleanups.push(t)},t.pauseTracking=V,t.proxyRefs=function(t){return Pt(t)?t:new Proxy(t,Yt)},t.reactive=jt,t.readonly=Et,t.ref=It,t.resetTracking=z,t.shallowReactive=function(t){return xt(t,!1,X,yt,mt)},t.shallowReadonly=function(t){return xt(t,!0,Z,Rt,kt)},t.shallowRef=function(t){return Kt(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=zt,t.toRef=function(t,e,n){return Ct(t)?t:u(t)?new Ft(t):h(t)&&arguments.length>1?Gt(t,e,n):It(t)},t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=Gt(t,n);return e},t.toValue=function(t){return u(t)?t():Lt(t)},t.track=W,t.trigger=N,t.triggerRef=function(t){Tt(t)},t.unref=Lt,t}({});
|
|
1
|
+
var VueReactivity=function(t){"use strict";function e(t,e){const s=Object.create(null),n=t.split(",");for(let i=0;i<n.length;i++)s[n[i]]=!0;return e?t=>!!s[t.toLowerCase()]:t=>!!s[t]}const s=()=>{},n=Object.assign,i=Object.prototype.hasOwnProperty,r=(t,e)=>i.call(t,e),c=Array.isArray,o=t=>"[object Map]"===f(t),u=t=>"function"==typeof t,a=t=>"symbol"==typeof t,h=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,f=t=>l.call(t),_=t=>f(t).slice(8,-1),d=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,p=(t,e)=>!Object.is(t,e);let v;class g{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=v,!t&&v&&(this.index=(v.scopes||(v.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const e=v;try{return v=this,t()}finally{v=e}}}on(){v=this}off(){v=this.parent}stop(t){if(this._active){let e,s;for(e=0,s=this.effects.length;e<s;e++)this.effects[e].stop();for(e=0,s=this.cleanups.length;e<s;e++)this.cleanups[e]();if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].stop(!0);if(!this.detached&&this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.parent=void 0,this._active=!1}}}function y(t,e=v){e&&e.active&&e.effects.push(t)}const w=t=>{const e=new Set(t);return e.w=0,e.n=0,e},R=t=>(t.w&k)>0,b=t=>(t.n&k)>0,m=new WeakMap;let S=0,k=1;const O=30;let j;const x=Symbol(""),E=Symbol("");class P{constructor(t,e=null,s){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,y(this,s)}run(){if(!this.active)return this.fn();let t=j,e=V;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=j,j=this,V=!0,k=1<<++S,S<=O?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=k})(this):M(this),this.fn()}finally{S<=O&&(t=>{const{deps:e}=t;if(e.length){let s=0;for(let n=0;n<e.length;n++){const i=e[n];R(i)&&!b(i)?i.delete(t):e[s++]=i,i.w&=~k,i.n&=~k}e.length=s}})(this),k=1<<--S,j=this.parent,V=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){j===this?this.deferStop=!0:this.active&&(M(this),this.onStop&&this.onStop(),this.active=!1)}}function M(t){const{deps:e}=t;if(e.length){for(let s=0;s<e.length;s++)e[s].delete(t);e.length=0}}let V=!0;const z=[];function W(){z.push(V),V=!1}function A(){const t=z.pop();V=void 0===t||t}function N(t,e,s){if(V&&j){let e=m.get(t);e||m.set(t,e=new Map);let n=e.get(s);n||e.set(s,n=w()),T(n)}}function T(t,e){let s=!1;S<=O?b(t)||(t.n|=k,s=!R(t)):s=!t.has(j),s&&(t.add(j),j.deps.push(t))}function C(t,e,s,n,i,r){const u=m.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===s&&c(t)){const t=Number(n);u.forEach(((e,s)=>{("length"===s||s>=t)&&a.push(e)}))}else switch(void 0!==s&&a.push(u.get(s)),e){case"add":c(t)?d(s)&&a.push(u.get("length")):(a.push(u.get(x)),o(t)&&a.push(u.get(E)));break;case"delete":c(t)||(a.push(u.get(x)),o(t)&&a.push(u.get(E)));break;case"set":o(t)&&a.push(u.get(x))}if(1===a.length)a[0]&&I(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);I(w(t))}}function I(t,e){const s=c(t)?t:[...t];for(const n of s)n.computed&&K(n);for(const n of s)n.computed||K(n)}function K(t,e){(t!==j||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const D=e("__proto__,__v_isRef,__isVue"),L=new Set(Object.getOwnPropertyNames(Symbol).filter((t=>"arguments"!==t&&"caller"!==t)).map((t=>Symbol[t])).filter(a)),Y=q();function q(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const s=Mt(this);for(let e=0,i=this.length;e<i;e++)N(s,0,e+"");const n=s[e](...t);return-1===n||!1===n?s[e](...t.map(Mt)):n}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){W();const s=Mt(this)[e].apply(this,t);return A(),s}})),t}function B(t){const e=Mt(this);return N(e,0,t),e.hasOwnProperty(t)}class F{constructor(t=!1,e=!1){this._isReadonly=t,this._shallow=e}get(t,e,s){const n=this._isReadonly,i=this._shallow;if("__v_isReactive"===e)return!n;if("__v_isReadonly"===e)return n;if("__v_isShallow"===e)return i;if("__v_raw"===e&&s===(n?i?St:mt:i?bt:Rt).get(t))return t;const o=c(t);if(!n){if(o&&r(Y,e))return Reflect.get(Y,e,s);if("hasOwnProperty"===e)return B}const u=Reflect.get(t,e,s);return(a(e)?L.has(e):D(e))?u:(n||N(t,0,e),i?u:Nt(u)?o&&d(e)?u:u.value:h(u)?n?Ot(u):kt(u):u)}}class G extends F{constructor(t=!1){super(!1,t)}set(t,e,s,n){let i=t[e];if(Et(i)&&Nt(i)&&!Nt(s))return!1;if(!this._shallow&&(Pt(s)||Et(s)||(i=Mt(i),s=Mt(s)),!c(t)&&Nt(i)&&!Nt(s)))return i.value=s,!0;const o=c(t)&&d(e)?Number(e)<t.length:r(t,e),u=Reflect.set(t,e,s,n);return t===Mt(n)&&(o?p(s,i)&&C(t,"set",e,s):C(t,"add",e,s)),u}deleteProperty(t,e){const s=r(t,e),n=Reflect.deleteProperty(t,e);return n&&s&&C(t,"delete",e,void 0),n}has(t,e){const s=Reflect.has(t,e);return a(e)&&L.has(e)||N(t,0,e),s}ownKeys(t){return N(t,0,c(t)?"length":x),Reflect.ownKeys(t)}}class H extends F{constructor(t=!1){super(!0,t)}set(t,e){return!0}deleteProperty(t,e){return!0}}const J=new G,Q=new H,U=new G(!0),X=new H(!0),Z=t=>t,$=t=>Reflect.getPrototypeOf(t);function tt(t,e,s=!1,n=!1){const i=Mt(t=t.__v_raw),r=Mt(e);s||(p(e,r)&&N(i,0,e),N(i,0,r));const{has:c}=$(i),o=n?Z:s?zt:Vt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function et(t,e=!1){const s=this.__v_raw,n=Mt(s),i=Mt(t);return e||(p(t,i)&&N(n,0,t),N(n,0,i)),t===i?s.has(t):s.has(t)||s.has(i)}function st(t,e=!1){return t=t.__v_raw,!e&&N(Mt(t),0,x),Reflect.get(t,"size",t)}function nt(t){t=Mt(t);const e=Mt(this);return $(e).has.call(e,t)||(e.add(t),C(e,"add",t,t)),this}function it(t,e){e=Mt(e);const s=Mt(this),{has:n,get:i}=$(s);let r=n.call(s,t);r||(t=Mt(t),r=n.call(s,t));const c=i.call(s,t);return s.set(t,e),r?p(e,c)&&C(s,"set",t,e):C(s,"add",t,e),this}function rt(t){const e=Mt(this),{has:s,get:n}=$(e);let i=s.call(e,t);i||(t=Mt(t),i=s.call(e,t)),n&&n.call(e,t);const r=e.delete(t);return i&&C(e,"delete",t,void 0),r}function ct(){const t=Mt(this),e=0!==t.size,s=t.clear();return e&&C(t,"clear",void 0,void 0),s}function ot(t,e){return function(s,n){const i=this,r=i.__v_raw,c=Mt(r),o=e?Z:t?zt:Vt;return!t&&N(c,0,x),r.forEach(((t,e)=>s.call(n,o(t),o(e),i)))}}function ut(t,e,s){return function(...n){const i=this.__v_raw,r=Mt(i),c=o(r),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,h=i[t](...n),l=s?Z:e?zt:Vt;return!e&&N(r,0,a?E:x),{next(){const{value:t,done:e}=h.next();return e?{value:t,done:e}:{value:u?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function at(t){return function(...e){return"delete"!==t&&this}}function ht(){const t={get(t){return tt(this,t)},get size(){return st(this)},has:et,add:nt,set:it,delete:rt,clear:ct,forEach:ot(!1,!1)},e={get(t){return tt(this,t,!1,!0)},get size(){return st(this)},has:et,add:nt,set:it,delete:rt,clear:ct,forEach:ot(!1,!0)},s={get(t){return tt(this,t,!0)},get size(){return st(this,!0)},has(t){return et.call(this,t,!0)},add:at("add"),set:at("set"),delete:at("delete"),clear:at("clear"),forEach:ot(!0,!1)},n={get(t){return tt(this,t,!0,!0)},get size(){return st(this,!0)},has(t){return et.call(this,t,!0)},add:at("add"),set:at("set"),delete:at("delete"),clear:at("clear"),forEach:ot(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=ut(i,!1,!1),s[i]=ut(i,!0,!1),e[i]=ut(i,!1,!0),n[i]=ut(i,!0,!0)})),[t,s,e,n]}const[lt,ft,_t,dt]=ht();function pt(t,e){const s=e?t?dt:_t:t?ft:lt;return(e,n,i)=>"__v_isReactive"===n?!t:"__v_isReadonly"===n?t:"__v_raw"===n?e:Reflect.get(r(s,n)&&n in e?s:e,n,i)}const vt={get:pt(!1,!1)},gt={get:pt(!1,!0)},yt={get:pt(!0,!1)},wt={get:pt(!0,!0)},Rt=new WeakMap,bt=new WeakMap,mt=new WeakMap,St=new WeakMap;function kt(t){return Et(t)?t:jt(t,!1,J,vt,Rt)}function Ot(t){return jt(t,!0,Q,yt,mt)}function jt(t,e,s,n,i){if(!h(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=(o=t).__v_skip||!Object.isExtensible(o)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(_(o));var o;if(0===c)return t;const u=new Proxy(t,2===c?n:s);return i.set(t,u),u}function xt(t){return Et(t)?xt(t.__v_raw):!(!t||!t.__v_isReactive)}function Et(t){return!(!t||!t.__v_isReadonly)}function Pt(t){return!(!t||!t.__v_isShallow)}function Mt(t){const e=t&&t.__v_raw;return e?Mt(e):t}const Vt=t=>h(t)?kt(t):t,zt=t=>h(t)?Ot(t):t;function Wt(t){V&&j&&T((t=Mt(t)).dep||(t.dep=w()))}function At(t,e){const s=(t=Mt(t)).dep;s&&I(s)}function Nt(t){return!(!t||!0!==t.__v_isRef)}function Tt(t){return Ct(t,!1)}function Ct(t,e){return Nt(t)?t:new It(t,e)}class It{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Mt(t),this._value=e?t:Vt(t)}get value(){return Wt(this),this._value}set value(t){const e=this.__v_isShallow||Pt(t)||Et(t);t=e?t:Mt(t),p(t,this._rawValue)&&(this._rawValue=t,this._value=e?t:Vt(t),At(this))}}function Kt(t){return Nt(t)?t.value:t}const Dt={get:(t,e,s)=>Kt(Reflect.get(t,e,s)),set:(t,e,s,n)=>{const i=t[e];return Nt(i)&&!Nt(s)?(i.value=s,!0):Reflect.set(t,e,s,n)}};class Lt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:s}=t((()=>Wt(this)),(()=>At(this)));this._get=e,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}class Yt{constructor(t,e,s){this._object=t,this._key=e,this._defaultValue=s,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return t=Mt(this._object),e=this._key,null==(s=m.get(t))?void 0:s.get(e);var t,e,s}}class qt{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Bt(t,e,s){const n=t[e];return Nt(n)?n:new Yt(t,e,s)}class Ft{constructor(t,e,s,n){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new P(t,(()=>{this._dirty||(this._dirty=!0,At(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s}get value(){const t=Mt(this);return Wt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}const Gt=Promise.resolve(),Ht=[];let Jt=!1;const Qt=()=>{for(let t=0;t<Ht.length;t++)Ht[t]();Ht.length=0,Jt=!1};class Ut{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this.__v_isReadonly=!0;let s=!1,n=!1;this.effect=new P(t,(t=>{if(this.dep){if(t)e=this._value,s=!0;else if(!n){const t=s?e:this._value;n=!0,s=!1,Ht.push((()=>{this.effect.active&&this._get()!==t&&At(this),n=!1})),Jt||(Jt=!0,Gt.then(Qt))}for(const t of this.dep)t.computed instanceof Ut&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Wt(this),Mt(this)._get()}}return t.EffectScope=g,t.ITERATE_KEY=x,t.ReactiveEffect=P,t.computed=function(t,e,n=!1){let i,r;const c=u(t);return c?(i=t,r=s):(i=t.get,r=t.set),new Ft(i,r,c||!r,n)},t.customRef=function(t){return new Lt(t)},t.deferredComputed=function(t){return new Ut(t)},t.effect=function(t,e){t.effect instanceof P&&(t=t.effect.fn);const s=new P(t);e&&(n(s,e),e.scope&&y(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i},t.effectScope=function(t){return new g(t)},t.enableTracking=function(){z.push(V),V=!0},t.getCurrentScope=function(){return v},t.isProxy=function(t){return xt(t)||Et(t)},t.isReactive=xt,t.isReadonly=Et,t.isRef=Nt,t.isShallow=Pt,t.markRaw=function(t){return((t,e,s)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:s})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){v&&v.cleanups.push(t)},t.pauseTracking=W,t.proxyRefs=function(t){return xt(t)?t:new Proxy(t,Dt)},t.reactive=kt,t.readonly=Ot,t.ref=Tt,t.resetTracking=A,t.shallowReactive=function(t){return jt(t,!1,U,gt,bt)},t.shallowReadonly=function(t){return jt(t,!0,X,wt,St)},t.shallowRef=function(t){return Ct(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Mt,t.toRef=function(t,e,s){return Nt(t)?t:u(t)?new qt(t):h(t)&&arguments.length>1?Bt(t,e,s):Tt(t)},t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const s in t)e[s]=Bt(t,s);return e},t.toValue=function(t){return u(t)?t():Kt(t)},t.track=N,t.trigger=C,t.triggerRef=function(t){At(t)},t.unref=Kt,t}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/reactivity",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"description": "@vue/reactivity",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/reactivity.esm-bundler.js",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@vue/shared": "3.3.
|
|
39
|
+
"@vue/shared": "3.3.6"
|
|
40
40
|
}
|
|
41
41
|
}
|