@ixfx/components 0.4.2 → 0.4.4

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 (225) hide show
  1. package/bundle/index.d.ts +435 -1193
  2. package/bundle/index.d.ts.map +1 -1
  3. package/bundle/index.js +7765 -20670
  4. package/bundle/index.js.map +1 -1
  5. package/dist/ac-text.d.ts +12 -7
  6. package/dist/ac-text.d.ts.map +1 -1
  7. package/dist/ac-text.js +2 -3
  8. package/dist/ac-text.js.map +1 -1
  9. package/dist/{button-C3fLMKUv.js → button-DxYee1ZH.js} +2 -2
  10. package/dist/{button-C3fLMKUv.js.map → button-DxYee1ZH.js.map} +1 -1
  11. package/dist/button.d.ts +1 -2
  12. package/dist/button.d.ts.map +1 -1
  13. package/dist/button.js +1 -2
  14. package/dist/checkbox.d.ts +0 -1
  15. package/dist/checkbox.d.ts.map +1 -1
  16. package/dist/checkbox.js +1 -1
  17. package/dist/checkbox.js.map +1 -1
  18. package/dist/{colour-picker-0sgAha1T.js → colour-picker-BacNRabo.js} +14 -16
  19. package/dist/colour-picker-BacNRabo.js.map +1 -0
  20. package/dist/colour-picker.d.ts +1 -1
  21. package/dist/colour-picker.js +1 -1
  22. package/dist/crumbs.d.ts +5 -2
  23. package/dist/crumbs.d.ts.map +1 -1
  24. package/dist/crumbs.js +45 -20
  25. package/dist/crumbs.js.map +1 -1
  26. package/dist/data-display.d.ts +1 -2
  27. package/dist/data-display.d.ts.map +1 -1
  28. package/dist/data-display.js +25 -23
  29. package/dist/data-display.js.map +1 -1
  30. package/dist/{data-provider-DgI909FP.js → data-provider-35TyWclX.js} +2 -2
  31. package/dist/data-provider-35TyWclX.js.map +1 -0
  32. package/dist/{decorate-DdjvVHS-.js → decorate-VRK8rslU.js} +2 -2
  33. package/dist/{decorate-DdjvVHS-.js.map → decorate-VRK8rslU.js.map} +1 -1
  34. package/dist/editable-label.d.ts +1 -2
  35. package/dist/editable-label.d.ts.map +1 -1
  36. package/dist/editable-label.js +1 -1
  37. package/dist/editable-label.js.map +1 -1
  38. package/dist/{hex-editor-WZrjRtvL.js → hex-editor-Bk6rxhfg.js} +9 -11
  39. package/dist/hex-editor-Bk6rxhfg.js.map +1 -0
  40. package/dist/{hex-editor-CMIxtNgT.d.ts → hex-editor-Caq8vNQk.d.ts} +2 -3
  41. package/dist/hex-editor-Caq8vNQk.d.ts.map +1 -0
  42. package/dist/hex.d.ts +1 -1
  43. package/dist/hex.js +1 -1
  44. package/dist/highlight-B-eQrhhb.js.map +1 -1
  45. package/dist/{icon-Ndo40kNO.js → icon-B22XVlCt.js} +6 -4
  46. package/dist/{icon-Ndo40kNO.js.map → icon-B22XVlCt.js.map} +1 -1
  47. package/dist/{icon-epZd-JIO.d.ts → icon-DpA9x2Ve.d.ts} +3 -4
  48. package/dist/icon-DpA9x2Ve.d.ts.map +1 -0
  49. package/dist/icons.d.ts +2 -2
  50. package/dist/icons.js +1 -1
  51. package/dist/{incr-search-CeERfijK.js → incr-search-2pz21xtR.js} +9 -6
  52. package/dist/incr-search-2pz21xtR.js.map +1 -0
  53. package/dist/incr-search.d.ts +1 -1
  54. package/dist/incr-search.js +1 -1
  55. package/dist/{index-CowKi2mo.d.ts → index-BeuCXtiO.d.ts} +3 -4
  56. package/dist/index-BeuCXtiO.d.ts.map +1 -0
  57. package/dist/{index-D87kRcEs.d.ts → index-BtGFYfaK.d.ts} +2 -1
  58. package/dist/index-BtGFYfaK.d.ts.map +1 -0
  59. package/dist/{index-JuEVfmr-.d.ts → index-CoqtMSd9.d.ts} +6 -4
  60. package/dist/index-CoqtMSd9.d.ts.map +1 -0
  61. package/dist/{index-9fGVAg1d.d.ts → index-Cxwxtj6g.d.ts} +3 -3
  62. package/dist/index-Cxwxtj6g.d.ts.map +1 -0
  63. package/dist/index-D_ftz_IT.d.ts +184 -0
  64. package/dist/index-D_ftz_IT.d.ts.map +1 -0
  65. package/dist/{index-_RTQSKHi.d.ts → index-DfEkTGvT.d.ts} +11 -11
  66. package/dist/index-DfEkTGvT.d.ts.map +1 -0
  67. package/dist/index.d.ts +45 -30
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +304 -3075
  70. package/dist/index.js.map +1 -1
  71. package/dist/keyboard-B5xD7Fz-.js +36 -0
  72. package/dist/keyboard-B5xD7Fz-.js.map +1 -0
  73. package/dist/{labelled-input-base-Cz6qE6Dk.d.ts → labelled-input-base-DiTme1JO.d.ts} +2 -3
  74. package/dist/labelled-input-base-DiTme1JO.d.ts.map +1 -0
  75. package/dist/{labelled-input-base-9K_w3oLj.js → labelled-input-base-hoKGwyKT.js} +2 -2
  76. package/dist/{labelled-input-base-9K_w3oLj.js.map → labelled-input-base-hoKGwyKT.js.map} +1 -1
  77. package/dist/labelled-radial-input.d.ts +6 -5
  78. package/dist/labelled-radial-input.d.ts.map +1 -1
  79. package/dist/labelled-radial-input.js +7 -3
  80. package/dist/labelled-radial-input.js.map +1 -1
  81. package/dist/labelled-range-input.d.ts +1 -1
  82. package/dist/labelled-range-input.js +27 -3
  83. package/dist/labelled-range-input.js.map +1 -1
  84. package/dist/led.d.ts +1 -2
  85. package/dist/led.d.ts.map +1 -1
  86. package/dist/led.js +1 -1
  87. package/dist/led.js.map +1 -1
  88. package/dist/{menu-vjoiHZ13.js → menu-g6yd7ddN.js} +8 -9
  89. package/dist/menu-g6yd7ddN.js.map +1 -0
  90. package/dist/{menu-item-COx-Azgj.d.ts → menu-item-DSyf9f_L.d.ts} +4 -4
  91. package/dist/menu-item-DSyf9f_L.d.ts.map +1 -0
  92. package/dist/{menu-item-BrIuORYD.js → menu-item-NUKwJ4s5.js} +3 -4
  93. package/dist/{menu-item-BrIuORYD.js.map → menu-item-NUKwJ4s5.js.map} +1 -1
  94. package/dist/menu.d.ts +2 -2
  95. package/dist/menu.js +2 -2
  96. package/dist/miller.d.ts +8 -5
  97. package/dist/miller.d.ts.map +1 -1
  98. package/dist/miller.js +22 -24
  99. package/dist/miller.js.map +1 -1
  100. package/dist/narrowed-text.d.ts +7 -3
  101. package/dist/narrowed-text.d.ts.map +1 -1
  102. package/dist/narrowed-text.js +73 -47
  103. package/dist/narrowed-text.js.map +1 -1
  104. package/dist/panel.d.ts +1 -1
  105. package/dist/panel.d.ts.map +1 -1
  106. package/dist/panel.js +2 -2
  107. package/dist/panel.js.map +1 -1
  108. package/dist/plots.d.ts +2 -2
  109. package/dist/plots.js +1 -1
  110. package/dist/polar-pad.d.ts +15 -3
  111. package/dist/polar-pad.d.ts.map +1 -1
  112. package/dist/polar-pad.js +64 -11
  113. package/dist/polar-pad.js.map +1 -1
  114. package/dist/{radial-input-CpQPs1Mp.d.ts → radial-input-DXMN55Nz.d.ts} +6 -4
  115. package/dist/radial-input-DXMN55Nz.d.ts.map +1 -0
  116. package/dist/{radial-input-DZ7eQCcM.js → radial-input-DxCrt_NE.js} +41 -19
  117. package/dist/radial-input-DxCrt_NE.js.map +1 -0
  118. package/dist/radial-input.d.ts +1 -1
  119. package/dist/radial-input.js +1 -1
  120. package/dist/range-input.d.ts +15 -4
  121. package/dist/range-input.d.ts.map +1 -1
  122. package/dist/range-input.js +23 -2
  123. package/dist/range-input.js.map +1 -1
  124. package/dist/range.d.ts +15 -4
  125. package/dist/range.d.ts.map +1 -1
  126. package/dist/range.js +23 -2
  127. package/dist/range.js.map +1 -1
  128. package/dist/selecthorizontal.d.ts +1 -2
  129. package/dist/selecthorizontal.d.ts.map +1 -1
  130. package/dist/selecthorizontal.js +1 -1
  131. package/dist/selecthorizontal.js.map +1 -1
  132. package/dist/slider-input-DFpG23bS.js +1592 -0
  133. package/dist/slider-input-DFpG23bS.js.map +1 -0
  134. package/dist/slider-input-XppH3vcy.d.ts +160 -0
  135. package/dist/slider-input-XppH3vcy.d.ts.map +1 -0
  136. package/dist/slider-input.d.ts +2 -0
  137. package/dist/slider-input.js +2 -0
  138. package/dist/snap-container.d.ts +1 -2
  139. package/dist/snap-container.d.ts.map +1 -1
  140. package/dist/snap-container.js +6 -5
  141. package/dist/snap-container.js.map +1 -1
  142. package/dist/split-layout.d.ts +1 -2
  143. package/dist/split-layout.d.ts.map +1 -1
  144. package/dist/split-layout.js +6 -4
  145. package/dist/split-layout.js.map +1 -1
  146. package/dist/swipe.d.ts +12 -2
  147. package/dist/swipe.d.ts.map +1 -1
  148. package/dist/swipe.js +22 -3
  149. package/dist/swipe.js.map +1 -1
  150. package/dist/{tab-list-DLzb-m-I.d.ts → tab-list-BohmbvqF.d.ts} +14 -5
  151. package/dist/tab-list-BohmbvqF.d.ts.map +1 -0
  152. package/dist/tab-list-DzknpdSo.js +592 -0
  153. package/dist/tab-list-DzknpdSo.js.map +1 -0
  154. package/dist/tabs.d.ts +2 -2
  155. package/dist/tabs.js +1 -208
  156. package/dist/{tickled-controller-BjYCzGrU.d.ts → tickled-controller-BF2Ea0DE.d.ts} +2 -31
  157. package/dist/tickled-controller-BF2Ea0DE.d.ts.map +1 -0
  158. package/dist/tickled-styles-fNDdqf6l.js.map +1 -1
  159. package/dist/{timeline-2OFtN4Ta.js → timeline-B2fgDL4U.js} +37 -1438
  160. package/dist/timeline-B2fgDL4U.js.map +1 -0
  161. package/dist/timeline.d.ts +1 -1
  162. package/dist/timeline.js +1 -1
  163. package/dist/{tooltip-RGVIwHrZ.d.ts → tooltip-BlvBUQxx.d.ts} +3 -3
  164. package/dist/tooltip-BlvBUQxx.d.ts.map +1 -0
  165. package/dist/{tree-D84RUgFC.js → tree-BnvzhsAw.js} +8 -9
  166. package/dist/tree-BnvzhsAw.js.map +1 -0
  167. package/dist/{tree-component-BaCSPWg1.d.ts → tree-component-DCmmKZ4j.d.ts} +8 -124
  168. package/dist/tree-component-DCmmKZ4j.d.ts.map +1 -0
  169. package/dist/tree.d.ts +10 -4
  170. package/dist/tree.d.ts.map +1 -1
  171. package/dist/tree.js +1 -1
  172. package/dist/types-DO3gt5vg.d.ts +130 -0
  173. package/dist/types-DO3gt5vg.d.ts.map +1 -0
  174. package/dist/wheel-nudge-BlSCe_hD.js +86 -0
  175. package/dist/wheel-nudge-BlSCe_hD.js.map +1 -0
  176. package/dist/wheel-nudge-DGrNzWuE.d.ts +29 -0
  177. package/dist/wheel-nudge-DGrNzWuE.d.ts.map +1 -0
  178. package/dist/{xy-axis-CEI7ojks.d.ts → xy-axis-5KhVTNoX.d.ts} +75 -29
  179. package/dist/xy-axis-5KhVTNoX.d.ts.map +1 -0
  180. package/dist/xy-axis-CxHC8z5E.js +1849 -0
  181. package/dist/xy-axis-CxHC8z5E.js.map +1 -0
  182. package/dist/xy-pad.d.ts +13 -2
  183. package/dist/xy-pad.d.ts.map +1 -1
  184. package/dist/xy-pad.js +47 -6
  185. package/dist/xy-pad.js.map +1 -1
  186. package/docs-user/radial-input.md +2 -2
  187. package/package.json +22 -21
  188. package/dist/colour-C3MQIjFJ-vRCdr8W-.js +0 -3732
  189. package/dist/colour-C3MQIjFJ-vRCdr8W-.js.map +0 -1
  190. package/dist/colour-picker-0sgAha1T.js.map +0 -1
  191. package/dist/data-provider-DgI909FP.js.map +0 -1
  192. package/dist/dist-CA13FvMn.js +0 -980
  193. package/dist/dist-CA13FvMn.js.map +0 -1
  194. package/dist/hex-editor-CMIxtNgT.d.ts.map +0 -1
  195. package/dist/hex-editor-WZrjRtvL.js.map +0 -1
  196. package/dist/icon-epZd-JIO.d.ts.map +0 -1
  197. package/dist/incr-search-CeERfijK.js.map +0 -1
  198. package/dist/index-9fGVAg1d.d.ts.map +0 -1
  199. package/dist/index-CowKi2mo.d.ts.map +0 -1
  200. package/dist/index-D87kRcEs.d.ts.map +0 -1
  201. package/dist/index-DgXpCg_G.d.ts +0 -1244
  202. package/dist/index-DgXpCg_G.d.ts.map +0 -1
  203. package/dist/index-JuEVfmr-.d.ts.map +0 -1
  204. package/dist/index-_RTQSKHi.d.ts.map +0 -1
  205. package/dist/keyboard-CimiEskD.js +0 -20
  206. package/dist/keyboard-CimiEskD.js.map +0 -1
  207. package/dist/labelled-input-base-Cz6qE6Dk.d.ts.map +0 -1
  208. package/dist/menu-item-COx-Azgj.d.ts.map +0 -1
  209. package/dist/menu-vjoiHZ13.js.map +0 -1
  210. package/dist/radial-input-CpQPs1Mp.d.ts.map +0 -1
  211. package/dist/radial-input-DZ7eQCcM.js.map +0 -1
  212. package/dist/tab-list-DLzb-m-I.d.ts.map +0 -1
  213. package/dist/tabs.js.map +0 -1
  214. package/dist/tickled-controller-BjYCzGrU.d.ts.map +0 -1
  215. package/dist/timeline-2OFtN4Ta.js.map +0 -1
  216. package/dist/tooltip-RGVIwHrZ.d.ts.map +0 -1
  217. package/dist/tree-D84RUgFC.js.map +0 -1
  218. package/dist/tree-component-BaCSPWg1.d.ts.map +0 -1
  219. package/dist/types-DSfbtHs3.d.ts +0 -8
  220. package/dist/types-DSfbtHs3.d.ts.map +0 -1
  221. package/dist/xy-axis-CEI7ojks.d.ts.map +0 -1
  222. package/dist/xy-axis-DbPezP6A.js +0 -7849
  223. package/dist/xy-axis-DbPezP6A.js.map +0 -1
  224. /package/bundle/{chunk-D7D4PA-g.js → rolldown-runtime-D7D4PA-g.js} +0 -0
  225. /package/dist/{chunk-D7D4PA-g.js → rolldown-runtime-D7D4PA-g.js} +0 -0
@@ -1,980 +0,0 @@
1
- //#region node_modules/.pnpm/@ixfx+guards@0.56.13/node_modules/@ixfx/guards/dist/index.js
2
- function getErrorMessage(ex) {
3
- if (typeof ex === `string`) return ex;
4
- if (ex instanceof Error) return ex.message;
5
- return String(ex);
6
- }
7
- /**
8
- * Throws an error if any result is a failure.
9
- * Error message will be the combined from all errors.
10
- * @param results
11
- */
12
- function throwIfFailed(...results) {
13
- const failed = results.filter((r) => resultIsError(r));
14
- if (failed.length === 0) return;
15
- const messages = failed.map((f) => resultErrorToString(f));
16
- throw new Error(messages.join(`, `));
17
- }
18
- /**
19
- * If any of `results` is an error, throws it, otherwise ignored.
20
- * @param results
21
- * @returns _true_ or throws
22
- */
23
- function resultThrow$1(...results) {
24
- for (const r of results) {
25
- if (r === void 0) continue;
26
- if (typeof r === `boolean`) if (!r) throw IxfxError$1.fromString(`Guard failed: false result`);
27
- else continue;
28
- const rr = typeof r === `object` ? r : r();
29
- if (rr === void 0) continue;
30
- if (rr.success) continue;
31
- throw resultToError$1(rr);
32
- }
33
- return true;
34
- }
35
- /**
36
- * Returns _true_ if `result` is an error
37
- * @param result
38
- */
39
- function resultIsError(result) {
40
- if (typeof result !== `object` || result === null) return false;
41
- return !result.success;
42
- }
43
- var IxfxError$1 = class IxfxError extends Error {
44
- cause;
45
- constructor(message, cause) {
46
- super(message);
47
- this.cause = cause;
48
- }
49
- static fromError(error, cause) {
50
- const message = error.message;
51
- const stack = error.stack;
52
- const name = error.name;
53
- const newError = new IxfxError(message, cause);
54
- newError.stack = stack;
55
- newError.name = `IxfxError(${name})`;
56
- return newError;
57
- }
58
- static fromString(message, cause) {
59
- const newError = new IxfxError(message, cause);
60
- newError.name = `IxfxError`;
61
- return newError;
62
- }
63
- };
64
- /**
65
- * Gets the result as an Error
66
- * @param result
67
- */
68
- function resultToError$1(result) {
69
- if (typeof result.error === `string`) return IxfxError$1.fromString(result.error, result.info);
70
- if (result.error instanceof Error) return IxfxError$1.fromError(result.error, result.info);
71
- return IxfxError$1.fromString(JSON.stringify(result.error), result.info);
72
- }
73
- /**
74
- * Returns the error as a string.
75
- * @param result
76
- */
77
- function resultErrorToString(result) {
78
- if (result.error instanceof Error) return getErrorMessage(result.error);
79
- if (typeof result.error === `string`) return result.error;
80
- return JSON.stringify(result.error);
81
- }
82
- /**
83
- * Returns a {@link ResultError} using 'error' as the message.
84
- * @param error
85
- * @param info
86
- */
87
- function errorResult(error, info) {
88
- return {
89
- success: false,
90
- error,
91
- info
92
- };
93
- }
94
- /**
95
- * Returns first failed result or final value.
96
- * @param results
97
- */
98
- function resultsCollate(...results) {
99
- let rr;
100
- for (const r of results) {
101
- if (typeof r === `boolean`) {
102
- if (r) continue;
103
- return {
104
- success: false,
105
- error: `Guard failed: false result`
106
- };
107
- }
108
- rr = typeof r === `object` ? r : r();
109
- if (rr === void 0) continue;
110
- if (!rr.success) return rr;
111
- }
112
- if (!rr) throw new Error(`No results`);
113
- return rr;
114
- }
115
- /**
116
- * Checks if `t` is not a number or within specified range.
117
- * Returns `[false, reason:string]` if invalid or `[true]` if valid.
118
- *
119
- * Alternatives: {@link integerTest} for additional integer check, {@link percentTest} for percentage-range.
120
- *
121
- * * (empty, default): must be a number type and not NaN.
122
- * * finite: must be a number, not NaN and not infinite
123
- * * positive: must be at least zero
124
- * * negative: must be zero or lower
125
- * * aboveZero: must be above zero
126
- * * belowZero: must be below zero
127
- * * percentage: must be within 0-1, inclusive
128
- * * nonZero: can be anything except zero
129
- * * bipolar: can be -1 to 1, inclusive
130
- * @param value Value to check
131
- * @param parameterName Name of parameter (for more helpful exception messages)
132
- * @param range Range to enforce
133
- * @returns
134
- */
135
- const numberTest = (value, range = ``, parameterName = `?`, info) => {
136
- if (value === null) return {
137
- success: false,
138
- error: `Parameter '${parameterName}' is null`,
139
- info
140
- };
141
- if (typeof value === `undefined`) return {
142
- success: false,
143
- error: `Parameter '${parameterName}' is undefined`,
144
- info
145
- };
146
- if (Number.isNaN(value)) return {
147
- success: false,
148
- error: `Parameter '${parameterName}' is NaN`,
149
- info
150
- };
151
- if (typeof value !== `number`) return {
152
- success: false,
153
- error: `Parameter '${parameterName}' is not a number (${JSON.stringify(value)})`,
154
- info
155
- };
156
- switch (range) {
157
- case `finite`:
158
- if (!Number.isFinite(value)) return {
159
- success: false,
160
- error: `Parameter '${parameterName} must be finite (Got: ${value})`,
161
- info
162
- };
163
- break;
164
- case `positive`:
165
- if (value < 0) return {
166
- success: false,
167
- error: `Parameter '${parameterName}' must be at least zero (${value})`,
168
- info
169
- };
170
- break;
171
- case `negative`:
172
- if (value > 0) return {
173
- success: false,
174
- error: `Parameter '${parameterName}' must be zero or lower (${value})`,
175
- info
176
- };
177
- break;
178
- case `aboveZero`:
179
- if (value <= 0) return {
180
- success: false,
181
- error: `Parameter '${parameterName}' must be above zero (${value})`,
182
- info
183
- };
184
- break;
185
- case `belowZero`:
186
- if (value >= 0) return {
187
- success: false,
188
- error: `Parameter '${parameterName}' must be below zero (${value})`,
189
- info
190
- };
191
- break;
192
- case `percentage`:
193
- if (value > 1 || value < 0) return {
194
- success: false,
195
- error: `Parameter '${parameterName}' must be in percentage range (0 to 1). (${value})`,
196
- info
197
- };
198
- break;
199
- case `nonZero`:
200
- if (value === 0) return {
201
- success: false,
202
- error: `Parameter '${parameterName}' must non-zero. (${value})`,
203
- info
204
- };
205
- break;
206
- case `bipolar`:
207
- if (value > 1 || value < -1) return {
208
- success: false,
209
- error: `Parameter '${parameterName}' must be in bipolar percentage range (-1 to 1). (${value})`,
210
- info
211
- };
212
- break;
213
- }
214
- return {
215
- success: true,
216
- value,
217
- info
218
- };
219
- };
220
- /**
221
- * Returns test of `value` being in the range of 0-1.
222
- * Equiv to `number(value, `percentage`);`
223
- *
224
- * This is the same as calling ```number(t, `percentage`)```
225
- * @param value Value to check
226
- * @param parameterName Param name for customising exception message
227
- * @returns
228
- */
229
- const percentTest = (value, parameterName = `?`, info) => numberTest(value, `percentage`, parameterName, info);
230
- /**
231
- * Checks if `value` an integer and meets additional criteria.
232
- * See {@link numberTest} for guard details, or use that if integer checking is not required.
233
- *
234
- * Note:
235
- * * `bipolar` will mean -1, 0 or 1.
236
- * * positive: must be at least zero
237
- * * negative: must be zero or lower
238
- * * aboveZero: must be above zero
239
- * * belowZero: must be below zero
240
- * * percentage: must be within 0-1, inclusive
241
- * * nonZero: can be anything except zero
242
- * @param value Value to check
243
- * @param parameterName Param name for customising exception message
244
- * @param range Guard specifier.
245
- */
246
- const integerTest = (value, range = ``, parameterName = `?`) => {
247
- return resultsCollate(numberTest(value, range, parameterName), () => {
248
- if (!Number.isInteger(value)) return {
249
- success: false,
250
- error: `Param '${parameterName}' is not an integer`
251
- };
252
- return {
253
- success: true,
254
- value
255
- };
256
- });
257
- };
258
- const numberInclusiveRangeTest = (value, min, max, parameterName = `?`) => {
259
- if (typeof value !== `number`) return {
260
- success: false,
261
- error: `Param '${parameterName}' is not a number type. Got type: '${typeof value}' value: '${JSON.stringify(value)}'`
262
- };
263
- if (Number.isNaN(value)) return {
264
- success: false,
265
- error: `Param '${parameterName}' is not within range ${min}-${max}. Got: NaN`
266
- };
267
- if (Number.isFinite(value)) {
268
- if (value < min) return {
269
- success: false,
270
- error: `Param '${parameterName}' is below range ${min}-${max}. Got: ${value}`
271
- };
272
- else if (value > max) return {
273
- success: false,
274
- error: `Param '${parameterName}' is above range ${min}-${max}. Got: ${value}`
275
- };
276
- return {
277
- success: true,
278
- value
279
- };
280
- } else return {
281
- success: false,
282
- error: `Param '${parameterName}' is not within range ${min}-${max}. Got: infinite`
283
- };
284
- };
285
- const nullUndefTest = (value, parameterName = `?`) => {
286
- if (typeof value === `undefined`) return {
287
- success: false,
288
- error: `${parameterName} param is undefined`
289
- };
290
- if (value === null) return {
291
- success: false,
292
- error: `${parameterName} param is null`
293
- };
294
- return {
295
- success: true,
296
- value
297
- };
298
- };
299
- const functionTest$1 = (value, parameterName = `?`) => {
300
- if (value === void 0) return {
301
- success: false,
302
- error: `Param '${parameterName}' is undefined. Expected: function.`
303
- };
304
- if (value === null) return {
305
- success: false,
306
- error: `Param '${parameterName}' is null. Expected: function.`
307
- };
308
- if (typeof value !== `function`) return {
309
- success: false,
310
- error: `Param '${parameterName}' is type '${typeof value}'. Expected: function`
311
- };
312
- return {
313
- success: true,
314
- value
315
- };
316
- };
317
- /**
318
- * Throws an error if parameter is not an string
319
- * @param value
320
- * @param parameterName
321
- */
322
- function stringTest(value, range = ``, parameterName = `?`) {
323
- if (typeof value !== `string`) return {
324
- success: false,
325
- error: `Param '${parameterName} is not type string. Got: ${typeof value}`
326
- };
327
- switch (range) {
328
- case `non-empty`:
329
- if (value.length === 0) return {
330
- success: false,
331
- error: `Param '${parameterName} is empty`
332
- };
333
- break;
334
- }
335
- return {
336
- success: true,
337
- value
338
- };
339
- }
340
- //#endregion
341
- //#region node_modules/.pnpm/@ixfx+arrays@0.56.13/node_modules/@ixfx/arrays/dist/index.js
342
- /**
343
- * If any of `results` is an error, throws it, otherwise ignored.
344
- * @param results
345
- * @returns _true_ or throws
346
- */
347
- function resultThrow(...results) {
348
- for (const r of results) {
349
- if (r === void 0) continue;
350
- if (typeof r === `boolean`) if (!r) throw IxfxError.fromString(`Guard failed: false result`);
351
- else continue;
352
- const rr = typeof r === `object` ? r : r();
353
- if (rr === void 0) continue;
354
- if (rr.success) continue;
355
- throw resultToError(rr);
356
- }
357
- return true;
358
- }
359
- var IxfxError = class IxfxError extends Error {
360
- cause;
361
- constructor(message, cause) {
362
- super(message);
363
- this.cause = cause;
364
- }
365
- static fromError(error, cause) {
366
- const message = error.message;
367
- const stack = error.stack;
368
- const name = error.name;
369
- const newError = new IxfxError(message, cause);
370
- newError.stack = stack;
371
- newError.name = `IxfxError(${name})`;
372
- return newError;
373
- }
374
- static fromString(message, cause) {
375
- const newError = new IxfxError(message, cause);
376
- newError.name = `IxfxError`;
377
- return newError;
378
- }
379
- };
380
- /**
381
- * Gets the result as an Error
382
- * @param result
383
- */
384
- function resultToError(result) {
385
- if (typeof result.error === `string`) return IxfxError.fromString(result.error, result.info);
386
- if (result.error instanceof Error) return IxfxError.fromError(result.error, result.info);
387
- return IxfxError.fromString(JSON.stringify(result.error), result.info);
388
- }
389
- /**
390
- * Throws an error if parameter is not an array
391
- * @param value
392
- * @param parameterName
393
- */
394
- const arrayTest = (value, parameterName = `?`) => {
395
- if (!Array.isArray(value)) return {
396
- success: false,
397
- error: `Parameter '${parameterName}' is expected to be an array'`
398
- };
399
- return {
400
- success: true,
401
- value
402
- };
403
- };
404
- const functionTest = (value, parameterName = `?`) => {
405
- if (value === void 0) return {
406
- success: false,
407
- error: `Param '${parameterName}' is undefined. Expected: function.`
408
- };
409
- if (value === null) return {
410
- success: false,
411
- error: `Param '${parameterName}' is null. Expected: function.`
412
- };
413
- if (typeof value !== `function`) return {
414
- success: false,
415
- error: `Param '${parameterName}' is type '${typeof value}'. Expected: function`
416
- };
417
- return {
418
- success: true,
419
- value
420
- };
421
- };
422
- /**
423
- * If input is a string, it is returned.
424
- * Otherwise, it returns the result of JSON.stringify() with fields ordered.
425
- *
426
- * This allows for more consistent comparisons when object field orders are different but values the same.
427
- * @param itemToMakeStringFor
428
- * @returns
429
- */
430
- /**
431
- * Default comparer function is equiv to checking `a === b`.
432
- * Use {@link isEqualValueDefault} to compare by value, via comparing JSON string representation.
433
- */
434
- const isEqualDefault = (a, b) => a === b;
435
- /**
436
- * Returns _true_ if array contains duplicate instances based on `===` equality checking.
437
- *
438
- * ```js
439
- * const o1 = { hello: `there` };
440
- * const o2 = { hello: `there` };
441
- * containsDuplicateInstances([ o1, o2 ]); // False
442
- * containsDuplicateInstances([ o1, o1 ]); // True
443
- * ```
444
- *
445
- * Primitive values are compared by value:
446
- * ```js
447
- * containsDuplicateInstances([ 1, 2, 1 ]); // True
448
- * containsDuplicateInstances([ `a`, `b`, `a` ]); // True
449
- * ```
450
- *
451
- * Use {@link containsDuplicateValues} if you'd rather compare by value.
452
- * @param array
453
- * @throws {TypeError} If `array` parameter is not an array
454
- * @returns
455
- */
456
- const containsDuplicateInstances = (array) => {
457
- resultThrow(arrayTest(array, `array`));
458
- for (let index = 0; index < array.length; index++) for (let x = 0; x < array.length; x++) {
459
- if (index === x) continue;
460
- if (array[index] === array[x]) return true;
461
- }
462
- return false;
463
- };
464
- /**
465
- * Yields pairs made up of overlapping items from the input array.
466
- *
467
- * Throws an error if there are less than two entries.
468
- *
469
- * ```js
470
- * pairwise([1, 2, 3, 4, 5]);
471
- * Yields:
472
- * [ [1,2], [2,3], [3,4], [4,5] ]
473
- * ```
474
- * @param values
475
- */
476
- function* pairwise(values) {
477
- resultThrow(arrayTest(values, `values`));
478
- if (values.length < 2) throw new Error(`Array needs to have at least two entries. Length: ${values.length}`);
479
- for (let index = 1; index < values.length; index++) yield [values[index - 1], values[index]];
480
- }
481
- /**
482
- * Returns an array with value(s) omitted.
483
- *
484
- * If value is not found, result will be a copy of input.
485
- * Value checking is completed via the provided `comparer` function.
486
- * By default checking whether `a === b`. To compare based on value, use the `isEqualValueDefault` comparer.
487
- *
488
- * @example
489
- * ```js
490
- * const data = [100, 20, 40];
491
- * const filtered = without(data, 20); // [100, 40]
492
- * ```
493
- *
494
- * @example Using value-based comparison
495
- * ```js
496
- * const data = [{ name: `Alice` }, { name:`Sam` }];
497
- *
498
- * // This wouldn't work as expected, because the default comparer uses instance,
499
- * // not value:
500
- * without(data, { name: `Alice` });
501
- *
502
- * // So instead we can use a value comparer:
503
- * without(data, { name:`Alice` }, isEqualValueDefault);
504
- * ```
505
- *
506
- * @example Use a function
507
- * ```js
508
- * const data = [ { name: `Alice` }, { name:`Sam` }];
509
- * without(data, { name:`ALICE` }, (a, b) => {
510
- * return (a.name.toLowerCase() === b.name.toLowerCase());
511
- * });
512
- * ```
513
- *
514
- * Consider {@link remove} to remove an item by index.
515
- *
516
- * @typeParam V - Type of array items
517
- * @param sourceArray Source array
518
- * @param toRemove Value(s) to remove
519
- * @param comparer Comparison function. If not provided `isEqualDefault` is used, which compares using `===`
520
- * @throws {TypeError} If `sourceArray` is not an array, or compare function is not a function
521
- * @return Copy of array without value.
522
- */
523
- const without = (sourceArray, toRemove, comparer = isEqualDefault) => {
524
- resultThrow(arrayTest(sourceArray, `sourceArray`), functionTest(comparer, `comparer`));
525
- if (Array.isArray(toRemove)) {
526
- const returnArray = [];
527
- for (const source of sourceArray) if (!toRemove.some((v) => comparer(source, v))) returnArray.push(source);
528
- return returnArray;
529
- } else return sourceArray.filter((v) => !comparer(v, toRemove));
530
- };
531
- //#endregion
532
- //#region node_modules/.pnpm/@ixfx+numbers@0.56.13/node_modules/@ixfx/numbers/dist/index.js
533
- /**
534
- * Returns the dot product of arbitrary-sized arrays. Assumed they are of the same length.
535
- * @param values
536
- * @param nonNumber What to do if array contains an invalid number. Error: throw an exception, 'treat-as-zero' use as 0 instead, 'ignore', let math run with invalid number
537
- * @returns
538
- */
539
- const dotProduct = (values, nonNumber = `ignore`) => {
540
- let r = 0;
541
- const length = values[0].length;
542
- for (let index = 0; index < length; index++) {
543
- let t = 0;
544
- for (const [p, value] of values.entries()) {
545
- let v = value[index];
546
- if (Number.isNaN(v) || !Number.isFinite(v)) {
547
- if (nonNumber === `treat-as-zero`) v = 0;
548
- else if (nonNumber === `error`) throw new TypeError(`Invalid number at index ${index},${p}`);
549
- }
550
- if (p === 0) t = v;
551
- else t *= v;
552
- }
553
- r += t;
554
- }
555
- return r;
556
- };
557
- /**
558
- * Clamps a value between min and max (both inclusive)
559
- * Defaults to a 0-1 range, useful for percentages.
560
- *
561
- * @example Usage
562
- * ```js
563
- * // 0.5 - just fine, within default of 0 to 1
564
- * clamp(0.5);
565
- * // 1 - above default max of 1
566
- * clamp(1.5);
567
- * // 0 - below range
568
- * clamp(-50, 0, 100);
569
- * // 50 - within range
570
- * clamp(50, 0, 50);
571
- * ```
572
- *
573
- * For clamping integer ranges, consider {@link clampIndex }
574
- * For clamping `{ x, y }` points, consider {@link https://api.ixfx.fun/_ixfx/geometry/Points/clamp/ @ixfx/geometry/Points.clamp}.
575
- * For clamping bipolar values: {@link Bipolar.clamp}
576
- * @param value Value to clamp
577
- * @param min value (inclusive)
578
- * @param max value (inclusive)
579
- * @returns Clamped value
580
- */
581
- function clamp(value, min = 0, max = 1) {
582
- if (Number.isNaN(value)) throw new Error(`Param 'value' is NaN`);
583
- if (Number.isNaN(min)) throw new Error(`Param 'min' is NaN`);
584
- if (Number.isNaN(max)) throw new Error(`Param 'max' is NaN`);
585
- if (value < min) return min;
586
- if (value > max) return max;
587
- return value;
588
- }
589
- /**
590
- * Returns a function that clamps values.
591
- *
592
- * ```js
593
- * const c = clamper(0,100);
594
- * c(50); // 50
595
- * c(101); // 100
596
- * c(-5); // 0
597
- * ```
598
- * @param min Minimum value. Default: 0
599
- * @param max Maximum value. Default: 1
600
- */
601
- function clamper(min = 0, max = 1) {
602
- if (Number.isNaN(min)) throw new Error(`Param 'min' is NaN`);
603
- if (Number.isNaN(max)) throw new Error(`Param 'max' is NaN`);
604
- return (v) => {
605
- if (v > max) return max;
606
- if (v < min) return min;
607
- return v;
608
- };
609
- }
610
- /**
611
- * Wraps floating point numbers to be within a range (default: 0..1). Use {@link wrapInteger} if you want to wrap integer values.
612
- *
613
- * This logic makes sense for some things like rotation angle.
614
- *
615
- * If you just want to lock values to a range without wrapping, consider {@link clamp}.
616
- *
617
- * ```js
618
- * wrap(1.2); // 0.2
619
- * wrap(2); // 1.0
620
- * wrap(-0.2); // 0.8
621
- * ```
622
- *
623
- * A range can be provided too:
624
- * ```js
625
- * wrap(30, 20, 50); // 30
626
- * wrap(60, 20, 50); // 30
627
- * ```
628
- * @param v
629
- * @param min
630
- * @param max
631
- * @returns
632
- */
633
- const wrap = (v, min = 0, max = 1) => {
634
- resultThrow$1(numberTest(v, ``, `min`), numberTest(min, ``, `min`), numberTest(max, ``, `max`));
635
- if (v === min) return min;
636
- if (v === max) return min;
637
- while (v <= min || v >= max) {
638
- if (v === max) break;
639
- if (v === min) break;
640
- if (v > max) v = min + (v - max);
641
- else if (v < min) v = max - (min - v);
642
- }
643
- return v;
644
- };
645
- Math.PI * 2;
646
- /**
647
- * Interpolates between `a` and `b` by `amount`. Aka `lerp`.
648
- *
649
- * [ixfx Guide on Interpolation](https://ixfx.fun/data/interpolation/overview/)
650
- *
651
- * @example Get the halfway point between 30 and 60
652
- * ```js
653
- * interpolate(0.5, 30, 60);
654
- * ```
655
- *
656
- * See also {@link interpolatorStepped} and {@link https://api.ixfx.fun/_ixfx/modulation/interpolatorInterval/} for functions
657
- * which help to manage progression from A->B over steps or interval.
658
- *
659
- * Usually interpolation amount is on a 0...1 scale, inclusive. What is the interpolation result
660
- * if this scale is exceeded? By default it is clamped to 0..1, so the return value is always between `a` and `b` (inclusive).
661
- *
662
- * Alternatively, set the `limits` option to process `amount`:
663
- * * 'wrap': wrap amount, eg 1.5 is the same as 0.5, 2 is the same as 1
664
- * * 'ignore': allow exceeding values. eg 1.5 will yield b*1.5.
665
- * * 'clamp': default behaviour of clamping interpolation amount to 0..1
666
- *
667
- * Interpolation can be non-linear using 'easing' option or 'transform' funciton.
668
- * ```js
669
- * interpolate(0.1, 0, 100, { easing: `quadIn` });
670
- * ```
671
- * There are a few variations when calling `interpolate`, depending on what parameters are fixed.
672
- * * `interpolate(amount)`: returns a function that needs a & b
673
- * * `interpolate(a, b)`: returns a function that needs the interpolation amount
674
- */
675
- function interpolate(pos1, pos2, pos3, pos4) {
676
- let amountProcess;
677
- let limits = `clamp`;
678
- const handleAmount = (amount) => {
679
- if (amountProcess) amount = amountProcess(amount);
680
- if (limits === void 0 || limits === `clamp`) amount = clamp(amount);
681
- else if (limits === `wrap`) {
682
- if (amount > 1) amount = amount % 1;
683
- else if (amount < 0) amount = 1 + amount % 1;
684
- }
685
- return amount;
686
- };
687
- const doTheEase = (_amt, _a, _b) => {
688
- resultThrow$1(numberTest(_a, ``, `a`), numberTest(_b, ``, `b`), numberTest(_amt, ``, `amount`));
689
- _amt = handleAmount(_amt);
690
- return (1 - _amt) * _a + _amt * _b;
691
- };
692
- const readOpts = (o = {}) => {
693
- if (o.transform !== void 0) {
694
- if (typeof o.transform !== `function`) throw new Error(`Param 'transform' is expected to be a function. Got: ${typeof o.transform}`);
695
- amountProcess = o.transform;
696
- }
697
- limits = o.limits ?? `clamp`;
698
- };
699
- const rawEase = (_amt, _a, _b) => (1 - _amt) * _a + _amt * _b;
700
- if (typeof pos1 !== `number`) throw new TypeError(`First param is expected to be a number. Got: ${typeof pos1}`);
701
- if (typeof pos2 === `number`) {
702
- let a;
703
- let b;
704
- if (pos3 === void 0 || typeof pos3 === `object`) {
705
- a = pos1;
706
- b = pos2;
707
- readOpts(pos3);
708
- return (amount) => doTheEase(amount, a, b);
709
- } else if (typeof pos3 === `number`) {
710
- a = pos2;
711
- b = pos3;
712
- readOpts(pos4);
713
- return doTheEase(pos1, a, b);
714
- } else throw new Error(`Values for 'a' and 'b' not defined`);
715
- } else if (pos2 === void 0 || typeof pos2 === `object`) {
716
- const amount = handleAmount(pos1);
717
- readOpts(pos2);
718
- resultThrow$1(numberTest(amount, ``, `amount`));
719
- return (aValue, bValue) => rawEase(amount, aValue, bValue);
720
- }
721
- }
722
- /**
723
- * Rounds a number.
724
- *
725
- * If one parameter is given, it's the decimal places,
726
- * and a rounding function is returned:
727
- * ```js
728
- * const r = round(2);
729
- * r(10.12355); // 10.12
730
- * ```
731
- *
732
- * If two parameters are given, the first is decimal places,
733
- * the second the value to round.
734
- * ```js
735
- * round(2, 10.12355); // 10.12
736
- * ```
737
- * @param decimalPlaces
738
- * @returns
739
- */
740
- function round(a, b, roundUp) {
741
- resultThrow$1(integerTest(a, `positive`, `decimalPlaces`));
742
- const up = typeof b === `boolean` ? b : roundUp ?? false;
743
- let rounder;
744
- if (a === 0) rounder = Math.round;
745
- else {
746
- const p = Math.pow(10, a);
747
- if (up) rounder = (v) => Math.ceil(v * p) / p;
748
- else rounder = (v) => Math.floor(v * p) / p;
749
- }
750
- if (typeof b === `number`) return rounder(b);
751
- return rounder;
752
- }
753
- Math.PI * 2;
754
- /**
755
- * A moving average calculator (exponential weighted moving average) which does not keep track of
756
- * previous samples. Less accurate, but uses less system resources.
757
- *
758
- * The `scaling` parameter determines smoothing. A value of `1` means that
759
- * the latest value is used as the average - that is, no smoothing. Higher numbers
760
- * introduce progressively more smoothing by weighting the accumulated prior average more heavily.
761
- *
762
- * ```
763
- * const ma = movingAverageLight(); // default scaling of 3
764
- * ma(50); // 50
765
- * ma(100); // 75
766
- * ma(75); // 75
767
- * ma(0); // 50
768
- * ```
769
- *
770
- * Note that the final average of 50 is pretty far from the last value of 0. To make it more responsive,
771
- * we could use a lower scaling factor: `movingAverageLight(2)`. This yields a final average of `37.5` instead.
772
- *
773
- * @param scaling Scaling factor. 1 is no smoothing. Default: 3
774
- * @returns Function that adds to average.
775
- */
776
- const movingAverageLight = (scaling = 3) => {
777
- resultThrow$1(numberTest(scaling, `aboveZero`, `scaling`));
778
- let average = 0;
779
- let count = 0;
780
- return (v) => {
781
- if (numberTest(v, ``, `v`).success && v !== void 0) {
782
- count++;
783
- average = average + (v - average) / Math.min(count, scaling);
784
- }
785
- return average;
786
- };
787
- };
788
- /**
789
- * Rounds `v` by `every`. Middle values are rounded up by default.
790
- *
791
- * ```js
792
- * quantiseEvery(11, 10); // 10
793
- * quantiseEvery(25, 10); // 30
794
- * quantiseEvery(0, 10); // 0
795
- * quantiseEvery(4, 10); // 0
796
- * quantiseEvery(100, 10); // 100
797
- * ```
798
- *
799
- * Also works with decimals
800
- * ```js
801
- * quantiseEvery(1.123, 0.1); // 1.1
802
- * quantiseEvery(1.21, 0.1); // 1.2
803
- * ```
804
- *
805
- * @param v Value to quantise
806
- * @param every Number to quantise to
807
- * @param middleRoundsUp If _true_ (default), the exact middle rounds up to next step.
808
- * @returns
809
- */
810
- const quantiseEvery = (v, every, middleRoundsUp = true) => {
811
- const everyString = every.toString();
812
- const decimal = everyString.indexOf(`.`);
813
- let multiplier = 1;
814
- if (decimal >= 0) {
815
- multiplier = 10 * everyString.substring(decimal + 1).length;
816
- every = Math.floor(multiplier * every);
817
- v = v * multiplier;
818
- }
819
- resultThrow$1(numberTest(v, ``, `v`), integerTest(every, ``, `every`));
820
- let div = v / every;
821
- const divModule = div % 1;
822
- div = Math.floor(div);
823
- if (divModule === .5 && middleRoundsUp || divModule > .5) div++;
824
- return every * div / multiplier;
825
- };
826
- /**
827
- * Scales `v` from an input range to an output range (aka `map`)
828
- *
829
- * For example, if a sensor's useful range is 100-500, scale it to a percentage:
830
- *
831
- * ```js
832
- *
833
- * scale(sensorReading, 100, 500, 0, 1);
834
- * ```
835
- *
836
- * `scale` defaults to a percentage-range output, so you can get away with:
837
- * ```js
838
- * scale(sensorReading, 100, 500);
839
- * ```
840
- *
841
- * If `v` is outside of the input range, it will likewise be outside of the output range.
842
- * Use {@link scaleClamped} to clip value to range.
843
- *
844
- * If inMin and inMax are equal, outMax will be returned.
845
- *
846
- * An easing function can be provided for non-linear scaling. In this case
847
- * the input value is 'pre scaled' using the function before it is applied to the
848
- * output range.
849
- *
850
- * ```js
851
- * scale(sensorReading, 100, 500, 0, 1, Easings.gaussian());
852
- * ```
853
- * @param v Value to scale
854
- * @param inMin Input minimum
855
- * @param inMax Input maximum
856
- * @param outMin Output minimum. If not specified, 0
857
- * @param outMax Output maximum. If not specified, 1
858
- * @param easing Easing function
859
- * @returns Scaled value
860
- */
861
- const scale = (v, inMin, inMax, outMin, outMax, easing) => scaler(inMin, inMax, outMin, outMax, easing)(v);
862
- /**
863
- * Returns a scaling function
864
- * @param inMin Input minimum
865
- * @param inMax Input maximum
866
- * @param outMin Output minimum. If not specified, 0
867
- * @param outMax Output maximum. If not specified, 1
868
- * @param easing Easing function
869
- * @param clamped If true, value is clamped. Default: false
870
- * @returns
871
- */
872
- const scaler = (inMin, inMax, outMin, outMax, easing, clamped) => {
873
- resultThrow$1(numberTest(inMin, `finite`, `inMin`), numberTest(inMax, `finite`, `inMax`));
874
- const oMax = outMax ?? 1;
875
- const oMin = outMin ?? 0;
876
- const clampFunction = clamped ? clamper(outMin, outMax) : void 0;
877
- return (v) => {
878
- if (inMin === inMax) return oMax;
879
- let a = (v - inMin) / (inMax - inMin);
880
- if (easing !== void 0) a = easing(a);
881
- const x = a * (oMax - oMin) + oMin;
882
- if (clampFunction) return clampFunction(x);
883
- return x;
884
- };
885
- };
886
- /**
887
- * As {@link scale}, but result is clamped to be
888
- * within `outMin` and `outMax`. Useful if you can't be sure
889
- * that `v` is in 0..1 range.
890
- *
891
- * @param value
892
- * @param inMin
893
- * @param inMax
894
- * @param outMin 1 by default
895
- * @param outMax 0 by default d
896
- * @param easing
897
- * @returns
898
- */
899
- const scaleClamped = (value, inMin, inMax, outMin, outMax, easing) => {
900
- if (typeof outMax === `undefined`) outMax = 1;
901
- if (typeof outMin === `undefined`) outMin = 0;
902
- if (inMin === inMax) return outMax;
903
- return clamp(scale(value, inMin, inMax, outMin, outMax, easing), outMin, outMax);
904
- };
905
- /**
906
- * Returns an empty range:
907
- * ```js
908
- * {
909
- * min: Number.MAX_SAFE_INTEGER,
910
- * max: Number.MIN_SAFE_INTEGER
911
- * }
912
- * ```
913
- * @returns
914
- */
915
- const rangeInit = () => ({
916
- min: Number.MAX_SAFE_INTEGER,
917
- max: Number.MIN_SAFE_INTEGER
918
- });
919
- /**
920
- * Keeps track of min/max values.
921
- *
922
- * ```js
923
- * const s = rangeStream();
924
- * s.seen(10); // { min: 10, max: 10 }
925
- * s.seen(5); // { min: 5, max: 10 }
926
- * ```
927
- *
928
- * When calling `seen()`, non-numbers, or non-finite numbers are silently ignored.
929
- *
930
- * ```js
931
- * s.reset(); // Reset
932
- * s.min/s.max; // Current min/max
933
- * s.range; // Current { min, max }
934
- * ```
935
- * @param initWith
936
- * @returns
937
- */
938
- const rangeStream = (initWith = rangeInit()) => {
939
- let { min, max } = initWith;
940
- const seen = (v) => {
941
- if (typeof v === `number`) {
942
- if (!Number.isNaN(v) && Number.isFinite(v)) {
943
- min = Math.min(min, v);
944
- max = Math.max(max, v);
945
- }
946
- }
947
- return {
948
- min,
949
- max
950
- };
951
- };
952
- const reset = () => {
953
- min = Number.MAX_SAFE_INTEGER;
954
- max = Number.MIN_SAFE_INTEGER;
955
- return {
956
- min,
957
- max
958
- };
959
- };
960
- return {
961
- seen,
962
- reset,
963
- get range() {
964
- return {
965
- min,
966
- max
967
- };
968
- },
969
- get min() {
970
- return min;
971
- },
972
- get max() {
973
- return max;
974
- }
975
- };
976
- };
977
- //#endregion
978
- export { resultThrow$1 as C, percentTest as S, throwIfFailed as T, functionTest$1 as _, movingAverageLight as a, numberInclusiveRangeTest as b, round as c, scaler as d, wrap as f, errorResult as g, without as h, interpolate as i, scale as l, pairwise as m, clamper as n, quantiseEvery as o, containsDuplicateInstances as p, dotProduct as r, rangeStream as s, clamp as t, scaleClamped as u, integerTest as v, stringTest as w, numberTest as x, nullUndefTest as y };
979
-
980
- //# sourceMappingURL=dist-CA13FvMn.js.map