@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.
- package/dist/{core-CyilRD7s.js → core-CClhT8WR.js} +389 -400
- package/dist/core-cPQWYD4K.cjs +1 -0
- package/dist/debug/api/Raph.cjs +1 -1
- package/dist/debug/api/Raph.js +46 -47
- package/dist/debug/api/RaphFacadeSession.cjs +1 -1
- package/dist/debug/api/RaphFacadeSession.js +85 -89
- package/dist/debug/api/RaphReactivityInstance.cjs +1 -1
- package/dist/debug/api/RaphReactivityInstance.js +27 -30
- package/dist/debug/path/DataPath.cjs +1 -1
- package/dist/debug/path/DataPath.js +198 -202
- package/dist/debug/path/PathRouter.cjs +1 -1
- package/dist/debug/path/PathRouter.js +44 -50
- package/dist/debug/path/RaphKernel.cjs +1 -1
- package/dist/debug/path/RaphKernel.js +257 -228
- package/dist/debug/path/data-path.utils.cjs +1 -1
- package/dist/debug/path/data-path.utils.js +41 -41
- package/dist/debug/path/derived/DerivedRegistry.cjs +1 -1
- package/dist/debug/path/derived/DerivedRegistry.js +52 -66
- package/dist/debug/path/derived/RaphDerivedHandle.cjs +1 -1
- package/dist/debug/path/derived/RaphDerivedHandle.js +19 -22
- package/dist/debug/path/derived/derived-collection.utils.cjs +1 -1
- package/dist/debug/path/derived/derived-collection.utils.js +70 -70
- package/dist/debug/path/meta/MetaController.cjs +1 -1
- package/dist/debug/path/meta/MetaController.js +57 -65
- package/dist/debug/path/meta/RaphMeta.cjs +1 -1
- package/dist/debug/path/meta/RaphMeta.js +26 -32
- package/dist/debug/path/meta/RaphMetaStore.cjs +1 -1
- package/dist/debug/path/meta/RaphMetaStore.js +24 -30
- package/dist/debug/path/storage/AdapterPathStore.cjs +1 -1
- package/dist/debug/path/storage/AdapterPathStore.js +49 -54
- package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -1
- package/dist/debug/path/storage/DefaultDataAdapter.js +46 -56
- package/dist/debug/path/storage/PathEventHub.cjs +1 -1
- package/dist/debug/path/storage/PathEventHub.js +74 -61
- package/dist/debug/path/storage/PathStore.cjs +1 -1
- package/dist/debug/path/storage/PathStore.js +89 -99
- package/dist/debug/path/storage/createDataDraft.cjs +1 -1
- package/dist/debug/path/storage/createDataDraft.js +24 -28
- package/dist/debug/reactivity/disposal.cjs +1 -0
- package/dist/debug/reactivity/disposal.js +32 -0
- package/dist/debug/reactivity/engine.cjs +1 -1
- package/dist/debug/reactivity/engine.js +787 -392
- package/dist/debug/reactivity/reactive-object.cjs +1 -1
- package/dist/debug/reactivity/reactive-object.js +81 -96
- package/dist/debug/reactivity/scope.cjs +1 -1
- package/dist/debug/reactivity/scope.js +221 -117
- package/dist/debug/reactivity/watch.cjs +1 -1
- package/dist/debug/reactivity/watch.js +1 -1
- package/dist/debug/runtime/RaphRuntime.cjs +1 -1
- package/dist/debug/runtime/RaphRuntime.js +764 -411
- package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -1
- package/dist/debug/runtime/diagnostics/RaphDebug.js +90 -100
- package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -1
- package/dist/debug/runtime/ownership/RaphEffectScope.js +215 -82
- package/dist/debug/runtime/ownership/RaphNode.cjs +1 -1
- package/dist/debug/runtime/ownership/RaphNode.js +595 -136
- package/dist/debug/runtime/ownership/RaphScope.cjs +1 -1
- package/dist/debug/runtime/ownership/RaphScope.js +203 -68
- package/dist/debug/runtime/phases/RaphFrameLoop.cjs +1 -1
- package/dist/debug/runtime/phases/RaphFrameLoop.js +13 -17
- package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -1
- package/dist/debug/runtime/phases/RaphPhasePipeline.js +618 -357
- package/dist/debug/runtime/phases/RaphPhaseTaskRecord.cjs +1 -0
- package/dist/debug/runtime/phases/RaphPhaseTaskRecord.js +176 -0
- package/dist/debug/runtime/phases/RaphPhaseWatch.cjs +1 -0
- package/dist/debug/runtime/phases/RaphPhaseWatch.js +20 -0
- package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -1
- package/dist/debug/runtime/reactivity/PathHandle.js +50 -60
- package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -1
- package/dist/debug/runtime/reactivity/RaphMetaSource.js +28 -32
- package/dist/debug/runtime/reactivity/RaphSelector.cjs +1 -0
- package/dist/debug/runtime/reactivity/RaphSelector.js +503 -0
- package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -1
- package/dist/debug/runtime/reactivity/RaphWorkGraph.js +541 -379
- package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -1
- package/dist/debug/runtime/reactivity/RuntimeReactivity.js +484 -90
- package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -1
- package/dist/debug/runtime/reactivity/RuntimeWatch.js +33 -44
- package/dist/debug/runtime/reactivity/disposal-sweep.utils.cjs +1 -0
- package/dist/debug/runtime/reactivity/disposal-sweep.utils.js +42 -0
- package/dist/entrypoints/runtime.d.ts +2 -1
- package/dist/machine-testing.cjs +1 -1
- package/dist/machine-testing.js +1 -1
- package/dist/machine.cjs +1 -1
- package/dist/machine.js +216 -231
- package/dist/path/RaphKernel.d.ts +24 -0
- package/dist/path/storage/PathEventHub.d.ts +14 -0
- package/dist/path/storage/PathStore.d.ts +4 -4
- package/dist/reactivity/disposal.d.ts +14 -0
- package/dist/reactivity/engine.d.ts +177 -4
- package/dist/reactivity/scope.d.ts +108 -30
- package/dist/runtime/RaphRuntime.d.ts +236 -17
- package/dist/runtime/ownership/RaphEffectScope.d.ts +70 -1
- package/dist/runtime/ownership/RaphNode.d.ts +276 -6
- package/dist/runtime/ownership/RaphScope.d.ts +144 -14
- package/dist/runtime/phases/RaphPhasePipeline.d.ts +202 -28
- package/dist/runtime/phases/RaphPhaseTaskRecord.d.ts +195 -0
- package/dist/runtime/phases/RaphPhaseWatch.d.ts +22 -0
- package/dist/runtime/phases/phase.types.d.ts +83 -4
- package/dist/runtime/reactivity/RaphSelector.d.ts +338 -0
- package/dist/runtime/reactivity/RaphWorkGraph.d.ts +163 -25
- package/dist/runtime/reactivity/RuntimeReactivity.d.ts +258 -10
- package/dist/runtime/reactivity/RuntimeWatch.d.ts +8 -8
- package/dist/runtime/reactivity/disposal-sweep.utils.d.ts +19 -0
- package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +48 -3
- package/package.json +9 -1
- package/dist/core-ugchZNqC.cjs +0 -1
|
@@ -1,60 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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,
|
|
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
|
-
|
|
15
|
+
n.map((i) => Object.freeze({ ...i }))
|
|
17
16
|
);
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Нормализует поддерживаемое определение пути в DataPath.
|
|
21
20
|
*/
|
|
22
|
-
static from(e,
|
|
23
|
-
return e instanceof u ? e : typeof e == "string" ? this.fromString(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,
|
|
29
|
-
const
|
|
27
|
+
static fromString(e, n) {
|
|
28
|
+
const i = g(
|
|
30
29
|
e,
|
|
31
|
-
|
|
30
|
+
n?.vars,
|
|
32
31
|
!0,
|
|
33
|
-
|
|
32
|
+
n?.wildcardDynamic === !0,
|
|
34
33
|
!0
|
|
35
|
-
), s = this._cache
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
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(
|
|
40
|
-
return s.set(
|
|
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
|
|
47
|
-
return new u(
|
|
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,
|
|
54
|
-
const
|
|
52
|
+
static _parseExactString(e, n) {
|
|
53
|
+
const i = g(e, n?.vars, !1, !1, !0);
|
|
55
54
|
return {
|
|
56
|
-
canonical:
|
|
57
|
-
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
|
|
66
|
-
for (let
|
|
67
|
-
const c =
|
|
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
|
|
72
|
+
const i = n.segments[n.segments.length - 1], s = i?.kind === "wildcard" && !i.indexed;
|
|
74
73
|
return {
|
|
75
|
-
canonical:
|
|
74
|
+
canonical: n.canonical,
|
|
76
75
|
deep: s,
|
|
77
|
-
segments: s ?
|
|
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
|
|
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:
|
|
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,
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
for (;
|
|
121
|
-
const c = r
|
|
122
|
-
if (c.kind === "wildcard" && !c.indexed &&
|
|
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[
|
|
125
|
-
if (a === void 0 || !
|
|
123
|
+
const a = s[r];
|
|
124
|
+
if (a === void 0 || !N(c, a))
|
|
126
125
|
return !1;
|
|
127
126
|
}
|
|
128
|
-
return
|
|
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
|
|
138
|
-
return 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
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
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 =
|
|
156
|
-
return 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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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,
|
|
175
|
-
for (; a <
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
if (
|
|
179
|
-
throw
|
|
180
|
-
|
|
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 (
|
|
184
|
-
const
|
|
185
|
-
c.push(
|
|
186
|
-
|
|
179
|
+
if (y === "[") {
|
|
180
|
+
const x = b(r, a);
|
|
181
|
+
c.push($(
|
|
182
|
+
r.slice(a + 1, x),
|
|
187
183
|
e,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
)), a =
|
|
184
|
+
n,
|
|
185
|
+
i
|
|
186
|
+
)), a = x + 1, o = !1;
|
|
191
187
|
continue;
|
|
192
188
|
}
|
|
193
|
-
if (!
|
|
194
|
-
throw
|
|
195
|
-
let
|
|
196
|
-
for (;
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
throw
|
|
201
|
-
if (
|
|
202
|
-
if (!
|
|
203
|
-
throw
|
|
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
|
|
206
|
-
a =
|
|
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 (
|
|
209
|
-
throw
|
|
210
|
-
return { canonical:
|
|
204
|
+
if (o || c.length === 0)
|
|
205
|
+
throw l(t);
|
|
206
|
+
return { canonical: m(c), segments: c };
|
|
211
207
|
}
|
|
212
|
-
function
|
|
213
|
-
let
|
|
214
|
-
for (let s = e + 1; s <
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
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 (
|
|
221
|
-
|
|
216
|
+
if (n !== void 0) {
|
|
217
|
+
r === n && (n = void 0);
|
|
222
218
|
continue;
|
|
223
219
|
}
|
|
224
|
-
if (
|
|
225
|
-
|
|
220
|
+
if (r === '"' || r === "'") {
|
|
221
|
+
n = r;
|
|
226
222
|
continue;
|
|
227
223
|
}
|
|
228
|
-
if (
|
|
229
|
-
|
|
224
|
+
if (r === "[") {
|
|
225
|
+
i++;
|
|
230
226
|
continue;
|
|
231
227
|
}
|
|
232
|
-
if (
|
|
228
|
+
if (r === "]" && --i === 0)
|
|
233
229
|
return s;
|
|
234
230
|
}
|
|
235
|
-
throw
|
|
231
|
+
throw l(t);
|
|
236
232
|
}
|
|
237
|
-
function
|
|
238
|
-
const s =
|
|
233
|
+
function $(t, e, n, i) {
|
|
234
|
+
const s = t.trim();
|
|
239
235
|
if (s === "*") {
|
|
240
|
-
if (!
|
|
241
|
-
throw
|
|
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 (
|
|
243
|
+
if (i && !h(s.slice(1), e))
|
|
248
244
|
return { kind: "wildcard", indexed: !0 };
|
|
249
|
-
const
|
|
250
|
-
if (!Number.isInteger(
|
|
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:
|
|
248
|
+
return { kind: "index", index: o };
|
|
253
249
|
}
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
throw
|
|
257
|
-
const c = s.slice(0,
|
|
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
|
|
260
|
-
return
|
|
255
|
+
throw l(`[${t}]`);
|
|
256
|
+
return i && R(a, e) ? { kind: "wildcard", indexed: !0 } : {
|
|
261
257
|
kind: "selector",
|
|
262
258
|
key: c,
|
|
263
|
-
value:
|
|
259
|
+
value: S(a, e)
|
|
264
260
|
};
|
|
265
261
|
}
|
|
266
|
-
function
|
|
262
|
+
function v(t) {
|
|
267
263
|
let e;
|
|
268
|
-
for (let
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
|
|
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
|
-
|
|
271
|
+
i === e && (e = void 0);
|
|
276
272
|
continue;
|
|
277
273
|
}
|
|
278
|
-
if (
|
|
279
|
-
e =
|
|
280
|
-
else if (
|
|
281
|
-
return
|
|
274
|
+
if (i === '"' || i === "'")
|
|
275
|
+
e = i;
|
|
276
|
+
else if (i === "=")
|
|
277
|
+
return n;
|
|
282
278
|
}
|
|
283
279
|
return -1;
|
|
284
280
|
}
|
|
285
|
-
function
|
|
286
|
-
if (/^\$[A-Z_$][\w$]*$/i.test(
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
return
|
|
290
|
-
throw new TypeError(`[Raph] Selector variable "${
|
|
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 (
|
|
293
|
-
return
|
|
294
|
-
if (/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(
|
|
295
|
-
const
|
|
296
|
-
if (Number.isFinite(
|
|
297
|
-
return
|
|
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
|
|
295
|
+
return t === "true" ? !0 : t === "false" ? !1 : t === "null" ? null : t;
|
|
300
296
|
}
|
|
301
|
-
function
|
|
302
|
-
const e =
|
|
303
|
-
if (
|
|
304
|
-
throw
|
|
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
|
|
308
|
-
if (typeof
|
|
309
|
-
return
|
|
303
|
+
const i = JSON.parse(t);
|
|
304
|
+
if (typeof i == "string")
|
|
305
|
+
return i;
|
|
310
306
|
} catch {
|
|
311
|
-
throw
|
|
307
|
+
throw l(t);
|
|
312
308
|
}
|
|
313
|
-
let
|
|
314
|
-
for (let
|
|
315
|
-
const s =
|
|
309
|
+
let n = "";
|
|
310
|
+
for (let i = 1; i < t.length - 1; i++) {
|
|
311
|
+
const s = t[i];
|
|
316
312
|
if (s === "\\") {
|
|
317
|
-
if (
|
|
318
|
-
throw
|
|
319
|
-
|
|
313
|
+
if (i++, i >= t.length - 1)
|
|
314
|
+
throw l(t);
|
|
315
|
+
n += t[i];
|
|
320
316
|
} else
|
|
321
|
-
|
|
317
|
+
n += s;
|
|
322
318
|
}
|
|
323
|
-
return
|
|
319
|
+
return n;
|
|
324
320
|
}
|
|
325
|
-
function
|
|
326
|
-
if (!
|
|
327
|
-
return
|
|
328
|
-
const
|
|
329
|
-
if (typeof
|
|
330
|
-
throw new TypeError(`[Raph] Key variable "${
|
|
331
|
-
const
|
|
332
|
-
if (!
|
|
333
|
-
throw new TypeError(`[Raph] Key variable "${
|
|
334
|
-
return
|
|
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(
|
|
337
|
-
if (!
|
|
338
|
-
throw new TypeError(`[Raph] Missing path variable "${
|
|
339
|
-
return e[
|
|
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
|
|
342
|
-
return e !== void 0 && Object.hasOwn(e,
|
|
337
|
+
function h(t, e) {
|
|
338
|
+
return e !== void 0 && Object.hasOwn(e, t);
|
|
343
339
|
}
|
|
344
|
-
function
|
|
345
|
-
for (const
|
|
346
|
-
if (!
|
|
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
|
|
351
|
-
if (typeof
|
|
352
|
-
throw
|
|
353
|
-
const e =
|
|
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" &&
|
|
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
|
|
365
|
-
return
|
|
360
|
+
function P(t) {
|
|
361
|
+
return t === null || typeof t == "string" || typeof t == "boolean" || typeof t == "number" && Number.isFinite(t);
|
|
366
362
|
}
|
|
367
|
-
function
|
|
368
|
-
const e =
|
|
369
|
-
return
|
|
363
|
+
function _(t) {
|
|
364
|
+
const e = t[t.length - 1];
|
|
365
|
+
return e?.kind === "wildcard" && !e.indexed;
|
|
370
366
|
}
|
|
371
|
-
function
|
|
372
|
-
return
|
|
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
|
|
370
|
+
function m(t) {
|
|
375
371
|
let e = "";
|
|
376
|
-
for (const
|
|
377
|
-
|
|
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
|
|
381
|
-
return typeof
|
|
376
|
+
function I(t) {
|
|
377
|
+
return typeof t == "string" ? JSON.stringify(t) : String(t);
|
|
382
378
|
}
|
|
383
|
-
function
|
|
384
|
-
return new TypeError(`[Raph] Invalid data path "${
|
|
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
|
|
390
|
-
return new TypeError(`[Raph] Wildcard is only allowed in watch masks: "${
|
|
385
|
+
function w(t) {
|
|
386
|
+
return new TypeError(`[Raph] Wildcard is only allowed in watch masks: "${t}".`);
|
|
391
387
|
}
|
|
392
388
|
export {
|
|
393
|
-
|
|
389
|
+
u as DataPath
|
|
394
390
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
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;
|