@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,253 @@
1
+ const require_CodeBlock = require("./CodeBlock-BaMe7CiF.cjs");
2
+ let react = require("react");
3
+ let react_jsx_runtime = require("react/jsx-runtime");
4
+ let _gild_ui_react_Button = require("@gild-ui/react/Button");
5
+ let _gild_ui_react_Flex = require("@gild-ui/react/Flex");
6
+ let _gild_ui_react_Icon = require("@gild-ui/react/Icon");
7
+ let _gild_ui_react = require("@gild-ui/react");
8
+ let _gild_ui_react_View = require("@gild-ui/react/View");
9
+ let _gild_ui_react_Grid = require("@gild-ui/react/Grid");
10
+ let _gild_ui_react_Modal = require("@gild-ui/react/Modal");
11
+ // src/Mermaid/DiagramViewer.tsx
12
+ const MIN_SCALE = .2;
13
+ const MAX_SCALE = 5;
14
+ const ZOOM_STEP = .2;
15
+ const PAN_STEP = 48;
16
+ const MIN_HEIGHT = 180;
17
+ const MAX_HEIGHT = 640;
18
+ const Viewport = (0, _gild_ui_react.styled)(_gild_ui_react_Flex.Flex)(({ isDragging }) => ({
19
+ cursor: isDragging ? "grabbing" : "grab",
20
+ userSelect: "none",
21
+ WebkitUserSelect: "none"
22
+ }));
23
+ const Layer = (0, _gild_ui_react.styled)(_gild_ui_react_View.View)(({ isDragging, panX, panY, zoomLevel }) => ({
24
+ transform: `translate(${panX}, ${panY}) scale(${zoomLevel})`,
25
+ transformOrigin: "center",
26
+ transition: isDragging ? "none" : "transform 0.12s ease-out"
27
+ }));
28
+ const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
29
+ /**
30
+ * Wraps a rendered mermaid diagram in a zoom/pan viewport with a themed control cluster
31
+ * (bottom-right: a pan d-pad around a reset, plus zoom in/out) and an expand control
32
+ * (top-right) that opens the diagram in a fullscreen dialog. Drag-to-pan and wheel-to-zoom
33
+ * work too. Only the diagram layer clips; the controls sit above it, so a short diagram never
34
+ * hides them. Everything is a CSS transform - no dependency.
35
+ */
36
+ function DiagramViewer({ svg, expandable = true, fill = false }) {
37
+ const [scale, setScale] = (0, react.useState)(1);
38
+ const [offset, setOffset] = (0, react.useState)({
39
+ x: 0,
40
+ y: 0
41
+ });
42
+ const [dragging, setDragging] = (0, react.useState)(false);
43
+ const [fullscreen, setFullscreen] = (0, react.useState)(false);
44
+ const [naturalHeight, setNaturalHeight] = (0, react.useState)(0);
45
+ const dragOrigin = (0, react.useRef)(null);
46
+ const contentRef = (0, react.useRef)(null);
47
+ (0, react.useEffect)(() => {
48
+ setNaturalHeight(contentRef.current.offsetHeight);
49
+ }, [svg]);
50
+ const [x, setX] = (0, _gild_ui_react.useStyleValue)(0, "px");
51
+ const [y, setY] = (0, _gild_ui_react.useStyleValue)(0, "px");
52
+ const [zoom, setZoom] = (0, _gild_ui_react.useStyleValue)(1);
53
+ (0, react.useLayoutEffect)(() => {
54
+ setX(offset.x);
55
+ setY(offset.y);
56
+ setZoom(scale);
57
+ }, [
58
+ offset,
59
+ scale,
60
+ setX,
61
+ setY,
62
+ setZoom
63
+ ]);
64
+ const zoomBy = (delta) => setScale((current) => clamp(current + delta, MIN_SCALE, MAX_SCALE));
65
+ const panBy = (dx, dy) => setOffset((current) => ({
66
+ x: current.x + dx,
67
+ y: current.y + dy
68
+ }));
69
+ const reset = () => {
70
+ setScale(1);
71
+ setOffset({
72
+ x: 0,
73
+ y: 0
74
+ });
75
+ };
76
+ const closeFullscreen = () => setFullscreen(false);
77
+ const onWheel = (event) => {
78
+ event.preventDefault();
79
+ zoomBy(event.deltaY < 0 ? ZOOM_STEP : -.2);
80
+ };
81
+ const onMouseDown = (event) => {
82
+ dragOrigin.current = {
83
+ x: event.clientX - offset.x,
84
+ y: event.clientY - offset.y
85
+ };
86
+ setDragging(true);
87
+ };
88
+ const onMouseMove = (event) => {
89
+ if (!dragOrigin.current) return;
90
+ setOffset({
91
+ x: event.clientX - dragOrigin.current.x,
92
+ y: event.clientY - dragOrigin.current.y
93
+ });
94
+ };
95
+ const endDrag = () => {
96
+ dragOrigin.current = null;
97
+ setDragging(false);
98
+ };
99
+ const control = (label, icon, onClick) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Button.Button, {
100
+ type: "button",
101
+ variant: "outlined",
102
+ shape: "rounded",
103
+ size: "sm",
104
+ "aria-label": label,
105
+ onClick,
106
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Icon.Icon, {
107
+ name: icon,
108
+ size: "1.1rem"
109
+ })
110
+ }, label);
111
+ const inlineHeight = Math.max(MIN_HEIGHT, clamp(naturalHeight, MIN_HEIGHT, MAX_HEIGHT) * scale);
112
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_gild_ui_react_View.View, {
113
+ my: fill ? 0 : 2,
114
+ position: "relative",
115
+ maxWidth: "100%",
116
+ borderRadius: "md",
117
+ height: fill ? "100%" : void 0,
118
+ children: [
119
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Viewport, {
120
+ isDragging: dragging,
121
+ onWheel: fill ? onWheel : void 0,
122
+ onMouseDown,
123
+ onMouseMove,
124
+ onMouseUp: endDrag,
125
+ onMouseLeave: endDrag,
126
+ overflow: "hidden",
127
+ borderRadius: "md",
128
+ alignItems: "center",
129
+ justifyContent: "center",
130
+ height: fill ? "100%" : `${inlineHeight}px`,
131
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Layer, {
132
+ ref: contentRef,
133
+ "data-testid": "diagram-transform",
134
+ isDragging: dragging,
135
+ panX: x,
136
+ panY: y,
137
+ zoomLevel: zoom,
138
+ dangerouslySetInnerHTML: { __html: svg }
139
+ })
140
+ }),
141
+ expandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_View.View, {
142
+ position: "absolute",
143
+ top: 1,
144
+ right: 1,
145
+ zIndex: 1,
146
+ children: control("Expand diagram", "fullscreen", () => setFullscreen(true))
147
+ }),
148
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_gild_ui_react_Grid.Grid, {
149
+ position: "absolute",
150
+ bottom: 1,
151
+ right: 1,
152
+ zIndex: 1,
153
+ gridTemplateColumns: "repeat(3, auto)",
154
+ gap: .5,
155
+ children: [
156
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { "aria-hidden": true }),
157
+ control("Pan up", "expand_less", () => panBy(0, -48)),
158
+ control("Zoom in", "zoom_in", () => zoomBy(ZOOM_STEP)),
159
+ control("Pan left", "chevron_left", () => panBy(-48, 0)),
160
+ control("Reset view", "refresh", reset),
161
+ control("Pan right", "chevron_right", () => panBy(PAN_STEP, 0)),
162
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { "aria-hidden": true }),
163
+ control("Pan down", "expand_more", () => panBy(0, PAN_STEP)),
164
+ control("Zoom out", "zoom_out", () => zoomBy(-.2))
165
+ ]
166
+ })
167
+ ]
168
+ }), expandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Modal.Modal, {
169
+ isOpen: fullscreen,
170
+ onClose: closeFullscreen,
171
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_gild_ui_react_Flex.Flex, {
172
+ bg: "paper",
173
+ role: "dialog",
174
+ "aria-label": "Diagram fullscreen",
175
+ position: "fixed",
176
+ top: 0,
177
+ right: 0,
178
+ bottom: 0,
179
+ left: 0,
180
+ p: 2,
181
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_View.View, {
182
+ position: "absolute",
183
+ top: 2,
184
+ right: 2,
185
+ zIndex: 1,
186
+ children: control("Close", "close", closeFullscreen)
187
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Flex.Flex, {
188
+ flex: 1,
189
+ minHeight: 0,
190
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DiagramViewer, {
191
+ svg,
192
+ expandable: false,
193
+ fill: true
194
+ })
195
+ })]
196
+ })
197
+ })] });
198
+ }
199
+ // src/Mermaid/Mermaid.tsx
200
+ async function toSvg(id, chart, theme) {
201
+ const { default: mermaid } = await import("mermaid");
202
+ mermaid.initialize({
203
+ startOnLoad: false,
204
+ securityLevel: "strict",
205
+ suppressErrorRendering: true,
206
+ theme: theme.colorScheme === "dark" ? "dark" : "default",
207
+ themeVariables: {
208
+ darkMode: theme.colorScheme === "dark",
209
+ background: theme.background.paper,
210
+ fontFamily: theme.fonts.body,
211
+ mainBkg: theme.background.primary,
212
+ ...theme.mermaid
213
+ }
214
+ });
215
+ const { svg } = await mermaid.render(id, chart);
216
+ return svg;
217
+ }
218
+ /**
219
+ * Renders a mermaid diagram. Until the client renders the SVG - and if the source is
220
+ * invalid - it falls back to the diagram source in a `CodeBlock`, so server output and
221
+ * no-JS readers still show something useful and hydration stays stable.
222
+ */
223
+ function Mermaid({ chart, diagram }) {
224
+ const theme = (0, _gild_ui_react.useTheme)();
225
+ const id = `mermaid-${(0, react.useId)().replace(/[^a-zA-Z0-9-]/g, "")}`;
226
+ const [svg, setSvg] = (0, react.useState)(null);
227
+ (0, react.useEffect)(() => {
228
+ let active = true;
229
+ toSvg(id, chart, theme).then((rendered) => {
230
+ if (active) setSvg(rendered);
231
+ }).catch(() => {
232
+ if (active) setSvg(null);
233
+ });
234
+ return () => {
235
+ active = false;
236
+ };
237
+ }, [
238
+ chart,
239
+ id,
240
+ theme
241
+ ]);
242
+ if (svg) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DiagramViewer, {
243
+ svg,
244
+ ...diagram
245
+ });
246
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeBlock.CodeBlock, { children: chart });
247
+ }
248
+ Object.defineProperty(exports, "Mermaid", {
249
+ enumerable: true,
250
+ get: function() {
251
+ return Mermaid;
252
+ }
253
+ });
@@ -0,0 +1,3 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_Mermaid = require("./Mermaid-d1a5LqcK.cjs");
3
+ exports.Mermaid = require_Mermaid.Mermaid;
@@ -0,0 +1,2 @@
1
+ import { n as Mermaid, r as MermaidProps, t as DiagramProps } from "./index-BVYb370O.cjs";
2
+ export { DiagramProps, Mermaid, MermaidProps };
@@ -0,0 +1,2 @@
1
+ import { n as Mermaid, r as MermaidProps, t as DiagramProps } from "./index-CyddYU7P.mjs";
2
+ export { DiagramProps, Mermaid, MermaidProps };
@@ -0,0 +1 @@
1
+ export { t as Mermaid } from "./Mermaid-DR4XzGaY.mjs";
@@ -0,0 +1,268 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-CmQyd0Gu.cjs");
2
+ const require_CodeBlock = require("./CodeBlock-BaMe7CiF.cjs");
3
+ const require_Mermaid = require("./Mermaid-d1a5LqcK.cjs");
4
+ const require_mergeOverrides = require("./mergeOverrides-D2btS1Jb.cjs");
5
+ let react = require("react");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let _gild_ui_react_Typography = require("@gild-ui/react/Typography");
8
+ let _gild_ui_react = require("@gild-ui/react");
9
+ let _gild_ui_react_View = require("@gild-ui/react/View");
10
+ let react_markdown = require("react-markdown");
11
+ react_markdown = require_rolldown_runtime.__toESM(react_markdown, 1);
12
+ let remark_gfm = require("remark-gfm");
13
+ remark_gfm = require_rolldown_runtime.__toESM(remark_gfm, 1);
14
+ let rehype_highlight = require("rehype-highlight");
15
+ rehype_highlight = require_rolldown_runtime.__toESM(rehype_highlight, 1);
16
+ let rehype_slug = require("rehype-slug");
17
+ rehype_slug = require_rolldown_runtime.__toESM(rehype_slug, 1);
18
+ let _gild_ui_react_Quote = require("@gild-ui/react/Quote");
19
+ let _gild_ui_react_Checkbox = require("@gild-ui/react/Checkbox");
20
+ let _gild_ui_react_Image = require("@gild-ui/react/Image");
21
+ let _gild_ui_react_Link = require("@gild-ui/react/Link");
22
+ let _gild_ui_react_Table = require("@gild-ui/react/Table");
23
+ function mermaidSource(children) {
24
+ return (Array.isArray(children) ? children.join("") : String(children ?? "")).replace(/\n$/, "");
25
+ }
26
+ function isMermaidBlock(children) {
27
+ if (!(0, react.isValidElement)(children)) return false;
28
+ const { className } = children.props;
29
+ return typeof className === "string" && className.includes("language-mermaid");
30
+ }
31
+ // src/Preview/Preview.tsx
32
+ const taskItem = _gild_ui_react.StyleSheet.create({ item: { listStyleType: "none" } });
33
+ const remarkPlugins = [remark_gfm.default];
34
+ const rehypePlugins = [rehype_slug.default, [rehype_highlight.default, { ignoreMissing: true }]];
35
+ const PreviewRoot = (0, _gild_ui_react.styled)(_gild_ui_react_View.View, {
36
+ name: "MarkdownPreview",
37
+ label: "MarkdownPreview"
38
+ })({
39
+ minWidth: 0,
40
+ maxWidth: "100%",
41
+ overflowWrap: "break-word"
42
+ });
43
+ const alignOf = (style) => style?.textAlign;
44
+ const EMPTY_SLOT_PROPS = {};
45
+ const SlotPropsContext = (0, react.createContext)(EMPTY_SLOT_PROPS);
46
+ function slotted(render) {
47
+ function Slotted(props) {
48
+ return render((0, react.useContext)(SlotPropsContext), props);
49
+ }
50
+ return Slotted;
51
+ }
52
+ const components = {
53
+ h1: slotted(({ h1 }, { id, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
54
+ id,
55
+ mt: 2,
56
+ variant: "h1",
57
+ color: "primary",
58
+ gutterBottom: true,
59
+ ...h1,
60
+ children
61
+ })),
62
+ h2: slotted(({ h2 }, { id, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
63
+ id,
64
+ mt: 2,
65
+ variant: "h2",
66
+ color: "primary",
67
+ gutterBottom: true,
68
+ ...h2,
69
+ children
70
+ })),
71
+ h3: slotted(({ h3 }, { id, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
72
+ id,
73
+ mt: 2,
74
+ variant: "h3",
75
+ color: "primary",
76
+ gutterBottom: true,
77
+ ...h3,
78
+ children
79
+ })),
80
+ h4: slotted(({ h4 }, { id, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
81
+ id,
82
+ mt: 2,
83
+ variant: "h4",
84
+ gutterBottom: true,
85
+ ...h4,
86
+ children
87
+ })),
88
+ h5: slotted(({ h5 }, { id, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
89
+ id,
90
+ mt: 2,
91
+ variant: "h5",
92
+ gutterBottom: true,
93
+ ...h5,
94
+ children
95
+ })),
96
+ h6: slotted(({ h6 }, { id, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
97
+ id,
98
+ mt: 2,
99
+ variant: "h6",
100
+ gutterBottom: true,
101
+ ...h6,
102
+ children
103
+ })),
104
+ p: slotted(({ p }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
105
+ variant: "body1",
106
+ color: "secondary",
107
+ mb: 2,
108
+ lineHeight: "relaxed",
109
+ ...p,
110
+ children
111
+ })),
112
+ a: slotted(({ a }, { href, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Link.Link, {
113
+ href,
114
+ underline: "hover",
115
+ ...a,
116
+ children
117
+ })),
118
+ strong: slotted(({ strong }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
119
+ as: "strong",
120
+ variant: "inherit",
121
+ fontWeight: "extraBold",
122
+ ...strong,
123
+ children
124
+ })),
125
+ em: slotted(({ em }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
126
+ as: "em",
127
+ variant: "inherit",
128
+ fontStyle: "italic",
129
+ ...em,
130
+ children
131
+ })),
132
+ ul: slotted(({ ul }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_View.View, {
133
+ as: "ul",
134
+ pl: 3,
135
+ mb: 2,
136
+ ...ul,
137
+ children
138
+ })),
139
+ ol: slotted(({ ol }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_View.View, {
140
+ as: "ol",
141
+ pl: 3,
142
+ mb: 2,
143
+ ...ol,
144
+ children
145
+ })),
146
+ li: slotted(({ li }, { children, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
147
+ as: "li",
148
+ color: "secondary",
149
+ lineHeight: "base",
150
+ variant: "body1",
151
+ gutterBottom: true,
152
+ style: className?.includes("task-list-item") && taskItem.item,
153
+ ...li,
154
+ children
155
+ })),
156
+ input: slotted(({ input }, { checked }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Checkbox.Checkbox, {
157
+ checked: Boolean(checked),
158
+ disabled: true,
159
+ color: "primary",
160
+ size: "sm",
161
+ "aria-label": "Task item",
162
+ mr: 1,
163
+ ...input
164
+ })),
165
+ blockquote: slotted(({ blockquote }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Quote.Quote, {
166
+ as: "blockquote",
167
+ pl: 3,
168
+ py: 1,
169
+ my: 2,
170
+ ...blockquote,
171
+ children
172
+ })),
173
+ code: slotted(({ code, mermaid }, { className, children }) => {
174
+ const classes = className ?? "";
175
+ if (classes.includes("language-mermaid")) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Mermaid.Mermaid, {
176
+ chart: mermaidSource(children),
177
+ ...mermaid
178
+ });
179
+ const isBlock = classes.includes("language-");
180
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Typography.Typography, {
181
+ as: "code",
182
+ className,
183
+ color: "initial",
184
+ variant: "inherit",
185
+ fontFamily: "mono",
186
+ display: isBlock ? "block" : "inline",
187
+ bg: isBlock ? "transparent" : "paper",
188
+ px: isBlock ? 0 : 1,
189
+ borderRadius: "sm",
190
+ ...code,
191
+ children
192
+ });
193
+ }),
194
+ pre: slotted(({ pre }, { children }) => isMermaidBlock(children) ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeBlock.CodeBlock, {
195
+ ...pre,
196
+ children
197
+ })),
198
+ table: slotted(({ table }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Table.TableContainer, {
199
+ my: 2,
200
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Table.Table, {
201
+ bg: "terminal",
202
+ borderRadius: "md",
203
+ ...table,
204
+ children
205
+ })
206
+ })),
207
+ thead: slotted(({ thead }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Table.TableHead, {
208
+ bg: "grid",
209
+ color: "primary",
210
+ ...thead,
211
+ children
212
+ })),
213
+ tbody: slotted(({ tbody }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Table.TableBody, {
214
+ ...tbody,
215
+ children
216
+ })),
217
+ tr: slotted(({ tr }, { children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Table.TableRow, {
218
+ isHoverable: true,
219
+ ...tr,
220
+ children
221
+ })),
222
+ th: slotted(({ th }, { children, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Table.TableCell, {
223
+ align: alignOf(style),
224
+ ...th,
225
+ children
226
+ })),
227
+ td: slotted(({ td }, { children, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Table.TableCell, {
228
+ align: alignOf(style),
229
+ ...td,
230
+ children
231
+ })),
232
+ hr: slotted(({ hr }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_View.View, {
233
+ as: "hr",
234
+ my: 2,
235
+ height: "1px",
236
+ bg: "grid",
237
+ width: "100%",
238
+ border: "none",
239
+ ...hr
240
+ })),
241
+ img: slotted(({ img }, { src, alt }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_gild_ui_react_Image.Image, {
242
+ src,
243
+ alt,
244
+ maxWidth: "100%",
245
+ ...img
246
+ }))
247
+ };
248
+ /** Renders a markdown string with every element mapped to a design-system primitive. */
249
+ function Preview({ children, slotProps, style }) {
250
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PreviewRoot, {
251
+ ...require_mergeOverrides.mergeOverrides(slotProps?.root, { style }),
252
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SlotPropsContext.Provider, {
253
+ value: slotProps ?? EMPTY_SLOT_PROPS,
254
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_markdown.default, {
255
+ components,
256
+ remarkPlugins,
257
+ rehypePlugins,
258
+ children
259
+ })
260
+ })
261
+ });
262
+ }
263
+ Object.defineProperty(exports, "Preview", {
264
+ enumerable: true,
265
+ get: function() {
266
+ return Preview;
267
+ }
268
+ });