@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.
- package/dist/aether-BBeeeA1z.cjs +10 -0
- package/dist/aether-Bl3vMZO3.js +716 -0
- package/dist/aether-DmSenWd4.js +704 -0
- package/dist/aether-VeYJQDcf.cjs +11 -0
- package/dist/button-DBdzH6Ky.cjs +1 -0
- package/dist/button-KtgabnXL.js +251 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +2 -4
- package/dist/chunk-DeC0fbbY.js +23 -0
- package/dist/chunk-FeXHwk1_.cjs +1 -0
- package/dist/color-Cspp5cKp.js +7904 -0
- package/dist/color-DCCr0Z1b.cjs +29 -0
- package/dist/color.cjs +1 -1
- package/dist/color.js +2 -4
- package/dist/css-Ce-x3HcK.cjs +1 -0
- package/dist/css-UEo6g0SR.js +69 -0
- package/dist/css.cjs +1 -1
- package/dist/css.js +2 -8
- package/dist/dialog-BTCrp5Yv.cjs +1 -0
- package/dist/dialog-ClQI4sHo.js +331 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +2 -4
- package/dist/divider-BYRH8-5K.js +13 -0
- package/dist/divider-CEyntx31.cjs +1 -0
- package/dist/ether-CZlE80D0.cjs +53 -0
- package/dist/ether-KMGPzrZR.js +6222 -0
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +4 -104
- package/dist/event-Btz3eWg1.cjs +1 -0
- package/dist/event-Z4V8c501.js +4 -0
- package/dist/flex-Bgtu0DK6.js +62 -0
- package/dist/flex-D_GoD3ed.cjs +1 -0
- package/dist/flex.cjs +1 -1
- package/dist/flex.js +2 -4
- package/dist/haul-BdMc4rLJ.js +171 -0
- package/dist/haul-ZdSHqhp6.cjs +1 -0
- package/dist/header-CNx3pAkx.js +64 -0
- package/dist/header-lD0sRjCR.cjs +1 -0
- package/dist/header.cjs +1 -1
- package/dist/header.js +2 -4
- package/dist/input-CdL1OPDU.cjs +74 -0
- package/dist/input-h-4axMs7.js +47772 -0
- package/dist/input.cjs +1 -1
- package/dist/input.js +2 -4
- package/dist/list-DacuSBB3.cjs +4 -0
- package/dist/list-dZDsxTzd.js +1756 -0
- package/dist/list.cjs +1 -1
- package/dist/list.js +2 -4
- package/dist/menu-eeXfR_zT.js +170 -0
- package/dist/menu-yADx33I8.cjs +1 -0
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +2 -4
- package/dist/pluto.cjs +52 -0
- package/dist/pluto.css +2 -1
- package/dist/pluto.js +36474 -0
- package/dist/select-B93mFqvf.js +1328 -0
- package/dist/select-gt7wGGO4.cjs +1 -0
- package/dist/src/access/policy/queries.d.ts +34 -34
- package/dist/src/access/policy/queries.d.ts.map +1 -1
- package/dist/src/access/queries.d.ts +1 -1
- package/dist/src/access/queries.d.ts.map +1 -1
- package/dist/src/access/role/queries.d.ts +2 -12
- package/dist/src/access/role/queries.d.ts.map +1 -1
- package/dist/src/arc/queries.d.ts +1167 -29
- package/dist/src/arc/queries.d.ts.map +1 -1
- package/dist/src/channel/LinePlot.d.ts +2 -2
- package/dist/src/channel/LinePlot.d.ts.map +1 -1
- package/dist/src/channel/queries.d.ts +108 -60
- package/dist/src/channel/queries.d.ts.map +1 -1
- package/dist/src/color/Provider.d.ts +8 -8
- package/dist/src/device/queries.d.ts +148 -363
- package/dist/src/device/queries.d.ts.map +1 -1
- package/dist/src/flux/result.d.ts +5 -5
- package/dist/src/flux/result.d.ts.map +1 -1
- package/dist/src/flux/update.d.ts +1 -1
- package/dist/src/flux/update.d.ts.map +1 -1
- package/dist/src/icon/Icon.d.ts.map +1 -1
- package/dist/src/icon/registry.d.ts +1 -0
- package/dist/src/icon/registry.d.ts.map +1 -1
- package/dist/src/label/queries.d.ts +21 -21
- package/dist/src/label/queries.d.ts.map +1 -1
- package/dist/src/lineplot/aether/XAxis.d.ts +28 -28
- package/dist/src/lineplot/aether/YAxis.d.ts +28 -28
- package/dist/src/lineplot/aether/axis.d.ts +14 -14
- package/dist/src/lineplot/queries.d.ts +2 -2
- package/dist/src/lineplot/queries.d.ts.map +1 -1
- package/dist/src/lineplot/range/aether/provider.d.ts +126 -102
- package/dist/src/lineplot/range/aether/provider.d.ts.map +1 -1
- package/dist/src/lineplot/tooltip/aether/tooltip.d.ts +56 -56
- package/dist/src/log/aether/Log.d.ts +21 -21
- package/dist/src/log/queries.d.ts +2 -2
- package/dist/src/log/queries.d.ts.map +1 -1
- package/dist/src/memo/index.d.ts +0 -1
- package/dist/src/memo/index.d.ts.map +1 -1
- package/dist/src/memo/useMemoCompare.d.ts +0 -1
- package/dist/src/memo/useMemoCompare.d.ts.map +1 -1
- package/dist/src/rack/queries.d.ts.map +1 -1
- package/dist/src/ranger/aether/queries.d.ts.map +1 -1
- package/dist/src/ranger/queries.d.ts +19 -19
- package/dist/src/ranger/queries.d.ts.map +1 -1
- package/dist/src/schematic/queries.d.ts +2 -2
- package/dist/src/schematic/queries.d.ts.map +1 -1
- package/dist/src/schematic/symbol/Forms.d.ts.map +1 -1
- package/dist/src/schematic/symbol/Primitives.d.ts +2 -1
- package/dist/src/schematic/symbol/Primitives.d.ts.map +1 -1
- package/dist/src/schematic/symbol/SelectOrientation.d.ts.map +1 -1
- package/dist/src/schematic/symbol/Symbols.d.ts +35 -34
- package/dist/src/schematic/symbol/Symbols.d.ts.map +1 -1
- package/dist/src/schematic/symbol/queries.d.ts +96 -50
- package/dist/src/schematic/symbol/queries.d.ts.map +1 -1
- package/dist/src/schematic/symbol/registry.d.ts.map +1 -1
- package/dist/src/select/Dialog.d.ts +2 -1
- package/dist/src/select/Dialog.d.ts.map +1 -1
- package/dist/src/status/Select.d.ts.map +1 -1
- package/dist/src/status/SelectMulipleVariants.spec.d.ts +2 -0
- package/dist/src/status/SelectMulipleVariants.spec.d.ts.map +1 -0
- package/dist/src/status/SelectMultipleVariants.d.ts +9 -0
- package/dist/src/status/SelectMultipleVariants.d.ts.map +1 -0
- package/dist/src/status/SelectVariant.d.ts +2 -2
- package/dist/src/status/SelectVariant.d.ts.map +1 -1
- package/dist/src/status/SelectVariant.spec.d.ts +2 -0
- package/dist/src/status/SelectVariant.spec.d.ts.map +1 -0
- package/dist/src/status/aether/aggregator.d.ts +16 -2
- package/dist/src/status/aether/aggregator.d.ts.map +1 -1
- package/dist/src/status/aether/errorHandler.d.ts +2 -1
- package/dist/src/status/aether/errorHandler.d.ts.map +1 -1
- package/dist/src/status/base/Aggregator.d.ts +3 -2
- package/dist/src/status/base/Aggregator.d.ts.map +1 -1
- package/dist/src/status/external.d.ts +1 -0
- package/dist/src/status/external.d.ts.map +1 -1
- package/dist/src/status/queries.d.ts +25 -9
- package/dist/src/status/queries.d.ts.map +1 -1
- package/dist/src/status/variantData.d.ts +4 -0
- package/dist/src/status/variantData.d.ts.map +1 -0
- package/dist/src/table/cells/Cells.d.ts +17 -17
- package/dist/src/table/queries.d.ts +2 -2
- package/dist/src/table/queries.d.ts.map +1 -1
- package/dist/src/task/queries.d.ts +3 -3
- package/dist/src/task/queries.d.ts.map +1 -1
- package/dist/src/telem/aether/noop.d.ts.map +1 -1
- package/dist/src/telem/aether/static.d.ts +10 -10
- package/dist/src/telem/aether/telem.d.ts +1 -1
- package/dist/src/telem/aether/telem.d.ts.map +1 -1
- package/dist/src/telem/aether/transformers.d.ts +15 -15
- package/dist/src/telem/aether/transformers.d.ts.map +1 -1
- package/dist/src/telem/client/cache/cache.d.ts +1 -1
- package/dist/src/telem/client/cache/cache.d.ts.map +1 -1
- package/dist/src/telem/client/client.d.ts +4 -4
- package/dist/src/telem/client/client.d.ts.map +1 -1
- package/dist/src/telem/client/reader.d.ts +1 -1
- package/dist/src/telem/client/reader.d.ts.map +1 -1
- package/dist/src/telem/client/streamer.d.ts +1 -1
- package/dist/src/telem/client/streamer.d.ts.map +1 -1
- package/dist/src/telem/control/Controller.d.ts +1 -1
- package/dist/src/telem/control/Controller.d.ts.map +1 -1
- package/dist/src/telem/control/aether/chip.d.ts +16 -2
- package/dist/src/telem/control/aether/chip.d.ts.map +1 -1
- package/dist/src/telem/control/aether/controller.d.ts +16 -16
- package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
- package/dist/src/telem/control/aether/indicator.d.ts +51 -37
- package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
- package/dist/src/telem/control/aether/legend.d.ts +18 -16
- package/dist/src/telem/control/aether/legend.d.ts.map +1 -1
- package/dist/src/telem/control/aether/state.d.ts +9 -8
- package/dist/src/telem/control/aether/state.d.ts.map +1 -1
- package/dist/src/theming/aether/provider.d.ts +990 -990
- package/dist/src/theming/base/theme.d.ts +330 -330
- package/dist/src/user/queries.d.ts +2 -2
- package/dist/src/view/queries.d.ts +2 -2
- package/dist/src/vis/axis/axis.d.ts +14 -14
- package/dist/src/vis/gauge/aether/gauge.d.ts +21 -21
- package/dist/src/vis/gauge/use.d.ts +7 -7
- package/dist/src/vis/line/aether/line.d.ts +7 -7
- package/dist/src/vis/measure/aether/measure.d.ts +56 -56
- package/dist/src/vis/rule/aether/aether.d.ts +14 -14
- package/dist/src/vis/value/aether/value.d.ts +42 -42
- package/dist/src/vis/value/redline.d.ts +5 -5
- package/dist/src/vis/value/redline.d.ts.map +1 -1
- package/dist/src/vis/value/use.d.ts +14 -14
- package/dist/src/workspace/queries.d.ts +6 -4
- package/dist/src/workspace/queries.d.ts.map +1 -1
- package/dist/tabs-CB7d2_0h.cjs +1 -0
- package/dist/tabs-DEXXNOZA.js +253 -0
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +2 -4
- package/dist/text-Dd6wYgQM.js +142 -0
- package/dist/text-n3Fetdk6.cjs +1 -0
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -5
- package/dist/theming-Blgv4Cvi.js +591 -0
- package/dist/theming-KFfFjsRJ.cjs +1 -0
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -5
- package/dist/tree-B4jJAzS1.js +294 -0
- package/dist/tree-CsgSEpgy.cjs +1 -0
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +2 -4
- package/dist/triggers-AqBSAR_T.cjs +1 -0
- package/dist/triggers-DDlalLoO.js +4748 -0
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +2 -4
- package/dist/types-BGbd8pRh.js +73 -0
- package/dist/types-ByXvRm2h.cjs +1 -0
- package/dist/video-Bnr-2W9p.cjs +1 -0
- package/dist/video-ByMlaeKI.js +15 -0
- package/dist/video.cjs +1 -1
- package/dist/video.js +2 -4
- package/package.json +27 -28
- package/dist/Animated-B_N04fe6.cjs +0 -1
- package/dist/Animated-BsbNkFLg.cjs +0 -1
- package/dist/Animated-CLo1CLgn.js +0 -29
- package/dist/Animated-CO--9HPM.js +0 -354
- package/dist/Box-Bi280MYh.js +0 -96
- package/dist/Box-CNUz5BsV.cjs +0 -1
- package/dist/Copy-BgRUUzWz.cjs +0 -1
- package/dist/Copy-COWBkO_v.js +0 -337
- package/dist/Dialog-Bj7FiHJD.js +0 -59
- package/dist/Dialog-DBm6Fap1.cjs +0 -1
- package/dist/Editable-C17ILP50.js +0 -202
- package/dist/Editable-HUPqTaui.cjs +0 -1
- package/dist/Haul-CnZK3e-n.js +0 -132
- package/dist/Haul-DlwI4b25.cjs +0 -1
- package/dist/Items-CXBBG9Ip.cjs +0 -4
- package/dist/Items-DQba1BFQ.js +0 -842
- package/dist/Menu-BZ6ZGIv3.cjs +0 -1
- package/dist/Menu-CniMpPmC.js +0 -139
- package/dist/Provider-cSwm-2e_.cjs +0 -1
- package/dist/Provider-jFWpR0CX.js +0 -520
- package/dist/Tags-CxzMdPpm.cjs +0 -1
- package/dist/Tags-DvfGhiWv.js +0 -925
- package/dist/Text-2MISZsc5.js +0 -1712
- package/dist/Text-XHBXXDRS.cjs +0 -1
- package/dist/Video-Bew5_j16.js +0 -10
- package/dist/Video-BryrVNlH.cjs +0 -1
- package/dist/css-CloSmhZB.cjs +0 -1
- package/dist/css-D90kZTM8.js +0 -63
- package/dist/dimensions-CdFEW3oU.cjs +0 -1
- package/dist/dimensions-DbMN4145.js +0 -19
- package/dist/eraser-BShvqlBE.js +0 -958
- package/dist/eraser-rFMFKqsg.cjs +0 -11
- package/dist/event-BxvV3arE.cjs +0 -1
- package/dist/event-nNH_pXSr.js +0 -36
- package/dist/external-4jf1Bv96.cjs +0 -1
- package/dist/external-B2YeNEwd.cjs +0 -1
- package/dist/external-B9PnwQOL.js +0 -29
- package/dist/external-BBbkXXN0.js +0 -47
- package/dist/external-BByOkVID.cjs +0 -1
- package/dist/external-BrEnYrZV.js +0 -32
- package/dist/external-BwbypKCk.cjs +0 -1
- package/dist/external-C65vBow6.cjs +0 -1
- package/dist/external-CCcIJ20u.cjs +0 -1
- package/dist/external-CF4uh-dm.js +0 -51423
- package/dist/external-Cn6EfkLd.cjs +0 -1
- package/dist/external-CovFw1fv.cjs +0 -1
- package/dist/external-D2Zb9O5J.js +0 -93
- package/dist/external-D6aLGjMg.js +0 -8969
- package/dist/external-DDvmnE2k.js +0 -341
- package/dist/external-DTi9a-iK.cjs +0 -1
- package/dist/external-DYP1_xpd.js +0 -80
- package/dist/external-DxsuBuKe.js +0 -392
- package/dist/external-DysGdnTb.js +0 -130
- package/dist/external-N2L8ffzi.js +0 -71
- package/dist/external-UzXlHlr9.js +0 -24
- package/dist/external-_Ht_yCRf.cjs +0 -1
- package/dist/external-igNfmRSB.cjs +0 -28
- package/dist/external-uUEGzmui.cjs +0 -84
- package/dist/fontString-76R2eWDd.js +0 -29
- package/dist/fontString-BNnhiwug.cjs +0 -1
- package/dist/hooks-Co6IVYNw.cjs +0 -1
- package/dist/hooks-QNj6PdUo.js +0 -73
- package/dist/index.cjs +0 -60
- package/dist/index.js +0 -36908
- package/dist/jsx-runtime-nZSsnGb7.cjs +0 -6
- package/dist/jsx-runtime-tc70JA_2.js +0 -264
- package/dist/provider-Bt-E2O6g.js +0 -810
- package/dist/provider-DQkVj3tA.cjs +0 -10
- package/dist/src/memo/proxyMemo.d.ts +0 -3
- package/dist/src/memo/proxyMemo.d.ts.map +0 -1
- package/dist/types-CGRCBVD4.js +0 -82
- package/dist/types-DI2vtOGs.cjs +0 -1
- package/dist/units-Bu36uC6z.cjs +0 -1
- package/dist/units-DMip-eZH.js +0 -14
- package/dist/useStaticData-BTwIe0Il.cjs +0 -1
- package/dist/useStaticData-p8sk2VCJ.js +0 -1051
- package/dist/value-BkUH03tl.cjs +0 -53
- package/dist/value-D0vfKEY3.js +0 -6821
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
import { n as e } from "./chunk-DeC0fbbY.js";
|
|
2
|
+
import { l as t } from "./types-BGbd8pRh.js";
|
|
3
|
+
import { C as n, S as r, g as i, v as a } from "./aether-Bl3vMZO3.js";
|
|
4
|
+
import { n as o } from "./css-UEo6g0SR.js";
|
|
5
|
+
import { UnexpectedError as s } from "@synnaxlabs/client";
|
|
6
|
+
import { box as c, color as l, dimensions as u, scale as d, unique as f, xy as p } from "@synnaxlabs/x";
|
|
7
|
+
import { z as m } from "zod";
|
|
8
|
+
import { alamos as h } from "@synnaxlabs/alamos";
|
|
9
|
+
//#region src/alamos/aether/alamos.ts
|
|
10
|
+
var g = m.object({
|
|
11
|
+
include: m.string().array().optional(),
|
|
12
|
+
exclude: m.string().array().optional(),
|
|
13
|
+
level: m.enum(h.LOG_LEVELS).default("info")
|
|
14
|
+
}), _ = "alamos-provider", v = class extends r {
|
|
15
|
+
static TYPE = "alamos.Provider";
|
|
16
|
+
schema = g;
|
|
17
|
+
afterUpdate(e) {
|
|
18
|
+
if (e.getOptional(_) != null) return;
|
|
19
|
+
let t = [], { include: n, exclude: r, level: i } = this.state;
|
|
20
|
+
(n != null || r != null) && t.push(h.logLevelKeyFiler({
|
|
21
|
+
include: n,
|
|
22
|
+
exclude: r
|
|
23
|
+
})), i != null && t.push(h.logThresholdFilter(i)), t.length === 0 && t.push(() => !1), this.internal.ins = new h.Instrumentation({
|
|
24
|
+
key: "aether",
|
|
25
|
+
logger: new h.Logger({ filters: t })
|
|
26
|
+
}), e.set(_, this.internal.ins);
|
|
27
|
+
}
|
|
28
|
+
}, y = (e, t) => {
|
|
29
|
+
let n = e.get(_);
|
|
30
|
+
if (n == null) throw Error("No instrumentation provider");
|
|
31
|
+
return t == null ? n : n.child(t);
|
|
32
|
+
}, b = { [v.TYPE]: v }, x = (e, t) => c.construct(c.left(e) - t.x, c.top(e) - t.y, c.width(e) + t.x * 2, c.height(e) + t.y * 2), S = class e {
|
|
33
|
+
scale_;
|
|
34
|
+
wrapped;
|
|
35
|
+
atlasRegistry;
|
|
36
|
+
cachedFont = null;
|
|
37
|
+
cachedFillStyle = null;
|
|
38
|
+
cachedStrokeStyle = null;
|
|
39
|
+
cachedLineWidth = null;
|
|
40
|
+
cachedGlobalAlpha = null;
|
|
41
|
+
cachedTextAlign = null;
|
|
42
|
+
cachedTextBaseline = null;
|
|
43
|
+
cachedLineCap = null;
|
|
44
|
+
cachedLineJoin = null;
|
|
45
|
+
cachedMiterLimit = null;
|
|
46
|
+
dpr;
|
|
47
|
+
constructor(e, t, n, r = d.XY.IDENTITY) {
|
|
48
|
+
this.wrapped = e, this.scale_ = r, this.atlasRegistry = t, this.dpr = n;
|
|
49
|
+
}
|
|
50
|
+
get fontStretch() {
|
|
51
|
+
return this.wrapped.fontStretch;
|
|
52
|
+
}
|
|
53
|
+
set fontStretch(e) {
|
|
54
|
+
this.wrapped.fontStretch = e;
|
|
55
|
+
}
|
|
56
|
+
get fontVariantCaps() {
|
|
57
|
+
return this.wrapped.fontVariantCaps;
|
|
58
|
+
}
|
|
59
|
+
set fontVariantCaps(e) {
|
|
60
|
+
this.wrapped.fontVariantCaps = e;
|
|
61
|
+
}
|
|
62
|
+
isContextLost() {
|
|
63
|
+
return this.wrapped.isContextLost();
|
|
64
|
+
}
|
|
65
|
+
get wordSpacing() {
|
|
66
|
+
return this.wrapped.wordSpacing;
|
|
67
|
+
}
|
|
68
|
+
set wordSpacing(e) {
|
|
69
|
+
this.wrapped.wordSpacing = e;
|
|
70
|
+
}
|
|
71
|
+
get letterSpacing() {
|
|
72
|
+
return this.wrapped.letterSpacing;
|
|
73
|
+
}
|
|
74
|
+
set letterSpacing(e) {
|
|
75
|
+
this.wrapped.letterSpacing = e;
|
|
76
|
+
}
|
|
77
|
+
get textRendering() {
|
|
78
|
+
return this.wrapped.textRendering;
|
|
79
|
+
}
|
|
80
|
+
set textRendering(e) {
|
|
81
|
+
this.wrapped.textRendering = e;
|
|
82
|
+
}
|
|
83
|
+
checkAtlasFillStyle(e = !1) {
|
|
84
|
+
return e && typeof this.fillStyle == "string" ? [!0, this.fillStyle] : (e && 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]);
|
|
85
|
+
}
|
|
86
|
+
reset() {
|
|
87
|
+
this.wrapped.reset();
|
|
88
|
+
}
|
|
89
|
+
applyScale(t) {
|
|
90
|
+
return new e(this, this.atlasRegistry, this.dpr, t);
|
|
91
|
+
}
|
|
92
|
+
get canvas() {
|
|
93
|
+
return this.wrapped.canvas;
|
|
94
|
+
}
|
|
95
|
+
get miterLimit() {
|
|
96
|
+
return this.cachedMiterLimit ?? this.wrapped.miterLimit;
|
|
97
|
+
}
|
|
98
|
+
set miterLimit(e) {
|
|
99
|
+
let t = this.scale_.x.dim(e);
|
|
100
|
+
t !== this.cachedMiterLimit && (this.cachedMiterLimit = t, this.wrapped.miterLimit = t);
|
|
101
|
+
}
|
|
102
|
+
get globalAlpha() {
|
|
103
|
+
return this.cachedGlobalAlpha ?? this.wrapped.globalAlpha;
|
|
104
|
+
}
|
|
105
|
+
set globalAlpha(e) {
|
|
106
|
+
e !== this.cachedGlobalAlpha && (this.cachedGlobalAlpha = e, this.wrapped.globalAlpha = e);
|
|
107
|
+
}
|
|
108
|
+
get globalCompositeOperation() {
|
|
109
|
+
return this.wrapped.globalCompositeOperation;
|
|
110
|
+
}
|
|
111
|
+
set globalCompositeOperation(e) {
|
|
112
|
+
this.wrapped.globalCompositeOperation = e;
|
|
113
|
+
}
|
|
114
|
+
get fillStyle() {
|
|
115
|
+
return this.cachedFillStyle ?? this.wrapped.fillStyle;
|
|
116
|
+
}
|
|
117
|
+
set fillStyle(e) {
|
|
118
|
+
e !== this.cachedFillStyle && (this.cachedFillStyle = e, this.wrapped.fillStyle = e);
|
|
119
|
+
}
|
|
120
|
+
get strokeStyle() {
|
|
121
|
+
return this.cachedStrokeStyle ?? this.wrapped.strokeStyle;
|
|
122
|
+
}
|
|
123
|
+
set strokeStyle(e) {
|
|
124
|
+
e !== this.cachedStrokeStyle && (this.cachedStrokeStyle = e, this.wrapped.strokeStyle = e);
|
|
125
|
+
}
|
|
126
|
+
drawImage(e, t, n, r, i, a, o, s, c) {
|
|
127
|
+
this.wrapped.drawImage(e, t, n, r, i, a == null ? a : this.scale_.x.pos(a), o == null ? o : this.scale_.y.pos(o), s == null ? s : this.scale_.x.dim(s), c == null ? c : this.scale_.y.dim(c));
|
|
128
|
+
}
|
|
129
|
+
beginPath() {
|
|
130
|
+
this.wrapped.beginPath();
|
|
131
|
+
}
|
|
132
|
+
clip(e, t) {
|
|
133
|
+
this.wrapped.clip(e, t);
|
|
134
|
+
}
|
|
135
|
+
fill(e, t) {
|
|
136
|
+
if (e == null) return this.wrapped.fill();
|
|
137
|
+
this.wrapped.fill(e, t);
|
|
138
|
+
}
|
|
139
|
+
isPointInPath(e, t, n, r) {
|
|
140
|
+
return this.wrapped.isPointInPath(e, t, n, r);
|
|
141
|
+
}
|
|
142
|
+
isPointInStroke(e, t, n) {
|
|
143
|
+
return this.wrapped.isPointInStroke(e, t, n);
|
|
144
|
+
}
|
|
145
|
+
stroke(e) {
|
|
146
|
+
if (e == null) return this.wrapped.stroke();
|
|
147
|
+
this.wrapped.stroke(e);
|
|
148
|
+
}
|
|
149
|
+
createConicGradient(e, t, n) {
|
|
150
|
+
return this.wrapped.createConicGradient(e, t, n);
|
|
151
|
+
}
|
|
152
|
+
createLinearGradient(e, t, n, r) {
|
|
153
|
+
return this.wrapped.createLinearGradient(e, t, n, r);
|
|
154
|
+
}
|
|
155
|
+
createPattern(e, t) {
|
|
156
|
+
return this.wrapped.createPattern(e, t);
|
|
157
|
+
}
|
|
158
|
+
createRadialGradient(e, t, n, r, i, a) {
|
|
159
|
+
return this.wrapped.createRadialGradient(e, t, n, r, i, a);
|
|
160
|
+
}
|
|
161
|
+
get filter() {
|
|
162
|
+
return this.wrapped.filter;
|
|
163
|
+
}
|
|
164
|
+
set filter(e) {
|
|
165
|
+
this.wrapped.filter = e;
|
|
166
|
+
}
|
|
167
|
+
createImageData(e, t, n) {
|
|
168
|
+
return this.wrapped.createImageData(e, t, n);
|
|
169
|
+
}
|
|
170
|
+
getImageData(e, t, n, r, i) {
|
|
171
|
+
return this.wrapped.getImageData(e, t, n, r, i);
|
|
172
|
+
}
|
|
173
|
+
putImageData(e, t, n, r, i, a, o) {
|
|
174
|
+
this.wrapped.putImageData(e, t, n, r, i, a, o);
|
|
175
|
+
}
|
|
176
|
+
get imageSmoothingEnabled() {
|
|
177
|
+
return this.wrapped.imageSmoothingEnabled;
|
|
178
|
+
}
|
|
179
|
+
set imageSmoothingEnabled(e) {
|
|
180
|
+
this.wrapped.imageSmoothingEnabled = e;
|
|
181
|
+
}
|
|
182
|
+
get imageSmoothingQuality() {
|
|
183
|
+
return this.wrapped.imageSmoothingQuality;
|
|
184
|
+
}
|
|
185
|
+
set imageSmoothingQuality(e) {
|
|
186
|
+
this.wrapped.imageSmoothingQuality = e;
|
|
187
|
+
}
|
|
188
|
+
arc(e, t, n, r, i, a) {
|
|
189
|
+
this.wrapped.arc(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), r, i, a);
|
|
190
|
+
}
|
|
191
|
+
arcTo(e, t, n, r, i) {
|
|
192
|
+
this.wrapped.arcTo(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.pos(n), this.scale_.y.pos(r), this.scale_.x.dim(i));
|
|
193
|
+
}
|
|
194
|
+
bezierCurveTo(e, t, n, r, i, a) {
|
|
195
|
+
this.wrapped.bezierCurveTo(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.pos(n), this.scale_.y.pos(r), this.scale_.x.pos(i), this.scale_.y.pos(a));
|
|
196
|
+
}
|
|
197
|
+
closePath() {
|
|
198
|
+
this.wrapped.closePath();
|
|
199
|
+
}
|
|
200
|
+
ellipse(e, t, n, r, i, a, o, s) {
|
|
201
|
+
this.wrapped.ellipse(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), this.scale_.y.dim(r), i, a, o, s);
|
|
202
|
+
}
|
|
203
|
+
lineTo(e, t) {
|
|
204
|
+
this.wrapped.lineTo(this.scale_.x.pos(e), this.scale_.y.pos(t));
|
|
205
|
+
}
|
|
206
|
+
moveTo(e, t) {
|
|
207
|
+
this.wrapped.moveTo(this.scale_.x.pos(e), this.scale_.y.pos(t));
|
|
208
|
+
}
|
|
209
|
+
quadraticCurveTo(e, t, n, r) {
|
|
210
|
+
this.wrapped.quadraticCurveTo(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.pos(n), this.scale_.y.pos(r));
|
|
211
|
+
}
|
|
212
|
+
rect(e, t, n, r) {
|
|
213
|
+
this.wrapped.rect(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), this.scale_.y.dim(r));
|
|
214
|
+
}
|
|
215
|
+
roundRect(e, t, n, r, i) {
|
|
216
|
+
this.wrapped.roundRect(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), this.scale_.y.dim(r), typeof i == "number" ? this.scale_.x.dim(i) : i);
|
|
217
|
+
}
|
|
218
|
+
get lineCap() {
|
|
219
|
+
return this.cachedLineCap ?? this.wrapped.lineCap;
|
|
220
|
+
}
|
|
221
|
+
set lineCap(e) {
|
|
222
|
+
e !== this.cachedLineCap && (this.cachedLineCap = e, this.wrapped.lineCap = e);
|
|
223
|
+
}
|
|
224
|
+
get lineDashOffset() {
|
|
225
|
+
return this.wrapped.lineDashOffset;
|
|
226
|
+
}
|
|
227
|
+
set lineDashOffset(e) {
|
|
228
|
+
this.wrapped.lineDashOffset = this.scale_.x.dim(e);
|
|
229
|
+
}
|
|
230
|
+
get lineJoin() {
|
|
231
|
+
return this.cachedLineJoin ?? this.wrapped.lineJoin;
|
|
232
|
+
}
|
|
233
|
+
set lineJoin(e) {
|
|
234
|
+
e !== this.cachedLineJoin && (this.cachedLineJoin = e, this.wrapped.lineJoin = e);
|
|
235
|
+
}
|
|
236
|
+
get lineWidth() {
|
|
237
|
+
return this.cachedLineWidth ?? this.wrapped.lineWidth;
|
|
238
|
+
}
|
|
239
|
+
set lineWidth(e) {
|
|
240
|
+
let t = this.scale_.x.dim(e);
|
|
241
|
+
t !== this.cachedLineWidth && (this.cachedLineWidth = t, this.wrapped.lineWidth = t);
|
|
242
|
+
}
|
|
243
|
+
getLineDash() {
|
|
244
|
+
return this.wrapped.getLineDash();
|
|
245
|
+
}
|
|
246
|
+
setLineDash(e) {
|
|
247
|
+
let t = Array.from(e).map((e) => this.scale_.x.dim(e));
|
|
248
|
+
this.wrapped.setLineDash(t);
|
|
249
|
+
}
|
|
250
|
+
clearRect(e, t, n, r) {
|
|
251
|
+
this.wrapped.clearRect(e, t, n, r);
|
|
252
|
+
}
|
|
253
|
+
fillRect(e, t, n, r) {
|
|
254
|
+
this.wrapped.fillRect(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), this.scale_.y.dim(r));
|
|
255
|
+
}
|
|
256
|
+
strokeRect(e, t, n, r) {
|
|
257
|
+
this.wrapped.strokeRect(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), this.scale_.y.dim(r));
|
|
258
|
+
}
|
|
259
|
+
get shadowBlur() {
|
|
260
|
+
return this.wrapped.shadowBlur;
|
|
261
|
+
}
|
|
262
|
+
set shadowBlur(e) {
|
|
263
|
+
this.wrapped.shadowBlur = e;
|
|
264
|
+
}
|
|
265
|
+
get shadowColor() {
|
|
266
|
+
return this.wrapped.shadowColor;
|
|
267
|
+
}
|
|
268
|
+
set shadowColor(e) {
|
|
269
|
+
this.wrapped.shadowColor = e;
|
|
270
|
+
}
|
|
271
|
+
get shadowOffsetX() {
|
|
272
|
+
return this.wrapped.shadowOffsetX;
|
|
273
|
+
}
|
|
274
|
+
set shadowOffsetX(e) {
|
|
275
|
+
this.wrapped.shadowOffsetX = e;
|
|
276
|
+
}
|
|
277
|
+
get shadowOffsetY() {
|
|
278
|
+
return this.wrapped.shadowOffsetY;
|
|
279
|
+
}
|
|
280
|
+
restore() {
|
|
281
|
+
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();
|
|
282
|
+
}
|
|
283
|
+
save() {
|
|
284
|
+
this.wrapped.save();
|
|
285
|
+
}
|
|
286
|
+
fillText(e, t, n, r, i = {}) {
|
|
287
|
+
let [a, o] = this.checkAtlasFillStyle(i.useAtlas);
|
|
288
|
+
if (a) {
|
|
289
|
+
this.atlasRegistry.get({
|
|
290
|
+
font: this.font,
|
|
291
|
+
textColor: o
|
|
292
|
+
}).fillText(this, e, t, n);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
this.wrapped.fillText(e, this.scale_.x.pos(t), this.scale_.y.pos(n), r == null ? void 0 : this.scale_.x.dim(r));
|
|
296
|
+
}
|
|
297
|
+
measureText(e) {
|
|
298
|
+
return this.wrapped.measureText(e);
|
|
299
|
+
}
|
|
300
|
+
textDimensions(e, n = {}) {
|
|
301
|
+
let [r, i] = this.checkAtlasFillStyle(n.useAtlas);
|
|
302
|
+
return r ? this.atlasRegistry.get({
|
|
303
|
+
font: this.font,
|
|
304
|
+
textColor: i
|
|
305
|
+
}).measureText(e) : t(this.measureText(e));
|
|
306
|
+
}
|
|
307
|
+
strokeText(e, t, n, r) {
|
|
308
|
+
this.wrapped.strokeText(e, this.scale_.x.pos(t), this.scale_.y.pos(n), r == null ? void 0 : this.scale_.x.dim(r));
|
|
309
|
+
}
|
|
310
|
+
get direction() {
|
|
311
|
+
return this.wrapped.direction;
|
|
312
|
+
}
|
|
313
|
+
set direction(e) {
|
|
314
|
+
this.wrapped.direction = e;
|
|
315
|
+
}
|
|
316
|
+
get font() {
|
|
317
|
+
return this.cachedFont == null ? this.wrapped.font : this.cachedFont;
|
|
318
|
+
}
|
|
319
|
+
set font(e) {
|
|
320
|
+
e !== this.cachedFont && (this.cachedFont = e, this.wrapped.font = this.cachedFont);
|
|
321
|
+
}
|
|
322
|
+
get fontKerning() {
|
|
323
|
+
return this.wrapped.fontKerning;
|
|
324
|
+
}
|
|
325
|
+
set fontKerning(e) {
|
|
326
|
+
this.wrapped.fontKerning = e;
|
|
327
|
+
}
|
|
328
|
+
get textAlign() {
|
|
329
|
+
return this.cachedTextAlign ?? this.wrapped.textAlign;
|
|
330
|
+
}
|
|
331
|
+
set textAlign(e) {
|
|
332
|
+
e !== this.cachedTextAlign && (this.cachedTextAlign = e, this.wrapped.textAlign = e);
|
|
333
|
+
}
|
|
334
|
+
get textBaseline() {
|
|
335
|
+
return this.cachedTextBaseline ?? this.wrapped.textBaseline;
|
|
336
|
+
}
|
|
337
|
+
set textBaseline(e) {
|
|
338
|
+
e !== this.cachedTextBaseline && (this.cachedTextBaseline = e, this.wrapped.textBaseline = e);
|
|
339
|
+
}
|
|
340
|
+
getTransform() {
|
|
341
|
+
return this.wrapped.getTransform();
|
|
342
|
+
}
|
|
343
|
+
resetTransform() {
|
|
344
|
+
this.wrapped.resetTransform();
|
|
345
|
+
}
|
|
346
|
+
rotate(e) {
|
|
347
|
+
this.wrapped.rotate(e);
|
|
348
|
+
}
|
|
349
|
+
scale(e, t) {
|
|
350
|
+
this.wrapped.scale(e, t), this.dpr = e;
|
|
351
|
+
}
|
|
352
|
+
scissor(e, t = p.ZERO) {
|
|
353
|
+
let n = new C(this.scale_);
|
|
354
|
+
return e = x(e, t), n.rect(...p.couple(c.topLeft(e)), ...u.couple(c.dims(e))), this.save(), this.clip(n.getPath()), () => this.restore();
|
|
355
|
+
}
|
|
356
|
+
setTransform(e, t, n, r, i, a) {
|
|
357
|
+
this.wrapped.setTransform(e, t, n, r, i, a);
|
|
358
|
+
}
|
|
359
|
+
transform(e, t, n, r, i, a) {
|
|
360
|
+
this.wrapped.transform(e, t, n, r, i, a);
|
|
361
|
+
}
|
|
362
|
+
translate(e, t) {
|
|
363
|
+
this.wrapped.translate(e, t);
|
|
364
|
+
}
|
|
365
|
+
}, C = class {
|
|
366
|
+
scale_;
|
|
367
|
+
path;
|
|
368
|
+
constructor(e = d.XY.IDENTITY, t) {
|
|
369
|
+
this.scale_ = e, t instanceof Path2D || typeof t == "string" ? this.path = new Path2D(t) : this.path = new Path2D();
|
|
370
|
+
}
|
|
371
|
+
addPath(e, t) {
|
|
372
|
+
this.path.addPath(e, t);
|
|
373
|
+
}
|
|
374
|
+
arc(e, t, n, r, i, a) {
|
|
375
|
+
this.path.arc(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), r, i, a);
|
|
376
|
+
}
|
|
377
|
+
arcTo(e, t, n, r, i) {
|
|
378
|
+
this.path.arcTo(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.pos(n), this.scale_.y.pos(r), this.scale_.x.dim(i));
|
|
379
|
+
}
|
|
380
|
+
bezierCurveTo(e, t, n, r, i, a) {
|
|
381
|
+
this.path.bezierCurveTo(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.pos(n), this.scale_.y.pos(r), this.scale_.x.pos(i), this.scale_.y.pos(a));
|
|
382
|
+
}
|
|
383
|
+
closePath() {
|
|
384
|
+
this.path.closePath();
|
|
385
|
+
}
|
|
386
|
+
ellipse(e, t, n, r, i, a, o, s) {
|
|
387
|
+
this.path.ellipse(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), this.scale_.y.dim(r), i, a, o, s);
|
|
388
|
+
}
|
|
389
|
+
lineTo(e, t) {
|
|
390
|
+
this.path.lineTo(this.scale_.x.pos(e), this.scale_.y.pos(t));
|
|
391
|
+
}
|
|
392
|
+
moveTo(e, t) {
|
|
393
|
+
this.path.moveTo(this.scale_.x.pos(e), this.scale_.y.pos(t));
|
|
394
|
+
}
|
|
395
|
+
quadraticCurveTo(e, t, n, r) {
|
|
396
|
+
this.path.quadraticCurveTo(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.pos(n), this.scale_.y.pos(r));
|
|
397
|
+
}
|
|
398
|
+
rect(e, t, n, r) {
|
|
399
|
+
this.path.rect(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), this.scale_.y.dim(r));
|
|
400
|
+
}
|
|
401
|
+
roundRect(e, t, n, r, i) {
|
|
402
|
+
let a = this.scaleRadii(i);
|
|
403
|
+
this.path.roundRect(this.scale_.x.pos(e), this.scale_.y.pos(t), this.scale_.x.dim(n), this.scale_.y.dim(r), a);
|
|
404
|
+
}
|
|
405
|
+
scaleRadii(e) {
|
|
406
|
+
return e == null ? e : typeof e == "number" ? this.scale_.x.dim(e) : Array.isArray(e) ? e.map((e) => this.scaleRadius(e)) : this.scaleRadius(e);
|
|
407
|
+
}
|
|
408
|
+
scaleRadius(e) {
|
|
409
|
+
return typeof e == "number" ? this.scale_.x.dim(e) : {
|
|
410
|
+
x: this.scale_.x.dim(e.x ?? 0),
|
|
411
|
+
y: this.scale_.y.dim(e.y ?? 0)
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
getPath() {
|
|
415
|
+
return this.path;
|
|
416
|
+
}
|
|
417
|
+
}, w = "precision mediump float;\n\nvoid main(void) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); \n}\n", T = "attribute vec4 a_position;\n\nvoid main(void) {\n gl_Position = a_position;\n}\n", E = (e) => /* @__PURE__ */ Error(`failed to compile webgl program: ${e}`), D = /* @__PURE__ */ Error("null shader encountered"), O = class {
|
|
418
|
+
renderCtx;
|
|
419
|
+
prog;
|
|
420
|
+
vertShader;
|
|
421
|
+
fragShader;
|
|
422
|
+
uniformLocCache = /* @__PURE__ */ new Map();
|
|
423
|
+
constructor(e, t, n) {
|
|
424
|
+
this.renderCtx = e;
|
|
425
|
+
let r = e.gl.createProgram();
|
|
426
|
+
if (r == null) throw E("failed to create program");
|
|
427
|
+
this.prog = r, this.vertShader = t, this.fragShader = n, this.compile();
|
|
428
|
+
}
|
|
429
|
+
setAsActive() {
|
|
430
|
+
return this.renderCtx.gl.useProgram(this.prog), () => this.renderCtx.gl.useProgram(null);
|
|
431
|
+
}
|
|
432
|
+
uniformXY(e, t) {
|
|
433
|
+
this.renderCtx.gl.uniform2fv(this.getUniformLoc(e), p.couple(t));
|
|
434
|
+
}
|
|
435
|
+
uniformColor(e, t) {
|
|
436
|
+
this.renderCtx.gl.uniform4fv(this.getUniformLoc(e), l.rgba1(t));
|
|
437
|
+
}
|
|
438
|
+
getUniformLoc(e) {
|
|
439
|
+
let t = this.uniformLocCache.get(e);
|
|
440
|
+
if (t != null) return t;
|
|
441
|
+
let n = this.renderCtx.gl.getUniformLocation(this.prog, e);
|
|
442
|
+
if (n == null) throw Error(`unexpected missing uniform ${e}`);
|
|
443
|
+
return this.uniformLocCache.set(e, n), n;
|
|
444
|
+
}
|
|
445
|
+
compile() {
|
|
446
|
+
let e = this.renderCtx.gl;
|
|
447
|
+
this.compileShader(this.vertShader, e.VERTEX_SHADER), this.compileShader(this.fragShader, e.FRAGMENT_SHADER), e.linkProgram(this.prog);
|
|
448
|
+
}
|
|
449
|
+
compileShader(e, t) {
|
|
450
|
+
let n = this.renderCtx.gl, r = n.createShader(t);
|
|
451
|
+
if (r == null) throw D;
|
|
452
|
+
if (n.shaderSource(r, e), n.compileShader(r), !n.getShaderParameter(r, n.COMPILE_STATUS)) {
|
|
453
|
+
let e = n.getShaderInfoLog(r);
|
|
454
|
+
throw n.deleteShader(r), E(e ?? "unknown");
|
|
455
|
+
}
|
|
456
|
+
n.attachShader(this.prog, r);
|
|
457
|
+
}
|
|
458
|
+
}, k = new Float32Array([
|
|
459
|
+
0,
|
|
460
|
+
0,
|
|
461
|
+
0,
|
|
462
|
+
0,
|
|
463
|
+
0,
|
|
464
|
+
0
|
|
465
|
+
]), A = class extends O {
|
|
466
|
+
positionBuffer;
|
|
467
|
+
constructor(e) {
|
|
468
|
+
super(e, T, w);
|
|
469
|
+
let t = e.gl.createBuffer();
|
|
470
|
+
if (t == null) throw new s("webgl: failed to create buffer");
|
|
471
|
+
this.positionBuffer = t, e.gl.bindBuffer(e.gl.ARRAY_BUFFER, this.positionBuffer), e.gl.bufferData(e.gl.ARRAY_BUFFER, k, e.gl.STATIC_DRAW);
|
|
472
|
+
}
|
|
473
|
+
exec() {
|
|
474
|
+
let { gl: e } = this.renderCtx, t = e.getAttribLocation(this.prog, "a_position");
|
|
475
|
+
e.bindBuffer(e.ARRAY_BUFFER, this.positionBuffer);
|
|
476
|
+
let n = e.createVertexArray();
|
|
477
|
+
e.bindVertexArray(n), e.enableVertexAttribArray(t), e.vertexAttribPointer(t, 2, e.FLOAT, !1, 0, 0), this.setAsActive(), e.drawArrays(e.TRIANGLES, 0, 3);
|
|
478
|
+
}
|
|
479
|
+
}, j = {
|
|
480
|
+
high: 1,
|
|
481
|
+
low: 0
|
|
482
|
+
}, M = class {
|
|
483
|
+
requests = /* @__PURE__ */ new Map();
|
|
484
|
+
cleanup = /* @__PURE__ */ new Map();
|
|
485
|
+
afterRender;
|
|
486
|
+
instrumentation;
|
|
487
|
+
handleError;
|
|
488
|
+
constructor({ afterRender: e, instrumentation: t = h.Instrumentation.NOOP, handleError: n }) {
|
|
489
|
+
this.afterRender = e, this.instrumentation = t, this.handleError = n, this.start();
|
|
490
|
+
}
|
|
491
|
+
set(e) {
|
|
492
|
+
let t = this.requests.get(e.key);
|
|
493
|
+
if (t == null) this.requests.set(e.key, e);
|
|
494
|
+
else {
|
|
495
|
+
let n = j[e.priority] >= j[t.priority], r = e.canvases.length >= t.canvases.length;
|
|
496
|
+
n && r && this.requests.set(e.key, e);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
render() {
|
|
500
|
+
let { requests: e } = this;
|
|
501
|
+
e.size !== 0 && (this.runCleanupsSync(), this.renderSync(), this.requests.clear(), this.afterRender?.());
|
|
502
|
+
}
|
|
503
|
+
runCleanupsSync() {
|
|
504
|
+
let { cleanup: e, requests: t } = this;
|
|
505
|
+
e.forEach((n, r) => {
|
|
506
|
+
let i = t.get(r);
|
|
507
|
+
i != null && (n(i), e.delete(r));
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
renderSync() {
|
|
511
|
+
let { requests: e } = this;
|
|
512
|
+
e.forEach((e) => {
|
|
513
|
+
try {
|
|
514
|
+
let t = e.render();
|
|
515
|
+
t != null && this.cleanup.set(e.key, t);
|
|
516
|
+
} catch (e) {
|
|
517
|
+
this.handleError(e, "render loop failed");
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
start() {
|
|
522
|
+
let e = () => {
|
|
523
|
+
try {
|
|
524
|
+
this.render();
|
|
525
|
+
} catch (e) {
|
|
526
|
+
this.handleError(e, "render loop failed");
|
|
527
|
+
}
|
|
528
|
+
requestAnimationFrame(e);
|
|
529
|
+
};
|
|
530
|
+
requestAnimationFrame(e);
|
|
531
|
+
}
|
|
532
|
+
}, N = 2, P = 2, F = class e {
|
|
533
|
+
atlas;
|
|
534
|
+
charDims;
|
|
535
|
+
charMap;
|
|
536
|
+
static DEFAULT_CHARS = "0123456789.:-°µmsNa∞ᴇABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%";
|
|
537
|
+
constructor(n) {
|
|
538
|
+
let { font: r, characters: i = e.DEFAULT_CHARS, textColor: a } = n;
|
|
539
|
+
this.charMap = /* @__PURE__ */ new Map();
|
|
540
|
+
let o = f.unique(Array.from(i)), s = new OffscreenCanvas(1, 1).getContext("2d");
|
|
541
|
+
s.font = r, this.charDims = t(s.measureText("0")), this.charDims.width += N, this.charDims.height += N;
|
|
542
|
+
let c = o.length, u = this.charDims.width, d = this.charDims.height, p = Math.ceil(Math.sqrt(c)), m = Math.ceil(c / p);
|
|
543
|
+
this.atlas = new OffscreenCanvas(u * p * P, d * (m + 1) * P);
|
|
544
|
+
let h = this.atlas.getContext("2d");
|
|
545
|
+
h.scale(P, P), h.font = r, h.textBaseline = "alphabetic", h.textAlign = "left", h.fillStyle = l.hex(a), h.clearRect(0, 0, this.atlas.width, this.atlas.height), o.forEach((e, t) => {
|
|
546
|
+
let n = t % p, r = Math.floor(t / p), i = n * u, a = (r + 1) * d;
|
|
547
|
+
h.fillText(e, i, a), this.charMap.set(e, t);
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
fillText(e, t, n, r) {
|
|
551
|
+
let { width: i, height: a } = this.charDims, o = Math.ceil(Math.sqrt(this.charMap.size));
|
|
552
|
+
e.textAlign === "center" && (n -= i * t.length / 2), e.textBaseline === "middle" && (r += a / 2);
|
|
553
|
+
for (let s = 0; s < t.length; s++) {
|
|
554
|
+
let c = t[s], l = this.charMap.get(c);
|
|
555
|
+
if (l === void 0) continue;
|
|
556
|
+
let u = l % o, d = Math.floor(l / o);
|
|
557
|
+
e.drawImage(this.atlas, u * i * P, d * a * P + N, i * P, a * P, n + s * i, r - a - N / P, i, a);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
measureText(e) {
|
|
561
|
+
return {
|
|
562
|
+
width: e.length * this.charDims.width,
|
|
563
|
+
height: this.charDims.height
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
}, I = class {
|
|
567
|
+
atlases;
|
|
568
|
+
constructor() {
|
|
569
|
+
this.atlases = /* @__PURE__ */ new Map();
|
|
570
|
+
}
|
|
571
|
+
get(e) {
|
|
572
|
+
let t = `${e.font}-${l.hex(e.textColor)}-${e.characters}`;
|
|
573
|
+
if (this.atlases.has(t)) return this.atlases.get(t);
|
|
574
|
+
let n = new F(e);
|
|
575
|
+
return this.atlases.set(t, n), n;
|
|
576
|
+
}
|
|
577
|
+
}, L = (e) => (e.textRendering = "optimizeSpeed", e.imageSmoothingEnabled = !1, e), R = class e {
|
|
578
|
+
glCanvas;
|
|
579
|
+
upper2dCanvas;
|
|
580
|
+
lower2dCanvas;
|
|
581
|
+
gl;
|
|
582
|
+
lower2d;
|
|
583
|
+
upper2d;
|
|
584
|
+
region;
|
|
585
|
+
dpr;
|
|
586
|
+
loop;
|
|
587
|
+
clearProgram;
|
|
588
|
+
os;
|
|
589
|
+
static CONTEXT_KEY = o.B("render-context");
|
|
590
|
+
instrumentation;
|
|
591
|
+
static create(t, n, r, o, s) {
|
|
592
|
+
let c = new e(n, r, o, s, y(t, "render_context"), i(t), a(t));
|
|
593
|
+
return t.set(e.CONTEXT_KEY, c), c;
|
|
594
|
+
}
|
|
595
|
+
constructor(e, t, n, r, i, a, o) {
|
|
596
|
+
this.upper2dCanvas = n, this.lower2dCanvas = t, this.glCanvas = e, this.os = r, this.instrumentation = i, this.dpr = 1;
|
|
597
|
+
let s = this.lower2dCanvas.getContext("2d");
|
|
598
|
+
if (s == null) throw Error("Could not get 2D context");
|
|
599
|
+
let l = new I();
|
|
600
|
+
this.lower2d = L(new S(s, l, this.dpr));
|
|
601
|
+
let u = this.upper2dCanvas.getContext("2d");
|
|
602
|
+
if (u == null) throw Error("Could not get 2D context");
|
|
603
|
+
this.upper2d = L(new S(u, l, this.dpr));
|
|
604
|
+
let d = this.glCanvas.getContext("webgl2", {
|
|
605
|
+
preserveDrawingBuffer: !0,
|
|
606
|
+
powerPreference: "high-performance",
|
|
607
|
+
stencil: !1,
|
|
608
|
+
depth: !1
|
|
609
|
+
});
|
|
610
|
+
if (d == null) throw Error("Could not get WebGL context");
|
|
611
|
+
d.disable(d.DEPTH_TEST), d.disable(d.STENCIL_TEST), d.disable(d.CULL_FACE), d.disable(d.DITHER), this.gl = d, this.glCanvas.oncontextlost = () => a({
|
|
612
|
+
variant: "error",
|
|
613
|
+
message: "WebGL context lost"
|
|
614
|
+
}), this.loop = new M({
|
|
615
|
+
afterRender: () => {
|
|
616
|
+
this.gl.flush(), this.gl.finish();
|
|
617
|
+
},
|
|
618
|
+
instrumentation: this.instrumentation,
|
|
619
|
+
handleError: o
|
|
620
|
+
}), this.region = c.ZERO, this.os === "Windows" && (this.clearProgram = new A(this));
|
|
621
|
+
}
|
|
622
|
+
static useOptional(t) {
|
|
623
|
+
return t.getOptional(e.CONTEXT_KEY);
|
|
624
|
+
}
|
|
625
|
+
static use(t) {
|
|
626
|
+
return t.get(e.CONTEXT_KEY);
|
|
627
|
+
}
|
|
628
|
+
update(t) {
|
|
629
|
+
t.set(e.CONTEXT_KEY, this);
|
|
630
|
+
}
|
|
631
|
+
resize(e, t) {
|
|
632
|
+
c.equals(this.region, e) && this.dpr === t || (this.region = e, this.dpr = t, 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, c.width(e) * t, c.height(e) * t));
|
|
633
|
+
}
|
|
634
|
+
resizeCanvas(e) {
|
|
635
|
+
e.width = c.width(this.region) * this.dpr, e.height = c.height(this.region) * this.dpr;
|
|
636
|
+
}
|
|
637
|
+
get aspect() {
|
|
638
|
+
return c.aspect(this.region);
|
|
639
|
+
}
|
|
640
|
+
scaleRegion(e) {
|
|
641
|
+
return new d.XY(d.Scale.scale(0, 1).scale(c.width(e)).translate(c.left(e)).reBound(c.width(this.region)).scale(-1, 1), d.Scale.scale(0, 1).scale(c.height(e)).invert().translate(c.top(e)).reBound(c.height(this.region)).scale(-1, 1).invert());
|
|
642
|
+
}
|
|
643
|
+
scissor(e, t = p.ZERO, n) {
|
|
644
|
+
let r = [];
|
|
645
|
+
return n.includes("upper2d") && r.push(this.upper2d.scissor(e, t)), n.includes("lower2d") && r.push(this.lower2d.scissor(e, t)), n.includes("gl") && r.push(this.scissorGL(e, t)), () => r.forEach((e) => e());
|
|
646
|
+
}
|
|
647
|
+
scissorGL(e, t = p.ZERO) {
|
|
648
|
+
return this.gl.enable(this.gl.SCISSOR_TEST), e = x(e, t), this.gl.scissor(c.left(e) * this.dpr, (c.height(this.region) - c.bottom(e)) * this.dpr, c.width(e) * this.dpr, c.height(e) * this.dpr), () => this.gl.disable(this.gl.SCISSOR_TEST);
|
|
649
|
+
}
|
|
650
|
+
erase(e, t = p.ZERO, ...n) {
|
|
651
|
+
t = p.construct(t), n.length === 0 && (n = [
|
|
652
|
+
"upper2d",
|
|
653
|
+
"lower2d",
|
|
654
|
+
"gl"
|
|
655
|
+
]), n.includes("upper2d") && this.eraseCanvas(this.upper2d, e, t), n.includes("lower2d") && this.eraseCanvas(this.lower2d, e, t), n.includes("gl") && this.eraseGL(e, t);
|
|
656
|
+
}
|
|
657
|
+
eraseGL(e, t = p.ZERO) {
|
|
658
|
+
let { gl: n } = this, r = this.scissorGL(x(e, t));
|
|
659
|
+
n.clearColor(...l.rgba1(l.ZERO)), n.clear(n.COLOR_BUFFER_BIT), this.os === "Windows" && this.clearProgram?.exec(), r();
|
|
660
|
+
}
|
|
661
|
+
eraseCanvas(e, t, n = p.ZERO) {
|
|
662
|
+
let r = x(t, n);
|
|
663
|
+
e.clearRect(...p.couple(c.topLeft(r)), ...u.couple(c.dims(r)));
|
|
664
|
+
}
|
|
665
|
+
}, z = "pluto-vis-renderer", B = (e, t) => {
|
|
666
|
+
e.set(z, t, !1);
|
|
667
|
+
}, V = (e) => e.get(z), H = (e) => e.getOptional(z), U = (e, t) => V(e)(t), W = /* @__PURE__ */ e({
|
|
668
|
+
Context: () => R,
|
|
669
|
+
GLProgram: () => O,
|
|
670
|
+
Loop: () => M,
|
|
671
|
+
control: () => B,
|
|
672
|
+
request: () => U,
|
|
673
|
+
useOptionalRequestor: () => H,
|
|
674
|
+
useRequestor: () => V
|
|
675
|
+
}), G = m.object({
|
|
676
|
+
region: c.box,
|
|
677
|
+
enabled: m.boolean().default(!1)
|
|
678
|
+
}), K = [
|
|
679
|
+
"gl",
|
|
680
|
+
"lower2d",
|
|
681
|
+
"upper2d"
|
|
682
|
+
], q = class extends n {
|
|
683
|
+
static TYPE = "eraser";
|
|
684
|
+
schema = G;
|
|
685
|
+
afterUpdate(e) {
|
|
686
|
+
this.deleted || (this.internal.renderCtx = R.use(e), this.renderOnLifecycleChange());
|
|
687
|
+
}
|
|
688
|
+
afterDelete() {
|
|
689
|
+
this.renderOnLifecycleChange();
|
|
690
|
+
}
|
|
691
|
+
renderOnLifecycleChange() {
|
|
692
|
+
this.internal.renderCtx.loop.set({
|
|
693
|
+
key: `${this.type}-${this.key}`,
|
|
694
|
+
render: this.render.bind(this),
|
|
695
|
+
priority: "high",
|
|
696
|
+
canvases: K
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
render() {
|
|
700
|
+
this.deleted || !this.state.enabled || this.internal.renderCtx.erase(this.state.region, p.construct(0), ...K);
|
|
701
|
+
}
|
|
702
|
+
}, J = { [q.TYPE]: q };
|
|
703
|
+
//#endregion
|
|
704
|
+
export { B as a, V as c, v as d, b as f, W as i, R as l, y as m, J as n, U as o, g as p, G as r, H as s, q as t, O as u };
|