@synnaxlabs/x 0.49.3 → 0.52.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/dist/eslint.config.d.ts +2 -2
  3. package/dist/eslint.config.d.ts.map +1 -1
  4. package/dist/src/color/color.d.ts +26 -2
  5. package/dist/src/color/color.d.ts.map +1 -1
  6. package/dist/src/color/gradient.d.ts +10 -0
  7. package/dist/src/color/gradient.d.ts.map +1 -1
  8. package/dist/src/color/palette.d.ts +22 -2
  9. package/dist/src/color/palette.d.ts.map +1 -1
  10. package/dist/src/index.d.ts +0 -1
  11. package/dist/src/index.d.ts.map +1 -1
  12. package/dist/src/kv/types.d.ts.map +1 -1
  13. package/dist/src/label/label.d.ts +15 -1
  14. package/dist/src/label/label.d.ts.map +1 -1
  15. package/dist/src/record/record.d.ts +23 -9
  16. package/dist/src/record/record.d.ts.map +1 -1
  17. package/dist/src/status/status.d.ts +5 -0
  18. package/dist/src/status/status.d.ts.map +1 -1
  19. package/dist/src/sync/mutex.d.ts +3 -3
  20. package/dist/src/zod/util.d.ts +2 -0
  21. package/dist/src/zod/util.d.ts.map +1 -1
  22. package/dist/x.cjs +11 -8
  23. package/dist/x.js +1106 -1129
  24. package/eslint.config.ts +3 -3
  25. package/package.json +9 -8
  26. package/src/array/external.ts +1 -1
  27. package/src/array/index.ts +1 -1
  28. package/src/array/nullable.ts +1 -1
  29. package/src/array/toArray.spec.ts +1 -1
  30. package/src/array/toArray.ts +1 -1
  31. package/src/array/update.spec.ts +1 -1
  32. package/src/array/update.ts +1 -1
  33. package/src/binary/codec.spec.ts +1 -1
  34. package/src/binary/codec.ts +1 -1
  35. package/src/binary/index.ts +1 -1
  36. package/src/breaker/breaker.spec.ts +1 -1
  37. package/src/breaker/breaker.ts +1 -1
  38. package/src/breaker/index.ts +1 -1
  39. package/src/caseconv/caseconv.spec.ts +1 -1
  40. package/src/caseconv/caseconv.ts +1 -1
  41. package/src/caseconv/index.ts +1 -1
  42. package/src/change/change.ts +1 -1
  43. package/src/change/index.ts +1 -1
  44. package/src/clamp/clamp.ts +1 -1
  45. package/src/color/color.spec.ts +27 -2
  46. package/src/color/color.ts +10 -4
  47. package/src/color/external.ts +1 -1
  48. package/src/color/gradient.ts +1 -1
  49. package/src/color/index.ts +1 -1
  50. package/src/color/palette.ts +1 -1
  51. package/src/compare/binary.spec.ts +1 -1
  52. package/src/compare/binary.ts +1 -1
  53. package/src/compare/compare.spec.ts +1 -1
  54. package/src/compare/compare.ts +1 -1
  55. package/src/compare/external.ts +1 -1
  56. package/src/compare/index.ts +1 -1
  57. package/src/control/control.ts +1 -1
  58. package/src/control/index.ts +1 -1
  59. package/src/csv/csv.spec.ts +1 -1
  60. package/src/csv/csv.ts +1 -1
  61. package/src/csv/index.ts +1 -1
  62. package/src/debounce/debounce.spec.ts +1 -1
  63. package/src/debounce/debounce.ts +1 -1
  64. package/src/debounce/index.ts +1 -1
  65. package/src/deep/copy.spec.ts +1 -1
  66. package/src/deep/copy.ts +1 -1
  67. package/src/deep/difference.spec.ts +1 -1
  68. package/src/deep/difference.ts +1 -1
  69. package/src/deep/equal.spec.ts +1 -1
  70. package/src/deep/equal.ts +1 -1
  71. package/src/deep/external.ts +1 -1
  72. package/src/deep/get.bench.ts +1 -1
  73. package/src/deep/get.spec.ts +1 -1
  74. package/src/deep/get.ts +1 -1
  75. package/src/deep/index.ts +1 -1
  76. package/src/deep/join.ts +1 -1
  77. package/src/deep/merge.spec.ts +1 -1
  78. package/src/deep/merge.ts +1 -1
  79. package/src/deep/partial.spec.ts +1 -1
  80. package/src/deep/partial.ts +1 -1
  81. package/src/deep/path.spec.ts +1 -1
  82. package/src/deep/path.ts +1 -1
  83. package/src/deep/remove.bench.ts +1 -1
  84. package/src/deep/remove.spec.ts +1 -1
  85. package/src/deep/remove.ts +1 -1
  86. package/src/deep/set.bench.ts +1 -1
  87. package/src/deep/set.spec.ts +1 -1
  88. package/src/deep/set.ts +1 -1
  89. package/src/destructor/destructor.ts +1 -1
  90. package/src/destructor/index.ts +1 -1
  91. package/src/errors/errors.spec.ts +1 -1
  92. package/src/errors/errors.ts +1 -1
  93. package/src/errors/index.ts +1 -1
  94. package/src/id/id.spec.ts +1 -1
  95. package/src/id/id.ts +1 -1
  96. package/src/id/index.ts +1 -1
  97. package/src/index.ts +1 -2
  98. package/src/instance/index.ts +1 -1
  99. package/src/instance/matcher.spec.ts +1 -1
  100. package/src/instance/matcher.ts +1 -1
  101. package/src/kv/external.ts +1 -1
  102. package/src/kv/index.ts +1 -1
  103. package/src/kv/mock.spec.ts +1 -1
  104. package/src/kv/mock.ts +1 -1
  105. package/src/kv/types.ts +2 -4
  106. package/src/label/index.ts +1 -1
  107. package/src/label/label.ts +4 -2
  108. package/src/link/index.ts +1 -1
  109. package/src/link/link.spec.ts +1 -1
  110. package/src/link/link.ts +1 -1
  111. package/src/map/index.ts +1 -1
  112. package/src/map/map.spec.ts +1 -1
  113. package/src/map/map.ts +1 -1
  114. package/src/math/constants.ts +1 -1
  115. package/src/math/external.ts +1 -1
  116. package/src/math/index.ts +1 -1
  117. package/src/math/math.spec.ts +1 -1
  118. package/src/math/math.ts +1 -1
  119. package/src/math/round.spec.ts +1 -1
  120. package/src/math/round.ts +1 -1
  121. package/src/migrate/index.ts +1 -1
  122. package/src/migrate/migrate.spec.ts +1 -1
  123. package/src/migrate/migrate.ts +5 -5
  124. package/src/mock/MockGLBufferController.ts +1 -1
  125. package/src/narrow/index.ts +1 -1
  126. package/src/narrow/narrow.spec.ts +1 -1
  127. package/src/narrow/narrow.ts +1 -1
  128. package/src/notation/index.ts +1 -1
  129. package/src/notation/notation.spec.ts +1 -1
  130. package/src/notation/notation.ts +1 -1
  131. package/src/numeric/index.ts +1 -1
  132. package/src/numeric/numeric.ts +1 -1
  133. package/src/observe/index.ts +1 -1
  134. package/src/observe/observe.ts +1 -1
  135. package/src/observe/obsever.spec.ts +1 -1
  136. package/src/optional/index.ts +1 -1
  137. package/src/optional/optional.ts +1 -1
  138. package/src/primitive/index.ts +1 -1
  139. package/src/primitive/primitive.spec.ts +1 -1
  140. package/src/primitive/primitive.ts +1 -1
  141. package/src/record/index.ts +1 -1
  142. package/src/record/record.spec.ts +32 -18
  143. package/src/record/record.ts +30 -14
  144. package/src/runtime/detect.ts +1 -1
  145. package/src/runtime/external.ts +1 -1
  146. package/src/runtime/index.ts +1 -1
  147. package/src/runtime/os.ts +1 -1
  148. package/src/scheduler/index.ts +1 -1
  149. package/src/scheduler/scheduler.spec.ts +1 -1
  150. package/src/scheduler/scheduler.ts +1 -1
  151. package/src/shallow/copy.spec.ts +1 -1
  152. package/src/shallow/copy.ts +1 -1
  153. package/src/shallow/index.ts +1 -1
  154. package/src/singleton/define.spec.ts +1 -1
  155. package/src/singleton/define.ts +1 -1
  156. package/src/singleton/index.ts +1 -1
  157. package/src/sleep/index.ts +1 -1
  158. package/src/sleep/sleep.ts +1 -1
  159. package/src/spatial/base.ts +1 -1
  160. package/src/spatial/bounds/bounds.spec.ts +1 -1
  161. package/src/spatial/bounds/bounds.ts +1 -1
  162. package/src/spatial/bounds/index.ts +1 -1
  163. package/src/spatial/box/box.spec.ts +1 -1
  164. package/src/spatial/box/box.ts +1 -1
  165. package/src/spatial/box/index.ts +1 -1
  166. package/src/spatial/dimensions/dimensions.spec.ts +1 -1
  167. package/src/spatial/dimensions/dimensions.ts +1 -1
  168. package/src/spatial/dimensions/index.ts +1 -1
  169. package/src/spatial/direction/direction.spec.ts +1 -1
  170. package/src/spatial/direction/direction.ts +1 -1
  171. package/src/spatial/direction/index.ts +1 -1
  172. package/src/spatial/external.ts +1 -1
  173. package/src/spatial/index.ts +1 -1
  174. package/src/spatial/location/index.ts +1 -1
  175. package/src/spatial/location/location.spec.ts +1 -1
  176. package/src/spatial/location/location.ts +1 -1
  177. package/src/spatial/scale/index.ts +1 -1
  178. package/src/spatial/scale/scale.spec.ts +1 -1
  179. package/src/spatial/scale/scale.ts +1 -1
  180. package/src/spatial/spatial.ts +1 -1
  181. package/src/spatial/sticky/index.ts +1 -1
  182. package/src/spatial/sticky/sticky.spec.ts +1 -1
  183. package/src/spatial/sticky/sticky.ts +1 -1
  184. package/src/spatial/xy/index.ts +1 -1
  185. package/src/spatial/xy/xy.spec.ts +1 -1
  186. package/src/spatial/xy/xy.ts +1 -1
  187. package/src/status/index.ts +1 -1
  188. package/src/status/status.spec.ts +168 -1
  189. package/src/status/status.ts +47 -1
  190. package/src/strings/deduplicateFileName.spec.ts +1 -1
  191. package/src/strings/deduplicateFileName.ts +1 -1
  192. package/src/strings/external.ts +1 -1
  193. package/src/strings/index.ts +1 -1
  194. package/src/strings/strings.spec.ts +1 -1
  195. package/src/strings/strings.ts +1 -1
  196. package/src/sync/index.ts +1 -1
  197. package/src/sync/mutex.ts +4 -4
  198. package/src/telem/gl.ts +1 -1
  199. package/src/telem/index.ts +1 -1
  200. package/src/telem/series.spec.ts +1 -1
  201. package/src/telem/series.ts +4 -4
  202. package/src/telem/telem.spec.ts +1 -1
  203. package/src/telem/telem.ts +1 -1
  204. package/src/testutil/index.ts +1 -1
  205. package/src/testutil/testutil.spec.ts +1 -1
  206. package/src/testutil/testutil.ts +1 -1
  207. package/src/types/index.ts +1 -1
  208. package/src/unique/index.ts +1 -1
  209. package/src/unique/unique.spec.ts +1 -1
  210. package/src/unique/unique.ts +1 -1
  211. package/src/url/index.ts +1 -1
  212. package/src/url/url.spec.ts +1 -1
  213. package/src/url/url.ts +1 -1
  214. package/src/uuid/index.ts +1 -1
  215. package/src/uuid/uuid.spec.ts +1 -1
  216. package/src/uuid/uuid.ts +1 -1
  217. package/src/worker/index.ts +1 -1
  218. package/src/worker/worker.spec.ts +1 -1
  219. package/src/worker/worker.ts +1 -1
  220. package/src/zod/external.ts +1 -1
  221. package/src/zod/index.ts +1 -1
  222. package/src/zod/nullToUndefined.spec.ts +1 -1
  223. package/src/zod/nullToUndefined.ts +1 -1
  224. package/src/zod/schemas.spec.ts +1 -1
  225. package/src/zod/schemas.ts +1 -1
  226. package/src/zod/toArray.spec.ts +1 -1
  227. package/src/zod/toArray.ts +1 -1
  228. package/src/zod/util.spec.ts +31 -1
  229. package/src/zod/util.ts +14 -1
  230. package/tsconfig.tsbuildinfo +1 -1
  231. package/vite.config.ts +1 -2
  232. package/dist/src/jsonrpc/index.d.ts +0 -2
  233. package/dist/src/jsonrpc/index.d.ts.map +0 -1
  234. package/dist/src/jsonrpc/jsonrpc.d.ts +0 -70
  235. package/dist/src/jsonrpc/jsonrpc.d.ts.map +0 -1
  236. package/dist/src/jsonrpc/jsonrpc.spec.d.ts +0 -2
  237. package/dist/src/jsonrpc/jsonrpc.spec.d.ts.map +0 -1
  238. package/src/jsonrpc/index.ts +0 -10
  239. package/src/jsonrpc/jsonrpc.spec.ts +0 -135
  240. package/src/jsonrpc/jsonrpc.ts +0 -125
package/eslint.config.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,6 +7,6 @@
7
7
  // License, use of this software will be governed by the Apache License, Version 2.0,
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
- import synnaxConfig from "eslint-config-synnaxlabs";
10
+ import cfg from "@synnaxlabs/eslint-config";
11
11
 
12
- export default synnaxConfig;
12
+ export default cfg;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synnaxlabs/x",
3
- "version": "0.49.3",
3
+ "version": "0.52.3",
4
4
  "type": "module",
5
5
  "description": "Common Utilities for Synnax Labs",
6
6
  "repository": "https://github.com/synnaxlabs/synnax/tree/main/x/ts",
@@ -16,19 +16,19 @@
16
16
  "async-mutex": "^0.5.0",
17
17
  "nanoid": "^5.1.6",
18
18
  "uuid": "^13.0.0",
19
- "zod": "^4.1.12"
19
+ "zod": "^4.3.6"
20
20
  },
21
21
  "devDependencies": {
22
- "@types/node": "^24.10.0",
22
+ "@types/node": "^25.1.0",
23
23
  "@vitest/coverage-v8": "^3.2.4",
24
- "eslint": "^9.39.1",
24
+ "eslint": "^9.39.2",
25
25
  "madge": "^8.0.0",
26
26
  "typescript": "^5.9.3",
27
- "vite": "^7.1.12",
27
+ "vite": "^7.3.1",
28
28
  "vitest": "^3.2.4",
29
- "@synnaxlabs/tsconfig": "^0.43.0",
30
- "eslint-config-synnaxlabs": "^0.43.0",
31
- "@synnaxlabs/vite-plugin": "^0.43.0"
29
+ "@synnaxlabs/eslint-config": "^0.0.0",
30
+ "@synnaxlabs/tsconfig": "^0.0.0",
31
+ "@synnaxlabs/vite-plugin": "^0.0.0"
32
32
  },
33
33
  "main": "dist/x.cjs",
34
34
  "module": "dist/x.js",
@@ -37,6 +37,7 @@
37
37
  "build": "tsc --noEmit && vite build",
38
38
  "check-types": "tsc --noEmit",
39
39
  "test": "vitest",
40
+ "cov": "vitest --coverage",
40
41
  "lint": "eslint",
41
42
  "fix": "eslint --fix",
42
43
  "madge": "madge --circular src"
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -71,6 +71,27 @@ describe("color.Color", () => {
71
71
  expect(color.bValue(c)).toEqual(38);
72
72
  expect(color.aValue(c)).toEqual(0.5);
73
73
  });
74
+
75
+ test("from rgba struct", () => {
76
+ const c = color.construct({ r: 255, g: 0, b: 0, a: 1 });
77
+ expect(color.rValue(c)).toEqual(255);
78
+ expect(color.gValue(c)).toEqual(0);
79
+ expect(color.bValue(c)).toEqual(0);
80
+ expect(color.aValue(c)).toEqual(1);
81
+ });
82
+
83
+ test("from rgba struct with alpha", () => {
84
+ const c = color.construct({ r: 122, g: 44, b: 38, a: 0.5 });
85
+ expect(color.rValue(c)).toEqual(122);
86
+ expect(color.gValue(c)).toEqual(44);
87
+ expect(color.bValue(c)).toEqual(38);
88
+ expect(color.aValue(c)).toEqual(0.5);
89
+ });
90
+
91
+ test("colorZ parses rgba struct", () => {
92
+ const c = color.colorZ.parse({ r: 255, g: 0, b: 0, a: 1 });
93
+ expect(c).toEqual([255, 0, 0, 1]);
94
+ });
74
95
  });
75
96
 
76
97
  describe("to hex", () => {
@@ -80,7 +101,7 @@ describe("color.Color", () => {
80
101
  });
81
102
  test("with alpha", () => {
82
103
  const c = color.construct("#7a2c26", 0.5);
83
- expect(color.hex(c)).toEqual("#7a2c267f");
104
+ expect(color.hex(c)).toEqual("#7a2c2680");
84
105
  });
85
106
  });
86
107
 
@@ -694,6 +715,10 @@ describe("color.Color", () => {
694
715
  expect(color.isCrude([255, 0, 0, -0.1])).toBe(false);
695
716
  });
696
717
 
718
+ test("RGBA struct is a crude color", () => {
719
+ expect(color.isCrude({ r: 255, g: 0, b: 0, a: 1 })).toBe(true);
720
+ });
721
+
697
722
  test("rejects non-color values", () => {
698
723
  expect(color.isCrude(null)).toBe(false);
699
724
  expect(color.isCrude(undefined)).toBe(false);
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -24,6 +24,10 @@ const rgbaZ = z.tuple([rgbValueZ, rgbValueZ, rgbValueZ, alphaZ]);
24
24
  const rgbZ = z.tuple([rgbValueZ, rgbValueZ, rgbValueZ]);
25
25
  /** A zod schema for a legacy color object. */
26
26
  const legacyObjectZ = z.object({ rgba255: rgbaZ });
27
+ /** A zod schema for an RGBA struct (r, g, b, a fields). */
28
+ const rgbaStructZ = z.object({ r: rgbValueZ, g: rgbValueZ, b: rgbValueZ, a: alphaZ });
29
+ /** An RGBA struct with named fields. */
30
+ export type RGBAStruct = z.infer<typeof rgbaStructZ>;
27
31
  /** A zod schema for a hue value between 0 and 360. */
28
32
  const hueZ = z.number().min(0).max(360);
29
33
  /** A zod schema for a saturation value between 0 and 100. */
@@ -46,12 +50,12 @@ export type Hex = z.infer<typeof hexZ>;
46
50
  type LegacyObject = z.infer<typeof legacyObjectZ>;
47
51
 
48
52
  /** A zod schema for a crude color representation. */
49
- export const crudeZ = z.union([hexZ, rgbZ, rgbaZ, hslaZ, legacyObjectZ]);
53
+ export const crudeZ = z.union([hexZ, rgbZ, rgbaZ, hslaZ, legacyObjectZ, rgbaStructZ]);
50
54
  /**
51
55
  * An unparsed representation of a color i.e. a value that can be converted into
52
56
  * a Color object.
53
57
  */
54
- export type Crude = Hex | RGBA | Color | RGB | LegacyObject;
58
+ export type Crude = Hex | RGBA | Color | RGB | LegacyObject | RGBAStruct;
55
59
 
56
60
  /** A zod schema to parse color values from various crude representations. */
57
61
  export const colorZ = crudeZ.transform((v) => construct(v));
@@ -113,6 +117,7 @@ export const construct = (color: Crude, alpha: number = 1): Color => {
113
117
  if (color.length === 3) return [...color, alpha];
114
118
  return color;
115
119
  }
120
+ if ("a" in color && "r" in color) return [color.r, color.g, color.b, color.a];
116
121
  return color.rgba255;
117
122
  };
118
123
 
@@ -140,8 +145,9 @@ export interface ToHex {
140
145
  export const hex = ((color?: Crude) => {
141
146
  if (color == null) return undefined;
142
147
  const [r, g, b, a] = construct(color);
148
+ const alphaByte = Math.round(a * 255);
143
149
  return `#${rgbaToHex(r)}${rgbaToHex(g)}${rgbaToHex(b)}${
144
- a === 1 ? "" : rgbaToHex(a * 255)
150
+ alphaByte === 255 ? "" : rgbaToHex(alphaByte)
145
151
  }`;
146
152
  }) as ToHex;
147
153
 
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/csv/csv.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/csv/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/deep/copy.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/deep/equal.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/deep/get.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/deep/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/deep/join.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/deep/merge.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/deep/path.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/deep/set.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2025 Synnax Labs, Inc.
1
+ // Copyright 2026 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.