@graphysdk/theme-bauhaus 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 +61 -2
- package/dist/bauhaus.d.ts +21 -0
- package/dist/frame.d.ts +4 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +882 -0
- package/dist/palette.d.ts +19 -0
- package/dist/renderer/bar-frame.d.ts +18 -0
- package/dist/renderer/bar.d.ts +9 -0
- package/dist/renderer/forms.d.ts +40 -0
- package/dist/renderer/line.d.ts +9 -0
- package/dist/renderer/overprint.d.ts +5 -0
- package/dist/renderer/paint.d.ts +21 -0
- package/dist/renderer/plugins.d.ts +7 -0
- package/dist/renderer/point.d.ts +9 -0
- package/dist/renderer/slice.d.ts +8 -0
- package/dist/renderer/trace.d.ts +22 -0
- package/dist/renderer/utils/paths.d.ts +7 -0
- package/dist/renderer/utils/projections.d.ts +14 -0
- package/dist/styles.d.ts +9 -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,882 @@
|
|
|
1
|
+
import { useMemo as P } from "react";
|
|
2
|
+
import { GROUP_VARIABLES as ge, VISUAL_VARIABLES as pe, buildPolarBarArcPath as V, createLinePathGenerator as fe, createStableKeyGenerator as M, defineGeomRenderer as H, getAngleExtent as ve, getBarRectBounds as me, getRadiusExtent as te, getStackRole as $, getX as T, getXMax as ke, getXMin as ye, getY as O, getYMax as re, getYMin as Ae, polarToUnit as be, prepareLineObservations as Se, readMainAxis as X, style as i, toPaintColor as xe, toStrokeDasharray as Re, toViewBoxX as Ee, toViewBoxY as We, useGeomStyleReader as F } from "@graphysdk/react";
|
|
3
|
+
import { jsx as p, jsxs as ae } from "react/jsx-runtime";
|
|
4
|
+
var we = {
|
|
5
|
+
solo: {
|
|
6
|
+
base: !0,
|
|
7
|
+
value: !0
|
|
8
|
+
},
|
|
9
|
+
floor: {
|
|
10
|
+
base: !0,
|
|
11
|
+
value: !1
|
|
12
|
+
},
|
|
13
|
+
ceiling: {
|
|
14
|
+
base: !1,
|
|
15
|
+
value: !0
|
|
16
|
+
},
|
|
17
|
+
middle: {
|
|
18
|
+
base: !1,
|
|
19
|
+
value: !1
|
|
20
|
+
}
|
|
21
|
+
}, Le = {
|
|
22
|
+
top: "bottom",
|
|
23
|
+
bottom: "top",
|
|
24
|
+
left: "right",
|
|
25
|
+
right: "left"
|
|
26
|
+
}, _e = (e, t) => t === "x" ? (re(e) ?? O(e) ?? 0) >= (Ae(e) ?? 0) ? "top" : "bottom" : (ke(e) ?? 0) >= (ye(e) ?? 0) ? "right" : "left", Pe = (e, t, a) => {
|
|
27
|
+
const o = Math.max(0, e.width - a), r = Math.max(0, e.height - a);
|
|
28
|
+
return t === "top" ? {
|
|
29
|
+
...e,
|
|
30
|
+
y: e.y + e.height - r,
|
|
31
|
+
height: r
|
|
32
|
+
} : t === "bottom" ? {
|
|
33
|
+
...e,
|
|
34
|
+
height: r
|
|
35
|
+
} : t === "left" ? {
|
|
36
|
+
...e,
|
|
37
|
+
x: e.x + e.width - o,
|
|
38
|
+
width: o
|
|
39
|
+
} : {
|
|
40
|
+
...e,
|
|
41
|
+
width: o
|
|
42
|
+
};
|
|
43
|
+
}, Me = (e, t, a, o) => {
|
|
44
|
+
const r = me(t, e);
|
|
45
|
+
if (!r || r.width <= 0 || r.height <= 0) return null;
|
|
46
|
+
const n = we[$(e)], s = _e(e, t), h = {
|
|
47
|
+
x: r.x * a.width,
|
|
48
|
+
y: r.y * a.height,
|
|
49
|
+
width: r.width * a.width,
|
|
50
|
+
height: r.height * a.height
|
|
51
|
+
}, l = [n.value ? [] : [s], n.base ? [] : [Le[s]]].flat().reduce((m, y) => Pe(m, y, o / 2), h), c = s === "top" || s === "bottom", u = c ? l.width : l.height, g = c ? l.height : l.width;
|
|
52
|
+
if (u <= 0 || g <= 0) return null;
|
|
53
|
+
const { x: f, y: k, width: R, height: E } = l, W = (m, y) => s === "top" ? {
|
|
54
|
+
x: f + m,
|
|
55
|
+
y: k + E - y
|
|
56
|
+
} : s === "bottom" ? {
|
|
57
|
+
x: f + m,
|
|
58
|
+
y: k + y
|
|
59
|
+
} : s === "right" ? {
|
|
60
|
+
x: f + y,
|
|
61
|
+
y: k + m
|
|
62
|
+
} : {
|
|
63
|
+
x: f + R - y,
|
|
64
|
+
y: k + m
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
breadth: u,
|
|
68
|
+
length: g,
|
|
69
|
+
endsStack: n.value,
|
|
70
|
+
isSolo: n.base && n.value,
|
|
71
|
+
at: W
|
|
72
|
+
};
|
|
73
|
+
}, He = ({ x: e, y: t }) => `${Math.round(e * 100) / 100},${Math.round(t * 100) / 100}`, Te = (e, t) => `${t.map((a, o) => {
|
|
74
|
+
const r = a.map(([n, s]) => He(e.at(n, s)));
|
|
75
|
+
return o === 0 ? `M${r.join(" ")}` : a.length === 3 ? `C${r.join(" ")}` : `L${r.join(" ")}`;
|
|
76
|
+
}).join(" ")} Z`, D = (e) => {
|
|
77
|
+
const t = F(e);
|
|
78
|
+
return (a, o) => ({
|
|
79
|
+
color: xe(t.get("fill", a, o)),
|
|
80
|
+
opacity: t.get("alpha", a, o),
|
|
81
|
+
fillOpacity: t.get("fillAlpha", a, o),
|
|
82
|
+
edge: t.get("stroke", a, o),
|
|
83
|
+
edgeWidth: t.get("strokeWidth", a, o)
|
|
84
|
+
});
|
|
85
|
+
}, oe = (e) => {
|
|
86
|
+
const t = F(e);
|
|
87
|
+
return (a, o) => {
|
|
88
|
+
const r = t.get("strokeWidth", a, o);
|
|
89
|
+
return {
|
|
90
|
+
color: t.get("stroke", a, o),
|
|
91
|
+
opacity: t.get("alpha", a, o) * t.get("strokeAlpha", a, o),
|
|
92
|
+
width: r,
|
|
93
|
+
dashArray: Re(t.get("dashArray", a, o), r)
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
}, Oe = 2, Be = (e) => {
|
|
97
|
+
const { breadth: t, length: a } = e;
|
|
98
|
+
return Te(e, [
|
|
99
|
+
[[0, 0]],
|
|
100
|
+
[[0, a]],
|
|
101
|
+
[[t, a]],
|
|
102
|
+
[[t, 0]]
|
|
103
|
+
]);
|
|
104
|
+
}, j = ({ layer: e, observations: t, mainAxis: a, panel: o, state: r }) => {
|
|
105
|
+
const n = D(e), s = P(() => M(e.data, e.mapping, e.id), [
|
|
106
|
+
e.data,
|
|
107
|
+
e.mapping,
|
|
108
|
+
e.id
|
|
109
|
+
]);
|
|
110
|
+
if (o.width <= 0 || o.height <= 0) return null;
|
|
111
|
+
const h = [...t].flatMap((c) => {
|
|
112
|
+
const u = Me(c, a, o, Oe);
|
|
113
|
+
if (u === null) return [];
|
|
114
|
+
const g = n(c, r);
|
|
115
|
+
return [{
|
|
116
|
+
key: s(c),
|
|
117
|
+
frame: u,
|
|
118
|
+
paint: g
|
|
119
|
+
}];
|
|
120
|
+
}), l = r === "hovered";
|
|
121
|
+
return /* @__PURE__ */ p("g", {
|
|
122
|
+
"data-geom": "bar",
|
|
123
|
+
children: h.map(({ key: c, frame: u, paint: g }) => /* @__PURE__ */ p("g", {
|
|
124
|
+
opacity: g.opacity,
|
|
125
|
+
children: /* @__PURE__ */ p("path", {
|
|
126
|
+
d: Be(u),
|
|
127
|
+
fill: g.color,
|
|
128
|
+
fillOpacity: g.fillOpacity,
|
|
129
|
+
stroke: l ? g.edge : void 0,
|
|
130
|
+
strokeWidth: l ? g.edgeWidth : void 0,
|
|
131
|
+
strokeLinejoin: "miter"
|
|
132
|
+
})
|
|
133
|
+
}, c))
|
|
134
|
+
});
|
|
135
|
+
}, Ie = H("bar", {
|
|
136
|
+
coord: "cartesian",
|
|
137
|
+
guideMode: "band",
|
|
138
|
+
swatchShape: "square",
|
|
139
|
+
render: ({ layer: e, coordSystem: t, panelRect: a }) => /* @__PURE__ */ p(j, {
|
|
140
|
+
layer: e,
|
|
141
|
+
observations: e.data,
|
|
142
|
+
mainAxis: X(t),
|
|
143
|
+
panel: a
|
|
144
|
+
}),
|
|
145
|
+
renderHover: ({ layer: e, coordSystem: t, primary: a, panelRect: o }) => /* @__PURE__ */ p(j, {
|
|
146
|
+
layer: e,
|
|
147
|
+
observations: [a.observation],
|
|
148
|
+
mainAxis: X(t),
|
|
149
|
+
panel: o,
|
|
150
|
+
state: "hovered"
|
|
151
|
+
}),
|
|
152
|
+
renderHoverCompanions: () => null
|
|
153
|
+
}), d = {
|
|
154
|
+
paper: "#F3EEE1",
|
|
155
|
+
black: "#141414",
|
|
156
|
+
secondary: "#4A4640",
|
|
157
|
+
rule: "#C9C2B1"
|
|
158
|
+
}, v = {
|
|
159
|
+
red: "#D62718",
|
|
160
|
+
blue: "#1B4FA3",
|
|
161
|
+
yellow: "#E9A800",
|
|
162
|
+
black: "#141414",
|
|
163
|
+
green: "#1F7A4D",
|
|
164
|
+
orange: "#CF4F14",
|
|
165
|
+
violet: "#6A3D9A"
|
|
166
|
+
}, Ce = [
|
|
167
|
+
v.red,
|
|
168
|
+
v.blue,
|
|
169
|
+
v.yellow,
|
|
170
|
+
v.black,
|
|
171
|
+
v.green,
|
|
172
|
+
v.orange,
|
|
173
|
+
v.violet
|
|
174
|
+
], $e = [
|
|
175
|
+
v.yellow,
|
|
176
|
+
v.red,
|
|
177
|
+
v.black
|
|
178
|
+
], Fe = /[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu, De = /^[a-zA-Z]$/u, Ue = (e, t) => e === "H" ? "x" : e === "V" ? "y" : t % 2 === 0 ? "x" : "y", ze = (e, t) => {
|
|
179
|
+
let a = "", o = 0;
|
|
180
|
+
return (e.match(Fe) ?? []).map((r) => {
|
|
181
|
+
if (De.test(r))
|
|
182
|
+
return a = r.toUpperCase(), o = 0, r;
|
|
183
|
+
const n = Ue(a, o);
|
|
184
|
+
return o += 1, String(Number(r) * (n === "x" ? t.width : t.height));
|
|
185
|
+
}).join(" ");
|
|
186
|
+
}, ne = (e, t) => {
|
|
187
|
+
const a = T(e), o = O(e) ?? re(e);
|
|
188
|
+
return a === null || o === null ? null : {
|
|
189
|
+
x: Ee(a) * t.width,
|
|
190
|
+
y: We(o) * t.height
|
|
191
|
+
};
|
|
192
|
+
}, U = (e, t) => {
|
|
193
|
+
const a = T(e), o = O(e) ?? te(e).outerRadius;
|
|
194
|
+
if (a === null || o === null) return null;
|
|
195
|
+
const r = be(a, o), n = Math.min(t.width, t.height) / 2;
|
|
196
|
+
return {
|
|
197
|
+
x: t.width / 2 + r.x * n,
|
|
198
|
+
y: t.height / 2 - r.y * n
|
|
199
|
+
};
|
|
200
|
+
}, Ne = (e) => `${e.map((t, a) => `${a === 0 ? "M" : "L"}${t.x},${t.y}`).join(" ")} Z`, ie = [
|
|
201
|
+
[v.red, "square"],
|
|
202
|
+
[v.blue, "circle"],
|
|
203
|
+
[v.yellow, "triangle"],
|
|
204
|
+
[v.black, "diamond"],
|
|
205
|
+
[v.green, "cross"],
|
|
206
|
+
[v.orange, "triangle"],
|
|
207
|
+
[v.violet, "square"]
|
|
208
|
+
], Ge = new Map(ie.map(([e, t]) => [e.toUpperCase(), t])), z = (e) => Ge.get(e.toUpperCase()) ?? "circle", q = Math.sqrt(3), Ve = 5, _ = ({ x: e, y: t }) => `${Math.round(e * 100) / 100},${Math.round(t * 100) / 100}`, w = (e) => `${e.map((t, a) => `${a === 0 ? "M" : "L"}${_(t)}`).join(" ")} Z`, Xe = (e, t, a) => {
|
|
209
|
+
const o = Math.PI * (a / 2) ** 2, { x: r, y: n } = t;
|
|
210
|
+
if (e === "square" || e === "diamond") {
|
|
211
|
+
const h = Math.sqrt(o) / 2;
|
|
212
|
+
if (e === "square") return w([
|
|
213
|
+
{
|
|
214
|
+
x: r - h,
|
|
215
|
+
y: n - h
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
x: r + h,
|
|
219
|
+
y: n - h
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
x: r + h,
|
|
223
|
+
y: n + h
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
x: r - h,
|
|
227
|
+
y: n + h
|
|
228
|
+
}
|
|
229
|
+
]);
|
|
230
|
+
const l = h * Math.SQRT2;
|
|
231
|
+
return w([
|
|
232
|
+
{
|
|
233
|
+
x: r,
|
|
234
|
+
y: n - l
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
x: r + l,
|
|
238
|
+
y: n
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
x: r,
|
|
242
|
+
y: n + l
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
x: r - l,
|
|
246
|
+
y: n
|
|
247
|
+
}
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
if (e === "triangle") {
|
|
251
|
+
const h = Math.sqrt(4 * o / q), l = h * q / 2;
|
|
252
|
+
return w([
|
|
253
|
+
{
|
|
254
|
+
x: r,
|
|
255
|
+
y: n - l * 2 / 3
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
x: r + h / 2,
|
|
259
|
+
y: n + l / 3
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
x: r - h / 2,
|
|
263
|
+
y: n + l / 3
|
|
264
|
+
}
|
|
265
|
+
]);
|
|
266
|
+
}
|
|
267
|
+
if (e === "cross") {
|
|
268
|
+
const h = Math.sqrt(o / Ve), l = h / 2, c = h * 1.5;
|
|
269
|
+
return w([
|
|
270
|
+
{
|
|
271
|
+
x: r - l,
|
|
272
|
+
y: n - c
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
x: r + l,
|
|
276
|
+
y: n - c
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
x: r + l,
|
|
280
|
+
y: n - l
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
x: r + c,
|
|
284
|
+
y: n - l
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
x: r + c,
|
|
288
|
+
y: n + l
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
x: r + l,
|
|
292
|
+
y: n + l
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
x: r + l,
|
|
296
|
+
y: n + c
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
x: r - l,
|
|
300
|
+
y: n + c
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
x: r - l,
|
|
304
|
+
y: n + l
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
x: r - c,
|
|
308
|
+
y: n + l
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
x: r - c,
|
|
312
|
+
y: n - l
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
x: r - l,
|
|
316
|
+
y: n - l
|
|
317
|
+
}
|
|
318
|
+
]);
|
|
319
|
+
}
|
|
320
|
+
const s = a / 2;
|
|
321
|
+
return `M${_({
|
|
322
|
+
x: r - s,
|
|
323
|
+
y: n
|
|
324
|
+
})} A${s},${s} 0 1 0 ${_({
|
|
325
|
+
x: r + s,
|
|
326
|
+
y: n
|
|
327
|
+
})} A${s},${s} 0 1 0 ${_({
|
|
328
|
+
x: r - s,
|
|
329
|
+
y: n
|
|
330
|
+
})} Z`;
|
|
331
|
+
}, N = ({ form: e, centre: t, size: a, color: o, opacity: r, fillOpacity: n, edge: s, edgeWidth: h = 0 }) => /* @__PURE__ */ p("path", {
|
|
332
|
+
"data-form": e,
|
|
333
|
+
d: Xe(e, t, a),
|
|
334
|
+
fill: o,
|
|
335
|
+
fillOpacity: n,
|
|
336
|
+
opacity: r,
|
|
337
|
+
stroke: h > 0 ? s : void 0,
|
|
338
|
+
strokeWidth: h > 0 ? h : void 0,
|
|
339
|
+
strokeLinejoin: "miter"
|
|
340
|
+
}), Y = (e, t, a, o) => {
|
|
341
|
+
const r = M(e.data, e.mapping, e.id), n = [];
|
|
342
|
+
return e.data.groupBy(ge.group).forEach((s) => {
|
|
343
|
+
const h = [...s], [l] = h, c = o(h);
|
|
344
|
+
if (l === void 0 || c === null) return;
|
|
345
|
+
const u = h.flatMap((g) => {
|
|
346
|
+
const f = a(g, t);
|
|
347
|
+
return f === null ? [] : [{
|
|
348
|
+
key: r(g),
|
|
349
|
+
observation: g,
|
|
350
|
+
point: f
|
|
351
|
+
}];
|
|
352
|
+
});
|
|
353
|
+
n.push({
|
|
354
|
+
key: r(l),
|
|
355
|
+
observation: l,
|
|
356
|
+
path: c,
|
|
357
|
+
readings: u
|
|
358
|
+
});
|
|
359
|
+
}), n;
|
|
360
|
+
}, je = (e, t) => {
|
|
361
|
+
const a = e.flatMap((o) => {
|
|
362
|
+
const r = T(o), n = U(o, t);
|
|
363
|
+
return r === null || n === null ? [] : [{
|
|
364
|
+
angle: r,
|
|
365
|
+
point: n
|
|
366
|
+
}];
|
|
367
|
+
}).sort((o, r) => o.angle - r.angle).map(({ point: o }) => o);
|
|
368
|
+
return a.length === 0 ? null : Ne(a);
|
|
369
|
+
}, qe = 4, Ye = 11, le = 1.5, Ke = 1.8, Ze = 5, se = (e) => Math.max(Ye, e * qe), Je = (e, t) => {
|
|
370
|
+
const a = t * Ke;
|
|
371
|
+
return e.every(({ readings: o }) => o.every(({ point: r }, n) => {
|
|
372
|
+
const s = o[n + 1]?.point;
|
|
373
|
+
return s === void 0 || Math.hypot(s.x - r.x, s.y - r.y) >= a;
|
|
374
|
+
}));
|
|
375
|
+
}, Qe = ({ layer: e, panel: t, coord: a, project: o }) => {
|
|
376
|
+
const r = oe(e), n = P(() => {
|
|
377
|
+
if (a === "polar") return Y(e, t, o, (u) => je(u, t));
|
|
378
|
+
const c = fe(e.params);
|
|
379
|
+
return Y(e, t, o, (u) => {
|
|
380
|
+
const g = c(Se(u, e.params.missingValues));
|
|
381
|
+
return g ? ze(g, t) : null;
|
|
382
|
+
});
|
|
383
|
+
}, [
|
|
384
|
+
e,
|
|
385
|
+
t,
|
|
386
|
+
a,
|
|
387
|
+
o
|
|
388
|
+
]);
|
|
389
|
+
if (t.width <= 0 || t.height <= 0) return null;
|
|
390
|
+
const [s] = n, h = s === void 0 ? 0 : se(r(s.observation).width), l = s !== void 0 && Je(n, h);
|
|
391
|
+
return /* @__PURE__ */ ae("g", {
|
|
392
|
+
"data-geom": "line",
|
|
393
|
+
children: [n.map((c) => {
|
|
394
|
+
const u = r(c.observation);
|
|
395
|
+
return /* @__PURE__ */ p("path", {
|
|
396
|
+
d: c.path,
|
|
397
|
+
fill: "none",
|
|
398
|
+
stroke: u.color,
|
|
399
|
+
strokeWidth: u.width,
|
|
400
|
+
strokeDasharray: u.dashArray,
|
|
401
|
+
strokeLinecap: "butt",
|
|
402
|
+
strokeLinejoin: "miter",
|
|
403
|
+
opacity: u.opacity
|
|
404
|
+
}, c.key);
|
|
405
|
+
}), l && n.flatMap((c) => {
|
|
406
|
+
const u = r(c.observation), g = z(u.color);
|
|
407
|
+
return c.readings.map((f) => /* @__PURE__ */ p(N, {
|
|
408
|
+
form: g,
|
|
409
|
+
centre: f.point,
|
|
410
|
+
size: h,
|
|
411
|
+
color: u.color,
|
|
412
|
+
opacity: u.opacity,
|
|
413
|
+
edge: d.paper,
|
|
414
|
+
edgeWidth: le
|
|
415
|
+
}, f.key));
|
|
416
|
+
})]
|
|
417
|
+
});
|
|
418
|
+
}, et = ({ layer: e, observation: t, panel: a, project: o }) => {
|
|
419
|
+
const r = oe(e)(t, "hovered"), n = o(t, a);
|
|
420
|
+
return n === null ? null : /* @__PURE__ */ p("g", {
|
|
421
|
+
"data-geom": "line",
|
|
422
|
+
children: /* @__PURE__ */ p(N, {
|
|
423
|
+
form: z(r.color),
|
|
424
|
+
centre: n,
|
|
425
|
+
size: se(r.width) + Ze,
|
|
426
|
+
color: r.color,
|
|
427
|
+
opacity: r.opacity,
|
|
428
|
+
edge: d.black,
|
|
429
|
+
edgeWidth: le
|
|
430
|
+
})
|
|
431
|
+
});
|
|
432
|
+
}, de = (e, t) => H("line", {
|
|
433
|
+
coord: e,
|
|
434
|
+
guideMode: "crosshair",
|
|
435
|
+
swatchShape: "line",
|
|
436
|
+
render: ({ layer: a, panelRect: o }) => /* @__PURE__ */ p(Qe, {
|
|
437
|
+
layer: a,
|
|
438
|
+
panel: o,
|
|
439
|
+
coord: e,
|
|
440
|
+
project: t
|
|
441
|
+
}),
|
|
442
|
+
renderHover: ({ layer: a, primary: o, panelRect: r }) => /* @__PURE__ */ p(et, {
|
|
443
|
+
layer: a,
|
|
444
|
+
observation: o.observation,
|
|
445
|
+
panel: r,
|
|
446
|
+
project: t
|
|
447
|
+
}),
|
|
448
|
+
renderHoverCompanions: () => null,
|
|
449
|
+
getOverlayAnchor: ({ observation: a }) => {
|
|
450
|
+
const o = T(a), r = O(a);
|
|
451
|
+
return o === null || r === null ? null : {
|
|
452
|
+
x: o,
|
|
453
|
+
y: r
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
}), tt = de("cartesian", ne), rt = de("polar", U), at = { isolation: "isolate" }, ot = { mixBlendMode: "multiply" }, nt = 5, it = /* @__PURE__ */ new Set([
|
|
457
|
+
"square",
|
|
458
|
+
"circle",
|
|
459
|
+
"triangle",
|
|
460
|
+
"diamond",
|
|
461
|
+
"cross"
|
|
462
|
+
]), lt = (e, t) => it.has(e) ? e : z(t), K = ({ layer: e, observations: t, panel: a, project: o, state: r }) => {
|
|
463
|
+
const n = F(e), s = D(e), h = P(() => M(e.data, e.mapping, e.id), [
|
|
464
|
+
e.data,
|
|
465
|
+
e.mapping,
|
|
466
|
+
e.id
|
|
467
|
+
]), l = r === "hovered", c = l ? nt : 0;
|
|
468
|
+
return /* @__PURE__ */ p("g", {
|
|
469
|
+
"data-geom": "point",
|
|
470
|
+
style: l ? void 0 : at,
|
|
471
|
+
children: Array.from(t, (u) => {
|
|
472
|
+
const g = o(u, a);
|
|
473
|
+
if (g === null) return null;
|
|
474
|
+
const f = s(u, r);
|
|
475
|
+
return /* @__PURE__ */ p("g", {
|
|
476
|
+
style: l ? void 0 : ot,
|
|
477
|
+
children: /* @__PURE__ */ p(N, {
|
|
478
|
+
form: lt(String(n.get("symbol", u, r)), f.color),
|
|
479
|
+
centre: g,
|
|
480
|
+
size: n.get("size", u, r) + c,
|
|
481
|
+
color: f.color,
|
|
482
|
+
opacity: f.opacity,
|
|
483
|
+
fillOpacity: f.fillOpacity,
|
|
484
|
+
edge: f.edge,
|
|
485
|
+
edgeWidth: l ? f.edgeWidth : 0
|
|
486
|
+
})
|
|
487
|
+
}, h(u));
|
|
488
|
+
})
|
|
489
|
+
});
|
|
490
|
+
}, he = (e, t) => H("point", {
|
|
491
|
+
coord: e,
|
|
492
|
+
swatchShape: "circle",
|
|
493
|
+
render: ({ layer: a, panelRect: o }) => /* @__PURE__ */ p(K, {
|
|
494
|
+
layer: a,
|
|
495
|
+
observations: a.data,
|
|
496
|
+
panel: o,
|
|
497
|
+
project: t
|
|
498
|
+
}),
|
|
499
|
+
renderHover: ({ layer: a, primary: o, panelRect: r }) => /* @__PURE__ */ p(K, {
|
|
500
|
+
layer: a,
|
|
501
|
+
observations: [o.observation],
|
|
502
|
+
panel: r,
|
|
503
|
+
project: t,
|
|
504
|
+
state: "hovered"
|
|
505
|
+
}),
|
|
506
|
+
renderHoverCompanions: () => null
|
|
507
|
+
}), st = he("cartesian", ne), dt = he("polar", U), ht = 4, ct = 0.5, ut = 2, gt = 3, Z = 1e-6, J = (e, t, a) => [...e].flatMap((o) => {
|
|
508
|
+
const { startAngle: r, endAngle: n } = ve(o), { innerRadius: s, outerRadius: h } = te(o);
|
|
509
|
+
return r === null || n === null || s === null || h === null ? [] : n <= r || h <= 0 ? [] : [{
|
|
510
|
+
key: `${a(o)}-${r}`,
|
|
511
|
+
observation: o,
|
|
512
|
+
paint: t(o),
|
|
513
|
+
startAngle: r,
|
|
514
|
+
endAngle: n,
|
|
515
|
+
innerRadius: s,
|
|
516
|
+
outerRadius: h
|
|
517
|
+
}];
|
|
518
|
+
}), pt = (e) => {
|
|
519
|
+
const [t] = e;
|
|
520
|
+
return t === void 0 ? !1 : e.every((a) => Math.abs(a.innerRadius - t.innerRadius) < Z && Math.abs(a.outerRadius - t.outerRadius) < Z);
|
|
521
|
+
}, Q = ({ layer: e, observations: t, panel: a, state: o }) => {
|
|
522
|
+
const r = D(e), n = P(() => M(e.data, e.mapping, e.id), [
|
|
523
|
+
e.data,
|
|
524
|
+
e.mapping,
|
|
525
|
+
e.id
|
|
526
|
+
]), s = Math.min(a.width, a.height) / 2;
|
|
527
|
+
if (s <= 0) return null;
|
|
528
|
+
const h = J(t, (g) => r(g, o), n), l = pt(J(e.data, (g) => r(g), n)), c = o === "hovered", u = {
|
|
529
|
+
centerX: a.width / 2,
|
|
530
|
+
centerY: a.height / 2,
|
|
531
|
+
radius: s,
|
|
532
|
+
digits: gt
|
|
533
|
+
};
|
|
534
|
+
return /* @__PURE__ */ p("g", {
|
|
535
|
+
"data-geom": "bar",
|
|
536
|
+
children: h.map(({ key: g, observation: f, paint: k, startAngle: R, endAngle: E, innerRadius: W, outerRadius: m }) => {
|
|
537
|
+
const y = V({
|
|
538
|
+
startAngle: R,
|
|
539
|
+
endAngle: E,
|
|
540
|
+
innerRadius: W,
|
|
541
|
+
outerRadius: m
|
|
542
|
+
}, u);
|
|
543
|
+
if (y === void 0) return null;
|
|
544
|
+
const ce = (m - W) * s, ue = Math.min(ht, ce * ct) / s, G = !l && $(f) !== "floor" && $(f) !== "middle" ? V({
|
|
545
|
+
startAngle: R,
|
|
546
|
+
endAngle: E,
|
|
547
|
+
innerRadius: m - ue,
|
|
548
|
+
outerRadius: m
|
|
549
|
+
}, u) : void 0;
|
|
550
|
+
return /* @__PURE__ */ ae("g", {
|
|
551
|
+
opacity: k.opacity,
|
|
552
|
+
children: [/* @__PURE__ */ p("path", {
|
|
553
|
+
d: y,
|
|
554
|
+
fill: k.color,
|
|
555
|
+
fillOpacity: k.fillOpacity,
|
|
556
|
+
stroke: c ? k.edge : d.paper,
|
|
557
|
+
strokeWidth: c ? k.edgeWidth : ut,
|
|
558
|
+
strokeLinejoin: "miter"
|
|
559
|
+
}), G !== void 0 && /* @__PURE__ */ p("path", {
|
|
560
|
+
"data-value-rule": "",
|
|
561
|
+
d: G,
|
|
562
|
+
fill: d.black
|
|
563
|
+
})]
|
|
564
|
+
}, g);
|
|
565
|
+
})
|
|
566
|
+
});
|
|
567
|
+
}, ft = H("bar", {
|
|
568
|
+
coord: "polar",
|
|
569
|
+
guideMode: "band",
|
|
570
|
+
swatchShape: "slice",
|
|
571
|
+
render: ({ layer: e, panelRect: t }) => /* @__PURE__ */ p(Q, {
|
|
572
|
+
layer: e,
|
|
573
|
+
observations: e.data,
|
|
574
|
+
panel: t
|
|
575
|
+
}),
|
|
576
|
+
renderHover: ({ layer: e, primary: t, panelRect: a }) => /* @__PURE__ */ p(Q, {
|
|
577
|
+
layer: e,
|
|
578
|
+
observations: [t.observation],
|
|
579
|
+
panel: a,
|
|
580
|
+
state: "hovered"
|
|
581
|
+
}),
|
|
582
|
+
renderHoverCompanions: () => null
|
|
583
|
+
}), vt = [
|
|
584
|
+
Ie,
|
|
585
|
+
ft,
|
|
586
|
+
tt,
|
|
587
|
+
rt,
|
|
588
|
+
st,
|
|
589
|
+
dt
|
|
590
|
+
];
|
|
591
|
+
var mt = (e) => {
|
|
592
|
+
const t = `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect x="0" y="0" width="100%" height="10" fill="${e}"/></svg>`;
|
|
593
|
+
return `data:image/svg+xml,${encodeURIComponent(t)}`;
|
|
594
|
+
}, kt = "'Jost', 'Futura', ui-sans-serif, system-ui, sans-serif", yt = 2.5, L = 24, B = 1, I = 2.5, At = 14, C = 3, bt = 0.18, St = 18, xt = 3.5, b = { textColor: d.black }, S = { textColor: d.secondary }, A = {
|
|
595
|
+
textTransform: "uppercase",
|
|
596
|
+
letterSpacing: 1.2
|
|
597
|
+
}, x = {
|
|
598
|
+
...A,
|
|
599
|
+
textColor: d.paper,
|
|
600
|
+
fill: d.black,
|
|
601
|
+
stroke: d.black,
|
|
602
|
+
strokeWidth: 0,
|
|
603
|
+
cornerRadius: 0,
|
|
604
|
+
paddingInline: 8,
|
|
605
|
+
paddingBlock: 4,
|
|
606
|
+
fontWeight: 700,
|
|
607
|
+
fontSize: 11,
|
|
608
|
+
shadow: "none"
|
|
609
|
+
}, ee = {
|
|
610
|
+
stroke: d.black,
|
|
611
|
+
strokeWidth: yt,
|
|
612
|
+
dashArray: []
|
|
613
|
+
}, Rt = {
|
|
614
|
+
tokens: {
|
|
615
|
+
graphBackground: d.paper,
|
|
616
|
+
graphBorder: d.black,
|
|
617
|
+
geom: v.red,
|
|
618
|
+
geomBorder: d.black,
|
|
619
|
+
textPrimary: d.black,
|
|
620
|
+
textSecondary: d.secondary,
|
|
621
|
+
ruleLine: d.black,
|
|
622
|
+
gridLine: d.rule,
|
|
623
|
+
hoverAffordance: d.black,
|
|
624
|
+
hoverGuideFill: "rgba(20, 20, 20, 0.07)",
|
|
625
|
+
hoverGuideLine: d.black,
|
|
626
|
+
tooltipBackground: d.paper,
|
|
627
|
+
tooltipBorder: d.black,
|
|
628
|
+
tooltipPrimaryRow: "rgba(20, 20, 20, 0.08)",
|
|
629
|
+
annotationShape: v.yellow,
|
|
630
|
+
annotationArrow: d.black,
|
|
631
|
+
differenceLabelBackground: d.paper
|
|
632
|
+
},
|
|
633
|
+
defaults: [
|
|
634
|
+
i.graph({
|
|
635
|
+
strokeWidth: 0,
|
|
636
|
+
cornerRadius: 0,
|
|
637
|
+
fontFamily: kt,
|
|
638
|
+
padding: {
|
|
639
|
+
top: L + 10,
|
|
640
|
+
bottom: L,
|
|
641
|
+
left: L,
|
|
642
|
+
right: L
|
|
643
|
+
},
|
|
644
|
+
overlay: {
|
|
645
|
+
image: mt(d.black),
|
|
646
|
+
fit: "stretch",
|
|
647
|
+
fallback: "transparent"
|
|
648
|
+
}
|
|
649
|
+
}),
|
|
650
|
+
i.geom({ shadow: "none" }, { state: "hovered" }),
|
|
651
|
+
i.geom.bar({
|
|
652
|
+
stroke: d.paper,
|
|
653
|
+
strokeWidth: B,
|
|
654
|
+
cornerRadius: "none"
|
|
655
|
+
}),
|
|
656
|
+
i.geom.bar({
|
|
657
|
+
stroke: d.black,
|
|
658
|
+
strokeWidth: I
|
|
659
|
+
}, { state: "hovered" }),
|
|
660
|
+
i.geom.line({
|
|
661
|
+
strokeWidth: xt,
|
|
662
|
+
dashArray: [],
|
|
663
|
+
lineCap: "butt",
|
|
664
|
+
lineJoin: "miter"
|
|
665
|
+
}),
|
|
666
|
+
i.geom.area({
|
|
667
|
+
fillAlpha: 1,
|
|
668
|
+
strokeWidth: B,
|
|
669
|
+
dashArray: [],
|
|
670
|
+
lineCap: "butt",
|
|
671
|
+
lineJoin: "miter"
|
|
672
|
+
}),
|
|
673
|
+
i.geom.area({ stroke: d.paper }, { coord: "cartesian" }),
|
|
674
|
+
i.geom.point({
|
|
675
|
+
size: At,
|
|
676
|
+
stroke: d.paper,
|
|
677
|
+
strokeWidth: B
|
|
678
|
+
}),
|
|
679
|
+
i.geom.point({
|
|
680
|
+
stroke: d.black,
|
|
681
|
+
strokeWidth: I
|
|
682
|
+
}, { state: "hovered" }),
|
|
683
|
+
...ie.map(([e, t]) => i.geom.point({ symbol: t }, { where: {
|
|
684
|
+
variable: pe.color,
|
|
685
|
+
eq: e
|
|
686
|
+
} })),
|
|
687
|
+
i.geom.tile({
|
|
688
|
+
cornerRadius: 0,
|
|
689
|
+
stroke: d.paper,
|
|
690
|
+
strokeWidth: 2
|
|
691
|
+
}),
|
|
692
|
+
i.geom.tile({
|
|
693
|
+
stroke: d.black,
|
|
694
|
+
strokeWidth: I
|
|
695
|
+
}, { state: "hovered" }),
|
|
696
|
+
i.geom.rule({
|
|
697
|
+
stroke: d.black,
|
|
698
|
+
strokeWidth: C,
|
|
699
|
+
dashArray: []
|
|
700
|
+
}),
|
|
701
|
+
i.geom.rule.label({ ...x }),
|
|
702
|
+
i.gridLine.x({ strokeWidth: 0 }),
|
|
703
|
+
i.gridLine.y({ strokeWidth: 0 }),
|
|
704
|
+
i.panelBorder({
|
|
705
|
+
strokeWidth: 0,
|
|
706
|
+
cornerRadius: 0
|
|
707
|
+
}),
|
|
708
|
+
i.panelBorder.left(ee),
|
|
709
|
+
i.panelBorder.bottom(ee),
|
|
710
|
+
i.tickLine({
|
|
711
|
+
stroke: d.black,
|
|
712
|
+
strokeWidth: 1.5,
|
|
713
|
+
length: 6
|
|
714
|
+
}),
|
|
715
|
+
i.tickLabel({
|
|
716
|
+
...b,
|
|
717
|
+
...A,
|
|
718
|
+
fontWeight: 500,
|
|
719
|
+
fontSize: 11,
|
|
720
|
+
lineHeight: 1,
|
|
721
|
+
letterSpacing: 0.8
|
|
722
|
+
}),
|
|
723
|
+
i.axisLabel({
|
|
724
|
+
...b,
|
|
725
|
+
...A,
|
|
726
|
+
fontWeight: 700,
|
|
727
|
+
fontSize: 11,
|
|
728
|
+
lineHeight: 1,
|
|
729
|
+
letterSpacing: 1.6
|
|
730
|
+
}),
|
|
731
|
+
i.heading({ ...b }),
|
|
732
|
+
i.heading.h1({
|
|
733
|
+
fontWeight: 700,
|
|
734
|
+
fontSize: 28,
|
|
735
|
+
lineHeight: 1.05,
|
|
736
|
+
letterSpacing: -0.3
|
|
737
|
+
}),
|
|
738
|
+
i.heading.h2({
|
|
739
|
+
...S,
|
|
740
|
+
fontWeight: 400,
|
|
741
|
+
fontSize: 15,
|
|
742
|
+
lineHeight: 1.2
|
|
743
|
+
}),
|
|
744
|
+
i.header({ margin: { bottom: St } }),
|
|
745
|
+
i.caption({
|
|
746
|
+
...S,
|
|
747
|
+
fontWeight: 400,
|
|
748
|
+
fontSize: 12
|
|
749
|
+
}),
|
|
750
|
+
i.source({
|
|
751
|
+
...S,
|
|
752
|
+
...A,
|
|
753
|
+
fontWeight: 500,
|
|
754
|
+
fontSize: 10
|
|
755
|
+
}),
|
|
756
|
+
i.source.link({
|
|
757
|
+
...S,
|
|
758
|
+
...A,
|
|
759
|
+
fontWeight: 500,
|
|
760
|
+
fontSize: 10
|
|
761
|
+
}),
|
|
762
|
+
i.dataLabel({
|
|
763
|
+
...b,
|
|
764
|
+
fontWeight: 700,
|
|
765
|
+
fontSize: 12,
|
|
766
|
+
fill: "transparent"
|
|
767
|
+
}),
|
|
768
|
+
i.legendItem({
|
|
769
|
+
...b,
|
|
770
|
+
...A,
|
|
771
|
+
fontWeight: 500,
|
|
772
|
+
fontSize: 11,
|
|
773
|
+
fill: "transparent",
|
|
774
|
+
stroke: "transparent",
|
|
775
|
+
cornerRadius: 0
|
|
776
|
+
}),
|
|
777
|
+
i.directLabel({
|
|
778
|
+
...A,
|
|
779
|
+
fontWeight: 700,
|
|
780
|
+
fontSize: 11,
|
|
781
|
+
dashArray: []
|
|
782
|
+
}),
|
|
783
|
+
i.tooltip({
|
|
784
|
+
strokeWidth: 2,
|
|
785
|
+
cornerRadius: 0,
|
|
786
|
+
paddingInline: 12,
|
|
787
|
+
paddingBlock: 10,
|
|
788
|
+
shadow: "none"
|
|
789
|
+
}),
|
|
790
|
+
i.tooltip.heading({
|
|
791
|
+
...b,
|
|
792
|
+
...A,
|
|
793
|
+
fontWeight: 700,
|
|
794
|
+
fontSize: 11,
|
|
795
|
+
lineHeight: 1.3
|
|
796
|
+
}),
|
|
797
|
+
i.tooltip.label({
|
|
798
|
+
...S,
|
|
799
|
+
fontWeight: 400,
|
|
800
|
+
fontSize: 13,
|
|
801
|
+
lineHeight: 1.3
|
|
802
|
+
}),
|
|
803
|
+
i.tooltip.value({
|
|
804
|
+
...b,
|
|
805
|
+
fontWeight: 700,
|
|
806
|
+
fontSize: 13,
|
|
807
|
+
lineHeight: 1.3
|
|
808
|
+
}),
|
|
809
|
+
i.legend.popover({
|
|
810
|
+
strokeWidth: 2,
|
|
811
|
+
cornerRadius: 0,
|
|
812
|
+
shadow: "none"
|
|
813
|
+
}),
|
|
814
|
+
i.annotation.text({
|
|
815
|
+
...x,
|
|
816
|
+
lineHeight: 1.3
|
|
817
|
+
}),
|
|
818
|
+
i.annotation.shape({
|
|
819
|
+
fillAlpha: bt,
|
|
820
|
+
strokeWidth: 0
|
|
821
|
+
}),
|
|
822
|
+
i.annotation.arrow({
|
|
823
|
+
stroke: d.black,
|
|
824
|
+
strokeWidth: C,
|
|
825
|
+
dashArray: []
|
|
826
|
+
}),
|
|
827
|
+
i.annotation.pinnedNumber({
|
|
828
|
+
fill: d.black,
|
|
829
|
+
stroke: d.paper,
|
|
830
|
+
shadow: "none"
|
|
831
|
+
}),
|
|
832
|
+
i.annotation.pinnedNumber.label({ ...x }),
|
|
833
|
+
i.annotation.comment({
|
|
834
|
+
fill: d.black,
|
|
835
|
+
stroke: d.paper,
|
|
836
|
+
shadow: "none"
|
|
837
|
+
}),
|
|
838
|
+
i.annotation.comment.label({ ...x }),
|
|
839
|
+
i.annotation.differenceArrow({
|
|
840
|
+
stroke: d.black,
|
|
841
|
+
strokeWidth: C
|
|
842
|
+
}),
|
|
843
|
+
i.annotation.differenceArrow.label({ ...x }),
|
|
844
|
+
i.geom.area({
|
|
845
|
+
fillAlpha: 0.35,
|
|
846
|
+
strokeWidth: 3
|
|
847
|
+
}, { coord: "polar" }),
|
|
848
|
+
i.panelBorder.left({ strokeWidth: 0 }, { coord: "polar" }),
|
|
849
|
+
i.panelBorder.bottom({ strokeWidth: 0 }, { coord: "polar" }),
|
|
850
|
+
i.tickLine({ strokeWidth: 0 }, { coord: "polar" }),
|
|
851
|
+
i.gridLine.x({
|
|
852
|
+
strokeWidth: 1,
|
|
853
|
+
dashArray: []
|
|
854
|
+
}, { coord: "polar" }),
|
|
855
|
+
i.gridLine.y({
|
|
856
|
+
strokeWidth: 1,
|
|
857
|
+
dashArray: []
|
|
858
|
+
}, { coord: "polar" }),
|
|
859
|
+
i.tickLabel({
|
|
860
|
+
fontWeight: 700,
|
|
861
|
+
textOutlineColor: d.paper,
|
|
862
|
+
textOutlineWidth: 3
|
|
863
|
+
}, { coord: "polar" })
|
|
864
|
+
]
|
|
865
|
+
}, Lt = {
|
|
866
|
+
name: "bauhaus",
|
|
867
|
+
styles: Rt,
|
|
868
|
+
palette: Ce,
|
|
869
|
+
colormap: $e,
|
|
870
|
+
config: {
|
|
871
|
+
axes: { y: { position: "left" } },
|
|
872
|
+
legend: {
|
|
873
|
+
position: "top",
|
|
874
|
+
align: "start"
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
colorScheme: "light",
|
|
878
|
+
plugins: vt
|
|
879
|
+
};
|
|
880
|
+
export {
|
|
881
|
+
Lt as bauhaus
|
|
882
|
+
};
|