@raphy-js/raph 1.0.0-dev.2 → 1.0.1-dev.20

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 (211) 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-CyilRD7s.js +1055 -0
  8. package/dist/core-ugchZNqC.cjs +1 -0
  9. package/dist/debug/api/Raph.cjs +1 -1
  10. package/dist/debug/api/Raph.js +368 -366
  11. package/dist/debug/api/RaphFacadeSession.cjs +1 -0
  12. package/dist/debug/api/RaphFacadeSession.js +306 -0
  13. package/dist/debug/api/RaphReactivityInstance.cjs +1 -0
  14. package/dist/debug/api/RaphReactivityInstance.js +149 -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/{data-path.js → DataPath.js} +151 -180
  19. package/dist/debug/path/PathRouter.cjs +1 -0
  20. package/dist/debug/path/{path-router.js → PathRouter.js} +1 -1
  21. package/dist/debug/path/RaphKernel.cjs +1 -1
  22. package/dist/debug/path/RaphKernel.js +258 -207
  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/{DerivedRegistry.js → derived/DerivedRegistry.js} +5 -5
  27. package/dist/debug/path/derived/derived-collection.utils.cjs +1 -0
  28. package/dist/debug/path/{derived-collection.js → derived/derived-collection.utils.js} +1 -1
  29. package/dist/debug/path/derived/derived-strategy.types.cjs +1 -0
  30. package/dist/debug/path/derived/derived-strategy.types.js +1 -0
  31. package/dist/debug/path/{MetaController.cjs → meta/MetaController.cjs} +1 -1
  32. package/dist/debug/path/{MetaController.js → meta/MetaController.js} +3 -3
  33. package/dist/debug/path/meta/RaphMetaStore.cjs +1 -0
  34. package/dist/debug/path/{RaphMetaStore.js → meta/RaphMetaStore.js} +1 -1
  35. package/dist/debug/path/meta/meta.types.cjs +1 -0
  36. package/dist/debug/path/meta/meta.types.js +1 -0
  37. package/dist/debug/path/storage/AdapterPathStore.cjs +1 -0
  38. package/dist/debug/path/{AdapterPathStore.js → storage/AdapterPathStore.js} +9 -9
  39. package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -0
  40. package/dist/debug/path/{data-adapter.js → storage/DefaultDataAdapter.js} +2 -2
  41. package/dist/debug/path/storage/PathEventHub.cjs +1 -0
  42. package/dist/debug/path/{PathEventHub.js → storage/PathEventHub.js} +34 -34
  43. package/dist/debug/path/storage/PathStore.cjs +1 -0
  44. package/dist/debug/path/{PathStore.js → storage/PathStore.js} +28 -28
  45. package/dist/debug/path/storage/data-adapter.types.cjs +1 -0
  46. package/dist/debug/path/storage/data-adapter.types.js +1 -0
  47. package/dist/debug/reactivity/engine.cjs +1 -1
  48. package/dist/debug/reactivity/engine.js +478 -306
  49. package/dist/debug/reactivity/reactive-object.cjs +1 -0
  50. package/dist/debug/reactivity/reactive-object.js +280 -0
  51. package/dist/debug/runtime/RaphRuntime.cjs +1 -1
  52. package/dist/debug/runtime/RaphRuntime.js +798 -519
  53. package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -0
  54. package/dist/debug/runtime/diagnostics/RaphDebug.js +297 -0
  55. package/dist/debug/runtime/errors.cjs +1 -1
  56. package/dist/debug/runtime/errors.js +6 -3
  57. package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -0
  58. package/dist/debug/runtime/ownership/RaphEffectScope.js +171 -0
  59. package/dist/debug/runtime/ownership/RaphNode.cjs +1 -0
  60. package/dist/debug/runtime/ownership/RaphNode.js +206 -0
  61. package/dist/debug/runtime/ownership/RaphScope.cjs +1 -0
  62. package/dist/debug/runtime/ownership/RaphScope.js +101 -0
  63. package/dist/debug/runtime/ownership/parent-graph.types.cjs +1 -0
  64. package/dist/debug/runtime/ownership/parent-graph.types.js +1 -0
  65. package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -0
  66. package/dist/debug/runtime/phases/RaphPhasePipeline.js +587 -0
  67. package/dist/debug/runtime/phases/orderPhaseTasks.cjs +1 -0
  68. package/dist/debug/runtime/phases/orderPhaseTasks.js +59 -0
  69. package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -0
  70. package/dist/debug/runtime/{PathHandle.js → reactivity/PathHandle.js} +75 -39
  71. package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -0
  72. package/dist/debug/runtime/reactivity/RaphMetaSource.js +112 -0
  73. package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -0
  74. package/dist/debug/runtime/reactivity/RaphWorkGraph.js +995 -0
  75. package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -0
  76. package/dist/debug/runtime/reactivity/RuntimeReactivity.js +156 -0
  77. package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -0
  78. package/dist/debug/runtime/reactivity/RuntimeWatch.js +88 -0
  79. package/dist/debug/runtime/reactivity/runtime-reactivity.types.cjs +1 -0
  80. package/dist/debug/runtime/reactivity/runtime-reactivity.types.js +1 -0
  81. package/dist/entrypoints/machine-testing.d.ts +2 -0
  82. package/dist/entrypoints/machine.d.ts +5 -0
  83. package/dist/entrypoints/path.d.ts +14 -0
  84. package/dist/entrypoints/reactivity.d.ts +1 -0
  85. package/dist/entrypoints/runtime.d.ts +17 -0
  86. package/dist/index.cjs +1 -1
  87. package/dist/index.js +46 -38
  88. package/dist/machine/compiler.d.ts +71 -0
  89. package/dist/machine/core.d.ts +50 -0
  90. package/dist/machine/persistence.d.ts +5 -0
  91. package/dist/machine/runtime.d.ts +4 -0
  92. package/dist/machine/testing.d.ts +43 -0
  93. package/dist/machine/types.d.ts +155 -0
  94. package/dist/machine-testing.cjs +1 -0
  95. package/dist/machine-testing.js +188 -0
  96. package/dist/machine.cjs +1 -0
  97. package/dist/machine.js +837 -0
  98. package/dist/main.d.ts +20 -0
  99. package/dist/path/{data-path.d.ts → DataPath.d.ts} +16 -40
  100. package/dist/path/{path-router.d.ts → PathRouter.d.ts} +1 -1
  101. package/dist/path/RaphKernel.d.ts +13 -10
  102. package/dist/path/data-path.types.d.ts +34 -0
  103. package/dist/path/data-path.utils.d.ts +9 -0
  104. package/dist/path/{DerivedRegistry.d.ts → derived/DerivedRegistry.d.ts} +2 -2
  105. package/dist/path/{RaphDerivedHandle.d.ts → derived/RaphDerivedHandle.d.ts} +3 -3
  106. package/dist/path/derived/derived-collection.types.d.ts +12 -0
  107. package/dist/path/{derived-collection.d.ts → derived/derived-collection.utils.d.ts} +3 -13
  108. package/dist/path/{derived-strategies.d.ts → derived/derived-strategy.types.d.ts} +0 -3
  109. package/dist/path/derived/derived-strategy.utils.d.ts +4 -0
  110. package/dist/path/{MetaController.d.ts → meta/MetaController.d.ts} +4 -4
  111. package/dist/path/{RaphMeta.d.ts → meta/RaphMeta.d.ts} +2 -2
  112. package/dist/path/{RaphMetaStore.d.ts → meta/RaphMetaStore.d.ts} +1 -1
  113. package/dist/path/{meta.types.d.ts → meta/meta.types.d.ts} +2 -4
  114. package/dist/path/path.types.d.ts +3 -2
  115. package/dist/path/{segment-key.d.ts → pathSegmentKey.d.ts} +1 -1
  116. package/dist/path/{AdapterPathStore.d.ts → storage/AdapterPathStore.d.ts} +4 -4
  117. package/dist/path/{data-adapter.d.ts → storage/DefaultDataAdapter.d.ts} +2 -17
  118. package/dist/path/{PathEventHub.d.ts → storage/PathEventHub.d.ts} +9 -9
  119. package/dist/path/{PathStore.d.ts → storage/PathStore.d.ts} +3 -3
  120. package/dist/path/storage/data-adapter.types.d.ts +17 -0
  121. package/dist/path.cjs +1 -1
  122. package/dist/path.js +16 -16
  123. package/dist/raph.cjs +1 -1
  124. package/dist/raph.js +46 -38
  125. package/dist/reactivity/engine.d.ts +17 -3
  126. package/dist/reactivity/reactive-object.d.ts +36 -0
  127. package/dist/reactivity/types.d.ts +25 -0
  128. package/dist/reactivity.cjs +1 -1
  129. package/dist/reactivity.js +12 -12
  130. package/dist/runtime/RaphRuntime.d.ts +132 -192
  131. package/dist/runtime/diagnostics/RaphDebug.d.ts +239 -0
  132. package/dist/runtime/errors.d.ts +5 -0
  133. package/dist/runtime/ownership/RaphEffectScope.d.ts +29 -0
  134. package/dist/runtime/ownership/RaphNode.d.ts +40 -0
  135. package/dist/runtime/ownership/RaphScope.d.ts +38 -0
  136. package/dist/runtime/{parent-graph.d.ts → ownership/parent-graph.types.d.ts} +0 -1
  137. package/dist/runtime/ownership/parentGraph.d.ts +3 -0
  138. package/dist/runtime/phases/RaphPhasePipeline.d.ts +79 -0
  139. package/dist/runtime/phases/orderPhaseTasks.d.ts +6 -0
  140. package/dist/runtime/phases/phase.types.d.ts +92 -0
  141. package/dist/runtime/{PathHandle.d.ts → reactivity/PathHandle.d.ts} +14 -6
  142. package/dist/runtime/reactivity/RaphMetaSource.d.ts +32 -0
  143. package/dist/runtime/reactivity/RaphWorkGraph.d.ts +171 -0
  144. package/dist/runtime/{RuntimeReactivity.d.ts → reactivity/RuntimeReactivity.d.ts} +14 -9
  145. package/dist/runtime/{RuntimeWatch.d.ts → reactivity/RuntimeWatch.d.ts} +9 -3
  146. package/dist/runtime/{runtime-reactivity.types.d.ts → reactivity/runtime-reactivity.types.d.ts} +3 -1
  147. package/dist/runtime.cjs +1 -1
  148. package/dist/runtime.js +21 -16
  149. package/package.json +68 -35
  150. package/ReadMe.md +0 -153
  151. package/dist/api/public.d.ts +0 -22
  152. package/dist/debug/api/public.cjs +0 -1
  153. package/dist/debug/api/public.js +0 -40
  154. package/dist/debug/path/AdapterPathStore.cjs +0 -1
  155. package/dist/debug/path/DerivedRegistry.cjs +0 -1
  156. package/dist/debug/path/PathEventHub.cjs +0 -1
  157. package/dist/debug/path/PathStore.cjs +0 -1
  158. package/dist/debug/path/RaphMetaStore.cjs +0 -1
  159. package/dist/debug/path/data-adapter.cjs +0 -1
  160. package/dist/debug/path/data-path.cjs +0 -1
  161. package/dist/debug/path/derived-collection.cjs +0 -1
  162. package/dist/debug/path/path-router.cjs +0 -1
  163. package/dist/debug/path/public.cjs +0 -1
  164. package/dist/debug/path/public.js +0 -18
  165. package/dist/debug/runtime/PathHandle.cjs +0 -1
  166. package/dist/debug/runtime/RaphDebug.cjs +0 -1
  167. package/dist/debug/runtime/RaphDebug.js +0 -15
  168. package/dist/debug/runtime/RaphNode.cjs +0 -1
  169. package/dist/debug/runtime/RaphNode.js +0 -143
  170. package/dist/debug/runtime/RaphPhasePipeline.cjs +0 -1
  171. package/dist/debug/runtime/RaphPhasePipeline.js +0 -526
  172. package/dist/debug/runtime/RaphScope.cjs +0 -1
  173. package/dist/debug/runtime/RaphScope.js +0 -64
  174. package/dist/debug/runtime/RuntimeReactivity.cjs +0 -1
  175. package/dist/debug/runtime/RuntimeReactivity.js +0 -154
  176. package/dist/debug/runtime/RuntimeWatch.cjs +0 -1
  177. package/dist/debug/runtime/RuntimeWatch.js +0 -71
  178. package/dist/debug/runtime/public.cjs +0 -1
  179. package/dist/debug/runtime/public.js +0 -18
  180. package/dist/path/public.d.ts +0 -14
  181. package/dist/runtime/RaphDebug.d.ts +0 -32
  182. package/dist/runtime/RaphNode.d.ts +0 -68
  183. package/dist/runtime/RaphPhasePipeline.d.ts +0 -133
  184. package/dist/runtime/RaphScope.d.ts +0 -50
  185. package/dist/runtime/phase.types.d.ts +0 -49
  186. package/dist/runtime/public.d.ts +0 -13
  187. /package/dist/debug/path/{meta.types.cjs → data-path.types.cjs} +0 -0
  188. /package/dist/debug/path/{meta.types.js → data-path.types.js} +0 -0
  189. /package/dist/debug/path/{RaphDerivedHandle.cjs → derived/RaphDerivedHandle.cjs} +0 -0
  190. /package/dist/debug/path/{RaphDerivedHandle.js → derived/RaphDerivedHandle.js} +0 -0
  191. /package/dist/debug/{runtime/runtime-reactivity.types.cjs → path/derived/derived-collection.types.cjs} +0 -0
  192. /package/dist/debug/{runtime/runtime-reactivity.types.js → path/derived/derived-collection.types.js} +0 -0
  193. /package/dist/debug/path/{derived-strategies.cjs → derived/derived-strategy.utils.cjs} +0 -0
  194. /package/dist/debug/path/{derived-strategies.js → derived/derived-strategy.utils.js} +0 -0
  195. /package/dist/debug/path/{RaphMeta.cjs → meta/RaphMeta.cjs} +0 -0
  196. /package/dist/debug/path/{RaphMeta.js → meta/RaphMeta.js} +0 -0
  197. /package/dist/debug/path/{segment-key.cjs → pathSegmentKey.cjs} +0 -0
  198. /package/dist/debug/path/{segment-key.js → pathSegmentKey.js} +0 -0
  199. /package/dist/debug/path/{data-draft.cjs → storage/createDataDraft.cjs} +0 -0
  200. /package/dist/debug/path/{data-draft.js → storage/createDataDraft.js} +0 -0
  201. /package/dist/debug/runtime/{parent-graph.cjs → ownership/parentGraph.cjs} +0 -0
  202. /package/dist/debug/runtime/{parent-graph.js → ownership/parentGraph.js} +0 -0
  203. /package/dist/debug/runtime/{disposal.cjs → ownership/throwDisposalErrors.cjs} +0 -0
  204. /package/dist/debug/runtime/{disposal.js → ownership/throwDisposalErrors.js} +0 -0
  205. /package/dist/debug/runtime/{RaphFrameLoop.cjs → phases/RaphFrameLoop.cjs} +0 -0
  206. /package/dist/debug/runtime/{RaphFrameLoop.js → phases/RaphFrameLoop.js} +0 -0
  207. /package/dist/debug/runtime/{phase.types.cjs → phases/phase.types.cjs} +0 -0
  208. /package/dist/debug/runtime/{phase.types.js → phases/phase.types.js} +0 -0
  209. /package/dist/path/{data-draft.d.ts → storage/createDataDraft.d.ts} +0 -0
  210. /package/dist/runtime/{disposal.d.ts → ownership/throwDisposalErrors.d.ts} +0 -0
  211. /package/dist/runtime/{RaphFrameLoop.d.ts → phases/RaphFrameLoop.d.ts} +0 -0
package/dist/runtime.js CHANGED
@@ -1,18 +1,23 @@
1
- import { RaphActionError as p, RaphCrossRuntimeError as e, RaphDisposedError as t } from "./debug/runtime/errors.js";
2
- import { parentGraph as h } from "./debug/runtime/parent-graph.js";
3
- import { PathHandle as R } from "./debug/runtime/PathHandle.js";
4
- import { RaphSchedulerType as x } from "./debug/runtime/phase.types.js";
5
- import { RaphNode as d } from "./debug/runtime/RaphNode.js";
6
- import { RaphRuntime as s } from "./debug/runtime/RaphRuntime.js";
7
- import { RaphScope as u } from "./debug/runtime/RaphScope.js";
1
+ import { RaphActionError as e, RaphCrossRuntimeError as p, RaphDisposedError as a, RaphPhaseProcessError as t } from "./debug/runtime/errors.js";
2
+ import { parentGraph as f } from "./debug/runtime/ownership/parentGraph.js";
3
+ import { RaphEffectScope as R } from "./debug/runtime/ownership/RaphEffectScope.js";
4
+ import { RaphNode as x } from "./debug/runtime/ownership/RaphNode.js";
5
+ import { RaphScope as d } from "./debug/runtime/ownership/RaphScope.js";
6
+ import { orderPhaseTasks as E } from "./debug/runtime/phases/orderPhaseTasks.js";
7
+ import { RaphSchedulerType as P } from "./debug/runtime/phases/phase.types.js";
8
+ import { RaphRuntime as S } from "./debug/runtime/RaphRuntime.js";
9
+ import { PathHandle as T } from "./debug/runtime/reactivity/PathHandle.js";
8
10
  export {
9
- R as PathHandle,
10
- p as RaphActionError,
11
- e as RaphCrossRuntimeError,
12
- t as RaphDisposedError,
13
- d as RaphNode,
14
- s as RaphRuntime,
15
- x as RaphSchedulerType,
16
- u as RaphScope,
17
- h as parentGraph
11
+ T as PathHandle,
12
+ e as RaphActionError,
13
+ p as RaphCrossRuntimeError,
14
+ a as RaphDisposedError,
15
+ R as RaphEffectScope,
16
+ x as RaphNode,
17
+ t as RaphPhaseProcessError,
18
+ S as RaphRuntime,
19
+ P as RaphSchedulerType,
20
+ d as RaphScope,
21
+ E as orderPhaseTasks,
22
+ f as parentGraph
18
23
  };
package/package.json CHANGED
@@ -2,32 +2,32 @@
2
2
  "name": "@raphy-js/raph",
3
3
  "repository": {
4
4
  "type": "git",
5
- "url": "https://gitlab.com/raphyjs/raph.git"
5
+ "url": "https://gitlab.com/raphyjs/raphy-js-raph.git"
6
6
  },
7
7
  "type": "module",
8
- "version": "1.0.0-dev.2",
8
+ "version": "1.0.1-dev.20",
9
9
  "private": false,
10
10
  "description": "Reactive signals, paths and application runtime",
11
11
  "license": "Apache-2.0",
12
12
  "sideEffects": false,
13
13
  "exports": {
14
14
  ".": {
15
- "types": "./dist/api/public.d.ts",
15
+ "types": "./dist/main.d.ts",
16
16
  "import": "./dist/index.js",
17
17
  "require": "./dist/index.cjs"
18
18
  },
19
19
  "./path": {
20
- "types": "./dist/path/public.d.ts",
20
+ "types": "./dist/entrypoints/path.d.ts",
21
21
  "import": "./dist/path.js",
22
22
  "require": "./dist/path.cjs"
23
23
  },
24
24
  "./raph": {
25
- "types": "./dist/api/public.d.ts",
25
+ "types": "./dist/main.d.ts",
26
26
  "import": "./dist/raph.js",
27
27
  "require": "./dist/raph.cjs"
28
28
  },
29
29
  "./signals": {
30
- "types": "./dist/reactivity/engine.d.ts",
30
+ "types": "./dist/entrypoints/reactivity.d.ts",
31
31
  "import": "./dist/reactivity.js",
32
32
  "require": "./dist/reactivity.cjs"
33
33
  },
@@ -37,21 +37,32 @@
37
37
  "require": "./dist/debug/*.cjs"
38
38
  },
39
39
  "./reactivity": {
40
- "types": "./dist/reactivity/engine.d.ts",
40
+ "types": "./dist/entrypoints/reactivity.d.ts",
41
41
  "import": "./dist/reactivity.js",
42
42
  "require": "./dist/reactivity.cjs"
43
43
  },
44
44
  "./runtime": {
45
- "types": "./dist/runtime/public.d.ts",
45
+ "types": "./dist/entrypoints/runtime.d.ts",
46
46
  "import": "./dist/runtime.js",
47
47
  "require": "./dist/runtime.cjs"
48
+ },
49
+ "./machine": {
50
+ "types": "./dist/entrypoints/machine.d.ts",
51
+ "import": "./dist/machine.js",
52
+ "require": "./dist/machine.cjs"
53
+ },
54
+ "./machine/testing": {
55
+ "types": "./dist/entrypoints/machine-testing.d.ts",
56
+ "import": "./dist/machine-testing.js",
57
+ "require": "./dist/machine-testing.cjs"
48
58
  }
49
59
  },
50
60
  "main": "./dist/index.cjs",
51
61
  "module": "./dist/index.js",
52
- "types": "./dist/api/public.d.ts",
62
+ "types": "./dist/main.d.ts",
53
63
  "files": [
54
64
  "dist",
65
+ "README.md",
55
66
  "LICENSE"
56
67
  ],
57
68
  "scripts": {
@@ -64,27 +75,55 @@
64
75
  "test:coverage": "vitest run --coverage",
65
76
  "test:memory": "node --expose-gc ./node_modules/vitest/vitest.mjs run --config vitest.memory.config.ts",
66
77
  "test:distribution": "node --test src/test/distribution.node.mjs",
67
- "test:benchmark-2026": "pnpm --ignore-workspace run bench:lab:correctness",
68
- "bench:install": "pnpm --ignore-workspace run bench:lab:install",
69
- "bench": "pnpm --ignore-workspace run bench:lab:performance",
78
+ "test:benchmark:reactivity": "pnpm --ignore-workspace run bench:reactivity:correctness",
79
+ "bench:install": "pnpm --ignore-workspace run bench:reactivity:install",
80
+ "bench": "pnpm --ignore-workspace run bench:reactivity:performance",
70
81
  "bench:path": "node src/test/benchmarks/path/run.mjs",
71
- "bench:lab:install": "node src/test/benchmarks/bench-lab/scripts/install.mjs",
72
- "bench:lab:correctness": "node src/test/benchmarks/bench-lab/scripts/run-correctness.mjs",
73
- "bench:lab:performance": "node src/test/benchmarks/bench-lab/scripts/run-performance.mjs",
74
- "bench:lab:memory": "node src/test/benchmarks/bench-lab/scripts/run-memory.mjs",
75
- "bench:lab:balanced:performance": "node src/test/benchmarks/bench-lab/scripts/run-performance.mjs --balanced",
76
- "bench:lab:api-tax": "node src/test/benchmarks/bench-lab/scripts/run-api-tax.mjs",
77
- "bench:lab:report": "node src/test/benchmarks/bench-lab/scripts/generate-report.mjs",
78
- "bench:lab": "node src/test/benchmarks/bench-lab/scripts/run.mjs",
79
- "bench:lab:raph-only": "pnpm --ignore-workspace run bench:lab --raph-only",
80
- "bench:lab:balanced": "pnpm --ignore-workspace run bench:lab --balanced",
81
- "bench:lab:light:correctness": "node src/test/benchmarks/bench-lab/scripts/run-correctness.mjs --light",
82
- "bench:lab:light:performance": "node src/test/benchmarks/bench-lab/scripts/run-performance.mjs --light",
83
- "bench:lab:light:balanced:performance": "node src/test/benchmarks/bench-lab/scripts/run-performance.mjs --light --balanced",
84
- "bench:lab:light:api-tax": "node src/test/benchmarks/bench-lab/scripts/run-api-tax.mjs --light",
85
- "bench:lab:light:report": "node src/test/benchmarks/bench-lab/scripts/generate-report.mjs --light",
86
- "bench:lab:light": "pnpm --ignore-workspace run bench:lab --light",
87
- "bench:lab:light:balanced": "pnpm --ignore-workspace run bench:lab --light --balanced",
82
+ "bench:reactivity:install": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run install:lab",
83
+ "bench:reactivity:correctness": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run correctness",
84
+ "bench:reactivity:performance": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run performance",
85
+ "bench:reactivity:memory": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run memory",
86
+ "bench:reactivity:balanced:performance": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run performance -- --balanced",
87
+ "bench:reactivity:api-tax": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run api-tax",
88
+ "bench:reactivity:report": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run report",
89
+ "bench:reactivity": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run lab",
90
+ "bench:reactivity:raph-only": "pnpm --ignore-workspace run bench:reactivity --raph-only",
91
+ "bench:reactivity:balanced": "pnpm --ignore-workspace run bench:reactivity --balanced",
92
+ "bench:reactivity:light:correctness": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run correctness -- --light",
93
+ "bench:reactivity:light:performance": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run performance -- --light",
94
+ "bench:reactivity:light:balanced:performance": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run performance -- --light --balanced",
95
+ "bench:reactivity:light:api-tax": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run api-tax -- --light",
96
+ "bench:reactivity:light:report": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactivity run report -- --light",
97
+ "bench:reactivity:light": "pnpm --ignore-workspace run bench:reactivity --light",
98
+ "bench:reactivity:light:balanced": "pnpm --ignore-workspace run bench:reactivity --light --balanced",
99
+ "bench:reactive-object:install": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run install:lab",
100
+ "bench:reactive-object:correctness": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run correctness",
101
+ "bench:reactive-object:gc": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run gc",
102
+ "bench:reactive-object:performance": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run performance",
103
+ "bench:reactive-object:memory": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run memory",
104
+ "bench:reactive-object:browsers": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run browsers",
105
+ "bench:reactive-object:report": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run report",
106
+ "bench:reactive-object:quick": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run quick",
107
+ "bench:reactive-object": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/reactive-object run lab",
108
+ "bench:machine:install": "node src/test/benchmarks/labs/machine/scripts/install.mjs",
109
+ "bench:machine:correctness": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/machine run correctness",
110
+ "bench:machine:performance": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/machine run performance",
111
+ "bench:machine:browsers": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/machine run browsers",
112
+ "bench:machine:memory": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/machine run memory",
113
+ "bench:machine:report": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/machine run report",
114
+ "bench:machine:light": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/machine run light",
115
+ "bench:machine": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/machine run lab",
116
+ "bench:native:machine": "node src/test/benchmarks/machine/run.mjs",
117
+ "bench:ecosystem:install": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run install:lab",
118
+ "bench:ecosystem:typecheck": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run typecheck",
119
+ "bench:ecosystem:build": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run build",
120
+ "bench:ecosystem:test-cli": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run test:cli",
121
+ "bench:ecosystem:list": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run list",
122
+ "bench:ecosystem:light": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run light",
123
+ "bench:ecosystem:balanced": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run balanced",
124
+ "bench:ecosystem:full": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run full",
125
+ "bench:ecosystem:curves": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run curves",
126
+ "bench:ecosystem": "pnpm --ignore-workspace --dir src/test/benchmarks/labs/ecosystem run lab",
88
127
  "lint-check": "eslint src vite.config.ts vitest.config.ts vitest.memory.config.ts --cache",
89
128
  "lint-fix": "eslint src vite.config.ts vitest.config.ts vitest.memory.config.ts --fix --cache",
90
129
  "build:portable": "node scripts/build-portable.mjs"
@@ -92,18 +131,12 @@
92
131
  "devDependencies": {
93
132
  "@antfu/eslint-config": "9.3.0",
94
133
  "@vitest/coverage-v8": "^3.2.4",
95
- "@volynets/reflex": "1.0.0",
96
- "alien-signals": "3.2.1",
97
134
  "eslint": "10.9.1",
98
- "mobx": "7.0.3",
99
135
  "rimraf": "^6.0.1",
100
- "solid-js": "1.9.15",
101
136
  "typescript": "~6.0.3",
102
137
  "unplugin-dts": "^1.0.3",
103
138
  "vite": "^6.1.0",
104
139
  "vitest": "^3.2.4",
105
- "vue-reactivity-3-5": "npm:@vue/reactivity@3.5.43",
106
- "vue-reactivity-3-6-rc": "npm:@vue/reactivity@3.6.0-rc.9",
107
140
  "vue-tsc": "^3.3.11"
108
141
  }
109
142
  }
package/ReadMe.md DELETED
@@ -1,153 +0,0 @@
1
- # @raphy-js/raph
2
-
3
- Raph объединяет signal, path и runtime слои из Raph Next в одном публичном
4
- пакете. Benchmark-наборы и исторические результаты сохранены в `src/test/benchmarks/bench-lab`.
5
-
6
- Новая архитектура, изменения timing и миграция API описаны в [MIGRATION.md](MIGRATION.md).
7
-
8
- ## Entry points
9
-
10
- | Import | Назначение |
11
- |---|---|
12
- | `@raphy-js/raph` | плоский настраиваемый facade `Raph` и совместимые public-типы |
13
- | `@raphy-js/raph/path` | PathStore, Kernel, adapters, Meta и materialized derived |
14
- | `@raphy-js/raph/runtime` | RaphRuntime, ownership, execution tree, phases и FrameLoop |
15
- | `@raphy-js/raph/raph` | совместимый alias полного root API |
16
- | `@raphy-js/raph/reactivity` | функции `signal`, `computed`, `effect`, `watch`, `batch`, `untracked` и класс `RaphReactivity` для изолированного графа |
17
- | `@raphy-js/raph/debug/*` | отладочный доступ к собранным production-модулям, например `debug/reactivity/engine` |
18
-
19
- Корневой import и `/raph` предоставляют один прикладной фасад `Raph`.
20
- До первой операции фасада приложение обязано один раз выбрать режим:
21
-
22
- ```ts
23
- import { Raph } from '@raphy-js/raph'
24
-
25
- Raph.configure({ mode: 'runtime' })
26
- const count = Raph.signal(0)
27
- ```
28
-
29
- Начальные runtime phases можно определить там же, а затем дополнить через
30
- `definePhases()` или `addPhase()` до первого фактического выполнения phase
31
- pipeline:
32
-
33
- ```ts
34
- Raph.configure({
35
- mode: 'runtime',
36
- phases: [
37
- { name: 'calculate', traversal: 'dirty-only' },
38
- ],
39
- })
40
-
41
- Raph.addPhase({ name: 'dom-write', traversal: 'dirty-only' })
42
- ```
43
-
44
- До первого выполнения разрешено уточнять pipeline даже после регистрации phase
45
- effects и observers, пока новая конфигурация сохраняет все используемые ими
46
- имена фаз. Queued work при этом не теряется. После первого выполнения
47
- `definePhases()`, `addPhase()` и `clearPhases()` отклоняются, чтобы порядок и
48
- маршрутизация работающего pipeline оставались неизменными.
49
-
50
- Для приложения только с синхронной реактивностью используется
51
- `Raph.configure({ mode: 'reactivity' })`. Для нескольких явно именованных
52
- Runtime:
53
-
54
- ```ts
55
- Raph.configure({ mode: 'runtime', createDefaultRuntime: false })
56
- export const editor = Raph.createRuntime({ id: 'editor' })
57
- export const preview = Raph.createRuntime({ id: 'preview' })
58
- ```
59
-
60
- `/signals` — совместимый alias `/reactivity`. `/reactivity` даёт самостоятельный signal
61
- API; `/debug/*` предназначен для локальной диагностики и может меняться вместе
62
- с внутренней реализацией.
63
-
64
- ```ts
65
- import { computed, effect, signal } from '@raphy-js/raph/reactivity'
66
-
67
- const count = signal(0)
68
- const doubled = computed(() => count.get() * 2)
69
- const dispose = effect(() => console.log(doubled.get()))
70
- count.set(1)
71
- dispose()
72
- ```
73
-
74
- `new RaphReactivity()` создаёт независимый граф с тем же API. `RaphRuntime`
75
- использует собственный граф с проверками владельца и жизненного цикла.
76
- При миграции потребителя между major-версиями нужно проверить path,
77
- phases, lifecycle и timing semantics.
78
-
79
- `Raph.reset()` завершает все Runtime, созданные через фасад в текущей сессии.
80
- Экземпляры, созданные напрямую через `new RaphRuntime()`, остаются независимыми.
81
- Общие path, Meta и derived-данные нескольких Runtime принадлежат переданному
82
- им `RaphKernel`; data adapter настраивается на Kernel, а не на Runtime.
83
-
84
- ## Чтение всего Kernel
85
-
86
- `get()` и `peek()` без path эквивалентны `get('')` и `peek('')`: они
87
- возвращают текущий path-root без создания копии. Facade читает Kernel
88
- default runtime, а экземпляры Runtime и Kernel — данные своего Kernel:
89
-
90
- ```ts
91
- const trackedDefaultData = Raph.get()
92
- const untrackedDefaultData = Raph.peek()
93
- const runtimeData = runtime.get()
94
- const kernelData = kernel.peek()
95
- ```
96
-
97
- `get()` сохраняет reactive tracking-поведение `get('')`, а `peek()` не
98
- регистрирует реактивную зависимость.
99
-
100
- ## Sugar-ссылки facade
101
-
102
- Частые runtime-значения доступны через `Raph` без дополнительных imports. Эти
103
- ссылки используют существующие константы и функции как единственный source of
104
- truth:
105
-
106
- ```ts
107
- Raph.configure({
108
- mode: 'runtime',
109
- scheduler: Raph.Scheduler.Microtask,
110
- })
111
-
112
- Raph.derive({
113
- from: 'source.rows',
114
- to: 'target.rows',
115
- strategy: Raph.DerivedStrategy.collectionByKey('id'),
116
- compute: row => row,
117
- })
118
- ```
119
-
120
- ## Проверки и сборка
121
-
122
- ```sh
123
- pnpm --ignore-workspace install --frozen-lockfile
124
- pnpm --ignore-workspace run build
125
- pnpm --ignore-workspace run typecheck:test
126
- pnpm --ignore-workspace run test
127
- pnpm --ignore-workspace run test:memory
128
- pnpm --ignore-workspace run test:distribution
129
- pnpm --ignore-workspace run bench:lab:install
130
- pnpm --ignore-workspace run bench:lab:light:balanced
131
- pnpm --ignore-workspace run bench:lab:balanced
132
- pnpm --ignore-workspace run bench:path
133
- ```
134
-
135
- `src/test/benchmarks/bench-lab` содержит полные correctness/performance-наборы,
136
- всех исходных кандидатов и Endge-сценарии. Light и Full пишут отдельные простые
137
- HTML-таблицы в папках запусков `results-light/<дата>/index.html` и
138
- `results/<дата>/index.html`, подсвечивая
139
- всю группу в пределах +5% от лучшего результата. Balanced проводит три
140
- циклические ротации и использует медианы. Локальные результаты в `results/diff`
141
- можно использовать только при совпадающей среде измерения; generated reports не
142
- входят в публикуемый package.
143
-
144
- Простой независимый owner создаётся через `scope()` или `new RaphReactivity().scope()`.
145
- При необходимости сборки без native-модулей используйте `pnpm run build:portable`.
146
-
147
- # TODO
148
-
149
- - Отделить адаптеры BenchLab в отдельный репо BenchLab
150
- - _signalAccess()
151
- - _computedAccess()
152
- - _startBatch()
153
- - _endBatch()
@@ -1,22 +0,0 @@
1
- export { DefaultDataAdapter } from '../path/data-adapter';
2
- export type { DataAdapter, DataObject, DefaultAdapterOptions, } from '../path/data-adapter';
3
- export { DataPath } from '../path/data-path';
4
- export type { DataPathParseOptions, PathScalar, PathSegment, PlainDataPath, } from '../path/data-path';
5
- export { collectionByKey, filterByKey, full } from '../path/derived-strategies';
6
- export type { DerivedCollectionByKeyStrategy, DerivedFilterByKeyStrategy, DerivedFullStrategy, DerivedStrategy, } from '../path/derived-strategies';
7
- export type { RaphMetaApi, RaphMetaEvents, RaphMetaMutationCause, RaphMetaMutationEvent, RaphMetaMutationKind, RaphMetaReadOptions, RaphMetaWatchCallback, RaphMetaWatchOptions, RaphMetaWriteOptions, } from '../path/meta.types';
8
- export type { PathEvent as PhaseEvent } from '../path/path.types';
9
- export type { DataPathDef, PathEvent, PathEvents, PathMutationKind, PathOptions, PathWatchCallback, } from '../path/path.types';
10
- export { RaphDerivedHandle } from '../path/RaphDerivedHandle';
11
- export type PhaseName = string;
12
- export { RaphDerivedTargetWriteError } from '../path/RaphDerivedHandle';
13
- export type { DerivedOptions } from '../path/RaphDerivedHandle';
14
- export { RaphKernel } from '../path/RaphKernel';
15
- export type { RaphKernelOptions, RaphKernelRoot, RaphKernelRuntime, } from '../path/RaphKernel';
16
- export { RaphMeta } from '../path/RaphMeta';
17
- export type { ReadonlySignal, Signal, WritableComputedOptions, } from '../reactivity/types';
18
- export type { Disposer, WatchOptions, WatchSource, WatchValue, } from '../reactivity/types';
19
- export * from '../runtime/public';
20
- export { RaphConfigurationError, RaphDefaultRuntimeError, RaphError, RaphModeError, } from './errors';
21
- export { Raph } from './Raph';
22
- export type { RaphConfigureOptions, RaphMode, RaphReactivityConfigureOptions, RaphRuntimeConfigureOptions, RaphRuntimeDefaults, RaphRuntimeRegistryConfigureOptions, } from './types';
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../path/data-adapter.cjs"),o=require("../path/data-path.cjs"),r=require("../path/derived-strategies.cjs"),t=require("../path/RaphDerivedHandle.cjs"),h=require("../path/RaphKernel.cjs"),u=require("../path/RaphMeta.cjs"),a=require("../runtime/errors.cjs"),i=require("../runtime/parent-graph.cjs"),n=require("../runtime/PathHandle.cjs"),R=require("../runtime/phase.types.cjs"),d=require("../runtime/RaphNode.cjs"),_=require("../runtime/RaphRuntime.cjs"),s=require("../runtime/RaphScope.cjs"),e=require("./errors.cjs"),c=require("./Raph.cjs");exports.DefaultDataAdapter=p.DefaultDataAdapter;exports.DataPath=o.DataPath;exports.collectionByKey=r.collectionByKey;exports.filterByKey=r.filterByKey;exports.full=r.full;exports.RaphDerivedHandle=t.RaphDerivedHandle;exports.RaphDerivedTargetWriteError=t.RaphDerivedTargetWriteError;exports.RaphKernel=h.RaphKernel;exports.RaphMeta=u.RaphMeta;exports.RaphActionError=a.RaphActionError;exports.RaphCrossRuntimeError=a.RaphCrossRuntimeError;exports.RaphDisposedError=a.RaphDisposedError;exports.parentGraph=i.parentGraph;exports.PathHandle=n.PathHandle;exports.RaphSchedulerType=R.RaphSchedulerType;exports.RaphNode=d.RaphNode;exports.RaphRuntime=_.RaphRuntime;exports.RaphScope=s.RaphScope;exports.RaphConfigurationError=e.RaphConfigurationError;exports.RaphDefaultRuntimeError=e.RaphDefaultRuntimeError;exports.RaphError=e.RaphError;exports.RaphModeError=e.RaphModeError;exports.Raph=c.Raph;
@@ -1,40 +0,0 @@
1
- import { DefaultDataAdapter as e } from "../path/data-adapter.js";
2
- import { DataPath as t } from "../path/data-path.js";
3
- import { collectionByKey as f, filterByKey as h, full as R } from "../path/derived-strategies.js";
4
- import { RaphDerivedHandle as x, RaphDerivedTargetWriteError as i } from "../path/RaphDerivedHandle.js";
5
- import { RaphKernel as n } from "../path/RaphKernel.js";
6
- import { RaphMeta as u } from "../path/RaphMeta.js";
7
- import { RaphActionError as D, RaphCrossRuntimeError as c, RaphDisposedError as y } from "../runtime/errors.js";
8
- import { parentGraph as K } from "../runtime/parent-graph.js";
9
- import { PathHandle as v } from "../runtime/PathHandle.js";
10
- import { RaphSchedulerType as B } from "../runtime/phase.types.js";
11
- import { RaphNode as H } from "../runtime/RaphNode.js";
12
- import { RaphRuntime as P } from "../runtime/RaphRuntime.js";
13
- import { RaphScope as T } from "../runtime/RaphScope.js";
14
- import { RaphConfigurationError as N, RaphDefaultRuntimeError as W, RaphError as b, RaphModeError as j } from "./errors.js";
15
- import { Raph as q } from "./Raph.js";
16
- export {
17
- t as DataPath,
18
- e as DefaultDataAdapter,
19
- v as PathHandle,
20
- q as Raph,
21
- D as RaphActionError,
22
- N as RaphConfigurationError,
23
- c as RaphCrossRuntimeError,
24
- W as RaphDefaultRuntimeError,
25
- x as RaphDerivedHandle,
26
- i as RaphDerivedTargetWriteError,
27
- y as RaphDisposedError,
28
- b as RaphError,
29
- n as RaphKernel,
30
- u as RaphMeta,
31
- j as RaphModeError,
32
- H as RaphNode,
33
- P as RaphRuntime,
34
- B as RaphSchedulerType,
35
- T as RaphScope,
36
- f as collectionByKey,
37
- h as filterByKey,
38
- R as full,
39
- K as parentGraph
40
- };
@@ -1 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var l=(r,e,t)=>e in r?p(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var d=(r,e,t)=>l(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./data-path.cjs"),_=require("./PathEventHub.cjs");class b{constructor(e){d(this,"_eventHub",new _.PathEventHub("[Raph] Adapter transaction and publication failed."));this._adapter=e}get(e,t){const a=i.parseDataPath(e,t);return this._adapter.get(a.canonical)}peek(e,t){return this.get(e,t)}has(e,t){var n,s;const a=i.parseDataPath(e,t);return((s=(n=this._adapter).has)==null?void 0:s.call(n,a.canonical))??u(this._adapter.root(),a.segments)}set(e,t,a){const n=i.parseDataPath(e,a),s=this._eventHub.hasWatchers?this._adapter.get(n.canonical):void 0;this._adapter.set(n.canonical,t),this._eventHub.record({kind:"set",path:n.canonical,previous:s,value:this._eventHub.hasWatchers?this._adapter.get(n.canonical):void 0})}merge(e,t,a){const n=i.parseDataPath(e,a),s=this._eventHub.hasWatchers?this._adapter.get(n.canonical):void 0,c=o(s)&&o(t)?f(s):s;this._adapter.merge(n.canonical,t),this._eventHub.record({kind:"merge",path:n.canonical,previous:c,value:this._eventHub.hasWatchers?this._adapter.get(n.canonical):void 0})}delete(e,t){var c,h;const a=i.parseDataPath(e,t);if(!(((h=(c=this._adapter).has)==null?void 0:h.call(c,a.canonical))??u(this._adapter.root(),a.segments)))return;const s=this._eventHub.hasWatchers?this._adapter.get(a.canonical):void 0;this._adapter.delete(a.canonical),this._eventHub.record({kind:"delete",path:a.canonical,previous:s,value:void 0})}transaction(e){return this._eventHub.transaction(e)}watch(e,t){return this._eventHub.watch(e,t)}}function u(r,e){let t=r;for(const a of e)if(a.kind==="key"){if(!v(t)||!Object.hasOwn(t,a.key))return!1;t=t[a.key]}else if(a.kind==="index"){if(!Array.isArray(t)||!Object.hasOwn(t,a.index))return!1;t=t[a.index]}else{if(!Array.isArray(t))return!1;const n=t.findIndex(s=>o(s)&&Object.hasOwn(s,a.key)&&Object.is(s[a.key],a.value));if(n===-1)return!1;t=t[n]}return!0}function f(r){const e=Object.create(Object.getPrototypeOf(r));for(const t of Object.keys(r))t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r[t],writable:!0}):e[t]=r[t];return e}function o(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function v(r){return Array.isArray(r)||o(r)}exports.AdapterPathStore=b;
@@ -1 +0,0 @@
1
- "use strict";var h=Object.defineProperty;var u=(r,e,t)=>e in r?h(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var d=(r,e,t)=>u(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./data-path.cjs"),_=require("./derived-collection.cjs"),f=require("./path-router.cjs"),g=2e4;class v{constructor(){d(this,"_router");d(this,"_handles");d(this,"_matches");d(this,"_pending");d(this,"_collections");d(this,"_counter",0)}get size(){var e;return((e=this._handles)==null?void 0:e.size)??0}get pending(){return this._pending}nextId(){return`derived-${this._counter++}`}has(e){var t;return((t=this._handles)==null?void 0:t.has(e))??!1}values(){var e;return((e=this._handles)==null?void 0:e.values())??[][Symbol.iterator]()}state(e){var t;return(t=this._collections)==null?void 0:t.get(e)}register(e,t,i){(this._handles??(this._handles=new Map)).set(e.id,e),i!==void 0&&(this._collections??(this._collections=new Map)).set(e,{from:t,kind:i.kind,key:i.key,initialized:!1,full:!0,keys:new Set,sourceIndex:void 0,targetIndex:void 0});const n=this._router??(this._router=new f.PathRouter);this._matches=void 0,e._attachRoutes(l.pathRelationMasks(t).map(s=>n.add(l.parsePathMask(s),e)))}remove(e){var i,o,n;const t=this._handles;(t==null?void 0:t.get(e.id))===e&&(t.delete(e.id),e._detachRoutes(),this._matches=void 0,(i=this._pending)==null||i.delete(e),(o=this._collections)==null||o.delete(e),((n=this._collections)==null?void 0:n.size)===0&&(this._collections=void 0),t.size===0&&(this._handles=void 0,this._router=void 0,this._pending=void 0))}queue(e){var o;const t=this._matching(e);if(t.length===0)return;const i=this._pending??(this._pending=new Set);for(const n of t){if(n.paused||n.disposed)continue;const s=(o=this._collections)==null?void 0:o.get(n);if(s!==void 0&&s.initialized&&!s.full){const c=_.collectionMutationImpact(s.from,s.key,e);c.kind==="full"?(s.full=!0,s.keys.clear()):s.keys.add(c.key)}i.add(n)}}queueReplacement(e,t){var n;const i=this._matching(e);if(i.length===0)return;const o=this._pending??(this._pending=new Set);for(const s of i){if(s.paused||s.disposed)continue;const c=(n=this._collections)==null?void 0:n.get(s);if(c!==void 0&&c.initialized&&!c.full&&c.from.canonical===e.canonical)for(const a of t)c.keys.add(a);else c!==void 0&&(c.full=!0,c.keys.clear());o.add(s)}}clearPendingIfEmpty(){var e;((e=this._pending)==null?void 0:e.size)===0&&(this._pending=void 0)}dispose(){if(this._handles!==void 0)for(const e of this._handles.values())e._disposeFromKernel();this._handles=void 0,this._router=void 0,this._matches=void 0,this._pending=void 0,this._collections=void 0}_matching(e){var n;const t=this._router;if(t===void 0)return[];let i=(n=this._matches)==null?void 0:n.get(e.canonical);if(i!==void 0)return i;i=[...e.segments.length===0?t.matchAll():t.match(e.segments)];const o=this._matches??(this._matches=new Map);return o.size>=g&&o.clear(),o.set(e.canonical,i),i}}exports.DerivedRegistry=v;
@@ -1 +0,0 @@
1
- "use strict";var _=Object.defineProperty;var f=(a,t,e)=>t in a?_(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var c=(a,t,e)=>f(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./data-path.cjs"),g=require("./path-router.cjs");class v{constructor(t){c(this,"_router");c(this,"_events");c(this,"_transactionDepth",0);c(this,"_watcherCount",0);c(this,"_publishing",!1);this._transactionErrorMessage=t}get hasWatchers(){return this._watcherCount!==0}get events(){return this._events}get router(){return this._router}get watcherCount(){return this._watcherCount}record(t){this._watcherCount!==0&&((this._events??(this._events=[])).push(t),this._transactionDepth===0&&!this._publishing&&this._publish())}transaction(t){var o;let e=!1,h,n=!1,i,s;this._transactionDepth++;try{s=t()}catch(r){e=!0,h=r}finally{if(this._transactionDepth--,this._transactionDepth===0&&((o=this._events)!=null&&o.length))try{this._publish()}catch(r){n=!0,i=r}}if(e&&n)throw new AggregateError([h,i],this._transactionErrorMessage);if(e)throw h;if(n)throw i;return s}watch(t,e){const h=Array.isArray(t)?t:[t];if(h.length===0)throw new TypeError("[Raph] Path watch requires at least one mask.");const n=new Map;for(const r of h){const u=p.parsePathMask(r);n.set(u.canonical,u)}const i={active:!0,callback:e},s=this._router??(this._router=new g.PathRouter),o=[...n.values()].map(r=>s.add(r,i));return this._watcherCount++,d(()=>{i.active=!1,i.callback=void 0;for(const r of o)r();this._watcherCount--,this._watcherCount===0&&(this._router=void 0)})}_publish(){const t=this._events;if(t===void 0||t.length===0||this._publishing)return;const e=[];this._publishing=!0;try{for(;t.length!==0;){const h=t.splice(0),n=this._router;if(n===void 0)continue;const i=new Map;for(const s of h){const o=p.parseDataPath(s.path),r=o.segments.length===0?n.matchAll():n.match(o.segments);for(const u of r){const l=i.get(u);l===void 0?i.set(u,[s]):l.push(s)}}for(const[s,o]of i)if(!(!s.active||s.callback===void 0))try{s.callback({events:o})}catch(r){e.push(r)}}}finally{this._publishing=!1}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"[Raph] Multiple path watchers failed.")}}function d(a){let t=a;return()=>{const e=t;t=void 0,e==null||e()}}exports.PathEventHub=v;
@@ -1 +0,0 @@
1
- "use strict";var R=Object.defineProperty;var P=(r,e,t)=>e in r?R(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var v=(r,e,t)=>P(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./data-path.cjs"),H=require("./PathEventHub.cjs"),u=new WeakMap;class m{constructor(){v(this,"_root");v(this,"_eventHub",new H.PathEventHub("[Raph] Path transaction and publication failed."))}get _router(){return this._eventHub.router}get _events(){return this._eventHub.events}get _watcherCount(){return this._eventHub.watcherCount}get(e,t){const n=f.parseDataPath(e,t),o=this._root;if(o!==void 0)return h(o,n.segments).value}peek(e,t){return this.get(e,t)}has(e,t){const n=f.parseDataPath(e,t),o=this._root;return o!==void 0&&h(o,n.segments).exists}set(e,t,n){const o=f.parseDataPath(e,n);if(o.segments.length===0){this._setRoot(t);return}const s=this._eventHub.hasWatchers,i=s?h(this._root,o.segments).value:void 0;if(this._root??(this._root=Object.create(null)),w(this._root,o,t),!s)return;const c=h(this._root,o.segments).value;this._eventHub.record({kind:"set",path:o.canonical,previous:i,value:c})}merge(e,t,n){const o=f.parseDataPath(e,n);if(o.segments.length===0){this._mergeRoot(t);return}const s=this._eventHub.hasWatchers,i=h(this._root,o.segments).value,c=s&&a(i)&&a(t)?A(i):i;if(a(i)&&a(t)){p(this._root,o.segments);for(const g of Object.keys(t))l(i,g,t[g])}else this._root??(this._root=Object.create(null)),w(this._root,o,t);if(!s)return;const d=h(this._root,o.segments).value;this._eventHub.record({kind:"merge",path:o.canonical,previous:c,value:d})}delete(e,t){const n=f.parseDataPath(e,t);if(n.segments.length===0){this._deleteRoot();return}const o=h(this._root,n.segments);!o.exists||this._root===void 0||(p(this._root,n.segments),E(this._root,n),this._eventHub.hasWatchers&&this._eventHub.record({kind:"delete",path:n.canonical,previous:o.value,value:void 0}))}transaction(e){return this._eventHub.transaction(e)}watch(e,t){return this._eventHub.watch(e,t)}_setRoot(e){const t=x(e),n=this._root;this._root=t,this._recordRootEvent("set",n,t)}_mergeRoot(e){const t=this._root,n=this._eventHub.hasWatchers&&a(t)&&a(e)?A(t):t;if(a(t)&&a(e))for(const o of Object.keys(e))l(t,o,e[o]);else this._root=x(e);this._recordRootEvent("merge",n,this._root)}_deleteRoot(){const e=this._root;e!==void 0&&(this._root=D(),this._recordRootEvent("delete",e,void 0))}_recordRootEvent(e,t,n){this._eventHub.record({kind:e,path:"",previous:t,value:n})}}function h(r,e){let t=r;for(const n of e)if(n.kind==="key"){if(!b(t)||!Object.hasOwn(t,n.key))return{exists:!1,value:void 0};t=t[n.key]}else if(n.kind==="index"){if(!Array.isArray(t)||!Object.hasOwn(t,n.index))return{exists:!1,value:void 0};t=t[n.index]}else{if(!Array.isArray(t))return{exists:!1,value:void 0};const o=_(t,n.key,n.value);if(o===-1)return{exists:!1,value:void 0};t=t[o]}return{exists:!0,value:t}}function p(r,e){let t=r;for(const n of e){if(!b(t))return;const o=j(t,n);Array.isArray(t)&&u.delete(t),t=o}}function w(r,e,t){let n=r,o;for(let i=0;i<e.segments.length-1;i++){const c=e.segments[i],d=e.segments[i+1];c.kind==="selector"&&Array.isArray(n)&&(o=n),c.kind==="index"&&Array.isArray(n)&&(o=n),n=C(n,c,d,e.canonical)}const s=e.segments[e.segments.length-1];if(S(n,s,t,e.canonical),s.kind==="key"&&o!==void 0){const i=u.get(o);i==null||i.delete(s.key),(i==null?void 0:i.size)===0&&u.delete(o)}}function E(r,e){let t=r;for(let s=0;s<e.segments.length-1;s++){const i=e.segments[s],c=j(t,i);if(!b(c))return;t=c}const n=e.segments[e.segments.length-1];if(n.kind==="key"){delete t[n.key];return}if(!Array.isArray(t))return;if(n.kind==="index"){u.delete(t),delete t[n.index];return}const o=_(t,n.key,n.value);o!==-1&&(u.delete(t),delete t[o])}function j(r,e){if(e.kind==="key")return Object.hasOwn(r,e.key)?r[e.key]:void 0;if(!Array.isArray(r))return;if(e.kind==="index")return r[e.index];const t=_(r,e.key,e.value);return t===-1?void 0:r[t]}function C(r,e,t,n){if(e.kind==="key"){const s=r;let i=s[e.key];return(!Object.hasOwn(s,e.key)||i===void 0)&&(i=O(t),l(s,e.key,i)),k(i,n)}if(e.kind==="index"){if(!Array.isArray(r))throw y(n);let s=r[e.index];return(!Object.hasOwn(r,e.index)||s===void 0)&&(u.delete(r),s=O(t),r[e.index]=s),k(s,n)}if(!Array.isArray(r))throw y(n);let o=_(r,e.key,e.value);if(o===-1){u.delete(r);const s=Object.create(null);s[e.key]=e.value,r.push(s),o=r.length-1}return k(r[o],n)}function S(r,e,t,n){if(e.kind==="key"){l(r,e.key,t);return}if(e.kind==="index"){if(!Array.isArray(r))throw y(n);u.delete(r),r[e.index]=t;return}if(!Array.isArray(r))throw y(n);const o=_(r,e.key,e.value);if(o!==-1){u.delete(r),r[o]=t;return}if(!a(t))throw new TypeError(`[Raph] New selector target at "${n}" must be an object.`);const s=t[e.key];if(Object.hasOwn(t,e.key)&&!Object.is(s,e.value))throw new TypeError(`[Raph] Selector target at "${n}" has a conflicting key.`);u.delete(r),r.push(Object.hasOwn(t,e.key)?t:{...t,[e.key]:e.value})}function O(r){return r.kind==="index"||r.kind==="selector"?[]:Object.create(null)}function D(){return Object.create(null)}function x(r){if(b(r))return r;throw new TypeError("[Raph] Root value must be an object or array.")}function k(r,e){if(b(r))return r;throw y(e)}function _(r,e,t){let n=u.get(r);const o=n==null?void 0:n.get(e);if(o)return o.get(t)??-1;const s=new Map;for(let i=0;i<r.length;i++){const c=r[i];if(a(c)&&Object.hasOwn(c,e)){const d=c[e];(d===null||typeof d=="string"||typeof d=="number"||typeof d=="boolean")&&!s.has(d)&&s.set(d,i)}}return n||(n=new Map,u.set(r,n)),n.set(e,s),s.get(t)??-1}function l(r,e,t){if(e==="__proto__"){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0});return}r[e]=t}function A(r){const e=Object.create(Object.getPrototypeOf(r));for(const t of Object.keys(r))l(e,t,r[t]);return e}function a(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function b(r){return Array.isArray(r)||a(r)}function y(r){return new TypeError(`[Raph] Cannot traverse non-container data at "${r}".`)}exports.PathStore=m;
@@ -1 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var _=(n,e,t)=>e in n?p(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var a=(n,e,t)=>_(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./segment-key.cjs");function d(){return{children:new Map,namespaces:new Map,path:void 0}}class g{constructor(){a(this,"_root",d());a(this,"size",0)}get(e,t){const r=this._find(e);if(r!==void 0)return t===void 0?Object.fromEntries(r.namespaces):r.namespaces.get(t)}has(e,t){const r=this._find(e);return r===void 0?!1:t===void 0?r.namespaces.size!==0:r.namespaces.has(t)}set(e,t,r){const s=this._ensure(e);s.namespaces.has(t)||this.size++,s.namespaces.set(t,r),s.path=e}merge(e,t,r){const s=this.get(e,t);if(l(s)&&l(r)){for(const i of Object.keys(r))y(s,i,r[i]);return}this.set(e,t,r)}delete(e,t){var i;const r=this._findStack(e),s=(i=r.at(-1))==null?void 0:i.node;if(s===void 0)return!1;if(t===void 0){if(s.namespaces.size===0)return!1;this.size-=s.namespaces.size,s.namespaces.clear()}else{if(!s.namespaces.delete(t))return!1;this.size--}return this._pruneEmpty(r),!0}deleteSubtree(e){const t=o(e);if(t.length===0)return this.clear();let r=this._root;for(let c=0;c<t.length-1;c++){const u=r.children.get(t[c]);if(u===void 0)return[];r=u}const s=r.children.get(t.at(-1));if(s===void 0)return[];const i=h(s);return this.size-=f(s),r.children.delete(t.at(-1)),i}pruneMissing(e,t){const r=this._find(e);if(r===void 0)return[];const s=[];return this._pruneMissingNode(r,t,s),s}clear(){const e=h(this._root);return this._root.children.clear(),this._root.namespaces.clear(),this._root.path=void 0,this.size=0,e}_find(e){let t=this._root;for(const r of o(e)){const s=t.children.get(r);if(s===void 0)return;t=s}return t}_ensure(e){let t=this._root;for(const r of o(e)){let s=t.children.get(r);s===void 0&&(s=d(),t.children.set(r,s)),t=s}return t}_findStack(e){const t=[{key:void 0,node:this._root}];let r=this._root;for(const s of o(e)){const i=r.children.get(s);if(i===void 0)return[];t.push({key:s,node:i}),r=i}return t}_pruneEmpty(e){for(let t=e.length-1;t>0;t--){const r=e[t];if(r.node.namespaces.size!==0||r.node.children.size!==0)return;e[t-1].node.children.delete(r.key)}}_pruneMissingNode(e,t,r){for(const[s,i]of[...e.children])this._pruneMissingNode(i,t,r)&&e.children.delete(s);return e.path!==void 0&&e.namespaces.size!==0&&!t(e.path)&&(this.size-=e.namespaces.size,e.namespaces.clear(),r.push(e.path)),e!==this._root&&e.namespaces.size===0&&e.children.size===0}}function o(n){return n.segments().map(m.pathSegmentKey)}function h(n){const e=n.path!==void 0&&n.namespaces.size!==0?[n.path]:[];for(const t of n.children.values())e.push(...h(t));return e}function f(n){let e=n.namespaces.size;for(const t of n.children.values())e+=f(t);return e}function l(n){if(typeof n!="object"||n===null||Array.isArray(n))return!1;const e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function y(n,e,t){if(e!=="__proto__"){n[e]=t;return}Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0})}exports.RaphMetaStore=g;
@@ -1 +0,0 @@
1
- "use strict";var j=Object.defineProperty;var S=(o,e,t)=>e in o?j(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var y=(o,e,t)=>S(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./data-draft.cjs"),h=require("./data-path.cjs");class g{constructor(e=p(),t={}){y(this,"_root");y(this,"_options");y(this,"_indexes");this._root=x(e),this._options={arrayDelete:t.arrayDelete??"unset",autoCreate:t.autoCreate??!0,indexEnabled:t.indexEnabled??!0,indexStrategy:t.indexStrategy??"eager-all-keys"}}root(){return this._root}fork(){const e=new g({},this._options);return e._root=C.createDataDraft(this._root,t=>{var r;return(r=e._indexes)==null?void 0:r.delete(t)}).root,e}replaceRoot(e){this._root=x(e),this._indexes=void 0}options(e){e.arrayDelete!==void 0&&(this._options.arrayDelete=e.arrayDelete),e.autoCreate!==void 0&&(this._options.autoCreate=e.autoCreate),e.indexEnabled!==void 0&&(this._options.indexEnabled=e.indexEnabled),e.indexStrategy!==void 0&&(this._options.indexStrategy=e.indexStrategy),this._indexes=void 0}get(e,t){return this._read(h.parseDataPath(e,t)).value}has(e,t){return this._read(h.parseDataPath(e,t)).exists}set(e,t,r){const i=h.parseDataPath(e,r);if(i.segments.length===0){this.replaceRoot(x(t));return}let s=this._root,n;for(let a=0;a<i.segments.length-1;a++){const d=i.segments[a],c=i.segments[a+1],l=this._readOrCreateChild(s,d,c,i.canonical);s=l.value,n=l.indexedParent}this._writeSegment(s,i.segments[i.segments.length-1],t,i.canonical,n)}merge(e,t,r){const i=this.get(e,r);if(f(i)&&f(t)){for(const s of Object.keys(t))b(i,s,t[s]);this._indexes=void 0;return}this.set(e,t,r)}delete(e,t){const r=h.parseDataPath(e,t);if(r.segments.length===0){this._root=p(),this._indexes=void 0;return}let i=this._root;for(let n=0;n<r.segments.length-1;n++){if(!u(i))return;i=this._readSegment(i,r.segments[n])}if(!u(i))return;const s=r.segments[r.segments.length-1];if(s.kind==="key")delete i[s.key];else if(s.kind==="index"){if(!Array.isArray(i))return;this._options.arrayDelete==="splice"?i.splice(s.index,1):delete i[s.index]}else{if(!Array.isArray(i))return;const n=this._findSelector(i,s.key,s.value);if(n===-1)return;this._options.arrayDelete==="splice"?i.splice(n,1):delete i[n]}this._indexes=void 0}indexOf(e,t){const r=h.parseDataPath(e,t);let i=this._root;for(let s=0;s<r.segments.length;s++){const n=r.segments[s],a=s===r.segments.length-1;if(n.kind==="key"){if(!u(i)||!Object.hasOwn(i,n.key))return-1;i=i[n.key];continue}if(!Array.isArray(i))return-1;if(n.kind==="index"){if(!Object.hasOwn(i,n.index))return-1;if(a)return n.index;i=i[n.index];continue}const d=this._findSelector(i,n.key,n.value);if(d===-1)return-1;if(a)return d;i=i[d]}return-1}_read(e){let t=this._root;for(const r of e.segments)if(r.kind==="key"){if(!u(t)||!Object.hasOwn(t,r.key))return{exists:!1,value:void 0};t=t[r.key]}else if(r.kind==="index"){if(!Array.isArray(t)||!Object.hasOwn(t,r.index))return{exists:!1,value:void 0};t=t[r.index]}else{if(!Array.isArray(t))return{exists:!1,value:void 0};const i=this._findSelector(t,r.key,r.value);if(i===-1)return{exists:!1,value:void 0};t=t[i]}return{exists:!0,value:t}}_readSegment(e,t){if(t.kind==="key")return Object.hasOwn(e,t.key)?e[t.key]:void 0;if(!Array.isArray(e))return;if(t.kind==="index")return e[t.index];const r=this._findSelector(e,t.key,t.value);return r===-1?void 0:e[r]}_readOrCreateChild(e,t,r,i){if(t.kind==="key"){let n=e[t.key];if(!Object.hasOwn(e,t.key)||n===void 0){if(!this._options.autoCreate)throw _(i);n=v(r),b(e,t.key,n)}return{value:k(n,i)}}if(!Array.isArray(e))throw w(i);if(t.kind==="index"){let n=e[t.index];if(!Object.hasOwn(e,t.index)||n===void 0){if(!this._options.autoCreate)throw _(i);n=v(r),e[t.index]=n}return{value:k(n,i),indexedParent:{array:e,index:t.index}}}let s=this._findSelector(e,t.key,t.value);if(s===-1){if(!this._options.autoCreate)throw _(i);const n=Object.create(null);n[t.key]=t.value,e.push(n),s=e.length-1,this._invalidateArray(e)}return{value:k(e[s],i),indexedParent:{array:e,index:s}}}_writeSegment(e,t,r,i,s){if(t.kind==="key"){b(e,t.key,r),s!==void 0&&s.array[s.index]===e&&this._invalidateIndexKey(s.array,t.key);return}if(!Array.isArray(e))throw w(i);if(t.kind==="index"){e[t.index]=r,this._invalidateArray(e);return}if(!f(r))throw new TypeError(`[Raph] New selector target at "${i}" must be an object.`);if(Object.hasOwn(r,t.key)&&!Object.is(r[t.key],t.value))throw new TypeError(`[Raph] Selector target at "${i}" has a conflicting key.`);const n=this._findSelector(e,t.key,t.value);if(n===-1&&!this._options.autoCreate)throw _(i);const a=Object.hasOwn(r,t.key)?r:{...r,[t.key]:t.value};n===-1?e.push(a):e[n]=a,this._invalidateArray(e)}_invalidateArray(e){var t;(t=this._indexes)==null||t.delete(e)}_invalidateIndexKey(e,t){var i;const r=(i=this._indexes)==null?void 0:i.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._indexes.delete(e))}_findSelector(e,t,r){var d;if(!this._options.indexEnabled)return O(e,t,r);const i=(d=this._indexes)==null?void 0:d.get(e);let s=i==null?void 0:i.get(t);s===void 0&&(s=this._createIndex(e,t));const n=s.get(r);if(n!==void 0&&f(e[n])&&Object.is(e[n][t],r))return n;const a=O(e,t,r);return a===-1?s.delete(r):s.set(r,a),a}_createIndex(e,t){const r=this._indexes??(this._indexes=new WeakMap);let i=r.get(e);if(i===void 0&&(i=new Map,r.set(e,i)),this._options.indexStrategy==="eager-all-keys")for(let n=0;n<e.length;n++){const a=e[n];if(f(a))for(const d of Object.keys(a)){const c=a[d];if(!A(c))continue;let l=i.get(d);l===void 0&&(l=new Map,i.set(d,l)),l.has(c)||l.set(c,n)}}let s=i.get(t);if(s!==void 0)return s;s=new Map;for(let n=0;n<e.length;n++){const a=e[n];if(!f(a))continue;const d=a[t];A(d)&&!s.has(d)&&s.set(d,n)}return i.set(t,s),s}}function O(o,e,t){for(let r=0;r<o.length;r++){const i=o[r];if(f(i)&&Object.hasOwn(i,e)&&Object.is(i[e],t))return r}return-1}function v(o){return o.kind==="index"||o.kind==="selector"?[]:p()}function p(){return Object.create(null)}function x(o){if(u(o))return o;throw new TypeError("[Raph] Root value must be an object or array.")}function k(o,e){if(u(o))return o;throw w(e)}function f(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function u(o){return Array.isArray(o)||f(o)}function A(o){return o===null||typeof o=="string"||typeof o=="number"||typeof o=="boolean"}function b(o,e,t){if(e==="__proto__"){Object.defineProperty(o,e,{configurable:!0,enumerable:!0,value:t,writable:!0});return}o[e]=t}function w(o){return new TypeError(`[Raph] Cannot traverse non-container data at "${o}".`)}function _(o){return new Error(`[Raph] Cannot create missing container at "${o}" (autoCreate=false).`)}exports.DefaultDataAdapter=g;
@@ -1 +0,0 @@
1
- "use strict";var E=Object.defineProperty;var M=(t,e,n)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var o=(t,e,n)=>M(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=2e4;let m,w;const h=class h{constructor(e,n){o(this,"_canonical");o(this,"_segments");o(this,"_exact");o(this,"_mask");this._canonical=e,this._segments=Object.freeze(n.map(r=>Object.freeze({...r})))}static from(e,n){return e instanceof h?e:typeof e=="string"?this.fromString(e,n):this.fromPlain(e)}static fromString(e,n){const r=p(e,n==null?void 0:n.vars,!0,(n==null?void 0:n.wildcardDynamic)===!0,!0),i=this._cache??(this._cache=new Map),s=i.get(r.canonical);if(s!==void 0)return s;i.size>=y&&i.clear();const c=new h(r.canonical,r.segments);return i.set(r.canonical,c),c}static fromPlain(e){const r=(Array.isArray(e.segs)?e.segs:[]).map(F);return new h(k(r),r)}toPlain(){return{segs:this._segments.map(e=>e.kind==="key"?{t:"key",k:e.key}:e.kind==="index"?{t:"idx",i:e.index}:e.kind==="selector"?{t:"param",pk:e.key,pv:e.value}:{t:"wc",indexed:e.indexed}),deepOnTail:S(this._segments)}}toStringPath(){return this._canonical}toString(){return this._canonical}segments(){return this._segments}static match(e,n){const r=this.from(e)._segments,i=this.from(n)._segments;let s=0;for(;s<r.length;s++){const c=r[s];if(c.kind==="wildcard"&&!c.indexed&&s===r.length-1)return!0;const a=i[s];if(a===void 0||!W(c,a))return!1}return s===i.length}_asExact(){for(const e of this._segments)if(e.kind==="wildcard")throw $(this._canonical);return this._exact??(this._exact={canonical:this._canonical,segments:this._segments})}_asMask(){for(let n=0;n<this._segments.length-1;n++){const r=this._segments[n];if(r.kind==="wildcard"&&!r.indexed)throw new TypeError(`[Raph] Dot wildcard must be the final mask segment: "${this._canonical}".`)}const e=S(this._segments);return this._mask??(this._mask={canonical:this._canonical,deep:e,segments:e?this._segments.slice(0,-1):this._segments})}};o(h,"_cache");let d=h;function T(t,e){if(!(e!=null&&e.vars)){const i=m==null?void 0:m.get(t);if(i!==void 0)return i}if(typeof t!="string")return O(t,e);const n=p(t,e==null?void 0:e.vars,!1,!1,!0),r={canonical:n.canonical,segments:n.segments};if(!(e!=null&&e.vars)){const i=m??(m=new Map);i.size>=y&&i.clear(),i.set(t,r)}return r}function R(t){const e=w==null?void 0:w.get(t);if(e!==void 0)return e;if(typeof t!="string")return N(t);const n=p(t,void 0,!0,!1,!0);for(let a=0;a<n.segments.length-1;a++){const l=n.segments[a];if(l.kind==="wildcard"&&!l.indexed)throw new TypeError(`[Raph] Dot wildcard must be the final mask segment: "${t}".`)}const r=n.segments[n.segments.length-1],i=(r==null?void 0:r.kind)==="wildcard"&&!r.indexed,s={canonical:n.canonical,deep:i,segments:i?n.segments.slice(0,-1):n.segments},c=w??(w=new Map);return c.size>=y&&c.clear(),c.set(t,s),s}function O(t,e){const n=d.from(t,e)._asExact();if(t instanceof d&&!(e!=null&&e.vars)){const r=m??(m=new Map);r.size>=y&&r.clear(),r.set(t,n)}return n}function N(t){const e=d.from(t)._asMask();if(t instanceof d){const n=w??(w=new Map);n.size>=y&&n.clear(),n.set(t,e)}return e}function j(t){if(t.segments.length===0)return["*"];const e=[`${t.canonical}.*`];for(let n=1;n<t.segments.length;n++)e.push(k(t.segments.slice(0,n)));return e}function p(t,e,n,r=!1,i=!1){const s=t.trim();if(s.length===0){if(i)return{canonical:"",segments:[]};throw new TypeError("[Raph] Data path must not be empty.")}const c=[];let a=0,l=!0;for(;a<s.length;){const _=s[a];if(_==="."){if(l)throw f(t);l=!0,a++;continue}if(_==="["){const v=A(s,a);c.push(z(s.slice(a+1,v),e,n,r)),a=v+1,l=!1;continue}if(!l)throw f(t);let u=a;for(;u<s.length&&s[u]!=="."&&s[u]!=="[";)u++;const g=s.slice(a,u).trim();if(g.length===0)throw f(t);if(g==="*"){if(!n)throw $(t);c.push({kind:"wildcard",indexed:!1})}else r&&g.startsWith("$")&&!x(g.slice(1),e)?c.push({kind:"wildcard",indexed:!1}):c.push({kind:"key",key:V(g,e)});a=u,l=!1}if(l||c.length===0)throw f(t);return{canonical:k(c),segments:c}}function A(t,e){let n,r=1;for(let i=e+1;i<t.length;i++){const s=t[i];if(s==="\\"){i++;continue}if(n!==void 0){s===n&&(n=void 0);continue}if(s==='"'||s==="'"){n=s;continue}if(s==="["){r++;continue}if(s==="]"&&--r===0)return i}throw f(t)}function z(t,e,n,r){const i=t.trim();if(i==="*"){if(!n)throw $(`[${t}]`);return{kind:"wildcard",indexed:!0}}if(/^\d+$/.test(i))return{kind:"index",index:Number(i)};if(/^\$[A-Z_$][\w$]*$/i.test(i)){if(r&&!x(i.slice(1),e))return{kind:"wildcard",indexed:!0};const l=b(i.slice(1),e);if(!Number.isInteger(l)||l<0)throw new TypeError(`[Raph] Index variable "${i}" must be a non-negative integer.`);return{kind:"index",index:l}}const s=D(i);if(s===-1)throw f(`[${t}]`);const c=i.slice(0,s).trim(),a=i.slice(s+1).trim();if(!c||!a)throw f(`[${t}]`);return r&&Z(a,e)?{kind:"wildcard",indexed:!0}:{kind:"selector",key:c,value:I(a,e)}}function D(t){let e;for(let n=0;n<t.length;n++){const r=t[n];if(r==="\\"){n++;continue}if(e!==void 0){r===e&&(e=void 0);continue}if(r==='"'||r==="'")e=r;else if(r==="=")return n}return-1}function I(t,e){if(/^\$[A-Z_$][\w$]*$/i.test(t)){const n=b(t.slice(1),e);if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"&&Number.isFinite(n))return n;throw new TypeError(`[Raph] Selector variable "${t}" must be scalar.`)}if(t[0]==='"'||t[0]==="'")return q(t);if(/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(t)){const n=Number(t);if(Number.isFinite(n))return n}return t==="true"?!0:t==="false"?!1:t==="null"?null:t}function q(t){const e=t[0];if(t.length<2||t[t.length-1]!==e)throw f(t);if(e==='"')try{const r=JSON.parse(t);if(typeof r=="string")return r}catch{throw f(t)}let n="";for(let r=1;r<t.length-1;r++){const i=t[r];if(i==="\\"){if(r++,r>=t.length-1)throw f(t);n+=t[r]}else n+=i}return n}function V(t,e){if(!t.startsWith("$"))return t;const n=b(t.slice(1),e);if(typeof n!="string"&&typeof n!="number")throw new TypeError(`[Raph] Key variable "${t}" must be a string or number.`);const r=String(n);if(!r||r.includes(".")||r.includes("[")||r.includes("]"))throw new TypeError(`[Raph] Key variable "${t}" contains path syntax.`);return r}function b(t,e){if(!x(t,e))throw new TypeError(`[Raph] Missing path variable "${t}".`);return e[t]}function x(t,e){return e!==void 0&&Object.hasOwn(e,t)}function Z(t,e){for(const n of t.matchAll(/\$([A-Z_$][\w$]*)/gi))if(!x(n[1],e))return!0;return!1}function F(t){if(typeof t!="object"||t===null)throw P();const e=t;if(e.t==="key"&&typeof e.k=="string")return{kind:"key",key:e.k};if(e.t==="idx"&&typeof e.i=="number"&&Number.isInteger(e.i)&&e.i>=0)return{kind:"index",index:e.i};if(e.t==="wc")return{kind:"wildcard",indexed:e.indexed===!0};if(e.t==="param"&&typeof e.pk=="string"&&K(e.pv))return{kind:"selector",key:e.pk,value:e.pv};throw P()}function K(t){return t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t)}function S(t){const e=t[t.length-1];return(e==null?void 0:e.kind)==="wildcard"&&!e.indexed}function W(t,e){return t.kind==="wildcard"?!t.indexed||e.kind==="index"||e.kind==="selector":t.kind!==e.kind?!1:t.kind==="key"?t.key===e.key:t.kind==="index"?t.index===e.index:t.key===e.key&&Object.is(t.value,e.value)}function k(t){let e="";for(const n of t)n.kind==="key"?e+=e?`.${n.key}`:n.key:n.kind==="index"?e+=`[${n.index}]`:n.kind==="selector"?e+=`[${n.key}=${B(n.value)}]`:e+=n.indexed?"[*]":e?".*":"*";return e}function B(t){return typeof t=="string"?JSON.stringify(t):String(t)}function f(t){return new TypeError(`[Raph] Invalid data path "${t}".`)}function P(){return new TypeError("[Raph] Invalid plain DataPath representation.")}function $(t){return new TypeError(`[Raph] Wildcard is only allowed in watch masks: "${t}".`)}exports.DataPath=d;exports.parseDataPath=T;exports.parsePathMask=R;exports.pathRelationMasks=j;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./data-path.cjs");function m(e,t,i){if(i.segments.length<=e.segments.length)return{kind:"full"};for(let o=0;o<e.segments.length;o++)if(!$(e.segments[o],i.segments[o]))return{kind:"full"};const r=i.segments[e.segments.length];if((r==null?void 0:r.kind)!=="selector"||r.key!==t||typeof r.value!="string"&&typeof r.value!="number")return{kind:"full"};const n=i.segments[e.segments.length+1];return(n==null?void 0:n.kind)==="key"&&n.key===t?{kind:"full"}:{kind:"key",key:r.value}}function k(e,t,i){const r=p.parseDataPath(e).canonical,n=typeof i=="number"?String(i):JSON.stringify(i);return`${r}[${t}=${n}]`}function g(e,t,i,r){if(!Array.isArray(i)||!Array.isArray(r))throw f(e,"requires array source and output");if(i.length!==r.length)throw f(e,"must preserve collection cardinality");const n=a(i,t,"source"),o=a(r,t,"output");for(let s=0;s<n.length;s++)if(n[s]!==o[s])throw f(e,"must preserve key order")}function h(e,t,i,r){if(!Array.isArray(r))throw f(e,"incremental compute must return an array");if(i.length!==r.length)throw f(e,"incremental compute must preserve cardinality");const n=a(r,t,"output");for(let o=0;o<i.length;o++)if(i[o]!==n[o])throw f(e,"incremental compute must preserve key order")}function w(e,t,i,r){if(!Array.isArray(i)||!Array.isArray(r))throw u(e,"requires array source and output");d(e,"output must be an ordered subset of source",a(i,t,"source"),a(r,t,"output"))}function b(e,t,i,r){if(!Array.isArray(r))throw u(e,"incremental compute must return an array");d(e,"incremental output must be an ordered subset of input",i,a(r,t,"output"))}function a(e,t,i){const r=new Set,n=[];for(let o=0;o<e.length;o++){if(!(o in e)){n.push(void 0);continue}const s=e[o];if(!y(s))throw new TypeError(`[Raph] ${i} collection items must be objects.`);const c=s[t];if(typeof c!="string"&&typeof c!="number")throw new TypeError(`[Raph] ${i} item key "${t}" must be a string or number.`);if(r.has(c))throw new TypeError(`[Raph] Duplicate ${i} key: "${String(c)}".`);r.add(c),n.push(c)}return n}function A(e,t,i){const r=a(e,t,i),n=new Map;for(let o=0;o<r.length;o++){const s=r[o];s!==void 0&&n.set(s,o)}return n}function x(e,t,i,r){for(const n of r){const o=i.get(n);if(o===void 0)return!0;const s=e[o];if(!y(s)||s[t]!==n)return!0}return!1}function f(e,t){return new TypeError(`[Raph] collectionByKey derived "${e}" ${t}.`)}function u(e,t){return new TypeError(`[Raph] filterByKey derived "${e}" ${t}.`)}function E(e){return l(e,new WeakMap)}function d(e,t,i,r){const n=new Map;for(let s=0;s<i.length;s++){const c=i[s];c!==void 0&&n.set(c,s)}let o=-1;for(const s of r){if(s===void 0)continue;const c=n.get(s);if(c===void 0||c<=o)throw u(e,t);o=c}}function l(e,t){if(e===null||typeof e!="object")return e;const i=t.get(e);if(i!==void 0)return i;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){const n=new Map;t.set(e,n);for(const[o,s]of e)n.set(l(o,t),l(s,t));return n}if(e instanceof Set){const n=new Set;t.set(e,n);for(const o of e)n.add(l(o,t));return n}if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return structuredClone(e);if(Array.isArray(e)){const n=[];t.set(e,n);for(let o=0;o<e.length;o++)o in e&&(n[o]=l(e[o],t));return n}const r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(const n of Reflect.ownKeys(e))r[n]=l(e[n],t);return r}function $(e,t){return e.kind!==t.kind?!1:e.kind==="key"&&t.kind==="key"?e.key===t.key:e.kind==="index"&&t.kind==="index"?e.index===t.index:e.kind==="selector"&&t.kind==="selector"&&e.key===t.key&&Object.is(e.value,t.value)}function y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}exports.cloneMaterializedValue=E;exports.collectionError=f;exports.collectionIndex=A;exports.collectionKeys=a;exports.collectionMutationImpact=m;exports.filterError=u;exports.indexesAreStale=x;exports.keyedPath=k;exports.validateFullCollection=g;exports.validateFullFilter=w;exports.validateIncrementalCollection=h;exports.validateIncrementalFilter=b;
@@ -1 +0,0 @@
1
- "use strict";var u=Object.defineProperty;var x=(n,t,i)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i;var p=(n,t,i)=>x(n,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./segment-key.cjs");class g{constructor(){p(this,"_root",{})}add(t,i){let e=this._root;const o=[];for(const c of t.segments)if(c.kind==="wildcard"){const d=e.indexedWildcard??(e.indexedWildcard={});o.push({child:d,parent:e,indexedWildcard:!0}),e=d}else{const d=h.pathSegmentKey(c),a=e.exact??(e.exact=new Map);let s=a.get(d);s===void 0&&(s={},a.set(d,s)),o.push({child:s,key:d,parent:e,indexedWildcard:!1}),e=s}const r=t.deep?e.deep??(e.deep=new Set):e.end??(e.end=new Set);r.add(i);let l=!0;return()=>{if(l){l=!1,r.delete(i),r.size===0&&(t.deep?e.deep=void 0:e.end=void 0);for(let c=o.length-1;c>=0;c--){const d=o[c];if(!v(d.child))break;d.indexedWildcard?d.parent.indexedWildcard=void 0:(d.parent.exact.delete(d.key),d.parent.exact.size===0&&(d.parent.exact=void 0))}}}}match(t){var o;let i=[this._root];const e=new Set;for(let r=0;r<=t.length;r++){const l=r===t.length,c=[];for(const d of i){if(f(e,d.deep),l){f(e,d.end);continue}const a=t[r],s=(o=d.exact)==null?void 0:o.get(h.pathSegmentKey(a));s!==void 0&&c.push(s),d.indexedWildcard!==void 0&&(a.kind==="index"||a.kind==="selector")&&c.push(d.indexedWildcard)}if(l||(i=c,i.length===0))break}return e}matchAll(){const t=new Set,i=[this._root];for(;i.length;){const e=i.pop();if(f(t,e.deep),f(t,e.end),e.indexedWildcard!==void 0&&i.push(e.indexedWildcard),e.exact!==void 0)for(const o of e.exact.values())i.push(o)}return t}}function f(n,t){if(t!==void 0)for(const i of t)n.add(i)}function v(n){return n.deep===void 0&&n.end===void 0&&n.exact===void 0&&n.indexedWildcard===void 0}exports.PathRouter=g;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./data-adapter.cjs"),a=require("./data-path.cjs"),e=require("./derived-strategies.cjs"),r=require("./PathStore.cjs"),d=require("./RaphDerivedHandle.cjs"),h=require("./RaphKernel.cjs"),l=require("./RaphMeta.cjs");exports.DefaultDataAdapter=t.DefaultDataAdapter;exports.DataPath=a.DataPath;exports.collectionByKey=e.collectionByKey;exports.filterByKey=e.filterByKey;exports.full=e.full;exports.PathStore=r.PathStore;exports.RaphDerivedHandle=d.RaphDerivedHandle;exports.RaphKernel=h.RaphKernel;exports.RaphMeta=l.RaphMeta;
@@ -1,18 +0,0 @@
1
- import { DefaultDataAdapter as o } from "./data-adapter.js";
2
- import { DataPath as a } from "./data-path.js";
3
- import { collectionByKey as f, filterByKey as l, full as m } from "./derived-strategies.js";
4
- import { PathStore as h } from "./PathStore.js";
5
- import { RaphDerivedHandle as D } from "./RaphDerivedHandle.js";
6
- import { RaphKernel as i } from "./RaphKernel.js";
7
- import { RaphMeta as K } from "./RaphMeta.js";
8
- export {
9
- a as DataPath,
10
- o as DefaultDataAdapter,
11
- h as PathStore,
12
- D as RaphDerivedHandle,
13
- i as RaphKernel,
14
- K as RaphMeta,
15
- f as collectionByKey,
16
- l as filterByKey,
17
- m as full
18
- };
@@ -1 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var c=(r,s,t)=>s in r?p(r,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[s]=t;var e=(r,s,t)=>c(r,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../path/data-path.cjs"),u=require("./disposal.cjs"),k=require("./errors.cjs");class w{constructor(s,t,h,a,i,_,d,n,l){e(this,"path");e(this,"options");e(this,"_revision");e(this,"_disposeRevision");e(this,"_isTracking");e(this,"_store");e(this,"_release");e(this,"_masks");e(this,"_assertOwnerAlive");e(this,"_assertTrackedRead");e(this,"_assertWriteAllowed");e(this,"_runWrite");e(this,"_stop");e(this,"_disposed",!1);const o=i._ownedSignal(0);this._store=s,this._revision=o.source,this._disposeRevision=o.dispose,this._isTracking=i._isTracking,this.path=t.canonical,this.options=h,this._release=a,this._masks=v.pathRelationMasks(t),this._assertOwnerAlive=_,this._assertTrackedRead=d,this._assertWriteAllowed=n,this._runWrite=l}get disposed(){return this._disposed}get(){var s;return this._assertAlive(),(s=this._assertTrackedRead)==null||s.call(this),this._isTracking()?this._readTracked():this._store.peek(this.path)}peek(){return this._assertAlive(),this._store.peek(this.path)}set(s){var t;this._assertAlive(),(t=this._assertWriteAllowed)==null||t.call(this),this._write(()=>this._store.set(this.path,s))}merge(s){var t;this._assertAlive(),(t=this._assertWriteAllowed)==null||t.call(this),this._write(()=>this._store.merge(this.path,s))}delete(){var s;this._assertAlive(),(s=this._assertWriteAllowed)==null||s.call(this),this._write(()=>this._store.delete(this.path))}has(){return this._assertAlive(),this._store.has(this.path)}dispose(){if(this._disposed)return;this._disposed=!0;const s=[],t=this._stop;this._stop=void 0;const h=this._disposeRevision;this._disposeRevision=void 0;const a=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;try{t==null||t()}catch(i){s.push(i)}try{h==null||h()}catch(i){s.push(i)}try{a==null||a(this)}catch(i){s.push(i)}u.throwDisposalErrors(s,`[Raph] Path handle "${this.path}" disposal failed.`)}_getTracked(){var s;return this._assertAlive(),(s=this._assertTrackedRead)==null||s.call(this),this._readTracked()}_readTracked(){return this._observe(),this._revision.get(),this._store.get(this.path)}_observe(){this._stop??(this._stop=this._store.watch(this._masks,()=>{this._revision.set(this._revision.peek()+1)}))}_write(s){const t=this._runWrite;t===void 0?s():t(s)}_assertAlive(){var s;if(this._disposed)throw new k.RaphDisposedError(`[Raph] Path handle "${this.path}" is disposed.`);(s=this._assertOwnerAlive)==null||s.call(this)}}exports.PathHandle=w;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./RaphNode.cjs");function c(e){const d=e instanceof t.RaphNode?e.children.map(c):[];return Object.freeze({id:e.id,kind:e instanceof t.RaphNode?"node":"scope",disposed:e.disposed,resources:e._debugResourceCount(),sources:e._debugSourceCount(),children:Object.freeze(d)})}exports.createOwnerSnapshot=c;
@@ -1,15 +0,0 @@
1
- import { RaphNode as c } from "./RaphNode.js";
2
- function s(e) {
3
- const d = e instanceof c ? e.children.map(s) : [];
4
- return Object.freeze({
5
- id: e.id,
6
- kind: e instanceof c ? "node" : "scope",
7
- disposed: e.disposed,
8
- resources: e._debugResourceCount(),
9
- sources: e._debugSourceCount(),
10
- children: Object.freeze(d)
11
- });
12
- }
13
- export {
14
- s as createOwnerSnapshot
15
- };