@gild-ui/react-markdown 0.0.0-stage → 0.1.0-alpha.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 +179 -2
- package/dist/CodeBlock.cjs +136 -0
- package/dist/CodeBlock.d.cts +15 -0
- package/dist/CodeBlock.d.mts +3 -0
- package/dist/CodeBlock.mjs +133 -0
- package/dist/Control.cjs +60 -0
- package/dist/Control.d.cts +16 -0
- package/dist/Control.d.mts +16 -0
- package/dist/Control.mjs +59 -0
- package/dist/Editor.cjs +131 -0
- package/dist/Editor.d.cts +48 -0
- package/dist/Editor.d.mts +48 -0
- package/dist/Editor.mjs +130 -0
- package/dist/LiveEdit-1-8cA5Xw.mjs +215 -0
- package/dist/LiveEdit-B83sDZXu.cjs +224 -0
- package/dist/LiveEdit.cjs +3 -0
- package/dist/LiveEdit.d.cts +29 -0
- package/dist/LiveEdit.d.mts +29 -0
- package/dist/LiveEdit.mjs +1 -0
- package/dist/MarkdownContext-D28Czdll.mjs +10 -0
- package/dist/MarkdownContext-DS1X9B6N.cjs +21 -0
- package/dist/Mermaid-DW0NuDS-.mjs +248 -0
- package/dist/Mermaid-D_tCNrQ9.cjs +253 -0
- package/dist/Mermaid.cjs +3 -0
- package/dist/Mermaid.d.cts +2 -0
- package/dist/Mermaid.d.mts +2 -0
- package/dist/Mermaid.mjs +1 -0
- package/dist/Preview-BLXtPaa9.mjs +258 -0
- package/dist/Preview-D-AL97QU.cjs +268 -0
- package/dist/Preview.cjs +3 -0
- package/dist/Preview.d.cts +56 -0
- package/dist/Preview.d.mts +2 -0
- package/dist/Preview.mjs +1 -0
- package/dist/Toolbar-Eg7KmYbK.mjs +603 -0
- package/dist/Toolbar-gk3KJhCE.cjs +614 -0
- package/dist/Toolbar.cjs +4 -0
- package/dist/Toolbar.d.cts +18 -0
- package/dist/Toolbar.d.mts +18 -0
- package/dist/Toolbar.mjs +1 -0
- package/dist/applyAction-B3AwrWKV.cjs +121 -0
- package/dist/applyAction-CkTQJ5Iy.mjs +116 -0
- package/dist/index-BBkHCbE7.d.mts +15 -0
- package/dist/index-BVYb370O.d.cts +24 -0
- package/dist/index-CfPKWPpM.d.mts +57 -0
- package/dist/index-CyddYU7P.d.mts +24 -0
- package/dist/index.cjs +21 -0
- package/dist/index.d.cts +80 -0
- package/dist/index.d.mts +80 -0
- package/dist/index.mjs +9 -0
- package/dist/mergeOverrides-D2btS1Jb.cjs +19 -0
- package/dist/mergeOverrides-DEbU7yDg.mjs +14 -0
- package/dist/rolldown-runtime-CmQyd0Gu.cjs +27 -0
- package/dist/themeTypes-C4kTtkIA.d.cts +83 -0
- package/dist/themeTypes-C4kTtkIA.d.mts +83 -0
- package/package.json +168 -3
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syntax-highlighting tokens for `CodeBlock` - mapped onto highlight.js token classes.
|
|
3
|
+
* Not part of design-system's own scales; `../themeTypes.ts` augments
|
|
4
|
+
* `@gild-ui/core/theme` so `theme.syntax` is available wherever this
|
|
5
|
+
* package is imported. Merge one of the presets below into your theme via
|
|
6
|
+
* `createTheme(baseTheme, { syntax: syntaxDark })`, or supply your own.
|
|
7
|
+
*/
|
|
8
|
+
interface ThemeSyntax {
|
|
9
|
+
/** Default code text - plain identifiers, operators, punctuation. */
|
|
10
|
+
base: string;
|
|
11
|
+
/** Keywords, built-ins, types, literals, selector tags. */
|
|
12
|
+
keyword: string;
|
|
13
|
+
/** Strings, template literals, regular expressions. */
|
|
14
|
+
string: string;
|
|
15
|
+
/** Numbers, symbols, links. */
|
|
16
|
+
number: string;
|
|
17
|
+
/** Function / class titles, section headings, attributes. */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Fields, constants, and property keys. */
|
|
20
|
+
constant: string;
|
|
21
|
+
/** Type and class names. */
|
|
22
|
+
type: string;
|
|
23
|
+
/** Comments and quotes - rendered dimmed and italic. */
|
|
24
|
+
comment: string;
|
|
25
|
+
/** Markup tags/names, meta, variables, deletions. */
|
|
26
|
+
tag: string;
|
|
27
|
+
/** Font family for the code surface - independent of `theme.fonts.mono`. */
|
|
28
|
+
font: string;
|
|
29
|
+
}
|
|
30
|
+
/** Matched to the JetBrains "Islands Dark" editor scheme. */
|
|
31
|
+
declare const syntaxDark: ThemeSyntax;
|
|
32
|
+
/** Matched to the JetBrains "Islands Light" editor scheme. */
|
|
33
|
+
declare const syntaxLight: ThemeSyntax;
|
|
34
|
+
/**
|
|
35
|
+
* Per-theme overrides for the `Mermaid` renderer, merged over (and winning against) its default
|
|
36
|
+
* mermaid `themeVariables`. Common variables are listed for autocomplete; any other mermaid theme
|
|
37
|
+
* variable is accepted. Set via `theme.mermaid` (e.g. `createTheme(baseTheme, { mermaid: ... })`).
|
|
38
|
+
*/
|
|
39
|
+
interface MermaidThemeVariables {
|
|
40
|
+
darkMode?: boolean;
|
|
41
|
+
background?: string;
|
|
42
|
+
fontFamily?: string;
|
|
43
|
+
fontSize?: string;
|
|
44
|
+
primaryColor?: string;
|
|
45
|
+
primaryTextColor?: string;
|
|
46
|
+
primaryBorderColor?: string;
|
|
47
|
+
secondaryColor?: string;
|
|
48
|
+
tertiaryColor?: string;
|
|
49
|
+
lineColor?: string;
|
|
50
|
+
textColor?: string;
|
|
51
|
+
mainBkg?: string;
|
|
52
|
+
noteBkgColor?: string;
|
|
53
|
+
noteTextColor?: string;
|
|
54
|
+
[variable: string]: string | number | boolean | undefined;
|
|
55
|
+
}
|
|
56
|
+
/** The slots of `MarkdownLiveEdit` a theme can style, and `slotProps` can override. */
|
|
57
|
+
type MarkdownLiveEditSlot = 'root' | 'block';
|
|
58
|
+
/** The slots of `MarkdownToolbar` a theme can style, and `slotProps` can override. */
|
|
59
|
+
type MarkdownToolbarSlot = 'root' | 'strike' | 'tablePickerCell';
|
|
60
|
+
/** The slots of `CodeBlock` a theme can style, and `slotProps` can override. */
|
|
61
|
+
type CodeBlockSlot = 'root' | 'surface';
|
|
62
|
+
declare module '@gild-ui/react' {
|
|
63
|
+
interface ThemeComponents {
|
|
64
|
+
MarkdownEditor?: import('@gild-ui/react').ComponentConfig;
|
|
65
|
+
MarkdownLiveEdit?: import('@gild-ui/react').ComponentConfig<Record<string, unknown>, MarkdownLiveEditSlot>;
|
|
66
|
+
MarkdownPreview?: import('@gild-ui/react').ComponentConfig;
|
|
67
|
+
MarkdownToolbar?: import('@gild-ui/react').ComponentConfig<Record<string, unknown>, MarkdownToolbarSlot>;
|
|
68
|
+
CodeBlock?: import('@gild-ui/react').ComponentConfig<Record<string, unknown>, CodeBlockSlot>;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
declare module '@gild-ui/core/theme' {
|
|
72
|
+
interface Theme {
|
|
73
|
+
/** Per-theme overrides for the `Mermaid` renderer's mermaid `themeVariables`. */
|
|
74
|
+
mermaid?: MermaidThemeVariables;
|
|
75
|
+
/**
|
|
76
|
+
* Syntax-highlighting tokens for `CodeBlock` - see `syntaxDark`/`syntaxLight`. Optional
|
|
77
|
+
* only so `design-system`'s own `baseTheme` literal still satisfies `Theme` in this
|
|
78
|
+
* monorepo's source-consuming builds; `CodeBlock` requires it in practice (no fallback).
|
|
79
|
+
*/
|
|
80
|
+
syntax?: ThemeSyntax;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export { ThemeSyntax as a, MermaidThemeVariables as i, MarkdownLiveEditSlot as n, syntaxDark as o, MarkdownToolbarSlot as r, syntaxLight as s, CodeBlockSlot as t };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syntax-highlighting tokens for `CodeBlock` - mapped onto highlight.js token classes.
|
|
3
|
+
* Not part of design-system's own scales; `../themeTypes.ts` augments
|
|
4
|
+
* `@gild-ui/core/theme` so `theme.syntax` is available wherever this
|
|
5
|
+
* package is imported. Merge one of the presets below into your theme via
|
|
6
|
+
* `createTheme(baseTheme, { syntax: syntaxDark })`, or supply your own.
|
|
7
|
+
*/
|
|
8
|
+
interface ThemeSyntax {
|
|
9
|
+
/** Default code text - plain identifiers, operators, punctuation. */
|
|
10
|
+
base: string;
|
|
11
|
+
/** Keywords, built-ins, types, literals, selector tags. */
|
|
12
|
+
keyword: string;
|
|
13
|
+
/** Strings, template literals, regular expressions. */
|
|
14
|
+
string: string;
|
|
15
|
+
/** Numbers, symbols, links. */
|
|
16
|
+
number: string;
|
|
17
|
+
/** Function / class titles, section headings, attributes. */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Fields, constants, and property keys. */
|
|
20
|
+
constant: string;
|
|
21
|
+
/** Type and class names. */
|
|
22
|
+
type: string;
|
|
23
|
+
/** Comments and quotes - rendered dimmed and italic. */
|
|
24
|
+
comment: string;
|
|
25
|
+
/** Markup tags/names, meta, variables, deletions. */
|
|
26
|
+
tag: string;
|
|
27
|
+
/** Font family for the code surface - independent of `theme.fonts.mono`. */
|
|
28
|
+
font: string;
|
|
29
|
+
}
|
|
30
|
+
/** Matched to the JetBrains "Islands Dark" editor scheme. */
|
|
31
|
+
declare const syntaxDark: ThemeSyntax;
|
|
32
|
+
/** Matched to the JetBrains "Islands Light" editor scheme. */
|
|
33
|
+
declare const syntaxLight: ThemeSyntax;
|
|
34
|
+
/**
|
|
35
|
+
* Per-theme overrides for the `Mermaid` renderer, merged over (and winning against) its default
|
|
36
|
+
* mermaid `themeVariables`. Common variables are listed for autocomplete; any other mermaid theme
|
|
37
|
+
* variable is accepted. Set via `theme.mermaid` (e.g. `createTheme(baseTheme, { mermaid: ... })`).
|
|
38
|
+
*/
|
|
39
|
+
interface MermaidThemeVariables {
|
|
40
|
+
darkMode?: boolean;
|
|
41
|
+
background?: string;
|
|
42
|
+
fontFamily?: string;
|
|
43
|
+
fontSize?: string;
|
|
44
|
+
primaryColor?: string;
|
|
45
|
+
primaryTextColor?: string;
|
|
46
|
+
primaryBorderColor?: string;
|
|
47
|
+
secondaryColor?: string;
|
|
48
|
+
tertiaryColor?: string;
|
|
49
|
+
lineColor?: string;
|
|
50
|
+
textColor?: string;
|
|
51
|
+
mainBkg?: string;
|
|
52
|
+
noteBkgColor?: string;
|
|
53
|
+
noteTextColor?: string;
|
|
54
|
+
[variable: string]: string | number | boolean | undefined;
|
|
55
|
+
}
|
|
56
|
+
/** The slots of `MarkdownLiveEdit` a theme can style, and `slotProps` can override. */
|
|
57
|
+
type MarkdownLiveEditSlot = 'root' | 'block';
|
|
58
|
+
/** The slots of `MarkdownToolbar` a theme can style, and `slotProps` can override. */
|
|
59
|
+
type MarkdownToolbarSlot = 'root' | 'strike' | 'tablePickerCell';
|
|
60
|
+
/** The slots of `CodeBlock` a theme can style, and `slotProps` can override. */
|
|
61
|
+
type CodeBlockSlot = 'root' | 'surface';
|
|
62
|
+
declare module '@gild-ui/react' {
|
|
63
|
+
interface ThemeComponents {
|
|
64
|
+
MarkdownEditor?: import('@gild-ui/react').ComponentConfig;
|
|
65
|
+
MarkdownLiveEdit?: import('@gild-ui/react').ComponentConfig<Record<string, unknown>, MarkdownLiveEditSlot>;
|
|
66
|
+
MarkdownPreview?: import('@gild-ui/react').ComponentConfig;
|
|
67
|
+
MarkdownToolbar?: import('@gild-ui/react').ComponentConfig<Record<string, unknown>, MarkdownToolbarSlot>;
|
|
68
|
+
CodeBlock?: import('@gild-ui/react').ComponentConfig<Record<string, unknown>, CodeBlockSlot>;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
declare module '@gild-ui/core/theme' {
|
|
72
|
+
interface Theme {
|
|
73
|
+
/** Per-theme overrides for the `Mermaid` renderer's mermaid `themeVariables`. */
|
|
74
|
+
mermaid?: MermaidThemeVariables;
|
|
75
|
+
/**
|
|
76
|
+
* Syntax-highlighting tokens for `CodeBlock` - see `syntaxDark`/`syntaxLight`. Optional
|
|
77
|
+
* only so `design-system`'s own `baseTheme` literal still satisfies `Theme` in this
|
|
78
|
+
* monorepo's source-consuming builds; `CodeBlock` requires it in practice (no fallback).
|
|
79
|
+
*/
|
|
80
|
+
syntax?: ThemeSyntax;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export { ThemeSyntax as a, MermaidThemeVariables as i, MarkdownLiveEditSlot as n, syntaxDark as o, MarkdownToolbarSlot as r, syntaxLight as s, CodeBlockSlot as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,171 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gild-ui/react-markdown",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "A markdown editor and renderer for @gild-ui/react - Control, Toolbar, Editor, Preview, LiveEdit, CodeBlock and a themed, zoomable diagram viewer.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"markdown",
|
|
7
|
+
"editor",
|
|
8
|
+
"renderer",
|
|
9
|
+
"react",
|
|
10
|
+
"design-system",
|
|
11
|
+
"remark",
|
|
12
|
+
"rehype",
|
|
13
|
+
"typescript"
|
|
14
|
+
],
|
|
15
|
+
"author": "Masoud Soroush <masoud@soroush.tech>",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://gild-ui.soroush.design/react/markdown/",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/soroush-tech/gild-ui.git",
|
|
21
|
+
"directory": "packages/react-markdown"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/soroush-tech/gild-ui/issues"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": {
|
|
34
|
+
"types": "./dist/index.d.mts",
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"require": {
|
|
38
|
+
"types": "./dist/index.d.cts",
|
|
39
|
+
"default": "./dist/index.cjs"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"./CodeBlock": {
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/CodeBlock.d.mts",
|
|
45
|
+
"default": "./dist/CodeBlock.mjs"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/CodeBlock.d.cts",
|
|
49
|
+
"default": "./dist/CodeBlock.cjs"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"./Control": {
|
|
53
|
+
"import": {
|
|
54
|
+
"types": "./dist/Control.d.mts",
|
|
55
|
+
"default": "./dist/Control.mjs"
|
|
56
|
+
},
|
|
57
|
+
"require": {
|
|
58
|
+
"types": "./dist/Control.d.cts",
|
|
59
|
+
"default": "./dist/Control.cjs"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"./Editor": {
|
|
63
|
+
"import": {
|
|
64
|
+
"types": "./dist/Editor.d.mts",
|
|
65
|
+
"default": "./dist/Editor.mjs"
|
|
66
|
+
},
|
|
67
|
+
"require": {
|
|
68
|
+
"types": "./dist/Editor.d.cts",
|
|
69
|
+
"default": "./dist/Editor.cjs"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"./LiveEdit": {
|
|
73
|
+
"import": {
|
|
74
|
+
"types": "./dist/LiveEdit.d.mts",
|
|
75
|
+
"default": "./dist/LiveEdit.mjs"
|
|
76
|
+
},
|
|
77
|
+
"require": {
|
|
78
|
+
"types": "./dist/LiveEdit.d.cts",
|
|
79
|
+
"default": "./dist/LiveEdit.cjs"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"./Mermaid": {
|
|
83
|
+
"import": {
|
|
84
|
+
"types": "./dist/Mermaid.d.mts",
|
|
85
|
+
"default": "./dist/Mermaid.mjs"
|
|
86
|
+
},
|
|
87
|
+
"require": {
|
|
88
|
+
"types": "./dist/Mermaid.d.cts",
|
|
89
|
+
"default": "./dist/Mermaid.cjs"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"./Preview": {
|
|
93
|
+
"import": {
|
|
94
|
+
"types": "./dist/Preview.d.mts",
|
|
95
|
+
"default": "./dist/Preview.mjs"
|
|
96
|
+
},
|
|
97
|
+
"require": {
|
|
98
|
+
"types": "./dist/Preview.d.cts",
|
|
99
|
+
"default": "./dist/Preview.cjs"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"./Toolbar": {
|
|
103
|
+
"import": {
|
|
104
|
+
"types": "./dist/Toolbar.d.mts",
|
|
105
|
+
"default": "./dist/Toolbar.mjs"
|
|
106
|
+
},
|
|
107
|
+
"require": {
|
|
108
|
+
"types": "./dist/Toolbar.d.cts",
|
|
109
|
+
"default": "./dist/Toolbar.cjs"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"types": "./dist/index.d.mts",
|
|
114
|
+
"publishConfig": {
|
|
115
|
+
"access": "public"
|
|
116
|
+
},
|
|
117
|
+
"dependencies": {
|
|
118
|
+
"mermaid": "^12.3.0",
|
|
119
|
+
"react-markdown": "^10.1.0",
|
|
120
|
+
"rehype-highlight": "^7.0.2",
|
|
121
|
+
"rehype-parse": "^9.0.1",
|
|
122
|
+
"rehype-remark": "^10.0.1",
|
|
123
|
+
"rehype-slug": "^6.0.0",
|
|
124
|
+
"remark-gfm": "^4.0.1",
|
|
125
|
+
"remark-stringify": "^11.0.0",
|
|
126
|
+
"unified": "^11.0.5",
|
|
127
|
+
"@gild-ui/core": "^0.1.0-alpha.0",
|
|
128
|
+
"@gild-ui/hooks": "^0.1.0-alpha.0"
|
|
129
|
+
},
|
|
130
|
+
"peerDependencies": {
|
|
131
|
+
"react": "^19.2.8",
|
|
132
|
+
"react-dom": "^19.2.8",
|
|
133
|
+
"@gild-ui/react": "^0.1.0-alpha.0"
|
|
134
|
+
},
|
|
135
|
+
"devDependencies": {
|
|
136
|
+
"@storybook/react-vite": "^10.6.7",
|
|
137
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
138
|
+
"@testing-library/react": "^16.3.3",
|
|
139
|
+
"@types/node": "^26.6.6",
|
|
140
|
+
"@types/react": "^19.3.0",
|
|
141
|
+
"@types/react-dom": "^19.3.0",
|
|
142
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
143
|
+
"jsdom": "^31.0.0",
|
|
144
|
+
"oxlint": "^1.93.0",
|
|
145
|
+
"react": "^19.3.1",
|
|
146
|
+
"react-dom": "^19.3.1",
|
|
147
|
+
"storybook": "^10.6.7",
|
|
148
|
+
"tsdown": "^0.23.7",
|
|
149
|
+
"typescript": "~7.0.2",
|
|
150
|
+
"vitest": "^5.1.0",
|
|
151
|
+
"@gild-ui/react": "0.1.0-alpha.0",
|
|
152
|
+
"@soroush.tech/eslint-config": "0.0.0"
|
|
153
|
+
},
|
|
154
|
+
"scripts": {
|
|
155
|
+
"build": "tsdown",
|
|
156
|
+
"lint": "oxlint --deny-warnings",
|
|
157
|
+
"typecheck": "tsc --noEmit",
|
|
158
|
+
"test": "vitest run",
|
|
159
|
+
"test:coverage": "vitest run --coverage",
|
|
160
|
+
"test:types": "pnpm build && tsc -p type-tests/tsconfig.json"
|
|
161
|
+
},
|
|
162
|
+
"main": "./dist/index.cjs",
|
|
163
|
+
"module": "./dist/index.mjs",
|
|
164
|
+
"typesVersions": {
|
|
165
|
+
"*": {
|
|
166
|
+
"*": [
|
|
167
|
+
"./dist/*.d.cts"
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
}
|
|
6
171
|
}
|