@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
package/dist/eraser-BShvqlBE.js
DELETED
|
@@ -1,958 +0,0 @@
|
|
|
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")
|
|
12
|
-
}), L = "alamos-provider";
|
|
13
|
-
class v extends q {
|
|
14
|
-
static TYPE = "alamos.Provider";
|
|
15
|
-
schema = Z;
|
|
16
|
-
afterUpdate(t) {
|
|
17
|
-
if (t.getOptional(L) != null) return;
|
|
18
|
-
const s = [], { include: i, exclude: r, level: a } = this.state;
|
|
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({
|
|
20
|
-
key: "aether",
|
|
21
|
-
logger: new _.Logger({ filters: s })
|
|
22
|
-
}), t.set(L, this.internal.ins);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const J = (l, t) => {
|
|
26
|
-
const e = l.get(L);
|
|
27
|
-
if (e == null) throw new Error("No instrumentation provider");
|
|
28
|
-
return t == null ? e : e.child(t);
|
|
29
|
-
}, gt = {
|
|
30
|
-
[v.TYPE]: v
|
|
31
|
-
}, T = (l, t) => h.construct(
|
|
32
|
-
h.left(l) - t.x,
|
|
33
|
-
h.top(l) - t.y,
|
|
34
|
-
h.width(l) + t.x * 2,
|
|
35
|
-
h.height(l) + t.y * 2
|
|
36
|
-
);
|
|
37
|
-
class R {
|
|
38
|
-
scale_;
|
|
39
|
-
wrapped;
|
|
40
|
-
atlasRegistry;
|
|
41
|
-
cachedFont = null;
|
|
42
|
-
cachedFillStyle = null;
|
|
43
|
-
cachedStrokeStyle = null;
|
|
44
|
-
cachedLineWidth = null;
|
|
45
|
-
cachedGlobalAlpha = null;
|
|
46
|
-
cachedTextAlign = null;
|
|
47
|
-
cachedTextBaseline = null;
|
|
48
|
-
cachedLineCap = null;
|
|
49
|
-
cachedLineJoin = null;
|
|
50
|
-
cachedMiterLimit = null;
|
|
51
|
-
dpr;
|
|
52
|
-
constructor(t, e, s, i = y.XY.IDENTITY) {
|
|
53
|
-
this.wrapped = t, this.scale_ = i, this.atlasRegistry = e, this.dpr = s;
|
|
54
|
-
}
|
|
55
|
-
get fontStretch() {
|
|
56
|
-
return this.wrapped.fontStretch;
|
|
57
|
-
}
|
|
58
|
-
set fontStretch(t) {
|
|
59
|
-
this.wrapped.fontStretch = t;
|
|
60
|
-
}
|
|
61
|
-
get fontVariantCaps() {
|
|
62
|
-
return this.wrapped.fontVariantCaps;
|
|
63
|
-
}
|
|
64
|
-
set fontVariantCaps(t) {
|
|
65
|
-
this.wrapped.fontVariantCaps = t;
|
|
66
|
-
}
|
|
67
|
-
isContextLost() {
|
|
68
|
-
return this.wrapped.isContextLost();
|
|
69
|
-
}
|
|
70
|
-
get wordSpacing() {
|
|
71
|
-
return this.wrapped.wordSpacing;
|
|
72
|
-
}
|
|
73
|
-
set wordSpacing(t) {
|
|
74
|
-
this.wrapped.wordSpacing = t;
|
|
75
|
-
}
|
|
76
|
-
get letterSpacing() {
|
|
77
|
-
return this.wrapped.letterSpacing;
|
|
78
|
-
}
|
|
79
|
-
set letterSpacing(t) {
|
|
80
|
-
this.wrapped.letterSpacing = t;
|
|
81
|
-
}
|
|
82
|
-
get textRendering() {
|
|
83
|
-
return this.wrapped.textRendering;
|
|
84
|
-
}
|
|
85
|
-
set textRendering(t) {
|
|
86
|
-
this.wrapped.textRendering = t;
|
|
87
|
-
}
|
|
88
|
-
checkAtlasFillStyle(t = !1) {
|
|
89
|
-
return t && typeof this.fillStyle == "string" ? [!0, this.fillStyle] : (t && console.warn(
|
|
90
|
-
"attempted to use a text atlas with a gradient fill style. This is not supported. Falling back to default canvas fill."
|
|
91
|
-
), [!1, null]);
|
|
92
|
-
}
|
|
93
|
-
reset() {
|
|
94
|
-
this.wrapped.reset();
|
|
95
|
-
}
|
|
96
|
-
applyScale(t) {
|
|
97
|
-
return new R(
|
|
98
|
-
this,
|
|
99
|
-
this.atlasRegistry,
|
|
100
|
-
this.dpr,
|
|
101
|
-
t
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
get canvas() {
|
|
105
|
-
return this.wrapped.canvas;
|
|
106
|
-
}
|
|
107
|
-
get miterLimit() {
|
|
108
|
-
return this.cachedMiterLimit ?? this.wrapped.miterLimit;
|
|
109
|
-
}
|
|
110
|
-
set miterLimit(t) {
|
|
111
|
-
const e = this.scale_.x.dim(t);
|
|
112
|
-
e !== this.cachedMiterLimit && (this.cachedMiterLimit = e, this.wrapped.miterLimit = e);
|
|
113
|
-
}
|
|
114
|
-
get globalAlpha() {
|
|
115
|
-
return this.cachedGlobalAlpha ?? this.wrapped.globalAlpha;
|
|
116
|
-
}
|
|
117
|
-
set globalAlpha(t) {
|
|
118
|
-
t !== this.cachedGlobalAlpha && (this.cachedGlobalAlpha = t, this.wrapped.globalAlpha = t);
|
|
119
|
-
}
|
|
120
|
-
get globalCompositeOperation() {
|
|
121
|
-
return this.wrapped.globalCompositeOperation;
|
|
122
|
-
}
|
|
123
|
-
set globalCompositeOperation(t) {
|
|
124
|
-
this.wrapped.globalCompositeOperation = t;
|
|
125
|
-
}
|
|
126
|
-
get fillStyle() {
|
|
127
|
-
return this.cachedFillStyle ?? this.wrapped.fillStyle;
|
|
128
|
-
}
|
|
129
|
-
set fillStyle(t) {
|
|
130
|
-
t !== this.cachedFillStyle && (this.cachedFillStyle = t, this.wrapped.fillStyle = t);
|
|
131
|
-
}
|
|
132
|
-
get strokeStyle() {
|
|
133
|
-
return this.cachedStrokeStyle ?? this.wrapped.strokeStyle;
|
|
134
|
-
}
|
|
135
|
-
set strokeStyle(t) {
|
|
136
|
-
t !== this.cachedStrokeStyle && (this.cachedStrokeStyle = t, this.wrapped.strokeStyle = t);
|
|
137
|
-
}
|
|
138
|
-
drawImage(t, e, s, i, r, a, n, o, p) {
|
|
139
|
-
this.wrapped.drawImage(
|
|
140
|
-
t,
|
|
141
|
-
e,
|
|
142
|
-
s,
|
|
143
|
-
i,
|
|
144
|
-
r,
|
|
145
|
-
a != null ? this.scale_.x.pos(a) : a,
|
|
146
|
-
n != null ? this.scale_.y.pos(n) : n,
|
|
147
|
-
o != null ? this.scale_.x.dim(o) : o,
|
|
148
|
-
p != null ? this.scale_.y.dim(p) : p
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
beginPath() {
|
|
152
|
-
this.wrapped.beginPath();
|
|
153
|
-
}
|
|
154
|
-
clip(t, e) {
|
|
155
|
-
this.wrapped.clip(t, e);
|
|
156
|
-
}
|
|
157
|
-
fill(t, e) {
|
|
158
|
-
if (t == null) return this.wrapped.fill();
|
|
159
|
-
this.wrapped.fill(t, e);
|
|
160
|
-
}
|
|
161
|
-
isPointInPath(t, e, s, i) {
|
|
162
|
-
return this.wrapped.isPointInPath(t, e, s, i);
|
|
163
|
-
}
|
|
164
|
-
isPointInStroke(t, e, s) {
|
|
165
|
-
return this.wrapped.isPointInStroke(t, e, s);
|
|
166
|
-
}
|
|
167
|
-
stroke(t) {
|
|
168
|
-
if (t == null) return this.wrapped.stroke();
|
|
169
|
-
this.wrapped.stroke(t);
|
|
170
|
-
}
|
|
171
|
-
createConicGradient(t, e, s) {
|
|
172
|
-
return this.wrapped.createConicGradient(t, e, s);
|
|
173
|
-
}
|
|
174
|
-
createLinearGradient(t, e, s, i) {
|
|
175
|
-
return this.wrapped.createLinearGradient(t, e, s, i);
|
|
176
|
-
}
|
|
177
|
-
createPattern(t, e) {
|
|
178
|
-
return this.wrapped.createPattern(t, e);
|
|
179
|
-
}
|
|
180
|
-
createRadialGradient(t, e, s, i, r, a) {
|
|
181
|
-
return this.wrapped.createRadialGradient(t, e, s, i, r, a);
|
|
182
|
-
}
|
|
183
|
-
get filter() {
|
|
184
|
-
return this.wrapped.filter;
|
|
185
|
-
}
|
|
186
|
-
set filter(t) {
|
|
187
|
-
this.wrapped.filter = t;
|
|
188
|
-
}
|
|
189
|
-
createImageData(t, e, s) {
|
|
190
|
-
return this.wrapped.createImageData(t, e, s);
|
|
191
|
-
}
|
|
192
|
-
getImageData(t, e, s, i, r) {
|
|
193
|
-
return this.wrapped.getImageData(t, e, s, i, r);
|
|
194
|
-
}
|
|
195
|
-
putImageData(t, e, s, i, r, a, n) {
|
|
196
|
-
this.wrapped.putImageData(
|
|
197
|
-
// @ts-expect-error - typescript overloads cause issues here
|
|
198
|
-
t,
|
|
199
|
-
e,
|
|
200
|
-
s,
|
|
201
|
-
i,
|
|
202
|
-
r,
|
|
203
|
-
a,
|
|
204
|
-
n
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
get imageSmoothingEnabled() {
|
|
208
|
-
return this.wrapped.imageSmoothingEnabled;
|
|
209
|
-
}
|
|
210
|
-
set imageSmoothingEnabled(t) {
|
|
211
|
-
this.wrapped.imageSmoothingEnabled = t;
|
|
212
|
-
}
|
|
213
|
-
get imageSmoothingQuality() {
|
|
214
|
-
return this.wrapped.imageSmoothingQuality;
|
|
215
|
-
}
|
|
216
|
-
set imageSmoothingQuality(t) {
|
|
217
|
-
this.wrapped.imageSmoothingQuality = t;
|
|
218
|
-
}
|
|
219
|
-
arc(t, e, s, i, r, a) {
|
|
220
|
-
this.wrapped.arc(
|
|
221
|
-
this.scale_.x.pos(t),
|
|
222
|
-
this.scale_.y.pos(e),
|
|
223
|
-
this.scale_.x.dim(s),
|
|
224
|
-
i,
|
|
225
|
-
r,
|
|
226
|
-
a
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
arcTo(t, e, s, i, r) {
|
|
230
|
-
this.wrapped.arcTo(
|
|
231
|
-
this.scale_.x.pos(t),
|
|
232
|
-
this.scale_.y.pos(e),
|
|
233
|
-
this.scale_.x.pos(s),
|
|
234
|
-
this.scale_.y.pos(i),
|
|
235
|
-
this.scale_.x.dim(r)
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
bezierCurveTo(t, e, s, i, r, a) {
|
|
239
|
-
this.wrapped.bezierCurveTo(
|
|
240
|
-
this.scale_.x.pos(t),
|
|
241
|
-
this.scale_.y.pos(e),
|
|
242
|
-
this.scale_.x.pos(s),
|
|
243
|
-
this.scale_.y.pos(i),
|
|
244
|
-
this.scale_.x.pos(r),
|
|
245
|
-
this.scale_.y.pos(a)
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
closePath() {
|
|
249
|
-
this.wrapped.closePath();
|
|
250
|
-
}
|
|
251
|
-
ellipse(t, e, s, i, r, a, n, o) {
|
|
252
|
-
this.wrapped.ellipse(
|
|
253
|
-
this.scale_.x.pos(t),
|
|
254
|
-
this.scale_.y.pos(e),
|
|
255
|
-
this.scale_.x.dim(s),
|
|
256
|
-
this.scale_.y.dim(i),
|
|
257
|
-
r,
|
|
258
|
-
a,
|
|
259
|
-
n,
|
|
260
|
-
o
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
lineTo(t, e) {
|
|
264
|
-
this.wrapped.lineTo(this.scale_.x.pos(t), this.scale_.y.pos(e));
|
|
265
|
-
}
|
|
266
|
-
moveTo(t, e) {
|
|
267
|
-
this.wrapped.moveTo(this.scale_.x.pos(t), this.scale_.y.pos(e));
|
|
268
|
-
}
|
|
269
|
-
quadraticCurveTo(t, e, s, i) {
|
|
270
|
-
this.wrapped.quadraticCurveTo(
|
|
271
|
-
this.scale_.x.pos(t),
|
|
272
|
-
this.scale_.y.pos(e),
|
|
273
|
-
this.scale_.x.pos(s),
|
|
274
|
-
this.scale_.y.pos(i)
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
rect(t, e, s, i) {
|
|
278
|
-
this.wrapped.rect(
|
|
279
|
-
this.scale_.x.pos(t),
|
|
280
|
-
this.scale_.y.pos(e),
|
|
281
|
-
this.scale_.x.dim(s),
|
|
282
|
-
this.scale_.y.dim(i)
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
roundRect(t, e, s, i, r) {
|
|
286
|
-
this.wrapped.roundRect(
|
|
287
|
-
this.scale_.x.pos(t),
|
|
288
|
-
this.scale_.y.pos(e),
|
|
289
|
-
this.scale_.x.dim(s),
|
|
290
|
-
this.scale_.y.dim(i),
|
|
291
|
-
typeof r == "number" ? this.scale_.x.dim(r) : r
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
get lineCap() {
|
|
295
|
-
return this.cachedLineCap ?? this.wrapped.lineCap;
|
|
296
|
-
}
|
|
297
|
-
set lineCap(t) {
|
|
298
|
-
t !== this.cachedLineCap && (this.cachedLineCap = t, this.wrapped.lineCap = t);
|
|
299
|
-
}
|
|
300
|
-
get lineDashOffset() {
|
|
301
|
-
return this.wrapped.lineDashOffset;
|
|
302
|
-
}
|
|
303
|
-
set lineDashOffset(t) {
|
|
304
|
-
this.wrapped.lineDashOffset = this.scale_.x.dim(t);
|
|
305
|
-
}
|
|
306
|
-
get lineJoin() {
|
|
307
|
-
return this.cachedLineJoin ?? this.wrapped.lineJoin;
|
|
308
|
-
}
|
|
309
|
-
set lineJoin(t) {
|
|
310
|
-
t !== this.cachedLineJoin && (this.cachedLineJoin = t, this.wrapped.lineJoin = t);
|
|
311
|
-
}
|
|
312
|
-
get lineWidth() {
|
|
313
|
-
return this.cachedLineWidth ?? this.wrapped.lineWidth;
|
|
314
|
-
}
|
|
315
|
-
set lineWidth(t) {
|
|
316
|
-
const e = this.scale_.x.dim(t);
|
|
317
|
-
e !== this.cachedLineWidth && (this.cachedLineWidth = e, this.wrapped.lineWidth = e);
|
|
318
|
-
}
|
|
319
|
-
getLineDash() {
|
|
320
|
-
return this.wrapped.getLineDash();
|
|
321
|
-
}
|
|
322
|
-
setLineDash(t) {
|
|
323
|
-
const e = Array.from(t).map((s) => this.scale_.x.dim(s));
|
|
324
|
-
this.wrapped.setLineDash(e);
|
|
325
|
-
}
|
|
326
|
-
clearRect(t, e, s, i) {
|
|
327
|
-
this.wrapped.clearRect(t, e, s, i);
|
|
328
|
-
}
|
|
329
|
-
fillRect(t, e, s, i) {
|
|
330
|
-
this.wrapped.fillRect(
|
|
331
|
-
this.scale_.x.pos(t),
|
|
332
|
-
this.scale_.y.pos(e),
|
|
333
|
-
this.scale_.x.dim(s),
|
|
334
|
-
this.scale_.y.dim(i)
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
strokeRect(t, e, s, i) {
|
|
338
|
-
this.wrapped.strokeRect(
|
|
339
|
-
this.scale_.x.pos(t),
|
|
340
|
-
this.scale_.y.pos(e),
|
|
341
|
-
this.scale_.x.dim(s),
|
|
342
|
-
this.scale_.y.dim(i)
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
get shadowBlur() {
|
|
346
|
-
return this.wrapped.shadowBlur;
|
|
347
|
-
}
|
|
348
|
-
set shadowBlur(t) {
|
|
349
|
-
this.wrapped.shadowBlur = t;
|
|
350
|
-
}
|
|
351
|
-
get shadowColor() {
|
|
352
|
-
return this.wrapped.shadowColor;
|
|
353
|
-
}
|
|
354
|
-
set shadowColor(t) {
|
|
355
|
-
this.wrapped.shadowColor = t;
|
|
356
|
-
}
|
|
357
|
-
get shadowOffsetX() {
|
|
358
|
-
return this.wrapped.shadowOffsetX;
|
|
359
|
-
}
|
|
360
|
-
set shadowOffsetX(t) {
|
|
361
|
-
this.wrapped.shadowOffsetX = t;
|
|
362
|
-
}
|
|
363
|
-
get shadowOffsetY() {
|
|
364
|
-
return this.wrapped.shadowOffsetY;
|
|
365
|
-
}
|
|
366
|
-
restore() {
|
|
367
|
-
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();
|
|
368
|
-
}
|
|
369
|
-
save() {
|
|
370
|
-
this.wrapped.save();
|
|
371
|
-
}
|
|
372
|
-
fillText(t, e, s, i, r = {}) {
|
|
373
|
-
const [a, n] = this.checkAtlasFillStyle(r.useAtlas);
|
|
374
|
-
if (a) {
|
|
375
|
-
this.atlasRegistry.get({ font: this.font, textColor: n }).fillText(this, t, e, s);
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
this.wrapped.fillText(
|
|
379
|
-
t,
|
|
380
|
-
this.scale_.x.pos(e),
|
|
381
|
-
this.scale_.y.pos(s),
|
|
382
|
-
i != null ? this.scale_.x.dim(i) : void 0
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
measureText(t) {
|
|
386
|
-
return this.wrapped.measureText(t);
|
|
387
|
-
}
|
|
388
|
-
textDimensions(t, e = {}) {
|
|
389
|
-
const [s, i] = this.checkAtlasFillStyle(e.useAtlas);
|
|
390
|
-
return s ? this.atlasRegistry.get({ font: this.font, textColor: i }).measureText(t) : G(this.measureText(t));
|
|
391
|
-
}
|
|
392
|
-
strokeText(t, e, s, i) {
|
|
393
|
-
this.wrapped.strokeText(
|
|
394
|
-
t,
|
|
395
|
-
this.scale_.x.pos(e),
|
|
396
|
-
this.scale_.y.pos(s),
|
|
397
|
-
i != null ? this.scale_.x.dim(i) : void 0
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
get direction() {
|
|
401
|
-
return this.wrapped.direction;
|
|
402
|
-
}
|
|
403
|
-
set direction(t) {
|
|
404
|
-
this.wrapped.direction = t;
|
|
405
|
-
}
|
|
406
|
-
get font() {
|
|
407
|
-
return this.cachedFont != null ? this.cachedFont : this.wrapped.font;
|
|
408
|
-
}
|
|
409
|
-
set font(t) {
|
|
410
|
-
t !== this.cachedFont && (this.cachedFont = t, this.wrapped.font = this.cachedFont);
|
|
411
|
-
}
|
|
412
|
-
get fontKerning() {
|
|
413
|
-
return this.wrapped.fontKerning;
|
|
414
|
-
}
|
|
415
|
-
set fontKerning(t) {
|
|
416
|
-
this.wrapped.fontKerning = t;
|
|
417
|
-
}
|
|
418
|
-
get textAlign() {
|
|
419
|
-
return this.cachedTextAlign ?? this.wrapped.textAlign;
|
|
420
|
-
}
|
|
421
|
-
set textAlign(t) {
|
|
422
|
-
t !== this.cachedTextAlign && (this.cachedTextAlign = t, this.wrapped.textAlign = t);
|
|
423
|
-
}
|
|
424
|
-
get textBaseline() {
|
|
425
|
-
return this.cachedTextBaseline ?? this.wrapped.textBaseline;
|
|
426
|
-
}
|
|
427
|
-
set textBaseline(t) {
|
|
428
|
-
t !== this.cachedTextBaseline && (this.cachedTextBaseline = t, this.wrapped.textBaseline = t);
|
|
429
|
-
}
|
|
430
|
-
getTransform() {
|
|
431
|
-
return this.wrapped.getTransform();
|
|
432
|
-
}
|
|
433
|
-
resetTransform() {
|
|
434
|
-
this.wrapped.resetTransform();
|
|
435
|
-
}
|
|
436
|
-
rotate(t) {
|
|
437
|
-
this.wrapped.rotate(t);
|
|
438
|
-
}
|
|
439
|
-
scale(t, e) {
|
|
440
|
-
this.wrapped.scale(t, e), this.dpr = t;
|
|
441
|
-
}
|
|
442
|
-
scissor(t, e = d.ZERO) {
|
|
443
|
-
const s = new $(this.scale_);
|
|
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();
|
|
445
|
-
}
|
|
446
|
-
setTransform(t, e, s, i, r, a) {
|
|
447
|
-
this.wrapped.setTransform(t, e, s, i, r, a);
|
|
448
|
-
}
|
|
449
|
-
transform(t, e, s, i, r, a) {
|
|
450
|
-
this.wrapped.transform(t, e, s, i, r, a);
|
|
451
|
-
}
|
|
452
|
-
translate(t, e) {
|
|
453
|
-
this.wrapped.translate(t, e);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
class $ {
|
|
457
|
-
scale_;
|
|
458
|
-
path;
|
|
459
|
-
constructor(t = y.XY.IDENTITY, e) {
|
|
460
|
-
this.scale_ = t, e instanceof Path2D || typeof e == "string" ? this.path = new Path2D(e) : this.path = new Path2D();
|
|
461
|
-
}
|
|
462
|
-
addPath(t, e) {
|
|
463
|
-
this.path.addPath(t, e);
|
|
464
|
-
}
|
|
465
|
-
arc(t, e, s, i, r, a) {
|
|
466
|
-
this.path.arc(
|
|
467
|
-
this.scale_.x.pos(t),
|
|
468
|
-
this.scale_.y.pos(e),
|
|
469
|
-
this.scale_.x.dim(s),
|
|
470
|
-
i,
|
|
471
|
-
r,
|
|
472
|
-
a
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
arcTo(t, e, s, i, r) {
|
|
476
|
-
this.path.arcTo(
|
|
477
|
-
this.scale_.x.pos(t),
|
|
478
|
-
this.scale_.y.pos(e),
|
|
479
|
-
this.scale_.x.pos(s),
|
|
480
|
-
this.scale_.y.pos(i),
|
|
481
|
-
this.scale_.x.dim(r)
|
|
482
|
-
);
|
|
483
|
-
}
|
|
484
|
-
bezierCurveTo(t, e, s, i, r, a) {
|
|
485
|
-
this.path.bezierCurveTo(
|
|
486
|
-
this.scale_.x.pos(t),
|
|
487
|
-
this.scale_.y.pos(e),
|
|
488
|
-
this.scale_.x.pos(s),
|
|
489
|
-
this.scale_.y.pos(i),
|
|
490
|
-
this.scale_.x.pos(r),
|
|
491
|
-
this.scale_.y.pos(a)
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
closePath() {
|
|
495
|
-
this.path.closePath();
|
|
496
|
-
}
|
|
497
|
-
ellipse(t, e, s, i, r, a, n, o) {
|
|
498
|
-
this.path.ellipse(
|
|
499
|
-
this.scale_.x.pos(t),
|
|
500
|
-
this.scale_.y.pos(e),
|
|
501
|
-
this.scale_.x.dim(s),
|
|
502
|
-
this.scale_.y.dim(i),
|
|
503
|
-
r,
|
|
504
|
-
a,
|
|
505
|
-
n,
|
|
506
|
-
o
|
|
507
|
-
);
|
|
508
|
-
}
|
|
509
|
-
lineTo(t, e) {
|
|
510
|
-
this.path.lineTo(this.scale_.x.pos(t), this.scale_.y.pos(e));
|
|
511
|
-
}
|
|
512
|
-
moveTo(t, e) {
|
|
513
|
-
this.path.moveTo(this.scale_.x.pos(t), this.scale_.y.pos(e));
|
|
514
|
-
}
|
|
515
|
-
quadraticCurveTo(t, e, s, i) {
|
|
516
|
-
this.path.quadraticCurveTo(
|
|
517
|
-
this.scale_.x.pos(t),
|
|
518
|
-
this.scale_.y.pos(e),
|
|
519
|
-
this.scale_.x.pos(s),
|
|
520
|
-
this.scale_.y.pos(i)
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
rect(t, e, s, i) {
|
|
524
|
-
this.path.rect(
|
|
525
|
-
this.scale_.x.pos(t),
|
|
526
|
-
this.scale_.y.pos(e),
|
|
527
|
-
this.scale_.x.dim(s),
|
|
528
|
-
this.scale_.y.dim(i)
|
|
529
|
-
);
|
|
530
|
-
}
|
|
531
|
-
roundRect(t, e, s, i, r) {
|
|
532
|
-
const a = this.scaleRadii(r);
|
|
533
|
-
this.path.roundRect(
|
|
534
|
-
this.scale_.x.pos(t),
|
|
535
|
-
this.scale_.y.pos(e),
|
|
536
|
-
this.scale_.x.dim(s),
|
|
537
|
-
this.scale_.y.dim(i),
|
|
538
|
-
a
|
|
539
|
-
);
|
|
540
|
-
}
|
|
541
|
-
scaleRadii(t) {
|
|
542
|
-
return t == null ? t : typeof t == "number" ? this.scale_.x.dim(t) : Array.isArray(t) ? t.map((e) => this.scaleRadius(e)) : this.scaleRadius(t);
|
|
543
|
-
}
|
|
544
|
-
scaleRadius(t) {
|
|
545
|
-
return typeof t == "number" ? this.scale_.x.dim(t) : {
|
|
546
|
-
x: this.scale_.x.dim(t.x ?? 0),
|
|
547
|
-
y: this.scale_.y.dim(t.y ?? 0)
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
getPath() {
|
|
551
|
-
return this.path;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
const Q = `precision mediump float;
|
|
555
|
-
|
|
556
|
-
void main(void) {
|
|
557
|
-
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
558
|
-
}
|
|
559
|
-
`, j = `attribute vec4 a_position;
|
|
560
|
-
|
|
561
|
-
void main(void) {
|
|
562
|
-
gl_Position = a_position;
|
|
563
|
-
}
|
|
564
|
-
`, D = (l) => new Error(`failed to compile webgl program: ${l}`), tt = new Error("null shader encountered");
|
|
565
|
-
let et = class {
|
|
566
|
-
/** The render context used by this program. */
|
|
567
|
-
renderCtx;
|
|
568
|
-
/** The underlying webgl program. */
|
|
569
|
-
prog;
|
|
570
|
-
/** The code for the vertex shader. */
|
|
571
|
-
vertShader;
|
|
572
|
-
/** The code for the fragment shader. */
|
|
573
|
-
fragShader;
|
|
574
|
-
uniformLocCache = /* @__PURE__ */ new Map();
|
|
575
|
-
/**
|
|
576
|
-
* @constructor compiles the given vertex and fragment shaders under the given
|
|
577
|
-
* render context into a program.
|
|
578
|
-
*
|
|
579
|
-
* @param ctx - The render context to use.
|
|
580
|
-
* @param vertShader - The vertex shader code.
|
|
581
|
-
* @param fragShader - The fragment shader code.
|
|
582
|
-
*/
|
|
583
|
-
constructor(t, e, s) {
|
|
584
|
-
this.renderCtx = t;
|
|
585
|
-
const i = t.gl.createProgram();
|
|
586
|
-
if (i == null) throw D("failed to create program");
|
|
587
|
-
this.prog = i, this.vertShader = e, this.fragShader = s, this.compile();
|
|
588
|
-
}
|
|
589
|
-
/** Sets the current program as the active program used by the context. */
|
|
590
|
-
setAsActive() {
|
|
591
|
-
return this.renderCtx.gl.useProgram(this.prog), () => this.renderCtx.gl.useProgram(null);
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Sets a uniform XY coordinate value.
|
|
595
|
-
*
|
|
596
|
-
* @param name - The name of the uniform.
|
|
597
|
-
* @param value - The value to set.
|
|
598
|
-
*/
|
|
599
|
-
uniformXY(t, e) {
|
|
600
|
-
this.renderCtx.gl.uniform2fv(this.getUniformLoc(t), d.couple(e));
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Sets a uniform color value.
|
|
604
|
-
*
|
|
605
|
-
* @param name - The name of the uniform.
|
|
606
|
-
* @param value - The value to set.
|
|
607
|
-
*/
|
|
608
|
-
uniformColor(t, e) {
|
|
609
|
-
this.renderCtx.gl.uniform4fv(this.getUniformLoc(t), C.rgba1(e));
|
|
610
|
-
}
|
|
611
|
-
getUniformLoc(t) {
|
|
612
|
-
const e = this.uniformLocCache.get(t);
|
|
613
|
-
if (e != null) return e;
|
|
614
|
-
const s = this.renderCtx.gl.getUniformLocation(this.prog, t);
|
|
615
|
-
if (s == null) throw new Error(`unexpected missing uniform ${t}`);
|
|
616
|
-
return this.uniformLocCache.set(t, s), s;
|
|
617
|
-
}
|
|
618
|
-
compile() {
|
|
619
|
-
const t = this.renderCtx.gl;
|
|
620
|
-
this.compileShader(this.vertShader, t.VERTEX_SHADER), this.compileShader(this.fragShader, t.FRAGMENT_SHADER), t.linkProgram(this.prog);
|
|
621
|
-
}
|
|
622
|
-
compileShader(t, e) {
|
|
623
|
-
const s = this.renderCtx.gl, i = s.createShader(e);
|
|
624
|
-
if (i == null) throw tt;
|
|
625
|
-
if (s.shaderSource(i, t), s.compileShader(i), !s.getShaderParameter(i, s.COMPILE_STATUS)) {
|
|
626
|
-
const a = s.getShaderInfoLog(i);
|
|
627
|
-
throw s.deleteShader(i), D(a ?? "unknown");
|
|
628
|
-
}
|
|
629
|
-
s.attachShader(this.prog, i);
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
const st = new Float32Array([0, 0, 0, 0, 0, 0]);
|
|
633
|
-
class it extends et {
|
|
634
|
-
positionBuffer;
|
|
635
|
-
constructor(t) {
|
|
636
|
-
super(t, j, Q);
|
|
637
|
-
const e = t.gl.createBuffer();
|
|
638
|
-
if (e == null) throw new V("webgl: failed to create buffer");
|
|
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);
|
|
640
|
-
}
|
|
641
|
-
exec() {
|
|
642
|
-
const { gl: t } = this.renderCtx, e = t.getAttribLocation(this.prog, "a_position");
|
|
643
|
-
t.bindBuffer(t.ARRAY_BUFFER, this.positionBuffer);
|
|
644
|
-
const s = t.createVertexArray();
|
|
645
|
-
t.bindVertexArray(s), t.enableVertexAttribArray(e), t.vertexAttribPointer(e, 2, t.FLOAT, !1, 0, 0), this.setAsActive(), t.drawArrays(t.TRIANGLES, 0, 3);
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
const P = { high: 1, low: 0 };
|
|
649
|
-
class rt {
|
|
650
|
-
/** Stores the current requests for rendering. */
|
|
651
|
-
requests = /* @__PURE__ */ new Map();
|
|
652
|
-
/** Stores render cleanup functions for clearing canvases and other resources. */
|
|
653
|
-
cleanup = /* @__PURE__ */ new Map();
|
|
654
|
-
/** A callback to run after each render call. */
|
|
655
|
-
afterRender;
|
|
656
|
-
/** Instrumentation for logging, tracing, metrics, etc. */
|
|
657
|
-
instrumentation;
|
|
658
|
-
/** A function to add status to the status bar. */
|
|
659
|
-
handleError;
|
|
660
|
-
constructor({
|
|
661
|
-
afterRender: t,
|
|
662
|
-
instrumentation: e = _.Instrumentation.NOOP,
|
|
663
|
-
handleError: s
|
|
664
|
-
}) {
|
|
665
|
-
this.afterRender = t, this.instrumentation = e, this.handleError = s, this.start();
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
* Sets a new request in the queue according to a set of rules:
|
|
669
|
-
*
|
|
670
|
-
* 1. If no request with the same key exists, add the request to the queue.
|
|
671
|
-
* 2. If a request with the same key exists, replace it if the new request has a
|
|
672
|
-
* greater or equal priority and a greater or equal number of canvases that are
|
|
673
|
-
* being rendered to.
|
|
674
|
-
*
|
|
675
|
-
* @param req - The request to set.
|
|
676
|
-
*/
|
|
677
|
-
set(t) {
|
|
678
|
-
const e = this.requests.get(t.key);
|
|
679
|
-
if (e == null) this.requests.set(t.key, t);
|
|
680
|
-
else {
|
|
681
|
-
const s = P[t.priority] >= P[e.priority], i = t.canvases.length >= e.canvases.length;
|
|
682
|
-
s && i && this.requests.set(t.key, t);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
/** Execute the render. */
|
|
686
|
-
render() {
|
|
687
|
-
const { requests: t } = this;
|
|
688
|
-
t.size !== 0 && (this.runCleanupsSync(), this.renderSync(), this.requests.clear(), this.afterRender?.());
|
|
689
|
-
}
|
|
690
|
-
runCleanupsSync() {
|
|
691
|
-
const { cleanup: t, requests: e } = this;
|
|
692
|
-
t.forEach((s, i) => {
|
|
693
|
-
const r = e.get(i);
|
|
694
|
-
r != null && (s(r), t.delete(i));
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
renderSync() {
|
|
698
|
-
const { requests: t } = this;
|
|
699
|
-
t.forEach((e) => {
|
|
700
|
-
try {
|
|
701
|
-
const s = e.render();
|
|
702
|
-
s != null && this.cleanup.set(e.key, s);
|
|
703
|
-
} catch (s) {
|
|
704
|
-
this.handleError(s, "render loop failed");
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
/** Starts the rendering loop. */
|
|
709
|
-
start() {
|
|
710
|
-
const t = () => {
|
|
711
|
-
try {
|
|
712
|
-
this.render();
|
|
713
|
-
} catch (e) {
|
|
714
|
-
this.handleError(e, "render loop failed");
|
|
715
|
-
}
|
|
716
|
-
requestAnimationFrame(t);
|
|
717
|
-
};
|
|
718
|
-
requestAnimationFrame(t);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
const S = 2, g = 2;
|
|
722
|
-
class b {
|
|
723
|
-
// A canvas buffer that holds rendered characters.
|
|
724
|
-
atlas;
|
|
725
|
-
// Cached dimensions of a character.
|
|
726
|
-
charDims;
|
|
727
|
-
// A map of characters to their index in the atlas.
|
|
728
|
-
charMap;
|
|
729
|
-
// The default characters to include in the atlas.
|
|
730
|
-
static DEFAULT_CHARS = "0123456789.:-°µmsNa∞ᴇABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%";
|
|
731
|
-
constructor(t) {
|
|
732
|
-
const { font: e, characters: s = b.DEFAULT_CHARS, textColor: i } = t;
|
|
733
|
-
this.charMap = /* @__PURE__ */ new Map();
|
|
734
|
-
const r = X.unique(Array.from(s)), n = new OffscreenCanvas(1, 1).getContext("2d");
|
|
735
|
-
n.font = e;
|
|
736
|
-
const o = n.measureText("0");
|
|
737
|
-
this.charDims = G(o), this.charDims.width += S, this.charDims.height += S;
|
|
738
|
-
const p = r.length, u = this.charDims.width, m = this.charDims.height, c = Math.ceil(Math.sqrt(p)), E = Math.ceil(p / c);
|
|
739
|
-
this.atlas = new OffscreenCanvas(
|
|
740
|
-
u * c * g,
|
|
741
|
-
m * (E + 1) * g
|
|
742
|
-
);
|
|
743
|
-
const f = this.atlas.getContext("2d");
|
|
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);
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
fillText(t, e, s, i) {
|
|
750
|
-
const { width: r, height: a } = this.charDims, n = Math.ceil(Math.sqrt(this.charMap.size));
|
|
751
|
-
t.textAlign === "center" && (s -= r * e.length / 2), t.textBaseline === "middle" && (i += a / 2);
|
|
752
|
-
for (let o = 0; o < e.length; o++) {
|
|
753
|
-
const p = e[o], u = this.charMap.get(p);
|
|
754
|
-
if (u === void 0) continue;
|
|
755
|
-
const m = u % n, c = Math.floor(u / n);
|
|
756
|
-
t.drawImage(
|
|
757
|
-
this.atlas,
|
|
758
|
-
m * r * g,
|
|
759
|
-
c * a * g + S,
|
|
760
|
-
r * g,
|
|
761
|
-
a * g,
|
|
762
|
-
s + o * r,
|
|
763
|
-
i - a - S / g,
|
|
764
|
-
r,
|
|
765
|
-
a
|
|
766
|
-
);
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
measureText(t) {
|
|
770
|
-
return { width: t.length * this.charDims.width, height: this.charDims.height };
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
class at {
|
|
774
|
-
atlases;
|
|
775
|
-
constructor() {
|
|
776
|
-
this.atlases = /* @__PURE__ */ new Map();
|
|
777
|
-
}
|
|
778
|
-
/**
|
|
779
|
-
* @returns at atlas from the registry compatible with the given props. If the
|
|
780
|
-
* atlas does not exist in the registry, it is created and added to the registry.
|
|
781
|
-
*/
|
|
782
|
-
get(t) {
|
|
783
|
-
const e = `${t.font}-${C.hex(t.textColor)}-${t.characters}`;
|
|
784
|
-
if (this.atlases.has(e)) return this.atlases.get(e);
|
|
785
|
-
const s = new b(t);
|
|
786
|
-
return this.atlases.set(e, s), s;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
const F = (l) => (l.textRendering = "optimizeSpeed", l.imageSmoothingEnabled = !1, l);
|
|
790
|
-
class w {
|
|
791
|
-
/* The canvas element used by WebGL. */
|
|
792
|
-
glCanvas;
|
|
793
|
-
/** The canvas element used by the 2D canvas. */
|
|
794
|
-
upper2dCanvas;
|
|
795
|
-
/** The canvas element used by the 2D canvas. */
|
|
796
|
-
lower2dCanvas;
|
|
797
|
-
/** The WebGL rendering context. */
|
|
798
|
-
gl;
|
|
799
|
-
/** A 2D canvas that sits below the WebGL canvas. */
|
|
800
|
-
lower2d;
|
|
801
|
-
/** A 2D canvas that sits above the WebGL canvas. */
|
|
802
|
-
upper2d;
|
|
803
|
-
/** The region the canvas occupies in pixel space */
|
|
804
|
-
region;
|
|
805
|
-
/** The device pixel ratio of the canvas */
|
|
806
|
-
dpr;
|
|
807
|
-
/** queue render transitions onto the stack */
|
|
808
|
-
loop;
|
|
809
|
-
/** See the @link{clear.Program} for why this is necessary. */
|
|
810
|
-
clearProgram;
|
|
811
|
-
os;
|
|
812
|
-
static CONTEXT_KEY = H.B("render-context");
|
|
813
|
-
instrumentation;
|
|
814
|
-
static create(t, e, s, i, r) {
|
|
815
|
-
const a = J(t, "render_context"), n = new w(
|
|
816
|
-
e,
|
|
817
|
-
s,
|
|
818
|
-
i,
|
|
819
|
-
r,
|
|
820
|
-
a,
|
|
821
|
-
z(t),
|
|
822
|
-
K(t)
|
|
823
|
-
);
|
|
824
|
-
return t.set(w.CONTEXT_KEY, n), n;
|
|
825
|
-
}
|
|
826
|
-
constructor(t, e, s, i, r, a, n) {
|
|
827
|
-
this.upper2dCanvas = s, this.lower2dCanvas = e, this.glCanvas = t, this.os = i, this.instrumentation = r, this.dpr = 1;
|
|
828
|
-
const o = this.lower2dCanvas.getContext("2d");
|
|
829
|
-
if (o == null) throw new Error("Could not get 2D context");
|
|
830
|
-
const p = new at();
|
|
831
|
-
this.lower2d = F(
|
|
832
|
-
new R(o, p, this.dpr)
|
|
833
|
-
);
|
|
834
|
-
const u = this.upper2dCanvas.getContext("2d");
|
|
835
|
-
if (u == null) throw new Error("Could not get 2D context");
|
|
836
|
-
this.upper2d = F(
|
|
837
|
-
new R(u, p, this.dpr)
|
|
838
|
-
);
|
|
839
|
-
const m = {
|
|
840
|
-
preserveDrawingBuffer: !0,
|
|
841
|
-
powerPreference: "high-performance",
|
|
842
|
-
stencil: !1,
|
|
843
|
-
depth: !1
|
|
844
|
-
}, c = this.glCanvas.getContext("webgl2", m);
|
|
845
|
-
if (c == null) throw new Error("Could not get WebGL context");
|
|
846
|
-
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 = () => a({
|
|
847
|
-
variant: "error",
|
|
848
|
-
message: "WebGL context lost"
|
|
849
|
-
});
|
|
850
|
-
const E = () => {
|
|
851
|
-
this.gl.flush(), this.gl.finish();
|
|
852
|
-
};
|
|
853
|
-
this.loop = new rt({
|
|
854
|
-
afterRender: E,
|
|
855
|
-
instrumentation: this.instrumentation,
|
|
856
|
-
handleError: n
|
|
857
|
-
}), this.region = h.ZERO, this.os === "Windows" && (this.clearProgram = new it(this));
|
|
858
|
-
}
|
|
859
|
-
static useOptional(t) {
|
|
860
|
-
return t.getOptional(w.CONTEXT_KEY);
|
|
861
|
-
}
|
|
862
|
-
static use(t) {
|
|
863
|
-
return t.get(w.CONTEXT_KEY);
|
|
864
|
-
}
|
|
865
|
-
update(t) {
|
|
866
|
-
t.set(w.CONTEXT_KEY, this);
|
|
867
|
-
}
|
|
868
|
-
/**
|
|
869
|
-
* Resizes the canvas to the given region and device pixel ratio. Ensuring
|
|
870
|
-
* that all drawing operations and viewports are scaled correctly.
|
|
871
|
-
*/
|
|
872
|
-
resize(t, e) {
|
|
873
|
-
h.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, h.width(t) * e, h.height(t) * e));
|
|
874
|
-
}
|
|
875
|
-
resizeCanvas(t) {
|
|
876
|
-
t.width = h.width(this.region) * this.dpr, t.height = h.height(this.region) * this.dpr;
|
|
877
|
-
}
|
|
878
|
-
/** @returns the aspect ratio of the canvas. */
|
|
879
|
-
get aspect() {
|
|
880
|
-
return h.aspect(this.region);
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Takes the given box in PIXEL space and produces a transform
|
|
884
|
-
* in CLIP space representing the sub-region represented by the box
|
|
885
|
-
* in the canvas.
|
|
886
|
-
*/
|
|
887
|
-
scaleRegion(t) {
|
|
888
|
-
return new y.XY(
|
|
889
|
-
// Accept a value in decimal.
|
|
890
|
-
y.Scale.scale(0, 1).scale(h.width(t)).translate(h.left(t)).reBound(h.width(this.region)).scale(-1, 1),
|
|
891
|
-
// Accept a value in decimal.
|
|
892
|
-
y.Scale.scale(0, 1).scale(h.height(t)).invert().translate(h.top(t)).reBound(h.height(this.region)).scale(-1, 1).invert()
|
|
893
|
-
);
|
|
894
|
-
}
|
|
895
|
-
scissor(t, e = d.ZERO, s) {
|
|
896
|
-
const i = [];
|
|
897
|
-
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());
|
|
898
|
-
}
|
|
899
|
-
scissorGL(t, e = d.ZERO) {
|
|
900
|
-
return this.gl.enable(this.gl.SCISSOR_TEST), t = T(t, e), this.gl.scissor(
|
|
901
|
-
h.left(t) * this.dpr,
|
|
902
|
-
(h.height(this.region) - h.bottom(t)) * this.dpr,
|
|
903
|
-
h.width(t) * this.dpr,
|
|
904
|
-
h.height(t) * this.dpr
|
|
905
|
-
), () => this.gl.disable(this.gl.SCISSOR_TEST);
|
|
906
|
-
}
|
|
907
|
-
erase(t, e = d.ZERO, ...s) {
|
|
908
|
-
e = d.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);
|
|
909
|
-
}
|
|
910
|
-
eraseGL(t, e = d.ZERO) {
|
|
911
|
-
const { gl: s } = this, i = this.scissorGL(T(t, e));
|
|
912
|
-
s.clearColor(...C.rgba1(C.ZERO)), s.clear(s.COLOR_BUFFER_BIT), this.os === "Windows" && this.clearProgram?.exec(), i();
|
|
913
|
-
}
|
|
914
|
-
eraseCanvas(t, e, s = d.ZERO) {
|
|
915
|
-
const i = T(e, s);
|
|
916
|
-
t.clearRect(...d.couple(h.topLeft(i)), ...k.couple(h.dims(i)));
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
const ht = x.object({
|
|
920
|
-
region: h.box,
|
|
921
|
-
enabled: x.boolean().default(!1)
|
|
922
|
-
}), I = ["gl", "lower2d", "upper2d"];
|
|
923
|
-
class B extends W {
|
|
924
|
-
static TYPE = "eraser";
|
|
925
|
-
schema = ht;
|
|
926
|
-
afterUpdate(t) {
|
|
927
|
-
this.deleted || (this.internal.renderCtx = w.use(t), this.renderOnLifecycleChange());
|
|
928
|
-
}
|
|
929
|
-
afterDelete() {
|
|
930
|
-
this.renderOnLifecycleChange();
|
|
931
|
-
}
|
|
932
|
-
renderOnLifecycleChange() {
|
|
933
|
-
this.internal.renderCtx.loop.set({
|
|
934
|
-
key: `${this.type}-${this.key}`,
|
|
935
|
-
render: this.render.bind(this),
|
|
936
|
-
priority: "high",
|
|
937
|
-
canvases: I
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
render() {
|
|
941
|
-
this.deleted || !this.state.enabled || this.internal.renderCtx.erase(this.state.region, d.construct(0), ...I);
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
const wt = {
|
|
945
|
-
[B.TYPE]: B
|
|
946
|
-
};
|
|
947
|
-
export {
|
|
948
|
-
w as C,
|
|
949
|
-
B as E,
|
|
950
|
-
et as G,
|
|
951
|
-
rt as L,
|
|
952
|
-
v as P,
|
|
953
|
-
wt as R,
|
|
954
|
-
gt as a,
|
|
955
|
-
ht as e,
|
|
956
|
-
Z as p,
|
|
957
|
-
J as u
|
|
958
|
-
};
|