@amritanshu3011/mdx-renderer 1.0.0 → 1.0.3
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/MDXRenderer.d.ts +7 -0
- package/dist/MDXRenderer.js +56 -0
- package/dist/components/DynamicVisualizations.d.ts +2 -0
- package/dist/components/DynamicVisualizations.js +17 -0
- package/dist/components/WeatherWidget.d.ts +6 -0
- package/dist/components/WeatherWidget.js +29 -0
- package/dist/components/composite/Dashboard.d.ts +8 -0
- package/dist/components/composite/Dashboard.js +14 -0
- package/dist/components/composite/DataExplorer.d.ts +8 -0
- package/dist/components/composite/DataExplorer.js +37 -0
- package/dist/components/composite/index.d.ts +0 -0
- package/dist/components/composite/index.js +1 -0
- package/dist/components/data/BarChart.d.ts +10 -0
- package/dist/components/data/BarChart.js +17 -0
- package/dist/components/data/LineChart.d.ts +10 -0
- package/dist/components/data/LineChart.js +17 -0
- package/dist/components/data/SimpleChart.d.ts +6 -0
- package/dist/components/data/SimpleChart.js +18 -0
- package/dist/components/data/Table.d.ts +0 -0
- package/dist/components/data/Table.js +1 -0
- package/dist/components/data/index.d.ts +0 -0
- package/dist/components/data/index.js +1 -0
- package/dist/components/index.d.ts +0 -0
- package/dist/components/index.js +1 -0
- package/dist/components/interactive/Accordion.d.ts +8 -0
- package/dist/components/interactive/Accordion.js +29 -0
- package/dist/components/interactive/Modal.d.ts +0 -0
- package/dist/components/interactive/Modal.js +1 -0
- package/dist/components/interactive/Tabs.d.ts +11 -0
- package/dist/components/interactive/Tabs.js +22 -0
- package/dist/components/interactive/index.d.ts +0 -0
- package/dist/components/interactive/index.js +1 -0
- package/dist/components/layout/Card.d.ts +6 -0
- package/dist/components/layout/Card.js +13 -0
- package/dist/components/layout/Container.d.ts +0 -0
- package/dist/components/layout/Container.js +1 -0
- package/dist/components/layout/Grid.d.ts +0 -0
- package/dist/components/layout/Grid.js +1 -0
- package/dist/components/layout/index.d.ts +0 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/smart/ComparisonBlock.d.ts +14 -0
- package/dist/components/smart/ComparisonBlock.js +81 -0
- package/dist/components/smart/ConceptTreeBlock.d.ts +11 -0
- package/dist/components/smart/ConceptTreeBlock.js +140 -0
- package/dist/components/smart/FlowBlock.d.ts +11 -0
- package/dist/components/smart/FlowBlock.js +122 -0
- package/dist/components/smart/InteractiveCompositeBlock.d.ts +22 -0
- package/dist/components/smart/InteractiveCompositeBlock.js +102 -0
- package/dist/components/smart/LineChartBlock.d.ts +8 -0
- package/dist/components/smart/LineChartBlock.js +22 -0
- package/dist/components/smart/ProsConsBlock.d.ts +7 -0
- package/dist/components/smart/ProsConsBlock.js +77 -0
- package/dist/components/smart/Sunburst.d.ts +12 -0
- package/dist/components/smart/Sunburst.js +152 -0
- package/dist/components/text/Blockquote.d.ts +7 -0
- package/dist/components/text/Blockquote.js +16 -0
- package/dist/components/text/ComparisonGrid.d.ts +14 -0
- package/dist/components/text/ComparisonGrid.js +46 -0
- package/dist/components/text/Heading.d.ts +7 -0
- package/dist/components/text/Heading.js +13 -0
- package/dist/components/text/List.d.ts +7 -0
- package/dist/components/text/List.js +12 -0
- package/dist/components/text/Paragraph.d.ts +6 -0
- package/dist/components/text/Paragraph.js +13 -0
- package/dist/components/text/ProcessFlow.d.ts +12 -0
- package/dist/components/text/ProcessFlow.js +48 -0
- package/dist/components/text/index.d.ts +0 -0
- package/dist/components/text/index.js +1 -0
- package/dist/context/VisualizationContext.d.ts +13 -0
- package/dist/context/VisualizationContext.js +21 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +34 -0
- package/dist/registry/visualizationRegistry.d.ts +10 -0
- package/dist/registry/visualizationRegistry.js +16 -0
- package/dist/theme/ThemeContext.d.ts +14 -0
- package/dist/theme/ThemeContext.js +19 -0
- package/dist/theme/defaultTheme.d.ts +2 -0
- package/dist/theme/defaultTheme.js +30 -0
- package/dist/theme/index.d.ts +0 -0
- package/dist/theme/index.js +1 -0
- package/dist/theme/themes.d.ts +3 -0
- package/dist/theme/themes.js +60 -0
- package/dist/theme/types.d.ts +30 -0
- package/dist/theme/types.js +1 -0
- package/dist/types/mockLLM.d.ts +5 -0
- package/dist/types/mockLLM.js +109 -0
- package/dist/utils/useThemeWithFallback.d.ts +2 -0
- package/dist/utils/useThemeWithFallback.js +7 -0
- package/dist/utils/withDefaults.d.ts +2 -0
- package/dist/utils/withDefaults.js +4 -0
- package/package.json +29 -24
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import * as echarts from 'echarts/core';
|
|
4
|
+
import { SunburstChart } from 'echarts/charts';
|
|
5
|
+
import { TooltipComponent, TitleComponent } from 'echarts/components';
|
|
6
|
+
import { CanvasRenderer } from 'echarts/renderers';
|
|
7
|
+
import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
|
|
8
|
+
echarts.use([
|
|
9
|
+
SunburstChart,
|
|
10
|
+
TooltipComponent,
|
|
11
|
+
TitleComponent,
|
|
12
|
+
CanvasRenderer
|
|
13
|
+
]);
|
|
14
|
+
/** Normalize tree - ensure all nodes have values */
|
|
15
|
+
const normalizeTree = (node, depth = 0) => {
|
|
16
|
+
if (!node.children || node.children.length === 0) {
|
|
17
|
+
return { ...node, value: node.value ?? 1 };
|
|
18
|
+
}
|
|
19
|
+
const children = node.children.map(c => normalizeTree(c, depth + 1));
|
|
20
|
+
const value = children.reduce((sum, c) => sum + (c.value ?? 0), 0);
|
|
21
|
+
return { ...node, children, value };
|
|
22
|
+
};
|
|
23
|
+
export const Sunburst = ({ title, root }) => {
|
|
24
|
+
const theme = useThemeWithFallback();
|
|
25
|
+
const chartRef = useRef(null);
|
|
26
|
+
const chartInstance = useRef(null);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!chartRef.current)
|
|
29
|
+
return;
|
|
30
|
+
if (!chartInstance.current) {
|
|
31
|
+
chartInstance.current = echarts.init(chartRef.current);
|
|
32
|
+
}
|
|
33
|
+
const normalizedRoot = normalizeTree(root);
|
|
34
|
+
chartInstance.current.setOption({
|
|
35
|
+
title: {
|
|
36
|
+
text: title,
|
|
37
|
+
left: 'center',
|
|
38
|
+
top: 20,
|
|
39
|
+
textStyle: {
|
|
40
|
+
color: theme.colors.text,
|
|
41
|
+
fontSize: 22,
|
|
42
|
+
fontWeight: 'bold'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
tooltip: {
|
|
46
|
+
trigger: 'item',
|
|
47
|
+
formatter: (params) => {
|
|
48
|
+
const { name, value } = params;
|
|
49
|
+
return `<b>${name}</b><br/>Value: ${value}`;
|
|
50
|
+
},
|
|
51
|
+
backgroundColor: 'rgba(50, 50, 50, 0.9)',
|
|
52
|
+
borderColor: '#777',
|
|
53
|
+
borderWidth: 1,
|
|
54
|
+
textStyle: {
|
|
55
|
+
color: '#fff'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
series: [
|
|
59
|
+
{
|
|
60
|
+
type: 'sunburst',
|
|
61
|
+
data: [normalizedRoot],
|
|
62
|
+
radius: [0, '90%'],
|
|
63
|
+
center: ['50%', '55%'],
|
|
64
|
+
sort: 'desc',
|
|
65
|
+
highlightPolicy: 'ancestor',
|
|
66
|
+
itemStyle: {
|
|
67
|
+
borderRadius: 7,
|
|
68
|
+
borderWidth: 2,
|
|
69
|
+
borderColor: '#fff'
|
|
70
|
+
},
|
|
71
|
+
label: {
|
|
72
|
+
rotate: 'radial',
|
|
73
|
+
fontSize: 11,
|
|
74
|
+
color: '#000',
|
|
75
|
+
fontWeight: 'bold',
|
|
76
|
+
minAngle: 20,
|
|
77
|
+
overflow: 'truncate'
|
|
78
|
+
},
|
|
79
|
+
emphasis: {
|
|
80
|
+
focus: 'ancestor',
|
|
81
|
+
itemStyle: {
|
|
82
|
+
shadowBlur: 10,
|
|
83
|
+
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
levels: [
|
|
87
|
+
{},
|
|
88
|
+
{
|
|
89
|
+
r0: '0%',
|
|
90
|
+
r: '30%',
|
|
91
|
+
itemStyle: {
|
|
92
|
+
borderWidth: 3
|
|
93
|
+
},
|
|
94
|
+
label: {
|
|
95
|
+
rotate: 0,
|
|
96
|
+
fontSize: 13,
|
|
97
|
+
fontWeight: 'bold',
|
|
98
|
+
distance: 5
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
r0: '30%',
|
|
103
|
+
r: '60%',
|
|
104
|
+
label: {
|
|
105
|
+
fontSize: 11,
|
|
106
|
+
distance: 3
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
r0: '60%',
|
|
111
|
+
r: '90%',
|
|
112
|
+
label: {
|
|
113
|
+
fontSize: 10,
|
|
114
|
+
padding: 2,
|
|
115
|
+
silent: false,
|
|
116
|
+
minAngle: 25
|
|
117
|
+
},
|
|
118
|
+
itemStyle: {
|
|
119
|
+
borderWidth: 1
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}, true);
|
|
126
|
+
const resize = () => chartInstance.current?.resize();
|
|
127
|
+
window.addEventListener('resize', resize);
|
|
128
|
+
return () => {
|
|
129
|
+
window.removeEventListener('resize', resize);
|
|
130
|
+
};
|
|
131
|
+
}, [root, title, theme]);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
return () => {
|
|
134
|
+
if (chartInstance.current) {
|
|
135
|
+
chartInstance.current.dispose();
|
|
136
|
+
chartInstance.current = null;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}, []);
|
|
140
|
+
return (_jsx("div", { style: {
|
|
141
|
+
margin: `${theme.spacing.large} 0`,
|
|
142
|
+
backgroundColor: theme.colors.cardBackground,
|
|
143
|
+
borderRadius: theme.borderRadius.medium,
|
|
144
|
+
border: `1px solid ${theme.colors.border}`,
|
|
145
|
+
padding: theme.spacing.large,
|
|
146
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.1)'
|
|
147
|
+
}, children: _jsx("div", { ref: chartRef, style: {
|
|
148
|
+
width: '100%',
|
|
149
|
+
height: 650,
|
|
150
|
+
minHeight: 500
|
|
151
|
+
} }) }));
|
|
152
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
|
|
3
|
+
export const Blockquote = ({ children, author }) => {
|
|
4
|
+
const theme = useThemeWithFallback();
|
|
5
|
+
return (_jsxs("blockquote", { style: {
|
|
6
|
+
borderLeft: `4px solid ${theme.colors.primary}`,
|
|
7
|
+
paddingLeft: theme.spacing.medium,
|
|
8
|
+
margin: `${theme.spacing.medium} 0`,
|
|
9
|
+
color: theme.colors.textSecondary,
|
|
10
|
+
fontStyle: 'italic'
|
|
11
|
+
}, children: [children, author && (_jsxs("footer", { style: {
|
|
12
|
+
marginTop: theme.spacing.small,
|
|
13
|
+
fontSize: theme.typography.smallSize,
|
|
14
|
+
color: theme.colors.textSecondary
|
|
15
|
+
}, children: ["\u2014 ", author] }))] }));
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ComparisonItem {
|
|
3
|
+
label: string;
|
|
4
|
+
option1: string;
|
|
5
|
+
option2: string;
|
|
6
|
+
}
|
|
7
|
+
interface ComparisonGridProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
option1Name: string;
|
|
10
|
+
option2Name: string;
|
|
11
|
+
items: ComparisonItem[];
|
|
12
|
+
}
|
|
13
|
+
export declare const ComparisonGrid: React.FC<ComparisonGridProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
|
|
3
|
+
export const ComparisonGrid = ({ title, option1Name, option2Name, items }) => {
|
|
4
|
+
const theme = useThemeWithFallback();
|
|
5
|
+
const containerStyle = {
|
|
6
|
+
margin: `${theme.spacing.large} 0`,
|
|
7
|
+
border: `1px solid ${theme.colors.border}`,
|
|
8
|
+
borderRadius: theme.borderRadius.medium,
|
|
9
|
+
overflow: 'hidden'
|
|
10
|
+
};
|
|
11
|
+
const headerStyle = {
|
|
12
|
+
display: 'grid',
|
|
13
|
+
gridTemplateColumns: '1fr 1fr 1fr',
|
|
14
|
+
backgroundColor: theme.colors.primary,
|
|
15
|
+
color: '#fff',
|
|
16
|
+
fontWeight: 'bold'
|
|
17
|
+
};
|
|
18
|
+
const cellStyle = {
|
|
19
|
+
padding: theme.spacing.medium,
|
|
20
|
+
borderRight: `1px solid ${theme.colors.border}`
|
|
21
|
+
};
|
|
22
|
+
const rowStyle = {
|
|
23
|
+
display: 'grid',
|
|
24
|
+
gridTemplateColumns: '1fr 1fr 1fr',
|
|
25
|
+
borderBottom: `1px solid ${theme.colors.border}`
|
|
26
|
+
};
|
|
27
|
+
return (_jsxs("div", { children: [title && (_jsx("h3", { style: {
|
|
28
|
+
margin: `${theme.spacing.medium} 0`,
|
|
29
|
+
color: theme.colors.text,
|
|
30
|
+
fontSize: theme.typography.h2Size
|
|
31
|
+
}, children: title })), _jsxs("div", { style: containerStyle, children: [_jsxs("div", { style: headerStyle, children: [_jsx("div", { style: cellStyle, children: "Feature" }), _jsx("div", { style: cellStyle, children: option1Name }), _jsx("div", { style: { ...cellStyle, borderRight: 'none' }, children: option2Name })] }), items.map((item, index) => (_jsxs("div", { style: {
|
|
32
|
+
...rowStyle,
|
|
33
|
+
backgroundColor: index % 2 === 0 ? theme.colors.background : theme.colors.cardBackground
|
|
34
|
+
}, children: [_jsx("div", { style: {
|
|
35
|
+
...cellStyle,
|
|
36
|
+
fontWeight: 'bold',
|
|
37
|
+
color: theme.colors.text
|
|
38
|
+
}, children: item.label }), _jsx("div", { style: {
|
|
39
|
+
...cellStyle,
|
|
40
|
+
color: theme.colors.textSecondary
|
|
41
|
+
}, children: item.option1 }), _jsx("div", { style: {
|
|
42
|
+
...cellStyle,
|
|
43
|
+
borderRight: 'none',
|
|
44
|
+
color: theme.colors.textSecondary
|
|
45
|
+
}, children: item.option2 })] }, index)))] })] }));
|
|
46
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
|
|
3
|
+
export const Heading = ({ level, children }) => {
|
|
4
|
+
const theme = useThemeWithFallback();
|
|
5
|
+
const style = {
|
|
6
|
+
margin: level === 1 ? `0 0 ${theme.spacing.medium} 0` : `0 0 ${theme.spacing.small} 0`,
|
|
7
|
+
fontSize: level === 1 ? theme.typography.h1Size : theme.typography.h2Size,
|
|
8
|
+
fontWeight: 'bold',
|
|
9
|
+
color: theme.colors.text,
|
|
10
|
+
fontFamily: theme.typography.fontFamily
|
|
11
|
+
};
|
|
12
|
+
return level === 1 ? (_jsx("h1", { style: style, children: children })) : (_jsx("h2", { style: style, children: children }));
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
|
|
3
|
+
export const List = ({ children, ordered = false }) => {
|
|
4
|
+
const theme = useThemeWithFallback();
|
|
5
|
+
const style = {
|
|
6
|
+
margin: `0 0 ${theme.spacing.medium} 0`,
|
|
7
|
+
paddingLeft: theme.spacing.large,
|
|
8
|
+
color: theme.colors.textSecondary,
|
|
9
|
+
lineHeight: '1.6'
|
|
10
|
+
};
|
|
11
|
+
return ordered ? (_jsx("ol", { style: style, children: children })) : (_jsx("ul", { style: style, children: children }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
|
|
3
|
+
export const Paragraph = ({ children }) => {
|
|
4
|
+
const theme = useThemeWithFallback();
|
|
5
|
+
const style = {
|
|
6
|
+
margin: `0 0 ${theme.spacing.medium} 0`,
|
|
7
|
+
lineHeight: '1.6',
|
|
8
|
+
color: theme.colors.textSecondary,
|
|
9
|
+
fontSize: theme.typography.bodySize,
|
|
10
|
+
fontFamily: theme.typography.fontFamily
|
|
11
|
+
};
|
|
12
|
+
return _jsx("p", { style: style, children: children });
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ProcessStep {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
interface ProcessFlowProps {
|
|
7
|
+
steps: ProcessStep[];
|
|
8
|
+
title?: string;
|
|
9
|
+
direction?: 'horizontal' | 'vertical';
|
|
10
|
+
}
|
|
11
|
+
export declare const ProcessFlow: React.FC<ProcessFlowProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
|
|
4
|
+
export const ProcessFlow = ({ steps, title, direction = 'horizontal' }) => {
|
|
5
|
+
const theme = useThemeWithFallback();
|
|
6
|
+
const containerStyle = {
|
|
7
|
+
margin: `${theme.spacing.large} 0`,
|
|
8
|
+
padding: theme.spacing.medium,
|
|
9
|
+
border: `1px solid ${theme.colors.border}`,
|
|
10
|
+
borderRadius: theme.borderRadius.medium,
|
|
11
|
+
backgroundColor: theme.colors.cardBackground
|
|
12
|
+
};
|
|
13
|
+
const flowStyle = {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: direction === 'horizontal' ? 'row' : 'column',
|
|
16
|
+
gap: theme.spacing.medium,
|
|
17
|
+
alignItems: direction === 'horizontal' ? 'center' : 'stretch',
|
|
18
|
+
overflowX: direction === 'horizontal' ? 'auto' : 'visible'
|
|
19
|
+
};
|
|
20
|
+
const stepStyle = {
|
|
21
|
+
flex: direction === 'horizontal' ? '0 0 200px' : '1',
|
|
22
|
+
padding: theme.spacing.medium,
|
|
23
|
+
backgroundColor: theme.colors.background,
|
|
24
|
+
border: `2px solid ${theme.colors.primary}`,
|
|
25
|
+
borderRadius: theme.borderRadius.small,
|
|
26
|
+
position: 'relative'
|
|
27
|
+
};
|
|
28
|
+
const arrowStyle = {
|
|
29
|
+
color: theme.colors.primary,
|
|
30
|
+
fontSize: '24px',
|
|
31
|
+
fontWeight: 'bold',
|
|
32
|
+
flex: '0 0 auto'
|
|
33
|
+
};
|
|
34
|
+
return (_jsxs("div", { style: containerStyle, children: [title && (_jsx("h3", { style: {
|
|
35
|
+
margin: `0 0 ${theme.spacing.medium} 0`,
|
|
36
|
+
color: theme.colors.text,
|
|
37
|
+
fontSize: theme.typography.h2Size
|
|
38
|
+
}, children: title })), _jsx("div", { style: flowStyle, children: steps.map((step, index) => (_jsxs(React.Fragment, { children: [_jsxs("div", { style: stepStyle, children: [_jsxs("div", { style: {
|
|
39
|
+
fontWeight: 'bold',
|
|
40
|
+
marginBottom: theme.spacing.small,
|
|
41
|
+
color: theme.colors.primary,
|
|
42
|
+
fontSize: theme.typography.bodySize
|
|
43
|
+
}, children: [index + 1, ". ", step.title] }), _jsx("div", { style: {
|
|
44
|
+
color: theme.colors.textSecondary,
|
|
45
|
+
fontSize: theme.typography.smallSize,
|
|
46
|
+
lineHeight: '1.5'
|
|
47
|
+
}, children: step.description })] }), index < steps.length - 1 && (_jsx("div", { style: arrowStyle, children: direction === 'horizontal' ? '→' : '↓' }))] }, index))) })] }));
|
|
48
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { LLMResponse } from '../types/mockLLM';
|
|
3
|
+
interface VisualizationContextType {
|
|
4
|
+
visualizations: LLMResponse[];
|
|
5
|
+
addVisualization: (viz: LLMResponse) => void;
|
|
6
|
+
clearVisualizations: () => void;
|
|
7
|
+
}
|
|
8
|
+
interface VisualizationProviderProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const VisualizationProvider: React.FC<VisualizationProviderProps>;
|
|
12
|
+
export declare const useVisualizations: () => VisualizationContextType;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from 'react';
|
|
3
|
+
const VisualizationContext = createContext(undefined);
|
|
4
|
+
export const VisualizationProvider = ({ children }) => {
|
|
5
|
+
const [visualizations, setVisualizations] = useState([]);
|
|
6
|
+
const addVisualization = (viz) => {
|
|
7
|
+
console.log('Storing visualization:', viz);
|
|
8
|
+
setVisualizations(prev => [...prev, viz]);
|
|
9
|
+
};
|
|
10
|
+
const clearVisualizations = () => {
|
|
11
|
+
setVisualizations([]);
|
|
12
|
+
};
|
|
13
|
+
return (_jsx(VisualizationContext.Provider, { value: { visualizations, addVisualization, clearVisualizations }, children: children }));
|
|
14
|
+
};
|
|
15
|
+
export const useVisualizations = () => {
|
|
16
|
+
const context = useContext(VisualizationContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error('useVisualizations must be used within VisualizationProvider');
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { ThemeProvider, useTheme } from './theme/ThemeContext';
|
|
2
|
+
export { lightTheme, darkTheme } from './theme/themes';
|
|
3
|
+
export { defaultTheme } from './theme/defaultTheme';
|
|
4
|
+
export { useThemeWithFallback } from './utils/useThemeWithFallback';
|
|
5
|
+
export type { Theme } from './theme/types';
|
|
6
|
+
export { MDXRenderer } from './MDXRenderer';
|
|
7
|
+
export { ProsConsBlock } from './components/smart/ProsConsBlock';
|
|
8
|
+
export { ComparisonBlock } from './components/smart/ComparisonBlock';
|
|
9
|
+
export { FlowBlock } from './components/smart/FlowBlock';
|
|
10
|
+
export { ConceptTreeBlock } from './components/smart/ConceptTreeBlock';
|
|
11
|
+
export { DynamicVisualizations } from './components/DynamicVisualizations';
|
|
12
|
+
export { VisualizationProvider, useVisualizations } from './context/VisualizationContext';
|
|
13
|
+
export { visualizationRegistry } from './registry/visualizationRegistry';
|
|
14
|
+
export type { VisualizationType } from './registry/visualizationRegistry';
|
|
15
|
+
export { Card } from './components/layout/Card';
|
|
16
|
+
export { SimpleChart } from './components/data/SimpleChart';
|
|
17
|
+
export { LineChart } from './components/data/LineChart';
|
|
18
|
+
export { BarChart } from './components/data/BarChart';
|
|
19
|
+
export { Accordion } from './components/interactive/Accordion';
|
|
20
|
+
export { Tabs } from './components/interactive/Tabs';
|
|
21
|
+
export { Dashboard } from './components/composite/Dashboard';
|
|
22
|
+
export { DataExplorer } from './components/composite/DataExplorer';
|
|
23
|
+
export { Heading } from './components/text/Heading';
|
|
24
|
+
export { Paragraph } from './components/text/Paragraph';
|
|
25
|
+
export { ProcessFlow } from './components/text/ProcessFlow';
|
|
26
|
+
export { ComparisonGrid } from './components/text/ComparisonGrid';
|
|
27
|
+
export { WeatherWidget } from './components/WeatherWidget';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Theme
|
|
2
|
+
export { ThemeProvider, useTheme } from './theme/ThemeContext';
|
|
3
|
+
export { lightTheme, darkTheme } from './theme/themes';
|
|
4
|
+
export { defaultTheme } from './theme/defaultTheme';
|
|
5
|
+
export { useThemeWithFallback } from './utils/useThemeWithFallback';
|
|
6
|
+
// Renderer
|
|
7
|
+
export { MDXRenderer } from './MDXRenderer';
|
|
8
|
+
// Smart Components
|
|
9
|
+
export { ProsConsBlock } from './components/smart/ProsConsBlock';
|
|
10
|
+
export { ComparisonBlock } from './components/smart/ComparisonBlock';
|
|
11
|
+
export { FlowBlock } from './components/smart/FlowBlock';
|
|
12
|
+
export { ConceptTreeBlock } from './components/smart/ConceptTreeBlock';
|
|
13
|
+
export { DynamicVisualizations } from './components/DynamicVisualizations';
|
|
14
|
+
export { VisualizationProvider, useVisualizations } from './context/VisualizationContext';
|
|
15
|
+
export { visualizationRegistry } from './registry/visualizationRegistry';
|
|
16
|
+
// Layout Components
|
|
17
|
+
export { Card } from './components/layout/Card';
|
|
18
|
+
// Data Components
|
|
19
|
+
export { SimpleChart } from './components/data/SimpleChart';
|
|
20
|
+
export { LineChart } from './components/data/LineChart';
|
|
21
|
+
export { BarChart } from './components/data/BarChart';
|
|
22
|
+
// Interactive Components
|
|
23
|
+
export { Accordion } from './components/interactive/Accordion';
|
|
24
|
+
export { Tabs } from './components/interactive/Tabs';
|
|
25
|
+
// Composite Components
|
|
26
|
+
export { Dashboard } from './components/composite/Dashboard';
|
|
27
|
+
export { DataExplorer } from './components/composite/DataExplorer';
|
|
28
|
+
// Text Components
|
|
29
|
+
export { Heading } from './components/text/Heading';
|
|
30
|
+
export { Paragraph } from './components/text/Paragraph';
|
|
31
|
+
export { ProcessFlow } from './components/text/ProcessFlow';
|
|
32
|
+
export { ComparisonGrid } from './components/text/ComparisonGrid';
|
|
33
|
+
// Weather Widget
|
|
34
|
+
export { WeatherWidget } from './components/WeatherWidget';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const visualizationRegistry: {
|
|
2
|
+
pros_cons: import("react").FC<import("../components/smart/ProsConsBlock").ProsConsBlockProps>;
|
|
3
|
+
comparison: import("react").FC<import("../components/smart/ComparisonBlock").ComparisonBlockProps>;
|
|
4
|
+
flow: import("react").FC<import("../components/smart/FlowBlock").FlowBlockProps>;
|
|
5
|
+
concept_tree: import("react").FC<import("../components/smart/ConceptTreeBlock").ConceptTreeBlockProps>;
|
|
6
|
+
line_chart: import("react").FC<import("../components/smart/LineChartBlock").LineChartBlockProps>;
|
|
7
|
+
interactive_composite: import("react").FC<import("../components/smart/InteractiveCompositeBlock").InteractiveCompositeProps>;
|
|
8
|
+
sunburst: import("react").FC<import("../components/smart/Sunburst").SunburstProps>;
|
|
9
|
+
};
|
|
10
|
+
export type VisualizationType = keyof typeof visualizationRegistry;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComparisonBlock } from "../components/smart/ComparisonBlock";
|
|
2
|
+
import { ConceptTreeBlock } from "../components/smart/ConceptTreeBlock";
|
|
3
|
+
import { FlowBlock } from "../components/smart/FlowBlock";
|
|
4
|
+
import { InteractiveCompositeBlock } from "../components/smart/InteractiveCompositeBlock";
|
|
5
|
+
import { LineChartBlock } from "../components/smart/LineChartBlock";
|
|
6
|
+
import { ProsConsBlock } from "../components/smart/ProsConsBlock";
|
|
7
|
+
import { Sunburst } from "../components/smart/Sunburst";
|
|
8
|
+
export const visualizationRegistry = {
|
|
9
|
+
pros_cons: ProsConsBlock,
|
|
10
|
+
comparison: ComparisonBlock,
|
|
11
|
+
flow: FlowBlock,
|
|
12
|
+
concept_tree: ConceptTreeBlock,
|
|
13
|
+
line_chart: LineChartBlock,
|
|
14
|
+
interactive_composite: InteractiveCompositeBlock,
|
|
15
|
+
sunburst: Sunburst,
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Theme } from './types';
|
|
3
|
+
interface ThemeContextType {
|
|
4
|
+
theme: Theme;
|
|
5
|
+
themeName: 'light' | 'dark';
|
|
6
|
+
toggleTheme: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ThemeContext: React.Context<ThemeContextType | undefined>;
|
|
9
|
+
interface ThemeProviderProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
13
|
+
export declare const useTheme: () => ThemeContextType;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from 'react';
|
|
3
|
+
import { lightTheme, darkTheme } from './themes';
|
|
4
|
+
export const ThemeContext = createContext(undefined);
|
|
5
|
+
export const ThemeProvider = ({ children }) => {
|
|
6
|
+
const [themeName, setThemeName] = useState('light');
|
|
7
|
+
const theme = themeName === 'light' ? lightTheme : darkTheme;
|
|
8
|
+
const toggleTheme = () => {
|
|
9
|
+
setThemeName(prev => prev === 'light' ? 'dark' : 'light');
|
|
10
|
+
};
|
|
11
|
+
return (_jsx(ThemeContext.Provider, { value: { theme, themeName, toggleTheme }, children: children }));
|
|
12
|
+
};
|
|
13
|
+
export const useTheme = () => {
|
|
14
|
+
const context = useContext(ThemeContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error('useTheme must be used within ThemeProvider');
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const defaultTheme = {
|
|
2
|
+
colors: {
|
|
3
|
+
primary: '#007bff',
|
|
4
|
+
secondary: '#6c757d',
|
|
5
|
+
text: '#1a1a1a',
|
|
6
|
+
textSecondary: '#666',
|
|
7
|
+
background: '#ffffff',
|
|
8
|
+
cardBackground: '#f8f9fa',
|
|
9
|
+
border: '#ddd',
|
|
10
|
+
chartLine: '#8884d8',
|
|
11
|
+
chartBar: '#82ca9d'
|
|
12
|
+
},
|
|
13
|
+
spacing: {
|
|
14
|
+
small: '8px',
|
|
15
|
+
medium: '16px',
|
|
16
|
+
large: '32px',
|
|
17
|
+
xlarge: '48px'
|
|
18
|
+
},
|
|
19
|
+
typography: {
|
|
20
|
+
h1Size: '32px',
|
|
21
|
+
h2Size: '24px',
|
|
22
|
+
bodySize: '16px',
|
|
23
|
+
smallSize: '14px',
|
|
24
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
25
|
+
},
|
|
26
|
+
borderRadius: {
|
|
27
|
+
small: '4px',
|
|
28
|
+
medium: '8px'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const lightTheme = {
|
|
2
|
+
colors: {
|
|
3
|
+
primary: '#007bff',
|
|
4
|
+
secondary: '#6c757d',
|
|
5
|
+
text: '#1a1a1a',
|
|
6
|
+
textSecondary: '#666',
|
|
7
|
+
background: '#ffffff',
|
|
8
|
+
cardBackground: '#f8f9fa',
|
|
9
|
+
border: '#ddd',
|
|
10
|
+
chartLine: '#8884d8',
|
|
11
|
+
chartBar: '#82ca9d'
|
|
12
|
+
},
|
|
13
|
+
spacing: {
|
|
14
|
+
small: '8px',
|
|
15
|
+
medium: '16px',
|
|
16
|
+
large: '32px',
|
|
17
|
+
xlarge: '48px'
|
|
18
|
+
},
|
|
19
|
+
typography: {
|
|
20
|
+
h1Size: '32px',
|
|
21
|
+
h2Size: '24px',
|
|
22
|
+
bodySize: '16px',
|
|
23
|
+
smallSize: '14px',
|
|
24
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
25
|
+
},
|
|
26
|
+
borderRadius: {
|
|
27
|
+
small: '4px',
|
|
28
|
+
medium: '8px',
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export const darkTheme = {
|
|
32
|
+
colors: {
|
|
33
|
+
primary: '#0d6efd',
|
|
34
|
+
secondary: '#6c757d',
|
|
35
|
+
text: '#e9ecef',
|
|
36
|
+
textSecondary: '#adb5bd',
|
|
37
|
+
background: '#212529',
|
|
38
|
+
cardBackground: '#2d3238',
|
|
39
|
+
border: '#495057',
|
|
40
|
+
chartLine: '#66b3ff',
|
|
41
|
+
chartBar: '#66d9a6'
|
|
42
|
+
},
|
|
43
|
+
spacing: {
|
|
44
|
+
small: '8px',
|
|
45
|
+
medium: '16px',
|
|
46
|
+
large: '32px',
|
|
47
|
+
xlarge: '48px'
|
|
48
|
+
},
|
|
49
|
+
typography: {
|
|
50
|
+
h1Size: '32px',
|
|
51
|
+
h2Size: '24px',
|
|
52
|
+
bodySize: '16px',
|
|
53
|
+
smallSize: '14px',
|
|
54
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
55
|
+
},
|
|
56
|
+
borderRadius: {
|
|
57
|
+
small: '4px',
|
|
58
|
+
medium: '8px'
|
|
59
|
+
}
|
|
60
|
+
};
|