@raphy-js/raph 1.0.0-dev.2 → 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.
Files changed (246) hide show
  1. package/README.md +1096 -0
  2. package/dist/api/Raph.d.ts +59 -190
  3. package/dist/api/RaphFacadeSession.d.ts +90 -0
  4. package/dist/api/RaphReactivityInstance.d.ts +72 -0
  5. package/dist/api/errors.d.ts +9 -4
  6. package/dist/api/types.d.ts +162 -17
  7. package/dist/core-CClhT8WR.js +1044 -0
  8. package/dist/core-cPQWYD4K.cjs +1 -0
  9. package/dist/debug/api/Raph.cjs +1 -1
  10. package/dist/debug/api/Raph.js +368 -367
  11. package/dist/debug/api/RaphFacadeSession.cjs +1 -0
  12. package/dist/debug/api/RaphFacadeSession.js +302 -0
  13. package/dist/debug/api/RaphReactivityInstance.cjs +1 -0
  14. package/dist/debug/api/RaphReactivityInstance.js +146 -0
  15. package/dist/debug/api/errors.cjs +1 -1
  16. package/dist/debug/api/errors.js +10 -7
  17. package/dist/debug/path/DataPath.cjs +1 -0
  18. package/dist/debug/path/DataPath.js +390 -0
  19. package/dist/debug/path/PathRouter.cjs +1 -0
  20. package/dist/debug/path/PathRouter.js +80 -0
  21. package/dist/debug/path/RaphKernel.cjs +1 -1
  22. package/dist/debug/path/RaphKernel.js +316 -236
  23. package/dist/debug/path/data-path.utils.cjs +1 -0
  24. package/dist/debug/path/data-path.utils.js +56 -0
  25. package/dist/debug/path/derived/DerivedRegistry.cjs +1 -0
  26. package/dist/debug/path/derived/DerivedRegistry.js +143 -0
  27. package/dist/debug/path/derived/RaphDerivedHandle.cjs +1 -0
  28. package/dist/debug/path/{RaphDerivedHandle.js → derived/RaphDerivedHandle.js} +19 -22
  29. package/dist/debug/path/derived/derived-collection.utils.cjs +1 -0
  30. package/dist/debug/path/{derived-collection.js → derived/derived-collection.utils.js} +71 -71
  31. package/dist/debug/path/derived/derived-strategy.types.cjs +1 -0
  32. package/dist/debug/path/derived/derived-strategy.types.js +1 -0
  33. package/dist/debug/path/meta/MetaController.cjs +1 -0
  34. package/dist/debug/path/{MetaController.js → meta/MetaController.js} +58 -66
  35. package/dist/debug/path/meta/RaphMeta.cjs +1 -0
  36. package/dist/debug/path/meta/RaphMeta.js +62 -0
  37. package/dist/debug/path/meta/RaphMetaStore.cjs +1 -0
  38. package/dist/debug/path/{RaphMetaStore.js → meta/RaphMetaStore.js} +24 -30
  39. package/dist/debug/path/meta/meta.types.cjs +1 -0
  40. package/dist/debug/path/meta/meta.types.js +1 -0
  41. package/dist/debug/path/storage/AdapterPathStore.cjs +1 -0
  42. package/dist/debug/path/storage/AdapterPathStore.js +128 -0
  43. package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -0
  44. package/dist/debug/path/{data-adapter.js → storage/DefaultDataAdapter.js} +47 -57
  45. package/dist/debug/path/storage/PathEventHub.cjs +1 -0
  46. package/dist/debug/path/storage/PathEventHub.js +161 -0
  47. package/dist/debug/path/storage/PathStore.cjs +1 -0
  48. package/dist/debug/path/{PathStore.js → storage/PathStore.js} +88 -98
  49. package/dist/debug/path/storage/createDataDraft.cjs +1 -0
  50. package/dist/debug/path/{data-draft.js → storage/createDataDraft.js} +24 -28
  51. package/dist/debug/path/storage/data-adapter.types.cjs +1 -0
  52. package/dist/debug/path/storage/data-adapter.types.js +1 -0
  53. package/dist/debug/reactivity/disposal.cjs +1 -0
  54. package/dist/debug/reactivity/disposal.js +32 -0
  55. package/dist/debug/reactivity/engine.cjs +1 -1
  56. package/dist/debug/reactivity/engine.js +888 -321
  57. package/dist/debug/reactivity/reactive-object.cjs +1 -0
  58. package/dist/debug/reactivity/reactive-object.js +265 -0
  59. package/dist/debug/reactivity/scope.cjs +1 -1
  60. package/dist/debug/reactivity/scope.js +221 -117
  61. package/dist/debug/reactivity/watch.cjs +1 -1
  62. package/dist/debug/reactivity/watch.js +1 -1
  63. package/dist/debug/runtime/RaphRuntime.cjs +1 -1
  64. package/dist/debug/runtime/RaphRuntime.js +1134 -502
  65. package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -0
  66. package/dist/debug/runtime/diagnostics/RaphDebug.js +287 -0
  67. package/dist/debug/runtime/errors.cjs +1 -1
  68. package/dist/debug/runtime/errors.js +6 -3
  69. package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -0
  70. package/dist/debug/runtime/ownership/RaphEffectScope.js +304 -0
  71. package/dist/debug/runtime/ownership/RaphNode.cjs +1 -0
  72. package/dist/debug/runtime/ownership/RaphNode.js +665 -0
  73. package/dist/debug/runtime/ownership/RaphScope.cjs +1 -0
  74. package/dist/debug/runtime/ownership/RaphScope.js +236 -0
  75. package/dist/debug/runtime/ownership/parent-graph.types.cjs +1 -0
  76. package/dist/debug/runtime/ownership/parent-graph.types.js +1 -0
  77. package/dist/debug/runtime/phases/RaphFrameLoop.cjs +1 -0
  78. package/dist/debug/runtime/{RaphFrameLoop.js → phases/RaphFrameLoop.js} +13 -17
  79. package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -0
  80. package/dist/debug/runtime/phases/RaphPhasePipeline.js +848 -0
  81. package/dist/debug/runtime/phases/RaphPhaseTaskRecord.cjs +1 -0
  82. package/dist/debug/runtime/phases/RaphPhaseTaskRecord.js +176 -0
  83. package/dist/debug/runtime/phases/RaphPhaseWatch.cjs +1 -0
  84. package/dist/debug/runtime/phases/RaphPhaseWatch.js +20 -0
  85. package/dist/debug/runtime/phases/orderPhaseTasks.cjs +1 -0
  86. package/dist/debug/runtime/phases/orderPhaseTasks.js +59 -0
  87. package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -0
  88. package/dist/debug/runtime/reactivity/PathHandle.js +165 -0
  89. package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -0
  90. package/dist/debug/runtime/reactivity/RaphMetaSource.js +108 -0
  91. package/dist/debug/runtime/reactivity/RaphSelector.cjs +1 -0
  92. package/dist/debug/runtime/reactivity/RaphSelector.js +503 -0
  93. package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -0
  94. package/dist/debug/runtime/reactivity/RaphWorkGraph.js +1157 -0
  95. package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -0
  96. package/dist/debug/runtime/reactivity/RuntimeReactivity.js +550 -0
  97. package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -0
  98. package/dist/debug/runtime/reactivity/RuntimeWatch.js +77 -0
  99. package/dist/debug/runtime/reactivity/disposal-sweep.utils.cjs +1 -0
  100. package/dist/debug/runtime/reactivity/disposal-sweep.utils.js +42 -0
  101. package/dist/debug/runtime/reactivity/runtime-reactivity.types.cjs +1 -0
  102. package/dist/debug/runtime/reactivity/runtime-reactivity.types.js +1 -0
  103. package/dist/entrypoints/machine-testing.d.ts +2 -0
  104. package/dist/entrypoints/machine.d.ts +5 -0
  105. package/dist/entrypoints/path.d.ts +14 -0
  106. package/dist/entrypoints/reactivity.d.ts +1 -0
  107. package/dist/entrypoints/runtime.d.ts +18 -0
  108. package/dist/index.cjs +1 -1
  109. package/dist/index.js +46 -38
  110. package/dist/machine/compiler.d.ts +71 -0
  111. package/dist/machine/core.d.ts +50 -0
  112. package/dist/machine/persistence.d.ts +5 -0
  113. package/dist/machine/runtime.d.ts +4 -0
  114. package/dist/machine/testing.d.ts +43 -0
  115. package/dist/machine/types.d.ts +155 -0
  116. package/dist/machine-testing.cjs +1 -0
  117. package/dist/machine-testing.js +188 -0
  118. package/dist/machine.cjs +1 -0
  119. package/dist/machine.js +822 -0
  120. package/dist/main.d.ts +20 -0
  121. package/dist/path/{data-path.d.ts → DataPath.d.ts} +16 -40
  122. package/dist/path/{path-router.d.ts → PathRouter.d.ts} +1 -1
  123. package/dist/path/RaphKernel.d.ts +37 -10
  124. package/dist/path/data-path.types.d.ts +34 -0
  125. package/dist/path/data-path.utils.d.ts +9 -0
  126. package/dist/path/{DerivedRegistry.d.ts → derived/DerivedRegistry.d.ts} +2 -2
  127. package/dist/path/{RaphDerivedHandle.d.ts → derived/RaphDerivedHandle.d.ts} +3 -3
  128. package/dist/path/derived/derived-collection.types.d.ts +12 -0
  129. package/dist/path/{derived-collection.d.ts → derived/derived-collection.utils.d.ts} +3 -13
  130. package/dist/path/{derived-strategies.d.ts → derived/derived-strategy.types.d.ts} +0 -3
  131. package/dist/path/derived/derived-strategy.utils.d.ts +4 -0
  132. package/dist/path/{MetaController.d.ts → meta/MetaController.d.ts} +4 -4
  133. package/dist/path/{RaphMeta.d.ts → meta/RaphMeta.d.ts} +2 -2
  134. package/dist/path/{RaphMetaStore.d.ts → meta/RaphMetaStore.d.ts} +1 -1
  135. package/dist/path/{meta.types.d.ts → meta/meta.types.d.ts} +2 -4
  136. package/dist/path/path.types.d.ts +3 -2
  137. package/dist/path/{segment-key.d.ts → pathSegmentKey.d.ts} +1 -1
  138. package/dist/path/{AdapterPathStore.d.ts → storage/AdapterPathStore.d.ts} +4 -4
  139. package/dist/path/{data-adapter.d.ts → storage/DefaultDataAdapter.d.ts} +2 -17
  140. package/dist/path/storage/PathEventHub.d.ts +62 -0
  141. package/dist/path/{PathStore.d.ts → storage/PathStore.d.ts} +7 -7
  142. package/dist/path/storage/data-adapter.types.d.ts +17 -0
  143. package/dist/path.cjs +1 -1
  144. package/dist/path.js +16 -16
  145. package/dist/raph.cjs +1 -1
  146. package/dist/raph.js +46 -38
  147. package/dist/reactivity/disposal.d.ts +14 -0
  148. package/dist/reactivity/engine.d.ts +193 -6
  149. package/dist/reactivity/reactive-object.d.ts +36 -0
  150. package/dist/reactivity/scope.d.ts +108 -30
  151. package/dist/reactivity/types.d.ts +25 -0
  152. package/dist/reactivity.cjs +1 -1
  153. package/dist/reactivity.js +12 -12
  154. package/dist/runtime/RaphRuntime.d.ts +319 -160
  155. package/dist/runtime/diagnostics/RaphDebug.d.ts +239 -0
  156. package/dist/runtime/errors.d.ts +5 -0
  157. package/dist/runtime/ownership/RaphEffectScope.d.ts +98 -0
  158. package/dist/runtime/ownership/RaphNode.d.ts +310 -0
  159. package/dist/runtime/ownership/RaphScope.d.ts +168 -0
  160. package/dist/runtime/{parent-graph.d.ts → ownership/parent-graph.types.d.ts} +0 -1
  161. package/dist/runtime/ownership/parentGraph.d.ts +3 -0
  162. package/dist/runtime/phases/RaphPhasePipeline.d.ts +253 -0
  163. package/dist/runtime/phases/RaphPhaseTaskRecord.d.ts +195 -0
  164. package/dist/runtime/phases/RaphPhaseWatch.d.ts +22 -0
  165. package/dist/runtime/phases/orderPhaseTasks.d.ts +6 -0
  166. package/dist/runtime/phases/phase.types.d.ts +171 -0
  167. package/dist/runtime/{PathHandle.d.ts → reactivity/PathHandle.d.ts} +14 -6
  168. package/dist/runtime/reactivity/RaphMetaSource.d.ts +32 -0
  169. package/dist/runtime/reactivity/RaphSelector.d.ts +338 -0
  170. package/dist/runtime/reactivity/RaphWorkGraph.d.ts +309 -0
  171. package/dist/runtime/reactivity/RuntimeReactivity.d.ts +293 -0
  172. package/dist/runtime/{RuntimeWatch.d.ts → reactivity/RuntimeWatch.d.ts} +12 -6
  173. package/dist/runtime/reactivity/disposal-sweep.utils.d.ts +19 -0
  174. package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +56 -0
  175. package/dist/runtime.cjs +1 -1
  176. package/dist/runtime.js +21 -16
  177. package/package.json +76 -35
  178. package/ReadMe.md +0 -153
  179. package/dist/api/public.d.ts +0 -22
  180. package/dist/debug/api/public.cjs +0 -1
  181. package/dist/debug/api/public.js +0 -40
  182. package/dist/debug/path/AdapterPathStore.cjs +0 -1
  183. package/dist/debug/path/AdapterPathStore.js +0 -133
  184. package/dist/debug/path/DerivedRegistry.cjs +0 -1
  185. package/dist/debug/path/DerivedRegistry.js +0 -157
  186. package/dist/debug/path/MetaController.cjs +0 -1
  187. package/dist/debug/path/PathEventHub.cjs +0 -1
  188. package/dist/debug/path/PathEventHub.js +0 -148
  189. package/dist/debug/path/PathStore.cjs +0 -1
  190. package/dist/debug/path/RaphDerivedHandle.cjs +0 -1
  191. package/dist/debug/path/RaphMeta.cjs +0 -1
  192. package/dist/debug/path/RaphMeta.js +0 -68
  193. package/dist/debug/path/RaphMetaStore.cjs +0 -1
  194. package/dist/debug/path/data-adapter.cjs +0 -1
  195. package/dist/debug/path/data-draft.cjs +0 -1
  196. package/dist/debug/path/data-path.cjs +0 -1
  197. package/dist/debug/path/data-path.js +0 -423
  198. package/dist/debug/path/derived-collection.cjs +0 -1
  199. package/dist/debug/path/path-router.cjs +0 -1
  200. package/dist/debug/path/path-router.js +0 -86
  201. package/dist/debug/path/public.cjs +0 -1
  202. package/dist/debug/path/public.js +0 -18
  203. package/dist/debug/runtime/PathHandle.cjs +0 -1
  204. package/dist/debug/runtime/PathHandle.js +0 -139
  205. package/dist/debug/runtime/RaphDebug.cjs +0 -1
  206. package/dist/debug/runtime/RaphDebug.js +0 -15
  207. package/dist/debug/runtime/RaphFrameLoop.cjs +0 -1
  208. package/dist/debug/runtime/RaphNode.cjs +0 -1
  209. package/dist/debug/runtime/RaphNode.js +0 -143
  210. package/dist/debug/runtime/RaphPhasePipeline.cjs +0 -1
  211. package/dist/debug/runtime/RaphPhasePipeline.js +0 -526
  212. package/dist/debug/runtime/RaphScope.cjs +0 -1
  213. package/dist/debug/runtime/RaphScope.js +0 -64
  214. package/dist/debug/runtime/RuntimeReactivity.cjs +0 -1
  215. package/dist/debug/runtime/RuntimeReactivity.js +0 -154
  216. package/dist/debug/runtime/RuntimeWatch.cjs +0 -1
  217. package/dist/debug/runtime/RuntimeWatch.js +0 -71
  218. package/dist/debug/runtime/public.cjs +0 -1
  219. package/dist/debug/runtime/public.js +0 -18
  220. package/dist/path/PathEventHub.d.ts +0 -48
  221. package/dist/path/public.d.ts +0 -14
  222. package/dist/runtime/RaphDebug.d.ts +0 -32
  223. package/dist/runtime/RaphNode.d.ts +0 -68
  224. package/dist/runtime/RaphPhasePipeline.d.ts +0 -133
  225. package/dist/runtime/RaphScope.d.ts +0 -50
  226. package/dist/runtime/RuntimeReactivity.d.ts +0 -40
  227. package/dist/runtime/phase.types.d.ts +0 -49
  228. package/dist/runtime/public.d.ts +0 -13
  229. package/dist/runtime/runtime-reactivity.types.d.ts +0 -9
  230. /package/dist/debug/path/{meta.types.cjs → data-path.types.cjs} +0 -0
  231. /package/dist/debug/path/{meta.types.js → data-path.types.js} +0 -0
  232. /package/dist/debug/{runtime/runtime-reactivity.types.cjs → path/derived/derived-collection.types.cjs} +0 -0
  233. /package/dist/debug/{runtime/runtime-reactivity.types.js → path/derived/derived-collection.types.js} +0 -0
  234. /package/dist/debug/path/{derived-strategies.cjs → derived/derived-strategy.utils.cjs} +0 -0
  235. /package/dist/debug/path/{derived-strategies.js → derived/derived-strategy.utils.js} +0 -0
  236. /package/dist/debug/path/{segment-key.cjs → pathSegmentKey.cjs} +0 -0
  237. /package/dist/debug/path/{segment-key.js → pathSegmentKey.js} +0 -0
  238. /package/dist/debug/runtime/{parent-graph.cjs → ownership/parentGraph.cjs} +0 -0
  239. /package/dist/debug/runtime/{parent-graph.js → ownership/parentGraph.js} +0 -0
  240. /package/dist/debug/runtime/{disposal.cjs → ownership/throwDisposalErrors.cjs} +0 -0
  241. /package/dist/debug/runtime/{disposal.js → ownership/throwDisposalErrors.js} +0 -0
  242. /package/dist/debug/runtime/{phase.types.cjs → phases/phase.types.cjs} +0 -0
  243. /package/dist/debug/runtime/{phase.types.js → phases/phase.types.js} +0 -0
  244. /package/dist/path/{data-draft.d.ts → storage/createDataDraft.d.ts} +0 -0
  245. /package/dist/runtime/{disposal.d.ts → ownership/throwDisposalErrors.d.ts} +0 -0
  246. /package/dist/runtime/{RaphFrameLoop.d.ts → phases/RaphFrameLoop.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=Object.freeze([]),c=Object.freeze({now:0,delta:0,elapsed:0,frame:0}),o=1,_=2,E=4,p=8,d=16,T=32,l=64,A=128,u=256,f=1536,R=0,D=512,v=1024,K=1536,C=2048,O=0,U=1,P=2;class S{constructor(e){this._record=e,Object.freeze(this)}get phase(){return this._record.phaseState.name}get consumerOwner(){return this._record.consumerOwner}get effect(){return this._record.effect}get causes(){return this._record.causes}get frame(){return this._record.frame}get priority(){return this._record.priority}get sequence(){return this._record.sequence}run(){const e=this._record;e.phaseState.pipeline._runDelivery(e)}defer(){const e=this._record;e.phaseState.pipeline._deferDelivery(e)}cancel(){const e=this._record;e.phaseState.pipeline._cancelDelivery(e)}}class a{constructor(){this.extraCauses=void 0,this.deliveryFirstCause=void 0,this.deliveryFirstCauseKey=void 0,this.deliveryExtraCauses=void 0,this.deliveryCauses=void 0,this.deferCount=0}}a._shapeAnchor=new a;class y{constructor(e,t,s,i){this.state=o,this.sequence=0,this.phaseState=e,this.priority=t,this.consumerOwner=s,this.effect=i,this.node=void 0,this.watch=void 0,this.group=void 0,this.scopeParent=void 0,this.scopePrevious=void 0,this.scopeNext=void 0,this.firstCause=void 0,this.firstCauseKey=void 0,this.frame=c,this.facade=void 0,this.detail=void 0}get phase(){return this.phaseState.name}get dependencyOwner(){return this.consumerOwner}get allowScheduleDuringRun(){return!0}get active(){return(this.state&o)!==0}get causes(){const e=this.detail;if(e!==void 0){const r=e.deliveryCauses;if(r!==void 0)return r}let t,s;if(this.state&u?(t=this.firstCause,e!==void 0&&(s=e.extraCauses)):e!==void 0&&(t=e.deliveryFirstCause,s=e.deliveryExtraCauses),t===void 0)return h;const i=[Object.freeze(t)];if(s!==void 0)for(const r of s.values())i.push(Object.freeze(r));return this.detailed().deliveryCauses=Object.freeze(i)}get task(){let e=this.facade;return e===void 0&&(this.state&d&&(this.frame=this.phaseState.pipeline.frame),this.facade=e=new S(this)),e}detailed(){return this.detail??=new a}notify(e){this.phaseState.pipeline._notifyTask(this,e)}schedule(){this.phaseState.pipeline._queue(this,!0)}enqueue(e,t=e.source,s=!0){const i=this.phaseState.pipeline;i._appendCause(this,e,t),i._queue(this,s)}start(e,t="scheduled"){this.consumerOwner.runtime._startGroupSlot(this,e,t)}_start(e,t,s){this.consumerOwner.runtime._startGroupSlot(this,e,t,s)}pause(){this.phaseState.pipeline._pauseTask(this)}resume(){this.phaseState.pipeline._resumeTask(this)}dispose(){this.phaseState.pipeline._disposeBinding(this)}}exports.EMPTY_CAUSES=h;exports.EMPTY_FRAME=c;exports.GROUP_CONTEXT=O;exports.GROUP_CURSOR=U;exports.GROUP_NODES=P;exports.RaphPhaseTaskDetail=a;exports.RaphPhaseTaskHandle=S;exports.RaphPhaseTaskRecord=y;exports.TASK_ACTIVE=o;exports.TASK_CANCEL=K;exports.TASK_CAUSES_DELIVERED=u;exports.TASK_DEFER=v;exports.TASK_DEFERRED=p;exports.TASK_DISCARD_ACKNOWLEDGED=T;exports.TASK_EXECUTED=A;exports.TASK_IN_DELIVERY=d;exports.TASK_PAUSED=_;exports.TASK_PENDING=E;exports.TASK_REQUESTED=l;exports.TASK_RESOLUTION=f;exports.TASK_RUN=D;exports.TASK_TASKLESS=C;exports.TASK_UNRESOLVED=R;
@@ -0,0 +1,176 @@
1
+ const h = Object.freeze([]), c = Object.freeze({ now: 0, delta: 0, elapsed: 0, frame: 0 }), n = 1, l = 2, _ = 4, S = 8, u = 16, f = 32, v = 64, E = 128, d = 256, T = 1536, A = 0, C = 512, O = 1024, D = 1536, R = 2048, y = 0, K = 1, m = 2;
2
+ class p {
3
+ constructor(e) {
4
+ this._record = e, Object.freeze(this);
5
+ }
6
+ get phase() {
7
+ return this._record.phaseState.name;
8
+ }
9
+ get consumerOwner() {
10
+ return this._record.consumerOwner;
11
+ }
12
+ get effect() {
13
+ return this._record.effect;
14
+ }
15
+ get causes() {
16
+ return this._record.causes;
17
+ }
18
+ get frame() {
19
+ return this._record.frame;
20
+ }
21
+ get priority() {
22
+ return this._record.priority;
23
+ }
24
+ get sequence() {
25
+ return this._record.sequence;
26
+ }
27
+ run() {
28
+ const e = this._record;
29
+ e.phaseState.pipeline._runDelivery(e);
30
+ }
31
+ defer() {
32
+ const e = this._record;
33
+ e.phaseState.pipeline._deferDelivery(e);
34
+ }
35
+ cancel() {
36
+ const e = this._record;
37
+ e.phaseState.pipeline._cancelDelivery(e);
38
+ }
39
+ }
40
+ class a {
41
+ constructor() {
42
+ this.extraCauses = void 0, this.deliveryFirstCause = void 0, this.deliveryFirstCauseKey = void 0, this.deliveryExtraCauses = void 0, this.deliveryCauses = void 0, this.deferCount = 0;
43
+ }
44
+ }
45
+ a._shapeAnchor = new a();
46
+ class g {
47
+ constructor(e, t, s, i) {
48
+ this.state = n, this.sequence = 0, this.phaseState = e, this.priority = t, this.consumerOwner = s, this.effect = i, this.node = void 0, this.watch = void 0, this.group = void 0, this.scopeParent = void 0, this.scopePrevious = void 0, this.scopeNext = void 0, this.firstCause = void 0, this.firstCauseKey = void 0, this.frame = c, this.facade = void 0, this.detail = void 0;
49
+ }
50
+ get phase() {
51
+ return this.phaseState.name;
52
+ }
53
+ get dependencyOwner() {
54
+ return this.consumerOwner;
55
+ }
56
+ get allowScheduleDuringRun() {
57
+ return !0;
58
+ }
59
+ /**
60
+ * Становится false, когда binding остановлен: так запись видят effect scopes,
61
+ * которым она передана как pausable-регистрация.
62
+ */
63
+ get active() {
64
+ return (this.state & n) !== 0;
65
+ }
66
+ /**
67
+ * Причины текущей доставки в том виде, в каком их получает callback или
68
+ * `process`. Массив строится при первом чтении в доставке и до её конца
69
+ * остаётся тем же объектом; доставка, причины которой никто не прочитал, не
70
+ * создаёт ни массива, ни заморозки. Вне доставки и для доставки без причин
71
+ * это общий пустой массив.
72
+ *
73
+ * Это единственное место, где причины выходят наружу, поэтому здесь же они
74
+ * становятся неизменяемыми: WorkGraph создаёт причину без заморозки, а
75
+ * замораживает её первое чтение.
76
+ */
77
+ get causes() {
78
+ const e = this.detail;
79
+ if (e !== void 0) {
80
+ const r = e.deliveryCauses;
81
+ if (r !== void 0)
82
+ return r;
83
+ }
84
+ let t, s;
85
+ if (this.state & d ? (t = this.firstCause, e !== void 0 && (s = e.extraCauses)) : e !== void 0 && (t = e.deliveryFirstCause, s = e.deliveryExtraCauses), t === void 0)
86
+ return h;
87
+ const i = [Object.freeze(t)];
88
+ if (s !== void 0)
89
+ for (const r of s.values())
90
+ i.push(Object.freeze(r));
91
+ return this.detailed().deliveryCauses = Object.freeze(i);
92
+ }
93
+ /**
94
+ * One facade per record: created on first exposure, then reused.
95
+ *
96
+ * Запись начинает вести frame с появлением facade. Facade создаётся внутри
97
+ * открытой доставки своей записи — его запрашивают только тело binding и
98
+ * `process` — и получает её frame; frame каждой следующей доставки
99
+ * записывает её открытие.
100
+ */
101
+ get task() {
102
+ let e = this.facade;
103
+ return e === void 0 && (this.state & u && (this.frame = this.phaseState.pipeline.frame), this.facade = e = new p(this)), e;
104
+ }
105
+ /** Возвращает редкое состояние записи и создаёт его при первом обращении. */
106
+ detailed() {
107
+ return this.detail ??= new a();
108
+ }
109
+ notify(e) {
110
+ this.phaseState.pipeline._notifyTask(this, e);
111
+ }
112
+ schedule() {
113
+ this.phaseState.pipeline._queue(this, !0);
114
+ }
115
+ enqueue(e, t = e.source, s = !0) {
116
+ const i = this.phaseState.pipeline;
117
+ i._appendCause(this, e, t), i._queue(this, s);
118
+ }
119
+ /**
120
+ * Запускает slot группы effects; у записи одиночного effect и watch ничего
121
+ * не делает. Запись группы сама является handle, который возвращает
122
+ * `effectGroup`.
123
+ */
124
+ start(e, t = "scheduled") {
125
+ this.consumerOwner.runtime._startGroupSlot(this, e, t);
126
+ }
127
+ /**
128
+ * Внутренний initial invocation renderer; публичный start не меняет signature.
129
+ * Continuation не сохраняется в записи и не вызывается при последующих runs.
130
+ * @internal
131
+ */
132
+ _start(e, t, s) {
133
+ this.consumerOwner.runtime._startGroupSlot(this, e, t, s);
134
+ }
135
+ pause() {
136
+ this.phaseState.pipeline._pauseTask(this);
137
+ }
138
+ resume() {
139
+ this.phaseState.pipeline._resumeTask(this);
140
+ }
141
+ /**
142
+ * Полностью освобождает binding; безопасен для повторного и вложенного вызова:
143
+ * снимает запись со списка владельца, останавливает engine effect или watch
144
+ * lifecycle и сбрасывает состояние pipeline. Engine вызывает его как task hook
145
+ * остановленного effect, владелец — как элемент списка ресурсов, а
146
+ * пользователь — через disposer.
147
+ */
148
+ dispose() {
149
+ this.phaseState.pipeline._disposeBinding(this);
150
+ }
151
+ }
152
+ export {
153
+ h as EMPTY_CAUSES,
154
+ c as EMPTY_FRAME,
155
+ y as GROUP_CONTEXT,
156
+ K as GROUP_CURSOR,
157
+ m as GROUP_NODES,
158
+ a as RaphPhaseTaskDetail,
159
+ p as RaphPhaseTaskHandle,
160
+ g as RaphPhaseTaskRecord,
161
+ n as TASK_ACTIVE,
162
+ D as TASK_CANCEL,
163
+ d as TASK_CAUSES_DELIVERED,
164
+ O as TASK_DEFER,
165
+ S as TASK_DEFERRED,
166
+ f as TASK_DISCARD_ACKNOWLEDGED,
167
+ E as TASK_EXECUTED,
168
+ u as TASK_IN_DELIVERY,
169
+ l as TASK_PAUSED,
170
+ _ as TASK_PENDING,
171
+ v as TASK_REQUESTED,
172
+ T as TASK_RESOLUTION,
173
+ C as TASK_RUN,
174
+ R as TASK_TASKLESS,
175
+ A as TASK_UNRESOLVED
176
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../reactivity/RuntimeWatch.cjs");class a extends o.RuntimeWatch{constructor(t,e){super(t,e),this.source=void 0,this.record=void 0}}function s(r,t){const e=new a(r,()=>{const c=e.record;return c===void 0?void 0:c.effect(c.task)});return e.record=t,e}exports.RaphPhaseWatch=a;exports.createPhaseWatch=s;
@@ -0,0 +1,20 @@
1
+ import { RuntimeWatch as c } from "../reactivity/RuntimeWatch.js";
2
+ class s extends c {
3
+ /**
4
+ * Создаёт lifecycle без подписки и без binding; оба поля задаёт регистрация.
5
+ */
6
+ constructor(e, t) {
7
+ super(e, t), this.source = void 0, this.record = void 0;
8
+ }
9
+ }
10
+ function a(o, e) {
11
+ const t = new s(o, () => {
12
+ const r = t.record;
13
+ return r === void 0 ? void 0 : r.effect(r.task);
14
+ });
15
+ return t.record = e, t;
16
+ }
17
+ export {
18
+ s as RaphPhaseWatch,
19
+ a as createPhaseWatch
20
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function u(o,r){const i=r.direction??"parents-first",s=o.map(n=>{const t=r.node(n);return{node:t,path:t==null?void 0:k(t),task:n}}),e=l(s);return s.sort((n,t)=>{if(n.path===void 0||t.path===void 0)return n.path!==t.path?n.path===void 0?1:-1:t.task.priority-n.task.priority||n.task.sequence-t.task.sequence;const c=d(n.path,t.path,e,i==="children-first");return c!==0?c:t.task.priority-n.task.priority||n.task.sequence-t.task.sequence}),s.map(n=>n.task)}function d(o,r,i,s){if(o[o.length-1]===r[r.length-1])return 0;let e=0;const n=Math.min(o.length,r.length);for(;e<n&&o[e]===r[e];)e++;if(e===o.length)return s?1:-1;if(e===r.length)return s?-1:1;const t=o[e],c=r[e];if(t.priority!==c.priority)return c.priority-t.priority;const a=i.get(t),p=i.get(c);return a!==void 0&&p!==void 0?a-p:t.id.localeCompare(c.id)}function l(o){const r=new Set;for(const s of o){const e=s.path;if(e!==void 0)for(let n=0;n+1<e.length;n++)r.add(e[n])}const i=new Map;for(const s of r){const e=s.children;for(let n=0;n<e.length;n++)i.set(e[n],n)}return i}function k(o){const r=[];for(let i=o;i!==null;i=i.parent)r.push(i);return r.reverse(),r}exports.orderPhaseTasks=u;
@@ -0,0 +1,59 @@
1
+ function k(o, r) {
2
+ const i = r.direction ?? "parents-first", s = o.map((n) => {
3
+ const t = r.node(n);
4
+ return { node: t, path: t == null ? void 0 : l(t), task: n };
5
+ }), e = d(s);
6
+ return s.sort((n, t) => {
7
+ if (n.path === void 0 || t.path === void 0)
8
+ return n.path !== t.path ? n.path === void 0 ? 1 : -1 : t.task.priority - n.task.priority || n.task.sequence - t.task.sequence;
9
+ const c = u(
10
+ n.path,
11
+ t.path,
12
+ e,
13
+ i === "children-first"
14
+ );
15
+ return c !== 0 ? c : t.task.priority - n.task.priority || n.task.sequence - t.task.sequence;
16
+ }), s.map((n) => n.task);
17
+ }
18
+ function u(o, r, i, s) {
19
+ if (o[o.length - 1] === r[r.length - 1])
20
+ return 0;
21
+ let e = 0;
22
+ const n = Math.min(o.length, r.length);
23
+ for (; e < n && o[e] === r[e]; )
24
+ e++;
25
+ if (e === o.length)
26
+ return s ? 1 : -1;
27
+ if (e === r.length)
28
+ return s ? -1 : 1;
29
+ const t = o[e], c = r[e];
30
+ if (t.priority !== c.priority)
31
+ return c.priority - t.priority;
32
+ const a = i.get(t), p = i.get(c);
33
+ return a !== void 0 && p !== void 0 ? a - p : t.id.localeCompare(c.id);
34
+ }
35
+ function d(o) {
36
+ const r = /* @__PURE__ */ new Set();
37
+ for (const s of o) {
38
+ const e = s.path;
39
+ if (e !== void 0)
40
+ for (let n = 0; n + 1 < e.length; n++)
41
+ r.add(e[n]);
42
+ }
43
+ const i = /* @__PURE__ */ new Map();
44
+ for (const s of r) {
45
+ const e = s.children;
46
+ for (let n = 0; n < e.length; n++)
47
+ i.set(e[n], n);
48
+ }
49
+ return i;
50
+ }
51
+ function l(o) {
52
+ const r = [];
53
+ for (let i = o; i !== null; i = i.parent)
54
+ r.push(i);
55
+ return r.reverse(), r;
56
+ }
57
+ export {
58
+ k as orderPhaseTasks
59
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../path/data-path.utils.cjs"),l=require("../errors.cjs"),p=require("../ownership/throwDisposalErrors.cjs");class u{path;options;_revision;_disposeRevision;_isTracking;_store;_release;_masks;_assertOwnerAlive;_assertTrackedRead;_assertWriteAllowed;_runWrite;_notifyEvents;_hasRevisionSubscribers;_stop;_activationLeases=0;_trackedActivation=!1;_disposed=!1;constructor(s,t,r,e,i,o,a,_,n,d,v){const h=i._ownedSignal(0,d);this._store=s,this._revision=h.source,this._disposeRevision=h.dispose,this._isTracking=i._isTracking,this.path=t.canonical,this.options=r,this._release=e,this._masks=c.pathRelationMasks(t),this._assertOwnerAlive=o,this._assertTrackedRead=a,this._assertWriteAllowed=_,this._runWrite=n,this._notifyEvents=v,this._hasRevisionSubscribers=h.hasSubscribers}get disposed(){return this._disposed}get(){return this._assertAlive(),this._assertTrackedRead?.(),this._isTracking()?this._readTracked():this._store.peek(this.path)}peek(){return this._assertAlive(),this._store.peek(this.path)}set(s){this._assertAlive(),this._assertWriteAllowed?.(),this._write(()=>this._store.set(this.path,s))}merge(s){this._assertAlive(),this._assertWriteAllowed?.(),this._write(()=>this._store.merge(this.path,s))}delete(){this._assertAlive(),this._assertWriteAllowed?.(),this._write(()=>this._store.delete(this.path))}has(){return this._assertAlive(),this._store.has(this.path)}dispose(){if(this._disposed)return;const s=this._runWrite;s===void 0?this._disposeNow():s(()=>this._disposeNow())}_disposeNow(){if(this._disposed)return;this._disposed=!0;const s=[],t=this._stop;this._stop=void 0;const r=this._disposeRevision;this._disposeRevision=void 0;const e=this._release;this._release=void 0,this._revision=void 0,this._isTracking=void 0,this._store=void 0,this._assertOwnerAlive=void 0,this._assertTrackedRead=void 0,this._assertWriteAllowed=void 0,this._runWrite=void 0,this._notifyEvents=void 0,this._hasRevisionSubscribers=void 0,this._activationLeases=0,this._trackedActivation=!1;try{t?.()}catch(i){s.push(i)}try{r?.()}catch(i){s.push(i)}try{e?.(this)}catch(i){s.push(i)}p.throwDisposalErrors(s,`[Raph] Path handle "${this.path}" disposal failed.`)}_getTracked(){return this._assertAlive(),this._assertTrackedRead?.(),this._readTracked()}_activate(){this._assertAlive(),this._activationLeases++;try{this._observe()}catch(t){throw this._activationLeases--,t}let s=!0;return()=>{s&&(s=!1,this._activationLeases!==0&&this._activationLeases--,this._releaseObserverIfIdle())}}_readTracked(){return this._trackedActivation=!0,this._observe(),this._revision.get(),this._store.get(this.path)}_observe(){this._stop??=this._store.watch(this._masks,s=>{const t=()=>{if(this._disposed)return;const e=this._revision;e!==void 0&&(this._notifyEvents?.(s,this._hasRevisionSubscribers?.()??!1),!(this._disposed||this._revision!==e)&&e.set(e.peek()+1))},r=this._runWrite;r===void 0?t():r(t)})}_releaseObserverIfIdle(){if(this._disposed||this._trackedActivation||this._activationLeases!==0)return;const s=this._stop;this._stop=void 0,s?.()}_write(s){const t=this._runWrite;t===void 0?s():t(s)}_assertAlive(){if(this._disposed)throw new l.RaphDisposedError(`[Raph] Path handle "${this.path}" is disposed.`);this._assertOwnerAlive?.()}}exports.PathHandle=u;
@@ -0,0 +1,165 @@
1
+ import { pathRelationMasks as c } from "../../path/data-path.utils.js";
2
+ import { RaphDisposedError as p } from "../errors.js";
3
+ import { throwDisposalErrors as l } from "../ownership/throwDisposalErrors.js";
4
+ class A {
5
+ // Публикуют canonical path и нормализованные параметры handle.
6
+ path;
7
+ options;
8
+ // Связывают path revision с runtime reactivity и owning Kernel.
9
+ _revision;
10
+ _disposeRevision;
11
+ _isTracking;
12
+ _store;
13
+ _release;
14
+ _masks;
15
+ // Применяют runtime lifecycle и write policy к операциям handle.
16
+ _assertOwnerAlive;
17
+ _assertTrackedRead;
18
+ _assertWriteAllowed;
19
+ _runWrite;
20
+ _notifyEvents;
21
+ _hasRevisionSubscribers;
22
+ // Хранят активную Kernel subscription и окончательное состояние handle.
23
+ _stop;
24
+ _activationLeases = 0;
25
+ _trackedActivation = !1;
26
+ _disposed = !1;
27
+ /**
28
+ * Создаёт internal path handle и связывает его с runtime lifecycle.
29
+ * @internal
30
+ */
31
+ constructor(s, t, r, i, e, o, a, _, n, d, v) {
32
+ const h = e._ownedSignal(0, d);
33
+ this._store = s, this._revision = h.source, this._disposeRevision = h.dispose, this._isTracking = e._isTracking, this.path = t.canonical, this.options = r, this._release = i, this._masks = c(t), this._assertOwnerAlive = o, this._assertTrackedRead = a, this._assertWriteAllowed = _, this._runWrite = n, this._notifyEvents = v, this._hasRevisionSubscribers = h.hasSubscribers;
34
+ }
35
+ /**
36
+ * Показывает, освобождён ли path handle.
37
+ */
38
+ get disposed() {
39
+ return this._disposed;
40
+ }
41
+ /**
42
+ * Читает path с регистрацией реактивной зависимости.
43
+ */
44
+ get() {
45
+ return this._assertAlive(), this._assertTrackedRead?.(), this._isTracking() ? this._readTracked() : this._store.peek(this.path);
46
+ }
47
+ /**
48
+ * Читает path без регистрации реактивной зависимости.
49
+ */
50
+ peek() {
51
+ return this._assertAlive(), this._store.peek(this.path);
52
+ }
53
+ /**
54
+ * Записывает значение path через runtime write policy.
55
+ */
56
+ set(s) {
57
+ this._assertAlive(), this._assertWriteAllowed?.(), this._write(() => this._store.set(this.path, s));
58
+ }
59
+ /**
60
+ * Объединяет значение path через runtime write policy.
61
+ */
62
+ merge(s) {
63
+ this._assertAlive(), this._assertWriteAllowed?.(), this._write(() => this._store.merge(this.path, s));
64
+ }
65
+ /**
66
+ * Удаляет значение path через runtime write policy.
67
+ */
68
+ delete() {
69
+ this._assertAlive(), this._assertWriteAllowed?.(), this._write(() => this._store.delete(this.path));
70
+ }
71
+ /**
72
+ * Проверяет наличие значения path.
73
+ */
74
+ has() {
75
+ return this._assertAlive(), this._store.has(this.path);
76
+ }
77
+ /**
78
+ * Отсоединяет Kernel subscription и освобождает reactive revision handle.
79
+ */
80
+ dispose() {
81
+ if (this._disposed)
82
+ return;
83
+ const s = this._runWrite;
84
+ s === void 0 ? this._disposeNow() : s(() => this._disposeNow());
85
+ }
86
+ _disposeNow() {
87
+ if (this._disposed)
88
+ return;
89
+ this._disposed = !0;
90
+ const s = [], t = this._stop;
91
+ this._stop = void 0;
92
+ const r = this._disposeRevision;
93
+ this._disposeRevision = void 0;
94
+ const i = this._release;
95
+ this._release = void 0, this._revision = void 0, this._isTracking = void 0, this._store = void 0, this._assertOwnerAlive = void 0, this._assertTrackedRead = void 0, this._assertWriteAllowed = void 0, this._runWrite = void 0, this._notifyEvents = void 0, this._hasRevisionSubscribers = void 0, this._activationLeases = 0, this._trackedActivation = !1;
96
+ try {
97
+ t?.();
98
+ } catch (e) {
99
+ s.push(e);
100
+ }
101
+ try {
102
+ r?.();
103
+ } catch (e) {
104
+ s.push(e);
105
+ }
106
+ try {
107
+ i?.(this);
108
+ } catch (e) {
109
+ s.push(e);
110
+ }
111
+ l(s, `[Raph] Path handle "${this.path}" disposal failed.`);
112
+ }
113
+ /**
114
+ * Читает path с регистрацией runtime reactive dependency.
115
+ * @internal
116
+ */
117
+ _getTracked() {
118
+ return this._assertAlive(), this._assertTrackedRead?.(), this._readTracked();
119
+ }
120
+ /** Activates the lazy Kernel observer for an explicit granular watch. @internal */
121
+ _activate() {
122
+ this._assertAlive(), this._activationLeases++;
123
+ try {
124
+ this._observe();
125
+ } catch (t) {
126
+ throw this._activationLeases--, t;
127
+ }
128
+ let s = !0;
129
+ return () => {
130
+ s && (s = !1, this._activationLeases !== 0 && this._activationLeases--, this._releaseObserverIfIdle());
131
+ };
132
+ }
133
+ _readTracked() {
134
+ return this._trackedActivation = !0, this._observe(), this._revision.get(), this._store.get(this.path);
135
+ }
136
+ _observe() {
137
+ this._stop ??= this._store.watch(this._masks, (s) => {
138
+ const t = () => {
139
+ if (this._disposed)
140
+ return;
141
+ const i = this._revision;
142
+ i !== void 0 && (this._notifyEvents?.(s, this._hasRevisionSubscribers?.() ?? !1), !(this._disposed || this._revision !== i) && i.set(i.peek() + 1));
143
+ }, r = this._runWrite;
144
+ r === void 0 ? t() : r(t);
145
+ });
146
+ }
147
+ _releaseObserverIfIdle() {
148
+ if (this._disposed || this._trackedActivation || this._activationLeases !== 0)
149
+ return;
150
+ const s = this._stop;
151
+ this._stop = void 0, s?.();
152
+ }
153
+ _write(s) {
154
+ const t = this._runWrite;
155
+ t === void 0 ? s() : t(s);
156
+ }
157
+ _assertAlive() {
158
+ if (this._disposed)
159
+ throw new p(`[Raph] Path handle "${this.path}" is disposed.`);
160
+ this._assertOwnerAlive?.();
161
+ }
162
+ }
163
+ export {
164
+ A as PathHandle
165
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../path/DataPath.cjs"),d=require("../errors.cjs");class a{constructor(e,t,s,r,i){this.owner=e,this._start=r,this._release=i;const o=Object.freeze({...s,...s.vars===void 0?{}:{vars:Object.freeze({...s.vars})}});this.options=o,this.masks=Array.isArray(t)?Object.freeze(t.map(c=>n.DataPath.from(c,o))):n.DataPath.from(t,o)}masks;options;_stop;_activationLeases=0;_disposed=!1;_releaseOwner;static _create(e,t,s,r,i){return new a(e,t,s,r,i)}get runtime(){return this.owner.runtime}get disposed(){return this._disposed}dispose(){if(this._disposed)return;const e=this.runtime,t=!e._ownerDisposalActive();t&&e._beginOwnerDisposal();const s=[];try{const r=this._releaseOwner;r!==void 0?(this._releaseOwner=void 0,r()):this._disposeOwned()}catch(r){s.push(r)}finally{if(t)try{e._endOwnerDisposal()}catch(r){s.push(r)}}if(s.length===1)throw s[0];if(s.length>1)throw new AggregateError(s,"[Raph] Meta source disposal failed.")}_bindOwner(e){this._releaseOwner=e}_disposeOwned(){if(this._disposed)return;this._disposed=!0,this._releaseOwner=void 0;const e=[];try{this._stop?.()}catch(t){e.push(t)}this._stop=void 0,this._activationLeases=0;try{this._release()}catch(t){e.push(t)}if(this._start=_,this._release=h,e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"[Raph] Meta source disposal failed.")}_activate(){this._assertAlive(),this._activationLeases++;try{this._stop??=this._start()}catch(t){throw this._activationLeases--,t}let e=!0;return()=>{if(!e||(e=!1,this._activationLeases!==0&&this._activationLeases--,this._disposed||this._activationLeases!==0))return;const t=this._stop;this._stop=void 0,t?.()}}_assertAlive(){if(this._disposed||this.owner.disposed)throw new d.RaphDisposedError("[Raph] Meta source is disposed.")}}function h(){}function _(){return h}exports.RaphMetaSource=a;
@@ -0,0 +1,108 @@
1
+ import { DataPath as a } from "../../path/DataPath.js";
2
+ import { RaphDisposedError as c } from "../errors.js";
3
+ class n {
4
+ /** @internal */
5
+ constructor(e, s, t, r, i) {
6
+ this.owner = e, this._start = r, this._release = i;
7
+ const o = Object.freeze({
8
+ ...t,
9
+ ...t.vars === void 0 ? {} : { vars: Object.freeze({ ...t.vars }) }
10
+ });
11
+ this.options = o, this.masks = Array.isArray(s) ? Object.freeze(s.map((p) => a.from(p, o))) : a.from(s, o);
12
+ }
13
+ masks;
14
+ options;
15
+ _stop;
16
+ _activationLeases = 0;
17
+ _disposed = !1;
18
+ _releaseOwner;
19
+ /** @internal */
20
+ static _create(e, s, t, r, i) {
21
+ return new n(e, s, t, r, i);
22
+ }
23
+ get runtime() {
24
+ return this.owner.runtime;
25
+ }
26
+ get disposed() {
27
+ return this._disposed;
28
+ }
29
+ dispose() {
30
+ if (this._disposed)
31
+ return;
32
+ const e = this.runtime, s = !e._ownerDisposalActive();
33
+ s && e._beginOwnerDisposal();
34
+ const t = [];
35
+ try {
36
+ const r = this._releaseOwner;
37
+ r !== void 0 ? (this._releaseOwner = void 0, r()) : this._disposeOwned();
38
+ } catch (r) {
39
+ t.push(r);
40
+ } finally {
41
+ if (s)
42
+ try {
43
+ e._endOwnerDisposal();
44
+ } catch (r) {
45
+ t.push(r);
46
+ }
47
+ }
48
+ if (t.length === 1)
49
+ throw t[0];
50
+ if (t.length > 1)
51
+ throw new AggregateError(t, "[Raph] Meta source disposal failed.");
52
+ }
53
+ /** @internal */
54
+ _bindOwner(e) {
55
+ this._releaseOwner = e;
56
+ }
57
+ /** @internal */
58
+ _disposeOwned() {
59
+ if (this._disposed)
60
+ return;
61
+ this._disposed = !0, this._releaseOwner = void 0;
62
+ const e = [];
63
+ try {
64
+ this._stop?.();
65
+ } catch (s) {
66
+ e.push(s);
67
+ }
68
+ this._stop = void 0, this._activationLeases = 0;
69
+ try {
70
+ this._release();
71
+ } catch (s) {
72
+ e.push(s);
73
+ }
74
+ if (this._start = d, this._release = h, e.length === 1)
75
+ throw e[0];
76
+ if (e.length > 1)
77
+ throw new AggregateError(e, "[Raph] Meta source disposal failed.");
78
+ }
79
+ /** @internal */
80
+ _activate() {
81
+ this._assertAlive(), this._activationLeases++;
82
+ try {
83
+ this._stop ??= this._start();
84
+ } catch (s) {
85
+ throw this._activationLeases--, s;
86
+ }
87
+ let e = !0;
88
+ return () => {
89
+ if (!e || (e = !1, this._activationLeases !== 0 && this._activationLeases--, this._disposed || this._activationLeases !== 0))
90
+ return;
91
+ const s = this._stop;
92
+ this._stop = void 0, s?.();
93
+ };
94
+ }
95
+ /** @internal */
96
+ _assertAlive() {
97
+ if (this._disposed || this.owner.disposed)
98
+ throw new c("[Raph] Meta source is disposed.");
99
+ }
100
+ }
101
+ function h() {
102
+ }
103
+ function d() {
104
+ return h;
105
+ }
106
+ export {
107
+ n as RaphMetaSource
108
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=32,a=32;class f{constructor(e,s,t,r){this.select=u(this),this._previousSource=void 0,this._trackedKey=void 0,this._owner=e,this._reactivity=s,this._source=t,this._equals=r,this._dense=[],this._denseBase=0,this._denseCount=0,this._triggers=void 0,this._scanning=!1,this._objectHooks=l(this,t),this._growthLimit=1,this._sweptAt=0,this._sweepStride=0,this._disposed=!1,this._tapSlot=-1,this._sweepSlot=-1,this._sweepDue=0,t._addWriteTap(this)}get[Symbol.toStringTag](){return"RaphSelector"}toJSON(){return{owner:this._owner.id,triggers:this._size(),disposed:this._disposed}}get _tapOwner(){return this._owner}_debugTriggerCount(){return this._size()}_test(e){const s=this._owner,t=this._reactivity;t._assertTrackedRead(s),s._assertAlive(),this._track(e,t);const r=this._source.peek(),i=this._equals;return i!==void 0?i(e,r):e===r||typeof e=="number"&&typeof r=="number"&&Object.is(e,r)}_observesWrites(){return this._size()!==0}_afterSourceWrite(e,s){if(this._size()===0)return;const t=this._reactivity,r=this._equals;if(r===void 0){if(Object.is(e,s))return;this._wakePair(e,s,t);return}let i;const n=this._scanning;this._scanning=!0;const o=this._dense;for(let _=0;_<o.length;_++){const d=o[_];if(d!==void 0){if(!t._signalNodeHasSubscribers(d)){o[_]=void 0,this._denseCount--;continue}i=this._wakeChanged(this._denseBase+_,d,e,s,r,i)}}const h=this._triggers;if(h!==void 0)for(const[_,d]of h){if(!t._signalNodeHasSubscribers(d)){h.delete(_);continue}i=this._wakeChanged(_,d,e,s,r,i)}if(this._scanning=n,this._settleDense(),i!==void 0)throw i.length===1?i[0]:new AggregateError(i,"[Raph] Selector notification failed.")}_afterOwnerDisposals(e){const s=this._size(),t=this._sweepStride,r=this._sweptAt+(t>s?t:s);if(e<r)return r;this._sweep(e);const i=this._size();if(i===0)return this._sweepStride=0,this._growthLimit=1,0;if(i!==s)return this._sweepStride=0,e+i;const n=(t>i?t:i)*2;return this._sweepStride=n,e+n}_edgeDetached(e){if(this._disposed)return;const s=this._triggers,t=s.get(e);t!==void 0&&this._reactivity._hasSingleSubscriber(t)&&s.delete(e)}_findConsumerOwner(e,s){const t=this._reactivity,r=this._dense;for(let n=0;n<r.length;n++){const o=r[n];if(o===void 0)continue;const h=t._findSubscriberOwner(o,e,s);if(h!==void 0)return h}const i=this._triggers;if(i!==void 0)for(const n of i.values()){const o=t._findSubscriberOwner(n,e,s);if(o!==void 0)return o}}_finalizeSource(){if(this._disposed)return!0;this._disposed=!0,this._equals=void 0,this._source._removeWriteTap(this),this._sweepSlot!==-1&&this._owner.runtime._removeDisposalSweeper(this);const e=this._reactivity;let s;const t=this._dense;for(let i=0;i<t.length;i++){const n=t[i];if(n!==void 0)try{e._releaseSignalNode(n)}catch(o){(s??=[]).push(o)}}t.length=0,this._denseCount=0;const r=this._triggers;if(r!==void 0){for(const i of r.values())try{e._releaseSignalNode(i)}catch(n){(s??=[]).push(n)}r.clear()}if(s!==void 0)throw s.length===1?s[0]:new AggregateError(s,"[Raph] Selector disposal failed.");return!0}_sweep(e=this._owner.runtime._ownerDisposalCount()){this._sweptAt=e;const s=this._size();if(s===0)return;const t=this._dense,r=this._triggers,i=this._reactivity,n=i._countObserved(t,r);if(n===s){t.length!==this._denseCount&&this._settleDense();return}if(n===0){t.length=0,this._denseCount=0,r!==void 0&&r.clear();return}this._denseCount=i._dropUnobserved(t,r),this._settleDense()}_size(){const e=this._triggers;return e===void 0?this._denseCount:this._denseCount+e.size}_track(e,s){if(typeof e=="number"){const n=this._dense,o=n.length;if(o===0){if(Number.isInteger(e)){this._trackDense(e,0,s);return}}else{const h=this._denseBase,_=e-h;if(_>=0&&_<=o&&_===(_|0)&&h+_===e){const d=_<o?n[_]:void 0;d!==void 0?s._readSignalNode(d):this._trackDense(e,_,s);return}}}const t=this._triggers,r=t===void 0?void 0:t.get(e);if(typeof e=="object"?e!==null:typeof e=="function"){this._trackObject(e,r,s);return}if(r!==void 0){s._readSignalNode(r);return}const i=s._trackCounterNode(this._source);i!==void 0&&(t===void 0?this._triggers=new Map().set(e,i):t.set(e,i),this._size()>=this._growthLimit&&this._grow())}_trackDense(e,s,t){const r=this._triggers;if(r!==void 0&&r.size!==0){const o=r.get(e);if(o!==void 0){t._readSignalNode(o);return}}const i=t._trackCounterNode(this._source);if(i===void 0)return;const n=this._dense;s===n.length?(s===0&&(this._denseBase=e+0),n.push(i)):n[s]=i,this._denseCount++,this._size()>=this._growthLimit&&this._grow()}_trackObject(e,s,t){if(this._trackedKey=e,s!==void 0)t._readSignalNode(s);else{const r=t._trackCounterNode(this._objectHooks);if(r!==void 0){const i=this._triggers;i===void 0?this._triggers=new Map().set(e,r):i.set(e,r),this._size()>=this._growthLimit&&this._grow()}}this._trackedKey=void 0}_grow(){const e=this._owner.runtime,s=e._ownerDisposalCount();this._sweep(s);const t=this._size();this._growthLimit=t*2>g?t*2:g,this._sweepSlot===-1&&(this._sweepStride=0,e._addDisposalSweeper(this,s+t))}_wakePair(e,s,t){let r=!1,i;const n=this._find(e);if(n!==void 0)try{this._bump(e,n,t)}catch(h){r=!0,i=h}const o=this._find(s);if(o!==void 0)try{this._bump(s,o,t)}catch(h){throw r?new AggregateError([i,h],"[Raph] Selector notification failed."):h}if(r)throw i}_bump(e,s,t){t._bumpSignalNode(s)||this._forget(e)}_wakeChanged(e,s,t,r,i,n){let o=!0;try{o=i(e,t)!==i(e,r)}catch(h){(n??=[]).push(h)}if(o)try{this._bump(e,s,this._reactivity)}catch(h){(n??=[]).push(h)}return n}_find(e){if(typeof e=="number"){const t=this._dense,r=this._denseBase,i=e-r;if(i>=0&&i<t.length&&i===(i|0)&&r+i===e)return t[i]}const s=this._triggers;return s===void 0?void 0:s.get(e)}_forget(e){if(typeof e=="number"){const t=this._dense,r=this._denseBase,i=e-r;if(i>=0&&i<t.length&&i===(i|0)&&r+i===e){if(t[i]!==void 0){t[i]=void 0;const n=--this._denseCount;(n===0||t.length>(n*2+a)*2)&&this._settleDense()}return}}const s=this._triggers;s!==void 0&&s.delete(e)}_settleDense(){if(this._scanning)return;const e=this._dense,s=this._denseCount;if(s===0){e.length=0;return}let t=e.length,r=0;for(;r<t&&e[r]===void 0;)r++;for(;t>r&&e[t-1]===void 0;)t--;if(t-r>s*2+a){const i=this._denseBase,n=this._triggers??=new Map;for(let o=r;o<t;o++){const h=e[o];h!==void 0&&n.set(i+o,h)}e.length=0,this._denseCount=0;return}r!==0&&(e.copyWithin(0,r,t),this._denseBase+=r),e.length=t-r}}function u(c){return e=>c._test(e)}function l(c,e){return{token:e,onDependency:()=>{const s=c._trackedKey;return()=>{c._edgeDetached(s)}}}}exports.RuntimeSelector=f;