@ersbeth/picoflow 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/README.md +10 -0
  2. package/SKILL.md +106 -0
  3. package/package.json +5 -1
  4. package/.gitlab-ci.yml +0 -24
  5. package/.vscode/settings.json +0 -5
  6. package/CHANGELOG.md +0 -94
  7. package/biome.json +0 -47
  8. package/docs/.vitepress/config.mts +0 -145
  9. package/docs/api/functions/array.md +0 -35
  10. package/docs/api/functions/constant.md +0 -33
  11. package/docs/api/functions/constantAsync.md +0 -69
  12. package/docs/api/functions/derivation.md +0 -34
  13. package/docs/api/functions/derivationAsync.md +0 -34
  14. package/docs/api/functions/from.md +0 -129
  15. package/docs/api/functions/isDisposable.md +0 -27
  16. package/docs/api/functions/map.md +0 -36
  17. package/docs/api/functions/signal.md +0 -21
  18. package/docs/api/functions/state.md +0 -67
  19. package/docs/api/functions/stateAsync.md +0 -69
  20. package/docs/api/functions/subscribe.md +0 -40
  21. package/docs/api/functions/writableDerivation.md +0 -33
  22. package/docs/api/functions/writableDerivationAsync.md +0 -34
  23. package/docs/api/index.md +0 -61
  24. package/docs/api/interfaces/FlowArray.md +0 -439
  25. package/docs/api/interfaces/FlowConstant.md +0 -220
  26. package/docs/api/interfaces/FlowConstantAsync.md +0 -221
  27. package/docs/api/interfaces/FlowDerivation.md +0 -241
  28. package/docs/api/interfaces/FlowDerivationAsync.md +0 -242
  29. package/docs/api/interfaces/FlowDisposable.md +0 -59
  30. package/docs/api/interfaces/FlowEffect.md +0 -64
  31. package/docs/api/interfaces/FlowMap.md +0 -374
  32. package/docs/api/interfaces/FlowObservable.md +0 -155
  33. package/docs/api/interfaces/FlowSignal.md +0 -156
  34. package/docs/api/interfaces/FlowState.md +0 -269
  35. package/docs/api/interfaces/FlowStateAsync.md +0 -268
  36. package/docs/api/interfaces/FlowSubscribable.md +0 -55
  37. package/docs/api/interfaces/FlowTracker.md +0 -61
  38. package/docs/api/interfaces/FlowValue.md +0 -222
  39. package/docs/api/interfaces/FlowWritableDerivation.md +0 -292
  40. package/docs/api/interfaces/FlowWritableDerivationAsync.md +0 -293
  41. package/docs/api/type-aliases/DerivationFunction.md +0 -28
  42. package/docs/api/type-aliases/DerivationFunctionAsync.md +0 -28
  43. package/docs/api/type-aliases/FlowArrayAction.md +0 -60
  44. package/docs/api/type-aliases/FlowDataTracker.md +0 -33
  45. package/docs/api/type-aliases/FlowMapAction.md +0 -48
  46. package/docs/api/type-aliases/FlowOnDataListener.md +0 -33
  47. package/docs/api/type-aliases/FlowOnErrorListener.md +0 -27
  48. package/docs/api/type-aliases/FlowOnPendingListener.md +0 -21
  49. package/docs/api/type-aliases/FlowReadonly.md +0 -22
  50. package/docs/api/type-aliases/InitFunction.md +0 -21
  51. package/docs/api/type-aliases/InitFunctionAsync.md +0 -21
  52. package/docs/api/type-aliases/NotPromise.md +0 -21
  53. package/docs/api/type-aliases/UpdateFunction.md +0 -27
  54. package/docs/api/type-aliases/UpdateFunctionAsync.md +0 -27
  55. package/docs/api/typedoc-sidebar.json +0 -65
  56. package/docs/examples/examples.md +0 -2311
  57. package/docs/examples/patterns.md +0 -649
  58. package/docs/guide/advanced/architecture.md +0 -1234
  59. package/docs/guide/advanced/disposal.md +0 -426
  60. package/docs/guide/advanced/migration-v1.md +0 -464
  61. package/docs/guide/advanced/migration-v2.md +0 -204
  62. package/docs/guide/advanced/solidjs.md +0 -135
  63. package/docs/guide/introduction/concepts.md +0 -57
  64. package/docs/guide/introduction/conventions.md +0 -30
  65. package/docs/guide/introduction/getting-started.md +0 -139
  66. package/docs/guide/introduction/lifecycle.md +0 -368
  67. package/docs/guide/primitives/array.md +0 -286
  68. package/docs/guide/primitives/constant.md +0 -207
  69. package/docs/guide/primitives/derivations.md +0 -281
  70. package/docs/guide/primitives/effects.md +0 -372
  71. package/docs/guide/primitives/map.md +0 -265
  72. package/docs/guide/primitives/overview.md +0 -92
  73. package/docs/guide/primitives/signal.md +0 -222
  74. package/docs/guide/primitives/state.md +0 -272
  75. package/docs/index.md +0 -47
  76. package/docs/public/logo.svg +0 -1
  77. package/src/api/base/flowDisposable.ts +0 -44
  78. package/src/api/base/flowObservable.ts +0 -28
  79. package/src/api/base/flowSubscribable.ts +0 -87
  80. package/src/api/base/flowTracker.ts +0 -7
  81. package/src/api/base/index.ts +0 -4
  82. package/src/api/index.ts +0 -2
  83. package/src/api/nodes/async/flowConstantAsync.ts +0 -36
  84. package/src/api/nodes/async/flowDerivationAsync.ts +0 -42
  85. package/src/api/nodes/async/flowStateAsync.ts +0 -47
  86. package/src/api/nodes/async/flowWritableDerivationAsync.ts +0 -33
  87. package/src/api/nodes/async/index.ts +0 -4
  88. package/src/api/nodes/collections/flowArray.ts +0 -155
  89. package/src/api/nodes/collections/flowMap.ts +0 -115
  90. package/src/api/nodes/collections/index.ts +0 -2
  91. package/src/api/nodes/flowEffect.ts +0 -42
  92. package/src/api/nodes/flowSignal.ts +0 -28
  93. package/src/api/nodes/flowValue.ts +0 -37
  94. package/src/api/nodes/index.ts +0 -7
  95. package/src/api/nodes/sync/flowConstant.ts +0 -33
  96. package/src/api/nodes/sync/flowDerivation.ts +0 -41
  97. package/src/api/nodes/sync/flowState.ts +0 -45
  98. package/src/api/nodes/sync/flowWritableDerivation.ts +0 -31
  99. package/src/api/nodes/sync/index.ts +0 -4
  100. package/src/api/nodes/utils.ts +0 -24
  101. package/src/base/disposable.ts +0 -18
  102. package/src/base/executionStack.ts +0 -42
  103. package/src/base/index.ts +0 -5
  104. package/src/base/node.ts +0 -98
  105. package/src/base/observable.ts +0 -92
  106. package/src/base/observer.ts +0 -51
  107. package/src/converters/index.ts +0 -1
  108. package/src/converters/solid.ts +0 -109
  109. package/src/index.ts +0 -2
  110. package/src/nodes/arrayNode.ts +0 -180
  111. package/src/nodes/effectNode.ts +0 -58
  112. package/src/nodes/index.ts +0 -7
  113. package/src/nodes/mapNode.ts +0 -125
  114. package/src/nodes/signalNode.ts +0 -19
  115. package/src/nodes/valueAsyncNode.ts +0 -85
  116. package/src/nodes/valueNode.ts +0 -148
  117. package/src/nodes/valueSyncNode.ts +0 -125
  118. package/src/schedulers/asyncResolver.ts +0 -78
  119. package/src/schedulers/asyncScheduler.ts +0 -66
  120. package/src/schedulers/index.ts +0 -4
  121. package/src/schedulers/pendingError.ts +0 -13
  122. package/src/schedulers/scheduler.ts +0 -9
  123. package/src/schedulers/syncResolver.ts +0 -69
  124. package/src/schedulers/syncScheduler.ts +0 -55
  125. package/test/base/pendingError.test.ts +0 -67
  126. package/test/converters/solid.derivation.browser.test.tsx +0 -69
  127. package/test/converters/solid.node.test.ts +0 -654
  128. package/test/converters/solid.state.browser.test.tsx +0 -1592
  129. package/test/reactivity/flowSignal.test.ts +0 -226
  130. package/test/reactivity/nodes/async/asyncScheduler/asyncResolver.test.ts +0 -593
  131. package/test/reactivity/nodes/async/asyncScheduler/asyncScheduler.test.ts +0 -317
  132. package/test/reactivity/nodes/async/flowConstantAsync.test.ts +0 -652
  133. package/test/reactivity/nodes/async/flowDerivation.test.ts +0 -898
  134. package/test/reactivity/nodes/async/flowDerivationAsync.test.ts +0 -1716
  135. package/test/reactivity/nodes/async/flowStateAsync.test.ts +0 -708
  136. package/test/reactivity/nodes/async/flowWritableDerivationAsync.test.ts +0 -614
  137. package/test/reactivity/nodes/collections/flowArray.asyncStates.test.ts +0 -1289
  138. package/test/reactivity/nodes/collections/flowArray.scalars.test.ts +0 -961
  139. package/test/reactivity/nodes/collections/flowArray.states.test.ts +0 -1035
  140. package/test/reactivity/nodes/collections/flowMap.asyncStates.test.ts +0 -960
  141. package/test/reactivity/nodes/collections/flowMap.scalars.test.ts +0 -775
  142. package/test/reactivity/nodes/collections/flowMap.states.test.ts +0 -958
  143. package/test/reactivity/nodes/sync/flowConstant.test.ts +0 -377
  144. package/test/reactivity/nodes/sync/flowDerivation.test.ts +0 -896
  145. package/test/reactivity/nodes/sync/flowState.test.ts +0 -341
  146. package/test/reactivity/nodes/sync/flowWritableDerivation.test.ts +0 -603
  147. package/test/vitest.d.ts +0 -10
  148. package/tsconfig.json +0 -37
  149. package/typedoc.json +0 -37
  150. package/vite.config.ts +0 -31
  151. package/vitest.browser.config.ts +0 -21
  152. package/vitest.config.ts +0 -17
@@ -1,226 +0,0 @@
1
- import { describe, expect, it, vi } from "vitest";
2
- import { signal, subscribe } from "~";
3
-
4
- describe("FlowSignal", () => {
5
- describe("unit", () => {
6
- describe("disposal", () => {
7
- it("should have disposed property set to false initially and true after disposal", () => {
8
- const $signal = signal();
9
- expect($signal.disposed).toBe(false);
10
- $signal.dispose();
11
- expect($signal.disposed).toBe(true);
12
- });
13
-
14
- it("should throw error when disposed twice", () => {
15
- const $signal = signal();
16
- $signal.dispose();
17
- expect(() => $signal.dispose()).toThrow("[PicoFlow] Primitive is disposed");
18
- });
19
-
20
- it("should dispose signal successfully", () => {
21
- const $signal = signal();
22
- expect(() => $signal.dispose()).not.toThrow();
23
- expect($signal.disposed).toBe(true);
24
- });
25
-
26
- it("should accept self option without throwing", () => {
27
- const $signal = signal();
28
- expect(() => $signal.dispose()).not.toThrow();
29
- expect($signal.disposed).toBe(true);
30
- });
31
-
32
- it("should accept default options without throwing", () => {
33
- const $signal = signal();
34
- expect(() => $signal.dispose()).not.toThrow();
35
- expect($signal.disposed).toBe(true);
36
- });
37
- });
38
-
39
- describe("trigger", () => {
40
- it("should return void when triggered", () => {
41
- const $signal = signal();
42
- const result = $signal.trigger();
43
- expect(result).toBeUndefined();
44
- });
45
-
46
- it("should throw error when trigger is called after disposal", () => {
47
- const $signal = signal();
48
- $signal.dispose();
49
- expect(() => $signal.trigger()).toThrow("[PicoFlow] Primitive is disposed");
50
- });
51
-
52
- it("should allow multiple triggers", () => {
53
- const $signal = signal();
54
- $signal.trigger();
55
- $signal.trigger();
56
- $signal.trigger();
57
- // Should not throw
58
- expect(true).toBe(true);
59
- });
60
- });
61
- });
62
-
63
- describe("integration", () => {
64
- describe("with effects", () => {
65
- describe("watch", () => {
66
- it("should register effect when watch is called", async () => {
67
- const $signal = signal();
68
- const onData = vi.fn();
69
- subscribe((t) => $signal.watch(t), onData);
70
-
71
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(1));
72
- expect(onData).toHaveBeenCalledTimes(1);
73
- });
74
-
75
- it("should throw error when watch is called after signal disposal", async () => {
76
- const $signal = signal();
77
- const onData1 = vi.fn();
78
- subscribe((t) => $signal.watch(t), onData1);
79
-
80
- await vi.waitFor(() => expect(onData1).toHaveBeenCalledTimes(1));
81
-
82
- $signal.dispose();
83
-
84
- const onData2 = vi.fn();
85
- const onError = vi.fn();
86
-
87
- subscribe((t) => $signal.watch(t), onData2, onError);
88
-
89
- await vi.waitFor(() => expect(onError).toHaveBeenCalledTimes(1));
90
- expect(onData2).toHaveBeenCalledTimes(0);
91
- expect(onError).toHaveBeenLastCalledWith(expect.any(Error));
92
-
93
- expect(() => $signal.trigger()).toThrow("[PicoFlow] Primitive is disposed");
94
- });
95
- });
96
-
97
- describe("trigger", () => {
98
- it("should notify effects when triggered", async () => {
99
- const $signal = signal();
100
- const onData = vi.fn();
101
- subscribe((t) => $signal.watch(t), onData);
102
-
103
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(1));
104
-
105
- $signal.trigger();
106
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(2));
107
-
108
- $signal.trigger();
109
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(3));
110
- });
111
-
112
- it("should notify multiple effects when triggered", async () => {
113
- const $signal = signal();
114
- const onData1 = vi.fn();
115
- const onData2 = vi.fn();
116
- const onData3 = vi.fn();
117
-
118
- subscribe((t) => $signal.watch(t), onData1);
119
-
120
- subscribe((t) => $signal.watch(t), onData2);
121
-
122
- subscribe((t) => $signal.watch(t), onData3);
123
-
124
- await vi.waitFor(() => {
125
- expect(onData1).toHaveBeenCalledTimes(1);
126
- expect(onData2).toHaveBeenCalledTimes(1);
127
- expect(onData3).toHaveBeenCalledTimes(1);
128
- });
129
-
130
- $signal.trigger();
131
- await vi.waitFor(() => {
132
- expect(onData1).toHaveBeenCalledTimes(2);
133
- expect(onData2).toHaveBeenCalledTimes(2);
134
- expect(onData3).toHaveBeenCalledTimes(2);
135
- });
136
- });
137
-
138
- it("should not notify effects after they are disposed", async () => {
139
- const $signal = signal();
140
- const onData = vi.fn();
141
- const $effect = subscribe((t) => $signal.watch(t), onData);
142
-
143
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(1));
144
-
145
- $signal.trigger();
146
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(2));
147
-
148
- $effect.dispose();
149
-
150
- $signal.trigger();
151
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(2));
152
- });
153
-
154
- it("should notify effects multiple times on multiple triggers", async () => {
155
- const $signal = signal();
156
- const onData = vi.fn();
157
- subscribe((t) => $signal.watch(t), onData);
158
-
159
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(1));
160
-
161
- $signal.trigger();
162
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(2));
163
-
164
- $signal.trigger();
165
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(3));
166
-
167
- $signal.trigger();
168
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(4));
169
- });
170
-
171
- it("should execute effects asynchronously when triggered", async () => {
172
- const $signal = signal();
173
- const onData = vi.fn();
174
-
175
- subscribe(
176
- (t) => $signal.watch(t),
177
- () => onData("effect-executed"),
178
- );
179
-
180
- onData("after-initial-effect");
181
- $signal.trigger();
182
- onData("trigger-called");
183
-
184
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(4));
185
-
186
- expect(onData).toHaveBeenNthCalledWith(1, "effect-executed");
187
- expect(onData).toHaveBeenNthCalledWith(2, "after-initial-effect");
188
- expect(onData).toHaveBeenNthCalledWith(3, "trigger-called");
189
- expect(onData).toHaveBeenNthCalledWith(4, "effect-executed");
190
- });
191
- });
192
-
193
- describe("dispose", () => {
194
- it("should not dispose effects when signal is disposed", async () => {
195
- const $signal = signal();
196
- const onData = vi.fn();
197
- const $effect = subscribe((t) => $signal.watch(t), onData);
198
-
199
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(1));
200
- expect($effect.disposed).toBe(false);
201
-
202
- $signal.dispose();
203
-
204
- expect($effect.disposed).toBe(false);
205
- expect($signal.disposed).toBe(true);
206
- });
207
-
208
- it("should unregister effects when signal is disposed with self option", async () => {
209
- const $signal = signal();
210
- const onData = vi.fn();
211
- const $effect = subscribe((t) => $signal.watch(t), onData);
212
-
213
- await vi.waitFor(() => expect(onData).toHaveBeenCalledTimes(1));
214
-
215
- $signal.dispose();
216
-
217
- // Effect should still be active but not notified
218
- expect($effect.disposed).toBe(false);
219
-
220
- // But signal is disposed so trigger will fail
221
- expect(() => $signal.trigger()).toThrow("[PicoFlow] Primitive is disposed");
222
- });
223
- });
224
- });
225
- });
226
- });