@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,30 @@
|
|
|
1
|
+
export interface Theme {
|
|
2
|
+
colors: {
|
|
3
|
+
primary: string;
|
|
4
|
+
secondary: string;
|
|
5
|
+
text: string;
|
|
6
|
+
textSecondary: string;
|
|
7
|
+
background: string;
|
|
8
|
+
cardBackground: string;
|
|
9
|
+
border: string;
|
|
10
|
+
chartLine: string;
|
|
11
|
+
chartBar: string;
|
|
12
|
+
};
|
|
13
|
+
spacing: {
|
|
14
|
+
small: string;
|
|
15
|
+
medium: string;
|
|
16
|
+
large: string;
|
|
17
|
+
xlarge: string;
|
|
18
|
+
};
|
|
19
|
+
typography: {
|
|
20
|
+
h1Size: string;
|
|
21
|
+
h2Size: string;
|
|
22
|
+
bodySize: string;
|
|
23
|
+
smallSize: string;
|
|
24
|
+
fontFamily: string;
|
|
25
|
+
};
|
|
26
|
+
borderRadius: {
|
|
27
|
+
small: string;
|
|
28
|
+
medium: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Mock LLM responses for different queries
|
|
2
|
+
const mockResponses = {
|
|
3
|
+
'websockets': {
|
|
4
|
+
type: 'pros_cons',
|
|
5
|
+
data: {
|
|
6
|
+
title: 'WebSockets',
|
|
7
|
+
pros: [
|
|
8
|
+
'Real-time bidirectional communication',
|
|
9
|
+
'Low latency for live updates',
|
|
10
|
+
'Reduced overhead compared to HTTP polling',
|
|
11
|
+
'Persistent connection reduces handshake overhead'
|
|
12
|
+
],
|
|
13
|
+
cons: [
|
|
14
|
+
'Harder to scale horizontally',
|
|
15
|
+
'Stateful connections consume server resources',
|
|
16
|
+
'Not supported by all proxies and firewalls',
|
|
17
|
+
'More complex error handling'
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
'rest vs graphql': {
|
|
22
|
+
type: 'comparison',
|
|
23
|
+
data: {
|
|
24
|
+
title: 'REST vs GraphQL',
|
|
25
|
+
option1Name: 'REST',
|
|
26
|
+
option2Name: 'GraphQL',
|
|
27
|
+
items: [
|
|
28
|
+
{ aspect: 'Data Fetching', option1: 'Multiple endpoints', option2: 'Single endpoint' },
|
|
29
|
+
{ aspect: 'Over-fetching', option1: 'Common issue', option2: 'Eliminated' },
|
|
30
|
+
{ aspect: 'Learning Curve', option1: 'Easier to learn', option2: 'Steeper learning curve' },
|
|
31
|
+
{ aspect: 'Caching', option1: 'HTTP caching built-in', option2: 'Requires custom solutions' }
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
'machine learning pipeline': {
|
|
36
|
+
type: 'flow',
|
|
37
|
+
data: {
|
|
38
|
+
title: 'ML Pipeline',
|
|
39
|
+
steps: [
|
|
40
|
+
{ title: 'Data Collection', description: 'Gather raw data from various sources' },
|
|
41
|
+
{ title: 'Preprocessing', description: 'Clean and transform data' },
|
|
42
|
+
{ title: 'Feature Engineering', description: 'Extract relevant features' },
|
|
43
|
+
{ title: 'Model Training', description: 'Train ML model on processed data' },
|
|
44
|
+
{ title: 'Evaluation', description: 'Test model performance' }
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
'react ecosystem': {
|
|
49
|
+
type: 'concept_tree',
|
|
50
|
+
data: {
|
|
51
|
+
title: 'React Ecosystem',
|
|
52
|
+
root: {
|
|
53
|
+
name: 'React',
|
|
54
|
+
children: [
|
|
55
|
+
{
|
|
56
|
+
name: 'State Management',
|
|
57
|
+
children: [
|
|
58
|
+
{ name: 'Redux' },
|
|
59
|
+
{ name: 'MobX' },
|
|
60
|
+
{ name: 'Zustand' }
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Routing',
|
|
65
|
+
children: [
|
|
66
|
+
{ name: 'React Router' },
|
|
67
|
+
{ name: 'Next.js' }
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Styling',
|
|
72
|
+
children: [
|
|
73
|
+
{ name: 'CSS Modules' },
|
|
74
|
+
{ name: 'Styled Components' },
|
|
75
|
+
{ name: 'Tailwind' }
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
export async function queryLLM(userPrompt) {
|
|
84
|
+
// Simulate API delay
|
|
85
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
86
|
+
// Simple keyword matching for mock
|
|
87
|
+
const prompt = userPrompt.toLowerCase();
|
|
88
|
+
if (prompt.includes('websocket')) {
|
|
89
|
+
return mockResponses['websockets'];
|
|
90
|
+
}
|
|
91
|
+
else if (prompt.includes('rest') || prompt.includes('graphql')) {
|
|
92
|
+
return mockResponses['rest vs graphql'];
|
|
93
|
+
}
|
|
94
|
+
else if (prompt.includes('machine learning') || prompt.includes('pipeline')) {
|
|
95
|
+
return mockResponses['machine learning pipeline'];
|
|
96
|
+
}
|
|
97
|
+
else if (prompt.includes('react') || prompt.includes('ecosystem')) {
|
|
98
|
+
return mockResponses['react ecosystem'];
|
|
99
|
+
}
|
|
100
|
+
// Default fallback
|
|
101
|
+
return {
|
|
102
|
+
type: 'pros_cons',
|
|
103
|
+
data: {
|
|
104
|
+
title: 'Default Response',
|
|
105
|
+
pros: ['Unable to parse query'],
|
|
106
|
+
cons: ['Try asking about: WebSockets, REST vs GraphQL, ML Pipeline, or React Ecosystem']
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { ThemeContext } from '../theme/ThemeContext';
|
|
3
|
+
import { defaultTheme } from '../theme/defaultTheme';
|
|
4
|
+
export const useThemeWithFallback = () => {
|
|
5
|
+
const context = useContext(ThemeContext);
|
|
6
|
+
return context?.theme || defaultTheme;
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
2
|
+
"name": "@amritanshu3011/mdx-renderer",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Reusable MDX visualization library",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc"
|
|
13
|
+
},
|
|
14
|
+
"author": "Amritanshu",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"react": ">=18.0.0",
|
|
18
|
+
"react-dom": ">=18.0.0",
|
|
19
|
+
"@mdx-js/react": ">=2.0.0"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"recharts": "^2.0.0",
|
|
23
|
+
"echarts": "^5.0.0",
|
|
24
|
+
"lucide-react": "^0.562.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.0.0",
|
|
28
|
+
"@types/react": "^18.0.0"
|
|
29
|
+
}
|
|
30
|
+
}
|