resuxjs 0.4.0-beta.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/compiler/directives.js +7 -3
- package/dist/compiler/directives.js.map +1 -1
- package/dist/compiler/implementation.js +33 -13
- package/dist/compiler/index.js.map +1 -1
- package/dist/create.js +9 -3
- package/dist/create.js.map +1 -1
- package/dist/deploy/common.js +19 -3
- package/dist/deploy/common.js.map +1 -1
- package/dist/icons/component.d.ts +8 -8
- package/dist/runtime/index.js +441 -91
- package/dist/runtime/index.js.map +1 -1
- package/dist/ui/index.d.ts +45 -45
- package/dist/ui/verification-code.d.ts +9 -9
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -5275,10 +5275,12 @@ const __rxFlags = {
|
|
|
5275
5275
|
const __rxTargetMap = new WeakMap();
|
|
5276
5276
|
const __rxReactiveMap = new WeakMap();
|
|
5277
5277
|
const __rxReadonlyMap = new WeakMap();
|
|
5278
|
+
const __rxProxyToRaw = new WeakMap();
|
|
5278
5279
|
let __rxActiveEffect;
|
|
5279
5280
|
let __rxShouldTrack = true;
|
|
5280
5281
|
const __rxTrackStack = [];
|
|
5281
5282
|
const __rxQueue = new Set();
|
|
5283
|
+
const __rxPostFlushQueue = new Set();
|
|
5282
5284
|
let __rxFlushing = false;
|
|
5283
5285
|
const __rxResolvedPromise = Promise.resolve();
|
|
5284
5286
|
let __rxFlushPromise = null;
|
|
@@ -5612,11 +5614,11 @@ async function ensureClientEnhancementManifestLoaded() {
|
|
|
5612
5614
|
}
|
|
5613
5615
|
|
|
5614
5616
|
function packageCacheKey(name, options = {}) {
|
|
5617
|
+
const css = normalizePackageCssInput(options.css).sort().join(",");
|
|
5615
5618
|
const exportName = typeof options.exportName === "string" ? options.exportName : "";
|
|
5616
|
-
const preferDefault = options.preferDefault === false ? "named" : "default";
|
|
5617
5619
|
const mode = normalizePackageMode(options.mode, options.clientOnly ? "clientOnly" : "ssr");
|
|
5618
|
-
const
|
|
5619
|
-
return
|
|
5620
|
+
const preferDefault = options.preferDefault === false ? "0" : "1";
|
|
5621
|
+
return name + "::" + mode + "::" + preferDefault + "::" + exportName + "::" + css;
|
|
5620
5622
|
}
|
|
5621
5623
|
|
|
5622
5624
|
function normalizePackageCssInput(value) {
|
|
@@ -6435,6 +6437,7 @@ async function activateDeclaredClientEnhancements(root = document) {
|
|
|
6435
6437
|
|
|
6436
6438
|
|
|
6437
6439
|
const __rxIterateKey = Symbol("iterate");
|
|
6440
|
+
const __rxMapKeyIterateKey = Symbol("Map key iterate");
|
|
6438
6441
|
|
|
6439
6442
|
function __rxIsObject(value) {
|
|
6440
6443
|
return value !== null && typeof value === "object";
|
|
@@ -6444,43 +6447,74 @@ function __rxHasChanged(value, oldValue) {
|
|
|
6444
6447
|
return !Object.is(value, oldValue);
|
|
6445
6448
|
}
|
|
6446
6449
|
|
|
6447
|
-
function
|
|
6448
|
-
__rxQueue.add(job);
|
|
6450
|
+
function __rxStartFlush() {
|
|
6449
6451
|
if (__rxFlushing) {
|
|
6450
6452
|
return;
|
|
6451
6453
|
}
|
|
6452
6454
|
__rxFlushing = true;
|
|
6453
6455
|
__rxFlushPromise = __rxResolvedPromise.then(__rxFlushJobs);
|
|
6456
|
+
// Mark the flush as handled so fire-and-forget queued jobs do not produce
|
|
6457
|
+
// an unhandled rejection; nextTick awaiters still observe it (mirrors the
|
|
6458
|
+
// server scheduler).
|
|
6459
|
+
__rxFlushPromise.catch(__rxNoopErrorObserver);
|
|
6460
|
+
}
|
|
6461
|
+
|
|
6462
|
+
function __rxNoopErrorObserver() {
|
|
6463
|
+
// Intentionally empty: the rejection remains visible through nextTick().
|
|
6464
|
+
}
|
|
6465
|
+
|
|
6466
|
+
function __rxQueueJob(job) {
|
|
6467
|
+
__rxQueue.add(job);
|
|
6468
|
+
__rxStartFlush();
|
|
6469
|
+
}
|
|
6470
|
+
|
|
6471
|
+
function __rxQueuePostFlushCb(job) {
|
|
6472
|
+
__rxPostFlushQueue.add(job);
|
|
6473
|
+
__rxStartFlush();
|
|
6454
6474
|
}
|
|
6455
6475
|
|
|
6456
6476
|
function __rxFlushJobs() {
|
|
6457
6477
|
let didError = false;
|
|
6458
6478
|
let firstError;
|
|
6459
6479
|
const executionCounts = new Map();
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
const
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
if (!didError) {
|
|
6468
|
-
didError = true;
|
|
6469
|
-
firstError = new Error("Resux scheduler stopped a recursively queued job after 100 executions.");
|
|
6470
|
-
}
|
|
6471
|
-
continue;
|
|
6480
|
+
const runJobs = (jobs) => {
|
|
6481
|
+
for (const job of jobs) {
|
|
6482
|
+
const count = executionCounts.get(job) || 0;
|
|
6483
|
+
if (count >= 100) {
|
|
6484
|
+
if (!didError) {
|
|
6485
|
+
didError = true;
|
|
6486
|
+
firstError = new Error("Resux scheduler stopped a recursively queued job after 100 executions.");
|
|
6472
6487
|
}
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6488
|
+
continue;
|
|
6489
|
+
}
|
|
6490
|
+
executionCounts.set(job, count + 1);
|
|
6491
|
+
try {
|
|
6492
|
+
job();
|
|
6493
|
+
} catch (error) {
|
|
6494
|
+
if (!didError) {
|
|
6495
|
+
didError = true;
|
|
6496
|
+
firstError = error;
|
|
6481
6497
|
}
|
|
6482
6498
|
}
|
|
6483
6499
|
}
|
|
6500
|
+
};
|
|
6501
|
+
try {
|
|
6502
|
+
let hasJobs = true;
|
|
6503
|
+
while (hasJobs) {
|
|
6504
|
+
hasJobs = false;
|
|
6505
|
+
if (__rxQueue.size > 0) {
|
|
6506
|
+
const currentQueue = [...__rxQueue];
|
|
6507
|
+
__rxQueue.clear();
|
|
6508
|
+
runJobs(currentQueue);
|
|
6509
|
+
hasJobs = true;
|
|
6510
|
+
}
|
|
6511
|
+
if (__rxPostFlushQueue.size > 0) {
|
|
6512
|
+
const currentPostQueue = [...__rxPostFlushQueue];
|
|
6513
|
+
__rxPostFlushQueue.clear();
|
|
6514
|
+
runJobs(currentPostQueue);
|
|
6515
|
+
hasJobs = true;
|
|
6516
|
+
}
|
|
6517
|
+
}
|
|
6484
6518
|
} finally {
|
|
6485
6519
|
__rxFlushing = false;
|
|
6486
6520
|
__rxFlushPromise = null;
|
|
@@ -6593,7 +6627,7 @@ function __rxTrack(target, key) {
|
|
|
6593
6627
|
__rxActiveEffect.deps.push(dep);
|
|
6594
6628
|
}
|
|
6595
6629
|
|
|
6596
|
-
function __rxTrigger(target, key, type = "set") {
|
|
6630
|
+
function __rxTrigger(target, key, type = "set", newValue) {
|
|
6597
6631
|
const depsMap = __rxTargetMap.get(target);
|
|
6598
6632
|
if (!depsMap) {
|
|
6599
6633
|
return;
|
|
@@ -6603,9 +6637,38 @@ function __rxTrigger(target, key, type = "set") {
|
|
|
6603
6637
|
if (!dep) return;
|
|
6604
6638
|
for (const effect of dep) effects.add(effect);
|
|
6605
6639
|
};
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6640
|
+
if (type === "clear") {
|
|
6641
|
+
// Clearing a collection invalidates every dependency it owns.
|
|
6642
|
+
for (const dep of depsMap.values()) {
|
|
6643
|
+
addEffects(dep);
|
|
6644
|
+
}
|
|
6645
|
+
} else if (Array.isArray(target) && key === "length") {
|
|
6646
|
+
// Truncating or extending an array via its length invalidates the length,
|
|
6647
|
+
// iteration, and every index at or past the new length (mirrors the
|
|
6648
|
+
// server engine's trigger()).
|
|
6649
|
+
const nextLength = Number(newValue);
|
|
6650
|
+
for (const [depKey, dep] of depsMap) {
|
|
6651
|
+
if (
|
|
6652
|
+
depKey === "length"
|
|
6653
|
+
|| depKey === __rxIterateKey
|
|
6654
|
+
|| (__rxIsArrayIndex(depKey) && Number(depKey) >= nextLength)
|
|
6655
|
+
) {
|
|
6656
|
+
addEffects(dep);
|
|
6657
|
+
}
|
|
6658
|
+
}
|
|
6659
|
+
} else {
|
|
6660
|
+
addEffects(depsMap.get(key));
|
|
6661
|
+
if (type === "add" || type === "delete") {
|
|
6662
|
+
addEffects(depsMap.get(__rxIterateKey));
|
|
6663
|
+
if (target instanceof Map) {
|
|
6664
|
+
addEffects(depsMap.get(__rxMapKeyIterateKey));
|
|
6665
|
+
}
|
|
6666
|
+
} else if (type === "set" && target instanceof Map) {
|
|
6667
|
+
// A changed value is visible to values()/entries()/forEach iteration and
|
|
6668
|
+
// size, which all track ITERATE_KEY on maps. keys() iteration is not
|
|
6669
|
+
// affected by value changes.
|
|
6670
|
+
addEffects(depsMap.get(__rxIterateKey));
|
|
6671
|
+
}
|
|
6609
6672
|
}
|
|
6610
6673
|
__rxTriggerEffects(effects);
|
|
6611
6674
|
}
|
|
@@ -6618,85 +6681,333 @@ function readonly(target) {
|
|
|
6618
6681
|
return __rxCreateReactiveObject(target, true, __rxReadonlyMap, false);
|
|
6619
6682
|
}
|
|
6620
6683
|
|
|
6621
|
-
function
|
|
6622
|
-
|
|
6623
|
-
|
|
6684
|
+
function __rxGetTargetType(target) {
|
|
6685
|
+
switch (Object.prototype.toString.call(target)) {
|
|
6686
|
+
case "[object Object]":
|
|
6687
|
+
case "[object Array]":
|
|
6688
|
+
return "common";
|
|
6689
|
+
case "[object Map]":
|
|
6690
|
+
case "[object Set]":
|
|
6691
|
+
case "[object WeakMap]":
|
|
6692
|
+
case "[object WeakSet]":
|
|
6693
|
+
return "collection";
|
|
6694
|
+
default:
|
|
6695
|
+
return "invalid";
|
|
6696
|
+
}
|
|
6624
6697
|
}
|
|
6625
6698
|
|
|
6626
|
-
function
|
|
6627
|
-
if (
|
|
6628
|
-
return
|
|
6699
|
+
function __rxIsArrayIndex(key) {
|
|
6700
|
+
if (typeof key === "symbol" || key === "length") {
|
|
6701
|
+
return false;
|
|
6629
6702
|
}
|
|
6630
|
-
const
|
|
6631
|
-
|
|
6632
|
-
|
|
6703
|
+
const value = String(key);
|
|
6704
|
+
return /^(?:0|[1-9]\d*)$/.test(value) && Number(value) < 4294967295;
|
|
6705
|
+
}
|
|
6706
|
+
|
|
6707
|
+
function toRaw(value) {
|
|
6708
|
+
let current = value;
|
|
6709
|
+
while (__rxIsObject(current)) {
|
|
6710
|
+
const raw = __rxProxyToRaw.get(current);
|
|
6711
|
+
if (!raw || raw === current) {
|
|
6712
|
+
break;
|
|
6713
|
+
}
|
|
6714
|
+
current = raw;
|
|
6633
6715
|
}
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6716
|
+
return current;
|
|
6717
|
+
}
|
|
6718
|
+
|
|
6719
|
+
// --- Collection (Map / Set / WeakMap / WeakSet) instrumentation ------------
|
|
6720
|
+
// Mirrors src/reactivity/reactive.ts so resumed client scopes behave exactly
|
|
6721
|
+
// like the server engine.
|
|
6722
|
+
|
|
6723
|
+
function __rxWrapCollectionValue(value, isReadonlyValue) {
|
|
6724
|
+
if (!__rxIsObject(value)) {
|
|
6725
|
+
return value;
|
|
6726
|
+
}
|
|
6727
|
+
return isReadonlyValue ? readonly(value) : reactive(value);
|
|
6728
|
+
}
|
|
6729
|
+
|
|
6730
|
+
function __rxCreateIterableMethod(method, isReadonlyValue) {
|
|
6731
|
+
return function () {
|
|
6732
|
+
const target = toRaw(this);
|
|
6733
|
+
const isMap = target instanceof Map;
|
|
6734
|
+
const isKeys = method === "keys";
|
|
6735
|
+
__rxTrack(target, isKeys && isMap ? __rxMapKeyIterateKey : __rxIterateKey);
|
|
6736
|
+
const resolved = method === Symbol.iterator ? (isMap ? "entries" : "values") : method;
|
|
6737
|
+
const inner = target[resolved].call(target);
|
|
6738
|
+
const wrap = (value) => __rxWrapCollectionValue(value, isReadonlyValue);
|
|
6739
|
+
const isEntries = resolved === "entries";
|
|
6740
|
+
|
|
6741
|
+
return {
|
|
6742
|
+
next() {
|
|
6743
|
+
const { value, done } = inner.next();
|
|
6744
|
+
if (done) {
|
|
6745
|
+
return { value, done: true };
|
|
6746
|
+
}
|
|
6747
|
+
if (isEntries) {
|
|
6748
|
+
return { value: [wrap(value[0]), wrap(value[1])], done: false };
|
|
6749
|
+
}
|
|
6750
|
+
return { value: wrap(value), done: false };
|
|
6751
|
+
},
|
|
6752
|
+
[Symbol.iterator]() {
|
|
6753
|
+
return this;
|
|
6641
6754
|
}
|
|
6642
|
-
|
|
6643
|
-
|
|
6755
|
+
};
|
|
6756
|
+
};
|
|
6757
|
+
}
|
|
6758
|
+
|
|
6759
|
+
function __rxCreateCollectionInstrumentations(isReadonlyValue) {
|
|
6760
|
+
const wrap = (value) => __rxWrapCollectionValue(value, isReadonlyValue);
|
|
6761
|
+
|
|
6762
|
+
return {
|
|
6763
|
+
get(key) {
|
|
6764
|
+
const target = toRaw(this);
|
|
6765
|
+
const rawKey = toRaw(key);
|
|
6766
|
+
__rxTrack(target, rawKey);
|
|
6767
|
+
if (rawKey !== key) {
|
|
6768
|
+
__rxTrack(target, key);
|
|
6644
6769
|
}
|
|
6645
|
-
|
|
6646
|
-
if (
|
|
6647
|
-
|
|
6770
|
+
let result = target.get(rawKey);
|
|
6771
|
+
if (result === undefined && rawKey !== key) {
|
|
6772
|
+
result = target.get(key);
|
|
6648
6773
|
}
|
|
6649
|
-
|
|
6650
|
-
|
|
6774
|
+
return wrap(result);
|
|
6775
|
+
},
|
|
6776
|
+
|
|
6777
|
+
has(key) {
|
|
6778
|
+
const target = toRaw(this);
|
|
6779
|
+
const rawKey = toRaw(key);
|
|
6780
|
+
__rxTrack(target, rawKey);
|
|
6781
|
+
if (rawKey !== key) {
|
|
6782
|
+
__rxTrack(target, key);
|
|
6651
6783
|
}
|
|
6652
|
-
return
|
|
6784
|
+
return target.has(rawKey) || (rawKey !== key && target.has(key));
|
|
6785
|
+
},
|
|
6786
|
+
|
|
6787
|
+
get size() {
|
|
6788
|
+
// 'this' is the receiver (the proxy) because instrumentations are read
|
|
6789
|
+
// via Reflect.get(instrumentations, key, receiver).
|
|
6790
|
+
const target = toRaw(this);
|
|
6791
|
+
__rxTrack(target, __rxIterateKey);
|
|
6792
|
+
return target.size;
|
|
6653
6793
|
},
|
|
6654
|
-
|
|
6794
|
+
|
|
6795
|
+
set(key, value) {
|
|
6655
6796
|
if (isReadonlyValue) {
|
|
6656
|
-
return
|
|
6797
|
+
return this;
|
|
6657
6798
|
}
|
|
6658
|
-
const
|
|
6659
|
-
const
|
|
6660
|
-
const
|
|
6661
|
-
const
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
&& Number(key) >= oldLength
|
|
6669
|
-
&& Number(key) < 4294967295
|
|
6670
|
-
) {
|
|
6671
|
-
__rxTrigger(rawTarget, "length");
|
|
6672
|
-
}
|
|
6799
|
+
const target = toRaw(this);
|
|
6800
|
+
const rawKey = toRaw(key);
|
|
6801
|
+
const rawValue = toRaw(value);
|
|
6802
|
+
const hadKey = target.has(rawKey);
|
|
6803
|
+
const oldValue = target.get(rawKey);
|
|
6804
|
+
target.set(rawKey, rawValue);
|
|
6805
|
+
if (!hadKey) {
|
|
6806
|
+
__rxTrigger(target, rawKey, "add");
|
|
6807
|
+
} else if (!Object.is(rawValue, toRaw(oldValue))) {
|
|
6808
|
+
__rxTrigger(target, rawKey, "set");
|
|
6673
6809
|
}
|
|
6674
|
-
return
|
|
6810
|
+
return this;
|
|
6675
6811
|
},
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6812
|
+
|
|
6813
|
+
add(value) {
|
|
6814
|
+
if (isReadonlyValue) {
|
|
6815
|
+
return this;
|
|
6816
|
+
}
|
|
6817
|
+
const target = toRaw(this);
|
|
6818
|
+
const rawValue = toRaw(value);
|
|
6819
|
+
const hadKey = target.has(rawValue);
|
|
6820
|
+
target.add(rawValue);
|
|
6821
|
+
if (!hadKey) {
|
|
6822
|
+
__rxTrigger(target, rawValue, "add");
|
|
6679
6823
|
}
|
|
6680
|
-
return
|
|
6824
|
+
return this;
|
|
6681
6825
|
},
|
|
6682
|
-
|
|
6826
|
+
|
|
6827
|
+
delete(key) {
|
|
6683
6828
|
if (isReadonlyValue) {
|
|
6684
|
-
return
|
|
6829
|
+
return false;
|
|
6685
6830
|
}
|
|
6686
|
-
const
|
|
6687
|
-
const
|
|
6831
|
+
const target = toRaw(this);
|
|
6832
|
+
const rawKey = toRaw(key);
|
|
6833
|
+
const hadKey = target.has(rawKey);
|
|
6834
|
+
const success = target.delete(rawKey);
|
|
6688
6835
|
if (hadKey && success) {
|
|
6689
|
-
__rxTrigger(
|
|
6836
|
+
__rxTrigger(target, rawKey, "delete");
|
|
6690
6837
|
}
|
|
6691
6838
|
return success;
|
|
6692
|
-
}
|
|
6693
|
-
|
|
6839
|
+
},
|
|
6840
|
+
|
|
6841
|
+
clear() {
|
|
6842
|
+
if (isReadonlyValue) {
|
|
6843
|
+
return undefined;
|
|
6844
|
+
}
|
|
6845
|
+
const target = toRaw(this);
|
|
6846
|
+
const hadItems = target.size !== 0;
|
|
6847
|
+
target.clear();
|
|
6848
|
+
if (hadItems) {
|
|
6849
|
+
__rxTrigger(target, __rxIterateKey, "clear");
|
|
6850
|
+
}
|
|
6851
|
+
return undefined;
|
|
6852
|
+
},
|
|
6853
|
+
|
|
6854
|
+
forEach(callback, thisArg) {
|
|
6855
|
+
const target = toRaw(this);
|
|
6856
|
+
__rxTrack(target, __rxIterateKey);
|
|
6857
|
+
target.forEach((value, key) => {
|
|
6858
|
+
callback.call(thisArg, wrap(value), wrap(key), this);
|
|
6859
|
+
});
|
|
6860
|
+
},
|
|
6861
|
+
|
|
6862
|
+
keys: __rxCreateIterableMethod("keys", isReadonlyValue),
|
|
6863
|
+
values: __rxCreateIterableMethod("values", isReadonlyValue),
|
|
6864
|
+
entries: __rxCreateIterableMethod("entries", isReadonlyValue),
|
|
6865
|
+
[Symbol.iterator]: __rxCreateIterableMethod(Symbol.iterator, isReadonlyValue)
|
|
6866
|
+
};
|
|
6867
|
+
}
|
|
6868
|
+
|
|
6869
|
+
const __rxMutableCollectionInstrumentations = __rxCreateCollectionInstrumentations(false);
|
|
6870
|
+
const __rxReadonlyCollectionInstrumentations = __rxCreateCollectionInstrumentations(true);
|
|
6871
|
+
|
|
6872
|
+
function __rxCollectionGet(instrumentations, isReadonlyValue, rawTarget, key, receiver) {
|
|
6873
|
+
if (key === __rxFlags.isReactive) {
|
|
6874
|
+
return !isReadonlyValue;
|
|
6875
|
+
}
|
|
6876
|
+
if (key === __rxFlags.isReadonly) {
|
|
6877
|
+
return isReadonlyValue;
|
|
6878
|
+
}
|
|
6879
|
+
if (key === __rxFlags.raw) {
|
|
6880
|
+
return rawTarget;
|
|
6881
|
+
}
|
|
6882
|
+
const source = Object.prototype.hasOwnProperty.call(instrumentations, key) && key in rawTarget
|
|
6883
|
+
? instrumentations
|
|
6884
|
+
: rawTarget;
|
|
6885
|
+
return Reflect.get(source, key, receiver);
|
|
6886
|
+
}
|
|
6887
|
+
|
|
6888
|
+
function __rxCreateReactiveObject(target, isReadonlyValue, proxyMap, isShallow) {
|
|
6889
|
+
const targetType = __rxIsObject(target) ? __rxGetTargetType(target) : "invalid";
|
|
6890
|
+
if (targetType === "invalid") {
|
|
6891
|
+
return target;
|
|
6892
|
+
}
|
|
6893
|
+
if (__rxProxyToRaw.has(target) && !(isReadonlyValue && isReactive(target))) {
|
|
6894
|
+
return target;
|
|
6895
|
+
}
|
|
6896
|
+
const existing = proxyMap.get(target);
|
|
6897
|
+
if (existing) {
|
|
6898
|
+
return existing;
|
|
6899
|
+
}
|
|
6900
|
+
let proxy;
|
|
6901
|
+
if (targetType === "collection") {
|
|
6902
|
+
const instrumentations = isReadonlyValue
|
|
6903
|
+
? __rxReadonlyCollectionInstrumentations
|
|
6904
|
+
: __rxMutableCollectionInstrumentations;
|
|
6905
|
+
proxy = new Proxy(target, {
|
|
6906
|
+
get(rawTarget, key, receiver) {
|
|
6907
|
+
return __rxCollectionGet(instrumentations, isReadonlyValue, rawTarget, key, receiver);
|
|
6908
|
+
}
|
|
6909
|
+
});
|
|
6910
|
+
} else {
|
|
6911
|
+
proxy = new Proxy(target, {
|
|
6912
|
+
get(rawTarget, key, receiver) {
|
|
6913
|
+
if (key === __rxFlags.isReactive) {
|
|
6914
|
+
return !isReadonlyValue;
|
|
6915
|
+
}
|
|
6916
|
+
if (key === __rxFlags.isReadonly) {
|
|
6917
|
+
return isReadonlyValue;
|
|
6918
|
+
}
|
|
6919
|
+
if (key === __rxFlags.raw) {
|
|
6920
|
+
return rawTarget;
|
|
6921
|
+
}
|
|
6922
|
+
const value = Reflect.get(rawTarget, key, receiver);
|
|
6923
|
+
if (!isReadonlyValue) {
|
|
6924
|
+
__rxTrack(rawTarget, key);
|
|
6925
|
+
}
|
|
6926
|
+
// Vue-style ref unwrapping on plain object property access. Refs
|
|
6927
|
+
// stored at array indices stay wrapped, matching the server engine.
|
|
6928
|
+
if (isRef(value)) {
|
|
6929
|
+
return !Array.isArray(rawTarget) || !__rxIsArrayIndex(key)
|
|
6930
|
+
? value.value
|
|
6931
|
+
: value;
|
|
6932
|
+
}
|
|
6933
|
+
if (isShallow || !__rxIsObject(value)) {
|
|
6934
|
+
return value;
|
|
6935
|
+
}
|
|
6936
|
+
return isReadonlyValue ? readonly(value) : reactive(value);
|
|
6937
|
+
},
|
|
6938
|
+
set(rawTarget, key, value, receiver) {
|
|
6939
|
+
if (isReadonlyValue) {
|
|
6940
|
+
return true;
|
|
6941
|
+
}
|
|
6942
|
+
const hadKey = Object.prototype.hasOwnProperty.call(rawTarget, key);
|
|
6943
|
+
const storedOldValue = Reflect.get(rawTarget, key, receiver);
|
|
6944
|
+
const oldLength = Array.isArray(rawTarget) ? rawTarget.length : 0;
|
|
6945
|
+
// Vue-style ref assignment: writing a plain value over a stored ref
|
|
6946
|
+
// updates the ref in place instead of replacing it. Arrays exempt.
|
|
6947
|
+
if (!Array.isArray(rawTarget) && isRef(storedOldValue) && !isRef(value)) {
|
|
6948
|
+
storedOldValue.value = value;
|
|
6949
|
+
return true;
|
|
6950
|
+
}
|
|
6951
|
+
const oldValue = toRaw(storedOldValue);
|
|
6952
|
+
const rawValue = toRaw(value);
|
|
6953
|
+
const success = Reflect.set(rawTarget, key, rawValue, receiver);
|
|
6954
|
+
if (success && (!hadKey || __rxHasChanged(rawValue, oldValue))) {
|
|
6955
|
+
__rxTrigger(rawTarget, key, hadKey ? "set" : "add", rawValue);
|
|
6956
|
+
if (
|
|
6957
|
+
Array.isArray(rawTarget)
|
|
6958
|
+
&& key !== "length"
|
|
6959
|
+
&& /^(?:0|[1-9]\d*)$/.test(String(key))
|
|
6960
|
+
&& Number(key) >= oldLength
|
|
6961
|
+
&& Number(key) < 4294967295
|
|
6962
|
+
) {
|
|
6963
|
+
__rxTrigger(rawTarget, "length");
|
|
6964
|
+
}
|
|
6965
|
+
}
|
|
6966
|
+
return success;
|
|
6967
|
+
},
|
|
6968
|
+
has(rawTarget, key) {
|
|
6969
|
+
const result = Reflect.has(rawTarget, key);
|
|
6970
|
+
if (!isReadonlyValue) {
|
|
6971
|
+
__rxTrack(rawTarget, key);
|
|
6972
|
+
}
|
|
6973
|
+
return result;
|
|
6974
|
+
},
|
|
6975
|
+
ownKeys(rawTarget) {
|
|
6976
|
+
if (!isReadonlyValue) {
|
|
6977
|
+
__rxTrack(rawTarget, __rxIterateKey);
|
|
6978
|
+
}
|
|
6979
|
+
return Reflect.ownKeys(rawTarget);
|
|
6980
|
+
},
|
|
6981
|
+
deleteProperty(rawTarget, key) {
|
|
6982
|
+
if (isReadonlyValue) {
|
|
6983
|
+
return true;
|
|
6984
|
+
}
|
|
6985
|
+
const hadKey = Object.prototype.hasOwnProperty.call(rawTarget, key);
|
|
6986
|
+
const success = Reflect.deleteProperty(rawTarget, key);
|
|
6987
|
+
if (hadKey && success) {
|
|
6988
|
+
__rxTrigger(rawTarget, key, "delete");
|
|
6989
|
+
}
|
|
6990
|
+
return success;
|
|
6991
|
+
}
|
|
6992
|
+
});
|
|
6993
|
+
}
|
|
6694
6994
|
proxyMap.set(target, proxy);
|
|
6995
|
+
__rxProxyToRaw.set(proxy, target);
|
|
6695
6996
|
return proxy;
|
|
6696
6997
|
}
|
|
6697
6998
|
|
|
6698
6999
|
function isReactive(value) {
|
|
6699
|
-
|
|
7000
|
+
if (!__rxIsObject(value)) {
|
|
7001
|
+
return false;
|
|
7002
|
+
}
|
|
7003
|
+
if (value[__rxFlags.isReactive]) {
|
|
7004
|
+
return true;
|
|
7005
|
+
}
|
|
7006
|
+
if (value[__rxFlags.isReadonly]) {
|
|
7007
|
+
const raw = __rxProxyToRaw.get(value);
|
|
7008
|
+
return Boolean(raw && raw !== value && isReactive(raw));
|
|
7009
|
+
}
|
|
7010
|
+
return false;
|
|
6700
7011
|
}
|
|
6701
7012
|
|
|
6702
7013
|
function isReadonly(value) {
|
|
@@ -6706,7 +7017,7 @@ function isReadonly(value) {
|
|
|
6706
7017
|
class __rxRefImpl {
|
|
6707
7018
|
constructor(value) {
|
|
6708
7019
|
this.__v_isRef = true;
|
|
6709
|
-
this._rawValue = value;
|
|
7020
|
+
this._rawValue = toRaw(value);
|
|
6710
7021
|
this._value = __rxIsObject(value) ? reactive(value) : value;
|
|
6711
7022
|
this.dep = new Set();
|
|
6712
7023
|
}
|
|
@@ -6722,10 +7033,11 @@ class __rxRefImpl {
|
|
|
6722
7033
|
}
|
|
6723
7034
|
|
|
6724
7035
|
set value(newValue) {
|
|
6725
|
-
|
|
7036
|
+
const rawValue = toRaw(newValue);
|
|
7037
|
+
if (!__rxHasChanged(rawValue, this._rawValue)) {
|
|
6726
7038
|
return;
|
|
6727
7039
|
}
|
|
6728
|
-
this._rawValue =
|
|
7040
|
+
this._rawValue = rawValue;
|
|
6729
7041
|
this._value = __rxIsObject(newValue) ? reactive(newValue) : newValue;
|
|
6730
7042
|
__rxTriggerEffects(this.dep);
|
|
6731
7043
|
}
|
|
@@ -6855,8 +7167,13 @@ function __rxDoWatch(source, callback, options) {
|
|
|
6855
7167
|
}
|
|
6856
7168
|
|
|
6857
7169
|
let oldValue = __rxInitialWatchValue;
|
|
7170
|
+
let stopped = false;
|
|
6858
7171
|
|
|
6859
7172
|
const job = () => {
|
|
7173
|
+
if (stopped) {
|
|
7174
|
+
return;
|
|
7175
|
+
}
|
|
7176
|
+
|
|
6860
7177
|
if (callback === null) {
|
|
6861
7178
|
runner();
|
|
6862
7179
|
return;
|
|
@@ -6874,7 +7191,7 @@ function __rxDoWatch(source, callback, options) {
|
|
|
6874
7191
|
|
|
6875
7192
|
const scheduler = flush === "sync"
|
|
6876
7193
|
? job
|
|
6877
|
-
: () =>
|
|
7194
|
+
: () => __rxQueuePostFlushCb(job);
|
|
6878
7195
|
|
|
6879
7196
|
const runner = effect(getter, {
|
|
6880
7197
|
scheduler,
|
|
@@ -6890,6 +7207,10 @@ function __rxDoWatch(source, callback, options) {
|
|
|
6890
7207
|
}
|
|
6891
7208
|
|
|
6892
7209
|
return () => {
|
|
7210
|
+
if (stopped) {
|
|
7211
|
+
return;
|
|
7212
|
+
}
|
|
7213
|
+
stopped = true;
|
|
6893
7214
|
if (cleanup) {
|
|
6894
7215
|
cleanup();
|
|
6895
7216
|
cleanup = undefined;
|
|
@@ -7043,7 +7364,11 @@ function readClientTranslation(messages, localeCode, key) {
|
|
|
7043
7364
|
|
|
7044
7365
|
function interpolateClientTranslation(value, params = {}) {
|
|
7045
7366
|
if (typeof value !== "string") return value;
|
|
7046
|
-
return value.replace(/\{([
|
|
7367
|
+
return value.replace(/\{([A-Za-z0-9_]+)\}/g, (match, key) => {
|
|
7368
|
+
const param = params[key];
|
|
7369
|
+
if (param === undefined || param === null) return match;
|
|
7370
|
+
return String(param);
|
|
7371
|
+
});
|
|
7047
7372
|
}
|
|
7048
7373
|
|
|
7049
7374
|
function buildClientLocalePath(to, localeCode, config) {
|
|
@@ -7075,7 +7400,9 @@ function useClientI18n(routeOverride) {
|
|
|
7075
7400
|
const dir = computed(() => config.locales.find((entry) => entry.code === locale.value)?.dir || "ltr");
|
|
7076
7401
|
const t = (key, params = {}) => {
|
|
7077
7402
|
const value = readClientTranslation(config.messages, locale.value, key) ?? readClientTranslation(config.messages, config.fallbackLocale, key);
|
|
7078
|
-
|
|
7403
|
+
if (typeof value === "string") return interpolateClientTranslation(value, params);
|
|
7404
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
7405
|
+
return String(key);
|
|
7079
7406
|
};
|
|
7080
7407
|
const tm = (key) => readClientTranslation(config.messages, locale.value, key) ?? readClientTranslation(config.messages, config.fallbackLocale, key) ?? key;
|
|
7081
7408
|
return {
|
|
@@ -7958,7 +8285,7 @@ export function createClientComponent(definition) {
|
|
|
7958
8285
|
setRegistryValue(
|
|
7959
8286
|
stateRefs,
|
|
7960
8287
|
normalizedKey,
|
|
7961
|
-
ref(hasValue ? serializedScope.state[normalizedKey] : factory
|
|
8288
|
+
ref(hasValue ? serializedScope.state[normalizedKey] : createClientStateValue(normalizedKey, factory))
|
|
7962
8289
|
);
|
|
7963
8290
|
}
|
|
7964
8291
|
return stateRefs[normalizedKey];
|
|
@@ -13448,7 +13775,9 @@ function renderElement(node, scope, locals, styleScopeId, scopeId, moduleId) {
|
|
|
13448
13775
|
if (event.locals && event.locals.length) {
|
|
13449
13776
|
const eventLocals = {};
|
|
13450
13777
|
for (const name of event.locals) {
|
|
13451
|
-
if (Object.prototype.hasOwnProperty.call(locals, name))
|
|
13778
|
+
if (!Object.prototype.hasOwnProperty.call(locals, name)) continue;
|
|
13779
|
+
if (locals[name] !== undefined) assertJsonSerializableInDev(locals[name], 'event local "' + name + '"');
|
|
13780
|
+
eventLocals[name] = locals[name];
|
|
13452
13781
|
}
|
|
13453
13782
|
attrs.push('data-rx-locals-' + event.name + '=\"' + escapeAttribute(JSON.stringify(eventLocals)) + '\"');
|
|
13454
13783
|
}
|
|
@@ -15770,6 +16099,27 @@ function assertJsonSerializable(value, label) {
|
|
|
15770
16099
|
}
|
|
15771
16100
|
}
|
|
15772
16101
|
|
|
16102
|
+
function isClientDevMode() {
|
|
16103
|
+
if (!isClientRuntime()) {
|
|
16104
|
+
return false;
|
|
16105
|
+
}
|
|
16106
|
+
return Boolean(import.meta && import.meta.env && import.meta.env.DEV) || Boolean(window.__RESUX_DEV_RELOAD__);
|
|
16107
|
+
}
|
|
16108
|
+
|
|
16109
|
+
// Mirrors the server's assertJsonSerializable checks for client-created state
|
|
16110
|
+
// and event locals, but only in dev so production pays no extra serialization.
|
|
16111
|
+
function assertJsonSerializableInDev(value, label) {
|
|
16112
|
+
if (isClientDevMode()) {
|
|
16113
|
+
assertJsonSerializable(value, label);
|
|
16114
|
+
}
|
|
16115
|
+
}
|
|
16116
|
+
|
|
16117
|
+
function createClientStateValue(key, factory) {
|
|
16118
|
+
const value = factory?.();
|
|
16119
|
+
assertJsonSerializableInDev(value, 'useState("' + key + '")');
|
|
16120
|
+
return value;
|
|
16121
|
+
}
|
|
16122
|
+
|
|
15773
16123
|
function cloneJsonSerializable(value, label) {
|
|
15774
16124
|
assertJsonSerializable(value, label);
|
|
15775
16125
|
return JSON.parse(JSON.stringify(value));
|