@lostgradient/cinder 0.22.0 → 0.23.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/CHANGELOG.md +31 -0
- package/components.json +1 -1
- package/dist/_internal/chart/chart-bar-model.d.ts +24 -0
- package/dist/_internal/chart/chart-cartesian-model.d.ts +16 -0
- package/dist/_internal/chart/chart-layout.d.ts +23 -0
- package/dist/_internal/chart/chart-model-utilities.d.ts +157 -0
- package/dist/_internal/chart/chart-scale.d.ts +37 -0
- package/dist/_internal/chart/chart-utilities.d.ts +7 -164
- package/dist/_internal/chart/heatmap-utilities.d.ts +5 -4
- package/dist/components/_internal/chart-tooltip.css +21 -0
- package/dist/components/_internal/chart-tooltip.svelte.d.ts +11 -0
- package/dist/components/approval-card/index.js +5 -5
- package/dist/components/area-chart/area-chart.css +27 -23
- package/dist/components/area-chart/area-chart.schema.js +38 -1
- package/dist/components/area-chart/area-chart.types.d.ts +6 -2
- package/dist/components/area-chart/index.js +1589 -768
- package/dist/components/badge/badge.css +2 -2
- package/dist/components/badge/badge.schema.js +2 -2
- package/dist/components/badge/badge.types.d.ts +3 -3
- package/dist/components/badge/index.js +4 -4
- package/dist/components/bar-chart/bar-chart.css +27 -21
- package/dist/components/bar-chart/bar-chart.schema.js +38 -1
- package/dist/components/bar-chart/bar-chart.types.d.ts +7 -3
- package/dist/components/bar-chart/index.js +1544 -740
- package/dist/components/chart.types.d.ts +98 -2
- package/dist/components/json-schema-editor/index.js +4 -4
- package/dist/components/line-chart/index.js +1587 -785
- package/dist/components/line-chart/line-chart.css +25 -24
- package/dist/components/line-chart/line-chart.schema.js +38 -1
- package/dist/components/line-chart/line-chart.types.d.ts +6 -2
- package/dist/components/matrix-chart/index.js +1038 -429
- package/dist/components/matrix-chart/matrix-chart.css +12 -6
- package/dist/components/matrix-chart/matrix-chart.schema.js +26 -1
- package/dist/components/matrix-chart/matrix-chart.types.d.ts +5 -1
- package/dist/components/payload-inspector/index.js +4 -4
- package/dist/components/run-step-timeline/index.js +6 -6
- package/dist/components/sparkbar/index.js +1291 -4
- package/dist/components/sparkbar/sparkbar.css +5 -4
- package/dist/components/sparkbar/sparkbar.schema.js +26 -1
- package/dist/components/sparkbar/sparkbar.types.d.ts +5 -0
- package/dist/components/spectrogram/index.js +1076 -437
- package/dist/components/spectrogram/spectrogram.css +7 -6
- package/dist/components/spectrogram/spectrogram.schema.js +26 -1
- package/dist/components/spectrogram/spectrogram.types.d.ts +5 -1
- package/dist/components/spectrum-chart/index.js +1037 -423
- package/dist/components/spectrum-chart/spectrum-chart.css +8 -7
- package/dist/components/spectrum-chart/spectrum-chart.schema.js +26 -1
- package/dist/components/spectrum-chart/spectrum-chart.types.d.ts +5 -1
- package/dist/components/statistic/index.js +1284 -2
- package/dist/components/statistic/statistic.css +6 -5
- package/dist/components/statistic/statistic.schema.js +26 -1
- package/dist/components/statistic/statistic.types.d.ts +5 -0
- package/dist/components/statistic-group/index.js +1284 -2
- package/dist/components/waveform/index.js +1004 -404
- package/dist/components/waveform/waveform.css +8 -7
- package/dist/components/waveform/waveform.schema.js +26 -1
- package/dist/components/waveform/waveform.types.d.ts +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17730 -16540
- package/dist/server/components/approval-card/index.js +3 -3
- package/dist/server/components/area-chart/index.js +3 -3
- package/dist/server/components/badge/index.js +2 -2
- package/dist/server/components/bar-chart/index.js +3 -3
- package/dist/server/components/json-schema-editor/index.js +2 -2
- package/dist/server/components/line-chart/index.js +3 -3
- package/dist/server/components/matrix-chart/index.js +3 -3
- package/dist/server/components/payload-inspector/index.js +3 -3
- package/dist/server/components/run-step-timeline/index.js +2 -2
- package/dist/server/components/sparkbar/index.js +3 -2
- package/dist/server/components/spectrogram/index.js +3 -3
- package/dist/server/components/spectrum-chart/index.js +2 -2
- package/dist/server/components/statistic/index.js +4 -3
- package/dist/server/components/statistic-group/index.js +4 -3
- package/dist/server/components/waveform/index.js +2 -2
- package/dist/server/index.js +21 -21
- package/dist/server/{index.server-3dkwzkd3.js → index.server-10r7yf13.js} +110 -27
- package/dist/server/{index.server-93943z3e.js → index.server-151dt1tx.js} +1 -1
- package/dist/server/{index.server-pp2n6def.js → index.server-2y0xz53g.js} +37 -14
- package/dist/server/{index.server-bd8rcgf0.js → index.server-4hvjet4z.js} +1 -1
- package/dist/server/{index.server-bsm39gpy.js → index.server-5d83fkyg.js} +75 -21
- package/dist/server/{index.server-4wweyb2e.js → index.server-8dh2rtnc.js} +1 -1
- package/dist/server/{index.server-abqbstkt.js → index.server-9gj583qs.js} +41 -14
- package/dist/server/{index.server-2nmwsacy.js → index.server-9scm7zf9.js} +4 -4
- package/dist/server/{index.server-5j6jv7rm.js → index.server-9vwxyy06.js} +108 -29
- package/dist/server/{index.server-abjsjsw8.js → index.server-afpjvfz1.js} +111 -35
- package/dist/server/{index.server-86sw5ea6.js → index.server-dw9bz17h.js} +4 -4
- package/dist/server/{index.server-d26jzn2m.js → index.server-en31rprd.js} +3 -3
- package/dist/server/{index.server-dx58qant.js → index.server-f3a0ecqg.js} +72 -9
- package/dist/server/{index.server-d63pwytk.js → index.server-kz8aeeq5.js} +18 -10
- package/dist/server/index.server-mmmrgvyd.js +1274 -0
- package/dist/server/{index.server-1221p7e4.js → index.server-scahngwv.js} +13 -1
- package/dist/server/{index.server-nj8kk5bv.js → index.server-t73q59c1.js} +1 -1
- package/dist/server/{index.server-5schb2vt.js → index.server-tdrncj5e.js} +16 -6
- package/dist/server/{index.server-wm8957be.js → index.server-veqke4sq.js} +10 -1
- package/dist/server/{index.server-fphvzcfb.js → index.server-wqajghn9.js} +1 -1
- package/dist/server/{index.server-yd9shwqq.js → index.server-zjcjzcv6.js} +1 -1
- package/package.json +1 -1
- package/src/_internal/chart/chart-bar-model.ts +330 -0
- package/src/_internal/chart/chart-cartesian-model.ts +450 -0
- package/src/_internal/chart/chart-interaction.svelte.ts +25 -6
- package/src/_internal/chart/chart-layout.ts +348 -0
- package/src/_internal/chart/chart-model-utilities.ts +357 -0
- package/src/_internal/chart/chart-scale.ts +487 -0
- package/src/_internal/chart/chart-utilities.ts +22 -1078
- package/src/_internal/chart/heatmap-utilities.ts +21 -17
- package/src/components/_internal/chart-tooltip.css +21 -0
- package/src/components/_internal/chart-tooltip.svelte +44 -0
- package/src/components/approval-card/approval-card.svelte +1 -1
- package/src/components/area-chart/area-chart.css +27 -23
- package/src/components/area-chart/area-chart.examples.json +1 -1
- package/src/components/area-chart/area-chart.schema.json +37 -0
- package/src/components/area-chart/area-chart.schema.ts +40 -0
- package/src/components/area-chart/area-chart.svelte +103 -35
- package/src/components/area-chart/area-chart.types.ts +7 -1
- package/src/components/badge/badge.css +2 -2
- package/src/components/badge/badge.schema.json +1 -1
- package/src/components/badge/badge.schema.ts +1 -1
- package/src/components/badge/badge.svelte +2 -2
- package/src/components/badge/badge.types.ts +3 -3
- package/src/components/bar-chart/bar-chart.css +27 -21
- package/src/components/bar-chart/bar-chart.schema.json +37 -0
- package/src/components/bar-chart/bar-chart.schema.ts +40 -0
- package/src/components/bar-chart/bar-chart.svelte +94 -33
- package/src/components/bar-chart/bar-chart.types.ts +9 -2
- package/src/components/chart.types.ts +112 -2
- package/src/components/line-chart/line-chart.css +25 -24
- package/src/components/line-chart/line-chart.examples.json +1 -1
- package/src/components/line-chart/line-chart.schema.json +37 -0
- package/src/components/line-chart/line-chart.schema.ts +40 -0
- package/src/components/line-chart/line-chart.svelte +95 -40
- package/src/components/line-chart/line-chart.types.ts +7 -1
- package/src/components/matrix-chart/matrix-chart.css +12 -6
- package/src/components/matrix-chart/matrix-chart.schema.json +25 -0
- package/src/components/matrix-chart/matrix-chart.schema.ts +25 -0
- package/src/components/matrix-chart/matrix-chart.svelte +30 -12
- package/src/components/matrix-chart/matrix-chart.types.ts +5 -1
- package/src/components/run-step-timeline/run-step-timeline.svelte +2 -2
- package/src/components/sparkbar/sparkbar.css +5 -4
- package/src/components/sparkbar/sparkbar.schema.json +25 -0
- package/src/components/sparkbar/sparkbar.schema.ts +26 -0
- package/src/components/sparkbar/sparkbar.svelte +8 -1
- package/src/components/sparkbar/sparkbar.types.ts +5 -0
- package/src/components/spectrogram/spectrogram.css +7 -6
- package/src/components/spectrogram/spectrogram.schema.json +25 -0
- package/src/components/spectrogram/spectrogram.schema.ts +25 -0
- package/src/components/spectrogram/spectrogram.svelte +73 -28
- package/src/components/spectrogram/spectrogram.types.ts +5 -1
- package/src/components/spectrum-chart/spectrum-chart.css +8 -7
- package/src/components/spectrum-chart/spectrum-chart.schema.json +25 -0
- package/src/components/spectrum-chart/spectrum-chart.schema.ts +26 -0
- package/src/components/spectrum-chart/spectrum-chart.svelte +38 -12
- package/src/components/spectrum-chart/spectrum-chart.types.ts +5 -1
- package/src/components/statistic/statistic.css +6 -5
- package/src/components/statistic/statistic.schema.json +25 -0
- package/src/components/statistic/statistic.schema.ts +26 -0
- package/src/components/statistic/statistic.svelte +6 -1
- package/src/components/statistic/statistic.types.ts +5 -0
- package/src/components/waveform/waveform.css +8 -7
- package/src/components/waveform/waveform.schema.json +25 -0
- package/src/components/waveform/waveform.schema.ts +26 -0
- package/src/components/waveform/waveform.svelte +16 -3
- package/src/components/waveform/waveform.types.ts +5 -1
- package/src/index.ts +8 -0
- package/dist/server/index.server-6vbpz6dd.js +0 -690
|
@@ -3,13 +3,16 @@ import {
|
|
|
3
3
|
heatmapDomain,
|
|
4
4
|
heatmapLabelFill,
|
|
5
5
|
toFiniteOrNull
|
|
6
|
-
} from "./index.server-
|
|
6
|
+
} from "./index.server-kz8aeeq5.js";
|
|
7
7
|
import {
|
|
8
8
|
Chart_data_table
|
|
9
9
|
} from "./index.server-60jkchq7.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
createChartGeometry,
|
|
12
|
+
dataTableClass,
|
|
13
|
+
observeChartFontLoading,
|
|
14
|
+
resolveChartTheme
|
|
15
|
+
} from "./index.server-mmmrgvyd.js";
|
|
13
16
|
import {
|
|
14
17
|
useResizeObserver
|
|
15
18
|
} from "./index.server-6gzzpcyd.js";
|
|
@@ -19,6 +22,7 @@ import {
|
|
|
19
22
|
|
|
20
23
|
// src/components/matrix-chart/matrix-chart.svelte
|
|
21
24
|
import * as $ from "svelte/internal/server";
|
|
25
|
+
import { onMount } from "svelte";
|
|
22
26
|
function Matrix_chart($$renderer, $$props) {
|
|
23
27
|
$$renderer.component(($$renderer2) => {
|
|
24
28
|
const generatedId = $.props_id($$renderer2);
|
|
@@ -35,6 +39,7 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
35
39
|
loading = false,
|
|
36
40
|
dataTableCaption,
|
|
37
41
|
dataTableVisibility = "screen-reader-only",
|
|
42
|
+
theme,
|
|
38
43
|
class: customClassName,
|
|
39
44
|
empty,
|
|
40
45
|
loadingContent,
|
|
@@ -45,18 +50,22 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
45
50
|
} = $$props;
|
|
46
51
|
const rootId = $.derived(() => id ?? generatedId);
|
|
47
52
|
const descriptionId = $.derived(() => description ? `${rootId()}-description` : undefined);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
const resolvedTheme = $.derived(() => resolveChartTheme(theme));
|
|
54
|
+
let rootElement = undefined;
|
|
55
|
+
let measureText = false;
|
|
56
|
+
let measurementVersion = 0;
|
|
57
|
+
onMount(() => {
|
|
58
|
+
measureText = true;
|
|
59
|
+
return observeChartFontLoading(() => {
|
|
60
|
+
measurementVersion += 1;
|
|
61
|
+
});
|
|
62
|
+
});
|
|
52
63
|
let measuredWidth = 400;
|
|
53
64
|
const observeResize = useResizeObserver((entries) => {
|
|
54
65
|
const entry = entries[0];
|
|
55
66
|
if (entry && entry.contentRect.width > 0)
|
|
56
67
|
measuredWidth = entry.contentRect.width;
|
|
57
68
|
});
|
|
58
|
-
const plotWidth = $.derived(() => Math.max(1, measuredWidth - marginLeft - marginRight));
|
|
59
|
-
const plotHeight = $.derived(() => Math.max(1, height - marginTop - marginBottom));
|
|
60
69
|
const xLabels = $.derived(() => {
|
|
61
70
|
const seen = new Set;
|
|
62
71
|
const result = [];
|
|
@@ -87,6 +96,15 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
87
96
|
}
|
|
88
97
|
return result;
|
|
89
98
|
});
|
|
99
|
+
const geometry = $.derived(() => createChartGeometry(measuredWidth, height, {
|
|
100
|
+
xTickLabels: xLabels(),
|
|
101
|
+
yTickLabels: yLabels(),
|
|
102
|
+
xTickPosition: "top",
|
|
103
|
+
measureText,
|
|
104
|
+
measurementElement: rootElement,
|
|
105
|
+
measurementVersion
|
|
106
|
+
}));
|
|
107
|
+
const plotWidth = $.derived(() => geometry().plotWidth), plotHeight = $.derived(() => geometry().plotHeight), marginTop = $.derived(() => geometry().marginTop), marginLeft = $.derived(() => geometry().marginLeft);
|
|
90
108
|
const isEmpty = $.derived(() => xLabels().length === 0 || yLabels().length === 0);
|
|
91
109
|
const cellWidth = $.derived(() => xLabels().length > 0 ? plotWidth() / xLabels().length : 0);
|
|
92
110
|
const cellHeight = $.derived(() => yLabels().length > 0 ? plotHeight() / yLabels().length : 0);
|
|
@@ -133,7 +151,7 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
133
151
|
});
|
|
134
152
|
const domain = $.derived(() => heatmapDomain(cells().map((cell) => cell.value)));
|
|
135
153
|
function cellFill(value) {
|
|
136
|
-
return heatmapCellFill(value, domain(), colorScale);
|
|
154
|
+
return heatmapCellFill(value, domain(), colorScale, resolvedTheme().palette, theme?.background ?? "var(--cinder-surface-inset)");
|
|
137
155
|
}
|
|
138
156
|
const numberFormatter = new Intl.NumberFormat(undefined, { maximumFractionDigits: 2 });
|
|
139
157
|
function formatValue(value) {
|
|
@@ -142,7 +160,7 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
142
160
|
return numberFormatter.format(value);
|
|
143
161
|
}
|
|
144
162
|
function cellLabelFill(value) {
|
|
145
|
-
return heatmapLabelFill(value,
|
|
163
|
+
return heatmapLabelFill(value, resolvedTheme().muted);
|
|
146
164
|
}
|
|
147
165
|
const hasDataTable = $.derived(() => dataTableVisibility !== "hidden");
|
|
148
166
|
let hoveredCellKey = null;
|
|
@@ -165,6 +183,11 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
165
183
|
"aria-label": label,
|
|
166
184
|
"aria-describedby": descriptionId(),
|
|
167
185
|
"data-cinder-color-scale": colorScale
|
|
186
|
+
}, undefined, undefined, {
|
|
187
|
+
"--_cinder-chart-foreground": resolvedTheme().foreground,
|
|
188
|
+
"--_cinder-chart-muted": resolvedTheme().muted,
|
|
189
|
+
"--_cinder-chart-grid": resolvedTheme().grid,
|
|
190
|
+
"--_cinder-chart-background": resolvedTheme().background
|
|
168
191
|
})}>`);
|
|
169
192
|
if (description) {
|
|
170
193
|
$$renderer2.push("<!--[0-->");
|
|
@@ -210,7 +233,7 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
210
233
|
$$renderer2.push(`<!--]-->`);
|
|
211
234
|
if (!loading && !isEmpty()) {
|
|
212
235
|
$$renderer2.push("<!--[0-->");
|
|
213
|
-
$$renderer2.push(`<g role="presentation"${$.attr("transform", `translate(${marginLeft}, ${marginTop})`)}><!--[-->`);
|
|
236
|
+
$$renderer2.push(`<g role="presentation"${$.attr("transform", `translate(${marginLeft()}, ${marginTop()})`)}><!--[-->`);
|
|
214
237
|
const each_array = $.ensure_array_like(xLabels());
|
|
215
238
|
for (let index = 0, $$length = each_array.length;index < $$length; index++) {
|
|
216
239
|
let xLabel = each_array[index];
|
|
@@ -226,7 +249,7 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
226
249
|
const each_array_2 = $.ensure_array_like(cells());
|
|
227
250
|
for (let $$index_2 = 0, $$length = each_array_2.length;$$index_2 < $$length; $$index_2++) {
|
|
228
251
|
let cell = each_array_2[$$index_2];
|
|
229
|
-
$$renderer2.push(`<g><rect class="cinder-matrix-chart__cell"${$.attr("x", cell.x)}${$.attr("y", cell.y)}${$.attr("width", cell.width)}${$.attr("height", cell.height)}${$.attr("fill", cellFill(cell.value))} aria-hidden="true"${$.attr("data-cinder-x", cell.xLabel)}${$.attr("data-cinder-y", cell.yLabel)}${$.attr("data-cinder-active", hoveredCellKey === cell.key ? "" : undefined)}><title>${$.escape(cell.xLabel)} × ${$.escape(cell.yLabel)}: ${$.escape(cell.value !== null ? formatValue(cell.value) : "no data")}</title></rect>`);
|
|
252
|
+
$$renderer2.push(`<g class="cinder-matrix-chart__cell-group"><rect class="cinder-matrix-chart__cell"${$.attr("x", cell.x)}${$.attr("y", cell.y)}${$.attr("width", cell.width)}${$.attr("height", cell.height)}${$.attr("fill", cellFill(cell.value))} aria-hidden="true"${$.attr("data-cinder-x", cell.xLabel)}${$.attr("data-cinder-y", cell.yLabel)}${$.attr("data-cinder-active", hoveredCellKey === cell.key ? "" : undefined)}><title>${$.escape(cell.xLabel)} × ${$.escape(cell.yLabel)}: ${$.escape(cell.value !== null ? formatValue(cell.value) : "no data")}</title></rect>`);
|
|
230
253
|
if (cellLabelsVisible && cell.value !== null) {
|
|
231
254
|
$$renderer2.push("<!--[0-->");
|
|
232
255
|
$$renderer2.push(`<text class="cinder-matrix-chart__cell-label"${$.attr("x", cell.x + cell.width / 2)}${$.attr("y", cell.y + cell.height / 2)} text-anchor="middle" dominant-baseline="middle"${$.attr("fill", cellLabelFill(cell.value))} aria-hidden="true">${$.escape(formatValue(cell.value))}</text>`);
|
|
@@ -263,4 +286,4 @@ function Matrix_chart($$renderer, $$props) {
|
|
|
263
286
|
var matrix_chart_default = Matrix_chart;
|
|
264
287
|
export { Matrix_chart, matrix_chart_default };
|
|
265
288
|
|
|
266
|
-
//# debugId=
|
|
289
|
+
//# debugId=8601C27042F5F7B164756E2164756E21
|
|
@@ -2,10 +2,13 @@ import {
|
|
|
2
2
|
heatmapCellFill,
|
|
3
3
|
heatmapDomainOfRows,
|
|
4
4
|
toFiniteOrNull
|
|
5
|
-
} from "./index.server-
|
|
5
|
+
} from "./index.server-kz8aeeq5.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
createChartGeometry,
|
|
8
|
+
dataTableClass,
|
|
9
|
+
observeChartFontLoading,
|
|
10
|
+
resolveChartTheme
|
|
11
|
+
} from "./index.server-mmmrgvyd.js";
|
|
9
12
|
import {
|
|
10
13
|
useResizeObserver
|
|
11
14
|
} from "./index.server-6gzzpcyd.js";
|
|
@@ -15,6 +18,7 @@ import {
|
|
|
15
18
|
|
|
16
19
|
// src/components/spectrogram/spectrogram.svelte
|
|
17
20
|
import * as $ from "svelte/internal/server";
|
|
21
|
+
import { onMount } from "svelte";
|
|
18
22
|
function Spectrogram($$renderer, $$props) {
|
|
19
23
|
$$renderer.component(($$renderer2) => {
|
|
20
24
|
const generatedId = $.props_id($$renderer2);
|
|
@@ -26,6 +30,7 @@ function Spectrogram($$renderer, $$props) {
|
|
|
26
30
|
height = 200,
|
|
27
31
|
loading = false,
|
|
28
32
|
dataTableVisibility = "screen-reader-only",
|
|
33
|
+
theme,
|
|
29
34
|
dataTableCaption,
|
|
30
35
|
class: customClassName,
|
|
31
36
|
empty,
|
|
@@ -37,45 +42,89 @@ function Spectrogram($$renderer, $$props) {
|
|
|
37
42
|
} = $$props;
|
|
38
43
|
const rootId = $.derived(() => id ?? generatedId);
|
|
39
44
|
const descriptionId = $.derived(() => description ? `${rootId()}-description` : undefined);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
const resolvedTheme = $.derived(() => resolveChartTheme(theme));
|
|
46
|
+
let rootElement = undefined;
|
|
47
|
+
let measureText = false;
|
|
48
|
+
let measurementVersion = 0;
|
|
49
|
+
onMount(() => {
|
|
50
|
+
measureText = true;
|
|
51
|
+
return observeChartFontLoading(() => {
|
|
52
|
+
measurementVersion += 1;
|
|
53
|
+
});
|
|
54
|
+
});
|
|
44
55
|
let measuredWidth = 400;
|
|
45
56
|
const observeResize = useResizeObserver((entries) => {
|
|
46
57
|
const entry = entries[0];
|
|
47
58
|
if (entry && entry.contentRect.width > 0)
|
|
48
59
|
measuredWidth = entry.contentRect.width;
|
|
49
60
|
});
|
|
50
|
-
const plotWidth = $.derived(() => Math.max(1, measuredWidth - marginLeft - marginRight));
|
|
51
|
-
const plotHeight = $.derived(() => Math.max(1, height - marginTop - marginBottom));
|
|
52
61
|
const binCount = $.derived(() => frames.reduce((max, frame) => Math.max(max, frame.bins.length), 0));
|
|
53
|
-
const binIndices = $.derived(() => Array.from({ length: binCount() }, (_, index) => index));
|
|
54
62
|
const isEmpty = $.derived(() => frames.length === 0 || binCount() === 0);
|
|
55
|
-
const cellWidth = $.derived(() => frames.length > 0 ? plotWidth() / frames.length : 0);
|
|
56
|
-
const cellHeight = $.derived(() => binCount() > 0 ? plotHeight() / binCount() : 0);
|
|
57
63
|
function binValueAt(frameIndex, binIndex) {
|
|
58
64
|
return toFiniteOrNull(frames[frameIndex]?.bins[binIndex]);
|
|
59
65
|
}
|
|
66
|
+
function plotBucketValue(frameIndex, frameSpan, binIndex, binSpan) {
|
|
67
|
+
let maximum = null;
|
|
68
|
+
for (let frameOffset = 0;frameOffset < frameSpan; frameOffset += 1) {
|
|
69
|
+
const frame = frames[frameIndex + frameOffset];
|
|
70
|
+
if (!frame)
|
|
71
|
+
continue;
|
|
72
|
+
for (let binOffset = 0;binOffset < binSpan; binOffset += 1) {
|
|
73
|
+
const value = toFiniteOrNull(frame.bins[binIndex + binOffset]);
|
|
74
|
+
if (value !== null && (maximum === null || value > maximum))
|
|
75
|
+
maximum = value;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return maximum;
|
|
79
|
+
}
|
|
60
80
|
const domain = $.derived(() => heatmapDomainOfRows(frames.map((frame) => frame.bins)));
|
|
61
81
|
function cellFill(value) {
|
|
62
|
-
return heatmapCellFill(value, domain(), "sequential");
|
|
82
|
+
return heatmapCellFill(value, domain(), "sequential", resolvedTheme().palette, theme?.background ?? "var(--cinder-surface-inset)");
|
|
63
83
|
}
|
|
64
84
|
function binY(binIndex) {
|
|
65
|
-
return
|
|
85
|
+
return;
|
|
86
|
+
plotHeight() - (binIndex + 1) * cellHeight();
|
|
66
87
|
}
|
|
67
88
|
const yLabels = $.derived(() => Array.from({ length: binCount() }, (_, index) => frequencyLabels?.[index] ?? String(index)));
|
|
68
89
|
const maxYLabels = 8;
|
|
69
90
|
const yLabelStep = $.derived(() => Math.max(1, Math.ceil(binCount() / maxYLabels)));
|
|
91
|
+
const renderedYLabels = $.derived(() => yLabels().filter((_, index) => index % yLabelStep() === 0));
|
|
70
92
|
const maxXLabels = 10;
|
|
71
93
|
const xLabelStep = $.derived(() => Math.max(1, Math.ceil(frames.length / maxXLabels)));
|
|
94
|
+
const renderedXLabels = $.derived(() => frames.filter((_, index) => index % xLabelStep() === 0).map((frame) => frame.label));
|
|
95
|
+
const geometry = $.derived(() => createChartGeometry(measuredWidth, height, {
|
|
96
|
+
xTickLabels: renderedXLabels(),
|
|
97
|
+
yTickLabels: renderedYLabels(),
|
|
98
|
+
measureText,
|
|
99
|
+
measurementElement: rootElement,
|
|
100
|
+
measurementVersion
|
|
101
|
+
}));
|
|
102
|
+
const plotWidth = $.derived(() => geometry().plotWidth), plotHeight = $.derived(() => geometry().plotHeight), marginTop = $.derived(() => geometry().marginTop), marginLeft = $.derived(() => geometry().marginLeft);
|
|
103
|
+
const cellWidth = $.derived(() => frames.length > 0 ? plotWidth() / frames.length : 0);
|
|
104
|
+
const cellHeight = $.derived(() => binCount() > 0 ? plotHeight() / binCount() : 0);
|
|
72
105
|
const hasDataTable = $.derived(() => dataTableVisibility !== "hidden");
|
|
73
106
|
const maxPlotFrames = 400;
|
|
74
107
|
const maxPlotBins = 256;
|
|
75
108
|
const plotFrameStep = $.derived(() => Math.max(1, Math.ceil(frames.length / maxPlotFrames)));
|
|
76
109
|
const plotBinStep = $.derived(() => Math.max(1, Math.ceil(binCount() / maxPlotBins)));
|
|
77
|
-
const plotFrames = $.derived(() =>
|
|
78
|
-
|
|
110
|
+
const plotFrames = $.derived(() => Array.from({
|
|
111
|
+
length: Math.min(maxPlotFrames, Math.ceil(frames.length / plotFrameStep()))
|
|
112
|
+
}, (_, bucketIndex) => {
|
|
113
|
+
const frameIndex = bucketIndex * plotFrameStep();
|
|
114
|
+
return {
|
|
115
|
+
frameIndex,
|
|
116
|
+
span: Math.min(plotFrameStep(), frames.length - frameIndex)
|
|
117
|
+
};
|
|
118
|
+
}));
|
|
119
|
+
const plotBins = $.derived(() => Array.from({
|
|
120
|
+
length: Math.min(maxPlotBins, Math.ceil(binCount() / plotBinStep()))
|
|
121
|
+
}, (_, bucketIndex) => {
|
|
122
|
+
const binIndex = bucketIndex * plotBinStep();
|
|
123
|
+
return {
|
|
124
|
+
binIndex,
|
|
125
|
+
span: Math.min(plotBinStep(), binCount() - binIndex)
|
|
126
|
+
};
|
|
127
|
+
}));
|
|
79
128
|
const maxTableFrames = 10;
|
|
80
129
|
const maxTableBins = 10;
|
|
81
130
|
const tableFrameStep = $.derived(() => Math.max(1, Math.ceil(frames.length / maxTableFrames)));
|
|
@@ -95,6 +144,11 @@ function Spectrogram($$renderer, $$props) {
|
|
|
95
144
|
class: $.clsx(classNames("cinder-spectrogram", customClassName)),
|
|
96
145
|
"aria-label": label,
|
|
97
146
|
"aria-describedby": descriptionId()
|
|
147
|
+
}, undefined, undefined, {
|
|
148
|
+
"--_cinder-chart-foreground": resolvedTheme().foreground,
|
|
149
|
+
"--_cinder-chart-muted": resolvedTheme().muted,
|
|
150
|
+
"--_cinder-chart-grid": resolvedTheme().grid,
|
|
151
|
+
"--_cinder-chart-background": resolvedTheme().background
|
|
98
152
|
})}>`);
|
|
99
153
|
if (description) {
|
|
100
154
|
$$renderer2.push("<!--[0-->");
|
|
@@ -140,15 +194,15 @@ function Spectrogram($$renderer, $$props) {
|
|
|
140
194
|
$$renderer2.push(`<!--]-->`);
|
|
141
195
|
if (!loading && !isEmpty()) {
|
|
142
196
|
$$renderer2.push("<!--[0-->");
|
|
143
|
-
$$renderer2.push(`<g${$.attr("transform", `translate(${marginLeft}, ${marginTop})`)}><!--[-->`);
|
|
197
|
+
$$renderer2.push(`<g${$.attr("transform", `translate(${marginLeft()}, ${marginTop()})`)}><!--[-->`);
|
|
144
198
|
const each_array = $.ensure_array_like(plotFrames());
|
|
145
199
|
for (let $$index_1 = 0, $$length = each_array.length;$$index_1 < $$length; $$index_1++) {
|
|
146
200
|
let entry = each_array[$$index_1];
|
|
147
201
|
$$renderer2.push(`<!--[-->`);
|
|
148
|
-
const each_array_1 = $.ensure_array_like(
|
|
202
|
+
const each_array_1 = $.ensure_array_like(plotBins());
|
|
149
203
|
for (let $$index = 0, $$length2 = each_array_1.length;$$index < $$length2; $$index++) {
|
|
150
|
-
let
|
|
151
|
-
$$renderer2.push(`<rect class="cinder-spectrogram__cell"${$.attr("x", entry.frameIndex * cellWidth())}${$.attr("y", binY(binIndex))}${$.attr("width", cellWidth())}${$.attr("height", cellHeight())}${$.attr("fill", cellFill(
|
|
204
|
+
let bin = each_array_1[$$index];
|
|
205
|
+
$$renderer2.push(`<rect class="cinder-spectrogram__cell"${$.attr("x", entry.frameIndex * cellWidth())}${$.attr("y", binY(bin.binIndex + bin.span - 1))}${$.attr("width", entry.span * cellWidth())}${$.attr("height", bin.span * cellHeight())}${$.attr("fill", cellFill(plotBucketValue(entry.frameIndex, entry.span, bin.binIndex, bin.span)))} aria-hidden="true"></rect>`);
|
|
152
206
|
}
|
|
153
207
|
$$renderer2.push(`<!--]-->`);
|
|
154
208
|
}
|
|
@@ -213,4 +267,4 @@ function Spectrogram($$renderer, $$props) {
|
|
|
213
267
|
var spectrogram_default = Spectrogram;
|
|
214
268
|
export { Spectrogram, spectrogram_default };
|
|
215
269
|
|
|
216
|
-
//# debugId=
|
|
270
|
+
//# debugId=F8FB45FEBAC4071C64756E2164756E21
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
chartPaletteColor,
|
|
3
|
+
createChartGeometry,
|
|
2
4
|
dataTableClass,
|
|
3
|
-
formatNumericValue
|
|
4
|
-
|
|
5
|
+
formatNumericValue,
|
|
6
|
+
observeChartFontLoading,
|
|
7
|
+
resolveChartTheme
|
|
8
|
+
} from "./index.server-mmmrgvyd.js";
|
|
5
9
|
import {
|
|
6
10
|
useResizeObserver
|
|
7
11
|
} from "./index.server-6gzzpcyd.js";
|
|
@@ -11,6 +15,7 @@ import {
|
|
|
11
15
|
|
|
12
16
|
// src/components/spectrum-chart/spectrum-chart.svelte
|
|
13
17
|
import * as $ from "svelte/internal/server";
|
|
18
|
+
import { onMount } from "svelte";
|
|
14
19
|
function Spectrum_chart($$renderer, $$props) {
|
|
15
20
|
$$renderer.component(($$renderer2) => {
|
|
16
21
|
const generatedId = $.props_id($$renderer2);
|
|
@@ -22,6 +27,7 @@ function Spectrum_chart($$renderer, $$props) {
|
|
|
22
27
|
loading = false,
|
|
23
28
|
dataTableVisibility = "screen-reader-only",
|
|
24
29
|
dataTableCaption,
|
|
30
|
+
theme,
|
|
25
31
|
class: customClassName,
|
|
26
32
|
empty,
|
|
27
33
|
loadingContent,
|
|
@@ -32,19 +38,23 @@ function Spectrum_chart($$renderer, $$props) {
|
|
|
32
38
|
} = $$props;
|
|
33
39
|
const rootId = $.derived(() => id ?? generatedId);
|
|
34
40
|
const descriptionId = $.derived(() => description ? `${rootId()}-description` : undefined);
|
|
35
|
-
const marginTop = 8;
|
|
36
|
-
const marginRight = 8;
|
|
37
|
-
const marginBottom = 32;
|
|
38
|
-
const marginLeft = 40;
|
|
39
41
|
let measuredWidth = 400;
|
|
40
42
|
const observeResize = useResizeObserver((entries) => {
|
|
41
43
|
const entry = entries[0];
|
|
42
44
|
if (entry && entry.contentRect.width > 0)
|
|
43
45
|
measuredWidth = entry.contentRect.width;
|
|
44
46
|
});
|
|
45
|
-
const plotWidth = $.derived(() => Math.max(1, measuredWidth - marginLeft - marginRight));
|
|
46
|
-
const plotHeight = $.derived(() => Math.max(1, height - marginTop - marginBottom));
|
|
47
47
|
const isEmpty = $.derived(() => bins.length === 0);
|
|
48
|
+
const resolvedTheme = $.derived(() => resolveChartTheme(theme));
|
|
49
|
+
let rootElement = undefined;
|
|
50
|
+
let measureText = false;
|
|
51
|
+
let measurementVersion = 0;
|
|
52
|
+
onMount(() => {
|
|
53
|
+
measureText = true;
|
|
54
|
+
return observeChartFontLoading(() => {
|
|
55
|
+
measurementVersion += 1;
|
|
56
|
+
});
|
|
57
|
+
});
|
|
48
58
|
function sanitizeMagnitude(value) {
|
|
49
59
|
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
50
60
|
}
|
|
@@ -63,6 +73,19 @@ function Spectrum_chart($$renderer, $$props) {
|
|
|
63
73
|
return [0];
|
|
64
74
|
return Array.from({ length: tickCount }, (_, index) => maxValue() * index / (tickCount - 1));
|
|
65
75
|
});
|
|
76
|
+
const maxXLabels = 8;
|
|
77
|
+
const xLabelStep = $.derived(() => Math.max(1, Math.ceil(bins.length / maxXLabels)));
|
|
78
|
+
const xTickLabels = $.derived(() => bins.filter((_, index) => index % xLabelStep() === 0).map((bin) => bin.label));
|
|
79
|
+
const yTickLabels = $.derived(() => yTicks().map((tick, index) => formatNumericValue(tick, undefined, undefined, { index })));
|
|
80
|
+
const geometry = $.derived(() => createChartGeometry(measuredWidth, height, {
|
|
81
|
+
xTickLabels: xTickLabels(),
|
|
82
|
+
yTickLabels: yTickLabels(),
|
|
83
|
+
measureText,
|
|
84
|
+
measurementElement: rootElement,
|
|
85
|
+
measurementVersion
|
|
86
|
+
}));
|
|
87
|
+
const plotWidth = $.derived(() => geometry().plotWidth);
|
|
88
|
+
const plotHeight = $.derived(() => geometry().plotHeight);
|
|
66
89
|
function scaleY(value) {
|
|
67
90
|
if (maxValue() <= 0)
|
|
68
91
|
return plotHeight();
|
|
@@ -83,8 +106,6 @@ function Spectrum_chart($$renderer, $$props) {
|
|
|
83
106
|
};
|
|
84
107
|
});
|
|
85
108
|
});
|
|
86
|
-
const maxXLabels = 8;
|
|
87
|
-
const xLabelStep = $.derived(() => Math.max(1, Math.ceil(bins.length / maxXLabels)));
|
|
88
109
|
const hasDataTable = $.derived(() => dataTableVisibility !== "hidden");
|
|
89
110
|
$$renderer2.push(`<figure${$.attributes({
|
|
90
111
|
...rest,
|
|
@@ -92,6 +113,12 @@ function Spectrum_chart($$renderer, $$props) {
|
|
|
92
113
|
class: $.clsx(classNames("cinder-spectrum-chart", customClassName)),
|
|
93
114
|
"aria-label": label,
|
|
94
115
|
"aria-describedby": descriptionId()
|
|
116
|
+
}, undefined, undefined, {
|
|
117
|
+
"--_cinder-chart-foreground": resolvedTheme().foreground,
|
|
118
|
+
"--_cinder-chart-muted": resolvedTheme().muted,
|
|
119
|
+
"--_cinder-chart-grid": resolvedTheme().grid,
|
|
120
|
+
"--_cinder-chart-background": resolvedTheme().background,
|
|
121
|
+
"--_cinder-chart-series-color": chartPaletteColor(0, resolvedTheme().palette)
|
|
95
122
|
})}>`);
|
|
96
123
|
if (description) {
|
|
97
124
|
$$renderer2.push("<!--[0-->");
|
|
@@ -137,17 +164,17 @@ function Spectrum_chart($$renderer, $$props) {
|
|
|
137
164
|
$$renderer2.push(`<!--]-->`);
|
|
138
165
|
if (!loading && !isEmpty()) {
|
|
139
166
|
$$renderer2.push("<!--[0-->");
|
|
140
|
-
$$renderer2.push(`<g${$.attr("transform", `translate(${marginLeft}, ${marginTop})`)}><!--[-->`);
|
|
167
|
+
$$renderer2.push(`<g${$.attr("transform", `translate(${geometry().marginLeft}, ${geometry().marginTop})`)}><!--[-->`);
|
|
141
168
|
const each_array = $.ensure_array_like(yTicks());
|
|
142
169
|
for (let index = 0, $$length = each_array.length;index < $$length; index++) {
|
|
143
170
|
let tick = each_array[index];
|
|
144
|
-
$$renderer2.push(`<text class="cinder-spectrum-chart__tick-label"${$.attr("x", -6)}${$.attr("y", scaleY(tick))} text-anchor="end" dominant-baseline="middle">${$.escape(formatNumericValue(tick, undefined, undefined, { index }))}</text><line class="cinder-spectrum-chart__grid-line" x1="0"${$.attr("x2", plotWidth())}${$.attr("y1", scaleY(tick))}${$.attr("y2", scaleY(tick))} aria-hidden="true"></line>`);
|
|
171
|
+
$$renderer2.push(`<text class="cinder-spectrum-chart__tick-label"${$.attr("x", -6)}${$.attr("y", scaleY(tick))} text-anchor="end" dominant-baseline="middle"${$.attr("fill", resolvedTheme().muted)}>${$.escape(formatNumericValue(tick, undefined, undefined, { index }))}</text><line class="cinder-spectrum-chart__grid-line" x1="0"${$.attr("x2", plotWidth())}${$.attr("y1", scaleY(tick))}${$.attr("y2", scaleY(tick))} aria-hidden="true"${$.attr("stroke", resolvedTheme().grid)}></line>`);
|
|
145
172
|
}
|
|
146
173
|
$$renderer2.push(`<!--]--><!--[-->`);
|
|
147
174
|
const each_array_1 = $.ensure_array_like(spectrumBars());
|
|
148
175
|
for (let index = 0, $$length = each_array_1.length;index < $$length; index++) {
|
|
149
176
|
let bar = each_array_1[index];
|
|
150
|
-
$$renderer2.push(`<rect class="cinder-spectrum-chart__bar"${$.attr("x", bar.x)}${$.attr("y", bar.y)}${$.attr("width", bar.barWidth)}${$.attr("height", bar.barHeight)} aria-hidden="true"${$.attr("data-cinder-bin", bar.label)}></rect>`);
|
|
177
|
+
$$renderer2.push(`<rect class="cinder-spectrum-chart__bar"${$.attr("x", bar.x)}${$.attr("y", bar.y)}${$.attr("width", bar.barWidth)}${$.attr("height", bar.barHeight)} aria-hidden="true"${$.attr("data-cinder-bin", bar.label)}${$.attr("fill", chartPaletteColor(0, resolvedTheme().palette))}></rect>`);
|
|
151
178
|
}
|
|
152
179
|
$$renderer2.push(`<!--]--><!--[-->`);
|
|
153
180
|
const each_array_2 = $.ensure_array_like(spectrumBars());
|
|
@@ -186,4 +213,4 @@ function Spectrum_chart($$renderer, $$props) {
|
|
|
186
213
|
var spectrum_chart_default = Spectrum_chart;
|
|
187
214
|
export { Spectrum_chart, spectrum_chart_default };
|
|
188
215
|
|
|
189
|
-
//# debugId=
|
|
216
|
+
//# debugId=8F1B27D080BFED0964756E2164756E21
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./index.server-nprmntcb.js";
|
|
4
4
|
import {
|
|
5
5
|
Payload_inspector
|
|
6
|
-
} from "./index.server-
|
|
6
|
+
} from "./index.server-wqajghn9.js";
|
|
7
7
|
import {
|
|
8
8
|
Code_block
|
|
9
9
|
} from "./index.server-64dvhh7s.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./index.server-1cnz5ax1.js";
|
|
22
22
|
import {
|
|
23
23
|
Badge
|
|
24
|
-
} from "./index.server-
|
|
24
|
+
} from "./index.server-en31rprd.js";
|
|
25
25
|
import {
|
|
26
26
|
Signal_high,
|
|
27
27
|
Signal_low,
|
|
@@ -516,7 +516,7 @@ function Approval_card($$renderer, $$props) {
|
|
|
516
516
|
$$renderer4.push(`<li>`);
|
|
517
517
|
Badge($$renderer4, {
|
|
518
518
|
size: "sm",
|
|
519
|
-
|
|
519
|
+
monospace: true,
|
|
520
520
|
children: ($$renderer5) => {
|
|
521
521
|
$$renderer5.push(`<!---->${$2.escape(environmentName)}`);
|
|
522
522
|
},
|
|
@@ -572,4 +572,4 @@ function Approval_card($$renderer, $$props) {
|
|
|
572
572
|
var approval_card_default = Approval_card;
|
|
573
573
|
export { Approval_card, approval_card_default };
|
|
574
574
|
|
|
575
|
-
//# debugId=
|
|
575
|
+
//# debugId=07D8E97683C7820164756E2164756E21
|