@synnaxlabs/pluto 0.53.1 → 0.54.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 (286) hide show
  1. package/dist/aether-BBeeeA1z.cjs +10 -0
  2. package/dist/aether-Bl3vMZO3.js +716 -0
  3. package/dist/aether-DmSenWd4.js +704 -0
  4. package/dist/aether-VeYJQDcf.cjs +11 -0
  5. package/dist/button-DBdzH6Ky.cjs +1 -0
  6. package/dist/button-KtgabnXL.js +251 -0
  7. package/dist/button.cjs +1 -1
  8. package/dist/button.js +2 -4
  9. package/dist/chunk-DeC0fbbY.js +23 -0
  10. package/dist/chunk-FeXHwk1_.cjs +1 -0
  11. package/dist/color-Cspp5cKp.js +7904 -0
  12. package/dist/color-DCCr0Z1b.cjs +29 -0
  13. package/dist/color.cjs +1 -1
  14. package/dist/color.js +2 -4
  15. package/dist/css-Ce-x3HcK.cjs +1 -0
  16. package/dist/css-UEo6g0SR.js +69 -0
  17. package/dist/css.cjs +1 -1
  18. package/dist/css.js +2 -8
  19. package/dist/dialog-BTCrp5Yv.cjs +1 -0
  20. package/dist/dialog-ClQI4sHo.js +331 -0
  21. package/dist/dialog.cjs +1 -1
  22. package/dist/dialog.js +2 -4
  23. package/dist/divider-BYRH8-5K.js +13 -0
  24. package/dist/divider-CEyntx31.cjs +1 -0
  25. package/dist/ether-CZlE80D0.cjs +53 -0
  26. package/dist/ether-KMGPzrZR.js +6222 -0
  27. package/dist/ether.cjs +1 -1
  28. package/dist/ether.js +4 -104
  29. package/dist/event-Btz3eWg1.cjs +1 -0
  30. package/dist/event-Z4V8c501.js +4 -0
  31. package/dist/flex-Bgtu0DK6.js +62 -0
  32. package/dist/flex-D_GoD3ed.cjs +1 -0
  33. package/dist/flex.cjs +1 -1
  34. package/dist/flex.js +2 -4
  35. package/dist/haul-BdMc4rLJ.js +171 -0
  36. package/dist/haul-ZdSHqhp6.cjs +1 -0
  37. package/dist/header-CNx3pAkx.js +64 -0
  38. package/dist/header-lD0sRjCR.cjs +1 -0
  39. package/dist/header.cjs +1 -1
  40. package/dist/header.js +2 -4
  41. package/dist/input-CdL1OPDU.cjs +74 -0
  42. package/dist/input-h-4axMs7.js +47772 -0
  43. package/dist/input.cjs +1 -1
  44. package/dist/input.js +2 -4
  45. package/dist/list-DacuSBB3.cjs +4 -0
  46. package/dist/list-dZDsxTzd.js +1756 -0
  47. package/dist/list.cjs +1 -1
  48. package/dist/list.js +2 -4
  49. package/dist/menu-eeXfR_zT.js +170 -0
  50. package/dist/menu-yADx33I8.cjs +1 -0
  51. package/dist/menu.cjs +1 -1
  52. package/dist/menu.js +2 -4
  53. package/dist/pluto.cjs +52 -0
  54. package/dist/pluto.css +2 -1
  55. package/dist/pluto.js +36474 -0
  56. package/dist/select-B93mFqvf.js +1328 -0
  57. package/dist/select-gt7wGGO4.cjs +1 -0
  58. package/dist/src/access/policy/queries.d.ts +34 -34
  59. package/dist/src/access/policy/queries.d.ts.map +1 -1
  60. package/dist/src/access/queries.d.ts +1 -1
  61. package/dist/src/access/queries.d.ts.map +1 -1
  62. package/dist/src/access/role/queries.d.ts +2 -12
  63. package/dist/src/access/role/queries.d.ts.map +1 -1
  64. package/dist/src/arc/queries.d.ts +1167 -29
  65. package/dist/src/arc/queries.d.ts.map +1 -1
  66. package/dist/src/channel/LinePlot.d.ts +2 -2
  67. package/dist/src/channel/LinePlot.d.ts.map +1 -1
  68. package/dist/src/channel/queries.d.ts +108 -60
  69. package/dist/src/channel/queries.d.ts.map +1 -1
  70. package/dist/src/color/Provider.d.ts +8 -8
  71. package/dist/src/device/queries.d.ts +148 -363
  72. package/dist/src/device/queries.d.ts.map +1 -1
  73. package/dist/src/flux/result.d.ts +5 -5
  74. package/dist/src/flux/result.d.ts.map +1 -1
  75. package/dist/src/flux/update.d.ts +1 -1
  76. package/dist/src/flux/update.d.ts.map +1 -1
  77. package/dist/src/icon/Icon.d.ts.map +1 -1
  78. package/dist/src/icon/registry.d.ts +1 -0
  79. package/dist/src/icon/registry.d.ts.map +1 -1
  80. package/dist/src/label/queries.d.ts +21 -21
  81. package/dist/src/label/queries.d.ts.map +1 -1
  82. package/dist/src/lineplot/aether/XAxis.d.ts +28 -28
  83. package/dist/src/lineplot/aether/YAxis.d.ts +28 -28
  84. package/dist/src/lineplot/aether/axis.d.ts +14 -14
  85. package/dist/src/lineplot/queries.d.ts +2 -2
  86. package/dist/src/lineplot/queries.d.ts.map +1 -1
  87. package/dist/src/lineplot/range/aether/provider.d.ts +126 -102
  88. package/dist/src/lineplot/range/aether/provider.d.ts.map +1 -1
  89. package/dist/src/lineplot/tooltip/aether/tooltip.d.ts +56 -56
  90. package/dist/src/log/aether/Log.d.ts +21 -21
  91. package/dist/src/log/queries.d.ts +2 -2
  92. package/dist/src/log/queries.d.ts.map +1 -1
  93. package/dist/src/memo/index.d.ts +0 -1
  94. package/dist/src/memo/index.d.ts.map +1 -1
  95. package/dist/src/memo/useMemoCompare.d.ts +0 -1
  96. package/dist/src/memo/useMemoCompare.d.ts.map +1 -1
  97. package/dist/src/rack/queries.d.ts.map +1 -1
  98. package/dist/src/ranger/aether/queries.d.ts.map +1 -1
  99. package/dist/src/ranger/queries.d.ts +19 -19
  100. package/dist/src/ranger/queries.d.ts.map +1 -1
  101. package/dist/src/schematic/queries.d.ts +2 -2
  102. package/dist/src/schematic/queries.d.ts.map +1 -1
  103. package/dist/src/schematic/symbol/Forms.d.ts.map +1 -1
  104. package/dist/src/schematic/symbol/Primitives.d.ts +2 -1
  105. package/dist/src/schematic/symbol/Primitives.d.ts.map +1 -1
  106. package/dist/src/schematic/symbol/SelectOrientation.d.ts.map +1 -1
  107. package/dist/src/schematic/symbol/Symbols.d.ts +35 -34
  108. package/dist/src/schematic/symbol/Symbols.d.ts.map +1 -1
  109. package/dist/src/schematic/symbol/queries.d.ts +96 -50
  110. package/dist/src/schematic/symbol/queries.d.ts.map +1 -1
  111. package/dist/src/schematic/symbol/registry.d.ts.map +1 -1
  112. package/dist/src/select/Dialog.d.ts +2 -1
  113. package/dist/src/select/Dialog.d.ts.map +1 -1
  114. package/dist/src/status/Select.d.ts.map +1 -1
  115. package/dist/src/status/SelectMulipleVariants.spec.d.ts +2 -0
  116. package/dist/src/status/SelectMulipleVariants.spec.d.ts.map +1 -0
  117. package/dist/src/status/SelectMultipleVariants.d.ts +9 -0
  118. package/dist/src/status/SelectMultipleVariants.d.ts.map +1 -0
  119. package/dist/src/status/SelectVariant.d.ts +2 -2
  120. package/dist/src/status/SelectVariant.d.ts.map +1 -1
  121. package/dist/src/status/SelectVariant.spec.d.ts +2 -0
  122. package/dist/src/status/SelectVariant.spec.d.ts.map +1 -0
  123. package/dist/src/status/aether/aggregator.d.ts +16 -2
  124. package/dist/src/status/aether/aggregator.d.ts.map +1 -1
  125. package/dist/src/status/aether/errorHandler.d.ts +2 -1
  126. package/dist/src/status/aether/errorHandler.d.ts.map +1 -1
  127. package/dist/src/status/base/Aggregator.d.ts +3 -2
  128. package/dist/src/status/base/Aggregator.d.ts.map +1 -1
  129. package/dist/src/status/external.d.ts +1 -0
  130. package/dist/src/status/external.d.ts.map +1 -1
  131. package/dist/src/status/queries.d.ts +25 -9
  132. package/dist/src/status/queries.d.ts.map +1 -1
  133. package/dist/src/status/variantData.d.ts +4 -0
  134. package/dist/src/status/variantData.d.ts.map +1 -0
  135. package/dist/src/table/cells/Cells.d.ts +17 -17
  136. package/dist/src/table/queries.d.ts +2 -2
  137. package/dist/src/table/queries.d.ts.map +1 -1
  138. package/dist/src/task/queries.d.ts +3 -3
  139. package/dist/src/task/queries.d.ts.map +1 -1
  140. package/dist/src/telem/aether/noop.d.ts.map +1 -1
  141. package/dist/src/telem/aether/static.d.ts +10 -10
  142. package/dist/src/telem/aether/telem.d.ts +1 -1
  143. package/dist/src/telem/aether/telem.d.ts.map +1 -1
  144. package/dist/src/telem/aether/transformers.d.ts +15 -15
  145. package/dist/src/telem/aether/transformers.d.ts.map +1 -1
  146. package/dist/src/telem/client/cache/cache.d.ts +1 -1
  147. package/dist/src/telem/client/cache/cache.d.ts.map +1 -1
  148. package/dist/src/telem/client/client.d.ts +4 -4
  149. package/dist/src/telem/client/client.d.ts.map +1 -1
  150. package/dist/src/telem/client/reader.d.ts +1 -1
  151. package/dist/src/telem/client/reader.d.ts.map +1 -1
  152. package/dist/src/telem/client/streamer.d.ts +1 -1
  153. package/dist/src/telem/client/streamer.d.ts.map +1 -1
  154. package/dist/src/telem/control/Controller.d.ts +1 -1
  155. package/dist/src/telem/control/Controller.d.ts.map +1 -1
  156. package/dist/src/telem/control/aether/chip.d.ts +16 -2
  157. package/dist/src/telem/control/aether/chip.d.ts.map +1 -1
  158. package/dist/src/telem/control/aether/controller.d.ts +16 -16
  159. package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
  160. package/dist/src/telem/control/aether/indicator.d.ts +51 -37
  161. package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
  162. package/dist/src/telem/control/aether/legend.d.ts +18 -16
  163. package/dist/src/telem/control/aether/legend.d.ts.map +1 -1
  164. package/dist/src/telem/control/aether/state.d.ts +9 -8
  165. package/dist/src/telem/control/aether/state.d.ts.map +1 -1
  166. package/dist/src/theming/aether/provider.d.ts +990 -990
  167. package/dist/src/theming/base/theme.d.ts +330 -330
  168. package/dist/src/user/queries.d.ts +2 -2
  169. package/dist/src/view/queries.d.ts +2 -2
  170. package/dist/src/vis/axis/axis.d.ts +14 -14
  171. package/dist/src/vis/gauge/aether/gauge.d.ts +21 -21
  172. package/dist/src/vis/gauge/use.d.ts +7 -7
  173. package/dist/src/vis/line/aether/line.d.ts +7 -7
  174. package/dist/src/vis/measure/aether/measure.d.ts +56 -56
  175. package/dist/src/vis/rule/aether/aether.d.ts +14 -14
  176. package/dist/src/vis/value/aether/value.d.ts +42 -42
  177. package/dist/src/vis/value/redline.d.ts +5 -5
  178. package/dist/src/vis/value/redline.d.ts.map +1 -1
  179. package/dist/src/vis/value/use.d.ts +14 -14
  180. package/dist/src/workspace/queries.d.ts +6 -4
  181. package/dist/src/workspace/queries.d.ts.map +1 -1
  182. package/dist/tabs-CB7d2_0h.cjs +1 -0
  183. package/dist/tabs-DEXXNOZA.js +253 -0
  184. package/dist/tabs.cjs +1 -1
  185. package/dist/tabs.js +2 -4
  186. package/dist/text-Dd6wYgQM.js +142 -0
  187. package/dist/text-n3Fetdk6.cjs +1 -0
  188. package/dist/text.cjs +1 -1
  189. package/dist/text.js +2 -5
  190. package/dist/theming-Blgv4Cvi.js +591 -0
  191. package/dist/theming-KFfFjsRJ.cjs +1 -0
  192. package/dist/theming.cjs +1 -1
  193. package/dist/theming.js +2 -5
  194. package/dist/tree-B4jJAzS1.js +294 -0
  195. package/dist/tree-CsgSEpgy.cjs +1 -0
  196. package/dist/tree.cjs +1 -1
  197. package/dist/tree.js +2 -4
  198. package/dist/triggers-AqBSAR_T.cjs +1 -0
  199. package/dist/triggers-DDlalLoO.js +4748 -0
  200. package/dist/triggers.cjs +1 -1
  201. package/dist/triggers.js +2 -4
  202. package/dist/types-BGbd8pRh.js +73 -0
  203. package/dist/types-ByXvRm2h.cjs +1 -0
  204. package/dist/video-Bnr-2W9p.cjs +1 -0
  205. package/dist/video-ByMlaeKI.js +15 -0
  206. package/dist/video.cjs +1 -1
  207. package/dist/video.js +2 -4
  208. package/package.json +27 -28
  209. package/dist/Animated-B_N04fe6.cjs +0 -1
  210. package/dist/Animated-BsbNkFLg.cjs +0 -1
  211. package/dist/Animated-CLo1CLgn.js +0 -29
  212. package/dist/Animated-CO--9HPM.js +0 -354
  213. package/dist/Box-Bi280MYh.js +0 -96
  214. package/dist/Box-CNUz5BsV.cjs +0 -1
  215. package/dist/Copy-BgRUUzWz.cjs +0 -1
  216. package/dist/Copy-COWBkO_v.js +0 -337
  217. package/dist/Dialog-Bj7FiHJD.js +0 -59
  218. package/dist/Dialog-DBm6Fap1.cjs +0 -1
  219. package/dist/Editable-C17ILP50.js +0 -202
  220. package/dist/Editable-HUPqTaui.cjs +0 -1
  221. package/dist/Haul-CnZK3e-n.js +0 -132
  222. package/dist/Haul-DlwI4b25.cjs +0 -1
  223. package/dist/Items-CXBBG9Ip.cjs +0 -4
  224. package/dist/Items-DQba1BFQ.js +0 -842
  225. package/dist/Menu-BZ6ZGIv3.cjs +0 -1
  226. package/dist/Menu-CniMpPmC.js +0 -139
  227. package/dist/Provider-cSwm-2e_.cjs +0 -1
  228. package/dist/Provider-jFWpR0CX.js +0 -520
  229. package/dist/Tags-CxzMdPpm.cjs +0 -1
  230. package/dist/Tags-DvfGhiWv.js +0 -925
  231. package/dist/Text-2MISZsc5.js +0 -1712
  232. package/dist/Text-XHBXXDRS.cjs +0 -1
  233. package/dist/Video-Bew5_j16.js +0 -10
  234. package/dist/Video-BryrVNlH.cjs +0 -1
  235. package/dist/css-CloSmhZB.cjs +0 -1
  236. package/dist/css-D90kZTM8.js +0 -63
  237. package/dist/dimensions-CdFEW3oU.cjs +0 -1
  238. package/dist/dimensions-DbMN4145.js +0 -19
  239. package/dist/eraser-BShvqlBE.js +0 -958
  240. package/dist/eraser-rFMFKqsg.cjs +0 -11
  241. package/dist/event-BxvV3arE.cjs +0 -1
  242. package/dist/event-nNH_pXSr.js +0 -36
  243. package/dist/external-4jf1Bv96.cjs +0 -1
  244. package/dist/external-B2YeNEwd.cjs +0 -1
  245. package/dist/external-B9PnwQOL.js +0 -29
  246. package/dist/external-BBbkXXN0.js +0 -47
  247. package/dist/external-BByOkVID.cjs +0 -1
  248. package/dist/external-BrEnYrZV.js +0 -32
  249. package/dist/external-BwbypKCk.cjs +0 -1
  250. package/dist/external-C65vBow6.cjs +0 -1
  251. package/dist/external-CCcIJ20u.cjs +0 -1
  252. package/dist/external-CF4uh-dm.js +0 -51423
  253. package/dist/external-Cn6EfkLd.cjs +0 -1
  254. package/dist/external-CovFw1fv.cjs +0 -1
  255. package/dist/external-D2Zb9O5J.js +0 -93
  256. package/dist/external-D6aLGjMg.js +0 -8969
  257. package/dist/external-DDvmnE2k.js +0 -341
  258. package/dist/external-DTi9a-iK.cjs +0 -1
  259. package/dist/external-DYP1_xpd.js +0 -80
  260. package/dist/external-DxsuBuKe.js +0 -392
  261. package/dist/external-DysGdnTb.js +0 -130
  262. package/dist/external-N2L8ffzi.js +0 -71
  263. package/dist/external-UzXlHlr9.js +0 -24
  264. package/dist/external-_Ht_yCRf.cjs +0 -1
  265. package/dist/external-igNfmRSB.cjs +0 -28
  266. package/dist/external-uUEGzmui.cjs +0 -84
  267. package/dist/fontString-76R2eWDd.js +0 -29
  268. package/dist/fontString-BNnhiwug.cjs +0 -1
  269. package/dist/hooks-Co6IVYNw.cjs +0 -1
  270. package/dist/hooks-QNj6PdUo.js +0 -73
  271. package/dist/index.cjs +0 -60
  272. package/dist/index.js +0 -36908
  273. package/dist/jsx-runtime-nZSsnGb7.cjs +0 -6
  274. package/dist/jsx-runtime-tc70JA_2.js +0 -264
  275. package/dist/provider-Bt-E2O6g.js +0 -810
  276. package/dist/provider-DQkVj3tA.cjs +0 -10
  277. package/dist/src/memo/proxyMemo.d.ts +0 -3
  278. package/dist/src/memo/proxyMemo.d.ts.map +0 -1
  279. package/dist/types-CGRCBVD4.js +0 -82
  280. package/dist/types-DI2vtOGs.cjs +0 -1
  281. package/dist/units-Bu36uC6z.cjs +0 -1
  282. package/dist/units-DMip-eZH.js +0 -14
  283. package/dist/useStaticData-BTwIe0Il.cjs +0 -1
  284. package/dist/useStaticData-p8sk2VCJ.js +0 -1051
  285. package/dist/value-BkUH03tl.cjs +0 -53
  286. package/dist/value-D0vfKEY3.js +0 -6821
@@ -1,810 +0,0 @@
1
- import { z as i } from "zod";
2
- import { alamos as V } from "@synnaxlabs/alamos";
3
- import { NotFoundError as Z, UnexpectedError as f, ValidationError as D } from "@synnaxlabs/client";
4
- import { shallow as Y, deep as N, status as x, color as o } from "@synnaxlabs/x";
5
- import { e as K, s as u } from "./types-CGRCBVD4.js";
6
- const F = (r, t, e = "") => {
7
- try {
8
- return r.parse(t);
9
- } catch (n) {
10
- if (n instanceof i.ZodError) {
11
- const s = n.issues.map((a) => a.path.length === 0 ? a.message : `${a.path.join(".")}: ${a.message}`);
12
- throw new Error(`${e} - ${s.join(`
13
- `)}`);
14
- } else throw n;
15
- }
16
- }, A = (r, t) => r instanceof Error ? (r.message = `[${t}] - ${r.message}`, r) : new Error(t ?? "unknown error", { cause: r }), L = (r) => {
17
- const t = r._zod.def.output;
18
- return t instanceof i.ZodVoid || t instanceof i.ZodNever || t instanceof i.ZodUnknown;
19
- };
20
- class T {
21
- type;
22
- key;
23
- sender;
24
- _internalState;
25
- _state;
26
- _prevState;
27
- _deleted = !1;
28
- parentCtxValues;
29
- childCtxValues;
30
- childCtxChangedKeys;
31
- instrumentation;
32
- schema = void 0;
33
- /**
34
- * Methods schema for invoke. Define this to enable invokable methods.
35
- * Method names in the schema must match method names on the class.
36
- */
37
- methods = void 0;
38
- _methodImplementations = null;
39
- constructor({
40
- key: t,
41
- type: e,
42
- sender: n,
43
- instrumentation: s,
44
- parentCtxValues: a
45
- }) {
46
- this.type = e, this.key = t, this.sender = n, this._internalState = {}, this.instrumentation = s.child(this.toString()), this.parentCtxValues = /* @__PURE__ */ new Map(), a?.forEach((c, h) => this.parentCtxValues.set(h, c)), this.childCtxValues = /* @__PURE__ */ new Map(), this.childCtxChangedKeys = /* @__PURE__ */ new Set();
47
- }
48
- initializeMethods() {
49
- if (!(this.methods == null || this._methodImplementations != null)) {
50
- this._methodImplementations = {};
51
- for (const [t, e] of Object.entries(this.methods)) {
52
- const n = this[t];
53
- if (typeof n != "function")
54
- throw new Error(`Method ${t} is not a function`);
55
- this._methodImplementations[t] = L(e) ? e.implement(n.bind(this)) : e.implementAsync(n.bind(this));
56
- }
57
- }
58
- }
59
- get _schema() {
60
- if (this.schema == null)
61
- throw new D(
62
- `[AetherLeaf] - expected subclass to define component schema, but none was found.
63
- Make sure to define a property 'schema' on the class.`
64
- );
65
- return this.schema;
66
- }
67
- /**
68
- * Sets the state on the component, communicating the change to the corresponding
69
- * React component on the main thread.
70
- *
71
- * @param next - The new state to set on the component. This can be the state object
72
- * or a pure function that takes in the previous state and returns the next state.
73
- */
74
- setState(t) {
75
- const e = K(t, this.state);
76
- this._prevState = Y.copy(this._state), this._state = F(this._schema, e, `${this.toString()}`), this.sender.send({ variant: "update", key: this.key, state: this._state });
77
- }
78
- /** @returns the current state of the component. */
79
- get state() {
80
- if (this._state == null)
81
- throw new f(
82
- `[AetherLeaf] - state not defined in ${this.toString()}`
83
- );
84
- return this._state;
85
- }
86
- get internal() {
87
- return this._internalState;
88
- }
89
- /** @returns the previous state of the component. */
90
- get prevState() {
91
- if (this._prevState === void 0) throw new Error("prevState not defined");
92
- return this._prevState;
93
- }
94
- get deleted() {
95
- return this._deleted;
96
- }
97
- get ctx() {
98
- return {
99
- get: (t) => {
100
- const e = this.parentCtxValues.get(t);
101
- if (e === void 0)
102
- throw new Z(
103
- `Context value for ${t} not found on ${this.toString()}`
104
- );
105
- return e;
106
- },
107
- getOptional: (t) => this.parentCtxValues.get(t),
108
- has: (t) => this.parentCtxValues.has(t),
109
- wasSetPreviously: (t) => this.childCtxValues.has(t),
110
- set: (t, e, n = !0) => {
111
- this.childCtxValues.set(t, e), n && this.childCtxChangedKeys.add(t);
112
- }
113
- };
114
- }
115
- toString() {
116
- return `${this.type}(${this.key})`;
117
- }
118
- /**
119
- * @implements AetherComponent, and should NOT be called by a subclass other than
120
- * AetherComposite.
121
- */
122
- _updateState({ path: t, state: e }) {
123
- if (!this.deleted)
124
- try {
125
- this.initializeMethods();
126
- const n = this.instrumentation.T.debug(`${this.toString()}:updateState`);
127
- this.validatePath(t);
128
- const s = F(this._schema, e, `${this.toString()}`);
129
- this._state != null ? this.instrumentation.L.debug("updating state", () => ({
130
- diff: N.difference(this.state, s)
131
- })) : this.instrumentation.L.debug("setting initial state", { state: e, path: t }), this._prevState = this._state ?? s, this._state = s, this.afterUpdate(this.ctx), n();
132
- } catch (n) {
133
- throw A(n, `${this.toString()}.updateState`);
134
- }
135
- }
136
- _updateContext(t) {
137
- try {
138
- const e = this.instrumentation.T.debug(`${this.toString()}:updateContext`);
139
- t.forEach((n, s) => this.parentCtxValues.set(s, n)), this.afterUpdate(this.ctx), e();
140
- } catch (e) {
141
- throw A(e, `${this.type}.${this.key}.updateContext`);
142
- }
143
- }
144
- /**
145
- * @implements AetherComponent, and should NOT be called by a subclass other than
146
- * AetherComposite.
147
- */
148
- _delete(t) {
149
- try {
150
- const e = this.instrumentation.T.debug(`${this.toString()}:delete`);
151
- this.validatePath(t), this._deleted = !0, this.afterDelete(this.ctx), e();
152
- } catch (e) {
153
- throw A(e, `[${this.toString()}:delete]`);
154
- }
155
- }
156
- /**
157
- * afterUpdate is optionally defined by a subclass, allowing the component to
158
- * perform some action after the component is updated. At this point, the current
159
- * state, previous state, derived state, and current context are all available to
160
- * the component.
161
- */
162
- afterUpdate(t) {
163
- }
164
- /**
165
- * Runs after the component has been spliced out of the tree. This is useful for
166
- * running cleanup code, such as unsubscribing from an event emitter. At this point,
167
- * the current state, previous state, derived state, and current context are all
168
- * available to the component, and this.deleted is true.
169
- */
170
- afterDelete(t) {
171
- }
172
- validatePath(t) {
173
- if (t.length === 0)
174
- throw new f(
175
- `[Leaf.setState] - ${this.toString()} received an empty path`
176
- );
177
- const e = t[t.length - 1];
178
- if (t.length > 1)
179
- throw new f(
180
- `[Leaf.setState] - ${this.toString()} received a subPath ${t.join(
181
- "."
182
- )} but is a leaf`
183
- );
184
- if (e !== this.key)
185
- throw new f(
186
- `[Leaf.setState] - ${this.toString()} received a key ${e} but expected ${this.key}`
187
- );
188
- }
189
- handleInvokeError({ method: t, key: e, args: n }, s) {
190
- if (!(e != null))
191
- return console.error(
192
- `Error in fire and forget method ${t} on ${this.toString()}`,
193
- s
194
- );
195
- const c = s instanceof Error ? s : new Error(String(s));
196
- this.sender.send({
197
- variant: "invoke_response",
198
- key: e,
199
- result: void 0,
200
- error: {
201
- name: c.name,
202
- message: `Failed to execute ${t}(${e}) with args ${JSON.stringify(n)} on ${this.toString()}: ${c.message}`,
203
- stack: c.stack ?? ""
204
- }
205
- });
206
- }
207
- _invokeMethod(t) {
208
- if (this.deleted) return;
209
- const { method: e, key: n, args: s } = t, a = n != null, c = this._methodImplementations?.[e];
210
- if (c == null)
211
- return this.handleInvokeError(
212
- t,
213
- new Error(`Method ${e} not found on ${this.toString()}`)
214
- );
215
- try {
216
- const h = c(...s);
217
- h instanceof Promise && h.then((m) => {
218
- a && this.sender.send({ variant: "invoke_response", key: n, result: m });
219
- }).catch((m) => this.handleInvokeError(t, m));
220
- } catch (h) {
221
- this.handleInvokeError(t, h);
222
- }
223
- }
224
- }
225
- class _ extends T {
226
- _children = /* @__PURE__ */ new Map();
227
- /** @returns a readonly array of the children of the component. */
228
- get children() {
229
- return Array.from(this._children.values());
230
- }
231
- /**
232
- * Finds a child component with the given key.
233
- *
234
- * @param key - the key of the child component to find.
235
- * @returns the child component, or null if no child component with the given key
236
- */
237
- getChild(t) {
238
- return this._children.get(t) ?? null;
239
- }
240
- /**
241
- * Finds all children of the component with the given type
242
- *
243
- * @param types - the type of the children to find
244
- * @returns an array of all children of the component with the given type
245
- */
246
- childrenOfType(...t) {
247
- return this.children.filter(
248
- (e) => t.includes(e.type)
249
- );
250
- }
251
- _updateState(t) {
252
- const { path: e, type: n, create: s } = t;
253
- if (this.deleted) return;
254
- const a = this.parsePath(e);
255
- if (a.length === 0) {
256
- if (this.childCtxChangedKeys.clear(), super._updateState(t), this.childCtxChangedKeys.size == 0) return;
257
- this.updateChildContexts();
258
- return;
259
- }
260
- const h = a[0], m = this.getChild(h);
261
- if (m != null) return m._updateState({ ...t, path: a });
262
- if (a.length > 1) {
263
- const I = e.slice(0, e.indexOf(h) + 1).join("."), R = e.join(".");
264
- throw new f(
265
- `Child of ${this.toString()} at path ${I} does not exist,
266
- but an extended path ${R} was provided. This means that the aether
267
- tree is attempting to create a new child of type ${n} (or nested children)
268
- on a child that does not exist.
269
-
270
- Children present: ${this.children.map((k) => `${k.type}:${k.key}`).join(".")}
271
-
272
- `
273
- );
274
- }
275
- const $ = s(this.childCtx());
276
- $._updateState({ ...t, path: a }), this._children.set(h, $);
277
- }
278
- _updateContext(t) {
279
- super._updateContext(t), this.updateChildContexts();
280
- }
281
- childCtx() {
282
- return {
283
- get: (t) => this.childCtxValues.get(t) ?? this.parentCtxValues.get(t),
284
- forEach: (t) => {
285
- this.childCtxValues.forEach(
286
- (e, n) => t(e, n, this.childCtxValues)
287
- ), this.parentCtxValues.forEach((e, n) => {
288
- this.childCtxValues.has(n) || t(e, n, this.parentCtxValues);
289
- });
290
- }
291
- };
292
- }
293
- updateChildContexts() {
294
- const t = this.childCtx();
295
- this.children.forEach((e) => e._updateContext(t));
296
- }
297
- _delete(t) {
298
- const e = this.parsePath(t);
299
- if (e.length === 0) {
300
- for (const s of this.children) s._delete([s.key]);
301
- this._children.clear(), super._delete([this.key]);
302
- }
303
- const n = this.getChild(e[0]);
304
- if (n != null) {
305
- if (e.length > 1) return n._delete(e);
306
- this._children.delete(n.key), n._delete(e);
307
- }
308
- }
309
- /**
310
- * Find a child component at the given path for method invocation.
311
- * @param path - The path to the child component (excluding this component's key).
312
- * @returns The component at the path, or null if not found.
313
- */
314
- findChildAtPath(t) {
315
- if (t.length === 0) return null;
316
- const [e, ...n] = t, s = this.getChild(e);
317
- return s == null ? null : n.length === 0 ? s : "findChildAtPath" in s && typeof s.findChildAtPath == "function" ? s.findChildAtPath(n) : null;
318
- }
319
- parsePath(t, e) {
320
- const [n, ...s] = t;
321
- if (n == null)
322
- throw new Error(
323
- `Composite ${this.toString()} received an empty path${e != null ? ` for ${e}` : ""}`
324
- );
325
- if (n !== this.key)
326
- throw new f(
327
- `[Composite.getRequiredKey] - ${this.toString()} received a key ${n} but expected ${this.key}`
328
- );
329
- return s;
330
- }
331
- }
332
- const B = i.object({}), M = () => {
333
- throw new Error("should not call create");
334
- };
335
- class d extends _ {
336
- /** Key of the root component. */
337
- static TYPE = "root";
338
- /** Type of the root component. */
339
- static KEY = "root";
340
- /** A communication mechanism for sending messages to the main thread. */
341
- comms;
342
- /** A registry used for creating new components in the tree. */
343
- registry;
344
- schema = B;
345
- constructor({
346
- comms: t,
347
- instrumentation: e = V.Instrumentation.NOOP,
348
- registry: n
349
- }) {
350
- super({
351
- key: d.KEY,
352
- type: d.TYPE,
353
- sender: t,
354
- instrumentation: e,
355
- parentCtxValues: null
356
- }), this.comms = t, this.registry = n;
357
- }
358
- /**
359
- * Creates a new aether tree with the provided props, and starts listing for state
360
- * updates on the provided comms.
361
- */
362
- static render(t) {
363
- const e = new d(t);
364
- return e._updateState({
365
- path: [d.KEY],
366
- type: "",
367
- state: {},
368
- create: M
369
- }), e.comms.handle((n) => {
370
- try {
371
- e.handle(n);
372
- } catch (s) {
373
- const a = {
374
- name: "unknown",
375
- message: JSON.stringify(s),
376
- stack: "unknown"
377
- };
378
- s instanceof Error && (a.name = s.name, a.message = s.message, a.stack = s.stack), e.comms.send({ variant: "error", error: a });
379
- }
380
- }), e;
381
- }
382
- /**
383
- * Handles messages from the main thread and applies them as updates in the
384
- * aether tree.
385
- */
386
- handle(t) {
387
- const { variant: e } = t;
388
- if (e === "invoke_request") {
389
- this.invokeAtPath(t);
390
- return;
391
- }
392
- const { path: n, type: s } = t;
393
- if (e === "delete") {
394
- this._delete(n);
395
- return;
396
- }
397
- const { state: a } = t;
398
- this._updateState({
399
- path: n,
400
- type: s,
401
- state: a,
402
- create: (c) => {
403
- const h = n[n.length - 1];
404
- return this.create({ key: h, type: s, parentCtxValues: c });
405
- }
406
- });
407
- }
408
- invokeAtPath(t) {
409
- const { path: e } = t, [n, ...s] = e;
410
- if (n !== d.KEY) {
411
- this.handleInvokeError(
412
- t,
413
- new Error(`Invalid path: expected root key '${d.KEY}', got '${n}'`)
414
- );
415
- return;
416
- }
417
- if (s.length === 0) {
418
- this._invokeMethod(t);
419
- return;
420
- }
421
- const a = this.findChildAtPath(s);
422
- if (a == null) {
423
- this.handleInvokeError(
424
- t,
425
- new Z(`Component at path ${e.join(".")} not found`)
426
- );
427
- return;
428
- }
429
- a._invokeMethod(t);
430
- }
431
- /** Creates a new component from the registry */
432
- create({
433
- key: t,
434
- type: e,
435
- parentCtxValues: n
436
- }) {
437
- const s = this.registry[e];
438
- if (s == null)
439
- throw new f(`[Root.create] - ${e} not found in registry`);
440
- return new s({
441
- key: t,
442
- type: e,
443
- sender: this.comms,
444
- instrumentation: this.instrumentation,
445
- parentCtxValues: n
446
- });
447
- }
448
- }
449
- const U = d.render.bind(d), wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
450
- __proto__: null,
451
- Composite: _,
452
- Leaf: T,
453
- Root: d,
454
- isFireAndForget: L,
455
- render: U
456
- }, Symbol.toStringTag, { value: "Module" })), G = (r, t) => Array.isArray(t) ? t.some((e) => e.matches(r)) : t?.matches(r) ?? !1, X = (r) => {
457
- console.error(x.toString(r));
458
- }, z = (r, t, e) => {
459
- const n = x.fromException(r, t);
460
- return X(n), G(r, e) ? null : n;
461
- }, H = (r, t, e, n) => {
462
- if (typeof r == "function") return !0;
463
- const s = z(r, e, n);
464
- return s != null && t(s), !1;
465
- }, j = async (r, t, e, n) => {
466
- try {
467
- const s = r();
468
- s != null && await s;
469
- } catch (s) {
470
- const a = z(s, e, n);
471
- if (a != null) return t(a);
472
- }
473
- }, W = (r) => (t, e, n) => {
474
- H(t, r, e, n) && j(t, r, e, n);
475
- }, q = (r) => async (t, e, n) => {
476
- H(t, r, e, n) && await j(t, r, e, n);
477
- }, J = i.object({ statuses: x.statusZ().array() }), w = "status.aggregator";
478
- class P extends _ {
479
- static TYPE = "status.Aggregator";
480
- schema = J;
481
- afterUpdate(t) {
482
- t.wasSetPreviously(w) || t.set(w, {
483
- add: this.add.bind(this),
484
- create: x.create
485
- });
486
- }
487
- add(t) {
488
- this.setState((e) => ({
489
- ...e,
490
- statuses: [...e.statuses, x.create(t)]
491
- }));
492
- }
493
- }
494
- const O = (r) => r.get(w).add, Et = (r) => {
495
- const t = r.getOptional(w);
496
- return t != null ? t.add : () => {
497
- };
498
- }, Q = (r) => W(O(r)), _t = (r) => q(O(r)), At = {
499
- [P.TYPE]: P
500
- }, tt = i.object({
501
- // Main background surface
502
- l0: o.colorZ,
503
- // Large surfaces to contrast against background
504
- l1: o.colorZ,
505
- // Small surfaces to contrast against background
506
- l2: o.colorZ,
507
- // Hover on small surfaces
508
- l3: o.colorZ,
509
- // Border strength 1
510
- l4: o.colorZ,
511
- // Border strength 2
512
- // Border strength 1 hover
513
- l5: o.colorZ,
514
- // Border strength 2 hover
515
- // Border strength 1 active
516
- l6: o.colorZ,
517
- // Border strength 2 active
518
- l7: o.colorZ,
519
- // Text strength 1
520
- l8: o.colorZ,
521
- // Text strength 2
522
- l9: o.colorZ,
523
- // Text strength 3
524
- l10: o.colorZ,
525
- // Text strength 4
526
- l11: o.colorZ
527
- }), l = (r, t) => [
528
- r[0],
529
- r[1],
530
- t,
531
- r[3]
532
- ], et = i.object({
533
- m2: o.colorZ,
534
- m1: o.colorZ,
535
- z: o.colorZ,
536
- p1: o.colorZ,
537
- p2: o.colorZ
538
- }), C = et.or(
539
- o.colorZ.transform((r) => {
540
- const t = o.hsla(r);
541
- return {
542
- m2: o.fromHSLA(l(t, 40)),
543
- m1: o.fromHSLA(l(t, 45)),
544
- z: r,
545
- p1: o.fromHSLA(l(t, 55)),
546
- p2: o.fromHSLA(l(t, 65))
547
- };
548
- })
549
- ), nt = i.object({
550
- name: i.string(),
551
- key: i.string(),
552
- colors: i.object({
553
- border: o.colorZ,
554
- primary: C,
555
- gray: tt,
556
- error: C,
557
- secondary: C,
558
- warning: C,
559
- palettes: i.record(i.string(), o.paletteZ),
560
- visualization: i.object({ palettes: i.record(i.string(), i.array(o.colorZ)) }).default({ palettes: {} }),
561
- white: o.colorZ,
562
- black: o.colorZ,
563
- text: o.colorZ,
564
- textInverted: o.colorZ,
565
- textOnPrimary: o.colorZ.default(o.ZERO),
566
- primaryText: o.colorZ,
567
- errorText: o.colorZ,
568
- warningText: o.colorZ,
569
- logo: i.string()
570
- }),
571
- sizes: i.object({
572
- base: i.number(),
573
- border: i.object({
574
- radius: i.number(),
575
- width: i.number(),
576
- thickWidth: i.number()
577
- }),
578
- schematic: i.object({ elementStrokeWidth: i.number() })
579
- }),
580
- typography: i.object({
581
- family: i.string(),
582
- codeFamily: i.string(),
583
- h1: u,
584
- h2: u,
585
- h3: u,
586
- h4: u,
587
- h5: u,
588
- p: u,
589
- small: u
590
- })
591
- }).transform((r) => ((r.colors.textOnPrimary == null || o.isZero(r.colors.textOnPrimary)) && (r.colors.textOnPrimary = o.pickByContrast(
592
- r.colors.primary.z,
593
- r.colors.text,
594
- r.colors.textInverted
595
- )), r)), rt = '"Inter Variable", sans-serif', st = '"Geist Mono", monospace', ot = 6, p = [357, 91, 55, 1], g = [48, 90, 55, 1], it = [
596
- "#FEFEFE",
597
- // l0 - background
598
- "#FAFAFA",
599
- // l1 - large surfaces
600
- "#F2F2F2",
601
- // l2 - small surfaces
602
- "#ECECEC",
603
- // l3 - small surfaces hover
604
- "#E4E4E4",
605
- // l4 - border 1
606
- "#D1D1D1",
607
- // l5 - border 2
608
- "#BCBCBC",
609
- // l6 - border 2 hover
610
- "#ACACAC",
611
- // l7 - border 2 active
612
- "#8F8F8F",
613
- // l8 - text 1
614
- "#4F4F4F",
615
- // l9 - text 2
616
- "#292929",
617
- // l10 - text 3
618
- "#050505"
619
- // l11 - text 4
620
- ], y = Object.fromEntries(
621
- it.map((r, t) => [`l${t}`, r])
622
- ), at = () => typeof window > "u" ? !1 : window.devicePixelRatio > 1, ht = at(), b = {
623
- key: "synnaxBase",
624
- name: "Synnax Base",
625
- colors: {
626
- primary: {
627
- m2: "#041B3D",
628
- m1: "#356fc5",
629
- z: "#3774D0",
630
- p1: "#5E94EE",
631
- p2: "#8AB8FF"
632
- },
633
- secondary: {
634
- m2: "#2D8F4E",
635
- m1: "#38B261",
636
- z: "#50C878",
637
- p1: "#73D393",
638
- p2: "#96DEAE"
639
- },
640
- gray: y,
641
- border: y.l4,
642
- error: {
643
- m2: o.fromHSLA(l(p, 30)),
644
- m1: o.fromHSLA(l(p, 40)),
645
- z: o.fromHSLA(p),
646
- p1: o.fromHSLA(l(p, 65)),
647
- p2: o.fromHSLA(l(p, 77))
648
- },
649
- warning: {
650
- m2: o.fromHSLA(l(g, 30)),
651
- m1: o.fromHSLA(l(g, 40)),
652
- z: o.fromHSLA(g),
653
- p1: o.fromHSLA(l(g, 65)),
654
- p2: o.fromHSLA(l(g, 75))
655
- },
656
- palettes: { recent: { key: "recent", name: "Recent", swatches: [] } },
657
- visualization: {
658
- palettes: {
659
- default: [
660
- "#DC136C",
661
- "#20A4F3",
662
- "#7AC74F",
663
- "#FFC43D",
664
- "#FE5F55",
665
- "#8075FF",
666
- "#D90429",
667
- "#f7aef8",
668
- "#f18f01",
669
- "#791e94",
670
- "#279af1",
671
- "#d9fff5",
672
- "#ff6b6b",
673
- "#52ffb8"
674
- ]
675
- }
676
- },
677
- logo: "url(#synnax-linear-gradient)",
678
- white: "#FFFFFF",
679
- black: "#000000",
680
- text: y.l11,
681
- textInverted: y.l0,
682
- textOnPrimary: y.l0,
683
- primaryText: "#3b82f6",
684
- errorText: "#ef4444",
685
- warningText: "#f59e0b"
686
- },
687
- sizes: {
688
- base: ot,
689
- border: { radius: 3, width: ht ? 0.5 : 1, thickWidth: 1 },
690
- schematic: { elementStrokeWidth: 2 }
691
- },
692
- typography: {
693
- family: rt,
694
- codeFamily: st,
695
- h1: { size: 5.5, weight: "500", lineHeight: 5.5 * 1.5 },
696
- h2: { size: 4.5, weight: "medium", lineHeight: 4.5 * 1.5 },
697
- h3: { size: 3.5, weight: "medium", lineHeight: 3.5 * 1.5 },
698
- h4: { size: 2.6666, weight: "medium", lineHeight: 2.6666 * 1.5 },
699
- h5: { size: 2.333333, weight: 450, lineHeight: 2.333333 * 1.5 },
700
- p: { size: 2.1666666666, weight: "regular", lineHeight: 2 * 1.5 },
701
- small: { size: 1.916666, weight: "regular", lineHeight: 2.3333333 }
702
- }
703
- }, lt = Object.freeze({
704
- ...b,
705
- key: "synnaxLight",
706
- name: "Synnax Light"
707
- }), ct = [
708
- "#020202",
709
- // l0
710
- "#080808",
711
- // l1
712
- "#151515",
713
- // l2
714
- "#202020",
715
- // l3
716
- "#272727",
717
- // l4
718
- "#3B3B3B",
719
- // l5
720
- "#4A4A4A",
721
- // l6
722
- "#5C5C5C",
723
- // l7
724
- "#767676",
725
- // l8
726
- "#959595",
727
- // l9
728
- "#dadada",
729
- // l10
730
- "#FAFAFA"
731
- // l11
732
- ], S = Object.fromEntries(
733
- ct.map((r, t) => [`l${t}`, r])
734
- ), dt = Object.freeze({
735
- ...b,
736
- key: "synnaxDark",
737
- name: "Synnax Dark",
738
- colors: {
739
- ...b.colors,
740
- gray: S,
741
- logo: "var(--pluto-text-color)",
742
- border: S.l4,
743
- text: S.l11,
744
- textInverted: S.l0,
745
- textOnPrimary: S.l11,
746
- primaryText: "#93c5fd",
747
- errorText: "#fca5a5",
748
- warningText: "#fcd34d"
749
- }
750
- }), bt = { synnaxDark: dt, synnaxLight: lt }, ut = ["tiny", "small", "medium", "large", "huge"], ft = i.enum(ut), vt = (r) => ft.safeParse(r).success, v = "pluto-theming-context", mt = i.object({
751
- name: i.string(),
752
- url: i.string()
753
- }), pt = i.object({
754
- theme: nt,
755
- fontURLs: i.array(mt)
756
- });
757
- class E extends _ {
758
- static TYPE = "theming.Provider";
759
- static z = pt;
760
- schema = E.z;
761
- afterUpdate(t) {
762
- if (t.getOptional(v) != null && this.state.theme.key === this.prevState.theme.key) return;
763
- t.set(v, this.state.theme), Q(t)(async () => {
764
- await this.loadFonts();
765
- }, "failed to load theme fonts");
766
- }
767
- async loadFonts() {
768
- await Promise.all(
769
- this.state.fontURLs.map(async ({ name: t, url: e }) => {
770
- const n = new FontFace(t, `url(${e})`);
771
- try {
772
- await n.load(), self.fonts.add(n);
773
- } catch (s) {
774
- console.error(s);
775
- }
776
- })
777
- );
778
- }
779
- }
780
- const $t = (r) => r.get(v), kt = {
781
- [E.TYPE]: E
782
- };
783
- export {
784
- P as A,
785
- _ as C,
786
- T as L,
787
- E as P,
788
- kt as R,
789
- dt as S,
790
- lt as a,
791
- bt as b,
792
- At as c,
793
- wt as d,
794
- O as e,
795
- mt as f,
796
- Q as g,
797
- L as h,
798
- vt as i,
799
- W as j,
800
- J as k,
801
- q as l,
802
- _t as m,
803
- Et as n,
804
- ut as o,
805
- F as p,
806
- U as r,
807
- ft as s,
808
- nt as t,
809
- $t as u
810
- };