@dxos/react-ui-plot 0.0.0-stage → 0.0.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.
Files changed (39) hide show
  1. package/LICENSE +105 -0
  2. package/README.md +2 -2
  3. package/dist/lib/index.mjs +223 -0
  4. package/dist/lib/index.mjs.map +1 -0
  5. package/dist/px-icons/anthropic.svg +12 -0
  6. package/dist/px-icons/bar-high.svg +21 -0
  7. package/dist/px-icons/bar-low.svg +18 -0
  8. package/dist/px-icons/bar-medium.svg +20 -0
  9. package/dist/px-icons/circle.svg +5 -0
  10. package/dist/px-icons/deepseek.svg +10 -0
  11. package/dist/types/src/components/Plot/Plot.d.ts +12 -0
  12. package/dist/types/src/components/Plot/Plot.d.ts.map +1 -0
  13. package/dist/types/src/components/Plot/Plot.stories.d.ts +29 -0
  14. package/dist/types/src/components/Plot/Plot.stories.d.ts.map +1 -0
  15. package/dist/types/src/components/Plot/index.d.ts +2 -0
  16. package/dist/types/src/components/Plot/index.d.ts.map +1 -0
  17. package/dist/types/src/components/index.d.ts +2 -0
  18. package/dist/types/src/components/index.d.ts.map +1 -0
  19. package/dist/types/src/index.d.ts +4 -0
  20. package/dist/types/src/index.d.ts.map +1 -0
  21. package/dist/types/src/types.d.ts +29 -0
  22. package/dist/types/src/types.d.ts.map +1 -0
  23. package/dist/types/src/util/data.d.ts +13 -0
  24. package/dist/types/src/util/data.d.ts.map +1 -0
  25. package/dist/types/src/util/data.test.d.ts +2 -0
  26. package/dist/types/src/util/data.test.d.ts.map +1 -0
  27. package/dist/types/src/util/index.d.ts +2 -0
  28. package/dist/types/src/util/index.d.ts.map +1 -0
  29. package/dist/types/tsconfig.tsbuildinfo +1 -0
  30. package/package.json +50 -3
  31. package/src/components/Plot/Plot.stories.tsx +46 -0
  32. package/src/components/Plot/Plot.tsx +158 -0
  33. package/src/components/Plot/index.ts +5 -0
  34. package/src/components/index.ts +5 -0
  35. package/src/index.ts +7 -0
  36. package/src/types.ts +39 -0
  37. package/src/util/data.test.ts +53 -0
  38. package/src/util/data.ts +63 -0
  39. package/src/util/index.ts +5 -0
package/LICENSE ADDED
@@ -0,0 +1,105 @@
1
+ # Functional Source License, Version 1.1, ALv2 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # Temporary Holding Version
1
+ # @dxos/react-ui-plot
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Chart components (bar, pie, xy) over tabular data, built on Observable Plot and d3.
@@ -0,0 +1,223 @@
1
+ import * as ObservablePlot from "@observablehq/plot";
2
+ import * as d3 from "d3";
3
+ import { useEffect, useMemo } from "react";
4
+ import { useResizeDetector } from "react-resize-detector";
5
+ import { mx } from "@dxos/ui-theme";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import * as Schema from "effect/Schema";
8
+ //#region src/util/data.ts
9
+ /** Spreadsheet column letters for a zero-based index: A–Z, then AA, AB, … (bijective base 26). */
10
+ var columnName = (index) => {
11
+ let name = "";
12
+ for (let remaining = index + 1; remaining > 0; remaining = Math.floor((remaining - 1) / 26)) name = String.fromCharCode("A".charCodeAt(0) + (remaining - 1) % 26) + name;
13
+ return name;
14
+ };
15
+ var toNumber = (value) => {
16
+ if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
17
+ if (typeof value === "string" && value.trim() !== "") {
18
+ const number = Number(value.replace(/[$,%]/g, ""));
19
+ return Number.isFinite(number) ? number : void 0;
20
+ }
21
+ };
22
+ /** Converts a 2D block of cell values (rows of columns) into `PlotData`. */
23
+ var toPlotData = (values, { header = false } = {}) => {
24
+ const width = values.reduce((max, row) => Math.max(max, row.length), 0);
25
+ const [first, ...rest] = values;
26
+ return {
27
+ columns: Array.from({ length: width }, (_, index) => header && first?.[index] != null ? String(first[index]) : columnName(index)),
28
+ rows: header ? rest : values
29
+ };
30
+ };
31
+ /**
32
+ * Flattens `PlotData` into long form. With a single column the row index is the key;
33
+ * otherwise the first column is the key and each remaining column a series. Non-numeric values are dropped.
34
+ */
35
+ var toPlotDatums = ({ columns, rows }) => {
36
+ if (columns.length === 1) return rows.flatMap((row, index) => {
37
+ const value = toNumber(row[0]);
38
+ return value === void 0 ? [] : [{
39
+ key: index + 1,
40
+ series: columns[0],
41
+ value
42
+ }];
43
+ });
44
+ return rows.flatMap((row) => columns.slice(1).flatMap((series, index) => {
45
+ const value = toNumber(row[index + 1]);
46
+ return value === void 0 ? [] : [{
47
+ key: row[0],
48
+ series,
49
+ value
50
+ }];
51
+ }));
52
+ };
53
+ //#endregion
54
+ //#region src/components/Plot/Plot.tsx
55
+ var MARGIN = 40;
56
+ var MIN_SIZE = 80;
57
+ var TIP = {
58
+ fill: "var(--color-modal-surface)",
59
+ stroke: "var(--color-separator)"
60
+ };
61
+ /** Renders tabular data as a bar, pie, or xy chart sized to its container. */
62
+ var Plot = ({ classNames, data, options }) => {
63
+ const { ref: containerRef, width = 0, height = 0 } = useResizeDetector({ refreshRate: 100 });
64
+ const datums = useMemo(() => toPlotDatums(data), [data]);
65
+ useEffect(() => {
66
+ const container = containerRef.current;
67
+ if (!container || width < MIN_SIZE || height < MIN_SIZE || options.type === "pie") return;
68
+ const label = data.columns[0];
69
+ let plot = createPlot(datums, options, {
70
+ width,
71
+ height,
72
+ label
73
+ });
74
+ container.append(plot);
75
+ const overflow = plot.getBoundingClientRect().height - height;
76
+ if (overflow > 0) {
77
+ plot.remove();
78
+ plot = createPlot(datums, options, {
79
+ width,
80
+ height: height - overflow,
81
+ label
82
+ });
83
+ container.append(plot);
84
+ }
85
+ return () => plot.remove();
86
+ }, [
87
+ data,
88
+ datums,
89
+ options,
90
+ width,
91
+ height
92
+ ]);
93
+ return /* @__PURE__ */ jsx("div", {
94
+ ref: containerRef,
95
+ role: "img",
96
+ className: mx("relative dx-fill overflow-hidden", classNames),
97
+ children: options.type === "pie" && width >= MIN_SIZE && height >= MIN_SIZE && /* @__PURE__ */ jsx(Pie, {
98
+ datums,
99
+ width,
100
+ height
101
+ })
102
+ });
103
+ };
104
+ Plot.displayName = "Plot";
105
+ var createPlot = (datums, { type, grid = true }, { label, ...size }) => {
106
+ const series = new Set(datums.map((datum) => datum.series));
107
+ const keys = [...new Set(datums.map((datum) => datum.key))];
108
+ const seriesOrder = [...series];
109
+ const options = {
110
+ ...size,
111
+ grid,
112
+ marginLeft: MARGIN,
113
+ marginBottom: MARGIN,
114
+ style: {
115
+ background: "transparent",
116
+ color: "currentColor"
117
+ },
118
+ color: {
119
+ legend: series.size > 1,
120
+ domain: seriesOrder
121
+ },
122
+ y: { label: null }
123
+ };
124
+ switch (type) {
125
+ case "xy": return ObservablePlot.plot({
126
+ ...options,
127
+ x: { label },
128
+ marks: [
129
+ ObservablePlot.ruleY([0]),
130
+ ObservablePlot.line(datums, {
131
+ x: "key",
132
+ y: "value",
133
+ stroke: "series"
134
+ }),
135
+ ObservablePlot.dot(datums, {
136
+ x: "key",
137
+ y: "value",
138
+ fill: "series",
139
+ r: 3
140
+ })
141
+ ]
142
+ });
143
+ default: return ObservablePlot.plot({
144
+ ...options,
145
+ ...series.size > 1 ? {
146
+ fx: {
147
+ label: null,
148
+ domain: keys,
149
+ axis: "bottom"
150
+ },
151
+ x: {
152
+ axis: null,
153
+ domain: seriesOrder
154
+ }
155
+ } : { x: {
156
+ label: null,
157
+ domain: keys
158
+ } },
159
+ marks: [ObservablePlot.ruleY([0]), series.size > 1 ? ObservablePlot.barY(datums, {
160
+ fx: "key",
161
+ x: "series",
162
+ y: "value",
163
+ fill: "series",
164
+ tip: TIP
165
+ }) : ObservablePlot.barY(datums, {
166
+ x: "key",
167
+ y: "value",
168
+ fill: "series",
169
+ tip: TIP
170
+ })]
171
+ });
172
+ }
173
+ };
174
+ /** Observable Plot has no polar marks, so the pie is drawn directly with d3-shape; the first series is used. */
175
+ var Pie = ({ datums, width, height }) => {
176
+ const radius = Math.max(0, Math.min(width, height) / 2 - MARGIN / 2);
177
+ const slices = useMemo(() => {
178
+ const first = datums[0]?.series;
179
+ const values = datums.filter((datum) => datum.series === first && datum.value > 0);
180
+ return d3.pie().sort(null).value((datum) => datum.value)(values);
181
+ }, [datums]);
182
+ const arc = d3.arc().innerRadius(0).outerRadius(radius);
183
+ const label = d3.arc().innerRadius(radius * .65).outerRadius(radius * .65);
184
+ const color = d3.scaleOrdinal(d3.schemeTableau10);
185
+ return /* @__PURE__ */ jsx("svg", {
186
+ width,
187
+ height,
188
+ viewBox: `${-width / 2} ${-height / 2} ${width} ${height}`,
189
+ children: slices.map((slice, index) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("path", {
190
+ d: arc(slice) ?? void 0,
191
+ fill: color(String(slice.data.key)),
192
+ stroke: "var(--color-base-surface)",
193
+ children: /* @__PURE__ */ jsx("title", { children: `${slice.data.key}: ${slice.data.value}` })
194
+ }), /* @__PURE__ */ jsx("text", {
195
+ transform: `translate(${label.centroid(slice)})`,
196
+ textAnchor: "middle",
197
+ dominantBaseline: "middle",
198
+ fontSize: 11,
199
+ fill: "white",
200
+ children: String(slice.data.key)
201
+ })] }, index))
202
+ });
203
+ };
204
+ //#endregion
205
+ //#region src/types.ts
206
+ var PlotType = Schema.Literals([
207
+ "bar",
208
+ "pie",
209
+ "xy"
210
+ ]);
211
+ var PLOT_TYPES = PlotType.literals;
212
+ /** Presentation options; persisted alongside the data source by the host. */
213
+ var PlotOptions = Schema.Struct({
214
+ type: PlotType.annotate({ title: "Chart type" }),
215
+ /** The first row holds the series names. */
216
+ header: Schema.optional(Schema.Boolean.annotate({ title: "Header row" })),
217
+ /** Draw grid lines (bar and xy). */
218
+ grid: Schema.optional(Schema.Boolean.annotate({ title: "Grid lines" }))
219
+ });
220
+ //#endregion
221
+ export { PLOT_TYPES, Plot, PlotOptions, PlotType, toPlotData, toPlotDatums };
222
+
223
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/util/data.ts","../../src/components/Plot/Plot.tsx","../../src/types.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type PlotData, type PlotDatum, type PlotValue } from '../types.ts';\n\n/** Spreadsheet column letters for a zero-based index: A–Z, then AA, AB, … (bijective base 26). */\nconst columnName = (index: number): string => {\n let name = '';\n for (let remaining = index + 1; remaining > 0; remaining = Math.floor((remaining - 1) / 26)) {\n name = String.fromCharCode('A'.charCodeAt(0) + ((remaining - 1) % 26)) + name;\n }\n return name;\n};\n\nconst toNumber = (value: PlotValue): number | undefined => {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? value : undefined;\n }\n\n if (typeof value === 'string' && value.trim() !== '') {\n const number = Number(value.replace(/[$,%]/g, ''));\n return Number.isFinite(number) ? number : undefined;\n }\n\n return undefined;\n};\n\nexport type ToPlotDataOptions = {\n /** The first row holds the series names. */\n header?: boolean;\n};\n\n/** Converts a 2D block of cell values (rows of columns) into `PlotData`. */\nexport const toPlotData = (values: PlotValue[][], { header = false }: ToPlotDataOptions = {}): PlotData => {\n const width = values.reduce((max, row) => Math.max(max, row.length), 0);\n const [first, ...rest] = values;\n const columns = Array.from({ length: width }, (_, index) =>\n header && first?.[index] != null ? String(first[index]) : columnName(index),\n );\n\n return { columns, rows: header ? rest : values };\n};\n\n/**\n * Flattens `PlotData` into long form. With a single column the row index is the key;\n * otherwise the first column is the key and each remaining column a series. Non-numeric values are dropped.\n */\nexport const toPlotDatums = ({ columns, rows }: PlotData): PlotDatum[] => {\n if (columns.length === 1) {\n return rows.flatMap((row, index) => {\n const value = toNumber(row[0]);\n return value === undefined ? [] : [{ key: index + 1, series: columns[0], value }];\n });\n }\n\n return rows.flatMap((row) =>\n columns.slice(1).flatMap((series, index) => {\n const value = toNumber(row[index + 1]);\n return value === undefined ? [] : [{ key: row[0], series, value }];\n }),\n );\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as ObservablePlot from '@observablehq/plot';\nimport * as d3 from 'd3';\nimport React, { useEffect, useMemo } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { mx } from '@dxos/ui-theme';\nimport { type ThemedClassName } from '@dxos/ui-types';\n\nimport { type PlotData, type PlotDatum, type PlotOptions } from '../../types.ts';\nimport { toPlotDatums } from '../../util/index.ts';\n\nconst MARGIN = 40;\nconst MIN_SIZE = MARGIN * 2;\n\n// Plot's tip box defaults to a white fill, while its text follows the theme's currentColor.\nconst TIP = { fill: 'var(--color-modal-surface)', stroke: 'var(--color-separator)' };\n\nexport type PlotProps = ThemedClassName<{\n data: PlotData;\n options: PlotOptions;\n}>;\n\n/** Renders tabular data as a bar, pie, or xy chart sized to its container. */\nexport const Plot = ({ classNames, data, options }: PlotProps) => {\n const { ref: containerRef, width = 0, height = 0 } = useResizeDetector<HTMLDivElement>({ refreshRate: 100 });\n const datums = useMemo(() => toPlotDatums(data), [data]);\n\n useEffect(() => {\n const container = containerRef.current;\n // Below twice the margin the plot frame has a negative extent.\n if (!container || width < MIN_SIZE || height < MIN_SIZE || options.type === 'pie') {\n return;\n }\n\n const label = data.columns[0];\n let plot = createPlot(datums, options, { width, height, label });\n container.append(plot);\n\n // A legend is laid out above an SVG of the full height, pushing the x axis out of view; redraw shorter.\n const overflow = plot.getBoundingClientRect().height - height;\n if (overflow > 0) {\n plot.remove();\n plot = createPlot(datums, options, { width, height: height - overflow, label });\n container.append(plot);\n }\n\n return () => plot.remove();\n }, [data, datums, options, width, height]);\n\n return (\n <div ref={containerRef} role='img' className={mx('relative dx-fill overflow-hidden', classNames)}>\n {options.type === 'pie' && width >= MIN_SIZE && height >= MIN_SIZE && (\n <Pie datums={datums} width={width} height={height} />\n )}\n </div>\n );\n};\n\nPlot.displayName = 'Plot';\n\nconst createPlot = (\n datums: PlotDatum[],\n { type, grid = true }: PlotOptions,\n { label, ...size }: { width: number; height: number; label?: string },\n): SVGSVGElement | HTMLElement => {\n const series = new Set(datums.map((datum) => datum.series));\n // Ordinal scales sort by default; keep the sheet's row and column order.\n const keys = [...new Set(datums.map((datum) => datum.key))];\n const seriesOrder = [...series];\n const options = {\n ...size,\n grid,\n marginLeft: MARGIN,\n marginBottom: MARGIN,\n style: { background: 'transparent', color: 'currentColor' },\n color: { legend: series.size > 1, domain: seriesOrder },\n y: { label: null },\n };\n\n switch (type) {\n case 'xy':\n return ObservablePlot.plot({\n ...options,\n x: { label },\n marks: [\n ObservablePlot.ruleY([0]),\n ObservablePlot.line(datums, { x: 'key', y: 'value', stroke: 'series' }),\n ObservablePlot.dot(datums, { x: 'key', y: 'value', fill: 'series', r: 3 }),\n ],\n });\n\n case 'bar':\n default:\n return ObservablePlot.plot({\n ...options,\n ...(series.size > 1\n ? { fx: { label: null, domain: keys, axis: 'bottom' }, x: { axis: null, domain: seriesOrder } }\n : { x: { label: null, domain: keys } }),\n marks: [\n ObservablePlot.ruleY([0]),\n series.size > 1\n ? ObservablePlot.barY(datums, { fx: 'key', x: 'series', y: 'value', fill: 'series', tip: TIP })\n : ObservablePlot.barY(datums, { x: 'key', y: 'value', fill: 'series', tip: TIP }),\n ],\n });\n }\n};\n\ntype PieProps = {\n datums: PlotDatum[];\n width: number;\n height: number;\n};\n\n/** Observable Plot has no polar marks, so the pie is drawn directly with d3-shape; the first series is used. */\nconst Pie = ({ datums, width, height }: PieProps) => {\n const radius = Math.max(0, Math.min(width, height) / 2 - MARGIN / 2);\n const slices = useMemo(() => {\n const first = datums[0]?.series;\n const values = datums.filter((datum) => datum.series === first && datum.value > 0);\n return d3\n .pie<PlotDatum>()\n .sort(null)\n .value((datum) => datum.value)(values);\n }, [datums]);\n\n const arc = d3.arc<d3.PieArcDatum<PlotDatum>>().innerRadius(0).outerRadius(radius);\n const label = d3\n .arc<d3.PieArcDatum<PlotDatum>>()\n .innerRadius(radius * 0.65)\n .outerRadius(radius * 0.65);\n const color = d3.scaleOrdinal<string, string>(d3.schemeTableau10);\n\n return (\n <svg width={width} height={height} viewBox={`${-width / 2} ${-height / 2} ${width} ${height}`}>\n {slices.map((slice, index) => (\n <g key={index}>\n <path d={arc(slice) ?? undefined} fill={color(String(slice.data.key))} stroke='var(--color-base-surface)'>\n <title>{`${slice.data.key}: ${slice.data.value}`}</title>\n </path>\n <text\n transform={`translate(${label.centroid(slice)})`}\n textAnchor='middle'\n dominantBaseline='middle'\n fontSize={11}\n fill='white'\n >\n {String(slice.data.key)}\n </text>\n </g>\n ))}\n </svg>\n );\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nexport const PlotType = Schema.Literals(['bar', 'pie', 'xy']);\nexport type PlotType = Schema.Schema.Type<typeof PlotType>;\n\nexport const PLOT_TYPES: readonly PlotType[] = PlotType.literals;\n\n/** Presentation options; persisted alongside the data source by the host. */\nexport const PlotOptions = Schema.Struct({\n type: PlotType.annotate({ title: 'Chart type' }),\n /** The first row holds the series names. */\n header: Schema.optional(Schema.Boolean.annotate({ title: 'Header row' })),\n /** Draw grid lines (bar and xy). */\n grid: Schema.optional(Schema.Boolean.annotate({ title: 'Grid lines' })),\n});\n\nexport type PlotOptions = Schema.Schema.Type<typeof PlotOptions>;\n\nexport type PlotValue = string | number | boolean | null;\n\n/**\n * Column-oriented table: the first column is the category (bar, pie) or the x axis (xy);\n * each remaining column is a series.\n */\nexport type PlotData = {\n columns: string[];\n rows: PlotValue[][];\n};\n\n/** One series value in long form, the shape Observable Plot marks consume. */\nexport type PlotDatum = {\n key: PlotValue;\n series: string;\n value: number;\n};\n"],"mappings":";;;;;;;;;AAOA,IAAM,cAAc,UAA0B;CAC5C,IAAI,OAAO;CACX,KAAK,IAAI,YAAY,QAAQ,GAAG,YAAY,GAAG,YAAY,KAAK,OAAO,YAAY,KAAK,EAAE,GACxF,OAAO,OAAO,aAAa,IAAI,WAAW,CAAC,KAAM,YAAY,KAAK,EAAG,IAAI;CAE3E,OAAO;AACT;AAEA,IAAM,YAAY,UAAyC;CACzD,IAAI,OAAO,UAAU,UACnB,OAAO,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;CAG1C,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,IAAI;EACpD,MAAM,SAAS,OAAO,MAAM,QAAQ,UAAU,EAAE,CAAC;EACjD,OAAO,OAAO,SAAS,MAAM,IAAI,SAAS,KAAA;CAC5C;AAGF;;AAQA,IAAa,cAAc,QAAuB,EAAE,SAAS,UAA6B,CAAC,MAAgB;CACzG,MAAM,QAAQ,OAAO,QAAQ,KAAK,QAAQ,KAAK,IAAI,KAAK,IAAI,MAAM,GAAG,CAAC;CACtE,MAAM,CAAC,OAAO,GAAG,QAAQ;CAKzB,OAAO;EAAE,S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AAO,KAAK,OAAO,UAClB,qBAAC,KAAD,EAAA,UAAA,CACE,oBAAC,QAAD;GAAM,GAAG,IAAI,KAAK,KAAK,KAAA;GAAW,MAAM,MAAM,OAAO,MAAM,KAAK,GAAG,CAAC;GAAG,QAAO;GAC5E,UAAA,oBAAC,SAAD,EAAA,UAAQ,GAAG,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,QAAe,CAAA;EACpD,CAAA,GACN,oBAAC,QAAD;GACE,WAAW,aAAa,MAAM,SAAS,KAAK,EAAE;GAC9C,YAAW;GACX,kBAAiB;GACjB,UAAU;GACV,MAAK;GAEJ,UAAA,OAAO,MAAM,KAAK,GAAG;EAClB,CAAA,CACL,EAAA,GAbK,KAaL,CACJ;CACE,CAAA;AAET;;;ACvJA,IAAa,WAAW,OAAO,SAAS;CAAC;CAAO;CAAO;AAAI,CAAC;AAG5D,IAAa,aAAkC,SAAS;;AAGxD,IAAa,cAAc,OAAO,OAAO;CACvC,MAAM,SAAS,SAAS,EAAE,OAAO,aAAa,CAAC;;CAE/C,QAAQ,OAAO,SAAS,OAAO,QAAQ,SAAS,EAAE,OAAO,aAAa,CAAC,CAAC;;CAExE,MAAM,OAAO,SAAS,OAAO,QAAQ,SAAS,EAAE,OAAO,aAAa,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
+ <g transform="matrix(1,0,0,1,-256,0)">
5
+ <g id="anthropic" transform="matrix(0.882759,0,0,1.03226,3.53103,-2.06452)">
6
+ <rect x="286" y="2" width="290" height="248" style="fill:none;"/>
7
+ <g transform="matrix(2.75361,0,0,2.35481,303.993,49.4687)">
8
+ <path d="M66.5,0L52.4,0L78.1,65L92.2,65L66.5,0ZM25.7,0L0,65L14.4,65L19.7,51.4L46.6,51.4L51.8,65L66.2,65L40.5,0L25.7,0ZM24.3,39.3L33.1,16.5L41.9,39.3L24.3,39.3Z" style="fill:currentColor;fill-rule:nonzero;"/>
9
+ </g>
10
+ </g>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
+ <g transform="matrix(1,0,0,1,-600,-600)">
5
+ <g id="bar-high" transform="matrix(1.01587,0,0,0.920863,890.54,625.784)">
6
+ <rect x="-286" y="-28" width="252" height="278" style="fill:none;"/>
7
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
8
+ <path d="M80,384L80,471L41,471L41,384L80,384ZM68,396L53,396L53,459L68,459L68,396Z"/>
9
+ <rect x="41" y="384" width="39" height="87"/>
10
+ </g>
11
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
12
+ <path d="M144,336L144,472L96,472L96,336L144,336ZM132,348L108,348L108,460L132,460L132,348Z"/>
13
+ <rect x="96" y="336" width="48" height="136"/>
14
+ </g>
15
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
16
+ <path d="M216,288L216,472L160,472L160,288L216,288ZM204,300L172,300L172,460L204,460L204,300Z"/>
17
+ <rect x="160" y="288" width="56" height="184"/>
18
+ </g>
19
+ </g>
20
+ </g>
21
+ </svg>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
+ <g transform="matrix(1,0,0,1,0,-600)">
5
+ <g id="bar-low" transform="matrix(1.01587,0,0,0.920863,290.54,625.784)">
6
+ <rect x="-286" y="-28" width="252" height="278" style="fill:none;"/>
7
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
8
+ <rect x="41" y="384" width="39" height="87"/>
9
+ </g>
10
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
11
+ <rect x="96" y="336" width="48" height="136" style="fill-opacity:0.25;"/>
12
+ </g>
13
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
14
+ <rect x="160" y="288" width="56" height="184" style="fill-opacity:0.25;"/>
15
+ </g>
16
+ </g>
17
+ </g>
18
+ </svg>
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
+ <g transform="matrix(1,0,0,1,-300,-600)">
5
+ <g id="bar-medium" transform="matrix(1.01587,0,0,0.920863,590.54,625.784)">
6
+ <rect x="-286" y="-28" width="252" height="278" style="fill:none;"/>
7
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
8
+ <path d="M80,384L80,471L41,471L41,384L80,384ZM68,396L53,396L53,459L68,459L68,396Z"/>
9
+ <rect x="41" y="384" width="39" height="87"/>
10
+ </g>
11
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
12
+ <path d="M144,336L144,472L96,472L96,336L144,336ZM132,348L108,348L108,460L132,460L132,348Z"/>
13
+ <rect x="96" y="336" width="48" height="136"/>
14
+ </g>
15
+ <g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
16
+ <rect x="160" y="288" width="56" height="184" style="fill-opacity:0.25;"/>
17
+ </g>
18
+ </g>
19
+ </g>
20
+ </svg>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
4
+ <circle cx="128" cy="128" r="96" style="fill:none;stroke:currentColor;stroke-width:16px;"/>
5
+ </svg>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
+ <g id="deepseek" transform="matrix(1.01587,0,0,0.920863,290.54,25.7842)">
5
+ <rect x="-286" y="-28" width="252" height="278" style="fill:none;"/>
6
+ <g transform="matrix(9.18732,0,0,10.1352,-270.25,-8.90305)">
7
+ <path d="M23.748,4.482C23.494,4.358 23.384,4.595 23.236,4.716C23.185,4.755 23.142,4.806 23.099,4.852C22.727,5.249 22.293,5.509 21.726,5.478C20.897,5.432 20.189,5.692 19.563,6.326C19.43,5.544 18.988,5.078 18.316,4.778C17.964,4.622 17.608,4.467 17.361,4.128C17.189,3.887 17.142,3.618 17.056,3.354C17.001,3.194 16.946,3.031 16.763,3.004C16.563,2.973 16.485,3.14 16.407,3.28C16.094,3.852 15.973,4.482 15.985,5.12C16.012,6.556 16.618,7.7 17.823,8.513C17.96,8.606 17.995,8.7 17.952,8.836C17.87,9.116 17.772,9.388 17.686,9.669C17.631,9.848 17.549,9.886 17.357,9.809C16.708,9.53 16.119,9.13 15.621,8.629C14.764,7.801 13.99,6.887 13.024,6.171C12.8,6.006 12.57,5.849 12.335,5.7C11.35,4.743 12.465,3.957 12.723,3.864C12.993,3.766 12.816,3.432 11.944,3.436C11.072,3.44 10.274,3.731 9.257,4.12C9.106,4.178 8.95,4.224 8.792,4.257C7.842,4.078 6.87,4.044 5.909,4.155C4.024,4.365 2.519,5.257 1.412,6.778C0.082,8.606 -0.231,10.684 0.152,12.85C0.555,15.134 1.721,17.025 3.512,18.503C5.37,20.036 7.509,20.787 9.95,20.643C11.432,20.558 13.083,20.359 14.944,18.783C15.414,19.017 15.906,19.11 16.724,19.18C17.354,19.239 17.96,19.15 18.429,19.052C19.164,18.896 19.113,18.215 18.848,18.091C16.693,17.087 17.166,17.496 16.735,17.165C17.831,15.869 19.481,14.523 20.127,10.162C20.177,9.815 20.134,9.597 20.127,9.317C20.123,9.147 20.162,9.08 20.357,9.061C20.898,9.005 21.423,8.844 21.902,8.586C23.298,7.823 23.862,6.571 23.995,5.069C24.015,4.839 23.991,4.602 23.748,4.481L23.748,4.482ZM11.581,18C9.492,16.358 8.479,15.817 8.061,15.84C7.669,15.864 7.74,16.311 7.826,16.603C7.916,16.891 8.033,17.089 8.197,17.342C8.311,17.509 8.389,17.758 8.084,17.945C7.411,18.361 6.242,17.805 6.187,17.778C4.826,16.976 3.687,15.918 2.886,14.471C2.112,13.078 1.662,11.584 1.588,9.989C1.568,9.603 1.681,9.467 2.065,9.397C2.569,9.301 3.086,9.287 3.594,9.358C5.726,9.67 7.54,10.623 9.062,12.132C9.93,12.992 10.587,14.019 11.264,15.023C11.984,16.089 12.758,17.105 13.744,17.937C14.092,18.229 14.369,18.451 14.635,18.614C13.833,18.704 12.495,18.724 11.581,18ZM12.581,11.56C12.581,11.56 12.581,11.559 12.581,11.559C12.581,11.391 12.719,11.253 12.887,11.253C12.924,11.253 12.961,11.26 12.996,11.273C13.117,11.316 13.198,11.432 13.196,11.561C13.196,11.561 13.196,11.562 13.196,11.562C13.196,11.73 13.058,11.868 12.89,11.868C12.889,11.868 12.885,11.868 12.885,11.868C12.719,11.868 12.582,11.731 12.582,11.565C12.582,11.563 12.582,11.562 12.582,11.56L12.581,11.56ZM15.691,13.156C15.491,13.237 15.292,13.307 15.101,13.316C14.814,13.326 14.532,13.236 14.303,13.062C14.029,12.832 13.833,12.704 13.751,12.304C13.723,12.109 13.728,11.91 13.767,11.716C13.837,11.389 13.759,11.179 13.528,10.989C13.341,10.833 13.102,10.79 12.84,10.79C12.75,10.785 12.663,10.758 12.586,10.712C12.476,10.658 12.386,10.522 12.472,10.354C12.5,10.3 12.632,10.168 12.664,10.144C13.02,9.942 13.431,10.008 13.81,10.16C14.162,10.304 14.428,10.568 14.811,10.942C15.202,11.393 15.273,11.518 15.496,11.856C15.672,12.121 15.832,12.393 15.941,12.704C16.008,12.899 15.922,13.058 15.691,13.156Z"/>
8
+ </g>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { type ThemedClassName } from '@dxos/ui-types';
3
+ import { type PlotData, type PlotOptions } from '../../types.ts';
4
+ export type PlotProps = ThemedClassName<{
5
+ data: PlotData;
6
+ options: PlotOptions;
7
+ }>;
8
+ export declare function Plot({ classNames, data, options }: PlotProps): React.JSX.Element;
9
+ export declare namespace Plot {
10
+ var displayName: string;
11
+ }
12
+ //# sourceMappingURL=Plot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plot.d.ts","sourceRoot":"","sources":["../../../../../src/components/Plot/Plot.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAIlD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,KAAK,QAAQ,EAAkB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AASjF,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC,CAAC;6BAGkB,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,SAAS"}
@@ -0,0 +1,29 @@
1
+ import { type StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ import { type PlotOptions } from '../../types.ts';
4
+ type StoryArgs = Pick<PlotOptions, 'type' | 'grid'>;
5
+ declare const DefaultStory: (options: StoryArgs) => React.JSX.Element;
6
+ declare const meta: {
7
+ title: string;
8
+ render: typeof DefaultStory;
9
+ decorators: import("@storybook/react").Decorator[];
10
+ args: {
11
+ type: "bar";
12
+ grid: true;
13
+ };
14
+ argTypes: {
15
+ type: {
16
+ control: "inline-radio";
17
+ options: readonly ("bar" | "pie" | "xy")[];
18
+ };
19
+ };
20
+ parameters: {
21
+ layout: string;
22
+ };
23
+ };
24
+ export default meta;
25
+ type Story = StoryObj<typeof meta>;
26
+ export declare const Default: Story;
27
+ export declare const Pie: Story;
28
+ export declare const XY: Story;
29
+ //# sourceMappingURL=Plot.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plot.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Plot/Plot.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAe9D,KAAK,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAEpD,QAAA,MAAM,YAAY,YAAa,SAAS,sBAAkE,CAAC;AAE3G,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;QAMM,MAAM;;CACK,CAAC;eAEb,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,GAAG,EAAE,KAAiC,CAAC;AAEpD,eAAO,MAAM,EAAE,EAAE,KAAgC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './Plot.tsx';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Plot/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './Plot/index.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './components/index.ts';
2
+ export * from './types.ts';
3
+ export * from './util/index.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import * as Schema from 'effect/Schema';
2
+ export declare const PlotType: Schema.Literals<readonly ["bar", "pie", "xy"]>;
3
+ export type PlotType = Schema.Schema.Type<typeof PlotType>;
4
+ export declare const PLOT_TYPES: readonly PlotType[];
5
+ /** Presentation options; persisted alongside the data source by the host. */
6
+ export declare const PlotOptions: Schema.Struct<{
7
+ readonly type: Schema.Literals<readonly ["bar", "pie", "xy"]>;
8
+ /** The first row holds the series names. */
9
+ readonly header: Schema.optional<Schema.Boolean>;
10
+ /** Draw grid lines (bar and xy). */
11
+ readonly grid: Schema.optional<Schema.Boolean>;
12
+ }>;
13
+ export type PlotOptions = Schema.Schema.Type<typeof PlotOptions>;
14
+ export type PlotValue = string | number | boolean | null;
15
+ /**
16
+ * Column-oriented table: the first column is the category (bar, pie) or the x axis (xy);
17
+ * each remaining column is a series.
18
+ */
19
+ export type PlotData = {
20
+ columns: string[];
21
+ rows: PlotValue[][];
22
+ };
23
+ /** One series value in long form, the shape Observable Plot marks consume. */
24
+ export type PlotDatum = {
25
+ key: PlotValue;
26
+ series: string;
27
+ value: number;
28
+ };
29
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,QAAQ,gDAAwC,CAAC;AAC9D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE3D,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAAsB,CAAC;AAEjE,6EAA6E;AAC7E,eAAO,MAAM,WAAW;;IAEtB,4CAA4C;;IAE5C,oCAAoC;;EAEpC,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;CACrB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,SAAS,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type PlotData, type PlotDatum, type PlotValue } from '../types.ts';
2
+ export type ToPlotDataOptions = {
3
+ /** The first row holds the series names. */
4
+ header?: boolean;
5
+ };
6
+ /** Converts a 2D block of cell values (rows of columns) into `PlotData`. */
7
+ export declare const toPlotData: (values: PlotValue[][], { header }?: ToPlotDataOptions) => PlotData;
8
+ /**
9
+ * Flattens `PlotData` into long form. With a single column the row index is the key;
10
+ * otherwise the first column is the key and each remaining column a series. Non-numeric values are dropped.
11
+ */
12
+ export declare const toPlotDatums: ({ columns, rows }: PlotData) => PlotDatum[];
13
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/util/data.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAwB5E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,UAAU,WAAY,SAAS,EAAE,EAAE,eAAsB,iBAAiB,KAAQ,QAQ9F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,sBAAuB,QAAQ,KAAG,SAAS,EAcnE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.test.d.ts","sourceRoot":"","sources":["../../../../src/util/data.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './data.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}