@ruckc/truss-chart 1.52.0 → 1.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/BarChart.svelte +11 -4
- package/dist/ChartFrame.svelte +5 -3
- package/dist/DensityChart.svelte +30 -23
- package/dist/Histogram.svelte +9 -2
- package/dist/LineChart.svelte +19 -7
- package/dist/ScatterChart.svelte +5 -1
- package/dist/Sparkline.svelte +7 -2
- package/dist/StatTile.svelte +49 -5
- package/dist/StatTile.svelte.d.ts +2 -0
- package/dist/charts.css +14 -6
- package/dist/themevar.d.ts +6 -0
- package/dist/themevar.js +14 -0
- package/dist/util.js +3 -0
- package/package.json +1 -1
package/dist/BarChart.svelte
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
import ChartFrame from './ChartFrame.svelte';
|
|
28
28
|
import { useLabels } from './labels.js';
|
|
29
29
|
import { cssvars } from './cssvars.js';
|
|
30
|
+
import { themeNumber } from './themevar.js';
|
|
30
31
|
import { watchFill } from './fill.js';
|
|
31
32
|
import Tooltip from './Tooltip.svelte';
|
|
32
33
|
import type { ChartSelection, Series } from './types.js';
|
|
@@ -153,6 +154,8 @@
|
|
|
153
154
|
|
|
154
155
|
const pick = (c: number, name: string, v: number) => onselect?.({ index: c, category: categories[c], series: name, value: v });
|
|
155
156
|
|
|
157
|
+
/** Corner radius of a bar's data end: the --tr-chart-bar-radius hook (a square-bar theme sets 0), read at the plot. */
|
|
158
|
+
let barRadius = $state(4);
|
|
156
159
|
const GAP = 1; // each side of a shared edge yields a 2px surface gap
|
|
157
160
|
const labelWidth = $derived(Math.min(168, Math.max(48, Math.max(0, ...categories.map((c) => c.length)) * 6.4 + 14)));
|
|
158
161
|
const trunc = (s: string, px: number) => (s.length * 6.4 > px ? `${s.slice(0, Math.max(1, Math.floor(px / 6.4) - 1))}…` : s);
|
|
@@ -183,7 +186,7 @@
|
|
|
183
186
|
{@const cluster = isStack ? thick : thick * nb + 2 * (nb - 1)}
|
|
184
187
|
{@const catPos = (c: number) => (horizontal ? m.top : m.left) + band * c + band / 2}
|
|
185
188
|
|
|
186
|
-
<svg width={w} height={plotH} role="img" aria-label={L.tableHint(title ?? L.name)} onpointerleave={() => (tip = null)}>
|
|
189
|
+
<svg width={w} height={plotH} role="img" aria-label={L.tableHint(title ?? L.name)} onpointerleave={() => (tip = null)} {@attach themeNumber('--tr-chart-bar-radius', (v) => (barRadius = v ?? 4))}>
|
|
187
190
|
{#each scale.ticks as t}
|
|
188
191
|
{#if horizontal}
|
|
189
192
|
<line class="grid" x1={V(t)} x2={V(t)} y1={m.top} y2={plotH - m.bottom} data-zero={t === 0} />
|
|
@@ -214,8 +217,8 @@
|
|
|
214
217
|
{@const a = Math.min(p0, p1) + (horizontal ? (gapLo ? GAP : 0) : gapHi ? GAP : 0)}
|
|
215
218
|
{@const bEnd = Math.max(p0, p1) - (horizontal ? (gapHi ? GAP : 0) : gapLo ? GAP : 0)}
|
|
216
219
|
{@const d = horizontal
|
|
217
|
-
? rr(a, start, bEnd - a, thick,
|
|
218
|
-
: rr(start, a, thick, bEnd - a,
|
|
220
|
+
? rr(a, start, bEnd - a, thick, barRadius, s.outer ? (s.sign === 1 ? { tr: true, br: true } : { tl: true, bl: true }) : {})
|
|
221
|
+
: rr(start, a, thick, bEnd - a, barRadius, s.outer ? (s.sign === 1 ? { tl: true, tr: true } : { bl: true, br: true }) : {})}
|
|
219
222
|
{@const tx = horizontal ? (s.sign === 1 ? Math.max(p0, p1) : Math.min(p0, p1)) : start + thick / 2}
|
|
220
223
|
{@const ty = horizontal ? start + thick / 2 : s.sign === 1 ? Math.min(p0, p1) : Math.max(p0, p1)}
|
|
221
224
|
{#if d}
|
|
@@ -233,6 +236,8 @@
|
|
|
233
236
|
{/if}
|
|
234
237
|
{/each}
|
|
235
238
|
|
|
239
|
+
<path class="axisline" d="M{m.left},{m.top}V{plotH - m.bottom}H{w - m.right}" />
|
|
240
|
+
|
|
236
241
|
{#each refs as r}
|
|
237
242
|
{#if horizontal}
|
|
238
243
|
<line class="ref" x1={V(r.value)} x2={V(r.value)} y1={m.top} y2={plotH - m.bottom} />
|
|
@@ -298,7 +303,9 @@
|
|
|
298
303
|
svg { display: block; overflow: visible; }
|
|
299
304
|
.grid { stroke: var(--tr-chart-grid-color, var(--tr-outline-variant)); stroke-opacity: var(--tr-chart-grid-opacity, 0.6); stroke-dasharray: var(--tr-chart-grid-dash, none); }
|
|
300
305
|
.grid[data-zero='true'] { stroke-opacity: 1; }
|
|
301
|
-
|
|
306
|
+
/* the axis lines (left and bottom edge of the plot): none in classic, ink in a theme that draws them */
|
|
307
|
+
.axisline { fill: none; stroke: var(--tr-chart-axis-color, none); stroke-width: var(--tr-chart-axis-width, 1); shape-rendering: crispEdges; pointer-events: none; }
|
|
308
|
+
.tick { fill: var(--tr-chart-tick-color, var(--tr-on-surface-variant)); font-family: var(--tr-chart-tick-font, inherit); font-size: var(--tr-text-xs); font-variant-numeric: tabular-nums; }
|
|
302
309
|
.val { fill: var(--tr-on-surface-variant); font-size: var(--tr-text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
303
310
|
.bar { outline: none; transition: filter var(--tr-dur-fast) var(--tr-ease); }
|
|
304
311
|
.bar.act { cursor: pointer; }
|
package/dist/ChartFrame.svelte
CHANGED
|
@@ -82,10 +82,12 @@
|
|
|
82
82
|
.tv { height: 24px; padding: 0 10px; border: 1px solid var(--tr-outline-variant); border-radius: var(--tr-radius-sm); background: none; color: var(--tr-on-surface-variant); font: 600 var(--tr-text-sm) var(--tr-font-sans); cursor: pointer; }
|
|
83
83
|
.tv:hover { background: var(--tr-surface-container-high); }
|
|
84
84
|
.tv:focus-visible, .legend button:focus-visible { outline: none; box-shadow: var(--tr-focus-ring); }
|
|
85
|
-
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 6px; padding: 0; list-style: none; }
|
|
86
|
-
|
|
85
|
+
.legend { display: flex; flex-wrap: wrap; gap: var(--tr-chart-legend-gap, 4px 12px); margin: 0 0 6px; padding: 0; list-style: none; }
|
|
86
|
+
/* the legend buttons: plain text in classic, pills (radius, fill, height, padding) in a theme that sets the hooks */
|
|
87
|
+
.legend button { display: inline-flex; align-items: center; gap: 6px; height: var(--tr-chart-legend-height, auto); padding: var(--tr-chart-legend-padding, 2px 4px); border: 0; border-radius: var(--tr-chart-legend-radius, var(--tr-radius-sm)); background: var(--tr-chart-legend-bg, none); color: var(--tr-chart-legend-color, var(--tr-on-surface-variant)); font: var(--tr-chart-legend-weight, normal) var(--tr-text-sm) var(--tr-font-sans); cursor: pointer; }
|
|
88
|
+
.legend button:hover { background: var(--tr-chart-legend-bg-hover, var(--tr-chart-legend-bg, none)); }
|
|
87
89
|
.legend button[aria-pressed='false'] { opacity: 0.45; text-decoration: line-through; }
|
|
88
|
-
.key { width: 10px; height: 10px; border-radius: var(--tr-chart-key-radius, 2px); }
|
|
90
|
+
.key { width: var(--tr-chart-key-width, 10px); height: var(--tr-chart-key-height, 10px); border-radius: var(--tr-chart-key-radius, 2px); }
|
|
89
91
|
.body { position: relative; }
|
|
90
92
|
.tbl { max-height: 320px; overflow: auto; }
|
|
91
93
|
.tbl:focus-visible { outline: none; box-shadow: inset var(--tr-focus-ring); }
|
package/dist/DensityChart.svelte
CHANGED
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
<script lang="ts">
|
|
90
90
|
import { useLabels } from './labels.js';
|
|
91
91
|
import type { Snippet } from 'svelte';
|
|
92
|
-
import { startDrag } from '@ruckc/truss-ui';
|
|
92
|
+
import { startDrag, readColorTokens, onThemeChange } from '@ruckc/truss-ui';
|
|
93
93
|
import ChartFrame from './ChartFrame.svelte';
|
|
94
94
|
import { cssvars, csstext } from './cssvars.js';
|
|
95
95
|
import SsrStyle from './SsrStyle.svelte';
|
|
@@ -249,17 +249,16 @@
|
|
|
249
249
|
schedule();
|
|
250
250
|
return () => { cancelAnimationFrame(raf); raf = 0; };
|
|
251
251
|
});
|
|
252
|
-
// colours come from CSS custom properties, so follow theme switches (
|
|
252
|
+
// colours come from CSS custom properties, so follow theme switches (data-theme or data-truss-theme on any ancestor, or the OS preference)
|
|
253
253
|
$effect(() => {
|
|
254
|
-
|
|
255
|
-
mo.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme', 'data-truss-theme', 'class'] });
|
|
256
|
-
// the default theme follows the OS, which changes without touching any attribute
|
|
257
|
-
const os = matchMedia('(prefers-color-scheme: dark)');
|
|
258
|
-
os.addEventListener('change', schedule);
|
|
259
|
-
return () => { mo.disconnect(); os.removeEventListener('change', schedule); };
|
|
254
|
+
if (canvas) return onThemeChange(canvas, schedule);
|
|
260
255
|
});
|
|
261
256
|
|
|
262
257
|
const cssVar = (st: CSSStyleDeclaration, name: string, fallback: string) => st.getPropertyValue(name).trim() || fallback;
|
|
258
|
+
const COLOR_TOKENS = [
|
|
259
|
+
'--tr-on-surface', '--tr-on-surface-variant', '--tr-outline-variant', '--tr-surface', '--tr-chart-tick-color', '--tr-chart-grid-color', '--tr-chart-axis-color',
|
|
260
|
+
...Array.from({ length: 8 }, (_, i) => `--trc-s${i + 1}`), ...Array.from({ length: 9 }, (_, i) => `--trc-seq-${i + 1}`)
|
|
261
|
+
];
|
|
263
262
|
|
|
264
263
|
function draw() {
|
|
265
264
|
raf = 0;
|
|
@@ -273,13 +272,16 @@
|
|
|
273
272
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
274
273
|
ctx.clearRect(0, 0, W, H);
|
|
275
274
|
const st = getComputedStyle(c);
|
|
275
|
+
// every colour the canvas uses, resolved by the browser at the canvas (any CSS colour syntax: oklch(), light-dark()…)
|
|
276
|
+
const col = readColorTokens(c, COLOR_TOKENS);
|
|
276
277
|
const v = cur;
|
|
277
278
|
const X = linear(v.x0, v.x1, m.left, m.left + pw), Y = linear(v.y0, v.y1, m.top + ph, m.top);
|
|
278
279
|
|
|
279
280
|
// axes
|
|
280
|
-
ctx.font = `11px ${cssVar(st, '--tr-font-sans', 'sans-serif')}`;
|
|
281
|
-
ctx.fillStyle =
|
|
282
|
-
ctx.strokeStyle =
|
|
281
|
+
ctx.font = `11px ${cssVar(st, '--tr-chart-tick-font', cssVar(st, '--tr-font-sans', 'sans-serif'))}`;
|
|
282
|
+
ctx.fillStyle = col['--tr-chart-tick-color'] ?? col['--tr-on-surface-variant'] ?? '#666';
|
|
283
|
+
ctx.strokeStyle = col['--tr-chart-grid-color'] ?? col['--tr-outline-variant'] ?? '#ccc';
|
|
284
|
+
const gridAlpha = Number.parseFloat(cssVar(st, '--tr-chart-grid-opacity', '0.6'));
|
|
283
285
|
ctx.globalAlpha = 1;
|
|
284
286
|
ctx.lineWidth = 1;
|
|
285
287
|
ctx.textBaseline = 'middle';
|
|
@@ -287,7 +289,7 @@
|
|
|
287
289
|
for (const t of niceTicks(v.y0, v.y1, 5).ticks) {
|
|
288
290
|
if (t < v.y0 || t > v.y1) continue;
|
|
289
291
|
const y = Math.round(Y(t)) + 0.5;
|
|
290
|
-
ctx.globalAlpha =
|
|
292
|
+
ctx.globalAlpha = gridAlpha;
|
|
291
293
|
ctx.beginPath(); ctx.moveTo(m.left, y); ctx.lineTo(m.left + pw, y); ctx.stroke();
|
|
292
294
|
ctx.globalAlpha = 1;
|
|
293
295
|
ctx.fillText(fmtAxis(t), m.left - 8, y);
|
|
@@ -315,11 +317,7 @@
|
|
|
315
317
|
ctx.rect(m.left, m.top, pw, ph);
|
|
316
318
|
ctx.clip();
|
|
317
319
|
if (markers) {
|
|
318
|
-
const slots = Array.from({ length: 8 }, (_, i) => {
|
|
319
|
-
ctx.fillStyle = '#000';
|
|
320
|
-
ctx.fillStyle = cssVar(st, `--trc-s${i + 1}`, '#2a78d6');
|
|
321
|
-
return ctx.fillStyle as string;
|
|
322
|
-
});
|
|
320
|
+
const slots = Array.from({ length: 8 }, (_, i) => col[`--trc-s${i + 1}`] ?? '#2a78d6');
|
|
323
321
|
const { xs: dx, ys: dy, g, n: dn } = data;
|
|
324
322
|
const half = markerSize / 2;
|
|
325
323
|
const x0 = v.x0, x1 = v.x1, y0 = v.y0, y1 = v.y1;
|
|
@@ -336,11 +334,9 @@
|
|
|
336
334
|
} else {
|
|
337
335
|
const stops: [number, number, number][] = [];
|
|
338
336
|
for (let i = 1; i <= 9; i++) {
|
|
339
|
-
const
|
|
340
|
-
if (!
|
|
341
|
-
|
|
342
|
-
ctx.fillStyle = raw;
|
|
343
|
-
stops.push(parseColor(ctx.fillStyle as string));
|
|
337
|
+
const c = col[`--trc-seq-${i}`];
|
|
338
|
+
if (!c) break;
|
|
339
|
+
stops.push(parseColor(c));
|
|
344
340
|
}
|
|
345
341
|
const colors = stops.length > 1 ? stops : DEFAULT_RAMP.map(parseColor);
|
|
346
342
|
let max = 1;
|
|
@@ -359,7 +355,7 @@
|
|
|
359
355
|
}
|
|
360
356
|
}
|
|
361
357
|
if (hl && !hlHidden) {
|
|
362
|
-
const core =
|
|
358
|
+
const core = col['--tr-on-surface'] ?? '#111', halo = col['--tr-surface'] ?? '#fff';
|
|
363
359
|
const r = highlightSize / 2;
|
|
364
360
|
ctx.globalAlpha = 1;
|
|
365
361
|
for (let i = 0; i < hl.n; i++) {
|
|
@@ -373,6 +369,17 @@
|
|
|
373
369
|
}
|
|
374
370
|
}
|
|
375
371
|
ctx.restore();
|
|
372
|
+
// the axis lines (left and bottom edge of the plot), over the data: only where a theme sets --tr-chart-axis-color
|
|
373
|
+
const axis = col['--tr-chart-axis-color'];
|
|
374
|
+
if (axis) {
|
|
375
|
+
const aw = Number.parseFloat(cssVar(st, '--tr-chart-axis-width', '1'));
|
|
376
|
+
const lw = Number.isFinite(aw) ? aw : 1, o = (lw % 2) / 2;
|
|
377
|
+
const x = Math.round(m.left) - o, y = Math.round(m.top + ph) + o;
|
|
378
|
+
ctx.globalAlpha = 1;
|
|
379
|
+
ctx.strokeStyle = axis;
|
|
380
|
+
ctx.lineWidth = lw;
|
|
381
|
+
ctx.beginPath(); ctx.moveTo(x, m.top); ctx.lineTo(x, y); ctx.lineTo(m.left + pw, y); ctx.stroke();
|
|
382
|
+
}
|
|
376
383
|
if (markers && maxCount !== 0) maxCount = 0;
|
|
377
384
|
inView = n;
|
|
378
385
|
mode = markers ? 'markers' : 'heatmap';
|
package/dist/Histogram.svelte
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
import { watchFill } from './fill.js';
|
|
34
34
|
import Tooltip from './Tooltip.svelte';
|
|
35
35
|
import type { ChartSelection } from './types.js';
|
|
36
|
+
import { themeNumber } from './themevar.js';
|
|
36
37
|
import { activate, barPath, fmtAxis, fmtValue, linear, niceTicks, seriesColor, str } from './util.js';
|
|
37
38
|
|
|
38
39
|
let {
|
|
@@ -75,6 +76,8 @@
|
|
|
75
76
|
const L = useLabels('Histogram', DEFAULTS, () => labels);
|
|
76
77
|
|
|
77
78
|
let hover = $state<number | null>(null);
|
|
79
|
+
/** Corner radius of a bar's data end: the --tr-chart-bar-radius hook (a square-bar theme sets 0), read at the plot. */
|
|
80
|
+
let barRadius = $state(4);
|
|
78
81
|
let drag = $state<{ a: number; b: number } | null>(null);
|
|
79
82
|
let stop: (() => void) | undefined; // the running brush, abandoned if the chart unmounts mid-drag
|
|
80
83
|
$effect(() => () => stop?.());
|
|
@@ -135,6 +138,7 @@
|
|
|
135
138
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex, a11y_no_noninteractive_element_interactions -->
|
|
136
139
|
<svg
|
|
137
140
|
width={w} {height} role="group" tabindex="0"
|
|
141
|
+
{@attach themeNumber('--tr-chart-bar-radius', (v) => (barRadius = v ?? 4))}
|
|
138
142
|
aria-label={L.keys(title ?? L.name)}
|
|
139
143
|
onpointerleave={() => (hover = null)}
|
|
140
144
|
onblur={() => (hover = null)}
|
|
@@ -157,8 +161,9 @@
|
|
|
157
161
|
{/each}
|
|
158
162
|
|
|
159
163
|
{#each counts as c, i}
|
|
160
|
-
<path class="bar" d={barPath(X(edges[i]) + 1, Y(0), Y(c), bw,
|
|
164
|
+
<path class="bar" d={barPath(X(edges[i]) + 1, Y(0), Y(c), bw, barRadius)} fill={color} data-dim={!!sel && !(edges[i + 1] > sel[0] && edges[i] < sel[1])} data-hover={hover === i} />
|
|
161
165
|
{/each}
|
|
166
|
+
<path class="axisline" d="M{m.left},{m.top}V{height - m.bottom}H{w - m.right}" />
|
|
162
167
|
|
|
163
168
|
{#if sel}
|
|
164
169
|
<rect class="brush" x={X(sel[0])} y={m.top} width={Math.max(0, X(sel[1]) - X(sel[0]))} height={height - m.top - m.bottom} />
|
|
@@ -230,7 +235,9 @@
|
|
|
230
235
|
svg { display: block; outline: none; overflow: visible; }
|
|
231
236
|
svg:focus-visible { border-radius: var(--tr-radius-sm); box-shadow: var(--tr-focus-ring); }
|
|
232
237
|
.grid { stroke: var(--tr-chart-grid-color, var(--tr-outline-variant)); stroke-opacity: var(--tr-chart-grid-opacity, 0.6); stroke-dasharray: var(--tr-chart-grid-dash, none); }
|
|
233
|
-
|
|
238
|
+
/* the axis lines (left and bottom edge of the plot): none in classic, ink in a theme that draws them */
|
|
239
|
+
.axisline { fill: none; stroke: var(--tr-chart-axis-color, none); stroke-width: var(--tr-chart-axis-width, 1); shape-rendering: crispEdges; pointer-events: none; }
|
|
240
|
+
.tick { fill: var(--tr-chart-tick-color, var(--tr-on-surface-variant)); font-family: var(--tr-chart-tick-font, inherit); font-size: var(--tr-text-xs); font-variant-numeric: tabular-nums; }
|
|
234
241
|
.bar { transition: opacity var(--tr-dur-fast) var(--tr-ease), filter var(--tr-dur-fast) var(--tr-ease); }
|
|
235
242
|
.bar[data-hover='true'] { filter: brightness(1.12) saturate(1.1); }
|
|
236
243
|
.bar[data-dim='true'] { opacity: 0.3; }
|
package/dist/LineChart.svelte
CHANGED
|
@@ -183,8 +183,9 @@
|
|
|
183
183
|
const el = svgEl, names = all.map((s) => s.name);
|
|
184
184
|
let live = true;
|
|
185
185
|
const measure = () => {
|
|
186
|
-
|
|
187
|
-
const probes = [...el.querySelectorAll<SVGTextElement>('text.dprobe')];
|
|
186
|
+
// fonts.ready can settle after the probes have left (the labels re-laid out): nothing to measure then
|
|
187
|
+
const probes = live ? [...el.querySelectorAll<SVGTextElement>('text.dprobe')] : [];
|
|
188
|
+
if (probes.length < names.length) return;
|
|
188
189
|
const cs = getComputedStyle(probes[0]);
|
|
189
190
|
meas = { lh: parseFloat(cs.lineHeight) || parseFloat(cs.fontSize) * 1.4, w: Object.fromEntries(names.map((n, i) => [n, probes[i].getComputedTextLength()])) };
|
|
190
191
|
};
|
|
@@ -291,8 +292,9 @@
|
|
|
291
292
|
d={areaPath(seg, X, Y, si)} />
|
|
292
293
|
{/each}
|
|
293
294
|
{/if}
|
|
294
|
-
<path class="line" stroke={s.color} d={segments(s.values).map((seg) => seg.map((i, k) => `${k ? 'L' : 'M'}${X(xs[i]).toFixed(1)},${Y(bands[si][i]!.hi).toFixed(1)}`).join(' ')).join(' ')} />
|
|
295
|
+
<path class="line" pathLength="1" stroke={s.color} color={s.color} d={segments(s.values).map((seg) => seg.map((i, k) => `${k ? 'L' : 'M'}${X(xs[i]).toFixed(1)},${Y(bands[si][i]!.hi).toFixed(1)}`).join(' ')).join(' ')} />
|
|
295
296
|
{/each}
|
|
297
|
+
<path class="axisline" d="M{m.left},{m.top}V{height - m.bottom}H{w - m.right}" />
|
|
296
298
|
|
|
297
299
|
{#each refs as r}
|
|
298
300
|
<line class="ref" x1={m.left} x2={w - m.right} y1={Y(r.value)} y2={Y(r.value)} />
|
|
@@ -362,10 +364,20 @@
|
|
|
362
364
|
svg.act { cursor: pointer; }
|
|
363
365
|
svg:focus-visible { border-radius: var(--tr-radius-sm); box-shadow: var(--tr-focus-ring); }
|
|
364
366
|
.grid { stroke: var(--tr-chart-grid-color, var(--tr-outline-variant)); stroke-opacity: var(--tr-chart-grid-opacity, 0.6); stroke-dasharray: var(--tr-chart-grid-dash, none); stroke-width: 1; }
|
|
365
|
-
|
|
366
|
-
.
|
|
367
|
-
.
|
|
368
|
-
.
|
|
367
|
+
/* the axis lines (left and bottom edge of the plot): none in classic, ink in a theme that draws them */
|
|
368
|
+
.axisline { fill: none; stroke: var(--tr-chart-axis-color, none); stroke-width: var(--tr-chart-axis-width, 1); shape-rendering: crispEdges; pointer-events: none; }
|
|
369
|
+
.tick { fill: var(--tr-chart-tick-color, var(--tr-on-surface-variant)); font-family: var(--tr-chart-tick-font, inherit); font-size: var(--tr-text-xs); font-variant-numeric: tabular-nums; }
|
|
370
|
+
.line { fill: none; stroke-width: var(--tr-chart-line-width, 2); stroke-linejoin: round; stroke-linecap: round; filter: var(--tr-chart-line-glow, none); }
|
|
371
|
+
/* an unstacked area: its tint, and an optional fade toward the baseline (a mask image, e.g. linear-gradient(#000, transparent)) */
|
|
372
|
+
.area { fill-opacity: var(--tr-chart-area-opacity, 0.14); -webkit-mask-image: var(--tr-chart-area-fade, none); mask-image: var(--tr-chart-area-fade, none); }
|
|
373
|
+
.area.stack { fill-opacity: 0.55; -webkit-mask-image: none; mask-image: none; }
|
|
374
|
+
/* the load orchestration a theme can opt into (--tr-load-dur, 0s by default; no travel under reduced motion): the lines draw in
|
|
375
|
+
along their length (pathLength 1) and the areas rise from the baseline. Nothing stays applied once it ends. */
|
|
376
|
+
.line, .area { animation-duration: calc(var(--tr-load-dur, 0s) * var(--tr-motion-distance)); animation-timing-function: var(--tr-load-ease, var(--tr-ease)); animation-fill-mode: backwards; }
|
|
377
|
+
.line { animation-name: tr-draw; }
|
|
378
|
+
.area { animation-name: tr-rise; transform-box: fill-box; transform-origin: 50% 100%; }
|
|
379
|
+
@keyframes tr-draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
|
|
380
|
+
@keyframes tr-rise { from { opacity: 0; transform: scaleY(0.6); } }
|
|
369
381
|
.band { fill-opacity: 0.18; stroke: none; }
|
|
370
382
|
.ref { stroke: var(--tr-on-surface); stroke-width: 1.5; stroke-dasharray: 6 3; }
|
|
371
383
|
.reflabel { fill: var(--tr-on-surface); font-size: var(--tr-text-xs); font-weight: 600; }
|
package/dist/ScatterChart.svelte
CHANGED
|
@@ -194,6 +194,8 @@
|
|
|
194
194
|
{#if xLabel}<text class="axis" x={(m.left + w - m.right) / 2} y={height - 6} text-anchor="middle">{xLabel}</text>{/if}
|
|
195
195
|
{#if yLabel}<text class="axis" transform="translate(12 {(m.top + height - m.bottom) / 2}) rotate(-90)" text-anchor="middle">{yLabel}</text>{/if}
|
|
196
196
|
|
|
197
|
+
<path class="axisline" d="M{m.left},{m.top}V{height - m.bottom}H{w - m.right}" />
|
|
198
|
+
|
|
197
199
|
{#each vis as p, i (p.idx)}
|
|
198
200
|
<circle class="pt" class:on={i === active} cx={X(p.x)} cy={Y(p.y)} r={diameter(p.size) / 2} fill={colorOf(p.group)} />
|
|
199
201
|
{/each}
|
|
@@ -238,7 +240,9 @@
|
|
|
238
240
|
svg.act { cursor: pointer; }
|
|
239
241
|
svg:focus-visible { border-radius: var(--tr-radius-sm); box-shadow: var(--tr-focus-ring); }
|
|
240
242
|
.grid { stroke: var(--tr-chart-grid-color, var(--tr-outline-variant)); stroke-opacity: var(--tr-chart-grid-opacity, 0.6); stroke-dasharray: var(--tr-chart-grid-dash, none); stroke-width: 1; }
|
|
241
|
-
|
|
243
|
+
/* the axis lines (left and bottom edge of the plot): none in classic, ink in a theme that draws them */
|
|
244
|
+
.axisline { fill: none; stroke: var(--tr-chart-axis-color, none); stroke-width: var(--tr-chart-axis-width, 1); shape-rendering: crispEdges; pointer-events: none; }
|
|
245
|
+
.tick { fill: var(--tr-chart-tick-color, var(--tr-on-surface-variant)); font-family: var(--tr-chart-tick-font, inherit); font-size: var(--tr-text-xs); font-variant-numeric: tabular-nums; }
|
|
242
246
|
.axis { fill: var(--tr-on-surface-variant); font-size: var(--tr-text-sm); font-weight: 600; }
|
|
243
247
|
.pt { fill-opacity: 0.85; stroke: var(--tr-surface-container-low); stroke-width: 2; }
|
|
244
248
|
.pt.on { fill-opacity: 1; }
|
package/dist/Sparkline.svelte
CHANGED
|
@@ -19,8 +19,13 @@
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<svg {width} {height} role="img" aria-label={ariaLabel}>
|
|
22
|
-
<path d={pts.map((p, k) => `${k ? 'L' : 'M'}${X(p.i).toFixed(1)},${Y(p.v).toFixed(1)}`).join(' ')} fill="none" stroke={color} stroke-width="2" stroke-linejoin="round" stroke-linecap="round" />
|
|
22
|
+
<path pathLength="1" d={pts.map((p, k) => `${k ? 'L' : 'M'}${X(p.i).toFixed(1)},${Y(p.v).toFixed(1)}`).join(' ')} fill="none" stroke={color} stroke-width="2" stroke-linejoin="round" stroke-linecap="round" />
|
|
23
23
|
{#if last}<circle cx={X(last.i)} cy={Y(last.v)} r="3.5" fill={color} stroke="var(--tr-surface-container-low)" stroke-width="2" />{/if}
|
|
24
24
|
</svg>
|
|
25
25
|
|
|
26
|
-
<style>
|
|
26
|
+
<style>
|
|
27
|
+
svg { display: inline-block; vertical-align: middle; overflow: visible; }
|
|
28
|
+
/* the opt-in load orchestration (--tr-load-dur): the trend line draws in along its length; see LineChart */
|
|
29
|
+
path { animation: tr-draw calc(var(--tr-load-dur, 0s) * var(--tr-motion-distance)) var(--tr-load-ease, var(--tr-ease)) backwards; }
|
|
30
|
+
@keyframes tr-draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
|
|
31
|
+
</style>
|
package/dist/StatTile.svelte
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<script lang="ts">
|
|
24
|
+
import { onMount } from 'svelte';
|
|
24
25
|
import { useLabels } from './labels.js';
|
|
25
26
|
import Sparkline from './Sparkline.svelte';
|
|
26
27
|
import { fmtValue } from './util.js';
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
deltaGoodDirection = 'up',
|
|
35
36
|
spark,
|
|
36
37
|
size = 'md',
|
|
38
|
+
featured = false,
|
|
37
39
|
labels
|
|
38
40
|
}: {
|
|
39
41
|
label: string;
|
|
@@ -50,6 +52,8 @@
|
|
|
50
52
|
spark?: number[];
|
|
51
53
|
/** `'auto'` makes the tile a width-based size container: the value size and padding follow the tile's width (`cqi`, clamped to 20-56px), so it needs no fixed size in a grid cell; it ignores height so it never collapses. `'sm'` uses `--tr-text-xl` for the value and tighter padding. The value size can also be set from outside with the `--trc-stat-value-size` custom property (default 28px). */
|
|
52
54
|
size?: 'sm' | 'md' | 'auto';
|
|
55
|
+
/** The headline number of a row of tiles: a tinted tile (the primary container in classic; a theme may give it a gradient and a glow through the `--tr-stat-featured-*` hooks) whose trend line follows its text colour. */
|
|
56
|
+
featured?: boolean;
|
|
53
57
|
/** Replaces the built-in texts (translation). Missing keys keep the defaults. */
|
|
54
58
|
labels?: Partial<StatTileLabels>;
|
|
55
59
|
} = $props();
|
|
@@ -58,6 +62,39 @@
|
|
|
58
62
|
const deltaLabel = $derived(deltaLabelProp ?? L.vsPrevious);
|
|
59
63
|
|
|
60
64
|
const shown = $derived(typeof value === 'number' ? (format ?? fmtValue)(value) : value);
|
|
65
|
+
|
|
66
|
+
// The opt-in count-up of the load orchestration (--tr-load-dur, 0s unless a theme sets it; none under reduced motion): the visible
|
|
67
|
+
// number runs from 0 to the value once, on mount. Only the aria-hidden digits move: the tile's accessible name (the summary) carries
|
|
68
|
+
// the final value from the start, and the server renders it too. The clock is a Web Animation, so anything that waits for the page's
|
|
69
|
+
// animations to finish (a screenshot, a test) sees the final number.
|
|
70
|
+
let valueEl = $state<HTMLElement>();
|
|
71
|
+
let counting = $state<{ to: number; text: string } | null>(null);
|
|
72
|
+
const display = $derived(counting && counting.to === value ? counting.text : shown);
|
|
73
|
+
const toMs = (t: string) => (/ms\s*$/.test(t) ? 1 : 1000) * parseFloat(t);
|
|
74
|
+
onMount(() => {
|
|
75
|
+
if (typeof value !== 'number') return;
|
|
76
|
+
const cs = getComputedStyle(valueEl!);
|
|
77
|
+
const dur = toMs(cs.getPropertyValue('--_load')) * Number(cs.getPropertyValue('--tr-motion-distance'));
|
|
78
|
+
if (!(dur > 0)) return;
|
|
79
|
+
const to = value;
|
|
80
|
+
const fmt = format ?? fmtValue;
|
|
81
|
+
const dec = (String(to).split('.')[1] ?? '').length;
|
|
82
|
+
let clock: Animation;
|
|
83
|
+
try {
|
|
84
|
+
clock = valueEl!.animate(null, { duration: dur, easing: cs.getPropertyValue('--_load-ease').trim() });
|
|
85
|
+
} catch {
|
|
86
|
+
clock = valueEl!.animate(null, { duration: dur, easing: 'ease-out' }); // an easing the Web Animations API does not take
|
|
87
|
+
}
|
|
88
|
+
let raf = 0;
|
|
89
|
+
const step = () => {
|
|
90
|
+
counting = { to, text: fmt(Number((to * (clock.effect!.getComputedTiming().progress ?? 1)).toFixed(dec))) };
|
|
91
|
+
raf = requestAnimationFrame(step);
|
|
92
|
+
};
|
|
93
|
+
const done = () => { cancelAnimationFrame(raf); counting = null; };
|
|
94
|
+
clock.finished.then(done, done);
|
|
95
|
+
step();
|
|
96
|
+
return () => clock.cancel();
|
|
97
|
+
});
|
|
61
98
|
const dir = $derived(delta == null || delta === 0 ? 'flat' : delta > 0 ? 'up' : 'down');
|
|
62
99
|
const tone = $derived(dir === 'flat' ? 'neutral' : dir === deltaGoodDirection ? 'good' : 'bad');
|
|
63
100
|
const signed = (d: number) => `${d > 0 ? '+' : d < 0 ? '−' : ''}${fmtValue(Math.abs(d))}%`;
|
|
@@ -75,11 +112,11 @@
|
|
|
75
112
|
</script>
|
|
76
113
|
|
|
77
114
|
<div class="host" class:auto={size === 'auto'}>
|
|
78
|
-
<div class="tile" class:sm={size === 'sm'} role="group" aria-label={summary}>
|
|
115
|
+
<div class="tile" class:sm={size === 'sm'} class:featured role="group" aria-label={summary}>
|
|
79
116
|
<div class="label" aria-hidden="true">{label}</div>
|
|
80
117
|
<div class="row" aria-hidden="true">
|
|
81
|
-
<div class="value">{
|
|
82
|
-
{#if spark && spark.length > 1}<Sparkline values={spark} {label} />{/if}
|
|
118
|
+
<div class="value" bind:this={valueEl}>{display}</div>
|
|
119
|
+
{#if spark && spark.length > 1}<Sparkline values={spark} {label} color={featured ? 'currentColor' : undefined} />{/if}
|
|
83
120
|
</div>
|
|
84
121
|
{#if delta != null}
|
|
85
122
|
<div class={deltaClass} data-dir={dir} aria-hidden="true">
|
|
@@ -97,12 +134,19 @@
|
|
|
97
134
|
.host.auto { display: block; container-type: inline-size; height: 100%; min-width: 0; }
|
|
98
135
|
.auto .tile { box-sizing: border-box; height: 100%; padding: clamp(8px, 4cqi, 20px) clamp(12px, 5cqi, 24px); gap: clamp(2px, 1.5cqi, 8px); }
|
|
99
136
|
.auto .value { font-size: var(--trc-stat-value-size, clamp(20px, 11cqi, 56px)); }
|
|
100
|
-
.tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; background: var(--tr-surface-container-low); border: 1px solid var(--tr-outline-variant); border-radius: var(--tr-radius-md); color: var(--tr-on-surface); font-family: var(--tr-font-sans); }
|
|
137
|
+
.tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; background: var(--tr-stat-tile-bg, var(--tr-surface-container-low)); border: 1px solid var(--tr-stat-tile-border-color, var(--tr-outline-variant)); border-radius: var(--tr-radius-card, var(--tr-radius-md)); box-shadow: var(--tr-stat-tile-shadow, none); color: var(--tr-on-surface); font-family: var(--tr-font-sans); }
|
|
138
|
+
.tile.featured {
|
|
139
|
+
background-color: var(--tr-stat-featured-bg, var(--tr-primary-container)); background-image: var(--tr-stat-featured-image, none);
|
|
140
|
+
border-color: var(--tr-stat-featured-border-color, transparent); box-shadow: var(--tr-stat-featured-shadow, none); color: var(--tr-stat-featured-color, var(--tr-on-primary-container));
|
|
141
|
+
}
|
|
142
|
+
.featured .label, .featured .vs, .featured .delta.good, .featured .delta.bad, .featured .delta.neutral { color: inherit; }
|
|
143
|
+
.tile.featured:not(.sm) .value { font-size: var(--tr-stat-featured-value-size, var(--trc-stat-value-size, 28px)); }
|
|
144
|
+
.auto .tile.featured .value { font-size: var(--tr-stat-featured-value-size, var(--trc-stat-value-size, clamp(20px, 11cqi, 56px))); }
|
|
101
145
|
.tile.sm { padding: 8px 12px; gap: 2px; }
|
|
102
146
|
.tile.sm .value { font-size: var(--trc-stat-value-size, var(--tr-text-xl)); }
|
|
103
147
|
.label { color: var(--tr-on-surface-variant); font-size: var(--tr-text-sm); font-weight: 600; }
|
|
104
148
|
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
|
|
105
|
-
.value { font-size: var(--trc-stat-value-size, 28px); font-family: var(--tr-font-display, inherit); font-weight: var(--tr-display-weight, 700); font-variation-settings: var(--tr-display-axes, normal); line-height: 1.2; font-variant-numeric: tabular-nums; }
|
|
149
|
+
.value { --_load: var(--tr-load-dur, 0s); --_load-ease: var(--tr-load-ease, var(--tr-ease)); font-size: var(--trc-stat-value-size, 28px); font-family: var(--tr-font-display, inherit); font-weight: var(--tr-display-weight, 700); font-variation-settings: var(--tr-display-axes, normal); line-height: 1.2; font-variant-numeric: tabular-nums; }
|
|
106
150
|
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--tr-text-sm); font-variant-numeric: tabular-nums; }
|
|
107
151
|
.delta.good { color: var(--tr-success); }
|
|
108
152
|
.delta.bad { color: var(--tr-danger); }
|
|
@@ -25,6 +25,8 @@ type $$ComponentProps = {
|
|
|
25
25
|
spark?: number[];
|
|
26
26
|
/** `'auto'` makes the tile a width-based size container: the value size and padding follow the tile's width (`cqi`, clamped to 20-56px), so it needs no fixed size in a grid cell; it ignores height so it never collapses. `'sm'` uses `--tr-text-xl` for the value and tighter padding. The value size can also be set from outside with the `--trc-stat-value-size` custom property (default 28px). */
|
|
27
27
|
size?: 'sm' | 'md' | 'auto';
|
|
28
|
+
/** The headline number of a row of tiles: a tinted tile (the primary container in classic; a theme may give it a gradient and a glow through the `--tr-stat-featured-*` hooks) whose trend line follows its text colour. */
|
|
29
|
+
featured?: boolean;
|
|
28
30
|
/** Replaces the built-in texts (translation). Missing keys keep the defaults. */
|
|
29
31
|
labels?: Partial<StatTileLabels>;
|
|
30
32
|
};
|
package/dist/charts.css
CHANGED
|
@@ -2,18 +2,23 @@
|
|
|
2
2
|
* Categorical series palette (8 slots, fixed order — never cycled).
|
|
3
3
|
* Validated adjacent-pair CVD / normal-vision separation in both modes.
|
|
4
4
|
* Chart chrome reuses truss tokens, so it themes with the rest of the app.
|
|
5
|
+
* Every palette is also declared on each [data-truss-theme] element (#290), so a theme nested in another theme starts from these
|
|
6
|
+
* values rather than the outer theme's; a theme's own rules, specificity (0,3,0), still win (these are (0,1,0)).
|
|
5
7
|
*/
|
|
6
|
-
:root
|
|
8
|
+
:root,
|
|
9
|
+
[data-truss-theme] {
|
|
7
10
|
--trc-s1: #2a78d6; --trc-s2: #eb6834; --trc-s3: #1baf7a; --trc-s4: #eda100;
|
|
8
11
|
--trc-s5: #e87ba4; --trc-s6: #008300; --trc-s7: #6250d6; --trc-s8: #e34948;
|
|
9
12
|
}
|
|
10
13
|
@media (prefers-color-scheme: dark) {
|
|
11
|
-
:root:not([data-theme='light'])
|
|
14
|
+
:root:not([data-theme='light']),
|
|
15
|
+
:where(:root:not([data-theme='light'])) [data-truss-theme] {
|
|
12
16
|
--trc-s1: #3987e5; --trc-s2: #d95926; --trc-s3: #199e70; --trc-s4: #c98500;
|
|
13
17
|
--trc-s5: #d55181; --trc-s6: #008300; --trc-s7: #9085e9; --trc-s8: #e66767;
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
|
-
:root[data-theme='dark']
|
|
20
|
+
:root[data-theme='dark'],
|
|
21
|
+
:where(:root[data-theme='dark']) [data-truss-theme] {
|
|
17
22
|
--trc-s1: #3987e5; --trc-s2: #d95926; --trc-s3: #199e70; --trc-s4: #c98500;
|
|
18
23
|
--trc-s5: #d55181; --trc-s6: #008300; --trc-s7: #9085e9; --trc-s8: #e66767;
|
|
19
24
|
}
|
|
@@ -25,21 +30,24 @@
|
|
|
25
30
|
* Diverging: blue (div-1) through a neutral midpoint (div-4) to orange (div-7). Each half is monotonic in lightness toward the
|
|
26
31
|
* neutral, and the poles stay distinguishable under protan, deutan and tritan simulation (OKLab delta-E >= 0.19).
|
|
27
32
|
*/
|
|
28
|
-
:root
|
|
33
|
+
:root,
|
|
34
|
+
[data-truss-theme] {
|
|
29
35
|
--trc-seq-1: #eaf3fe; --trc-seq-2: #c5ddfc; --trc-seq-3: #97c1f7; --trc-seq-4: #64a1ee;
|
|
30
36
|
--trc-seq-5: #3a81d7; --trc-seq-6: #1d60ad; --trc-seq-7: #10427b;
|
|
31
37
|
--trc-div-1: #11458c; --trc-div-2: #3c79d1; --trc-div-3: #94b9f1; --trc-div-4: #f0eeeb;
|
|
32
38
|
--trc-div-5: #ebaf86; --trc-div-6: #d26c28; --trc-div-7: #993e02;
|
|
33
39
|
}
|
|
34
40
|
@media (prefers-color-scheme: dark) {
|
|
35
|
-
:root:not([data-theme='light'])
|
|
41
|
+
:root:not([data-theme='light']),
|
|
42
|
+
:where(:root:not([data-theme='light'])) [data-truss-theme] {
|
|
36
43
|
--trc-seq-1: #0e294a; --trc-seq-2: #113d70; --trc-seq-3: #1b589e; --trc-seq-4: #3077cd;
|
|
37
44
|
--trc-seq-5: #589aed; --trc-seq-6: #8fbefa; --trc-seq-7: #c5ddfc;
|
|
38
45
|
--trc-div-1: #86bafe; --trc-div-2: #4c8edf; --trc-div-3: #285994; --trc-div-4: #2a2926;
|
|
39
46
|
--trc-div-5: #944e21; --trc-div-6: #dc7b40; --trc-div-7: #f9a870;
|
|
40
47
|
}
|
|
41
48
|
}
|
|
42
|
-
:root[data-theme='dark']
|
|
49
|
+
:root[data-theme='dark'],
|
|
50
|
+
:where(:root[data-theme='dark']) [data-truss-theme] {
|
|
43
51
|
--trc-seq-1: #0e294a; --trc-seq-2: #113d70; --trc-seq-3: #1b589e; --trc-seq-4: #3077cd;
|
|
44
52
|
--trc-seq-5: #589aed; --trc-seq-6: #8fbefa; --trc-seq-7: #c5ddfc;
|
|
45
53
|
--trc-div-1: #86bafe; --trc-div-2: #4c8edf; --trc-div-3: #285994; --trc-div-4: #2a2926;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An attachment that reads a numeric theme hook (e.g. the chart bar radius) at the element, now and whenever the theme there
|
|
3
|
+
* changes, and hands it to `set` (`null` when the hook is unset or not a number). For geometry drawn from script, where a CSS
|
|
4
|
+
* `var()` cannot reach (#291). The server and the first paint keep the caller's default.
|
|
5
|
+
*/
|
|
6
|
+
export declare const themeNumber: (name: string, set: (v: number | null) => void) => (el: Element) => () => void;
|
package/dist/themevar.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { onThemeChange } from '@ruckc/truss-ui';
|
|
2
|
+
/**
|
|
3
|
+
* An attachment that reads a numeric theme hook (e.g. the chart bar radius) at the element, now and whenever the theme there
|
|
4
|
+
* changes, and hands it to `set` (`null` when the hook is unset or not a number). For geometry drawn from script, where a CSS
|
|
5
|
+
* `var()` cannot reach (#291). The server and the first paint keep the caller's default.
|
|
6
|
+
*/
|
|
7
|
+
export const themeNumber = (name, set) => (el) => {
|
|
8
|
+
const read = () => {
|
|
9
|
+
const v = Number.parseFloat(getComputedStyle(el).getPropertyValue(name));
|
|
10
|
+
set(Number.isFinite(v) ? v : null);
|
|
11
|
+
};
|
|
12
|
+
read();
|
|
13
|
+
return onThemeChange(el, read);
|
|
14
|
+
};
|
package/dist/util.js
CHANGED
|
@@ -90,6 +90,9 @@ export function barPath(x, y0, y1, w, r, round = true) {
|
|
|
90
90
|
if (h < 0.5)
|
|
91
91
|
return '';
|
|
92
92
|
const rr = round ? Math.min(r, w / 2, h) : 0;
|
|
93
|
+
// square (a radius of 0 from the theme's bar-radius hook, or round = false): a plain rectangle, no degenerate curves
|
|
94
|
+
if (rr <= 0)
|
|
95
|
+
return `M${x},${y0}V${y1}H${x + w}V${y0}Z`;
|
|
93
96
|
return y1 < y0
|
|
94
97
|
? `M${x},${y0}V${top + rr}Q${x},${top} ${x + rr},${top}H${x + w - rr}Q${x + w},${top} ${x + w},${top + rr}V${y0}Z`
|
|
95
98
|
: `M${x},${y0}V${top + h - rr}Q${x},${top + h} ${x + rr},${top + h}H${x + w - rr}Q${x + w},${top + h} ${x + w},${top + h - rr}V${y0}Z`;
|