@raphy-js/raph 1.0.1-dev.20 → 1.0.1-dev.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/{core-CyilRD7s.js → core-CClhT8WR.js} +389 -400
  2. package/dist/core-cPQWYD4K.cjs +1 -0
  3. package/dist/debug/api/Raph.cjs +1 -1
  4. package/dist/debug/api/Raph.js +46 -47
  5. package/dist/debug/api/RaphFacadeSession.cjs +1 -1
  6. package/dist/debug/api/RaphFacadeSession.js +85 -89
  7. package/dist/debug/api/RaphReactivityInstance.cjs +1 -1
  8. package/dist/debug/api/RaphReactivityInstance.js +27 -30
  9. package/dist/debug/path/DataPath.cjs +1 -1
  10. package/dist/debug/path/DataPath.js +198 -202
  11. package/dist/debug/path/PathRouter.cjs +1 -1
  12. package/dist/debug/path/PathRouter.js +44 -50
  13. package/dist/debug/path/RaphKernel.cjs +1 -1
  14. package/dist/debug/path/RaphKernel.js +257 -228
  15. package/dist/debug/path/data-path.utils.cjs +1 -1
  16. package/dist/debug/path/data-path.utils.js +41 -41
  17. package/dist/debug/path/derived/DerivedRegistry.cjs +1 -1
  18. package/dist/debug/path/derived/DerivedRegistry.js +52 -66
  19. package/dist/debug/path/derived/RaphDerivedHandle.cjs +1 -1
  20. package/dist/debug/path/derived/RaphDerivedHandle.js +19 -22
  21. package/dist/debug/path/derived/derived-collection.utils.cjs +1 -1
  22. package/dist/debug/path/derived/derived-collection.utils.js +70 -70
  23. package/dist/debug/path/meta/MetaController.cjs +1 -1
  24. package/dist/debug/path/meta/MetaController.js +57 -65
  25. package/dist/debug/path/meta/RaphMeta.cjs +1 -1
  26. package/dist/debug/path/meta/RaphMeta.js +26 -32
  27. package/dist/debug/path/meta/RaphMetaStore.cjs +1 -1
  28. package/dist/debug/path/meta/RaphMetaStore.js +24 -30
  29. package/dist/debug/path/storage/AdapterPathStore.cjs +1 -1
  30. package/dist/debug/path/storage/AdapterPathStore.js +49 -54
  31. package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -1
  32. package/dist/debug/path/storage/DefaultDataAdapter.js +46 -56
  33. package/dist/debug/path/storage/PathEventHub.cjs +1 -1
  34. package/dist/debug/path/storage/PathEventHub.js +74 -61
  35. package/dist/debug/path/storage/PathStore.cjs +1 -1
  36. package/dist/debug/path/storage/PathStore.js +89 -99
  37. package/dist/debug/path/storage/createDataDraft.cjs +1 -1
  38. package/dist/debug/path/storage/createDataDraft.js +24 -28
  39. package/dist/debug/reactivity/disposal.cjs +1 -0
  40. package/dist/debug/reactivity/disposal.js +32 -0
  41. package/dist/debug/reactivity/engine.cjs +1 -1
  42. package/dist/debug/reactivity/engine.js +787 -392
  43. package/dist/debug/reactivity/reactive-object.cjs +1 -1
  44. package/dist/debug/reactivity/reactive-object.js +81 -96
  45. package/dist/debug/reactivity/scope.cjs +1 -1
  46. package/dist/debug/reactivity/scope.js +221 -117
  47. package/dist/debug/reactivity/watch.cjs +1 -1
  48. package/dist/debug/reactivity/watch.js +1 -1
  49. package/dist/debug/runtime/RaphRuntime.cjs +1 -1
  50. package/dist/debug/runtime/RaphRuntime.js +764 -411
  51. package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -1
  52. package/dist/debug/runtime/diagnostics/RaphDebug.js +90 -100
  53. package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -1
  54. package/dist/debug/runtime/ownership/RaphEffectScope.js +215 -82
  55. package/dist/debug/runtime/ownership/RaphNode.cjs +1 -1
  56. package/dist/debug/runtime/ownership/RaphNode.js +595 -136
  57. package/dist/debug/runtime/ownership/RaphScope.cjs +1 -1
  58. package/dist/debug/runtime/ownership/RaphScope.js +203 -68
  59. package/dist/debug/runtime/phases/RaphFrameLoop.cjs +1 -1
  60. package/dist/debug/runtime/phases/RaphFrameLoop.js +13 -17
  61. package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -1
  62. package/dist/debug/runtime/phases/RaphPhasePipeline.js +618 -357
  63. package/dist/debug/runtime/phases/RaphPhaseTaskRecord.cjs +1 -0
  64. package/dist/debug/runtime/phases/RaphPhaseTaskRecord.js +176 -0
  65. package/dist/debug/runtime/phases/RaphPhaseWatch.cjs +1 -0
  66. package/dist/debug/runtime/phases/RaphPhaseWatch.js +20 -0
  67. package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -1
  68. package/dist/debug/runtime/reactivity/PathHandle.js +50 -60
  69. package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -1
  70. package/dist/debug/runtime/reactivity/RaphMetaSource.js +28 -32
  71. package/dist/debug/runtime/reactivity/RaphSelector.cjs +1 -0
  72. package/dist/debug/runtime/reactivity/RaphSelector.js +503 -0
  73. package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -1
  74. package/dist/debug/runtime/reactivity/RaphWorkGraph.js +541 -379
  75. package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -1
  76. package/dist/debug/runtime/reactivity/RuntimeReactivity.js +484 -90
  77. package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -1
  78. package/dist/debug/runtime/reactivity/RuntimeWatch.js +33 -44
  79. package/dist/debug/runtime/reactivity/disposal-sweep.utils.cjs +1 -0
  80. package/dist/debug/runtime/reactivity/disposal-sweep.utils.js +42 -0
  81. package/dist/entrypoints/runtime.d.ts +2 -1
  82. package/dist/machine-testing.cjs +1 -1
  83. package/dist/machine-testing.js +1 -1
  84. package/dist/machine.cjs +1 -1
  85. package/dist/machine.js +216 -231
  86. package/dist/path/RaphKernel.d.ts +24 -0
  87. package/dist/path/storage/PathEventHub.d.ts +14 -0
  88. package/dist/path/storage/PathStore.d.ts +4 -4
  89. package/dist/reactivity/disposal.d.ts +14 -0
  90. package/dist/reactivity/engine.d.ts +177 -4
  91. package/dist/reactivity/scope.d.ts +108 -30
  92. package/dist/runtime/RaphRuntime.d.ts +236 -17
  93. package/dist/runtime/ownership/RaphEffectScope.d.ts +70 -1
  94. package/dist/runtime/ownership/RaphNode.d.ts +276 -6
  95. package/dist/runtime/ownership/RaphScope.d.ts +144 -14
  96. package/dist/runtime/phases/RaphPhasePipeline.d.ts +202 -28
  97. package/dist/runtime/phases/RaphPhaseTaskRecord.d.ts +195 -0
  98. package/dist/runtime/phases/RaphPhaseWatch.d.ts +22 -0
  99. package/dist/runtime/phases/phase.types.d.ts +83 -4
  100. package/dist/runtime/reactivity/RaphSelector.d.ts +338 -0
  101. package/dist/runtime/reactivity/RaphWorkGraph.d.ts +163 -25
  102. package/dist/runtime/reactivity/RuntimeReactivity.d.ts +258 -10
  103. package/dist/runtime/reactivity/RuntimeWatch.d.ts +8 -8
  104. package/dist/runtime/reactivity/disposal-sweep.utils.d.ts +19 -0
  105. package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +48 -3
  106. package/package.json +9 -1
  107. package/dist/core-ugchZNqC.cjs +0 -1
@@ -1,60 +1,59 @@
1
- var v = Object.defineProperty;
2
- var S = (n, e, t) => e in n ? v(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var o = (n, e, t) => S(n, typeof e != "symbol" ? e + "" : e, t);
4
- const u = class u {
1
+ class u {
2
+ // Переиспользует immutable экземпляры для одинаковых canonical paths.
3
+ static _cache;
4
+ // Хранят canonical value и разобранные сегменты пути.
5
+ _canonical;
6
+ _segments;
7
+ // Кешируют проверенные exact и mask представления.
8
+ _exact;
9
+ _mask;
5
10
  /**
6
11
  * Сохраняет уже разобранный immutable path value.
7
12
  */
8
- constructor(e, t) {
9
- // Хранят canonical value и разобранные сегменты пути.
10
- o(this, "_canonical");
11
- o(this, "_segments");
12
- // Кешируют проверенные exact и mask представления.
13
- o(this, "_exact");
14
- o(this, "_mask");
13
+ constructor(e, n) {
15
14
  this._canonical = e, this._segments = Object.freeze(
16
- t.map((r) => Object.freeze({ ...r }))
15
+ n.map((i) => Object.freeze({ ...i }))
17
16
  );
18
17
  }
19
18
  /**
20
19
  * Нормализует поддерживаемое определение пути в DataPath.
21
20
  */
22
- static from(e, t) {
23
- return e instanceof u ? e : typeof e == "string" ? this.fromString(e, t) : this.fromPlain(e);
21
+ static from(e, n) {
22
+ return e instanceof u ? e : typeof e == "string" ? this.fromString(e, n) : this.fromPlain(e);
24
23
  }
25
24
  /**
26
25
  * Разбирает строковый path согласно строгой грамматике.
27
26
  */
28
- static fromString(e, t) {
29
- const r = m(
27
+ static fromString(e, n) {
28
+ const i = g(
30
29
  e,
31
- t == null ? void 0 : t.vars,
30
+ n?.vars,
32
31
  !0,
33
- (t == null ? void 0 : t.wildcardDynamic) === !0,
32
+ n?.wildcardDynamic === !0,
34
33
  !0
35
- ), s = this._cache ?? (this._cache = /* @__PURE__ */ new Map()), i = s.get(r.canonical);
36
- if (i !== void 0)
37
- return i;
34
+ ), s = this._cache ??= /* @__PURE__ */ new Map(), r = s.get(i.canonical);
35
+ if (r !== void 0)
36
+ return r;
38
37
  s.size >= 2e4 && s.clear();
39
- const c = new u(r.canonical, r.segments);
40
- return s.set(r.canonical, c), c;
38
+ const c = new u(i.canonical, i.segments);
39
+ return s.set(i.canonical, c), c;
41
40
  }
42
41
  /**
43
42
  * Восстанавливает DataPath из сериализованного представления.
44
43
  */
45
44
  static fromPlain(e) {
46
- const r = (Array.isArray(e.segs) ? e.segs : []).map(O);
47
- return new u(w(r), r);
45
+ const i = (Array.isArray(e.segs) ? e.segs : []).map(A);
46
+ return new u(m(i), i);
48
47
  }
49
48
  /**
50
49
  * Разбирает строку exact path без создания публичного value object.
51
50
  * @internal
52
51
  */
53
- static _parseExactString(e, t) {
54
- const r = m(e, t == null ? void 0 : t.vars, !1, !1, !0);
52
+ static _parseExactString(e, n) {
53
+ const i = g(e, n?.vars, !1, !1, !0);
55
54
  return {
56
- canonical: r.canonical,
57
- segments: r.segments
55
+ canonical: i.canonical,
56
+ segments: i.segments
58
57
  };
59
58
  }
60
59
  /**
@@ -62,19 +61,19 @@ const u = class u {
62
61
  * @internal
63
62
  */
64
63
  static _parseMaskString(e) {
65
- const t = m(e, void 0, !0, !1, !0);
66
- for (let i = 0; i < t.segments.length - 1; i++) {
67
- const c = t.segments[i];
64
+ const n = g(e, void 0, !0, !1, !0);
65
+ for (let r = 0; r < n.segments.length - 1; r++) {
66
+ const c = n.segments[r];
68
67
  if (c.kind === "wildcard" && !c.indexed)
69
68
  throw new TypeError(
70
69
  `[Raph] Dot wildcard must be the final mask segment: "${e}".`
71
70
  );
72
71
  }
73
- const r = t.segments[t.segments.length - 1], s = (r == null ? void 0 : r.kind) === "wildcard" && !r.indexed;
72
+ const i = n.segments[n.segments.length - 1], s = i?.kind === "wildcard" && !i.indexed;
74
73
  return {
75
- canonical: t.canonical,
74
+ canonical: n.canonical,
76
75
  deep: s,
77
- segments: s ? t.segments.slice(0, -1) : t.segments
76
+ segments: s ? n.segments.slice(0, -1) : n.segments
78
77
  };
79
78
  }
80
79
  /**
@@ -82,7 +81,7 @@ const u = class u {
82
81
  * @internal
83
82
  */
84
83
  static _renderSegments(e) {
85
- return w(e);
84
+ return m(e);
86
85
  }
87
86
  /**
88
87
  * Сериализует path в независимое plain-представление.
@@ -90,7 +89,7 @@ const u = class u {
90
89
  toPlain() {
91
90
  return {
92
91
  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 }),
93
- deepOnTail: b(this._segments)
92
+ deepOnTail: _(this._segments)
94
93
  };
95
94
  }
96
95
  /**
@@ -114,18 +113,18 @@ const u = class u {
114
113
  /**
115
114
  * Проверяет соответствие exact path указанной маске.
116
115
  */
117
- static match(e, t) {
118
- const r = this.from(e)._segments, s = this.from(t)._segments;
119
- let i = 0;
120
- for (; i < r.length; i++) {
121
- const c = r[i];
122
- if (c.kind === "wildcard" && !c.indexed && i === r.length - 1)
116
+ static match(e, n) {
117
+ const i = this.from(e)._segments, s = this.from(n)._segments;
118
+ let r = 0;
119
+ for (; r < i.length; r++) {
120
+ const c = i[r];
121
+ if (c.kind === "wildcard" && !c.indexed && r === i.length - 1)
123
122
  return !0;
124
- const a = s[i];
125
- if (a === void 0 || !j(c, a))
123
+ const a = s[r];
124
+ if (a === void 0 || !N(c, a))
126
125
  return !1;
127
126
  }
128
- return i === s.length;
127
+ return r === s.length;
129
128
  }
130
129
  /**
131
130
  * Возвращает exact path либо отклоняет wildcard-сегменты.
@@ -134,261 +133,258 @@ const u = class u {
134
133
  _asExact() {
135
134
  for (const e of this._segments)
136
135
  if (e.kind === "wildcard")
137
- throw y(this._canonical);
138
- return this._exact ?? (this._exact = {
136
+ throw w(this._canonical);
137
+ return this._exact ??= {
139
138
  canonical: this._canonical,
140
139
  segments: this._segments
141
- });
140
+ };
142
141
  }
143
142
  /**
144
143
  * Возвращает path mask с проверкой позиции wildcard.
145
144
  * @internal
146
145
  */
147
146
  _asMask() {
148
- for (let t = 0; t < this._segments.length - 1; t++) {
149
- const r = this._segments[t];
150
- if (r.kind === "wildcard" && !r.indexed)
147
+ for (let n = 0; n < this._segments.length - 1; n++) {
148
+ const i = this._segments[n];
149
+ if (i.kind === "wildcard" && !i.indexed)
151
150
  throw new TypeError(
152
151
  `[Raph] Dot wildcard must be the final mask segment: "${this._canonical}".`
153
152
  );
154
153
  }
155
- const e = b(this._segments);
156
- return this._mask ?? (this._mask = {
154
+ const e = _(this._segments);
155
+ return this._mask ??= {
157
156
  canonical: this._canonical,
158
157
  deep: e,
159
158
  segments: e ? this._segments.slice(0, -1) : this._segments
160
- });
159
+ };
161
160
  }
162
- };
163
- // Переиспользует immutable экземпляры для одинаковых canonical paths.
164
- o(u, "_cache");
165
- let k = u;
166
- function m(n, e, t, r = !1, s = !1) {
167
- const i = n.trim();
168
- if (i.length === 0) {
161
+ }
162
+ function g(t, e, n, i = !1, s = !1) {
163
+ const r = t.trim();
164
+ if (r.length === 0) {
169
165
  if (s)
170
166
  return { canonical: "", segments: [] };
171
167
  throw new TypeError("[Raph] Data path must not be empty.");
172
168
  }
173
169
  const c = [];
174
- let a = 0, l = !0;
175
- for (; a < i.length; ) {
176
- const x = i[a];
177
- if (x === ".") {
178
- if (l)
179
- throw d(n);
180
- l = !0, a++;
170
+ let a = 0, o = !0;
171
+ for (; a < r.length; ) {
172
+ const y = r[a];
173
+ if (y === ".") {
174
+ if (o)
175
+ throw l(t);
176
+ o = !0, a++;
181
177
  continue;
182
178
  }
183
- if (x === "[") {
184
- const _ = E(i, a);
185
- c.push(T(
186
- i.slice(a + 1, _),
179
+ if (y === "[") {
180
+ const x = b(r, a);
181
+ c.push($(
182
+ r.slice(a + 1, x),
187
183
  e,
188
- t,
189
- r
190
- )), a = _ + 1, l = !1;
184
+ n,
185
+ i
186
+ )), a = x + 1, o = !1;
191
187
  continue;
192
188
  }
193
- if (!l)
194
- throw d(n);
195
- let f = a;
196
- for (; f < i.length && i[f] !== "." && i[f] !== "["; )
197
- f++;
198
- const h = i.slice(a, f).trim();
199
- if (h.length === 0)
200
- throw d(n);
201
- if (h === "*") {
202
- if (!t)
203
- throw y(n);
189
+ if (!o)
190
+ throw l(t);
191
+ let d = a;
192
+ for (; d < r.length && r[d] !== "." && r[d] !== "["; )
193
+ d++;
194
+ const f = r.slice(a, d).trim();
195
+ if (f.length === 0)
196
+ throw l(t);
197
+ if (f === "*") {
198
+ if (!n)
199
+ throw w(t);
204
200
  c.push({ kind: "wildcard", indexed: !1 });
205
- } else r && h.startsWith("$") && !g(h.slice(1), e) ? c.push({ kind: "wildcard", indexed: !1 }) : c.push({ kind: "key", key: N(h, e) });
206
- a = f, l = !1;
201
+ } else i && f.startsWith("$") && !h(f.slice(1), e) ? c.push({ kind: "wildcard", indexed: !1 }) : c.push({ kind: "key", key: T(f, e) });
202
+ a = d, o = !1;
207
203
  }
208
- if (l || c.length === 0)
209
- throw d(n);
210
- return { canonical: w(c), segments: c };
204
+ if (o || c.length === 0)
205
+ throw l(t);
206
+ return { canonical: m(c), segments: c };
211
207
  }
212
- function E(n, e) {
213
- let t, r = 1;
214
- for (let s = e + 1; s < n.length; s++) {
215
- const i = n[s];
216
- if (i === "\\") {
208
+ function b(t, e) {
209
+ let n, i = 1;
210
+ for (let s = e + 1; s < t.length; s++) {
211
+ const r = t[s];
212
+ if (r === "\\") {
217
213
  s++;
218
214
  continue;
219
215
  }
220
- if (t !== void 0) {
221
- i === t && (t = void 0);
216
+ if (n !== void 0) {
217
+ r === n && (n = void 0);
222
218
  continue;
223
219
  }
224
- if (i === '"' || i === "'") {
225
- t = i;
220
+ if (r === '"' || r === "'") {
221
+ n = r;
226
222
  continue;
227
223
  }
228
- if (i === "[") {
229
- r++;
224
+ if (r === "[") {
225
+ i++;
230
226
  continue;
231
227
  }
232
- if (i === "]" && --r === 0)
228
+ if (r === "]" && --i === 0)
233
229
  return s;
234
230
  }
235
- throw d(n);
231
+ throw l(t);
236
232
  }
237
- function T(n, e, t, r) {
238
- const s = n.trim();
233
+ function $(t, e, n, i) {
234
+ const s = t.trim();
239
235
  if (s === "*") {
240
- if (!t)
241
- throw y(`[${n}]`);
236
+ if (!n)
237
+ throw w(`[${t}]`);
242
238
  return { kind: "wildcard", indexed: !0 };
243
239
  }
244
240
  if (/^\d+$/.test(s))
245
241
  return { kind: "index", index: Number(s) };
246
242
  if (/^\$[A-Z_$][\w$]*$/i.test(s)) {
247
- if (r && !g(s.slice(1), e))
243
+ if (i && !h(s.slice(1), e))
248
244
  return { kind: "wildcard", indexed: !0 };
249
- const l = p(s.slice(1), e);
250
- if (!Number.isInteger(l) || l < 0)
245
+ const o = p(s.slice(1), e);
246
+ if (!Number.isInteger(o) || o < 0)
251
247
  throw new TypeError(`[Raph] Index variable "${s}" must be a non-negative integer.`);
252
- return { kind: "index", index: l };
248
+ return { kind: "index", index: o };
253
249
  }
254
- const i = R(s);
255
- if (i === -1)
256
- throw d(`[${n}]`);
257
- const c = s.slice(0, i).trim(), a = s.slice(i + 1).trim();
250
+ const r = v(s);
251
+ if (r === -1)
252
+ throw l(`[${t}]`);
253
+ const c = s.slice(0, r).trim(), a = s.slice(r + 1).trim();
258
254
  if (!c || !a)
259
- throw d(`[${n}]`);
260
- return r && I(a, e) ? { kind: "wildcard", indexed: !0 } : {
255
+ throw l(`[${t}]`);
256
+ return i && R(a, e) ? { kind: "wildcard", indexed: !0 } : {
261
257
  kind: "selector",
262
258
  key: c,
263
- value: A(a, e)
259
+ value: S(a, e)
264
260
  };
265
261
  }
266
- function R(n) {
262
+ function v(t) {
267
263
  let e;
268
- for (let t = 0; t < n.length; t++) {
269
- const r = n[t];
270
- if (r === "\\") {
271
- t++;
264
+ for (let n = 0; n < t.length; n++) {
265
+ const i = t[n];
266
+ if (i === "\\") {
267
+ n++;
272
268
  continue;
273
269
  }
274
270
  if (e !== void 0) {
275
- r === e && (e = void 0);
271
+ i === e && (e = void 0);
276
272
  continue;
277
273
  }
278
- if (r === '"' || r === "'")
279
- e = r;
280
- else if (r === "=")
281
- return t;
274
+ if (i === '"' || i === "'")
275
+ e = i;
276
+ else if (i === "=")
277
+ return n;
282
278
  }
283
279
  return -1;
284
280
  }
285
- function A(n, e) {
286
- if (/^\$[A-Z_$][\w$]*$/i.test(n)) {
287
- const t = p(n.slice(1), e);
288
- if (t === null || typeof t == "string" || typeof t == "boolean" || typeof t == "number" && Number.isFinite(t))
289
- return t;
290
- throw new TypeError(`[Raph] Selector variable "${n}" must be scalar.`);
281
+ function S(t, e) {
282
+ if (/^\$[A-Z_$][\w$]*$/i.test(t)) {
283
+ const n = p(t.slice(1), e);
284
+ if (n === null || typeof n == "string" || typeof n == "boolean" || typeof n == "number" && Number.isFinite(n))
285
+ return n;
286
+ throw new TypeError(`[Raph] Selector variable "${t}" must be scalar.`);
291
287
  }
292
- if (n[0] === '"' || n[0] === "'")
293
- return P(n);
294
- if (/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(n)) {
295
- const t = Number(n);
296
- if (Number.isFinite(t))
297
- return t;
288
+ if (t[0] === '"' || t[0] === "'")
289
+ return E(t);
290
+ if (/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(t)) {
291
+ const n = Number(t);
292
+ if (Number.isFinite(n))
293
+ return n;
298
294
  }
299
- return n === "true" ? !0 : n === "false" ? !1 : n === "null" ? null : n;
295
+ return t === "true" ? !0 : t === "false" ? !1 : t === "null" ? null : t;
300
296
  }
301
- function P(n) {
302
- const e = n[0];
303
- if (n.length < 2 || n[n.length - 1] !== e)
304
- throw d(n);
297
+ function E(t) {
298
+ const e = t[0];
299
+ if (t.length < 2 || t[t.length - 1] !== e)
300
+ throw l(t);
305
301
  if (e === '"')
306
302
  try {
307
- const r = JSON.parse(n);
308
- if (typeof r == "string")
309
- return r;
303
+ const i = JSON.parse(t);
304
+ if (typeof i == "string")
305
+ return i;
310
306
  } catch {
311
- throw d(n);
307
+ throw l(t);
312
308
  }
313
- let t = "";
314
- for (let r = 1; r < n.length - 1; r++) {
315
- const s = n[r];
309
+ let n = "";
310
+ for (let i = 1; i < t.length - 1; i++) {
311
+ const s = t[i];
316
312
  if (s === "\\") {
317
- if (r++, r >= n.length - 1)
318
- throw d(n);
319
- t += n[r];
313
+ if (i++, i >= t.length - 1)
314
+ throw l(t);
315
+ n += t[i];
320
316
  } else
321
- t += s;
317
+ n += s;
322
318
  }
323
- return t;
319
+ return n;
324
320
  }
325
- function N(n, e) {
326
- if (!n.startsWith("$"))
327
- return n;
328
- const t = p(n.slice(1), e);
329
- if (typeof t != "string" && typeof t != "number")
330
- throw new TypeError(`[Raph] Key variable "${n}" must be a string or number.`);
331
- const r = String(t);
332
- if (!r || r.includes(".") || r.includes("[") || r.includes("]"))
333
- throw new TypeError(`[Raph] Key variable "${n}" contains path syntax.`);
334
- return r;
321
+ function T(t, e) {
322
+ if (!t.startsWith("$"))
323
+ return t;
324
+ const n = p(t.slice(1), e);
325
+ if (typeof n != "string" && typeof n != "number")
326
+ throw new TypeError(`[Raph] Key variable "${t}" must be a string or number.`);
327
+ const i = String(n);
328
+ if (!i || i.includes(".") || i.includes("[") || i.includes("]"))
329
+ throw new TypeError(`[Raph] Key variable "${t}" contains path syntax.`);
330
+ return i;
335
331
  }
336
- function p(n, e) {
337
- if (!g(n, e))
338
- throw new TypeError(`[Raph] Missing path variable "${n}".`);
339
- return e[n];
332
+ function p(t, e) {
333
+ if (!h(t, e))
334
+ throw new TypeError(`[Raph] Missing path variable "${t}".`);
335
+ return e[t];
340
336
  }
341
- function g(n, e) {
342
- return e !== void 0 && Object.hasOwn(e, n);
337
+ function h(t, e) {
338
+ return e !== void 0 && Object.hasOwn(e, t);
343
339
  }
344
- function I(n, e) {
345
- for (const t of n.matchAll(/\$([A-Z_$][\w$]*)/gi))
346
- if (!g(t[1], e))
340
+ function R(t, e) {
341
+ for (const n of t.matchAll(/\$([A-Z_$][\w$]*)/gi))
342
+ if (!h(n[1], e))
347
343
  return !0;
348
344
  return !1;
349
345
  }
350
- function O(n) {
351
- if (typeof n != "object" || n === null)
352
- throw $();
353
- const e = n;
346
+ function A(t) {
347
+ if (typeof t != "object" || t === null)
348
+ throw k();
349
+ const e = t;
354
350
  if (e.t === "key" && typeof e.k == "string")
355
351
  return { kind: "key", key: e.k };
356
352
  if (e.t === "idx" && typeof e.i == "number" && Number.isInteger(e.i) && e.i >= 0)
357
353
  return { kind: "index", index: e.i };
358
354
  if (e.t === "wc")
359
355
  return { kind: "wildcard", indexed: e.indexed === !0 };
360
- if (e.t === "param" && typeof e.pk == "string" && M(e.pv))
356
+ if (e.t === "param" && typeof e.pk == "string" && P(e.pv))
361
357
  return { kind: "selector", key: e.pk, value: e.pv };
362
- throw $();
358
+ throw k();
363
359
  }
364
- function M(n) {
365
- return n === null || typeof n == "string" || typeof n == "boolean" || typeof n == "number" && Number.isFinite(n);
360
+ function P(t) {
361
+ return t === null || typeof t == "string" || typeof t == "boolean" || typeof t == "number" && Number.isFinite(t);
366
362
  }
367
- function b(n) {
368
- const e = n[n.length - 1];
369
- return (e == null ? void 0 : e.kind) === "wildcard" && !e.indexed;
363
+ function _(t) {
364
+ const e = t[t.length - 1];
365
+ return e?.kind === "wildcard" && !e.indexed;
370
366
  }
371
- function j(n, e) {
372
- 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);
367
+ function N(t, e) {
368
+ 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);
373
369
  }
374
- function w(n) {
370
+ function m(t) {
375
371
  let e = "";
376
- for (const t of n)
377
- t.kind === "key" ? e += e ? `.${t.key}` : t.key : t.kind === "index" ? e += `[${t.index}]` : t.kind === "selector" ? e += `[${t.key}=${C(t.value)}]` : e += t.indexed ? "[*]" : e ? ".*" : "*";
372
+ for (const n of t)
373
+ n.kind === "key" ? e += e ? `.${n.key}` : n.key : n.kind === "index" ? e += `[${n.index}]` : n.kind === "selector" ? e += `[${n.key}=${I(n.value)}]` : e += n.indexed ? "[*]" : e ? ".*" : "*";
378
374
  return e;
379
375
  }
380
- function C(n) {
381
- return typeof n == "string" ? JSON.stringify(n) : String(n);
376
+ function I(t) {
377
+ return typeof t == "string" ? JSON.stringify(t) : String(t);
382
378
  }
383
- function d(n) {
384
- return new TypeError(`[Raph] Invalid data path "${n}".`);
379
+ function l(t) {
380
+ return new TypeError(`[Raph] Invalid data path "${t}".`);
385
381
  }
386
- function $() {
382
+ function k() {
387
383
  return new TypeError("[Raph] Invalid plain DataPath representation.");
388
384
  }
389
- function y(n) {
390
- return new TypeError(`[Raph] Wildcard is only allowed in watch masks: "${n}".`);
385
+ function w(t) {
386
+ return new TypeError(`[Raph] Wildcard is only allowed in watch masks: "${t}".`);
391
387
  }
392
388
  export {
393
- k as DataPath
389
+ u as DataPath
394
390
  };
@@ -1 +1 @@
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("./pathSegmentKey.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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./pathSegmentKey.cjs");class h{_root={};add(d,n){let e=this._root;const o=[];for(const i of d.segments)if(i.kind==="wildcard"){const t=e.indexedWildcard??={};o.push({child:t,parent:e,indexedWildcard:!0}),e=t}else{const t=p.pathSegmentKey(i),a=e.exact??=new Map;let l=a.get(t);l===void 0&&(l={},a.set(t,l)),o.push({child:l,key:t,parent:e,indexedWildcard:!1}),e=l}const r=d.deep?e.deep??=new Set:e.end??=new Set;r.add(n);let s=!0;return()=>{if(s){s=!1,r.delete(n),r.size===0&&(d.deep?e.deep=void 0:e.end=void 0);for(let i=o.length-1;i>=0;i--){const t=o[i];if(!u(t.child))break;t.indexedWildcard?t.parent.indexedWildcard=void 0:(t.parent.exact.delete(t.key),t.parent.exact.size===0&&(t.parent.exact=void 0))}}}}match(d){let n=[this._root];const e=new Set;for(let o=0;o<=d.length;o++){const r=o===d.length,s=[];for(const i of n){if(f(e,i.deep),r){f(e,i.end);continue}const t=d[o],a=i.exact?.get(p.pathSegmentKey(t));a!==void 0&&s.push(a),i.indexedWildcard!==void 0&&(t.kind==="index"||t.kind==="selector")&&s.push(i.indexedWildcard)}if(r||(n=s,n.length===0))break}return e}matchAll(){const d=new Set,n=[this._root];for(;n.length;){const e=n.pop();if(f(d,e.deep),f(d,e.end),e.indexedWildcard!==void 0&&n.push(e.indexedWildcard),e.exact!==void 0)for(const o of e.exact.values())n.push(o)}return d}}function f(c,d){if(d!==void 0)for(const n of d)c.add(n)}function u(c){return c.deep===void 0&&c.end===void 0&&c.exact===void 0&&c.indexedWildcard===void 0}exports.PathRouter=h;