open-mcp-app-ui 0.0.6 → 0.0.7
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/charts/index.d.ts +53 -12
- package/dist/charts/index.js +60 -1
- package/dist/charts/index.js.map +1 -1
- package/dist/editor/index.d.ts +7 -7
- package/dist/editor/index.js +11 -12
- package/dist/editor/index.js.map +1 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +23 -26
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/table/index.d.ts +8 -1
- package/dist/table/index.js +7 -12
- package/dist/table/index.js.map +1 -1
- package/package.json +1 -1
package/dist/charts/index.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
3
|
export { Area, Bar, CartesianGrid, Cell, Legend, Line, Pie, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, Tooltip as RechartsTooltip, ReferenceArea, ReferenceLine, ResponsiveContainer, Scatter, XAxis, YAxis } from 'recharts';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Border variant type shared across chart sub-components.
|
|
7
|
+
* - "default" uses --color-border-primary (stronger)
|
|
8
|
+
* - "secondary" uses --color-border-secondary (subtler)
|
|
9
|
+
*/
|
|
10
|
+
type ChartBorderVariant = "default" | "secondary";
|
|
11
|
+
|
|
5
12
|
/**
|
|
6
13
|
* Shared chart types.
|
|
7
14
|
* Defines the theme interface and common props used across all chart wrappers.
|
|
@@ -35,36 +42,56 @@ interface ThemedLineChartProps extends ChartContainerProps {
|
|
|
35
42
|
children: ReactNode;
|
|
36
43
|
/** Show background grid lines. */
|
|
37
44
|
grid?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Border variant for axis lines and tick marks.
|
|
47
|
+
* - "default" — uses --color-border-primary (stronger)
|
|
48
|
+
* - "secondary" — uses --color-border-secondary (subtler)
|
|
49
|
+
*/
|
|
50
|
+
borderVariant?: ChartBorderVariant;
|
|
38
51
|
}
|
|
39
52
|
/**
|
|
40
53
|
* Themed LineChart.
|
|
41
|
-
* Automatically assigns palette colors to Line children
|
|
42
|
-
*
|
|
54
|
+
* Automatically assigns palette colors to Line children and
|
|
55
|
+
* applies themed axis styles to XAxis/YAxis children.
|
|
43
56
|
*/
|
|
44
|
-
declare const LineChart: ({ data, height, colorPalette, className, style, grid, children, }: ThemedLineChartProps) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
declare const LineChart: ({ data, height, colorPalette, className, style, grid, borderVariant, children, }: ThemedLineChartProps) => react_jsx_runtime.JSX.Element;
|
|
45
58
|
|
|
46
59
|
interface ThemedBarChartProps extends ChartContainerProps {
|
|
47
60
|
/** Chart data array. */
|
|
48
61
|
data: Record<string, unknown>[];
|
|
49
62
|
children: ReactNode;
|
|
50
63
|
grid?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Border variant for axis lines and tick marks.
|
|
66
|
+
* - "default" — uses --color-border-primary (stronger)
|
|
67
|
+
* - "secondary" — uses --color-border-secondary (subtler)
|
|
68
|
+
*/
|
|
69
|
+
borderVariant?: ChartBorderVariant;
|
|
51
70
|
}
|
|
52
71
|
/**
|
|
53
72
|
* Themed BarChart.
|
|
54
|
-
* Automatically assigns palette colors to Bar children
|
|
73
|
+
* Automatically assigns palette colors to Bar children and
|
|
74
|
+
* applies themed axis styles to XAxis/YAxis children.
|
|
55
75
|
*/
|
|
56
|
-
declare const BarChart: ({ data, height, colorPalette, className, style, grid, children, }: ThemedBarChartProps) => react_jsx_runtime.JSX.Element;
|
|
76
|
+
declare const BarChart: ({ data, height, colorPalette, className, style, grid, borderVariant, children, }: ThemedBarChartProps) => react_jsx_runtime.JSX.Element;
|
|
57
77
|
|
|
58
78
|
interface ThemedAreaChartProps extends ChartContainerProps {
|
|
59
79
|
data: Record<string, unknown>[];
|
|
60
80
|
children: ReactNode;
|
|
61
81
|
grid?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Border variant for axis lines and tick marks.
|
|
84
|
+
* - "default" — uses --color-border-primary (stronger)
|
|
85
|
+
* - "secondary" — uses --color-border-secondary (subtler)
|
|
86
|
+
*/
|
|
87
|
+
borderVariant?: ChartBorderVariant;
|
|
62
88
|
}
|
|
63
89
|
/**
|
|
64
90
|
* Themed AreaChart.
|
|
65
|
-
* Auto-assigns palette colors with gradient fill to Area children
|
|
91
|
+
* Auto-assigns palette colors with gradient fill to Area children and
|
|
92
|
+
* applies themed axis styles to XAxis/YAxis children.
|
|
66
93
|
*/
|
|
67
|
-
declare const AreaChart: ({ data, height, colorPalette, className, style, grid, children, }: ThemedAreaChartProps) => react_jsx_runtime.JSX.Element;
|
|
94
|
+
declare const AreaChart: ({ data, height, colorPalette, className, style, grid, borderVariant, children, }: ThemedAreaChartProps) => react_jsx_runtime.JSX.Element;
|
|
68
95
|
|
|
69
96
|
interface ThemedPieChartProps extends Omit<ChartContainerProps, "height"> {
|
|
70
97
|
/** Chart height (also used for approximate width in responsive container). */
|
|
@@ -81,12 +108,19 @@ declare const PieChart: ({ height, colorPalette, className, style, children, }:
|
|
|
81
108
|
interface ThemedScatterChartProps extends ChartContainerProps {
|
|
82
109
|
children: ReactNode;
|
|
83
110
|
grid?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Border variant for axis lines and tick marks.
|
|
113
|
+
* - "default" — uses --color-border-primary (stronger)
|
|
114
|
+
* - "secondary" — uses --color-border-secondary (subtler)
|
|
115
|
+
*/
|
|
116
|
+
borderVariant?: ChartBorderVariant;
|
|
84
117
|
}
|
|
85
118
|
/**
|
|
86
119
|
* Themed ScatterChart.
|
|
87
|
-
* Auto-assigns palette fill colors to Scatter children
|
|
120
|
+
* Auto-assigns palette fill colors to Scatter children and
|
|
121
|
+
* applies themed axis styles to XAxis/YAxis children.
|
|
88
122
|
*/
|
|
89
|
-
declare const ScatterChart: ({ height, colorPalette, className, style, grid, children, }: ThemedScatterChartProps) => react_jsx_runtime.JSX.Element;
|
|
123
|
+
declare const ScatterChart: ({ height, colorPalette, className, style, grid, borderVariant, children, }: ThemedScatterChartProps) => react_jsx_runtime.JSX.Element;
|
|
90
124
|
|
|
91
125
|
interface ThemedRadarChartProps extends ChartContainerProps {
|
|
92
126
|
data: Record<string, unknown>[];
|
|
@@ -102,12 +136,19 @@ interface ThemedComposedChartProps extends ChartContainerProps {
|
|
|
102
136
|
data: Record<string, unknown>[];
|
|
103
137
|
children: ReactNode;
|
|
104
138
|
grid?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Border variant for axis lines and tick marks.
|
|
141
|
+
* - "default" — uses --color-border-primary (stronger)
|
|
142
|
+
* - "secondary" — uses --color-border-secondary (subtler)
|
|
143
|
+
*/
|
|
144
|
+
borderVariant?: ChartBorderVariant;
|
|
105
145
|
}
|
|
106
146
|
/**
|
|
107
147
|
* Themed ComposedChart.
|
|
108
|
-
* Auto-assigns palette colors to Line, Bar, and Area children
|
|
148
|
+
* Auto-assigns palette colors to Line, Bar, and Area children and
|
|
149
|
+
* applies themed axis styles to XAxis/YAxis children.
|
|
109
150
|
*/
|
|
110
|
-
declare const ComposedChart: ({ data, height, colorPalette, className, style, grid, children, }: ThemedComposedChartProps) => react_jsx_runtime.JSX.Element;
|
|
151
|
+
declare const ComposedChart: ({ data, height, colorPalette, className, style, grid, borderVariant, children, }: ThemedComposedChartProps) => react_jsx_runtime.JSX.Element;
|
|
111
152
|
|
|
112
153
|
/**
|
|
113
154
|
* ThemedTooltip — Pre-themed tooltip using MCP Apps spec CSS variables.
|
|
@@ -121,4 +162,4 @@ declare const ComposedChart: ({ data, height, colorPalette, className, style, gr
|
|
|
121
162
|
*/
|
|
122
163
|
declare const ThemedTooltip: (props: any) => react_jsx_runtime.JSX.Element;
|
|
123
164
|
|
|
124
|
-
export { AreaChart, BarChart, type ChartContainerProps, ComposedChart, DEFAULT_PALETTE, LineChart, PieChart, RadarChart, ScatterChart, ThemedTooltip as Tooltip };
|
|
165
|
+
export { AreaChart, BarChart, type ChartBorderVariant, type ChartContainerProps, ComposedChart, DEFAULT_PALETTE, LineChart, PieChart, RadarChart, ScatterChart, ThemedTooltip as Tooltip };
|
package/dist/charts/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import { Children, cloneElement, isValidElement } from "react";
|
|
|
3
3
|
import {
|
|
4
4
|
LineChart as RechartsLineChart,
|
|
5
5
|
Line as RechartsLine,
|
|
6
|
+
XAxis as RechartsXAxis,
|
|
7
|
+
YAxis as RechartsYAxis,
|
|
6
8
|
CartesianGrid
|
|
7
9
|
} from "recharts";
|
|
8
10
|
|
|
@@ -44,6 +46,7 @@ var getSeriesColor = ({
|
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
// src/charts/theme.ts
|
|
49
|
+
import React from "react";
|
|
47
50
|
var getCSSVar = ({ name, fallback }) => {
|
|
48
51
|
if (typeof window === "undefined") return fallback;
|
|
49
52
|
const value = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
@@ -66,7 +69,40 @@ var getTooltipStyle = () => ({
|
|
|
66
69
|
marginBottom: "4px"
|
|
67
70
|
}
|
|
68
71
|
});
|
|
69
|
-
var
|
|
72
|
+
var getBorderColor = ({ variant = "default" } = {}) => variant === "secondary" ? getCSSVar({ name: "--color-border-secondary", fallback: "#e5e7eb" }) : getCSSVar({ name: "--color-border-primary", fallback: "#d1d5db" });
|
|
73
|
+
var getGridColor = ({ variant = "secondary" } = {}) => getBorderColor({ variant });
|
|
74
|
+
var getAxisStyle = ({ variant = "default" } = {}) => ({
|
|
75
|
+
tick: {
|
|
76
|
+
fill: getCSSVar({ name: "--color-text-secondary", fallback: "#6b7280" }),
|
|
77
|
+
fontSize: getCSSVar({ name: "--font-text-xs-size", fallback: "11px" }),
|
|
78
|
+
fontFamily: getCSSVar({ name: "--font-sans", fallback: "ui-sans-serif, system-ui, sans-serif" })
|
|
79
|
+
},
|
|
80
|
+
axisLine: {
|
|
81
|
+
stroke: getBorderColor({ variant })
|
|
82
|
+
},
|
|
83
|
+
tickLine: {
|
|
84
|
+
stroke: getBorderColor({ variant })
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
var themeAxisChild = ({
|
|
88
|
+
child,
|
|
89
|
+
variant = "default",
|
|
90
|
+
XAxis: XAxis2,
|
|
91
|
+
YAxis: YAxis2
|
|
92
|
+
}) => {
|
|
93
|
+
const t = child.type;
|
|
94
|
+
const dn = t?.displayName;
|
|
95
|
+
if (t === XAxis2 || t === YAxis2 || dn === "XAxis" || dn === "YAxis") {
|
|
96
|
+
const style = getAxisStyle({ variant });
|
|
97
|
+
const props = child.props;
|
|
98
|
+
return React.cloneElement(child, {
|
|
99
|
+
tick: props.tick === false ? false : { ...style.tick, ...typeof props.tick === "object" && props.tick ? props.tick : {} },
|
|
100
|
+
axisLine: props.axisLine === false ? false : { ...style.axisLine, ...typeof props.axisLine === "object" && props.axisLine ? props.axisLine : {} },
|
|
101
|
+
tickLine: props.tickLine === false ? false : { ...style.tickLine, ...typeof props.tickLine === "object" && props.tickLine ? props.tickLine : {} }
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
};
|
|
70
106
|
|
|
71
107
|
// src/charts/LineChart.tsx
|
|
72
108
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
@@ -77,11 +113,14 @@ var LineChart = ({
|
|
|
77
113
|
className,
|
|
78
114
|
style,
|
|
79
115
|
grid = true,
|
|
116
|
+
borderVariant = "default",
|
|
80
117
|
children
|
|
81
118
|
}) => {
|
|
82
119
|
let seriesIndex = 0;
|
|
83
120
|
const themedChildren = Children.map(children, (child) => {
|
|
84
121
|
if (!isValidElement(child)) return child;
|
|
122
|
+
const themedAxis = themeAxisChild({ child, variant: borderVariant, XAxis: RechartsXAxis, YAxis: RechartsYAxis });
|
|
123
|
+
if (themedAxis) return themedAxis;
|
|
85
124
|
if (child.type === RechartsLine || child.type?.displayName === "Line") {
|
|
86
125
|
const idx = seriesIndex++;
|
|
87
126
|
const existing = child.props.stroke;
|
|
@@ -105,6 +144,8 @@ import { Children as Children2, cloneElement as cloneElement2, isValidElement as
|
|
|
105
144
|
import {
|
|
106
145
|
BarChart as RechartsBarChart,
|
|
107
146
|
Bar as RechartsBar,
|
|
147
|
+
XAxis as RechartsXAxis2,
|
|
148
|
+
YAxis as RechartsYAxis2,
|
|
108
149
|
CartesianGrid as CartesianGrid2
|
|
109
150
|
} from "recharts";
|
|
110
151
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -115,11 +156,14 @@ var BarChart = ({
|
|
|
115
156
|
className,
|
|
116
157
|
style,
|
|
117
158
|
grid = true,
|
|
159
|
+
borderVariant = "default",
|
|
118
160
|
children
|
|
119
161
|
}) => {
|
|
120
162
|
let seriesIndex = 0;
|
|
121
163
|
const themedChildren = Children2.map(children, (child) => {
|
|
122
164
|
if (!isValidElement2(child)) return child;
|
|
165
|
+
const themedAxis = themeAxisChild({ child, variant: borderVariant, XAxis: RechartsXAxis2, YAxis: RechartsYAxis2 });
|
|
166
|
+
if (themedAxis) return themedAxis;
|
|
123
167
|
if (child.type === RechartsBar || child.type?.displayName === "Bar") {
|
|
124
168
|
const idx = seriesIndex++;
|
|
125
169
|
const existing = child.props.fill;
|
|
@@ -141,6 +185,8 @@ import { Children as Children3, cloneElement as cloneElement3, isValidElement as
|
|
|
141
185
|
import {
|
|
142
186
|
AreaChart as RechartsAreaChart,
|
|
143
187
|
Area as RechartsArea,
|
|
188
|
+
XAxis as RechartsXAxis3,
|
|
189
|
+
YAxis as RechartsYAxis3,
|
|
144
190
|
CartesianGrid as CartesianGrid3
|
|
145
191
|
} from "recharts";
|
|
146
192
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -151,11 +197,14 @@ var AreaChart = ({
|
|
|
151
197
|
className,
|
|
152
198
|
style,
|
|
153
199
|
grid = true,
|
|
200
|
+
borderVariant = "default",
|
|
154
201
|
children
|
|
155
202
|
}) => {
|
|
156
203
|
let seriesIndex = 0;
|
|
157
204
|
const themedChildren = Children3.map(children, (child) => {
|
|
158
205
|
if (!isValidElement3(child)) return child;
|
|
206
|
+
const themedAxis = themeAxisChild({ child, variant: borderVariant, XAxis: RechartsXAxis3, YAxis: RechartsYAxis3 });
|
|
207
|
+
if (themedAxis) return themedAxis;
|
|
159
208
|
if (child.type === RechartsArea || child.type?.displayName === "Area") {
|
|
160
209
|
const idx = seriesIndex++;
|
|
161
210
|
const color = child.props.stroke || getSeriesColor({ index: idx, palette: colorPalette });
|
|
@@ -213,6 +262,8 @@ import { Children as Children5, cloneElement as cloneElement5, isValidElement as
|
|
|
213
262
|
import {
|
|
214
263
|
ScatterChart as RechartsScatterChart,
|
|
215
264
|
Scatter as RechartsScatter,
|
|
265
|
+
XAxis as RechartsXAxis4,
|
|
266
|
+
YAxis as RechartsYAxis4,
|
|
216
267
|
CartesianGrid as CartesianGrid4
|
|
217
268
|
} from "recharts";
|
|
218
269
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -222,11 +273,14 @@ var ScatterChart = ({
|
|
|
222
273
|
className,
|
|
223
274
|
style,
|
|
224
275
|
grid = true,
|
|
276
|
+
borderVariant = "default",
|
|
225
277
|
children
|
|
226
278
|
}) => {
|
|
227
279
|
let seriesIndex = 0;
|
|
228
280
|
const themedChildren = Children5.map(children, (child) => {
|
|
229
281
|
if (!isValidElement5(child)) return child;
|
|
282
|
+
const themedAxis = themeAxisChild({ child, variant: borderVariant, XAxis: RechartsXAxis4, YAxis: RechartsYAxis4 });
|
|
283
|
+
if (themedAxis) return themedAxis;
|
|
230
284
|
if (child.type === RechartsScatter || child.type?.displayName === "Scatter") {
|
|
231
285
|
const idx = seriesIndex++;
|
|
232
286
|
const existing = child.props.fill;
|
|
@@ -281,6 +335,8 @@ import {
|
|
|
281
335
|
Line as RechartsLine2,
|
|
282
336
|
Bar as RechartsBar2,
|
|
283
337
|
Area as RechartsArea2,
|
|
338
|
+
XAxis as RechartsXAxis5,
|
|
339
|
+
YAxis as RechartsYAxis5,
|
|
284
340
|
CartesianGrid as CartesianGrid5
|
|
285
341
|
} from "recharts";
|
|
286
342
|
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -291,11 +347,14 @@ var ComposedChart = ({
|
|
|
291
347
|
className,
|
|
292
348
|
style,
|
|
293
349
|
grid = true,
|
|
350
|
+
borderVariant = "default",
|
|
294
351
|
children
|
|
295
352
|
}) => {
|
|
296
353
|
let seriesIndex = 0;
|
|
297
354
|
const themedChildren = Children7.map(children, (child) => {
|
|
298
355
|
if (!isValidElement7(child)) return child;
|
|
356
|
+
const themedAxis = themeAxisChild({ child, variant: borderVariant, XAxis: RechartsXAxis5, YAxis: RechartsYAxis5 });
|
|
357
|
+
if (themedAxis) return themedAxis;
|
|
299
358
|
const t = child.type;
|
|
300
359
|
const dn = t?.displayName;
|
|
301
360
|
if (t === RechartsLine2 || dn === "Line") {
|
package/dist/charts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/charts/LineChart.tsx","../../src/charts/ChartContainer.tsx","../../src/charts/types.ts","../../src/charts/theme.ts","../../src/charts/BarChart.tsx","../../src/charts/AreaChart.tsx","../../src/charts/PieChart.tsx","../../src/charts/ScatterChart.tsx","../../src/charts/RadarChart.tsx","../../src/charts/ComposedChart.tsx","../../src/charts/ThemedTooltip.tsx","../../src/charts/index.ts"],"sourcesContent":["/**\n * LineChart — Themed line/trend chart wrapper.\n *\n * Thin wrapper around Recharts' LineChart that auto-applies\n * MCP Apps spec CSS variable theming to all visual elements.\n *\n * @example\n * ```tsx\n * import { LineChart, Line, XAxis, YAxis, Tooltip } from \"open-mcp-app-ui/charts\";\n *\n * <LineChart data={data} height={300}>\n * <XAxis dataKey=\"month\" />\n * <YAxis />\n * <Tooltip />\n * <Line dataKey=\"revenue\" />\n * </LineChart>\n * ```\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n LineChart as RechartsLineChart,\n Line as RechartsLine,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedLineChartProps extends ChartContainerProps {\n /** Chart data array. Each entry is one data point. */\n data: Record<string, unknown>[];\n /** Child elements (Line, XAxis, YAxis, Tooltip, Legend, etc.) */\n children: ReactNode;\n /** Show background grid lines. */\n grid?: boolean;\n}\n\n/**\n * Themed LineChart.\n * Automatically assigns palette colors to Line children that\n * don't have an explicit stroke prop.\n */\nexport const LineChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n grid = true,\n children,\n}: ThemedLineChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n if ((child.type as any) === RechartsLine || (child.type as any)?.displayName === \"Line\") {\n const idx = seriesIndex++;\n const existing = (child.props as any).stroke;\n return cloneElement(child as React.ReactElement<any>, {\n stroke: existing || getSeriesColor({ index: idx, palette: colorPalette }),\n strokeWidth: (child.props as any).strokeWidth ?? 2,\n dot: (child.props as any).dot ?? false,\n activeDot: (child.props as any).activeDot ?? { r: 4 },\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsLineChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} />}\n {themedChildren}\n </RechartsLineChart>\n </ChartContainer>\n );\n};\n","/**\n * ChartContainer — Responsive wrapper for all chart types.\n *\n * Wraps Recharts' ResponsiveContainer with the theme palette context.\n * All chart wrappers use this internally. Not exported directly — each\n * chart type (LineChart, BarChart, etc.) composes it.\n */\n\nimport { type ReactNode } from \"react\";\nimport { ResponsiveContainer } from \"recharts\";\nimport { DEFAULT_PALETTE, type ChartContainerProps } from \"./types.js\";\n\n/**\n * Provides a responsive, themed container for a Recharts chart.\n * Fills 100% width of its parent and uses the specified height.\n */\nexport const ChartContainer = ({\n height = 300,\n className = \"\",\n style,\n children,\n}: ChartContainerProps & { children: ReactNode }) => (\n <div\n className={`omu-chart w-full ${className}`}\n style={{ height: `${height}px`, ...style }}\n >\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {children as React.ReactElement}\n </ResponsiveContainer>\n </div>\n);\n\n/**\n * Get the color for a given series index from the palette.\n * Wraps around if there are more series than palette entries.\n */\nexport const getSeriesColor = ({\n index,\n palette,\n}: {\n index: number;\n palette?: string[];\n}): string => {\n const colors = palette ?? DEFAULT_PALETTE;\n return colors[index % colors.length];\n};\n","/**\n * Shared chart types.\n * Defines the theme interface and common props used across all chart wrappers.\n */\n\nimport type { CSSProperties } from \"react\";\n\n/**\n * Color palette for multi-series charts.\n * Each series gets the next color in the palette.\n * Uses CSS variables from the MCP Apps spec where possible,\n * with opacity variations for additional series.\n */\nexport const DEFAULT_PALETTE = [\n \"var(--color-accent, #6366f1)\",\n \"var(--color-text-secondary, #6b7280)\",\n \"var(--color-ring-primary, #a78bfa)\",\n \"var(--color-text-tertiary, #9ca3af)\",\n \"var(--color-border-primary, #d1d5db)\",\n \"color-mix(in srgb, var(--color-accent, #6366f1) 60%, transparent)\",\n \"color-mix(in srgb, var(--color-accent, #6366f1) 35%, transparent)\",\n];\n\n/**\n * Base props shared by all chart container wrappers.\n */\nexport interface ChartContainerProps {\n /** Chart height in pixels. Width is always 100% of parent. */\n height?: number;\n /** Custom color palette for series data. Overrides the default palette. */\n colorPalette?: string[];\n /** Additional CSS class on the outermost wrapper. */\n className?: string;\n /** Inline styles on the outermost wrapper. */\n style?: CSSProperties;\n}\n","/**\n * Chart Theme — CSS variable mapping for Recharts.\n *\n * Reads MCP Apps spec CSS variables at render time and provides\n * them as style objects for Recharts sub-components (tooltip, grid,\n * axis labels, legend). This is how charts automatically adapt to\n * the host's theme without configuration.\n */\n\n/**\n * Resolve a CSS variable value at runtime.\n * Falls back to the provided default if the variable is not set.\n */\nexport const getCSSVar = ({ name, fallback }: { name: string; fallback: string }): string => {\n if (typeof window === \"undefined\") return fallback;\n const value = getComputedStyle(document.documentElement).getPropertyValue(name).trim();\n return value || fallback;\n};\n\n/**\n * Themed tooltip style object for Recharts <Tooltip>.\n * Applied via contentStyle, labelStyle, and wrapperStyle props.\n */\nexport const getTooltipStyle = () => ({\n contentStyle: {\n backgroundColor: getCSSVar({ name: \"--color-background-secondary\", fallback: \"#f9fafb\" }),\n border: `1px solid ${getCSSVar({ name: \"--color-border-secondary\", fallback: \"#e5e7eb\" })}`,\n borderRadius: getCSSVar({ name: \"--border-radius-md\", fallback: \"8px\" }),\n color: getCSSVar({ name: \"--color-text-primary\", fallback: \"#111827\" }),\n fontSize: getCSSVar({ name: \"--font-text-sm-size\", fallback: \"13px\" }),\n fontFamily: getCSSVar({ name: \"--font-sans\", fallback: \"ui-sans-serif, system-ui, sans-serif\" }),\n padding: \"8px 12px\",\n boxShadow: \"0 4px 12px rgba(0,0,0,0.08)\",\n },\n labelStyle: {\n color: getCSSVar({ name: \"--color-text-primary\", fallback: \"#111827\" }),\n fontWeight: 500,\n marginBottom: \"4px\",\n },\n});\n\n/**\n * Themed grid line color for <CartesianGrid>.\n */\nexport const getGridColor = (): string =>\n getCSSVar({ name: \"--color-border-secondary\", fallback: \"#e5e7eb\" });\n\n/**\n * Themed axis tick/label style for <XAxis> and <YAxis>.\n */\nexport const getAxisStyle = () => ({\n tick: {\n fill: getCSSVar({ name: \"--color-text-secondary\", fallback: \"#6b7280\" }),\n fontSize: getCSSVar({ name: \"--font-text-xs-size\", fallback: \"11px\" }),\n fontFamily: getCSSVar({ name: \"--font-sans\", fallback: \"ui-sans-serif, system-ui, sans-serif\" }),\n },\n axisLine: {\n stroke: getCSSVar({ name: \"--color-border-secondary\", fallback: \"#e5e7eb\" }),\n },\n tickLine: {\n stroke: getCSSVar({ name: \"--color-border-secondary\", fallback: \"#e5e7eb\" }),\n },\n});\n\n/**\n * Themed legend style for <Legend>.\n */\nexport const getLegendStyle = () => ({\n color: getCSSVar({ name: \"--color-text-secondary\", fallback: \"#6b7280\" }),\n fontSize: getCSSVar({ name: \"--font-text-sm-size\", fallback: \"13px\" }),\n fontFamily: getCSSVar({ name: \"--font-sans\", fallback: \"ui-sans-serif, system-ui, sans-serif\" }),\n});\n","/**\n * BarChart — Themed bar/column chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n BarChart as RechartsBarChart,\n Bar as RechartsBar,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedBarChartProps extends ChartContainerProps {\n /** Chart data array. */\n data: Record<string, unknown>[];\n children: ReactNode;\n grid?: boolean;\n}\n\n/**\n * Themed BarChart.\n * Automatically assigns palette colors to Bar children.\n */\nexport const BarChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n grid = true,\n children,\n}: ThemedBarChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n if ((child.type as any) === RechartsBar || (child.type as any)?.displayName === \"Bar\") {\n const idx = seriesIndex++;\n const existing = (child.props as any).fill;\n return cloneElement(child as React.ReactElement<any>, {\n fill: existing || getSeriesColor({ index: idx, palette: colorPalette }),\n radius: (child.props as any).radius ?? [4, 4, 0, 0],\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsBarChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} vertical={false} />}\n {themedChildren}\n </RechartsBarChart>\n </ChartContainer>\n );\n};\n","/**\n * AreaChart — Themed area/volume chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n AreaChart as RechartsAreaChart,\n Area as RechartsArea,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedAreaChartProps extends ChartContainerProps {\n data: Record<string, unknown>[];\n children: ReactNode;\n grid?: boolean;\n}\n\n/**\n * Themed AreaChart.\n * Auto-assigns palette colors with gradient fill to Area children.\n */\nexport const AreaChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n grid = true,\n children,\n}: ThemedAreaChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n if ((child.type as any) === RechartsArea || (child.type as any)?.displayName === \"Area\") {\n const idx = seriesIndex++;\n const color = (child.props as any).stroke || getSeriesColor({ index: idx, palette: colorPalette });\n return cloneElement(child as React.ReactElement<any>, {\n stroke: color,\n fill: (child.props as any).fill || color,\n fillOpacity: (child.props as any).fillOpacity ?? 0.15,\n strokeWidth: (child.props as any).strokeWidth ?? 2,\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsAreaChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} />}\n {themedChildren}\n </RechartsAreaChart>\n </ChartContainer>\n );\n};\n","/**\n * PieChart — Themed pie/donut chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n PieChart as RechartsPieChart,\n Pie as RechartsPie,\n Cell,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedPieChartProps extends Omit<ChartContainerProps, \"height\"> {\n /** Chart height (also used for approximate width in responsive container). */\n height?: number;\n children: ReactNode;\n}\n\n/**\n * Themed PieChart.\n * Auto-assigns palette colors to Pie data via Cell children when no\n * explicit fill is provided on individual data entries.\n */\nexport const PieChart = ({\n height,\n colorPalette,\n className,\n style,\n children,\n}: ThemedPieChartProps) => {\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n if ((child.type as any) === RechartsPie || (child.type as any)?.displayName === \"Pie\") {\n const props = child.props as any;\n const data: any[] = props.data ?? [];\n /**\n * If the Pie has no Cell children, inject them automatically\n * so each slice gets a palette color.\n */\n const hasExplicitCells = Children.toArray(props.children).some(\n (c: any) => isValidElement(c) && ((c.type as any) === Cell || (c.type as any)?.displayName === \"Cell\")\n );\n if (!hasExplicitCells && data.length > 0) {\n return cloneElement(child as React.ReactElement<any>, {\n children: data.map((_, i) => (\n <Cell key={`cell-${i}`} fill={getSeriesColor({ index: i, palette: colorPalette })} />\n )),\n });\n }\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsPieChart>\n {themedChildren}\n </RechartsPieChart>\n </ChartContainer>\n );\n};\n","/**\n * ScatterChart — Themed scatter/correlation chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n ScatterChart as RechartsScatterChart,\n Scatter as RechartsScatter,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedScatterChartProps extends ChartContainerProps {\n children: ReactNode;\n grid?: boolean;\n}\n\n/**\n * Themed ScatterChart.\n * Auto-assigns palette fill colors to Scatter children.\n */\nexport const ScatterChart = ({\n height,\n colorPalette,\n className,\n style,\n grid = true,\n children,\n}: ThemedScatterChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n if ((child.type as any) === RechartsScatter || (child.type as any)?.displayName === \"Scatter\") {\n const idx = seriesIndex++;\n const existing = (child.props as any).fill;\n return cloneElement(child as React.ReactElement<any>, {\n fill: existing || getSeriesColor({ index: idx, palette: colorPalette }),\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsScatterChart margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} />}\n {themedChildren}\n </RechartsScatterChart>\n </ChartContainer>\n );\n};\n","/**\n * RadarChart — Themed radar/spider chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n RadarChart as RechartsRadarChart,\n Radar as RechartsRadar,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedRadarChartProps extends ChartContainerProps {\n data: Record<string, unknown>[];\n children: ReactNode;\n}\n\n/**\n * Themed RadarChart.\n * Auto-assigns palette colors to Radar children.\n */\nexport const RadarChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n children,\n}: ThemedRadarChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n if ((child.type as any) === RechartsRadar || (child.type as any)?.displayName === \"Radar\") {\n const idx = seriesIndex++;\n const color = (child.props as any).stroke || getSeriesColor({ index: idx, palette: colorPalette });\n return cloneElement(child as React.ReactElement<any>, {\n stroke: color,\n fill: (child.props as any).fill || color,\n fillOpacity: (child.props as any).fillOpacity ?? 0.2,\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsRadarChart data={data} cx=\"50%\" cy=\"50%\" outerRadius=\"70%\">\n {themedChildren}\n </RechartsRadarChart>\n </ChartContainer>\n );\n};\n","/**\n * ComposedChart — Themed mixed chart wrapper (Bar + Line + Area in one).\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n ComposedChart as RechartsComposedChart,\n Line as RechartsLine,\n Bar as RechartsBar,\n Area as RechartsArea,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedComposedChartProps extends ChartContainerProps {\n data: Record<string, unknown>[];\n children: ReactNode;\n grid?: boolean;\n}\n\n/**\n * Themed ComposedChart.\n * Auto-assigns palette colors to Line, Bar, and Area children.\n */\nexport const ComposedChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n grid = true,\n children,\n}: ThemedComposedChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n const t = child.type as any;\n const dn = t?.displayName;\n\n if (t === RechartsLine || dn === \"Line\") {\n const idx = seriesIndex++;\n return cloneElement(child as React.ReactElement<any>, {\n stroke: (child.props as any).stroke || getSeriesColor({ index: idx, palette: colorPalette }),\n strokeWidth: (child.props as any).strokeWidth ?? 2,\n dot: (child.props as any).dot ?? false,\n });\n }\n if (t === RechartsBar || dn === \"Bar\") {\n const idx = seriesIndex++;\n return cloneElement(child as React.ReactElement<any>, {\n fill: (child.props as any).fill || getSeriesColor({ index: idx, palette: colorPalette }),\n radius: (child.props as any).radius ?? [4, 4, 0, 0],\n });\n }\n if (t === RechartsArea || dn === \"Area\") {\n const idx = seriesIndex++;\n const color = (child.props as any).stroke || getSeriesColor({ index: idx, palette: colorPalette });\n return cloneElement(child as React.ReactElement<any>, {\n stroke: color,\n fill: (child.props as any).fill || color,\n fillOpacity: (child.props as any).fillOpacity ?? 0.15,\n strokeWidth: (child.props as any).strokeWidth ?? 2,\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsComposedChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} />}\n {themedChildren}\n </RechartsComposedChart>\n </ChartContainer>\n );\n};\n","/**\n * ThemedTooltip — Pre-themed tooltip using MCP Apps spec CSS variables.\n *\n * Drop-in replacement for Recharts' Tooltip that automatically\n * applies the host's theme colors for background, text, border.\n */\n\nimport { useMemo } from \"react\";\nimport { Tooltip as RechartsTooltip } from \"recharts\";\nimport { getTooltipStyle } from \"./theme.js\";\n\n/**\n * A themed Tooltip that reads CSS variables at render time.\n * Forwards all standard Recharts Tooltip props.\n */\nexport const ThemedTooltip = (props: any) => {\n const style = useMemo(() => getTooltipStyle(), []);\n return (\n <RechartsTooltip\n contentStyle={style.contentStyle}\n labelStyle={style.labelStyle}\n cursor={{ stroke: \"var(--color-border-secondary, #e5e7eb)\", strokeWidth: 1 }}\n {...props}\n />\n );\n};\n","/**\n * open-mcp-app-ui/charts\n *\n * Themed chart components built on Recharts v3.\n * Auto-styled via MCP Apps spec CSS variables.\n *\n * Usage:\n * import { LineChart, Line, XAxis, YAxis, Tooltip } from \"open-mcp-app-ui/charts\";\n *\n * <LineChart data={data} height={300}>\n * <XAxis dataKey=\"month\" />\n * <YAxis />\n * <Tooltip />\n * <Line dataKey=\"revenue\" />\n * </LineChart>\n */\n\n// Themed chart wrappers\nexport { LineChart } from \"./LineChart.js\";\nexport { BarChart } from \"./BarChart.js\";\nexport { AreaChart } from \"./AreaChart.js\";\nexport { PieChart } from \"./PieChart.js\";\nexport { ScatterChart } from \"./ScatterChart.js\";\nexport { RadarChart } from \"./RadarChart.js\";\nexport { ComposedChart } from \"./ComposedChart.js\";\nexport { ThemedTooltip as Tooltip } from \"./ThemedTooltip.js\";\n\n// Re-export Recharts primitives for composition\nexport {\n Line,\n Bar,\n Area,\n Pie,\n Scatter,\n Radar,\n Cell,\n XAxis,\n YAxis,\n CartesianGrid,\n Legend,\n PolarGrid,\n PolarAngleAxis,\n PolarRadiusAxis,\n Tooltip as RechartsTooltip,\n ReferenceLine,\n ReferenceArea,\n ResponsiveContainer,\n} from \"recharts\";\n\n// Types\nexport type { Ch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AAC;AAED,SACE,gBAAAL,KAAC,kBAAe,QAAgB,WAAsB,OACpD,0BAAAC,MAAC,yBAAsB,MAAY,QAAQ,EAAE,KAAK,GAAG,OAAO,IAAI,QAAQ,GAAG,MAAM,EAAE,GAChF;AAAA,YAAQ,gBAAAD,KAACQ,gBAAA,EAAc,iBAAgB,OAAM,QAAQ,aAAa,GAAG,SAAS,KAAK;AAAA,IACnF;AAAA,KACH,GACF;AAEJ;;;ACvEA,SAAS,eAAe;AACxB,SAAS,WAAW,uBAAuB;AAUvC,gBAAAC,YAAA;AAHG,IAAM,gBAAgB,CAAC,UAAe;AAC3C,QAAM,QAAQ,QAAQ,MAAM,gBAAgB,GAAG,CAAC,CAAC;AACjD,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,cAAc,MAAM;AAAA,MACpB,YAAY,MAAM;AAAA,MAClB,QAAQ,EAAE,QAAQ,0CAA0C,aAAa,EAAE;AAAA,MAC1E,GAAG;AAAA;AAAA,EACN;AAEJ;;;ACGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACW;AAAA,EACX;AAAA,EACA;AAAA,EACA,uBAAAC;AAAA,OACK;","names":["jsx","Children","cloneElement","isValidElement","CartesianGrid","jsx","jsxs","Children","isValidElement","cloneElement","CartesianGrid","Children","cloneElement","isValidElement","CartesianGrid","jsx","jsxs","Children","isValidElement","cloneElement","CartesianGrid","Children","cloneElement","isValidElement","jsx","Children","isValidElement","cloneElement","Children","cloneElement","isValidElement","CartesianGrid","jsx","jsxs","Children","isValidElement","cloneElement","CartesianGrid","Children","cloneElement","isValidElement","jsx","Children","isValidElement","cloneElement","Children","cloneElement","isValidElement","RechartsLine","RechartsBar","RechartsArea","CartesianGrid","jsx","jsxs","Children","isValidElement","RechartsLine","cloneElement","RechartsBar","RechartsArea","CartesianGrid","jsx","Cell","CartesianGrid","ResponsiveContainer"]}
|
|
1
|
+
{"version":3,"sources":["../../src/charts/LineChart.tsx","../../src/charts/ChartContainer.tsx","../../src/charts/types.ts","../../src/charts/theme.ts","../../src/charts/BarChart.tsx","../../src/charts/AreaChart.tsx","../../src/charts/PieChart.tsx","../../src/charts/ScatterChart.tsx","../../src/charts/RadarChart.tsx","../../src/charts/ComposedChart.tsx","../../src/charts/ThemedTooltip.tsx","../../src/charts/index.ts"],"sourcesContent":["/**\n * LineChart — Themed line/trend chart wrapper.\n *\n * Thin wrapper around Recharts' LineChart that auto-applies\n * MCP Apps spec CSS variable theming to all visual elements.\n *\n * @example\n * ```tsx\n * import { LineChart, Line, XAxis, YAxis, Tooltip } from \"open-mcp-app-ui/charts\";\n *\n * <LineChart data={data} height={300}>\n * <XAxis dataKey=\"month\" />\n * <YAxis />\n * <Tooltip />\n * <Line dataKey=\"revenue\" />\n * </LineChart>\n * ```\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n LineChart as RechartsLineChart,\n Line as RechartsLine,\n XAxis as RechartsXAxis,\n YAxis as RechartsYAxis,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor, themeAxisChild, type ChartBorderVariant } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedLineChartProps extends ChartContainerProps {\n /** Chart data array. Each entry is one data point. */\n data: Record<string, unknown>[];\n /** Child elements (Line, XAxis, YAxis, Tooltip, Legend, etc.) */\n children: ReactNode;\n /** Show background grid lines. */\n grid?: boolean;\n /**\n * Border variant for axis lines and tick marks.\n * - \"default\" — uses --color-border-primary (stronger)\n * - \"secondary\" — uses --color-border-secondary (subtler)\n */\n borderVariant?: ChartBorderVariant;\n}\n\n/**\n * Themed LineChart.\n * Automatically assigns palette colors to Line children and\n * applies themed axis styles to XAxis/YAxis children.\n */\nexport const LineChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n grid = true,\n borderVariant = \"default\",\n children,\n}: ThemedLineChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n\n // Theme axis children\n const themedAxis = themeAxisChild({ child: child as React.ReactElement<any>, variant: borderVariant, XAxis: RechartsXAxis, YAxis: RechartsYAxis });\n if (themedAxis) return themedAxis;\n\n if ((child.type as any) === RechartsLine || (child.type as any)?.displayName === \"Line\") {\n const idx = seriesIndex++;\n const existing = (child.props as any).stroke;\n return cloneElement(child as React.ReactElement<any>, {\n stroke: existing || getSeriesColor({ index: idx, palette: colorPalette }),\n strokeWidth: (child.props as any).strokeWidth ?? 2,\n dot: (child.props as any).dot ?? false,\n activeDot: (child.props as any).activeDot ?? { r: 4 },\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsLineChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} />}\n {themedChildren}\n </RechartsLineChart>\n </ChartContainer>\n );\n};\n","/**\n * ChartContainer — Responsive wrapper for all chart types.\n *\n * Wraps Recharts' ResponsiveContainer with the theme palette context.\n * All chart wrappers use this internally. Not exported directly — each\n * chart type (LineChart, BarChart, etc.) composes it.\n */\n\nimport { type ReactNode } from \"react\";\nimport { ResponsiveContainer } from \"recharts\";\nimport { DEFAULT_PALETTE, type ChartContainerProps } from \"./types.js\";\n\n/**\n * Provides a responsive, themed container for a Recharts chart.\n * Fills 100% width of its parent and uses the specified height.\n */\nexport const ChartContainer = ({\n height = 300,\n className = \"\",\n style,\n children,\n}: ChartContainerProps & { children: ReactNode }) => (\n <div\n className={`omu-chart w-full ${className}`}\n style={{ height: `${height}px`, ...style }}\n >\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {children as React.ReactElement}\n </ResponsiveContainer>\n </div>\n);\n\n/**\n * Get the color for a given series index from the palette.\n * Wraps around if there are more series than palette entries.\n */\nexport const getSeriesColor = ({\n index,\n palette,\n}: {\n index: number;\n palette?: string[];\n}): string => {\n const colors = palette ?? DEFAULT_PALETTE;\n return colors[index % colors.length];\n};\n","/**\n * Shared chart types.\n * Defines the theme interface and common props used across all chart wrappers.\n */\n\nimport type { CSSProperties } from \"react\";\n\n/**\n * Color palette for multi-series charts.\n * Each series gets the next color in the palette.\n * Uses CSS variables from the MCP Apps spec where possible,\n * with opacity variations for additional series.\n */\nexport const DEFAULT_PALETTE = [\n \"var(--color-accent, #6366f1)\",\n \"var(--color-text-secondary, #6b7280)\",\n \"var(--color-ring-primary, #a78bfa)\",\n \"var(--color-text-tertiary, #9ca3af)\",\n \"var(--color-border-primary, #d1d5db)\",\n \"color-mix(in srgb, var(--color-accent, #6366f1) 60%, transparent)\",\n \"color-mix(in srgb, var(--color-accent, #6366f1) 35%, transparent)\",\n];\n\n/**\n * Base props shared by all chart container wrappers.\n */\nexport interface ChartContainerProps {\n /** Chart height in pixels. Width is always 100% of parent. */\n height?: number;\n /** Custom color palette for series data. Overrides the default palette. */\n colorPalette?: string[];\n /** Additional CSS class on the outermost wrapper. */\n className?: string;\n /** Inline styles on the outermost wrapper. */\n style?: CSSProperties;\n}\n","import React from \"react\";\n\n/**\n * Chart Theme — CSS variable mapping for Recharts.\n *\n * Reads MCP Apps spec CSS variables at render time and provides\n * them as style objects for Recharts sub-components (tooltip, grid,\n * axis labels, legend). This is how charts automatically adapt to\n * the host's theme without configuration.\n */\n\n/**\n * Resolve a CSS variable value at runtime.\n * Falls back to the provided default if the variable is not set.\n */\nexport const getCSSVar = ({ name, fallback }: { name: string; fallback: string }): string => {\n if (typeof window === \"undefined\") return fallback;\n const value = getComputedStyle(document.documentElement).getPropertyValue(name).trim();\n return value || fallback;\n};\n\n/**\n * Themed tooltip style object for Recharts <Tooltip>.\n * Applied via contentStyle, labelStyle, and wrapperStyle props.\n */\nexport const getTooltipStyle = () => ({\n contentStyle: {\n backgroundColor: getCSSVar({ name: \"--color-background-secondary\", fallback: \"#f9fafb\" }),\n border: `1px solid ${getCSSVar({ name: \"--color-border-secondary\", fallback: \"#e5e7eb\" })}`,\n borderRadius: getCSSVar({ name: \"--border-radius-md\", fallback: \"8px\" }),\n color: getCSSVar({ name: \"--color-text-primary\", fallback: \"#111827\" }),\n fontSize: getCSSVar({ name: \"--font-text-sm-size\", fallback: \"13px\" }),\n fontFamily: getCSSVar({ name: \"--font-sans\", fallback: \"ui-sans-serif, system-ui, sans-serif\" }),\n padding: \"8px 12px\",\n boxShadow: \"0 4px 12px rgba(0,0,0,0.08)\",\n },\n labelStyle: {\n color: getCSSVar({ name: \"--color-text-primary\", fallback: \"#111827\" }),\n fontWeight: 500,\n marginBottom: \"4px\",\n },\n});\n\n/**\n * Border variant type shared across chart sub-components.\n * - \"default\" uses --color-border-primary (stronger)\n * - \"secondary\" uses --color-border-secondary (subtler)\n */\nexport type ChartBorderVariant = \"default\" | \"secondary\";\n\n/**\n * Resolve the border CSS variable for the given variant.\n */\nconst getBorderColor = ({ variant = \"default\" }: { variant?: ChartBorderVariant } = {}): string =>\n variant === \"secondary\"\n ? getCSSVar({ name: \"--color-border-secondary\", fallback: \"#e5e7eb\" })\n : getCSSVar({ name: \"--color-border-primary\", fallback: \"#d1d5db\" });\n\n/**\n * Themed grid line color for <CartesianGrid>.\n * Grids default to secondary (subtle background lines).\n */\nexport const getGridColor = ({ variant = \"secondary\" }: { variant?: ChartBorderVariant } = {}): string =>\n getBorderColor({ variant });\n\n/**\n * Themed axis tick/label style for <XAxis> and <YAxis>.\n * Axis lines default to primary (visible structural lines).\n */\nexport const getAxisStyle = ({ variant = \"default\" }: { variant?: ChartBorderVariant } = {}) => ({\n tick: {\n fill: getCSSVar({ name: \"--color-text-secondary\", fallback: \"#6b7280\" }),\n fontSize: getCSSVar({ name: \"--font-text-xs-size\", fallback: \"11px\" }),\n fontFamily: getCSSVar({ name: \"--font-sans\", fallback: \"ui-sans-serif, system-ui, sans-serif\" }),\n },\n axisLine: {\n stroke: getBorderColor({ variant }),\n },\n tickLine: {\n stroke: getBorderColor({ variant }),\n },\n});\n\n/**\n * Apply themed axis styles to an XAxis or YAxis child via cloneElement.\n *\n * Recharts identifies axis components by child.type, so wrapping them\n * in custom components breaks chart rendering. Instead, chart wrappers\n * call this in their Children.map loop to inject theme props while\n * preserving the original Recharts component type.\n *\n * Returns a cloned element with themed tick, axisLine, and tickLine,\n * or the original child untouched if it's not an axis component.\n */\nexport const themeAxisChild = ({\n child,\n variant = \"default\",\n XAxis,\n YAxis,\n}: {\n child: React.ReactElement<any>;\n variant?: ChartBorderVariant;\n XAxis: any;\n YAxis: any;\n}): React.ReactElement<any> | null => {\n const t = child.type as any;\n const dn = t?.displayName;\n\n if (t === XAxis || t === YAxis || dn === \"XAxis\" || dn === \"YAxis\") {\n const style = getAxisStyle({ variant });\n const props = child.props as any;\n return React.cloneElement(child, {\n tick: props.tick === false ? false : { ...style.tick, ...(typeof props.tick === \"object\" && props.tick ? props.tick : {}) },\n axisLine: props.axisLine === false ? false : { ...style.axisLine, ...(typeof props.axisLine === \"object\" && props.axisLine ? props.axisLine : {}) },\n tickLine: props.tickLine === false ? false : { ...style.tickLine, ...(typeof props.tickLine === \"object\" && props.tickLine ? props.tickLine : {}) },\n });\n }\n\n return null;\n};\n\n/**\n * Themed legend style for <Legend>.\n */\nexport const getLegendStyle = () => ({\n color: getCSSVar({ name: \"--color-text-secondary\", fallback: \"#6b7280\" }),\n fontSize: getCSSVar({ name: \"--font-text-sm-size\", fallback: \"13px\" }),\n fontFamily: getCSSVar({ name: \"--font-sans\", fallback: \"ui-sans-serif, system-ui, sans-serif\" }),\n});\n","/**\n * BarChart — Themed bar/column chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n BarChart as RechartsBarChart,\n Bar as RechartsBar,\n XAxis as RechartsXAxis,\n YAxis as RechartsYAxis,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor, themeAxisChild, type ChartBorderVariant } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedBarChartProps extends ChartContainerProps {\n /** Chart data array. */\n data: Record<string, unknown>[];\n children: ReactNode;\n grid?: boolean;\n /**\n * Border variant for axis lines and tick marks.\n * - \"default\" — uses --color-border-primary (stronger)\n * - \"secondary\" — uses --color-border-secondary (subtler)\n */\n borderVariant?: ChartBorderVariant;\n}\n\n/**\n * Themed BarChart.\n * Automatically assigns palette colors to Bar children and\n * applies themed axis styles to XAxis/YAxis children.\n */\nexport const BarChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n grid = true,\n borderVariant = \"default\",\n children,\n}: ThemedBarChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n\n const themedAxis = themeAxisChild({ child: child as React.ReactElement<any>, variant: borderVariant, XAxis: RechartsXAxis, YAxis: RechartsYAxis });\n if (themedAxis) return themedAxis;\n\n if ((child.type as any) === RechartsBar || (child.type as any)?.displayName === \"Bar\") {\n const idx = seriesIndex++;\n const existing = (child.props as any).fill;\n return cloneElement(child as React.ReactElement<any>, {\n fill: existing || getSeriesColor({ index: idx, palette: colorPalette }),\n radius: (child.props as any).radius ?? [4, 4, 0, 0],\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsBarChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} vertical={false} />}\n {themedChildren}\n </RechartsBarChart>\n </ChartContainer>\n );\n};\n","/**\n * AreaChart — Themed area/volume chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n AreaChart as RechartsAreaChart,\n Area as RechartsArea,\n XAxis as RechartsXAxis,\n YAxis as RechartsYAxis,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor, themeAxisChild, type ChartBorderVariant } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedAreaChartProps extends ChartContainerProps {\n data: Record<string, unknown>[];\n children: ReactNode;\n grid?: boolean;\n /**\n * Border variant for axis lines and tick marks.\n * - \"default\" — uses --color-border-primary (stronger)\n * - \"secondary\" — uses --color-border-secondary (subtler)\n */\n borderVariant?: ChartBorderVariant;\n}\n\n/**\n * Themed AreaChart.\n * Auto-assigns palette colors with gradient fill to Area children and\n * applies themed axis styles to XAxis/YAxis children.\n */\nexport const AreaChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n grid = true,\n borderVariant = \"default\",\n children,\n}: ThemedAreaChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n\n const themedAxis = themeAxisChild({ child: child as React.ReactElement<any>, variant: borderVariant, XAxis: RechartsXAxis, YAxis: RechartsYAxis });\n if (themedAxis) return themedAxis;\n\n if ((child.type as any) === RechartsArea || (child.type as any)?.displayName === \"Area\") {\n const idx = seriesIndex++;\n const color = (child.props as any).stroke || getSeriesColor({ index: idx, palette: colorPalette });\n return cloneElement(child as React.ReactElement<any>, {\n stroke: color,\n fill: (child.props as any).fill || color,\n fillOpacity: (child.props as any).fillOpacity ?? 0.15,\n strokeWidth: (child.props as any).strokeWidth ?? 2,\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsAreaChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} />}\n {themedChildren}\n </RechartsAreaChart>\n </ChartContainer>\n );\n};\n","/**\n * PieChart — Themed pie/donut chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n PieChart as RechartsPieChart,\n Pie as RechartsPie,\n Cell,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedPieChartProps extends Omit<ChartContainerProps, \"height\"> {\n /** Chart height (also used for approximate width in responsive container). */\n height?: number;\n children: ReactNode;\n}\n\n/**\n * Themed PieChart.\n * Auto-assigns palette colors to Pie data via Cell children when no\n * explicit fill is provided on individual data entries.\n */\nexport const PieChart = ({\n height,\n colorPalette,\n className,\n style,\n children,\n}: ThemedPieChartProps) => {\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n if ((child.type as any) === RechartsPie || (child.type as any)?.displayName === \"Pie\") {\n const props = child.props as any;\n const data: any[] = props.data ?? [];\n /**\n * If the Pie has no Cell children, inject them automatically\n * so each slice gets a palette color.\n */\n const hasExplicitCells = Children.toArray(props.children).some(\n (c: any) => isValidElement(c) && ((c.type as any) === Cell || (c.type as any)?.displayName === \"Cell\")\n );\n if (!hasExplicitCells && data.length > 0) {\n return cloneElement(child as React.ReactElement<any>, {\n children: data.map((_, i) => (\n <Cell key={`cell-${i}`} fill={getSeriesColor({ index: i, palette: colorPalette })} />\n )),\n });\n }\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsPieChart>\n {themedChildren}\n </RechartsPieChart>\n </ChartContainer>\n );\n};\n","/**\n * ScatterChart — Themed scatter/correlation chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n ScatterChart as RechartsScatterChart,\n Scatter as RechartsScatter,\n XAxis as RechartsXAxis,\n YAxis as RechartsYAxis,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor, themeAxisChild, type ChartBorderVariant } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedScatterChartProps extends ChartContainerProps {\n children: ReactNode;\n grid?: boolean;\n /**\n * Border variant for axis lines and tick marks.\n * - \"default\" — uses --color-border-primary (stronger)\n * - \"secondary\" — uses --color-border-secondary (subtler)\n */\n borderVariant?: ChartBorderVariant;\n}\n\n/**\n * Themed ScatterChart.\n * Auto-assigns palette fill colors to Scatter children and\n * applies themed axis styles to XAxis/YAxis children.\n */\nexport const ScatterChart = ({\n height,\n colorPalette,\n className,\n style,\n grid = true,\n borderVariant = \"default\",\n children,\n}: ThemedScatterChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n\n const themedAxis = themeAxisChild({ child: child as React.ReactElement<any>, variant: borderVariant, XAxis: RechartsXAxis, YAxis: RechartsYAxis });\n if (themedAxis) return themedAxis;\n\n if ((child.type as any) === RechartsScatter || (child.type as any)?.displayName === \"Scatter\") {\n const idx = seriesIndex++;\n const existing = (child.props as any).fill;\n return cloneElement(child as React.ReactElement<any>, {\n fill: existing || getSeriesColor({ index: idx, palette: colorPalette }),\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsScatterChart margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} />}\n {themedChildren}\n </RechartsScatterChart>\n </ChartContainer>\n );\n};\n","/**\n * RadarChart — Themed radar/spider chart wrapper.\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n RadarChart as RechartsRadarChart,\n Radar as RechartsRadar,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedRadarChartProps extends ChartContainerProps {\n data: Record<string, unknown>[];\n children: ReactNode;\n}\n\n/**\n * Themed RadarChart.\n * Auto-assigns palette colors to Radar children.\n */\nexport const RadarChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n children,\n}: ThemedRadarChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n if ((child.type as any) === RechartsRadar || (child.type as any)?.displayName === \"Radar\") {\n const idx = seriesIndex++;\n const color = (child.props as any).stroke || getSeriesColor({ index: idx, palette: colorPalette });\n return cloneElement(child as React.ReactElement<any>, {\n stroke: color,\n fill: (child.props as any).fill || color,\n fillOpacity: (child.props as any).fillOpacity ?? 0.2,\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsRadarChart data={data} cx=\"50%\" cy=\"50%\" outerRadius=\"70%\">\n {themedChildren}\n </RechartsRadarChart>\n </ChartContainer>\n );\n};\n","/**\n * ComposedChart — Themed mixed chart wrapper (Bar + Line + Area in one).\n */\n\nimport React, { type ReactNode, Children, cloneElement, isValidElement } from \"react\";\nimport {\n ComposedChart as RechartsComposedChart,\n Line as RechartsLine,\n Bar as RechartsBar,\n Area as RechartsArea,\n XAxis as RechartsXAxis,\n YAxis as RechartsYAxis,\n CartesianGrid,\n} from \"recharts\";\nimport { ChartContainer, getSeriesColor } from \"./ChartContainer.js\";\nimport { getGridColor, themeAxisChild, type ChartBorderVariant } from \"./theme.js\";\nimport type { ChartContainerProps } from \"./types.js\";\n\ninterface ThemedComposedChartProps extends ChartContainerProps {\n data: Record<string, unknown>[];\n children: ReactNode;\n grid?: boolean;\n /**\n * Border variant for axis lines and tick marks.\n * - \"default\" — uses --color-border-primary (stronger)\n * - \"secondary\" — uses --color-border-secondary (subtler)\n */\n borderVariant?: ChartBorderVariant;\n}\n\n/**\n * Themed ComposedChart.\n * Auto-assigns palette colors to Line, Bar, and Area children and\n * applies themed axis styles to XAxis/YAxis children.\n */\nexport const ComposedChart = ({\n data,\n height,\n colorPalette,\n className,\n style,\n grid = true,\n borderVariant = \"default\",\n children,\n}: ThemedComposedChartProps) => {\n let seriesIndex = 0;\n\n const themedChildren = Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n\n const themedAxis = themeAxisChild({ child: child as React.ReactElement<any>, variant: borderVariant, XAxis: RechartsXAxis, YAxis: RechartsYAxis });\n if (themedAxis) return themedAxis;\n\n const t = child.type as any;\n const dn = t?.displayName;\n\n if (t === RechartsLine || dn === \"Line\") {\n const idx = seriesIndex++;\n return cloneElement(child as React.ReactElement<any>, {\n stroke: (child.props as any).stroke || getSeriesColor({ index: idx, palette: colorPalette }),\n strokeWidth: (child.props as any).strokeWidth ?? 2,\n dot: (child.props as any).dot ?? false,\n });\n }\n if (t === RechartsBar || dn === \"Bar\") {\n const idx = seriesIndex++;\n return cloneElement(child as React.ReactElement<any>, {\n fill: (child.props as any).fill || getSeriesColor({ index: idx, palette: colorPalette }),\n radius: (child.props as any).radius ?? [4, 4, 0, 0],\n });\n }\n if (t === RechartsArea || dn === \"Area\") {\n const idx = seriesIndex++;\n const color = (child.props as any).stroke || getSeriesColor({ index: idx, palette: colorPalette });\n return cloneElement(child as React.ReactElement<any>, {\n stroke: color,\n fill: (child.props as any).fill || color,\n fillOpacity: (child.props as any).fillOpacity ?? 0.15,\n strokeWidth: (child.props as any).strokeWidth ?? 2,\n });\n }\n return child;\n });\n\n return (\n <ChartContainer height={height} className={className} style={style}>\n <RechartsComposedChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>\n {grid && <CartesianGrid strokeDasharray=\"3 3\" stroke={getGridColor()} opacity={0.5} />}\n {themedChildren}\n </RechartsComposedChart>\n </ChartContainer>\n );\n};\n","/**\n * ThemedTooltip — Pre-themed tooltip using MCP Apps spec CSS variables.\n *\n * Drop-in replacement for Recharts' Tooltip that automatically\n * applies the host's theme colors for background, text, border.\n */\n\nimport { useMemo } from \"react\";\nimport { Tooltip as RechartsTooltip } from \"recharts\";\nimport { getTooltipStyle } from \"./theme.js\";\n\n/**\n * A themed Tooltip that reads CSS variables at render time.\n * Forwards all standard Recharts Tooltip props.\n */\nexport const ThemedTooltip = (props: any) => {\n const style = useMemo(() => getTooltipStyle(), []);\n return (\n <RechartsTooltip\n contentStyle={style.contentStyle}\n labelStyle={style.labelStyle}\n cursor={{ stroke: \"var(--color-border-secondary, #e5e7eb)\", strokeWidth: 1 }}\n {...props}\n />\n );\n};\n","/**\n * open-mcp-app-ui/charts\n *\n * Themed chart components built on Recharts v3.\n * Auto-styled via MCP Apps spec CSS variables.\n *\n * Usage:\n * import { LineChart, Line, XAxis, YAxis, Tooltip } from \"open-mcp-app-ui/charts\";\n *\n * <LineChart data={data} height={300}>\n * <XAxis dataKey=\"month\" />\n * <YAxis />\n * <Tooltip />\n * <Line dataKey=\"revenue\" />\n * </LineChart>\n */\n\n// Themed chart wrappers\nexport { LineChart } from \"./LineChart.js\";\nexport { BarChart } from \"./BarChart.js\";\nexport { AreaChart } from \"./AreaChart.js\";\nexport { PieChart } from \"./PieChart.js\";\nexport { ScatterChart } from \"./ScatterChart.js\";\nexport { RadarChart } from \"./RadarChart.js\";\nexport { ComposedChart } from \"./ComposedChart.js\";\nexport { ThemedTooltip as Tooltip } from \"./ThemedTooltip.js\";\n\n// Re-export Recharts primitives for composition\nexport {\n Line,\n Bar,\n Area,\n Pie,\n Scatter,\n Radar,\n Cell,\n XAxis,\n YAxis,\n CartesianGrid,\n Legend,\n PolarGrid,\n PolarAngleAxis,\n PolarRadiusAxis,\n Tooltip as RechartsTooltip,\n ReferenceLine,\n ReferenceArea,\n ResponsiveContainer,\n} from \"recharts\";\n\n// Theme utilities\nexport { type ChartBorderVariant } from \"./theme.js\";\n\n// Types\nexport type { ChartContainerProps } from \"./types.js\";\nexport { DEFAULT_PALETTE } from \"./types.js\";\n"],"mappings":";AAmBA,SAAgC,UAAU,cAAc,sBAAsB;AAC9E;AAAA,EACE,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT;AAAA,OACK;;;ACjBP,SAAS,2BAA2B;;;ACI7B,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,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A,MAClB,QAAQ,EAAE,QAAQ,0CAA0C,aAAa,EAAE;AAAA,MAC1E,GAAG;AAAA;AAAA,EACN;AAEJ;;;ACGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACW;AAAA,EACX;AAAA,EACA;AAAA,EACA,uBAAAC;AAAA,OACK;","names":["XAxis","YAxis","jsx","Children","cloneElement","isValidElement","RechartsXAxis","RechartsYAxis","CartesianGrid","jsx","jsxs","Children","isValidElement","RechartsXAxis","RechartsYAxis","cloneElement","CartesianGrid","Children","cloneElement","isValidElement","RechartsXAxis","RechartsYAxis","CartesianGrid","jsx","jsxs","Children","isValidElement","RechartsXAxis","RechartsYAxis","cloneElement","CartesianGrid","Children","cloneElement","isValidElement","jsx","Children","isValidElement","cloneElement","Children","cloneElement","isValidElement","RechartsXAxis","RechartsYAxis","CartesianGrid","jsx","jsxs","Children","isValidElement","RechartsXAxis","RechartsYAxis","cloneElement","CartesianGrid","Children","cloneElement","isValidElement","jsx","Children","isValidElement","cloneElement","Children","cloneElement","isValidElement","RechartsLine","RechartsBar","RechartsArea","RechartsXAxis","RechartsYAxis","CartesianGrid","jsx","jsxs","Children","isValidElement","RechartsXAxis","RechartsYAxis","RechartsLine","cloneElement","RechartsBar","RechartsArea","CartesianGrid","jsx","Cell","CartesianGrid","ResponsiveContainer"]}
|
package/dist/editor/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import react__default from 'react';
|
|
|
5
5
|
*
|
|
6
6
|
* Built on Milkdown (ProseMirror + Remark) for markdown-first editing
|
|
7
7
|
* with perfect round-trip fidelity. Supports WYSIWYG, raw markdown,
|
|
8
|
-
* and
|
|
8
|
+
* and raw markdown editing modes.
|
|
9
9
|
*
|
|
10
10
|
* Styled exclusively with MCP Apps spec CSS variables. All typography,
|
|
11
11
|
* colors, borders, and spacing use the host's theme tokens.
|
|
@@ -19,7 +19,7 @@ import react__default from 'react';
|
|
|
19
19
|
/** Available toolbar action items. */
|
|
20
20
|
type ToolbarItem = "bold" | "italic" | "strikethrough" | "heading" | "bulletList" | "orderedList" | "taskList" | "code" | "codeBlock" | "blockquote" | "link" | "divider" | "undo" | "redo";
|
|
21
21
|
/** Editing mode. */
|
|
22
|
-
type EditorMode = "wysiwyg" | "markdown"
|
|
22
|
+
type EditorMode = "wysiwyg" | "markdown";
|
|
23
23
|
interface EditorProps {
|
|
24
24
|
/** Markdown string (source of truth). */
|
|
25
25
|
value?: string;
|
|
@@ -29,7 +29,6 @@ interface EditorProps {
|
|
|
29
29
|
* Editing mode:
|
|
30
30
|
* - "wysiwyg" — Rich text rendering with formatting (default)
|
|
31
31
|
* - "markdown" — Raw markdown text editing
|
|
32
|
-
* - "split" — Side-by-side WYSIWYG and markdown
|
|
33
32
|
*
|
|
34
33
|
* Omit to show a mode toggle in the toolbar so users can switch freely.
|
|
35
34
|
*/
|
|
@@ -45,10 +44,11 @@ interface EditorProps {
|
|
|
45
44
|
readOnly?: boolean;
|
|
46
45
|
/**
|
|
47
46
|
* Show a border and rounded corners around the editor.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* - false (default) — no border, sits flat within its container
|
|
48
|
+
* - true / "default" — uses --color-border-primary (stronger)
|
|
49
|
+
* - "secondary" — uses --color-border-secondary (subtler)
|
|
50
50
|
*/
|
|
51
|
-
bordered?: boolean;
|
|
51
|
+
bordered?: boolean | "default" | "secondary";
|
|
52
52
|
/** Minimum editor height in pixels. */
|
|
53
53
|
minHeight?: number;
|
|
54
54
|
/** Maximum editor height in pixels before scrolling. */
|
|
@@ -70,7 +70,7 @@ interface EditorRef {
|
|
|
70
70
|
* Markdown + rich text editor with toolbar and mode switching.
|
|
71
71
|
*
|
|
72
72
|
* Built on Milkdown (ProseMirror + Remark) for markdown-first editing.
|
|
73
|
-
* Supports WYSIWYG
|
|
73
|
+
* Supports WYSIWYG and raw markdown editing modes. Styled with
|
|
74
74
|
* MCP Apps spec CSS variables for automatic host theming.
|
|
75
75
|
*
|
|
76
76
|
* By default the editor has no border or rounded corners so it sits
|
package/dist/editor/index.js
CHANGED
|
@@ -190,8 +190,7 @@ var ModeToggle = ({
|
|
|
190
190
|
}) => {
|
|
191
191
|
const modes = [
|
|
192
192
|
{ value: "wysiwyg", label: "Rich" },
|
|
193
|
-
{ value: "markdown", label: "MD" }
|
|
194
|
-
{ value: "split", label: "Split" }
|
|
193
|
+
{ value: "markdown", label: "MD" }
|
|
195
194
|
];
|
|
196
195
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 ml-auto pl-2 pr-2", children: modes.map((m) => /* @__PURE__ */ jsx(
|
|
197
196
|
"button",
|
|
@@ -386,11 +385,8 @@ var Editor = forwardRef(
|
|
|
386
385
|
(markdown) => {
|
|
387
386
|
setRawValue(markdown);
|
|
388
387
|
onChange?.(markdown);
|
|
389
|
-
if (mode === "split") {
|
|
390
|
-
actionsRef.current?.setMarkdown(markdown);
|
|
391
|
-
}
|
|
392
388
|
},
|
|
393
|
-
[onChange
|
|
389
|
+
[onChange]
|
|
394
390
|
);
|
|
395
391
|
const handleToolbarAction = useCallback(
|
|
396
392
|
(item) => {
|
|
@@ -466,12 +462,12 @@ var Editor = forwardRef(
|
|
|
466
462
|
);
|
|
467
463
|
const handleModeChange = useCallback(
|
|
468
464
|
(newMode) => {
|
|
469
|
-
if (mode === "wysiwyg"
|
|
465
|
+
if (mode === "wysiwyg") {
|
|
470
466
|
const current = actionsRef.current?.getMarkdown() ?? rawValue;
|
|
471
467
|
setRawValue(current);
|
|
472
468
|
}
|
|
473
469
|
setInternalMode(newMode);
|
|
474
|
-
if (newMode === "wysiwyg"
|
|
470
|
+
if (newMode === "wysiwyg") {
|
|
475
471
|
setMilkdownKey((k) => k + 1);
|
|
476
472
|
}
|
|
477
473
|
},
|
|
@@ -489,7 +485,10 @@ var Editor = forwardRef(
|
|
|
489
485
|
className: [
|
|
490
486
|
"omu-editor flex flex-col overflow-hidden",
|
|
491
487
|
"bg-bg-primary text-txt-primary",
|
|
492
|
-
bordered ?
|
|
488
|
+
bordered ? [
|
|
489
|
+
"rounded-md focus-within:outline focus-within:outline-2 focus-within:outline-offset-0 focus-within:outline-ring-primary",
|
|
490
|
+
bordered === "secondary" ? "border border-bdr-secondary" : "border border-bdr-primary"
|
|
491
|
+
].join(" ") : "",
|
|
493
492
|
className
|
|
494
493
|
].join(" "),
|
|
495
494
|
style: wrapperStyle,
|
|
@@ -499,7 +498,7 @@ var Editor = forwardRef(
|
|
|
499
498
|
showModeToggle && !readOnly && /* @__PURE__ */ jsx(ModeToggle, { mode, onModeChange: handleModeChange })
|
|
500
499
|
] }),
|
|
501
500
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 min-h-0 overflow-hidden", children: [
|
|
502
|
-
|
|
501
|
+
mode === "wysiwyg" && /* @__PURE__ */ jsx("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ jsx(MilkdownProvider, { children: /* @__PURE__ */ jsx(
|
|
503
502
|
MilkdownInner,
|
|
504
503
|
{
|
|
505
504
|
defaultValue: rawValue,
|
|
@@ -511,13 +510,13 @@ var Editor = forwardRef(
|
|
|
511
510
|
actionsRef
|
|
512
511
|
}
|
|
513
512
|
) }, milkdownKey) }),
|
|
514
|
-
|
|
513
|
+
mode === "markdown" && /* @__PURE__ */ jsx("div", { className: "flex flex-col flex-1 min-h-0", children: /* @__PURE__ */ jsx(
|
|
515
514
|
MarkdownTextarea,
|
|
516
515
|
{
|
|
517
516
|
value: rawValue,
|
|
518
517
|
onChange: handleRawChange,
|
|
519
518
|
readOnly,
|
|
520
|
-
placeholder
|
|
519
|
+
placeholder,
|
|
521
520
|
autoFocus: autoFocus && mode === "markdown",
|
|
522
521
|
minHeight: minHeight - 40,
|
|
523
522
|
maxHeight: maxHeight ? maxHeight - 40 : void 0
|