@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,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,5 @@
1
+ export interface LLMResponse {
2
+ type: 'pros_cons' | 'comparison' | 'flow' | 'concept_tree';
3
+ data: any;
4
+ }
5
+ export declare function queryLLM(userPrompt: string): Promise<LLMResponse>;
@@ -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,2 @@
1
+ import type { Theme } from '../theme/types';
2
+ export declare const useThemeWithFallback: () => Theme;
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function withDefaults<P extends object>(Component: React.ComponentType<P>, defaultProps: Partial<P>): (props: P) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function withDefaults(Component, defaultProps) {
3
+ return (props) => _jsx(Component, { ...defaultProps, ...props });
4
+ }
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@amritanshu3011/mdx-renderer",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Reusable MDX visualization library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
- "dist"
8
+ "dist"
9
9
  ],
10
10
  "scripts": {
11
- "build": "tsc"
11
+ "build": "tsc"
12
12
  },
13
13
  "author": "Amritanshu",
14
14
  "license": "MIT",
15
15
  "peerDependencies": {
16
- "react": ">=18.0.0",
17
- "react-dom": ">=18.0.0",
18
- "@mdx-js/react": ">=2.0.0",
19
- "recharts": ">=2.0.0"
16
+ "react": ">=18.0.0",
17
+ "react-dom": ">=18.0.0",
18
+ "@mdx-js/react": ">=2.0.0",
19
+ "recharts": ">=2.0.0"
20
20
  },
21
21
  "devDependencies": {
22
- "typescript": "^5.0.0",
23
- "@types/react": "^18.0.0"
22
+ "typescript": "^5.0.0",
23
+ "@types/react": "^18.0.0"
24
24
  }
25
- }
25
+ }