@principal-ade/industry-themed-mdx-editor 0.1.0
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/LICENSE +21 -0
- package/README.md +184 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +10738 -0
- package/dist/src/components/ThemedMDXEditor.d.ts +20 -0
- package/dist/src/components/ThemedMDXEditor.d.ts.map +1 -0
- package/dist/src/components/ThemedMDXEditorWithProvider.d.ts +5 -0
- package/dist/src/components/ThemedMDXEditorWithProvider.d.ts.map +1 -0
- package/dist/src/hooks/useThemedMDXEditor.d.ts +29 -0
- package/dist/src/hooks/useThemedMDXEditor.d.ts.map +1 -0
- package/dist/src/utils/codeMirrorTheme.d.ts +5 -0
- package/dist/src/utils/codeMirrorTheme.d.ts.map +1 -0
- package/dist/styles.css +120 -0
- package/package.json +106 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Theme } from '@a24z/industry-theme';
|
|
2
|
+
import { type MDXEditorMethods, type MDXEditorProps } from '@mdxeditor/editor';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface ThemedMDXEditorProps extends Omit<MDXEditorProps, 'className' | 'contentEditableClassName'> {
|
|
5
|
+
theme: Theme;
|
|
6
|
+
loadingComponent?: React.ReactNode;
|
|
7
|
+
initialValue?: string;
|
|
8
|
+
onSave?: (value: string, context: {
|
|
9
|
+
filePath?: string;
|
|
10
|
+
}) => void | Promise<void>;
|
|
11
|
+
filePath?: string;
|
|
12
|
+
enableSaveShortcut?: boolean;
|
|
13
|
+
onDirtyChange?: (isDirty: boolean) => void;
|
|
14
|
+
hideStatusBar?: boolean;
|
|
15
|
+
containerClassName?: string;
|
|
16
|
+
containerStyle?: React.CSSProperties;
|
|
17
|
+
showLoadingState?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const ThemedMDXEditor: React.ForwardRefExoticComponent<ThemedMDXEditorProps & React.RefAttributes<MDXEditorMethods>>;
|
|
20
|
+
//# sourceMappingURL=ThemedMDXEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemedMDXEditor.d.ts","sourceRoot":"","sources":["../../../src/components/ThemedMDXEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAQN,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,0BAA0B,CAAC;IAI1G,KAAK,EAAE,KAAK,CAAC;IAIb,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAInC,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAIjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAIlB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAK3C,aAAa,CAAC,EAAE,OAAO,CAAC;IAIxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAI5B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAIrC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAKD,eAAO,MAAM,eAAe,+FAwR1B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ThemedMDXEditorProps } from './ThemedMDXEditor';
|
|
3
|
+
export type ThemedMDXEditorWithProviderProps = Omit<ThemedMDXEditorProps, 'theme'>;
|
|
4
|
+
export declare const ThemedMDXEditorWithProvider: React.ForwardRefExoticComponent<ThemedMDXEditorWithProviderProps & React.RefAttributes<import("@mdxeditor/editor").MDXEditorMethods>>;
|
|
5
|
+
//# sourceMappingURL=ThemedMDXEditorWithProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemedMDXEditorWithProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ThemedMDXEditorWithProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE/E,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;AAMnF,eAAO,MAAM,2BAA2B,uIAMtC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
export declare function useThemedMDXEditor(): {
|
|
3
|
+
theme: {
|
|
4
|
+
colors: {
|
|
5
|
+
background: string;
|
|
6
|
+
text: string;
|
|
7
|
+
textSecondary: string;
|
|
8
|
+
backgroundSecondary: string;
|
|
9
|
+
backgroundTertiary: string;
|
|
10
|
+
border: string;
|
|
11
|
+
primary: string;
|
|
12
|
+
warning: string;
|
|
13
|
+
highlight: string;
|
|
14
|
+
};
|
|
15
|
+
fonts: {
|
|
16
|
+
body: string;
|
|
17
|
+
monospace: string;
|
|
18
|
+
};
|
|
19
|
+
fontSizes: {
|
|
20
|
+
small: number;
|
|
21
|
+
normal: number;
|
|
22
|
+
medium: number;
|
|
23
|
+
large: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
getCSSVariables: () => Record<string, string>;
|
|
27
|
+
getCodeMirrorExtensions: () => Extension[];
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useThemedMDXEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThemedMDXEditor.d.ts","sourceRoot":"","sources":["../../../src/hooks/useThemedMDXEditor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnD,wBAAgB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;2BA0CzB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;mCAGmB,SAAS,EAAE;EAS5D"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
import type { Theme } from '@a24z/industry-theme';
|
|
3
|
+
export declare function createCodeMirrorTheme(theme: Theme): Extension;
|
|
4
|
+
export declare function createAutoCodeMirrorTheme(theme: Theme): Extension;
|
|
5
|
+
//# sourceMappingURL=codeMirrorTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeMirrorTheme.d.ts","sourceRoot":"","sources":["../../../src/utils/codeMirrorTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMlD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAqD7D;AAsBD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAsDjE"}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Industry-themed MDX Editor styles
|
|
3
|
+
* These CSS custom properties integrate MDXEditor with the industry-theme system
|
|
4
|
+
* Based on Radix UI theming system used by MDXEditor
|
|
5
|
+
*
|
|
6
|
+
* Note: All Radix color variables are set directly by the component
|
|
7
|
+
* This file provides additional content styling and customizations
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/* MDXEditor content styling */
|
|
11
|
+
.themed-mdx-editor .mdx-editor-content {
|
|
12
|
+
font-family: var(--mdx-editor-font-family, 'monospace');
|
|
13
|
+
font-size: var(--mdx-editor-font-size, 14px);
|
|
14
|
+
color: var(--mdx-editor-fg, #1a1a1a);
|
|
15
|
+
line-height: 1.6;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Headings */
|
|
19
|
+
.themed-mdx-editor .mdx-editor-content h1,
|
|
20
|
+
.themed-mdx-editor .mdx-editor-content h2,
|
|
21
|
+
.themed-mdx-editor .mdx-editor-content h3,
|
|
22
|
+
.themed-mdx-editor .mdx-editor-content h4,
|
|
23
|
+
.themed-mdx-editor .mdx-editor-content h5,
|
|
24
|
+
.themed-mdx-editor .mdx-editor-content h6 {
|
|
25
|
+
color: var(--mdx-editor-heading-color, #1a1a1a);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Links */
|
|
29
|
+
.themed-mdx-editor .mdx-editor-content a {
|
|
30
|
+
color: var(--mdx-editor-link-color, #0066cc);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Inline code */
|
|
34
|
+
.themed-mdx-editor .mdx-editor-content code {
|
|
35
|
+
background-color: var(--mdx-editor-code-bg, #f5f5f5);
|
|
36
|
+
font-family: var(--mdx-editor-font-family, 'monospace');
|
|
37
|
+
padding: 2px 6px;
|
|
38
|
+
border-radius: 3px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Code blocks - target the CodeMirror editor wrapper */
|
|
42
|
+
.themed-mdx-editor .cm-editor {
|
|
43
|
+
background-color: var(--mdx-editor-code-bg, #f5f5f5) !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.themed-mdx-editor .cm-editor .cm-scroller {
|
|
47
|
+
font-family: var(--mdx-editor-font-family, 'monospace');
|
|
48
|
+
background-color: var(--mdx-editor-code-bg, #f5f5f5);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.themed-mdx-editor .cm-editor .cm-gutters {
|
|
52
|
+
background-color: var(--mdx-editor-code-bg, #f5f5f5);
|
|
53
|
+
border-right: 1px solid var(--mdx-editor-border, #e0e0e0);
|
|
54
|
+
color: var(--mdx-editor-fg, #1a1a1a);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.themed-mdx-editor .cm-editor .cm-content {
|
|
58
|
+
background-color: var(--mdx-editor-code-bg, #f5f5f5);
|
|
59
|
+
color: var(--mdx-editor-fg, #1a1a1a);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.themed-mdx-editor .cm-editor .cm-line {
|
|
63
|
+
background-color: var(--mdx-editor-code-bg, #f5f5f5);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.themed-mdx-editor .cm-editor .cm-activeLineGutter {
|
|
67
|
+
background-color: var(--baseBgHover, #f0f0f0);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.themed-mdx-editor .cm-editor .cm-activeLine {
|
|
71
|
+
background-color: var(--baseBgHover, #f0f0f0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Selection */
|
|
75
|
+
.themed-mdx-editor .mdx-editor-content ::selection {
|
|
76
|
+
background-color: var(--mdx-editor-selection-bg, rgba(0, 123, 255, 0.2));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Toolbar */
|
|
80
|
+
.themed-mdx-editor [class*='toolbar'] {
|
|
81
|
+
background-color: var(--mdx-editor-toolbar-bg, #f8f8f8);
|
|
82
|
+
border-bottom: 1px solid var(--mdx-editor-border, #e0e0e0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Toolbar buttons */
|
|
86
|
+
.themed-mdx-editor [class*='toolbar'] button {
|
|
87
|
+
color: var(--mdx-editor-fg, #1a1a1a);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.themed-mdx-editor [class*='toolbar'] button:hover {
|
|
91
|
+
background-color: var(--mdx-editor-selection-bg, rgba(0, 123, 255, 0.1));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Source mode editor */
|
|
95
|
+
.themed-mdx-editor [class*='sourceEditor'] {
|
|
96
|
+
font-family: var(--mdx-editor-font-family, 'monospace');
|
|
97
|
+
font-size: var(--mdx-editor-font-size, 14px);
|
|
98
|
+
background-color: var(--mdx-editor-bg, #ffffff);
|
|
99
|
+
color: var(--mdx-editor-fg, #1a1a1a);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Scrollbars */
|
|
103
|
+
.themed-mdx-editor ::-webkit-scrollbar {
|
|
104
|
+
width: 12px;
|
|
105
|
+
height: 12px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.themed-mdx-editor ::-webkit-scrollbar-track {
|
|
109
|
+
background: var(--mdx-editor-bg, #ffffff);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.themed-mdx-editor ::-webkit-scrollbar-thumb {
|
|
113
|
+
background: var(--mdx-editor-border, #e0e0e0);
|
|
114
|
+
border-radius: 6px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.themed-mdx-editor ::-webkit-scrollbar-thumb:hover {
|
|
118
|
+
background: var(--mdx-editor-fg, #1a1a1a);
|
|
119
|
+
opacity: 0.5;
|
|
120
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@principal-ade/industry-themed-mdx-editor",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Industry-themed MDX editor wrapper with integrated theming",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.mjs",
|
|
7
|
+
"module": "dist/index.mjs",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.mjs",
|
|
14
|
+
"default": "./dist/index.mjs"
|
|
15
|
+
},
|
|
16
|
+
"./styles.css": "./dist/styles.css",
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "bun run clean && bun run build:esm && bun run build:types && bun run build:styles",
|
|
21
|
+
"build:esm": "NODE_ENV=production bun build ./index.ts --outfile ./dist/index.mjs --format esm --target browser --external react --external react-dom --external @mdxeditor/editor --external @a24z/industry-theme",
|
|
22
|
+
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
|
|
23
|
+
"build:styles": "cp src/styles/mdx-editor-theme.css dist/styles.css",
|
|
24
|
+
"dev": "bun run build --watch",
|
|
25
|
+
"test": "bun test",
|
|
26
|
+
"test:watch": "bun test --watch",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
29
|
+
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
30
|
+
"format": "prettier --write .",
|
|
31
|
+
"format:check": "prettier --check .",
|
|
32
|
+
"clean": "rm -rf dist coverage",
|
|
33
|
+
"storybook": "storybook dev -p 6008",
|
|
34
|
+
"build-storybook": "storybook build"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"mdx",
|
|
38
|
+
"editor",
|
|
39
|
+
"markdown",
|
|
40
|
+
"mdxeditor",
|
|
41
|
+
"theme",
|
|
42
|
+
"industry"
|
|
43
|
+
],
|
|
44
|
+
"author": "Principal ADE Team",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@a24z/industry-theme": "^0.1.1"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@codemirror/state": ">=6.0.0",
|
|
51
|
+
"@codemirror/view": ">=6.0.0",
|
|
52
|
+
"@mdxeditor/editor": ">=3.0.0",
|
|
53
|
+
"react": ">=19.0.0",
|
|
54
|
+
"react-dom": ">=19.0.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"@codemirror/state": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"@codemirror/view": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"react": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"react-dom": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@eslint/js": "^9.32.0",
|
|
72
|
+
"@mdxeditor/editor": "^3.20.0",
|
|
73
|
+
"@storybook/addon-docs": "^9.1.13",
|
|
74
|
+
"@storybook/addon-onboarding": "^9.1.13",
|
|
75
|
+
"@storybook/addon-webpack5-compiler-swc": "^4.0.1",
|
|
76
|
+
"@storybook/react-webpack5": "^9.1.13",
|
|
77
|
+
"@types/bun": "latest",
|
|
78
|
+
"@types/node": "^22.15.26",
|
|
79
|
+
"@types/react": "^19.1.12",
|
|
80
|
+
"@types/react-dom": "^19.1.8",
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
82
|
+
"@typescript-eslint/parser": "^8.38.0",
|
|
83
|
+
"esbuild": "^0.25.8",
|
|
84
|
+
"eslint": "^9.32.0",
|
|
85
|
+
"eslint-config-prettier": "^10.1.8",
|
|
86
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
87
|
+
"eslint-plugin-import": "^2.32.0",
|
|
88
|
+
"eslint-plugin-storybook": "^9.1.13",
|
|
89
|
+
"prettier": "^3.6.2",
|
|
90
|
+
"react": "^19.1.1",
|
|
91
|
+
"react-dom": "^19.1.1",
|
|
92
|
+
"storybook": "^9.1.13",
|
|
93
|
+
"typescript": "^5.0.4",
|
|
94
|
+
"typescript-eslint": "^8.38.0"
|
|
95
|
+
},
|
|
96
|
+
"files": [
|
|
97
|
+
"dist",
|
|
98
|
+
"README.md",
|
|
99
|
+
"LICENSE"
|
|
100
|
+
],
|
|
101
|
+
"repository": {
|
|
102
|
+
"type": "git",
|
|
103
|
+
"url": "git+https://github.com/principal-ade/industry-themed-mdx-editor.git"
|
|
104
|
+
},
|
|
105
|
+
"homepage": "https://principal-ade.com"
|
|
106
|
+
}
|