@raphy-js/raph 1.0.1-dev.26 → 1.0.1-dev.54

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 (127) hide show
  1. package/README.md +100 -0
  2. package/dist/api/Raph.d.ts +15 -15
  3. package/dist/api/RaphFacadeSession.d.ts +4 -4
  4. package/dist/api/RaphReactivityInstance.d.ts +4 -4
  5. package/dist/api/types.d.ts +11 -11
  6. package/dist/compact.cjs +1 -0
  7. package/dist/compact.js +4 -0
  8. package/dist/debug/reactivity/engine-core.cjs +1 -0
  9. package/dist/debug/reactivity/engine-core.js +1760 -0
  10. package/dist/debug/reactivity/engine.cjs +1 -1
  11. package/dist/debug/reactivity/engine.js +25 -1689
  12. package/dist/debug/reactivity/reactive-object.cjs +1 -1
  13. package/dist/debug/reactivity/reactive-object.js +604 -167
  14. package/dist/debug/runtime/RaphCompactExecutionRuntime.cjs +1 -0
  15. package/dist/debug/runtime/RaphCompactExecutionRuntime.js +9 -0
  16. package/dist/debug/runtime/RaphExecutionRuntime.cjs +1 -0
  17. package/dist/debug/runtime/RaphExecutionRuntime.js +11 -0
  18. package/dist/debug/runtime/RaphRuntime.cjs +1 -1
  19. package/dist/debug/runtime/RaphRuntime.js +115 -1176
  20. package/dist/debug/runtime/RaphRuntimeBase.cjs +1 -0
  21. package/dist/debug/runtime/RaphRuntimeBase.js +941 -0
  22. package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -1
  23. package/dist/debug/runtime/diagnostics/RaphDebug.js +72 -66
  24. package/dist/debug/runtime/ownership/RaphNode.cjs +1 -1
  25. package/dist/debug/runtime/ownership/RaphNode.js +11 -0
  26. package/dist/debug/runtime/ownership/RaphScope.cjs +1 -1
  27. package/dist/debug/runtime/ownership/RaphScope.js +12 -12
  28. package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -1
  29. package/dist/debug/runtime/phases/RaphPhasePipeline.js +361 -242
  30. package/dist/debug/runtime/phases/RaphPhaseTaskRecord.cjs +1 -1
  31. package/dist/debug/runtime/phases/RaphPhaseTaskRecord.js +23 -22
  32. package/dist/debug/runtime/reactivity/RaphSelector.cjs +1 -1
  33. package/dist/debug/runtime/reactivity/RaphSelector.js +111 -90
  34. package/dist/debug/runtime/reactivity/RuntimeObjectSupport.cjs +1 -0
  35. package/dist/debug/runtime/reactivity/RuntimeObjectSupport.js +11 -0
  36. package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -1
  37. package/dist/debug/runtime/reactivity/RuntimeReactivity.js +118 -103
  38. package/dist/debug/runtime/reactivity/RuntimeSelectorSupport.cjs +1 -0
  39. package/dist/debug/runtime/reactivity/RuntimeSelectorSupport.js +12 -0
  40. package/dist/entrypoints/compact.d.ts +2 -0
  41. package/dist/entrypoints/execution.d.ts +2 -0
  42. package/dist/entrypoints/machine-testing.d.ts +2 -2
  43. package/dist/entrypoints/machine.d.ts +5 -5
  44. package/dist/entrypoints/observable.d.ts +4 -0
  45. package/dist/entrypoints/path.d.ts +14 -14
  46. package/dist/entrypoints/reactivity.d.ts +1 -1
  47. package/dist/entrypoints/runtime.d.ts +19 -18
  48. package/dist/execution.cjs +1 -0
  49. package/dist/execution.js +4 -0
  50. package/dist/index.cjs +1 -1
  51. package/dist/index.js +23 -21
  52. package/dist/machine/compiler.d.ts +1 -1
  53. package/dist/machine/core.d.ts +2 -2
  54. package/dist/machine/persistence.d.ts +1 -1
  55. package/dist/machine/runtime.d.ts +3 -3
  56. package/dist/machine/testing.d.ts +1 -1
  57. package/dist/machine/types.d.ts +3 -3
  58. package/dist/main.d.ts +19 -19
  59. package/dist/observable/buffer.d.ts +6 -0
  60. package/dist/observable/class-admin.d.ts +63 -0
  61. package/dist/observable/class-plan.d.ts +46 -0
  62. package/dist/observable/classes.d.ts +10 -0
  63. package/dist/observable/context.d.ts +73 -0
  64. package/dist/observable/native.d.ts +2 -0
  65. package/dist/observable/observable.d.ts +13 -0
  66. package/dist/observable/types.d.ts +60 -0
  67. package/dist/observable.cjs +1 -0
  68. package/dist/observable.js +1187 -0
  69. package/dist/path/DataPath.d.ts +2 -2
  70. package/dist/path/PathRouter.d.ts +1 -1
  71. package/dist/path/RaphKernel.d.ts +6 -6
  72. package/dist/path/data-path.types.d.ts +1 -1
  73. package/dist/path/data-path.utils.d.ts +2 -2
  74. package/dist/path/derived/DerivedRegistry.d.ts +3 -3
  75. package/dist/path/derived/RaphDerivedHandle.d.ts +3 -3
  76. package/dist/path/derived/derived-collection.types.d.ts +1 -1
  77. package/dist/path/derived/derived-collection.utils.d.ts +3 -3
  78. package/dist/path/derived/derived-strategy.utils.d.ts +1 -1
  79. package/dist/path/meta/MetaController.d.ts +5 -5
  80. package/dist/path/meta/RaphMeta.d.ts +3 -3
  81. package/dist/path/meta/RaphMetaStore.d.ts +1 -1
  82. package/dist/path/meta/meta.types.d.ts +2 -2
  83. package/dist/path/path.types.d.ts +2 -2
  84. package/dist/path/pathSegmentKey.d.ts +1 -1
  85. package/dist/path/storage/AdapterPathStore.d.ts +2 -2
  86. package/dist/path/storage/DefaultDataAdapter.d.ts +2 -2
  87. package/dist/path/storage/PathEventHub.d.ts +1 -1
  88. package/dist/path/storage/PathStore.d.ts +2 -2
  89. package/dist/path/storage/data-adapter.types.d.ts +1 -1
  90. package/dist/raph.cjs +1 -1
  91. package/dist/raph.js +23 -21
  92. package/dist/reactivity/engine-core.d.ts +600 -0
  93. package/dist/reactivity/engine.d.ts +6 -550
  94. package/dist/reactivity/reactive-object.d.ts +143 -2
  95. package/dist/reactivity/scope.d.ts +7 -6
  96. package/dist/reactivity/types.d.ts +9 -12
  97. package/dist/reactivity/watch.d.ts +1 -1
  98. package/dist/runtime/RaphCompactExecutionRuntime.d.ts +7 -0
  99. package/dist/runtime/RaphExecutionRuntime.d.ts +6 -0
  100. package/dist/runtime/RaphRuntime.d.ts +19 -403
  101. package/dist/runtime/RaphRuntimeBase.d.ts +194 -0
  102. package/dist/runtime/diagnostics/RaphDebug.d.ts +8 -5
  103. package/dist/runtime/errors.d.ts +1 -1
  104. package/dist/runtime/ownership/RaphEffectScope.d.ts +13 -12
  105. package/dist/runtime/ownership/RaphNode.d.ts +28 -21
  106. package/dist/runtime/ownership/RaphScope.d.ts +32 -19
  107. package/dist/runtime/ownership/parent-graph.types.d.ts +1 -1
  108. package/dist/runtime/ownership/parentGraph.d.ts +2 -2
  109. package/dist/runtime/phases/RaphFrameLoop.d.ts +1 -1
  110. package/dist/runtime/phases/RaphPhasePipeline.d.ts +80 -29
  111. package/dist/runtime/phases/RaphPhaseTaskRecord.d.ts +21 -21
  112. package/dist/runtime/phases/RaphPhaseWatch.d.ts +3 -3
  113. package/dist/runtime/phases/orderPhaseTasks.d.ts +4 -2
  114. package/dist/runtime/phases/phase.types.d.ts +36 -35
  115. package/dist/runtime/reactivity/PathHandle.d.ts +5 -5
  116. package/dist/runtime/reactivity/RaphMetaSource.d.ts +7 -7
  117. package/dist/runtime/reactivity/RaphSelector.d.ts +27 -6
  118. package/dist/runtime/reactivity/RaphWorkGraph.d.ts +40 -39
  119. package/dist/runtime/reactivity/RuntimeObjectSupport.d.ts +9 -0
  120. package/dist/runtime/reactivity/RuntimeReactivity.d.ts +27 -19
  121. package/dist/runtime/reactivity/RuntimeSelectorSupport.d.ts +10 -0
  122. package/dist/runtime/reactivity/RuntimeWatch.d.ts +1 -1
  123. package/dist/runtime/reactivity/disposal-sweep.utils.d.ts +1 -1
  124. package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +3 -3
  125. package/dist/runtime.cjs +1 -1
  126. package/dist/runtime.js +13 -11
  127. package/package.json +22 -62
@@ -1,9 +1,9 @@
1
- import { EffectTask, OwnedResource, ReactiveNode, ScopeChildren } from '../../reactivity/types';
2
- import { RaphScope } from '../ownership/RaphScope';
3
- import { RaphEffectGroup, RaphEffectInitialMode, RaphFrameContext, RaphPhaseEffect, RaphPhaseTask, RaphWorkCause } from './phase.types';
4
- import { RaphPhaseState } from './RaphPhasePipeline';
5
- import { RaphPhaseWatch } from './RaphPhaseWatch';
6
- export declare const EMPTY_CAUSES: readonly RaphWorkCause[];
1
+ import { EffectTask, OwnedResource, ReactiveNode, ScopeChildren } from '../../reactivity/types.js';
2
+ import { RaphScope } from '../ownership/RaphScope.js';
3
+ import { RaphEffectGroup, RaphEffectInitialMode, RaphFrameContext, RaphPhaseEffect, RaphPhaseTask, RaphWorkCause } from './phase.types.js';
4
+ import { RaphPhaseState } from './RaphPhasePipeline.js';
5
+ import { RaphPhaseWatch } from './RaphPhaseWatch.js';
6
+ export declare const EMPTY_CAUSES: readonly RaphWorkCause<any>[];
7
7
  export declare const EMPTY_FRAME: RaphFrameContext;
8
8
  export declare const TASK_ACTIVE = 1;
9
9
  export declare const TASK_PAUSED: number;
@@ -53,9 +53,9 @@ export declare class RaphPhaseTaskHandle implements RaphPhaseTask {
53
53
  readonly _record: RaphPhaseTaskRecord;
54
54
  constructor(record: RaphPhaseTaskRecord);
55
55
  get phase(): string;
56
- get consumerOwner(): RaphScope;
57
- get effect(): RaphPhaseEffect;
58
- get causes(): readonly RaphWorkCause[];
56
+ get consumerOwner(): RaphScope<any>;
57
+ get effect(): RaphPhaseEffect<any>;
58
+ get causes(): readonly RaphWorkCause<any>[];
59
59
  get frame(): RaphFrameContext;
60
60
  get priority(): number;
61
61
  get sequence(): number;
@@ -90,11 +90,11 @@ export declare class RaphPhaseTaskHandle implements RaphPhaseTask {
90
90
  */
91
91
  export declare class RaphPhaseTaskDetail {
92
92
  static _shapeAnchor: RaphPhaseTaskDetail;
93
- extraCauses: Map<object, RaphWorkCause> | undefined;
94
- deliveryFirstCause: RaphWorkCause | undefined;
93
+ extraCauses: Map<object, RaphWorkCause<any>> | undefined;
94
+ deliveryFirstCause: RaphWorkCause<any> | undefined;
95
95
  deliveryFirstCauseKey: object | undefined;
96
- deliveryExtraCauses: Map<object, RaphWorkCause> | undefined;
97
- deliveryCauses: readonly RaphWorkCause[] | undefined;
96
+ deliveryExtraCauses: Map<object, RaphWorkCause<any>> | undefined;
97
+ deliveryCauses: readonly RaphWorkCause<any>[] | undefined;
98
98
  deferCount: number;
99
99
  constructor();
100
100
  }
@@ -122,22 +122,22 @@ export declare class RaphPhaseTaskRecord implements EffectTask, OwnedResource, R
122
122
  sequence: number;
123
123
  readonly phaseState: RaphPhaseState;
124
124
  readonly priority: number;
125
- readonly consumerOwner: RaphScope;
126
- readonly effect: RaphPhaseEffect;
125
+ readonly consumerOwner: RaphScope<any>;
126
+ readonly effect: RaphPhaseEffect<any>;
127
127
  node: ReactiveNode | undefined;
128
128
  watch: RaphPhaseWatch | undefined;
129
129
  group: RaphEffectGroupState | undefined;
130
130
  scopeParent: ScopeChildren<OwnedResource> | undefined;
131
131
  scopePrevious: OwnedResource | undefined;
132
132
  scopeNext: OwnedResource | undefined;
133
- firstCause: RaphWorkCause | undefined;
133
+ firstCause: RaphWorkCause<any> | undefined;
134
134
  firstCauseKey: object | undefined;
135
135
  frame: RaphFrameContext;
136
136
  facade: RaphPhaseTaskHandle | undefined;
137
137
  detail: RaphPhaseTaskDetail | undefined;
138
- constructor(phaseState: RaphPhaseState, priority: number, consumerOwner: RaphScope, effect: RaphPhaseEffect);
138
+ constructor(phaseState: RaphPhaseState, priority: number, consumerOwner: RaphScope<any>, effect: RaphPhaseEffect<any>);
139
139
  get phase(): string;
140
- get dependencyOwner(): RaphScope;
140
+ get dependencyOwner(): RaphScope<any>;
141
141
  get allowScheduleDuringRun(): boolean;
142
142
  /**
143
143
  * Становится false, когда binding остановлен: так запись видят effect scopes,
@@ -155,7 +155,7 @@ export declare class RaphPhaseTaskRecord implements EffectTask, OwnedResource, R
155
155
  * становятся неизменяемыми: WorkGraph создаёт причину без заморозки, а
156
156
  * замораживает её первое чтение.
157
157
  */
158
- get causes(): readonly RaphWorkCause[];
158
+ get causes(): readonly RaphWorkCause<any>[];
159
159
  /**
160
160
  * One facade per record: created on first exposure, then reused.
161
161
  *
@@ -164,12 +164,12 @@ export declare class RaphPhaseTaskRecord implements EffectTask, OwnedResource, R
164
164
  * `process` — и получает её frame; frame каждой следующей доставки
165
165
  * записывает её открытие.
166
166
  */
167
- get task(): RaphPhaseTask;
167
+ get task(): RaphPhaseTask<any>;
168
168
  /** Возвращает редкое состояние записи и создаёт его при первом обращении. */
169
169
  detailed(): RaphPhaseTaskDetail;
170
170
  notify(token: unknown): void;
171
171
  schedule(): void;
172
- enqueue(cause: RaphWorkCause, key?: object, schedule?: boolean): void;
172
+ enqueue(cause: RaphWorkCause<any>, key?: object, schedule?: boolean): void;
173
173
  /**
174
174
  * Запускает slot группы effects; у записи одиночного effect и watch ничего
175
175
  * не делает. Запись группы сама является handle, который возвращает
@@ -1,6 +1,6 @@
1
- import { Disposer } from '../../reactivity/types';
2
- import { RaphPhaseTaskRecord } from './RaphPhaseTaskRecord';
3
- import { RuntimeWatch } from '../reactivity/RuntimeWatch';
1
+ import { Disposer } from '../../reactivity/types.js';
2
+ import { RaphPhaseTaskRecord } from './RaphPhaseTaskRecord.js';
3
+ import { RuntimeWatch } from '../reactivity/RuntimeWatch.js';
4
4
  /**
5
5
  * Callback lifecycle одного explicit watch binding вместе с подпиской, которая
6
6
  * его питает. Подписка освобождается при освобождении binding, до cleanup
@@ -1,6 +1,8 @@
1
- import { RaphPhaseTask, RaphTaskOrderOptions } from './phase.types';
1
+ import { RaphRuntime } from '../RaphRuntime.js';
2
+ import { RaphRuntimeBase } from '../RaphRuntimeBase.js';
3
+ import { RaphPhaseTask, RaphTaskOrderOptions } from './phase.types.js';
2
4
  /**
3
5
  * Возвращает новый массив задач в tree-order выбранной пользователем owner-плоскости.
4
6
  * Исходный batch и persistent task identities не изменяются.
5
7
  */
6
- export declare function orderPhaseTasks(tasks: readonly RaphPhaseTask[], options: RaphTaskOrderOptions): RaphPhaseTask[];
8
+ export declare function orderPhaseTasks<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime>(tasks: readonly RaphPhaseTask<Runtime>[], options: RaphTaskOrderOptions<Runtime>): RaphPhaseTask<Runtime>[];
@@ -1,11 +1,12 @@
1
- import { RaphMetaMutationEvent } from '../../path/meta/meta.types';
2
- import { PathEvent } from '../../path/path.types';
3
- import { Disposer, ReadonlySignal } from '../../reactivity/types';
4
- import { RaphNode } from '../ownership/RaphNode';
5
- import { RaphScope } from '../ownership/RaphScope';
6
- import { RaphRuntime } from '../RaphRuntime';
7
- import { RaphMetaSource } from '../reactivity/RaphMetaSource';
8
- import { RaphAggregate } from '../reactivity/RaphWorkGraph';
1
+ import { RaphMetaMutationEvent } from '../../path/meta/meta.types.js';
2
+ import { PathEvent } from '../../path/path.types.js';
3
+ import { Disposer, ReadonlySignal } from '../../reactivity/types.js';
4
+ import { RaphNode } from '../ownership/RaphNode.js';
5
+ import { RaphScope } from '../ownership/RaphScope.js';
6
+ import { RaphRuntime } from '../RaphRuntime.js';
7
+ import { RaphRuntimeBase } from '../RaphRuntimeBase.js';
8
+ import { RaphMetaSource } from '../reactivity/RaphMetaSource.js';
9
+ import { RaphAggregate } from '../reactivity/RaphWorkGraph.js';
9
10
  export declare const RaphSchedulerType: Readonly<{
10
11
  readonly AnimationFrame: "animationFrame";
11
12
  readonly Microtask: "microtask";
@@ -24,27 +25,27 @@ export interface RaphFrameContext {
24
25
  readonly elapsed: number;
25
26
  readonly frame: number;
26
27
  }
27
- export interface RaphStructureCause {
28
- readonly node: RaphNode;
29
- readonly oldParent?: RaphNode;
30
- readonly newParent?: RaphNode;
28
+ export interface RaphStructureCause<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> {
29
+ readonly node: RaphNode<unknown, Runtime>;
30
+ readonly oldParent?: RaphNode<unknown, Runtime>;
31
+ readonly newParent?: RaphNode<unknown, Runtime>;
31
32
  readonly oldIndex?: number;
32
33
  readonly newIndex?: number;
33
34
  }
34
35
  export type RaphWorkCauseKind = 'producer' | 'structure' | 'path' | 'frame' | 'touch';
35
36
  /** Одна logical причина phase delivery. Повторные причины одного source coalesce. */
36
- export interface RaphWorkCause {
37
+ export interface RaphWorkCause<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> {
37
38
  readonly kind: RaphWorkCauseKind;
38
- readonly source: RaphWatchSource;
39
- readonly sourceOwner?: RaphScope;
39
+ readonly source: RaphWatchSource<Runtime>;
40
+ readonly sourceOwner?: RaphScope<Runtime>;
40
41
  readonly revision: number;
41
42
  readonly previous?: unknown;
42
43
  readonly value?: unknown;
43
- readonly structure?: RaphStructureCause;
44
+ readonly structure?: RaphStructureCause<Runtime>;
44
45
  readonly events?: readonly (PathEvent | RaphMetaMutationEvent)[];
45
46
  readonly metadata?: unknown;
46
47
  }
47
- export type RaphPhaseEffect = (task: RaphPhaseTask) => void | Disposer;
48
+ export type RaphPhaseEffect<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> = (task: RaphPhaseTask<Runtime>) => void | Disposer;
48
49
  /**
49
50
  * Тело binding, зарегистрированного через `bindEffect`: task ему не передаётся,
50
51
  * поэтому тело объявляется без параметров. Возвращённый cleanup выполняется
@@ -125,26 +126,26 @@ export interface RaphEffectGroup {
125
126
  * run/defer/cancel вызываются через task или с явным receiver: извлечённый
126
127
  * метод не работает без this.
127
128
  */
128
- export interface RaphPhaseTask {
129
+ export interface RaphPhaseTask<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> {
129
130
  readonly phase: string;
130
- readonly consumerOwner: RaphScope;
131
- readonly effect: RaphPhaseEffect;
132
- readonly causes: readonly RaphWorkCause[];
131
+ readonly consumerOwner: RaphScope<Runtime>;
132
+ readonly effect: RaphPhaseEffect<Runtime>;
133
+ readonly causes: readonly RaphWorkCause<Runtime>[];
133
134
  readonly frame: RaphFrameContext;
134
135
  readonly priority: number;
135
136
  readonly sequence: number;
136
- run: (this: RaphPhaseTask) => void;
137
- defer: (this: RaphPhaseTask) => void;
138
- cancel: (this: RaphPhaseTask) => void;
137
+ run: (this: RaphPhaseTask<Runtime>) => void;
138
+ defer: (this: RaphPhaseTask<Runtime>) => void;
139
+ cancel: (this: RaphPhaseTask<Runtime>) => void;
139
140
  }
140
- export interface RaphPhaseBatch {
141
+ export interface RaphPhaseBatch<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> {
141
142
  readonly phase: string;
142
143
  readonly frame: RaphFrameContext;
143
- readonly tasks: readonly RaphPhaseTask[];
144
+ readonly tasks: readonly RaphPhaseTask<Runtime>[];
144
145
  }
145
- export interface RaphPhase {
146
+ export interface RaphPhase<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> {
146
147
  readonly name: string;
147
- readonly process?: (batch: RaphPhaseBatch) => void;
148
+ readonly process?: (batch: RaphPhaseBatch<Runtime>) => void;
148
149
  }
149
150
  export interface RaphEffectOptions {
150
151
  readonly initial?: RaphEffectInitialMode;
@@ -157,15 +158,15 @@ export interface RaphWatchOptions extends Omit<RaphEffectOptions, 'initial'> {
157
158
  /** Применяется только к RaphNode source; default — self. */
158
159
  readonly include?: RaphWatchInclude;
159
160
  }
160
- export interface RaphNodeWatchSource {
161
- readonly source: RaphNode;
161
+ export interface RaphNodeWatchSource<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> {
162
+ readonly source: RaphNode<unknown, Runtime>;
162
163
  readonly include: RaphWatchInclude;
163
164
  }
164
165
  export type RaphProducerSource = ReadonlySignal<unknown>;
165
- export type RaphWatchSource = RaphProducerSource | RaphNode | RaphNodeWatchSource | RaphRuntime | RaphAggregate | RaphMetaSource;
166
- export type RaphOwnerWatchSource = RaphWatchSource;
167
- export type RaphAggregateSource = RaphOwnerWatchSource;
168
- export interface RaphTaskOrderOptions {
169
- readonly node: (task: RaphPhaseTask) => RaphNode | null | undefined;
166
+ export type RaphWatchSource<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> = RaphProducerSource | RaphNode<unknown, Runtime> | RaphNodeWatchSource<Runtime> | Runtime | RaphAggregate<Runtime> | RaphMetaSource;
167
+ export type RaphOwnerWatchSource<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> = RaphWatchSource<Runtime>;
168
+ export type RaphAggregateSource<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> = RaphOwnerWatchSource<Runtime>;
169
+ export interface RaphTaskOrderOptions<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> {
170
+ readonly node: (task: RaphPhaseTask<Runtime>) => RaphNode<unknown, Runtime> | null | undefined;
170
171
  readonly direction?: 'parents-first' | 'children-first';
171
172
  }
@@ -1,8 +1,8 @@
1
- import { ParsedDataPath } from '../../path/data-path.types';
2
- import { PathEvents, PathOptions } from '../../path/path.types';
3
- import { RaphKernel } from '../../path/RaphKernel';
4
- import { RaphReactivity } from '../../reactivity/engine';
5
- import { Disposer, OwnedSourceHooks, ReadonlySignal } from '../../reactivity/types';
1
+ import { ParsedDataPath } from '../../path/data-path.types.js';
2
+ import { PathEvents, PathOptions } from '../../path/path.types.js';
3
+ import { RaphKernel } from '../../path/RaphKernel.js';
4
+ import { RaphReactivity } from '../../reactivity/engine.js';
5
+ import { Disposer, OwnedSourceHooks, ReadonlySignal } from '../../reactivity/types.js';
6
6
  type PathSignalEngine = Pick<RaphReactivity, '_isTracking' | '_ownedSignal'>;
7
7
  /**
8
8
  * Реактивный handle одного canonical path в default E2 data-plane.
@@ -1,11 +1,11 @@
1
- import { RaphMetaWatchOptions } from '../../path/meta/meta.types';
2
- import { DataPathDef } from '../../path/path.types';
3
- import { Disposer } from '../../reactivity/types';
4
- import { RaphScope } from '../ownership/RaphScope';
1
+ import { RaphMetaWatchOptions } from '../../path/meta/meta.types.js';
2
+ import { DataPathDef } from '../../path/path.types.js';
3
+ import { Disposer } from '../../reactivity/types.js';
4
+ import { RaphScope } from '../ownership/RaphScope.js';
5
5
  export type RaphMetaSourceOptions = RaphMetaWatchOptions;
6
6
  /** Immutable Runtime-owned metadata event source for explicit phase watches. */
7
7
  export declare class RaphMetaSource {
8
- readonly owner: RaphScope;
8
+ readonly owner: RaphScope<any>;
9
9
  private _start;
10
10
  private _release;
11
11
  readonly masks: DataPathDef | readonly DataPathDef[];
@@ -17,8 +17,8 @@ export declare class RaphMetaSource {
17
17
  /** @internal */
18
18
  private constructor();
19
19
  /** @internal */
20
- static _create(owner: RaphScope, masks: DataPathDef | readonly DataPathDef[], options: RaphMetaSourceOptions, start: () => Disposer, release: () => void): RaphMetaSource;
21
- get runtime(): import('../RaphRuntime').RaphRuntime;
20
+ static _create(owner: RaphScope<any>, masks: DataPathDef | readonly DataPathDef[], options: RaphMetaSourceOptions, start: () => Disposer, release: () => void): RaphMetaSource;
21
+ get runtime(): any;
22
22
  get disposed(): boolean;
23
23
  dispose(): void;
24
24
  /** @internal */
@@ -1,7 +1,7 @@
1
- import { OwnedSourceEntry } from '../../reactivity/scope';
2
- import { RaphScope } from '../ownership/RaphScope';
3
- import { RuntimeDisposalSweeper, RuntimeSignalWriteTap } from './runtime-reactivity.types';
4
- import { RuntimeReactivity, RuntimeSignal } from './RuntimeReactivity';
1
+ import { OwnedSourceEntry } from '../../reactivity/scope.js';
2
+ import { RaphScope } from '../ownership/RaphScope.js';
3
+ import { RuntimeDisposalSweeper, RuntimeSignalWriteTap } from './runtime-reactivity.types.js';
4
+ import { RuntimeReactivity, RuntimeSignal } from './RuntimeReactivity.js';
5
5
  /**
6
6
  * Настройки selector.
7
7
  *
@@ -137,7 +137,7 @@ export declare class RuntimeSelector<Key> implements OwnedSourceEntry, RuntimeSi
137
137
  * Создаёт selector и подключает его к записям source. Регистрацию у
138
138
  * владельца и проверку аргументов выполняет вызывающий код.
139
139
  */
140
- constructor(owner: RaphScope, reactivity: RuntimeReactivity, source: RuntimeSignal<Key>, equals: ((key: Key, value: Key) => boolean) | undefined);
140
+ constructor(owner: RaphScope<any>, reactivity: RuntimeReactivity, source: RuntimeSignal<Key>, equals: ((key: Key, value: Key) => boolean) | undefined);
141
141
  /**
142
142
  * Тег Object.prototype.toString: инструменты, которые обходят только plain
143
143
  * objects, принимают selector за неделимое значение и не идут через него в
@@ -153,7 +153,7 @@ export declare class RuntimeSelector<Key> implements OwnedSourceEntry, RuntimeSi
153
153
  * Владелец selector как наблюдателя записей source.
154
154
  * @internal
155
155
  */
156
- get _tapOwner(): RaphScope;
156
+ get _tapOwner(): RaphScope<any>;
157
157
  /**
158
158
  * Число ключей в индексе triggers: с потребителями и ещё не убранных.
159
159
  * @internal
@@ -175,6 +175,8 @@ export declare class RuntimeSelector<Key> implements OwnedSourceEntry, RuntimeSi
175
175
  * @internal
176
176
  */
177
177
  _observesWrites(): boolean;
178
+ /** @internal См. `inspectSelector`. */
179
+ _inspect(): RaphSelectorInspection<Key> | undefined;
178
180
  /**
179
181
  * Будит потребителей ключей, чей ответ изменила запись в source. Вызывается
180
182
  * signal-ом после того, как новое значение стало видимым, внутри его границы
@@ -336,3 +338,22 @@ export declare class RuntimeSelector<Key> implements OwnedSourceEntry, RuntimeSi
336
338
  */
337
339
  private _settleDense;
338
340
  }
341
+ /**
342
+ * Доступ renderer к selector списка: чтение source с подпиской активного
343
+ * потребителя и ответ ключа без подписки. Список держит одну подписку на source
344
+ * и сам обновляет строки прежнего и нового ключа вместо подписки каждой строки.
345
+ * @internal
346
+ */
347
+ export interface RaphSelectorInspection<Key> {
348
+ /** Читает source и подписывает активного потребителя на каждую запись в него. */
349
+ readonly read: () => Key;
350
+ /** Отвечает, совпадает ли ключ с текущим значением source, без подписки. */
351
+ readonly test: (key: Key) => boolean;
352
+ }
353
+ /**
354
+ * Возвращает доступ к selector по его функции либо `undefined`, если значение
355
+ * не функция selector или selector сравнивает ключи своей `equals`: такая
356
+ * запись может изменить ответ любого ключа, а не двух.
357
+ * @internal
358
+ */
359
+ export declare function inspectSelector<Key>(select: unknown): RaphSelectorInspection<Key> | undefined;
@@ -1,10 +1,11 @@
1
- import { Disposer, OwnedSourceHooks } from '../../reactivity/types';
2
- import { RaphNode } from '../ownership/RaphNode';
3
- import { RaphScope } from '../ownership/RaphScope';
4
- import { RaphAggregateSource, RaphStructureCause, RaphWatchInclude, RaphWatchSource, RaphWorkCause, RaphWorkCauseKind } from '../phases/phase.types';
5
- import { RaphRuntime } from '../RaphRuntime';
6
- type WorkSink = (cause: RaphWorkCause, key: object, schedule: boolean) => void;
7
- type WorkEdgeSource = RaphProducer | RaphNode | RaphRuntime;
1
+ import { Disposer, OwnedSourceHooks } from '../../reactivity/types.js';
2
+ import { RaphNode } from '../ownership/RaphNode.js';
3
+ import { RaphScope } from '../ownership/RaphScope.js';
4
+ import { RaphAggregateSource, RaphStructureCause, RaphWatchInclude, RaphWatchSource, RaphWorkCause, RaphWorkCauseKind } from '../phases/phase.types.js';
5
+ import { RaphRuntime } from '../RaphRuntime.js';
6
+ import { RaphRuntimeBase } from '../RaphRuntimeBase.js';
7
+ type WorkSink = (cause: RaphWorkCause<any>, key: object, schedule: boolean) => void;
8
+ type WorkEdgeSource = RaphProducer | RaphNode<unknown, any> | RaphRuntimeBase<any>;
8
9
  interface WorkEdge {
9
10
  readonly sink: WorkSink;
10
11
  readonly kind: 'producer' | 'runtime' | 'self' | 'subtree';
@@ -17,7 +18,7 @@ interface WorkEdgeList {
17
18
  first?: WorkEdge;
18
19
  last?: WorkEdge;
19
20
  }
20
- type CleanupSource = RaphProducer | RaphNode | RaphAggregate;
21
+ type CleanupSource = RaphProducer | RaphNode<unknown, any> | RaphAggregate<any>;
21
22
  interface CleanupEdge {
22
23
  cleanup?: () => void;
23
24
  source?: CleanupSource;
@@ -29,8 +30,8 @@ interface CleanupEdgeList {
29
30
  last?: CleanupEdge;
30
31
  }
31
32
  interface AggregateSubscription {
32
- dispose?: (finalCause?: RaphWorkCause) => void;
33
- aggregate?: RaphAggregate;
33
+ dispose?: (finalCause?: RaphWorkCause<any>) => void;
34
+ aggregate?: RaphAggregate<any>;
34
35
  previous?: AggregateSubscription;
35
36
  next?: AggregateSubscription;
36
37
  }
@@ -64,16 +65,16 @@ export interface RaphProducerDescription {
64
65
  * @internal
65
66
  */
66
67
  export declare class RaphProducer {
67
- readonly owner: RaphScope;
68
+ readonly owner: RaphScope<any>;
68
69
  readonly kind: RaphProducerKind;
69
70
  readonly includeRuntime: boolean;
70
71
  subscribers: WorkEdgeList | undefined;
71
72
  memberships: CleanupEdgeList | undefined;
72
- implicitConsumers: Map<RaphNode, number> | undefined;
73
- source: RaphWatchSource | undefined;
73
+ implicitConsumers: Map<RaphNode<unknown, any>, number> | undefined;
74
+ source: RaphWatchSource<any> | undefined;
74
75
  activate: (() => void | Disposer) | undefined;
75
76
  runtimeActivation: Disposer | undefined;
76
- lastCause: RaphWorkCause | undefined;
77
+ lastCause: RaphWorkCause<any> | undefined;
77
78
  transientNext: RaphProducer | undefined;
78
79
  revision: number;
79
80
  disposed: boolean;
@@ -84,8 +85,8 @@ export declare class RaphProducer {
84
85
  * @internal
85
86
  */
86
87
  readonly _isProducer: boolean;
87
- constructor(owner: RaphScope, kind: RaphProducerKind, includeRuntime: boolean);
88
- get runtime(): RaphRuntime;
88
+ constructor(owner: RaphScope<any>, kind: RaphProducerKind, includeRuntime: boolean);
89
+ get runtime(): RaphRuntimeBase<any>;
89
90
  /**
90
91
  * Тег Object.prototype.toString: `[object RaphProducer]`. По нему инструменты,
91
92
  * которые копируют и обходят только plain objects, принимают producer за
@@ -103,8 +104,8 @@ export declare class RaphProducer {
103
104
  toJSON(): RaphProducerDescription;
104
105
  }
105
106
  /** Immutable explicit group of granular sources owned by one Runtime scope. */
106
- export declare class RaphAggregate {
107
- readonly owner: RaphScope;
107
+ export declare class RaphAggregate<Runtime extends RaphRuntimeBase<Runtime> = RaphRuntime> {
108
+ readonly owner: RaphScope<Runtime>;
108
109
  private _sources;
109
110
  private _disposed;
110
111
  private _releaseOwner;
@@ -118,10 +119,10 @@ export declare class RaphAggregate {
118
119
  /** @internal */
119
120
  private constructor();
120
121
  /** @internal */
121
- static _create(owner: RaphScope, sources: readonly RaphAggregateSource[]): RaphAggregate;
122
- get runtime(): RaphRuntime;
122
+ static _create<OwnerRuntime extends RaphRuntimeBase<OwnerRuntime>>(owner: RaphScope<OwnerRuntime>, sources: readonly RaphAggregateSource<OwnerRuntime>[]): RaphAggregate<OwnerRuntime>;
123
+ get runtime(): Runtime;
123
124
  get disposed(): boolean;
124
- get sources(): readonly RaphAggregateSource[];
125
+ get sources(): readonly RaphAggregateSource<Runtime>[];
125
126
  dispose(): void;
126
127
  /** @internal */
127
128
  _assertAlive(): void;
@@ -134,13 +135,13 @@ export declare class RaphAggregate {
134
135
  /** @internal */
135
136
  _disposeOwned(): void;
136
137
  /** @internal */
137
- _linkSubscription(dispose: (finalCause?: RaphWorkCause) => void): () => void;
138
+ _linkSubscription(dispose: (finalCause?: RaphWorkCause<any>) => void): () => void;
138
139
  /** @internal */
139
140
  _linkDependent(edge: CleanupEdge): void;
140
141
  /** @internal */
141
142
  _detachDependent(edge: CleanupEdge): void;
142
143
  /** @internal */
143
- _disposalCause(): RaphWorkCause;
144
+ _disposalCause(): RaphWorkCause<any>;
144
145
  /** @internal */
145
146
  _detachSubscription(subscription: AggregateSubscription): void;
146
147
  }
@@ -152,7 +153,7 @@ export declare class RaphWorkGraph {
152
153
  * живой причины.
153
154
  * @internal
154
155
  */
155
- static _valueCauseShapeAnchor: RaphWorkCause;
156
+ static _valueCauseShapeAnchor: RaphWorkCause<any>;
156
157
  private _selfSubscribers;
157
158
  private _subtreeSubscribers;
158
159
  private _runtimeSubscribers;
@@ -166,8 +167,8 @@ export declare class RaphWorkGraph {
166
167
  private _dispatchDepth;
167
168
  private _detachedEdges;
168
169
  private _disposed;
169
- constructor(_runtime: RaphRuntime);
170
- createProducer(owner: RaphScope, kind?: RaphProducerKind, options?: ProducerOptions): RaphProducer;
170
+ constructor(_runtime: RaphRuntimeBase<any>);
171
+ createProducer(owner: RaphScope<any>, kind?: RaphProducerKind, options?: ProducerOptions): RaphProducer;
171
172
  attachProducer<T extends object>(record: RaphProducer, source: T): T;
172
173
  setProducerActivation(record: RaphProducer, activate: () => void | Disposer, activateForRuntime?: boolean): void;
173
174
  producerHooks(record: RaphProducer): OwnedSourceHooks;
@@ -179,10 +180,10 @@ export declare class RaphWorkGraph {
179
180
  * распознаётся prototype-брендом, а Runtime читается у владельца напрямую:
180
181
  * без `instanceof` и без accessor.
181
182
  */
182
- causeForToken(token: unknown): RaphWorkCause | undefined;
183
+ causeForToken(token: unknown): RaphWorkCause<any> | undefined;
183
184
  /** Clears mutation-local payloads after engine propagation consumed them. */
184
185
  clearTransientCauses(): void;
185
- notifyProducer(record: RaphProducer, previous?: unknown, value?: unknown, events?: RaphWorkCause['events'], schedule?: boolean, hasReactiveSubscribers?: boolean, includeValues?: boolean): void;
186
+ notifyProducer(record: RaphProducer, previous?: unknown, value?: unknown, events?: RaphWorkCause<any>['events'], schedule?: boolean, hasReactiveSubscribers?: boolean, includeValues?: boolean): void;
186
187
  /**
187
188
  * Публикует запись значения producer: форма `notifyProducer()` для причины с
188
189
  * `previous` и `value`, без events и с планированием. Так свою запись
@@ -197,7 +198,7 @@ export declare class RaphWorkGraph {
197
198
  * @internal
198
199
  */
199
200
  _notifyValueWrite(record: RaphProducer, previous: unknown, value: unknown, hasReactiveSubscribers: boolean): void;
200
- notifyProducerEvents(record: RaphProducer, events: NonNullable<RaphWorkCause['events']>, schedule?: boolean, hasReactiveSubscribers?: boolean): void;
201
+ notifyProducerEvents(record: RaphProducer, events: NonNullable<RaphWorkCause<any>['events']>, schedule?: boolean, hasReactiveSubscribers?: boolean): void;
201
202
  /**
202
203
  * Дешёвая предварительная проверка structural publication: `false` означает,
203
204
  * что `notifyNode` для этой node вернётся до создания cause и без побочных
@@ -205,7 +206,7 @@ export declare class RaphWorkGraph {
205
206
  *
206
207
  * @internal
207
208
  */
208
- _hasStructuralDemand(node: RaphNode): boolean;
209
+ _hasStructuralDemand(node: RaphNode<unknown, any>): boolean;
209
210
  /**
210
211
  * Сообщает, есть ли хотя бы один runtime-, subtree- или self-подписчик.
211
212
  * `true` означает, что `_hasStructuralDemand` может вернуть `true` для
@@ -214,15 +215,15 @@ export declare class RaphWorkGraph {
214
215
  * @internal
215
216
  */
216
217
  _hasNodeSubscribers(): boolean;
217
- notifyNode(node: RaphNode, kind: Extract<RaphWorkCauseKind, 'structure' | 'touch'>, options?: {
218
+ notifyNode(node: RaphNode<unknown, any>, kind: Extract<RaphWorkCauseKind, 'structure' | 'touch'>, options?: {
218
219
  readonly metadata?: unknown;
219
- readonly structure?: RaphStructureCause;
220
- readonly oldAncestors?: readonly RaphNode[];
221
- readonly newAncestors?: readonly RaphNode[];
220
+ readonly structure?: RaphStructureCause<any>;
221
+ readonly oldAncestors?: readonly RaphNode<unknown, any>[];
222
+ readonly newAncestors?: readonly RaphNode<unknown, any>[];
222
223
  }): void;
223
- createAggregate(owner: RaphScope, sources: readonly RaphAggregateSource[]): RaphAggregate;
224
- subscribe(input: RaphWatchSource, include: RaphWatchInclude | undefined, sink: WorkSink): () => void;
225
- assertSubscriptionAllowed(consumer: RaphScope, input: RaphWatchSource): void;
224
+ createAggregate<OwnerRuntime extends RaphRuntimeBase<any>>(owner: RaphScope<OwnerRuntime>, sources: readonly RaphAggregateSource<OwnerRuntime>[]): RaphAggregate<OwnerRuntime>;
225
+ subscribe(input: RaphWatchSource<any>, include: RaphWatchInclude | undefined, sink: WorkSink): () => void;
226
+ assertSubscriptionAllowed(consumer: RaphScope<any>, input: RaphWatchSource<any>): void;
226
227
  /**
227
228
  * Rejects a move that would make an existing implicit reactive edge illegal.
228
229
  *
@@ -230,7 +231,7 @@ export declare class RaphWorkGraph {
230
231
  * учёта `implicitConsumers`. Рёбра от Runtime signals нигде не учитываются:
231
232
  * они читаются из графа в момент проверки.
232
233
  */
233
- assertReparentAllowed(node: RaphNode, newParent: RaphNode): void;
234
+ assertReparentAllowed(node: RaphNode<unknown, any>, newParent: RaphNode<unknown, any>): void;
234
235
  /**
235
236
  * Проверяет живые implicit-рёбра от Runtime signals. Implicit-чтение
236
237
  * разрешено только у собственного владельца, его предков и root scope,
@@ -259,7 +260,7 @@ export declare class RaphWorkGraph {
259
260
  * в дереве они ни находились.
260
261
  */
261
262
  private _assertSignalEdgesAllowReparent;
262
- releaseNode(node: RaphNode): void;
263
+ releaseNode(node: RaphNode<unknown, any>): void;
263
264
  dispose(): void;
264
265
  /**
265
266
  * Освобождает producer: публикует финальную structural cause при спросе и
@@ -0,0 +1,9 @@
1
+ import { ReactivityEngine } from '../../reactivity/engine-core.js';
2
+ import { ReactiveObjectPolicy } from '../../reactivity/reactive-object.js';
3
+ /** Необязательный адаптер полного профиля без собственного graph или ownership. */
4
+ export interface RuntimeObjectSupport {
5
+ readonly configure: (engine: ReactivityEngine, policy: ReactiveObjectPolicy) => void;
6
+ readonly dispose: (engine: ReactivityEngine, policy: ReactiveObjectPolicy) => void;
7
+ readonly reactive: <T extends object>(engine: ReactivityEngine, value: T) => T;
8
+ }
9
+ export declare const RUNTIME_OBJECT_SUPPORT: RuntimeObjectSupport;