@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
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A **signal** is a reactive primitive that represents an event or notification. Unlike state or derivations, signals don't hold values - they simply notify watchers that something has happened.
|
|
4
4
|
|
|
5
|
-
Imagine a refresh button on a web page. When clicked, it doesn't need to pass data - it just needs to tell the system "hey, refresh now!" That's exactly what signals do.
|
|
6
|
-
|
|
7
|
-
### Key Characteristics
|
|
8
|
-
|
|
9
|
-
- **No value**: Signals don't store or return data
|
|
10
|
-
- **Pure notification**: They exist solely to trigger reactions
|
|
11
|
-
- **Lightweight**: Perfect for events that don't need to carry information
|
|
12
|
-
- **Explicit tracking**: Use `.watch(t)` to track them in effects
|
|
13
|
-
|
|
14
5
|
## When to Use Signals
|
|
15
6
|
|
|
16
7
|
Use signals when you need to:
|
|
@@ -23,8 +14,6 @@ Use signals when you need to:
|
|
|
23
14
|
Don't use signals when:
|
|
24
15
|
|
|
25
16
|
- ❌ You need to pass data (use state instead)
|
|
26
|
-
- ❌ You're tracking continuous streams of events (use streams instead)
|
|
27
|
-
- ❌ The value itself matters (use state or derivation)
|
|
28
17
|
|
|
29
18
|
## Creating Signals
|
|
30
19
|
|
|
@@ -44,38 +33,38 @@ Signals don't take any parameters since they don't hold values.
|
|
|
44
33
|
|
|
45
34
|
Signals have three main operations: watching, triggering, and disposing.
|
|
46
35
|
|
|
47
|
-
###
|
|
36
|
+
### Watch
|
|
48
37
|
|
|
49
|
-
Inside
|
|
38
|
+
Inside a subscription or derivation, use `.watch(t)` to track a signal:
|
|
50
39
|
|
|
51
40
|
```typescript
|
|
52
|
-
import { signal,
|
|
41
|
+
import { signal, subscribe } from '@ersbeth/picoflow'
|
|
53
42
|
|
|
54
43
|
const $refresh = signal()
|
|
55
44
|
|
|
56
|
-
|
|
57
|
-
$refresh.watch(t)
|
|
58
|
-
console.log('Refresh triggered!')
|
|
59
|
-
|
|
45
|
+
subscribe(
|
|
46
|
+
(t) => { $refresh.watch(t) },
|
|
47
|
+
() => { console.log('Refresh triggered!') }
|
|
48
|
+
)
|
|
60
49
|
|
|
61
50
|
$refresh.trigger() // Logs: "Refresh triggered!"
|
|
62
51
|
$refresh.trigger() // Logs: "Refresh triggered!" again
|
|
63
52
|
```
|
|
64
53
|
|
|
65
|
-
Every time the signal is triggered, the
|
|
54
|
+
Every time the signal is triggered, the subscription re-executes.
|
|
66
55
|
|
|
67
|
-
###
|
|
56
|
+
### Trigger
|
|
68
57
|
|
|
69
58
|
Call `.trigger()` to notify all watchers:
|
|
70
59
|
|
|
71
60
|
```typescript
|
|
72
61
|
const $notification = signal()
|
|
73
62
|
|
|
74
|
-
// Setup
|
|
75
|
-
|
|
76
|
-
$notification.watch(t)
|
|
77
|
-
showNotification('New activity!')
|
|
78
|
-
|
|
63
|
+
// Setup a subscription that watches the signal
|
|
64
|
+
subscribe(
|
|
65
|
+
(t) => { $notification.watch(t) },
|
|
66
|
+
() => { showNotification('New activity!') }
|
|
67
|
+
)
|
|
79
68
|
|
|
80
69
|
// Trigger from anywhere
|
|
81
70
|
function onNewMessage() {
|
|
@@ -87,7 +76,7 @@ function onNewLike() {
|
|
|
87
76
|
}
|
|
88
77
|
```
|
|
89
78
|
|
|
90
|
-
###
|
|
79
|
+
### Dispose
|
|
91
80
|
|
|
92
81
|
Signals can be disposed to free resources and prevent memory leaks:
|
|
93
82
|
|
|
@@ -95,10 +84,10 @@ Signals can be disposed to free resources and prevent memory leaks:
|
|
|
95
84
|
const $mySignal = signal()
|
|
96
85
|
|
|
97
86
|
// Use the signal
|
|
98
|
-
|
|
99
|
-
$mySignal.watch(t)
|
|
100
|
-
console.log('Signal triggered!')
|
|
101
|
-
|
|
87
|
+
subscribe(
|
|
88
|
+
(t) => { $mySignal.watch(t) },
|
|
89
|
+
() => { console.log('Signal triggered!') }
|
|
90
|
+
)
|
|
102
91
|
|
|
103
92
|
// Later, clean up
|
|
104
93
|
$mySignal.dispose()
|
|
@@ -109,41 +98,41 @@ $mySignal.trigger() // Error: Primitive is disposed
|
|
|
109
98
|
|
|
110
99
|
## Lifecyle
|
|
111
100
|
|
|
112
|
-
When you create
|
|
101
|
+
When you create a subscription that watches a signal:
|
|
113
102
|
|
|
114
|
-
1. **Registration**: The signal registers the
|
|
103
|
+
1. **Registration**: The signal registers the subscription as a watcher
|
|
115
104
|
2. **Waiting**: The signal waits for `.trigger()` to be called
|
|
116
|
-
3. **Notification**: When triggered, all watching
|
|
117
|
-
4. **Re-execution**: Each watching
|
|
105
|
+
3. **Notification**: When triggered, all watching subscriptions are scheduled to run
|
|
106
|
+
4. **Re-execution**: Each watching subscription re-executes its function
|
|
118
107
|
|
|
119
108
|
```mermaid
|
|
120
109
|
sequenceDiagram
|
|
121
110
|
participant User
|
|
122
111
|
participant Signal as $refresh (Signal)
|
|
123
|
-
participant
|
|
112
|
+
participant Subscription
|
|
124
113
|
|
|
125
|
-
Note over User,
|
|
126
|
-
User->>
|
|
127
|
-
activate
|
|
128
|
-
|
|
129
|
-
Note over Signal: Register
|
|
130
|
-
Signal-->>
|
|
131
|
-
|
|
132
|
-
Note over
|
|
133
|
-
deactivate
|
|
114
|
+
Note over User,Subscription: 1. Setup Phase
|
|
115
|
+
User->>Subscription: Create subscription
|
|
116
|
+
activate Subscription
|
|
117
|
+
Subscription->>Signal: watch(t)
|
|
118
|
+
Note over Signal: Register Subscription as watcher
|
|
119
|
+
Signal-->>Subscription: Registered
|
|
120
|
+
Subscription->>Subscription: Execute function
|
|
121
|
+
Note over Subscription: Log: "Ready to refresh"
|
|
122
|
+
deactivate Subscription
|
|
134
123
|
|
|
135
|
-
Note over User,
|
|
124
|
+
Note over User,Subscription: 2. Trigger Phase
|
|
136
125
|
User->>Signal: trigger()
|
|
137
126
|
activate Signal
|
|
138
127
|
Note over Signal: Notify all watchers
|
|
139
|
-
Signal->>
|
|
128
|
+
Signal->>Subscription: Schedule execution
|
|
140
129
|
deactivate Signal
|
|
141
130
|
|
|
142
|
-
activate
|
|
143
|
-
Note over
|
|
144
|
-
|
|
145
|
-
Note over
|
|
146
|
-
deactivate
|
|
131
|
+
activate Subscription
|
|
132
|
+
Note over Subscription: Re-execute function
|
|
133
|
+
Subscription->>Subscription: Perform refresh
|
|
134
|
+
Note over Subscription: Log: "Refreshing..."
|
|
135
|
+
deactivate Subscription
|
|
147
136
|
```
|
|
148
137
|
|
|
149
138
|
## Best Practices
|
|
@@ -174,12 +163,17 @@ const $handleSave = signal()
|
|
|
174
163
|
const $userUpdated = signal()
|
|
175
164
|
let currentUser: User | null = null
|
|
176
165
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
166
|
+
subscribe(
|
|
167
|
+
(t) => {
|
|
168
|
+
$userUpdated.watch(t)
|
|
169
|
+
return currentUser
|
|
170
|
+
},
|
|
171
|
+
(user) => {
|
|
172
|
+
if (user) {
|
|
173
|
+
renderUser(user)
|
|
174
|
+
}
|
|
181
175
|
}
|
|
182
|
-
|
|
176
|
+
)
|
|
183
177
|
|
|
184
178
|
function setUser(user: User) {
|
|
185
179
|
currentUser = user
|
|
@@ -193,8 +187,7 @@ function setUser(user: User) {
|
|
|
193
187
|
// ✅ Good - state holds the value
|
|
194
188
|
const $currentUser = state<User | null>(null)
|
|
195
189
|
|
|
196
|
-
|
|
197
|
-
const user = $currentUser.get(t)
|
|
190
|
+
$currentUser.subscribe((user) => {
|
|
198
191
|
if (user) {
|
|
199
192
|
renderUser(user)
|
|
200
193
|
}
|
|
@@ -205,36 +198,6 @@ function setUser(user: User) {
|
|
|
205
198
|
}
|
|
206
199
|
```
|
|
207
200
|
|
|
208
|
-
### Forgetting to Watch the Signal
|
|
209
|
-
|
|
210
|
-
**Problem**: Calling `.trigger()` without any watchers.
|
|
211
|
-
|
|
212
|
-
```typescript
|
|
213
|
-
// ❌ Bad - nothing watches the signal
|
|
214
|
-
const $refresh = signal()
|
|
215
|
-
|
|
216
|
-
effect((t) => {
|
|
217
|
-
// Forgot to watch!
|
|
218
|
-
performRefresh()
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
$refresh.trigger() // Effect won't run
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
**Solution**: Make sure to call `.watch(t)`:
|
|
225
|
-
|
|
226
|
-
```typescript
|
|
227
|
-
// ✅ Good - explicitly watch the signal
|
|
228
|
-
const $refresh = signal()
|
|
229
|
-
|
|
230
|
-
effect((t) => {
|
|
231
|
-
$refresh.watch(t) // Now it will react!
|
|
232
|
-
performRefresh()
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
$refresh.trigger() // Effect runs
|
|
236
|
-
```
|
|
237
|
-
|
|
238
201
|
### Over-Triggering
|
|
239
202
|
|
|
240
203
|
**Problem**: Triggering a signal in a loop or too frequently.
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
# State
|
|
2
2
|
|
|
3
|
-
**State** is a reactive primitive that holds a mutable value.
|
|
4
|
-
|
|
5
|
-
Imagine a thermometer in your home. The temperature is state - it changes throughout the day, and your heating system watches it to decide when to turn on or off. That's exactly what state does in PicoFlow.
|
|
3
|
+
**State** is a reactive primitive that holds a mutable value.
|
|
6
4
|
|
|
7
5
|
### Key Characteristics
|
|
8
6
|
|
|
9
7
|
- **Mutable**: Can be updated with `.set()`
|
|
10
8
|
- **Reactive**: Automatically notifies watchers on changes
|
|
11
9
|
- **Equality checking**: Only notifies if the new value differs from the current value
|
|
12
|
-
- **Type-safe**: TypeScript ensures updates match the initial type
|
|
13
10
|
|
|
14
11
|
## When to Use State
|
|
15
12
|
|
|
16
13
|
Use state when you need to:
|
|
17
14
|
|
|
18
15
|
- ✅ Track values that change over time
|
|
19
|
-
- ✅ Respond to user input or interactions
|
|
20
|
-
- ✅ Store data fetched from APIs
|
|
21
|
-
- ✅ Manage application state (UI state, form data, etc.)
|
|
22
16
|
|
|
23
17
|
Don't use state when:
|
|
24
18
|
|
|
@@ -45,45 +39,35 @@ The value you pass becomes the initial value. It can be any type: numbers, strin
|
|
|
45
39
|
|
|
46
40
|
State provides methods for reading, updating, and disposing.
|
|
47
41
|
|
|
48
|
-
###
|
|
42
|
+
### Get
|
|
49
43
|
|
|
50
|
-
Inside
|
|
44
|
+
Inside a subscription or derivation, use `.get(t)` to read the value and create a dependency:
|
|
51
45
|
|
|
52
46
|
```typescript
|
|
53
|
-
import { state, effect } from '@ersbeth/picoflow'
|
|
54
|
-
|
|
55
47
|
const $count = state(0)
|
|
48
|
+
const $double = derivation((t) => $count.get(t) * 2)
|
|
56
49
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log('Count is:', value)
|
|
50
|
+
$double.subscribe((value) => {
|
|
51
|
+
console.log('Double is:', value)
|
|
60
52
|
})
|
|
61
53
|
|
|
62
|
-
$count.set(1) // Console logs: "
|
|
63
|
-
$count.set(2) // Console logs: "
|
|
54
|
+
$count.set(1) // Console logs: "Double is: 2"
|
|
55
|
+
$count.set(2) // Console logs: "Double is: 4"
|
|
64
56
|
```
|
|
65
57
|
|
|
66
|
-
###
|
|
58
|
+
### Pick
|
|
67
59
|
|
|
68
60
|
Use `.pick()` when you want the current value without creating a dependency:
|
|
69
61
|
|
|
70
62
|
```typescript
|
|
71
63
|
const $count = state(0)
|
|
72
64
|
|
|
73
|
-
// Read without tracking (e.g., outside
|
|
74
|
-
const currentValue = $count.pick()
|
|
65
|
+
// Read without tracking (e.g., outside a subscription)
|
|
66
|
+
const currentValue = await $count.pick()
|
|
75
67
|
console.log(currentValue) // 0
|
|
76
|
-
|
|
77
|
-
// Or inside an effect, when you don't want to track changes
|
|
78
|
-
const $trigger = signal()
|
|
79
|
-
effect((t) => {
|
|
80
|
-
$trigger.watch(t) // Only track trigger
|
|
81
|
-
const snapshot = $count.pick() // Don't track count
|
|
82
|
-
console.log(snapshot)
|
|
83
|
-
})
|
|
84
68
|
```
|
|
85
69
|
|
|
86
|
-
###
|
|
70
|
+
### Update
|
|
87
71
|
|
|
88
72
|
Pass the new value directly to `.set()`:
|
|
89
73
|
|
|
@@ -94,8 +78,6 @@ $count.set(5) // Set to 5
|
|
|
94
78
|
$count.set(10) // Set to 10
|
|
95
79
|
```
|
|
96
80
|
|
|
97
|
-
### Updating with `.set(updater)`
|
|
98
|
-
|
|
99
81
|
Pass a function that receives the current value and returns the new value:
|
|
100
82
|
|
|
101
83
|
```typescript
|
|
@@ -111,7 +93,7 @@ $count.set(n => Math.max(0, n - 1)) // Decrement, min 0
|
|
|
111
93
|
- To guarantee you're working with the latest value
|
|
112
94
|
- For atomic updates (important in concurrent scenarios)
|
|
113
95
|
|
|
114
|
-
###
|
|
96
|
+
### Dispose
|
|
115
97
|
|
|
116
98
|
State can be disposed to free resources and prevent memory leaks:
|
|
117
99
|
|
|
@@ -119,8 +101,8 @@ State can be disposed to free resources and prevent memory leaks:
|
|
|
119
101
|
const $count = state(0)
|
|
120
102
|
|
|
121
103
|
// Use the state
|
|
122
|
-
|
|
123
|
-
console.log(
|
|
104
|
+
$count.subscribe((value) => {
|
|
105
|
+
console.log(value)
|
|
124
106
|
})
|
|
125
107
|
|
|
126
108
|
// Later, clean up
|
|
@@ -134,16 +116,12 @@ $count.set(5) // Error: Primitive is disposed
|
|
|
134
116
|
|
|
135
117
|
When you update state, a specific flow occurs to ensure efficiency and consistency.
|
|
136
118
|
|
|
137
|
-
### Update Flow
|
|
138
|
-
|
|
139
|
-
Here's what happens when you call `.set()`:
|
|
140
|
-
|
|
141
119
|
```mermaid
|
|
142
120
|
sequenceDiagram
|
|
143
121
|
participant User
|
|
144
122
|
participant $count as $count (State)
|
|
145
123
|
participant $double as $double (Derivation)
|
|
146
|
-
participant
|
|
124
|
+
participant Subscription
|
|
147
125
|
|
|
148
126
|
User->>$count: set(n => n + 1)
|
|
149
127
|
activate $count
|
|
@@ -156,18 +134,18 @@ sequenceDiagram
|
|
|
156
134
|
Note over $double: Mark as dirty<br/>NO recompute yet
|
|
157
135
|
deactivate $double
|
|
158
136
|
|
|
159
|
-
$count->>
|
|
137
|
+
$count->>Subscription: Schedule execution
|
|
160
138
|
deactivate $count
|
|
161
139
|
|
|
162
|
-
activate
|
|
163
|
-
Note over
|
|
140
|
+
activate Subscription
|
|
141
|
+
Note over Subscription: Execute function
|
|
164
142
|
|
|
165
|
-
|
|
143
|
+
Subscription->>$count: get(t)
|
|
166
144
|
activate $count
|
|
167
|
-
$count-->>
|
|
145
|
+
$count-->>Subscription: 1
|
|
168
146
|
deactivate $count
|
|
169
147
|
|
|
170
|
-
|
|
148
|
+
Subscription->>$double: get(t)
|
|
171
149
|
activate $double
|
|
172
150
|
Note over $double: Dirty? YES<br/>Recompute now
|
|
173
151
|
|
|
@@ -177,11 +155,11 @@ sequenceDiagram
|
|
|
177
155
|
deactivate $count
|
|
178
156
|
|
|
179
157
|
Note over $double: Compute: 1 * 2 = 2
|
|
180
|
-
$double-->>
|
|
158
|
+
$double-->>Subscription: 2
|
|
181
159
|
deactivate $double
|
|
182
160
|
|
|
183
|
-
Note over
|
|
184
|
-
deactivate
|
|
161
|
+
Note over Subscription: Log: "Count: 1, Double: 2"
|
|
162
|
+
deactivate Subscription
|
|
185
163
|
```
|
|
186
164
|
|
|
187
165
|
**How it works:**
|
|
@@ -192,8 +170,8 @@ sequenceDiagram
|
|
|
192
170
|
4. **Update value**: Store the new value
|
|
193
171
|
5. **Notify dependents**:
|
|
194
172
|
- Derivations are marked dirty (not recomputed yet)
|
|
195
|
-
-
|
|
196
|
-
6. **Pull-based recompute**: When
|
|
173
|
+
- Subscriptions are scheduled for execution
|
|
174
|
+
6. **Pull-based recompute**: When subscriptions run and read derivations, they recompute
|
|
197
175
|
|
|
198
176
|
### Equality Check Example
|
|
199
177
|
|
|
@@ -203,27 +181,27 @@ State only notifies when the value actually changes:
|
|
|
203
181
|
sequenceDiagram
|
|
204
182
|
participant User
|
|
205
183
|
participant $count as $count (State)
|
|
206
|
-
participant
|
|
184
|
+
participant Subscription
|
|
207
185
|
|
|
208
|
-
Note over User,
|
|
186
|
+
Note over User,Subscription: Initial state: $count = 5
|
|
209
187
|
|
|
210
188
|
User->>$count: set(5)
|
|
211
189
|
activate $count
|
|
212
190
|
Note over $count: Check: 5 === 5?<br/>YES - no change
|
|
213
191
|
Note over $count: Skip notification
|
|
214
192
|
deactivate $count
|
|
215
|
-
Note over
|
|
193
|
+
Note over Subscription: Subscription does NOT run
|
|
216
194
|
|
|
217
195
|
User->>$count: set(10)
|
|
218
196
|
activate $count
|
|
219
197
|
Note over $count: Check: 10 === 5?<br/>NO - value changed
|
|
220
198
|
Note over $count: Update: 5 → 10
|
|
221
|
-
$count->>
|
|
199
|
+
$count->>Subscription: Notify & schedule
|
|
222
200
|
deactivate $count
|
|
223
201
|
|
|
224
|
-
activate
|
|
225
|
-
Note over
|
|
226
|
-
deactivate
|
|
202
|
+
activate Subscription
|
|
203
|
+
Note over Subscription: Subscription runs
|
|
204
|
+
deactivate Subscription
|
|
227
205
|
```
|
|
228
206
|
|
|
229
207
|
## Best Practices
|
|
@@ -279,7 +257,6 @@ const form = {
|
|
|
279
257
|
}
|
|
280
258
|
```
|
|
281
259
|
|
|
282
|
-
### Name State Clearly
|
|
283
260
|
|
|
284
261
|
Use the `$` prefix for all reactive values:
|
|
285
262
|
|
|
@@ -293,76 +270,3 @@ const $isLoading = state(false)
|
|
|
293
270
|
const count = state(0)
|
|
294
271
|
const user = state({...})
|
|
295
272
|
```
|
|
296
|
-
|
|
297
|
-
## Common Pitfalls
|
|
298
|
-
|
|
299
|
-
### Using `.pick()` in Effects
|
|
300
|
-
|
|
301
|
-
**Problem**: Using `.pick()` inside effects prevents reactivity.
|
|
302
|
-
|
|
303
|
-
```typescript
|
|
304
|
-
// ❌ Wrong - will never update
|
|
305
|
-
effect((t) => {
|
|
306
|
-
const count = $count.pick() // No dependency created!
|
|
307
|
-
console.log(count) // Only logs once
|
|
308
|
-
})
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
**Solution**: Use `.get(t)` to create dependencies:
|
|
312
|
-
|
|
313
|
-
```typescript
|
|
314
|
-
// ✅ Correct - creates dependency
|
|
315
|
-
effect((t) => {
|
|
316
|
-
const count = $count.get(t) // Creates dependency
|
|
317
|
-
console.log(count) // Logs on every change
|
|
318
|
-
})
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
### Forgetting Updater Functions
|
|
322
|
-
|
|
323
|
-
**Problem**: Reading and setting separately creates race conditions.
|
|
324
|
-
|
|
325
|
-
```typescript
|
|
326
|
-
// ❌ Potential race condition
|
|
327
|
-
const current = $count.pick()
|
|
328
|
-
$count.set(current + 1)
|
|
329
|
-
// What if $count changes between pick() and set()?
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
**Solution**: Use updater functions:
|
|
333
|
-
|
|
334
|
-
```typescript
|
|
335
|
-
// ✅ Safe - uses latest value atomically
|
|
336
|
-
$count.set(n => n + 1)
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Mutating State Directly
|
|
340
|
-
|
|
341
|
-
**Problem**: Directly mutating arrays or objects doesn't trigger updates.
|
|
342
|
-
|
|
343
|
-
```typescript
|
|
344
|
-
const $items = state([1, 2, 3])
|
|
345
|
-
|
|
346
|
-
// ❌ Wrong - mutates the array
|
|
347
|
-
const items = $items.pick()
|
|
348
|
-
items.push(4) // Doesn't trigger updates!
|
|
349
|
-
|
|
350
|
-
// ❌ Also wrong - same array reference
|
|
351
|
-
$items.set(items => {
|
|
352
|
-
items.push(4) // Mutation!
|
|
353
|
-
return items // Same reference, no notification!
|
|
354
|
-
})
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
**Solution**: Create new arrays/objects (or use FlowArray/FlowMap):
|
|
358
|
-
|
|
359
|
-
```typescript
|
|
360
|
-
// ✅ Correct - creates new array
|
|
361
|
-
$items.set(items => [...items, 4])
|
|
362
|
-
|
|
363
|
-
// ✅ Also correct - for objects
|
|
364
|
-
$user.set(user => ({
|
|
365
|
-
...user,
|
|
366
|
-
age: user.age + 1
|
|
367
|
-
}))
|
|
368
|
-
```
|
package/package.json
CHANGED
|
@@ -1,61 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
"api:clean": "rm ./api/temp/*",
|
|
59
|
-
"api": "pnpm api:extract && pnpm api:generate && pnpm api:clean"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
2
|
+
"name": "@ersbeth/picoflow",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Minimal Dataflow library for TypeScript",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
|
+
"default": "./dist/picoflow.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"check": "pnpm exec tsc --noEmit",
|
|
12
|
+
"lint": "pnpm exec biome check --fix",
|
|
13
|
+
"build": "pnpm exec vite build --config vite.config.ts",
|
|
14
|
+
"test": "pnpm exec vitest",
|
|
15
|
+
"test:browser": "pnpm exec vitest --config=vitest.browser.config.ts",
|
|
16
|
+
"docs:dev": "pnpm exec vitepress dev docs",
|
|
17
|
+
"docs:build": "pnpm docs:generate && pnpm exec vitepress build docs",
|
|
18
|
+
"docs:preview": "pnpm exec vitepress preview docs",
|
|
19
|
+
"docs:generate": "pnpm exec typedoc"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"solid-js": "^1.9.7"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@biomejs/biome": "2.3.8",
|
|
26
|
+
"@braintree/sanitize-url": "^7.1.1",
|
|
27
|
+
"@solidjs/testing-library": "^0.8.10",
|
|
28
|
+
"@vitest/browser-playwright": "^4.0.16",
|
|
29
|
+
"cytoscape": "^3.33.1",
|
|
30
|
+
"cytoscape-cose-bilkent": "^4.1.0",
|
|
31
|
+
"dayjs": "^1.11.19",
|
|
32
|
+
"dompurify": "^3.3.0",
|
|
33
|
+
"jsdom": "^27.3.0",
|
|
34
|
+
"mermaid": "^11.12.1",
|
|
35
|
+
"typedoc": "^0.28.15",
|
|
36
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
37
|
+
"typedoc-vitepress-theme": "^1.1.2",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vite": "^7.3.0",
|
|
40
|
+
"vite-plugin-dts": "^4.5.4",
|
|
41
|
+
"vite-plugin-solid": "^2.11.10",
|
|
42
|
+
"vite-tsconfig-paths": "^6.0.3",
|
|
43
|
+
"vitepress": "^1.6.4",
|
|
44
|
+
"vitepress-plugin-mermaid": "^2.0.17",
|
|
45
|
+
"vitest": "^4.0.16"
|
|
46
|
+
},
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+ssh://git@gitlab.com/ersbeth-web/picoflow.git"
|
|
50
|
+
},
|
|
51
|
+
"author": "Elisabeth Rousset",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://gitlab.com/ersbeth-web/picoflow/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://gitlab.com/ersbeth-web/picoflow#readme"
|
|
57
|
+
}
|