@gild-ui/react-markdown 0.0.0 → 0.1.0-alpha.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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +179 -2
  3. package/dist/CodeBlock-BFqv_nVv.mjs +134 -0
  4. package/dist/CodeBlock-BaMe7CiF.cjs +151 -0
  5. package/dist/CodeBlock.cjs +5 -0
  6. package/dist/CodeBlock.d.cts +15 -0
  7. package/dist/CodeBlock.d.mts +3 -0
  8. package/dist/CodeBlock.mjs +1 -0
  9. package/dist/Control.cjs +60 -0
  10. package/dist/Control.d.cts +16 -0
  11. package/dist/Control.d.mts +16 -0
  12. package/dist/Control.mjs +59 -0
  13. package/dist/Editor.cjs +131 -0
  14. package/dist/Editor.d.cts +48 -0
  15. package/dist/Editor.d.mts +48 -0
  16. package/dist/Editor.mjs +130 -0
  17. package/dist/LiveEdit-CXw-vQpD.cjs +224 -0
  18. package/dist/LiveEdit-CzJcNsEo.mjs +215 -0
  19. package/dist/LiveEdit.cjs +3 -0
  20. package/dist/LiveEdit.d.cts +29 -0
  21. package/dist/LiveEdit.d.mts +29 -0
  22. package/dist/LiveEdit.mjs +1 -0
  23. package/dist/MarkdownContext-D28Czdll.mjs +10 -0
  24. package/dist/MarkdownContext-DS1X9B6N.cjs +21 -0
  25. package/dist/Mermaid-DR4XzGaY.mjs +248 -0
  26. package/dist/Mermaid-d1a5LqcK.cjs +253 -0
  27. package/dist/Mermaid.cjs +3 -0
  28. package/dist/Mermaid.d.cts +2 -0
  29. package/dist/Mermaid.d.mts +2 -0
  30. package/dist/Mermaid.mjs +1 -0
  31. package/dist/Preview-CIbu-nRm.cjs +268 -0
  32. package/dist/Preview-DQOQ1NKJ.mjs +258 -0
  33. package/dist/Preview.cjs +3 -0
  34. package/dist/Preview.d.cts +56 -0
  35. package/dist/Preview.d.mts +2 -0
  36. package/dist/Preview.mjs +1 -0
  37. package/dist/Toolbar-Eg7KmYbK.mjs +603 -0
  38. package/dist/Toolbar-gk3KJhCE.cjs +614 -0
  39. package/dist/Toolbar.cjs +4 -0
  40. package/dist/Toolbar.d.cts +18 -0
  41. package/dist/Toolbar.d.mts +18 -0
  42. package/dist/Toolbar.mjs +1 -0
  43. package/dist/applyAction-B3AwrWKV.cjs +121 -0
  44. package/dist/applyAction-CkTQJ5Iy.mjs +116 -0
  45. package/dist/index-BBkHCbE7.d.mts +15 -0
  46. package/dist/index-BVYb370O.d.cts +24 -0
  47. package/dist/index-CfPKWPpM.d.mts +57 -0
  48. package/dist/index-CyddYU7P.d.mts +24 -0
  49. package/dist/index.cjs +21 -0
  50. package/dist/index.d.cts +80 -0
  51. package/dist/index.d.mts +80 -0
  52. package/dist/index.mjs +9 -0
  53. package/dist/mergeOverrides-D2btS1Jb.cjs +19 -0
  54. package/dist/mergeOverrides-DEbU7yDg.mjs +14 -0
  55. package/dist/rolldown-runtime-CmQyd0Gu.cjs +27 -0
  56. package/dist/themeTypes-C4kTtkIA.d.cts +83 -0
  57. package/dist/themeTypes-C4kTtkIA.d.mts +83 -0
  58. package/package.json +166 -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,11 +1,174 @@
1
1
  {
2
2
  "name": "@gild-ui/react-markdown",
3
- "version": "0.0.0",
4
- "description": "Temporary package placeholder for staged publishing",
3
+ "version": "0.1.0-alpha.1",
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>",
5
16
  "license": "MIT",
17
+ "homepage": "https://gild-ui.soroush.design/react/markdown/",
6
18
  "repository": {
7
19
  "type": "git",
8
20
  "url": "git+https://github.com/soroush-tech/gild-ui.git",
9
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.4.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.1",
128
+ "@gild-ui/hooks": "^0.1.0-alpha.1"
129
+ },
130
+ "peerDependencies": {
131
+ "react": "^19.2.8",
132
+ "react-dom": "^19.2.8",
133
+ "@gild-ui/react": "^0.1.0-alpha.1"
134
+ },
135
+ "devDependencies": {
136
+ "@storybook/react-vite": "^10.6.10",
137
+ "@testing-library/jest-dom": "^8.0.0",
138
+ "@testing-library/react": "^16.3.3",
139
+ "@types/hast": "^3.0.4",
140
+ "@types/node": "^26.6.11",
141
+ "@types/react": "^19.3.3",
142
+ "@types/react-dom": "^19.3.0",
143
+ "@vitest/coverage-v8": "^5.1.2",
144
+ "jsdom": "^31.0.1",
145
+ "oxlint": "^1.96.0",
146
+ "react": "^19.3.1",
147
+ "react-dom": "^19.3.1",
148
+ "remark-parse": "^11.0.0",
149
+ "remark-rehype": "^11.1.2",
150
+ "storybook": "^10.6.10",
151
+ "tsdown": "^0.23.7",
152
+ "typescript": "~7.0.2",
153
+ "vitest": "^5.1.2",
154
+ "@gild-ui/react": "0.1.0-alpha.1",
155
+ "@soroush.tech/eslint-config": "0.0.0"
156
+ },
157
+ "scripts": {
158
+ "build": "tsdown",
159
+ "lint": "oxlint --deny-warnings",
160
+ "typecheck": "tsc --noEmit",
161
+ "test": "vitest run",
162
+ "test:coverage": "vitest run --coverage",
163
+ "test:types": "pnpm build && tsc -p type-tests/tsconfig.json"
164
+ },
165
+ "main": "./dist/index.cjs",
166
+ "module": "./dist/index.mjs",
167
+ "typesVersions": {
168
+ "*": {
169
+ "*": [
170
+ "./dist/*.d.cts"
171
+ ]
172
+ }
10
173
  }
11
- }
174
+ }