@raphy-js/raph 1.0.0-dev.18
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/dist/api/Raph.d.ts +97 -0
- package/dist/api/RaphFacadeSession.d.ts +90 -0
- package/dist/api/RaphReactivityInstance.d.ts +72 -0
- package/dist/api/errors.d.ts +25 -0
- package/dist/api/types.d.ts +170 -0
- package/dist/core-CyilRD7s.js +1055 -0
- package/dist/core-ugchZNqC.cjs +1 -0
- package/dist/debug/api/Raph.cjs +1 -0
- package/dist/debug/api/Raph.js +421 -0
- package/dist/debug/api/RaphFacadeSession.cjs +1 -0
- package/dist/debug/api/RaphFacadeSession.js +306 -0
- package/dist/debug/api/RaphReactivityInstance.cjs +1 -0
- package/dist/debug/api/RaphReactivityInstance.js +149 -0
- package/dist/debug/api/errors.cjs +1 -0
- package/dist/debug/api/errors.js +17 -0
- package/dist/debug/api/types.cjs +1 -0
- package/dist/debug/api/types.js +1 -0
- package/dist/debug/path/DataPath.cjs +1 -0
- package/dist/debug/path/DataPath.js +394 -0
- package/dist/debug/path/PathRouter.cjs +1 -0
- package/dist/debug/path/PathRouter.js +86 -0
- package/dist/debug/path/RaphKernel.cjs +1 -0
- package/dist/debug/path/RaphKernel.js +687 -0
- package/dist/debug/path/data-path.types.cjs +1 -0
- package/dist/debug/path/data-path.types.js +1 -0
- 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 +157 -0
- package/dist/debug/path/derived/RaphDerivedHandle.cjs +1 -0
- package/dist/debug/path/derived/RaphDerivedHandle.js +125 -0
- package/dist/debug/path/derived/derived-collection.types.cjs +1 -0
- package/dist/debug/path/derived/derived-collection.types.js +1 -0
- package/dist/debug/path/derived/derived-collection.utils.cjs +1 -0
- package/dist/debug/path/derived/derived-collection.utils.js +179 -0
- 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/derived/derived-strategy.utils.cjs +1 -0
- package/dist/debug/path/derived/derived-strategy.utils.js +20 -0
- package/dist/debug/path/meta/MetaController.cjs +1 -0
- package/dist/debug/path/meta/MetaController.js +214 -0
- package/dist/debug/path/meta/RaphMeta.cjs +1 -0
- package/dist/debug/path/meta/RaphMeta.js +68 -0
- package/dist/debug/path/meta/RaphMetaStore.cjs +1 -0
- package/dist/debug/path/meta/RaphMetaStore.js +184 -0
- package/dist/debug/path/meta/meta.types.cjs +1 -0
- package/dist/debug/path/meta/meta.types.js +1 -0
- package/dist/debug/path/path.types.cjs +1 -0
- package/dist/debug/path/path.types.js +1 -0
- package/dist/debug/path/pathSegmentKey.cjs +1 -0
- package/dist/debug/path/pathSegmentKey.js +12 -0
- package/dist/debug/path/storage/AdapterPathStore.cjs +1 -0
- package/dist/debug/path/storage/AdapterPathStore.js +133 -0
- package/dist/debug/path/storage/DefaultDataAdapter.cjs +1 -0
- package/dist/debug/path/storage/DefaultDataAdapter.js +356 -0
- package/dist/debug/path/storage/PathEventHub.cjs +1 -0
- package/dist/debug/path/storage/PathEventHub.js +148 -0
- package/dist/debug/path/storage/PathStore.cjs +1 -0
- package/dist/debug/path/storage/PathStore.js +326 -0
- package/dist/debug/path/storage/createDataDraft.cjs +1 -0
- package/dist/debug/path/storage/createDataDraft.js +71 -0
- 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/engine.cjs +1 -0
- package/dist/debug/reactivity/engine.js +1305 -0
- package/dist/debug/reactivity/reactive-object.cjs +1 -0
- package/dist/debug/reactivity/reactive-object.js +280 -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/RaphRuntime.cjs +1 -0
- package/dist/debug/runtime/RaphRuntime.js +979 -0
- package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -0
- package/dist/debug/runtime/diagnostics/RaphDebug.js +297 -0
- package/dist/debug/runtime/errors.cjs +1 -0
- package/dist/debug/runtime/errors.js +15 -0
- package/dist/debug/runtime/ownership/RaphEffectScope.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphEffectScope.js +171 -0
- package/dist/debug/runtime/ownership/RaphNode.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphNode.js +206 -0
- package/dist/debug/runtime/ownership/RaphScope.cjs +1 -0
- package/dist/debug/runtime/ownership/RaphScope.js +101 -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/ownership/parentGraph.cjs +1 -0
- package/dist/debug/runtime/ownership/parentGraph.js +10 -0
- package/dist/debug/runtime/ownership/throwDisposalErrors.cjs +1 -0
- package/dist/debug/runtime/ownership/throwDisposalErrors.js +9 -0
- package/dist/debug/runtime/phases/RaphFrameLoop.cjs +1 -0
- package/dist/debug/runtime/phases/RaphFrameLoop.js +106 -0
- package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -0
- package/dist/debug/runtime/phases/RaphPhasePipeline.js +587 -0
- package/dist/debug/runtime/phases/orderPhaseTasks.cjs +1 -0
- package/dist/debug/runtime/phases/orderPhaseTasks.js +59 -0
- package/dist/debug/runtime/phases/phase.types.cjs +1 -0
- package/dist/debug/runtime/phases/phase.types.js +8 -0
- package/dist/debug/runtime/reactivity/PathHandle.cjs +1 -0
- package/dist/debug/runtime/reactivity/PathHandle.js +175 -0
- package/dist/debug/runtime/reactivity/RaphMetaSource.cjs +1 -0
- package/dist/debug/runtime/reactivity/RaphMetaSource.js +112 -0
- package/dist/debug/runtime/reactivity/RaphWorkGraph.cjs +1 -0
- package/dist/debug/runtime/reactivity/RaphWorkGraph.js +995 -0
- package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -0
- package/dist/debug/runtime/reactivity/RuntimeReactivity.js +156 -0
- package/dist/debug/runtime/reactivity/RuntimeWatch.cjs +1 -0
- package/dist/debug/runtime/reactivity/RuntimeWatch.js +88 -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 +17 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +48 -0
- 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 +837 -0
- package/dist/main.d.ts +20 -0
- package/dist/path/DataPath.d.ts +73 -0
- package/dist/path/PathRouter.d.ts +21 -0
- package/dist/path/RaphKernel.d.ts +169 -0
- package/dist/path/data-path.types.d.ts +34 -0
- package/dist/path/data-path.utils.d.ts +9 -0
- package/dist/path/derived/DerivedRegistry.d.ts +67 -0
- package/dist/path/derived/RaphDerivedHandle.d.ts +97 -0
- package/dist/path/derived/derived-collection.types.d.ts +12 -0
- package/dist/path/derived/derived-collection.utils.d.ts +20 -0
- package/dist/path/derived/derived-strategy.types.d.ts +12 -0
- package/dist/path/derived/derived-strategy.utils.d.ts +4 -0
- package/dist/path/meta/MetaController.d.ts +85 -0
- package/dist/path/meta/RaphMeta.d.ts +45 -0
- package/dist/path/meta/RaphMetaStore.d.ts +45 -0
- package/dist/path/meta/meta.types.d.ts +31 -0
- package/dist/path/path.types.d.ts +27 -0
- package/dist/path/pathSegmentKey.d.ts +2 -0
- package/dist/path/storage/AdapterPathStore.d.ts +45 -0
- package/dist/path/storage/DefaultDataAdapter.d.ts +63 -0
- package/dist/path/storage/PathEventHub.d.ts +48 -0
- package/dist/path/storage/PathStore.d.ts +51 -0
- package/dist/path/storage/createDataDraft.d.ts +4 -0
- package/dist/path/storage/data-adapter.types.d.ts +17 -0
- package/dist/path.cjs +1 -0
- package/dist/path.js +18 -0
- package/dist/raph.cjs +1 -0
- package/dist/raph.js +48 -0
- package/dist/reactivity/engine.d.ts +393 -0
- package/dist/reactivity/reactive-object.d.ts +36 -0
- package/dist/reactivity/scope.d.ts +146 -0
- package/dist/reactivity/types.d.ts +175 -0
- package/dist/reactivity/watch.d.ts +15 -0
- package/dist/reactivity.cjs +1 -0
- package/dist/reactivity.js +14 -0
- package/dist/runtime/RaphRuntime.d.ts +225 -0
- package/dist/runtime/diagnostics/RaphDebug.d.ts +239 -0
- package/dist/runtime/errors.d.ts +21 -0
- package/dist/runtime/ownership/RaphEffectScope.d.ts +29 -0
- package/dist/runtime/ownership/RaphNode.d.ts +40 -0
- package/dist/runtime/ownership/RaphScope.d.ts +38 -0
- package/dist/runtime/ownership/parent-graph.types.d.ts +4 -0
- package/dist/runtime/ownership/parentGraph.d.ts +3 -0
- package/dist/runtime/ownership/throwDisposalErrors.d.ts +1 -0
- package/dist/runtime/phases/RaphFrameLoop.d.ts +51 -0
- package/dist/runtime/phases/RaphPhasePipeline.d.ts +79 -0
- package/dist/runtime/phases/orderPhaseTasks.d.ts +6 -0
- package/dist/runtime/phases/phase.types.d.ts +92 -0
- package/dist/runtime/reactivity/PathHandle.d.ts +80 -0
- package/dist/runtime/reactivity/RaphMetaSource.d.ts +32 -0
- package/dist/runtime/reactivity/RaphWorkGraph.d.ts +171 -0
- package/dist/runtime/reactivity/RuntimeReactivity.d.ts +45 -0
- package/dist/runtime/reactivity/RuntimeWatch.d.ts +34 -0
- package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +11 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.js +23 -0
- package/package.json +141 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { DerivedOptions, RaphDerivedHandle } from '../path/derived/RaphDerivedHandle';
|
|
2
|
+
import { DataPathDef, PathOptions } from '../path/path.types';
|
|
3
|
+
import { RaphKernel, RaphKernelOptions, RaphKernelRoot } from '../path/RaphKernel';
|
|
4
|
+
import { ScopeNode } from '../reactivity/scope';
|
|
5
|
+
import { Disposer, ReadonlySignal, Signal, WatchOptions, WatchSource, WatchValue, WritableComputedOptions } from '../reactivity/types';
|
|
6
|
+
import { RaphRuntimeDebug } from '../runtime/diagnostics/RaphDebug';
|
|
7
|
+
import { NodeOptions, RaphNode } from '../runtime/ownership/RaphNode';
|
|
8
|
+
import { RaphScope } from '../runtime/ownership/RaphScope';
|
|
9
|
+
import { FrameLoopLease, RaphAggregateSource, RaphEffectOptions, RaphPhase, RaphPhaseEffect, RaphWatchOptions, RaphWatchSource } from '../runtime/phases/phase.types';
|
|
10
|
+
import { RaphRuntimeMeta, RaphRuntimeOptions, RaphRuntime } from '../runtime/RaphRuntime';
|
|
11
|
+
import { PathHandle } from '../runtime/reactivity/PathHandle';
|
|
12
|
+
import { RaphAggregate } from '../runtime/reactivity/RaphWorkGraph';
|
|
13
|
+
import { ConfiguredRaph, RaphFlatConfigureOptions, RaphInstance, RaphInstanceDefinitions, RaphInstancesConfigureOptions, RaphReactivityInstanceOptions, StrictRaphConfigureOptions } from './types';
|
|
14
|
+
import { collectionByKey, filterByKey, full } from '../path/derived/derived-strategy.utils';
|
|
15
|
+
import { RaphReactivityInstance } from './RaphReactivityInstance';
|
|
16
|
+
type WithoutRuntimePathHandle<Source> = Source extends PathHandle<unknown> ? never : Source extends readonly unknown[] ? {
|
|
17
|
+
[Key in keyof Source]: Source[Key] extends PathHandle<unknown> ? never : Source[Key];
|
|
18
|
+
} : Source;
|
|
19
|
+
/**
|
|
20
|
+
* Process-level convenience facade над одной явно configured heterogeneous session.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Raph {
|
|
23
|
+
private static _handle;
|
|
24
|
+
private constructor();
|
|
25
|
+
static get configured(): boolean;
|
|
26
|
+
static get defaultInstanceId(): string | undefined;
|
|
27
|
+
static get kernel(): RaphKernel;
|
|
28
|
+
static get meta(): RaphRuntimeMeta;
|
|
29
|
+
static get debug(): RaphRuntimeDebug;
|
|
30
|
+
static get root(): RaphNode;
|
|
31
|
+
static get rootScope(): RaphScope;
|
|
32
|
+
static get frameTick(): ReadonlySignal<number>;
|
|
33
|
+
static get frame(): RaphRuntime['frame'];
|
|
34
|
+
static get phases(): readonly RaphPhase[];
|
|
35
|
+
static get loopEnabled(): boolean;
|
|
36
|
+
static configure<const Definitions extends RaphInstanceDefinitions>(options: StrictRaphConfigureOptions<RaphInstancesConfigureOptions<Definitions>>): ConfiguredRaph<RaphInstancesConfigureOptions<Definitions>>;
|
|
37
|
+
static configure<const Options extends RaphFlatConfigureOptions>(options: StrictRaphConfigureOptions<Options>): ConfiguredRaph<Options>;
|
|
38
|
+
static reset(): void;
|
|
39
|
+
static instance(id?: string): RaphInstance;
|
|
40
|
+
static getInstance(id: string): RaphInstance | undefined;
|
|
41
|
+
static hasInstance(id: string): boolean;
|
|
42
|
+
static disposeInstance(id: string): boolean;
|
|
43
|
+
static runtime(id?: string): RaphRuntime;
|
|
44
|
+
static reactivity(id?: string): RaphReactivityInstance;
|
|
45
|
+
static createRuntime(options?: RaphRuntimeOptions): RaphRuntime;
|
|
46
|
+
static createReactivity(options?: RaphReactivityInstanceOptions): RaphReactivityInstance;
|
|
47
|
+
static createKernel(options?: RaphKernelOptions): RaphKernel;
|
|
48
|
+
static signal<T>(value: T): Signal<T>;
|
|
49
|
+
static reactive<T extends object>(value: T): T;
|
|
50
|
+
static computed<T>(getter: () => T): ReadonlySignal<T>;
|
|
51
|
+
static computed<T>(options: WritableComputedOptions<T>): Signal<T>;
|
|
52
|
+
static effect(callback: () => void | Disposer): Disposer;
|
|
53
|
+
static effect(phase: string, callback: RaphPhaseEffect, options?: RaphEffectOptions): Disposer;
|
|
54
|
+
static watch<Source extends WatchSource | readonly WatchSource[]>(source: Source & WithoutRuntimePathHandle<Source>, callback: (value: WatchValue<Source>, previous: WatchValue<Source> | undefined) => void | Disposer, options?: WatchOptions): Disposer;
|
|
55
|
+
static watch(source: RaphWatchSource, phase: string, callback: RaphPhaseEffect, options?: RaphWatchOptions): Disposer;
|
|
56
|
+
static batch<T>(operation: () => T): T;
|
|
57
|
+
static untracked<T>(operation: () => T): T;
|
|
58
|
+
static scope(): ScopeNode;
|
|
59
|
+
static scope(id: string): RaphScope;
|
|
60
|
+
static action<Args extends unknown[], Result>(operation: (...args: Args) => Result): (...args: Args) => Result;
|
|
61
|
+
static action<Args extends unknown[], Result>(name: string, operation: (...args: Args) => Result): (...args: Args) => Result;
|
|
62
|
+
static definePhases(phases: readonly RaphPhase[]): void;
|
|
63
|
+
static addPhase(phase: RaphPhase): void;
|
|
64
|
+
static clearPhases(): void;
|
|
65
|
+
static requestExecution(): void;
|
|
66
|
+
static flush(): void;
|
|
67
|
+
static afterFlush(): Promise<void>;
|
|
68
|
+
static acquireLoop(owner: string): FrameLoopLease;
|
|
69
|
+
static startLoop(): void;
|
|
70
|
+
static stopLoop(): void;
|
|
71
|
+
static aggregate(sources: readonly RaphAggregateSource[]): RaphAggregate;
|
|
72
|
+
static node<TApi = void>(options: NodeOptions, setup?: (node: RaphNode) => TApi): RaphNode<TApi>;
|
|
73
|
+
static getNode(id: string): RaphNode | undefined;
|
|
74
|
+
static derive<TSource, TTarget>(options: DerivedOptions<TSource, TTarget>): RaphDerivedHandle<TSource, TTarget>;
|
|
75
|
+
static getDerivedSnapshot(): ReturnType<RaphKernel['getDerivedSnapshot']>;
|
|
76
|
+
static path<T>(path: DataPathDef, options?: PathOptions): PathHandle<T>;
|
|
77
|
+
static get<T = RaphKernelRoot>(): T | undefined;
|
|
78
|
+
static get<T = unknown>(path: DataPathDef, options?: PathOptions): T | undefined;
|
|
79
|
+
static peek<T = RaphKernelRoot>(): T | undefined;
|
|
80
|
+
static peek<T = unknown>(path: DataPathDef, options?: PathOptions): T | undefined;
|
|
81
|
+
static has(path: DataPathDef, options?: PathOptions): boolean;
|
|
82
|
+
static set<T>(path: DataPathDef, value: T, options?: PathOptions): void;
|
|
83
|
+
static merge(path: DataPathDef, value: unknown, options?: PathOptions): void;
|
|
84
|
+
static delete(path: DataPathDef, options?: PathOptions): void;
|
|
85
|
+
static readonly Scheduler: Readonly<{
|
|
86
|
+
readonly AnimationFrame: "animationFrame";
|
|
87
|
+
readonly Microtask: "microtask";
|
|
88
|
+
readonly Sync: "sync";
|
|
89
|
+
}>;
|
|
90
|
+
static readonly DerivedStrategy: Readonly<{
|
|
91
|
+
full: typeof full;
|
|
92
|
+
collectionByKey: typeof collectionByKey;
|
|
93
|
+
filterByKey: typeof filterByKey;
|
|
94
|
+
}>;
|
|
95
|
+
private static _require;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { RaphRuntimeOptions, RaphRuntime } from '../runtime/RaphRuntime';
|
|
2
|
+
import { RaphConfigureOptions, RaphInstance, RaphReactivityInstanceOptions } from './types';
|
|
3
|
+
import { RaphKernel } from '../path/RaphKernel';
|
|
4
|
+
import { RaphReactivityInstance } from './RaphReactivityInstance';
|
|
5
|
+
/**
|
|
6
|
+
* Владеет registry, default pointer и lifecycle одной facade generation.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RaphFacadeSession {
|
|
9
|
+
private static _runtimeCounter;
|
|
10
|
+
private static _reactivityCounter;
|
|
11
|
+
private readonly _instances;
|
|
12
|
+
private readonly _instanceOrder;
|
|
13
|
+
private _defaultInstance;
|
|
14
|
+
private _disposed;
|
|
15
|
+
private constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Валидирует всю конфигурацию до construction и атомарно создаёт session.
|
|
18
|
+
*/
|
|
19
|
+
static create(options: RaphConfigureOptions): RaphFacadeSession;
|
|
20
|
+
/**
|
|
21
|
+
* Показывает, завершен ли lifecycle session.
|
|
22
|
+
*/
|
|
23
|
+
get disposed(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Возвращает ID default instance без создания fallback.
|
|
26
|
+
*/
|
|
27
|
+
get defaultInstanceId(): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Возвращает default либо явно адресованный instance.
|
|
30
|
+
*/
|
|
31
|
+
instance(id?: string): RaphInstance;
|
|
32
|
+
/**
|
|
33
|
+
* Читает registry без ошибки для неизвестного ID.
|
|
34
|
+
*/
|
|
35
|
+
getInstance(id: string): RaphInstance | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Проверяет наличие managed instance.
|
|
38
|
+
*/
|
|
39
|
+
hasInstance(id: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Возвращает Runtime или сообщает о capability mismatch.
|
|
42
|
+
*/
|
|
43
|
+
runtime(id?: string): RaphRuntime;
|
|
44
|
+
/**
|
|
45
|
+
* Возвращает pure-reactivity instance или сообщает о capability mismatch.
|
|
46
|
+
*/
|
|
47
|
+
reactivity(id?: string): RaphReactivityInstance;
|
|
48
|
+
/**
|
|
49
|
+
* Создаёт managed Runtime без неявного изменения default pointer.
|
|
50
|
+
*/
|
|
51
|
+
createRuntime(options?: RaphRuntimeOptions): RaphRuntime;
|
|
52
|
+
/**
|
|
53
|
+
* Создаёт managed pure-reactivity instance без изменения default pointer.
|
|
54
|
+
*/
|
|
55
|
+
createReactivity(options?: RaphReactivityInstanceOptions): RaphReactivityInstance;
|
|
56
|
+
/** Создаёт unmanaged Kernel, сохраняя generation-bound lifecycle check. */
|
|
57
|
+
createKernel(options?: ConstructorParameters<typeof RaphKernel>[0]): RaphKernel;
|
|
58
|
+
/**
|
|
59
|
+
* Освобождает managed instance и сразу удаляет его из registry.
|
|
60
|
+
*/
|
|
61
|
+
disposeInstance(id: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Освобождает managed instances в обратном порядке construction.
|
|
64
|
+
*/
|
|
65
|
+
dispose(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Создаёт instance из заранее проверенного definition.
|
|
68
|
+
*/
|
|
69
|
+
private _construct;
|
|
70
|
+
/**
|
|
71
|
+
* Регистрирует единственный managed owner и его terminal cleanup.
|
|
72
|
+
*/
|
|
73
|
+
private _register;
|
|
74
|
+
/**
|
|
75
|
+
* Удаляет точную identity после её terminal disposal.
|
|
76
|
+
*/
|
|
77
|
+
private _forget;
|
|
78
|
+
/**
|
|
79
|
+
* Формирует свободный ID для dynamic factory.
|
|
80
|
+
*/
|
|
81
|
+
private _generateId;
|
|
82
|
+
/**
|
|
83
|
+
* Отклоняет duplicate resolved ID до registration.
|
|
84
|
+
*/
|
|
85
|
+
private _assertFreeId;
|
|
86
|
+
/**
|
|
87
|
+
* Запрещает stale typed/global handle после reset.
|
|
88
|
+
*/
|
|
89
|
+
private _assertActive;
|
|
90
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Disposer, ReadonlySignal, Signal, WatchCallback, WatchOptions, WatchSource, WritableComputedOptions } from '../reactivity/types';
|
|
2
|
+
import { RaphReactivityInstanceOptions } from './types';
|
|
3
|
+
import { RaphReactivity } from '../reactivity/engine';
|
|
4
|
+
import { ScopeNode } from '../reactivity/scope';
|
|
5
|
+
/**
|
|
6
|
+
* Управляемый pure-reactivity instance одной facade session.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RaphReactivityInstance {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly mode: "reactivity";
|
|
11
|
+
readonly engine: RaphReactivity;
|
|
12
|
+
readonly rootScope: ScopeNode;
|
|
13
|
+
private _disposed;
|
|
14
|
+
private readonly _disposedListeners;
|
|
15
|
+
/**
|
|
16
|
+
* Создаёт изолированный graph с общим lifecycle owner.
|
|
17
|
+
*/
|
|
18
|
+
constructor(id: string, options?: Omit<RaphReactivityInstanceOptions, 'id'>);
|
|
19
|
+
/**
|
|
20
|
+
* Показывает, завершён ли lifecycle instance.
|
|
21
|
+
*/
|
|
22
|
+
get disposed(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Создаёт signal, принадлежащий root scope instance.
|
|
25
|
+
*/
|
|
26
|
+
signal<T>(value: T): Signal<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Создаёт deep reactive Proxy в изолированном graph instance.
|
|
29
|
+
*/
|
|
30
|
+
reactive<T extends object>(value: T): T;
|
|
31
|
+
/**
|
|
32
|
+
* Создаёт root-owned computed только для чтения.
|
|
33
|
+
*/
|
|
34
|
+
computed<T>(getter: () => T): ReadonlySignal<T>;
|
|
35
|
+
/**
|
|
36
|
+
* Создаёт root-owned writable computed.
|
|
37
|
+
*/
|
|
38
|
+
computed<T>(options: WritableComputedOptions<T>): Signal<T>;
|
|
39
|
+
/**
|
|
40
|
+
* Создаёт синхронный effect в root scope instance.
|
|
41
|
+
*/
|
|
42
|
+
effect(callback: () => void | Disposer): Disposer;
|
|
43
|
+
/**
|
|
44
|
+
* Создаёт value watch в root scope instance.
|
|
45
|
+
*/
|
|
46
|
+
watch<S extends WatchSource | readonly WatchSource[]>(source: S, callback: WatchCallback<S>, options?: WatchOptions): Disposer;
|
|
47
|
+
/**
|
|
48
|
+
* Группирует propagation одного reactive graph.
|
|
49
|
+
*/
|
|
50
|
+
batch<T>(operation: () => T): T;
|
|
51
|
+
/**
|
|
52
|
+
* Выполняет операцию без dependency tracking.
|
|
53
|
+
*/
|
|
54
|
+
untracked<T>(operation: () => T): T;
|
|
55
|
+
/**
|
|
56
|
+
* Создаёт дочерний resource scope, освобождаемый вместе с instance.
|
|
57
|
+
*/
|
|
58
|
+
scope(): ScopeNode;
|
|
59
|
+
/**
|
|
60
|
+
* Освобождает owned resources и делает retained reactive proxies терминальными.
|
|
61
|
+
*/
|
|
62
|
+
dispose(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Привязывает registry cleanup к lifecycle managed instance.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
_onDisposed(listener: () => void): Disposer;
|
|
68
|
+
/**
|
|
69
|
+
* Запрещает операции после завершения lifecycle.
|
|
70
|
+
*/
|
|
71
|
+
private _assertAlive;
|
|
72
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Базовая ошибка публичного API Raph.
|
|
3
|
+
*/
|
|
4
|
+
export declare class RaphError extends Error {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Сообщает о нарушении lifecycle или параметров конфигурации facade.
|
|
8
|
+
*/
|
|
9
|
+
export declare class RaphConfigurationError extends RaphError {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Сообщает, что выбранный instance не поддерживает запрошенную capability.
|
|
13
|
+
*/
|
|
14
|
+
export declare class RaphCapabilityError extends RaphConfigurationError {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Сообщает об отсутствии default instance у facade session.
|
|
18
|
+
*/
|
|
19
|
+
export declare class RaphDefaultInstanceError extends RaphConfigurationError {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Сообщает, что generation-bound handle относится к уже освобождённой session.
|
|
23
|
+
*/
|
|
24
|
+
export declare class RaphFacadeDisposedError extends RaphConfigurationError {
|
|
25
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { RaphKernel } from '../path/RaphKernel';
|
|
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'];
|
|
17
|
+
}
|
|
18
|
+
export interface RaphReactivityApi extends RaphReactiveApi {
|
|
19
|
+
readonly effect: RaphReactivity['effect'];
|
|
20
|
+
readonly watch: RaphReactivity['watch'];
|
|
21
|
+
readonly scope: () => ScopeNode;
|
|
22
|
+
}
|
|
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;
|
|
26
|
+
}
|
|
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;
|
|
86
|
+
readonly mode: 'runtime';
|
|
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;
|
|
102
|
+
readonly kernel?: never;
|
|
103
|
+
readonly mode?: never;
|
|
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>;
|
|
159
|
+
}
|
|
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 {};
|