@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.
Files changed (139) hide show
  1. package/LICENSE +202 -0
  2. package/ReadMe.md +153 -0
  3. package/dist/api/Raph.d.ts +228 -0
  4. package/dist/api/errors.d.ts +20 -0
  5. package/dist/api/public.d.ts +22 -0
  6. package/dist/api/types.d.ts +25 -0
  7. package/dist/debug/api/Raph.cjs +1 -0
  8. package/dist/debug/api/Raph.js +419 -0
  9. package/dist/debug/api/errors.cjs +1 -0
  10. package/dist/debug/api/errors.js +14 -0
  11. package/dist/debug/api/public.cjs +1 -0
  12. package/dist/debug/api/public.js +40 -0
  13. package/dist/debug/api/types.cjs +1 -0
  14. package/dist/debug/api/types.js +1 -0
  15. package/dist/debug/path/AdapterPathStore.cjs +1 -0
  16. package/dist/debug/path/AdapterPathStore.js +133 -0
  17. package/dist/debug/path/DerivedRegistry.cjs +1 -0
  18. package/dist/debug/path/DerivedRegistry.js +157 -0
  19. package/dist/debug/path/MetaController.cjs +1 -0
  20. package/dist/debug/path/MetaController.js +214 -0
  21. package/dist/debug/path/PathEventHub.cjs +1 -0
  22. package/dist/debug/path/PathEventHub.js +148 -0
  23. package/dist/debug/path/PathStore.cjs +1 -0
  24. package/dist/debug/path/PathStore.js +326 -0
  25. package/dist/debug/path/RaphDerivedHandle.cjs +1 -0
  26. package/dist/debug/path/RaphDerivedHandle.js +125 -0
  27. package/dist/debug/path/RaphKernel.cjs +1 -0
  28. package/dist/debug/path/RaphKernel.js +636 -0
  29. package/dist/debug/path/RaphMeta.cjs +1 -0
  30. package/dist/debug/path/RaphMeta.js +68 -0
  31. package/dist/debug/path/RaphMetaStore.cjs +1 -0
  32. package/dist/debug/path/RaphMetaStore.js +184 -0
  33. package/dist/debug/path/data-adapter.cjs +1 -0
  34. package/dist/debug/path/data-adapter.js +356 -0
  35. package/dist/debug/path/data-draft.cjs +1 -0
  36. package/dist/debug/path/data-draft.js +71 -0
  37. package/dist/debug/path/data-path.cjs +1 -0
  38. package/dist/debug/path/data-path.js +423 -0
  39. package/dist/debug/path/derived-collection.cjs +1 -0
  40. package/dist/debug/path/derived-collection.js +179 -0
  41. package/dist/debug/path/derived-strategies.cjs +1 -0
  42. package/dist/debug/path/derived-strategies.js +20 -0
  43. package/dist/debug/path/meta.types.cjs +1 -0
  44. package/dist/debug/path/meta.types.js +1 -0
  45. package/dist/debug/path/path-router.cjs +1 -0
  46. package/dist/debug/path/path-router.js +86 -0
  47. package/dist/debug/path/path.types.cjs +1 -0
  48. package/dist/debug/path/path.types.js +1 -0
  49. package/dist/debug/path/public.cjs +1 -0
  50. package/dist/debug/path/public.js +18 -0
  51. package/dist/debug/path/segment-key.cjs +1 -0
  52. package/dist/debug/path/segment-key.js +12 -0
  53. package/dist/debug/reactivity/engine.cjs +1 -0
  54. package/dist/debug/reactivity/engine.js +1133 -0
  55. package/dist/debug/reactivity/scope.cjs +1 -0
  56. package/dist/debug/reactivity/scope.js +274 -0
  57. package/dist/debug/reactivity/types.cjs +1 -0
  58. package/dist/debug/reactivity/types.js +1 -0
  59. package/dist/debug/reactivity/watch.cjs +1 -0
  60. package/dist/debug/reactivity/watch.js +64 -0
  61. package/dist/debug/runtime/PathHandle.cjs +1 -0
  62. package/dist/debug/runtime/PathHandle.js +139 -0
  63. package/dist/debug/runtime/RaphDebug.cjs +1 -0
  64. package/dist/debug/runtime/RaphDebug.js +15 -0
  65. package/dist/debug/runtime/RaphFrameLoop.cjs +1 -0
  66. package/dist/debug/runtime/RaphFrameLoop.js +106 -0
  67. package/dist/debug/runtime/RaphNode.cjs +1 -0
  68. package/dist/debug/runtime/RaphNode.js +143 -0
  69. package/dist/debug/runtime/RaphPhasePipeline.cjs +1 -0
  70. package/dist/debug/runtime/RaphPhasePipeline.js +526 -0
  71. package/dist/debug/runtime/RaphRuntime.cjs +1 -0
  72. package/dist/debug/runtime/RaphRuntime.js +700 -0
  73. package/dist/debug/runtime/RaphScope.cjs +1 -0
  74. package/dist/debug/runtime/RaphScope.js +64 -0
  75. package/dist/debug/runtime/RuntimeReactivity.cjs +1 -0
  76. package/dist/debug/runtime/RuntimeReactivity.js +154 -0
  77. package/dist/debug/runtime/RuntimeWatch.cjs +1 -0
  78. package/dist/debug/runtime/RuntimeWatch.js +71 -0
  79. package/dist/debug/runtime/disposal.cjs +1 -0
  80. package/dist/debug/runtime/disposal.js +9 -0
  81. package/dist/debug/runtime/errors.cjs +1 -0
  82. package/dist/debug/runtime/errors.js +12 -0
  83. package/dist/debug/runtime/parent-graph.cjs +1 -0
  84. package/dist/debug/runtime/parent-graph.js +10 -0
  85. package/dist/debug/runtime/phase.types.cjs +1 -0
  86. package/dist/debug/runtime/phase.types.js +8 -0
  87. package/dist/debug/runtime/public.cjs +1 -0
  88. package/dist/debug/runtime/public.js +18 -0
  89. package/dist/debug/runtime/runtime-reactivity.types.cjs +1 -0
  90. package/dist/debug/runtime/runtime-reactivity.types.js +1 -0
  91. package/dist/index.cjs +1 -0
  92. package/dist/index.js +40 -0
  93. package/dist/path/AdapterPathStore.d.ts +45 -0
  94. package/dist/path/DerivedRegistry.d.ts +67 -0
  95. package/dist/path/MetaController.d.ts +85 -0
  96. package/dist/path/PathEventHub.d.ts +48 -0
  97. package/dist/path/PathStore.d.ts +51 -0
  98. package/dist/path/RaphDerivedHandle.d.ts +97 -0
  99. package/dist/path/RaphKernel.d.ts +166 -0
  100. package/dist/path/RaphMeta.d.ts +45 -0
  101. package/dist/path/RaphMetaStore.d.ts +45 -0
  102. package/dist/path/data-adapter.d.ts +78 -0
  103. package/dist/path/data-draft.d.ts +4 -0
  104. package/dist/path/data-path.d.ts +97 -0
  105. package/dist/path/derived-collection.d.ts +30 -0
  106. package/dist/path/derived-strategies.d.ts +15 -0
  107. package/dist/path/meta.types.d.ts +33 -0
  108. package/dist/path/path-router.d.ts +21 -0
  109. package/dist/path/path.types.d.ts +26 -0
  110. package/dist/path/public.d.ts +14 -0
  111. package/dist/path/segment-key.d.ts +2 -0
  112. package/dist/path.cjs +1 -0
  113. package/dist/path.js +18 -0
  114. package/dist/raph.cjs +1 -0
  115. package/dist/raph.js +40 -0
  116. package/dist/reactivity/engine.d.ts +379 -0
  117. package/dist/reactivity/scope.d.ts +146 -0
  118. package/dist/reactivity/types.d.ts +150 -0
  119. package/dist/reactivity/watch.d.ts +15 -0
  120. package/dist/reactivity.cjs +1 -0
  121. package/dist/reactivity.js +14 -0
  122. package/dist/runtime/PathHandle.d.ts +72 -0
  123. package/dist/runtime/RaphDebug.d.ts +32 -0
  124. package/dist/runtime/RaphFrameLoop.d.ts +51 -0
  125. package/dist/runtime/RaphNode.d.ts +68 -0
  126. package/dist/runtime/RaphPhasePipeline.d.ts +133 -0
  127. package/dist/runtime/RaphRuntime.d.ts +285 -0
  128. package/dist/runtime/RaphScope.d.ts +50 -0
  129. package/dist/runtime/RuntimeReactivity.d.ts +40 -0
  130. package/dist/runtime/RuntimeWatch.d.ts +28 -0
  131. package/dist/runtime/disposal.d.ts +1 -0
  132. package/dist/runtime/errors.d.ts +16 -0
  133. package/dist/runtime/parent-graph.d.ts +5 -0
  134. package/dist/runtime/phase.types.d.ts +49 -0
  135. package/dist/runtime/public.d.ts +13 -0
  136. package/dist/runtime/runtime-reactivity.types.d.ts +9 -0
  137. package/dist/runtime.cjs +1 -0
  138. package/dist/runtime.js +18 -0
  139. package/package.json +109 -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.
package/ReadMe.md ADDED
@@ -0,0 +1,153 @@
1
+ # @raphy-js/raph
2
+
3
+ Raph объединяет signal, path и runtime слои из Raph Next в одном публичном
4
+ пакете. Benchmark-наборы и исторические результаты сохранены в `src/test/benchmarks/bench-lab`.
5
+
6
+ Новая архитектура, изменения timing и миграция API описаны в [MIGRATION.md](MIGRATION.md).
7
+
8
+ ## Entry points
9
+
10
+ | Import | Назначение |
11
+ |---|---|
12
+ | `@raphy-js/raph` | плоский настраиваемый facade `Raph` и совместимые public-типы |
13
+ | `@raphy-js/raph/path` | PathStore, Kernel, adapters, Meta и materialized derived |
14
+ | `@raphy-js/raph/runtime` | RaphRuntime, ownership, execution tree, phases и FrameLoop |
15
+ | `@raphy-js/raph/raph` | совместимый alias полного root API |
16
+ | `@raphy-js/raph/reactivity` | функции `signal`, `computed`, `effect`, `watch`, `batch`, `untracked` и класс `RaphReactivity` для изолированного графа |
17
+ | `@raphy-js/raph/debug/*` | отладочный доступ к собранным production-модулям, например `debug/reactivity/engine` |
18
+
19
+ Корневой import и `/raph` предоставляют один прикладной фасад `Raph`.
20
+ До первой операции фасада приложение обязано один раз выбрать режим:
21
+
22
+ ```ts
23
+ import { Raph } from '@raphy-js/raph'
24
+
25
+ Raph.configure({ mode: 'runtime' })
26
+ const count = Raph.signal(0)
27
+ ```
28
+
29
+ Начальные runtime phases можно определить там же, а затем дополнить через
30
+ `definePhases()` или `addPhase()` до первого фактического выполнения phase
31
+ pipeline:
32
+
33
+ ```ts
34
+ Raph.configure({
35
+ mode: 'runtime',
36
+ phases: [
37
+ { name: 'calculate', traversal: 'dirty-only' },
38
+ ],
39
+ })
40
+
41
+ Raph.addPhase({ name: 'dom-write', traversal: 'dirty-only' })
42
+ ```
43
+
44
+ До первого выполнения разрешено уточнять pipeline даже после регистрации phase
45
+ effects и observers, пока новая конфигурация сохраняет все используемые ими
46
+ имена фаз. Queued work при этом не теряется. После первого выполнения
47
+ `definePhases()`, `addPhase()` и `clearPhases()` отклоняются, чтобы порядок и
48
+ маршрутизация работающего pipeline оставались неизменными.
49
+
50
+ Для приложения только с синхронной реактивностью используется
51
+ `Raph.configure({ mode: 'reactivity' })`. Для нескольких явно именованных
52
+ Runtime:
53
+
54
+ ```ts
55
+ Raph.configure({ mode: 'runtime', createDefaultRuntime: false })
56
+ export const editor = Raph.createRuntime({ id: 'editor' })
57
+ export const preview = Raph.createRuntime({ id: 'preview' })
58
+ ```
59
+
60
+ `/signals` — совместимый alias `/reactivity`. `/reactivity` даёт самостоятельный signal
61
+ API; `/debug/*` предназначен для локальной диагностики и может меняться вместе
62
+ с внутренней реализацией.
63
+
64
+ ```ts
65
+ import { computed, effect, signal } from '@raphy-js/raph/reactivity'
66
+
67
+ const count = signal(0)
68
+ const doubled = computed(() => count.get() * 2)
69
+ const dispose = effect(() => console.log(doubled.get()))
70
+ count.set(1)
71
+ dispose()
72
+ ```
73
+
74
+ `new RaphReactivity()` создаёт независимый граф с тем же API. `RaphRuntime`
75
+ использует собственный граф с проверками владельца и жизненного цикла.
76
+ При миграции потребителя между major-версиями нужно проверить path,
77
+ phases, lifecycle и timing semantics.
78
+
79
+ `Raph.reset()` завершает все Runtime, созданные через фасад в текущей сессии.
80
+ Экземпляры, созданные напрямую через `new RaphRuntime()`, остаются независимыми.
81
+ Общие path, Meta и derived-данные нескольких Runtime принадлежат переданному
82
+ им `RaphKernel`; data adapter настраивается на Kernel, а не на Runtime.
83
+
84
+ ## Чтение всего Kernel
85
+
86
+ `get()` и `peek()` без path эквивалентны `get('')` и `peek('')`: они
87
+ возвращают текущий path-root без создания копии. Facade читает Kernel
88
+ default runtime, а экземпляры Runtime и Kernel — данные своего Kernel:
89
+
90
+ ```ts
91
+ const trackedDefaultData = Raph.get()
92
+ const untrackedDefaultData = Raph.peek()
93
+ const runtimeData = runtime.get()
94
+ const kernelData = kernel.peek()
95
+ ```
96
+
97
+ `get()` сохраняет reactive tracking-поведение `get('')`, а `peek()` не
98
+ регистрирует реактивную зависимость.
99
+
100
+ ## Sugar-ссылки facade
101
+
102
+ Частые runtime-значения доступны через `Raph` без дополнительных imports. Эти
103
+ ссылки используют существующие константы и функции как единственный source of
104
+ truth:
105
+
106
+ ```ts
107
+ Raph.configure({
108
+ mode: 'runtime',
109
+ scheduler: Raph.Scheduler.Microtask,
110
+ })
111
+
112
+ Raph.derive({
113
+ from: 'source.rows',
114
+ to: 'target.rows',
115
+ strategy: Raph.DerivedStrategy.collectionByKey('id'),
116
+ compute: row => row,
117
+ })
118
+ ```
119
+
120
+ ## Проверки и сборка
121
+
122
+ ```sh
123
+ pnpm --ignore-workspace install --frozen-lockfile
124
+ pnpm --ignore-workspace run build
125
+ pnpm --ignore-workspace run typecheck:test
126
+ pnpm --ignore-workspace run test
127
+ pnpm --ignore-workspace run test:memory
128
+ pnpm --ignore-workspace run test:distribution
129
+ pnpm --ignore-workspace run bench:lab:install
130
+ pnpm --ignore-workspace run bench:lab:light:balanced
131
+ pnpm --ignore-workspace run bench:lab:balanced
132
+ pnpm --ignore-workspace run bench:path
133
+ ```
134
+
135
+ `src/test/benchmarks/bench-lab` содержит полные correctness/performance-наборы,
136
+ всех исходных кандидатов и Endge-сценарии. Light и Full пишут отдельные простые
137
+ HTML-таблицы в папках запусков `results-light/<дата>/index.html` и
138
+ `results/<дата>/index.html`, подсвечивая
139
+ всю группу в пределах +5% от лучшего результата. Balanced проводит три
140
+ циклические ротации и использует медианы. Локальные результаты в `results/diff`
141
+ можно использовать только при совпадающей среде измерения; generated reports не
142
+ входят в публикуемый package.
143
+
144
+ Простой независимый owner создаётся через `scope()` или `new RaphReactivity().scope()`.
145
+ При необходимости сборки без native-модулей используйте `pnpm run build:portable`.
146
+
147
+ # TODO
148
+
149
+ - Отделить адаптеры BenchLab в отдельный репо BenchLab
150
+ - _signalAccess()
151
+ - _computedAccess()
152
+ - _startBatch()
153
+ - _endBatch()
@@ -0,0 +1,228 @@
1
+ import { DataPathDef, PathEvents, PathOptions } from '../path/path.types';
2
+ import { DerivedOptions, RaphDerivedHandle } from '../path/RaphDerivedHandle';
3
+ import { RaphKernelOptions, RaphKernelRoot, RaphKernel } from '../path/RaphKernel';
4
+ import { RaphMeta } from '../path/RaphMeta';
5
+ import { ScopeNode } from '../reactivity/scope';
6
+ import { Disposer, ReadonlySignal, Signal, WatchOptions, WatchSource, WatchValue, WritableComputedOptions } from '../reactivity/types';
7
+ import { PathHandle } from '../runtime/PathHandle';
8
+ import { FrameLoopLease, RaphEffectOptions, RaphPhase } from '../runtime/phase.types';
9
+ import { RaphRuntimeDebug } from '../runtime/RaphDebug';
10
+ import { NodeOptions, RaphNode } from '../runtime/RaphNode';
11
+ import { RaphRuntimeOptions, RaphRuntime } from '../runtime/RaphRuntime';
12
+ import { RaphScope } from '../runtime/RaphScope';
13
+ import { RaphConfigureOptions, RaphMode } from './types';
14
+ import { collectionByKey, filterByKey, full } from '../path/derived-strategies';
15
+ interface RaphComputed {
16
+ <T>(getter: () => T): ReadonlySignal<T>;
17
+ <T>(options: WritableComputedOptions<T>): Signal<T>;
18
+ }
19
+ interface RaphEffect {
20
+ (callback: () => void | Disposer): Disposer;
21
+ (phase: string, callback: () => void | Disposer, options?: RaphEffectOptions): Disposer;
22
+ }
23
+ interface RaphWatch {
24
+ (masks: DataPathDef | readonly DataPathDef[], callback: (payload: PathEvents) => void | Disposer, options?: WatchOptions): Disposer;
25
+ <S extends WatchSource | readonly WatchSource[]>(source: S, callback: (value: WatchValue<S>, previous: WatchValue<S> | undefined) => void | Disposer, options?: WatchOptions): Disposer;
26
+ }
27
+ interface RaphScopeFactory {
28
+ (): ScopeNode;
29
+ (id: string): RaphScope;
30
+ }
31
+ /**
32
+ * Плоский фасад над одним явно выбранным backend текущей сессии.
33
+ */
34
+ export declare class Raph {
35
+ private static _state;
36
+ private static _mode;
37
+ private static _defaultRuntime;
38
+ private static _reactivity;
39
+ private static _runtimes;
40
+ private static _runtimeOrder;
41
+ private static _runtimeCounter;
42
+ private static _runtimeDefaults;
43
+ static signal: <T>(value: T) => Signal<T>;
44
+ static computed: RaphComputed;
45
+ static effect: RaphEffect;
46
+ static watch: RaphWatch;
47
+ static batch: <T>(operation: () => T) => T;
48
+ static untracked: <T>(operation: () => T) => T;
49
+ static scope: RaphScopeFactory;
50
+ /**
51
+ * Показывает, завершена ли явная конфигурация facade.
52
+ */
53
+ static get configured(): boolean;
54
+ /**
55
+ * Возвращает выбранный режим либо `undefined` до конфигурации.
56
+ */
57
+ static get mode(): RaphMode | undefined;
58
+ /**
59
+ * Однократно выбирает backend и устанавливает публичные операции facade.
60
+ */
61
+ static configure(options: RaphConfigureOptions): void;
62
+ /**
63
+ * Освобождает принадлежащие facade runtimes и возвращает его в исходное состояние.
64
+ */
65
+ static reset(): void;
66
+ /**
67
+ * Возвращает default runtime текущей runtime-сессии.
68
+ */
69
+ static get runtime(): RaphRuntime;
70
+ /**
71
+ * Возвращает metadata facade default runtime.
72
+ */
73
+ static get meta(): RaphMeta;
74
+ /**
75
+ * Возвращает диагностический facade default runtime.
76
+ */
77
+ static get debug(): RaphRuntimeDebug;
78
+ /**
79
+ * Возвращает корневой node default runtime.
80
+ */
81
+ static get root(): RaphNode;
82
+ /**
83
+ * Формирует снимок materialized derived default runtime.
84
+ */
85
+ static getDerivedSnapshot(): ReturnType<RaphKernel['getDerivedSnapshot']>;
86
+ /**
87
+ * Создаёт независимый path/kernel owner в runtime-режиме.
88
+ */
89
+ static createKernel(options?: RaphKernelOptions): RaphKernel;
90
+ /**
91
+ * Создаёт и регистрирует принадлежащий facade runtime.
92
+ */
93
+ static createRuntime(options?: RaphRuntimeOptions): RaphRuntime;
94
+ /**
95
+ * Возвращает зарегистрированный runtime без ошибки при его отсутствии.
96
+ */
97
+ static getRuntime(id: string): RaphRuntime | undefined;
98
+ /**
99
+ * Возвращает зарегистрированный runtime либо отклоняет неизвестный id.
100
+ */
101
+ static requireRuntime(id: string): RaphRuntime;
102
+ /**
103
+ * Проверяет наличие runtime в registry текущей сессии.
104
+ */
105
+ static hasRuntime(id: string): boolean;
106
+ /**
107
+ * Освобождает зарегистрированный runtime с указанным id.
108
+ */
109
+ static disposeRuntime(id: string): boolean;
110
+ /**
111
+ * Заменяет phases default runtime до первого выполнения pipeline.
112
+ */
113
+ static definePhases(phases: readonly RaphPhase[]): void;
114
+ /**
115
+ * Добавляет phase в default runtime до первого выполнения pipeline.
116
+ */
117
+ static addPhase(phase: RaphPhase): void;
118
+ /**
119
+ * Удаляет phases default runtime до первого выполнения pipeline.
120
+ */
121
+ static clearPhases(): void;
122
+ /**
123
+ * Синхронно выполняет накопленную работу default runtime.
124
+ */
125
+ static flush(): void;
126
+ /**
127
+ * Удерживает frame loop активным от имени указанного owner.
128
+ */
129
+ static acquireLoop(owner: string): FrameLoopLease;
130
+ /**
131
+ * Явно запускает frame loop default runtime.
132
+ */
133
+ static startLoop(): void;
134
+ /**
135
+ * Снимает явный запуск frame loop default runtime.
136
+ */
137
+ static stopLoop(): void;
138
+ /**
139
+ * Создаёт принадлежащий default runtime node и выполняет его setup.
140
+ */
141
+ static node<TApi>(options: NodeOptions, setup: (node: RaphNode) => TApi): RaphNode<TApi>;
142
+ /**
143
+ * Регистрирует materialized path dependency в default runtime.
144
+ */
145
+ static derive<TSource, TTarget>(options: DerivedOptions<TSource, TTarget>): RaphDerivedHandle<TSource, TTarget>;
146
+ /**
147
+ * Создаёт lifecycle-aware handle указанного data path.
148
+ */
149
+ static path<T>(path: DataPathDef, options?: PathOptions): PathHandle<T>;
150
+ /**
151
+ * Читает весь path-root Kernel default runtime с реактивным tracking.
152
+ */
153
+ static get<T = RaphKernelRoot>(): T | undefined;
154
+ /**
155
+ * Читает значение path с реактивным tracking текущего owner.
156
+ */
157
+ static get<T = unknown>(path: DataPathDef, options?: PathOptions): T | undefined;
158
+ /**
159
+ * Читает весь path-root Kernel default runtime без tracking.
160
+ */
161
+ static peek<T = RaphKernelRoot>(): T | undefined;
162
+ /**
163
+ * Читает значение path без регистрации реактивной зависимости.
164
+ */
165
+ static peek<T = unknown>(path: DataPathDef, options?: PathOptions): T | undefined;
166
+ /**
167
+ * Проверяет наличие значения по указанному path.
168
+ */
169
+ static has(path: DataPathDef, options?: PathOptions): boolean;
170
+ /**
171
+ * Заменяет значение по указанному path.
172
+ */
173
+ static set<T>(path: DataPathDef, value: T, options?: PathOptions): void;
174
+ /**
175
+ * Объединяет значение с существующим объектом по указанному path.
176
+ */
177
+ static merge(path: DataPathDef, value: unknown, options?: PathOptions): void;
178
+ /**
179
+ * Удаляет значение по указанному path.
180
+ */
181
+ static delete(path: DataPathDef, options?: PathOptions): void;
182
+ /**
183
+ * Выполняет несколько mutations как одну реактивную транзакцию.
184
+ */
185
+ static transaction<T>(operation: () => T): T;
186
+ /**
187
+ * Оборачивает операцию в именованную action текущего runtime.
188
+ */
189
+ static action<Args extends unknown[], Result>(name: string, operation: (...args: Args) => Result): (...args: Args) => Result;
190
+ /**
191
+ * Немедленно выполняет именованную action текущего runtime.
192
+ */
193
+ static runInAction<T>(name: string, operation: () => T): T;
194
+ private static _configureReactivity;
195
+ private static _configureRuntime;
196
+ private static _bindRuntime;
197
+ private static _registerRuntime;
198
+ private static _requireDefault;
199
+ private static _requireMode;
200
+ private static _resolveRuntimeId;
201
+ private static _validateRuntimeId;
202
+ private static _validateConfigureOptions;
203
+ private static _assertKnownOptions;
204
+ private static _installMissingDefaultBindings;
205
+ private static _clearBindings;
206
+ private static _clearSession;
207
+ /**
208
+ * Запрещает создание экземпляров статического facade.
209
+ */
210
+ private constructor();
211
+ /**
212
+ * Предоставляет режимы scheduler без отдельного импорта константы.
213
+ */
214
+ static readonly Scheduler: Readonly<{
215
+ readonly AnimationFrame: "animationFrame";
216
+ readonly Microtask: "microtask";
217
+ readonly Sync: "sync";
218
+ }>;
219
+ /**
220
+ * Предоставляет стратегии materialized derived рядом с facade API.
221
+ */
222
+ static readonly DerivedStrategy: Readonly<{
223
+ full: typeof full;
224
+ collectionByKey: typeof collectionByKey;
225
+ filterByKey: typeof filterByKey;
226
+ }>;
227
+ }
228
+ export {};
@@ -0,0 +1,20 @@
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
+ * Сообщает, что операция недоступна в выбранном режиме facade.
13
+ */
14
+ export declare class RaphModeError extends RaphConfigurationError {
15
+ }
16
+ /**
17
+ * Сообщает об отсутствии default runtime у runtime-сессии.
18
+ */
19
+ export declare class RaphDefaultRuntimeError extends RaphConfigurationError {
20
+ }
@@ -0,0 +1,22 @@
1
+ export { DefaultDataAdapter } from '../path/data-adapter';
2
+ export type { DataAdapter, DataObject, DefaultAdapterOptions, } from '../path/data-adapter';
3
+ export { DataPath } from '../path/data-path';
4
+ export type { DataPathParseOptions, PathScalar, PathSegment, PlainDataPath, } from '../path/data-path';
5
+ export { collectionByKey, filterByKey, full } from '../path/derived-strategies';
6
+ export type { DerivedCollectionByKeyStrategy, DerivedFilterByKeyStrategy, DerivedFullStrategy, DerivedStrategy, } from '../path/derived-strategies';
7
+ export type { RaphMetaApi, RaphMetaEvents, RaphMetaMutationCause, RaphMetaMutationEvent, RaphMetaMutationKind, RaphMetaReadOptions, RaphMetaWatchCallback, RaphMetaWatchOptions, RaphMetaWriteOptions, } from '../path/meta.types';
8
+ export type { PathEvent as PhaseEvent } from '../path/path.types';
9
+ export type { DataPathDef, PathEvent, PathEvents, PathMutationKind, PathOptions, PathWatchCallback, } from '../path/path.types';
10
+ export { RaphDerivedHandle } from '../path/RaphDerivedHandle';
11
+ export type PhaseName = string;
12
+ export { RaphDerivedTargetWriteError } from '../path/RaphDerivedHandle';
13
+ export type { DerivedOptions } from '../path/RaphDerivedHandle';
14
+ export { RaphKernel } from '../path/RaphKernel';
15
+ export type { RaphKernelOptions, RaphKernelRoot, RaphKernelRuntime, } from '../path/RaphKernel';
16
+ export { RaphMeta } from '../path/RaphMeta';
17
+ export type { ReadonlySignal, Signal, WritableComputedOptions, } from '../reactivity/types';
18
+ export type { Disposer, WatchOptions, WatchSource, WatchValue, } from '../reactivity/types';
19
+ export * from '../runtime/public';
20
+ export { RaphConfigurationError, RaphDefaultRuntimeError, RaphError, RaphModeError, } from './errors';
21
+ export { Raph } from './Raph';
22
+ export type { RaphConfigureOptions, RaphMode, RaphReactivityConfigureOptions, RaphRuntimeConfigureOptions, RaphRuntimeDefaults, RaphRuntimeRegistryConfigureOptions, } from './types';
@@ -0,0 +1,25 @@
1
+ import { RaphKernel } from '../path/RaphKernel';
2
+ import { RaphPhase, RaphSchedulerMode } from '../runtime/phase.types';
3
+ export type RaphMode = 'reactivity' | 'runtime';
4
+ export interface RaphReactivityConfigureOptions {
5
+ readonly mode: 'reactivity';
6
+ }
7
+ export interface RaphRuntimeDefaults {
8
+ readonly scheduler?: RaphSchedulerMode;
9
+ readonly enforceActions?: boolean;
10
+ }
11
+ export interface RaphRuntimeConfigureOptions extends RaphRuntimeDefaults {
12
+ readonly mode: 'runtime';
13
+ readonly createDefaultRuntime?: true;
14
+ readonly defaultRuntimeId?: string;
15
+ readonly kernel?: RaphKernel;
16
+ readonly phases?: readonly RaphPhase[];
17
+ }
18
+ export interface RaphRuntimeRegistryConfigureOptions extends RaphRuntimeDefaults {
19
+ readonly mode: 'runtime';
20
+ readonly createDefaultRuntime: false;
21
+ readonly defaultRuntimeId?: never;
22
+ readonly kernel?: never;
23
+ readonly phases?: never;
24
+ }
25
+ export type RaphConfigureOptions = RaphReactivityConfigureOptions | RaphRuntimeConfigureOptions | RaphRuntimeRegistryConfigureOptions;