@sampleapp.ai/sdk 1.0.28 → 1.0.30
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/dist/components/chat-bar.js +1 -2
- package/dist/components/guardian/app-layout-no-sidebar.js +8 -0
- package/dist/components/guardian/ask-ai-view.js +249 -0
- package/dist/components/guardian/code-focus-section.d.ts +41 -0
- package/dist/components/guardian/code-focus-section.js +174 -0
- package/dist/components/guardian/context/guardian-context.js +94 -0
- package/dist/components/guardian/context/vm-context.js +28 -0
- package/dist/components/guardian/default-guide-view.js +34 -0
- package/dist/components/guardian/demo/guardian-demo.js +35 -0
- package/dist/components/guardian/demo/left-view/toggle.js +28 -0
- package/dist/components/guardian/demo/left-view.js +49 -0
- package/dist/components/guardian/guardian-component.js +79 -0
- package/dist/components/guardian/guardian-demo.js +35 -0
- package/dist/components/guardian/guardian-home.d.ts +4 -0
- package/dist/components/guardian/guardian-home.js +61 -0
- package/dist/components/guardian/guardian-playground.js +45 -0
- package/dist/components/guardian/guardian-style-wrapper.js +29 -0
- package/dist/components/guardian/guardian-upload-spec.d.ts +14 -0
- package/dist/components/guardian/guardian-upload-spec.js +160 -0
- package/dist/components/guardian/header/glassmorphic-combobox.d.ts +15 -0
- package/dist/components/guardian/header/glassmorphic-combobox.js +30 -0
- package/dist/components/guardian/header.js +61 -0
- package/dist/components/guardian/hooks/use-frame-messages.js +65 -0
- package/dist/components/guardian/hooks/use-frame-params.js +44 -0
- package/dist/components/guardian/hooks/use-sandbox-url-loader.js +101 -0
- package/dist/components/guardian/ide/browser.js +538 -0
- package/dist/components/guardian/index.js +8 -0
- package/dist/components/guardian/layout/app-layout-no-sidebar.js +8 -0
- package/dist/components/guardian/layout/header/glassmorphic-combobox.js +48 -0
- package/dist/components/guardian/layout/header.js +63 -0
- package/dist/components/guardian/right-view/code-view.js +56 -0
- package/dist/components/guardian/right-view/pill-file-selector.js +233 -0
- package/dist/components/guardian/right-view/preview-control-bar.js +25 -0
- package/dist/components/guardian/right-view/right-panel-view.js +38 -0
- package/dist/components/guardian/right-view/right-top-down-view.js +289 -0
- package/dist/components/guardian/right-view/right-view.js +28 -0
- package/dist/components/guardian/right-view/simplified-editor.js +234 -0
- package/dist/components/guardian/types/ide-types.js +162 -0
- package/dist/components/guardian/types.js +3 -0
- package/dist/components/guardian/ui/ai-loader.js +48 -0
- package/dist/components/guardian/ui/badge.js +24 -0
- package/dist/components/guardian/ui/button.js +45 -0
- package/dist/components/guardian/ui/command.js +63 -0
- package/dist/components/guardian/ui/console-with-app.js +17 -0
- package/dist/components/guardian/ui/dialog.js +57 -0
- package/dist/components/guardian/ui/dropdown-menu.js +82 -0
- package/dist/components/guardian/ui/markdown.js +57 -0
- package/dist/components/guardian/ui/popover.js +25 -0
- package/dist/components/guardian/ui/tooltip.js +25 -0
- package/dist/components/guardian/utils.js +88 -0
- package/dist/components/guardian/zip-to-codebase.js +246 -0
- package/dist/components/guardian/zip-to-filetree.js +284 -0
- package/dist/components/icons.js +22 -0
- package/dist/components/sandbox/Sandbox.js +87 -0
- package/dist/components/sandbox/SandboxHome.js +141 -0
- package/dist/components/sandbox/api.js +108 -0
- package/dist/components/sandbox/guardian/app-layout-no-sidebar.js +8 -0
- package/dist/components/sandbox/guardian/ask-ai-view.js +249 -0
- package/dist/components/sandbox/guardian/code-focus-section.js +174 -0
- package/dist/components/sandbox/guardian/context/guardian-context.js +94 -0
- package/dist/components/sandbox/guardian/context/vm-context.js +28 -0
- package/dist/components/sandbox/guardian/default-guide-view.js +34 -0
- package/dist/components/sandbox/guardian/demo/guardian-demo.js +35 -0
- package/dist/components/sandbox/guardian/demo/left-view/toggle.js +28 -0
- package/dist/components/sandbox/guardian/demo/left-view.js +58 -0
- package/dist/components/sandbox/guardian/guardian-component.js +97 -0
- package/dist/components/sandbox/guardian/guardian-demo.js +35 -0
- package/dist/components/sandbox/guardian/guardian-home.d.ts +4 -0
- package/dist/components/sandbox/guardian/guardian-home.js +61 -0
- package/dist/components/sandbox/guardian/guardian-playground.js +45 -0
- package/dist/components/sandbox/guardian/guardian-style-wrapper.js +33 -0
- package/dist/components/sandbox/guardian/guardian-upload-spec.d.ts +14 -0
- package/dist/components/sandbox/guardian/guardian-upload-spec.js +160 -0
- package/dist/components/sandbox/guardian/header/glassmorphic-combobox.js +30 -0
- package/dist/components/sandbox/guardian/header.js +61 -0
- package/dist/components/sandbox/guardian/hooks/use-frame-messages.js +65 -0
- package/dist/components/sandbox/guardian/hooks/use-frame-params.js +44 -0
- package/dist/components/sandbox/guardian/hooks/use-sandbox-url-loader.js +145 -0
- package/dist/components/sandbox/guardian/ide/browser.js +538 -0
- package/dist/components/sandbox/guardian/index.js +8 -0
- package/dist/components/sandbox/guardian/right-view/code-view.js +60 -0
- package/dist/components/sandbox/guardian/right-view/pill-file-selector.js +233 -0
- package/dist/components/sandbox/guardian/right-view/preview-control-bar.js +25 -0
- package/dist/components/sandbox/guardian/right-view/right-panel-view.js +38 -0
- package/dist/components/sandbox/guardian/right-view/right-top-down-view.js +289 -0
- package/dist/components/sandbox/guardian/right-view/right-view.js +28 -0
- package/dist/components/sandbox/guardian/right-view/simplified-editor.js +234 -0
- package/dist/components/sandbox/guardian/types/ide-types.js +162 -0
- package/dist/components/sandbox/guardian/types.js +3 -0
- package/dist/components/sandbox/guardian/ui/ai-loader.js +48 -0
- package/dist/components/sandbox/guardian/ui/badge.js +24 -0
- package/dist/components/sandbox/guardian/ui/button.js +45 -0
- package/dist/components/sandbox/guardian/ui/command.js +63 -0
- package/dist/components/sandbox/guardian/ui/console-with-app.js +17 -0
- package/dist/components/sandbox/guardian/ui/dialog.js +57 -0
- package/dist/components/sandbox/guardian/ui/dropdown-menu.js +82 -0
- package/dist/components/sandbox/guardian/ui/markdown/accordion-group/accordion.js +62 -0
- package/dist/components/sandbox/guardian/ui/markdown/accordion-group.js +23 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-check.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-error.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-info.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-note.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-tip.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-warning.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/shared/callout.js +9 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/shared/types.js +1 -0
- package/dist/components/sandbox/guardian/ui/markdown/card-group/card.js +18 -0
- package/dist/components/sandbox/guardian/ui/markdown/card-group.js +25 -0
- package/dist/components/sandbox/guardian/ui/markdown/code-group/code-block.js +87 -0
- package/dist/components/sandbox/guardian/ui/markdown/code-group.js +101 -0
- package/dist/components/sandbox/guardian/ui/markdown/icon.js +31 -0
- package/dist/components/sandbox/guardian/ui/markdown.js +786 -0
- package/dist/components/sandbox/guardian/ui/popover.js +25 -0
- package/dist/components/sandbox/guardian/ui/tooltip.js +25 -0
- package/dist/components/sandbox/guardian/utils.js +88 -0
- package/dist/components/sandbox/guardian/zip-to-codebase.js +259 -0
- package/dist/components/sandbox/guardian/zip-to-filetree.js +284 -0
- package/dist/components/sandbox/index.js +4 -0
- package/dist/components/sandbox/sandbox-control-bar.js +91 -0
- package/dist/components/sandbox/sandbox-header.js +52 -0
- package/dist/components/sandbox/sandbox-home/SandboxCard.js +59 -0
- package/dist/components/sandbox/sandbox-home/SandboxHome.js +174 -0
- package/dist/components/sandbox/sandbox-home/SearchBar.js +12 -0
- package/dist/components/sandbox/sandbox-home/index.js +3 -0
- package/dist/components/sandbox/sandbox-left-panel.js +248 -0
- package/dist/components/sandbox/sandbox-loading.js +48 -0
- package/dist/components/sandbox/sandbox-right-panel.js +247 -0
- package/dist/components/sandbox/types.js +1 -0
- package/dist/components/sandbox.js +32 -0
- package/dist/components/tailwind-example.js +46 -0
- package/dist/index.d.ts +336 -1
- package/dist/index.es.js +90151 -667
- package/dist/index.js +13 -2
- package/dist/index.standalone.js +61 -53
- package/dist/index.standalone.umd.js +17 -89
- package/dist/index.umd.js +86 -151
- package/dist/lib/api-client.example.js +60 -0
- package/dist/lib/api-client.js +98 -0
- package/dist/lib/generated-css.js +4 -0
- package/dist/lib/inject-styles.js +42 -0
- package/dist/lib/shadow-dom-wrapper.js +42 -0
- package/dist/lib/utils.js +5 -0
- package/dist/sdk.css +1 -1
- package/dist/tailwind.css +1 -0
- package/package.json +32 -5
|
@@ -0,0 +1,786 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
//@ts-nocheck
|
|
3
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
8
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10
|
+
t[p[i]] = s[p[i]];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
import { cn } from "../../../../lib/utils";
|
|
15
|
+
import { memo } from "react";
|
|
16
|
+
import ReactMarkdown from "react-markdown";
|
|
17
|
+
import remarkGfm from "remark-gfm";
|
|
18
|
+
import remarkMath from "remark-math";
|
|
19
|
+
import rehypeRaw from "rehype-raw";
|
|
20
|
+
// import remarkMdx from "remark-mdx"; // Import remark-mdx
|
|
21
|
+
import React from "react";
|
|
22
|
+
import { CodeGroup } from "./markdown/code-group";
|
|
23
|
+
import { CodeBlock } from "./markdown/code-group/code-block";
|
|
24
|
+
import { Accordion } from "./markdown/accordion-group/accordion";
|
|
25
|
+
import { AccordionGroup } from "./markdown/accordion-group";
|
|
26
|
+
import { CalloutCheck } from "./markdown/callout/callout-check";
|
|
27
|
+
import { CalloutError } from "./markdown/callout/callout-error";
|
|
28
|
+
import { CalloutInfo } from "./markdown/callout/callout-info";
|
|
29
|
+
import { CalloutNote } from "./markdown/callout/callout-note";
|
|
30
|
+
import { CalloutTip } from "./markdown/callout/callout-tip";
|
|
31
|
+
import { CalloutWarning } from "./markdown/callout/callout-warning";
|
|
32
|
+
import { CardGroup } from "./markdown/card-group";
|
|
33
|
+
import { Card } from "./markdown/card-group/card";
|
|
34
|
+
import CodeFocusSection from "@/components/sandbox/guardian/code-focus-section";
|
|
35
|
+
// Stub components for components that don't exist in SDK
|
|
36
|
+
const ButtonFileServer = ({ title, description, filePath, feature, fileContent, color, }) => {
|
|
37
|
+
return null; // Stub - not implemented in SDK
|
|
38
|
+
};
|
|
39
|
+
const ToggleFileServer = ({ title, description, filePath, feature, fileContent, color, }) => {
|
|
40
|
+
return null; // Stub - not implemented in SDK
|
|
41
|
+
};
|
|
42
|
+
const ToggleIframeUrl = ({ title, description, newUrl, feature, color, useVm, groupId, preloadedVmUrl, }) => {
|
|
43
|
+
return null; // Stub - not implemented in SDK
|
|
44
|
+
};
|
|
45
|
+
const DownloadAndOpenButtons = ({ downloadUrl, themeColor, gitUrl }) => {
|
|
46
|
+
return null; // Stub - not implemented in SDK
|
|
47
|
+
};
|
|
48
|
+
const createId = (text) => {
|
|
49
|
+
return text
|
|
50
|
+
.toLowerCase()
|
|
51
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
52
|
+
.replace(/(^-|-$)/g, "");
|
|
53
|
+
};
|
|
54
|
+
export const MemoizedReactMarkdown = memo(ReactMarkdown, (prevProps, nextProps) => prevProps.children === nextProps.children &&
|
|
55
|
+
prevProps.className === nextProps.className);
|
|
56
|
+
export const Markdown = ({ children, className, isRestricted, showToc, themeColor }) => {
|
|
57
|
+
const headingRenderer = (level) => {
|
|
58
|
+
return (_a) => {
|
|
59
|
+
var _b, _c;
|
|
60
|
+
var { children: headerChildren, node } = _a, props = __rest(_a, ["children", "node"]);
|
|
61
|
+
const text = String(headerChildren);
|
|
62
|
+
const id = createId(text);
|
|
63
|
+
const isFirstElement = ((_c = (_b = node === null || node === void 0 ? void 0 : node.position) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.offset) === 0;
|
|
64
|
+
const HeadingClasses = {
|
|
65
|
+
1: cn("scroll-m-20 text-3xl font-bold tracking-tight lg:text-3xl mb-7 text-zinc-900 dark:text-zinc-50", !isFirstElement && "mt-16"),
|
|
66
|
+
2: cn("scroll-m-20 text-2xl font-bold tracking-tight mb-7 text-zinc-900 dark:text-zinc-50", !isFirstElement && "mt-14"),
|
|
67
|
+
3: cn("scroll-m-20 text-xl font-bold tracking-tight mb-6 text-zinc-900 dark:text-zinc-50", !isFirstElement && "mt-10"),
|
|
68
|
+
4: cn("scroll-m-20 text-lg font-bold tracking-tight mb-6 text-zinc-900 dark:text-zinc-50", !isFirstElement && "mt-10"),
|
|
69
|
+
};
|
|
70
|
+
const Tag = `h${level}`;
|
|
71
|
+
return (React.createElement(Tag, Object.assign({ id: id, className: HeadingClasses[level] }, props),
|
|
72
|
+
React.createElement("a", { href: `#${id}`, className: "no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400" }, headerChildren)));
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
// Wrapper for CodeFocusSection to handle HTML attributes from react-markdown
|
|
76
|
+
const CodeFocusSectionWrapper = (_a) => {
|
|
77
|
+
var { children, filepath, filerange, title, description, themecolor, className } = _a, props = __rest(_a, ["children", "filepath", "filerange", "title", "description", "themecolor", "className"]);
|
|
78
|
+
// Parse lineRange from string format like "10-30" or "10"
|
|
79
|
+
let lineRange;
|
|
80
|
+
if (filerange) {
|
|
81
|
+
const parts = filerange.split("-");
|
|
82
|
+
if (parts.length === 2) {
|
|
83
|
+
lineRange = {
|
|
84
|
+
start: parseInt(parts[0], 10),
|
|
85
|
+
end: parseInt(parts[1], 10),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
else if (parts.length === 1) {
|
|
89
|
+
lineRange = {
|
|
90
|
+
start: parseInt(parts[0], 10),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (!filepath || !title) {
|
|
95
|
+
return React.createElement("div", { className: className }, children);
|
|
96
|
+
}
|
|
97
|
+
// Use provided themecolor from HTML attribute, or fall back to component's themeColor prop, or default to blue
|
|
98
|
+
const color = themecolor || themeColor || "#3b82f6";
|
|
99
|
+
return (React.createElement("div", { className: className },
|
|
100
|
+
React.createElement(CodeFocusSection, { filePath: filepath, lineRange: lineRange, title: title, description: description, themeColor: color }, children)));
|
|
101
|
+
};
|
|
102
|
+
// Wrapper for ButtonFileServer to handle HTML attributes from react-markdown
|
|
103
|
+
const ButtonFileServerWrapper = (_a) => {
|
|
104
|
+
var { children, title, description, filepath, feature, filecontent, color, className } = _a, props = __rest(_a, ["children", "title", "description", "filepath", "feature", "filecontent", "color", "className"]);
|
|
105
|
+
if (!title ||
|
|
106
|
+
!description ||
|
|
107
|
+
!filepath ||
|
|
108
|
+
!feature ||
|
|
109
|
+
!filecontent ||
|
|
110
|
+
!color) {
|
|
111
|
+
return React.createElement("div", { className: className }, children);
|
|
112
|
+
}
|
|
113
|
+
return (React.createElement("div", { className: className },
|
|
114
|
+
React.createElement(ButtonFileServer, { title: title, description: description, filePath: filepath, feature: feature, fileContent: filecontent, color: color }),
|
|
115
|
+
children));
|
|
116
|
+
};
|
|
117
|
+
// Wrapper for ToggleFileServer to handle HTML attributes from react-markdown
|
|
118
|
+
const ToggleFileServerWrapper = (_a) => {
|
|
119
|
+
var { children, title, description, filepath, feature, filecontent, color, className } = _a, props = __rest(_a, ["children", "title", "description", "filepath", "feature", "filecontent", "color", "className"]);
|
|
120
|
+
if (!title ||
|
|
121
|
+
!description ||
|
|
122
|
+
!filepath ||
|
|
123
|
+
!feature ||
|
|
124
|
+
!filecontent ||
|
|
125
|
+
!color) {
|
|
126
|
+
return React.createElement("div", { className: className }, children);
|
|
127
|
+
}
|
|
128
|
+
return (React.createElement("div", { className: className },
|
|
129
|
+
React.createElement(ToggleFileServer, { title: title, description: description, filePath: filepath, feature: feature, fileContent: filecontent, color: color }),
|
|
130
|
+
children));
|
|
131
|
+
};
|
|
132
|
+
// Wrapper for ToggleIframeUrl to handle HTML attributes from react-markdown
|
|
133
|
+
const ToggleIframeUrlWrapper = (_a) => {
|
|
134
|
+
var { children, title, description, newurl, feature, color, usevm, groupid, preloadedvmurl, className } = _a, props = __rest(_a, ["children", "title", "description", "newurl", "feature", "color", "usevm", "groupid", "preloadedvmurl", "className"]);
|
|
135
|
+
if (!title || !description || !newurl || !feature || !color) {
|
|
136
|
+
return React.createElement("div", { className: className }, children);
|
|
137
|
+
}
|
|
138
|
+
// Convert usevm string to boolean
|
|
139
|
+
const useVmBoolean = usevm === "true" || usevm === "1";
|
|
140
|
+
return (React.createElement("div", { className: className },
|
|
141
|
+
React.createElement(ToggleIframeUrl, { title: title, description: description, newUrl: newurl, feature: feature, color: color, useVm: useVmBoolean, groupId: groupid, preloadedVmUrl: preloadedvmurl }),
|
|
142
|
+
children));
|
|
143
|
+
};
|
|
144
|
+
// Wrapper for DownloadAndOpenButtons to handle HTML attributes from react-markdown
|
|
145
|
+
const DownloadAndOpenButtonsWrapper = (_a) => {
|
|
146
|
+
var { children, downloadurl, themecolor, giturl, className } = _a, props = __rest(_a, ["children", "downloadurl", "themecolor", "giturl", "className"]);
|
|
147
|
+
if (!downloadurl || !themecolor) {
|
|
148
|
+
return React.createElement("div", { className: className }, children);
|
|
149
|
+
}
|
|
150
|
+
return (React.createElement("div", { className: cn("my-6", className) },
|
|
151
|
+
React.createElement(DownloadAndOpenButtons, { downloadUrl: downloadurl, themeColor: themecolor, gitUrl: giturl }),
|
|
152
|
+
children));
|
|
153
|
+
};
|
|
154
|
+
const sharedComponents = {
|
|
155
|
+
codegroup: CodeGroup, // For <codegroup>
|
|
156
|
+
codeblock: CodeBlock, // For <codeblock>
|
|
157
|
+
accordiongroup: AccordionGroup, // For <accordiongroup>
|
|
158
|
+
accordion: Accordion, // For <accordion>
|
|
159
|
+
check: CalloutCheck, // For <calloutcheck>
|
|
160
|
+
error: CalloutError, // For <callouterror>
|
|
161
|
+
info: CalloutInfo, // For <calloutinfo>
|
|
162
|
+
note: CalloutNote, // For <calloutnote>
|
|
163
|
+
tip: CalloutTip, // For <callouttip>
|
|
164
|
+
warning: CalloutWarning, // For <calloutwarning>
|
|
165
|
+
cardgroup: CardGroup, // For <cardgroup>
|
|
166
|
+
card: Card, // For <card>
|
|
167
|
+
codefocussection: CodeFocusSectionWrapper, // For <codefocussection>
|
|
168
|
+
buttonfileserver: ButtonFileServerWrapper, // For <buttonfileserver>
|
|
169
|
+
togglefileserver: ToggleFileServerWrapper, // For <togglefileserver>
|
|
170
|
+
toggleiframeurl: ToggleIframeUrlWrapper, // For <toggleiframeurl>
|
|
171
|
+
downloadandopenbuttons: DownloadAndOpenButtonsWrapper, // For <downloadandopenbuttons>
|
|
172
|
+
// icon: Icon, // For <icon> //TODO: HIDE THIS FIX SOME ICON ISSUES
|
|
173
|
+
p(_a) {
|
|
174
|
+
var _b, _c;
|
|
175
|
+
var { children, node } = _a, props = __rest(_a, ["children", "node"]);
|
|
176
|
+
const isFirstElement = ((_c = (_b = node === null || node === void 0 ? void 0 : node.position) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.offset) === 0;
|
|
177
|
+
// Check if children contain known block-level components, to prevent hydration error.
|
|
178
|
+
const blockComponents = [
|
|
179
|
+
CalloutCheck,
|
|
180
|
+
CalloutError,
|
|
181
|
+
CalloutInfo,
|
|
182
|
+
CalloutNote,
|
|
183
|
+
CalloutTip,
|
|
184
|
+
CalloutWarning,
|
|
185
|
+
];
|
|
186
|
+
const hasBlockElementChild = React.Children.toArray(children).some((child) => React.isValidElement(child) &&
|
|
187
|
+
blockComponents.includes(child.type));
|
|
188
|
+
if (hasBlockElementChild) {
|
|
189
|
+
// If there's a block-level component, don't wrap in <p>, just return a <div> or fragment
|
|
190
|
+
return React.createElement("div", Object.assign({}, props), children);
|
|
191
|
+
}
|
|
192
|
+
return (React.createElement("div", Object.assign({ className: cn("leading-6 text-zinc-700 dark:text-zinc-300 text-sm", !isFirstElement && "mt-5") }, props), children));
|
|
193
|
+
},
|
|
194
|
+
// List
|
|
195
|
+
li({ children }) {
|
|
196
|
+
return (React.createElement("li", { className: "text-zinc-700 dark:text-zinc-300 leading-7 text-sm" }, children));
|
|
197
|
+
},
|
|
198
|
+
// Unordered List
|
|
199
|
+
ul({ children }) {
|
|
200
|
+
return (React.createElement("ul", { className: "my-4 ml-6 list-disc marker:text-zinc-400" }, children));
|
|
201
|
+
},
|
|
202
|
+
// Ordered List
|
|
203
|
+
ol({ children }) {
|
|
204
|
+
return (React.createElement("ol", { className: "my-4 ml-6 list-decimal marker:text-zinc-400" }, children));
|
|
205
|
+
},
|
|
206
|
+
a(_a) {
|
|
207
|
+
var { children, href } = _a, props = __rest(_a, ["children", "href"]);
|
|
208
|
+
const isInternal = href === null || href === void 0 ? void 0 : href.startsWith("#");
|
|
209
|
+
return (React.createElement("a", Object.assign({ className: cn("font-medium transition-colors underline underline-offset-4", isInternal
|
|
210
|
+
? "text-zinc-900 hover:text-zinc-700 dark:text-zinc-100 dark:hover:text-zinc-300"
|
|
211
|
+
: "text-[var(--colors-primary)] hover:text-[var(--colors-primary)]"), target: isInternal ? undefined : "_blank", rel: isInternal ? undefined : "noopener noreferrer", href: href }, props), children));
|
|
212
|
+
},
|
|
213
|
+
// "> This is ÷a quote"
|
|
214
|
+
blockquote({ children }) {
|
|
215
|
+
return (React.createElement("blockquote", { className: "mt-4 border-l-4 border-zinc-200 dark:border-zinc-800 pl-6 italic text-zinc-800 dark:text-zinc-200" }, children));
|
|
216
|
+
},
|
|
217
|
+
code(_a) {
|
|
218
|
+
var _b, _c;
|
|
219
|
+
var { node, inline, className, children } = _a, props = __rest(_a, ["node", "inline", "className", "children"]);
|
|
220
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
221
|
+
const isInline = ((_b = node.position) === null || _b === void 0 ? void 0 : _b.start.line) === ((_c = node.position) === null || _c === void 0 ? void 0 : _c.end.line);
|
|
222
|
+
// If it's an inline code block, render it as a small block by default
|
|
223
|
+
// so it visually separates from the surrounding text instead of sitting inline.
|
|
224
|
+
if (isInline) {
|
|
225
|
+
return (React.createElement("code", Object.assign({ className: cn("inline-block text-[var(--colors-primary)] text-sm bg-[var(--colors-secondary)] px-2 py-1 rounded-lg mt-2", className) }, props), children));
|
|
226
|
+
}
|
|
227
|
+
// Extract language and title
|
|
228
|
+
const language = (match === null || match === void 0 ? void 0 : match[1]) || "";
|
|
229
|
+
// Look for title in the className (format: language-js title.js)
|
|
230
|
+
const parts = (className === null || className === void 0 ? void 0 : className.split(" ")) || [];
|
|
231
|
+
const title = parts[1] || `${language}`;
|
|
232
|
+
return match ? (React.createElement(CodeBlock, Object.assign({ language: language, value: String(children).trim(), isInsideCodeGroup: false, title: title, className: "my-5" }, props))) : (
|
|
233
|
+
// <code className={className} {...props}>
|
|
234
|
+
// {children}
|
|
235
|
+
// </code>
|
|
236
|
+
React.createElement(CodeBlock, Object.assign({ language: "", value: String(children).trim(), isInsideCodeGroup: false, title: "", className: "my-5" }, props)));
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
return (React.createElement("div", { className: "mx-auto min-w-0" },
|
|
240
|
+
React.createElement(MemoizedReactMarkdown, { className: cn("prose prose-slate dark:prose-invert max-w-none", "prose-headings:font-semibold prose-headings:tracking-tight", "[&>*:first-child]:mt-0", "prose-p:leading-7", "prose-li:leading-7", "prose-code:rounded-md prose-code:bg-zinc-100 dark:prose-code:bg-zinc-800 prose-code:px-2 prose-code:py-1", "prose-pre:rounded-lg prose-pre:border prose-pre:border-zinc-200 dark:prose-pre:border-zinc-800", "prose-img:rounded-lg prose-img:border prose-img:border-zinc-200 dark:prose-img:border-zinc-800", "prose-blockquote:border-l-4 prose-blockquote:border-zinc-200 dark:prose-blockquote:border-zinc-800", "prose-table:border prose-table:border-zinc-200 dark:prose-table:border-zinc-800", "prose-a:no-underline hover:prose-a:underline", className), remarkPlugins: [
|
|
241
|
+
remarkGfm,
|
|
242
|
+
remarkMath,
|
|
243
|
+
// add remarkMdx to the remarkPlugins array
|
|
244
|
+
// remarkMdx,
|
|
245
|
+
], rehypePlugins: [rehypeRaw], components: isRestricted
|
|
246
|
+
? sharedComponents
|
|
247
|
+
: Object.assign(Object.assign({}, sharedComponents), { h1: headingRenderer(1), h2: headingRenderer(2), h3: headingRenderer(3), h4: headingRenderer(4), table({ children }) {
|
|
248
|
+
return (React.createElement("div", { className: "my-6 w-full overflow-x-auto rounded-lg" },
|
|
249
|
+
React.createElement("table", { className: "w-full border-collapse border border-zinc-200 dark:border-zinc-800" }, children)));
|
|
250
|
+
},
|
|
251
|
+
th({ children }) {
|
|
252
|
+
return (React.createElement("th", { className: "border border-zinc-200 dark:border-zinc-800 px-4 py-2 text-left font-semibold bg-zinc-50 dark:bg-zinc-900" }, children));
|
|
253
|
+
},
|
|
254
|
+
td({ children }) {
|
|
255
|
+
return (React.createElement("td", { className: "border border-zinc-200 dark:border-zinc-800 px-4 py-2" }, children));
|
|
256
|
+
} }) }, children)));
|
|
257
|
+
};
|
|
258
|
+
// import React, { FC, useEffect, useState } from "react";
|
|
259
|
+
// import { cn } from "@/lib/utils";
|
|
260
|
+
// import { MDXProvider } from "@mdx-js/react";
|
|
261
|
+
// import { evaluate } from "@mdx-js/mdx";
|
|
262
|
+
// import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
263
|
+
// import remarkGfm from "remark-gfm";
|
|
264
|
+
// import remarkMath from "remark-math";
|
|
265
|
+
// import rehypeRaw from "rehype-raw";
|
|
266
|
+
// // Import your custom components
|
|
267
|
+
// import { CodeGroup } from "./markdown/code-group";
|
|
268
|
+
// import { CodeBlock } from "./markdown/code-group/code-block";
|
|
269
|
+
// import { Accordion } from "./markdown/accordion-group/accordion";
|
|
270
|
+
// import { AccordionGroup } from "./markdown/accordion-group";
|
|
271
|
+
// import { CalloutCheck } from "./markdown/callout/callout-check";
|
|
272
|
+
// import { CalloutError } from "./markdown/callout/callout-error";
|
|
273
|
+
// import { CalloutInfo } from "./markdown/callout/callout-info";
|
|
274
|
+
// import { CalloutNote } from "./markdown/callout/callout-note";
|
|
275
|
+
// import { CalloutTip } from "./markdown/callout/callout-tip";
|
|
276
|
+
// import { CalloutWarning } from "./markdown/callout/callout-warning";
|
|
277
|
+
// import { CardGroup } from "./markdown/card-group";
|
|
278
|
+
// import { Card } from "./markdown/card-group/card";
|
|
279
|
+
// import { Icon } from "./markdown/icon";
|
|
280
|
+
// const createId = (text: string) => {
|
|
281
|
+
// return text
|
|
282
|
+
// .toLowerCase()
|
|
283
|
+
// .replace(/[^a-z0-9]+/g, "-")
|
|
284
|
+
// .replace(/(^-|-$)/g, "");
|
|
285
|
+
// };
|
|
286
|
+
// export const Markdown: FC<{
|
|
287
|
+
// children: string;
|
|
288
|
+
// className?: string;
|
|
289
|
+
// isRestricted?: boolean;
|
|
290
|
+
// showToc?: boolean;
|
|
291
|
+
// }> = ({ children, className, isRestricted }) => {
|
|
292
|
+
// const [MDXContent, setMDXContent] = useState<React.ComponentType | null>(
|
|
293
|
+
// null,
|
|
294
|
+
// );
|
|
295
|
+
// useEffect(() => {
|
|
296
|
+
// let isMounted = true;
|
|
297
|
+
// (async () => {
|
|
298
|
+
// try {
|
|
299
|
+
// const { default: Content } = await evaluate(children, {
|
|
300
|
+
// jsx,
|
|
301
|
+
// jsxs,
|
|
302
|
+
// Fragment,
|
|
303
|
+
// remarkPlugins: [remarkGfm],
|
|
304
|
+
// rehypePlugins: [rehypeRaw],
|
|
305
|
+
// });
|
|
306
|
+
// if (isMounted) setMDXContent(() => Content);
|
|
307
|
+
// } catch (err) {
|
|
308
|
+
// console.error("MDX Evaluation Error:", err); // Log evaluation errors
|
|
309
|
+
// }
|
|
310
|
+
// })();
|
|
311
|
+
// return () => {
|
|
312
|
+
// isMounted = false;
|
|
313
|
+
// };
|
|
314
|
+
// }, [children]);
|
|
315
|
+
// // Define shared components
|
|
316
|
+
// const sharedComponents = {
|
|
317
|
+
// codegroup: CodeGroup,
|
|
318
|
+
// codeblock: CodeBlock,
|
|
319
|
+
// accordiongroup: AccordionGroup,
|
|
320
|
+
// accordion: Accordion,
|
|
321
|
+
// check: CalloutCheck,
|
|
322
|
+
// error: CalloutError,
|
|
323
|
+
// info: CalloutInfo,
|
|
324
|
+
// note: CalloutNote,
|
|
325
|
+
// tip: CalloutTip,
|
|
326
|
+
// warning: CalloutWarning,
|
|
327
|
+
// cardgroup: CardGroup,
|
|
328
|
+
// card: Card,
|
|
329
|
+
// icon: Icon,
|
|
330
|
+
// p: ({ children, ...props }) => (
|
|
331
|
+
// <p
|
|
332
|
+
// className={cn("leading-6 text-zinc-700 dark:text-zinc-300")}
|
|
333
|
+
// {...props}
|
|
334
|
+
// >
|
|
335
|
+
// {children}
|
|
336
|
+
// </p>
|
|
337
|
+
// ),
|
|
338
|
+
// li: ({ children, ...props }) => (
|
|
339
|
+
// <li className="text-zinc-700 dark:text-zinc-300 leading-7" {...props}>
|
|
340
|
+
// {children}
|
|
341
|
+
// </li>
|
|
342
|
+
// ),
|
|
343
|
+
// ul: ({ children, ...props }) => (
|
|
344
|
+
// <ul className="my-4 ml-6 list-disc marker:text-zinc-400" {...props}>
|
|
345
|
+
// {children}
|
|
346
|
+
// </ul>
|
|
347
|
+
// ),
|
|
348
|
+
// ol: ({ children, ...props }) => (
|
|
349
|
+
// <ol className="my-4 ml-6 list-decimal marker:text-zinc-400" {...props}>
|
|
350
|
+
// {children}
|
|
351
|
+
// </ol>
|
|
352
|
+
// ),
|
|
353
|
+
// a: ({ children, href, ...props }) => {
|
|
354
|
+
// const isInternal = href?.startsWith("#");
|
|
355
|
+
// return (
|
|
356
|
+
// <a
|
|
357
|
+
// className={cn(
|
|
358
|
+
// "font-medium transition-colors underline-offset-4 hover:underline",
|
|
359
|
+
// isInternal
|
|
360
|
+
// ? "text-zinc-900 hover:text-zinc-700 dark:text-zinc-100 dark:hover:text-zinc-300"
|
|
361
|
+
// : "text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300",
|
|
362
|
+
// )}
|
|
363
|
+
// target={isInternal ? undefined : "_blank"}
|
|
364
|
+
// rel={isInternal ? undefined : "noopener noreferrer"}
|
|
365
|
+
// href={href}
|
|
366
|
+
// {...props}
|
|
367
|
+
// >
|
|
368
|
+
// {children}
|
|
369
|
+
// </a>
|
|
370
|
+
// );
|
|
371
|
+
// },
|
|
372
|
+
// blockquote: ({ children, ...props }) => (
|
|
373
|
+
// <blockquote
|
|
374
|
+
// className="mt-4 border-l-4 border-zinc-200 dark:border-zinc-800 pl-6 italic text-zinc-800 dark:text-zinc-200"
|
|
375
|
+
// {...props}
|
|
376
|
+
// >
|
|
377
|
+
// {children}
|
|
378
|
+
// </blockquote>
|
|
379
|
+
// ),
|
|
380
|
+
// code: ({ children, className, ...props }) => {
|
|
381
|
+
// const match = /language-(\w+)/.exec(className || "");
|
|
382
|
+
// const language = match?.[1] || "";
|
|
383
|
+
// return (
|
|
384
|
+
// <CodeBlock
|
|
385
|
+
// language={language}
|
|
386
|
+
// value={String(children).trim()}
|
|
387
|
+
// isInsideCodeGroup={false}
|
|
388
|
+
// {...props}
|
|
389
|
+
// />
|
|
390
|
+
// );
|
|
391
|
+
// },
|
|
392
|
+
// table: ({ children, ...props }) => (
|
|
393
|
+
// <div className="my-6 w-full overflow-x-auto rounded-lg">
|
|
394
|
+
// <table
|
|
395
|
+
// className="w-full border-collapse border border-zinc-200 dark:border-zinc-800"
|
|
396
|
+
// {...props}
|
|
397
|
+
// >
|
|
398
|
+
// {children}
|
|
399
|
+
// </table>
|
|
400
|
+
// </div>
|
|
401
|
+
// ),
|
|
402
|
+
// th: ({ children, ...props }) => (
|
|
403
|
+
// <th
|
|
404
|
+
// className="border border-zinc-200 dark:border-zinc-800 px-4 py-2 text-left font-semibold bg-zinc-50 dark:bg-zinc-900"
|
|
405
|
+
// {...props}
|
|
406
|
+
// >
|
|
407
|
+
// {children}
|
|
408
|
+
// </th>
|
|
409
|
+
// ),
|
|
410
|
+
// td: ({ children, ...props }) => (
|
|
411
|
+
// <td
|
|
412
|
+
// className="border border-zinc-200 dark:border-zinc-800 px-4 py-2"
|
|
413
|
+
// {...props}
|
|
414
|
+
// >
|
|
415
|
+
// {children}
|
|
416
|
+
// </td>
|
|
417
|
+
// ),
|
|
418
|
+
// };
|
|
419
|
+
// // If not restricted, add headings
|
|
420
|
+
// const components = isRestricted
|
|
421
|
+
// ? sharedComponents
|
|
422
|
+
// : {
|
|
423
|
+
// ...sharedComponents,
|
|
424
|
+
// h1: ({ children, ...props }) => {
|
|
425
|
+
// const text = String(children);
|
|
426
|
+
// const id = createId(text);
|
|
427
|
+
// return (
|
|
428
|
+
// <h1
|
|
429
|
+
// id={id}
|
|
430
|
+
// className="scroll-m-20 text-3xl font-bold tracking-tight lg:text-3xl mb-4 text-zinc-900 dark:text-zinc-50"
|
|
431
|
+
// {...props}
|
|
432
|
+
// >
|
|
433
|
+
// <a
|
|
434
|
+
// href={`#${id}`}
|
|
435
|
+
// className="no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400"
|
|
436
|
+
// >
|
|
437
|
+
// {children}
|
|
438
|
+
// </a>
|
|
439
|
+
// </h1>
|
|
440
|
+
// );
|
|
441
|
+
// },
|
|
442
|
+
// h2: ({ children, ...props }) => {
|
|
443
|
+
// const text = String(children);
|
|
444
|
+
// const id = createId(text);
|
|
445
|
+
// return (
|
|
446
|
+
// <h2
|
|
447
|
+
// id={id}
|
|
448
|
+
// className="scroll-m-20 text-2xl font-bold tracking-tight mb-3 text-zinc-900 dark:text-zinc-50"
|
|
449
|
+
// {...props}
|
|
450
|
+
// >
|
|
451
|
+
// <a
|
|
452
|
+
// href={`#${id}`}
|
|
453
|
+
// className="no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400"
|
|
454
|
+
// >
|
|
455
|
+
// {children}
|
|
456
|
+
// </a>
|
|
457
|
+
// </h2>
|
|
458
|
+
// );
|
|
459
|
+
// },
|
|
460
|
+
// h3: ({ children, ...props }) => {
|
|
461
|
+
// const text = String(children);
|
|
462
|
+
// const id = createId(text);
|
|
463
|
+
// return (
|
|
464
|
+
// <h3
|
|
465
|
+
// id={id}
|
|
466
|
+
// className="scroll-m-20 text-xl font-bold tracking-tight mb-3 text-zinc-900 dark:text-zinc-50"
|
|
467
|
+
// {...props}
|
|
468
|
+
// >
|
|
469
|
+
// <a
|
|
470
|
+
// href={`#${id}`}
|
|
471
|
+
// className="no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400"
|
|
472
|
+
// >
|
|
473
|
+
// {children}
|
|
474
|
+
// </a>
|
|
475
|
+
// </h3>
|
|
476
|
+
// );
|
|
477
|
+
// },
|
|
478
|
+
// h4: ({ children, ...props }) => {
|
|
479
|
+
// const text = String(children);
|
|
480
|
+
// const id = createId(text);
|
|
481
|
+
// return (
|
|
482
|
+
// <h4
|
|
483
|
+
// id={id}
|
|
484
|
+
// className="scroll-m-20 text-lg font-bold tracking-tight mb-3 text-zinc-900 dark:text-zinc-50"
|
|
485
|
+
// {...props}
|
|
486
|
+
// >
|
|
487
|
+
// <a
|
|
488
|
+
// href={`#${id}`}
|
|
489
|
+
// className="no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400"
|
|
490
|
+
// >
|
|
491
|
+
// {children}
|
|
492
|
+
// </a>
|
|
493
|
+
// </h4>
|
|
494
|
+
// );
|
|
495
|
+
// },
|
|
496
|
+
// };
|
|
497
|
+
// return (
|
|
498
|
+
// <div
|
|
499
|
+
// className={cn(
|
|
500
|
+
// "mx-auto min-w-0",
|
|
501
|
+
// "prose prose-slate dark:prose-invert max-w-none",
|
|
502
|
+
// "prose-headings:font-semibold prose-headings:tracking-tight",
|
|
503
|
+
// "[&>*:first-child]:mt-0",
|
|
504
|
+
// "prose-p:leading-7",
|
|
505
|
+
// "prose-li:leading-7",
|
|
506
|
+
// "prose-code:rounded-md prose-code:bg-zinc-100 dark:prose-code:bg-zinc-800 prose-code:px-2 prose-code:py-1",
|
|
507
|
+
// "prose-pre:rounded-lg prose-pre:border prose-pre:border-zinc-200 dark:prose-pre:border-zinc-800",
|
|
508
|
+
// "prose-img:rounded-lg prose-img:border prose-img:border-zinc-200 dark:prose-img:border-zinc-800",
|
|
509
|
+
// "prose-blockquote:border-l-4 prose-blockquote:border-zinc-200 dark:prose-blockquote:border-zinc-800",
|
|
510
|
+
// "prose-table:border prose-table:border-zinc-200 dark:prose-table:border-zinc-800",
|
|
511
|
+
// "prose-a:no-underline hover:prose-a:underline",
|
|
512
|
+
// className,
|
|
513
|
+
// )}
|
|
514
|
+
// >
|
|
515
|
+
// <MDXProvider components={components}>
|
|
516
|
+
// {/* Render the evaluated component only after it's loaded */}
|
|
517
|
+
// {MDXContent ? <MDXContent /> : null}
|
|
518
|
+
// </MDXProvider>
|
|
519
|
+
// </div>
|
|
520
|
+
// );
|
|
521
|
+
// };
|
|
522
|
+
//v3
|
|
523
|
+
// import React, { FC, useEffect, useState } from "react";
|
|
524
|
+
// import { cn } from "@/lib/utils";
|
|
525
|
+
// import { MDXProvider } from "@mdx-js/react";
|
|
526
|
+
// import { evaluate } from "@mdx-js/mdx";
|
|
527
|
+
// import * as runtime from "react/jsx-runtime"; // Use the entire runtime
|
|
528
|
+
// import remarkGfm from "remark-gfm";
|
|
529
|
+
// import remarkMath from "remark-math";
|
|
530
|
+
// import rehypeRaw from "rehype-raw";
|
|
531
|
+
// // Import your custom components
|
|
532
|
+
// import { CodeGroup } from "./markdown/code-group";
|
|
533
|
+
// import { CodeBlock } from "./markdown/code-group/code-block";
|
|
534
|
+
// import { Accordion } from "./markdown/accordion-group/accordion";
|
|
535
|
+
// import { AccordionGroup } from "./markdown/accordion-group";
|
|
536
|
+
// import { CalloutCheck } from "./markdown/callout/callout-check";
|
|
537
|
+
// import { CalloutError } from "./markdown/callout/callout-error";
|
|
538
|
+
// import { CalloutInfo } from "./markdown/callout/callout-info";
|
|
539
|
+
// import { CalloutNote } from "./markdown/callout/callout-note";
|
|
540
|
+
// import { CalloutTip } from "./markdown/callout/callout-tip";
|
|
541
|
+
// import { CalloutWarning } from "./markdown/callout/callout-warning";
|
|
542
|
+
// import { CardGroup } from "./markdown/card-group";
|
|
543
|
+
// import { Card } from "./markdown/card-group/card";
|
|
544
|
+
// import { Icon } from "./markdown/icon";
|
|
545
|
+
// const createId = (text: string) => {
|
|
546
|
+
// return text
|
|
547
|
+
// .toLowerCase()
|
|
548
|
+
// .replace(/[^a-z0-9]+/g, "-")
|
|
549
|
+
// .replace(/(^-|-$)/g, "");
|
|
550
|
+
// };
|
|
551
|
+
// export const Markdown: FC<{
|
|
552
|
+
// children: string;
|
|
553
|
+
// className?: string;
|
|
554
|
+
// isRestricted?: boolean;
|
|
555
|
+
// showToc?: boolean;
|
|
556
|
+
// }> = ({ children, className, isRestricted }) => {
|
|
557
|
+
// const [MDXContent, setMDXContent] = useState<React.ComponentType | null>(
|
|
558
|
+
// null,
|
|
559
|
+
// );
|
|
560
|
+
// useEffect(() => {
|
|
561
|
+
// let isMounted = true;
|
|
562
|
+
// (async () => {
|
|
563
|
+
// try {
|
|
564
|
+
// const { default: Content } = await evaluate(children, {
|
|
565
|
+
// ...runtime,
|
|
566
|
+
// remarkPlugins: [remarkGfm, remarkMath],
|
|
567
|
+
// rehypePlugins: [rehypeRaw],
|
|
568
|
+
// development: true, // Adds helpful debugging
|
|
569
|
+
// format: "mdx", // Ensures MDX format
|
|
570
|
+
// });
|
|
571
|
+
// if (isMounted) setMDXContent(() => Content);
|
|
572
|
+
// } catch (err) {
|
|
573
|
+
// console.error("MDX Evaluation Error:", err); // Log evaluation errors
|
|
574
|
+
// }
|
|
575
|
+
// })();
|
|
576
|
+
// return () => {
|
|
577
|
+
// isMounted = false;
|
|
578
|
+
// };
|
|
579
|
+
// }, [children]);
|
|
580
|
+
// // Define shared components
|
|
581
|
+
// const sharedComponents = {
|
|
582
|
+
// codegroup: CodeGroup,
|
|
583
|
+
// codeblock: CodeBlock,
|
|
584
|
+
// accordiongroup: AccordionGroup,
|
|
585
|
+
// accordion: Accordion,
|
|
586
|
+
// check: CalloutCheck,
|
|
587
|
+
// error: CalloutError,
|
|
588
|
+
// info: CalloutInfo,
|
|
589
|
+
// note: CalloutNote,
|
|
590
|
+
// tip: CalloutTip,
|
|
591
|
+
// warning: CalloutWarning,
|
|
592
|
+
// cardgroup: CardGroup,
|
|
593
|
+
// card: Card,
|
|
594
|
+
// icon: Icon,
|
|
595
|
+
// p: ({ children, ...props }) => (
|
|
596
|
+
// <p
|
|
597
|
+
// className={cn("leading-6 text-zinc-700 dark:text-zinc-300")}
|
|
598
|
+
// {...props}
|
|
599
|
+
// >
|
|
600
|
+
// {children}
|
|
601
|
+
// </p>
|
|
602
|
+
// ),
|
|
603
|
+
// li: ({ children, ...props }) => (
|
|
604
|
+
// <li className="text-zinc-700 dark:text-zinc-300 leading-7" {...props}>
|
|
605
|
+
// {children}
|
|
606
|
+
// </li>
|
|
607
|
+
// ),
|
|
608
|
+
// ul: ({ children, ...props }) => (
|
|
609
|
+
// <ul className="my-4 ml-6 list-disc marker:text-zinc-400" {...props}>
|
|
610
|
+
// {children}
|
|
611
|
+
// </ul>
|
|
612
|
+
// ),
|
|
613
|
+
// ol: ({ children, ...props }) => (
|
|
614
|
+
// <ol className="my-4 ml-6 list-decimal marker:text-zinc-400" {...props}>
|
|
615
|
+
// {children}
|
|
616
|
+
// </ol>
|
|
617
|
+
// ),
|
|
618
|
+
// a: ({ children, href, ...props }) => {
|
|
619
|
+
// const isInternal = href?.startsWith("#");
|
|
620
|
+
// return (
|
|
621
|
+
// <a
|
|
622
|
+
// className={cn(
|
|
623
|
+
// "font-medium transition-colors underline-offset-4 hover:underline",
|
|
624
|
+
// isInternal
|
|
625
|
+
// ? "text-zinc-900 hover:text-zinc-700 dark:text-zinc-100 dark:hover:text-zinc-300"
|
|
626
|
+
// : "text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300",
|
|
627
|
+
// )}
|
|
628
|
+
// target={isInternal ? undefined : "_blank"}
|
|
629
|
+
// rel={isInternal ? undefined : "noopener noreferrer"}
|
|
630
|
+
// href={href}
|
|
631
|
+
// {...props}
|
|
632
|
+
// >
|
|
633
|
+
// {children}
|
|
634
|
+
// </a>
|
|
635
|
+
// );
|
|
636
|
+
// },
|
|
637
|
+
// blockquote: ({ children, ...props }) => (
|
|
638
|
+
// <blockquote
|
|
639
|
+
// className="mt-4 border-l-4 border-zinc-200 dark:border-zinc-800 pl-6 italic text-zinc-800 dark:text-zinc-200"
|
|
640
|
+
// {...props}
|
|
641
|
+
// >
|
|
642
|
+
// {children}
|
|
643
|
+
// </blockquote>
|
|
644
|
+
// ),
|
|
645
|
+
// code: ({ children, className, ...props }) => {
|
|
646
|
+
// const match = /language-(\w+)/.exec(className || "");
|
|
647
|
+
// const language = match?.[1] || "";
|
|
648
|
+
// return (
|
|
649
|
+
// <CodeBlock
|
|
650
|
+
// language={language}
|
|
651
|
+
// value={String(children).trim()}
|
|
652
|
+
// isInsideCodeGroup={false}
|
|
653
|
+
// {...props}
|
|
654
|
+
// />
|
|
655
|
+
// );
|
|
656
|
+
// },
|
|
657
|
+
// table: ({ children, ...props }) => (
|
|
658
|
+
// <div className="my-6 w-full overflow-x-auto rounded-lg">
|
|
659
|
+
// <table
|
|
660
|
+
// className="w-full border-collapse border border-zinc-200 dark:border-zinc-800"
|
|
661
|
+
// {...props}
|
|
662
|
+
// >
|
|
663
|
+
// {children}
|
|
664
|
+
// </table>
|
|
665
|
+
// </div>
|
|
666
|
+
// ),
|
|
667
|
+
// th: ({ children, ...props }) => (
|
|
668
|
+
// <th
|
|
669
|
+
// className="border border-zinc-200 dark:border-zinc-800 px-4 py-2 text-left font-semibold bg-zinc-50 dark:bg-zinc-900"
|
|
670
|
+
// {...props}
|
|
671
|
+
// >
|
|
672
|
+
// {children}
|
|
673
|
+
// </th>
|
|
674
|
+
// ),
|
|
675
|
+
// td: ({ children, ...props }) => (
|
|
676
|
+
// <td
|
|
677
|
+
// className="border border-zinc-200 dark:border-zinc-800 px-4 py-2"
|
|
678
|
+
// {...props}
|
|
679
|
+
// >
|
|
680
|
+
// {children}
|
|
681
|
+
// </td>
|
|
682
|
+
// ),
|
|
683
|
+
// };
|
|
684
|
+
// // If not restricted, add headings
|
|
685
|
+
// const components = isRestricted
|
|
686
|
+
// ? sharedComponents
|
|
687
|
+
// : {
|
|
688
|
+
// ...sharedComponents,
|
|
689
|
+
// h1: ({ children, ...props }) => {
|
|
690
|
+
// const text = String(children);
|
|
691
|
+
// const id = createId(text);
|
|
692
|
+
// return (
|
|
693
|
+
// <h1
|
|
694
|
+
// id={id}
|
|
695
|
+
// className="scroll-m-20 text-3xl font-bold tracking-tight lg:text-3xl mb-4 text-zinc-900 dark:text-zinc-50"
|
|
696
|
+
// {...props}
|
|
697
|
+
// >
|
|
698
|
+
// <a
|
|
699
|
+
// href={`#${id}`}
|
|
700
|
+
// className="no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400"
|
|
701
|
+
// >
|
|
702
|
+
// {children}
|
|
703
|
+
// </a>
|
|
704
|
+
// </h1>
|
|
705
|
+
// );
|
|
706
|
+
// },
|
|
707
|
+
// h2: ({ children, ...props }) => {
|
|
708
|
+
// const text = String(children);
|
|
709
|
+
// const id = createId(text);
|
|
710
|
+
// return (
|
|
711
|
+
// <h2
|
|
712
|
+
// id={id}
|
|
713
|
+
// className="scroll-m-20 text-2xl font-bold tracking-tight mb-3 text-zinc-900 dark:text-zinc-50"
|
|
714
|
+
// {...props}
|
|
715
|
+
// >
|
|
716
|
+
// <a
|
|
717
|
+
// href={`#${id}`}
|
|
718
|
+
// className="no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400"
|
|
719
|
+
// >
|
|
720
|
+
// {children}
|
|
721
|
+
// </a>
|
|
722
|
+
// </h2>
|
|
723
|
+
// );
|
|
724
|
+
// },
|
|
725
|
+
// h3: ({ children, ...props }) => {
|
|
726
|
+
// const text = String(children);
|
|
727
|
+
// const id = createId(text);
|
|
728
|
+
// return (
|
|
729
|
+
// <h3
|
|
730
|
+
// id={id}
|
|
731
|
+
// className="scroll-m-20 text-xl font-bold tracking-tight mb-3 text-zinc-900 dark:text-zinc-50"
|
|
732
|
+
// {...props}
|
|
733
|
+
// >
|
|
734
|
+
// <a
|
|
735
|
+
// href={`#${id}`}
|
|
736
|
+
// className="no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400"
|
|
737
|
+
// >
|
|
738
|
+
// {children}
|
|
739
|
+
// </a>
|
|
740
|
+
// </h3>
|
|
741
|
+
// );
|
|
742
|
+
// },
|
|
743
|
+
// h4: ({ children, ...props }) => {
|
|
744
|
+
// const text = String(children);
|
|
745
|
+
// const id = createId(text);
|
|
746
|
+
// return (
|
|
747
|
+
// <h4
|
|
748
|
+
// id={id}
|
|
749
|
+
// className="scroll-m-20 text-lg font-bold tracking-tight mb-3 text-zinc-900 dark:text-zinc-50"
|
|
750
|
+
// {...props}
|
|
751
|
+
// >
|
|
752
|
+
// <a
|
|
753
|
+
// href={`#${id}`}
|
|
754
|
+
// className="no-underline hover:after:content-['#'] hover:after:ml-2 hover:after:text-zinc-400"
|
|
755
|
+
// >
|
|
756
|
+
// {children}
|
|
757
|
+
// </a>
|
|
758
|
+
// </h4>
|
|
759
|
+
// );
|
|
760
|
+
// },
|
|
761
|
+
// };
|
|
762
|
+
// return (
|
|
763
|
+
// <div
|
|
764
|
+
// className={cn(
|
|
765
|
+
// "mx-auto min-w-0",
|
|
766
|
+
// "prose prose-slate dark:prose-invert max-w-none",
|
|
767
|
+
// "prose-headings:font-semibold prose-headings:tracking-tight",
|
|
768
|
+
// "[&>*:first-child]:mt-0",
|
|
769
|
+
// "prose-p:leading-7",
|
|
770
|
+
// "prose-li:leading-7",
|
|
771
|
+
// "prose-code:rounded-md prose-code:bg-zinc-100 dark:prose-code:bg-zinc-800 prose-code:px-2 prose-code:py-1",
|
|
772
|
+
// "prose-pre:rounded-lg prose-pre:border prose-pre:border-zinc-200 dark:prose-pre:border-zinc-800",
|
|
773
|
+
// "prose-img:rounded-lg prose-img:border prose-img:border-zinc-200 dark:prose-img:border-zinc-800",
|
|
774
|
+
// "prose-blockquote:border-l-4 prose-blockquote:border-zinc-200 dark:prose-blockquote:border-zinc-800",
|
|
775
|
+
// "prose-table:border prose-table:border-zinc-200 dark:prose-table:border-zinc-800",
|
|
776
|
+
// "prose-a:no-underline hover:prose-a:underline",
|
|
777
|
+
// className,
|
|
778
|
+
// )}
|
|
779
|
+
// >
|
|
780
|
+
// <MDXProvider components={components}>
|
|
781
|
+
// {/* Render the evaluated component only after it's loaded */}
|
|
782
|
+
// {MDXContent ? <MDXContent /> : null}
|
|
783
|
+
// </MDXProvider>
|
|
784
|
+
// </div>
|
|
785
|
+
// );
|
|
786
|
+
// };
|