@gild-ui/react-markdown 0.0.0 → 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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +179 -2
  3. package/dist/CodeBlock.cjs +136 -0
  4. package/dist/CodeBlock.d.cts +15 -0
  5. package/dist/CodeBlock.d.mts +3 -0
  6. package/dist/CodeBlock.mjs +133 -0
  7. package/dist/Control.cjs +60 -0
  8. package/dist/Control.d.cts +16 -0
  9. package/dist/Control.d.mts +16 -0
  10. package/dist/Control.mjs +59 -0
  11. package/dist/Editor.cjs +131 -0
  12. package/dist/Editor.d.cts +48 -0
  13. package/dist/Editor.d.mts +48 -0
  14. package/dist/Editor.mjs +130 -0
  15. package/dist/LiveEdit-1-8cA5Xw.mjs +215 -0
  16. package/dist/LiveEdit-B83sDZXu.cjs +224 -0
  17. package/dist/LiveEdit.cjs +3 -0
  18. package/dist/LiveEdit.d.cts +29 -0
  19. package/dist/LiveEdit.d.mts +29 -0
  20. package/dist/LiveEdit.mjs +1 -0
  21. package/dist/MarkdownContext-D28Czdll.mjs +10 -0
  22. package/dist/MarkdownContext-DS1X9B6N.cjs +21 -0
  23. package/dist/Mermaid-DW0NuDS-.mjs +248 -0
  24. package/dist/Mermaid-D_tCNrQ9.cjs +253 -0
  25. package/dist/Mermaid.cjs +3 -0
  26. package/dist/Mermaid.d.cts +2 -0
  27. package/dist/Mermaid.d.mts +2 -0
  28. package/dist/Mermaid.mjs +1 -0
  29. package/dist/Preview-BLXtPaa9.mjs +258 -0
  30. package/dist/Preview-D-AL97QU.cjs +268 -0
  31. package/dist/Preview.cjs +3 -0
  32. package/dist/Preview.d.cts +56 -0
  33. package/dist/Preview.d.mts +2 -0
  34. package/dist/Preview.mjs +1 -0
  35. package/dist/Toolbar-Eg7KmYbK.mjs +603 -0
  36. package/dist/Toolbar-gk3KJhCE.cjs +614 -0
  37. package/dist/Toolbar.cjs +4 -0
  38. package/dist/Toolbar.d.cts +18 -0
  39. package/dist/Toolbar.d.mts +18 -0
  40. package/dist/Toolbar.mjs +1 -0
  41. package/dist/applyAction-B3AwrWKV.cjs +121 -0
  42. package/dist/applyAction-CkTQJ5Iy.mjs +116 -0
  43. package/dist/index-BBkHCbE7.d.mts +15 -0
  44. package/dist/index-BVYb370O.d.cts +24 -0
  45. package/dist/index-CfPKWPpM.d.mts +57 -0
  46. package/dist/index-CyddYU7P.d.mts +24 -0
  47. package/dist/index.cjs +21 -0
  48. package/dist/index.d.cts +80 -0
  49. package/dist/index.d.mts +80 -0
  50. package/dist/index.mjs +9 -0
  51. package/dist/mergeOverrides-D2btS1Jb.cjs +19 -0
  52. package/dist/mergeOverrides-DEbU7yDg.mjs +14 -0
  53. package/dist/rolldown-runtime-CmQyd0Gu.cjs +27 -0
  54. package/dist/themeTypes-C4kTtkIA.d.cts +83 -0
  55. package/dist/themeTypes-C4kTtkIA.d.mts +83 -0
  56. package/package.json +163 -3
@@ -0,0 +1,253 @@
1
+ const require_CodeBlock = require("./CodeBlock.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-D_tCNrQ9.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-DW0NuDS-.mjs";
@@ -0,0 +1,258 @@
1
+ import { CodeBlock } from "./CodeBlock.mjs";
2
+ import { t as Mermaid } from "./Mermaid-DW0NuDS-.mjs";
3
+ import { t as mergeOverrides } from "./mergeOverrides-DEbU7yDg.mjs";
4
+ import { createContext, isValidElement, useContext } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { Typography } from "@gild-ui/react/Typography";
7
+ import { StyleSheet, styled } from "@gild-ui/react";
8
+ import { View } from "@gild-ui/react/View";
9
+ import ReactMarkdown from "react-markdown";
10
+ import remarkGfm from "remark-gfm";
11
+ import rehypeHighlight from "rehype-highlight";
12
+ import rehypeSlug from "rehype-slug";
13
+ import { Quote } from "@gild-ui/react/Quote";
14
+ import { Checkbox } from "@gild-ui/react/Checkbox";
15
+ import { Image } from "@gild-ui/react/Image";
16
+ import { Link } from "@gild-ui/react/Link";
17
+ import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from "@gild-ui/react/Table";
18
+ function mermaidSource(children) {
19
+ return (Array.isArray(children) ? children.join("") : String(children ?? "")).replace(/\n$/, "");
20
+ }
21
+ function isMermaidBlock(children) {
22
+ if (!isValidElement(children)) return false;
23
+ const { className } = children.props;
24
+ return typeof className === "string" && className.includes("language-mermaid");
25
+ }
26
+ // src/Preview/Preview.tsx
27
+ const taskItem = StyleSheet.create({ item: { listStyleType: "none" } });
28
+ const remarkPlugins = [remarkGfm];
29
+ const rehypePlugins = [rehypeSlug, [rehypeHighlight, { ignoreMissing: true }]];
30
+ const PreviewRoot = styled(View, {
31
+ name: "MarkdownPreview",
32
+ label: "MarkdownPreview"
33
+ })({
34
+ minWidth: 0,
35
+ maxWidth: "100%",
36
+ overflowWrap: "break-word"
37
+ });
38
+ const alignOf = (style) => style?.textAlign;
39
+ const EMPTY_SLOT_PROPS = {};
40
+ const SlotPropsContext = createContext(EMPTY_SLOT_PROPS);
41
+ function slotted(render) {
42
+ function Slotted(props) {
43
+ return render(useContext(SlotPropsContext), props);
44
+ }
45
+ return Slotted;
46
+ }
47
+ const components = {
48
+ h1: slotted(({ h1 }, { id, children }) => /* @__PURE__ */ jsx(Typography, {
49
+ id,
50
+ mt: 2,
51
+ variant: "h1",
52
+ color: "primary",
53
+ gutterBottom: true,
54
+ ...h1,
55
+ children
56
+ })),
57
+ h2: slotted(({ h2 }, { id, children }) => /* @__PURE__ */ jsx(Typography, {
58
+ id,
59
+ mt: 2,
60
+ variant: "h2",
61
+ color: "primary",
62
+ gutterBottom: true,
63
+ ...h2,
64
+ children
65
+ })),
66
+ h3: slotted(({ h3 }, { id, children }) => /* @__PURE__ */ jsx(Typography, {
67
+ id,
68
+ mt: 2,
69
+ variant: "h3",
70
+ color: "primary",
71
+ gutterBottom: true,
72
+ ...h3,
73
+ children
74
+ })),
75
+ h4: slotted(({ h4 }, { id, children }) => /* @__PURE__ */ jsx(Typography, {
76
+ id,
77
+ mt: 2,
78
+ variant: "h4",
79
+ gutterBottom: true,
80
+ ...h4,
81
+ children
82
+ })),
83
+ h5: slotted(({ h5 }, { id, children }) => /* @__PURE__ */ jsx(Typography, {
84
+ id,
85
+ mt: 2,
86
+ variant: "h5",
87
+ gutterBottom: true,
88
+ ...h5,
89
+ children
90
+ })),
91
+ h6: slotted(({ h6 }, { id, children }) => /* @__PURE__ */ jsx(Typography, {
92
+ id,
93
+ mt: 2,
94
+ variant: "h6",
95
+ gutterBottom: true,
96
+ ...h6,
97
+ children
98
+ })),
99
+ p: slotted(({ p }, { children }) => /* @__PURE__ */ jsx(Typography, {
100
+ variant: "body1",
101
+ color: "secondary",
102
+ mb: 2,
103
+ lineHeight: "relaxed",
104
+ ...p,
105
+ children
106
+ })),
107
+ a: slotted(({ a }, { href, children }) => /* @__PURE__ */ jsx(Link, {
108
+ href,
109
+ underline: "hover",
110
+ ...a,
111
+ children
112
+ })),
113
+ strong: slotted(({ strong }, { children }) => /* @__PURE__ */ jsx(Typography, {
114
+ as: "strong",
115
+ variant: "inherit",
116
+ fontWeight: "extraBold",
117
+ ...strong,
118
+ children
119
+ })),
120
+ em: slotted(({ em }, { children }) => /* @__PURE__ */ jsx(Typography, {
121
+ as: "em",
122
+ variant: "inherit",
123
+ fontStyle: "italic",
124
+ ...em,
125
+ children
126
+ })),
127
+ ul: slotted(({ ul }, { children }) => /* @__PURE__ */ jsx(View, {
128
+ as: "ul",
129
+ pl: 3,
130
+ mb: 2,
131
+ ...ul,
132
+ children
133
+ })),
134
+ ol: slotted(({ ol }, { children }) => /* @__PURE__ */ jsx(View, {
135
+ as: "ol",
136
+ pl: 3,
137
+ mb: 2,
138
+ ...ol,
139
+ children
140
+ })),
141
+ li: slotted(({ li }, { children, className }) => /* @__PURE__ */ jsx(Typography, {
142
+ as: "li",
143
+ color: "secondary",
144
+ lineHeight: "base",
145
+ variant: "body1",
146
+ gutterBottom: true,
147
+ style: className?.includes("task-list-item") && taskItem.item,
148
+ ...li,
149
+ children
150
+ })),
151
+ input: slotted(({ input }, { checked }) => /* @__PURE__ */ jsx(Checkbox, {
152
+ checked: Boolean(checked),
153
+ disabled: true,
154
+ color: "primary",
155
+ size: "sm",
156
+ "aria-label": "Task item",
157
+ mr: 1,
158
+ ...input
159
+ })),
160
+ blockquote: slotted(({ blockquote }, { children }) => /* @__PURE__ */ jsx(Quote, {
161
+ as: "blockquote",
162
+ pl: 3,
163
+ py: 1,
164
+ my: 2,
165
+ ...blockquote,
166
+ children
167
+ })),
168
+ code: slotted(({ code, mermaid }, { className, children }) => {
169
+ const classes = className ?? "";
170
+ if (classes.includes("language-mermaid")) return /* @__PURE__ */ jsx(Mermaid, {
171
+ chart: mermaidSource(children),
172
+ ...mermaid
173
+ });
174
+ const isBlock = classes.includes("language-");
175
+ return /* @__PURE__ */ jsx(Typography, {
176
+ as: "code",
177
+ className,
178
+ color: "initial",
179
+ variant: "inherit",
180
+ fontFamily: "mono",
181
+ display: isBlock ? "block" : "inline",
182
+ bg: isBlock ? "transparent" : "paper",
183
+ px: isBlock ? 0 : 1,
184
+ borderRadius: "sm",
185
+ ...code,
186
+ children
187
+ });
188
+ }),
189
+ pre: slotted(({ pre }, { children }) => isMermaidBlock(children) ? children : /* @__PURE__ */ jsx(CodeBlock, {
190
+ ...pre,
191
+ children
192
+ })),
193
+ table: slotted(({ table }, { children }) => /* @__PURE__ */ jsx(TableContainer, {
194
+ my: 2,
195
+ children: /* @__PURE__ */ jsx(Table, {
196
+ bg: "terminal",
197
+ borderRadius: "md",
198
+ ...table,
199
+ children
200
+ })
201
+ })),
202
+ thead: slotted(({ thead }, { children }) => /* @__PURE__ */ jsx(TableHead, {
203
+ bg: "grid",
204
+ color: "primary",
205
+ ...thead,
206
+ children
207
+ })),
208
+ tbody: slotted(({ tbody }, { children }) => /* @__PURE__ */ jsx(TableBody, {
209
+ ...tbody,
210
+ children
211
+ })),
212
+ tr: slotted(({ tr }, { children }) => /* @__PURE__ */ jsx(TableRow, {
213
+ isHoverable: true,
214
+ ...tr,
215
+ children
216
+ })),
217
+ th: slotted(({ th }, { children, style }) => /* @__PURE__ */ jsx(TableCell, {
218
+ align: alignOf(style),
219
+ ...th,
220
+ children
221
+ })),
222
+ td: slotted(({ td }, { children, style }) => /* @__PURE__ */ jsx(TableCell, {
223
+ align: alignOf(style),
224
+ ...td,
225
+ children
226
+ })),
227
+ hr: slotted(({ hr }) => /* @__PURE__ */ jsx(View, {
228
+ as: "hr",
229
+ my: 2,
230
+ height: "1px",
231
+ bg: "grid",
232
+ width: "100%",
233
+ border: "none",
234
+ ...hr
235
+ })),
236
+ img: slotted(({ img }, { src, alt }) => /* @__PURE__ */ jsx(Image, {
237
+ src,
238
+ alt,
239
+ maxWidth: "100%",
240
+ ...img
241
+ }))
242
+ };
243
+ /** Renders a markdown string with every element mapped to a design-system primitive. */
244
+ function Preview({ children, slotProps, style }) {
245
+ return /* @__PURE__ */ jsx(PreviewRoot, {
246
+ ...mergeOverrides(slotProps?.root, { style }),
247
+ children: /* @__PURE__ */ jsx(SlotPropsContext.Provider, {
248
+ value: slotProps ?? EMPTY_SLOT_PROPS,
249
+ children: /* @__PURE__ */ jsx(ReactMarkdown, {
250
+ components,
251
+ remarkPlugins,
252
+ rehypePlugins,
253
+ children
254
+ })
255
+ })
256
+ });
257
+ }
258
+ export { Preview as t };