@raphy-js/raph 1.0.0-dev.2 → 1.0.1-dev.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1096 -0
- package/dist/api/Raph.d.ts +59 -190
- package/dist/api/RaphFacadeSession.d.ts +90 -0
- package/dist/api/RaphReactivityInstance.d.ts +72 -0
- package/dist/api/errors.d.ts +9 -4
- package/dist/api/types.d.ts +162 -17
- package/dist/core-CClhT8WR.js +1044 -0
- package/dist/core-cPQWYD4K.cjs +1 -0
- package/dist/debug/api/Raph.cjs +1 -1
- package/dist/debug/api/Raph.js +368 -367
- package/dist/debug/api/RaphFacadeSession.cjs +1 -0
- package/dist/debug/api/RaphFacadeSession.js +302 -0
- package/dist/debug/api/RaphReactivityInstance.cjs +1 -0
- package/dist/debug/api/RaphReactivityInstance.js +146 -0
- package/dist/debug/api/errors.cjs +1 -1
- package/dist/debug/api/errors.js +10 -7
- package/dist/debug/path/DataPath.cjs +1 -0
- package/dist/debug/path/DataPath.js +390 -0
- package/dist/debug/path/PathRouter.cjs +1 -0
- package/dist/debug/path/PathRouter.js +80 -0
- package/dist/debug/path/RaphKernel.cjs +1 -1
- package/dist/debug/path/RaphKernel.js +316 -236
- package/dist/debug/path/data-path.utils.cjs +1 -0
- package/dist/debug/path/data-path.utils.js +56 -0
- package/dist/debug/path/derived/DerivedRegistry.cjs +1 -0
- package/dist/debug/path/derived/DerivedRegistry.js +143 -0
- package/dist/debug/path/derived/RaphDerivedHandle.cjs +1 -0
- package/dist/debug/path/{RaphDerivedHandle.js → derived/RaphDerivedHandle.js} +19 -22
- package/dist/debug/path/derived/derived-collection.utils.cjs +1 -0
- package/dist/debug/path/{derived-collection.js → derived/derived-collection.utils.js} +71 -71
- package/dist/debug/path/derived/derived-strategy.types.cjs +1 -0
- package/dist/debug/path/derived/derived-strategy.types.js +1 -0
- package/dist/debug/path/meta/MetaController.cjs +1 -0
- package/dist/debug/path/{MetaController.js → meta/MetaController.js} +58 -66
- package/dist/debug/path/meta/RaphMeta.cjs +1 -0
- package/dist/debug/path/meta/RaphMeta.js +62 -0
- package/dist/debug/path/meta/RaphMetaStore.cjs +1 -0
- package/dist/debug/path/{RaphMetaStore.js → meta/RaphMetaStore.js} +24 -30
- package/dist/debug/path/meta/meta.types.cjs +1 -0
- package/dist/debug/path/meta/meta.types.js +1 -0
- package/dist/debug/path/storage/AdapterPathStore.cjs +1 -0
- package/dist/debug/path/storage/AdapterPathStore.js +128 -0
- package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -0
- package/dist/debug/path/{data-adapter.js → storage/DefaultDataAdapter.js} +47 -57
- package/dist/debug/path/storage/PathEventHub.cjs +1 -0
- package/dist/debug/path/storage/PathEventHub.js +161 -0
- package/dist/debug/path/storage/PathStore.cjs +1 -0
- package/dist/debug/path/{PathStore.js → storage/PathStore.js} +88 -98
- package/dist/debug/path/storage/createDataDraft.cjs +1 -0
- package/dist/debug/path/{data-draft.js → storage/createDataDraft.js} +24 -28
- package/dist/debug/path/storage/data-adapter.types.cjs +1 -0
- package/dist/debug/path/storage/data-adapter.types.js +1 -0
- 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 +888 -321
- package/dist/debug/reactivity/reactive-object.cjs +1 -0
- package/dist/debug/reactivity/reactive-object.js +265 -0
- 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 +1134 -502
- package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -0
- package/dist/debug/runtime/diagnostics/RaphDebug.js +287 -0
- package/dist/debug/runtime/errors.cjs +1 -1
- package/dist/debug/runtime/errors.js +6 -3
- package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphEffectScope.js +304 -0
- package/dist/debug/runtime/ownership/RaphNode.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphNode.js +665 -0
- package/dist/debug/runtime/ownership/RaphScope.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphScope.js +236 -0
- package/dist/debug/runtime/ownership/parent-graph.types.cjs +1 -0
- package/dist/debug/runtime/ownership/parent-graph.types.js +1 -0
- package/dist/debug/runtime/phases/RaphFrameLoop.cjs +1 -0
- package/dist/debug/runtime/{RaphFrameLoop.js → phases/RaphFrameLoop.js} +13 -17
- package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -0
- package/dist/debug/runtime/phases/RaphPhasePipeline.js +848 -0
- 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/phases/orderPhaseTasks.cjs +1 -0
- package/dist/debug/runtime/phases/orderPhaseTasks.js +59 -0
- package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -0
- package/dist/debug/runtime/reactivity/PathHandle.js +165 -0
- package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -0
- package/dist/debug/runtime/reactivity/RaphMetaSource.js +108 -0
- 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 -0
- package/dist/debug/runtime/reactivity/RaphWorkGraph.js +1157 -0
- package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -0
- package/dist/debug/runtime/reactivity/RuntimeReactivity.js +550 -0
- package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -0
- package/dist/debug/runtime/reactivity/RuntimeWatch.js +77 -0
- package/dist/debug/runtime/reactivity/disposal-sweep.utils.cjs +1 -0
- package/dist/debug/runtime/reactivity/disposal-sweep.utils.js +42 -0
- package/dist/debug/runtime/reactivity/runtime-reactivity.types.cjs +1 -0
- package/dist/debug/runtime/reactivity/runtime-reactivity.types.js +1 -0
- package/dist/entrypoints/machine-testing.d.ts +2 -0
- package/dist/entrypoints/machine.d.ts +5 -0
- package/dist/entrypoints/path.d.ts +14 -0
- package/dist/entrypoints/reactivity.d.ts +1 -0
- package/dist/entrypoints/runtime.d.ts +18 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +46 -38
- package/dist/machine/compiler.d.ts +71 -0
- package/dist/machine/core.d.ts +50 -0
- package/dist/machine/persistence.d.ts +5 -0
- package/dist/machine/runtime.d.ts +4 -0
- package/dist/machine/testing.d.ts +43 -0
- package/dist/machine/types.d.ts +155 -0
- package/dist/machine-testing.cjs +1 -0
- package/dist/machine-testing.js +188 -0
- package/dist/machine.cjs +1 -0
- package/dist/machine.js +822 -0
- package/dist/main.d.ts +20 -0
- package/dist/path/{data-path.d.ts → DataPath.d.ts} +16 -40
- package/dist/path/{path-router.d.ts → PathRouter.d.ts} +1 -1
- package/dist/path/RaphKernel.d.ts +37 -10
- package/dist/path/data-path.types.d.ts +34 -0
- package/dist/path/data-path.utils.d.ts +9 -0
- package/dist/path/{DerivedRegistry.d.ts → derived/DerivedRegistry.d.ts} +2 -2
- package/dist/path/{RaphDerivedHandle.d.ts → derived/RaphDerivedHandle.d.ts} +3 -3
- package/dist/path/derived/derived-collection.types.d.ts +12 -0
- package/dist/path/{derived-collection.d.ts → derived/derived-collection.utils.d.ts} +3 -13
- package/dist/path/{derived-strategies.d.ts → derived/derived-strategy.types.d.ts} +0 -3
- package/dist/path/derived/derived-strategy.utils.d.ts +4 -0
- package/dist/path/{MetaController.d.ts → meta/MetaController.d.ts} +4 -4
- package/dist/path/{RaphMeta.d.ts → meta/RaphMeta.d.ts} +2 -2
- package/dist/path/{RaphMetaStore.d.ts → meta/RaphMetaStore.d.ts} +1 -1
- package/dist/path/{meta.types.d.ts → meta/meta.types.d.ts} +2 -4
- package/dist/path/path.types.d.ts +3 -2
- package/dist/path/{segment-key.d.ts → pathSegmentKey.d.ts} +1 -1
- package/dist/path/{AdapterPathStore.d.ts → storage/AdapterPathStore.d.ts} +4 -4
- package/dist/path/{data-adapter.d.ts → storage/DefaultDataAdapter.d.ts} +2 -17
- package/dist/path/storage/PathEventHub.d.ts +62 -0
- package/dist/path/{PathStore.d.ts → storage/PathStore.d.ts} +7 -7
- package/dist/path/storage/data-adapter.types.d.ts +17 -0
- package/dist/path.cjs +1 -1
- package/dist/path.js +16 -16
- package/dist/raph.cjs +1 -1
- package/dist/raph.js +46 -38
- package/dist/reactivity/disposal.d.ts +14 -0
- package/dist/reactivity/engine.d.ts +193 -6
- package/dist/reactivity/reactive-object.d.ts +36 -0
- package/dist/reactivity/scope.d.ts +108 -30
- package/dist/reactivity/types.d.ts +25 -0
- package/dist/reactivity.cjs +1 -1
- package/dist/reactivity.js +12 -12
- package/dist/runtime/RaphRuntime.d.ts +319 -160
- package/dist/runtime/diagnostics/RaphDebug.d.ts +239 -0
- package/dist/runtime/errors.d.ts +5 -0
- package/dist/runtime/ownership/RaphEffectScope.d.ts +98 -0
- package/dist/runtime/ownership/RaphNode.d.ts +310 -0
- package/dist/runtime/ownership/RaphScope.d.ts +168 -0
- package/dist/runtime/{parent-graph.d.ts → ownership/parent-graph.types.d.ts} +0 -1
- package/dist/runtime/ownership/parentGraph.d.ts +3 -0
- package/dist/runtime/phases/RaphPhasePipeline.d.ts +253 -0
- package/dist/runtime/phases/RaphPhaseTaskRecord.d.ts +195 -0
- package/dist/runtime/phases/RaphPhaseWatch.d.ts +22 -0
- package/dist/runtime/phases/orderPhaseTasks.d.ts +6 -0
- package/dist/runtime/phases/phase.types.d.ts +171 -0
- package/dist/runtime/{PathHandle.d.ts → reactivity/PathHandle.d.ts} +14 -6
- package/dist/runtime/reactivity/RaphMetaSource.d.ts +32 -0
- package/dist/runtime/reactivity/RaphSelector.d.ts +338 -0
- package/dist/runtime/reactivity/RaphWorkGraph.d.ts +309 -0
- package/dist/runtime/reactivity/RuntimeReactivity.d.ts +293 -0
- package/dist/runtime/{RuntimeWatch.d.ts → reactivity/RuntimeWatch.d.ts} +12 -6
- package/dist/runtime/reactivity/disposal-sweep.utils.d.ts +19 -0
- package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +56 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +21 -16
- package/package.json +76 -35
- package/ReadMe.md +0 -153
- package/dist/api/public.d.ts +0 -22
- package/dist/debug/api/public.cjs +0 -1
- package/dist/debug/api/public.js +0 -40
- package/dist/debug/path/AdapterPathStore.cjs +0 -1
- package/dist/debug/path/AdapterPathStore.js +0 -133
- package/dist/debug/path/DerivedRegistry.cjs +0 -1
- package/dist/debug/path/DerivedRegistry.js +0 -157
- package/dist/debug/path/MetaController.cjs +0 -1
- package/dist/debug/path/PathEventHub.cjs +0 -1
- package/dist/debug/path/PathEventHub.js +0 -148
- package/dist/debug/path/PathStore.cjs +0 -1
- package/dist/debug/path/RaphDerivedHandle.cjs +0 -1
- package/dist/debug/path/RaphMeta.cjs +0 -1
- package/dist/debug/path/RaphMeta.js +0 -68
- package/dist/debug/path/RaphMetaStore.cjs +0 -1
- package/dist/debug/path/data-adapter.cjs +0 -1
- package/dist/debug/path/data-draft.cjs +0 -1
- package/dist/debug/path/data-path.cjs +0 -1
- package/dist/debug/path/data-path.js +0 -423
- package/dist/debug/path/derived-collection.cjs +0 -1
- package/dist/debug/path/path-router.cjs +0 -1
- package/dist/debug/path/path-router.js +0 -86
- package/dist/debug/path/public.cjs +0 -1
- package/dist/debug/path/public.js +0 -18
- package/dist/debug/runtime/PathHandle.cjs +0 -1
- package/dist/debug/runtime/PathHandle.js +0 -139
- package/dist/debug/runtime/RaphDebug.cjs +0 -1
- package/dist/debug/runtime/RaphDebug.js +0 -15
- package/dist/debug/runtime/RaphFrameLoop.cjs +0 -1
- package/dist/debug/runtime/RaphNode.cjs +0 -1
- package/dist/debug/runtime/RaphNode.js +0 -143
- package/dist/debug/runtime/RaphPhasePipeline.cjs +0 -1
- package/dist/debug/runtime/RaphPhasePipeline.js +0 -526
- package/dist/debug/runtime/RaphScope.cjs +0 -1
- package/dist/debug/runtime/RaphScope.js +0 -64
- package/dist/debug/runtime/RuntimeReactivity.cjs +0 -1
- package/dist/debug/runtime/RuntimeReactivity.js +0 -154
- package/dist/debug/runtime/RuntimeWatch.cjs +0 -1
- package/dist/debug/runtime/RuntimeWatch.js +0 -71
- package/dist/debug/runtime/public.cjs +0 -1
- package/dist/debug/runtime/public.js +0 -18
- package/dist/path/PathEventHub.d.ts +0 -48
- package/dist/path/public.d.ts +0 -14
- package/dist/runtime/RaphDebug.d.ts +0 -32
- package/dist/runtime/RaphNode.d.ts +0 -68
- package/dist/runtime/RaphPhasePipeline.d.ts +0 -133
- package/dist/runtime/RaphScope.d.ts +0 -50
- package/dist/runtime/RuntimeReactivity.d.ts +0 -40
- package/dist/runtime/phase.types.d.ts +0 -49
- package/dist/runtime/public.d.ts +0 -13
- package/dist/runtime/runtime-reactivity.types.d.ts +0 -9
- /package/dist/debug/path/{meta.types.cjs → data-path.types.cjs} +0 -0
- /package/dist/debug/path/{meta.types.js → data-path.types.js} +0 -0
- /package/dist/debug/{runtime/runtime-reactivity.types.cjs → path/derived/derived-collection.types.cjs} +0 -0
- /package/dist/debug/{runtime/runtime-reactivity.types.js → path/derived/derived-collection.types.js} +0 -0
- /package/dist/debug/path/{derived-strategies.cjs → derived/derived-strategy.utils.cjs} +0 -0
- /package/dist/debug/path/{derived-strategies.js → derived/derived-strategy.utils.js} +0 -0
- /package/dist/debug/path/{segment-key.cjs → pathSegmentKey.cjs} +0 -0
- /package/dist/debug/path/{segment-key.js → pathSegmentKey.js} +0 -0
- /package/dist/debug/runtime/{parent-graph.cjs → ownership/parentGraph.cjs} +0 -0
- /package/dist/debug/runtime/{parent-graph.js → ownership/parentGraph.js} +0 -0
- /package/dist/debug/runtime/{disposal.cjs → ownership/throwDisposalErrors.cjs} +0 -0
- /package/dist/debug/runtime/{disposal.js → ownership/throwDisposalErrors.js} +0 -0
- /package/dist/debug/runtime/{phase.types.cjs → phases/phase.types.cjs} +0 -0
- /package/dist/debug/runtime/{phase.types.js → phases/phase.types.js} +0 -0
- /package/dist/path/{data-draft.d.ts → storage/createDataDraft.d.ts} +0 -0
- /package/dist/runtime/{disposal.d.ts → ownership/throwDisposalErrors.d.ts} +0 -0
- /package/dist/runtime/{RaphFrameLoop.d.ts → phases/RaphFrameLoop.d.ts} +0 -0
package/dist/api/types.d.ts
CHANGED
|
@@ -1,25 +1,170 @@
|
|
|
1
1
|
import { RaphKernel } from '../path/RaphKernel';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { RaphReactivity } from '../reactivity/engine';
|
|
3
|
+
import { ScopeNode } from '../reactivity/scope';
|
|
4
|
+
import { Disposer } from '../reactivity/types';
|
|
5
|
+
import { RaphNode } from '../runtime/ownership/RaphNode';
|
|
6
|
+
import { RaphScope } from '../runtime/ownership/RaphScope';
|
|
7
|
+
import { RaphAggregateSource, RaphEffectOptions, RaphPhase, RaphPhaseEffect, RaphWatchOptions, RaphWatchSource } from '../runtime/phases/phase.types';
|
|
8
|
+
import { RaphRuntime, RaphRuntimeOptions } from '../runtime/RaphRuntime';
|
|
9
|
+
import { RaphAggregate } from '../runtime/reactivity/RaphWorkGraph';
|
|
10
|
+
import { RaphReactivityInstance } from './RaphReactivityInstance';
|
|
11
|
+
export interface RaphReactiveApi {
|
|
12
|
+
readonly signal: RaphReactivity['signal'];
|
|
13
|
+
readonly reactive: RaphReactivity['reactive'];
|
|
14
|
+
readonly computed: RaphReactivity['computed'];
|
|
15
|
+
readonly batch: RaphReactivity['batch'];
|
|
16
|
+
readonly untracked: RaphReactivity['untracked'];
|
|
6
17
|
}
|
|
7
|
-
export interface
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
18
|
+
export interface RaphReactivityApi extends RaphReactiveApi {
|
|
19
|
+
readonly effect: RaphReactivity['effect'];
|
|
20
|
+
readonly watch: RaphReactivity['watch'];
|
|
21
|
+
readonly scope: () => ScopeNode;
|
|
10
22
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
readonly defaultRuntimeId?: string;
|
|
15
|
-
readonly kernel?: RaphKernel;
|
|
16
|
-
readonly phases?: readonly RaphPhase[];
|
|
23
|
+
interface RaphFacadeAction {
|
|
24
|
+
<Args extends unknown[], Result>(operation: (...args: Args) => Result): (...args: Args) => Result;
|
|
25
|
+
<Args extends unknown[], Result>(name: string, operation: (...args: Args) => Result): (...args: Args) => Result;
|
|
17
26
|
}
|
|
18
|
-
export interface
|
|
27
|
+
export interface RaphRuntimeApi extends RaphReactiveApi {
|
|
28
|
+
readonly acquireLoop: RaphRuntime['acquireLoop'];
|
|
29
|
+
readonly action: RaphFacadeAction;
|
|
30
|
+
readonly addPhase: RaphRuntime['addPhase'];
|
|
31
|
+
readonly afterFlush: RaphRuntime['afterFlush'];
|
|
32
|
+
readonly aggregate: (sources: readonly RaphAggregateSource[]) => RaphAggregate;
|
|
33
|
+
readonly clearPhases: RaphRuntime['clearPhases'];
|
|
34
|
+
readonly debug: RaphRuntime['debug'];
|
|
35
|
+
readonly definePhases: RaphRuntime['definePhases'];
|
|
36
|
+
readonly delete: RaphRuntime['delete'];
|
|
37
|
+
readonly derive: RaphRuntime['derive'];
|
|
38
|
+
readonly effect: (phase: string, callback: RaphPhaseEffect, options?: RaphEffectOptions) => Disposer;
|
|
39
|
+
readonly flush: RaphRuntime['flush'];
|
|
40
|
+
readonly frame: RaphRuntime['frame'];
|
|
41
|
+
readonly frameTick: RaphRuntime['frameTick'];
|
|
42
|
+
readonly get: RaphRuntime['get'];
|
|
43
|
+
readonly getDerivedSnapshot: RaphRuntime['getDerivedSnapshot'];
|
|
44
|
+
readonly getNode: RaphRuntime['getNode'];
|
|
45
|
+
readonly has: RaphRuntime['has'];
|
|
46
|
+
readonly kernel: RaphKernel;
|
|
47
|
+
readonly loopEnabled: boolean;
|
|
48
|
+
readonly merge: RaphRuntime['merge'];
|
|
49
|
+
readonly meta: RaphRuntime['meta'];
|
|
50
|
+
readonly node: RaphRuntime['node'];
|
|
51
|
+
readonly path: RaphRuntime['path'];
|
|
52
|
+
readonly peek: RaphRuntime['peek'];
|
|
53
|
+
readonly phases: RaphRuntime['phases'];
|
|
54
|
+
readonly requestExecution: RaphRuntime['requestExecution'];
|
|
55
|
+
readonly root: RaphNode;
|
|
56
|
+
readonly rootScope: RaphScope;
|
|
57
|
+
readonly scope: (id: string) => RaphScope;
|
|
58
|
+
readonly set: RaphRuntime['set'];
|
|
59
|
+
readonly startLoop: RaphRuntime['startLoop'];
|
|
60
|
+
readonly stopLoop: RaphRuntime['stopLoop'];
|
|
61
|
+
readonly watch: (source: RaphWatchSource, phase: string, callback: RaphPhaseEffect, options?: RaphWatchOptions) => Disposer;
|
|
62
|
+
}
|
|
63
|
+
export type RaphInstance = RaphRuntime | RaphReactivityInstance;
|
|
64
|
+
export type RaphInstanceMode = 'reactivity' | 'runtime';
|
|
65
|
+
export interface RaphReactivityInstanceOptions {
|
|
66
|
+
readonly adaptiveDependencyIndex?: boolean;
|
|
67
|
+
readonly id?: string;
|
|
68
|
+
}
|
|
69
|
+
export type RaphRuntimeConfigureOptions = Omit<RaphRuntimeOptions, 'id'> & {
|
|
70
|
+
readonly default?: never;
|
|
71
|
+
readonly id?: string;
|
|
72
|
+
readonly instances?: never;
|
|
73
|
+
readonly mode?: 'runtime';
|
|
74
|
+
readonly phases?: readonly RaphPhase[];
|
|
75
|
+
};
|
|
76
|
+
export type RaphReactivityConfigureOptions = Omit<RaphReactivityInstanceOptions, 'id'> & {
|
|
77
|
+
readonly default?: never;
|
|
78
|
+
readonly id?: string;
|
|
79
|
+
readonly instances?: never;
|
|
80
|
+
readonly mode: 'reactivity';
|
|
81
|
+
};
|
|
82
|
+
export type RaphFlatConfigureOptions = RaphReactivityConfigureOptions | RaphRuntimeConfigureOptions;
|
|
83
|
+
export type RaphRuntimeInstanceDefinition = Omit<RaphRuntimeOptions, 'id'> & {
|
|
84
|
+
readonly default?: boolean;
|
|
85
|
+
readonly id?: string;
|
|
19
86
|
readonly mode: 'runtime';
|
|
20
|
-
readonly
|
|
21
|
-
|
|
87
|
+
readonly phases?: readonly RaphPhase[];
|
|
88
|
+
};
|
|
89
|
+
export type RaphReactivityInstanceDefinition = Omit<RaphReactivityInstanceOptions, 'id'> & {
|
|
90
|
+
readonly default?: boolean;
|
|
91
|
+
readonly id?: string;
|
|
92
|
+
readonly mode: 'reactivity';
|
|
93
|
+
};
|
|
94
|
+
export type RaphInstanceDefinition = RaphReactivityInstanceDefinition | RaphRuntimeInstanceDefinition;
|
|
95
|
+
export type RaphInstanceDefinitions = Readonly<Record<string, RaphInstanceDefinition>>;
|
|
96
|
+
export interface RaphInstancesConfigureOptions<Definitions extends RaphInstanceDefinitions = RaphInstanceDefinitions> {
|
|
97
|
+
readonly adaptiveDependencyIndex?: never;
|
|
98
|
+
readonly default?: never;
|
|
99
|
+
readonly enforceActions?: never;
|
|
100
|
+
readonly id?: never;
|
|
101
|
+
readonly instances: Definitions;
|
|
22
102
|
readonly kernel?: never;
|
|
103
|
+
readonly mode?: never;
|
|
23
104
|
readonly phases?: never;
|
|
105
|
+
readonly scheduler?: never;
|
|
106
|
+
}
|
|
107
|
+
export type RaphConfigureOptions = RaphFlatConfigureOptions | RaphInstancesConfigureOptions;
|
|
108
|
+
type InvalidInstanceDefinitionKeys<Definitions extends RaphInstanceDefinitions> = {
|
|
109
|
+
[Key in keyof Definitions]: Exclude<keyof Definitions[Key], Definitions[Key] extends {
|
|
110
|
+
readonly mode: 'reactivity';
|
|
111
|
+
} ? keyof RaphReactivityInstanceDefinition : keyof RaphRuntimeInstanceDefinition>;
|
|
112
|
+
}[keyof Definitions];
|
|
113
|
+
type StrictInstancesConfigureOptions<Options, Definitions extends RaphInstanceDefinitions> = Exclude<keyof Options, keyof RaphInstancesConfigureOptions> extends never ? InvalidInstanceDefinitionKeys<Definitions> extends never ? Options : never : never;
|
|
114
|
+
export type StrictRaphConfigureOptions<Options extends RaphConfigureOptions> = Options extends {
|
|
115
|
+
readonly instances: infer Definitions extends RaphInstanceDefinitions;
|
|
116
|
+
} ? StrictInstancesConfigureOptions<Options, Definitions> : Options extends {
|
|
117
|
+
readonly mode: 'reactivity';
|
|
118
|
+
} ? Options & Record<Exclude<keyof Options, keyof RaphReactivityConfigureOptions>, never> : Options & Record<Exclude<keyof Options, keyof RaphRuntimeConfigureOptions>, never>;
|
|
119
|
+
type DefinitionInstance<Definition> = Definition extends {
|
|
120
|
+
readonly mode: 'reactivity';
|
|
121
|
+
} ? RaphReactivityInstance : RaphRuntime;
|
|
122
|
+
type ResolvedDefinitionId<Key, Definition> = Definition extends {
|
|
123
|
+
readonly id: infer Id extends string;
|
|
124
|
+
} ? Id : Key extends string ? Key : never;
|
|
125
|
+
type InstancesFromDefinitions<Definitions extends RaphInstanceDefinitions> = {
|
|
126
|
+
[Key in keyof Definitions as ResolvedDefinitionId<Key, Definitions[Key]>]: DefinitionInstance<Definitions[Key]>;
|
|
127
|
+
};
|
|
128
|
+
export type RaphInstanceMapForConfigure<Options extends RaphConfigureOptions> = Options extends {
|
|
129
|
+
readonly instances: infer Definitions extends RaphInstanceDefinitions;
|
|
130
|
+
} ? InstancesFromDefinitions<Definitions> : Options extends RaphFlatConfigureOptions ? Record<Options extends {
|
|
131
|
+
readonly id: infer Id extends string;
|
|
132
|
+
} ? Id : 'default', DefinitionInstance<Options>> : never;
|
|
133
|
+
type DefaultFromDefinitions<Definitions extends RaphInstanceDefinitions> = {
|
|
134
|
+
[Key in keyof Definitions]: Definitions[Key] extends {
|
|
135
|
+
readonly default: true;
|
|
136
|
+
} ? DefinitionInstance<Definitions[Key]> : never;
|
|
137
|
+
}[keyof Definitions];
|
|
138
|
+
export type RaphDefaultInstanceForConfigure<Options extends RaphConfigureOptions> = Options extends {
|
|
139
|
+
readonly instances: infer Definitions extends RaphInstanceDefinitions;
|
|
140
|
+
} ? DefaultFromDefinitions<Definitions> : Options extends RaphFlatConfigureOptions ? DefinitionInstance<Options> : never;
|
|
141
|
+
type RuntimeIds<Instances extends Record<string, RaphInstance>> = {
|
|
142
|
+
[Id in keyof Instances]: Instances[Id] extends RaphRuntime ? Id : never;
|
|
143
|
+
}[keyof Instances] & string;
|
|
144
|
+
type ReactivityIds<Instances extends Record<string, RaphInstance>> = {
|
|
145
|
+
[Id in keyof Instances]: Instances[Id] extends RaphReactivityInstance ? Id : never;
|
|
146
|
+
}[keyof Instances] & string;
|
|
147
|
+
export interface ConfiguredRaphRegistry<Instances extends Record<string, RaphInstance>> {
|
|
148
|
+
readonly configured: true;
|
|
149
|
+
readonly defaultInstanceId: keyof Instances & string | undefined;
|
|
150
|
+
createReactivity: (options?: RaphReactivityInstanceOptions) => RaphReactivityInstance;
|
|
151
|
+
createKernel: (options?: ConstructorParameters<typeof import('../path/RaphKernel').RaphKernel>[0]) => RaphKernel;
|
|
152
|
+
createRuntime: (options?: RaphRuntimeOptions) => RaphRuntime;
|
|
153
|
+
disposeInstance: <Id extends keyof Instances & string>(id: Id) => boolean;
|
|
154
|
+
getInstance: <Id extends keyof Instances & string>(id: Id) => Instances[Id] | undefined;
|
|
155
|
+
hasInstance: <Id extends keyof Instances & string>(id: Id) => boolean;
|
|
156
|
+
instance: <Id extends keyof Instances & string>(id: Id) => Instances[Id];
|
|
157
|
+
reactivity: <Id extends ReactivityIds<Instances>>(id: Id) => Extract<Instances[Id], RaphReactivityInstance>;
|
|
158
|
+
runtime: <Id extends RuntimeIds<Instances>>(id: Id) => Extract<Instances[Id], RaphRuntime>;
|
|
24
159
|
}
|
|
25
|
-
|
|
160
|
+
type RuntimeDefaultFacadeApi<DefaultInstance extends RaphRuntime> = RaphRuntimeApi & {
|
|
161
|
+
instance: () => DefaultInstance;
|
|
162
|
+
runtime: () => DefaultInstance;
|
|
163
|
+
};
|
|
164
|
+
type ReactivityDefaultFacadeApi<DefaultInstance extends RaphReactivityInstance> = RaphReactivityApi & {
|
|
165
|
+
instance: () => DefaultInstance;
|
|
166
|
+
reactivity: () => DefaultInstance;
|
|
167
|
+
};
|
|
168
|
+
type DefaultFacadeApi<DefaultInstance extends RaphInstance> = [DefaultInstance] extends [never] ? object : DefaultInstance extends RaphRuntime ? RuntimeDefaultFacadeApi<DefaultInstance> : DefaultInstance extends RaphReactivityInstance ? ReactivityDefaultFacadeApi<DefaultInstance> : object;
|
|
169
|
+
export type ConfiguredRaph<Options extends RaphConfigureOptions> = ConfiguredRaphRegistry<RaphInstanceMapForConfigure<Options>> & DefaultFacadeApi<RaphDefaultInstanceForConfigure<Options>>;
|
|
170
|
+
export {};
|