@ixfx/components 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/bundle/index.d.ts +1086 -603
  2. package/bundle/index.d.ts.map +1 -1
  3. package/bundle/index.js +16153 -15296
  4. package/bundle/index.js.map +1 -1
  5. package/bundle/style.css +14 -4
  6. package/dist/ac-text.d.ts.map +1 -1
  7. package/dist/ac-text.js +11 -6
  8. package/dist/ac-text.js.map +1 -1
  9. package/dist/{button-DMt5XWUK.js → button-C3fLMKUv.js} +4 -4
  10. package/dist/{button-DMt5XWUK.js.map → button-C3fLMKUv.js.map} +1 -1
  11. package/dist/button.d.ts +1 -1
  12. package/dist/button.d.ts.map +1 -1
  13. package/dist/button.js +1 -1
  14. package/dist/checkbox.d.ts +2 -2
  15. package/dist/checkbox.d.ts.map +1 -1
  16. package/dist/checkbox.js +14 -8
  17. package/dist/checkbox.js.map +1 -1
  18. package/dist/{colour-C3MQIjFJ-BLXg8W3U.js → colour-C3MQIjFJ-vRCdr8W-.js} +146 -552
  19. package/dist/colour-C3MQIjFJ-vRCdr8W-.js.map +1 -0
  20. package/dist/{colour-picker-K6zu82lm.js → colour-picker-0sgAha1T.js} +14 -9
  21. package/dist/colour-picker-0sgAha1T.js.map +1 -0
  22. package/dist/colour-picker.d.ts +1 -1
  23. package/dist/colour-picker.js +1 -1
  24. package/dist/crumbs.d.ts +1 -1
  25. package/dist/crumbs.d.ts.map +1 -1
  26. package/dist/crumbs.js +11 -6
  27. package/dist/crumbs.js.map +1 -1
  28. package/dist/data-display.d.ts +9 -4
  29. package/dist/data-display.d.ts.map +1 -1
  30. package/dist/data-display.js +270 -43
  31. package/dist/data-display.js.map +1 -1
  32. package/dist/data-provider-DgI909FP.js +23 -0
  33. package/dist/data-provider-DgI909FP.js.map +1 -0
  34. package/dist/{decorate-D7rC1gLP.js → decorate-DdjvVHS-.js} +2 -2
  35. package/dist/{decorate-D7rC1gLP.js.map → decorate-DdjvVHS-.js.map} +1 -1
  36. package/dist/{defaults-C7elhuyJ.js → defaults-C3b9OWJD.js} +2 -2
  37. package/dist/{defaults-C7elhuyJ.js.map → defaults-C3b9OWJD.js.map} +1 -1
  38. package/dist/{dist-TAGYwaju.js → dist-CA13FvMn.js} +7 -66
  39. package/dist/dist-CA13FvMn.js.map +1 -0
  40. package/dist/editable-label.d.ts.map +1 -1
  41. package/dist/editable-label.js +3 -2
  42. package/dist/editable-label.js.map +1 -1
  43. package/dist/fallbacks-pNMOMx38.js +168 -0
  44. package/dist/fallbacks-pNMOMx38.js.map +1 -0
  45. package/dist/{hex-editor-DlfoA65y.d.ts → hex-editor-CMIxtNgT.d.ts} +1 -1
  46. package/dist/hex-editor-CMIxtNgT.d.ts.map +1 -0
  47. package/dist/{hex-editor-CsN_ySkH.js → hex-editor-WZrjRtvL.js} +3 -3
  48. package/dist/{hex-editor-CsN_ySkH.js.map → hex-editor-WZrjRtvL.js.map} +1 -1
  49. package/dist/hex.d.ts +1 -1
  50. package/dist/hex.js +1 -1
  51. package/dist/{highlight-TPbSHruI.js → highlight-B-eQrhhb.js} +1 -1
  52. package/dist/{highlight-TPbSHruI.js.map → highlight-B-eQrhhb.js.map} +1 -1
  53. package/dist/{icon-Dm_DHDz6.d.ts → icon-Bd5BiU4b.d.ts} +3 -3
  54. package/dist/icon-Bd5BiU4b.d.ts.map +1 -0
  55. package/dist/{icon-9NWTXtE1.js → icon-Ndo40kNO.js} +6 -5
  56. package/dist/icon-Ndo40kNO.js.map +1 -0
  57. package/dist/icons.d.ts +2 -2
  58. package/dist/icons.js +3 -3
  59. package/dist/{incr-search-DSKKsk6w.js → incr-search-CeERfijK.js} +2 -2
  60. package/dist/{incr-search-DSKKsk6w.js.map → incr-search-CeERfijK.js.map} +1 -1
  61. package/dist/incr-search.d.ts +1 -1
  62. package/dist/incr-search.js +2 -2
  63. package/dist/{index-hXFn14tM.d.ts → index-BMjri2-S.d.ts} +2 -2
  64. package/dist/{index-hXFn14tM.d.ts.map → index-BMjri2-S.d.ts.map} +1 -1
  65. package/dist/{index-DSlPeWLK.d.ts → index-CWpNcQKE.d.ts} +5 -5
  66. package/dist/index-CWpNcQKE.d.ts.map +1 -0
  67. package/dist/{index-DLkSKL4T.d.ts → index-CowKi2mo.d.ts} +1 -1
  68. package/dist/index-CowKi2mo.d.ts.map +1 -0
  69. package/dist/{index-B1hNR7Z9.d.ts → index-D87kRcEs.d.ts} +1 -1
  70. package/dist/{index-B1hNR7Z9.d.ts.map → index-D87kRcEs.d.ts.map} +1 -1
  71. package/dist/{index-CnL9krsH.d.ts → index-DgXpCg_G.d.ts} +32 -26
  72. package/dist/index-DgXpCg_G.d.ts.map +1 -0
  73. package/dist/{index-iZLld8Ca.d.ts → index-s_IhSnwc.d.ts} +2 -2
  74. package/dist/index-s_IhSnwc.d.ts.map +1 -0
  75. package/dist/index.d.ts +432 -121
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +2369 -1706
  78. package/dist/index.js.map +1 -1
  79. package/dist/interaction-D6efrBLo.js +1 -0
  80. package/dist/{keyboard-De_vOHLg.js → keyboard-CimiEskD.js} +1 -1
  81. package/dist/{keyboard-De_vOHLg.js.map → keyboard-CimiEskD.js.map} +1 -1
  82. package/dist/{labelled-input-base-CqPL5rKm.js → labelled-input-base-9K_w3oLj.js} +2 -2
  83. package/dist/{labelled-input-base-CqPL5rKm.js.map → labelled-input-base-9K_w3oLj.js.map} +1 -1
  84. package/dist/{labelled-input-base-BVvNeb5R.d.ts → labelled-input-base-ORb1rGq6.d.ts} +2 -2
  85. package/dist/labelled-input-base-ORb1rGq6.d.ts.map +1 -0
  86. package/dist/labelled-radial-input.d.ts +3 -3
  87. package/dist/labelled-radial-input.d.ts.map +1 -1
  88. package/dist/labelled-radial-input.js +7 -6
  89. package/dist/labelled-radial-input.js.map +1 -1
  90. package/dist/labelled-range-input.d.ts +1 -1
  91. package/dist/labelled-range-input.js +2 -2
  92. package/dist/led.d.ts +1 -1
  93. package/dist/led.d.ts.map +1 -1
  94. package/dist/led.js +2 -2
  95. package/dist/led.js.map +1 -1
  96. package/dist/{menu-item-CKRfP0pN.js → menu-item-BrIuORYD.js} +20 -10
  97. package/dist/menu-item-BrIuORYD.js.map +1 -0
  98. package/dist/{menu-item-ClQF2DKN.d.ts → menu-item-COx-Azgj.d.ts} +1 -1
  99. package/dist/menu-item-COx-Azgj.d.ts.map +1 -0
  100. package/dist/{menu-DJJuCm-5.js → menu-vjoiHZ13.js} +30 -17
  101. package/dist/menu-vjoiHZ13.js.map +1 -0
  102. package/dist/menu.d.ts +2 -2
  103. package/dist/menu.js +2 -2
  104. package/dist/miller.d.ts +2 -2
  105. package/dist/miller.d.ts.map +1 -1
  106. package/dist/miller.js +18 -11
  107. package/dist/miller.js.map +1 -1
  108. package/dist/narrowed-text.d.ts.map +1 -1
  109. package/dist/narrowed-text.js +7 -5
  110. package/dist/narrowed-text.js.map +1 -1
  111. package/dist/panel.d.ts +1 -1
  112. package/dist/panel.d.ts.map +1 -1
  113. package/dist/panel.js +5 -4
  114. package/dist/panel.js.map +1 -1
  115. package/dist/plots.d.ts +2 -2
  116. package/dist/plots.js +2 -2
  117. package/dist/polar-pad.d.ts +1 -1
  118. package/dist/polar-pad.d.ts.map +1 -1
  119. package/dist/polar-pad.js +10 -4
  120. package/dist/polar-pad.js.map +1 -1
  121. package/dist/{popup-ImtS9KnS.js → popup-DiWMxsWj.js} +1 -1
  122. package/dist/{popup-ImtS9KnS.js.map → popup-DiWMxsWj.js.map} +1 -1
  123. package/dist/prominence-DlFShic3.js +104 -0
  124. package/dist/prominence-DlFShic3.js.map +1 -0
  125. package/dist/{radial-input-LUSBEycd.d.ts → radial-input-CpQPs1Mp.d.ts} +1 -1
  126. package/dist/radial-input-CpQPs1Mp.d.ts.map +1 -0
  127. package/dist/{radial-input-DZA6WaFu.js → radial-input-DZ7eQCcM.js} +11 -6
  128. package/dist/radial-input-DZ7eQCcM.js.map +1 -0
  129. package/dist/radial-input.d.ts +1 -1
  130. package/dist/radial-input.js +1 -1
  131. package/dist/range-input.d.ts +1 -1
  132. package/dist/range-input.d.ts.map +1 -1
  133. package/dist/range-input.js +9 -4
  134. package/dist/range-input.js.map +1 -1
  135. package/dist/range.d.ts +1 -1
  136. package/dist/range.d.ts.map +1 -1
  137. package/dist/range.js +5 -3
  138. package/dist/range.js.map +1 -1
  139. package/dist/{registry-Q2gYQCHM.js → registry-CkW7q09Q.js} +1 -1
  140. package/dist/{registry-Q2gYQCHM.js.map → registry-CkW7q09Q.js.map} +1 -1
  141. package/dist/selecthorizontal.d.ts +1 -1
  142. package/dist/selecthorizontal.d.ts.map +1 -1
  143. package/dist/selecthorizontal.js +4 -3
  144. package/dist/selecthorizontal.js.map +1 -1
  145. package/dist/snap-container.d.ts.map +1 -1
  146. package/dist/snap-container.js +1 -1
  147. package/dist/split-layout.d.ts +1 -1
  148. package/dist/split-layout.d.ts.map +1 -1
  149. package/dist/split-layout.js +6 -5
  150. package/dist/split-layout.js.map +1 -1
  151. package/dist/style.css +14 -4
  152. package/dist/swipe.d.ts.map +1 -1
  153. package/dist/swipe.js +9 -4
  154. package/dist/swipe.js.map +1 -1
  155. package/dist/{tab-list-BnqISNvO.d.ts → tab-list-DLzb-m-I.d.ts} +2 -2
  156. package/dist/tab-list-DLzb-m-I.d.ts.map +1 -0
  157. package/dist/tabs.d.ts +1 -1
  158. package/dist/tabs.js +10 -4
  159. package/dist/tabs.js.map +1 -1
  160. package/dist/{tickled-controller-Cq1Va0rR.d.ts → tickled-controller-BjYCzGrU.d.ts} +2 -2
  161. package/dist/tickled-controller-BjYCzGrU.d.ts.map +1 -0
  162. package/dist/{tickled-styles-Bg3QbcrD.js → tickled-styles-fNDdqf6l.js} +1 -17
  163. package/dist/{tickled-styles-Bg3QbcrD.js.map → tickled-styles-fNDdqf6l.js.map} +1 -1
  164. package/dist/{timeline-Bh0PhlKW.js → timeline-2OFtN4Ta.js} +2 -2
  165. package/dist/{timeline-Bh0PhlKW.js.map → timeline-2OFtN4Ta.js.map} +1 -1
  166. package/dist/timeline.d.ts +1 -1
  167. package/dist/timeline.js +1 -1
  168. package/dist/{tooltip-DMxmBNky.js → tooltip-CJt3WLmN.js} +1 -1
  169. package/dist/{tooltip-DMxmBNky.js.map → tooltip-CJt3WLmN.js.map} +1 -1
  170. package/dist/{tooltip-CwGfb4lp.d.ts → tooltip-RGVIwHrZ.d.ts} +1 -1
  171. package/dist/{tooltip-CwGfb4lp.d.ts.map → tooltip-RGVIwHrZ.d.ts.map} +1 -1
  172. package/dist/{tree-CvvKbO-f.js → tree-CJWpMUvD.js} +113 -103
  173. package/dist/tree-CJWpMUvD.js.map +1 -0
  174. package/dist/{tree-component-D8Bg48tt.d.ts → tree-component-BcO26Xvt.d.ts} +65 -3
  175. package/dist/tree-component-BcO26Xvt.d.ts.map +1 -0
  176. package/dist/tree.d.ts +15 -15
  177. package/dist/tree.d.ts.map +1 -1
  178. package/dist/tree.js +1 -1
  179. package/dist/{types-BKaqnpwx.d.ts → types-DSfbtHs3.d.ts} +1 -1
  180. package/dist/types-DSfbtHs3.d.ts.map +1 -0
  181. package/dist/{xy-axis-DL0tfJDr.js → xy-axis-CK64haaK.js} +1831 -359
  182. package/dist/xy-axis-CK64haaK.js.map +1 -0
  183. package/dist/{xy-axis-D9uwpGTT.d.ts → xy-axis-McdUpcYr.d.ts} +102 -3
  184. package/dist/xy-axis-McdUpcYr.d.ts.map +1 -0
  185. package/dist/xy-pad.d.ts +1 -1
  186. package/dist/xy-pad.d.ts.map +1 -1
  187. package/dist/xy-pad.js +11 -6
  188. package/dist/xy-pad.js.map +1 -1
  189. package/docs-user/README.md +45 -0
  190. package/docs-user/ac-text.md +67 -0
  191. package/docs-user/ac-token.md +187 -0
  192. package/docs-user/button.md +355 -0
  193. package/docs-user/checkbox.md +62 -0
  194. package/docs-user/colour-picker.md +237 -0
  195. package/docs-user/crumbs.md +66 -0
  196. package/docs-user/data-display.md +98 -0
  197. package/docs-user/editable-label.md +244 -0
  198. package/docs-user/grouped-item-lister.md +424 -0
  199. package/docs-user/icons.md +191 -0
  200. package/docs-user/incr-search.md +94 -0
  201. package/docs-user/labelled-radial-input.md +204 -0
  202. package/docs-user/labelled-range-input.md +194 -0
  203. package/docs-user/led.md +40 -0
  204. package/docs-user/menu.md +319 -0
  205. package/docs-user/miller.md +453 -0
  206. package/docs-user/narrowed-text.md +72 -0
  207. package/docs-user/panel.md +250 -0
  208. package/docs-user/plots.md +361 -0
  209. package/docs-user/polar-pad.md +228 -0
  210. package/docs-user/radial-input.md +559 -0
  211. package/docs-user/range-input.md +264 -0
  212. package/docs-user/range.md +12 -0
  213. package/docs-user/selecthorizontal.md +32 -0
  214. package/docs-user/snap-container.md +132 -0
  215. package/docs-user/split-layout.md +232 -0
  216. package/docs-user/swipe.md +44 -0
  217. package/docs-user/tabs.md +217 -0
  218. package/docs-user/timeline.md +116 -0
  219. package/docs-user/transitory-label.md +120 -0
  220. package/docs-user/tree.md +592 -0
  221. package/docs-user/user-catalog.md +165 -0
  222. package/docs-user/user-theming.md +379 -0
  223. package/docs-user/util.md +122 -0
  224. package/docs-user/vertical-list.md +351 -0
  225. package/docs-user/xy-pad.md +94 -0
  226. package/package.json +18 -17
  227. package/dist/colour-C3MQIjFJ-BLXg8W3U.js.map +0 -1
  228. package/dist/colour-picker-K6zu82lm.js.map +0 -1
  229. package/dist/dist-BX0OVIm7.js +0 -1290
  230. package/dist/dist-BX0OVIm7.js.map +0 -1
  231. package/dist/dist-TAGYwaju.js.map +0 -1
  232. package/dist/hex-editor-DlfoA65y.d.ts.map +0 -1
  233. package/dist/icon-9NWTXtE1.js.map +0 -1
  234. package/dist/icon-Dm_DHDz6.d.ts.map +0 -1
  235. package/dist/index-CnL9krsH.d.ts.map +0 -1
  236. package/dist/index-DLkSKL4T.d.ts.map +0 -1
  237. package/dist/index-DSlPeWLK.d.ts.map +0 -1
  238. package/dist/index-iZLld8Ca.d.ts.map +0 -1
  239. package/dist/interaction-DG7X1rhI.js +0 -1
  240. package/dist/labelled-input-base-BVvNeb5R.d.ts.map +0 -1
  241. package/dist/menu-DJJuCm-5.js.map +0 -1
  242. package/dist/menu-item-CKRfP0pN.js.map +0 -1
  243. package/dist/menu-item-ClQF2DKN.d.ts.map +0 -1
  244. package/dist/prominence--ic9uWBl.js +0 -98
  245. package/dist/prominence--ic9uWBl.js.map +0 -1
  246. package/dist/radial-input-DZA6WaFu.js.map +0 -1
  247. package/dist/radial-input-LUSBEycd.d.ts.map +0 -1
  248. package/dist/tab-list-BnqISNvO.d.ts.map +0 -1
  249. package/dist/tickled-controller-Cq1Va0rR.d.ts.map +0 -1
  250. package/dist/tree-CvvKbO-f.js.map +0 -1
  251. package/dist/tree-component-D8Bg48tt.d.ts.map +0 -1
  252. package/dist/types-BKaqnpwx.d.ts.map +0 -1
  253. package/dist/xy-axis-D9uwpGTT.d.ts.map +0 -1
  254. package/dist/xy-axis-DL0tfJDr.js.map +0 -1
  255. /package/bundle/{chunk-pbuEa-1d.js → chunk-D7D4PA-g.js} +0 -0
  256. /package/dist/{chunk-pbuEa-1d.js → chunk-D7D4PA-g.js} +0 -0
@@ -1,17 +1,5 @@
1
- import { C as resultThrow, S as percentTest, a as movingAverageLight, b as numberInclusiveRangeTest, g as errorResult, i as interpolate, m as pairwise, t as clamp, u as scaleClamped, x as numberTest } from "./dist-TAGYwaju.js";
2
- //#region node_modules/.pnpm/@ixfx+visual@0.56.12/node_modules/@ixfx/visual/dist/chunk-pbuEa-1d.js
3
- var __defProp$2 = Object.defineProperty;
4
- var __exportAll$1 = (all, no_symbols) => {
5
- let target = {};
6
- for (var name in all) __defProp$2(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- if (!no_symbols) __defProp$2(target, Symbol.toStringTag, { value: "Module" });
11
- return target;
12
- };
13
- //#endregion
14
- //#region node_modules/.pnpm/@ixfx+geometry@0.56.12/node_modules/@ixfx/geometry/dist/chunk-pbuEa-1d.js
1
+ import { C as resultThrow, S as percentTest, a as movingAverageLight, b as numberInclusiveRangeTest, g as errorResult, i as interpolate, m as pairwise, t as clamp, u as scaleClamped, x as numberTest } from "./dist-CA13FvMn.js";
2
+ //#region node_modules/.pnpm/@ixfx+visual@0.56.13/node_modules/@ixfx/visual/dist/chunk-pbuEa-1d.js
15
3
  var __defProp$1 = Object.defineProperty;
16
4
  var __exportAll = (all, no_symbols) => {
17
5
  let target = {};
@@ -23,28 +11,28 @@ var __exportAll = (all, no_symbols) => {
23
11
  return target;
24
12
  };
25
13
  //#endregion
26
- //#region node_modules/.pnpm/@ixfx+geometry@0.56.12/node_modules/@ixfx/geometry/dist/guard-CqkBirEd.js
14
+ //#region node_modules/.pnpm/@ixfx+geometry@0.56.13/node_modules/@ixfx/geometry/dist/guard-hlhkAOMZ.js
27
15
  /**
28
16
  * Returns true if xy (and z, if present) are _null_.
29
17
  * @param p
30
- * @returns
18
+ * @returns True if all props are null
31
19
  */
32
- const isNull = (p) => {
20
+ function isNull(p) {
33
21
  if (isPoint3d(p)) {
34
22
  if (p.z !== null) return false;
35
23
  }
36
24
  return p.x === null && p.y === null;
37
- };
25
+ }
38
26
  /***
39
27
  * Returns true if either x, y, z isNaN.
40
28
  */
41
- const isNaN = (p) => {
29
+ function isNaN(p) {
42
30
  if (isPoint3d(p)) {
43
31
  if (!Number.isNaN(p.z)) return false;
44
32
  }
45
33
  return Number.isNaN(p.x) || Number.isNaN(p.y);
46
- };
47
- function test(p, name = `Point`, extraInfo = ``) {
34
+ }
35
+ function pointTest(p, name = `Point`, extraInfo = ``) {
48
36
  if (p === void 0) return errorResult(`'${name}' is undefined. Expected {x,y} got ${JSON.stringify(p)}`, extraInfo);
49
37
  if (p === null) return errorResult(`'${name}' is null. Expected {x,y} got ${JSON.stringify(p)}`, extraInfo);
50
38
  if (typeof p !== `object`) return errorResult(`'${name}' is type '${typeof p}'. Expected object.`, extraInfo);
@@ -71,26 +59,26 @@ function test(p, name = `Point`, extraInfo = ``) {
71
59
  * @param name
72
60
  */
73
61
  function guard$5(p, name = `Point`, info) {
74
- resultThrow(test(p, name, info));
62
+ resultThrow(pointTest(p, name, info));
75
63
  }
76
64
  /**
77
65
  * Throws if parameter is not a valid point, or either x or y is 0
78
66
  * @param pt
79
- * @returns
67
+ * @returns Throws an error if not a valid point or zero.
80
68
  */
81
- const guardNonZeroPoint = (pt, name = `pt`) => {
69
+ function guardNonZeroPoint(pt, name = `pt`) {
82
70
  guard$5(pt, name);
83
71
  resultThrow(numberTest(pt.x, `nonZero`, `${name}.x`), numberTest(pt.y, `nonZero`, `${name}.y`), () => {
84
72
  if (typeof pt.z !== `undefined`) return numberTest(pt.z, `nonZero`, `${name}.z`);
85
73
  });
86
74
  return true;
87
- };
75
+ }
88
76
  /**
89
77
  * Returns _true_ if `p` has x & y properties.
90
78
  * Returns _false_ if `p` is undefined, null or does not contain properties.
91
79
  * Use {@link isPoint3d} to check further check for `z`.
92
- * @param p
93
- * @returns
80
+ * @param p
81
+ * @returns True if `p` has x & y props
94
82
  */
95
83
  function isPoint(p) {
96
84
  if (p === void 0) return false;
@@ -102,267 +90,45 @@ function isPoint(p) {
102
90
  /**
103
91
  * Returns _true_ if `p` has x, y, & z properties.
104
92
  * Returns _false_ if `p` is undefined, null or does not contain properties.
105
- * @param p
106
- * @returns
93
+ * @param p
94
+ * @returns _True_ if `p` has x, y, & z props
107
95
  */
108
- const isPoint3d = (p) => {
96
+ function isPoint3d(p) {
109
97
  if (p === void 0) return false;
110
98
  if (p === null) return false;
111
99
  if (p.x === void 0) return false;
112
100
  if (p.y === void 0) return false;
113
101
  if (p.z === void 0) return false;
114
102
  return true;
115
- };
103
+ }
116
104
  /**
117
105
  * Returns true if both xy (and z, if present) are 0.
118
106
  * Use `Points.Empty` to return an empty point.
119
107
  * @param p
120
- * @returns
108
+ * @returns _True_ is all props are 0
121
109
  */
122
- const isEmpty = (p) => {
110
+ function isEmpty(p) {
123
111
  if (isPoint3d(p)) {
124
112
  if (p.z !== 0) return false;
125
113
  }
126
114
  return p.x === 0 && p.y === 0;
127
- };
115
+ }
128
116
  /**
129
117
  * Returns true if point is a placeholder, where xy (and z, if present)
130
118
  * are `NaN`.
131
119
  *
132
120
  * Use Points.Placeholder to return a placeholder point.
133
121
  * @param p
134
- * @returns
122
+ * @returns True if all props are NaN
135
123
  */
136
- const isPlaceholder = (p) => {
124
+ function isPlaceholder(p) {
137
125
  if (isPoint3d(p)) {
138
126
  if (!Number.isNaN(p.z)) return false;
139
127
  }
140
128
  return Number.isNaN(p.x) && Number.isNaN(p.y);
141
- };
142
- //#endregion
143
- //#region node_modules/.pnpm/@ixfx+geometry@0.56.12/node_modules/@ixfx/geometry/dist/to-jujzVMAL.js
144
- function getTwoPointParameters(a1, ab2, ab3, ab4, ab5, ab6) {
145
- if (isPoint3d(a1) && isPoint3d(ab2)) return [a1, ab2];
146
- if (isPoint(a1) && isPoint(ab2)) return [a1, ab2];
147
- if (isPoint3d(a1)) {
148
- const b = {
149
- x: ab2,
150
- y: ab3,
151
- z: ab4
152
- };
153
- if (!isPoint3d(b)) throw new Error(`Expected x, y & z parameters`);
154
- return [a1, b];
155
- }
156
- if (isPoint(a1)) {
157
- const b = {
158
- x: ab2,
159
- y: ab3
160
- };
161
- if (!isPoint(b)) throw new Error(`Expected x & y parameters`);
162
- return [a1, b];
163
- }
164
- if (typeof ab5 !== `undefined` && typeof ab4 !== `undefined`) {
165
- const a = {
166
- x: a1,
167
- y: ab2,
168
- z: ab3
169
- };
170
- const b = {
171
- x: ab4,
172
- y: ab5,
173
- z: ab6
174
- };
175
- if (!isPoint3d(a)) throw new Error(`Expected x,y,z for first point`);
176
- if (!isPoint3d(b)) throw new Error(`Expected x,y,z for second point`);
177
- return [a, b];
178
- }
179
- const a = {
180
- x: a1,
181
- y: ab2
182
- };
183
- const b = {
184
- x: ab3,
185
- y: ab4
186
- };
187
- if (!isPoint(a)) throw new Error(`Expected x,y for first point`);
188
- if (!isPoint(b)) throw new Error(`Expected x,y for second point`);
189
- return [a, b];
190
- }
191
- /**
192
- * Returns a Point form of either a point, x,y params or x,y,z params.
193
- * If parameters are undefined, an empty point is returned (0, 0)
194
- * @ignore
195
- * @param a
196
- * @param b
197
- * @returns
198
- */
199
- function getPointParameter(a, b, c) {
200
- if (a === void 0) return {
201
- x: 0,
202
- y: 0
203
- };
204
- if (Array.isArray(a)) {
205
- if (a.length === 0) return Object.freeze({
206
- x: 0,
207
- y: 0
208
- });
209
- if (a.length === 1) return Object.freeze({
210
- x: a[0],
211
- y: 0
212
- });
213
- if (a.length === 2) return Object.freeze({
214
- x: a[0],
215
- y: a[1]
216
- });
217
- if (a.length === 3) return Object.freeze({
218
- x: a[0],
219
- y: a[1],
220
- z: a[2]
221
- });
222
- throw new Error(`Expected array to be 1-3 elements in length. Got ${a.length}.`);
223
- }
224
- if (isPoint(a)) return a;
225
- else if (typeof a !== `number` || typeof b !== `number`) throw new TypeError(`Expected point or x,y as parameters. Got: a: ${JSON.stringify(a)} b: ${JSON.stringify(b)}`);
226
- if (typeof c === `number`) return Object.freeze({
227
- x: a,
228
- y: b,
229
- z: c
230
- });
231
- return Object.freeze({
232
- x: a,
233
- y: b
234
- });
235
- }
236
- /**
237
- * Calculate distance between two points.
238
- * If both points have a `z` property, the distance is 3D distance is calculated.
239
- * If only one point has a `z`, it is ignored. To force 2D distance, use {@link distance2d}
240
- *
241
- * ```js
242
- * // Distance between two points
243
- * const ptA = { x: 0.5, y:0.8 };
244
- * const ptB = { x: 1, y: 0.4 };
245
- * distance(ptA, ptB);
246
- * // Or, provide x,y as parameters
247
- * distance(ptA, 0.4, 0.9);
248
- *
249
- * // Distance from ptA to x: 0.5, y:0.8, z: 0.1
250
- * const ptC = { x: 0.5, y:0.5, z: 0.3 };
251
- * // With x,y,z as parameters:
252
- * distance(ptC, 0.5, 0.8, 0.1);
253
- * ```
254
- * @param a First point
255
- * @param xOrB Second point, or x coord
256
- * @param y y coord, if x coord is given
257
- * @param z Optional z coord, if x and y are given.
258
- * @returns
259
- */
260
- function distance(a, xOrB, y, z) {
261
- const pt = getPointParameter(xOrB, y, z);
262
- guard$5(pt, `b`);
263
- guard$5(a, `a`);
264
- return isPoint3d(pt) && isPoint3d(a) ? Math.hypot(pt.x - a.x, pt.y - a.y, pt.z - a.z) : Math.hypot(pt.x - a.x, pt.y - a.y);
265
- }
266
- /**
267
- * As {@link distance} but always compares by x,y only.
268
- * @param a
269
- * @param xOrB
270
- * @param y
271
- * @returns
272
- */
273
- function distance2d(a, xOrB, y) {
274
- const pt = getPointParameter(xOrB, y);
275
- guard$5(pt, `b`);
276
- guard$5(a, `a`);
277
- return Math.hypot(pt.x - a.x, pt.y - a.y);
278
- }
279
- /**
280
- * Returns a Point with the x,y,z values of two points subtracted (a-b).
281
- *
282
- * `z` parameter is used if present. Uses a default value of 0 for 'z' when subtracting a 2D point with a 3D one.
283
- *
284
- * Examples:
285
- *
286
- * ```js
287
- * subtract(ptA, ptB);
288
- * subtract(x1, y1, x2, y2);
289
- * subtract(ptA, x2, y2);
290
- * ```
291
- */
292
- function subtract(a1, ab2, ab3, ab4, ab5, ab6) {
293
- const [ptA, ptB] = getTwoPointParameters(a1, ab2, ab3, ab4, ab5, ab6);
294
- guard$5(ptA, `a`);
295
- guard$5(ptB, `b`);
296
- const pt = {
297
- x: ptA.x - ptB.x,
298
- y: ptA.y - ptB.y
299
- };
300
- if (isPoint3d(ptA) || isPoint3d(ptB)) pt.z = (ptA.z ?? 0) - (ptB.z ?? 0);
301
- return Object.freeze(pt);
302
- }
303
- /**
304
- * Returns a point with rounded x,y coordinates. By default uses `Math.round` to round.
305
- * ```js
306
- * toIntegerValues({x:1.234, y:5.567}); // Yields: {x:1, y:6}
307
- * ```
308
- *
309
- * ```js
310
- * toIntegerValues(pt, Math.ceil); // Use Math.ceil to round x,y of `pt`.
311
- * ```
312
- * @param pt Point to round
313
- * @param rounder Rounding function, or Math.round by default
314
- * @returns
315
- */
316
- const toIntegerValues = (pt, rounder = Math.round) => {
317
- guard$5(pt, `pt`);
318
- return Object.freeze({
319
- x: rounder(pt.x),
320
- y: rounder(pt.y)
321
- });
322
- };
323
- /**
324
- * Returns a copy of `pt` with `z` field omitted.
325
- * If it didn't have one to begin within, a copy is still returned.
326
- * @param pt
327
- * @returns
328
- */
329
- const to2d = (pt) => {
330
- guard$5(pt, `pt`);
331
- let copy = { ...pt };
332
- delete copy.z;
333
- return Object.freeze(copy);
334
- };
335
- /**
336
- * Returns a copy of `pt` with a `z` field set.
337
- * Defaults to a z value of 0.
338
- * @param pt Point
339
- * @param z Z-value, defaults to 0
340
- * @returns
341
- */
342
- const to3d = (pt, z = 0) => {
343
- guard$5(pt, `pt`);
344
- return Object.freeze({
345
- ...pt,
346
- z
347
- });
348
- };
349
- /**
350
- * Returns a human-friendly string representation `(x, y)`.
351
- * If `precision` is supplied, this will be the number of significant digits.
352
- * @param p
353
- * @returns
354
- */
355
- function toString(p, digits) {
356
- if (p === void 0) return `(undefined)`;
357
- if (p === null) return `(null)`;
358
- guard$5(p, `pt`);
359
- const x = digits ? p.x.toFixed(digits) : p.x;
360
- const y = digits ? p.y.toFixed(digits) : p.y;
361
- if (p.z === void 0) return `(${x},${y})`;
362
- else return `(${x},${y},${digits ? p.z.toFixed(digits) : p.z})`;
363
129
  }
364
130
  //#endregion
365
- //#region node_modules/.pnpm/@ixfx+geometry@0.56.12/node_modules/@ixfx/geometry/dist/polar-LvwxTwIf.js
131
+ //#region node_modules/.pnpm/@ixfx+geometry@0.56.13/node_modules/@ixfx/geometry/dist/angles-BkBEzlEN.js
366
132
  const piPi = Math.PI * 2;
367
133
  /**
368
134
  * Averages a set of points, by default as a 'mean'.
@@ -436,9 +202,9 @@ function degreeToGradian(angleInDegrees) {
436
202
  /**
437
203
  * Returns the gradian value converted to degrees.
438
204
  * By default it wraps, so any value 360 or greater wraps around.
439
- * @param angleInGradians
440
- * @param wrap
441
- * @returns
205
+ * @param angleInGradians
206
+ * @param wrap
207
+ * @returns Degrees
442
208
  */
443
209
  function gradianToDegree(angleInGradians, wrap = true) {
444
210
  if (wrap) return angleInGradians * .9 % 360;
@@ -455,24 +221,31 @@ function radianToDegree(angleInRadians) {
455
221
  }
456
222
  /**
457
223
  * Parses CSS-style angle strings into an 'Angle' type. By default assumes degrees.
458
- *
224
+ *
459
225
  * ```js
460
226
  * angleParse(`100`); // { value: 100, unit: `deg` }
461
227
  * angleParse(100); // { value: 100, unit: `deg` }
462
228
  * angleParse(`100deg`); // { value: 100, unit: `deg` }
463
- *
229
+ *
464
230
  * // More exotic units:
465
231
  * angleParse(`100rad`); // { value: 100, unit: `rad` }
466
232
  * angleParse(`100turn`); // { value: 100, unit: `turn` }
467
233
  * angleParse(`100grad`); // { value: 100, unit: `grad` }
234
+ * angleParse(`n`); // { value: 90, unit: `deg` }
235
+ * angleParse(`e`); // { value: 0, unit: `deg` }
236
+ * angleParse(`s`); // { value: 270, unit: `deg` }
237
+ * angleParse(`w`); // { value: 180, unit: `deg` }
238
+ * angleParse(`ne`); // ne/nw/se/sw supported
239
+ * // Once parsed, use angleConvert to convert to a different unit:
240
+ * angleConvert(`100rad`, `deg`); // { value: 5729.57795, unit: `deg` }
468
241
  * ```
469
- *
242
+ *
470
243
  * Once parsed in this format, use {@link angleConvert} to convert to
471
244
  * a different unit.
472
- * @param value
473
- * @returns
245
+ * @param value
246
+ * @returns Angle
474
247
  */
475
- const angleParse = (value) => {
248
+ function angleParse(value) {
476
249
  if (isAngleType(value)) return value;
477
250
  if (typeof value === `number`) return {
478
251
  value,
@@ -494,14 +267,46 @@ const angleParse = (value) => {
494
267
  numberValue = Number.parseFloat(value.substring(0, value.length - 3));
495
268
  unit = `deg`;
496
269
  } else numberValue = Number.parseFloat(value);
497
- if (Number.isNaN(numberValue)) throw new Error(`Invalid angle (bad value?)`);
270
+ if (Number.isNaN(numberValue)) if (value === `n`) return {
271
+ value: 90,
272
+ unit: `deg`
273
+ };
274
+ else if (value === `e`) return {
275
+ value: 0,
276
+ unit: `deg`
277
+ };
278
+ else if (value === `s`) return {
279
+ value: 270,
280
+ unit: `deg`
281
+ };
282
+ else if (value === `w`) return {
283
+ value: 180,
284
+ unit: `deg`
285
+ };
286
+ else if (value === `ne`) return {
287
+ value: 45,
288
+ unit: `deg`
289
+ };
290
+ else if (value === `se`) return {
291
+ value: 315,
292
+ unit: `deg`
293
+ };
294
+ else if (value === `sw`) return {
295
+ value: 225,
296
+ unit: `deg`
297
+ };
298
+ else if (value === `nw`) return {
299
+ value: 135,
300
+ unit: `deg`
301
+ };
302
+ else throw new Error(`Invalid angle (bad value?): '${value}'. If using cardinals, use: 'n', 'se', etc.`);
498
303
  if (unit.length === 0) throw new Error(`Invalid angle (no unit)`);
499
304
  return {
500
305
  value: numberValue,
501
306
  unit
502
307
  };
503
- };
504
- const isAngleType = (v) => {
308
+ }
309
+ function isAngleType(v) {
505
310
  if (typeof v !== `object`) return false;
506
311
  if (`unit` in v && `value` in v) {
507
312
  if (typeof v.unit !== `string`) return false;
@@ -509,337 +314,126 @@ const isAngleType = (v) => {
509
314
  return true;
510
315
  }
511
316
  return false;
512
- };
317
+ }
513
318
  /**
514
319
  * Converts an angle to another representation.
515
320
  * Input value is assumed degrees unless it's an {@link Angle} type of has the unit.
516
- *
321
+ *
517
322
  * These are all identical inputs: 100, `100`, `100deg`
518
323
  * ```js
519
324
  * angleConvert(100, `rad`); // Converts 100deg to radians
520
325
  * ```
521
- *
326
+ *
522
327
  * Other units can be used for string input: `2turn`, `1grad`, `2rad`.
523
328
  * ```js
524
329
  * angleConvert(`2rad`, `deg`); // Converts 2radians to degrees
525
330
  * ```
526
- *
331
+ *
527
332
  * Can also use an object input:
528
333
  * ```js
529
334
  * angleConvert({ value: 10, unit: `deg`}, `rad`);
530
335
  * ```
531
- * @param angleOrDegrees
532
- * @param destination
533
- * @returns
336
+ * @param angleOrDegrees
337
+ * @param destination
338
+ * @returns Angle
534
339
  */
535
- const angleConvert = (angleOrDegrees, destination) => {
536
- const angle = typeof angleOrDegrees === `object` ? angleOrDegrees : angleParse(angleOrDegrees);
340
+ function angleConvert(angleOrDegrees, destination) {
341
+ const input = typeof angleOrDegrees === `object` ? angleOrDegrees : angleParse(angleOrDegrees);
537
342
  switch (destination) {
538
343
  case `deg`:
539
- if (angle.unit === `deg`) return angle;
540
- if (angle.unit === `rad`) return {
541
- value: radianToDegree(angle.value),
344
+ if (input.unit === `deg`) return input;
345
+ if (input.unit === `rad`) return {
346
+ value: radianToDegree(input.value),
542
347
  unit: `deg`
543
348
  };
544
- if (angle.unit === `grad`) return {
545
- value: gradianToDegree(angle.value),
349
+ if (input.unit === `grad`) return {
350
+ value: gradianToDegree(input.value),
546
351
  unit: `deg`
547
352
  };
548
- if (angle.unit === `turn`) return {
549
- value: turnToDegree(angle.value),
353
+ if (input.unit === `turn`) return {
354
+ value: turnToDegree(input.value),
550
355
  unit: `deg`
551
356
  };
552
- throw new Error(`Unknown unit: ${angle.unit}`);
357
+ throw new Error(`Unknown unit: ${input.unit}`);
553
358
  case `grad`:
554
- if (angle.unit === `deg`) return {
555
- value: degreeToGradian(angle.value),
359
+ if (input.unit === `deg`) return {
360
+ value: degreeToGradian(input.value),
556
361
  unit: `grad`
557
362
  };
558
- if (angle.unit === `rad`) return {
559
- value: radianToGradian(angle.value),
363
+ if (input.unit === `rad`) return {
364
+ value: radianToGradian(input.value),
560
365
  unit: `grad`
561
366
  };
562
- if (angle.unit === `grad`) return angle;
563
- if (angle.unit === `turn`) return {
564
- value: radianToGradian(turnToRadian(angle.value)),
367
+ if (input.unit === `grad`) return input;
368
+ if (input.unit === `turn`) return {
369
+ value: radianToGradian(turnToRadian(input.value)),
565
370
  unit: `grad`
566
371
  };
567
- throw new Error(`Unknown unit: ${angle.unit}`);
372
+ throw new Error(`Unknown unit: ${input.unit}`);
568
373
  case `rad`:
569
- if (angle.unit === `deg`) return {
570
- value: degreeToRadian(angle.value),
374
+ if (input.unit === `deg`) return {
375
+ value: degreeToRadian(input.value),
571
376
  unit: `rad`
572
377
  };
573
- if (angle.unit === `rad`) return angle;
574
- if (angle.unit === `grad`) return {
575
- value: gradianToRadian(angle.value),
378
+ if (input.unit === `rad`) return input;
379
+ if (input.unit === `grad`) return {
380
+ value: gradianToRadian(input.value),
576
381
  unit: `rad`
577
382
  };
578
- if (angle.unit === `turn`) return {
579
- value: radianToGradian(turnToRadian(angle.value)),
580
- unit: `grad`
383
+ if (input.unit === `turn`) return {
384
+ value: turnToRadian(input.value),
385
+ unit: `rad`
581
386
  };
582
- throw new Error(`Unknown unit: ${angle.unit}`);
387
+ throw new Error(`Unknown unit: ${input.unit}`);
583
388
  case `turn`:
584
- if (angle.unit === `deg`) return {
585
- value: degreeToTurn(angle.value),
389
+ if (input.unit === `deg`) return {
390
+ value: degreeToTurn(input.value),
586
391
  unit: `turn`
587
392
  };
588
- if (angle.unit === `rad`) return {
589
- value: radianToTurn(angle.value),
393
+ if (input.unit === `rad`) return {
394
+ value: radianToTurn(input.value),
590
395
  unit: `turn`
591
396
  };
592
- if (angle.unit === `grad`) return {
593
- value: radianToTurn(gradianToRadian(angle.value)),
397
+ if (input.unit === `grad`) return {
398
+ value: radianToTurn(gradianToRadian(input.value)),
594
399
  unit: `turn`
595
400
  };
596
- if (angle.unit === `turn`) return angle;
597
- throw new Error(`Unknown unit: ${angle.unit}`);
401
+ if (input.unit === `turn`) return input;
402
+ throw new Error(`Unknown unit: ${input.unit}`);
598
403
  default: throw new Error(`Destination unit unknown ('${destination}). Expects: deg, grad, rad or turn`);
599
404
  }
600
- };
405
+ }
601
406
  /**
602
- * Converts 'turns' to degrees. By defaults wraps the value, so
407
+ * Converts 'turns' to degrees. By defaults wraps the value, so
603
408
  * turn value of 1 or 2 equal 0deg instead of 360 or 720deg.
604
- * @param turns
605
- * @param wrap
606
- * @returns
409
+ * @param turns
410
+ * @param wrap
411
+ * @returns Degrees
607
412
  */
608
- const turnToDegree = (turns, wrap = true) => {
413
+ function turnToDegree(turns, wrap = true) {
609
414
  if (wrap) return turns * 360 % 360;
610
415
  return turns * 360;
611
- };
612
- const turnToRadian = (turns) => turns * piPi;
613
- const degreeToTurn = (degrees) => degrees / 360;
614
- const radianToTurn = (radians) => radians / piPi;
416
+ }
615
417
  /**
616
418
  * Normalise a radian angle to 0..2*PI range
617
- * @param angleRadian
618
- * @returns
419
+ * @param angleRadian
420
+ * @returns Normalised angle
619
421
  */
620
- const radiansNormalise = (angleRadian) => {
422
+ function radiansNormalise(angleRadian) {
621
423
  angleRadian %= piPi;
622
424
  return angleRadian < 0 ? angleRadian + piPi : angleRadian;
623
- };
624
- /**
625
- * Returns true if `p` seems to be a {@link Polar.Coord} (ie has both distance & angleRadian fields)
626
- * @param p
627
- * @returns True if `p` seems to be a PolarCoord
628
- */
629
- const isPolarCoord = (p) => {
630
- if (p.distance === void 0) return false;
631
- if (p.angleRadian === void 0) return false;
632
- return true;
633
- };
634
- /**
635
- * Returns a rotated coordinate
636
- * @param c Coordinate
637
- * @param amountRadian Amount to rotate, in radians
638
- * @returns
639
- */
640
- const rotate$1 = (c, amountRadian) => Object.freeze({
641
- ...c,
642
- angleRadian: c.angleRadian + amountRadian
643
- });
644
- /**
645
- * An empty point of `{ x: 0, y: 0 }`.
646
- *
647
- * Use `isEmpty` to check if a point is empty.
648
- * Use `Empty3d` to get an empty point with `z`.
649
- */
650
- const Empty = {
651
- x: 0,
652
- y: 0
653
- };
654
- /**
655
- * Returns { x:1, y:1 }
656
- */
657
- const Unit = {
658
- x: 1,
659
- y: 1
660
- };
661
- /**
662
- * An empty Point of `{ x: 0, y: 0, z: 0}`
663
- * Use `isEmpty` to check if a point is empty.
664
- * Use `Empty` to get an empty point without `z`.
665
- */
666
- const Empty3d = {
667
- x: 0,
668
- y: 0,
669
- z: 0
670
- };
671
- /**
672
- * Returns { x:1,y:1,z:1 }
673
- */
674
- const Unit3d = {
675
- x: 1,
676
- y: 1,
677
- z: 1
678
- };
679
- /**
680
- * Converts to Cartesian coordinate from polar.
681
- *
682
- * ```js
683
- *
684
- * const origin = { x: 50, y: 50}; // Polar origin
685
- * // Yields: { x, y }
686
- * const polar = Polar.toCartesian({ distance: 10, angleRadian: 0 }, origin);
687
- * ```
688
- *
689
- * Distance and angle can be provided as numbers intead:
690
- *
691
- * ```
692
- * // Yields: { x, y }
693
- * const polar = Polar.toCartesian(10, 0, origin);
694
- * ```
695
- *
696
- * @param a
697
- * @param b
698
- * @param c
699
- * @returns
700
- */
701
- const toCartesian$1 = (a, b, c) => {
702
- if (isPolarCoord(a)) {
703
- if (typeof b === `undefined`) b = Empty;
704
- if (isPoint(b)) return polarToCartesian(a.distance, a.angleRadian, b);
705
- throw new Error(`Expecting (Coord, Point). Second parameter is not a point`);
706
- } else if (typeof a === `object`) throw new TypeError(`First param is an object, but not a Coord: ${JSON.stringify(a)}`);
707
- else if (typeof a === `number` && typeof b === `number`) {
708
- if (typeof c === `undefined`) c = Empty;
709
- if (!isPoint(c)) throw new Error(`Expecting (number, number, Point). Point param wrong type`);
710
- return polarToCartesian(a, b, c);
711
- } else throw new TypeError(`Expecting parameters of (number, number). Got: (${typeof a}, ${typeof b}, ${typeof c}). a: ${JSON.stringify(a)}`);
712
- };
713
- /**
714
- * Converts a Cartesian coordinate to polar
715
- *
716
- * ```js
717
- *
718
- * // Yields: { angleRadian, distance }
719
- * const polar = Polar.fromCartesian({x: 50, y: 50}, origin);
720
- * ```
721
- *
722
- * Any additional properties of `point` are copied to object.
723
- *
724
- * Options:
725
- * * fullCircle: If _true_ (default) returns values on 0..2PI range. If _false_, 0....PI..-PI range.
726
- * * digits: Rounding to apply
727
- * @param point Point
728
- * @param origin Origin. If unspecified, {x:0,y:0} is used
729
- * @param options Options
730
- * @returns
731
- */
732
- const fromCartesian = (point, origin, options = {}) => {
733
- if (typeof point !== `object`) throw new TypeError(`Param 'point' wrong. Expecting a Point, got: ${typeof point}`);
734
- const fullCircle = options.fullCircle ?? true;
735
- if (typeof origin === `object`) point = subtract(point, origin);
736
- let angle = Math.atan2(point.y, point.x);
737
- if (fullCircle) angle = radiansNormalise(angle);
738
- let distance = Math.hypot(point.x, point.y);
739
- if (typeof options.digits === `number`) {
740
- angle = parseFloat(angle.toFixed(options.digits));
741
- distance = parseFloat(distance.toFixed(options.digits));
742
- }
743
- const polar = {
744
- ...point,
745
- angleRadian: angle,
746
- distance
747
- };
748
- delete polar.x;
749
- delete polar.y;
750
- return Object.freeze(polar);
751
- };
752
- /**
753
- * Converts a polar coordinate to Cartesian
754
- * @param distance Distance
755
- * @param angleRadians Angle in radians
756
- * @param origin Origin, or 0,0 by default.
757
- * @returns
758
- */
759
- const polarToCartesian = (distance, angleRadians, origin = Empty) => {
760
- guard$5(origin);
761
- return Object.freeze({
762
- x: origin.x + distance * Math.cos(angleRadians),
763
- y: origin.y + distance * Math.sin(angleRadians)
764
- });
765
- };
766
- /**
767
- * Returns the angle in radians between `a` and `b`.
768
- *
769
- * Eg if `a` is the origin, and `b` is another point,
770
- * in degrees one would get 0 to -180 when `b` was above `a`.
771
- * -180 would be `b` in line with `a`.
772
- * Same for under `a`.
773
- *
774
- * Providing a third point `c` gives the interior angle, where `b` is the middle point.
775
- *
776
- * See also {@link angleRadianCircle} which returns coordinates on 0..Math.Pi*2
777
- * range. This avoids negative numbers.
778
- *
779
- * @example Calculate angle between a middle of canvas and the cursor
780
- * ```js
781
- * const canvasEl = document.querySelector('canvas');
782
- * const middle = { x: canvasEl.width/2, y: canvasEl.height /2 }
783
- *
784
- * canvasEl.addEventListener(`pointermove`, event => {
785
- * const cursor = {
786
- * x: event.offsetX,
787
- * y: event.offsetY
788
- * }
789
- * const a = G.Points.angleRadian(middle, cursor);
790
- *});
791
- * ```
792
- * @param a
793
- * @param b
794
- * @param c
795
- * @returns
796
- */
797
- const angleRadian = (a, b, c) => {
798
- guard$5(a, `a`);
799
- if (b === void 0) return Math.atan2(a.y, a.x);
800
- guard$5(b, `b`);
801
- if (c === void 0) return Math.atan2(b.y - a.y, b.x - a.x);
802
- guard$5(c, `c`);
803
- return Math.atan2(b.y - a.y, b.x - a.x) - Math.atan2(c.y - a.y, c.x - a.x);
804
- };
805
- /**
806
- * Returns the angle between point(s) using a radian circle system.
807
- * ```
808
- * 90deg
809
- * Pi/2
810
- * |
811
- * Pi ---+--- 0
812
- * 180 |
813
- * 3PI/2
814
- * 270deg
815
- * ```
816
- * @param a
817
- * @param b
818
- * @param c
819
- * @returns
820
- */
821
- const angleRadianCircle = (a, b, c) => {
822
- const angle = angleRadian(a, b, c);
823
- if (angle < 0) return angle + piPi;
824
- return angle;
825
- };
826
- /**
827
- * Return the angle of a wedge, defined by a, b and C points, where 'b'
828
- * could be thought of as the origin or pivot.
829
- *
830
- * @param a
831
- * @param b
832
- * @param c
833
- * @returns
834
- */
835
- const angleRadianThreePoint = (a, b, c) => {
836
- const ab = Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));
837
- const bc = Math.sqrt(Math.pow(b.x - c.x, 2) + Math.pow(b.y - c.y, 2));
838
- const ac = Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2));
839
- return Math.acos((bc * bc + ab * ab - ac * ac) / (2 * bc * ab));
840
- };
425
+ }
426
+ function turnToRadian(turns) {
427
+ return turns * piPi;
428
+ }
429
+ function degreeToTurn(degrees) {
430
+ return degrees / 360;
431
+ }
432
+ function radianToTurn(radians) {
433
+ return radians / piPi;
434
+ }
841
435
  //#endregion
842
- //#region node_modules/.pnpm/@ixfx+visual@0.56.12/node_modules/@ixfx/visual/dist/colour-C3MQIjFJ.js
436
+ //#region node_modules/.pnpm/@ixfx+visual@0.56.13/node_modules/@ixfx/visual/dist/colour-C3MQIjFJ.js
843
437
  var __defProp = Object.defineProperty;
844
438
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
845
439
  enumerable: true,
@@ -2377,7 +1971,7 @@ function wrapScalarHue(value) {
2377
1971
  if (value < 0) return (1 - Math.abs(value)) % 1;
2378
1972
  return value;
2379
1973
  }
2380
- var hsl_exports = /* @__PURE__ */ __exportAll$1({
1974
+ var hsl_exports = /* @__PURE__ */ __exportAll({
2381
1975
  absolute: () => absolute$1,
2382
1976
  changeLightness: () => changeLightness$1,
2383
1977
  fromCss: () => fromCss$3,
@@ -2714,7 +2308,7 @@ function toLibraryRgb(hsl) {
2714
2308
  alpha: (hsl.opacity ?? 100) / 100 * 255
2715
2309
  };
2716
2310
  }
2717
- var srgb_exports = /* @__PURE__ */ __exportAll$1({
2311
+ var srgb_exports = /* @__PURE__ */ __exportAll({
2718
2312
  changeLightness: () => changeLightness,
2719
2313
  eightBit: () => eightBit$1,
2720
2314
  fromCss: () => fromCss$2,
@@ -3025,7 +2619,7 @@ function toLibraryHsl(rgb) {
3025
2619
  alpha: (rgb.opacity ?? 255) / 255
3026
2620
  };
3027
2621
  }
3028
- var oklch_exports = /* @__PURE__ */ __exportAll$1({
2622
+ var oklch_exports = /* @__PURE__ */ __exportAll({
3029
2623
  OKLCH_CHROMA_MAX: () => OKLCH_CHROMA_MAX,
3030
2624
  absolute: () => absolute,
3031
2625
  fromCss: () => fromCss$1,
@@ -3968,7 +3562,7 @@ function decodeRgbFrom16Bit565(colour) {
3968
3562
  space: `srgb`
3969
3563
  };
3970
3564
  }
3971
- var ycbcr_exports = /* @__PURE__ */ __exportAll$1({
3565
+ var ycbcr_exports = /* @__PURE__ */ __exportAll({
3972
3566
  eightBit: () => eightBit,
3973
3567
  fromCss: () => fromCss,
3974
3568
  fromHexString: () => fromHexString,
@@ -4092,7 +3686,7 @@ function guard(rgb) {
4092
3686
  function toHexString(ycbcr) {
4093
3687
  return toHexString$2(toSrgb8bit(ycbcr));
4094
3688
  }
4095
- var colour_exports = /* @__PURE__ */ __exportAll$1({
3689
+ var colour_exports = /* @__PURE__ */ __exportAll({
4096
3690
  HslSpace: () => hsl_exports,
4097
3691
  OklchSpace: () => oklch_exports,
4098
3692
  SrgbSpace: () => srgb_exports,
@@ -4133,6 +3727,6 @@ var colour_exports = /* @__PURE__ */ __exportAll$1({
4133
3727
  withOpacity: () => withOpacity
4134
3728
  });
4135
3729
  //#endregion
4136
- export { isPoint3d as A, guard$5 as C, isNull as D, isNaN as E, __exportAll as M, isPlaceholder as O, toString as S, isEmpty as T, getTwoPointParameters as _, Unit3d as a, to3d as b, angleRadianThreePoint as c, fromCartesian as d, rotate$1 as f, getPointParameter as g, distance2d as h, Unit as i, test as j, isPoint as k, average$1 as l, distance as m, Empty as n, angleRadian as o, toCartesian$1 as p, Empty3d as r, angleRadianCircle as s, colour_exports as t, averager as u, subtract as v, guardNonZeroPoint as w, toIntegerValues as x, to2d as y };
3730
+ export { radiansNormalise as a, isEmpty as c, isPlaceholder as d, isPoint as f, piPi as i, isNaN as l, pointTest as m, average$1 as n, guard$5 as o, isPoint3d as p, averager as r, guardNonZeroPoint as s, colour_exports as t, isNull as u };
4137
3731
 
4138
- //# sourceMappingURL=colour-C3MQIjFJ-BLXg8W3U.js.map
3732
+ //# sourceMappingURL=colour-C3MQIjFJ-vRCdr8W-.js.map