@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
@@ -1,423 +0,0 @@
1
- var S = Object.defineProperty;
2
- var A = (n, e, t) => e in n ? S(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var u = (n, e, t) => A(n, typeof e != "symbol" ? e + "" : e, t);
4
- let m, w;
5
- const o = class o {
6
- /**
7
- * Сохраняет уже разобранный immutable path value.
8
- */
9
- constructor(e, t) {
10
- // Хранят canonical value и разобранные сегменты пути.
11
- u(this, "_canonical");
12
- u(this, "_segments");
13
- // Кешируют проверенные exact и mask представления.
14
- u(this, "_exact");
15
- u(this, "_mask");
16
- this._canonical = e, this._segments = Object.freeze(
17
- t.map((r) => Object.freeze({ ...r }))
18
- );
19
- }
20
- /**
21
- * Нормализует поддерживаемое определение пути в DataPath.
22
- */
23
- static from(e, t) {
24
- return e instanceof o ? e : typeof e == "string" ? this.fromString(e, t) : this.fromPlain(e);
25
- }
26
- /**
27
- * Разбирает строковый path согласно строгой грамматике.
28
- */
29
- static fromString(e, t) {
30
- const r = x(
31
- e,
32
- t == null ? void 0 : t.vars,
33
- !0,
34
- (t == null ? void 0 : t.wildcardDynamic) === !0,
35
- !0
36
- ), i = this._cache ?? (this._cache = /* @__PURE__ */ new Map()), s = i.get(r.canonical);
37
- if (s !== void 0)
38
- return s;
39
- i.size >= 2e4 && i.clear();
40
- const c = new o(r.canonical, r.segments);
41
- return i.set(r.canonical, c), c;
42
- }
43
- /**
44
- * Восстанавливает DataPath из сериализованного представления.
45
- */
46
- static fromPlain(e) {
47
- const r = (Array.isArray(e.segs) ? e.segs : []).map(j);
48
- return new o(_(r), r);
49
- }
50
- /**
51
- * Сериализует path в независимое plain-представление.
52
- */
53
- toPlain() {
54
- return {
55
- 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 }),
56
- deepOnTail: v(this._segments)
57
- };
58
- }
59
- /**
60
- * Возвращает canonical строковое представление пути.
61
- */
62
- toStringPath() {
63
- return this._canonical;
64
- }
65
- /**
66
- * Возвращает canonical строковое представление пути.
67
- */
68
- toString() {
69
- return this._canonical;
70
- }
71
- /**
72
- * Возвращает immutable список сегментов пути.
73
- */
74
- segments() {
75
- return this._segments;
76
- }
77
- /**
78
- * Проверяет соответствие exact path указанной маске.
79
- */
80
- static match(e, t) {
81
- const r = this.from(e)._segments, i = this.from(t)._segments;
82
- let s = 0;
83
- for (; s < r.length; s++) {
84
- const c = r[s];
85
- if (c.kind === "wildcard" && !c.indexed && s === r.length - 1)
86
- return !0;
87
- const a = i[s];
88
- if (a === void 0 || !H(c, a))
89
- return !1;
90
- }
91
- return s === i.length;
92
- }
93
- /**
94
- * Возвращает exact path либо отклоняет wildcard-сегменты.
95
- * @internal
96
- */
97
- _asExact() {
98
- for (const e of this._segments)
99
- if (e.kind === "wildcard")
100
- throw b(this._canonical);
101
- return this._exact ?? (this._exact = {
102
- canonical: this._canonical,
103
- segments: this._segments
104
- });
105
- }
106
- /**
107
- * Возвращает path mask с проверкой позиции wildcard.
108
- * @internal
109
- */
110
- _asMask() {
111
- for (let t = 0; t < this._segments.length - 1; t++) {
112
- const r = this._segments[t];
113
- if (r.kind === "wildcard" && !r.indexed)
114
- throw new TypeError(
115
- `[Raph] Dot wildcard must be the final mask segment: "${this._canonical}".`
116
- );
117
- }
118
- const e = v(this._segments);
119
- return this._mask ?? (this._mask = {
120
- canonical: this._canonical,
121
- deep: e,
122
- segments: e ? this._segments.slice(0, -1) : this._segments
123
- });
124
- }
125
- };
126
- // Переиспользует immutable экземпляры для одинаковых canonical paths.
127
- u(o, "_cache");
128
- let h = o;
129
- function q(n, e) {
130
- if (!(e != null && e.vars)) {
131
- const i = m == null ? void 0 : m.get(n);
132
- if (i !== void 0)
133
- return i;
134
- }
135
- if (typeof n != "string")
136
- return M(n, e);
137
- const t = x(n, e == null ? void 0 : e.vars, !1, !1, !0), r = {
138
- canonical: t.canonical,
139
- segments: t.segments
140
- };
141
- if (!(e != null && e.vars)) {
142
- const i = m ?? (m = /* @__PURE__ */ new Map());
143
- i.size >= 2e4 && i.clear(), i.set(n, r);
144
- }
145
- return r;
146
- }
147
- function V(n) {
148
- const e = w == null ? void 0 : w.get(n);
149
- if (e !== void 0)
150
- return e;
151
- if (typeof n != "string")
152
- return P(n);
153
- const t = x(n, void 0, !0, !1, !0);
154
- for (let a = 0; a < t.segments.length - 1; a++) {
155
- const l = t.segments[a];
156
- if (l.kind === "wildcard" && !l.indexed)
157
- throw new TypeError(
158
- `[Raph] Dot wildcard must be the final mask segment: "${n}".`
159
- );
160
- }
161
- const r = t.segments[t.segments.length - 1], i = (r == null ? void 0 : r.kind) === "wildcard" && !r.indexed, s = {
162
- canonical: t.canonical,
163
- deep: i,
164
- segments: i ? t.segments.slice(0, -1) : t.segments
165
- }, c = w ?? (w = /* @__PURE__ */ new Map());
166
- return c.size >= 2e4 && c.clear(), c.set(n, s), s;
167
- }
168
- function M(n, e) {
169
- const t = h.from(n, e)._asExact();
170
- if (n instanceof h && !(e != null && e.vars)) {
171
- const r = m ?? (m = /* @__PURE__ */ new Map());
172
- r.size >= 2e4 && r.clear(), r.set(n, t);
173
- }
174
- return t;
175
- }
176
- function P(n) {
177
- const e = h.from(n)._asMask();
178
- if (n instanceof h) {
179
- const t = w ?? (w = /* @__PURE__ */ new Map());
180
- t.size >= 2e4 && t.clear(), t.set(n, e);
181
- }
182
- return e;
183
- }
184
- function F(n) {
185
- if (n.segments.length === 0)
186
- return ["*"];
187
- const e = [`${n.canonical}.*`];
188
- for (let t = 1; t < n.segments.length; t++)
189
- e.push(_(n.segments.slice(0, t)));
190
- return e;
191
- }
192
- function x(n, e, t, r = !1, i = !1) {
193
- const s = n.trim();
194
- if (s.length === 0) {
195
- if (i)
196
- return { canonical: "", segments: [] };
197
- throw new TypeError("[Raph] Data path must not be empty.");
198
- }
199
- const c = [];
200
- let a = 0, l = !0;
201
- for (; a < s.length; ) {
202
- const k = s[a];
203
- if (k === ".") {
204
- if (l)
205
- throw f(n);
206
- l = !0, a++;
207
- continue;
208
- }
209
- if (k === "[") {
210
- const $ = T(s, a);
211
- c.push(I(
212
- s.slice(a + 1, $),
213
- e,
214
- t,
215
- r
216
- )), a = $ + 1, l = !1;
217
- continue;
218
- }
219
- if (!l)
220
- throw f(n);
221
- let d = a;
222
- for (; d < s.length && s[d] !== "." && s[d] !== "["; )
223
- d++;
224
- const g = s.slice(a, d).trim();
225
- if (g.length === 0)
226
- throw f(n);
227
- if (g === "*") {
228
- if (!t)
229
- throw b(n);
230
- c.push({ kind: "wildcard", indexed: !1 });
231
- } else r && g.startsWith("$") && !y(g.slice(1), e) ? c.push({ kind: "wildcard", indexed: !1 }) : c.push({ kind: "key", key: N(g, e) });
232
- a = d, l = !1;
233
- }
234
- if (l || c.length === 0)
235
- throw f(n);
236
- return { canonical: _(c), segments: c };
237
- }
238
- function T(n, e) {
239
- let t, r = 1;
240
- for (let i = e + 1; i < n.length; i++) {
241
- const s = n[i];
242
- if (s === "\\") {
243
- i++;
244
- continue;
245
- }
246
- if (t !== void 0) {
247
- s === t && (t = void 0);
248
- continue;
249
- }
250
- if (s === '"' || s === "'") {
251
- t = s;
252
- continue;
253
- }
254
- if (s === "[") {
255
- r++;
256
- continue;
257
- }
258
- if (s === "]" && --r === 0)
259
- return i;
260
- }
261
- throw f(n);
262
- }
263
- function I(n, e, t, r) {
264
- const i = n.trim();
265
- if (i === "*") {
266
- if (!t)
267
- throw b(`[${n}]`);
268
- return { kind: "wildcard", indexed: !0 };
269
- }
270
- if (/^\d+$/.test(i))
271
- return { kind: "index", index: Number(i) };
272
- if (/^\$[A-Z_$][\w$]*$/i.test(i)) {
273
- if (r && !y(i.slice(1), e))
274
- return { kind: "wildcard", indexed: !0 };
275
- const l = p(i.slice(1), e);
276
- if (!Number.isInteger(l) || l < 0)
277
- throw new TypeError(`[Raph] Index variable "${i}" must be a non-negative integer.`);
278
- return { kind: "index", index: l };
279
- }
280
- const s = R(i);
281
- if (s === -1)
282
- throw f(`[${n}]`);
283
- const c = i.slice(0, s).trim(), a = i.slice(s + 1).trim();
284
- if (!c || !a)
285
- throw f(`[${n}]`);
286
- return r && Z(a, e) ? { kind: "wildcard", indexed: !0 } : {
287
- kind: "selector",
288
- key: c,
289
- value: C(a, e)
290
- };
291
- }
292
- function R(n) {
293
- let e;
294
- for (let t = 0; t < n.length; t++) {
295
- const r = n[t];
296
- if (r === "\\") {
297
- t++;
298
- continue;
299
- }
300
- if (e !== void 0) {
301
- r === e && (e = void 0);
302
- continue;
303
- }
304
- if (r === '"' || r === "'")
305
- e = r;
306
- else if (r === "=")
307
- return t;
308
- }
309
- return -1;
310
- }
311
- function C(n, e) {
312
- if (/^\$[A-Z_$][\w$]*$/i.test(n)) {
313
- const t = p(n.slice(1), e);
314
- if (t === null || typeof t == "string" || typeof t == "boolean" || typeof t == "number" && Number.isFinite(t))
315
- return t;
316
- throw new TypeError(`[Raph] Selector variable "${n}" must be scalar.`);
317
- }
318
- if (n[0] === '"' || n[0] === "'")
319
- return O(n);
320
- if (/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(n)) {
321
- const t = Number(n);
322
- if (Number.isFinite(t))
323
- return t;
324
- }
325
- return n === "true" ? !0 : n === "false" ? !1 : n === "null" ? null : n;
326
- }
327
- function O(n) {
328
- const e = n[0];
329
- if (n.length < 2 || n[n.length - 1] !== e)
330
- throw f(n);
331
- if (e === '"')
332
- try {
333
- const r = JSON.parse(n);
334
- if (typeof r == "string")
335
- return r;
336
- } catch {
337
- throw f(n);
338
- }
339
- let t = "";
340
- for (let r = 1; r < n.length - 1; r++) {
341
- const i = n[r];
342
- if (i === "\\") {
343
- if (r++, r >= n.length - 1)
344
- throw f(n);
345
- t += n[r];
346
- } else
347
- t += i;
348
- }
349
- return t;
350
- }
351
- function N(n, e) {
352
- if (!n.startsWith("$"))
353
- return n;
354
- const t = p(n.slice(1), e);
355
- if (typeof t != "string" && typeof t != "number")
356
- throw new TypeError(`[Raph] Key variable "${n}" must be a string or number.`);
357
- const r = String(t);
358
- if (!r || r.includes(".") || r.includes("[") || r.includes("]"))
359
- throw new TypeError(`[Raph] Key variable "${n}" contains path syntax.`);
360
- return r;
361
- }
362
- function p(n, e) {
363
- if (!y(n, e))
364
- throw new TypeError(`[Raph] Missing path variable "${n}".`);
365
- return e[n];
366
- }
367
- function y(n, e) {
368
- return e !== void 0 && Object.hasOwn(e, n);
369
- }
370
- function Z(n, e) {
371
- for (const t of n.matchAll(/\$([A-Z_$][\w$]*)/gi))
372
- if (!y(t[1], e))
373
- return !0;
374
- return !1;
375
- }
376
- function j(n) {
377
- if (typeof n != "object" || n === null)
378
- throw E();
379
- const e = n;
380
- if (e.t === "key" && typeof e.k == "string")
381
- return { kind: "key", key: e.k };
382
- if (e.t === "idx" && typeof e.i == "number" && Number.isInteger(e.i) && e.i >= 0)
383
- return { kind: "index", index: e.i };
384
- if (e.t === "wc")
385
- return { kind: "wildcard", indexed: e.indexed === !0 };
386
- if (e.t === "param" && typeof e.pk == "string" && z(e.pv))
387
- return { kind: "selector", key: e.pk, value: e.pv };
388
- throw E();
389
- }
390
- function z(n) {
391
- return n === null || typeof n == "string" || typeof n == "boolean" || typeof n == "number" && Number.isFinite(n);
392
- }
393
- function v(n) {
394
- const e = n[n.length - 1];
395
- return (e == null ? void 0 : e.kind) === "wildcard" && !e.indexed;
396
- }
397
- function H(n, e) {
398
- return n.kind === "wildcard" ? !n.indexed || e.kind === "index" || e.kind === "selector" : n.kind !== e.kind ? !1 : n.kind === "key" ? n.key === e.key : n.kind === "index" ? n.index === e.index : n.key === e.key && Object.is(n.value, e.value);
399
- }
400
- function _(n) {
401
- let e = "";
402
- for (const t of n)
403
- t.kind === "key" ? e += e ? `.${t.key}` : t.key : t.kind === "index" ? e += `[${t.index}]` : t.kind === "selector" ? e += `[${t.key}=${X(t.value)}]` : e += t.indexed ? "[*]" : e ? ".*" : "*";
404
- return e;
405
- }
406
- function X(n) {
407
- return typeof n == "string" ? JSON.stringify(n) : String(n);
408
- }
409
- function f(n) {
410
- return new TypeError(`[Raph] Invalid data path "${n}".`);
411
- }
412
- function E() {
413
- return new TypeError("[Raph] Invalid plain DataPath representation.");
414
- }
415
- function b(n) {
416
- return new TypeError(`[Raph] Wildcard is only allowed in watch masks: "${n}".`);
417
- }
418
- export {
419
- h as DataPath,
420
- q as parseDataPath,
421
- V as parsePathMask,
422
- F as pathRelationMasks
423
- };
@@ -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,86 +0,0 @@
1
- var h = Object.defineProperty;
2
- var u = (n, t, i) => t in n ? h(n, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : n[t] = i;
3
- var p = (n, t, i) => u(n, typeof t != "symbol" ? t + "" : t, i);
4
- import { pathSegmentKey as x } from "./segment-key.js";
5
- class m {
6
- constructor() {
7
- // Корень trie разделяет exact и indexed-wildcard transitions.
8
- p(this, "_root", {});
9
- }
10
- /**
11
- * Регистрирует route mask и возвращает функцию удаления.
12
- */
13
- add(t, i) {
14
- let e = this._root;
15
- const o = [];
16
- for (const c of t.segments)
17
- if (c.kind === "wildcard") {
18
- const d = e.indexedWildcard ?? (e.indexedWildcard = {});
19
- o.push({ child: d, parent: e, indexedWildcard: !0 }), e = d;
20
- } else {
21
- const d = x(c), a = e.exact ?? (e.exact = /* @__PURE__ */ new Map());
22
- let s = a.get(d);
23
- s === void 0 && (s = {}, a.set(d, s)), o.push({ child: s, key: d, parent: e, indexedWildcard: !1 }), e = s;
24
- }
25
- const r = t.deep ? e.deep ?? (e.deep = /* @__PURE__ */ new Set()) : e.end ?? (e.end = /* @__PURE__ */ new Set());
26
- r.add(i);
27
- let l = !0;
28
- return () => {
29
- if (l) {
30
- l = !1, r.delete(i), r.size === 0 && (t.deep ? e.deep = void 0 : e.end = void 0);
31
- for (let c = o.length - 1; c >= 0; c--) {
32
- const d = o[c];
33
- if (!v(d.child))
34
- break;
35
- d.indexedWildcard ? d.parent.indexedWildcard = void 0 : (d.parent.exact.delete(d.key), d.parent.exact.size === 0 && (d.parent.exact = void 0));
36
- }
37
- }
38
- };
39
- }
40
- /**
41
- * Возвращает routes, чьи masks соответствуют указанному событию.
42
- */
43
- match(t) {
44
- var o;
45
- let i = [this._root];
46
- const e = /* @__PURE__ */ new Set();
47
- for (let r = 0; r <= t.length; r++) {
48
- const l = r === t.length, c = [];
49
- for (const d of i) {
50
- if (f(e, d.deep), l) {
51
- f(e, d.end);
52
- continue;
53
- }
54
- const a = t[r], s = (o = d.exact) == null ? void 0 : o.get(x(a));
55
- s !== void 0 && c.push(s), d.indexedWildcard !== void 0 && (a.kind === "index" || a.kind === "selector") && c.push(d.indexedWildcard);
56
- }
57
- if (l || (i = c, i.length === 0))
58
- break;
59
- }
60
- return e;
61
- }
62
- /**
63
- * При замене root возвращает все зарегистрированные path masks.
64
- */
65
- matchAll() {
66
- const t = /* @__PURE__ */ new Set(), i = [this._root];
67
- for (; i.length; ) {
68
- const e = i.pop();
69
- if (f(t, e.deep), f(t, e.end), e.indexedWildcard !== void 0 && i.push(e.indexedWildcard), e.exact !== void 0)
70
- for (const o of e.exact.values())
71
- i.push(o);
72
- }
73
- return t;
74
- }
75
- }
76
- function f(n, t) {
77
- if (t !== void 0)
78
- for (const i of t)
79
- n.add(i);
80
- }
81
- function v(n) {
82
- return n.deep === void 0 && n.end === void 0 && n.exact === void 0 && n.indexedWildcard === void 0;
83
- }
84
- export {
85
- m as PathRouter
86
- };
@@ -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,139 +0,0 @@
1
- var l = Object.defineProperty;
2
- var v = (r, s, t) => s in r ? l(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
- var e = (r, s, t) => v(r, typeof s != "symbol" ? s + "" : s, t);
4
- import { pathRelationMasks as c } from "../path/data-path.js";
5
- import { throwDisposalErrors as k } from "./disposal.js";
6
- import { RaphDisposedError as w } from "./errors.js";
7
- class R {
8
- /**
9
- * Создаёт internal path handle и связывает его с runtime lifecycle.
10
- * @internal
11
- */
12
- constructor(s, t, h, o, i, _, d, n, p) {
13
- // Публикуют canonical path и нормализованные параметры handle.
14
- e(this, "path");
15
- e(this, "options");
16
- // Связывают path revision с runtime reactivity и owning Kernel.
17
- e(this, "_revision");
18
- e(this, "_disposeRevision");
19
- e(this, "_isTracking");
20
- e(this, "_store");
21
- e(this, "_release");
22
- e(this, "_masks");
23
- // Применяют runtime lifecycle и write policy к операциям handle.
24
- e(this, "_assertOwnerAlive");
25
- e(this, "_assertTrackedRead");
26
- e(this, "_assertWriteAllowed");
27
- e(this, "_runWrite");
28
- // Хранят активную Kernel subscription и окончательное состояние handle.
29
- e(this, "_stop");
30
- e(this, "_disposed", !1);
31
- const a = i._ownedSignal(0);
32
- this._store = s, this._revision = a.source, this._disposeRevision = a.dispose, this._isTracking = i._isTracking, this.path = t.canonical, this.options = h, this._release = o, this._masks = c(t), this._assertOwnerAlive = _, this._assertTrackedRead = d, this._assertWriteAllowed = n, this._runWrite = p;
33
- }
34
- /**
35
- * Показывает, освобождён ли path handle.
36
- */
37
- get disposed() {
38
- return this._disposed;
39
- }
40
- /**
41
- * Читает path с регистрацией реактивной зависимости.
42
- */
43
- get() {
44
- var s;
45
- return this._assertAlive(), (s = this._assertTrackedRead) == null || s.call(this), 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
- var t;
58
- this._assertAlive(), (t = this._assertWriteAllowed) == null || t.call(this), this._write(() => this._store.set(this.path, s));
59
- }
60
- /**
61
- * Объединяет значение path через runtime write policy.
62
- */
63
- merge(s) {
64
- var t;
65
- this._assertAlive(), (t = this._assertWriteAllowed) == null || t.call(this), this._write(() => this._store.merge(this.path, s));
66
- }
67
- /**
68
- * Удаляет значение path через runtime write policy.
69
- */
70
- delete() {
71
- var s;
72
- this._assertAlive(), (s = this._assertWriteAllowed) == null || s.call(this), this._write(() => this._store.delete(this.path));
73
- }
74
- /**
75
- * Проверяет наличие значения path.
76
- */
77
- has() {
78
- return this._assertAlive(), this._store.has(this.path);
79
- }
80
- /**
81
- * Отсоединяет Kernel subscription и освобождает reactive revision handle.
82
- */
83
- dispose() {
84
- if (this._disposed)
85
- return;
86
- this._disposed = !0;
87
- const s = [], t = this._stop;
88
- this._stop = void 0;
89
- const h = this._disposeRevision;
90
- this._disposeRevision = void 0;
91
- const o = this._release;
92
- 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;
93
- try {
94
- t == null || t();
95
- } catch (i) {
96
- s.push(i);
97
- }
98
- try {
99
- h == null || h();
100
- } catch (i) {
101
- s.push(i);
102
- }
103
- try {
104
- o == null || o(this);
105
- } catch (i) {
106
- s.push(i);
107
- }
108
- k(s, `[Raph] Path handle "${this.path}" disposal failed.`);
109
- }
110
- /**
111
- * Читает path с регистрацией runtime reactive dependency.
112
- * @internal
113
- */
114
- _getTracked() {
115
- var s;
116
- return this._assertAlive(), (s = this._assertTrackedRead) == null || s.call(this), this._readTracked();
117
- }
118
- _readTracked() {
119
- return this._observe(), this._revision.get(), this._store.get(this.path);
120
- }
121
- _observe() {
122
- this._stop ?? (this._stop = this._store.watch(this._masks, () => {
123
- this._revision.set(this._revision.peek() + 1);
124
- }));
125
- }
126
- _write(s) {
127
- const t = this._runWrite;
128
- t === void 0 ? s() : t(s);
129
- }
130
- _assertAlive() {
131
- var s;
132
- if (this._disposed)
133
- throw new w(`[Raph] Path handle "${this.path}" is disposed.`);
134
- (s = this._assertOwnerAlive) == null || s.call(this);
135
- }
136
- }
137
- export {
138
- R as PathHandle
139
- };