@ersbeth/picoflow 1.1.2 → 2.0.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.
- package/.vscode/settings.json +3 -3
- package/CHANGELOG.md +43 -0
- package/README.md +2 -18
- package/biome.json +45 -35
- package/dist/picoflow.js +856 -1530
- package/dist/types/api/base/flowDisposable.d.ts +41 -0
- package/dist/types/api/base/flowDisposable.d.ts.map +1 -0
- package/dist/types/api/base/flowObservable.d.ts +27 -0
- package/dist/types/api/base/flowObservable.d.ts.map +1 -0
- package/dist/types/api/base/flowSubscribable.d.ts +79 -0
- package/dist/types/api/base/flowSubscribable.d.ts.map +1 -0
- package/dist/types/api/base/flowTracker.d.ts +8 -0
- package/dist/types/api/base/flowTracker.d.ts.map +1 -0
- package/dist/types/api/base/index.d.ts +5 -0
- package/dist/types/api/base/index.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +3 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/api/nodes/async/flowConstantAsync.d.ts +31 -0
- package/dist/types/api/nodes/async/flowConstantAsync.d.ts.map +1 -0
- package/dist/types/api/nodes/async/flowDerivationAsync.d.ts +37 -0
- package/dist/types/api/nodes/async/flowDerivationAsync.d.ts.map +1 -0
- package/dist/types/api/nodes/async/flowStateAsync.d.ts +41 -0
- package/dist/types/api/nodes/async/flowStateAsync.d.ts.map +1 -0
- package/dist/types/api/nodes/async/flowWritableDerivationAsync.d.ts +30 -0
- package/dist/types/api/nodes/async/flowWritableDerivationAsync.d.ts.map +1 -0
- package/dist/types/{flow → api}/nodes/async/index.d.ts +1 -2
- package/dist/types/api/nodes/async/index.d.ts.map +1 -0
- package/dist/types/api/nodes/collections/flowArray.d.ts +134 -0
- package/dist/types/api/nodes/collections/flowArray.d.ts.map +1 -0
- package/dist/types/api/nodes/collections/flowMap.d.ts +98 -0
- package/dist/types/api/nodes/collections/flowMap.d.ts.map +1 -0
- package/dist/types/api/nodes/collections/index.d.ts.map +1 -0
- package/dist/types/api/nodes/flowEffect.d.ts +28 -0
- package/dist/types/api/nodes/flowEffect.d.ts.map +1 -0
- package/dist/types/api/nodes/flowSignal.d.ts +25 -0
- package/dist/types/api/nodes/flowSignal.d.ts.map +1 -0
- package/dist/types/api/nodes/flowValue.d.ts +35 -0
- package/dist/types/api/nodes/flowValue.d.ts.map +1 -0
- package/dist/types/api/nodes/index.d.ts +8 -0
- package/dist/types/api/nodes/index.d.ts.map +1 -0
- package/dist/types/api/nodes/sync/flowConstant.d.ts +29 -0
- package/dist/types/api/nodes/sync/flowConstant.d.ts.map +1 -0
- package/dist/types/api/nodes/sync/flowDerivation.d.ts +36 -0
- package/dist/types/api/nodes/sync/flowDerivation.d.ts.map +1 -0
- package/dist/types/api/nodes/sync/flowState.d.ts +39 -0
- package/dist/types/api/nodes/sync/flowState.d.ts.map +1 -0
- package/dist/types/api/nodes/sync/flowWritableDerivation.d.ts +28 -0
- package/dist/types/api/nodes/sync/flowWritableDerivation.d.ts.map +1 -0
- package/dist/types/{flow → api}/nodes/sync/index.d.ts +1 -2
- package/dist/types/api/nodes/sync/index.d.ts.map +1 -0
- package/dist/types/api/nodes/utils.d.ts +22 -0
- package/dist/types/api/nodes/utils.d.ts.map +1 -0
- package/dist/types/base/disposable.d.ts +11 -0
- package/dist/types/base/disposable.d.ts.map +1 -0
- package/dist/types/base/executionStack.d.ts +14 -0
- package/dist/types/base/executionStack.d.ts.map +1 -0
- package/dist/types/base/index.d.ts +6 -0
- package/dist/types/base/index.d.ts.map +1 -0
- package/dist/types/base/node.d.ts +27 -0
- package/dist/types/base/node.d.ts.map +1 -0
- package/dist/types/base/observable.d.ts +37 -0
- package/dist/types/base/observable.d.ts.map +1 -0
- package/dist/types/base/observer.d.ts +25 -0
- package/dist/types/base/observer.d.ts.map +1 -0
- package/dist/types/converters/index.d.ts +2 -0
- package/dist/types/converters/index.d.ts.map +1 -0
- package/dist/types/converters/solid.d.ts +46 -0
- package/dist/types/converters/solid.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -63
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/nodes/arrayNode.d.ts +2 -0
- package/dist/types/nodes/arrayNode.d.ts.map +1 -0
- package/dist/types/nodes/effectNode.d.ts +2 -0
- package/dist/types/nodes/effectNode.d.ts.map +1 -0
- package/dist/types/nodes/index.d.ts +9 -0
- package/dist/types/nodes/index.d.ts.map +1 -0
- package/dist/types/nodes/mapNode.d.ts +2 -0
- package/dist/types/nodes/mapNode.d.ts.map +1 -0
- package/dist/types/nodes/signalNode.d.ts +2 -0
- package/dist/types/nodes/signalNode.d.ts.map +1 -0
- package/dist/types/nodes/valueAsyncNode.d.ts +2 -0
- package/dist/types/nodes/valueAsyncNode.d.ts.map +1 -0
- package/dist/types/nodes/valueNode.d.ts +2 -0
- package/dist/types/nodes/valueNode.d.ts.map +1 -0
- package/dist/types/nodes/valueSyncNode.d.ts +2 -0
- package/dist/types/nodes/valueSyncNode.d.ts.map +1 -0
- package/dist/types/schedulers/asyncResolver.d.ts +2 -0
- package/dist/types/schedulers/asyncResolver.d.ts.map +1 -0
- package/dist/types/schedulers/asyncScheduler.d.ts +2 -0
- package/dist/types/schedulers/asyncScheduler.d.ts.map +1 -0
- package/dist/types/schedulers/index.d.ts +5 -0
- package/dist/types/schedulers/index.d.ts.map +1 -0
- package/dist/types/schedulers/pendingError.d.ts +2 -0
- package/dist/types/schedulers/pendingError.d.ts.map +1 -0
- package/dist/types/schedulers/scheduler.d.ts +2 -0
- package/dist/types/schedulers/scheduler.d.ts.map +1 -0
- package/dist/types/schedulers/syncResolver.d.ts +2 -0
- package/dist/types/schedulers/syncResolver.d.ts.map +1 -0
- package/dist/types/schedulers/syncScheduler.d.ts +2 -0
- package/dist/types/schedulers/syncScheduler.d.ts.map +1 -0
- package/docs/.vitepress/config.mts +128 -93
- package/docs/api/functions/array.md +14 -37
- package/docs/api/functions/constant.md +13 -25
- package/docs/api/functions/constantAsync.md +69 -0
- package/docs/api/functions/derivation.md +14 -33
- package/docs/api/functions/derivationAsync.md +34 -0
- package/docs/api/functions/from.md +62 -153
- package/docs/api/functions/isDisposable.md +8 -30
- package/docs/api/functions/map.md +15 -36
- package/docs/api/functions/signal.md +8 -23
- package/docs/api/functions/state.md +43 -23
- package/docs/api/functions/stateAsync.md +69 -0
- package/docs/api/functions/subscribe.md +40 -0
- package/docs/api/functions/writableDerivation.md +33 -0
- package/docs/api/functions/writableDerivationAsync.md +34 -0
- package/docs/api/index.md +45 -102
- package/docs/api/interfaces/FlowArray.md +439 -0
- package/docs/api/interfaces/FlowConstant.md +220 -0
- package/docs/api/interfaces/FlowConstantAsync.md +221 -0
- package/docs/api/interfaces/FlowDerivation.md +241 -0
- package/docs/api/interfaces/FlowDerivationAsync.md +242 -0
- package/docs/api/interfaces/FlowDisposable.md +32 -38
- package/docs/api/interfaces/FlowEffect.md +64 -0
- package/docs/api/interfaces/FlowMap.md +374 -0
- package/docs/api/interfaces/FlowObservable.md +155 -0
- package/docs/api/interfaces/FlowSignal.md +156 -0
- package/docs/api/interfaces/FlowState.md +269 -0
- package/docs/api/interfaces/FlowStateAsync.md +268 -0
- package/docs/api/interfaces/FlowSubscribable.md +55 -0
- package/docs/api/interfaces/FlowTracker.md +61 -0
- package/docs/api/interfaces/FlowValue.md +222 -0
- package/docs/api/interfaces/FlowWritableDerivation.md +292 -0
- package/docs/api/interfaces/FlowWritableDerivationAsync.md +293 -0
- package/docs/api/type-aliases/DerivationFunction.md +28 -0
- package/docs/api/type-aliases/DerivationFunctionAsync.md +28 -0
- package/docs/api/type-aliases/FlowArrayAction.md +19 -8
- package/docs/api/type-aliases/FlowDataTracker.md +33 -0
- package/docs/api/type-aliases/FlowMapAction.md +48 -0
- package/docs/api/type-aliases/FlowOnDataListener.md +33 -0
- package/docs/api/type-aliases/FlowOnErrorListener.md +27 -0
- package/docs/api/type-aliases/FlowOnPendingListener.md +21 -0
- package/docs/api/type-aliases/FlowReadonly.md +22 -0
- package/docs/api/type-aliases/InitFunction.md +21 -0
- package/docs/api/type-aliases/InitFunctionAsync.md +21 -0
- package/docs/api/type-aliases/NotPromise.md +6 -3
- package/docs/api/type-aliases/UpdateFunction.md +27 -0
- package/docs/api/type-aliases/UpdateFunctionAsync.md +27 -0
- package/docs/api/typedoc-sidebar.json +1 -81
- package/docs/examples/examples.md +0 -2
- package/docs/guide/advanced/architecture.md +1234 -0
- package/docs/guide/advanced/migration-v2.md +204 -0
- package/docs/guide/advanced/solidjs.md +2 -88
- package/docs/guide/introduction/concepts.md +4 -3
- package/docs/guide/introduction/conventions.md +2 -33
- package/docs/guide/introduction/getting-started.md +28 -23
- package/docs/guide/introduction/lifecycle.md +16 -19
- package/docs/guide/primitives/array.md +102 -216
- package/docs/guide/primitives/constant.md +39 -212
- package/docs/guide/primitives/derivations.md +55 -122
- package/docs/guide/primitives/effects.md +155 -241
- package/docs/guide/primitives/map.md +64 -186
- package/docs/guide/primitives/overview.md +45 -128
- package/docs/guide/primitives/signal.md +51 -88
- package/docs/guide/primitives/state.md +34 -130
- package/package.json +56 -60
- package/src/api/base/flowDisposable.ts +44 -0
- package/src/api/base/flowObservable.ts +28 -0
- package/src/api/base/flowSubscribable.ts +87 -0
- package/src/api/base/flowTracker.ts +7 -0
- package/src/api/base/index.ts +4 -0
- package/src/{flow → api}/index.ts +0 -1
- package/src/api/nodes/async/flowConstantAsync.ts +36 -0
- package/src/api/nodes/async/flowDerivationAsync.ts +42 -0
- package/src/api/nodes/async/flowStateAsync.ts +47 -0
- package/src/api/nodes/async/flowWritableDerivationAsync.ts +33 -0
- package/src/{flow → api}/nodes/async/index.ts +1 -2
- package/src/api/nodes/collections/flowArray.ts +155 -0
- package/src/api/nodes/collections/flowMap.ts +115 -0
- package/src/api/nodes/flowEffect.ts +42 -0
- package/src/api/nodes/flowSignal.ts +28 -0
- package/src/api/nodes/flowValue.ts +36 -0
- package/src/api/nodes/index.ts +7 -0
- package/src/api/nodes/sync/flowConstant.ts +33 -0
- package/src/api/nodes/sync/flowDerivation.ts +41 -0
- package/src/api/nodes/sync/flowState.ts +45 -0
- package/src/api/nodes/sync/flowWritableDerivation.ts +31 -0
- package/src/{flow → api}/nodes/sync/index.ts +1 -2
- package/src/api/nodes/utils.ts +22 -0
- package/src/base/disposable.ts +18 -0
- package/src/base/executionStack.ts +42 -0
- package/src/base/index.ts +5 -0
- package/src/base/node.ts +98 -0
- package/src/base/observable.ts +87 -0
- package/src/base/observer.ts +51 -0
- package/src/converters/index.ts +1 -0
- package/src/converters/solid.ts +109 -0
- package/src/index.ts +2 -64
- package/src/nodes/arrayNode.ts +172 -0
- package/src/nodes/effectNode.ts +59 -0
- package/src/nodes/index.ts +8 -0
- package/src/nodes/mapNode.ts +127 -0
- package/src/nodes/signalNode.ts +21 -0
- package/src/nodes/valueAsyncNode.ts +88 -0
- package/src/nodes/valueNode.ts +144 -0
- package/src/nodes/valueSyncNode.ts +128 -0
- package/src/schedulers/asyncResolver.ts +78 -0
- package/src/schedulers/asyncScheduler.ts +66 -0
- package/src/schedulers/index.ts +4 -0
- package/src/schedulers/pendingError.ts +13 -0
- package/src/schedulers/scheduler.ts +9 -0
- package/src/schedulers/syncResolver.ts +69 -0
- package/src/schedulers/syncScheduler.ts +55 -0
- package/test/base/pendingError.test.ts +67 -0
- package/test/converters/solid.derivation.browser.test.tsx +69 -0
- package/test/converters/solid.node.test.ts +654 -0
- package/test/converters/solid.state.browser.test.tsx +1592 -0
- package/test/reactivity/flowSignal.test.ts +226 -0
- package/test/reactivity/nodes/async/asyncScheduler/asyncResolver.test.ts +593 -0
- package/test/reactivity/nodes/async/asyncScheduler/asyncScheduler.test.ts +317 -0
- package/test/reactivity/nodes/async/flowConstantAsync.test.ts +652 -0
- package/test/reactivity/nodes/async/flowDerivation.test.ts +898 -0
- package/test/reactivity/nodes/async/flowDerivationAsync.test.ts +1716 -0
- package/test/reactivity/nodes/async/flowStateAsync.test.ts +708 -0
- package/test/reactivity/nodes/async/flowWritableDerivationAsync.test.ts +614 -0
- package/test/reactivity/nodes/collections/flowArray.asyncStates.test.ts +1289 -0
- package/test/reactivity/nodes/collections/flowArray.scalars.test.ts +961 -0
- package/test/reactivity/nodes/collections/flowArray.states.test.ts +1035 -0
- package/test/reactivity/nodes/collections/flowMap.asyncStates.test.ts +960 -0
- package/test/reactivity/nodes/collections/flowMap.scalars.test.ts +775 -0
- package/test/reactivity/nodes/collections/flowMap.states.test.ts +958 -0
- package/test/reactivity/nodes/sync/flowConstant.test.ts +377 -0
- package/test/reactivity/nodes/sync/flowDerivation.test.ts +896 -0
- package/test/reactivity/nodes/sync/flowState.test.ts +341 -0
- package/test/reactivity/nodes/sync/flowWritableDerivation.test.ts +603 -0
- package/test/vitest.d.ts +10 -0
- package/tsconfig.json +31 -20
- package/typedoc.json +35 -35
- package/vite.config.ts +25 -23
- package/vitest.browser.config.ts +21 -0
- package/vitest.config.ts +12 -12
- package/.cursor/plans/unifier-flowresource-avec-flowderivation-c9506e24.plan.md +0 -372
- package/.cursor/plans/update-js-e795d61b.plan.md +0 -567
- package/dist/types/flow/base/flowDisposable.d.ts +0 -67
- package/dist/types/flow/base/flowDisposable.d.ts.map +0 -1
- package/dist/types/flow/base/flowEffect.d.ts +0 -127
- package/dist/types/flow/base/flowEffect.d.ts.map +0 -1
- package/dist/types/flow/base/flowGraph.d.ts +0 -97
- package/dist/types/flow/base/flowGraph.d.ts.map +0 -1
- package/dist/types/flow/base/flowSignal.d.ts +0 -134
- package/dist/types/flow/base/flowSignal.d.ts.map +0 -1
- package/dist/types/flow/base/flowTracker.d.ts +0 -15
- package/dist/types/flow/base/flowTracker.d.ts.map +0 -1
- package/dist/types/flow/base/index.d.ts +0 -7
- package/dist/types/flow/base/index.d.ts.map +0 -1
- package/dist/types/flow/base/utils.d.ts +0 -20
- package/dist/types/flow/base/utils.d.ts.map +0 -1
- package/dist/types/flow/collections/flowArray.d.ts +0 -148
- package/dist/types/flow/collections/flowArray.d.ts.map +0 -1
- package/dist/types/flow/collections/flowMap.d.ts +0 -224
- package/dist/types/flow/collections/flowMap.d.ts.map +0 -1
- package/dist/types/flow/collections/index.d.ts.map +0 -1
- package/dist/types/flow/index.d.ts +0 -4
- package/dist/types/flow/index.d.ts.map +0 -1
- package/dist/types/flow/nodes/async/flowConstantAsync.d.ts +0 -137
- package/dist/types/flow/nodes/async/flowConstantAsync.d.ts.map +0 -1
- package/dist/types/flow/nodes/async/flowDerivationAsync.d.ts +0 -137
- package/dist/types/flow/nodes/async/flowDerivationAsync.d.ts.map +0 -1
- package/dist/types/flow/nodes/async/flowNodeAsync.d.ts +0 -343
- package/dist/types/flow/nodes/async/flowNodeAsync.d.ts.map +0 -1
- package/dist/types/flow/nodes/async/flowReadonlyAsync.d.ts +0 -81
- package/dist/types/flow/nodes/async/flowReadonlyAsync.d.ts.map +0 -1
- package/dist/types/flow/nodes/async/flowStateAsync.d.ts +0 -111
- package/dist/types/flow/nodes/async/flowStateAsync.d.ts.map +0 -1
- package/dist/types/flow/nodes/async/index.d.ts.map +0 -1
- package/dist/types/flow/nodes/index.d.ts +0 -3
- package/dist/types/flow/nodes/index.d.ts.map +0 -1
- package/dist/types/flow/nodes/sync/flowConstant.d.ts +0 -108
- package/dist/types/flow/nodes/sync/flowConstant.d.ts.map +0 -1
- package/dist/types/flow/nodes/sync/flowDerivation.d.ts +0 -100
- package/dist/types/flow/nodes/sync/flowDerivation.d.ts.map +0 -1
- package/dist/types/flow/nodes/sync/flowNode.d.ts +0 -314
- package/dist/types/flow/nodes/sync/flowNode.d.ts.map +0 -1
- package/dist/types/flow/nodes/sync/flowReadonly.d.ts +0 -57
- package/dist/types/flow/nodes/sync/flowReadonly.d.ts.map +0 -1
- package/dist/types/flow/nodes/sync/flowState.d.ts +0 -96
- package/dist/types/flow/nodes/sync/flowState.d.ts.map +0 -1
- package/dist/types/flow/nodes/sync/index.d.ts.map +0 -1
- package/dist/types/solid/converters.d.ts +0 -57
- package/dist/types/solid/converters.d.ts.map +0 -1
- package/dist/types/solid/index.d.ts +0 -3
- package/dist/types/solid/index.d.ts.map +0 -1
- package/dist/types/solid/primitives.d.ts +0 -181
- package/dist/types/solid/primitives.d.ts.map +0 -1
- package/docs/api/classes/FlowArray.md +0 -489
- package/docs/api/classes/FlowConstant.md +0 -350
- package/docs/api/classes/FlowDerivation.md +0 -334
- package/docs/api/classes/FlowEffect.md +0 -100
- package/docs/api/classes/FlowMap.md +0 -512
- package/docs/api/classes/FlowObservable.md +0 -306
- package/docs/api/classes/FlowResource.md +0 -380
- package/docs/api/classes/FlowResourceAsync.md +0 -362
- package/docs/api/classes/FlowSignal.md +0 -160
- package/docs/api/classes/FlowState.md +0 -368
- package/docs/api/classes/FlowStream.md +0 -367
- package/docs/api/classes/FlowStreamAsync.md +0 -364
- package/docs/api/classes/SolidDerivation.md +0 -75
- package/docs/api/classes/SolidResource.md +0 -91
- package/docs/api/classes/SolidState.md +0 -71
- package/docs/api/classes/TrackingContext.md +0 -33
- package/docs/api/functions/effect.md +0 -49
- package/docs/api/functions/resource.md +0 -52
- package/docs/api/functions/resourceAsync.md +0 -50
- package/docs/api/functions/stream.md +0 -53
- package/docs/api/functions/streamAsync.md +0 -50
- package/docs/api/interfaces/SolidObservable.md +0 -19
- package/docs/api/type-aliases/FlowStreamDisposer.md +0 -15
- package/docs/api/type-aliases/FlowStreamSetter.md +0 -27
- package/docs/api/type-aliases/FlowStreamUpdater.md +0 -32
- package/docs/api/type-aliases/SolidGetter.md +0 -17
- package/docs/guide/primitives/resources.md +0 -858
- package/docs/guide/primitives/streams.md +0 -931
- package/src/flow/base/flowDisposable.ts +0 -71
- package/src/flow/base/flowEffect.ts +0 -171
- package/src/flow/base/flowGraph.ts +0 -288
- package/src/flow/base/flowSignal.ts +0 -207
- package/src/flow/base/flowTracker.ts +0 -17
- package/src/flow/base/index.ts +0 -6
- package/src/flow/base/utils.ts +0 -19
- package/src/flow/collections/flowArray.ts +0 -409
- package/src/flow/collections/flowMap.ts +0 -398
- package/src/flow/nodes/async/flowConstantAsync.ts +0 -142
- package/src/flow/nodes/async/flowDerivationAsync.ts +0 -143
- package/src/flow/nodes/async/flowNodeAsync.ts +0 -474
- package/src/flow/nodes/async/flowReadonlyAsync.ts +0 -81
- package/src/flow/nodes/async/flowStateAsync.ts +0 -116
- package/src/flow/nodes/await/advanced/index.ts +0 -5
- package/src/flow/nodes/await/advanced/resource.ts +0 -134
- package/src/flow/nodes/await/advanced/resourceAsync.ts +0 -109
- package/src/flow/nodes/await/advanced/stream.ts +0 -188
- package/src/flow/nodes/await/advanced/streamAsync.ts +0 -176
- package/src/flow/nodes/await/flowConstantAwait.ts +0 -154
- package/src/flow/nodes/await/flowDerivationAwait.ts +0 -154
- package/src/flow/nodes/await/flowNodeAwait.ts +0 -508
- package/src/flow/nodes/await/flowReadonlyAwait.ts +0 -89
- package/src/flow/nodes/await/flowStateAwait.ts +0 -130
- package/src/flow/nodes/await/index.ts +0 -5
- package/src/flow/nodes/index.ts +0 -3
- package/src/flow/nodes/sync/flowConstant.ts +0 -111
- package/src/flow/nodes/sync/flowDerivation.ts +0 -105
- package/src/flow/nodes/sync/flowNode.ts +0 -439
- package/src/flow/nodes/sync/flowReadonly.ts +0 -57
- package/src/flow/nodes/sync/flowState.ts +0 -101
- package/src/solid/converters.ts +0 -148
- package/src/solid/index.ts +0 -2
- package/src/solid/primitives.ts +0 -215
- package/test/base/flowEffect.test.ts +0 -108
- package/test/base/flowGraph.test.ts +0 -485
- package/test/base/flowSignal.test.ts +0 -372
- package/test/collections/flowArray.asyncStates.test.ts +0 -1553
- package/test/collections/flowArray.scalars.test.ts +0 -1129
- package/test/collections/flowArray.states.test.ts +0 -1365
- package/test/collections/flowMap.asyncStates.test.ts +0 -1105
- package/test/collections/flowMap.scalars.test.ts +0 -877
- package/test/collections/flowMap.states.test.ts +0 -1097
- package/test/nodes/async/flowConstantAsync.test.ts +0 -860
- package/test/nodes/async/flowDerivationAsync.test.ts +0 -1517
- package/test/nodes/async/flowStateAsync.test.ts +0 -1387
- package/test/nodes/await/advanced/resource.test.ts +0 -129
- package/test/nodes/await/advanced/resourceAsync.test.ts +0 -108
- package/test/nodes/await/advanced/stream.test.ts +0 -198
- package/test/nodes/await/advanced/streamAsync.test.ts +0 -196
- package/test/nodes/await/flowConstantAwait.test.ts +0 -643
- package/test/nodes/await/flowDerivationAwait.test.ts +0 -1583
- package/test/nodes/await/flowStateAwait.test.ts +0 -999
- package/test/nodes/mixed/derivation.test.ts +0 -1527
- package/test/nodes/sync/flowConstant.test.ts +0 -620
- package/test/nodes/sync/flowDerivation.test.ts +0 -1373
- package/test/nodes/sync/flowState.test.ts +0 -945
- package/test/solid/converters.test.ts +0 -721
- package/test/solid/primitives.test.ts +0 -1031
- /package/dist/types/{flow → api/nodes}/collections/index.d.ts +0 -0
- /package/docs/guide/advanced/{upgrading.md → migration-v1.md} +0 -0
- /package/src/{flow → api/nodes}/collections/index.ts +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract for resources that can be explicitly released to prevent memory leaks.
|
|
3
|
+
*
|
|
4
|
+
* All reactive primitives in PicoFlow implement this interface, allowing manual cleanup of subscriptions
|
|
5
|
+
* and dependencies. Once disposed, the resource cannot be reused and will throw errors on further access.
|
|
6
|
+
* Call `dispose()` when you no longer need a reactive primitive to free its resources.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface FlowDisposable {
|
|
11
|
+
/**
|
|
12
|
+
* Indicates whether this resource has been disposed.
|
|
13
|
+
*
|
|
14
|
+
* Returns `true` if `dispose()` has been called, `false` otherwise. Once disposed,
|
|
15
|
+
* the resource is no longer usable and any operations on it will throw errors.
|
|
16
|
+
*/
|
|
17
|
+
get disposed(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Releases all resources held by this disposable object.
|
|
20
|
+
*
|
|
21
|
+
* Cleans up all subscriptions, dependencies, and internal state. After calling this method,
|
|
22
|
+
* the resource enters a disposed state and cannot be reused. Any subsequent operations will
|
|
23
|
+
* throw errors. This method should be called when you no longer need the reactive primitive
|
|
24
|
+
* to prevent memory leaks.
|
|
25
|
+
*/
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Type guard to check if an object implements the FlowDisposable interface.
|
|
30
|
+
*
|
|
31
|
+
* Useful for conditionally disposing objects that may or may not be disposable,
|
|
32
|
+
* such as when cleaning up mixed collections of values. Returns true if the object
|
|
33
|
+
* has a `dispose` method, providing type-safe access to disposal functionality.
|
|
34
|
+
*
|
|
35
|
+
* @param obj - The object to check
|
|
36
|
+
* @returns True if the object implements FlowDisposable, false otherwise
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare function isDisposable(obj: unknown): obj is FlowDisposable;
|
|
41
|
+
//# sourceMappingURL=flowDisposable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowDisposable.d.ts","sourceRoot":"","sources":["../../../../src/api/base/flowDisposable.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,OAAO,CAAC;IAExB;;;;;;;OAOG;IACH,OAAO,IAAI,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc,CAEhE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FlowDisposable } from './flowDisposable';
|
|
2
|
+
import { FlowSubscribable } from './flowSubscribable';
|
|
3
|
+
import { FlowTracker } from './flowTracker';
|
|
4
|
+
/**
|
|
5
|
+
* Contract for reactive primitives that emit changes and notify their dependents in the reactivity graph.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface FlowObservable<T> extends FlowDisposable, FlowSubscribable<T> {
|
|
9
|
+
/**
|
|
10
|
+
* Establishes a reactive dependency without reading the value.
|
|
11
|
+
*
|
|
12
|
+
* Registers this observable as a dependency of the given tracker, allowing it to be notified
|
|
13
|
+
* when changes occur. This enables dependency tracking without accessing the actual value.
|
|
14
|
+
*
|
|
15
|
+
* @param tracker - Tracker that records this observable as a dependency
|
|
16
|
+
*/
|
|
17
|
+
watch(tracker: FlowTracker): void;
|
|
18
|
+
/**
|
|
19
|
+
* Manually triggers notifications to all dependents.
|
|
20
|
+
*
|
|
21
|
+
* Forces all dependents of this observable to be notified and re-executed, even if the
|
|
22
|
+
* value hasn't actually changed. Useful for imperatively triggering updates when the
|
|
23
|
+
* reactive system cannot detect changes automatically.
|
|
24
|
+
*/
|
|
25
|
+
trigger(): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=flowObservable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowObservable.d.ts","sourceRoot":"","sources":["../../../../src/api/base/flowObservable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAC1E;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAElC;;;;;;OAMG;IACH,OAAO,IAAI,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { FlowEffect } from '../nodes';
|
|
2
|
+
import { FlowTracker } from './flowTracker';
|
|
3
|
+
/**
|
|
4
|
+
* Function that tracks reactive dependencies and returns data.
|
|
5
|
+
*
|
|
6
|
+
* This function is called during effect execution with a tracker parameter that automatically
|
|
7
|
+
* records any reactive values accessed. The tracker enables automatic dependency tracking without
|
|
8
|
+
* explicit subscriptions. The returned data is passed to the `onData` callback.
|
|
9
|
+
*
|
|
10
|
+
* @param t - Tracker object that records dependencies when reactive values are accessed
|
|
11
|
+
* @returns The computed data of type T
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export type FlowDataTracker<T> = (t: FlowTracker) => T;
|
|
16
|
+
/**
|
|
17
|
+
* Callback invoked when new data is available.
|
|
18
|
+
*
|
|
19
|
+
* This callback runs each time the effect executes successfully, receiving the data returned
|
|
20
|
+
* by the tracker function. It's called immediately on effect creation and then on every reactive
|
|
21
|
+
* re-execution. Use this callback to perform side effects with the computed data.
|
|
22
|
+
*
|
|
23
|
+
* @param data - The computed data from the tracker function
|
|
24
|
+
* @returns Always returns undefined (callbacks are for side effects)
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export type FlowOnDataListener<T> = (data: T) => undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Callback invoked when an error occurs during effect execution.
|
|
31
|
+
*
|
|
32
|
+
* If provided, this callback handles any errors thrown by the tracker function (except PendingError).
|
|
33
|
+
* Without this callback, errors propagate and may crash the application. Use this for error logging,
|
|
34
|
+
* recovery, or user feedback. The effect remains active and will retry on the next reactive trigger.
|
|
35
|
+
*
|
|
36
|
+
* @param error - The error that occurred, always normalized to an Error instance
|
|
37
|
+
* @returns Always returns undefined (callbacks are for side effects)
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export type FlowOnErrorListener = (error: Error) => undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Callback invoked when an async computation is pending.
|
|
44
|
+
*
|
|
45
|
+
* This callback is triggered when the tracker function throws a PendingError, indicating that
|
|
46
|
+
* async dependencies are still resolving. Use this to show loading states or pending indicators.
|
|
47
|
+
* The effect will automatically re-execute once the async values settle.
|
|
48
|
+
*
|
|
49
|
+
* @returns Always returns undefined (callbacks are for side effects)
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export type FlowOnPendingListener = () => undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Contract for observables that can be subscribed to with lifecycle callbacks.
|
|
56
|
+
*
|
|
57
|
+
* This interface enables imperative subscription to reactive values, allowing manual control over
|
|
58
|
+
* when effects run. The subscribe method returns a disposal function to stop the subscription.
|
|
59
|
+
* Useful for integrating with non-reactive code or frameworks that manage subscriptions differently.
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
export interface FlowSubscribable<T> {
|
|
64
|
+
/**
|
|
65
|
+
* Subscribes to this observable with lifecycle callbacks.
|
|
66
|
+
*
|
|
67
|
+
* Creates an active subscription that executes immediately and then re-executes whenever
|
|
68
|
+
* the observable's dependencies change. The subscription remains active until the returned
|
|
69
|
+
* disposal function is called. The `onData` callback receives the computed value, while
|
|
70
|
+
* `onError` handles errors and `onPending` signals async operations in progress.
|
|
71
|
+
*
|
|
72
|
+
* @param onData - Callback invoked with the computed data on each execution
|
|
73
|
+
* @param onError - Optional callback for handling errors during execution
|
|
74
|
+
* @param onPending - Optional callback invoked when async dependencies are pending
|
|
75
|
+
* @returns A function to dispose the subscription and stop receiving updates
|
|
76
|
+
*/
|
|
77
|
+
subscribe(onData: FlowOnDataListener<T>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener): FlowEffect;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=flowSubscribable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowSubscribable.d.ts","sourceRoot":"","sources":["../../../../src/api/base/flowSubscribable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,KAAK,CAAC,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,SAAS,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAC/B;;;;;;;;;;;;OAYG;IACH,SAAS,CACL,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC7B,OAAO,CAAC,EAAE,mBAAmB,EAC7B,SAAS,CAAC,EAAE,qBAAqB,GAClC,UAAU,CAAC;CACjB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FlowDisposable } from './flowDisposable';
|
|
2
|
+
/**
|
|
3
|
+
* Contract for reactive computations that track dependencies and react to changes in the reactivity graph.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface FlowTracker extends FlowDisposable {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=flowTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowTracker.d.ts","sourceRoot":"","sources":["../../../../src/api/base/flowTracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,cAAc;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/base/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FlowValue } from '../flowValue';
|
|
2
|
+
/** Function that initializes a value asynchronously. */
|
|
3
|
+
export type InitFunctionAsync<T> = () => Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* Read-only reactive value that resolves once from a promise or async initializer.
|
|
6
|
+
*
|
|
7
|
+
* Async constants provide lazy initialization for asynchronous values. The promise or async initializer
|
|
8
|
+
* runs once on first access, and the resolved value is cached forever. While pending, accessing the value
|
|
9
|
+
* throws PendingError. Use for async operations that only need to run once, such as loading remote configuration,
|
|
10
|
+
* fetching initial data, or computing expensive async resources.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface FlowConstantAsync<T> extends FlowValue<T> {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a constant reactive value from a promise or async initializer that resolves once and never recomputes.
|
|
18
|
+
*
|
|
19
|
+
* The promise or async initializer executes once on first access, and the resolved value is cached permanently.
|
|
20
|
+
* While the promise is pending, any reactive computation that accesses the value will receive PendingError and
|
|
21
|
+
* automatically retry once the promise resolves. Use for one-time async operations that don't depend on other
|
|
22
|
+
* reactive values, such as loading configuration or fetching initial data.
|
|
23
|
+
*
|
|
24
|
+
* @param value - Promise to resolve, or async function that returns a promise on first access
|
|
25
|
+
* @returns A FlowConstantAsync that provides read-only access to the resolved value
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowConstantAsync.d.ts","sourceRoot":"","sources":["../../../../../src/api/nodes/async/flowConstantAsync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,wDAAwD;AACxD,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;CAAG;AAE7D;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAC1E,wBAAgB,aAAa,CAAC,CAAC,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FlowTracker } from '../../../../api/base';
|
|
2
|
+
import { FlowValue } from '../flowValue';
|
|
3
|
+
import { NotPromise } from '../utils';
|
|
4
|
+
/** Function that derives a value asynchronously from dependencies and optionally the previous value. */
|
|
5
|
+
export type DerivationFunctionAsync<T> = (tracker: FlowTracker, previous?: NotPromise<T> | undefined) => Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Read-only reactive value that recomputes asynchronously when dependencies change.
|
|
8
|
+
*
|
|
9
|
+
* Async derivations track reactive values accessed during computation and automatically recompute when any
|
|
10
|
+
* tracked dependency changes. The compute function returns a promise, and the resolved value is cached until
|
|
11
|
+
* dependencies change. While recomputing, accessing the value throws PendingError. Use for values derived from
|
|
12
|
+
* async operations like API calls, database queries, or any computation that depends on reactive state and
|
|
13
|
+
* requires async work.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface FlowDerivationAsync<T> extends FlowValue<T> {
|
|
18
|
+
/**
|
|
19
|
+
* Forces the derivation to recompute even if dependencies haven't changed.
|
|
20
|
+
*/
|
|
21
|
+
refresh(): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates an async derived value that automatically recomputes when dependencies change.
|
|
25
|
+
*
|
|
26
|
+
* The async compute function tracks dependencies and returns a promise. When any tracked dependency changes,
|
|
27
|
+
* the function runs again and returns a new promise. The resolved value is cached until the next change.
|
|
28
|
+
* While the promise is pending, reactive computations that access this value receive PendingError and automatically
|
|
29
|
+
* retry once resolved. Use for derived data from async sources like filtered API results or computed database queries.
|
|
30
|
+
*
|
|
31
|
+
* @param compute - Async function that accesses dependencies and returns a promise of the derived value
|
|
32
|
+
* @returns A FlowDerivationAsync that provides read-only access to the resolved computed value
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export declare function derivationAsync<T>(compute: DerivationFunctionAsync<T>): FlowDerivationAsync<T>;
|
|
37
|
+
//# sourceMappingURL=flowDerivationAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowDerivationAsync.d.ts","sourceRoot":"","sources":["../../../../../src/api/nodes/async/flowDerivationAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,wGAAwG;AACxG,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAEpH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IACxD;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAE9F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FlowValue } from '../flowValue';
|
|
2
|
+
import { NotPromise } from '../utils';
|
|
3
|
+
import { InitFunctionAsync } from './flowConstantAsync';
|
|
4
|
+
/** Function that updates a value asynchronously based on the previous value. */
|
|
5
|
+
export type UpdateFunctionAsync<T> = (previous: NotPromise<T> | undefined) => Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Writable reactive value that resolves promises and can be updated with new promises.
|
|
8
|
+
*
|
|
9
|
+
* Async state is the async equivalent of regular state. Unlike sync state, it accepts promises instead of
|
|
10
|
+
* direct values. Set new promises or async updater functions to update the state. While a promise is pending,
|
|
11
|
+
* accessing the value throws PendingError. Use for async data that changes imperatively, such as user-triggered
|
|
12
|
+
* API calls, async form submissions, or any async operation that updates based on user actions.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export interface FlowStateAsync<T> extends FlowValue<T> {
|
|
17
|
+
/**
|
|
18
|
+
* Updates the state with a new promise or via an async updater function.
|
|
19
|
+
* Notifies all dependents immediately (they will receive PendingError until resolved).
|
|
20
|
+
*
|
|
21
|
+
* @param promise - New promise to resolve, or async function that receives current value and returns a promise
|
|
22
|
+
*/
|
|
23
|
+
set(promise: Promise<T>): void;
|
|
24
|
+
set(updater: UpdateFunctionAsync<T>): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a mutable async reactive state that resolves promises and can be updated imperatively.
|
|
28
|
+
*
|
|
29
|
+
* State can be initialized with a direct promise or a lazy async initializer function. Update the state by
|
|
30
|
+
* calling `set()` with a new promise or an async updater function. Changes propagate automatically to all
|
|
31
|
+
* reactive computations that depend on this state. Use for async data that changes through user actions or
|
|
32
|
+
* application logic, such as loading user profiles, fetching search results, or any async state updates.
|
|
33
|
+
*
|
|
34
|
+
* @param value - Initial promise to resolve, or lazy async initializer function
|
|
35
|
+
* @returns A FlowStateAsync that can be read and modified with promises
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowStateAsync.d.ts","sourceRoot":"","sources":["../../../../../src/api/nodes/async/flowStateAsync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAEzF;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IACnD;;;;;OAKG;IACH,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC/B,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;AACpE,wBAAgB,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DerivationFunctionAsync, FlowDerivationAsync } from './flowDerivationAsync';
|
|
2
|
+
import { FlowStateAsync } from './flowStateAsync';
|
|
3
|
+
/**
|
|
4
|
+
* Writable reactive value that recomputes asynchronously when dependencies change, but can be manually overridden.
|
|
5
|
+
*
|
|
6
|
+
* Async writable derivations combine reactive async computation with manual control. They track dependencies and
|
|
7
|
+
* recompute asynchronously like regular async derivations, but you can also call `set()` to override the computed
|
|
8
|
+
* value with a new promise. While recomputing or pending, accessing the value throws PendingError. Use for computed
|
|
9
|
+
* async values that users can edit, such as formatted async fields, calculated async totals that can be adjusted,
|
|
10
|
+
* or any async value that is usually derived but sometimes needs manual correction.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface FlowWritableDerivationAsync<T> extends FlowStateAsync<T>, FlowDerivationAsync<T> {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates an async derived value that recomputes automatically but can also be manually overridden.
|
|
18
|
+
*
|
|
19
|
+
* The async compute function tracks dependencies and returns a promise. When any tracked dependency changes,
|
|
20
|
+
* the function runs again and returns a new promise. However, you can also call `set()` to override the computed
|
|
21
|
+
* value with a new promise. Use for async values that are normally derived but need occasional manual adjustments,
|
|
22
|
+
* such as editable async calculated fields or user-correctable async totals.
|
|
23
|
+
*
|
|
24
|
+
* @param compute - Async function that accesses dependencies and returns a promise of the derived value
|
|
25
|
+
* @returns A FlowWritableDerivationAsync that provides both reactive async computation and manual control
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare function writableDerivationAsync<T>(compute: DerivationFunctionAsync<T>): FlowWritableDerivationAsync<T>;
|
|
30
|
+
//# sourceMappingURL=flowWritableDerivationAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowWritableDerivationAsync.d.ts","sourceRoot":"","sources":["../../../../../src/api/nodes/async/flowWritableDerivationAsync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,2BAA2B,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;CAAG;AAEpG;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,2BAA2B,CAAC,CAAC,CAAC,CAE9G"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from './flowConstantAsync';
|
|
2
2
|
export * from './flowDerivationAsync';
|
|
3
|
-
export * from './flowNodeAsync';
|
|
4
|
-
export * from './flowReadonlyAsync';
|
|
5
3
|
export * from './flowStateAsync';
|
|
4
|
+
export * from './flowWritableDerivationAsync';
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/nodes/async/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { FlowState } from '../sync/flowState';
|
|
2
|
+
/**
|
|
3
|
+
* Discriminated union representing all possible array mutation operations.
|
|
4
|
+
*
|
|
5
|
+
* Each mutation on a FlowArray emits an action describing what changed. This enables fine-grained
|
|
6
|
+
* reactive tracking - you can observe the array itself or subscribe to `$lastAction` to react only
|
|
7
|
+
* to specific mutations. Use this for optimized rendering, undo/redo systems, or any scenario where
|
|
8
|
+
* you need to know exactly what changed rather than just that something changed.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export type FlowArrayAction<T> = {
|
|
13
|
+
type: "set";
|
|
14
|
+
setItems: T[];
|
|
15
|
+
clearedItems: T[];
|
|
16
|
+
} | {
|
|
17
|
+
type: "update";
|
|
18
|
+
index: number;
|
|
19
|
+
setItem: T;
|
|
20
|
+
clearedItem: T | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
type: "push";
|
|
23
|
+
addedItem: T;
|
|
24
|
+
} | {
|
|
25
|
+
type: "pop";
|
|
26
|
+
removedItem: T | undefined;
|
|
27
|
+
} | {
|
|
28
|
+
type: "unshift";
|
|
29
|
+
addedItem: T;
|
|
30
|
+
} | {
|
|
31
|
+
type: "shift";
|
|
32
|
+
removedItem: T | undefined;
|
|
33
|
+
} | {
|
|
34
|
+
type: "splice";
|
|
35
|
+
start: number;
|
|
36
|
+
deleteCount: number;
|
|
37
|
+
addedItems: T[];
|
|
38
|
+
removedItems: T[];
|
|
39
|
+
} | {
|
|
40
|
+
type: "clear";
|
|
41
|
+
clearedItems: T[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Reactive array with standard mutation methods and fine-grained change tracking.
|
|
45
|
+
*
|
|
46
|
+
* FlowArray behaves like a regular array but notifies dependents on mutations. It provides all standard
|
|
47
|
+
* array mutation methods (push, pop, splice, etc.) and tracks each operation via the `$lastAction` signal.
|
|
48
|
+
* This enables both coarse-grained reactivity (reacting to any change) and fine-grained reactivity (reacting
|
|
49
|
+
* only to specific mutations). Use for lists that need reactive updates, such as todo lists, data tables,
|
|
50
|
+
* or any collection that changes over time.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export interface FlowArray<T> extends FlowState<T[]> {
|
|
55
|
+
/**
|
|
56
|
+
* Replaces an item at a specific index.
|
|
57
|
+
* Emits an "update" action to $lastAction.
|
|
58
|
+
*
|
|
59
|
+
* @param index - The index of the item to replace
|
|
60
|
+
* @param item - The new item
|
|
61
|
+
* @returns The previous item at that index
|
|
62
|
+
*/
|
|
63
|
+
update(index: number, item: T): T | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Appends an item to the end of the array.
|
|
66
|
+
* Emits a "push" action to $lastAction.
|
|
67
|
+
*
|
|
68
|
+
* @param item - The item to append
|
|
69
|
+
*/
|
|
70
|
+
push(item: T): void;
|
|
71
|
+
/**
|
|
72
|
+
* Removes and returns the last item from the array.
|
|
73
|
+
* Emits a "pop" action to $lastAction.
|
|
74
|
+
*
|
|
75
|
+
* @returns The removed item, or undefined if the array was empty
|
|
76
|
+
*/
|
|
77
|
+
pop(): T | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Inserts an item at the beginning of the array.
|
|
80
|
+
* Emits an "unshift" action to $lastAction.
|
|
81
|
+
*
|
|
82
|
+
* @param item - The item to insert
|
|
83
|
+
*/
|
|
84
|
+
unshift(item: T): void;
|
|
85
|
+
/**
|
|
86
|
+
* Removes and returns the first item from the array.
|
|
87
|
+
* Emits a "shift" action to $lastAction.
|
|
88
|
+
*
|
|
89
|
+
* @returns The removed item, or undefined if the array was empty
|
|
90
|
+
*/
|
|
91
|
+
shift(): T | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Changes the content of the array by removing, replacing, or adding items.
|
|
94
|
+
* Emits a "splice" action to $lastAction.
|
|
95
|
+
*
|
|
96
|
+
* @param start - The starting index
|
|
97
|
+
* @param deleteCount - Number of items to remove
|
|
98
|
+
* @param newItems - New items to add at the start position
|
|
99
|
+
* @returns Array of removed items
|
|
100
|
+
*/
|
|
101
|
+
splice(start: number, deleteCount: number, ...newItems: T[]): T[];
|
|
102
|
+
/**
|
|
103
|
+
* Removes all items from the array.
|
|
104
|
+
* Emits a "clear" action to $lastAction.
|
|
105
|
+
*
|
|
106
|
+
* @returns Array of all removed items
|
|
107
|
+
*/
|
|
108
|
+
clear(): T[];
|
|
109
|
+
/**
|
|
110
|
+
* The current length of the array.
|
|
111
|
+
*/
|
|
112
|
+
length: number;
|
|
113
|
+
/**
|
|
114
|
+
* Reactive state containing the last mutation operation performed on the array.
|
|
115
|
+
* Subscribe to this for fine-grained reactivity to specific mutation types.
|
|
116
|
+
*/
|
|
117
|
+
$lastAction: FlowState<FlowArrayAction<T>>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Creates a reactive array with mutation methods and fine-grained action tracking.
|
|
121
|
+
*
|
|
122
|
+
* The array starts with the provided initial items (or empty if none provided). All mutation methods
|
|
123
|
+
* (push, pop, splice, etc.) notify dependents and emit detailed action information to `$lastAction`.
|
|
124
|
+
* Use the array itself for coarse-grained reactivity, or subscribe to `$lastAction` for fine-grained
|
|
125
|
+
* reactivity to specific mutation types. Useful for reactive lists, collections, or any data that
|
|
126
|
+
* needs array-like operations with automatic change propagation.
|
|
127
|
+
*
|
|
128
|
+
* @param initial - Optional initial array of items
|
|
129
|
+
* @returns A FlowArray with reactive mutation methods
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
export declare function array<T>(initial?: T[]): FlowArray<T>;
|
|
134
|
+
//# sourceMappingURL=flowArray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowArray.d.ts","sourceRoot":"","sources":["../../../../../src/api/nodes/collections/flowArray.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IACvB;IACI,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,YAAY,EAAE,CAAC,EAAE,CAAC;CACrB,GACD;IACI,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;IACX,WAAW,EAAE,CAAC,GAAG,SAAS,CAAC;CAC9B,GACD;IACI,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,CAAC,CAAC;CAChB,GACD;IACI,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,EAAE,CAAC,GAAG,SAAS,CAAC;CAC9B,GACD;IACI,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,CAAC,CAAC;CAChB,GACD;IACI,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,CAAC,GAAG,SAAS,CAAC;CAC9B,GACD;IACI,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,CAAC,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC,EAAE,CAAC;CACrB,GACD;IACI,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,EAAE,CAAC;CACrB,CAAC;AAER;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,EAAE,CAAC;IAChD;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAE9C;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAEpB;;;;;OAKG;IACH,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAErB;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAEvB;;;;;OAKG;IACH,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAEvB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IAElE;;;;;OAKG;IACH,KAAK,IAAI,CAAC,EAAE,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAEpD"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { FlowState } from '../sync/flowState';
|
|
2
|
+
/**
|
|
3
|
+
* Discriminated union representing all possible map mutation operations.
|
|
4
|
+
*
|
|
5
|
+
* Each mutation on a FlowMap emits an action describing what changed. This enables fine-grained
|
|
6
|
+
* reactive tracking - you can observe the map itself or subscribe to `$lastAction` to react only
|
|
7
|
+
* to specific mutations. Use this for optimized updates, undo/redo systems, or any scenario where
|
|
8
|
+
* you need to know exactly what changed rather than just that something changed.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export type FlowMapAction<K, V> = {
|
|
13
|
+
type: "set";
|
|
14
|
+
setMap: Map<K, V>;
|
|
15
|
+
clearedMap: Map<K, V>;
|
|
16
|
+
} | {
|
|
17
|
+
type: "add";
|
|
18
|
+
key: K;
|
|
19
|
+
addedValue: V;
|
|
20
|
+
} | {
|
|
21
|
+
type: "update";
|
|
22
|
+
key: K;
|
|
23
|
+
setValue: V;
|
|
24
|
+
clearedValue: V;
|
|
25
|
+
} | {
|
|
26
|
+
type: "delete";
|
|
27
|
+
key: K;
|
|
28
|
+
removedValue: V;
|
|
29
|
+
} | {
|
|
30
|
+
type: "clear";
|
|
31
|
+
clearedMap: Map<K, V>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Reactive map with standard mutation methods and fine-grained change tracking.
|
|
35
|
+
*
|
|
36
|
+
* FlowMap behaves like a regular Map but notifies dependents on mutations. It provides standard
|
|
37
|
+
* map operations (add, update, delete) and tracks each operation via the `$lastAction` signal.
|
|
38
|
+
* This enables both coarse-grained reactivity (reacting to any change) and fine-grained reactivity
|
|
39
|
+
* (reacting only to specific mutations). Use for key-value collections that need reactive updates,
|
|
40
|
+
* such as entity stores, lookup tables, or any map-based data that changes over time.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export interface FlowMap<K, V> extends FlowState<Map<K, V>> {
|
|
45
|
+
/**
|
|
46
|
+
* Removes a key-value pair from the map.
|
|
47
|
+
* Emits a "delete" action to $lastAction.
|
|
48
|
+
*
|
|
49
|
+
* @param key - The key to delete
|
|
50
|
+
* @returns The deleted value
|
|
51
|
+
*/
|
|
52
|
+
delete(key: K): V;
|
|
53
|
+
/**
|
|
54
|
+
* Updates an existing key-value pair in the map.
|
|
55
|
+
* Emits an "update" action to $lastAction.
|
|
56
|
+
*
|
|
57
|
+
* @param key - The key to update (must exist)
|
|
58
|
+
* @param value - The new value
|
|
59
|
+
* @returns The previous value
|
|
60
|
+
*/
|
|
61
|
+
update(key: K, value: V): V | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a new key-value pair to the map.
|
|
64
|
+
* Emits an "add" action to $lastAction.
|
|
65
|
+
*
|
|
66
|
+
* @param key - The key to add (must not exist)
|
|
67
|
+
* @param value - The value to associate with the key
|
|
68
|
+
*/
|
|
69
|
+
add(key: K, value: V): void;
|
|
70
|
+
/**
|
|
71
|
+
* Removes all entries from the map.
|
|
72
|
+
* Emits a "clear" action to $lastAction.
|
|
73
|
+
*
|
|
74
|
+
* @returns Map of all removed entries
|
|
75
|
+
*/
|
|
76
|
+
clear(): Map<K, V>;
|
|
77
|
+
/**
|
|
78
|
+
* Reactive state containing the last mutation operation performed on the map.
|
|
79
|
+
* Subscribe to this for fine-grained reactivity to specific mutation types.
|
|
80
|
+
*/
|
|
81
|
+
$lastAction: FlowState<FlowMapAction<K, V>>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates a reactive map with mutation methods and fine-grained action tracking.
|
|
85
|
+
*
|
|
86
|
+
* The map starts with the provided initial entries (or empty if none provided). All mutation methods
|
|
87
|
+
* (add, update, delete) notify dependents and emit detailed action information to `$lastAction`.
|
|
88
|
+
* Use the map itself for coarse-grained reactivity, or subscribe to `$lastAction` for fine-grained
|
|
89
|
+
* reactivity to specific mutation types. Useful for entity stores, lookup tables, or any key-value
|
|
90
|
+
* data that needs reactive updates.
|
|
91
|
+
*
|
|
92
|
+
* @param initial - Optional initial entries as a Record or Map
|
|
93
|
+
* @returns A FlowMap with reactive mutation methods
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export declare function map<K extends string | number | symbol, V>(initial?: Record<K, V> | Map<K, V>): FlowMap<K, V>;
|
|
98
|
+
//# sourceMappingURL=flowMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowMap.d.ts","sourceRoot":"","sources":["../../../../../src/api/nodes/collections/flowMap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,IACxB;IACI,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClB,UAAU,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACzB,GACD;IACI,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,CAAC,CAAC;IACP,UAAU,EAAE,CAAC,CAAC;CACjB,GACD;IACI,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,CAAC,CAAC;IACP,QAAQ,EAAE,CAAC,CAAC;IACZ,YAAY,EAAE,CAAC,CAAC;CACnB,GACD;IACI,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,CAAC,CAAC;IACP,YAAY,EAAE,CAAC,CAAC;CACnB,GACD;IACI,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACzB,CAAC;AAER;;;;;;;;;;GAUG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IAElB;;;;;;;OAOG;IACH,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAExC;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAE5B;;;;;OAKG;IACH,KAAK,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEnB;;;OAGG;IACH,WAAW,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAC/C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAK5G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/nodes/collections/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FlowDataTracker, FlowDisposable, FlowOnDataListener, FlowOnErrorListener, FlowOnPendingListener } from '../../../api/base';
|
|
2
|
+
/**
|
|
3
|
+
* Handle to a reactive effect that automatically tracks dependencies and re-executes when they change.
|
|
4
|
+
*
|
|
5
|
+
* Effects run immediately upon creation and then reactively respond to changes in any reactive values
|
|
6
|
+
* accessed during execution. Call `dispose()` to stop the effect and clean up its subscriptions.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface FlowEffect extends FlowDisposable {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a reactive effect that runs immediately and automatically re-runs when dependencies change.
|
|
14
|
+
*
|
|
15
|
+
* The effect function tracks any reactive values accessed and subscribes to their changes.
|
|
16
|
+
* When any tracked value changes, the effect re-executes with the new values.
|
|
17
|
+
* Optional callbacks handle errors and pending async states.
|
|
18
|
+
*
|
|
19
|
+
* @param data - Function that accesses reactive dependencies and returns data
|
|
20
|
+
* @param onData - Callback invoked with the computed data on each execution
|
|
21
|
+
* @param onError - Optional callback for handling errors during execution
|
|
22
|
+
* @param onPending - Optional callback invoked when async dependencies are pending
|
|
23
|
+
* @returns A FlowEffect handle with a `dispose()` method to stop the effect
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare function subscribe<T>(data: FlowDataTracker<T>, onData: FlowOnDataListener<T>, onError?: FlowOnErrorListener, onPending?: FlowOnPendingListener): FlowEffect;
|
|
28
|
+
//# sourceMappingURL=flowEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowEffect.d.ts","sourceRoot":"","sources":["../../../../src/api/nodes/flowEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACxB,MAAM,YAAY,CAAC;AAGpB;;;;;;;GAOG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;CAAG;AAErD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACvB,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EACxB,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAC7B,OAAO,CAAC,EAAE,mBAAmB,EAC7B,SAAS,CAAC,EAAE,qBAAqB,GAClC,UAAU,CAEZ"}
|