@raphy-js/raph 1.0.1-dev.20 → 1.0.1-dev.26
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 +10 -2
- package/dist/core-ugchZNqC.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../../reactivity/engine.cjs"),O=require("../errors.cjs"),R=require("../phases/RaphPhaseTaskRecord.cjs"),S=require("./RaphSelector.cjs"),T=require("./RaphWorkGraph.cjs");let a,u;function A(n){return{schedule:n,dispose:g}}let v=0;function E(n){n.firstSub!==null&&++v}function N(n,e,t){n.firstSub===null&&t.delete(e)}const _=Object.freeze({}),m=Object.freeze({schedule:g,dispose:g}),b=64;class C{constructor(e){this.items=[e],this.shared=!1}detach(){const e=this.items.slice();return this.items=e,this.shared=!1,e}}class f extends T.RaphProducer{constructor(e,t,r,i){super(e,t,r),this._value=i,this._node=void 0,this._previousSource=void 0,this._writeTaps=void 0,this.source=this}get token(){return this}get dependencyOwner(){return this.owner}toJSON(){let e=0;for(let t=this._previousSource;t!==void 0&&e<b;t=t._previousSource)++e;return{kind:this.kind,owner:this.owner.id,index:e,revision:this.revision,disposed:this.disposed}}get(){const e=this.owner,t=e.runtime._getReactivity();w(t,e),e._assertAlive();const r=this._node;if(r!==void 0)return t._readSignalNode(r);const i=this._value,s=t._trackSignalNode(i,this);return s!==void 0&&(this._node=s,this._value=void 0),i}peek(){const e=this.owner,t=e.runtime._getReactivity();h(t._lifecycle),e._assertAlive();const r=this._node;return r===void 0?this._value:t._peekSignalNode(r)}set(e){const t=this.owner,r=t.runtime,i=r._getReactivity()._lifecycle,s=i.assertWriteAllowed;s===void 0?(h(i),t._assertAlive()):(t._assertAlive(),s()),r._enterWrite();try{this._write(e)}catch(o){throw r._failWrite(o)}r._exitWrite()}_writeInBoundary(e){const t=this.owner;h(t.runtime._getReactivity()._lifecycle),t._assertAlive(),this._write(e)}_addWriteTap(e){const t=this._writeTaps;if(t===void 0){e._tapSlot=0,this._writeTaps=new C(e);return}const r=t.shared?t.detach():t.items;e._tapSlot=r.length,r.push(e)}_removeWriteTap(e){const t=this._writeTaps;if(t===void 0)return;const r=e._tapSlot;if(r<0||t.items[r]!==e)return;if(e._tapSlot=-1,t.items.length===1){this._writeTaps=void 0;return}const i=t.shared?t.detach():t.items,s=i.pop();s!==e&&(i[r]=s,s._tapSlot=r)}onChange(e,t,r){this.owner.runtime._getWorkGraph()._notifyValueWrite(this,e,t,r)}onDispose(e){this.owner.runtime._getWorkGraph()._disposeProducer(this,e)}_findConsumerOwner(e,t){const r=this._writeTaps;if(r!==void 0){const s=r.items;for(let o=0;o<s.length;o++){const c=s[o]._tapOwner;if(e(c,t))return c}}const i=this._node;return i===void 0?void 0:this.owner.runtime._getReactivity()._findSubscriberOwner(i,e,t)}_finalizeSource(){if(this.disposed)return!0;this._value=void 0,this._writeTaps=void 0;const e=this._node,t=this.owner.runtime._getReactivity();let r;try{this.onDispose(e!==void 0&&t._signalNodeHasSubscribers(e))}catch(i){(r??=[]).push(i)}if(e!==void 0){this._node=void 0;try{t._releaseSignalNode(e)}catch(i){(r??=[]).push(i)}}if(r!==void 0)throw r.length===1?r[0]:new AggregateError(r,"Owned signal disposal failed.");return!0}_write(e){const t=this._writeTaps;if(t!==void 0){this._writeTapped(e,t);return}const r=this._node;if(r!==void 0){const s=this.owner.runtime,o=s._getReactivity(),c=o._visibleSignalValue(r);c!==e&&s._getWorkGraph()._notifyValueWrite(this,c,e,r.firstSub!==null),o._writeSignalNode(r,e);return}const i=this._value;i!==e&&(this.owner.runtime._getWorkGraph()._notifyValueWrite(this,i,e,!1),this._value=e)}_writeTapped(e,t){const r=this._node,i=this.owner.runtime._getReactivity(),s=r===void 0?this._value:i._visibleSignalValue(r);if(s===e)return;const o=t.items;t.shared=!0;let c=r!==void 0&&i._signalNodeHasSubscribers(r);for(let d=0;!c&&d<o.length;d++)c=o[d]._observesWrites();this.onChange(s,e,c);let l;if(r===void 0)this._value=e;else try{i._writeSignalNode(r,e)}catch(d){l=[d]}for(let d=0;d<o.length;d++)try{o[d]._afterSourceWrite(s,e)}catch(y){(l??=[]).push(y)}if(l!==void 0)throw l.length===1?l[0]:new AggregateError(l,"[Raph] Signal write and its observers failed.")}}class p extends k.RaphReactivity{constructor(e,t={}){super({...t.adaptiveDependencyIndex===void 0?{}:{adaptiveDependencyIndex:t.adaptiveDependencyIndex},effectScheduler:{bind:A}}),this._lifecycle=e,this._phaseBody=()=>{const r=this._activeEffectTask(),i=r.consumerOwner,s=a,o=u;a=e,u=i;let c;try{const l=r.effect;c=l(r.state&R.TASK_TASKLESS?r.group:r.task)}finally{a=s,u=o}return typeof c=="function"?I(this,c):c},p._releasedShapeAnchor??=W(this)}untrackedWithOwner(e){const t=a,r=u;a=void 0,u=void 0;try{return this.untracked(e)}finally{a=t,u=r}}_applyUntrackedWithOwner(e,t){const r=a,i=u;a=void 0,u=void 0;try{return this._isTracking()?this.untracked(()=>e(...t)):e(...t)}finally{a=r,u=i}}_runTaskEffectUntracked(e){const t=a,r=u;a=void 0,u=void 0;try{this._finishTaskEffectRun(e)}finally{a=t,u=r}}getActiveOwner(){return a===void 0?void 0:a.owner}getActiveConsumerOwner(){return u}hasActiveContext(){return a!==void 0||this._isTracking()}runWithOwner(e,t,r){const i=a,s=u;a=e,u=e===void 0?void 0:t;try{return r()}finally{a=i,u=s}}_findSignalConsumerOwner(e,t,r){for(let i=e._lastOwnedSource();i!==void 0;i=i._previousSource){if(!(i instanceof f)&&!(i instanceof S.RuntimeSelector))continue;const s=i._findConsumerOwner(t,r);if(s!==void 0)return s}}_assertTrackedRead(e){w(this,e)}_hasSingleSubscriber(e){const t=e.firstSub;return t!==null&&t===e.lastSub}_countObserved(e,t){let r=0;for(let i=0;i<e.length;i++){const s=e[i];s!==void 0&&s.firstSub!==null&&++r}return t!==void 0&&t.size!==0&&(v=0,t.forEach(E),r+=v),r}_dropUnobserved(e,t){let r=0;for(let i=0;i<e.length;i++){const s=e[i];s!==void 0&&(s.firstSub===null?e[i]=void 0:++r)}return t!==void 0&&t.size!==0&&t.forEach(N),r}selectorForOwner(e,t,r){if(!(e instanceof f))throw new TypeError("[Raph] selector() source must be a writable Runtime signal.");const i=r?.equals;if(i!==void 0&&typeof i!="function")throw new TypeError("[Raph] selector() equals must be a function.");const s=e.owner;if(s.runtime!==t.runtime)throw new O.RaphCrossRuntimeError("[Raph] selector() source belongs to another runtime.");s._assertAlive(),this._lifecycle.assertDependencyAllowed(s,t);const o=new S.RuntimeSelector(t,this,e,i);try{t._adoptSourceEntry(o)}catch(c){throw o._finalizeSource(),c}return o}signalForOwner(e,t,r="producer",i=!0){const s=new f(t,r,i,e);return t._adoptSourceEntry(s),s}computedForOwner(e,t,r){const i=this._lifecycle,s=t._adoptSource(this._ownedComputed(e,r));return{get:()=>{w(this,t),t._assertAlive();const o=s.get();return t._assertAlive(),o},peek(){h(i),t._assertAlive();const o=s.peek();return t._assertAlive(),o}}}}p._releasedShapeAnchor=void 0;function W(n){let e,t;const r=n._allocateTaskEffect(()=>{e=n._trackSignalNode(void 0,_),t=n._trackSignalNode(void 0,_)},m);n._requestTaskEffect(r,!1),n._beginTaskEffectRun(r),n._finishTaskEffectRun(r);const i=e.firstSub;n._disposeTaskEffect(r),n.batch(()=>n._writeSignalNode(t,0)),n._releaseSignalNode(e),n._releaseSignalNode(t);let s,o;const c=n._allocateTaskEffect(()=>{s=n._trackCounterNode(_),o=n._trackCounterNode(_)},m);return n._requestTaskEffect(c,!1),n._beginTaskEffectRun(c),n._finishTaskEffectRun(c),n.batch(()=>{n._bumpSignalNode(o)}),n._disposeTaskEffect(c),n._releaseSignalNode(s),n._releaseSignalNode(o),{source:e,written:t,edge:i,consumer:r,counter:s,bumped:o}}function I(n,e){return()=>n.untrackedWithOwner(e)}function h(n){n.owner===void 0&&n.throwDisposed()}function w(n,e){const t=n._lifecycle;h(t);const r=a;if(r!==void 0){r!==t&&t.throwCrossRuntime(r.owner);const s=u;s!==void 0&&s!==e&&t.assertDependencyAllowed(e,s);return}const i=n._activeSubscriberOwner();i!==void 0&&t.assertDependencyAllowed(e,i)}function g(){}exports.RuntimeReactivity=p;exports.RuntimeSignal=f;exports.SIGNAL_INDEX_LIMIT=b;
|