@ersbeth/picoflow 2.2.0 → 2.3.0

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 (109) hide show
  1. package/README.md +22 -0
  2. package/SKILL.md +5 -0
  3. package/dist/picoflow.js +252 -131
  4. package/dist/types/api/base/flowConfig.d.ts +0 -1
  5. package/dist/types/api/base/flowDisposable.d.ts +0 -1
  6. package/dist/types/api/base/flowErrors.d.ts +1 -0
  7. package/dist/types/api/base/flowObservable.d.ts +0 -1
  8. package/dist/types/api/base/flowPrimitiveOptions.d.ts +14 -0
  9. package/dist/types/api/base/flowSubscribable.d.ts +0 -1
  10. package/dist/types/api/base/flowTracker.d.ts +0 -1
  11. package/dist/types/api/base/index.d.ts +2 -1
  12. package/dist/types/api/index.d.ts +0 -1
  13. package/dist/types/api/nodes/async/flowConstantAsync.d.ts +4 -3
  14. package/dist/types/api/nodes/async/flowDerivationAsync.d.ts +3 -3
  15. package/dist/types/api/nodes/async/flowStateAsync.d.ts +4 -3
  16. package/dist/types/api/nodes/async/flowWritableDerivationAsync.d.ts +3 -2
  17. package/dist/types/api/nodes/async/index.d.ts +0 -1
  18. package/dist/types/api/nodes/collections/flowArray.d.ts +3 -2
  19. package/dist/types/api/nodes/collections/flowMap.d.ts +3 -2
  20. package/dist/types/api/nodes/collections/index.d.ts +0 -1
  21. package/dist/types/api/nodes/flowEffect.d.ts +0 -1
  22. package/dist/types/api/nodes/flowSignal.d.ts +3 -2
  23. package/dist/types/api/nodes/flowValue.d.ts +0 -1
  24. package/dist/types/api/nodes/index.d.ts +0 -1
  25. package/dist/types/api/nodes/sync/flowConstant.d.ts +3 -2
  26. package/dist/types/api/nodes/sync/flowDerivation.d.ts +3 -2
  27. package/dist/types/api/nodes/sync/flowState.d.ts +4 -3
  28. package/dist/types/api/nodes/sync/flowWritableDerivation.d.ts +3 -2
  29. package/dist/types/api/nodes/sync/index.d.ts +0 -1
  30. package/dist/types/api/nodes/utils.d.ts +0 -1
  31. package/dist/types/base/dependenciesRegistry.d.ts +1 -0
  32. package/dist/types/base/dependentsRegistry.d.ts +1 -0
  33. package/dist/types/base/disposable.d.ts +5 -1
  34. package/dist/types/base/errors.d.ts +31 -0
  35. package/dist/types/base/executionStack.d.ts +3 -11
  36. package/dist/types/base/index.d.ts +3 -1
  37. package/dist/types/base/node.d.ts +2 -3
  38. package/dist/types/base/observable.d.ts +1 -2
  39. package/dist/types/base/observer.d.ts +1 -2
  40. package/dist/types/converters/index.d.ts +0 -1
  41. package/dist/types/converters/solid.d.ts +0 -1
  42. package/dist/types/index.d.ts +0 -1
  43. package/dist/types/nodes/actionNode.d.ts +1 -23
  44. package/dist/types/nodes/arrayNode.d.ts +1 -26
  45. package/dist/types/nodes/effectNode.d.ts +1 -32
  46. package/dist/types/nodes/index.d.ts +0 -1
  47. package/dist/types/nodes/mapNode.d.ts +1 -20
  48. package/dist/types/nodes/signalNode.d.ts +1 -10
  49. package/dist/types/nodes/valueAsyncNode.d.ts +1 -23
  50. package/dist/types/nodes/valueNode.d.ts +1 -27
  51. package/dist/types/nodes/valueSyncNode.d.ts +1 -23
  52. package/dist/types/schedulers/asyncResolver.d.ts +1 -19
  53. package/dist/types/schedulers/asyncScheduler.d.ts +1 -21
  54. package/dist/types/schedulers/index.d.ts +0 -1
  55. package/dist/types/schedulers/pendingError.d.ts +1 -9
  56. package/dist/types/schedulers/scheduler.d.ts +1 -10
  57. package/dist/types/schedulers/syncResolver.d.ts +1 -18
  58. package/dist/types/schedulers/syncScheduler.d.ts +1 -19
  59. package/package.json +10 -8
  60. package/dist/types/api/base/flowConfig.d.ts.map +0 -1
  61. package/dist/types/api/base/flowDisposable.d.ts.map +0 -1
  62. package/dist/types/api/base/flowObservable.d.ts.map +0 -1
  63. package/dist/types/api/base/flowSubscribable.d.ts.map +0 -1
  64. package/dist/types/api/base/flowTracker.d.ts.map +0 -1
  65. package/dist/types/api/base/index.d.ts.map +0 -1
  66. package/dist/types/api/index.d.ts.map +0 -1
  67. package/dist/types/api/nodes/async/flowConstantAsync.d.ts.map +0 -1
  68. package/dist/types/api/nodes/async/flowDerivationAsync.d.ts.map +0 -1
  69. package/dist/types/api/nodes/async/flowStateAsync.d.ts.map +0 -1
  70. package/dist/types/api/nodes/async/flowWritableDerivationAsync.d.ts.map +0 -1
  71. package/dist/types/api/nodes/async/index.d.ts.map +0 -1
  72. package/dist/types/api/nodes/collections/flowArray.d.ts.map +0 -1
  73. package/dist/types/api/nodes/collections/flowMap.d.ts.map +0 -1
  74. package/dist/types/api/nodes/collections/index.d.ts.map +0 -1
  75. package/dist/types/api/nodes/flowEffect.d.ts.map +0 -1
  76. package/dist/types/api/nodes/flowSignal.d.ts.map +0 -1
  77. package/dist/types/api/nodes/flowValue.d.ts.map +0 -1
  78. package/dist/types/api/nodes/index.d.ts.map +0 -1
  79. package/dist/types/api/nodes/sync/flowConstant.d.ts.map +0 -1
  80. package/dist/types/api/nodes/sync/flowDerivation.d.ts.map +0 -1
  81. package/dist/types/api/nodes/sync/flowState.d.ts.map +0 -1
  82. package/dist/types/api/nodes/sync/flowWritableDerivation.d.ts.map +0 -1
  83. package/dist/types/api/nodes/sync/index.d.ts.map +0 -1
  84. package/dist/types/api/nodes/utils.d.ts.map +0 -1
  85. package/dist/types/base/disposable.d.ts.map +0 -1
  86. package/dist/types/base/executionStack.d.ts.map +0 -1
  87. package/dist/types/base/index.d.ts.map +0 -1
  88. package/dist/types/base/node.d.ts.map +0 -1
  89. package/dist/types/base/observable.d.ts.map +0 -1
  90. package/dist/types/base/observer.d.ts.map +0 -1
  91. package/dist/types/converters/index.d.ts.map +0 -1
  92. package/dist/types/converters/solid.d.ts.map +0 -1
  93. package/dist/types/index.d.ts.map +0 -1
  94. package/dist/types/nodes/actionNode.d.ts.map +0 -1
  95. package/dist/types/nodes/arrayNode.d.ts.map +0 -1
  96. package/dist/types/nodes/effectNode.d.ts.map +0 -1
  97. package/dist/types/nodes/index.d.ts.map +0 -1
  98. package/dist/types/nodes/mapNode.d.ts.map +0 -1
  99. package/dist/types/nodes/signalNode.d.ts.map +0 -1
  100. package/dist/types/nodes/valueAsyncNode.d.ts.map +0 -1
  101. package/dist/types/nodes/valueNode.d.ts.map +0 -1
  102. package/dist/types/nodes/valueSyncNode.d.ts.map +0 -1
  103. package/dist/types/schedulers/asyncResolver.d.ts.map +0 -1
  104. package/dist/types/schedulers/asyncScheduler.d.ts.map +0 -1
  105. package/dist/types/schedulers/index.d.ts.map +0 -1
  106. package/dist/types/schedulers/pendingError.d.ts.map +0 -1
  107. package/dist/types/schedulers/scheduler.d.ts.map +0 -1
  108. package/dist/types/schedulers/syncResolver.d.ts.map +0 -1
  109. package/dist/types/schedulers/syncScheduler.d.ts.map +0 -1
@@ -15,4 +15,3 @@
15
15
  * @public
16
16
  */
17
17
  export declare function onFlushError(handler: (error: unknown) => void): void;
18
- //# sourceMappingURL=flowConfig.d.ts.map
@@ -38,4 +38,3 @@ export interface FlowDisposable {
38
38
  * @public
39
39
  */
40
40
  export declare function isDisposable(obj: unknown): obj is FlowDisposable;
41
- //# sourceMappingURL=flowDisposable.d.ts.map
@@ -0,0 +1 @@
1
+ export { PicoFlowCycleError, PicoFlowDisposedError, PicoFlowError, PicoFlowInternalError } from '../../base/errors.js';
@@ -24,4 +24,3 @@ export interface FlowObservable<T> extends FlowDisposable, FlowSubscribable<T> {
24
24
  */
25
25
  trigger(): void;
26
26
  }
27
- //# sourceMappingURL=flowObservable.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Optional per-instance settings accepted by the primitive factories (`state`, `derivation`,
3
+ * `array`, `map`, `signal`, …).
4
+ *
5
+ * @public
6
+ */
7
+ export interface FlowPrimitiveOptions {
8
+ /**
9
+ * Identifies this primitive in error messages, e.g. `"[PicoFlow] Primitive \"$count\" is disposed"`
10
+ * instead of the unnamed `"[PicoFlow] Primitive is disposed"`. Purely diagnostic — has no effect
11
+ * on reactive behavior.
12
+ */
13
+ name?: string;
14
+ }
@@ -76,4 +76,3 @@ export interface FlowSubscribable<T> {
76
76
  */
77
77
  subscribe(onData: FlowOnDataListener<T>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener): FlowEffect;
78
78
  }
79
- //# sourceMappingURL=flowSubscribable.d.ts.map
@@ -5,4 +5,3 @@ import { FlowDisposable } from './flowDisposable.js';
5
5
  */
6
6
  export interface FlowTracker extends FlowDisposable {
7
7
  }
8
- //# sourceMappingURL=flowTracker.d.ts.map
@@ -1,6 +1,7 @@
1
1
  export * from './flowConfig.js';
2
2
  export * from './flowDisposable.js';
3
+ export * from './flowErrors.js';
3
4
  export * from './flowObservable.js';
5
+ export * from './flowPrimitiveOptions.js';
4
6
  export * from './flowSubscribable.js';
5
7
  export * from './flowTracker.js';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,2 @@
1
1
  export * from './base/index.js';
2
2
  export * from './nodes/index.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { FlowValue } from '../flowValue.js';
2
3
  /** Function that initializes a value asynchronously. */
3
4
  export type InitFunctionAsync<T> = () => Promise<T>;
@@ -22,10 +23,10 @@ export interface FlowConstantAsync<T> extends FlowValue<T> {
22
23
  * reactive values, such as loading configuration or fetching initial data.
23
24
  *
24
25
  * @param value - Promise to resolve, or async function that returns a promise on first access
26
+ * @param options - Optional settings; `name` identifies this primitive in error messages
25
27
  * @returns A FlowConstantAsync that provides read-only access to the resolved value
26
28
  *
27
29
  * @public
28
30
  */
29
- export declare function constantAsync<T>(value: Promise<T>): FlowConstantAsync<T>;
30
- export declare function constantAsync<T>(initializer: InitFunctionAsync<T>): FlowConstantAsync<T>;
31
- //# sourceMappingURL=flowConstantAsync.d.ts.map
31
+ export declare function constantAsync<T>(value: Promise<T>, options?: FlowPrimitiveOptions): FlowConstantAsync<T>;
32
+ export declare function constantAsync<T>(initializer: InitFunctionAsync<T>, options?: FlowPrimitiveOptions): FlowConstantAsync<T>;
@@ -1,4 +1,4 @@
1
- import { FlowTracker } from '../../base/index.js';
1
+ import { FlowPrimitiveOptions, FlowTracker } from '../../base/index.js';
2
2
  import { FlowValue } from '../flowValue.js';
3
3
  import { NotPromise } from '../utils.js';
4
4
  /** Function that derives a value asynchronously from dependencies and optionally the previous value. */
@@ -29,9 +29,9 @@ export interface FlowDerivationAsync<T> extends FlowValue<T> {
29
29
  * retry once resolved. Use for derived data from async sources like filtered API results or computed database queries.
30
30
  *
31
31
  * @param compute - Async function that accesses dependencies and returns a promise of the derived value
32
+ * @param options - Optional settings; `name` identifies this primitive in error messages
32
33
  * @returns A FlowDerivationAsync that provides read-only access to the resolved computed value
33
34
  *
34
35
  * @public
35
36
  */
36
- export declare function derivationAsync<T>(compute: DerivationFunctionAsync<T>): FlowDerivationAsync<T>;
37
- //# sourceMappingURL=flowDerivationAsync.d.ts.map
37
+ export declare function derivationAsync<T>(compute: DerivationFunctionAsync<T>, options?: FlowPrimitiveOptions): FlowDerivationAsync<T>;
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { FlowValue } from '../flowValue.js';
2
3
  import { NotPromise } from '../utils.js';
3
4
  import { InitFunctionAsync } from './flowConstantAsync.js';
@@ -32,10 +33,10 @@ export interface FlowStateAsync<T> extends FlowValue<T> {
32
33
  * application logic, such as loading user profiles, fetching search results, or any async state updates.
33
34
  *
34
35
  * @param value - Initial promise to resolve, or lazy async initializer function
36
+ * @param options - Optional settings; `name` identifies this primitive in error messages
35
37
  * @returns A FlowStateAsync that can be read and modified with promises
36
38
  *
37
39
  * @public
38
40
  */
39
- export declare function stateAsync<T>(value: Promise<T>): FlowStateAsync<T>;
40
- export declare function stateAsync<T>(initializer: InitFunctionAsync<T>): FlowStateAsync<T>;
41
- //# sourceMappingURL=flowStateAsync.d.ts.map
41
+ export declare function stateAsync<T>(value: Promise<T>, options?: FlowPrimitiveOptions): FlowStateAsync<T>;
42
+ export declare function stateAsync<T>(initializer: InitFunctionAsync<T>, options?: FlowPrimitiveOptions): FlowStateAsync<T>;
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { DerivationFunctionAsync, FlowDerivationAsync } from './flowDerivationAsync.js';
2
3
  import { FlowStateAsync } from './flowStateAsync.js';
3
4
  /**
@@ -22,9 +23,9 @@ export interface FlowWritableDerivationAsync<T> extends FlowStateAsync<T>, FlowD
22
23
  * such as editable async calculated fields or user-correctable async totals.
23
24
  *
24
25
  * @param compute - Async function that accesses dependencies and returns a promise of the derived value
26
+ * @param options - Optional settings; `name` identifies this primitive in error messages
25
27
  * @returns A FlowWritableDerivationAsync that provides both reactive async computation and manual control
26
28
  *
27
29
  * @public
28
30
  */
29
- export declare function writableDerivationAsync<T>(compute: DerivationFunctionAsync<T>): FlowWritableDerivationAsync<T>;
30
- //# sourceMappingURL=flowWritableDerivationAsync.d.ts.map
31
+ export declare function writableDerivationAsync<T>(compute: DerivationFunctionAsync<T>, options?: FlowPrimitiveOptions): FlowWritableDerivationAsync<T>;
@@ -2,4 +2,3 @@ export * from './flowConstantAsync.js';
2
2
  export * from './flowDerivationAsync.js';
3
3
  export * from './flowStateAsync.js';
4
4
  export * from './flowWritableDerivationAsync.js';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { FlowState } from '../sync/flowState.js';
2
3
  /**
3
4
  * Discriminated union representing all possible array mutation operations.
@@ -129,9 +130,9 @@ export interface FlowArray<T> extends FlowState<T[]> {
129
130
  * needs array-like operations with automatic change propagation.
130
131
  *
131
132
  * @param initial - Optional initial array of items
133
+ * @param options - Optional settings; `name` identifies this primitive in error messages
132
134
  * @returns A FlowArray with reactive mutation methods
133
135
  *
134
136
  * @public
135
137
  */
136
- export declare function array<T>(initial?: T[]): FlowArray<T>;
137
- //# sourceMappingURL=flowArray.d.ts.map
138
+ export declare function array<T>(initial?: T[], options?: FlowPrimitiveOptions): FlowArray<T>;
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { FlowState } from '../sync/flowState.js';
2
3
  /**
3
4
  * Discriminated union representing all possible map mutation operations.
@@ -91,9 +92,9 @@ export interface FlowMap<K, V> extends FlowState<Map<K, V>> {
91
92
  * data that needs reactive updates.
92
93
  *
93
94
  * @param initial - Optional initial entries as a Record or Map
95
+ * @param options - Optional settings; `name` identifies this primitive in error messages
94
96
  * @returns A FlowMap with reactive mutation methods
95
97
  *
96
98
  * @public
97
99
  */
98
- export declare function map<K extends string | number | symbol, V>(initial?: Record<K, V> | Map<K, V>): FlowMap<K, V>;
99
- //# sourceMappingURL=flowMap.d.ts.map
100
+ export declare function map<K extends string | number | symbol, V>(initial?: Record<K, V> | Map<K, V>, options?: FlowPrimitiveOptions): FlowMap<K, V>;
@@ -1,3 +1,2 @@
1
1
  export * from './flowArray.js';
2
2
  export * from './flowMap.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -26,4 +26,3 @@ export interface FlowEffect extends FlowDisposable {
26
26
  * @public
27
27
  */
28
28
  export declare function subscribe<T>(data: FlowDataTracker<T>, onData: FlowOnDataListener<T>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener): FlowEffect;
29
- //# sourceMappingURL=flowEffect.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { FlowObservable } from '../base/flowObservable.js';
2
+ import { FlowPrimitiveOptions } from '../base/flowPrimitiveOptions.js';
2
3
  /**
3
4
  * Manual trigger that notifies subscribers without carrying data.
4
5
  *
@@ -17,9 +18,9 @@ export interface FlowSignal extends FlowObservable<void> {
17
18
  * and reactive computations that depend on the signal. Unlike state or derivations, signals don't
18
19
  * carry data values - they simply represent that an event occurred.
19
20
  *
21
+ * @param options - Optional settings; `name` identifies this primitive in error messages
20
22
  * @returns A FlowSignal that can be triggered manually and subscribed to
21
23
  *
22
24
  * @public
23
25
  */
24
- export declare function signal(): FlowSignal;
25
- //# sourceMappingURL=flowSignal.d.ts.map
26
+ export declare function signal(options?: FlowPrimitiveOptions): FlowSignal;
@@ -33,4 +33,3 @@ export interface FlowValue<T> extends FlowObservable<T> {
33
33
  */
34
34
  pick(): Promise<T>;
35
35
  }
36
- //# sourceMappingURL=flowValue.d.ts.map
@@ -5,4 +5,3 @@ export * from './flowSignal.js';
5
5
  export * from './flowValue.js';
6
6
  export * from './sync/index.js';
7
7
  export * from './utils.js';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { FlowValue } from '../flowValue.js';
2
3
  import { NotPromise } from '../utils.js';
3
4
  /** Function that initializes a value. */
@@ -21,9 +22,9 @@ export interface FlowConstant<T> extends FlowValue<T> {
21
22
  * in the reactive graph. Useful for expensive one-time computations or static configuration.
22
23
  *
23
24
  * @param initializer - Function that computes the constant value on first access
25
+ * @param options - Optional settings; `name` identifies this primitive in error messages
24
26
  * @returns A FlowConstant that provides read-only access to the cached value
25
27
  *
26
28
  * @public
27
29
  */
28
- export declare function constant<T>(initializer: InitFunction<T>): FlowConstant<T>;
29
- //# sourceMappingURL=flowConstant.d.ts.map
30
+ export declare function constant<T>(initializer: InitFunction<T>, options?: FlowPrimitiveOptions): FlowConstant<T>;
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { FlowTracker } from '../../base/flowTracker.js';
2
3
  import { FlowValue } from '../flowValue.js';
3
4
  import { NotPromise } from '../utils.js';
@@ -28,9 +29,9 @@ export interface FlowDerivation<T> extends FlowValue<T> {
28
29
  * synchronized with source state.
29
30
  *
30
31
  * @param compute - Function that accesses dependencies and computes the derived value
32
+ * @param options - Optional settings; `name` identifies this primitive in error messages
31
33
  * @returns A FlowDerivation that provides read-only access to the computed value
32
34
  *
33
35
  * @public
34
36
  */
35
- export declare function derivation<T>(compute: DerivationFunction<T>): FlowDerivation<T>;
36
- //# sourceMappingURL=flowDerivation.d.ts.map
37
+ export declare function derivation<T>(compute: DerivationFunction<T>, options?: FlowPrimitiveOptions): FlowDerivation<T>;
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { FlowValue } from '../flowValue.js';
2
3
  import { NotPromise } from '../utils.js';
3
4
  import { InitFunction } from './flowConstant.js';
@@ -30,10 +31,10 @@ export interface FlowState<T> extends FlowValue<T> {
30
31
  * changes through user actions, external events, or application logic rather than derived computations.
31
32
  *
32
33
  * @param value - Initial value for the state, or lazy initializer function
34
+ * @param options - Optional settings; `name` identifies this primitive in error messages
33
35
  * @returns A FlowState that can be read and modified
34
36
  *
35
37
  * @public
36
38
  */
37
- export declare function state<T>(value: NotPromise<T>): FlowState<T>;
38
- export declare function state<T>(initializer: InitFunction<T>): FlowState<T>;
39
- //# sourceMappingURL=flowState.d.ts.map
39
+ export declare function state<T>(value: NotPromise<T>, options?: FlowPrimitiveOptions): FlowState<T>;
40
+ export declare function state<T>(initializer: InitFunction<T>, options?: FlowPrimitiveOptions): FlowState<T>;
@@ -1,3 +1,4 @@
1
+ import { FlowPrimitiveOptions } from '../../base/flowPrimitiveOptions.js';
1
2
  import { DerivationFunction, FlowDerivation } from './flowDerivation.js';
2
3
  import { FlowState } from './flowState.js';
3
4
  /**
@@ -20,9 +21,9 @@ export interface FlowWritableDerivation<T> extends FlowState<T>, FlowDerivation<
20
21
  * derived but need occasional manual adjustments, such as editable calculated fields or user-correctable totals.
21
22
  *
22
23
  * @param compute - Function that accesses dependencies and computes the derived value
24
+ * @param options - Optional settings; `name` identifies this primitive in error messages
23
25
  * @returns A FlowWritableDerivation that provides both reactive computation and manual control
24
26
  *
25
27
  * @public
26
28
  */
27
- export declare function writableDerivation<T>(compute: DerivationFunction<T>): FlowWritableDerivation<T>;
28
- //# sourceMappingURL=flowWritableDerivation.d.ts.map
29
+ export declare function writableDerivation<T>(compute: DerivationFunction<T>, options?: FlowPrimitiveOptions): FlowWritableDerivation<T>;
@@ -2,4 +2,3 @@ export * from './flowConstant.js';
2
2
  export * from './flowDerivation.js';
3
3
  export * from './flowState.js';
4
4
  export * from './flowWritableDerivation.js';
5
- //# sourceMappingURL=index.d.ts.map
@@ -20,4 +20,3 @@ export type NotPromise<T> = T extends Promise<unknown> ? never : T;
20
20
  * @public
21
21
  */
22
22
  export type FlowReadonly<T> = Omit<FlowValue<T>, "set" | "refresh" | "trigger">;
23
- //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,11 +1,15 @@
1
1
  import { FlowDisposable } from '../api/index.js';
2
+ import { PicoFlowDisposedError } from './errors.js';
2
3
  /**
3
4
  * Base implementation of the disposable pattern for reactive primitives.
4
5
  * Concrete subclasses implement `dispose()` and are expected to throw if disposed multiple times.
5
6
  */
6
7
  export declare abstract class Disposable implements FlowDisposable {
7
8
  protected _disposed: boolean;
9
+ protected readonly _name?: string;
10
+ constructor(name?: string);
8
11
  get disposed(): boolean;
12
+ /** Builds the disposed-primitive error, naming the primitive when a `name` was given at creation. */
13
+ protected _disposedError(): PicoFlowDisposedError;
9
14
  abstract dispose(): void;
10
15
  }
11
- //# sourceMappingURL=disposable.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Base class for every typed error picoflow throws, so a consumer can `catch` a picoflow-specific
3
+ * failure with a single `instanceof PicoFlowError` check without matching on message text.
4
+ * @public
5
+ */
6
+ export declare class PicoFlowError extends Error {
7
+ constructor(message: string);
8
+ }
9
+ /**
10
+ * Thrown when a disposed primitive (or its underlying scheduler) is read, written, or otherwise
11
+ * used after `dispose()`.
12
+ * @public
13
+ */
14
+ export declare class PicoFlowDisposedError extends PicoFlowError {
15
+ constructor(message: string);
16
+ }
17
+ /**
18
+ * Thrown when the reactive flush detects a feedback loop that exceeds the maximum step guard.
19
+ * @public
20
+ */
21
+ export declare class PicoFlowCycleError extends PicoFlowError {
22
+ constructor(message: string);
23
+ }
24
+ /**
25
+ * Thrown when a node reaches a state its own implementation considers unreachable. Reaching this
26
+ * indicates a picoflow bug rather than a misuse of the public API.
27
+ * @public
28
+ */
29
+ export declare class PicoFlowInternalError extends PicoFlowError {
30
+ constructor(message: string);
31
+ }
@@ -11,6 +11,9 @@ export declare class ExecutionStack {
11
11
  private static readonly _effectQueue;
12
12
  private static _executionScheduled?;
13
13
  private static _coalesceResetScheduled;
14
+ /** Per-effect resets accumulated for the microtask scheduled below, so notifying more than one
15
+ * effect in the same sync turn doesn't discard every reset after the first (A2-SEM-5). */
16
+ private static _coalesceResets;
14
17
  /** Routes any error escaping the flush loop; defaults to logging rather than crashing (A2-SEM-2, A2-SEC-1). */
15
18
  private static _onFlushError;
16
19
  /**
@@ -19,16 +22,6 @@ export declare class ExecutionStack {
19
22
  * from coalesced sync-batch notifications.
20
23
  */
21
24
  private static _pastSyncTurn;
22
- /** @internal Used by EffectNode to distinguish sync-batch from microtask notifications. */
23
- static get pastSyncTurn(): boolean;
24
- /**
25
- * @internal Runs after the current sync turn ends (queueMicrotask).
26
- * Marks pastSyncTurn so the next coalesced effect notify can bump its epoch,
27
- * and resets per-effect coalesce flags via onReset.
28
- */
29
- static scheduleCoalesceReset(onReset: () => void): void;
30
- /** @internal Wired to the public `onFlushError()` API in `src/api/base/flowConfig.ts`. */
31
- static setFlushErrorHandler(handler: (error: unknown) => void): void;
32
25
  static pushPending(node: IObserver): void;
33
26
  static pushEffect(effect: IObserver): void;
34
27
  private static _beginSyncTurn;
@@ -36,4 +29,3 @@ export declare class ExecutionStack {
36
29
  private static _drain;
37
30
  private static _execute;
38
31
  }
39
- //# sourceMappingURL=executionStack.d.ts.map
@@ -1,6 +1,8 @@
1
+ export * from './dependenciesRegistry.js';
2
+ export * from './dependentsRegistry.js';
1
3
  export * from './disposable.js';
4
+ export * from './errors.js';
2
5
  export * from './executionStack.js';
3
6
  export * from './node.js';
4
7
  export * from './observable.js';
5
8
  export * from './observer.js';
6
- //# sourceMappingURL=index.d.ts.map
@@ -6,8 +6,8 @@ import { IObserver } from './observer.js';
6
6
  * Base implementation for reactive nodes that propagate changes through the dependency graph.
7
7
  */
8
8
  export declare abstract class Node<T> extends Disposable implements IObservable<T>, IObserver {
9
- private _dependencies;
10
- private _dependents;
9
+ private _dependenciesRegistry;
10
+ private _dependentsRegistry;
11
11
  protected _status: ObservableStatus;
12
12
  get status(): ObservableStatus;
13
13
  set status(status: ObservableStatus);
@@ -25,4 +25,3 @@ export declare abstract class Node<T> extends Disposable implements IObservable<
25
25
  abstract execute(): void;
26
26
  abstract subscribe(onValue: FlowOnDataListener<T>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener): FlowEffect;
27
27
  }
28
- //# sourceMappingURL=node.d.ts.map
@@ -20,7 +20,7 @@ export interface IObservable<T> extends FlowObservable<T> {
20
20
  * Base implementation managing the dependency graph for reactive observables.
21
21
  */
22
22
  export declare abstract class Observable<T> extends Disposable implements IObservable<T> {
23
- private _dependents;
23
+ private _dependentsRegistry;
24
24
  protected _status: ObservableStatus;
25
25
  get status(): ObservableStatus;
26
26
  set status(status: ObservableStatus);
@@ -32,4 +32,3 @@ export declare abstract class Observable<T> extends Disposable implements IObser
32
32
  dispose(): void;
33
33
  abstract subscribe(onValue: FlowOnDataListener<T>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener): FlowEffect;
34
34
  }
35
- //# sourceMappingURL=observable.d.ts.map
@@ -20,7 +20,7 @@ export interface IObserver {
20
20
  * Base implementation managing dependency tracking for reactive observers.
21
21
  */
22
22
  export declare abstract class Observer extends Disposable implements IObserver {
23
- private _dependencies;
23
+ private _dependenciesRegistry;
24
24
  /** Set when a dependency disposed while this observer was queued; consumed by the next execute(). */
25
25
  protected _dependencyDisposed: boolean;
26
26
  markDependencyDisposed(): void;
@@ -31,4 +31,3 @@ export declare abstract class Observer extends Disposable implements IObserver {
31
31
  abstract notify(): void;
32
32
  abstract execute(): void;
33
33
  }
34
- //# sourceMappingURL=observer.d.ts.map
@@ -1,2 +1 @@
1
1
  export * from './solid.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -47,4 +47,3 @@ import { FlowTracker, FlowValue, NotPromise } from '../api/index.js';
47
47
  */
48
48
  export declare function from<T>(flow: FlowValue<T>): Resource<T>;
49
49
  export declare function from<T>(flow: (t: FlowTracker) => NotPromise<T>): Resource<T>;
50
- //# sourceMappingURL=solid.d.ts.map
@@ -1,3 +1,2 @@
1
1
  export * from './api/index.js';
2
2
  export * from './converters/index.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,23 +1 @@
1
- import { FlowEffect, FlowOnDataListener, FlowOnErrorListener, FlowOnPendingListener, NotPromise, UpdateFunction } from '../api/index.js';
2
- import { ValueSyncNode } from './valueSyncNode.js';
3
- /**
4
- * Reactive state that tracks the latest action while delivering every emitted action
5
- * to `.subscribe()` callbacks, including multiple mutations within the same batch.
6
- *
7
- * Two read models:
8
- * - get() / pick(): last-write-wins snapshot (current action value).
9
- * - subscribe(): event stream — one onData call per emitted action, even when several
10
- * mutations happen before the next flush. Each subscriber owns its own queue so
11
- * delivery is not shared or stolen between subscribers.
12
- *
13
- * @internal
14
- */
15
- export declare class ActionNode<T extends NotPromise<unknown>> extends ValueSyncNode<T> {
16
- private _slots;
17
- private _enqueueForSubscribers;
18
- set(value: NotPromise<T>): void;
19
- set(updater: UpdateFunction<T>): void;
20
- subscribe(onValue: FlowOnDataListener<T>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener): FlowEffect;
21
- dispose(): void;
22
- }
23
- //# sourceMappingURL=actionNode.d.ts.map
1
+ export {};
@@ -1,26 +1 @@
1
- import { FlowArray, FlowArrayAction, FlowTracker, NotPromise, UpdateFunction } from '../api/index.js';
2
- import { ActionNode } from './actionNode.js';
3
- import { ValueSyncNode } from './valueSyncNode.js';
4
- /**
5
- * Internal implementation of reactive array with mutation tracking.
6
- * @internal
7
- */
8
- export declare class ArrayNode<T> extends ValueSyncNode<T[]> implements FlowArray<T> {
9
- $lastAction: ActionNode<FlowArrayAction<T>>;
10
- protected _value: T[];
11
- constructor(value?: T[]);
12
- get(tracker: FlowTracker): T[];
13
- pick(): Promise<T[]>;
14
- get length(): number;
15
- set(items: NotPromise<T[]>): T[];
16
- set(updater: UpdateFunction<T[]>): T[];
17
- update(index: number, item: T): T | undefined;
18
- push(item: T): void;
19
- pop(): T | undefined;
20
- unshift(item: T): void;
21
- shift(): T | undefined;
22
- splice(start: number, deleteCount: number, ...newItems: T[]): T[];
23
- clear(): T[];
24
- dispose(): void;
25
- }
26
- //# sourceMappingURL=arrayNode.d.ts.map
1
+ export {};
@@ -1,32 +1 @@
1
- import { FlowDataTracker, FlowEffect, FlowOnDataListener, FlowOnErrorListener, FlowOnPendingListener } from '../api/index.js';
2
- import { Observer } from '../base/index.js';
3
- /**
4
- * Reactive effect that automatically re-executes when its dependencies change.
5
- *
6
- * Scheduling uses epoch-based coalescing:
7
- * - Multiple dependency changes in the same synchronous turn produce one queue entry
8
- * but may still require multiple runs when notifications arrive in later microtasks
9
- * (e.g. async pending → resolved).
10
- * - Re-notifications during execute() (cascading effects) enqueue a fresh run because
11
- * _queued is cleared at the start of execute().
12
- *
13
- * @internal
14
- */
15
- export declare class EffectNode<T> extends Observer implements FlowEffect {
16
- private _data;
17
- private _onData;
18
- private _onError?;
19
- private _onPending?;
20
- /** True while this effect is already waiting in the effect queue for the next flush. */
21
- private _queued;
22
- /** Guards the single coalesced bump of _notifyEpoch while _queued during one sync turn. */
23
- private _coalescedWhileQueued;
24
- /** Monotonic count of notifications that must eventually be executed. */
25
- private _notifyEpoch;
26
- /** How many notification epochs have been executed so far. */
27
- private _executedEpoch;
28
- constructor(data: FlowDataTracker<T>, onData: FlowOnDataListener<T>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener);
29
- notify(): void;
30
- execute(): void;
31
- }
32
- //# sourceMappingURL=effectNode.d.ts.map
1
+ export {};
@@ -6,4 +6,3 @@ export * from './signalNode.js';
6
6
  export * from './valueAsyncNode.js';
7
7
  export * from './valueNode.js';
8
8
  export * from './valueSyncNode.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1,20 +1 @@
1
- import { FlowMap, FlowMapAction, NotPromise, UpdateFunction } from '../api/index.js';
2
- import { ActionNode } from './actionNode.js';
3
- import { ValueSyncNode } from './valueSyncNode.js';
4
- /**
5
- * Internal implementation of reactive map with mutation tracking.
6
- * @internal
7
- */
8
- export declare class MapNode<K, V> extends ValueSyncNode<Map<K, V>> implements FlowMap<K, V> {
9
- $lastAction: ActionNode<FlowMapAction<K, V>>;
10
- protected _value: Map<K, V>;
11
- constructor(value?: Map<K, V>);
12
- add(key: K, value: V): void;
13
- update(key: K, value: V): V;
14
- delete(key: K): V;
15
- set(map: NotPromise<Map<K, V>>): Map<K, V>;
16
- set(updater: UpdateFunction<Map<K, V>>): Map<K, V>;
17
- clear(): Map<K, V>;
18
- dispose(): void;
19
- }
20
- //# sourceMappingURL=mapNode.d.ts.map
1
+ export {};
@@ -1,10 +1 @@
1
- import { FlowEffect, FlowOnDataListener, FlowOnErrorListener, FlowOnPendingListener, FlowSignal } from '../api/index.js';
2
- import { Observable } from '../base/index.js';
3
- /**
4
- * Manual trigger that notifies subscribers without carrying data.
5
- * @internal
6
- */
7
- export declare class SignalNode extends Observable<void> implements FlowSignal {
8
- subscribe(onTrigger: FlowOnDataListener<void>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener): FlowEffect;
9
- }
10
- //# sourceMappingURL=signalNode.d.ts.map
1
+ export {};
@@ -1,23 +1 @@
1
- import { DerivationFunctionAsync, InitFunctionAsync, NotPromise, UpdateFunctionAsync } from '../api/index.js';
2
- import { AsyncScheduler } from '../schedulers/index.js';
3
- import { ValueNode } from './valueNode.js';
4
- /**
5
- * Function that computes a value asynchronously (either initialization or derivation).
6
- * @internal
7
- */
8
- export type ComputeFunctionAsync<T> = InitFunctionAsync<T> | DerivationFunctionAsync<T>;
9
- /**
10
- * Asynchronous reactive value that resolves promises and propagates results when settled.
11
- * @internal
12
- */
13
- export declare class ValueAsyncNode<T extends NotPromise<unknown>> extends ValueNode<T> {
14
- protected _scheduler: AsyncScheduler<T>;
15
- private _compute;
16
- constructor(promiseOrCompute: Promise<T> | ComputeFunctionAsync<T>);
17
- private _onResolve;
18
- private _onReject;
19
- set(promise: Promise<T>): void;
20
- set(updater: UpdateFunctionAsync<T>): void;
21
- refresh(): void;
22
- }
23
- //# sourceMappingURL=valueAsyncNode.d.ts.map
1
+ export {};