@synnaxlabs/pluto 0.50.1 → 0.52.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Animated-C4xrEVd-.js → Animated-6qL1fRZx.js} +61 -60
- package/dist/Animated-Bn4jMc7c.js +29 -0
- package/dist/Animated-vGAs0qOH.cjs +1 -0
- package/dist/Animated-xK__WUQp.cjs +1 -0
- package/dist/{Box-DLO7l9hM.js → Box-Bi280MYh.js} +28 -27
- package/dist/Box-CNUz5BsV.cjs +1 -0
- package/dist/Copy-CzkBKGca.js +337 -0
- package/dist/Copy-DuC8dTK7.cjs +1 -0
- package/dist/Dialog-DNrgykEv.cjs +1 -0
- package/dist/{Dialog-BspO7uo8.js → Dialog-Dos5l3K2.js} +13 -12
- package/dist/{Editable-DjQORuR1.js → Editable-4ZwvICC4.js} +46 -45
- package/dist/Editable-HUPqTaui.cjs +1 -0
- package/dist/{Haul-DBy-2ds_.js → Haul-CxbMtSY4.js} +18 -18
- package/dist/Haul-V5NQI3MY.cjs +1 -0
- package/dist/{Items-CX11yLMf.js → Items-CNPUoiob.js} +22 -21
- package/dist/Items-DYYNNIjr.cjs +4 -0
- package/dist/Menu-C0scum-k.cjs +1 -0
- package/dist/{Menu-GBo3ayoP.js → Menu-CTuOX5DR.js} +42 -41
- package/dist/Provider-DSMJjyuY.cjs +1 -0
- package/dist/{Provider-BkxUzTWS.js → Provider-ZIy-UlnE.js} +95 -93
- package/dist/Tags-6OV0_eBz.cjs +1 -0
- package/dist/{Tags-V7sNuGZv.js → Tags-BUDnOqms.js} +223 -222
- package/dist/{Text-XeD58Fq8.js → Text-BSTMZRuo.js} +717 -675
- package/dist/Text-C2_VsLzw.cjs +1 -0
- package/dist/Video-Bew5_j16.js +10 -0
- package/dist/Video-BryrVNlH.cjs +1 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/color.cjs +1 -1
- package/dist/color.js +1 -1
- package/dist/css-CloSmhZB.cjs +1 -0
- package/dist/css-D90kZTM8.js +63 -0
- package/dist/css.cjs +1 -1
- package/dist/css.js +2 -2
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/dimensions-CdFEW3oU.cjs +1 -0
- package/dist/{dimensions-qj2CkPTy.js → dimensions-DbMN4145.js} +8 -8
- package/dist/{eraser-DuAfpO0P.js → eraser-BShvqlBE.js} +52 -49
- package/dist/eraser-rFMFKqsg.cjs +11 -0
- package/dist/eslint.config.d.ts +2 -2
- package/dist/eslint.config.d.ts.map +1 -1
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +65 -62
- package/dist/external--liXQuyF.cjs +1 -0
- package/dist/external-B3ipr7m2.cjs +1 -0
- package/dist/{external-Ct1k30Nd.js → external-B7UnU0MW.js} +27 -26
- package/dist/{external-PXU0gc_j.cjs → external-BRxBwBtj.cjs} +44 -44
- package/dist/{external-MvcifV4O.js → external-Ba2qQp_c.js} +3 -3
- package/dist/{external-g_vt4Lku.js → external-Bjd-DyWx.js} +22 -30
- package/dist/{external-B3o5P8Yw.cjs → external-BwbypKCk.cjs} +1 -1
- package/dist/external-C0rrTDhu.cjs +1 -0
- package/dist/{external-Dp5OkGYV.js → external-CG70NZqY.js} +97 -96
- package/dist/external-Ci1Iy9ku.js +32 -0
- package/dist/external-CmYpRWry.cjs +1 -0
- package/dist/{external-B-JsNciM.js → external-CoCI_tg5.js} +9 -8
- package/dist/{external-CLQdSLv0.js → external-Ctnukdzx.js} +10 -9
- package/dist/{external-DXWEyk9d.js → external-CvYxFUrc.js} +17 -17
- package/dist/{external-DNbIzfVy.js → external-Czkrdv2A.js} +55 -54
- package/dist/external-Czv2P05t.cjs +1 -0
- package/dist/{external-DxmgAHkn.js → external-DAotNquC.js} +3 -3
- package/dist/external-DFvPOUIQ.cjs +1 -0
- package/dist/{external-DojNoICL.cjs → external-DWEpl5aM.cjs} +1 -1
- package/dist/{external-xfkS0zGI.js → external-JwicH0Yv.js} +18 -17
- package/dist/external-N5bKB8Zx.cjs +1 -0
- package/dist/external-ZtJmVgiY.cjs +1 -0
- package/dist/external-ieDANY3X.cjs +28 -0
- package/dist/{external-sYHm9OG8.js → external-s6DOSL29.js} +16 -15
- package/dist/flex.cjs +1 -1
- package/dist/flex.js +1 -1
- package/dist/{fontString-CSWLcJcC.js → fontString-76R2eWDd.js} +3 -3
- package/dist/fontString-BNnhiwug.cjs +1 -0
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/hooks-C4ji1BSZ.cjs +1 -0
- package/dist/{hooks-BeSuo_di.js → hooks-CWEfATTF.js} +16 -16
- package/dist/index.cjs +35 -18
- package/dist/index.js +15379 -14087
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/{jsx-runtime-BbD0H88J.js → jsx-runtime-tc70JA_2.js} +2 -2
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/pluto.css +1 -1
- package/dist/provider-Bt-E2O6g.js +810 -0
- package/dist/provider-DQkVj3tA.cjs +10 -0
- package/dist/src/access/policy/queries.d.ts +6 -6
- package/dist/src/button/Copy.d.ts +28 -0
- package/dist/src/button/Copy.d.ts.map +1 -0
- package/dist/src/button/Copy.spec.d.ts +2 -0
- package/dist/src/button/Copy.spec.d.ts.map +1 -0
- package/dist/src/button/external.d.ts +1 -0
- package/dist/src/button/external.d.ts.map +1 -1
- package/dist/src/channel/queries.d.ts +1 -1
- package/dist/src/channel/queries.d.ts.map +1 -1
- package/dist/src/color/Provider.d.ts +11 -1
- package/dist/src/color/Provider.d.ts.map +1 -1
- package/dist/src/device/queries.d.ts +122 -72
- package/dist/src/device/queries.d.ts.map +1 -1
- package/dist/src/errors/Fallback.d.ts.map +1 -1
- package/dist/src/flux/base/store.d.ts +2 -2
- package/dist/src/flux/base/store.d.ts.map +1 -1
- package/dist/src/flux/retrieve.d.ts +1 -1
- package/dist/src/flux/retrieve.d.ts.map +1 -1
- package/dist/src/icon/EtherCAT.d.ts +2 -0
- package/dist/src/icon/EtherCAT.d.ts.map +1 -0
- package/dist/src/icon/registry.d.ts +3 -0
- package/dist/src/icon/registry.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/input/Numeric.d.ts.map +1 -1
- package/dist/src/json/SelectType.d.ts +8 -0
- package/dist/src/json/SelectType.d.ts.map +1 -0
- package/dist/src/json/external.d.ts +3 -0
- package/dist/src/json/external.d.ts.map +1 -0
- package/dist/src/json/index.d.ts +2 -0
- package/dist/src/json/index.d.ts.map +1 -0
- package/dist/src/json/primitive.d.ts +7 -0
- package/dist/src/json/primitive.d.ts.map +1 -0
- package/dist/src/json/primitive.spec.d.ts +2 -0
- package/dist/src/json/primitive.spec.d.ts.map +1 -0
- package/dist/src/label/queries.d.ts +30 -2
- package/dist/src/label/queries.d.ts.map +1 -1
- package/dist/src/lineplot/aether/XAxis.d.ts +40 -0
- package/dist/src/lineplot/aether/XAxis.d.ts.map +1 -1
- package/dist/src/lineplot/aether/YAxis.d.ts +40 -0
- package/dist/src/lineplot/aether/YAxis.d.ts.map +1 -1
- package/dist/src/lineplot/aether/axis.d.ts +20 -0
- package/dist/src/lineplot/aether/axis.d.ts.map +1 -1
- package/dist/src/lineplot/range/aether/provider.d.ts +90 -6
- package/dist/src/lineplot/range/aether/provider.d.ts.map +1 -1
- package/dist/src/lineplot/tooltip/aether/tooltip.d.ts +80 -0
- package/dist/src/lineplot/tooltip/aether/tooltip.d.ts.map +1 -1
- package/dist/src/log/aether/Log.d.ts +30 -0
- package/dist/src/log/aether/Log.d.ts.map +1 -1
- package/dist/src/pluto/aether/pluto.d.ts.map +1 -1
- package/dist/src/ranger/queries.d.ts +33 -5
- package/dist/src/ranger/queries.d.ts.map +1 -1
- package/dist/src/schematic/symbol/Forms.d.ts +2 -0
- package/dist/src/schematic/symbol/Forms.d.ts.map +1 -1
- package/dist/src/schematic/symbol/Primitives.d.ts +23 -0
- package/dist/src/schematic/symbol/Primitives.d.ts.map +1 -1
- package/dist/src/schematic/symbol/Symbols.d.ts +14 -0
- package/dist/src/schematic/symbol/Symbols.d.ts.map +1 -1
- package/dist/src/schematic/symbol/queries.d.ts +6 -6
- package/dist/src/schematic/symbol/registry.d.ts +2 -0
- package/dist/src/schematic/symbol/registry.d.ts.map +1 -1
- package/dist/src/status/aether/errorHandler.d.ts.map +1 -1
- package/dist/src/status/queries.d.ts +3 -2
- package/dist/src/status/queries.d.ts.map +1 -1
- package/dist/src/table/cells/Cells.d.ts +20 -0
- package/dist/src/table/cells/Cells.d.ts.map +1 -1
- package/dist/src/telem/aether/static.d.ts +10 -0
- package/dist/src/telem/aether/static.d.ts.map +1 -1
- package/dist/src/telem/aether/transformers.d.ts +15 -0
- package/dist/src/telem/aether/transformers.d.ts.map +1 -1
- package/dist/src/telem/control/Controller.d.ts +1 -0
- package/dist/src/telem/control/Controller.d.ts.map +1 -1
- package/dist/src/telem/control/Legend.d.ts +4 -2
- package/dist/src/telem/control/Legend.d.ts.map +1 -1
- package/dist/src/telem/control/aether/controller.d.ts +10 -0
- package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
- package/dist/src/telem/control/aether/indicator.d.ts +50 -0
- package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
- package/dist/src/telem/control/aether/legend.d.ts +22 -0
- package/dist/src/telem/control/aether/legend.d.ts.map +1 -1
- package/dist/src/telem/control/aether/state.d.ts +13 -0
- package/dist/src/telem/control/aether/state.d.ts.map +1 -1
- package/dist/src/theming/aether/provider.d.ts +1413 -3
- package/dist/src/theming/aether/provider.d.ts.map +1 -1
- package/dist/src/theming/base/theme.d.ts +941 -1
- package/dist/src/theming/base/theme.d.ts.map +1 -1
- package/dist/src/user/queries.d.ts +1 -1
- package/dist/src/vis/axis/axis.d.ts +20 -0
- package/dist/src/vis/axis/axis.d.ts.map +1 -1
- package/dist/src/vis/gauge/aether/gauge.d.ts +30 -0
- package/dist/src/vis/gauge/aether/gauge.d.ts.map +1 -1
- package/dist/src/vis/gauge/use.d.ts +10 -0
- package/dist/src/vis/gauge/use.d.ts.map +1 -1
- package/dist/src/vis/line/aether/line.d.ts +10 -0
- package/dist/src/vis/line/aether/line.d.ts.map +1 -1
- package/dist/src/vis/measure/aether/measure.d.ts +80 -0
- package/dist/src/vis/measure/aether/measure.d.ts.map +1 -1
- package/dist/src/vis/rule/aether/aether.d.ts +20 -0
- package/dist/src/vis/rule/aether/aether.d.ts.map +1 -1
- package/dist/src/vis/stateIndicator/aether/index.d.ts +2 -0
- package/dist/src/vis/stateIndicator/aether/index.d.ts.map +1 -0
- package/dist/src/vis/stateIndicator/aether/stateIndicator.d.ts +48 -0
- package/dist/src/vis/stateIndicator/aether/stateIndicator.d.ts.map +1 -0
- package/dist/src/vis/stateIndicator/index.d.ts +2 -0
- package/dist/src/vis/stateIndicator/index.d.ts.map +1 -0
- package/dist/src/vis/stateIndicator/use.d.ts +9 -0
- package/dist/src/vis/stateIndicator/use.d.ts.map +1 -0
- package/dist/src/vis/value/aether/value.d.ts +60 -0
- package/dist/src/vis/value/aether/value.d.ts.map +1 -1
- package/dist/src/vis/value/redline.d.ts +5 -0
- package/dist/src/vis/value/redline.d.ts.map +1 -1
- package/dist/src/vis/value/use.d.ts +20 -0
- package/dist/src/vis/value/use.d.ts.map +1 -1
- package/dist/src/workspace/queries.d.ts +1 -1
- package/dist/stylelint.config.d.ts +3 -0
- package/dist/stylelint.config.d.ts.map +1 -0
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -2
- package/dist/theme-dark.css +815 -0
- package/dist/theme-light.css +815 -0
- package/dist/theme.css +680 -680
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -2
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +1 -1
- package/dist/{types-B5-Tni3G.js → types-CGRCBVD4.js} +2 -2
- package/dist/{types-C0tUDfsz.cjs → types-DI2vtOGs.cjs} +1 -1
- package/dist/units-Bu36uC6z.cjs +1 -0
- package/dist/units-DMip-eZH.js +14 -0
- package/dist/value-Bfn0uQuG.cjs +53 -0
- package/dist/{value-BmuhX6zs.js → value-DimszMFu.js} +2108 -2057
- package/dist/video.cjs +1 -1
- package/dist/video.js +1 -1
- package/package.json +25 -21
- package/dist/Animated-BbeJdao0.js +0 -28
- package/dist/Animated-Dvm2k_z_.cjs +0 -1
- package/dist/Animated-umWjgTzy.cjs +0 -1
- package/dist/Box-D27bV7QJ.cjs +0 -1
- package/dist/Button-BSek5HG5.cjs +0 -1
- package/dist/Button-DLtxKGH5.js +0 -308
- package/dist/Dialog-BpjxXSmw.cjs +0 -1
- package/dist/Editable-C-z-stcD.cjs +0 -1
- package/dist/Haul-WgPKptr9.cjs +0 -1
- package/dist/Items-07R286kW.cjs +0 -4
- package/dist/Menu-58O-OOPJ.cjs +0 -1
- package/dist/Provider-BA3zQVbv.cjs +0 -1
- package/dist/Tags-DWsEZD9t.cjs +0 -1
- package/dist/Text-DW5FpCk9.cjs +0 -1
- package/dist/Video-C56z7qvH.js +0 -9
- package/dist/Video-CBPTBLTB.cjs +0 -1
- package/dist/css-BkBrZtKZ.js +0 -5328
- package/dist/css-D3NdC2sx.cjs +0 -8
- package/dist/dimensions-C7b02rFi.cjs +0 -1
- package/dist/eraser-Bocga8Eb.cjs +0 -11
- package/dist/external-5_uHky7w.cjs +0 -28
- package/dist/external-B9omdiDK.cjs +0 -1
- package/dist/external-BIbdeWQE.cjs +0 -1
- package/dist/external-BRA_zA83.cjs +0 -1
- package/dist/external-Bjh6lsVm.cjs +0 -1
- package/dist/external-BwRkgEyo.cjs +0 -1
- package/dist/external-CdHyPhLI.js +0 -31
- package/dist/external-Ct2A_YCT.cjs +0 -1
- package/dist/external-DT82RBon.cjs +0 -1
- package/dist/external-DyTk_hS7.cjs +0 -1
- package/dist/fontString-TocVNWmy.cjs +0 -1
- package/dist/hooks-Eb94kuDd.cjs +0 -1
- package/dist/provider-D0K9E52u.js +0 -16236
- package/dist/provider-DksyuJua.cjs +0 -78
- package/dist/units-Bd_mf9Ye.cjs +0 -1
- package/dist/units-CEfK1L7C.js +0 -14
- package/dist/value-CZfzRi_x.cjs +0 -53
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { box as h, scale as y, xy as d, dimensions as k, color as C, unique as X } from "@synnaxlabs/x";
|
|
2
|
+
import { z as x } from "zod";
|
|
3
|
+
import { C as q, e as z, g as K, L as W } from "./provider-Bt-E2O6g.js";
|
|
4
|
+
import { alamos as _ } from "@synnaxlabs/alamos";
|
|
5
|
+
import { C as H } from "./css-D90kZTM8.js";
|
|
6
|
+
import { a as G } from "./dimensions-DbMN4145.js";
|
|
7
|
+
import { UnexpectedError as V } from "@synnaxlabs/client";
|
|
8
|
+
const Z = x.object({
|
|
9
|
+
include: x.string().array().optional(),
|
|
10
|
+
exclude: x.string().array().optional(),
|
|
11
|
+
level: x.enum(_.LOG_LEVELS).default("info")
|
|
9
12
|
}), L = "alamos-provider";
|
|
10
|
-
class v extends
|
|
13
|
+
class v extends q {
|
|
11
14
|
static TYPE = "alamos.Provider";
|
|
12
|
-
schema =
|
|
15
|
+
schema = Z;
|
|
13
16
|
afterUpdate(t) {
|
|
14
17
|
if (t.getOptional(L) != null) return;
|
|
15
18
|
const s = [], { include: i, exclude: r, level: a } = this.state;
|
|
16
|
-
(i != null || r != null) && s.push(
|
|
19
|
+
(i != null || r != null) && s.push(_.logLevelKeyFiler({ include: i, exclude: r })), a != null && s.push(_.logThresholdFilter(a)), s.length === 0 && s.push(() => !1), this.internal.ins = new _.Instrumentation({
|
|
17
20
|
key: "aether",
|
|
18
|
-
logger: new
|
|
21
|
+
logger: new _.Logger({ filters: s })
|
|
19
22
|
}), t.set(L, this.internal.ins);
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -23,7 +26,7 @@ const J = (l, t) => {
|
|
|
23
26
|
const e = l.get(L);
|
|
24
27
|
if (e == null) throw new Error("No instrumentation provider");
|
|
25
28
|
return t == null ? e : e.child(t);
|
|
26
|
-
},
|
|
29
|
+
}, gt = {
|
|
27
30
|
[v.TYPE]: v
|
|
28
31
|
}, T = (l, t) => h.construct(
|
|
29
32
|
h.left(l) - t.x,
|
|
@@ -31,7 +34,7 @@ const J = (l, t) => {
|
|
|
31
34
|
h.width(l) + t.x * 2,
|
|
32
35
|
h.height(l) + t.y * 2
|
|
33
36
|
);
|
|
34
|
-
class
|
|
37
|
+
class R {
|
|
35
38
|
scale_;
|
|
36
39
|
wrapped;
|
|
37
40
|
atlasRegistry;
|
|
@@ -46,7 +49,7 @@ class E {
|
|
|
46
49
|
cachedLineJoin = null;
|
|
47
50
|
cachedMiterLimit = null;
|
|
48
51
|
dpr;
|
|
49
|
-
constructor(t, e, s, i =
|
|
52
|
+
constructor(t, e, s, i = y.XY.IDENTITY) {
|
|
50
53
|
this.wrapped = t, this.scale_ = i, this.atlasRegistry = e, this.dpr = s;
|
|
51
54
|
}
|
|
52
55
|
get fontStretch() {
|
|
@@ -91,7 +94,7 @@ class E {
|
|
|
91
94
|
this.wrapped.reset();
|
|
92
95
|
}
|
|
93
96
|
applyScale(t) {
|
|
94
|
-
return new
|
|
97
|
+
return new R(
|
|
95
98
|
this,
|
|
96
99
|
this.atlasRegistry,
|
|
97
100
|
this.dpr,
|
|
@@ -438,7 +441,7 @@ class E {
|
|
|
438
441
|
}
|
|
439
442
|
scissor(t, e = d.ZERO) {
|
|
440
443
|
const s = new $(this.scale_);
|
|
441
|
-
return t = T(t, e), s.rect(...d.couple(h.topLeft(t)), ...
|
|
444
|
+
return t = T(t, e), s.rect(...d.couple(h.topLeft(t)), ...k.couple(h.dims(t))), this.save(), this.clip(s.getPath()), () => this.restore();
|
|
442
445
|
}
|
|
443
446
|
setTransform(t, e, s, i, r, a) {
|
|
444
447
|
this.wrapped.setTransform(t, e, s, i, r, a);
|
|
@@ -453,7 +456,7 @@ class E {
|
|
|
453
456
|
class $ {
|
|
454
457
|
scale_;
|
|
455
458
|
path;
|
|
456
|
-
constructor(t =
|
|
459
|
+
constructor(t = y.XY.IDENTITY, e) {
|
|
457
460
|
this.scale_ = t, e instanceof Path2D || typeof e == "string" ? this.path = new Path2D(e) : this.path = new Path2D();
|
|
458
461
|
}
|
|
459
462
|
addPath(t, e) {
|
|
@@ -603,7 +606,7 @@ let et = class {
|
|
|
603
606
|
* @param value - The value to set.
|
|
604
607
|
*/
|
|
605
608
|
uniformColor(t, e) {
|
|
606
|
-
this.renderCtx.gl.uniform4fv(this.getUniformLoc(t),
|
|
609
|
+
this.renderCtx.gl.uniform4fv(this.getUniformLoc(t), C.rgba1(e));
|
|
607
610
|
}
|
|
608
611
|
getUniformLoc(t) {
|
|
609
612
|
const e = this.uniformLocCache.get(t);
|
|
@@ -632,7 +635,7 @@ class it extends et {
|
|
|
632
635
|
constructor(t) {
|
|
633
636
|
super(t, j, Q);
|
|
634
637
|
const e = t.gl.createBuffer();
|
|
635
|
-
if (e == null) throw new
|
|
638
|
+
if (e == null) throw new V("webgl: failed to create buffer");
|
|
636
639
|
this.positionBuffer = e, t.gl.bindBuffer(t.gl.ARRAY_BUFFER, this.positionBuffer), t.gl.bufferData(t.gl.ARRAY_BUFFER, st, t.gl.STATIC_DRAW);
|
|
637
640
|
}
|
|
638
641
|
exec() {
|
|
@@ -656,7 +659,7 @@ class rt {
|
|
|
656
659
|
handleError;
|
|
657
660
|
constructor({
|
|
658
661
|
afterRender: t,
|
|
659
|
-
instrumentation: e =
|
|
662
|
+
instrumentation: e = _.Instrumentation.NOOP,
|
|
660
663
|
handleError: s
|
|
661
664
|
}) {
|
|
662
665
|
this.afterRender = t, this.instrumentation = e, this.handleError = s, this.start();
|
|
@@ -728,19 +731,19 @@ class b {
|
|
|
728
731
|
constructor(t) {
|
|
729
732
|
const { font: e, characters: s = b.DEFAULT_CHARS, textColor: i } = t;
|
|
730
733
|
this.charMap = /* @__PURE__ */ new Map();
|
|
731
|
-
const r =
|
|
734
|
+
const r = X.unique(Array.from(s)), n = new OffscreenCanvas(1, 1).getContext("2d");
|
|
732
735
|
n.font = e;
|
|
733
736
|
const o = n.measureText("0");
|
|
734
737
|
this.charDims = G(o), this.charDims.width += S, this.charDims.height += S;
|
|
735
|
-
const p = r.length, u = this.charDims.width, m = this.charDims.height, c = Math.ceil(Math.sqrt(p)),
|
|
738
|
+
const p = r.length, u = this.charDims.width, m = this.charDims.height, c = Math.ceil(Math.sqrt(p)), E = Math.ceil(p / c);
|
|
736
739
|
this.atlas = new OffscreenCanvas(
|
|
737
740
|
u * c * g,
|
|
738
|
-
m * (
|
|
741
|
+
m * (E + 1) * g
|
|
739
742
|
);
|
|
740
743
|
const f = this.atlas.getContext("2d");
|
|
741
|
-
f.scale(g, g), f.font = e, f.textBaseline = "alphabetic", f.textAlign = "left", f.fillStyle =
|
|
742
|
-
const M = A % c, Y = Math.floor(A / c), N = M * u,
|
|
743
|
-
f.fillText(O, N,
|
|
744
|
+
f.scale(g, g), f.font = e, f.textBaseline = "alphabetic", f.textAlign = "left", f.fillStyle = C.hex(i), f.clearRect(0, 0, this.atlas.width, this.atlas.height), r.forEach((O, A) => {
|
|
745
|
+
const M = A % c, Y = Math.floor(A / c), N = M * u, U = (Y + 1) * m;
|
|
746
|
+
f.fillText(O, N, U), this.charMap.set(O, A);
|
|
744
747
|
});
|
|
745
748
|
}
|
|
746
749
|
fillText(t, e, s, i) {
|
|
@@ -777,7 +780,7 @@ class at {
|
|
|
777
780
|
* atlas does not exist in the registry, it is created and added to the registry.
|
|
778
781
|
*/
|
|
779
782
|
get(t) {
|
|
780
|
-
const e = `${t.font}-${
|
|
783
|
+
const e = `${t.font}-${C.hex(t.textColor)}-${t.characters}`;
|
|
781
784
|
if (this.atlases.has(e)) return this.atlases.get(e);
|
|
782
785
|
const s = new b(t);
|
|
783
786
|
return this.atlases.set(e, s), s;
|
|
@@ -806,7 +809,7 @@ class w {
|
|
|
806
809
|
/** See the @link{clear.Program} for why this is necessary. */
|
|
807
810
|
clearProgram;
|
|
808
811
|
os;
|
|
809
|
-
static CONTEXT_KEY =
|
|
812
|
+
static CONTEXT_KEY = H.B("render-context");
|
|
810
813
|
instrumentation;
|
|
811
814
|
static create(t, e, s, i, r) {
|
|
812
815
|
const a = J(t, "render_context"), n = new w(
|
|
@@ -815,8 +818,8 @@ class w {
|
|
|
815
818
|
i,
|
|
816
819
|
r,
|
|
817
820
|
a,
|
|
818
|
-
|
|
819
|
-
|
|
821
|
+
z(t),
|
|
822
|
+
K(t)
|
|
820
823
|
);
|
|
821
824
|
return t.set(w.CONTEXT_KEY, n), n;
|
|
822
825
|
}
|
|
@@ -826,12 +829,12 @@ class w {
|
|
|
826
829
|
if (o == null) throw new Error("Could not get 2D context");
|
|
827
830
|
const p = new at();
|
|
828
831
|
this.lower2d = F(
|
|
829
|
-
new
|
|
832
|
+
new R(o, p, this.dpr)
|
|
830
833
|
);
|
|
831
834
|
const u = this.upper2dCanvas.getContext("2d");
|
|
832
835
|
if (u == null) throw new Error("Could not get 2D context");
|
|
833
836
|
this.upper2d = F(
|
|
834
|
-
new
|
|
837
|
+
new R(u, p, this.dpr)
|
|
835
838
|
);
|
|
836
839
|
const m = {
|
|
837
840
|
preserveDrawingBuffer: !0,
|
|
@@ -844,11 +847,11 @@ class w {
|
|
|
844
847
|
variant: "error",
|
|
845
848
|
message: "WebGL context lost"
|
|
846
849
|
});
|
|
847
|
-
const
|
|
850
|
+
const E = () => {
|
|
848
851
|
this.gl.flush(), this.gl.finish();
|
|
849
852
|
};
|
|
850
853
|
this.loop = new rt({
|
|
851
|
-
afterRender:
|
|
854
|
+
afterRender: E,
|
|
852
855
|
instrumentation: this.instrumentation,
|
|
853
856
|
handleError: n
|
|
854
857
|
}), this.region = h.ZERO, this.os === "Windows" && (this.clearProgram = new it(this));
|
|
@@ -882,11 +885,11 @@ class w {
|
|
|
882
885
|
* in the canvas.
|
|
883
886
|
*/
|
|
884
887
|
scaleRegion(t) {
|
|
885
|
-
return new
|
|
888
|
+
return new y.XY(
|
|
886
889
|
// Accept a value in decimal.
|
|
887
|
-
|
|
890
|
+
y.Scale.scale(0, 1).scale(h.width(t)).translate(h.left(t)).reBound(h.width(this.region)).scale(-1, 1),
|
|
888
891
|
// Accept a value in decimal.
|
|
889
|
-
|
|
892
|
+
y.Scale.scale(0, 1).scale(h.height(t)).invert().translate(h.top(t)).reBound(h.height(this.region)).scale(-1, 1).invert()
|
|
890
893
|
);
|
|
891
894
|
}
|
|
892
895
|
scissor(t, e = d.ZERO, s) {
|
|
@@ -906,18 +909,18 @@ class w {
|
|
|
906
909
|
}
|
|
907
910
|
eraseGL(t, e = d.ZERO) {
|
|
908
911
|
const { gl: s } = this, i = this.scissorGL(T(t, e));
|
|
909
|
-
s.clearColor(...
|
|
912
|
+
s.clearColor(...C.rgba1(C.ZERO)), s.clear(s.COLOR_BUFFER_BIT), this.os === "Windows" && this.clearProgram?.exec(), i();
|
|
910
913
|
}
|
|
911
914
|
eraseCanvas(t, e, s = d.ZERO) {
|
|
912
915
|
const i = T(e, s);
|
|
913
|
-
t.clearRect(...d.couple(h.topLeft(i)), ...
|
|
916
|
+
t.clearRect(...d.couple(h.topLeft(i)), ...k.couple(h.dims(i)));
|
|
914
917
|
}
|
|
915
918
|
}
|
|
916
|
-
const ht =
|
|
919
|
+
const ht = x.object({
|
|
917
920
|
region: h.box,
|
|
918
|
-
enabled:
|
|
921
|
+
enabled: x.boolean().default(!1)
|
|
919
922
|
}), I = ["gl", "lower2d", "upper2d"];
|
|
920
|
-
class
|
|
923
|
+
class B extends W {
|
|
921
924
|
static TYPE = "eraser";
|
|
922
925
|
schema = ht;
|
|
923
926
|
afterUpdate(t) {
|
|
@@ -938,18 +941,18 @@ class k extends H {
|
|
|
938
941
|
this.deleted || !this.state.enabled || this.internal.renderCtx.erase(this.state.region, d.construct(0), ...I);
|
|
939
942
|
}
|
|
940
943
|
}
|
|
941
|
-
const
|
|
942
|
-
[
|
|
944
|
+
const wt = {
|
|
945
|
+
[B.TYPE]: B
|
|
943
946
|
};
|
|
944
947
|
export {
|
|
945
948
|
w as C,
|
|
946
|
-
|
|
949
|
+
B as E,
|
|
947
950
|
et as G,
|
|
948
951
|
rt as L,
|
|
949
952
|
v as P,
|
|
950
|
-
|
|
951
|
-
|
|
953
|
+
wt as R,
|
|
954
|
+
gt as a,
|
|
952
955
|
ht as e,
|
|
953
|
-
|
|
956
|
+
Z as p,
|
|
954
957
|
J as u
|
|
955
958
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";const a=require("@synnaxlabs/x"),m=require("zod"),C=require("./provider-DQkVj3tA.cjs"),x=require("@synnaxlabs/alamos"),X=require("./css-CloSmhZB.cjs"),I=require("./dimensions-CdFEW3oU.cjs"),K=require("@synnaxlabs/client"),B=m.z.object({include:m.z.string().array().optional(),exclude:m.z.string().array().optional(),level:m.z.enum(x.alamos.LOG_LEVELS).default("info")}),E="alamos-provider";class b extends C.Composite{static TYPE="alamos.Provider";schema=B;afterUpdate(t){if(t.getOptional(E)!=null)return;const s=[],{include:i,exclude:r,level:n}=this.state;(i!=null||r!=null)&&s.push(x.alamos.logLevelKeyFiler({include:i,exclude:r})),n!=null&&s.push(x.alamos.logThresholdFilter(n)),s.length===0&&s.push(()=>!1),this.internal.ins=new x.alamos.Instrumentation({key:"aether",logger:new x.alamos.Logger({filters:s})}),t.set(E,this.internal.ins)}}const k=(l,t)=>{const e=l.get(E);if(e==null)throw new Error("No instrumentation provider");return t==null?e:e.child(t)},W={[b.TYPE]:b},_=(l,t)=>a.box.construct(a.box.left(l)-t.x,a.box.top(l)-t.y,a.box.width(l)+t.x*2,a.box.height(l)+t.y*2);class S{scale_;wrapped;atlasRegistry;cachedFont=null;cachedFillStyle=null;cachedStrokeStyle=null;cachedLineWidth=null;cachedGlobalAlpha=null;cachedTextAlign=null;cachedTextBaseline=null;cachedLineCap=null;cachedLineJoin=null;cachedMiterLimit=null;dpr;constructor(t,e,s,i=a.scale.XY.IDENTITY){this.wrapped=t,this.scale_=i,this.atlasRegistry=e,this.dpr=s}get fontStretch(){return this.wrapped.fontStretch}set fontStretch(t){this.wrapped.fontStretch=t}get fontVariantCaps(){return this.wrapped.fontVariantCaps}set fontVariantCaps(t){this.wrapped.fontVariantCaps=t}isContextLost(){return this.wrapped.isContextLost()}get wordSpacing(){return this.wrapped.wordSpacing}set wordSpacing(t){this.wrapped.wordSpacing=t}get letterSpacing(){return this.wrapped.letterSpacing}set letterSpacing(t){this.wrapped.letterSpacing=t}get textRendering(){return this.wrapped.textRendering}set textRendering(t){this.wrapped.textRendering=t}checkAtlasFillStyle(t=!1){return t&&typeof this.fillStyle=="string"?[!0,this.fillStyle]:(t&&console.warn("attempted to use a text atlas with a gradient fill style. This is not supported. Falling back to default canvas fill."),[!1,null])}reset(){this.wrapped.reset()}applyScale(t){return new S(this,this.atlasRegistry,this.dpr,t)}get canvas(){return this.wrapped.canvas}get miterLimit(){return this.cachedMiterLimit??this.wrapped.miterLimit}set miterLimit(t){const e=this.scale_.x.dim(t);e!==this.cachedMiterLimit&&(this.cachedMiterLimit=e,this.wrapped.miterLimit=e)}get globalAlpha(){return this.cachedGlobalAlpha??this.wrapped.globalAlpha}set globalAlpha(t){t!==this.cachedGlobalAlpha&&(this.cachedGlobalAlpha=t,this.wrapped.globalAlpha=t)}get globalCompositeOperation(){return this.wrapped.globalCompositeOperation}set globalCompositeOperation(t){this.wrapped.globalCompositeOperation=t}get fillStyle(){return this.cachedFillStyle??this.wrapped.fillStyle}set fillStyle(t){t!==this.cachedFillStyle&&(this.cachedFillStyle=t,this.wrapped.fillStyle=t)}get strokeStyle(){return this.cachedStrokeStyle??this.wrapped.strokeStyle}set strokeStyle(t){t!==this.cachedStrokeStyle&&(this.cachedStrokeStyle=t,this.wrapped.strokeStyle=t)}drawImage(t,e,s,i,r,n,h,o,p){this.wrapped.drawImage(t,e,s,i,r,n!=null?this.scale_.x.pos(n):n,h!=null?this.scale_.y.pos(h):h,o!=null?this.scale_.x.dim(o):o,p!=null?this.scale_.y.dim(p):p)}beginPath(){this.wrapped.beginPath()}clip(t,e){this.wrapped.clip(t,e)}fill(t,e){if(t==null)return this.wrapped.fill();this.wrapped.fill(t,e)}isPointInPath(t,e,s,i){return this.wrapped.isPointInPath(t,e,s,i)}isPointInStroke(t,e,s){return this.wrapped.isPointInStroke(t,e,s)}stroke(t){if(t==null)return this.wrapped.stroke();this.wrapped.stroke(t)}createConicGradient(t,e,s){return this.wrapped.createConicGradient(t,e,s)}createLinearGradient(t,e,s,i){return this.wrapped.createLinearGradient(t,e,s,i)}createPattern(t,e){return this.wrapped.createPattern(t,e)}createRadialGradient(t,e,s,i,r,n){return this.wrapped.createRadialGradient(t,e,s,i,r,n)}get filter(){return this.wrapped.filter}set filter(t){this.wrapped.filter=t}createImageData(t,e,s){return this.wrapped.createImageData(t,e,s)}getImageData(t,e,s,i,r){return this.wrapped.getImageData(t,e,s,i,r)}putImageData(t,e,s,i,r,n,h){this.wrapped.putImageData(t,e,s,i,r,n,h)}get imageSmoothingEnabled(){return this.wrapped.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.wrapped.imageSmoothingEnabled=t}get imageSmoothingQuality(){return this.wrapped.imageSmoothingQuality}set imageSmoothingQuality(t){this.wrapped.imageSmoothingQuality=t}arc(t,e,s,i,r,n){this.wrapped.arc(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),i,r,n)}arcTo(t,e,s,i,r){this.wrapped.arcTo(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.pos(s),this.scale_.y.pos(i),this.scale_.x.dim(r))}bezierCurveTo(t,e,s,i,r,n){this.wrapped.bezierCurveTo(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.pos(s),this.scale_.y.pos(i),this.scale_.x.pos(r),this.scale_.y.pos(n))}closePath(){this.wrapped.closePath()}ellipse(t,e,s,i,r,n,h,o){this.wrapped.ellipse(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),this.scale_.y.dim(i),r,n,h,o)}lineTo(t,e){this.wrapped.lineTo(this.scale_.x.pos(t),this.scale_.y.pos(e))}moveTo(t,e){this.wrapped.moveTo(this.scale_.x.pos(t),this.scale_.y.pos(e))}quadraticCurveTo(t,e,s,i){this.wrapped.quadraticCurveTo(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.pos(s),this.scale_.y.pos(i))}rect(t,e,s,i){this.wrapped.rect(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),this.scale_.y.dim(i))}roundRect(t,e,s,i,r){this.wrapped.roundRect(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),this.scale_.y.dim(i),typeof r=="number"?this.scale_.x.dim(r):r)}get lineCap(){return this.cachedLineCap??this.wrapped.lineCap}set lineCap(t){t!==this.cachedLineCap&&(this.cachedLineCap=t,this.wrapped.lineCap=t)}get lineDashOffset(){return this.wrapped.lineDashOffset}set lineDashOffset(t){this.wrapped.lineDashOffset=this.scale_.x.dim(t)}get lineJoin(){return this.cachedLineJoin??this.wrapped.lineJoin}set lineJoin(t){t!==this.cachedLineJoin&&(this.cachedLineJoin=t,this.wrapped.lineJoin=t)}get lineWidth(){return this.cachedLineWidth??this.wrapped.lineWidth}set lineWidth(t){const e=this.scale_.x.dim(t);e!==this.cachedLineWidth&&(this.cachedLineWidth=e,this.wrapped.lineWidth=e)}getLineDash(){return this.wrapped.getLineDash()}setLineDash(t){const e=Array.from(t).map(s=>this.scale_.x.dim(s));this.wrapped.setLineDash(e)}clearRect(t,e,s,i){this.wrapped.clearRect(t,e,s,i)}fillRect(t,e,s,i){this.wrapped.fillRect(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),this.scale_.y.dim(i))}strokeRect(t,e,s,i){this.wrapped.strokeRect(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),this.scale_.y.dim(i))}get shadowBlur(){return this.wrapped.shadowBlur}set shadowBlur(t){this.wrapped.shadowBlur=t}get shadowColor(){return this.wrapped.shadowColor}set shadowColor(t){this.wrapped.shadowColor=t}get shadowOffsetX(){return this.wrapped.shadowOffsetX}set shadowOffsetX(t){this.wrapped.shadowOffsetX=t}get shadowOffsetY(){return this.wrapped.shadowOffsetY}restore(){this.cachedFillStyle=null,this.cachedStrokeStyle=null,this.cachedLineWidth=null,this.cachedGlobalAlpha=null,this.cachedTextAlign=null,this.cachedTextBaseline=null,this.cachedLineCap=null,this.cachedLineJoin=null,this.cachedMiterLimit=null,this.cachedFont=null,this.wrapped.restore()}save(){this.wrapped.save()}fillText(t,e,s,i,r={}){const[n,h]=this.checkAtlasFillStyle(r.useAtlas);if(n){this.atlasRegistry.get({font:this.font,textColor:h}).fillText(this,t,e,s);return}this.wrapped.fillText(t,this.scale_.x.pos(e),this.scale_.y.pos(s),i!=null?this.scale_.x.dim(i):void 0)}measureText(t){return this.wrapped.measureText(t)}textDimensions(t,e={}){const[s,i]=this.checkAtlasFillStyle(e.useAtlas);return s?this.atlasRegistry.get({font:this.font,textColor:i}).measureText(t):I.dimensionsFromMetrics(this.measureText(t))}strokeText(t,e,s,i){this.wrapped.strokeText(t,this.scale_.x.pos(e),this.scale_.y.pos(s),i!=null?this.scale_.x.dim(i):void 0)}get direction(){return this.wrapped.direction}set direction(t){this.wrapped.direction=t}get font(){return this.cachedFont!=null?this.cachedFont:this.wrapped.font}set font(t){t!==this.cachedFont&&(this.cachedFont=t,this.wrapped.font=this.cachedFont)}get fontKerning(){return this.wrapped.fontKerning}set fontKerning(t){this.wrapped.fontKerning=t}get textAlign(){return this.cachedTextAlign??this.wrapped.textAlign}set textAlign(t){t!==this.cachedTextAlign&&(this.cachedTextAlign=t,this.wrapped.textAlign=t)}get textBaseline(){return this.cachedTextBaseline??this.wrapped.textBaseline}set textBaseline(t){t!==this.cachedTextBaseline&&(this.cachedTextBaseline=t,this.wrapped.textBaseline=t)}getTransform(){return this.wrapped.getTransform()}resetTransform(){this.wrapped.resetTransform()}rotate(t){this.wrapped.rotate(t)}scale(t,e){this.wrapped.scale(t,e),this.dpr=t}scissor(t,e=a.xy.ZERO){const s=new Z(this.scale_);return t=_(t,e),s.rect(...a.xy.couple(a.box.topLeft(t)),...a.dimensions.couple(a.box.dims(t))),this.save(),this.clip(s.getPath()),()=>this.restore()}setTransform(t,e,s,i,r,n){this.wrapped.setTransform(t,e,s,i,r,n)}transform(t,e,s,i,r,n){this.wrapped.transform(t,e,s,i,r,n)}translate(t,e){this.wrapped.translate(t,e)}}class Z{scale_;path;constructor(t=a.scale.XY.IDENTITY,e){this.scale_=t,e instanceof Path2D||typeof e=="string"?this.path=new Path2D(e):this.path=new Path2D}addPath(t,e){this.path.addPath(t,e)}arc(t,e,s,i,r,n){this.path.arc(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),i,r,n)}arcTo(t,e,s,i,r){this.path.arcTo(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.pos(s),this.scale_.y.pos(i),this.scale_.x.dim(r))}bezierCurveTo(t,e,s,i,r,n){this.path.bezierCurveTo(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.pos(s),this.scale_.y.pos(i),this.scale_.x.pos(r),this.scale_.y.pos(n))}closePath(){this.path.closePath()}ellipse(t,e,s,i,r,n,h,o){this.path.ellipse(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),this.scale_.y.dim(i),r,n,h,o)}lineTo(t,e){this.path.lineTo(this.scale_.x.pos(t),this.scale_.y.pos(e))}moveTo(t,e){this.path.moveTo(this.scale_.x.pos(t),this.scale_.y.pos(e))}quadraticCurveTo(t,e,s,i){this.path.quadraticCurveTo(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.pos(s),this.scale_.y.pos(i))}rect(t,e,s,i){this.path.rect(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),this.scale_.y.dim(i))}roundRect(t,e,s,i,r){const n=this.scaleRadii(r);this.path.roundRect(this.scale_.x.pos(t),this.scale_.y.pos(e),this.scale_.x.dim(s),this.scale_.y.dim(i),n)}scaleRadii(t){return t==null?t:typeof t=="number"?this.scale_.x.dim(t):Array.isArray(t)?t.map(e=>this.scaleRadius(e)):this.scaleRadius(t)}scaleRadius(t){return typeof t=="number"?this.scale_.x.dim(t):{x:this.scale_.x.dim(t.x??0),y:this.scale_.y.dim(t.y??0)}}getPath(){return this.path}}const H=`precision mediump float;
|
|
2
|
+
|
|
3
|
+
void main(void) {
|
|
4
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
5
|
+
}
|
|
6
|
+
`,V=`attribute vec4 a_position;
|
|
7
|
+
|
|
8
|
+
void main(void) {
|
|
9
|
+
gl_Position = a_position;
|
|
10
|
+
}
|
|
11
|
+
`,v=l=>new Error(`failed to compile webgl program: ${l}`),J=new Error("null shader encountered");let G=class{renderCtx;prog;vertShader;fragShader;uniformLocCache=new Map;constructor(t,e,s){this.renderCtx=t;const i=t.gl.createProgram();if(i==null)throw v("failed to create program");this.prog=i,this.vertShader=e,this.fragShader=s,this.compile()}setAsActive(){return this.renderCtx.gl.useProgram(this.prog),()=>this.renderCtx.gl.useProgram(null)}uniformXY(t,e){this.renderCtx.gl.uniform2fv(this.getUniformLoc(t),a.xy.couple(e))}uniformColor(t,e){this.renderCtx.gl.uniform4fv(this.getUniformLoc(t),a.color.rgba1(e))}getUniformLoc(t){const e=this.uniformLocCache.get(t);if(e!=null)return e;const s=this.renderCtx.gl.getUniformLocation(this.prog,t);if(s==null)throw new Error(`unexpected missing uniform ${t}`);return this.uniformLocCache.set(t,s),s}compile(){const t=this.renderCtx.gl;this.compileShader(this.vertShader,t.VERTEX_SHADER),this.compileShader(this.fragShader,t.FRAGMENT_SHADER),t.linkProgram(this.prog)}compileShader(t,e){const s=this.renderCtx.gl,i=s.createShader(e);if(i==null)throw J;if(s.shaderSource(i,t),s.compileShader(i),!s.getShaderParameter(i,s.COMPILE_STATUS)){const n=s.getShaderInfoLog(i);throw s.deleteShader(i),v(n??"unknown")}s.attachShader(this.prog,i)}};const $=new Float32Array([0,0,0,0,0,0]);class Q extends G{positionBuffer;constructor(t){super(t,V,H);const e=t.gl.createBuffer();if(e==null)throw new K.UnexpectedError("webgl: failed to create buffer");this.positionBuffer=e,t.gl.bindBuffer(t.gl.ARRAY_BUFFER,this.positionBuffer),t.gl.bufferData(t.gl.ARRAY_BUFFER,$,t.gl.STATIC_DRAW)}exec(){const{gl:t}=this.renderCtx,e=t.getAttribLocation(this.prog,"a_position");t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer);const s=t.createVertexArray();t.bindVertexArray(s),t.enableVertexAttribArray(e),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),this.setAsActive(),t.drawArrays(t.TRIANGLES,0,3)}}const D={high:1,low:0};class M{requests=new Map;cleanup=new Map;afterRender;instrumentation;handleError;constructor({afterRender:t,instrumentation:e=x.alamos.Instrumentation.NOOP,handleError:s}){this.afterRender=t,this.instrumentation=e,this.handleError=s,this.start()}set(t){const e=this.requests.get(t.key);if(e==null)this.requests.set(t.key,t);else{const s=D[t.priority]>=D[e.priority],i=t.canvases.length>=e.canvases.length;s&&i&&this.requests.set(t.key,t)}}render(){const{requests:t}=this;t.size!==0&&(this.runCleanupsSync(),this.renderSync(),this.requests.clear(),this.afterRender?.())}runCleanupsSync(){const{cleanup:t,requests:e}=this;t.forEach((s,i)=>{const r=e.get(i);r!=null&&(s(r),t.delete(i))})}renderSync(){const{requests:t}=this;t.forEach(e=>{try{const s=e.render();s!=null&&this.cleanup.set(e.key,s)}catch(s){this.handleError(s,"render loop failed")}})}start(){const t=()=>{try{this.render()}catch(e){this.handleError(e,"render loop failed")}requestAnimationFrame(t)};requestAnimationFrame(t)}}const y=2,u=2;class L{atlas;charDims;charMap;static DEFAULT_CHARS="0123456789.:-°µmsNa∞ᴇABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%";constructor(t){const{font:e,characters:s=L.DEFAULT_CHARS,textColor:i}=t;this.charMap=new Map;const r=a.unique.unique(Array.from(s)),h=new OffscreenCanvas(1,1).getContext("2d");h.font=e;const o=h.measureText("0");this.charDims=I.dimensionsFromMetrics(o),this.charDims.width+=y,this.charDims.height+=y;const p=r.length,d=this.charDims.width,w=this.charDims.height,c=Math.ceil(Math.sqrt(p)),T=Math.ceil(p/c);this.atlas=new OffscreenCanvas(d*c*u,w*(T+1)*u);const f=this.atlas.getContext("2d");f.scale(u,u),f.font=e,f.textBaseline="alphabetic",f.textAlign="left",f.fillStyle=a.color.hex(i),f.clearRect(0,0,this.atlas.width,this.atlas.height),r.forEach((O,R)=>{const q=R%c,z=Math.floor(R/c),N=q*d,U=(z+1)*w;f.fillText(O,N,U),this.charMap.set(O,R)})}fillText(t,e,s,i){const{width:r,height:n}=this.charDims,h=Math.ceil(Math.sqrt(this.charMap.size));t.textAlign==="center"&&(s-=r*e.length/2),t.textBaseline==="middle"&&(i+=n/2);for(let o=0;o<e.length;o++){const p=e[o],d=this.charMap.get(p);if(d===void 0)continue;const w=d%h,c=Math.floor(d/h);t.drawImage(this.atlas,w*r*u,c*n*u+y,r*u,n*u,s+o*r,i-n-y/u,r,n)}}measureText(t){return{width:t.length*this.charDims.width,height:this.charDims.height}}}class j{atlases;constructor(){this.atlases=new Map}get(t){const e=`${t.font}-${a.color.hex(t.textColor)}-${t.characters}`;if(this.atlases.has(e))return this.atlases.get(e);const s=new L(t);return this.atlases.set(e,s),s}}const P=l=>(l.textRendering="optimizeSpeed",l.imageSmoothingEnabled=!1,l);class g{glCanvas;upper2dCanvas;lower2dCanvas;gl;lower2d;upper2d;region;dpr;loop;clearProgram;os;static CONTEXT_KEY=X.CSS.B("render-context");instrumentation;static create(t,e,s,i,r){const n=k(t,"render_context"),h=new g(e,s,i,r,n,C.useAdder(t),C.useErrorHandler(t));return t.set(g.CONTEXT_KEY,h),h}constructor(t,e,s,i,r,n,h){this.upper2dCanvas=s,this.lower2dCanvas=e,this.glCanvas=t,this.os=i,this.instrumentation=r,this.dpr=1;const o=this.lower2dCanvas.getContext("2d");if(o==null)throw new Error("Could not get 2D context");const p=new j;this.lower2d=P(new S(o,p,this.dpr));const d=this.upper2dCanvas.getContext("2d");if(d==null)throw new Error("Could not get 2D context");this.upper2d=P(new S(d,p,this.dpr));const w={preserveDrawingBuffer:!0,powerPreference:"high-performance",stencil:!1,depth:!1},c=this.glCanvas.getContext("webgl2",w);if(c==null)throw new Error("Could not get WebGL context");c.disable(c.DEPTH_TEST),c.disable(c.STENCIL_TEST),c.disable(c.CULL_FACE),c.disable(c.DITHER),this.gl=c,this.glCanvas.oncontextlost=()=>n({variant:"error",message:"WebGL context lost"});const T=()=>{this.gl.flush(),this.gl.finish()};this.loop=new M({afterRender:T,instrumentation:this.instrumentation,handleError:h}),this.region=a.box.ZERO,this.os==="Windows"&&(this.clearProgram=new Q(this))}static useOptional(t){return t.getOptional(g.CONTEXT_KEY)}static use(t){return t.get(g.CONTEXT_KEY)}update(t){t.set(g.CONTEXT_KEY,this)}resize(t,e){a.box.equals(this.region,t)&&this.dpr===e||(this.region=t,this.dpr=e,this.resizeCanvas(this.glCanvas),this.resizeCanvas(this.upper2dCanvas),this.resizeCanvas(this.lower2dCanvas),this.lower2d.scale(this.dpr,this.dpr),this.upper2d.scale(this.dpr,this.dpr),this.gl.viewport(0,0,a.box.width(t)*e,a.box.height(t)*e))}resizeCanvas(t){t.width=a.box.width(this.region)*this.dpr,t.height=a.box.height(this.region)*this.dpr}get aspect(){return a.box.aspect(this.region)}scaleRegion(t){return new a.scale.XY(a.scale.Scale.scale(0,1).scale(a.box.width(t)).translate(a.box.left(t)).reBound(a.box.width(this.region)).scale(-1,1),a.scale.Scale.scale(0,1).scale(a.box.height(t)).invert().translate(a.box.top(t)).reBound(a.box.height(this.region)).scale(-1,1).invert())}scissor(t,e=a.xy.ZERO,s){const i=[];return s.includes("upper2d")&&i.push(this.upper2d.scissor(t,e)),s.includes("lower2d")&&i.push(this.lower2d.scissor(t,e)),s.includes("gl")&&i.push(this.scissorGL(t,e)),()=>i.forEach(r=>r())}scissorGL(t,e=a.xy.ZERO){return this.gl.enable(this.gl.SCISSOR_TEST),t=_(t,e),this.gl.scissor(a.box.left(t)*this.dpr,(a.box.height(this.region)-a.box.bottom(t))*this.dpr,a.box.width(t)*this.dpr,a.box.height(t)*this.dpr),()=>this.gl.disable(this.gl.SCISSOR_TEST)}erase(t,e=a.xy.ZERO,...s){e=a.xy.construct(e),s.length===0&&(s=["upper2d","lower2d","gl"]),s.includes("upper2d")&&this.eraseCanvas(this.upper2d,t,e),s.includes("lower2d")&&this.eraseCanvas(this.lower2d,t,e),s.includes("gl")&&this.eraseGL(t,e)}eraseGL(t,e=a.xy.ZERO){const{gl:s}=this,i=this.scissorGL(_(t,e));s.clearColor(...a.color.rgba1(a.color.ZERO)),s.clear(s.COLOR_BUFFER_BIT),this.os==="Windows"&&this.clearProgram?.exec(),i()}eraseCanvas(t,e,s=a.xy.ZERO){const i=_(e,s);t.clearRect(...a.xy.couple(a.box.topLeft(i)),...a.dimensions.couple(a.box.dims(i)))}}const Y=m.z.object({region:a.box.box,enabled:m.z.boolean().default(!1)}),F=["gl","lower2d","upper2d"];class A extends C.Leaf{static TYPE="eraser";schema=Y;afterUpdate(t){this.deleted||(this.internal.renderCtx=g.use(t),this.renderOnLifecycleChange())}afterDelete(){this.renderOnLifecycleChange()}renderOnLifecycleChange(){this.internal.renderCtx.loop.set({key:`${this.type}-${this.key}`,render:this.render.bind(this),priority:"high",canvases:F})}render(){this.deleted||!this.state.enabled||this.internal.renderCtx.erase(this.state.region,a.xy.construct(0),...F)}}const tt={[A.TYPE]:A};exports.Context=g;exports.Eraser=A;exports.GLProgram=G;exports.Loop=M;exports.Provider=b;exports.REGISTRY=tt;exports.REGISTRY$1=W;exports.eraserStateZ=Y;exports.providerStateZ=B;exports.useInstrumentation=k;
|
package/dist/eslint.config.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
export default
|
|
1
|
+
import { default as cfg } from '@synnaxlabs/eslint-config';
|
|
2
|
+
export default cfg;
|
|
3
3
|
//# sourceMappingURL=eslint.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.ts"],"names":[],"mappings":"AASA,OAAO,
|
|
1
|
+
{"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.ts"],"names":[],"mappings":"AASA,OAAO,GAAG,MAAM,2BAA2B,CAAC;AAE5C,eAAe,GAAG,CAAC"}
|
package/dist/ether.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./provider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./provider-DQkVj3tA.cjs"),e=require("./value-Bfn0uQuG.cjs"),R=require("@synnaxlabs/alamos"),l=require("@synnaxlabs/x"),o=require("./eraser-rFMFKqsg.cjs");require("react");require("@synnaxlabs/client");require("./types-DI2vtOGs.cjs");const s=require("./fontString-BNnhiwug.cjs"),E=Object.freeze(Object.defineProperty({__proto__:null,Provider:t.Provider,REGISTRY:t.REGISTRY,SYNNAX_DARK:t.SYNNAX_DARK,SYNNAX_LIGHT:t.SYNNAX_LIGHT,SYNNAX_THEMES:t.SYNNAX_THEMES,fontSpecZ:t.fontSpecZ,fontString:s.fontString,themeZ:t.themeZ,use:t.use},Symbol.toStringTag,{value:"Module"})),T=Object.freeze(Object.defineProperty({__proto__:null,Context:o.Context,GLProgram:o.GLProgram,Loop:o.Loop,control:e.control,request:e.request,useOptionalRequestor:e.useOptionalRequestor,useRequestor:e.useRequestor},Symbol.toStringTag,{value:"Module"})),a=Object.freeze(Object.defineProperty({__proto__:null,LinePlot:e.LinePlot,REGISTRY:e.REGISTRY,XAxis:e.XAxis,YAxis:e.YAxis,linePlotMethodsZ:e.linePlotMethodsZ,linePlotStateZ:e.linePlotStateZ,xAxisStateZ:e.xAxisStateZ,yAxisStateZ:e.yAxisStateZ},Symbol.toStringTag,{value:"Module"})),u={[e.FLUX_STORE_KEY$2]:e.FLUX_STORE_CONFIG$2,[e.RELATIONSHIPS_FLUX_STORE_KEY]:e.RELATIONSHIP_FLUX_STORE_CONFIG,[e.RESOURCES_FLUX_STORE_KEY]:e.RESOURCE_FLUX_STORE_CONFIG,[e.FLUX_STORE_KEY$1]:e.FLUX_STORE_CONFIG$1,[e.FLUX_STORE_KEY]:e.FLUX_STORE_CONFIG},_=()=>{const r=new l.RoutedWorker((n,i)=>postMessage(n,i));onmessage=r.handle.bind(r);const S={...o.REGISTRY$1,...e.REGISTRY$20,...e.REGISTRY$19,...e.REGISTRY$18,...e.REGISTRY$17,...o.REGISTRY,...e.REGISTRY$16,...e.REGISTRY$15,...e.REGISTRY$14,...e.REGISTRY,...e.REGISTRY$13,...e.REGISTRY$12,...e.REGISTRY$11,...e.REGISTRY$10,...e.REGISTRY$9,...t.REGISTRY$1,...e.REGISTRY$8,...e.REGISTRY$7,...t.REGISTRY,...e.REGISTRY$6,...e.REGISTRY$5,...e.REGISTRY$4,...e.REGISTRY$3,...e.REGISTRY$2,...e.REGISTRY$1,...e.createRegistry({storeConfig:u})};t.render({comms:r.route("vis"),registry:S,instrumentation:new R.Instrumentation({logger:new R.Logger({filters:[R.logThresholdFilter("info")]})})})},I=Object.freeze(Object.defineProperty({__proto__:null,render:_},Symbol.toStringTag,{value:"Module"}));exports.aether=t.aether;exports.canvas=e.canvas;exports.diagram=e.Diagram;exports.measure=e.measure;exports.rule=e.aether;exports.synnax=e.provider;exports.telem=e.external;exports.tooltip=e.tooltip;exports.value=e.value;exports.lineplot=a;exports.pluto=I;exports.render=T;exports.theming=E;
|
package/dist/ether.js
CHANGED
|
@@ -1,101 +1,104 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { P as R, R as s, S, a as n, b as E, f as T, t as i, u as l, c as _, r as I } from "./provider-Bt-E2O6g.js";
|
|
2
|
+
import { d as Xe } from "./provider-Bt-E2O6g.js";
|
|
3
|
+
import { c as G, r as Y, u as m, a as $, L as O, R as a, X as p, Y as u, l as f, b as g, x as c, y as d, d as L, e as F, f as b, g as N, h as X, i as x, j as P, k as y, m as U, n as C, o as A, p as j, q as v, s as h, t as M, v as K, w as Z, z as w, A as z, B as H, C as q, F as k, D, E as W, G as B, H as J, I as Q, J as V, K as ee, M as se, N as ae } from "./value-DimszMFu.js";
|
|
4
|
+
import { O as Pe, P as ye, Q as Ue, S as Ce, T as Ae, U as je, V as ve, W as he } from "./value-DimszMFu.js";
|
|
5
|
+
import { Instrumentation as te, Logger as oe, logThresholdFilter as re } from "@synnaxlabs/alamos";
|
|
6
|
+
import { RoutedWorker as Re } from "@synnaxlabs/x";
|
|
7
|
+
import { C as Se, G as ne, L as Ee, R as Te, a as ie } from "./eraser-BShvqlBE.js";
|
|
7
8
|
import "react";
|
|
8
|
-
import "
|
|
9
|
-
import
|
|
10
|
-
|
|
9
|
+
import "@synnaxlabs/client";
|
|
10
|
+
import "./types-CGRCBVD4.js";
|
|
11
|
+
import { f as le } from "./fontString-76R2eWDd.js";
|
|
12
|
+
const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
11
13
|
__proto__: null,
|
|
12
|
-
Provider:
|
|
14
|
+
Provider: R,
|
|
13
15
|
REGISTRY: s,
|
|
14
16
|
SYNNAX_DARK: S,
|
|
15
17
|
SYNNAX_LIGHT: n,
|
|
16
18
|
SYNNAX_THEMES: E,
|
|
17
19
|
fontSpecZ: T,
|
|
18
|
-
fontString:
|
|
19
|
-
themeZ:
|
|
20
|
+
fontString: le,
|
|
21
|
+
themeZ: i,
|
|
20
22
|
use: l
|
|
21
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
23
|
+
}, Symbol.toStringTag, { value: "Module" })), de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
22
24
|
__proto__: null,
|
|
23
|
-
Context:
|
|
24
|
-
GLProgram:
|
|
25
|
-
Loop:
|
|
26
|
-
control:
|
|
27
|
-
request:
|
|
28
|
-
useOptionalRequestor:
|
|
29
|
-
useRequestor:
|
|
30
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
25
|
+
Context: Se,
|
|
26
|
+
GLProgram: ne,
|
|
27
|
+
Loop: Ee,
|
|
28
|
+
control: G,
|
|
29
|
+
request: Y,
|
|
30
|
+
useOptionalRequestor: m,
|
|
31
|
+
useRequestor: $
|
|
32
|
+
}, Symbol.toStringTag, { value: "Module" })), Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
31
33
|
__proto__: null,
|
|
32
|
-
LinePlot:
|
|
34
|
+
LinePlot: O,
|
|
33
35
|
REGISTRY: a,
|
|
34
|
-
XAxis:
|
|
35
|
-
YAxis:
|
|
36
|
-
linePlotMethodsZ:
|
|
37
|
-
linePlotStateZ:
|
|
38
|
-
xAxisStateZ:
|
|
39
|
-
yAxisStateZ:
|
|
40
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
},
|
|
47
|
-
const e = new Re((o,
|
|
36
|
+
XAxis: p,
|
|
37
|
+
YAxis: u,
|
|
38
|
+
linePlotMethodsZ: f,
|
|
39
|
+
linePlotStateZ: g,
|
|
40
|
+
xAxisStateZ: c,
|
|
41
|
+
yAxisStateZ: d
|
|
42
|
+
}, Symbol.toStringTag, { value: "Module" })), _e = {
|
|
43
|
+
[ae]: J,
|
|
44
|
+
[se]: B,
|
|
45
|
+
[ee]: W,
|
|
46
|
+
[V]: D,
|
|
47
|
+
[Q]: k
|
|
48
|
+
}, Ie = () => {
|
|
49
|
+
const e = new Re((o, r) => postMessage(o, r));
|
|
48
50
|
onmessage = e.handle.bind(e);
|
|
49
51
|
const t = {
|
|
50
|
-
...
|
|
51
|
-
...k,
|
|
52
|
-
...q,
|
|
52
|
+
...ie,
|
|
53
53
|
...H,
|
|
54
54
|
...z,
|
|
55
|
-
...Ee,
|
|
56
55
|
...w,
|
|
57
56
|
...Z,
|
|
57
|
+
...Te,
|
|
58
58
|
...K,
|
|
59
|
-
...a,
|
|
60
|
-
...h,
|
|
61
59
|
...M,
|
|
60
|
+
...h,
|
|
61
|
+
...a,
|
|
62
62
|
...v,
|
|
63
63
|
...j,
|
|
64
|
-
...i,
|
|
65
64
|
...A,
|
|
66
65
|
...C,
|
|
67
|
-
...s,
|
|
68
66
|
...U,
|
|
67
|
+
..._,
|
|
69
68
|
...y,
|
|
70
69
|
...P,
|
|
70
|
+
...s,
|
|
71
71
|
...x,
|
|
72
72
|
...X,
|
|
73
73
|
...N,
|
|
74
|
-
...
|
|
74
|
+
...b,
|
|
75
|
+
...F,
|
|
76
|
+
...L,
|
|
77
|
+
...q({ storeConfig: _e })
|
|
75
78
|
};
|
|
76
79
|
I({
|
|
77
80
|
comms: e.route("vis"),
|
|
78
81
|
registry: t,
|
|
79
|
-
instrumentation: new
|
|
80
|
-
logger: new
|
|
82
|
+
instrumentation: new te({
|
|
83
|
+
logger: new oe({ filters: [re("info")] })
|
|
81
84
|
})
|
|
82
85
|
});
|
|
83
|
-
},
|
|
86
|
+
}, Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
84
87
|
__proto__: null,
|
|
85
|
-
render:
|
|
88
|
+
render: Ie
|
|
86
89
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
87
90
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
Xe as aether,
|
|
92
|
+
Pe as canvas,
|
|
93
|
+
ye as diagram,
|
|
94
|
+
Le as lineplot,
|
|
95
|
+
Ue as measure,
|
|
96
|
+
Fe as pluto,
|
|
97
|
+
de as render,
|
|
98
|
+
Ce as rule,
|
|
99
|
+
Ae as synnax,
|
|
100
|
+
je as telem,
|
|
101
|
+
ce as theming,
|
|
102
|
+
ve as tooltip,
|
|
103
|
+
he as value
|
|
101
104
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("./Dialog-DNrgykEv.cjs"),e=require("./Animated-xK__WUQp.cjs"),r=require("./jsx-runtime-nZSsnGb7.cjs"),b=require("./Copy-DuC8dTK7.cjs"),C=require("./Animated-vGAs0qOH.cjs");require("@synnaxlabs/x");const i=require("./css-CloSmhZB.cjs"),s=({onClick:a,className:l,hideCaret:t=!1,children:u,variant:o,...c})=>{const{toggle:x,visible:d,variant:g}=e.useContext();let n;return o==="preview"&&(t=!0),g!=="modal"&&!t&&(n=r.jsxRuntimeExports.jsx(C.Animated,{enabled:d,enabledLoc:"bottom",disabledLoc:"left"})),r.jsxRuntimeExports.jsxs(b.Button,{className:i.CSS(i.CSS.BE("dialog","trigger"),l),onClick:m=>{a?.(m),x()},full:"x",variant:o,...c,children:[u,n]})},f=Object.freeze(Object.defineProperty({__proto__:null,Dialog:p.Dialog,Frame:e.Frame,Trigger:s,parseLocationOptions:e.parseLocationOptions,position:e.position,useContext:e.useContext,useInternalContext:e.useInternalContext},Symbol.toStringTag,{value:"Module"}));exports.Trigger=s;exports.external=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const y=require("@synnaxlabs/x"),w=require("./Text-C2_VsLzw.cjs"),p=require("./jsx-runtime-nZSsnGb7.cjs"),z=require("./Animated-vGAs0qOH.cjs"),d=require("./css-CloSmhZB.cjs"),T=require("./Tags-6OV0_eBz.cjs");require("./Copy-DuC8dTK7.cjs");require("./Box-CNUz5BsV.cjs");const K=require("./Items-DYYNNIjr.cjs");require("./Animated-xK__WUQp.cjs");const S=require("react"),b=require("./Editable-HUPqTaui.cjs"),U=require("./types-DI2vtOGs.cjs");require("./Provider-DSMJjyuY.cjs");require("react-dom");require("./Haul-V5NQI3MY.cjs");require("./provider-DQkVj3tA.cjs");const Y=require("./hooks-C4ji1BSZ.cjs"),A=(e,n)=>n.includes(e.key),I=({nodes:e,expanded:n,sort:t,depth:s=0})=>{const r={keys:[],nodes:[]};return t!=null&&e.sort(t),e.forEach(o=>{const l=A(o,n);if(r.keys.push(o.key),r.nodes.push({depth:s,expanded:l,hasChildren:o.children!=null}),l&&o.children!=null){const{keys:c,nodes:f}=I({nodes:o.children,expanded:n,sort:t,depth:s+1});r.keys.push(...c),r.nodes.push(...f)}}),r},J=({tree:e,destination:n,keys:t})=>(t=y.array.toArray(t),n==null?[...P({tree:e,keys:t}),...e.filter(r=>!t.includes(r.key))]:(t.forEach(s=>{const r=a({tree:e,key:s});r!=null&&(M({tree:e,keys:s}),L({tree:e,destination:n,additions:r}))}),e)),M=({tree:e,keys:n,parent:t})=>{if(n=y.array.toArray(n),t!==void 0){if(t===null)return e.filter(r=>!n.includes(r.key));const s=a({tree:e,key:t});return s==null||(s.children=s.children?.filter(r=>!n.includes(r.key))),e}return n.forEach(s=>{const r=e.findIndex(o=>o.key===s);if(r!==-1)e.splice(r,1);else{const o=g({tree:e,key:s});o!=null&&(o.children=o.children?.filter(l=>l.key!==s))}}),e},L=({tree:e,destination:n,additions:t,throwOnMissing:s=!0})=>{t=y.array.toArray(t);const r=y.unique.by(t,c=>c.key,!1),o=r.map(c=>c.key);if(n==null)return[...r,...e.filter(c=>!o.includes(c.key))];const l=a({tree:e,key:n});if(l==null){if(s)throw new Error(`Could not find node with key ${n}`);return e}return l.children??=[],l.children=[...r,...l.children.filter(c=>!o.includes(c.key))],e},Q=({tree:e,key:n,updater:t,throwOnMissing:s=!0})=>{const r=a({tree:e,key:n});if(r==null){if(s)throw new Error(`Could not find node with key ${n}`);return e}const o=g({tree:e,key:n});if(o!=null){const l=o.children?.findIndex(c=>c.key===n);l!=null&&l!==-1&&o.children?.splice(l,1,t(r))}else e.splice(e.findIndex(l=>l.key===n),1,t(r));return e},V=({tree:e,parent:n,updater:t,throwOnMissing:s=!0})=>{const r=a({tree:e,key:n});if(r==null){if(s)throw new Error(`Could not find node with key ${n}`);return e}return r.children=t(r.children??[]),e},a=({tree:e,key:n,depth:t=0})=>{for(let s=0;s<e.length;s++){const r=e[s];if(r.key===n)return r;if(r.children!=null){const o=a({tree:r.children,key:n,depth:t+1});if(o!=null)return o}}return null},P=({tree:e,keys:n})=>{const t=[];for(const s of n){const r=a({tree:e,key:s});r!=null&&t.push(r)}return t},g=({tree:e,key:n})=>{for(const t of e)if(t.children!=null){if(t.children.some(r=>r.key===n))return t;const s=g({tree:t.children,key:n});if(s!=null)return s}return null},D=e=>e.map(n=>({...n,children:n.children!=null?D(n.children):void 0})),H=(...e)=>{const n=[];return e.forEach(t=>{n.push(t),t.children!=null&&n.push(...H(...t.children))}),n},W=(e,n)=>{const t={keys:[],nodes:[]};return e.keys.forEach((s,r)=>{n(s,e.nodes[r].depth)&&(t.keys.push(s),t.nodes.push(e.nodes[r]))}),t},X=e=>{const n=Math.min(...e.nodes.map(t=>t.depth));return e.keys.filter((t,s)=>e.nodes[s].depth===n)},Z=(e,n)=>{const t=n.keys.findIndex(s=>s===e);return n.nodes[t].depth},O=(e,n)=>{const t=e.keys.findIndex(s=>s===n);return e.nodes[t]},[ee,$]=w.create({displayName:"Tree.Context",providerName:"Tree.Provider"}),ne=({children:e,style:n,className:t,loading:s,useMargin:r=!1,offsetMultiplier:o=2.5,...l})=>{const{index:c}=l,{expanded:f,depth:x,hasChildren:m}=$("Tree.Item")[c];return p.jsxRuntimeExports.jsxs(T.ListItem,{className:d.CSS(d.CSS.BE("tree","item"),x!==0&&d.CSS.M("show-rules"),r&&d.CSS.M("margin"),t),style:{[d.CSS.var("tree-item-offset")]:`${x*o+1.5}rem`,...n},gap:"small",align:"center",...l,children:[m&&p.jsxRuntimeExports.jsx(z.Animated,{className:d.CSS.BE("tree","expansion-indicator"),enabled:f,enabledLoc:"bottom",disabledLoc:"right"},"caret"),e,s&&p.jsxRuntimeExports.jsx(w.Loading,{})]})},te="tree-item",re=[["Shift"]],se=({onExpand:e,nodes:n,initialExpanded:t=[],selected:s,onSelectedChange:r,sort:o})=>{const[l,c,f]=b.useCombinedStateAndRef(t),[x,m]=U.usePassthrough({initial:[],value:s,onChange:r}),q=S.useMemo(()=>I({nodes:n,expanded:l,sort:o}),[n,l,o]),_=b.useSyncedRef(n),N=b.useSyncedRef(q),R=Y.useHeldRef({triggers:re}),j=S.useCallback((u,{clicked:i})=>{if(m(h=>u.length===0&&h.length>0?h.slice(0,1):u),i==null||R.current.held)return;const C=O(N.current,i);if(C==null||!C.hasChildren)return;const k=f.current,v=k.some(h=>h===i)?"contract":"expand";let E;v==="contract"?E=k.filter(h=>h!==i):E=[...k,i],c(E),e?.({current:E,action:v,clicked:i})},[e,_,c,m]),B=S.useCallback(u=>{c(i=>y.unique.unique([...i,u])),e?.({current:l,action:"expand",clicked:u})},[c]),F=S.useCallback((...u)=>{c(i=>i.filter(C=>!u.includes(C))),u.forEach(i=>{e?.({current:l,action:"contract",clicked:i})})},[c]),G=S.useCallback(()=>c([]),[c]);return{selected:x,expanded:l,contract:F,expand:B,clearExpanded:G,shape:q,onSelect:j}},oe=({shape:e,children:n,selected:t,onSelect:s,getItem:r,subscribe:o,className:l,contract:c,expand:f,expanded:x,className:m,clearExpanded:q,showRules:_=!1,virtual:N=!1,...R})=>{const{keys:j}=e;return p.jsxRuntimeExports.jsx(ee,{value:e.nodes,children:p.jsxRuntimeExports.jsx(T.Frame,{multiple:!0,value:t,replaceOnSingle:!0,data:j,onChange:s,getItem:r,subscribe:o,itemHeight:27,virtual:N,children:p.jsxRuntimeExports.jsx(K.Items,{full:"y",className:d.CSS(d.CSS.B("tree"),l,_&&d.CSS.M("show-rules")),...R,children:n})})})},le=Object.freeze(Object.defineProperty({__proto__:null,HAUL_TYPE:te,Item:ne,Tree:oe,deepCopy:D,filterShape:W,findNode:a,findNodeParent:g,findNodes:P,flatten:I,getAllNodesOfMinDepth:X,getDepth:Z,getDescendants:H,getNodeShape:O,moveNode:J,removeNode:M,setNode:L,shouldExpand:A,updateNode:Q,updateNodeChildren:V,use:se,useContext:$},Symbol.toStringTag,{value:"Module"}));exports.external=le;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { B as A, F as E, I as M, a as _, c as D, u as w, b as F, d as G, e as S } from "./Items-
|
|
1
|
+
import { B as A, F as E, I as M, a as _, c as D, u as w, b as F, d as G, e as S } from "./Items-CNPUoiob.js";
|
|
2
2
|
import { useCallback as u, useMemo as b } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { b as
|
|
5
|
-
import "./Text-
|
|
6
|
-
import "./jsx-runtime-
|
|
7
|
-
import "./types-
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
3
|
+
import { array as h } from "@synnaxlabs/x";
|
|
4
|
+
import { b as d } from "./Editable-4ZwvICC4.js";
|
|
5
|
+
import "./Text-BSTMZRuo.js";
|
|
6
|
+
import "./jsx-runtime-tc70JA_2.js";
|
|
7
|
+
import "./types-CGRCBVD4.js";
|
|
8
|
+
import "./css-D90kZTM8.js";
|
|
9
|
+
import "./Box-Bi280MYh.js";
|
|
10
|
+
import "./Provider-ZIy-UlnE.js";
|
|
10
11
|
import { u as U } from "./useStaticData-p8sk2VCJ.js";
|
|
11
|
-
const
|
|
12
|
+
const I = 10, y = ({ offset: t, searchTerm: e = "", ...s }, a = I) => ({
|
|
12
13
|
...s,
|
|
13
14
|
offset: (t ?? -a) + a,
|
|
14
15
|
limit: a,
|
|
15
16
|
searchTerm: e
|
|
16
|
-
}),
|
|
17
|
+
}), g = (t, e, s = I) => ({
|
|
17
18
|
...t,
|
|
18
19
|
searchTerm: e,
|
|
19
20
|
offset: 0,
|
|
20
21
|
limit: s
|
|
21
22
|
}), x = ({
|
|
22
23
|
retrieve: t,
|
|
23
|
-
pageSize: e =
|
|
24
|
+
pageSize: e = I
|
|
24
25
|
}) => {
|
|
25
26
|
const s = u(() => {
|
|
26
|
-
t((c) =>
|
|
27
|
+
t((c) => y(c, e), { mode: "append" });
|
|
27
28
|
}, [t, e]), a = u(
|
|
28
|
-
(c) => t((n) =>
|
|
29
|
+
(c) => t((n) => g(n, c, e)),
|
|
29
30
|
[t, e]
|
|
30
31
|
);
|
|
31
32
|
return b(
|
|
@@ -50,9 +51,9 @@ const p = 10, g = ({ offset: t, searchTerm: e = "", ...s }, a = p) => ({
|
|
|
50
51
|
[t.getItem, e.getItem]
|
|
51
52
|
), c = u(
|
|
52
53
|
(n, m) => {
|
|
53
|
-
const i = t.subscribe?.(n, m),
|
|
54
|
+
const i = t.subscribe?.(n, m), p = e.subscribe?.(n, m);
|
|
54
55
|
return () => {
|
|
55
|
-
i?.(),
|
|
56
|
+
i?.(), p?.();
|
|
56
57
|
};
|
|
57
58
|
},
|
|
58
59
|
[t.subscribe, e.subscribe]
|
|
@@ -72,19 +73,19 @@ const p = 10, g = ({ offset: t, searchTerm: e = "", ...s }, a = p) => ({
|
|
|
72
73
|
);
|
|
73
74
|
return b(() => ({ data: t, getItem: e }), [t, e]);
|
|
74
75
|
}, R = ({ initialData: t } = {}) => {
|
|
75
|
-
const e =
|
|
76
|
+
const e = d(() => {
|
|
76
77
|
const r = /* @__PURE__ */ new Map();
|
|
77
78
|
return t == null || t.forEach((o) => r.set(o.key, o)), r;
|
|
78
|
-
}), s =
|
|
79
|
+
}), s = d(() => /* @__PURE__ */ new Map()), a = u((r) => {
|
|
79
80
|
const o = new Set(r);
|
|
80
81
|
s.current.forEach((l, f) => {
|
|
81
82
|
o.has(l) && f();
|
|
82
83
|
});
|
|
83
84
|
}, []), c = u((r) => {
|
|
84
|
-
const o =
|
|
85
|
+
const o = h.toArray(r), l = o.map((f) => f.key);
|
|
85
86
|
o.forEach((f) => e.current.set(f.key, f)), a(l);
|
|
86
87
|
}, []), n = u((r) => {
|
|
87
|
-
const o =
|
|
88
|
+
const o = h.toArray(r);
|
|
88
89
|
o.forEach((l) => e.current.delete(l)), a(o);
|
|
89
90
|
}, []), m = u(
|
|
90
91
|
(r, o) => o == null ? () => {
|
|
@@ -98,20 +99,20 @@ const p = 10, g = ({ offset: t, searchTerm: e = "", ...s }, a = p) => ({
|
|
|
98
99
|
return Array.isArray(r) ? r.map((o) => e.current.get(o)).filter((o) => o != null) : e.current.get(r);
|
|
99
100
|
}),
|
|
100
101
|
[]
|
|
101
|
-
),
|
|
102
|
+
), p = u((r) => e.current.has(r), []);
|
|
102
103
|
return b(
|
|
103
|
-
() => ({ setItem: c, deleteItem: n, subscribe: m, getItem: i, hasItem:
|
|
104
|
-
[c, n, m, i,
|
|
104
|
+
() => ({ setItem: c, deleteItem: n, subscribe: m, getItem: i, hasItem: p }),
|
|
105
|
+
[c, n, m, i, p]
|
|
105
106
|
);
|
|
106
|
-
},
|
|
107
|
+
}, Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
107
108
|
__proto__: null,
|
|
108
109
|
BaseFrame: A,
|
|
109
110
|
Frame: E,
|
|
110
111
|
Item: M,
|
|
111
112
|
Items: _,
|
|
112
113
|
createGetItem: D,
|
|
113
|
-
page:
|
|
114
|
-
search:
|
|
114
|
+
page: y,
|
|
115
|
+
search: g,
|
|
115
116
|
useCombinedData: C,
|
|
116
117
|
useData: w,
|
|
117
118
|
useItem: F,
|
|
@@ -124,6 +125,6 @@ const p = 10, g = ({ offset: t, searchTerm: e = "", ...s }, a = p) => ({
|
|
|
124
125
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
125
126
|
export {
|
|
126
127
|
x as a,
|
|
127
|
-
|
|
128
|
+
Q as e,
|
|
128
129
|
P as u
|
|
129
130
|
};
|