@amritanshu3011/mdx-renderer 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/MDXRenderer.d.ts +7 -0
  2. package/dist/MDXRenderer.js +56 -0
  3. package/dist/components/DynamicVisualizations.d.ts +2 -0
  4. package/dist/components/DynamicVisualizations.js +17 -0
  5. package/dist/components/WeatherWidget.d.ts +6 -0
  6. package/dist/components/WeatherWidget.js +29 -0
  7. package/dist/components/composite/Dashboard.d.ts +8 -0
  8. package/dist/components/composite/Dashboard.js +14 -0
  9. package/dist/components/composite/DataExplorer.d.ts +8 -0
  10. package/dist/components/composite/DataExplorer.js +37 -0
  11. package/dist/components/composite/index.d.ts +0 -0
  12. package/dist/components/composite/index.js +1 -0
  13. package/dist/components/data/BarChart.d.ts +10 -0
  14. package/dist/components/data/BarChart.js +17 -0
  15. package/dist/components/data/LineChart.d.ts +10 -0
  16. package/dist/components/data/LineChart.js +17 -0
  17. package/dist/components/data/SimpleChart.d.ts +6 -0
  18. package/dist/components/data/SimpleChart.js +18 -0
  19. package/dist/components/data/Table.d.ts +0 -0
  20. package/dist/components/data/Table.js +1 -0
  21. package/dist/components/data/index.d.ts +0 -0
  22. package/dist/components/data/index.js +1 -0
  23. package/dist/components/index.d.ts +0 -0
  24. package/dist/components/index.js +1 -0
  25. package/dist/components/interactive/Accordion.d.ts +8 -0
  26. package/dist/components/interactive/Accordion.js +29 -0
  27. package/dist/components/interactive/Modal.d.ts +0 -0
  28. package/dist/components/interactive/Modal.js +1 -0
  29. package/dist/components/interactive/Tabs.d.ts +11 -0
  30. package/dist/components/interactive/Tabs.js +22 -0
  31. package/dist/components/interactive/index.d.ts +0 -0
  32. package/dist/components/interactive/index.js +1 -0
  33. package/dist/components/layout/Card.d.ts +6 -0
  34. package/dist/components/layout/Card.js +13 -0
  35. package/dist/components/layout/Container.d.ts +0 -0
  36. package/dist/components/layout/Container.js +1 -0
  37. package/dist/components/layout/Grid.d.ts +0 -0
  38. package/dist/components/layout/Grid.js +1 -0
  39. package/dist/components/layout/index.d.ts +0 -0
  40. package/dist/components/layout/index.js +1 -0
  41. package/dist/components/smart/ComparisonBlock.d.ts +14 -0
  42. package/dist/components/smart/ComparisonBlock.js +81 -0
  43. package/dist/components/smart/ConceptTreeBlock.d.ts +11 -0
  44. package/dist/components/smart/ConceptTreeBlock.js +140 -0
  45. package/dist/components/smart/FlowBlock.d.ts +11 -0
  46. package/dist/components/smart/FlowBlock.js +122 -0
  47. package/dist/components/smart/InteractiveCompositeBlock.d.ts +22 -0
  48. package/dist/components/smart/InteractiveCompositeBlock.js +102 -0
  49. package/dist/components/smart/LineChartBlock.d.ts +8 -0
  50. package/dist/components/smart/LineChartBlock.js +22 -0
  51. package/dist/components/smart/ProsConsBlock.d.ts +7 -0
  52. package/dist/components/smart/ProsConsBlock.js +77 -0
  53. package/dist/components/smart/Sunburst.d.ts +12 -0
  54. package/dist/components/smart/Sunburst.js +152 -0
  55. package/dist/components/text/Blockquote.d.ts +7 -0
  56. package/dist/components/text/Blockquote.js +16 -0
  57. package/dist/components/text/ComparisonGrid.d.ts +14 -0
  58. package/dist/components/text/ComparisonGrid.js +46 -0
  59. package/dist/components/text/Heading.d.ts +7 -0
  60. package/dist/components/text/Heading.js +13 -0
  61. package/dist/components/text/List.d.ts +7 -0
  62. package/dist/components/text/List.js +12 -0
  63. package/dist/components/text/Paragraph.d.ts +6 -0
  64. package/dist/components/text/Paragraph.js +13 -0
  65. package/dist/components/text/ProcessFlow.d.ts +12 -0
  66. package/dist/components/text/ProcessFlow.js +48 -0
  67. package/dist/components/text/index.d.ts +0 -0
  68. package/dist/components/text/index.js +1 -0
  69. package/dist/context/VisualizationContext.d.ts +13 -0
  70. package/dist/context/VisualizationContext.js +21 -0
  71. package/dist/index.d.ts +27 -0
  72. package/dist/index.js +34 -0
  73. package/dist/registry/visualizationRegistry.d.ts +10 -0
  74. package/dist/registry/visualizationRegistry.js +16 -0
  75. package/dist/theme/ThemeContext.d.ts +14 -0
  76. package/dist/theme/ThemeContext.js +19 -0
  77. package/dist/theme/defaultTheme.d.ts +2 -0
  78. package/dist/theme/defaultTheme.js +30 -0
  79. package/dist/theme/index.d.ts +0 -0
  80. package/dist/theme/index.js +1 -0
  81. package/dist/theme/themes.d.ts +3 -0
  82. package/dist/theme/themes.js +60 -0
  83. package/dist/theme/types.d.ts +30 -0
  84. package/dist/theme/types.js +1 -0
  85. package/dist/types/mockLLM.d.ts +5 -0
  86. package/dist/types/mockLLM.js +109 -0
  87. package/dist/utils/useThemeWithFallback.d.ts +2 -0
  88. package/dist/utils/useThemeWithFallback.js +7 -0
  89. package/dist/utils/withDefaults.d.ts +2 -0
  90. package/dist/utils/withDefaults.js +4 -0
  91. package/package.json +10 -10
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface MDXRendererProps {
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ }
6
+ export declare const MDXRenderer: React.FC<MDXRendererProps>;
7
+ export {};
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MDXProvider } from '@mdx-js/react';
3
+ import { useThemeWithFallback } from './utils/useThemeWithFallback';
4
+ // Text components
5
+ import { Heading } from './components/text/Heading';
6
+ import { Paragraph } from './components/text/Paragraph';
7
+ import { Blockquote } from './components/text/Blockquote';
8
+ import { List } from './components/text/List';
9
+ // Layout components
10
+ import { Card } from './components/layout/Card';
11
+ // Data components
12
+ import { SimpleChart } from './components/data/SimpleChart';
13
+ import { LineChart } from './components/data/LineChart';
14
+ import { BarChart } from './components/data/BarChart';
15
+ // Interactive components
16
+ import { Accordion } from './components/interactive/Accordion';
17
+ import { Tabs } from './components/interactive/Tabs';
18
+ // Composite components
19
+ import { Dashboard } from './components/composite/Dashboard';
20
+ import { DataExplorer } from './components/composite/DataExplorer';
21
+ import { WeatherWidget } from './components/WeatherWidget';
22
+ import { ProcessFlow } from './components/text/ProcessFlow';
23
+ import { ComparisonGrid } from './components/text/ComparisonGrid';
24
+ import { DynamicVisualizations } from './components/DynamicVisualizations';
25
+ const components = {
26
+ // Text
27
+ h1: (props) => _jsx(Heading, { level: 1, ...props }),
28
+ h2: (props) => _jsx(Heading, { level: 2, ...props }),
29
+ p: (props) => _jsx(Paragraph, { ...props }),
30
+ blockquote: (props) => _jsx(Blockquote, { ...props }),
31
+ ul: (props) => _jsx(List, { ordered: false, ...props }),
32
+ ol: (props) => _jsx(List, { ordered: true, ...props }),
33
+ // Layout
34
+ Card,
35
+ // Data
36
+ SimpleChart,
37
+ LineChart,
38
+ BarChart,
39
+ // Interactive
40
+ Accordion,
41
+ Tabs,
42
+ // Composite
43
+ Dashboard,
44
+ DataExplorer,
45
+ // Widgets
46
+ WeatherWidget,
47
+ //LLM
48
+ DynamicVisualizations,
49
+ //Text
50
+ ProcessFlow,
51
+ ComparisonGrid,
52
+ };
53
+ export const MDXRenderer = ({ children, className = 'mdx-content' }) => {
54
+ const theme = useThemeWithFallback();
55
+ return (_jsx("div", { className: className, "data-theme": theme.colors.background === '#212529' ? 'dark' : 'light', children: _jsx(MDXProvider, { components: components, children: children }) }));
56
+ };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const DynamicVisualizations: React.FC;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useVisualizations } from '../context/VisualizationContext';
3
+ import { visualizationRegistry } from '../registry/visualizationRegistry';
4
+ export const DynamicVisualizations = () => {
5
+ const { visualizations } = useVisualizations();
6
+ if (visualizations.length === 0)
7
+ return null;
8
+ return (_jsx("div", { children: visualizations.map((viz, index) => {
9
+ const vizType = viz.type;
10
+ const Component = visualizationRegistry[vizType];
11
+ if (!Component) {
12
+ console.warn(`Unknown visualization type: ${viz.type}`);
13
+ return null;
14
+ }
15
+ return (_jsx("div", { children: _jsx(Component, { ...viz.data }) }, index));
16
+ }) }));
17
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface WeatherWidgetProps {
3
+ city?: string;
4
+ }
5
+ export declare const WeatherWidget: React.FC<WeatherWidgetProps>;
6
+ export {};
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from 'react';
3
+ import { useThemeWithFallback } from '../utils/useThemeWithFallback';
4
+ export const WeatherWidget = ({ city = 'London' }) => {
5
+ const theme = useThemeWithFallback();
6
+ const [weather, setWeather] = useState(null);
7
+ const [loading, setLoading] = useState(true);
8
+ useEffect(() => {
9
+ fetch(`https://wttr.in/${city}?format=j1`)
10
+ .then(res => res.json())
11
+ .then(data => {
12
+ setWeather(data);
13
+ setLoading(false);
14
+ })
15
+ .catch(() => setLoading(false));
16
+ }, [city]);
17
+ if (loading)
18
+ return _jsx("div", { style: { color: theme.colors.text }, children: "Loading weather..." });
19
+ if (!weather)
20
+ return _jsx("div", { style: { color: theme.colors.text }, children: "Failed to load weather" });
21
+ const current = weather.current_condition[0];
22
+ return (_jsxs("div", { style: {
23
+ padding: theme.spacing.medium,
24
+ border: `1px solid ${theme.colors.border}`,
25
+ borderRadius: theme.borderRadius.small,
26
+ backgroundColor: theme.colors.cardBackground,
27
+ margin: `${theme.spacing.medium} 0`
28
+ }, children: [_jsxs("h3", { style: { margin: '0 0 12px 0', color: theme.colors.text }, children: ["Weather in ", city] }), _jsxs("div", { style: { color: theme.colors.textSecondary }, children: [_jsxs("p", { children: ["\uD83C\uDF21\uFE0F Temperature: ", current.temp_C, "\u00B0C / ", current.temp_F, "\u00B0F"] }), _jsxs("p", { children: ["\u2601\uFE0F Condition: ", current.weatherDesc[0].value] }), _jsxs("p", { children: ["\uD83D\uDCA8 Wind: ", current.windspeedKmph, " km/h"] }), _jsxs("p", { children: ["\uD83D\uDCA7 Humidity: ", current.humidity, "%"] })] })] }));
29
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface DashboardProps {
3
+ title?: string;
4
+ children: React.ReactNode;
5
+ columns?: number;
6
+ }
7
+ export declare const Dashboard: React.FC<DashboardProps>;
8
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
3
+ export const Dashboard = ({ title, children, columns = 2 }) => {
4
+ const theme = useThemeWithFallback();
5
+ return (_jsxs("div", { style: { margin: `${theme.spacing.large} 0` }, children: [title && (_jsx("h2", { style: {
6
+ margin: `0 0 ${theme.spacing.medium} 0`,
7
+ color: theme.colors.text,
8
+ fontSize: theme.typography.h2Size
9
+ }, children: title })), _jsx("div", { style: {
10
+ display: 'grid',
11
+ gridTemplateColumns: `repeat(${columns}, 1fr)`,
12
+ gap: theme.spacing.medium
13
+ }, children: children })] }));
14
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface DataExplorerProps {
3
+ data: Array<Record<string, any>>;
4
+ title?: string;
5
+ searchable?: boolean;
6
+ }
7
+ export declare const DataExplorer: React.FC<DataExplorerProps>;
8
+ export {};
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
4
+ export const DataExplorer = ({ data, title = 'Data Explorer', searchable = true }) => {
5
+ const theme = useThemeWithFallback();
6
+ const [search, setSearch] = useState('');
7
+ const filtered = data.filter(row => JSON.stringify(row).toLowerCase().includes(search.toLowerCase()));
8
+ return (_jsxs("div", { style: {
9
+ border: `1px solid ${theme.colors.border}`,
10
+ borderRadius: theme.borderRadius.small,
11
+ padding: theme.spacing.medium,
12
+ margin: `${theme.spacing.medium} 0`
13
+ }, children: [_jsx("h3", { style: {
14
+ margin: `0 0 ${theme.spacing.medium} 0`,
15
+ color: theme.colors.text
16
+ }, children: title }), searchable && (_jsx("input", { type: "text", placeholder: "Search...", value: search, onChange: (e) => setSearch(e.target.value), style: {
17
+ width: '100%',
18
+ padding: theme.spacing.small,
19
+ marginBottom: theme.spacing.medium,
20
+ border: `1px solid ${theme.colors.border}`,
21
+ borderRadius: theme.borderRadius.small,
22
+ fontSize: theme.typography.bodySize,
23
+ backgroundColor: theme.colors.background,
24
+ color: theme.colors.text
25
+ } })), _jsx("div", { style: {
26
+ maxHeight: '400px',
27
+ overflowY: 'auto',
28
+ fontSize: theme.typography.smallSize
29
+ }, children: _jsx("pre", { style: {
30
+ margin: 0,
31
+ color: theme.colors.text
32
+ }, children: JSON.stringify(filtered, null, 2) }) }), _jsxs("div", { style: {
33
+ marginTop: theme.spacing.small,
34
+ color: theme.colors.textSecondary,
35
+ fontSize: theme.typography.smallSize
36
+ }, children: ["Showing ", filtered.length, " of ", data.length, " records"] })] }));
37
+ };
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface BarChartProps {
3
+ data: Array<Record<string, any>>;
4
+ xKey: string;
5
+ yKey: string;
6
+ title?: string;
7
+ barColor?: string;
8
+ }
9
+ export declare const BarChart: React.FC<BarChartProps>;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BarChart as RechartsBar, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
3
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
4
+ export const BarChart = ({ data, xKey, yKey, title, barColor }) => {
5
+ const theme = useThemeWithFallback();
6
+ const color = barColor || theme.colors.chartBar;
7
+ return (_jsxs("div", { style: { width: '100%', margin: `${theme.spacing.large} 0` }, children: [title && (_jsx("h3", { style: {
8
+ margin: `0 0 ${theme.spacing.small} 0`,
9
+ fontSize: '18px',
10
+ color: theme.colors.text,
11
+ fontFamily: theme.typography.fontFamily
12
+ }, children: title })), _jsx(ResponsiveContainer, { width: "100%", height: 300, children: _jsxs(RechartsBar, { data: data, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: theme.colors.border }), _jsx(XAxis, { dataKey: xKey, stroke: theme.colors.text }), _jsx(YAxis, { stroke: theme.colors.text }), _jsx(Tooltip, { contentStyle: {
13
+ backgroundColor: theme.colors.cardBackground,
14
+ border: `1px solid ${theme.colors.border}`,
15
+ color: theme.colors.text
16
+ } }), _jsx(Legend, {}), _jsx(Bar, { dataKey: yKey, fill: color })] }) })] }));
17
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface LineChartProps {
3
+ data: Array<Record<string, any>>;
4
+ xKey: string;
5
+ yKey: string;
6
+ title?: string;
7
+ lineColor?: string;
8
+ }
9
+ export declare const LineChart: React.FC<LineChartProps>;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LineChart as RechartsLine, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
3
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
4
+ export const LineChart = ({ data, xKey, yKey, title, lineColor }) => {
5
+ const theme = useThemeWithFallback();
6
+ const color = lineColor || theme.colors.chartLine;
7
+ return (_jsxs("div", { style: { width: '100%', margin: `${theme.spacing.large} 0` }, children: [title && (_jsx("h3", { style: {
8
+ margin: `0 0 ${theme.spacing.small} 0`,
9
+ fontSize: '18px',
10
+ color: theme.colors.text,
11
+ fontFamily: theme.typography.fontFamily
12
+ }, children: title })), _jsx(ResponsiveContainer, { width: "100%", height: 300, children: _jsxs(RechartsLine, { data: data, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: theme.colors.border }), _jsx(XAxis, { dataKey: xKey, stroke: theme.colors.text }), _jsx(YAxis, { stroke: theme.colors.text }), _jsx(Tooltip, { contentStyle: {
13
+ backgroundColor: theme.colors.cardBackground,
14
+ border: `1px solid ${theme.colors.border}`,
15
+ color: theme.colors.text
16
+ } }), _jsx(Legend, {}), _jsx(Line, { type: "monotone", dataKey: yKey, stroke: color, strokeWidth: 2 })] }) })] }));
17
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface SimpleChartProps {
3
+ data: Record<string, any> | string;
4
+ }
5
+ export declare const SimpleChart: React.FC<SimpleChartProps>;
6
+ export {};
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
3
+ export const SimpleChart = ({ data }) => {
4
+ const theme = useThemeWithFallback();
5
+ const style = {
6
+ padding: theme.spacing.small,
7
+ backgroundColor: theme.colors.cardBackground,
8
+ borderRadius: theme.borderRadius.small,
9
+ fontFamily: 'monospace',
10
+ fontSize: theme.typography.smallSize,
11
+ whiteSpace: 'pre-wrap',
12
+ wordBreak: 'break-word',
13
+ color: theme.colors.text,
14
+ border: `1px solid ${theme.colors.border}`
15
+ };
16
+ const displayData = typeof data === 'string' ? data : JSON.stringify(data, null, 2);
17
+ return _jsx("pre", { style: style, children: displayData });
18
+ };
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface AccordionProps {
3
+ title: string;
4
+ children: React.ReactNode;
5
+ defaultOpen?: boolean;
6
+ }
7
+ export declare const Accordion: React.FC<AccordionProps>;
8
+ export {};
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
4
+ export const Accordion = ({ title, children, defaultOpen = false }) => {
5
+ const theme = useThemeWithFallback();
6
+ const [isOpen, setIsOpen] = useState(defaultOpen);
7
+ return (_jsxs("div", { style: {
8
+ border: `1px solid ${theme.colors.border}`,
9
+ borderRadius: theme.borderRadius.small,
10
+ margin: `${theme.spacing.medium} 0`,
11
+ overflow: 'hidden'
12
+ }, children: [_jsxs("button", { onClick: () => setIsOpen(!isOpen), style: {
13
+ width: '100%',
14
+ padding: theme.spacing.medium,
15
+ backgroundColor: theme.colors.cardBackground,
16
+ border: 'none',
17
+ textAlign: 'left',
18
+ cursor: 'pointer',
19
+ fontSize: theme.typography.bodySize,
20
+ fontWeight: 'bold',
21
+ color: theme.colors.text,
22
+ display: 'flex',
23
+ justifyContent: 'space-between',
24
+ alignItems: 'center'
25
+ }, children: [title, _jsx("span", { children: isOpen ? '▼' : '▶' })] }), isOpen && (_jsx("div", { style: {
26
+ padding: theme.spacing.medium,
27
+ borderTop: `1px solid ${theme.colors.border}`
28
+ }, children: children }))] }));
29
+ };
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface Tab {
3
+ label: string;
4
+ content: React.ReactNode;
5
+ }
6
+ interface TabsProps {
7
+ tabs: Tab[];
8
+ defaultTab?: number;
9
+ }
10
+ export declare const Tabs: React.FC<TabsProps>;
11
+ export {};
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
4
+ export const Tabs = ({ tabs, defaultTab = 0 }) => {
5
+ const theme = useThemeWithFallback();
6
+ const [activeTab, setActiveTab] = useState(defaultTab);
7
+ return (_jsxs("div", { style: { margin: `${theme.spacing.medium} 0` }, children: [_jsx("div", { style: {
8
+ display: 'flex',
9
+ borderBottom: `2px solid ${theme.colors.border}`,
10
+ gap: theme.spacing.small
11
+ }, children: tabs.map((tab, index) => (_jsx("button", { onClick: () => setActiveTab(index), style: {
12
+ padding: `${theme.spacing.small} ${theme.spacing.medium}`,
13
+ border: 'none',
14
+ background: 'none',
15
+ cursor: 'pointer',
16
+ fontSize: theme.typography.bodySize,
17
+ color: activeTab === index ? theme.colors.primary : theme.colors.textSecondary,
18
+ borderBottom: activeTab === index ? `2px solid ${theme.colors.primary}` : 'none',
19
+ marginBottom: '-2px',
20
+ fontWeight: activeTab === index ? 'bold' : 'normal'
21
+ }, children: tab.label }, index))) }), _jsx("div", { style: { padding: `${theme.spacing.medium} 0` }, children: tabs[activeTab]?.content })] }));
22
+ };
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface CardProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const Card: React.FC<CardProps>;
6
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
3
+ export const Card = ({ children }) => {
4
+ const theme = useThemeWithFallback();
5
+ const style = {
6
+ border: `1px solid ${theme.colors.border}`,
7
+ borderRadius: theme.borderRadius.small,
8
+ padding: theme.spacing.medium,
9
+ margin: `${theme.spacing.medium} 0`,
10
+ backgroundColor: theme.colors.cardBackground
11
+ };
12
+ return _jsx("div", { style: style, children: children });
13
+ };
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface ComparisonItem {
3
+ aspect: string;
4
+ option1: string;
5
+ option2: string;
6
+ }
7
+ export interface ComparisonBlockProps {
8
+ title: string;
9
+ option1Name: string;
10
+ option2Name: string;
11
+ items: ComparisonItem[];
12
+ }
13
+ export declare const ComparisonBlock: React.FC<ComparisonBlockProps>;
14
+ export {};
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useMemo } from 'react';
3
+ import { useThemeWithFallback } from '../../utils/useThemeWithFallback';
4
+ export const ComparisonBlock = ({ title, option1Name, option2Name, items }) => {
5
+ const theme = useThemeWithFallback();
6
+ // --- State ---
7
+ const [filterText, setFilterText] = useState('');
8
+ const [sortMode, setSortMode] = useState('original');
9
+ const [viewMode, setViewMode] = useState('table');
10
+ const [isPivoted, setIsPivoted] = useState(false); // Swaps Rows and Columns
11
+ const [isGrouped, setIsGrouped] = useState(false); // Group aspects by first letter
12
+ // --- Data Processing ---
13
+ const processedItems = useMemo(() => {
14
+ let data = [...items];
15
+ // 1. Filter
16
+ if (filterText) {
17
+ const lower = filterText.toLowerCase();
18
+ data = data.filter(i => i.aspect.toLowerCase().includes(lower) ||
19
+ i.option1.toLowerCase().includes(lower) ||
20
+ i.option2.toLowerCase().includes(lower));
21
+ }
22
+ // 2. Sort (Sorts rows in Normal view, or Columns in Pivoted view)
23
+ if (sortMode !== 'original') {
24
+ data.sort((a, b) => sortMode === 'asc'
25
+ ? a.aspect.localeCompare(b.aspect)
26
+ : b.aspect.localeCompare(a.aspect));
27
+ }
28
+ return data;
29
+ }, [items, filterText, sortMode]);
30
+ // --- Grouping Logic ---
31
+ const groupedItems = useMemo(() => {
32
+ if (!isGrouped || isPivoted)
33
+ return { 'All Aspects': processedItems };
34
+ return processedItems.reduce((acc, item) => {
35
+ const key = item.aspect.charAt(0).toUpperCase();
36
+ if (!acc[key])
37
+ acc[key] = [];
38
+ acc[key].push(item);
39
+ return acc;
40
+ }, {});
41
+ }, [processedItems, isGrouped, isPivoted]);
42
+ // --- Helper Styles ---
43
+ const btnStyle = (active) => ({
44
+ padding: '4px 12px',
45
+ backgroundColor: active ? theme.colors.primary : 'transparent',
46
+ color: active ? '#fff' : theme.colors.text,
47
+ border: `1px solid ${theme.colors.border}`,
48
+ borderRadius: theme.borderRadius.small,
49
+ cursor: 'pointer',
50
+ fontSize: theme.typography.smallSize
51
+ });
52
+ return (_jsxs("div", { style: {
53
+ margin: `${theme.spacing.large} 0`,
54
+ border: `1px solid ${theme.colors.border}`,
55
+ borderRadius: theme.borderRadius.medium,
56
+ overflow: 'hidden',
57
+ boxShadow: '0 4px 12px rgba(0,0,0,0.05)'
58
+ }, children: [_jsxs("div", { style: {
59
+ padding: theme.spacing.medium,
60
+ backgroundColor: theme.colors.background,
61
+ borderBottom: `1px solid ${theme.colors.border}`
62
+ }, children: [_jsx("h2", { style: { margin: `0 0 ${theme.spacing.medium} 0`, color: theme.colors.text }, children: title }), _jsxs("div", { style: { display: 'flex', flexWrap: 'wrap', gap: theme.spacing.medium, justifyContent: 'space-between' }, children: [_jsxs("div", { style: { display: 'flex', gap: theme.spacing.small, flexWrap: 'wrap' }, children: [_jsx("input", { type: "text", placeholder: "Filter aspects...", value: filterText, onChange: (e) => setFilterText(e.target.value), style: { padding: '4px 8px', borderRadius: theme.borderRadius.small, border: `1px solid ${theme.colors.border}` } }), _jsxs("button", { onClick: () => setSortMode(p => p === 'original' ? 'asc' : 'original'), style: btnStyle(sortMode === 'asc'), children: ["Sort ", sortMode === 'asc' ? '(A-Z)' : 'Original'] }), !isPivoted && (_jsx("button", { onClick: () => setIsGrouped(!isGrouped), style: btnStyle(isGrouped), children: "Group (A-Z)" }))] }), _jsxs("div", { style: { display: 'flex', gap: theme.spacing.small }, children: [_jsxs("button", { onClick: () => setIsPivoted(!isPivoted), style: btnStyle(isPivoted), children: ["Pivot ", isPivoted ? '(Show Attributes)' : '(Show Entities)'] }), !isPivoted && (_jsxs("div", { style: { display: 'flex', border: `1px solid ${theme.colors.primary}`, borderRadius: theme.borderRadius.small, overflow: 'hidden' }, children: [_jsx("button", { onClick: () => setViewMode('table'), style: { ...btnStyle(viewMode === 'table'), border: 'none', borderRadius: 0 }, children: "Table" }), _jsx("button", { onClick: () => setViewMode('grid'), style: { ...btnStyle(viewMode === 'grid'), border: 'none', borderRadius: 0 }, children: "Grid" })] }))] })] })] }), _jsxs("div", { style: { padding: 0, backgroundColor: theme.colors.background }, children: [isPivoted ? (_jsx("div", { style: { overflowX: 'auto', padding: theme.spacing.medium }, children: _jsxs("table", { style: { width: '100%', borderCollapse: 'collapse', minWidth: '600px' }, children: [_jsx("thead", { children: _jsxs("tr", { style: { backgroundColor: theme.colors.primary, color: '#fff' }, children: [_jsx("th", { style: { padding: theme.spacing.medium, textAlign: 'left', minWidth: '150px' }, children: "Entity" }), processedItems.map((item, i) => (_jsx("th", { style: { padding: theme.spacing.medium, textAlign: 'left', borderLeft: '1px solid rgba(255,255,255,0.2)' }, children: item.aspect }, i)))] }) }), _jsxs("tbody", { children: [_jsxs("tr", { style: { borderBottom: `1px solid ${theme.colors.border}` }, children: [_jsx("td", { style: { padding: theme.spacing.medium, fontWeight: 'bold', color: theme.colors.text }, children: option1Name }), processedItems.map((item, i) => (_jsx("td", { style: { padding: theme.spacing.medium, color: theme.colors.textSecondary, borderLeft: `1px solid ${theme.colors.border}` }, children: item.option1 }, i)))] }), _jsxs("tr", { children: [_jsx("td", { style: { padding: theme.spacing.medium, fontWeight: 'bold', color: theme.colors.text }, children: option2Name }), processedItems.map((item, i) => (_jsx("td", { style: { padding: theme.spacing.medium, color: theme.colors.textSecondary, borderLeft: `1px solid ${theme.colors.border}` }, children: item.option2 }, i)))] })] })] }) })) : (
63
+ /* MODE 2: STANDARD VIEWS (Table or Grid) */
64
+ _jsx("div", { style: { padding: theme.spacing.medium }, children: Object.entries(groupedItems).map(([groupTitle, groupItems]) => (_jsxs("div", { style: { marginBottom: theme.spacing.medium }, children: [isGrouped && (_jsx("h4", { style: { color: theme.colors.textSecondary, borderBottom: `1px solid ${theme.colors.border}`, marginBottom: theme.spacing.small }, children: groupTitle })), viewMode === 'table' && (_jsxs("div", { style: {
65
+ border: `1px solid ${theme.colors.border}`,
66
+ borderRadius: theme.borderRadius.medium,
67
+ overflow: 'hidden'
68
+ }, children: [_jsxs("div", { style: {
69
+ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr',
70
+ backgroundColor: theme.colors.primary, color: '#fff', fontWeight: 'bold'
71
+ }, children: [_jsx("div", { style: { padding: theme.spacing.medium, borderRight: `1px solid rgba(255,255,255,0.2)` }, children: "Aspect" }), _jsx("div", { style: { padding: theme.spacing.medium, borderRight: `1px solid rgba(255,255,255,0.2)` }, children: option1Name }), _jsx("div", { style: { padding: theme.spacing.medium }, children: option2Name })] }), groupItems.map((item, i) => (_jsxs("div", { style: {
72
+ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr',
73
+ backgroundColor: i % 2 === 0 ? theme.colors.background : theme.colors.cardBackground,
74
+ borderTop: `1px solid ${theme.colors.border}`
75
+ }, children: [_jsx("div", { style: { padding: theme.spacing.medium, fontWeight: 'bold', color: theme.colors.text, borderRight: `1px solid ${theme.colors.border}` }, children: item.aspect }), _jsx("div", { style: { padding: theme.spacing.medium, color: theme.colors.textSecondary, borderRight: `1px solid ${theme.colors.border}` }, children: item.option1 }), _jsx("div", { style: { padding: theme.spacing.medium, color: theme.colors.textSecondary }, children: item.option2 })] }, i)))] })), viewMode === 'grid' && (_jsx("div", { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))', gap: theme.spacing.medium }, children: groupItems.map((item, i) => (_jsxs("div", { style: {
76
+ border: `1px solid ${theme.colors.border}`,
77
+ borderRadius: theme.borderRadius.medium,
78
+ backgroundColor: theme.colors.cardBackground,
79
+ overflow: 'hidden'
80
+ }, children: [_jsx("div", { style: { padding: theme.spacing.small, backgroundColor: theme.colors.primary, color: 'white', fontWeight: 'bold', textAlign: 'center' }, children: item.aspect }), _jsxs("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr' }, children: [_jsxs("div", { style: { padding: theme.spacing.medium, borderRight: `1px solid ${theme.colors.border}` }, children: [_jsx("div", { style: { fontSize: '11px', color: theme.colors.textSecondary, marginBottom: '4px' }, children: option1Name }), _jsx("div", { style: { color: theme.colors.text }, children: item.option1 })] }), _jsxs("div", { style: { padding: theme.spacing.medium }, children: [_jsx("div", { style: { fontSize: '11px', color: theme.colors.textSecondary, marginBottom: '4px' }, children: option2Name }), _jsx("div", { style: { color: theme.colors.text }, children: item.option2 })] })] })] }, i))) }))] }, groupTitle))) })), processedItems.length === 0 && (_jsxs("div", { style: { padding: theme.spacing.large, textAlign: 'center', color: theme.colors.textSecondary }, children: ["No aspects found matching \"", filterText, "\""] }))] })] }));
81
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface ConceptNode {
3
+ name: string;
4
+ children?: ConceptNode[];
5
+ }
6
+ export interface ConceptTreeBlockProps {
7
+ title: string;
8
+ root: ConceptNode;
9
+ }
10
+ export declare const ConceptTreeBlock: React.FC<ConceptTreeBlockProps>;
11
+ export {};