From bc297e5e496d9f48ef77581b7fb41fdf328a62cf Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 15 Mar 2026 16:19:35 -0400 Subject: refactor: dev-docs/ --- dev-docs/src/theme/MDXComponents.js | 11 +++++++++ dev-docs/src/theme/ReactLiveScope/index.js | 38 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 dev-docs/src/theme/MDXComponents.js create mode 100644 dev-docs/src/theme/ReactLiveScope/index.js (limited to 'dev-docs/src/theme') diff --git a/dev-docs/src/theme/MDXComponents.js b/dev-docs/src/theme/MDXComponents.js new file mode 100644 index 0000000..3523430 --- /dev/null +++ b/dev-docs/src/theme/MDXComponents.js @@ -0,0 +1,11 @@ +// Import the original mapper +import MDXComponents from "@theme-original/MDXComponents"; +import Highlight from "@site/src/components/Highlight"; + +export default { + // Re-use the default mapping + ...MDXComponents, + // Map the "highlight" tag to our component! + // `Highlight` will receive all props that were passed to `highlight` in MDX + highlight: Highlight, +}; diff --git a/dev-docs/src/theme/ReactLiveScope/index.js b/dev-docs/src/theme/ReactLiveScope/index.js new file mode 100644 index 0000000..ca5a902 --- /dev/null +++ b/dev-docs/src/theme/ReactLiveScope/index.js @@ -0,0 +1,38 @@ +import React from "react"; +import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment"; +import initialData from "@site/src/initialData"; +import { useColorMode } from "@docusaurus/theme-common"; + +import "@excalidraw/excalidraw/index.css"; + +let ExcalidrawComp = {}; +if (ExecutionEnvironment.canUseDOM) { + ExcalidrawComp = require("@excalidraw/excalidraw"); +} +const Excalidraw = React.forwardRef((props, ref) => { + if (!window.EXCALIDRAW_ASSET_PATH) { + window.EXCALIDRAW_ASSET_PATH = + "https://esm.sh/@excalidraw/excalidraw@0.18.0/dist/prod/"; + } + + const { colorMode } = useColorMode(); + return ; +}); +// Add react-live imports you need here +const ExcalidrawScope = { + React, + ...React, + Excalidraw, + Footer: ExcalidrawComp.Footer, + useDevice: ExcalidrawComp.useDevice, + MainMenu: ExcalidrawComp.MainMenu, + WelcomeScreen: ExcalidrawComp.WelcomeScreen, + LiveCollaborationTrigger: ExcalidrawComp.LiveCollaborationTrigger, + Sidebar: ExcalidrawComp.Sidebar, + exportToCanvas: ExcalidrawComp.exportToCanvas, + initialData, + useI18n: ExcalidrawComp.useI18n, + convertToExcalidrawElements: ExcalidrawComp.convertToExcalidrawElements, +}; + +export default ExcalidrawScope; -- cgit v1.2.3