@raphy-js/raph 1.0.0-dev.2
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/LICENSE +202 -0
- package/ReadMe.md +153 -0
- package/dist/api/Raph.d.ts +228 -0
- package/dist/api/errors.d.ts +20 -0
- package/dist/api/public.d.ts +22 -0
- package/dist/api/types.d.ts +25 -0
- package/dist/debug/api/Raph.cjs +1 -0
- package/dist/debug/api/Raph.js +419 -0
- package/dist/debug/api/errors.cjs +1 -0
- package/dist/debug/api/errors.js +14 -0
- package/dist/debug/api/public.cjs +1 -0
- package/dist/debug/api/public.js +40 -0
- package/dist/debug/api/types.cjs +1 -0
- package/dist/debug/api/types.js +1 -0
- package/dist/debug/path/AdapterPathStore.cjs +1 -0
- package/dist/debug/path/AdapterPathStore.js +133 -0
- package/dist/debug/path/DerivedRegistry.cjs +1 -0
- package/dist/debug/path/DerivedRegistry.js +157 -0
- package/dist/debug/path/MetaController.cjs +1 -0
- package/dist/debug/path/MetaController.js +214 -0
- package/dist/debug/path/PathEventHub.cjs +1 -0
- package/dist/debug/path/PathEventHub.js +148 -0
- package/dist/debug/path/PathStore.cjs +1 -0
- package/dist/debug/path/PathStore.js +326 -0
- package/dist/debug/path/RaphDerivedHandle.cjs +1 -0
- package/dist/debug/path/RaphDerivedHandle.js +125 -0
- package/dist/debug/path/RaphKernel.cjs +1 -0
- package/dist/debug/path/RaphKernel.js +636 -0
- package/dist/debug/path/RaphMeta.cjs +1 -0
- package/dist/debug/path/RaphMeta.js +68 -0
- package/dist/debug/path/RaphMetaStore.cjs +1 -0
- package/dist/debug/path/RaphMetaStore.js +184 -0
- package/dist/debug/path/data-adapter.cjs +1 -0
- package/dist/debug/path/data-adapter.js +356 -0
- package/dist/debug/path/data-draft.cjs +1 -0
- package/dist/debug/path/data-draft.js +71 -0
- package/dist/debug/path/data-path.cjs +1 -0
- package/dist/debug/path/data-path.js +423 -0
- package/dist/debug/path/derived-collection.cjs +1 -0
- package/dist/debug/path/derived-collection.js +179 -0
- package/dist/debug/path/derived-strategies.cjs +1 -0
- package/dist/debug/path/derived-strategies.js +20 -0
- package/dist/debug/path/meta.types.cjs +1 -0
- package/dist/debug/path/meta.types.js +1 -0
- package/dist/debug/path/path-router.cjs +1 -0
- package/dist/debug/path/path-router.js +86 -0
- package/dist/debug/path/path.types.cjs +1 -0
- package/dist/debug/path/path.types.js +1 -0
- package/dist/debug/path/public.cjs +1 -0
- package/dist/debug/path/public.js +18 -0
- package/dist/debug/path/segment-key.cjs +1 -0
- package/dist/debug/path/segment-key.js +12 -0
- package/dist/debug/reactivity/engine.cjs +1 -0
- package/dist/debug/reactivity/engine.js +1133 -0
- package/dist/debug/reactivity/scope.cjs +1 -0
- package/dist/debug/reactivity/scope.js +274 -0
- package/dist/debug/reactivity/types.cjs +1 -0
- package/dist/debug/reactivity/types.js +1 -0
- package/dist/debug/reactivity/watch.cjs +1 -0
- package/dist/debug/reactivity/watch.js +64 -0
- package/dist/debug/runtime/PathHandle.cjs +1 -0
- package/dist/debug/runtime/PathHandle.js +139 -0
- package/dist/debug/runtime/RaphDebug.cjs +1 -0
- package/dist/debug/runtime/RaphDebug.js +15 -0
- package/dist/debug/runtime/RaphFrameLoop.cjs +1 -0
- package/dist/debug/runtime/RaphFrameLoop.js +106 -0
- package/dist/debug/runtime/RaphNode.cjs +1 -0
- package/dist/debug/runtime/RaphNode.js +143 -0
- package/dist/debug/runtime/RaphPhasePipeline.cjs +1 -0
- package/dist/debug/runtime/RaphPhasePipeline.js +526 -0
- package/dist/debug/runtime/RaphRuntime.cjs +1 -0
- package/dist/debug/runtime/RaphRuntime.js +700 -0
- package/dist/debug/runtime/RaphScope.cjs +1 -0
- package/dist/debug/runtime/RaphScope.js +64 -0
- package/dist/debug/runtime/RuntimeReactivity.cjs +1 -0
- package/dist/debug/runtime/RuntimeReactivity.js +154 -0
- package/dist/debug/runtime/RuntimeWatch.cjs +1 -0
- package/dist/debug/runtime/RuntimeWatch.js +71 -0
- package/dist/debug/runtime/disposal.cjs +1 -0
- package/dist/debug/runtime/disposal.js +9 -0
- package/dist/debug/runtime/errors.cjs +1 -0
- package/dist/debug/runtime/errors.js +12 -0
- package/dist/debug/runtime/parent-graph.cjs +1 -0
- package/dist/debug/runtime/parent-graph.js +10 -0
- package/dist/debug/runtime/phase.types.cjs +1 -0
- package/dist/debug/runtime/phase.types.js +8 -0
- package/dist/debug/runtime/public.cjs +1 -0
- package/dist/debug/runtime/public.js +18 -0
- package/dist/debug/runtime/runtime-reactivity.types.cjs +1 -0
- package/dist/debug/runtime/runtime-reactivity.types.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +40 -0
- package/dist/path/AdapterPathStore.d.ts +45 -0
- package/dist/path/DerivedRegistry.d.ts +67 -0
- package/dist/path/MetaController.d.ts +85 -0
- package/dist/path/PathEventHub.d.ts +48 -0
- package/dist/path/PathStore.d.ts +51 -0
- package/dist/path/RaphDerivedHandle.d.ts +97 -0
- package/dist/path/RaphKernel.d.ts +166 -0
- package/dist/path/RaphMeta.d.ts +45 -0
- package/dist/path/RaphMetaStore.d.ts +45 -0
- package/dist/path/data-adapter.d.ts +78 -0
- package/dist/path/data-draft.d.ts +4 -0
- package/dist/path/data-path.d.ts +97 -0
- package/dist/path/derived-collection.d.ts +30 -0
- package/dist/path/derived-strategies.d.ts +15 -0
- package/dist/path/meta.types.d.ts +33 -0
- package/dist/path/path-router.d.ts +21 -0
- package/dist/path/path.types.d.ts +26 -0
- package/dist/path/public.d.ts +14 -0
- package/dist/path/segment-key.d.ts +2 -0
- package/dist/path.cjs +1 -0
- package/dist/path.js +18 -0
- package/dist/raph.cjs +1 -0
- package/dist/raph.js +40 -0
- package/dist/reactivity/engine.d.ts +379 -0
- package/dist/reactivity/scope.d.ts +146 -0
- package/dist/reactivity/types.d.ts +150 -0
- package/dist/reactivity/watch.d.ts +15 -0
- package/dist/reactivity.cjs +1 -0
- package/dist/reactivity.js +14 -0
- package/dist/runtime/PathHandle.d.ts +72 -0
- package/dist/runtime/RaphDebug.d.ts +32 -0
- package/dist/runtime/RaphFrameLoop.d.ts +51 -0
- package/dist/runtime/RaphNode.d.ts +68 -0
- package/dist/runtime/RaphPhasePipeline.d.ts +133 -0
- package/dist/runtime/RaphRuntime.d.ts +285 -0
- package/dist/runtime/RaphScope.d.ts +50 -0
- package/dist/runtime/RuntimeReactivity.d.ts +40 -0
- package/dist/runtime/RuntimeWatch.d.ts +28 -0
- package/dist/runtime/disposal.d.ts +1 -0
- package/dist/runtime/errors.d.ts +16 -0
- package/dist/runtime/parent-graph.d.ts +5 -0
- package/dist/runtime/phase.types.d.ts +49 -0
- package/dist/runtime/public.d.ts +13 -0
- package/dist/runtime/runtime-reactivity.types.d.ts +9 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.js +18 -0
- package/package.json +109 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var n = (e, s, t) => s in e ? o(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
3
|
+
var h = (e, s, t) => n(e, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { ScopeNode as p } from "../reactivity/scope.js";
|
|
5
|
+
import { RaphDisposedError as u } from "./errors.js";
|
|
6
|
+
class m extends p {
|
|
7
|
+
/**
|
|
8
|
+
* Создаёт lifecycle scope внутри указанного runtime.
|
|
9
|
+
*/
|
|
10
|
+
constructor(t, i) {
|
|
11
|
+
super(i._getReactivity());
|
|
12
|
+
// Публикуют identity scope и единственного runtime-owner.
|
|
13
|
+
h(this, "id");
|
|
14
|
+
h(this, "runtime");
|
|
15
|
+
this.id = t, this.runtime = i, i._registerOwner(this);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Создаёт writable signal, принадлежащий указанному owner.
|
|
19
|
+
*/
|
|
20
|
+
signal(t) {
|
|
21
|
+
return this._assertAlive(), this.runtime.signal(t, this);
|
|
22
|
+
}
|
|
23
|
+
computed(t) {
|
|
24
|
+
return this._assertAlive(), typeof t == "function" ? this.runtime.computed(t, this) : this.runtime.computed(t, this);
|
|
25
|
+
}
|
|
26
|
+
effect(t, i, r) {
|
|
27
|
+
return this._assertAlive(), typeof t == "string" ? this.runtime.effect(t, i, r, this) : this.runtime.effect(t, this);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Подписывает callback и привязывает disposer к lifecycle scope.
|
|
31
|
+
*/
|
|
32
|
+
watch(t, i, r) {
|
|
33
|
+
return this._assertAlive(), this.runtime.watch(t, i, r, this);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Создаёт action, выполнение которой привязано к lifecycle scope.
|
|
37
|
+
*/
|
|
38
|
+
action(t, i) {
|
|
39
|
+
return this._assertAlive(), this.runtime.action(t, i, this);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Выполняет runtime cleanup после освобождения scope.
|
|
43
|
+
*/
|
|
44
|
+
_afterDispose() {
|
|
45
|
+
this.runtime._unregisterOwner(this);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Возвращает диагностическое сообщение для освобождённого scope.
|
|
49
|
+
*/
|
|
50
|
+
_disposalMessage() {
|
|
51
|
+
return `[Raph] Scope "${this.id}" disposal failed.`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Запрещает операции после начала освобождения scope.
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
_assertAlive() {
|
|
58
|
+
if (this._disposed || this._disposing)
|
|
59
|
+
throw new u(`[Raph] Owner "${this.id}" is disposed.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
m as RaphScope
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _=Object.defineProperty;var f=(u,e,i)=>e in u?_(u,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[e]=i;var a=(u,e,i)=>f(u,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../reactivity/engine.cjs");let c;class o{constructor(){a(this,"_active")}bind(e){const i=this._active;if(i===void 0)return{schedule:e,dispose:b};const t=i.binding(e);if(i.initial==="scheduled")return t;let s=!0;return{dispose:t.dispose,schedule:()=>{if(!s){t.schedule();return}s=!1,e()}}}runWith(e,i,t){const s=this._active;this._active=e===void 0?void 0:{binding:e,initial:i};try{return t()}finally{this._active=s}}}class g extends p.RaphReactivity{constructor(i){const t=new o;super({effectScheduler:{bind:t.bind.bind(t)}});a(this,"_bindings");this._lifecycle=i,this._bindings=t}withEffectBinding(i,t,s){return this._bindings.runWith(i,t,s)}untrackedWithOwner(i){const t=c;c=void 0;try{return this.untracked(i)}finally{c=t}}getActiveOwner(){return c==null?void 0:c.owner}runWithOwner(i,t){const s=c;c=i;try{return t()}finally{c=s}}signalForOwner(i,t){const s=this._lifecycle,r=t===void 0?this.signal(i):t._adoptSource(this._ownedSignal(i)),v=s.assertWriteAllowed,h=s.runWrite??y;return v!==void 0?{get(){return l(s),t==null||t._assertAlive(),r.get()},peek(){return n(s),t==null||t._assertAlive(),r.peek()},set(d){t==null||t._assertAlive(),v(),h(()=>r.set(d))}}:{get(){return l(s),t==null||t._assertAlive(),r.get()},peek(){return n(s),t==null||t._assertAlive(),r.peek()},set(d){n(s),t==null||t._assertAlive(),h(()=>r.set(d))}}}computedForOwner(i,t){const s=this._lifecycle,r=t===void 0?this.computed(i):t._adoptSource(this._ownedComputed(i));return{get(){return l(s),t==null||t._assertAlive(),r.get()},peek(){return n(s),t==null||t._assertAlive(),r.peek()}}}}function n(u){u.owner===void 0&&u.throwDisposed()}function l(u){n(u);const e=c;e!==void 0&&e!==u&&u.throwCrossRuntime(e.owner)}function y(u){return u()}function b(){}exports.RuntimeReactivity=g;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var _ = (c, e, i) => e in c ? p(c, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : c[e] = i;
|
|
3
|
+
var a = (c, e, i) => _(c, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { RaphReactivity as f } from "../reactivity/engine.js";
|
|
5
|
+
let r;
|
|
6
|
+
class o {
|
|
7
|
+
constructor() {
|
|
8
|
+
// Хранит binding только на время синхронной регистрации effect.
|
|
9
|
+
a(this, "_active");
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Связывает effect с owner и phase только на время регистрации.
|
|
13
|
+
*/
|
|
14
|
+
bind(e) {
|
|
15
|
+
const i = this._active;
|
|
16
|
+
if (i === void 0)
|
|
17
|
+
return { schedule: e, dispose: A };
|
|
18
|
+
const t = i.binding(e);
|
|
19
|
+
if (i.initial === "scheduled")
|
|
20
|
+
return t;
|
|
21
|
+
let s = !0;
|
|
22
|
+
return {
|
|
23
|
+
dispose: t.dispose,
|
|
24
|
+
schedule: () => {
|
|
25
|
+
if (!s) {
|
|
26
|
+
t.schedule();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
s = !1, e();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Выполняет операцию с текущим effect binding.
|
|
35
|
+
*/
|
|
36
|
+
runWith(e, i, t) {
|
|
37
|
+
const s = this._active;
|
|
38
|
+
this._active = e === void 0 ? void 0 : { binding: e, initial: i };
|
|
39
|
+
try {
|
|
40
|
+
return t();
|
|
41
|
+
} finally {
|
|
42
|
+
this._active = s;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
class y extends f {
|
|
47
|
+
/**
|
|
48
|
+
* Создаёт policy adapter реактивного графа для одного runtime.
|
|
49
|
+
*/
|
|
50
|
+
constructor(i) {
|
|
51
|
+
const t = new o();
|
|
52
|
+
super({
|
|
53
|
+
effectScheduler: {
|
|
54
|
+
bind: t.bind.bind(t)
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
// Изолирует registration binding от алгоритмов базового reactive graph.
|
|
58
|
+
a(this, "_bindings");
|
|
59
|
+
this._lifecycle = i, this._bindings = t;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Создаёт временную registration boundary для runtime effect.
|
|
63
|
+
*/
|
|
64
|
+
withEffectBinding(i, t, s) {
|
|
65
|
+
return this._bindings.runWith(i, t, s);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Выполняет untracked-операцию, сохраняя runtime owner context.
|
|
69
|
+
*/
|
|
70
|
+
untrackedWithOwner(i) {
|
|
71
|
+
const t = r;
|
|
72
|
+
r = void 0;
|
|
73
|
+
try {
|
|
74
|
+
return this.untracked(i);
|
|
75
|
+
} finally {
|
|
76
|
+
r = t;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Возвращает owner текущего синхронного реактивного контекста.
|
|
81
|
+
*/
|
|
82
|
+
getActiveOwner() {
|
|
83
|
+
return r == null ? void 0 : r.owner;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Выполняет операцию с указанным active owner.
|
|
87
|
+
*/
|
|
88
|
+
runWithOwner(i, t) {
|
|
89
|
+
const s = r;
|
|
90
|
+
r = i;
|
|
91
|
+
try {
|
|
92
|
+
return t();
|
|
93
|
+
} finally {
|
|
94
|
+
r = s;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Создаёт owned signal с runtime lifecycle policy.
|
|
99
|
+
*/
|
|
100
|
+
signalForOwner(i, t) {
|
|
101
|
+
const s = this._lifecycle, u = t === void 0 ? this.signal(i) : t._adoptSource(this._ownedSignal(i)), v = s.assertWriteAllowed, h = s.runWrite ?? g;
|
|
102
|
+
return v !== void 0 ? {
|
|
103
|
+
get() {
|
|
104
|
+
return l(s), t == null || t._assertAlive(), u.get();
|
|
105
|
+
},
|
|
106
|
+
peek() {
|
|
107
|
+
return n(s), t == null || t._assertAlive(), u.peek();
|
|
108
|
+
},
|
|
109
|
+
set(d) {
|
|
110
|
+
t == null || t._assertAlive(), v(), h(() => u.set(d));
|
|
111
|
+
}
|
|
112
|
+
} : {
|
|
113
|
+
get() {
|
|
114
|
+
return l(s), t == null || t._assertAlive(), u.get();
|
|
115
|
+
},
|
|
116
|
+
peek() {
|
|
117
|
+
return n(s), t == null || t._assertAlive(), u.peek();
|
|
118
|
+
},
|
|
119
|
+
set(d) {
|
|
120
|
+
n(s), t == null || t._assertAlive(), h(() => u.set(d));
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Создаёт owned computed с runtime lifecycle policy.
|
|
126
|
+
*/
|
|
127
|
+
computedForOwner(i, t) {
|
|
128
|
+
const s = this._lifecycle, u = t === void 0 ? this.computed(i) : t._adoptSource(this._ownedComputed(i));
|
|
129
|
+
return {
|
|
130
|
+
get() {
|
|
131
|
+
return l(s), t == null || t._assertAlive(), u.get();
|
|
132
|
+
},
|
|
133
|
+
peek() {
|
|
134
|
+
return n(s), t == null || t._assertAlive(), u.peek();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function n(c) {
|
|
140
|
+
c.owner === void 0 && c.throwDisposed();
|
|
141
|
+
}
|
|
142
|
+
function l(c) {
|
|
143
|
+
n(c);
|
|
144
|
+
const e = r;
|
|
145
|
+
e !== void 0 && e !== c && c.throwCrossRuntime(e.owner);
|
|
146
|
+
}
|
|
147
|
+
function g(c) {
|
|
148
|
+
return c();
|
|
149
|
+
}
|
|
150
|
+
function A() {
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
y as RuntimeReactivity
|
|
154
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var c=(i,t,e)=>t in i?a(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var p=(i,t,e)=>c(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class h{constructor(t){p(this,"_cleanup");p(this,"_stopped",!1);this._runUntracked=t}get stopped(){return this._stopped}deliver(t){const e=[],n=this._cleanup;if(this._cleanup=void 0,n!==void 0&&this._attempt(n,e),!this._stopped){let s=null;try{const r=this._runUntracked(t);typeof r=="function"&&(s=r)}catch(r){e.push(r)}s!==null&&(this._stopped?this._attempt(s,e):this._cleanup=s)}o(e)}stop(t){if(this._stopped)return;this._stopped=!0;const e=[];if(t!==void 0)try{t()}catch(s){e.push(s)}const n=this._cleanup;this._cleanup=void 0,n!==void 0&&this._attempt(n,e),o(e)}_attempt(t,e){try{this._runUntracked(t)}catch(n){e.push(n)}}}function o(i){if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"[Raph] Runtime watch delivery failed.")}exports.RuntimeWatch=h;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var a = (i, t, e) => t in i ? o(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var p = (i, t, e) => a(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
class u {
|
|
5
|
+
/**
|
|
6
|
+
* Создаёт runtime-owned watch с явным lifecycle остановки.
|
|
7
|
+
*/
|
|
8
|
+
constructor(t) {
|
|
9
|
+
// Хранят cleanup последней доставки и окончательное состояние watcher.
|
|
10
|
+
p(this, "_cleanup");
|
|
11
|
+
p(this, "_stopped", !1);
|
|
12
|
+
this._runUntracked = t;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Показывает, остановлен ли watch.
|
|
16
|
+
*/
|
|
17
|
+
get stopped() {
|
|
18
|
+
return this._stopped;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Освобождает предыдущий результат callback и выполняет новую доставку.
|
|
22
|
+
* Ошибка cleanup не лишает живой watcher текущего события.
|
|
23
|
+
*/
|
|
24
|
+
deliver(t) {
|
|
25
|
+
const e = [], s = this._cleanup;
|
|
26
|
+
if (this._cleanup = void 0, s !== void 0 && this._attempt(s, e), !this._stopped) {
|
|
27
|
+
let n = null;
|
|
28
|
+
try {
|
|
29
|
+
const r = this._runUntracked(t);
|
|
30
|
+
typeof r == "function" && (n = r);
|
|
31
|
+
} catch (r) {
|
|
32
|
+
e.push(r);
|
|
33
|
+
}
|
|
34
|
+
n !== null && (this._stopped ? this._attempt(n, e) : this._cleanup = n);
|
|
35
|
+
}
|
|
36
|
+
h(e);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Останавливает внешнюю регистрацию и cleanup callback, сохраняя обе ошибки.
|
|
40
|
+
*/
|
|
41
|
+
stop(t) {
|
|
42
|
+
if (this._stopped)
|
|
43
|
+
return;
|
|
44
|
+
this._stopped = !0;
|
|
45
|
+
const e = [];
|
|
46
|
+
if (t !== void 0)
|
|
47
|
+
try {
|
|
48
|
+
t();
|
|
49
|
+
} catch (n) {
|
|
50
|
+
e.push(n);
|
|
51
|
+
}
|
|
52
|
+
const s = this._cleanup;
|
|
53
|
+
this._cleanup = void 0, s !== void 0 && this._attempt(s, e), h(e);
|
|
54
|
+
}
|
|
55
|
+
_attempt(t, e) {
|
|
56
|
+
try {
|
|
57
|
+
this._runUntracked(t);
|
|
58
|
+
} catch (s) {
|
|
59
|
+
e.push(s);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function h(i) {
|
|
64
|
+
if (i.length === 1)
|
|
65
|
+
throw i[0];
|
|
66
|
+
if (i.length > 1)
|
|
67
|
+
throw new AggregateError(i, "[Raph] Runtime watch delivery failed.");
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
u as RuntimeWatch
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(t,e="[Raph] Multiple resource cleanup failures."){if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,e)}exports.throwDisposalErrors=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../api/errors.cjs");class o extends r.RaphError{}class s extends r.RaphError{}class a extends r.RaphError{}exports.RaphActionError=o;exports.RaphCrossRuntimeError=a;exports.RaphDisposedError=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(){return{parentsOf(e){return e.parent===null?new Set:new Set([e.parent])}}}exports.parentGraph=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({AnimationFrame:"animationFrame",Microtask:"microtask",Sync:"sync"});exports.RaphSchedulerType=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./errors.cjs"),r=require("./parent-graph.cjs"),t=require("./PathHandle.cjs"),p=require("./phase.types.cjs"),a=require("./RaphNode.cjs"),u=require("./RaphRuntime.cjs"),o=require("./RaphScope.cjs");exports.RaphActionError=e.RaphActionError;exports.RaphCrossRuntimeError=e.RaphCrossRuntimeError;exports.RaphDisposedError=e.RaphDisposedError;exports.parentGraph=r.parentGraph;exports.PathHandle=t.PathHandle;exports.RaphSchedulerType=p.RaphSchedulerType;exports.RaphNode=a.RaphNode;exports.RaphRuntime=u.RaphRuntime;exports.RaphScope=o.RaphScope;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RaphActionError as p, RaphCrossRuntimeError as e, RaphDisposedError as t } from "./errors.js";
|
|
2
|
+
import { parentGraph as h } from "./parent-graph.js";
|
|
3
|
+
import { PathHandle as R } from "./PathHandle.js";
|
|
4
|
+
import { RaphSchedulerType as x } from "./phase.types.js";
|
|
5
|
+
import { RaphNode as d } from "./RaphNode.js";
|
|
6
|
+
import { RaphRuntime as s } from "./RaphRuntime.js";
|
|
7
|
+
import { RaphScope as u } from "./RaphScope.js";
|
|
8
|
+
export {
|
|
9
|
+
R as PathHandle,
|
|
10
|
+
p as RaphActionError,
|
|
11
|
+
e as RaphCrossRuntimeError,
|
|
12
|
+
t as RaphDisposedError,
|
|
13
|
+
d as RaphNode,
|
|
14
|
+
s as RaphRuntime,
|
|
15
|
+
x as RaphSchedulerType,
|
|
16
|
+
u as RaphScope,
|
|
17
|
+
h as parentGraph
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./debug/path/data-adapter.cjs"),o=require("./debug/path/data-path.cjs"),r=require("./debug/path/derived-strategies.cjs"),t=require("./debug/path/RaphDerivedHandle.cjs"),h=require("./debug/path/RaphKernel.cjs"),u=require("./debug/path/RaphMeta.cjs"),a=require("./debug/runtime/errors.cjs"),i=require("./debug/runtime/parent-graph.cjs"),n=require("./debug/runtime/PathHandle.cjs"),R=require("./debug/runtime/phase.types.cjs"),d=require("./debug/runtime/RaphNode.cjs"),_=require("./debug/runtime/RaphRuntime.cjs"),s=require("./debug/runtime/RaphScope.cjs"),e=require("./debug/api/errors.cjs"),c=require("./debug/api/Raph.cjs");exports.DefaultDataAdapter=p.DefaultDataAdapter;exports.DataPath=o.DataPath;exports.collectionByKey=r.collectionByKey;exports.filterByKey=r.filterByKey;exports.full=r.full;exports.RaphDerivedHandle=t.RaphDerivedHandle;exports.RaphDerivedTargetWriteError=t.RaphDerivedTargetWriteError;exports.RaphKernel=h.RaphKernel;exports.RaphMeta=u.RaphMeta;exports.RaphActionError=a.RaphActionError;exports.RaphCrossRuntimeError=a.RaphCrossRuntimeError;exports.RaphDisposedError=a.RaphDisposedError;exports.parentGraph=i.parentGraph;exports.PathHandle=n.PathHandle;exports.RaphSchedulerType=R.RaphSchedulerType;exports.RaphNode=d.RaphNode;exports.RaphRuntime=_.RaphRuntime;exports.RaphScope=s.RaphScope;exports.RaphConfigurationError=e.RaphConfigurationError;exports.RaphDefaultRuntimeError=e.RaphDefaultRuntimeError;exports.RaphError=e.RaphError;exports.RaphModeError=e.RaphModeError;exports.Raph=c.Raph;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DefaultDataAdapter as e } from "./debug/path/data-adapter.js";
|
|
2
|
+
import { DataPath as t } from "./debug/path/data-path.js";
|
|
3
|
+
import { collectionByKey as f, filterByKey as h, full as R } from "./debug/path/derived-strategies.js";
|
|
4
|
+
import { RaphDerivedHandle as x, RaphDerivedTargetWriteError as i } from "./debug/path/RaphDerivedHandle.js";
|
|
5
|
+
import { RaphKernel as n } from "./debug/path/RaphKernel.js";
|
|
6
|
+
import { RaphMeta as u } from "./debug/path/RaphMeta.js";
|
|
7
|
+
import { RaphActionError as D, RaphCrossRuntimeError as c, RaphDisposedError as y } from "./debug/runtime/errors.js";
|
|
8
|
+
import { parentGraph as K } from "./debug/runtime/parent-graph.js";
|
|
9
|
+
import { PathHandle as v } from "./debug/runtime/PathHandle.js";
|
|
10
|
+
import { RaphSchedulerType as B } from "./debug/runtime/phase.types.js";
|
|
11
|
+
import { RaphNode as H } from "./debug/runtime/RaphNode.js";
|
|
12
|
+
import { RaphRuntime as P } from "./debug/runtime/RaphRuntime.js";
|
|
13
|
+
import { RaphScope as T } from "./debug/runtime/RaphScope.js";
|
|
14
|
+
import { RaphConfigurationError as N, RaphDefaultRuntimeError as W, RaphError as b, RaphModeError as j } from "./debug/api/errors.js";
|
|
15
|
+
import { Raph as q } from "./debug/api/Raph.js";
|
|
16
|
+
export {
|
|
17
|
+
t as DataPath,
|
|
18
|
+
e as DefaultDataAdapter,
|
|
19
|
+
v as PathHandle,
|
|
20
|
+
q as Raph,
|
|
21
|
+
D as RaphActionError,
|
|
22
|
+
N as RaphConfigurationError,
|
|
23
|
+
c as RaphCrossRuntimeError,
|
|
24
|
+
W as RaphDefaultRuntimeError,
|
|
25
|
+
x as RaphDerivedHandle,
|
|
26
|
+
i as RaphDerivedTargetWriteError,
|
|
27
|
+
y as RaphDisposedError,
|
|
28
|
+
b as RaphError,
|
|
29
|
+
n as RaphKernel,
|
|
30
|
+
u as RaphMeta,
|
|
31
|
+
j as RaphModeError,
|
|
32
|
+
H as RaphNode,
|
|
33
|
+
P as RaphRuntime,
|
|
34
|
+
B as RaphSchedulerType,
|
|
35
|
+
T as RaphScope,
|
|
36
|
+
f as collectionByKey,
|
|
37
|
+
h as filterByKey,
|
|
38
|
+
R as full,
|
|
39
|
+
K as parentGraph
|
|
40
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { DataAdapter } from './data-adapter';
|
|
2
|
+
import { DataPathDef, PathOptions, PathWatchCallback } from './path.types';
|
|
3
|
+
/**
|
|
4
|
+
* Связывает events и watchers только для Kernel поверх внешнего DataAdapter.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AdapterPathStore {
|
|
7
|
+
private readonly _adapter;
|
|
8
|
+
private readonly _eventHub;
|
|
9
|
+
/**
|
|
10
|
+
* Связывает внешний DataAdapter с path events и watchers Kernel.
|
|
11
|
+
*/
|
|
12
|
+
constructor(_adapter: DataAdapter);
|
|
13
|
+
/**
|
|
14
|
+
* Возвращает значение по пути без создания отсутствующих данных.
|
|
15
|
+
*/
|
|
16
|
+
get<T = unknown>(path: DataPathDef, options?: PathOptions): T | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Читает значение по пути без регистрации реактивной зависимости.
|
|
19
|
+
*/
|
|
20
|
+
peek<T = unknown>(path: DataPathDef, options?: PathOptions): T | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Проверяет наличие значения по указанному пути.
|
|
23
|
+
*/
|
|
24
|
+
has(path: DataPathDef, options?: PathOptions): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Записывает значение и публикует соответствующее изменение.
|
|
27
|
+
*/
|
|
28
|
+
set<T>(path: DataPathDef, value: T, options?: PathOptions): void;
|
|
29
|
+
/**
|
|
30
|
+
* Объединяет значение по пути и публикует соответствующее изменение.
|
|
31
|
+
*/
|
|
32
|
+
merge(path: DataPathDef, value: unknown, options?: PathOptions): void;
|
|
33
|
+
/**
|
|
34
|
+
* Удаляет значение по пути и публикует изменение при наличии данных.
|
|
35
|
+
*/
|
|
36
|
+
delete(path: DataPathDef, options?: PathOptions): void;
|
|
37
|
+
/**
|
|
38
|
+
* Выполняет операцию в общей синхронной transaction boundary.
|
|
39
|
+
*/
|
|
40
|
+
transaction<T>(operation: () => T): T;
|
|
41
|
+
/**
|
|
42
|
+
* Подписывает callback на подходящие изменения и возвращает disposer.
|
|
43
|
+
*/
|
|
44
|
+
watch(maskOrMasks: DataPathDef | readonly DataPathDef[], callback: PathWatchCallback): () => void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ParsedDataPath } from './data-path';
|
|
2
|
+
import { CollectionDerivedState, DerivedCollectionKey } from './derived-collection';
|
|
3
|
+
import { RaphDerivedHandle } from './RaphDerivedHandle';
|
|
4
|
+
/**
|
|
5
|
+
* Владеет регистрациями, routes и pending-state materialized derived.
|
|
6
|
+
* Вычисление значений остаётся у Kernel, который координирует data-plane.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DerivedRegistry {
|
|
9
|
+
private _router;
|
|
10
|
+
private _handles;
|
|
11
|
+
private _matches;
|
|
12
|
+
private _pending;
|
|
13
|
+
private _collections;
|
|
14
|
+
private _counter;
|
|
15
|
+
/**
|
|
16
|
+
* Возвращает число зарегистрированных записей.
|
|
17
|
+
*/
|
|
18
|
+
get size(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Возвращает очередь derived-вычислений, ожидающих стабилизации.
|
|
21
|
+
*/
|
|
22
|
+
get pending(): Set<RaphDerivedHandle<any, any>> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Выделяет следующий стабильный идентификатор registry.
|
|
25
|
+
*/
|
|
26
|
+
nextId(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Проверяет наличие derived handle с указанным id.
|
|
29
|
+
*/
|
|
30
|
+
has(id: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Возвращает зарегистрированные derived handles.
|
|
33
|
+
*/
|
|
34
|
+
values(): IterableIterator<RaphDerivedHandle<any, any>>;
|
|
35
|
+
/**
|
|
36
|
+
* Возвращает внутреннее состояние зарегистрированного handle.
|
|
37
|
+
*/
|
|
38
|
+
state(handle: RaphDerivedHandle<any, any>): CollectionDerivedState | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Регистрирует derived handle и его зависимости.
|
|
41
|
+
*/
|
|
42
|
+
register(handle: RaphDerivedHandle<any, any>, from: ParsedDataPath, strategy: {
|
|
43
|
+
readonly kind: 'collection-by-key' | 'filter-by-key';
|
|
44
|
+
readonly key: string;
|
|
45
|
+
} | undefined): void;
|
|
46
|
+
/**
|
|
47
|
+
* Удаляет регистрацию и связанные pending-записи.
|
|
48
|
+
*/
|
|
49
|
+
remove(handle: RaphDerivedHandle<any, any>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Добавляет derived handle в очередь пересчёта.
|
|
52
|
+
*/
|
|
53
|
+
queue(path: ParsedDataPath): void;
|
|
54
|
+
/**
|
|
55
|
+
* Запоминает полную замену, которую нужно применить при стабилизации.
|
|
56
|
+
*/
|
|
57
|
+
queueReplacement(path: ParsedDataPath, keys: ReadonlySet<DerivedCollectionKey>): void;
|
|
58
|
+
/**
|
|
59
|
+
* Сбрасывает pending-состояние после опустошения очереди.
|
|
60
|
+
*/
|
|
61
|
+
clearPendingIfEmpty(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Освобождает все handles и очищает derived registry.
|
|
64
|
+
*/
|
|
65
|
+
dispose(): void;
|
|
66
|
+
private _matching;
|
|
67
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { RaphMetaEvents, RaphMetaMutationCause, RaphMetaMutationEvent, RaphMetaWatchOptions, RaphMetaWriteOptions } from './meta.types';
|
|
2
|
+
import { DataPathDef } from './path.types';
|
|
3
|
+
import { RaphKernel } from './RaphKernel';
|
|
4
|
+
import { DataPath } from './data-path';
|
|
5
|
+
import { RaphMeta } from './RaphMeta';
|
|
6
|
+
/**
|
|
7
|
+
* Владеет metadata storage, routing и пакетной публикацией.
|
|
8
|
+
* Kernel сообщает контроллеру только о lifecycle data-owner.
|
|
9
|
+
*/
|
|
10
|
+
export declare class MetaController {
|
|
11
|
+
private readonly _kernel;
|
|
12
|
+
private readonly _ownerExists;
|
|
13
|
+
private readonly _publicationDeferred;
|
|
14
|
+
private _facade;
|
|
15
|
+
private _store;
|
|
16
|
+
private _router;
|
|
17
|
+
private _pending;
|
|
18
|
+
private _publishing;
|
|
19
|
+
private _watcherCount;
|
|
20
|
+
private _deferredWatcherCount;
|
|
21
|
+
/**
|
|
22
|
+
* Создаёт lifecycle-контроллер metadata для одного Kernel.
|
|
23
|
+
*/
|
|
24
|
+
constructor(_kernel: RaphKernel, _ownerExists: (path: DataPathDef) => boolean, _publicationDeferred: () => boolean);
|
|
25
|
+
/**
|
|
26
|
+
* Возвращает metadata facade, принадлежащий контроллеру.
|
|
27
|
+
*/
|
|
28
|
+
get facade(): RaphMeta;
|
|
29
|
+
/**
|
|
30
|
+
* Возвращает число зарегистрированных записей.
|
|
31
|
+
*/
|
|
32
|
+
get size(): number;
|
|
33
|
+
/**
|
|
34
|
+
* Показывает, есть ли активные синхронные metadata/path watchers.
|
|
35
|
+
*/
|
|
36
|
+
get hasWatchers(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Показывает, есть ли watchers с отложенной публикацией.
|
|
39
|
+
*/
|
|
40
|
+
get hasDeferredWatchers(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Возвращает значение по пути без создания отсутствующих данных.
|
|
43
|
+
*/
|
|
44
|
+
get(path: DataPath, namespace?: string): unknown;
|
|
45
|
+
/**
|
|
46
|
+
* Проверяет наличие значения по указанному пути.
|
|
47
|
+
*/
|
|
48
|
+
has(path: DataPath, namespace?: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Записывает значение и публикует соответствующее изменение.
|
|
51
|
+
*/
|
|
52
|
+
set(path: DataPath, namespace: string, value: unknown, options?: RaphMetaWriteOptions): void;
|
|
53
|
+
/**
|
|
54
|
+
* Объединяет значение по пути и публикует соответствующее изменение.
|
|
55
|
+
*/
|
|
56
|
+
merge(path: DataPath, namespace: string, value: unknown, options?: RaphMetaWriteOptions): void;
|
|
57
|
+
/**
|
|
58
|
+
* Удаляет значение по пути и публикует изменение при наличии данных.
|
|
59
|
+
*/
|
|
60
|
+
delete(path: DataPath, namespace?: string, options?: RaphMetaWriteOptions): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Удаляет metadata всего поддерева указанного data-owner.
|
|
63
|
+
*/
|
|
64
|
+
deleteSubtree(path: DataPath, cause: Extract<RaphMetaMutationCause, 'owner-delete' | 'owner-replaced'>): void;
|
|
65
|
+
/**
|
|
66
|
+
* Удаляет metadata, владельцы которой отсутствуют в data tree.
|
|
67
|
+
*/
|
|
68
|
+
pruneMissing(path: DataPath, cause: Extract<RaphMetaMutationCause, 'owner-delete' | 'owner-replaced'>): void;
|
|
69
|
+
/**
|
|
70
|
+
* Подписывает callback на подходящие изменения и возвращает disposer.
|
|
71
|
+
*/
|
|
72
|
+
watch(maskOrMasks: DataPathDef | readonly DataPathDef[], callback: (payload: RaphMetaEvents) => void, options?: RaphMetaWatchOptions, afterPublish?: (invalidate: boolean) => void): () => void;
|
|
73
|
+
/**
|
|
74
|
+
* Добавляет событие в текущую transaction либо публикует его сразу.
|
|
75
|
+
*/
|
|
76
|
+
record(kind: RaphMetaMutationEvent['kind'], path: DataPath, namespace: string | null, cause: RaphMetaMutationCause, options?: RaphMetaWriteOptions): void;
|
|
77
|
+
/**
|
|
78
|
+
* Публикует накопленные metadata-события с учётом watcher mode.
|
|
79
|
+
*/
|
|
80
|
+
publish(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Очищает metadata storage, subscriptions и pending publication state.
|
|
83
|
+
*/
|
|
84
|
+
dispose(): void;
|
|
85
|
+
}
|