@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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./DataPath.cjs"),r=2e4;let c,i;function f(e,t){if(!t?.vars){const n=c?.get(e);if(n!==void 0)return n}if(typeof e!="string")return h(e,t);const a=s.DataPath._parseExactString(e,t);if(!t?.vars){const n=c??=new Map;n.size>=r&&n.clear(),n.set(e,a)}return a}function o(e){const t=i?.get(e);if(t!==void 0)return t;if(typeof e!="string")return l(e);const a=s.DataPath._parseMaskString(e),n=i??=new Map;return n.size>=r&&n.clear(),n.set(e,a),a}function u(e){if(e.segments.length===0)return["*"];const t=[`${e.canonical}.*`];for(let a=1;a<e.segments.length;a++)t.push(s.DataPath._renderSegments(e.segments.slice(0,a)));return t}function h(e,t){const a=s.DataPath.from(e,t)._asExact();if(e instanceof s.DataPath&&!t?.vars){const n=c??=new Map;n.size>=r&&n.clear(),n.set(e,a)}return a}function l(e){const t=s.DataPath.from(e)._asMask();if(e instanceof s.DataPath){const a=i??=new Map;a.size>=r&&a.clear(),a.set(e,t)}return t}exports.parseDataPath=f;exports.parsePathMask=o;exports.pathRelationMasks=u;
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { DataPath as
|
|
2
|
-
const
|
|
3
|
-
let a,
|
|
4
|
-
function
|
|
5
|
-
if (!
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
return
|
|
1
|
+
import { DataPath as s } from "./DataPath.js";
|
|
2
|
+
const c = 2e4;
|
|
3
|
+
let a, i;
|
|
4
|
+
function l(e, t) {
|
|
5
|
+
if (!t?.vars) {
|
|
6
|
+
const r = a?.get(e);
|
|
7
|
+
if (r !== void 0)
|
|
8
|
+
return r;
|
|
9
9
|
}
|
|
10
10
|
if (typeof e != "string")
|
|
11
|
-
return
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
const
|
|
15
|
-
|
|
11
|
+
return f(e, t);
|
|
12
|
+
const n = s._parseExactString(e, t);
|
|
13
|
+
if (!t?.vars) {
|
|
14
|
+
const r = a ??= /* @__PURE__ */ new Map();
|
|
15
|
+
r.size >= c && r.clear(), r.set(e, n);
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return n;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
return
|
|
19
|
+
function g(e) {
|
|
20
|
+
const t = i?.get(e);
|
|
21
|
+
if (t !== void 0)
|
|
22
|
+
return t;
|
|
23
23
|
if (typeof e != "string")
|
|
24
|
-
return
|
|
25
|
-
const
|
|
26
|
-
return
|
|
24
|
+
return o(e);
|
|
25
|
+
const n = s._parseMaskString(e), r = i ??= /* @__PURE__ */ new Map();
|
|
26
|
+
return r.size >= c && r.clear(), r.set(e, n), n;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function h(e) {
|
|
29
29
|
if (e.segments.length === 0)
|
|
30
30
|
return ["*"];
|
|
31
|
-
const
|
|
32
|
-
for (let
|
|
33
|
-
|
|
34
|
-
return
|
|
31
|
+
const t = [`${e.canonical}.*`];
|
|
32
|
+
for (let n = 1; n < e.segments.length; n++)
|
|
33
|
+
t.push(s._renderSegments(e.segments.slice(0, n)));
|
|
34
|
+
return t;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
if (e instanceof
|
|
39
|
-
const
|
|
40
|
-
|
|
36
|
+
function f(e, t) {
|
|
37
|
+
const n = s.from(e, t)._asExact();
|
|
38
|
+
if (e instanceof s && !t?.vars) {
|
|
39
|
+
const r = a ??= /* @__PURE__ */ new Map();
|
|
40
|
+
r.size >= c && r.clear(), r.set(e, n);
|
|
41
41
|
}
|
|
42
|
-
return
|
|
42
|
+
return n;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
if (e instanceof
|
|
47
|
-
const
|
|
48
|
-
|
|
44
|
+
function o(e) {
|
|
45
|
+
const t = s.from(e)._asMask();
|
|
46
|
+
if (e instanceof s) {
|
|
47
|
+
const n = i ??= /* @__PURE__ */ new Map();
|
|
48
|
+
n.size >= c && n.clear(), n.set(e, t);
|
|
49
49
|
}
|
|
50
|
-
return
|
|
50
|
+
return t;
|
|
51
51
|
}
|
|
52
52
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
l as parseDataPath,
|
|
54
|
+
g as parsePathMask,
|
|
55
|
+
h as pathRelationMasks
|
|
56
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../data-path.utils.cjs"),l=require("../PathRouter.cjs"),r=require("./derived-collection.utils.cjs"),a=2e4;class h{_router;_handles;_matches;_pending;_collections;_counter=0;get size(){return this._handles?.size??0}get pending(){return this._pending}nextId(){return`derived-${this._counter++}`}has(e){return this._handles?.has(e)??!1}values(){return this._handles?.values()??[][Symbol.iterator]()}state(e){return this._collections?.get(e)}register(e,t,s){(this._handles??=new Map).set(e.id,e),s!==void 0&&(this._collections??=new Map).set(e,{from:t,kind:s.kind,key:s.key,initialized:!1,full:!0,keys:new Set,sourceIndex:void 0,targetIndex:void 0});const i=this._router??=new l.PathRouter;this._matches=void 0,e._attachRoutes(d.pathRelationMasks(t).map(n=>i.add(d.parsePathMask(n),e)))}remove(e){const t=this._handles;t?.get(e.id)===e&&(t.delete(e.id),e._detachRoutes(),this._matches=void 0,this._pending?.delete(e),this._collections?.delete(e),this._collections?.size===0&&(this._collections=void 0),t.size===0&&(this._handles=void 0,this._router=void 0,this._pending=void 0))}queue(e){const t=this._matching(e);if(t.length===0)return;const s=this._pending??=new Set;for(const o of t){if(o.paused||o.disposed)continue;const i=this._collections?.get(o);if(i!==void 0&&i.initialized&&!i.full){const n=r.collectionMutationImpact(i.from,i.key,e);n.kind==="full"?(i.full=!0,i.keys.clear()):i.keys.add(n.key)}s.add(o)}}queueReplacement(e,t){const s=this._matching(e);if(s.length===0)return;const o=this._pending??=new Set;for(const i of s){if(i.paused||i.disposed)continue;const n=this._collections?.get(i);if(n!==void 0&&n.initialized&&!n.full&&n.from.canonical===e.canonical)for(const c of t)n.keys.add(c);else n!==void 0&&(n.full=!0,n.keys.clear());o.add(i)}}clearPendingIfEmpty(){this._pending?.size===0&&(this._pending=void 0)}dispose(){if(this._handles!==void 0)for(const e of this._handles.values())e._disposeFromKernel();this._handles=void 0,this._router=void 0,this._matches=void 0,this._pending=void 0,this._collections=void 0}_matching(e){const t=this._router;if(t===void 0)return[];let s=this._matches?.get(e.canonical);if(s!==void 0)return s;s=[...e.segments.length===0?t.matchAll():t.match(e.segments)];const o=this._matches??=new Map;return o.size>=a&&o.clear(),o.set(e.canonical,s),s}}exports.DerivedRegistry=h;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
d(this, "_pending");
|
|
15
|
-
d(this, "_collections");
|
|
16
|
-
// Формирует локальные идентификаторы derived без глобального shared state.
|
|
17
|
-
d(this, "_counter", 0);
|
|
18
|
-
}
|
|
1
|
+
import { pathRelationMasks as d, parsePathMask as l } from "../data-path.utils.js";
|
|
2
|
+
import { PathRouter as r } from "../PathRouter.js";
|
|
3
|
+
import { collectionMutationImpact as a } from "./derived-collection.utils.js";
|
|
4
|
+
const h = 2e4;
|
|
5
|
+
class g {
|
|
6
|
+
// Хранят routes, handles и инкрементальное состояние materialized derived.
|
|
7
|
+
_router;
|
|
8
|
+
_handles;
|
|
9
|
+
_matches;
|
|
10
|
+
_pending;
|
|
11
|
+
_collections;
|
|
12
|
+
// Формирует локальные идентификаторы derived без глобального shared state.
|
|
13
|
+
_counter = 0;
|
|
19
14
|
/**
|
|
20
15
|
* Возвращает число зарегистрированных записей.
|
|
21
16
|
*/
|
|
22
17
|
get size() {
|
|
23
|
-
|
|
24
|
-
return ((e = this._handles) == null ? void 0 : e.size) ?? 0;
|
|
18
|
+
return this._handles?.size ?? 0;
|
|
25
19
|
}
|
|
26
20
|
/**
|
|
27
21
|
* Возвращает очередь derived-вычислений, ожидающих стабилизации.
|
|
@@ -39,96 +33,89 @@ class z {
|
|
|
39
33
|
* Проверяет наличие derived handle с указанным id.
|
|
40
34
|
*/
|
|
41
35
|
has(e) {
|
|
42
|
-
|
|
43
|
-
return ((t = this._handles) == null ? void 0 : t.has(e)) ?? !1;
|
|
36
|
+
return this._handles?.has(e) ?? !1;
|
|
44
37
|
}
|
|
45
38
|
/**
|
|
46
39
|
* Возвращает зарегистрированные derived handles.
|
|
47
40
|
*/
|
|
48
41
|
values() {
|
|
49
|
-
|
|
50
|
-
return ((e = this._handles) == null ? void 0 : e.values()) ?? [][Symbol.iterator]();
|
|
42
|
+
return this._handles?.values() ?? [][Symbol.iterator]();
|
|
51
43
|
}
|
|
52
44
|
/**
|
|
53
45
|
* Возвращает внутреннее состояние зарегистрированного handle.
|
|
54
46
|
*/
|
|
55
47
|
state(e) {
|
|
56
|
-
|
|
57
|
-
return (t = this._collections) == null ? void 0 : t.get(e);
|
|
48
|
+
return this._collections?.get(e);
|
|
58
49
|
}
|
|
59
50
|
/**
|
|
60
51
|
* Регистрирует derived handle и его зависимости.
|
|
61
52
|
*/
|
|
62
|
-
register(e, t,
|
|
63
|
-
(this._handles
|
|
53
|
+
register(e, t, s) {
|
|
54
|
+
(this._handles ??= /* @__PURE__ */ new Map()).set(e.id, e), s !== void 0 && (this._collections ??= /* @__PURE__ */ new Map()).set(e, {
|
|
64
55
|
from: t,
|
|
65
|
-
kind:
|
|
66
|
-
key:
|
|
56
|
+
kind: s.kind,
|
|
57
|
+
key: s.key,
|
|
67
58
|
initialized: !1,
|
|
68
59
|
full: !0,
|
|
69
60
|
keys: /* @__PURE__ */ new Set(),
|
|
70
61
|
sourceIndex: void 0,
|
|
71
62
|
targetIndex: void 0
|
|
72
63
|
});
|
|
73
|
-
const
|
|
74
|
-
this._matches = void 0, e._attachRoutes(
|
|
75
|
-
(
|
|
64
|
+
const i = this._router ??= new r();
|
|
65
|
+
this._matches = void 0, e._attachRoutes(d(t).map(
|
|
66
|
+
(n) => i.add(l(n), e)
|
|
76
67
|
));
|
|
77
68
|
}
|
|
78
69
|
/**
|
|
79
70
|
* Удаляет регистрацию и связанные pending-записи.
|
|
80
71
|
*/
|
|
81
72
|
remove(e) {
|
|
82
|
-
var i, o, n;
|
|
83
73
|
const t = this._handles;
|
|
84
|
-
|
|
74
|
+
t?.get(e.id) === e && (t.delete(e.id), e._detachRoutes(), this._matches = void 0, this._pending?.delete(e), this._collections?.delete(e), this._collections?.size === 0 && (this._collections = void 0), t.size === 0 && (this._handles = void 0, this._router = void 0, this._pending = void 0));
|
|
85
75
|
}
|
|
86
76
|
/**
|
|
87
77
|
* Добавляет derived handle в очередь пересчёта.
|
|
88
78
|
*/
|
|
89
79
|
queue(e) {
|
|
90
|
-
var o;
|
|
91
80
|
const t = this._matching(e);
|
|
92
81
|
if (t.length === 0)
|
|
93
82
|
return;
|
|
94
|
-
const
|
|
95
|
-
for (const
|
|
96
|
-
if (
|
|
83
|
+
const s = this._pending ??= /* @__PURE__ */ new Set();
|
|
84
|
+
for (const o of t) {
|
|
85
|
+
if (o.paused || o.disposed)
|
|
97
86
|
continue;
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
|
|
87
|
+
const i = this._collections?.get(o);
|
|
88
|
+
if (i !== void 0 && i.initialized && !i.full) {
|
|
89
|
+
const n = a(i.from, i.key, e);
|
|
90
|
+
n.kind === "full" ? (i.full = !0, i.keys.clear()) : i.keys.add(n.key);
|
|
102
91
|
}
|
|
103
|
-
|
|
92
|
+
s.add(o);
|
|
104
93
|
}
|
|
105
94
|
}
|
|
106
95
|
/**
|
|
107
96
|
* Запоминает полную замену, которую нужно применить при стабилизации.
|
|
108
97
|
*/
|
|
109
98
|
queueReplacement(e, t) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (i.length === 0)
|
|
99
|
+
const s = this._matching(e);
|
|
100
|
+
if (s.length === 0)
|
|
113
101
|
return;
|
|
114
|
-
const o = this._pending
|
|
115
|
-
for (const
|
|
116
|
-
if (
|
|
102
|
+
const o = this._pending ??= /* @__PURE__ */ new Set();
|
|
103
|
+
for (const i of s) {
|
|
104
|
+
if (i.paused || i.disposed)
|
|
117
105
|
continue;
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
for (const
|
|
121
|
-
|
|
122
|
-
else
|
|
123
|
-
o.add(
|
|
106
|
+
const n = this._collections?.get(i);
|
|
107
|
+
if (n !== void 0 && n.initialized && !n.full && n.from.canonical === e.canonical)
|
|
108
|
+
for (const c of t)
|
|
109
|
+
n.keys.add(c);
|
|
110
|
+
else n !== void 0 && (n.full = !0, n.keys.clear());
|
|
111
|
+
o.add(i);
|
|
124
112
|
}
|
|
125
113
|
}
|
|
126
114
|
/**
|
|
127
115
|
* Сбрасывает pending-состояние после опустошения очереди.
|
|
128
116
|
*/
|
|
129
117
|
clearPendingIfEmpty() {
|
|
130
|
-
|
|
131
|
-
((e = this._pending) == null ? void 0 : e.size) === 0 && (this._pending = void 0);
|
|
118
|
+
this._pending?.size === 0 && (this._pending = void 0);
|
|
132
119
|
}
|
|
133
120
|
/**
|
|
134
121
|
* Освобождает все handles и очищает derived registry.
|
|
@@ -140,18 +127,17 @@ class z {
|
|
|
140
127
|
this._handles = void 0, this._router = void 0, this._matches = void 0, this._pending = void 0, this._collections = void 0;
|
|
141
128
|
}
|
|
142
129
|
_matching(e) {
|
|
143
|
-
var n;
|
|
144
130
|
const t = this._router;
|
|
145
131
|
if (t === void 0)
|
|
146
132
|
return [];
|
|
147
|
-
let
|
|
148
|
-
if (
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
const o = this._matches
|
|
152
|
-
return o.size >=
|
|
133
|
+
let s = this._matches?.get(e.canonical);
|
|
134
|
+
if (s !== void 0)
|
|
135
|
+
return s;
|
|
136
|
+
s = [...e.segments.length === 0 ? t.matchAll() : t.match(e.segments)];
|
|
137
|
+
const o = this._matches ??= /* @__PURE__ */ new Map();
|
|
138
|
+
return o.size >= h && o.clear(), o.set(e.canonical, s), s;
|
|
153
139
|
}
|
|
154
140
|
}
|
|
155
141
|
export {
|
|
156
|
-
|
|
142
|
+
g as DerivedRegistry
|
|
157
143
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i extends Error{constructor(e){super(`[Raph] Derived target is read-only: "${e}".`),this.name="RaphDerivedTargetWriteError"}}class o{id;options;_kernel;_removeRoutes;_paused=!1;_disposed=!1;_status="idle";_lastError=null;constructor(e,s,r){this._kernel=e,this.id=s,this.options=r}get paused(){return this._paused}get disposed(){return this._disposed}get status(){return this._status}get lastError(){return this._lastError}_recordSuccess(){this._status="success",this._lastError=null}_recordFailure(e){this._status="error",this._lastError=e instanceof Error?e:new Error(String(e))}pause(){this._assertAlive(),this._paused=!0}resume(){this._assertAlive(),this._paused=!1,this.recompute()}recompute(){this._assertAlive(),this._kernel._recomputeDerived(this)}dispose(){this._disposed||(this._disposed=!0,this._kernel._removeDerived(this),this.options.disposeTarget==="delete"&&this._kernel.delete(this.options.to))}_attachRoutes(e){this._removeRoutes=e}_detachRoutes(){const e=this._removeRoutes;if(this._removeRoutes=void 0,e!==void 0)for(const s of e)s()}_disposeFromKernel(){this._disposed=!0,this._removeRoutes=void 0}_assertAlive(){if(this._disposed)throw new Error(`[Raph] Derived "${this.id}" is disposed.`)}}exports.RaphDerivedHandle=o;exports.RaphDerivedTargetWriteError=i;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var d = (r, e, t) => e in r ? o(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
-
var s = (r, e, t) => d(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
class h extends Error {
|
|
1
|
+
class i extends Error {
|
|
5
2
|
/**
|
|
6
3
|
* Создаёт ошибку с canonical path защищённого derived target.
|
|
7
4
|
*/
|
|
@@ -9,24 +6,24 @@ class h extends Error {
|
|
|
9
6
|
super(`[Raph] Derived target is read-only: "${e}".`), this.name = "RaphDerivedTargetWriteError";
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
class
|
|
9
|
+
class o {
|
|
10
|
+
// Публикуют identity и immutable параметры materialized dependency.
|
|
11
|
+
id;
|
|
12
|
+
options;
|
|
13
|
+
// Связывают handle с owning Kernel и зарегистрированными source routes.
|
|
14
|
+
_kernel;
|
|
15
|
+
_removeRoutes;
|
|
16
|
+
// Хранят lifecycle и результат последнего вычисления.
|
|
17
|
+
_paused = !1;
|
|
18
|
+
_disposed = !1;
|
|
19
|
+
_status = "idle";
|
|
20
|
+
_lastError = null;
|
|
13
21
|
/**
|
|
14
22
|
* Создаёт internal handle, которым управляет owning Kernel.
|
|
15
23
|
* @internal
|
|
16
24
|
*/
|
|
17
|
-
constructor(e,
|
|
18
|
-
|
|
19
|
-
s(this, "id");
|
|
20
|
-
s(this, "options");
|
|
21
|
-
// Связывают handle с owning Kernel и зарегистрированными source routes.
|
|
22
|
-
s(this, "_kernel");
|
|
23
|
-
s(this, "_removeRoutes");
|
|
24
|
-
// Хранят lifecycle и результат последнего вычисления.
|
|
25
|
-
s(this, "_paused", !1);
|
|
26
|
-
s(this, "_disposed", !1);
|
|
27
|
-
s(this, "_status", "idle");
|
|
28
|
-
s(this, "_lastError", null);
|
|
29
|
-
this._kernel = e, this.id = t, this.options = i;
|
|
25
|
+
constructor(e, s, r) {
|
|
26
|
+
this._kernel = e, this.id = s, this.options = r;
|
|
30
27
|
}
|
|
31
28
|
/**
|
|
32
29
|
* Показывает, приостановлено ли derived-вычисление.
|
|
@@ -104,8 +101,8 @@ class u {
|
|
|
104
101
|
_detachRoutes() {
|
|
105
102
|
const e = this._removeRoutes;
|
|
106
103
|
if (this._removeRoutes = void 0, e !== void 0)
|
|
107
|
-
for (const
|
|
108
|
-
|
|
104
|
+
for (const s of e)
|
|
105
|
+
s();
|
|
109
106
|
}
|
|
110
107
|
/**
|
|
111
108
|
* Помечает handle освобождённым после cleanup owning Kernel.
|
|
@@ -120,6 +117,6 @@ class u {
|
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
119
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
o as RaphDerivedHandle,
|
|
121
|
+
i as RaphDerivedTargetWriteError
|
|
125
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../data-path.utils.cjs");function m(e,t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../data-path.utils.cjs");function m(e,t,o){if(o.segments.length<=e.segments.length)return{kind:"full"};for(let r=0;r<e.segments.length;r++)if(!$(e.segments[r],o.segments[r]))return{kind:"full"};const i=o.segments[e.segments.length];if(i?.kind!=="selector"||i.key!==t||typeof i.value!="string"&&typeof i.value!="number")return{kind:"full"};const n=o.segments[e.segments.length+1];return n?.kind==="key"&&n.key===t?{kind:"full"}:{kind:"key",key:i.value}}function k(e,t,o){const i=p.parseDataPath(e).canonical,n=typeof o=="number"?String(o):JSON.stringify(o);return`${i}[${t}=${n}]`}function g(e,t,o,i){if(!Array.isArray(o)||!Array.isArray(i))throw f(e,"requires array source and output");if(o.length!==i.length)throw f(e,"must preserve collection cardinality");const n=a(o,t,"source"),r=a(i,t,"output");for(let s=0;s<n.length;s++)if(n[s]!==r[s])throw f(e,"must preserve key order")}function h(e,t,o,i){if(!Array.isArray(i))throw f(e,"incremental compute must return an array");if(o.length!==i.length)throw f(e,"incremental compute must preserve cardinality");const n=a(i,t,"output");for(let r=0;r<o.length;r++)if(o[r]!==n[r])throw f(e,"incremental compute must preserve key order")}function w(e,t,o,i){if(!Array.isArray(o)||!Array.isArray(i))throw u(e,"requires array source and output");d(e,"output must be an ordered subset of source",a(o,t,"source"),a(i,t,"output"))}function b(e,t,o,i){if(!Array.isArray(i))throw u(e,"incremental compute must return an array");d(e,"incremental output must be an ordered subset of input",o,a(i,t,"output"))}function a(e,t,o){const i=new Set,n=[];for(let r=0;r<e.length;r++){if(!(r in e)){n.push(void 0);continue}const s=e[r];if(!y(s))throw new TypeError(`[Raph] ${o} collection items must be objects.`);const c=s[t];if(typeof c!="string"&&typeof c!="number")throw new TypeError(`[Raph] ${o} item key "${t}" must be a string or number.`);if(i.has(c))throw new TypeError(`[Raph] Duplicate ${o} key: "${String(c)}".`);i.add(c),n.push(c)}return n}function A(e,t,o){const i=a(e,t,o),n=new Map;for(let r=0;r<i.length;r++){const s=i[r];s!==void 0&&n.set(s,r)}return n}function x(e,t,o,i){for(const n of i){const r=o.get(n);if(r===void 0)return!0;const s=e[r];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,o,i){const n=new Map;for(let s=0;s<o.length;s++){const c=o[s];c!==void 0&&n.set(c,s)}let r=-1;for(const s of i){if(s===void 0)continue;const c=n.get(s);if(c===void 0||c<=r)throw u(e,t);r=c}}function l(e,t){if(e===null||typeof e!="object")return e;const o=t.get(e);if(o!==void 0)return o;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[r,s]of e)n.set(l(r,t),l(s,t));return n}if(e instanceof Set){const n=new Set;t.set(e,n);for(const r of e)n.add(l(r,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 r=0;r<e.length;r++)r in e&&(n[r]=l(e[r],t));return n}const i=Object.create(Object.getPrototypeOf(e));t.set(e,i);for(const n of Reflect.ownKeys(e))i[n]=l(e[n],t);return i}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;
|