@graphysdk/theme-chalkboard 0.0.0-stage → 0.1.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/LICENSE.md +17 -0
- package/README.md +59 -2
- package/dist/board.d.ts +18 -0
- package/dist/chalkboard.d.ts +16 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1220 -0
- package/dist/renderer/area.d.ts +5 -0
- package/dist/renderer/bar.d.ts +8 -0
- package/dist/renderer/chalk.d.ts +34 -0
- package/dist/renderer/hand.d.ts +62 -0
- package/dist/renderer/line.d.ts +8 -0
- package/dist/renderer/paint.d.ts +21 -0
- package/dist/renderer/plugins.d.ts +7 -0
- package/dist/renderer/point.d.ts +8 -0
- package/dist/renderer/shapes.d.ts +2 -0
- package/dist/renderer/slice.d.ts +7 -0
- package/dist/renderer/tile.d.ts +6 -0
- package/dist/renderer/trace.d.ts +26 -0
- package/dist/renderer/utils/paths.d.ts +7 -0
- package/dist/renderer/utils/projections.d.ts +16 -0
- package/dist/styles.d.ts +33 -0
- package/fonts.css +2 -0
- package/licenses/PolyForm-Free-Trial-1.0.0.md +93 -0
- package/licenses/PolyForm-NonCommercial-1.0.0.md +131 -0
- package/licenses/PolyForm-Small-Business-1.0.0.md +121 -0
- package/package.json +79 -3
- package/src/fonts.css.d.ts +2 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1220 @@
|
|
|
1
|
+
import { useId as bt, useMemo as O } from "react";
|
|
2
|
+
import { DefaultGeomCircle as Ot, GROUP_VARIABLES as kt, createAreaPathGenerators as Dt, createStableCellKeyGenerator as Lt, createStableKeyGenerator as W, defineGeomRenderer as P, getAngleExtent as Wt, getBarRectBounds as Nt, getPaintedTileRect as Gt, getRadiusExtent as St, getStackRole as Bt, getX as b, getXMax as Ft, getXMin as Kt, getY as Y, getYMax as Et, getYMin as Ut, polarToUnit as Rt, prepareAreaObservations as zt, readMainAxis as at, style as v, toPaintColor as jt, toStrokeDasharray as Vt, toViewBoxX as Yt, toViewBoxY as Xt, useGeomStyleReader as X } from "@graphysdk/react";
|
|
3
|
+
import { jsx as c, jsxs as _ } from "react/jsx-runtime";
|
|
4
|
+
var Zt = /[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu, qt = /^[a-zA-Z]$/u, Jt = (t, r) => t === "H" ? "x" : t === "V" ? "y" : r % 2 === 0 ? "x" : "y", ot = (t, r) => {
|
|
5
|
+
let e = "", a = 0;
|
|
6
|
+
return (t.match(Zt) ?? []).map((o) => {
|
|
7
|
+
if (qt.test(o))
|
|
8
|
+
return e = o.toUpperCase(), a = 0, o;
|
|
9
|
+
const l = Jt(e, a);
|
|
10
|
+
return a += 1, String(Number(o) * (l === "x" ? r.width : r.height));
|
|
11
|
+
}).join(" ");
|
|
12
|
+
}, J = (t, r) => {
|
|
13
|
+
const e = b(t), a = Y(t) ?? Et(t);
|
|
14
|
+
return e === null || a === null ? null : {
|
|
15
|
+
x: Yt(e) * r.width,
|
|
16
|
+
y: Xt(a) * r.height
|
|
17
|
+
};
|
|
18
|
+
}, Z = (t, r) => {
|
|
19
|
+
const e = b(t), a = Y(t) ?? St(t).outerRadius;
|
|
20
|
+
if (e === null || a === null) return null;
|
|
21
|
+
const o = Rt(e, a), l = Math.min(r.width, r.height) / 2;
|
|
22
|
+
return {
|
|
23
|
+
x: r.width / 2 + o.x * l,
|
|
24
|
+
y: r.height / 2 - o.y * l
|
|
25
|
+
};
|
|
26
|
+
}, Qt = (t) => ({
|
|
27
|
+
x: 0,
|
|
28
|
+
y: 0,
|
|
29
|
+
width: t.width,
|
|
30
|
+
height: t.height
|
|
31
|
+
}), te = (t) => `${t.map((r, e) => `${e === 0 ? "M" : "L"}${r.x},${r.y}`).join(" ")} Z`;
|
|
32
|
+
var ee = 34, q = 8, G = 72, nt = 11, B = 6, re = (t, r, e) => `<svg x="${t}" y="${r}" width="1" height="1" overflow="visible">${e}</svg>`, ae = ({ wood: t, woodLight: r, woodDark: e }) => {
|
|
33
|
+
const a = (o, l, s, n = 1) => `<rect x="${o}" y="${o}" rx="3" style="width:calc(100% - ${o * 2}px);height:calc(100% - ${o * 2}px)" fill="none" stroke="${s}" stroke-width="${l}" stroke-opacity="${n}"/>`;
|
|
34
|
+
return a(8 / 2, 8, t) + a(0.5, 1, e) + a(8 - 0.5, 1, r, 0.7) + a(9, 2, "#000000", 0.18);
|
|
35
|
+
}, oe = ({ wood: t, woodLight: r, woodDark: e, dust: a }) => `<svg x="0" y="100%" width="100%" height="1" overflow="visible"><rect x="0" y="-13" width="100%" height="13" fill="${t}"/><rect x="0" y="-13" width="100%" height="1.5" fill="${r}"/><rect x="0" y="-1" width="100%" height="1" fill="${e}"/><rect x="12" y="-13" style="width:calc(100% - 24px)" height="1.5" fill="${a}" fill-opacity="0.45"/></svg>`, ne = ({ wood: t, woodDark: r, felt: e, dust: a, chalks: o }) => {
|
|
36
|
+
let s = -34 - G;
|
|
37
|
+
return `<rect x="${s}" y="${-13 - B}" width="${G}" height="${B}" rx="1" fill="${e}"/><rect x="${s + 1}" y="${-13 - B}" width="${G - 2}" height="1.5" fill="${a}" fill-opacity="0.35"/><rect x="${s}" y="${-13 - B - nt}" width="${G}" height="${nt}" rx="2.5" fill="${t}" stroke="${r}" stroke-width="0.75"/>` + o.map((n, h) => {
|
|
38
|
+
const d = ee - h * 6;
|
|
39
|
+
return s -= d + 14, `<rect x="${s}" y="${-13 - q}" width="${d}" height="${q}" rx="${q / 2}" fill="${n}"/><rect x="${s + 2}" y="-20" width="${d - 4}" height="1.2" fill="#FFFFFF" fill-opacity="0.35"/>`;
|
|
40
|
+
}).join("");
|
|
41
|
+
}, ie = (t) => `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">' + ae(t) + oe(t) + re("100%", "100%", ne(t)) + "</svg>")}`, f = {
|
|
42
|
+
board: "#27362F",
|
|
43
|
+
wiped: "#1F2C26",
|
|
44
|
+
chalk: "#F4F1E8",
|
|
45
|
+
dusty: "#C9D1C8",
|
|
46
|
+
grid: "rgba(244, 241, 232, 0.24)",
|
|
47
|
+
edge: "rgba(244, 241, 232, 0.45)",
|
|
48
|
+
axis: "rgba(244, 241, 232, 0.85)",
|
|
49
|
+
wood: "#86643F",
|
|
50
|
+
woodLight: "#A88456",
|
|
51
|
+
woodDark: "#4F3923",
|
|
52
|
+
felt: "#5E5A55"
|
|
53
|
+
}, he = "'Gochi Hand', 'Comic Sans MS', cursive", S = {
|
|
54
|
+
white: "#F4F1E8",
|
|
55
|
+
yellow: "#F7DC6F",
|
|
56
|
+
pink: "#F49AC2",
|
|
57
|
+
blue: "#8FD3F4",
|
|
58
|
+
green: "#A8E6A1",
|
|
59
|
+
orange: "#F9A65A"
|
|
60
|
+
}, _t = [
|
|
61
|
+
S.white,
|
|
62
|
+
S.yellow,
|
|
63
|
+
S.pink,
|
|
64
|
+
S.blue,
|
|
65
|
+
S.green,
|
|
66
|
+
S.orange
|
|
67
|
+
], le = [
|
|
68
|
+
"#668F99",
|
|
69
|
+
S.blue,
|
|
70
|
+
S.white
|
|
71
|
+
], se = (t, r) => `data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 ${t} ${t}">${r}</svg>`)}`, F = 480, de = {
|
|
72
|
+
image: se(F, `<filter id="smear" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency="0.004 0.021" numOctaves="4" seed="11" stitchTiles="stitch"/><feColorMatrix values="0 0 0 0 0.96 0 0 0 0 0.95 0 0 0 0 0.91 0.3 0 0 0 -0.1"/></filter><rect width="${F}" height="${F}" filter="url(#smear)"/>`),
|
|
73
|
+
size: F,
|
|
74
|
+
fallback: f.board
|
|
75
|
+
}, ce = {
|
|
76
|
+
image: ie({
|
|
77
|
+
wood: f.wood,
|
|
78
|
+
woodLight: f.woodLight,
|
|
79
|
+
woodDark: f.woodDark,
|
|
80
|
+
felt: f.felt,
|
|
81
|
+
dust: f.chalk,
|
|
82
|
+
chalks: [
|
|
83
|
+
S.white,
|
|
84
|
+
S.yellow,
|
|
85
|
+
S.pink
|
|
86
|
+
]
|
|
87
|
+
}),
|
|
88
|
+
fit: "stretch",
|
|
89
|
+
fallback: "transparent"
|
|
90
|
+
}, K = 22, ge = 6, ue = 0.82, it = 2.4, I = {
|
|
91
|
+
fontWeight: 400,
|
|
92
|
+
textColor: f.chalk
|
|
93
|
+
}, T = {
|
|
94
|
+
fontWeight: 400,
|
|
95
|
+
textColor: f.dusty
|
|
96
|
+
}, ht = {
|
|
97
|
+
dashArray: [],
|
|
98
|
+
lineCap: "round",
|
|
99
|
+
lineJoin: "round"
|
|
100
|
+
}, U = {
|
|
101
|
+
...I,
|
|
102
|
+
fontSize: 16,
|
|
103
|
+
textOutlineColor: f.board,
|
|
104
|
+
textOutlineWidth: 4,
|
|
105
|
+
fill: "transparent",
|
|
106
|
+
stroke: "transparent",
|
|
107
|
+
strokeWidth: 0,
|
|
108
|
+
cornerRadius: 0,
|
|
109
|
+
paddingInline: 3,
|
|
110
|
+
paddingBlock: 0,
|
|
111
|
+
shadow: "none"
|
|
112
|
+
}, pe = {
|
|
113
|
+
tokens: {
|
|
114
|
+
graphBackground: f.board,
|
|
115
|
+
graphBorder: f.edge,
|
|
116
|
+
geom: S.white,
|
|
117
|
+
geomBorder: f.axis,
|
|
118
|
+
textPrimary: f.chalk,
|
|
119
|
+
textSecondary: f.dusty,
|
|
120
|
+
ruleLine: f.chalk,
|
|
121
|
+
gridLine: f.grid,
|
|
122
|
+
hoverAffordance: f.board,
|
|
123
|
+
hoverGuideFill: "rgba(244, 241, 232, 0.07)",
|
|
124
|
+
hoverGuideLine: f.edge,
|
|
125
|
+
tooltipBackground: f.wiped,
|
|
126
|
+
tooltipBorder: f.edge,
|
|
127
|
+
tooltipPrimaryRow: "rgba(244, 241, 232, 0.1)",
|
|
128
|
+
annotationShape: S.yellow,
|
|
129
|
+
annotationArrow: f.chalk,
|
|
130
|
+
differenceLabelBackground: f.wiped
|
|
131
|
+
},
|
|
132
|
+
defaults: [
|
|
133
|
+
v.graph({
|
|
134
|
+
fill: de,
|
|
135
|
+
overlay: ce,
|
|
136
|
+
strokeWidth: 0,
|
|
137
|
+
cornerRadius: 4,
|
|
138
|
+
fontFamily: he,
|
|
139
|
+
padding: {
|
|
140
|
+
top: K,
|
|
141
|
+
right: K,
|
|
142
|
+
bottom: K + 13 + ge,
|
|
143
|
+
left: K
|
|
144
|
+
}
|
|
145
|
+
}),
|
|
146
|
+
v.geom({ shadow: "none" }),
|
|
147
|
+
v.geom({ shadow: "none" }, { state: "hovered" }),
|
|
148
|
+
v.geom.bar({
|
|
149
|
+
fillAlpha: ue,
|
|
150
|
+
stroke: f.chalk,
|
|
151
|
+
strokeWidth: it,
|
|
152
|
+
cornerRadius: 2
|
|
153
|
+
}),
|
|
154
|
+
v.geom.bar({
|
|
155
|
+
fillAlpha: 1,
|
|
156
|
+
stroke: f.chalk,
|
|
157
|
+
strokeWidth: 3,
|
|
158
|
+
shadow: "none"
|
|
159
|
+
}, { state: "hovered" }),
|
|
160
|
+
v.geom.line({
|
|
161
|
+
strokeWidth: 4,
|
|
162
|
+
...ht
|
|
163
|
+
}),
|
|
164
|
+
v.geom.area({
|
|
165
|
+
fillAlpha: 0.72,
|
|
166
|
+
strokeWidth: 3,
|
|
167
|
+
...ht
|
|
168
|
+
}),
|
|
169
|
+
v.geom.point({
|
|
170
|
+
size: 14,
|
|
171
|
+
stroke: f.board,
|
|
172
|
+
strokeWidth: 1.5
|
|
173
|
+
}),
|
|
174
|
+
v.geom.tile({
|
|
175
|
+
fillAlpha: 0.9,
|
|
176
|
+
cornerRadius: 2,
|
|
177
|
+
stroke: f.board,
|
|
178
|
+
strokeWidth: 3
|
|
179
|
+
}),
|
|
180
|
+
v.geom.tile({
|
|
181
|
+
fillAlpha: 1,
|
|
182
|
+
stroke: f.chalk,
|
|
183
|
+
strokeWidth: it
|
|
184
|
+
}, { state: "hovered" }),
|
|
185
|
+
v.geom.rule({
|
|
186
|
+
strokeWidth: 2.5,
|
|
187
|
+
dashArray: [2, 7],
|
|
188
|
+
lineCap: "round"
|
|
189
|
+
}),
|
|
190
|
+
v.geom.rule.label({
|
|
191
|
+
...I,
|
|
192
|
+
fontSize: 15
|
|
193
|
+
}),
|
|
194
|
+
v.gridLine({ dashArray: [7, 7] }),
|
|
195
|
+
v.gridLine.y({ strokeWidth: 1.5 }),
|
|
196
|
+
v.panelBorder({ strokeWidth: 0 }),
|
|
197
|
+
v.panelBorder.left({
|
|
198
|
+
stroke: f.axis,
|
|
199
|
+
strokeWidth: 2.5,
|
|
200
|
+
dashArray: []
|
|
201
|
+
}),
|
|
202
|
+
v.panelBorder.bottom({
|
|
203
|
+
stroke: f.axis,
|
|
204
|
+
strokeWidth: 2.5,
|
|
205
|
+
dashArray: []
|
|
206
|
+
}),
|
|
207
|
+
v.tickLine({ strokeWidth: 0 }),
|
|
208
|
+
v.tickLabel({
|
|
209
|
+
...T,
|
|
210
|
+
fontSize: 15,
|
|
211
|
+
lineHeight: 1
|
|
212
|
+
}),
|
|
213
|
+
v.axisLabel({
|
|
214
|
+
...T,
|
|
215
|
+
fontSize: 16,
|
|
216
|
+
lineHeight: 1
|
|
217
|
+
}),
|
|
218
|
+
v.heading({ ...I }),
|
|
219
|
+
v.heading.h1({
|
|
220
|
+
fontSize: 27,
|
|
221
|
+
lineHeight: 1
|
|
222
|
+
}),
|
|
223
|
+
v.heading.h2({
|
|
224
|
+
...T,
|
|
225
|
+
fontSize: 18,
|
|
226
|
+
lineHeight: 1.1
|
|
227
|
+
}),
|
|
228
|
+
v.header({ margin: { bottom: 16 } }),
|
|
229
|
+
v.caption({
|
|
230
|
+
...T,
|
|
231
|
+
fontSize: 14
|
|
232
|
+
}),
|
|
233
|
+
v.source({
|
|
234
|
+
...T,
|
|
235
|
+
fontSize: 14
|
|
236
|
+
}),
|
|
237
|
+
v.dataLabel({
|
|
238
|
+
...I,
|
|
239
|
+
fontSize: 15,
|
|
240
|
+
lineHeight: 1,
|
|
241
|
+
fill: "transparent",
|
|
242
|
+
paddingBlock: 1,
|
|
243
|
+
paddingInline: 3
|
|
244
|
+
}),
|
|
245
|
+
v.legendItem({
|
|
246
|
+
...I,
|
|
247
|
+
fontSize: 16,
|
|
248
|
+
fill: "transparent",
|
|
249
|
+
stroke: "transparent"
|
|
250
|
+
}),
|
|
251
|
+
v.directLabel({
|
|
252
|
+
fontWeight: 400,
|
|
253
|
+
fontSize: 16
|
|
254
|
+
}),
|
|
255
|
+
v.tooltip({
|
|
256
|
+
strokeWidth: 2,
|
|
257
|
+
cornerRadius: 3,
|
|
258
|
+
paddingInline: 12,
|
|
259
|
+
paddingBlock: 9,
|
|
260
|
+
shadow: "none"
|
|
261
|
+
}),
|
|
262
|
+
v.tooltip.heading({
|
|
263
|
+
...I,
|
|
264
|
+
fontSize: 17,
|
|
265
|
+
lineHeight: 1.15
|
|
266
|
+
}),
|
|
267
|
+
v.tooltip.label({
|
|
268
|
+
...T,
|
|
269
|
+
fontSize: 15,
|
|
270
|
+
lineHeight: 1.25
|
|
271
|
+
}),
|
|
272
|
+
v.tooltip.value({
|
|
273
|
+
...I,
|
|
274
|
+
fontSize: 15,
|
|
275
|
+
lineHeight: 1.25
|
|
276
|
+
}),
|
|
277
|
+
v.annotation.text({
|
|
278
|
+
...U,
|
|
279
|
+
paddingInline: 6,
|
|
280
|
+
paddingBlock: 2,
|
|
281
|
+
fontSize: 17,
|
|
282
|
+
lineHeight: 1.15
|
|
283
|
+
}),
|
|
284
|
+
v.annotation.pinnedNumber({
|
|
285
|
+
fill: f.chalk,
|
|
286
|
+
stroke: f.board
|
|
287
|
+
}),
|
|
288
|
+
v.annotation.pinnedNumber.label({ ...U }),
|
|
289
|
+
v.annotation.comment({
|
|
290
|
+
fill: f.chalk,
|
|
291
|
+
stroke: f.board
|
|
292
|
+
}),
|
|
293
|
+
v.annotation.comment.label({ ...U }),
|
|
294
|
+
v.annotation.differenceArrow({
|
|
295
|
+
stroke: f.chalk,
|
|
296
|
+
strokeWidth: 2.5
|
|
297
|
+
}),
|
|
298
|
+
v.annotation.differenceArrow.label({ ...U }),
|
|
299
|
+
v.annotation.arrow({
|
|
300
|
+
stroke: f.chalk,
|
|
301
|
+
strokeWidth: 3,
|
|
302
|
+
dashArray: []
|
|
303
|
+
}),
|
|
304
|
+
v.annotation.shape({
|
|
305
|
+
fill: f.chalk,
|
|
306
|
+
fillAlpha: 0.1,
|
|
307
|
+
strokeWidth: 0
|
|
308
|
+
}),
|
|
309
|
+
v.tickLabel({
|
|
310
|
+
textOutlineColor: f.board,
|
|
311
|
+
textOutlineWidth: 3
|
|
312
|
+
}, { coord: "polar" }),
|
|
313
|
+
v.panelBorder.left({ strokeWidth: 0 }, { coord: "polar" }),
|
|
314
|
+
v.panelBorder.bottom({ strokeWidth: 0 }, { coord: "polar" })
|
|
315
|
+
]
|
|
316
|
+
}, R = (t) => {
|
|
317
|
+
let r = 2166136261;
|
|
318
|
+
for (let e = 0; e < t.length; e += 1)
|
|
319
|
+
r ^= t.charCodeAt(e), r = Math.imul(r, 16777619);
|
|
320
|
+
return r >>> 0;
|
|
321
|
+
}, D = (t) => {
|
|
322
|
+
let r = t || 1;
|
|
323
|
+
return () => {
|
|
324
|
+
r = r + 1831565813 | 0;
|
|
325
|
+
let e = Math.imul(r ^ r >>> 15, 1 | r);
|
|
326
|
+
return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
327
|
+
};
|
|
328
|
+
}, ve = (t) => {
|
|
329
|
+
const r = [
|
|
330
|
+
0.035,
|
|
331
|
+
0.07,
|
|
332
|
+
0.13
|
|
333
|
+
].map((a, o) => ({
|
|
334
|
+
frequency: a * (0.7 + t() * 0.6),
|
|
335
|
+
phase: t() * Math.PI * 2,
|
|
336
|
+
weight: 1 / (o + 1)
|
|
337
|
+
})), e = r.reduce((a, o) => a + o.weight, 0);
|
|
338
|
+
return (a) => r.reduce((o, l) => o + l.weight * Math.sin(a * l.frequency + l.phase), 0) / e;
|
|
339
|
+
}, H = (t, { wander: r, seed: e, closed: a = !1, step: o = 9, cornered: l = !1 }) => {
|
|
340
|
+
if (t.length < 2) return "";
|
|
341
|
+
const s = ve(D(e)), n = a ? [...t, t[0]] : [...t], h = [], d = [];
|
|
342
|
+
let g = 0;
|
|
343
|
+
for (let p = 0; p < n.length - 1; p += 1) {
|
|
344
|
+
const i = n[p], u = n[p + 1], y = Math.hypot(u.x - i.x, u.y - i.y);
|
|
345
|
+
if (y === 0) continue;
|
|
346
|
+
const x = {
|
|
347
|
+
x: -(u.y - i.y) / y,
|
|
348
|
+
y: (u.x - i.x) / y
|
|
349
|
+
}, E = Math.max(1, Math.ceil(y / o)), w = [];
|
|
350
|
+
for (let m = 0; m <= E; m += 1) {
|
|
351
|
+
const A = m / E, C = r * Math.sin(Math.PI * A) * s(g + A * y);
|
|
352
|
+
w.push({
|
|
353
|
+
x: i.x + (u.x - i.x) * A + x.x * C,
|
|
354
|
+
y: i.y + (u.y - i.y) * A + x.y * C
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
d.push(w), h.push(...w.slice(0, -1)), g += y;
|
|
358
|
+
}
|
|
359
|
+
return l ? `${d.map((p) => lt(p, !1)).map((p, i) => i === 0 ? p : p.replace(/^M/u, "L")).join(" ")}${a ? " Z" : ""}` : (a || h.push(n[n.length - 1]), lt(h, a));
|
|
360
|
+
}, k = (t) => (Math.round(t * 100) / 100).toString(), lt = (t, r) => {
|
|
361
|
+
const e = t.length, a = (n) => r ? t[(n + e) % e] : t[Math.max(0, Math.min(e - 1, n))], o = a(0), l = [`M${k(o.x)},${k(o.y)}`], s = r ? e : e - 1;
|
|
362
|
+
for (let n = 0; n < s; n += 1) {
|
|
363
|
+
const [h, d, g, p] = [
|
|
364
|
+
a(n - 1),
|
|
365
|
+
a(n),
|
|
366
|
+
a(n + 1),
|
|
367
|
+
a(n + 2)
|
|
368
|
+
], i = {
|
|
369
|
+
x: d.x + (g.x - h.x) / 6,
|
|
370
|
+
y: d.y + (g.y - h.y) / 6
|
|
371
|
+
}, u = {
|
|
372
|
+
x: g.x - (p.x - d.x) / 6,
|
|
373
|
+
y: g.y - (p.y - d.y) / 6
|
|
374
|
+
};
|
|
375
|
+
l.push(`C${k(i.x)},${k(i.y)} ${k(u.x)},${k(u.y)} ${k(g.x)},${k(g.y)}`);
|
|
376
|
+
}
|
|
377
|
+
return `${l.join(" ")}${r ? " Z" : ""}`;
|
|
378
|
+
}, fe = 9, L = ({ run: t, skip: r }, e) => {
|
|
379
|
+
const a = D(e), o = ([l, s]) => k(l + a() * (s - l));
|
|
380
|
+
return Array.from({ length: fe }, () => `${o(t)} ${o(r)}`).join(" ");
|
|
381
|
+
}, ye = 0.07, me = 40, xe = (t, { angle: r, spacing: e, seed: a }) => {
|
|
382
|
+
const o = D(a), l = {
|
|
383
|
+
x: t.x + t.width / 2,
|
|
384
|
+
y: t.y + t.height / 2
|
|
385
|
+
}, s = Math.hypot(t.width, t.height) / 2 + e, n = [];
|
|
386
|
+
for (let h = -s; h <= s; h += e * (0.75 + o() * 0.5)) {
|
|
387
|
+
const d = r + (o() - 0.5) * Math.min(ye, e / s), g = {
|
|
388
|
+
x: Math.cos(d),
|
|
389
|
+
y: Math.sin(d)
|
|
390
|
+
}, p = {
|
|
391
|
+
x: -Math.sin(r),
|
|
392
|
+
y: Math.cos(r)
|
|
393
|
+
}, i = {
|
|
394
|
+
x: l.x + p.x * h,
|
|
395
|
+
y: l.y + p.y * h
|
|
396
|
+
}, u = s + o() * me;
|
|
397
|
+
n.push(H([{
|
|
398
|
+
x: i.x - g.x * u,
|
|
399
|
+
y: i.y - g.y * u
|
|
400
|
+
}, {
|
|
401
|
+
x: i.x + g.x * s,
|
|
402
|
+
y: i.y + g.y * s
|
|
403
|
+
}], {
|
|
404
|
+
wander: 1.1,
|
|
405
|
+
seed: a + n.length + 1,
|
|
406
|
+
step: 14
|
|
407
|
+
}));
|
|
408
|
+
}
|
|
409
|
+
return n.join(" ");
|
|
410
|
+
}, Ae = (t, r, e) => {
|
|
411
|
+
const a = (D(e)() - 0.5) * 0.25, o = (l) => {
|
|
412
|
+
const s = {
|
|
413
|
+
x: Math.cos(l) * r,
|
|
414
|
+
y: Math.sin(l) * r
|
|
415
|
+
};
|
|
416
|
+
return `M${k(t.x - s.x)},${k(t.y - s.y)} L${k(t.x + s.x)},${k(t.y + s.y)}`;
|
|
417
|
+
};
|
|
418
|
+
return `${o(Math.PI / 4 + a)} ${o(-Math.PI / 4 - a)}`;
|
|
419
|
+
}, Q = (t, r, { seed: e, overshoot: a, wander: o, drift: l = 0 }) => {
|
|
420
|
+
const s = D(e)() * Math.PI * 2, n = Math.PI * 2 + a, h = Math.max(8, Math.ceil(n * r / 10)), d = Array.from({ length: h + 1 }, (g, p) => {
|
|
421
|
+
const i = n * p / h, u = Math.max(0, i - Math.PI * 2) / Math.max(a, 1e-6), y = r + l * u * u, x = s + i;
|
|
422
|
+
return {
|
|
423
|
+
x: t.x + Math.cos(x) * y,
|
|
424
|
+
y: t.y + Math.sin(x) * y
|
|
425
|
+
};
|
|
426
|
+
});
|
|
427
|
+
return H(d, {
|
|
428
|
+
wander: o,
|
|
429
|
+
seed: e + 1,
|
|
430
|
+
step: 6
|
|
431
|
+
});
|
|
432
|
+
}, we = 0.4, ke = 0.85, Se = {
|
|
433
|
+
run: [14, 46],
|
|
434
|
+
skip: [1.5, 4]
|
|
435
|
+
}, Ee = 0.35, Re = {
|
|
436
|
+
run: [1.5, 6],
|
|
437
|
+
skip: [2, 7]
|
|
438
|
+
}, st = {
|
|
439
|
+
x: 0.45,
|
|
440
|
+
y: -0.35
|
|
441
|
+
}, j = {
|
|
442
|
+
x: -0.6,
|
|
443
|
+
y: 0.55
|
|
444
|
+
}, _e = {
|
|
445
|
+
run: [18, 70],
|
|
446
|
+
skip: [1.5, 5]
|
|
447
|
+
}, $e = {
|
|
448
|
+
run: [1, 4],
|
|
449
|
+
skip: [3, 9]
|
|
450
|
+
}, Ce = 0.55, He = 0.16, dt = [
|
|
451
|
+
-Math.PI / 4,
|
|
452
|
+
Math.PI / 4,
|
|
453
|
+
-Math.PI / 2.6,
|
|
454
|
+
Math.PI / 2.6,
|
|
455
|
+
-Math.PI / 8,
|
|
456
|
+
Math.PI / 8
|
|
457
|
+
], tt = (t, r = 0) => {
|
|
458
|
+
const e = _t.indexOf(t);
|
|
459
|
+
return dt[(e < 0 ? r : e) % dt.length];
|
|
460
|
+
}, $t = (t) => `${t}-${bt().replace(/[^a-zA-Z0-9]/gu, "")}`, $ = ({ path: t, color: r, width: e, seed: a, opacity: o = 1 }) => /* @__PURE__ */ _("g", {
|
|
461
|
+
opacity: o,
|
|
462
|
+
fill: "none",
|
|
463
|
+
stroke: r,
|
|
464
|
+
strokeLinejoin: "round",
|
|
465
|
+
children: [
|
|
466
|
+
/* @__PURE__ */ c("path", {
|
|
467
|
+
d: t,
|
|
468
|
+
strokeWidth: e,
|
|
469
|
+
strokeOpacity: we,
|
|
470
|
+
strokeLinecap: "round"
|
|
471
|
+
}),
|
|
472
|
+
/* @__PURE__ */ c("path", {
|
|
473
|
+
d: t,
|
|
474
|
+
strokeWidth: e * ke,
|
|
475
|
+
strokeDasharray: L(Se, a),
|
|
476
|
+
transform: `translate(${st.x} ${st.y})`
|
|
477
|
+
}),
|
|
478
|
+
/* @__PURE__ */ c("path", {
|
|
479
|
+
d: t,
|
|
480
|
+
strokeWidth: Math.max(0.8, e * Ee),
|
|
481
|
+
strokeDasharray: L(Re, a + 1),
|
|
482
|
+
transform: `translate(${j.x} ${j.y})`
|
|
483
|
+
})
|
|
484
|
+
]
|
|
485
|
+
}), et = ({ region: t, bounds: r, color: e, angle: a, spacing: o, width: l, seed: s, pressure: n }) => {
|
|
486
|
+
const h = $t("shade"), d = xe(r, {
|
|
487
|
+
angle: a,
|
|
488
|
+
spacing: o,
|
|
489
|
+
seed: s
|
|
490
|
+
});
|
|
491
|
+
return /* @__PURE__ */ _("g", { children: [
|
|
492
|
+
/* @__PURE__ */ c("clipPath", {
|
|
493
|
+
id: h,
|
|
494
|
+
children: /* @__PURE__ */ c("path", { d: t })
|
|
495
|
+
}),
|
|
496
|
+
/* @__PURE__ */ c("path", {
|
|
497
|
+
d: t,
|
|
498
|
+
fill: f.board,
|
|
499
|
+
fillOpacity: Ce
|
|
500
|
+
}),
|
|
501
|
+
/* @__PURE__ */ c("path", {
|
|
502
|
+
d: t,
|
|
503
|
+
fill: e,
|
|
504
|
+
fillOpacity: n * He
|
|
505
|
+
}),
|
|
506
|
+
/* @__PURE__ */ _("g", {
|
|
507
|
+
clipPath: `url(#${h})`,
|
|
508
|
+
fill: "none",
|
|
509
|
+
stroke: e,
|
|
510
|
+
children: [/* @__PURE__ */ c("path", {
|
|
511
|
+
d,
|
|
512
|
+
strokeWidth: l,
|
|
513
|
+
strokeOpacity: n * 0.72,
|
|
514
|
+
strokeDasharray: L(_e, s + 2)
|
|
515
|
+
}), /* @__PURE__ */ c("path", {
|
|
516
|
+
d,
|
|
517
|
+
strokeWidth: l * 0.4,
|
|
518
|
+
strokeOpacity: n,
|
|
519
|
+
strokeDasharray: L($e, s + 3),
|
|
520
|
+
transform: `translate(${j.x} ${j.y})`
|
|
521
|
+
})]
|
|
522
|
+
})
|
|
523
|
+
] });
|
|
524
|
+
}, M = (t) => {
|
|
525
|
+
const r = X(t);
|
|
526
|
+
return (e, a) => ({
|
|
527
|
+
color: jt(r.get("fill", e, a)),
|
|
528
|
+
opacity: r.get("alpha", e, a),
|
|
529
|
+
fillOpacity: r.get("fillAlpha", e, a),
|
|
530
|
+
edge: r.get("stroke", e, a),
|
|
531
|
+
edgeWidth: r.get("strokeWidth", e, a)
|
|
532
|
+
});
|
|
533
|
+
}, Ct = (t) => {
|
|
534
|
+
const r = X(t);
|
|
535
|
+
return (e, a) => {
|
|
536
|
+
const o = r.get("strokeWidth", e, a);
|
|
537
|
+
return {
|
|
538
|
+
color: r.get("stroke", e, a),
|
|
539
|
+
opacity: r.get("alpha", e, a) * r.get("strokeAlpha", e, a),
|
|
540
|
+
width: o,
|
|
541
|
+
dashArray: Vt(r.get("dashArray", e, a), o)
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
}, Ie = 10, Pe = 2.2, Me = 0.5, ct = (t, r) => {
|
|
545
|
+
const e = W(t.data, t.mapping, t.id), a = [];
|
|
546
|
+
return t.data.groupBy(kt.group).forEach((o) => {
|
|
547
|
+
const l = [...o], [s] = l, n = r(l);
|
|
548
|
+
s === void 0 || n === null || a.push({
|
|
549
|
+
key: e(s),
|
|
550
|
+
observation: s,
|
|
551
|
+
path: n
|
|
552
|
+
});
|
|
553
|
+
}), a;
|
|
554
|
+
}, Te = (t, r) => {
|
|
555
|
+
const e = t.flatMap((a) => {
|
|
556
|
+
const o = b(a), l = Z(a, r);
|
|
557
|
+
return o === null || l === null ? [] : [{
|
|
558
|
+
angle: o,
|
|
559
|
+
point: l
|
|
560
|
+
}];
|
|
561
|
+
}).sort((a, o) => a.angle - o.angle).map(({ point: a }) => a);
|
|
562
|
+
return e.length === 0 ? null : te(e);
|
|
563
|
+
}, rt = ({ geom: t, observation: r, panel: e, project: a, color: o, opacity: l, radius: s = Ie }) => {
|
|
564
|
+
const n = a(r, e);
|
|
565
|
+
return n === null ? null : /* @__PURE__ */ c("g", {
|
|
566
|
+
"data-geom": t,
|
|
567
|
+
children: /* @__PURE__ */ c($, {
|
|
568
|
+
path: Q(n, s, {
|
|
569
|
+
seed: 19,
|
|
570
|
+
overshoot: Me,
|
|
571
|
+
wander: 0.5
|
|
572
|
+
}),
|
|
573
|
+
color: o,
|
|
574
|
+
width: Pe,
|
|
575
|
+
seed: 23,
|
|
576
|
+
opacity: l
|
|
577
|
+
})
|
|
578
|
+
});
|
|
579
|
+
}, be = 1.3, Oe = 3.2, De = 8, Le = /^[ML\d\s.,eE+-]+$/u, We = /[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu, Ne = (t) => {
|
|
580
|
+
if (!Le.test(t)) return null;
|
|
581
|
+
const r = (t.match(We) ?? []).map(Number), e = [];
|
|
582
|
+
for (let a = 0; a + 1 < r.length; a += 2) e.push({
|
|
583
|
+
x: r[a],
|
|
584
|
+
y: r[a + 1]
|
|
585
|
+
});
|
|
586
|
+
return e;
|
|
587
|
+
}, gt = (t, r, e) => {
|
|
588
|
+
const a = Ne(t.replace(/\s*Z\s*$/u, ""));
|
|
589
|
+
return a === null || a.length < 2 ? t : H(a, {
|
|
590
|
+
wander: be,
|
|
591
|
+
seed: r,
|
|
592
|
+
closed: e
|
|
593
|
+
});
|
|
594
|
+
}, Ht = ({ layer: t, coordSystem: r, panel: e }) => {
|
|
595
|
+
const a = M(t), o = O(() => {
|
|
596
|
+
if (r === void 0) return ct(t, (h) => Te(h, e)).map((h) => ({
|
|
597
|
+
...h,
|
|
598
|
+
fill: h.path,
|
|
599
|
+
edge: gt(h.path, R(h.key), !0)
|
|
600
|
+
}));
|
|
601
|
+
const { areaGenerator: l, lineGenerator: s } = Dt(r, t.params), n = /* @__PURE__ */ new Map();
|
|
602
|
+
return ct(t, (h) => {
|
|
603
|
+
const d = zt(h, t.params.missingValues), g = l(d), p = s(d);
|
|
604
|
+
if (!g) return null;
|
|
605
|
+
const i = ot(g, e);
|
|
606
|
+
return p && n.set(i, ot(p, e)), i;
|
|
607
|
+
}).map((h) => ({
|
|
608
|
+
...h,
|
|
609
|
+
fill: h.path,
|
|
610
|
+
edge: gt(n.get(h.path) ?? "", R(h.key), !1)
|
|
611
|
+
}));
|
|
612
|
+
}, [
|
|
613
|
+
t,
|
|
614
|
+
r,
|
|
615
|
+
e
|
|
616
|
+
]);
|
|
617
|
+
return e.width <= 0 || e.height <= 0 ? null : /* @__PURE__ */ c("g", {
|
|
618
|
+
"data-geom": "area",
|
|
619
|
+
children: o.map(({ key: l, observation: s, fill: n, edge: h }, d) => {
|
|
620
|
+
const g = a(s), p = R(l);
|
|
621
|
+
return /* @__PURE__ */ _("g", {
|
|
622
|
+
opacity: g.opacity,
|
|
623
|
+
children: [/* @__PURE__ */ c(et, {
|
|
624
|
+
region: n,
|
|
625
|
+
bounds: Qt(e),
|
|
626
|
+
color: g.color,
|
|
627
|
+
angle: tt(g.color, d),
|
|
628
|
+
spacing: De,
|
|
629
|
+
width: Oe,
|
|
630
|
+
seed: p,
|
|
631
|
+
pressure: g.fillOpacity
|
|
632
|
+
}), h !== "" && /* @__PURE__ */ c($, {
|
|
633
|
+
path: h,
|
|
634
|
+
color: g.color,
|
|
635
|
+
width: g.edgeWidth,
|
|
636
|
+
seed: p
|
|
637
|
+
})]
|
|
638
|
+
}, l);
|
|
639
|
+
})
|
|
640
|
+
});
|
|
641
|
+
}, It = ({ layer: t, observation: r, panel: e, project: a }) => {
|
|
642
|
+
const o = M(t)(r, "hovered");
|
|
643
|
+
return /* @__PURE__ */ c(rt, {
|
|
644
|
+
geom: "area",
|
|
645
|
+
observation: r,
|
|
646
|
+
panel: e,
|
|
647
|
+
project: a,
|
|
648
|
+
color: o.color,
|
|
649
|
+
opacity: o.opacity
|
|
650
|
+
});
|
|
651
|
+
}, Ge = P("area", {
|
|
652
|
+
coord: "cartesian",
|
|
653
|
+
guideMode: "crosshair",
|
|
654
|
+
swatchShape: "area",
|
|
655
|
+
render: ({ layer: t, coordSystem: r, panelRect: e }) => r.type !== "cartesian" ? null : /* @__PURE__ */ c(Ht, {
|
|
656
|
+
layer: t,
|
|
657
|
+
coordSystem: r,
|
|
658
|
+
panel: e
|
|
659
|
+
}),
|
|
660
|
+
renderHover: ({ layer: t, primary: r, panelRect: e }) => /* @__PURE__ */ c(It, {
|
|
661
|
+
layer: t,
|
|
662
|
+
observation: r.observation,
|
|
663
|
+
panel: e,
|
|
664
|
+
project: J
|
|
665
|
+
}),
|
|
666
|
+
renderHoverCompanions: () => null
|
|
667
|
+
}), Be = P("area", {
|
|
668
|
+
coord: "polar",
|
|
669
|
+
guideMode: "crosshair",
|
|
670
|
+
swatchShape: "area",
|
|
671
|
+
render: ({ layer: t, panelRect: r }) => /* @__PURE__ */ c(Ht, {
|
|
672
|
+
layer: t,
|
|
673
|
+
panel: r
|
|
674
|
+
}),
|
|
675
|
+
renderHover: ({ layer: t, primary: r, panelRect: e }) => /* @__PURE__ */ c(It, {
|
|
676
|
+
layer: t,
|
|
677
|
+
observation: r.observation,
|
|
678
|
+
panel: e,
|
|
679
|
+
project: Z
|
|
680
|
+
}),
|
|
681
|
+
renderHoverCompanions: () => null
|
|
682
|
+
}), Fe = 1.6, Ke = 0.55, Ue = 0.6, ze = 3.8, ut = 7.5, je = 0.55, Ve = 3, Ye = {
|
|
683
|
+
solo: {
|
|
684
|
+
base: !0,
|
|
685
|
+
value: !0
|
|
686
|
+
},
|
|
687
|
+
floor: {
|
|
688
|
+
base: !0,
|
|
689
|
+
value: !1
|
|
690
|
+
},
|
|
691
|
+
ceiling: {
|
|
692
|
+
base: !1,
|
|
693
|
+
value: !0
|
|
694
|
+
},
|
|
695
|
+
middle: {
|
|
696
|
+
base: !1,
|
|
697
|
+
value: !1
|
|
698
|
+
}
|
|
699
|
+
}, Xe = {
|
|
700
|
+
top: "bottom",
|
|
701
|
+
bottom: "top",
|
|
702
|
+
left: "right",
|
|
703
|
+
right: "left"
|
|
704
|
+
}, Ze = (t, r) => r === "x" ? (Et(t) ?? Y(t) ?? 0) >= (Ut(t) ?? 0) ? "top" : "bottom" : (Ft(t) ?? 0) >= (Kt(t) ?? 0) ? "right" : "left", qe = (t, r, e) => {
|
|
705
|
+
const a = Math.max(0, t.width - e), o = Math.max(0, t.height - e);
|
|
706
|
+
return r === "top" ? {
|
|
707
|
+
...t,
|
|
708
|
+
y: t.y + t.height - o,
|
|
709
|
+
height: o
|
|
710
|
+
} : r === "bottom" ? {
|
|
711
|
+
...t,
|
|
712
|
+
height: o
|
|
713
|
+
} : r === "left" ? {
|
|
714
|
+
...t,
|
|
715
|
+
x: t.x + t.width - a,
|
|
716
|
+
width: a
|
|
717
|
+
} : {
|
|
718
|
+
...t,
|
|
719
|
+
width: a
|
|
720
|
+
};
|
|
721
|
+
}, Je = (t) => [
|
|
722
|
+
{
|
|
723
|
+
x: t.x,
|
|
724
|
+
y: t.y + t.height
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
x: t.x,
|
|
728
|
+
y: t.y
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
x: t.x + t.width,
|
|
732
|
+
y: t.y
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
x: t.x + t.width,
|
|
736
|
+
y: t.y + t.height
|
|
737
|
+
}
|
|
738
|
+
], Qe = ({ layer: t, observation: r, seedKey: e, mainAxis: a, panel: o, state: l }) => {
|
|
739
|
+
const s = M(t), n = Nt(a, r);
|
|
740
|
+
if (!n || n.width <= 0 || n.height <= 0) return null;
|
|
741
|
+
const h = s(r, l), d = Ye[Bt(r)], g = Ze(r, a), p = {
|
|
742
|
+
x: n.x * o.width,
|
|
743
|
+
y: n.y * o.height,
|
|
744
|
+
width: n.width * o.width,
|
|
745
|
+
height: n.height * o.height
|
|
746
|
+
}, i = [d.value ? [] : [g], d.base ? [] : [Xe[g]]].flat().reduce((C, N) => qe(C, N, Ve / 2), p);
|
|
747
|
+
if (i.width <= 0 || i.height <= 0) return null;
|
|
748
|
+
const u = R(e), y = Je(i), x = Math.min(Fe, i.width / 10, i.height / 10), E = H(y, {
|
|
749
|
+
wander: x,
|
|
750
|
+
seed: u,
|
|
751
|
+
closed: !0,
|
|
752
|
+
cornered: !0
|
|
753
|
+
}), w = H(y, {
|
|
754
|
+
wander: x,
|
|
755
|
+
seed: u + 7,
|
|
756
|
+
closed: !0,
|
|
757
|
+
cornered: !0
|
|
758
|
+
}), m = l === "hovered", A = tt(h.color) + (a === "x" ? 0 : Math.PI / 2);
|
|
759
|
+
return /* @__PURE__ */ _("g", {
|
|
760
|
+
opacity: h.opacity,
|
|
761
|
+
children: [
|
|
762
|
+
/* @__PURE__ */ c(et, {
|
|
763
|
+
region: E,
|
|
764
|
+
bounds: i,
|
|
765
|
+
color: h.color,
|
|
766
|
+
angle: A,
|
|
767
|
+
spacing: m ? ut * je : ut,
|
|
768
|
+
width: ze,
|
|
769
|
+
seed: u,
|
|
770
|
+
pressure: h.fillOpacity
|
|
771
|
+
}),
|
|
772
|
+
/* @__PURE__ */ c($, {
|
|
773
|
+
path: E,
|
|
774
|
+
color: m ? h.edge : h.color,
|
|
775
|
+
width: h.edgeWidth,
|
|
776
|
+
seed: u
|
|
777
|
+
}),
|
|
778
|
+
/* @__PURE__ */ c($, {
|
|
779
|
+
path: w,
|
|
780
|
+
color: h.color,
|
|
781
|
+
width: h.edgeWidth * Ue,
|
|
782
|
+
seed: u + 3,
|
|
783
|
+
opacity: Ke
|
|
784
|
+
})
|
|
785
|
+
]
|
|
786
|
+
});
|
|
787
|
+
}, pt = ({ layer: t, observations: r, mainAxis: e, panel: a, state: o }) => {
|
|
788
|
+
const l = O(() => W(t.data, t.mapping, t.id), [
|
|
789
|
+
t.data,
|
|
790
|
+
t.mapping,
|
|
791
|
+
t.id
|
|
792
|
+
]);
|
|
793
|
+
return a.width <= 0 || a.height <= 0 ? null : /* @__PURE__ */ c("g", {
|
|
794
|
+
"data-geom": "bar",
|
|
795
|
+
children: Array.from(r, (s) => {
|
|
796
|
+
const n = l(s);
|
|
797
|
+
return /* @__PURE__ */ c(Qe, {
|
|
798
|
+
layer: t,
|
|
799
|
+
observation: s,
|
|
800
|
+
seedKey: n,
|
|
801
|
+
mainAxis: e,
|
|
802
|
+
panel: a,
|
|
803
|
+
state: o
|
|
804
|
+
}, n);
|
|
805
|
+
})
|
|
806
|
+
});
|
|
807
|
+
}, tr = P("bar", {
|
|
808
|
+
coord: "cartesian",
|
|
809
|
+
guideMode: "band",
|
|
810
|
+
swatchShape: "square",
|
|
811
|
+
render: ({ layer: t, coordSystem: r, panelRect: e }) => /* @__PURE__ */ c(pt, {
|
|
812
|
+
layer: t,
|
|
813
|
+
observations: t.data,
|
|
814
|
+
mainAxis: at(r),
|
|
815
|
+
panel: e
|
|
816
|
+
}),
|
|
817
|
+
renderHover: ({ layer: t, coordSystem: r, primary: e, panelRect: a }) => /* @__PURE__ */ c(pt, {
|
|
818
|
+
layer: t,
|
|
819
|
+
observations: [e.observation],
|
|
820
|
+
mainAxis: at(r),
|
|
821
|
+
panel: a,
|
|
822
|
+
state: "hovered"
|
|
823
|
+
}),
|
|
824
|
+
renderHoverCompanions: () => null
|
|
825
|
+
}), er = 1.3, rr = 5, ar = 2.2, or = 16, nr = (t, r, e, a) => {
|
|
826
|
+
const o = W(t.data, t.mapping, t.id), l = [];
|
|
827
|
+
return t.data.groupBy(kt.group).forEach((s) => {
|
|
828
|
+
const n = [...s], [h] = n;
|
|
829
|
+
if (h === void 0) return;
|
|
830
|
+
const d = (e === "polar" ? n.sort((p, i) => (b(p) ?? 0) - (b(i) ?? 0)) : n).flatMap((p) => {
|
|
831
|
+
const i = a(p, r);
|
|
832
|
+
return i === null ? [] : [i];
|
|
833
|
+
});
|
|
834
|
+
if (d.length < 2) return;
|
|
835
|
+
const g = o(h);
|
|
836
|
+
l.push({
|
|
837
|
+
key: g,
|
|
838
|
+
observation: h,
|
|
839
|
+
points: d,
|
|
840
|
+
stroke: H(d, {
|
|
841
|
+
wander: er,
|
|
842
|
+
seed: R(g),
|
|
843
|
+
closed: e === "polar"
|
|
844
|
+
})
|
|
845
|
+
});
|
|
846
|
+
}), l;
|
|
847
|
+
}, ir = (t) => t.every((r, e) => e === 0 || Math.hypot(r.x - t[e - 1].x, r.y - t[e - 1].y) >= or), hr = ({ layer: t, panel: r, coord: e, project: a }) => {
|
|
848
|
+
const o = Ct(t), l = O(() => nr(t, r, e, a), [
|
|
849
|
+
t,
|
|
850
|
+
r,
|
|
851
|
+
e,
|
|
852
|
+
a
|
|
853
|
+
]);
|
|
854
|
+
return r.width <= 0 || r.height <= 0 ? null : /* @__PURE__ */ c("g", {
|
|
855
|
+
"data-geom": "line",
|
|
856
|
+
children: l.map(({ key: s, observation: n, stroke: h, points: d }) => {
|
|
857
|
+
const g = o(n), p = R(s), i = ir(d) ? d.map((u, y) => Ae(u, rr, p + y)).join(" ") : "";
|
|
858
|
+
return /* @__PURE__ */ _("g", {
|
|
859
|
+
opacity: g.opacity,
|
|
860
|
+
children: [/* @__PURE__ */ c($, {
|
|
861
|
+
path: h,
|
|
862
|
+
color: g.color,
|
|
863
|
+
width: g.width,
|
|
864
|
+
seed: p
|
|
865
|
+
}), i !== "" && /* @__PURE__ */ c($, {
|
|
866
|
+
path: i,
|
|
867
|
+
color: g.color,
|
|
868
|
+
width: ar,
|
|
869
|
+
seed: p + 1
|
|
870
|
+
})]
|
|
871
|
+
}, s);
|
|
872
|
+
})
|
|
873
|
+
});
|
|
874
|
+
}, lr = ({ layer: t, observation: r, panel: e, project: a }) => {
|
|
875
|
+
const o = Ct(t)(r, "hovered");
|
|
876
|
+
return /* @__PURE__ */ c(rt, {
|
|
877
|
+
geom: "line",
|
|
878
|
+
observation: r,
|
|
879
|
+
panel: e,
|
|
880
|
+
project: a,
|
|
881
|
+
color: o.color,
|
|
882
|
+
opacity: o.opacity
|
|
883
|
+
});
|
|
884
|
+
}, Pt = (t, r) => P("line", {
|
|
885
|
+
coord: t,
|
|
886
|
+
guideMode: "crosshair",
|
|
887
|
+
swatchShape: "line",
|
|
888
|
+
render: ({ layer: e, panelRect: a }) => /* @__PURE__ */ c(hr, {
|
|
889
|
+
layer: e,
|
|
890
|
+
panel: a,
|
|
891
|
+
coord: t,
|
|
892
|
+
project: r
|
|
893
|
+
}),
|
|
894
|
+
renderHover: ({ layer: e, primary: a, panelRect: o }) => /* @__PURE__ */ c(lr, {
|
|
895
|
+
layer: e,
|
|
896
|
+
observation: a.observation,
|
|
897
|
+
panel: o,
|
|
898
|
+
project: r
|
|
899
|
+
}),
|
|
900
|
+
renderHoverCompanions: () => null,
|
|
901
|
+
getOverlayAnchor: ({ observation: e }) => {
|
|
902
|
+
const a = b(e), o = Y(e);
|
|
903
|
+
return a === null || o === null ? null : {
|
|
904
|
+
x: a,
|
|
905
|
+
y: o
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
}), sr = Pt("cartesian", J), dr = Pt("polar", Z), cr = 0.35, gr = 0.35, ur = 2, pr = 0.3, vr = 5, fr = ({ layer: t, observations: r, panel: e, project: a, state: o }) => {
|
|
909
|
+
const l = X(t), s = M(t), n = O(() => W(t.data, t.mapping, t.id), [
|
|
910
|
+
t.data,
|
|
911
|
+
t.mapping,
|
|
912
|
+
t.id
|
|
913
|
+
]);
|
|
914
|
+
return /* @__PURE__ */ c("g", {
|
|
915
|
+
"data-geom": "point",
|
|
916
|
+
children: Array.from(r, (h) => {
|
|
917
|
+
const d = a(h, e);
|
|
918
|
+
if (d === null) return null;
|
|
919
|
+
const g = n(h), p = R(g), i = s(h, o), u = l.get("size", h, o) / 2;
|
|
920
|
+
return /* @__PURE__ */ _("g", {
|
|
921
|
+
opacity: i.opacity,
|
|
922
|
+
children: [/* @__PURE__ */ c("circle", {
|
|
923
|
+
cx: d.x,
|
|
924
|
+
cy: d.y,
|
|
925
|
+
r: u,
|
|
926
|
+
fill: i.color,
|
|
927
|
+
fillOpacity: i.fillOpacity * pr
|
|
928
|
+
}), /* @__PURE__ */ c($, {
|
|
929
|
+
path: Q(d, u, {
|
|
930
|
+
seed: p,
|
|
931
|
+
overshoot: gr,
|
|
932
|
+
wander: cr
|
|
933
|
+
}),
|
|
934
|
+
color: i.color,
|
|
935
|
+
width: ur,
|
|
936
|
+
seed: p + 1
|
|
937
|
+
})]
|
|
938
|
+
}, g);
|
|
939
|
+
})
|
|
940
|
+
});
|
|
941
|
+
}, yr = ({ layer: t, observation: r, panel: e, project: a }) => {
|
|
942
|
+
const o = M(t)(r, "hovered"), l = X(t).get("size", r, "hovered");
|
|
943
|
+
return /* @__PURE__ */ c(rt, {
|
|
944
|
+
geom: "point",
|
|
945
|
+
observation: r,
|
|
946
|
+
panel: e,
|
|
947
|
+
project: a,
|
|
948
|
+
color: o.color,
|
|
949
|
+
opacity: o.opacity,
|
|
950
|
+
radius: l / 2 + vr
|
|
951
|
+
});
|
|
952
|
+
}, Mt = (t, r) => P("point", {
|
|
953
|
+
coord: t,
|
|
954
|
+
swatchShape: "circle",
|
|
955
|
+
render: ({ layer: e, panelRect: a }) => /* @__PURE__ */ c(fr, {
|
|
956
|
+
layer: e,
|
|
957
|
+
observations: e.data,
|
|
958
|
+
panel: a,
|
|
959
|
+
project: r
|
|
960
|
+
}),
|
|
961
|
+
renderHover: ({ layer: e, primary: a, panelRect: o }) => /* @__PURE__ */ c(yr, {
|
|
962
|
+
layer: e,
|
|
963
|
+
observation: a.observation,
|
|
964
|
+
panel: o,
|
|
965
|
+
project: r
|
|
966
|
+
}),
|
|
967
|
+
renderHoverCompanions: () => null
|
|
968
|
+
}), mr = Mt("cartesian", J), xr = Mt("polar", Z), Ar = Math.PI / 40, wr = 1.2, kr = 3.4, vt = 8, Sr = 0.55, Er = 3, Rr = 0.42, _r = 5, $r = 1.1, Cr = 3, Hr = 2.2, ft = f.chalk, V = (t, r, e) => {
|
|
969
|
+
const a = Rt(r, 1);
|
|
970
|
+
return {
|
|
971
|
+
x: t.width / 2 + a.x * e,
|
|
972
|
+
y: t.height / 2 - a.y * e
|
|
973
|
+
};
|
|
974
|
+
}, yt = (t, r, e, a) => {
|
|
975
|
+
const o = Math.max(1, Math.ceil(Math.abs(e - r) / Ar));
|
|
976
|
+
return Array.from({ length: o + 1 }, (l, s) => V(t, r + (e - r) * s / o, a));
|
|
977
|
+
}, mt = (t, r, e, a) => {
|
|
978
|
+
const { startAngle: o, endAngle: l } = Wt(t), { innerRadius: s, outerRadius: n } = St(t);
|
|
979
|
+
if (o === null || l === null || s === null || n === null) return null;
|
|
980
|
+
const h = Math.min(e.width, e.height) / 2, d = n * h, g = s * h;
|
|
981
|
+
if (d <= 0) return null;
|
|
982
|
+
const p = Math.max(0, l - o), i = p >= 2 * Math.PI - 1e-6 ? 0 : Math.min(a / 2 / d, p / 4), u = o + i, y = l - i, x = yt(e, u, y, d), E = g > 0 ? yt(e, y, u, g) : [V(e, 0, 0)], w = [...x, ...E];
|
|
983
|
+
return {
|
|
984
|
+
key: r,
|
|
985
|
+
observation: t,
|
|
986
|
+
region: `${w.map((m, A) => `${A === 0 ? "M" : "L"}${m.x},${m.y}`).join(" ")} Z`,
|
|
987
|
+
outline: H(w, {
|
|
988
|
+
wander: wr,
|
|
989
|
+
seed: R(r),
|
|
990
|
+
closed: !0,
|
|
991
|
+
step: 12
|
|
992
|
+
}),
|
|
993
|
+
bounds: {
|
|
994
|
+
x: e.width / 2 - d,
|
|
995
|
+
y: e.height / 2 - d,
|
|
996
|
+
width: d * 2,
|
|
997
|
+
height: d * 2
|
|
998
|
+
},
|
|
999
|
+
startAngle: o,
|
|
1000
|
+
inner: g,
|
|
1001
|
+
outer: d
|
|
1002
|
+
};
|
|
1003
|
+
}, Ir = (t) => t.length > 1 && t.every(({ inner: r, outer: e }) => Math.abs(e - (t[0]?.outer ?? 0)) < 0.5 && Math.abs(r - (t[0]?.inner ?? 0)) < 0.5), xt = ({ layer: t, observations: r, panel: e, state: a }) => {
|
|
1004
|
+
const o = M(t), l = O(() => W(t.data, t.mapping, t.id), [
|
|
1005
|
+
t.data,
|
|
1006
|
+
t.mapping,
|
|
1007
|
+
t.id
|
|
1008
|
+
]);
|
|
1009
|
+
if (e.width <= 0 || e.height <= 0) return null;
|
|
1010
|
+
const s = a === "hovered", n = Array.from(r, (i) => ({
|
|
1011
|
+
key: l(i),
|
|
1012
|
+
observation: i
|
|
1013
|
+
})), h = n.flatMap(({ key: i, observation: u }) => mt(u, i, e, 0) ?? []), d = !s && Ir(h), g = d ? h : n.flatMap(({ key: i, observation: u }) => mt(u, i, e, Er) ?? []), p = {
|
|
1014
|
+
x: e.width / 2,
|
|
1015
|
+
y: e.height / 2
|
|
1016
|
+
};
|
|
1017
|
+
return /* @__PURE__ */ _("g", {
|
|
1018
|
+
"data-geom": "bar",
|
|
1019
|
+
children: [g.map(({ key: i, observation: u, region: y, outline: x, bounds: E }, w) => {
|
|
1020
|
+
const m = o(u, a), A = R(i);
|
|
1021
|
+
return /* @__PURE__ */ _("g", {
|
|
1022
|
+
opacity: m.opacity,
|
|
1023
|
+
children: [/* @__PURE__ */ c(et, {
|
|
1024
|
+
region: y,
|
|
1025
|
+
bounds: E,
|
|
1026
|
+
color: m.color,
|
|
1027
|
+
angle: tt(m.color, w) + (w % 2 === 0 ? 0 : Math.PI / 2),
|
|
1028
|
+
spacing: s ? vt * Sr : vt,
|
|
1029
|
+
width: kr,
|
|
1030
|
+
seed: A,
|
|
1031
|
+
pressure: m.fillOpacity
|
|
1032
|
+
}), !d && /* @__PURE__ */ c($, {
|
|
1033
|
+
path: x,
|
|
1034
|
+
color: s ? m.edge : m.color,
|
|
1035
|
+
width: m.edgeWidth,
|
|
1036
|
+
seed: A
|
|
1037
|
+
})]
|
|
1038
|
+
}, i);
|
|
1039
|
+
}), d && /* @__PURE__ */ _("g", { children: [g.map(({ key: i, startAngle: u, inner: y, outer: x }) => /* @__PURE__ */ c($, {
|
|
1040
|
+
path: H([V(e, u, y), V(e, u, x)], {
|
|
1041
|
+
wander: 0.8,
|
|
1042
|
+
seed: R(i) + 5,
|
|
1043
|
+
step: 14
|
|
1044
|
+
}),
|
|
1045
|
+
color: ft,
|
|
1046
|
+
width: Hr,
|
|
1047
|
+
seed: R(i) + 6
|
|
1048
|
+
}, i)), [g[0]?.outer ?? 0, g[0]?.inner ?? 0].filter((i) => i > 0).map((i, u) => /* @__PURE__ */ c($, {
|
|
1049
|
+
path: Q(p, i, {
|
|
1050
|
+
seed: 31 + u * 17,
|
|
1051
|
+
overshoot: Rr,
|
|
1052
|
+
wander: $r,
|
|
1053
|
+
drift: u === 0 ? _r : -5
|
|
1054
|
+
}),
|
|
1055
|
+
color: ft,
|
|
1056
|
+
width: Cr,
|
|
1057
|
+
seed: 41 + u
|
|
1058
|
+
}, i))] })]
|
|
1059
|
+
});
|
|
1060
|
+
}, Pr = P("bar", {
|
|
1061
|
+
coord: "polar",
|
|
1062
|
+
guideMode: "band",
|
|
1063
|
+
swatchShape: "slice",
|
|
1064
|
+
render: ({ layer: t, panelRect: r }) => /* @__PURE__ */ c(xt, {
|
|
1065
|
+
layer: t,
|
|
1066
|
+
observations: t.data,
|
|
1067
|
+
panel: r
|
|
1068
|
+
}),
|
|
1069
|
+
renderHover: ({ layer: t, primary: r, panelRect: e }) => /* @__PURE__ */ c(xt, {
|
|
1070
|
+
layer: t,
|
|
1071
|
+
observations: [r.observation],
|
|
1072
|
+
panel: e,
|
|
1073
|
+
state: "hovered"
|
|
1074
|
+
}),
|
|
1075
|
+
renderHoverCompanions: () => null
|
|
1076
|
+
}), z = 4, Mr = 1, Tr = 0.82, At = 3, br = 0.28, Or = {
|
|
1077
|
+
run: [16, 60],
|
|
1078
|
+
skip: [2, 7]
|
|
1079
|
+
}, Dr = 50, Lr = ({ layer: t, observation: r, seedKey: e, panel: a, state: o }) => {
|
|
1080
|
+
const l = M(t), s = $t("cell"), n = Gt(r);
|
|
1081
|
+
if (n === null) return null;
|
|
1082
|
+
const h = l(r, o), d = n.x * a.width + z / 2, g = n.y * a.height + z / 2, p = n.width * a.width - z, i = n.height * a.height - z;
|
|
1083
|
+
if (p <= 0 || i <= 0) return null;
|
|
1084
|
+
const u = R(e), y = D(u), x = H([
|
|
1085
|
+
{
|
|
1086
|
+
x: d,
|
|
1087
|
+
y: g
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
x: d + p,
|
|
1091
|
+
y: g
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
x: d + p,
|
|
1095
|
+
y: g + i
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
x: d,
|
|
1099
|
+
y: g + i
|
|
1100
|
+
}
|
|
1101
|
+
], {
|
|
1102
|
+
wander: Math.min(Mr, p / 10, i / 10),
|
|
1103
|
+
seed: u,
|
|
1104
|
+
closed: !0,
|
|
1105
|
+
cornered: !0
|
|
1106
|
+
}), E = i / At, w = Array.from({ length: At }, (A, C) => {
|
|
1107
|
+
const N = g + E * (C + 0.5), Tt = y() * Dr;
|
|
1108
|
+
return H([{
|
|
1109
|
+
x: d - 2 - Tt,
|
|
1110
|
+
y: N + (y() - 0.5) * 2
|
|
1111
|
+
}, {
|
|
1112
|
+
x: d + p + 2,
|
|
1113
|
+
y: N + (y() - 0.5) * 2
|
|
1114
|
+
}], {
|
|
1115
|
+
wander: 1.2,
|
|
1116
|
+
seed: u + C + 1,
|
|
1117
|
+
step: 16
|
|
1118
|
+
});
|
|
1119
|
+
}), m = o === "hovered";
|
|
1120
|
+
return /* @__PURE__ */ _("g", {
|
|
1121
|
+
opacity: h.opacity,
|
|
1122
|
+
children: [
|
|
1123
|
+
/* @__PURE__ */ c("clipPath", {
|
|
1124
|
+
id: s,
|
|
1125
|
+
children: /* @__PURE__ */ c("path", { d: x })
|
|
1126
|
+
}),
|
|
1127
|
+
/* @__PURE__ */ c("path", {
|
|
1128
|
+
d: x,
|
|
1129
|
+
fill: h.color,
|
|
1130
|
+
fillOpacity: h.fillOpacity * Tr
|
|
1131
|
+
}),
|
|
1132
|
+
/* @__PURE__ */ c("g", {
|
|
1133
|
+
clipPath: `url(#${s})`,
|
|
1134
|
+
fill: "none",
|
|
1135
|
+
stroke: h.color,
|
|
1136
|
+
strokeOpacity: br,
|
|
1137
|
+
children: w.map((A, C) => /* @__PURE__ */ c("path", {
|
|
1138
|
+
d: A,
|
|
1139
|
+
strokeWidth: E * 0.8,
|
|
1140
|
+
strokeDasharray: L(Or, u + C)
|
|
1141
|
+
}, C))
|
|
1142
|
+
}),
|
|
1143
|
+
m && /* @__PURE__ */ c($, {
|
|
1144
|
+
path: x,
|
|
1145
|
+
color: h.edge,
|
|
1146
|
+
width: h.edgeWidth,
|
|
1147
|
+
seed: u
|
|
1148
|
+
})
|
|
1149
|
+
]
|
|
1150
|
+
});
|
|
1151
|
+
}, wt = ({ layer: t, observations: r, panel: e, state: a }) => {
|
|
1152
|
+
const o = O(() => Lt(t.data, t.mapping, t.id), [
|
|
1153
|
+
t.data,
|
|
1154
|
+
t.mapping,
|
|
1155
|
+
t.id
|
|
1156
|
+
]);
|
|
1157
|
+
return e.width <= 0 || e.height <= 0 ? null : /* @__PURE__ */ c("g", {
|
|
1158
|
+
"data-geom": "tile",
|
|
1159
|
+
children: Array.from(r, (l) => {
|
|
1160
|
+
const s = o(l);
|
|
1161
|
+
return /* @__PURE__ */ c(Lr, {
|
|
1162
|
+
layer: t,
|
|
1163
|
+
observation: l,
|
|
1164
|
+
seedKey: s,
|
|
1165
|
+
panel: e,
|
|
1166
|
+
state: a
|
|
1167
|
+
}, s);
|
|
1168
|
+
})
|
|
1169
|
+
});
|
|
1170
|
+
}, Wr = P("tile", {
|
|
1171
|
+
coord: "cartesian",
|
|
1172
|
+
guideMode: null,
|
|
1173
|
+
swatchShape: "square",
|
|
1174
|
+
render: ({ layer: t, panelRect: r }) => /* @__PURE__ */ c(wt, {
|
|
1175
|
+
layer: t,
|
|
1176
|
+
observations: t.data,
|
|
1177
|
+
panel: r
|
|
1178
|
+
}),
|
|
1179
|
+
renderHover: ({ layer: t, primary: r, panelRect: e }) => /* @__PURE__ */ c(wt, {
|
|
1180
|
+
layer: t,
|
|
1181
|
+
observations: [r.observation],
|
|
1182
|
+
panel: e,
|
|
1183
|
+
state: "hovered"
|
|
1184
|
+
}),
|
|
1185
|
+
renderHoverCompanions: () => null
|
|
1186
|
+
}), Nr = [
|
|
1187
|
+
tr,
|
|
1188
|
+
Pr,
|
|
1189
|
+
Wr,
|
|
1190
|
+
sr,
|
|
1191
|
+
dr,
|
|
1192
|
+
Ge,
|
|
1193
|
+
Be,
|
|
1194
|
+
mr,
|
|
1195
|
+
xr
|
|
1196
|
+
], Gr = 0.3, Br = 2, Fr = ({ fill: t, fillOpacity: r, ...e }) => /* @__PURE__ */ c(Ot, {
|
|
1197
|
+
...e,
|
|
1198
|
+
fill: t,
|
|
1199
|
+
fillOpacity: Gr,
|
|
1200
|
+
stroke: t,
|
|
1201
|
+
strokeWidth: Br
|
|
1202
|
+
}), Kr = { Circle: Fr }, Vr = {
|
|
1203
|
+
name: "chalkboard",
|
|
1204
|
+
styles: pe,
|
|
1205
|
+
palette: _t,
|
|
1206
|
+
colormap: le,
|
|
1207
|
+
config: {
|
|
1208
|
+
axes: { y: { position: "left" } },
|
|
1209
|
+
legend: {
|
|
1210
|
+
position: "top",
|
|
1211
|
+
align: "start"
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
colorScheme: "dark",
|
|
1215
|
+
plugins: Nr,
|
|
1216
|
+
shapes: Kr
|
|
1217
|
+
};
|
|
1218
|
+
export {
|
|
1219
|
+
Vr as chalkboard
|
|
1220
|
+
};
|