@synnaxlabs/x 0.40.0 → 0.42.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 (203) hide show
  1. package/.turbo/turbo-build.log +33 -33
  2. package/dist/binary.cjs +1 -1
  3. package/dist/binary.js +2 -2
  4. package/dist/bounds-BQo7rvs9.cjs +1 -0
  5. package/dist/{bounds-azUOoVVR.js → bounds-Bn5_l4Z3.js} +84 -86
  6. package/dist/bounds.cjs +1 -1
  7. package/dist/bounds.js +1 -1
  8. package/dist/box-0YrQibkB.cjs +1 -0
  9. package/dist/box-Cc8IzcNo.js +205 -0
  10. package/dist/box.cjs +1 -1
  11. package/dist/box.js +1 -1
  12. package/dist/compare.cjs +1 -1
  13. package/dist/compare.js +1 -1
  14. package/dist/deep.cjs +1 -1
  15. package/dist/deep.js +66 -69
  16. package/dist/{dimensions-PWy5QZoM.cjs → dimensions-D2QGoNXO.cjs} +1 -1
  17. package/dist/dimensions.cjs +1 -1
  18. package/dist/{external-CvWr1nhS.cjs → external-DWQITF5_.cjs} +1 -1
  19. package/dist/index-BywOGO8U.js +1074 -0
  20. package/dist/index-CYYjI7Uf.cjs +1 -0
  21. package/dist/index-C_6NXBlg.cjs +3 -0
  22. package/dist/{index-BVC_8Cg9.js → index-QGplUHuy.js} +1 -1
  23. package/dist/index.cjs +3 -3
  24. package/dist/index.js +736 -240
  25. package/dist/location-BGl5Ddds.cjs +1 -0
  26. package/dist/{location-BuYbIFHD.js → location-C3aeu046.js} +16 -12
  27. package/dist/location.cjs +1 -1
  28. package/dist/location.js +1 -1
  29. package/dist/{position-DTrNGtrm.cjs → position-Cai5-wi1.cjs} +1 -1
  30. package/dist/{position-DemzGvAY.js → position-DIglP1l2.js} +2 -2
  31. package/dist/position.cjs +1 -1
  32. package/dist/position.js +1 -1
  33. package/dist/record.js +3 -1
  34. package/dist/{scale-DpJM6__6.cjs → scale-BtZINJ-A.cjs} +1 -1
  35. package/dist/{scale-C0EllH-1.js → scale-DfJe9755.js} +4 -4
  36. package/dist/scale.cjs +1 -1
  37. package/dist/scale.js +1 -1
  38. package/dist/{series-CXnO-P0V.js → series-B9JERcqi.js} +541 -474
  39. package/dist/series-DqJ6f97G.cjs +11 -0
  40. package/dist/spatial.cjs +1 -1
  41. package/dist/spatial.js +6 -6
  42. package/dist/src/binary/{encoder.d.ts → codec.d.ts} +14 -8
  43. package/dist/src/binary/codec.d.ts.map +1 -0
  44. package/dist/src/binary/codec.spec.d.ts +2 -0
  45. package/dist/src/binary/codec.spec.d.ts.map +1 -0
  46. package/dist/src/binary/index.d.ts +1 -1
  47. package/dist/src/binary/index.d.ts.map +1 -1
  48. package/dist/src/breaker/breaker.d.ts +14 -21
  49. package/dist/src/breaker/breaker.d.ts.map +1 -1
  50. package/dist/src/change/change.d.ts +5 -18
  51. package/dist/src/change/change.d.ts.map +1 -1
  52. package/dist/src/color/color.d.ts +126 -0
  53. package/dist/src/color/color.d.ts.map +1 -0
  54. package/dist/src/color/color.spec.d.ts +2 -0
  55. package/dist/src/color/color.spec.d.ts.map +1 -0
  56. package/dist/src/color/external.d.ts +5 -0
  57. package/dist/src/color/external.d.ts.map +1 -0
  58. package/dist/src/color/gradient.d.ts +18 -0
  59. package/dist/src/color/gradient.d.ts.map +1 -0
  60. package/dist/src/color/index.d.ts +2 -0
  61. package/dist/src/color/index.d.ts.map +1 -0
  62. package/dist/src/color/palette.d.ts +19 -0
  63. package/dist/src/color/palette.d.ts.map +1 -0
  64. package/dist/src/color/transformColorsToHex.d.ts +6 -0
  65. package/dist/src/color/transformColorsToHex.d.ts.map +1 -0
  66. package/dist/src/control/control.d.ts +69 -74
  67. package/dist/src/control/control.d.ts.map +1 -1
  68. package/dist/src/deep/merge.d.ts +1 -1
  69. package/dist/src/deep/merge.d.ts.map +1 -1
  70. package/dist/src/errors/errors.d.ts +127 -7
  71. package/dist/src/errors/errors.d.ts.map +1 -1
  72. package/dist/src/errors/errors.spec.d.ts +2 -0
  73. package/dist/src/errors/errors.spec.d.ts.map +1 -0
  74. package/dist/src/index.d.ts +5 -0
  75. package/dist/src/index.d.ts.map +1 -1
  76. package/dist/src/jsonrpc/jsonrpc.d.ts +10 -7
  77. package/dist/src/jsonrpc/jsonrpc.d.ts.map +1 -1
  78. package/dist/src/kv/types.d.ts +1 -7
  79. package/dist/src/kv/types.d.ts.map +1 -1
  80. package/dist/src/math/external.d.ts +3 -0
  81. package/dist/src/math/external.d.ts.map +1 -0
  82. package/dist/src/math/index.d.ts +1 -1
  83. package/dist/src/math/index.d.ts.map +1 -1
  84. package/dist/src/math/round.d.ts +40 -0
  85. package/dist/src/math/round.d.ts.map +1 -0
  86. package/dist/src/math/round.spec.d.ts +2 -0
  87. package/dist/src/math/round.spec.d.ts.map +1 -0
  88. package/dist/src/migrate/migrate.d.ts +1 -1
  89. package/dist/src/notation/index.d.ts +2 -0
  90. package/dist/src/notation/index.d.ts.map +1 -0
  91. package/dist/src/notation/notation.d.ts +37 -0
  92. package/dist/src/notation/notation.d.ts.map +1 -0
  93. package/dist/src/notation/notation.spec.d.ts +2 -0
  94. package/dist/src/notation/notation.spec.d.ts.map +1 -0
  95. package/dist/src/record.d.ts +2 -1
  96. package/dist/src/record.d.ts.map +1 -1
  97. package/dist/src/replace.d.ts +2 -0
  98. package/dist/src/replace.d.ts.map +1 -0
  99. package/dist/src/runtime/os.d.ts +9 -1
  100. package/dist/src/runtime/os.d.ts.map +1 -1
  101. package/dist/src/singleton/define.d.ts +9 -0
  102. package/dist/src/singleton/define.d.ts.map +1 -0
  103. package/dist/src/singleton/define.spec.d.ts +2 -0
  104. package/dist/src/singleton/define.spec.d.ts.map +1 -0
  105. package/dist/src/singleton/index.d.ts +2 -0
  106. package/dist/src/singleton/index.d.ts.map +1 -0
  107. package/dist/src/spatial/base.d.ts +74 -70
  108. package/dist/src/spatial/base.d.ts.map +1 -1
  109. package/dist/src/spatial/box/box.d.ts +22 -76
  110. package/dist/src/spatial/box/box.d.ts.map +1 -1
  111. package/dist/src/spatial/dimensions/dimensions.d.ts +5 -29
  112. package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -1
  113. package/dist/src/spatial/direction/direction.d.ts +9 -1
  114. package/dist/src/spatial/direction/direction.d.ts.map +1 -1
  115. package/dist/src/spatial/location/location.d.ts +45 -24
  116. package/dist/src/spatial/location/location.d.ts.map +1 -1
  117. package/dist/src/spatial/scale/scale.d.ts +12 -120
  118. package/dist/src/spatial/scale/scale.d.ts.map +1 -1
  119. package/dist/src/spatial/xy/xy.d.ts +15 -29
  120. package/dist/src/spatial/xy/xy.d.ts.map +1 -1
  121. package/dist/src/sync/index.d.ts +2 -0
  122. package/dist/src/sync/index.d.ts.map +1 -0
  123. package/dist/src/sync/mutex.d.ts +8 -0
  124. package/dist/src/sync/mutex.d.ts.map +1 -0
  125. package/dist/src/telem/gl.d.ts +4 -1
  126. package/dist/src/telem/gl.d.ts.map +1 -1
  127. package/dist/src/telem/series.d.ts +46 -125
  128. package/dist/src/telem/series.d.ts.map +1 -1
  129. package/dist/src/telem/telem.d.ts +102 -85
  130. package/dist/src/telem/telem.d.ts.map +1 -1
  131. package/dist/src/toArray.d.ts +1 -1
  132. package/dist/src/toArray.d.ts.map +1 -1
  133. package/dist/src/zod/util.d.ts.map +1 -1
  134. package/dist/telem.cjs +1 -1
  135. package/dist/telem.js +1 -1
  136. package/dist/toArray.cjs +1 -1
  137. package/dist/toArray.js +1 -1
  138. package/dist/{xy-DyQSETQZ.cjs → xy-B7065J2S.cjs} +1 -1
  139. package/dist/{xy-DHBO1dG_.js → xy-D_LqxaGt.js} +8 -4
  140. package/dist/xy.cjs +1 -1
  141. package/dist/xy.js +1 -1
  142. package/dist/zod.cjs +1 -1
  143. package/package.json +11 -8
  144. package/src/binary/codec.spec.ts +370 -0
  145. package/src/binary/{encoder.ts → codec.ts} +55 -11
  146. package/src/binary/index.ts +1 -1
  147. package/src/breaker/breaker.spec.ts +16 -25
  148. package/src/breaker/breaker.ts +36 -19
  149. package/src/color/color.spec.ts +673 -0
  150. package/src/color/color.ts +317 -0
  151. package/src/color/external.ts +13 -0
  152. package/src/color/gradient.ts +78 -0
  153. package/src/color/index.ts +10 -0
  154. package/src/color/palette.ts +28 -0
  155. package/src/color/transformColorsToHex.ts +30 -0
  156. package/src/control/control.ts +30 -22
  157. package/src/deep/merge.ts +2 -8
  158. package/src/errors/errors.spec.ts +152 -0
  159. package/src/errors/errors.ts +225 -10
  160. package/src/index.ts +5 -0
  161. package/src/jsonrpc/jsonrpc.ts +12 -8
  162. package/src/math/external.ts +11 -0
  163. package/src/math/index.ts +1 -1
  164. package/src/math/round.spec.ts +81 -0
  165. package/src/math/round.ts +68 -0
  166. package/src/migrate/migrate.ts +2 -2
  167. package/src/notation/index.ts +10 -0
  168. package/src/notation/notation.spec.ts +88 -0
  169. package/src/notation/notation.ts +61 -0
  170. package/src/primitive.ts +1 -1
  171. package/src/record.ts +5 -1
  172. package/src/replace.ts +1 -0
  173. package/src/singleton/define.spec.ts +93 -0
  174. package/src/singleton/define.ts +27 -0
  175. package/src/singleton/index.ts +10 -0
  176. package/src/spatial/box/box.spec.ts +3 -3
  177. package/src/spatial/box/box.ts +8 -0
  178. package/src/spatial/location/location.ts +4 -4
  179. package/src/spatial/position/position.spec.ts +10 -10
  180. package/src/spatial/xy/xy.spec.ts +8 -0
  181. package/src/spatial/xy/xy.ts +14 -0
  182. package/src/sync/index.ts +1 -0
  183. package/src/sync/mutex.ts +16 -0
  184. package/src/telem/series.spec.ts +71 -0
  185. package/src/telem/series.ts +69 -46
  186. package/src/telem/telem.spec.ts +151 -10
  187. package/src/telem/telem.ts +134 -73
  188. package/src/toArray.ts +2 -2
  189. package/src/zod/util.spec.ts +17 -1
  190. package/src/zod/util.ts +4 -2
  191. package/tsconfig.tsbuildinfo +1 -1
  192. package/dist/bounds-Dwq6ZFHm.cjs +0 -1
  193. package/dist/box-Bzya27QS.cjs +0 -1
  194. package/dist/box-DrsrRNSe.js +0 -201
  195. package/dist/index-BG3Scw3G.cjs +0 -1
  196. package/dist/index-C3QzbIwt.js +0 -101
  197. package/dist/index-CnclyYpG.cjs +0 -3
  198. package/dist/location-BgpQ3rN2.cjs +0 -1
  199. package/dist/series-BgoCtU71.cjs +0 -11
  200. package/dist/src/binary/encoder.d.ts.map +0 -1
  201. package/dist/src/binary/encoder.spec.d.ts +0 -2
  202. package/dist/src/binary/encoder.spec.d.ts.map +0 -1
  203. package/src/binary/encoder.spec.ts +0 -174
@@ -1,11 +1,11 @@
1
1
 
2
- > @synnaxlabs/x@0.40.0 build /home/runner/work/synnax/synnax/x/ts
2
+ > @synnaxlabs/x@0.42.0 build /home/runner/work/synnax/synnax/x/ts
3
3
  > tsc --noEmit && vite build
4
4
 
5
5
   Synnax - Production mode
6
- vite v6.2.1 building for production...
6
+ vite v6.2.5 building for production...
7
7
  transforming...
8
- ✓ 97 modules transformed.
8
+ ✓ 129 modules transformed.
9
9
  Generated an empty chunk: "destructor".
10
10
  rendering chunks...
11
11
 
@@ -14,11 +14,11 @@ computing gzip size...
14
14
  dist/destructor.js  0.00 kB │ gzip: 0.02 kB
15
15
  dist/xy.js  0.07 kB │ gzip: 0.08 kB
16
16
  dist/box.js  0.07 kB │ gzip: 0.08 kB
17
- dist/binary.js  0.07 kB │ gzip: 0.08 kB
18
17
  dist/kv.js  0.07 kB │ gzip: 0.09 kB
19
18
  dist/scale.js  0.07 kB │ gzip: 0.08 kB
20
19
  dist/location.js  0.07 kB │ gzip: 0.08 kB
21
20
  dist/zod.js  0.07 kB │ gzip: 0.09 kB
21
+ dist/binary.js  0.07 kB │ gzip: 0.09 kB
22
22
  dist/unique.js  0.07 kB │ gzip: 0.09 kB
23
23
  dist/bounds.js  0.07 kB │ gzip: 0.08 kB
24
24
  dist/change.js  0.07 kB │ gzip: 0.08 kB
@@ -38,7 +38,7 @@ computing gzip size...
38
38
  dist/link.js  0.44 kB │ gzip: 0.34 kB
39
39
  dist/telem.js  0.45 kB │ gzip: 0.26 kB
40
40
  dist/index-D4NCYiQB.js  0.45 kB │ gzip: 0.30 kB
41
- dist/spatial.js  0.58 kB │ gzip: 0.28 kB
41
+ dist/spatial.js  0.58 kB │ gzip: 0.29 kB
42
42
  dist/direction-BL0PhD1k.js  0.65 kB │ gzip: 0.37 kB
43
43
  dist/external-BPgtxa8d.js  0.99 kB │ gzip: 0.56 kB
44
44
  dist/external-DqPrWKvU.js  1.07 kB │ gzip: 0.46 kB
@@ -50,29 +50,29 @@ computing gzip size...
50
50
  dist/path-DD6ytXzr.js  1.79 kB │ gzip: 0.72 kB
51
51
  dist/index-DizUWH6z.js  1.89 kB │ gzip: 0.88 kB
52
52
  dist/url.js  1.98 kB │ gzip: 0.87 kB
53
- dist/position-DemzGvAY.js  2.25 kB │ gzip: 1.06 kB
54
- dist/location-BuYbIFHD.js  2.81 kB │ gzip: 1.17 kB
55
- dist/index-BVC_8Cg9.js  2.91 kB │ gzip: 1.15 kB
56
- dist/index-C3QzbIwt.js  2.95 kB │ gzip: 1.12 kB
57
- dist/deep.js  3.37 kB │ gzip: 1.36 kB
58
- dist/xy-DHBO1dG_.js  3.76 kB │ gzip: 1.43 kB
59
- dist/box-DrsrRNSe.js  6.13 kB │ gzip: 2.16 kB
60
- dist/bounds-azUOoVVR.js  6.52 kB │ gzip: 2.06 kB
61
- dist/scale-C0EllH-1.js  6.82 kB │ gzip: 2.02 kB
62
- dist/index.js 10.44 kB │ gzip: 3.78 kB
63
- dist/series-CXnO-P0V.js 64.01 kB │ gzip: 14.04 kB
64
- [vite:dts] Declaration files built in 4847ms.
53
+ dist/position-DIglP1l2.js  2.25 kB │ gzip: 1.07 kB
54
+ dist/location-C3aeu046.js  2.86 kB │ gzip: 1.18 kB
55
+ dist/index-QGplUHuy.js  2.90 kB │ gzip: 1.15 kB
56
+ dist/deep.js  3.23 kB │ gzip: 1.29 kB
57
+ dist/xy-D_LqxaGt.js  3.84 kB │ gzip: 1.45 kB
58
+ dist/box-Cc8IzcNo.js  6.33 kB │ gzip: 2.23 kB
59
+ dist/bounds-Bn5_l4Z3.js  6.35 kB │ gzip: 2.02 kB
60
+ dist/scale-DfJe9755.js  6.82 kB │ gzip: 2.03 kB
61
+ dist/index.js 25.43 kB │ gzip: 8.17 kB
62
+ dist/index-BywOGO8U.js 33.57 kB │ gzip: 7.89 kB
63
+ dist/series-B9JERcqi.js 66.73 kB │ gzip: 14.68 kB
64
+ [vite:dts] Declaration files built in 4950ms.
65
65
 
66
66
  Generated an empty chunk: "destructor".
67
67
  dist/destructor.cjs  0.01 kB │ gzip: 0.03 kB
68
- dist/xy.cjs  0.13 kB │ gzip: 0.14 kB
68
+ dist/xy.cjs  0.13 kB │ gzip: 0.15 kB
69
69
  dist/box.cjs  0.14 kB │ gzip: 0.14 kB
70
70
  dist/scale.cjs  0.14 kB │ gzip: 0.15 kB
71
+ dist/binary.cjs  0.14 kB │ gzip: 0.15 kB
71
72
  dist/unique.cjs  0.15 kB │ gzip: 0.15 kB
72
73
  dist/kv.cjs  0.15 kB │ gzip: 0.15 kB
73
74
  dist/bounds.cjs  0.15 kB │ gzip: 0.15 kB
74
75
  dist/change.cjs  0.15 kB │ gzip: 0.15 kB
75
- dist/binary.cjs  0.15 kB │ gzip: 0.15 kB
76
76
  dist/zod.cjs  0.15 kB │ gzip: 0.15 kB
77
77
  dist/compare.cjs  0.15 kB │ gzip: 0.15 kB
78
78
  dist/caseconv.cjs  0.15 kB │ gzip: 0.15 kB
@@ -97,21 +97,21 @@ computing gzip size...
97
97
  dist/external-uXk0Avrg.cjs  0.79 kB │ gzip: 0.49 kB
98
98
  dist/worker.cjs  0.94 kB │ gzip: 0.49 kB
99
99
  dist/observe.cjs  1.00 kB │ gzip: 0.47 kB
100
- dist/external-CvWr1nhS.cjs  1.03 kB │ gzip: 0.61 kB
100
+ dist/external-DWQITF5_.cjs  1.03 kB │ gzip: 0.61 kB
101
101
  dist/url.cjs  1.10 kB │ gzip: 0.60 kB
102
- dist/dimensions-PWy5QZoM.cjs  1.17 kB │ gzip: 0.58 kB
102
+ dist/dimensions-D2QGoNXO.cjs  1.17 kB │ gzip: 0.58 kB
103
103
  dist/path-1tZLZ4AN.cjs  1.35 kB │ gzip: 0.66 kB
104
104
  dist/index-Dd8DLyMx.cjs  1.38 kB │ gzip: 0.71 kB
105
105
  dist/base-BAM2mqCy.cjs  1.40 kB │ gzip: 0.58 kB
106
- dist/position-DTrNGtrm.cjs  1.71 kB │ gzip: 0.94 kB
107
- dist/index-BG3Scw3G.cjs  2.24 kB │ gzip: 1.04 kB
108
- dist/index-CnclyYpG.cjs  2.30 kB │ gzip: 1.01 kB
109
- dist/location-BgpQ3rN2.cjs  2.40 kB │ gzip: 1.05 kB
110
- dist/deep.cjs  2.50 kB │ gzip: 1.15 kB
111
- dist/xy-DyQSETQZ.cjs  2.75 kB │ gzip: 1.27 kB
112
- dist/scale-DpJM6__6.cjs  4.37 kB │ gzip: 1.60 kB
113
- dist/box-Bzya27QS.cjs  4.74 kB │ gzip: 1.95 kB
114
- dist/bounds-Dwq6ZFHm.cjs  4.89 kB │ gzip: 1.80 kB
115
- dist/index.cjs  8.44 kB │ gzip: 3.28 kB
116
- dist/series-BgoCtU71.cjs 36.75 kB │ gzip: 9.73 kB
117
- ✓ built in 5.43s
106
+ dist/position-Cai5-wi1.cjs  1.71 kB │ gzip: 0.94 kB
107
+ dist/index-CYYjI7Uf.cjs  2.24 kB │ gzip: 1.03 kB
108
+ dist/deep.cjs  2.39 kB │ gzip: 1.09 kB
109
+ dist/location-BGl5Ddds.cjs  2.49 kB │ gzip: 1.06 kB
110
+ dist/xy-B7065J2S.cjs  2.79 kB │ gzip: 1.29 kB
111
+ dist/scale-BtZINJ-A.cjs  4.37 kB │ gzip: 1.60 kB
112
+ dist/bounds-BQo7rvs9.cjs  4.88 kB │ gzip: 1.80 kB
113
+ dist/box-0YrQibkB.cjs  4.90 kB │ gzip: 2.00 kB
114
+ dist/index.cjs 19.50 kB │ gzip: 7.23 kB
115
+ dist/index-C_6NXBlg.cjs 24.43 kB │ gzip: 6.86 kB
116
+ dist/series-DqJ6f97G.cjs 37.48 kB │ gzip: 9.95 kB
117
+ ✓ built in 5.68s
package/dist/binary.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CnclyYpG.cjs");exports.binary=e.encoder;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C_6NXBlg.cjs");exports.binary=e.codec;
package/dist/binary.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e } from "./index-C3QzbIwt.js";
1
+ import { c as o } from "./index-BywOGO8U.js";
2
2
  export {
3
- e as binary
3
+ o as binary
4
4
  };
@@ -0,0 +1 @@
1
+ "use strict";const M=require("./base-BAM2mqCy.cjs"),a=e=>typeof e=="bigint"||e instanceof BigInt,m=(e,r)=>a(e)?e.valueOf()-BigInt(r.valueOf().valueOf()):e.valueOf()-Number(r.valueOf()),b=(e,r)=>a(e)?e.valueOf()+BigInt(r.valueOf().valueOf()):e+Number(r.valueOf()),A=(e,r,n=1e-4)=>Math.abs(e-r)<n,O=(e,r)=>a(e)?e===BigInt(r.valueOf().valueOf()):e===Number(r.valueOf()),j=e=>{const r=10**Math.floor(Math.log10(e));return Math.round(e/r)*r},B=(e,r)=>a(e)?e.valueOf()<BigInt(r.valueOf())?e:BigInt(r.valueOf()):e.valueOf()<Number(r.valueOf())?e:Number(r.valueOf()),P=(e,r)=>a(e)?e.valueOf()>BigInt(r.valueOf())?e:BigInt(r.valueOf()):e.valueOf()>Number(r.valueOf())?e:Number(r.valueOf()),x=e=>a(e)||e instanceof BigInt?e.valueOf()<0n?-e:e:e.valueOf()<0?-e:e,T=(e,r)=>a(e)?e.valueOf()*BigInt(r.valueOf()):e.valueOf()*Number(r.valueOf()),z=(e,r)=>a(e)?e.valueOf()/BigInt(r.valueOf()):e.valueOf()/Number(r.valueOf()),i=(e,r)=>{const n={};if(typeof e=="number"||typeof e=="bigint")r!=null?(n.lower=e,n.upper=r):(n.lower=typeof e=="bigint"?0n:0,n.upper=e);else if(Array.isArray(e)){if(e.length!==2)throw new Error("bounds: expected array of length 2");[n.lower,n.upper]=e}else return I(e);return I(n)},E=Object.freeze({lower:0,upper:0}),q=Object.freeze({lower:-1/0,upper:1/0}),D=Object.freeze({lower:0,upper:1}),F=Object.freeze({lower:-1,upper:1}),L=(e,r)=>{if(e==null&&r==null)return!0;if(e==null||r==null)return!1;const n=i(e),t=i(r);return(n==null?void 0:n.lower)===(t==null?void 0:t.lower)&&(n==null?void 0:n.upper)===(t==null?void 0:t.upper)},I=e=>e.lower>e.upper?{lower:e.upper,upper:e.lower}:e,h=(e,r)=>{const n=i(e);return r<n.lower?n.lower:r>=n.upper?n.upper-(typeof n.upper=="number"?1:1n):r},c=(e,r)=>{const n=i(e);if(typeof r=="number"||typeof r=="bigint")return r>=n.lower&&r<n.upper;const t=i(r);return t.lower>=n.lower&&t.upper<=n.upper},Z=(e,r)=>{const n=i(e),t=i(r);return n.lower===t.lower?!0:t.upper===n.lower||t.lower===n.upper?!1:c(n,t.upper)||c(n,t.lower)||c(t,n.upper)||c(t,n.lower)},v=e=>{const r=i(e);return r.upper-r.lower},S=e=>{const r=i(e);return typeof r.lower=="bigint"?r.lower===0n&&r.upper===0n:r.lower===0&&r.upper===0},$=e=>{const r=v(e);return typeof r=="number"?r===0:r===0n},C=e=>{const r=i(e);return typeof r.lower=="bigint"?!0:Number.isFinite(r.lower)&&Number.isFinite(r.upper)},R=e=>{const r=i(e);return(r.upper+r.lower)/2},y=e=>({lower:Math.min(...e.map(r=>i(r).lower)),upper:Math.max(...e.map(r=>i(r).upper))}),k=e=>({lower:Math.max(...e.map(r=>i(r).lower)),upper:Math.min(...e.map(r=>i(r).upper))}),U=e=>{const r=i(e),n=typeof r.lower=="bigint";return Array.from({length:Number(v(e))},(t,o)=>n?r.lower+BigInt(o):r.lower+o)},g=(e,r)=>{const n=e.map(l=>i(l)),t=n.findIndex(l=>c(l,r)||r<l.lower);if(t===-1)return{index:e.length,position:0};const o=n[t];return c(o,r)?{index:t,position:Number(r-o.lower)}:{index:t,position:0}},w={removeBefore:0,removeAfter:0,insertInto:0,deleteInBetween:0},V=(e,r)=>{const n=e.map(p=>i(p)),t=i(r);if(n.length===0)return w;const o=g(n,t.lower),l=g(n,t.upper);if(o.index===e.length)return{...w,insertInto:e.length};if(l.index===0)return{...w,removeAfter:l.position};if(o.index===l.index)return o.position!==0&&l.position!==0?null:{removeAfter:l.position,removeBefore:o.position,insertInto:o.index,deleteInBetween:0};let u=l.index-o.index,f=o.index,s=m(Number(v(n[o.index])),o.position);return o.position!==0?(u-=1,f+=1):s=0,{removeBefore:s,removeAfter:l.position,insertInto:f,deleteInBetween:u}},N=(e,r,n)=>{const t=e.map(f=>i(f)),o=n>0?1:n<0?-1:0;if(o===0)return r;let l=n,u=r;for(;O(l,0)===!1;){const f=t.findIndex(s=>o>0?u>=s.lower&&u<s.upper:u>s.lower&&u<=s.upper);if(f!==-1){const s=t[f];let p;if(o>0?p=m(s.upper,u):p=m(u,s.lower),p>0){const d=B(x(l),p);if(u=b(u,o>0?d:-d),l=m(l,o>0?d:-d),O(l,0))return u;continue}}if(o>0){const s=t.filter(p=>p.lower>u);if(s.length>0)u=s[0].lower;else return u}else{const s=t.filter(p=>p.upper<u);if(s.length>0)u=s[s.length-1].upper;else return u}}return u},_=(e,r,n)=>{const t=e.map(u=>i(u));if(r===n)return typeof r=="bigint"?0n:0;const o=r<n?i([r,n]):i([n,r]);let l=typeof r=="bigint"?0n:0;for(const u of t){const f=u.lower>o.lower?u.lower:o.lower,s=u.upper<o.upper?u.upper:o.upper;if(f<s){const p=s-f;l=l+p}}return l},W=Object.freeze(Object.defineProperty({__proto__:null,CLIP:F,DECIMAL:D,INFINITE:q,ZERO:E,bounds:M.bounds,buildInsertionPlan:V,clamp:h,construct:i,contains:c,distance:_,equals:L,findInsertPosition:g,isFinite:C,isZero:S,linspace:U,makeValid:I,max:y,mean:R,min:k,overlapsWith:Z,span:v,spanIsZero:$,traverse:N},Symbol.toStringTag,{value:"Module"}));exports.abs=x;exports.add=b;exports.bounds=W;exports.clamp=h;exports.closeTo=A;exports.construct=i;exports.contains=c;exports.distance=_;exports.div=z;exports.equal=O;exports.max=y;exports.max$1=P;exports.min=B;exports.mult=T;exports.roundToNearestMagnitude=j;exports.span=v;exports.sub=m;exports.traverse=N;
@@ -1,34 +1,22 @@
1
- import { j as h } from "./base-DFq0vvGn.js";
2
- const c = (e) => typeof e == "bigint" || e instanceof BigInt, m = (e, r) => c(e) ? e.valueOf() - BigInt(r.valueOf().valueOf()) : e.valueOf() - Number(r.valueOf()), b = (e, r) => c(e) ? e.valueOf() + BigInt(r.valueOf().valueOf()) : e + Number(r.valueOf()), x = (e, r, n = 1e-4) => Math.abs(e - r) < n, O = (e, r) => c(e) ? e === BigInt(r.valueOf().valueOf()) : e === Number(r.valueOf()), _ = (e) => {
1
+ import { j as b } from "./base-DFq0vvGn.js";
2
+ const c = (e) => typeof e == "bigint" || e instanceof BigInt, v = (e, r) => c(e) ? e.valueOf() - BigInt(r.valueOf().valueOf()) : e.valueOf() - Number(r.valueOf()), B = (e, r) => c(e) ? e.valueOf() + BigInt(r.valueOf().valueOf()) : e + Number(r.valueOf()), C = (e, r, n = 1e-4) => Math.abs(e - r) < n, g = (e, r) => c(e) ? e === BigInt(r.valueOf().valueOf()) : e === Number(r.valueOf()), R = (e) => {
3
3
  const r = 10 ** Math.floor(Math.log10(e));
4
4
  return Math.round(e / r) * r;
5
- }, y = (e, r) => c(e) ? e.valueOf() < BigInt(r.valueOf()) ? e : BigInt(r.valueOf()) : e.valueOf() < Number(r.valueOf()) ? e : Number(r.valueOf()), N = (e, r) => c(e) ? e.valueOf() > BigInt(r.valueOf()) ? e : BigInt(r.valueOf()) : e.valueOf() > Number(r.valueOf()) ? e : Number(r.valueOf()), B = (e) => c(e) || e instanceof BigInt ? e.valueOf() < 0n ? -e : e : e.valueOf() < 0 ? -e : e, M = (e, r) => c(e) ? e.valueOf() * BigInt(r.valueOf()) : e.valueOf() * Number(r.valueOf()), j = (e, r) => c(e) ? e.valueOf() / BigInt(r.valueOf()) : e.valueOf() / Number(r.valueOf()), G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6
- __proto__: null,
7
- abs: B,
8
- add: b,
9
- closeTo: x,
10
- div: j,
11
- equal: O,
12
- max: N,
13
- min: y,
14
- mult: M,
15
- roundToNearestMagnitude: _,
16
- sub: m
17
- }, Symbol.toStringTag, { value: "Module" })), i = (e, r) => {
5
+ }, h = (e, r) => c(e) ? e.valueOf() < BigInt(r.valueOf()) ? e : BigInt(r.valueOf()) : e.valueOf() < Number(r.valueOf()) ? e : Number(r.valueOf()), U = (e, r) => c(e) ? e.valueOf() > BigInt(r.valueOf()) ? e : BigInt(r.valueOf()) : e.valueOf() > Number(r.valueOf()) ? e : Number(r.valueOf()), x = (e) => c(e) || e instanceof BigInt ? e.valueOf() < 0n ? -e : e : e.valueOf() < 0 ? -e : e, V = (e, r) => c(e) ? e.valueOf() * BigInt(r.valueOf()) : e.valueOf() * Number(r.valueOf()), W = (e, r) => c(e) ? e.valueOf() / BigInt(r.valueOf()) : e.valueOf() / Number(r.valueOf()), i = (e, r) => {
18
6
  const n = {};
19
7
  if (typeof e == "number" || typeof e == "bigint")
20
8
  r != null ? (n.lower = e, n.upper = r) : (n.lower = typeof e == "bigint" ? 0n : 0, n.upper = e);
21
9
  else if (Array.isArray(e)) {
22
10
  if (e.length !== 2) throw new Error("bounds: expected array of length 2");
23
11
  [n.lower, n.upper] = e;
24
- } else return g(e);
25
- return g(n);
26
- }, A = Object.freeze({ lower: 0, upper: 0 }), P = Object.freeze({ lower: -1 / 0, upper: 1 / 0 }), z = Object.freeze({ lower: 0, upper: 1 }), E = Object.freeze({ lower: -1, upper: 1 }), S = (e, r) => {
12
+ } else return O(e);
13
+ return O(n);
14
+ }, y = Object.freeze({ lower: 0, upper: 0 }), N = Object.freeze({ lower: -1 / 0, upper: 1 / 0 }), _ = Object.freeze({ lower: 0, upper: 1 }), M = Object.freeze({ lower: -1, upper: 1 }), A = (e, r) => {
27
15
  if (e == null && r == null) return !0;
28
16
  if (e == null || r == null) return !1;
29
17
  const n = i(e), t = i(r);
30
18
  return (n == null ? void 0 : n.lower) === (t == null ? void 0 : t.lower) && (n == null ? void 0 : n.upper) === (t == null ? void 0 : t.upper);
31
- }, g = (e) => e.lower > e.upper ? { lower: e.upper, upper: e.lower } : e, T = (e, r) => {
19
+ }, O = (e) => e.lower > e.upper ? { lower: e.upper, upper: e.lower } : e, j = (e, r) => {
32
20
  const n = i(e);
33
21
  return r < n.lower ? n.lower : r >= n.upper ? n.upper - (typeof n.upper == "number" ? 1 : 1n) : r;
34
22
  }, a = (e, r) => {
@@ -37,35 +25,35 @@ const c = (e) => typeof e == "bigint" || e instanceof BigInt, m = (e, r) => c(e)
37
25
  return r >= n.lower && r < n.upper;
38
26
  const t = i(r);
39
27
  return t.lower >= n.lower && t.upper <= n.upper;
40
- }, D = (e, r) => {
28
+ }, P = (e, r) => {
41
29
  const n = i(e), t = i(r);
42
30
  return n.lower === t.lower ? !0 : t.upper === n.lower || t.lower === n.upper ? !1 : a(n, t.upper) || a(n, t.lower) || a(t, n.upper) || a(t, n.lower);
43
31
  }, w = (e) => {
44
32
  const r = i(e);
45
33
  return r.upper - r.lower;
46
- }, F = (e) => {
34
+ }, z = (e) => {
47
35
  const r = i(e);
48
36
  return typeof r.lower == "bigint" ? r.lower === 0n && r.upper === 0n : r.lower === 0 && r.upper === 0;
49
- }, L = (e) => {
37
+ }, E = (e) => {
50
38
  const r = w(e);
51
39
  return typeof r == "number" ? r === 0 : r === 0n;
52
- }, Z = (e) => {
40
+ }, D = (e) => {
53
41
  const r = i(e);
54
42
  return typeof r.lower == "bigint" ? !0 : Number.isFinite(r.lower) && Number.isFinite(r.upper);
55
- }, $ = (e) => {
43
+ }, F = (e) => {
56
44
  const r = i(e);
57
45
  return (r.upper + r.lower) / 2;
58
- }, q = (e) => ({
46
+ }, L = (e) => ({
59
47
  lower: Math.min(...e.map((r) => i(r).lower)),
60
48
  upper: Math.max(...e.map((r) => i(r).upper))
61
- }), C = (e) => ({
49
+ }), T = (e) => ({
62
50
  lower: Math.max(...e.map((r) => i(r).lower)),
63
51
  upper: Math.min(...e.map((r) => i(r).upper))
64
- }), R = (e) => {
52
+ }), Z = (e) => {
65
53
  const r = i(e), n = typeof r.lower == "bigint";
66
54
  return Array.from({ length: Number(w(e)) }, (t, o) => n ? r.lower + BigInt(o) : r.lower + o);
67
55
  }, I = (e, r) => {
68
- const n = e.map((l) => i(l)), t = n.findIndex((l) => a(l, r) || r < l.lower);
56
+ const n = e.map((s) => i(s)), t = n.findIndex((s) => a(s, r) || r < s.lower);
69
57
  if (t === -1) return { index: e.length, position: 0 };
70
58
  const o = n[t];
71
59
  return a(o, r) ? { index: t, position: Number(r - o.lower) } : { index: t, position: 0 };
@@ -74,102 +62,112 @@ const c = (e) => typeof e == "bigint" || e instanceof BigInt, m = (e, r) => c(e)
74
62
  removeAfter: 0,
75
63
  insertInto: 0,
76
64
  deleteInBetween: 0
77
- }, k = (e, r) => {
65
+ }, S = (e, r) => {
78
66
  const n = e.map((p) => i(p)), t = i(r);
79
67
  if (n.length === 0) return d;
80
- const o = I(n, t.lower), l = I(n, t.upper);
68
+ const o = I(n, t.lower), s = I(n, t.upper);
81
69
  if (o.index === e.length) return { ...d, insertInto: e.length };
82
- if (l.index === 0) return { ...d, removeAfter: l.position };
83
- if (o.index === l.index)
84
- return o.position !== 0 && l.position !== 0 ? null : {
85
- removeAfter: l.position,
70
+ if (s.index === 0) return { ...d, removeAfter: s.position };
71
+ if (o.index === s.index)
72
+ return o.position !== 0 && s.position !== 0 ? null : {
73
+ removeAfter: s.position,
86
74
  removeBefore: o.position,
87
75
  insertInto: o.index,
88
76
  deleteInBetween: 0
89
77
  };
90
- let u = l.index - o.index, f = o.index, s = m(Number(w(n[o.index])), o.position);
91
- return o.position !== 0 ? (u -= 1, f += 1) : s = 0, {
92
- removeBefore: s,
93
- removeAfter: l.position,
78
+ let u = s.index - o.index, f = o.index, l = v(Number(w(n[o.index])), o.position);
79
+ return o.position !== 0 ? (u -= 1, f += 1) : l = 0, {
80
+ removeBefore: l,
81
+ removeAfter: s.position,
94
82
  insertInto: f,
95
83
  deleteInBetween: u
96
84
  };
97
- }, U = (e, r, n) => {
85
+ }, $ = (e, r, n) => {
98
86
  const t = e.map((f) => i(f)), o = n > 0 ? 1 : n < 0 ? -1 : 0;
99
87
  if (o === 0) return r;
100
- let l = n, u = r;
101
- for (; O(l, 0) === !1; ) {
102
- const f = t.findIndex((s) => o > 0 ? u >= s.lower && u < s.upper : u > s.lower && u <= s.upper);
88
+ let s = n, u = r;
89
+ for (; g(s, 0) === !1; ) {
90
+ const f = t.findIndex((l) => o > 0 ? u >= l.lower && u < l.upper : u > l.lower && u <= l.upper);
103
91
  if (f !== -1) {
104
- const s = t[f];
92
+ const l = t[f];
105
93
  let p;
106
- if (o > 0 ? p = m(s.upper, u) : p = m(u, s.lower), p > 0) {
107
- const v = y(B(l), p);
108
- if (u = b(
94
+ if (o > 0 ? p = v(l.upper, u) : p = v(u, l.lower), p > 0) {
95
+ const m = h(x(s), p);
96
+ if (u = B(
109
97
  u,
110
- o > 0 ? v : -v
111
- ), l = m(l, o > 0 ? v : -v), O(l, 0)) return u;
98
+ o > 0 ? m : -m
99
+ ), s = v(s, o > 0 ? m : -m), g(s, 0)) return u;
112
100
  continue;
113
101
  }
114
102
  }
115
103
  if (o > 0) {
116
- const s = t.filter((p) => p.lower > u);
117
- if (s.length > 0) u = s[0].lower;
104
+ const l = t.filter((p) => p.lower > u);
105
+ if (l.length > 0) u = l[0].lower;
118
106
  else return u;
119
107
  } else {
120
- const s = t.filter((p) => p.upper < u);
121
- if (s.length > 0)
122
- u = s[s.length - 1].upper;
108
+ const l = t.filter((p) => p.upper < u);
109
+ if (l.length > 0)
110
+ u = l[l.length - 1].upper;
123
111
  else return u;
124
112
  }
125
113
  }
126
114
  return u;
127
- }, V = (e, r, n) => {
115
+ }, k = (e, r, n) => {
128
116
  const t = e.map((u) => i(u));
129
117
  if (r === n) return typeof r == "bigint" ? 0n : 0;
130
118
  const o = r < n ? i([r, n]) : i([n, r]);
131
- let l = typeof r == "bigint" ? 0n : 0;
119
+ let s = typeof r == "bigint" ? 0n : 0;
132
120
  for (const u of t) {
133
- const f = u.lower > o.lower ? u.lower : o.lower, s = u.upper < o.upper ? u.upper : o.upper;
134
- if (f < s) {
135
- const p = s - f;
136
- l = l + p;
121
+ const f = u.lower > o.lower ? u.lower : o.lower, l = u.upper < o.upper ? u.upper : o.upper;
122
+ if (f < l) {
123
+ const p = l - f;
124
+ s = s + p;
137
125
  }
138
126
  }
139
- return l;
140
- }, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
127
+ return s;
128
+ }, G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
141
129
  __proto__: null,
142
- CLIP: E,
143
- DECIMAL: z,
144
- INFINITE: P,
145
- ZERO: A,
146
- bounds: h,
147
- buildInsertionPlan: k,
148
- clamp: T,
130
+ CLIP: M,
131
+ DECIMAL: _,
132
+ INFINITE: N,
133
+ ZERO: y,
134
+ bounds: b,
135
+ buildInsertionPlan: S,
136
+ clamp: j,
149
137
  construct: i,
150
138
  contains: a,
151
- distance: V,
152
- equals: S,
139
+ distance: k,
140
+ equals: A,
153
141
  findInsertPosition: I,
154
- isFinite: Z,
155
- isZero: F,
156
- linspace: R,
157
- makeValid: g,
158
- max: q,
159
- mean: $,
160
- min: C,
161
- overlapsWith: D,
142
+ isFinite: D,
143
+ isZero: z,
144
+ linspace: Z,
145
+ makeValid: O,
146
+ max: L,
147
+ mean: F,
148
+ min: T,
149
+ overlapsWith: P,
162
150
  span: w,
163
- spanIsZero: L,
164
- traverse: U
151
+ spanIsZero: E,
152
+ traverse: $
165
153
  }, Symbol.toStringTag, { value: "Module" }));
166
154
  export {
167
- T as a,
168
- H as b,
155
+ j as a,
156
+ G as b,
169
157
  i as c,
170
158
  a as d,
171
- V as e,
172
- G as f,
173
- M as m,
174
- U as t
159
+ L as e,
160
+ k as f,
161
+ x as g,
162
+ B as h,
163
+ C as i,
164
+ W as j,
165
+ g as k,
166
+ U as l,
167
+ V as m,
168
+ h as n,
169
+ v as o,
170
+ R as r,
171
+ w as s,
172
+ $ as t
175
173
  };
package/dist/bounds.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bounds-Dwq6ZFHm.cjs");exports.bounds=e.bounds;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./bounds-BQo7rvs9.cjs");exports.bounds=e.bounds;
package/dist/bounds.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as r } from "./bounds-azUOoVVR.js";
1
+ import { b as r } from "./bounds-Bn5_l4Z3.js";
2
2
  export {
3
3
  r as bounds
4
4
  };
@@ -0,0 +1 @@
1
+ "use strict";const u=require("zod"),R=require("./direction-C-b6XTeU.cjs"),x=require("./location-BGl5Ddds.cjs"),i=require("./xy-B7065J2S.cjs"),m=require("./base-BAM2mqCy.cjs"),p=u.z.union([u.z.number(),u.z.string()]),H=u.z.object({top:p,left:p,width:p,height:p}),W=u.z.object({left:u.z.number(),top:u.z.number(),right:u.z.number(),bottom:u.z.number()}),S=u.z.object({one:m.xy,two:m.xy,root:x.corner}),B={one:i.ZERO,two:i.ZERO,root:x.TOP_LEFT},v={one:i.ZERO,two:i.ONE,root:x.BOTTOM_LEFT},C=(t,o)=>({one:t.one,two:t.two,root:o??t.root}),c=(t,o,e=0,n=0,s)=>{const r={one:{...i.ZERO},two:{...i.ZERO},root:s??x.TOP_LEFT};if(typeof t=="number"){if(typeof o!="number")throw new Error("Box constructor called with invalid arguments");return r.one={x:t,y:o},r.two={x:r.one.x+e,y:r.one.y+n},r}return"one"in t&&"two"in t&&"root"in t?{...t,root:s??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(r.one={x:t.left,y:t.top},r.two={x:t.right,y:t.bottom},r):(r.one=t,o==null?r.two={x:r.one.x+e,y:r.one.y+n}:typeof o=="number"?r.two={x:r.one.x+o,y:r.one.y+e}:"width"in o?r.two={x:r.one.x+o.width,y:r.one.y+o.height}:"signedWidth"in o?r.two={x:r.one.x+o.signedWidth,y:r.one.y+o.signedHeight}:r.two=o,r))},G=(t,o,e)=>{const n=c(t);if(typeof o=="string"){if(e==null)throw new Error("Invalid arguments for resize");const s=R.construct(o);return c(n.one,void 0,s==="x"?e:w(n),s==="y"?e:d(n),n.root)}return c(n.one,o,void 0,void 0,n.root)},D=(t,o,e=!0)=>{const n=c(t);let s=(r,y)=>r<y;return e&&(s=(r,y)=>r<=y),"one"in o?s(a(n),a(o))&&s(h(o),h(n))&&s(f(n),f(o))&&s(_(o),_(n)):s(a(n),o.x)&&s(o.x,h(n))&&s(f(n),o.y)&&s(o.y,_(n))},X=(t,o)=>i.equals(t.one,o.one)&&i.equals(t.two,o.two)&&x.xyEquals(t.root,o.root),I=t=>({width:w(t),height:d(t)}),$=t=>({signedWidth:O(t),signedHeight:E(t)}),U=t=>({top:f(t),left:a(t),width:w(t),height:d(t)}),L=(t,o,e=!1)=>{const n=R.construct(o)==="y"?E(t):O(t);return e?n:Math.abs(n)},l=(t,o)=>{const e=c(t);return{x:o.x==="center"?b(e).x:g(e,o.x),y:o.y==="center"?b(e).y:g(e,o.y)}},g=(t,o)=>{const e=c(t),n=x.xyCouple(e.root).includes(o)?Math.min:Math.max;return m.X_LOCATIONS.includes(o)?n(e.one.x,e.two.x):n(e.one.y,e.two.y)},Y=t=>t.one.x===t.two.x&&t.one.y===t.two.y,w=t=>L(t,"x"),d=t=>L(t,"y"),O=t=>{const o=c(t);return o.two.x-o.one.x},E=t=>{const o=c(t);return o.two.y-o.one.y},q=t=>l(t,x.TOP_LEFT),k=t=>l(t,x.TOP_CENTER),J=t=>l(t,x.TOP_RIGHT),K=t=>l(t,x.BOTTOM_LEFT),Q=t=>l(t,x.BOTTOM_CENTER),V=t=>l(t,x.BOTTOM_RIGHT),tt=t=>l(t,x.CENTER_LEFT),ot=t=>l(t,x.CENTER_RIGHT),h=t=>g(t,"right"),_=t=>g(t,"bottom"),a=t=>g(t,"left"),f=t=>g(t,"top"),b=t=>i.translate(q(t),{x:O(t)/2,y:E(t)/2}),M=t=>{const o=c(t);return o.root.x==="left"?a(o):h(o)},z=t=>{const o=c(t);return o.root.y==="top"?f(o):_(o)},nt=t=>({x:M(t),y:z(t)}),N=t=>{const o=c(t);return{lower:o.one.x,upper:o.two.x}},P=t=>{const o=c(t);return{lower:o.one.y,upper:o.two.y}},et=(t,o)=>C(t,o),rt=(t,o)=>{const e=c(t),n=m.X_LOCATIONS.includes(o)?"x":m.Y_LOCATIONS.includes(o)?"y":null;if(n===null)throw new Error(`Invalid location: ${o}`);const s=o==="top"||o==="left"?Math.min:Math.max,r={...e.one},y={...e.two};return r[n]=s(e.one[n],e.two[n]),y[n]=s(e.one[n],e.two[n]),[r,y]},st=(t,o)=>{const e=c(t),n=c(o),s=M(n)+(w(n)-w(e))/2,r=z(n)+(d(n)-d(e))/2;return c({x:s,y:r},I(e))},Z=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,ct=t=>w(t)/d(t),it=(t,o,e)=>{if(typeof o=="string"){if(e==null)throw new Error("Undefined amount passed into box.translate");const s=R.construct(o);o=i.construct(s,e)}const n=c(t);return c(i.translate(n.one,o),i.translate(n.two,o),void 0,void 0,n.root)},j=(t,o)=>{const e=Math.max(a(t),a(o)),n=Math.max(f(t),f(o)),s=Math.min(h(t),h(o)),r=Math.min(_(t),_(o));return e>s||n>r?B:c({x:e,y:n},{x:s,y:r},void 0,void 0,t.root)},A=t=>w(t)*d(t),xt=(t,o)=>{const e=c(t);return c(i.truncate(e.one,o),i.truncate(e.two,o),void 0,void 0,e.root)},F=(t,o,e,n,s,r)=>{const y={x:t,y:o},T={x:t+e,y:o+n};return s.x!==r.x&&(s.x==="center"?(y.x-=e/2,T.x-=e/2):(y.x-=e,T.x-=e)),s.y!==r.y&&(s.y==="center"?(y.y-=n/2,T.y-=n/2):(y.y-=n,T.y-=n)),c(y,T,void 0,void 0,r)},yt=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:v,ZERO:B,area:A,areaIsZero:Y,aspect:ct,bottom:_,bottomCenter:Q,bottomLeft:K,bottomRight:V,box:S,center:b,centerLeft:tt,centerRight:ot,construct:c,constructWithAlternateRoot:F,contains:D,copy:C,css:U,cssBox:H,dim:L,dims:I,domRect:W,edgePoints:rt,equals:X,height:d,intersection:j,isBox:Z,left:a,loc:g,positionInCenter:st,reRoot:et,resize:G,right:h,root:nt,signedDims:$,signedHeight:E,signedWidth:O,top:f,topCenter:k,topLeft:q,topRight:J,translate:it,truncate:xt,width:w,x:M,xBounds:N,xyLoc:l,y:z,yBounds:P},Symbol.toStringTag,{value:"Module"}));exports.area=A;exports.box=yt;exports.construct=c;exports.constructWithAlternateRoot=F;exports.height=d;exports.intersection=j;exports.isBox=Z;exports.width=w;exports.xBounds=N;exports.xyLoc=l;exports.yBounds=P;
@@ -0,0 +1,205 @@
1
+ import { z as x } from "zod";
2
+ import { c as O } from "./direction-BL0PhD1k.js";
3
+ import { c as A, T as M, B as j, b as S, d as Z, e as q, f as v, g as F, h as G, i as D, j as X } from "./location-C3aeu046.js";
4
+ import { Z as g, O as Y, e as I, t as b, c as U, a as L } from "./xy-D_LqxaGt.js";
5
+ import { x as $, X as N, Y as k } from "./base-DFq0vvGn.js";
6
+ const h = x.union([x.number(), x.string()]), J = x.object({
7
+ top: h,
8
+ left: h,
9
+ width: h,
10
+ height: h
11
+ }), K = x.object({
12
+ left: x.number(),
13
+ top: x.number(),
14
+ right: x.number(),
15
+ bottom: x.number()
16
+ }), Q = x.object({
17
+ one: $,
18
+ two: $,
19
+ root: A
20
+ }), H = { one: g, two: g, root: M }, V = { one: g, two: Y, root: j }, P = (t, o) => ({
21
+ one: t.one,
22
+ two: t.two,
23
+ root: o ?? t.root
24
+ }), c = (t, o, e = 0, n = 0, r) => {
25
+ const s = {
26
+ one: { ...g },
27
+ two: { ...g },
28
+ root: r ?? M
29
+ };
30
+ if (typeof t == "number") {
31
+ if (typeof o != "number")
32
+ throw new Error("Box constructor called with invalid arguments");
33
+ return s.one = { x: t, y: o }, s.two = { x: s.one.x + e, y: s.one.y + n }, s;
34
+ }
35
+ return "one" in t && "two" in t && "root" in t ? { ...t, root: r ?? t.root } : ("getBoundingClientRect" in t && (t = t.getBoundingClientRect()), "left" in t ? (s.one = { x: t.left, y: t.top }, s.two = { x: t.right, y: t.bottom }, s) : (s.one = t, o == null ? s.two = { x: s.one.x + e, y: s.one.y + n } : typeof o == "number" ? s.two = { x: s.one.x + o, y: s.one.y + e } : "width" in o ? s.two = {
36
+ x: s.one.x + o.width,
37
+ y: s.one.y + o.height
38
+ } : "signedWidth" in o ? s.two = {
39
+ x: s.one.x + o.signedWidth,
40
+ y: s.one.y + o.signedHeight
41
+ } : s.two = o, s));
42
+ }, tt = (t, o, e) => {
43
+ const n = c(t);
44
+ if (typeof o == "string") {
45
+ if (e == null) throw new Error("Invalid arguments for resize");
46
+ const r = O(o);
47
+ return c(
48
+ n.one,
49
+ void 0,
50
+ r === "x" ? e : f(n),
51
+ r === "y" ? e : w(n),
52
+ n.root
53
+ );
54
+ }
55
+ return c(n.one, o, void 0, void 0, n.root);
56
+ }, ot = (t, o, e = !0) => {
57
+ const n = c(t);
58
+ let r = (s, i) => s < i;
59
+ return e && (r = (s, i) => s <= i), "one" in o ? r(a(n), a(o)) && r(l(o), l(n)) && r(u(n), u(o)) && r(m(o), m(n)) : r(a(n), o.x) && r(o.x, l(n)) && r(u(n), o.y) && r(o.y, m(n));
60
+ }, nt = (t, o) => I(t.one, o.one) && I(t.two, o.two) && S(t.root, o.root), W = (t) => ({
61
+ width: f(t),
62
+ height: w(t)
63
+ }), et = (t) => ({
64
+ signedWidth: _(t),
65
+ signedHeight: T(t)
66
+ }), st = (t) => ({
67
+ top: u(t),
68
+ left: a(t),
69
+ width: f(t),
70
+ height: w(t)
71
+ }), C = (t, o, e = !1) => {
72
+ const n = O(o) === "y" ? T(t) : _(t);
73
+ return e ? n : Math.abs(n);
74
+ }, y = (t, o) => {
75
+ const e = c(t);
76
+ return {
77
+ x: o.x === "center" ? E(e).x : d(e, o.x),
78
+ y: o.y === "center" ? E(e).y : d(e, o.y)
79
+ };
80
+ }, d = (t, o) => {
81
+ const e = c(t), n = Z(e.root).includes(o) ? Math.min : Math.max;
82
+ return N.includes(o) ? n(e.one.x, e.two.x) : n(e.one.y, e.two.y);
83
+ }, rt = (t) => t.one.x === t.two.x && t.one.y === t.two.y, f = (t) => C(t, "x"), w = (t) => C(t, "y"), _ = (t) => {
84
+ const o = c(t);
85
+ return o.two.x - o.one.x;
86
+ }, T = (t) => {
87
+ const o = c(t);
88
+ return o.two.y - o.one.y;
89
+ }, z = (t) => y(t, M), ct = (t) => y(t, q), it = (t) => y(t, v), xt = (t) => y(t, j), yt = (t) => y(t, F), at = (t) => y(t, G), ut = (t) => y(t, D), ft = (t) => y(t, X), l = (t) => d(t, "right"), m = (t) => d(t, "bottom"), a = (t) => d(t, "left"), u = (t) => d(t, "top"), E = (t) => b(z(t), {
90
+ x: _(t) / 2,
91
+ y: T(t) / 2
92
+ }), B = (t) => {
93
+ const o = c(t);
94
+ return o.root.x === "left" ? a(o) : l(o);
95
+ }, R = (t) => {
96
+ const o = c(t);
97
+ return o.root.y === "top" ? u(o) : m(o);
98
+ }, wt = (t) => ({ x: B(t), y: R(t) }), lt = (t) => {
99
+ const o = c(t);
100
+ return { lower: o.one.x, upper: o.two.x };
101
+ }, mt = (t) => {
102
+ const o = c(t);
103
+ return { lower: o.one.y, upper: o.two.y };
104
+ }, dt = (t, o) => P(t, o), pt = (t, o) => {
105
+ const e = c(t), n = N.includes(o) ? "x" : k.includes(o) ? "y" : null;
106
+ if (n === null) throw new Error(`Invalid location: ${o}`);
107
+ const r = o === "top" || o === "left" ? Math.min : Math.max, s = { ...e.one }, i = { ...e.two };
108
+ return s[n] = r(e.one[n], e.two[n]), i[n] = r(e.one[n], e.two[n]), [s, i];
109
+ }, gt = (t, o) => {
110
+ const e = c(t), n = c(o), r = B(n) + (f(n) - f(e)) / 2, s = R(n) + (w(n) - w(e)) / 2;
111
+ return c({ x: r, y: s }, W(e));
112
+ }, ht = (t) => typeof t != "object" || t == null ? !1 : "one" in t && "two" in t && "root" in t, _t = (t) => f(t) / w(t), Tt = (t, o, e) => {
113
+ if (typeof o == "string") {
114
+ if (e == null) throw new Error("Undefined amount passed into box.translate");
115
+ const r = O(o);
116
+ o = U(r, e);
117
+ }
118
+ const n = c(t);
119
+ return c(
120
+ b(n.one, o),
121
+ b(n.two, o),
122
+ void 0,
123
+ void 0,
124
+ n.root
125
+ );
126
+ }, bt = (t, o) => {
127
+ const e = Math.max(a(t), a(o)), n = Math.max(u(t), u(o)), r = Math.min(l(t), l(o)), s = Math.min(m(t), m(o));
128
+ return e > r || n > s ? H : c({ x: e, y: n }, { x: r, y: s }, void 0, void 0, t.root);
129
+ }, Et = (t) => f(t) * w(t), Ot = (t, o) => {
130
+ const e = c(t);
131
+ return c(
132
+ L(e.one, o),
133
+ L(e.two, o),
134
+ void 0,
135
+ void 0,
136
+ e.root
137
+ );
138
+ }, Mt = (t, o, e, n, r, s) => {
139
+ const i = { x: t, y: o }, p = { x: t + e, y: o + n };
140
+ return r.x !== s.x && (r.x === "center" ? (i.x -= e / 2, p.x -= e / 2) : (i.x -= e, p.x -= e)), r.y !== s.y && (r.y === "center" ? (i.y -= n / 2, p.y -= n / 2) : (i.y -= n, p.y -= n)), c(i, p, void 0, void 0, s);
141
+ }, $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
142
+ __proto__: null,
143
+ DECIMAL: V,
144
+ ZERO: H,
145
+ area: Et,
146
+ areaIsZero: rt,
147
+ aspect: _t,
148
+ bottom: m,
149
+ bottomCenter: yt,
150
+ bottomLeft: xt,
151
+ bottomRight: at,
152
+ box: Q,
153
+ center: E,
154
+ centerLeft: ut,
155
+ centerRight: ft,
156
+ construct: c,
157
+ constructWithAlternateRoot: Mt,
158
+ contains: ot,
159
+ copy: P,
160
+ css: st,
161
+ cssBox: J,
162
+ dim: C,
163
+ dims: W,
164
+ domRect: K,
165
+ edgePoints: pt,
166
+ equals: nt,
167
+ height: w,
168
+ intersection: bt,
169
+ isBox: ht,
170
+ left: a,
171
+ loc: d,
172
+ positionInCenter: gt,
173
+ reRoot: dt,
174
+ resize: tt,
175
+ right: l,
176
+ root: wt,
177
+ signedDims: et,
178
+ signedHeight: T,
179
+ signedWidth: _,
180
+ top: u,
181
+ topCenter: ct,
182
+ topLeft: z,
183
+ topRight: it,
184
+ translate: Tt,
185
+ truncate: Ot,
186
+ width: f,
187
+ x: B,
188
+ xBounds: lt,
189
+ xyLoc: y,
190
+ y: R,
191
+ yBounds: mt
192
+ }, Symbol.toStringTag, { value: "Module" }));
193
+ export {
194
+ Mt as a,
195
+ $t as b,
196
+ c,
197
+ Et as d,
198
+ ht as e,
199
+ lt as f,
200
+ w as h,
201
+ bt as i,
202
+ f as w,
203
+ y as x,
204
+ mt as y
205
+ };
package/dist/box.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./box-Bzya27QS.cjs");exports.box=e.box;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./box-0YrQibkB.cjs");exports.box=e.box;
package/dist/box.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as r } from "./box-DrsrRNSe.js";
1
+ import { b as r } from "./box-Cc8IzcNo.js";
2
2
  export {
3
3
  r as box
4
4
  };