@raphy-js/raph 1.0.1-dev.20 → 1.0.1-dev.25
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/{core-CyilRD7s.js → core-CClhT8WR.js} +389 -400
- package/dist/core-cPQWYD4K.cjs +1 -0
- package/dist/debug/api/Raph.cjs +1 -1
- package/dist/debug/api/Raph.js +46 -47
- package/dist/debug/api/RaphFacadeSession.cjs +1 -1
- package/dist/debug/api/RaphFacadeSession.js +85 -89
- package/dist/debug/api/RaphReactivityInstance.cjs +1 -1
- package/dist/debug/api/RaphReactivityInstance.js +27 -30
- package/dist/debug/path/DataPath.cjs +1 -1
- package/dist/debug/path/DataPath.js +198 -202
- package/dist/debug/path/PathRouter.cjs +1 -1
- package/dist/debug/path/PathRouter.js +44 -50
- package/dist/debug/path/RaphKernel.cjs +1 -1
- package/dist/debug/path/RaphKernel.js +257 -228
- package/dist/debug/path/data-path.utils.cjs +1 -1
- package/dist/debug/path/data-path.utils.js +41 -41
- package/dist/debug/path/derived/DerivedRegistry.cjs +1 -1
- package/dist/debug/path/derived/DerivedRegistry.js +52 -66
- package/dist/debug/path/derived/RaphDerivedHandle.cjs +1 -1
- package/dist/debug/path/derived/RaphDerivedHandle.js +19 -22
- package/dist/debug/path/derived/derived-collection.utils.cjs +1 -1
- package/dist/debug/path/derived/derived-collection.utils.js +70 -70
- package/dist/debug/path/meta/MetaController.cjs +1 -1
- package/dist/debug/path/meta/MetaController.js +57 -65
- package/dist/debug/path/meta/RaphMeta.cjs +1 -1
- package/dist/debug/path/meta/RaphMeta.js +26 -32
- package/dist/debug/path/meta/RaphMetaStore.cjs +1 -1
- package/dist/debug/path/meta/RaphMetaStore.js +24 -30
- package/dist/debug/path/storage/AdapterPathStore.cjs +1 -1
- package/dist/debug/path/storage/AdapterPathStore.js +49 -54
- package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -1
- package/dist/debug/path/storage/DefaultDataAdapter.js +46 -56
- package/dist/debug/path/storage/PathEventHub.cjs +1 -1
- package/dist/debug/path/storage/PathEventHub.js +74 -61
- package/dist/debug/path/storage/PathStore.cjs +1 -1
- package/dist/debug/path/storage/PathStore.js +89 -99
- package/dist/debug/path/storage/createDataDraft.cjs +1 -1
- package/dist/debug/path/storage/createDataDraft.js +24 -28
- package/dist/debug/reactivity/disposal.cjs +1 -0
- package/dist/debug/reactivity/disposal.js +32 -0
- package/dist/debug/reactivity/engine.cjs +1 -1
- package/dist/debug/reactivity/engine.js +787 -392
- package/dist/debug/reactivity/reactive-object.cjs +1 -1
- package/dist/debug/reactivity/reactive-object.js +81 -96
- package/dist/debug/reactivity/scope.cjs +1 -1
- package/dist/debug/reactivity/scope.js +221 -117
- package/dist/debug/reactivity/watch.cjs +1 -1
- package/dist/debug/reactivity/watch.js +1 -1
- package/dist/debug/runtime/RaphRuntime.cjs +1 -1
- package/dist/debug/runtime/RaphRuntime.js +764 -411
- package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -1
- package/dist/debug/runtime/diagnostics/RaphDebug.js +90 -100
- package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -1
- package/dist/debug/runtime/ownership/RaphEffectScope.js +215 -82
- package/dist/debug/runtime/ownership/RaphNode.cjs +1 -1
- package/dist/debug/runtime/ownership/RaphNode.js +595 -136
- package/dist/debug/runtime/ownership/RaphScope.cjs +1 -1
- package/dist/debug/runtime/ownership/RaphScope.js +203 -68
- package/dist/debug/runtime/phases/RaphFrameLoop.cjs +1 -1
- package/dist/debug/runtime/phases/RaphFrameLoop.js +13 -17
- package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -1
- package/dist/debug/runtime/phases/RaphPhasePipeline.js +618 -357
- package/dist/debug/runtime/phases/RaphPhaseTaskRecord.cjs +1 -0
- package/dist/debug/runtime/phases/RaphPhaseTaskRecord.js +176 -0
- package/dist/debug/runtime/phases/RaphPhaseWatch.cjs +1 -0
- package/dist/debug/runtime/phases/RaphPhaseWatch.js +20 -0
- package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -1
- package/dist/debug/runtime/reactivity/PathHandle.js +50 -60
- package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -1
- package/dist/debug/runtime/reactivity/RaphMetaSource.js +28 -32
- package/dist/debug/runtime/reactivity/RaphSelector.cjs +1 -0
- package/dist/debug/runtime/reactivity/RaphSelector.js +503 -0
- package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -1
- package/dist/debug/runtime/reactivity/RaphWorkGraph.js +541 -379
- package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -1
- package/dist/debug/runtime/reactivity/RuntimeReactivity.js +484 -90
- package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -1
- package/dist/debug/runtime/reactivity/RuntimeWatch.js +33 -44
- package/dist/debug/runtime/reactivity/disposal-sweep.utils.cjs +1 -0
- package/dist/debug/runtime/reactivity/disposal-sweep.utils.js +42 -0
- package/dist/entrypoints/runtime.d.ts +2 -1
- package/dist/machine-testing.cjs +1 -1
- package/dist/machine-testing.js +1 -1
- package/dist/machine.cjs +1 -1
- package/dist/machine.js +216 -231
- package/dist/path/RaphKernel.d.ts +24 -0
- package/dist/path/storage/PathEventHub.d.ts +14 -0
- package/dist/path/storage/PathStore.d.ts +4 -4
- package/dist/reactivity/disposal.d.ts +14 -0
- package/dist/reactivity/engine.d.ts +177 -4
- package/dist/reactivity/scope.d.ts +108 -30
- package/dist/runtime/RaphRuntime.d.ts +236 -17
- package/dist/runtime/ownership/RaphEffectScope.d.ts +70 -1
- package/dist/runtime/ownership/RaphNode.d.ts +276 -6
- package/dist/runtime/ownership/RaphScope.d.ts +144 -14
- package/dist/runtime/phases/RaphPhasePipeline.d.ts +202 -28
- package/dist/runtime/phases/RaphPhaseTaskRecord.d.ts +195 -0
- package/dist/runtime/phases/RaphPhaseWatch.d.ts +22 -0
- package/dist/runtime/phases/phase.types.d.ts +83 -4
- package/dist/runtime/reactivity/RaphSelector.d.ts +338 -0
- package/dist/runtime/reactivity/RaphWorkGraph.d.ts +163 -25
- package/dist/runtime/reactivity/RuntimeReactivity.d.ts +258 -10
- package/dist/runtime/reactivity/RuntimeWatch.d.ts +8 -8
- package/dist/runtime/reactivity/disposal-sweep.utils.d.ts +19 -0
- package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +48 -3
- package/package.json +9 -1
- package/dist/core-ugchZNqC.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=Symbol("raph.reactive-object.identity"),x=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]),f=new WeakMap,g=new WeakMap,l=new WeakMap,T=Object.freeze({}),O=Object.freeze({assertRead:p,assertWrite:p,throwForeign:p});function j(s,e){g.set(s,e)}function A(s,e=O){g.delete(s);const t=f.get(s);t!==void 0&&(f.delete(s),t.dispose(e))}function M(s,e,t){const r=d(e),i=f.get(s);if(r!==void 0){if(r.context===i)return e;throw(g.get(s)??T).throwForeign?.(r.context.owner),new TypeError("[Raph] Reactive object belongs to another reactivity engine.")}return D(e),(i??W(s,t)).wrap(e)}class P{_rawToProxy=new WeakMap;_rawToTracking=new WeakMap;_arrayMethods=new Map;_bridge;_policy;_writeDepth=0;_disposed=!1;_handler;_weakSelf;constructor(e,t){this._bridge=e,this._policy=t,this._weakSelf=new WeakRef(this),this._handler={defineProperty:(r,i,n)=>this._define(r,i,n),deleteProperty:(r,i)=>this._delete(r,i),get:(r,i,n)=>this._get(r,i,n),has:(r,i)=>this._has(r,i),ownKeys:r=>this._ownKeys(r),set:(r,i,n)=>this._set(r,i,n)}}get owner(){return this._policy.owner}get disposed(){return this._disposed}wrap(e){const t=d(e);if(t!==void 0){if(t.context===this)return e;throw this._policy.throwForeign?.(t.context.owner),new TypeError("[Raph] Reactive object belongs to another reactivity engine.")}D(e);const r=v(e);if(r!==void 0&&r!==this&&!r.disposed)throw this._policy.throwForeign?.(r.owner),new TypeError("[Raph] Raw reactive object belongs to another reactivity engine.");const i=this._rawToProxy.get(e);if(i!==void 0)return i;const n=new Proxy(e,this._handler);return l.set(e,this._weakSelf),this._rawToProxy.set(e,n),n}dispose(e){this._disposed=!0,this._policy=e,this._bridge=void 0,this._rawToProxy=new WeakMap,this._rawToTracking=new WeakMap,this._arrayMethods.clear()}_get(e,t,r){if(t===R)return{context:this,raw:e};this._policy.assertRead?.();const i=Reflect.get(e,t,r);return this._trackValue(e,t),Array.isArray(e)&&x.has(t)&&i===Array.prototype[t]?this._arrayMutator(t):w(i)?this.wrap(i):i}_set(e,t,r){return this._write(()=>{const i=this._unwrap(r),n=Object.hasOwn(e,t),o=Reflect.get(e,t,e),c=Array.isArray(e)?e.length:0;if(n&&o===i)return!0;if(!Reflect.set(e,t,i,e))return!1;const h=this._rawToTracking.get(e);return h===void 0||(this._trigger(h.valueDeps?.get(t)),n||(this._trigger(h.hasDeps?.get(t)),this._trigger(h.iterateDep)),this._triggerArrayShape(e,t,i,c,h)),!0})}_define(e,t,r){return this._write(()=>{const i=Object.hasOwn(e,t),n=Reflect.getOwnPropertyDescriptor(e,t),o=Reflect.get(e,t,e),c=Array.isArray(e)?e.length:0,a="value"in r?{...r,value:this._unwrap(r.value)}:r;if(!Reflect.defineProperty(e,t,a))return!1;const u=this._rawToTracking.get(e);if(u===void 0)return!0;const y=Reflect.getOwnPropertyDescriptor(e,t),b=Reflect.get(e,t,e);return(!i||o!==b||!m(n,y))&&this._trigger(u.valueDeps?.get(t)),i?n?.enumerable!==y?.enumerable&&this._trigger(u.iterateDep):(this._trigger(u.hasDeps?.get(t)),this._trigger(u.iterateDep)),this._triggerArrayShape(e,t,b,c,u),!0})}_delete(e,t){return this._write(()=>{if(!Object.hasOwn(e,t))return!0;if(!Reflect.deleteProperty(e,t))return!1;const i=this._rawToTracking.get(e);return i!==void 0&&(this._trigger(i.valueDeps?.get(t)),this._trigger(i.hasDeps?.get(t)),this._trigger(i.iterateDep)),!0})}_has(e,t){return this._policy.assertRead?.(),this._trackHas(e,t),Reflect.has(e,t)}_ownKeys(e){return this._policy.assertRead?.(),this._trackIterate(e),Reflect.ownKeys(e)}_arrayMutator(e){const t=this._arrayMethods.get(e);if(t!==void 0)return t;const r=n=>this._write(n),i=function(...n){return r(()=>Reflect.apply(Array.prototype[e],this,n))};return this._arrayMethods.set(e,i),i}_trackValue(e,t){const r=this._requireBridge();if(!r.isTracking())return;const i=this._ensureTracking(e),n=i.valueDeps??=new Map;let o=n.get(t);o===void 0&&(o=r.create(),n.set(t,o)),r.track(o)}_trackHas(e,t){const r=this._requireBridge();if(!r.isTracking())return;const i=this._ensureTracking(e),n=i.hasDeps??=new Map;let o=n.get(t);o===void 0&&(o=r.create(),n.set(t,o)),r.track(o)}_trackIterate(e){const t=this._requireBridge();if(!t.isTracking())return;const r=this._ensureTracking(e),i=r.iterateDep??=t.create();t.track(i)}_ensureTracking(e){let t=this._rawToTracking.get(e);return t===void 0&&(t={},this._rawToTracking.set(e,t)),t}_trigger(e){e!==void 0&&this._requireBridge().trigger(e)}_triggerArrayShape(e,t,r,i,n){if(!Array.isArray(e))return;if(_(t)&&Number(t)>=i){this._trigger(n.valueDeps?.get("length"));return}if(t!=="length"||Number(r)>=i)return;const o=Number(r);for(const[c,a]of n.valueDeps?.entries()??[])_(c)&&Number(c)>=o&&this._trigger(a);for(const[c,a]of n.hasDeps?.entries()??[])_(c)&&Number(c)>=o&&this._trigger(a);this._trigger(n.iterateDep)}_write(e){if(this._policy.assertWrite?.(),this._writeDepth!==0)return e();const t=()=>{++this._writeDepth;try{return this._requireBridge().batch(e)}finally{--this._writeDepth}};return this._policy.runWrite===void 0?t():this._policy.runWrite(t)}_unwrap(e){const t=d(e);if(t===void 0){if(w(e)){const r=v(e);if(r!==void 0&&r!==this&&!r.disposed)throw this._policy.throwForeign?.(r.owner),new TypeError("[Raph] Raw reactive object belongs to another reactivity engine.")}return e}if(t.context!==this)throw this._policy.throwForeign?.(t.context.owner),new TypeError("[Raph] Reactive object belongs to another reactivity engine.");return t.raw}_requireBridge(){const e=this._bridge;return e===void 0&&p(),e}}function W(s,e){const t=new P(e(),g.get(s)??T);return f.set(s,t),t}function v(s){const e=l.get(s),t=e?.deref();return e!==void 0&&t===void 0&&l.delete(s),t}function d(s){if(!(s===null||typeof s!="object"))return Reflect.get(s,R)}function w(s){if(s===null||typeof s!="object")return!1;if(Array.isArray(s))return!0;const e=Object.getPrototypeOf(s);return e===Object.prototype||e===null}function D(s){if(!w(s))throw new TypeError("[Raph] reactive() accepts only plain objects and arrays.")}function _(s){if(typeof s!="string"||s==="")return!1;const e=Number(s);return Number.isInteger(e)&&e>=0&&e<4294967295&&String(e)===s}function m(s,e){return s===e?!0:s===void 0||e===void 0?!1:s.configurable===e.configurable&&s.enumerable===e.enumerable&&s.get===e.get&&s.set===e.set&&s.value===e.value&&s.writable===e.writable}function p(){throw new Error("[Raph] Reactive object owner is disposed.")}exports.configureReactiveObjectPolicy=j;exports.disposeReactiveObjectContext=A;exports.reactiveObject=M;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var M = (s, e, t) => e in s ? A(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var p = (s, e, t) => M(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
const D = Symbol("raph.reactive-object.identity"), P = /* @__PURE__ */ new Set([
|
|
1
|
+
const R = Symbol("raph.reactive-object.identity"), x = /* @__PURE__ */ new Set([
|
|
5
2
|
"copyWithin",
|
|
6
3
|
"fill",
|
|
7
4
|
"pop",
|
|
@@ -11,41 +8,39 @@ const D = Symbol("raph.reactive-object.identity"), P = /* @__PURE__ */ new Set([
|
|
|
11
8
|
"sort",
|
|
12
9
|
"splice",
|
|
13
10
|
"unshift"
|
|
14
|
-
]),
|
|
15
|
-
assertRead:
|
|
16
|
-
assertWrite:
|
|
17
|
-
throwForeign:
|
|
11
|
+
]), f = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), T = Object.freeze({}), O = Object.freeze({
|
|
12
|
+
assertRead: p,
|
|
13
|
+
assertWrite: p,
|
|
14
|
+
throwForeign: p
|
|
18
15
|
});
|
|
19
|
-
function
|
|
20
|
-
|
|
16
|
+
function P(s, e) {
|
|
17
|
+
_.set(s, e);
|
|
21
18
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
const t =
|
|
25
|
-
t !== void 0 && (
|
|
19
|
+
function W(s, e = O) {
|
|
20
|
+
_.delete(s);
|
|
21
|
+
const t = f.get(s);
|
|
22
|
+
t !== void 0 && (f.delete(s), t.dispose(e));
|
|
26
23
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
const r = b(e), i = g.get(s);
|
|
24
|
+
function m(s, e, t) {
|
|
25
|
+
const r = w(e), i = f.get(s);
|
|
30
26
|
if (r !== void 0) {
|
|
31
27
|
if (r.context === i)
|
|
32
28
|
return e;
|
|
33
|
-
|
|
34
|
-
throw (o = c.throwForeign) == null || o.call(c, r.context.owner), new TypeError("[Raph] Reactive object belongs to another reactivity engine.");
|
|
29
|
+
throw (_.get(s) ?? T).throwForeign?.(r.context.owner), new TypeError("[Raph] Reactive object belongs to another reactivity engine.");
|
|
35
30
|
}
|
|
36
|
-
return
|
|
31
|
+
return D(e), (i ?? A(s, t)).wrap(e);
|
|
37
32
|
}
|
|
38
|
-
class
|
|
33
|
+
class j {
|
|
34
|
+
_rawToProxy = /* @__PURE__ */ new WeakMap();
|
|
35
|
+
_rawToTracking = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
_arrayMethods = /* @__PURE__ */ new Map();
|
|
37
|
+
_bridge;
|
|
38
|
+
_policy;
|
|
39
|
+
_writeDepth = 0;
|
|
40
|
+
_disposed = !1;
|
|
41
|
+
_handler;
|
|
42
|
+
_weakSelf;
|
|
39
43
|
constructor(e, t) {
|
|
40
|
-
p(this, "_rawToProxy", /* @__PURE__ */ new WeakMap());
|
|
41
|
-
p(this, "_rawToTracking", /* @__PURE__ */ new WeakMap());
|
|
42
|
-
p(this, "_arrayMethods", /* @__PURE__ */ new Map());
|
|
43
|
-
p(this, "_bridge");
|
|
44
|
-
p(this, "_policy");
|
|
45
|
-
p(this, "_writeDepth", 0);
|
|
46
|
-
p(this, "_disposed", !1);
|
|
47
|
-
p(this, "_handler");
|
|
48
|
-
p(this, "_weakSelf");
|
|
49
44
|
this._bridge = e, this._policy = t, this._weakSelf = new WeakRef(this), this._handler = {
|
|
50
45
|
defineProperty: (r, i, n) => this._define(r, i, n),
|
|
51
46
|
deleteProperty: (r, i) => this._delete(r, i),
|
|
@@ -62,83 +57,76 @@ class m {
|
|
|
62
57
|
return this._disposed;
|
|
63
58
|
}
|
|
64
59
|
wrap(e) {
|
|
65
|
-
|
|
66
|
-
const t = b(e);
|
|
60
|
+
const t = w(e);
|
|
67
61
|
if (t !== void 0) {
|
|
68
62
|
if (t.context === this)
|
|
69
63
|
return e;
|
|
70
|
-
throw
|
|
64
|
+
throw this._policy.throwForeign?.(t.context.owner), new TypeError("[Raph] Reactive object belongs to another reactivity engine.");
|
|
71
65
|
}
|
|
72
|
-
|
|
73
|
-
const r =
|
|
66
|
+
D(e);
|
|
67
|
+
const r = v(e);
|
|
74
68
|
if (r !== void 0 && r !== this && !r.disposed)
|
|
75
|
-
throw
|
|
69
|
+
throw this._policy.throwForeign?.(r.owner), new TypeError("[Raph] Raw reactive object belongs to another reactivity engine.");
|
|
76
70
|
const i = this._rawToProxy.get(e);
|
|
77
71
|
if (i !== void 0)
|
|
78
72
|
return i;
|
|
79
73
|
const n = new Proxy(e, this._handler);
|
|
80
|
-
return
|
|
74
|
+
return l.set(e, this._weakSelf), this._rawToProxy.set(e, n), n;
|
|
81
75
|
}
|
|
82
76
|
dispose(e) {
|
|
83
77
|
this._disposed = !0, this._policy = e, this._bridge = void 0, this._rawToProxy = /* @__PURE__ */ new WeakMap(), this._rawToTracking = /* @__PURE__ */ new WeakMap(), this._arrayMethods.clear();
|
|
84
78
|
}
|
|
85
79
|
_get(e, t, r) {
|
|
86
|
-
|
|
87
|
-
if (t === D)
|
|
80
|
+
if (t === R)
|
|
88
81
|
return { context: this, raw: e };
|
|
89
|
-
|
|
82
|
+
this._policy.assertRead?.();
|
|
90
83
|
const i = Reflect.get(e, t, r);
|
|
91
|
-
return this._trackValue(e, t), Array.isArray(e) &&
|
|
84
|
+
return this._trackValue(e, t), Array.isArray(e) && x.has(t) && i === Array.prototype[t] ? this._arrayMutator(t) : d(i) ? this.wrap(i) : i;
|
|
92
85
|
}
|
|
93
86
|
_set(e, t, r) {
|
|
94
87
|
return this._write(() => {
|
|
95
|
-
var a, u;
|
|
96
88
|
const i = this._unwrap(r), n = Object.hasOwn(e, t), o = Reflect.get(e, t, e), c = Array.isArray(e) ? e.length : 0;
|
|
97
89
|
if (n && o === i)
|
|
98
90
|
return !0;
|
|
99
91
|
if (!Reflect.set(e, t, i, e))
|
|
100
92
|
return !1;
|
|
101
93
|
const h = this._rawToTracking.get(e);
|
|
102
|
-
return h === void 0 || (this._trigger(
|
|
94
|
+
return h === void 0 || (this._trigger(h.valueDeps?.get(t)), n || (this._trigger(h.hasDeps?.get(t)), this._trigger(h.iterateDep)), this._triggerArrayShape(e, t, i, c, h)), !0;
|
|
103
95
|
});
|
|
104
96
|
}
|
|
105
97
|
_define(e, t, r) {
|
|
106
98
|
return this._write(() => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!Reflect.defineProperty(e, t, _))
|
|
99
|
+
const i = Object.hasOwn(e, t), n = Reflect.getOwnPropertyDescriptor(e, t), o = Reflect.get(e, t, e), c = Array.isArray(e) ? e.length : 0, a = "value" in r ? { ...r, value: this._unwrap(r.value) } : r;
|
|
100
|
+
if (!Reflect.defineProperty(e, t, a))
|
|
110
101
|
return !1;
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
102
|
+
const u = this._rawToTracking.get(e);
|
|
103
|
+
if (u === void 0)
|
|
113
104
|
return !0;
|
|
114
|
-
const
|
|
115
|
-
return (!i || o !==
|
|
105
|
+
const y = Reflect.getOwnPropertyDescriptor(e, t), b = Reflect.get(e, t, e);
|
|
106
|
+
return (!i || o !== b || !M(n, y)) && this._trigger(u.valueDeps?.get(t)), i ? n?.enumerable !== y?.enumerable && this._trigger(u.iterateDep) : (this._trigger(u.hasDeps?.get(t)), this._trigger(u.iterateDep)), this._triggerArrayShape(
|
|
116
107
|
e,
|
|
117
108
|
t,
|
|
118
|
-
|
|
109
|
+
b,
|
|
119
110
|
c,
|
|
120
|
-
|
|
111
|
+
u
|
|
121
112
|
), !0;
|
|
122
113
|
});
|
|
123
114
|
}
|
|
124
115
|
_delete(e, t) {
|
|
125
116
|
return this._write(() => {
|
|
126
|
-
var n, o;
|
|
127
117
|
if (!Object.hasOwn(e, t))
|
|
128
118
|
return !0;
|
|
129
119
|
if (!Reflect.deleteProperty(e, t))
|
|
130
120
|
return !1;
|
|
131
121
|
const i = this._rawToTracking.get(e);
|
|
132
|
-
return i !== void 0 && (this._trigger(
|
|
122
|
+
return i !== void 0 && (this._trigger(i.valueDeps?.get(t)), this._trigger(i.hasDeps?.get(t)), this._trigger(i.iterateDep)), !0;
|
|
133
123
|
});
|
|
134
124
|
}
|
|
135
125
|
_has(e, t) {
|
|
136
|
-
|
|
137
|
-
return (i = (r = this._policy).assertRead) == null || i.call(r), this._trackHas(e, t), Reflect.has(e, t);
|
|
126
|
+
return this._policy.assertRead?.(), this._trackHas(e, t), Reflect.has(e, t);
|
|
138
127
|
}
|
|
139
128
|
_ownKeys(e) {
|
|
140
|
-
|
|
141
|
-
return (r = (t = this._policy).assertRead) == null || r.call(t), this._trackIterate(e), Reflect.ownKeys(e);
|
|
129
|
+
return this._policy.assertRead?.(), this._trackIterate(e), Reflect.ownKeys(e);
|
|
142
130
|
}
|
|
143
131
|
_arrayMutator(e) {
|
|
144
132
|
const t = this._arrayMethods.get(e);
|
|
@@ -157,7 +145,7 @@ class m {
|
|
|
157
145
|
const r = this._requireBridge();
|
|
158
146
|
if (!r.isTracking())
|
|
159
147
|
return;
|
|
160
|
-
const i = this._ensureTracking(e), n = i.valueDeps
|
|
148
|
+
const i = this._ensureTracking(e), n = i.valueDeps ??= /* @__PURE__ */ new Map();
|
|
161
149
|
let o = n.get(t);
|
|
162
150
|
o === void 0 && (o = r.create(), n.set(t, o)), r.track(o);
|
|
163
151
|
}
|
|
@@ -165,7 +153,7 @@ class m {
|
|
|
165
153
|
const r = this._requireBridge();
|
|
166
154
|
if (!r.isTracking())
|
|
167
155
|
return;
|
|
168
|
-
const i = this._ensureTracking(e), n = i.hasDeps
|
|
156
|
+
const i = this._ensureTracking(e), n = i.hasDeps ??= /* @__PURE__ */ new Map();
|
|
169
157
|
let o = n.get(t);
|
|
170
158
|
o === void 0 && (o = r.create(), n.set(t, o)), r.track(o);
|
|
171
159
|
}
|
|
@@ -173,7 +161,7 @@ class m {
|
|
|
173
161
|
const t = this._requireBridge();
|
|
174
162
|
if (!t.isTracking())
|
|
175
163
|
return;
|
|
176
|
-
const r = this._ensureTracking(e), i = r.iterateDep
|
|
164
|
+
const r = this._ensureTracking(e), i = r.iterateDep ??= t.create();
|
|
177
165
|
t.track(i);
|
|
178
166
|
}
|
|
179
167
|
_ensureTracking(e) {
|
|
@@ -184,25 +172,23 @@ class m {
|
|
|
184
172
|
e !== void 0 && this._requireBridge().trigger(e);
|
|
185
173
|
}
|
|
186
174
|
_triggerArrayShape(e, t, r, i, n) {
|
|
187
|
-
var c, _, h;
|
|
188
175
|
if (!Array.isArray(e))
|
|
189
176
|
return;
|
|
190
|
-
if (
|
|
191
|
-
this._trigger(
|
|
177
|
+
if (g(t) && Number(t) >= i) {
|
|
178
|
+
this._trigger(n.valueDeps?.get("length"));
|
|
192
179
|
return;
|
|
193
180
|
}
|
|
194
181
|
if (t !== "length" || Number(r) >= i)
|
|
195
182
|
return;
|
|
196
183
|
const o = Number(r);
|
|
197
|
-
for (const [
|
|
198
|
-
|
|
199
|
-
for (const [
|
|
200
|
-
|
|
184
|
+
for (const [c, a] of n.valueDeps?.entries() ?? [])
|
|
185
|
+
g(c) && Number(c) >= o && this._trigger(a);
|
|
186
|
+
for (const [c, a] of n.hasDeps?.entries() ?? [])
|
|
187
|
+
g(c) && Number(c) >= o && this._trigger(a);
|
|
201
188
|
this._trigger(n.iterateDep);
|
|
202
189
|
}
|
|
203
190
|
_write(e) {
|
|
204
|
-
|
|
205
|
-
if ((i = (r = this._policy).assertWrite) == null || i.call(r), this._writeDepth !== 0)
|
|
191
|
+
if (this._policy.assertWrite?.(), this._writeDepth !== 0)
|
|
206
192
|
return e();
|
|
207
193
|
const t = () => {
|
|
208
194
|
++this._writeDepth;
|
|
@@ -215,41 +201,40 @@ class m {
|
|
|
215
201
|
return this._policy.runWrite === void 0 ? t() : this._policy.runWrite(t);
|
|
216
202
|
}
|
|
217
203
|
_unwrap(e) {
|
|
218
|
-
|
|
219
|
-
const t = b(e);
|
|
204
|
+
const t = w(e);
|
|
220
205
|
if (t === void 0) {
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
223
|
-
if (
|
|
224
|
-
throw
|
|
206
|
+
if (d(e)) {
|
|
207
|
+
const r = v(e);
|
|
208
|
+
if (r !== void 0 && r !== this && !r.disposed)
|
|
209
|
+
throw this._policy.throwForeign?.(r.owner), new TypeError("[Raph] Raw reactive object belongs to another reactivity engine.");
|
|
225
210
|
}
|
|
226
211
|
return e;
|
|
227
212
|
}
|
|
228
213
|
if (t.context !== this)
|
|
229
|
-
throw
|
|
214
|
+
throw this._policy.throwForeign?.(t.context.owner), new TypeError("[Raph] Reactive object belongs to another reactivity engine.");
|
|
230
215
|
return t.raw;
|
|
231
216
|
}
|
|
232
217
|
_requireBridge() {
|
|
233
218
|
const e = this._bridge;
|
|
234
|
-
return e === void 0 &&
|
|
219
|
+
return e === void 0 && p(), e;
|
|
235
220
|
}
|
|
236
221
|
}
|
|
237
|
-
function
|
|
238
|
-
const t = new
|
|
222
|
+
function A(s, e) {
|
|
223
|
+
const t = new j(
|
|
239
224
|
e(),
|
|
240
|
-
|
|
225
|
+
_.get(s) ?? T
|
|
241
226
|
);
|
|
242
|
-
return
|
|
227
|
+
return f.set(s, t), t;
|
|
243
228
|
}
|
|
244
|
-
function
|
|
245
|
-
const e =
|
|
246
|
-
return e !== void 0 && t === void 0 &&
|
|
229
|
+
function v(s) {
|
|
230
|
+
const e = l.get(s), t = e?.deref();
|
|
231
|
+
return e !== void 0 && t === void 0 && l.delete(s), t;
|
|
247
232
|
}
|
|
248
|
-
function
|
|
233
|
+
function w(s) {
|
|
249
234
|
if (!(s === null || typeof s != "object"))
|
|
250
|
-
return Reflect.get(s,
|
|
235
|
+
return Reflect.get(s, R);
|
|
251
236
|
}
|
|
252
|
-
function
|
|
237
|
+
function d(s) {
|
|
253
238
|
if (s === null || typeof s != "object")
|
|
254
239
|
return !1;
|
|
255
240
|
if (Array.isArray(s))
|
|
@@ -257,24 +242,24 @@ function y(s) {
|
|
|
257
242
|
const e = Object.getPrototypeOf(s);
|
|
258
243
|
return e === Object.prototype || e === null;
|
|
259
244
|
}
|
|
260
|
-
function
|
|
261
|
-
if (!
|
|
245
|
+
function D(s) {
|
|
246
|
+
if (!d(s))
|
|
262
247
|
throw new TypeError("[Raph] reactive() accepts only plain objects and arrays.");
|
|
263
248
|
}
|
|
264
|
-
function
|
|
249
|
+
function g(s) {
|
|
265
250
|
if (typeof s != "string" || s === "")
|
|
266
251
|
return !1;
|
|
267
252
|
const e = Number(s);
|
|
268
253
|
return Number.isInteger(e) && e >= 0 && e < 4294967295 && String(e) === s;
|
|
269
254
|
}
|
|
270
|
-
function
|
|
255
|
+
function M(s, e) {
|
|
271
256
|
return s === e ? !0 : s === void 0 || e === void 0 ? !1 : s.configurable === e.configurable && s.enumerable === e.enumerable && s.get === e.get && s.set === e.set && s.value === e.value && s.writable === e.writable;
|
|
272
257
|
}
|
|
273
|
-
function
|
|
258
|
+
function p() {
|
|
274
259
|
throw new Error("[Raph] Reactive object owner is disposed.");
|
|
275
260
|
}
|
|
276
261
|
export {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
262
|
+
P as configureReactiveObjectPolicy,
|
|
263
|
+
W as disposeReactiveObjectContext,
|
|
264
|
+
m as reactiveObject
|
|
280
265
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./disposal.cjs");class v{constructor(e,s,t){this.scopeParent=e,this.scopePrevious=s,this.scopeNext=void 0,this._cleanup=t}dispose(){const e=this._cleanup;e!==void 0&&(this._cleanup=void 0,this.scopeParent._releaseRecord(this),e())}}let p;class a{_cleanup;constructor(e){this._cleanup=e}dispose(){u.throwDisposalFailure(p.call(this))}_disposeWithOutcome(){const e=this._cleanup;if(e!==void 0)return this._cleanup=void 0,this.scopeParent._releaseRecord(this),e()}}const f=a.prototype.dispose;p=a.prototype._disposeWithOutcome;class w{constructor(e,s){this._previousSource=e,this._finalizer=s}_finalizeSource(){const e=this._finalizer;return e()}}class h{constructor(){this.scopeFirstChild=void 0,this.scopeLastChild=void 0,this._resourceCount=0,this._lastSource=void 0,this._sourceCount=0,this._disposed=!1,this._disposing=!1}get disposed(){return this._disposed}get active(){return!this._disposed&&!this._disposing}_debugResourceCount(){return this._resourceCount}_debugSourceCount(){return this._sourceCount}_lastOwnedSource(){return this._lastSource}_releaseRecord(e){if(e.scopeParent!==this)return;const s=e.scopePrevious,t=e.scopeNext;s===void 0?this.scopeFirstChild=t:s.scopeNext=t,t===void 0?this.scopeLastChild=s:t.scopePrevious=s,e.scopeParent=void 0,e.scopePrevious=void 0,e.scopeNext=void 0,--this._resourceCount}_ownCleanup(e){const s=this.scopeLastChild,t=new v(this,s,e);return s===void 0?this.scopeFirstChild=t:s.scopeNext=t,this.scopeLastChild=t,++this._resourceCount,()=>t.dispose()}_ownCompleted(e){const s=new a(e);return this._ownRecord(s),()=>s.dispose()}_ownRecord(e){const s=this.scopeLastChild;e.scopeParent=this,e.scopePrevious=s,e.scopeNext=void 0,s===void 0?this.scopeFirstChild=e:s.scopeNext=e,this.scopeLastChild=e,++this._resourceCount}_ownSourceFinalizer(e){this._lastSource=new w(this._lastSource,e),++this._sourceCount}_ownSourceEntry(e){e._previousSource=this._lastSource,this._lastSource=e,++this._sourceCount}_releaseOwned(){let e,s=this.scopeLastChild;for(;s!==void 0;){try{const i=s.dispose;if(s instanceof a&&i===f){const c=p.call(s);c!==void 0&&(e??=[]).push(c)}else i.call(s)}catch(i){(e??=[]).push(u.unroutedDisposalFailure(i))}s=this.scopeLastChild}const t=this._lastSource;return t!==void 0&&(this._lastSource=void 0,this._sourceCount=0,e=S(t,e)),e}}class C extends h{constructor(e){super(),this.reactivity=e}signal(e){this._assertAlive();const s=this._adoptSource(this.reactivity._ownedSignal(e));return{get:()=>(this._assertAlive(),s.get()),peek:()=>(this._assertAlive(),s.peek()),set:t=>{this._assertAlive(),s.set(t)}}}computed(e){this._assertAlive();const s=typeof e=="function"?e:e.get,t=this._adoptSource(this.reactivity._ownedComputed(s)),i={get:()=>(this._assertAlive(),t.get()),peek:()=>(this._assertAlive(),t.peek())};if(typeof e=="function")return i;let c=e.set;this._own(()=>{c=void 0});const n=i;return n.set=r=>{this._assertAlive(),c(r)},n}effect(e){return this._assertAlive(),this._adoptResource(this.reactivity.effect(e))}watch(e,s,t){return this._assertAlive(),this._adoptResource(this.reactivity.watch(e,s,t))}own(e){return this._disposed||this._disposing?(e(),A):this._ownCleanup(e)}dispose(){if(this._disposed)return;this._disposed=!0,this._disposing=!0;let e;try{e=this._releaseOwned()}finally{this._disposing=!1;try{this._afterDispose()}catch(s){(e??=[]).push(u.unroutedDisposalFailure(s))}}e!==void 0&&u.throwDisposalFailure(u.combineDisposalFailures(e,this._disposalMessage()))}_own(e){return this._assertAlive(),this._ownCleanup(e)}_adoptResource(e){try{return this._own(e)}catch(s){try{e()}catch(t){throw new AggregateError([s,t],"Resource registration and cleanup failed.")}throw s}}_adoptSource(e){try{this._ownSource(e.dispose)}catch(s){try{e.dispose()}catch(t){throw new AggregateError([s,t],"Source registration and cleanup failed.")}throw s}return e.source}_ownSource(e){this._assertAlive(),this._ownSourceFinalizer(e)}_assertAlive(){if(this._disposed||this._disposing)throw new Error("ScopeNode is disposed.")}_afterDispose(){}_disposalMessage(){return"ScopeNode disposal failed."}}function S(o,e){let s=e,t=o;for(;t!==void 0;){let i,c,n=!1,r=t;for(;r!==void 0;){const d=r._previousSource;let l=!0;try{r._previousSource=void 0,l=r._finalizeSource()}catch(_){(s??=[]).push(u.unroutedDisposalFailure(_))}l?n=!0:(c===void 0?i=r:c._previousSource=r,c=r),r=d}if(!n)return s;t=i}return s}function g(o,e){const s=o.scopeLastChild;e.scopeParent=o,e.scopePrevious=s,e.scopeNext=void 0,s===void 0?o.scopeFirstChild=e:s.scopeNext=e,o.scopeLastChild=e}function P(o){const e=o.scopeParent;if(e===void 0)return;const s=o.scopePrevious,t=o.scopeNext;s===void 0?e.scopeFirstChild=t:s.scopeNext=t,t===void 0?e.scopeLastChild=s:t.scopePrevious=s,o.scopeParent=void 0,o.scopePrevious=void 0,o.scopeNext=void 0}function x(o,e){if(o.length===1)throw o[0];if(o.length>1)throw new AggregateError(o,e)}function A(){}exports.ScopeNode=C;exports.ScopeOwner=h;exports.appendScopeChild=g;exports.detachScopeChild=P;exports.throwScopeErrors=x;
|