@conloca/mdx 0.1.15 → 0.1.16

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 (44) hide show
  1. package/README.md +15 -5
  2. package/dist/blocks.d.ts +37 -0
  3. package/dist/blocks.d.ts.map +1 -0
  4. package/dist/blocks.js +51 -0
  5. package/dist/code-block-frame.d.ts +41 -0
  6. package/dist/code-block-frame.d.ts.map +1 -0
  7. package/dist/code-block-frame.js +186 -0
  8. package/dist/editor-core.d.ts +58 -0
  9. package/dist/editor-core.d.ts.map +1 -0
  10. package/dist/editor-core.js +181 -0
  11. package/dist/hooks/useMDXEvaluation.d.ts +28 -0
  12. package/dist/hooks/useMDXEvaluation.d.ts.map +1 -0
  13. package/dist/hooks/useMDXEvaluation.js +117 -0
  14. package/dist/index.d.mts +74 -43
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.d.ts +8 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +4 -0
  19. package/dist/index.mjs +328 -237
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/markdown-options.d.ts +3 -0
  22. package/dist/markdown-options.d.ts.map +1 -0
  23. package/dist/markdown-options.js +19 -0
  24. package/dist/mdx/compile.d.ts +3 -0
  25. package/dist/mdx/compile.d.ts.map +1 -0
  26. package/dist/mdx/compile.js +27 -0
  27. package/dist/mdx/evaluate.d.ts +44 -0
  28. package/dist/mdx/evaluate.d.ts.map +1 -0
  29. package/dist/mdx/evaluate.js +57 -0
  30. package/dist/mdx-editor.d.ts +7 -0
  31. package/dist/mdx-editor.d.ts.map +1 -0
  32. package/dist/mdx-editor.js +7 -0
  33. package/dist/node.d.mts +0 -5
  34. package/dist/node.d.mts.map +1 -1
  35. package/dist/node.d.ts +17 -0
  36. package/dist/node.d.ts.map +1 -0
  37. package/dist/node.js +16 -0
  38. package/dist/node.mjs +26 -11
  39. package/dist/node.mjs.map +1 -1
  40. package/dist/style.css +88 -0
  41. package/dist/types.d.ts +16 -0
  42. package/dist/types.d.ts.map +1 -0
  43. package/dist/types.js +1 -0
  44. package/package.json +54 -15
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["MDXEditorLib"],"sources":["../src/editor-core.tsx","../src/hooks/useMDXEvaluation.ts","../src/mdx-editor.tsx"],"sourcesContent":["import {\n BlockTypeSelect,\n BoldItalicUnderlineToggles,\n CreateLink,\n codeBlockPlugin,\n codeMirrorPlugin,\n DiffSourceToggleWrapper,\n diffSourcePlugin,\n frontmatterPlugin,\n headingsPlugin,\n InsertCodeBlock,\n InsertImage,\n InsertTable,\n InsertThematicBreak,\n imagePlugin,\n type JsxComponentDescriptor,\n jsxPlugin,\n ListsToggle,\n linkDialogPlugin,\n linkPlugin,\n listsPlugin,\n MDXEditor as MDXEditorLib,\n type MDXEditorMethods,\n markdownShortcutPlugin,\n quotePlugin,\n Separator,\n tablePlugin,\n thematicBreakPlugin,\n toolbarPlugin,\n UndoRedo,\n} from '@mdxeditor/editor';\nimport React, { useEffect, useState } from 'react';\nimport '@mdxeditor/editor/style.css';\n\nexport interface BaseMDXEditorProps {\n value: string;\n onChange: (value: string) => void;\n onSave?: (value: string) => void;\n readOnly?: boolean;\n imageDialog?: React.FC | null;\n disableImageSettingsButton?: boolean;\n onImageShortcut?: () => void;\n imageButtonRef?: React.Ref<HTMLButtonElement>;\n jsxComponentDescriptors?: JsxComponentDescriptor[];\n /**\n * Class applied to the MDXEditor root element (library forwards it to the\n * toolbar and portaled popups too). Pass `\"dark-theme\"` to activate the\n * library's built-in Radix dark palette.\n * See https://mdxeditor.dev/editor/docs/theming\n */\n className?: string;\n}\n\nexport interface BaseMDXEditorModalProps {\n isOpen: boolean;\n onClose: () => void;\n filePath?: string;\n initialContent: string;\n onSave: (content: string) => void | Promise<void>;\n headerExtra?: React.ReactNode;\n headerTools?: (tools: {\n content: string;\n setContent: React.Dispatch<React.SetStateAction<string>>;\n editorRef: React.RefObject<MDXEditorMethods | null>;\n }) => React.ReactNode;\n onBeforeClose?: () => boolean;\n EditorComponent: React.ForwardRefExoticComponent<BaseMDXEditorProps & React.RefAttributes<MDXEditorMethods>>;\n /**\n * Forwarded to the MDXEditor root. Typically `\"dark-theme\"` when the host\n * app is in dark mode — see BaseMDXEditorProps.className.\n */\n editorClassName?: string;\n}\n\nconst codeBlockLanguages = {\n text: 'Plain Text',\n js: 'JavaScript',\n jsx: 'JavaScript (React)',\n ts: 'TypeScript',\n tsx: 'TypeScript (React)',\n css: 'CSS',\n html: 'HTML',\n json: 'JSON',\n md: 'Markdown',\n mdx: 'MDX',\n bash: 'Bash',\n python: 'Python',\n};\n\nfunction renderInsertImageButton(imageButtonRef?: React.Ref<HTMLButtonElement>) {\n if (!imageButtonRef) {\n return <InsertImage />;\n }\n\n return React.createElement(InsertImage as unknown as React.FC<{ ref: React.Ref<HTMLButtonElement> }>, {\n ref: imageButtonRef,\n });\n}\n\nclass MDXEditorErrorBoundary extends React.Component<\n { children: React.ReactNode; logPrefix: string },\n { hasError: boolean; error?: Error }\n> {\n constructor(props: { children: React.ReactNode; logPrefix: string }) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, error };\n }\n\n override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n console.error(`${this.props.logPrefix} Error boundary caught:`, error, errorInfo);\n }\n\n override render() {\n if (this.state.hasError) {\n return (\n <div className=\"p-4 bg-red-50 border border-red-200 rounded text-red-600\">\n <p className=\"font-semibold mb-2\">MDXEditor Error</p>\n <p className=\"text-sm mb-2\">{this.state.error?.message || 'Unknown error occurred'}</p>\n <details className=\"text-xs\">\n <summary className=\"cursor-pointer font-medium\">Stack Trace</summary>\n <pre className=\"mt-2 p-2 bg-red-100 rounded overflow-auto whitespace-pre-wrap\">\n {this.state.error?.stack}\n </pre>\n </details>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n\nexport const BaseMDXEditor = React.forwardRef<MDXEditorMethods, BaseMDXEditorProps>(\n (\n {\n value,\n onChange,\n onSave,\n readOnly = false,\n imageDialog,\n disableImageSettingsButton = false,\n onImageShortcut,\n imageButtonRef,\n jsxComponentDescriptors,\n className,\n },\n ref,\n ) => {\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if ((event.ctrlKey || event.metaKey) && event.key === 's') {\n event.preventDefault();\n onSave?.(value);\n }\n\n if ((event.ctrlKey || event.metaKey) && event.shiftKey && event.key.toLowerCase() === 'i') {\n if (!onImageShortcut) {\n return;\n }\n\n event.preventDefault();\n onImageShortcut();\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [onImageShortcut, onSave, value]);\n\n return (\n <MDXEditorLib\n ref={ref}\n markdown={value}\n onChange={onChange}\n readOnly={readOnly}\n className={className}\n contentEditableClassName=\"conloca-prose conloca-prose--editor max-w-none\"\n plugins={[\n headingsPlugin(),\n listsPlugin(),\n quotePlugin(),\n linkPlugin(),\n linkDialogPlugin(),\n tablePlugin(),\n thematicBreakPlugin(),\n frontmatterPlugin(),\n codeBlockPlugin({ defaultCodeBlockLanguage: 'ts' }),\n codeMirrorPlugin({ codeBlockLanguages }),\n diffSourcePlugin({ viewMode: 'rich-text' }),\n markdownShortcutPlugin(),\n jsxPlugin({ jsxComponentDescriptors: jsxComponentDescriptors ?? [] }),\n imagePlugin(\n imageDialog\n ? {\n ImageDialog: imageDialog,\n disableImageSettingsButton,\n }\n : undefined,\n ),\n toolbarPlugin({\n toolbarContents: () => (\n <DiffSourceToggleWrapper>\n <UndoRedo />\n <Separator />\n <BoldItalicUnderlineToggles />\n <Separator />\n <ListsToggle />\n <Separator />\n <BlockTypeSelect />\n <Separator />\n <CreateLink />\n {renderInsertImageButton(imageButtonRef)}\n <InsertTable />\n <InsertThematicBreak />\n <Separator />\n <InsertCodeBlock />\n </DiffSourceToggleWrapper>\n ),\n }),\n ]}\n />\n );\n },\n);\n\nBaseMDXEditor.displayName = 'BaseMDXEditor';\n\nfunction DeferredMDXEditor({\n EditorComponent,\n editorRef,\n ...props\n}: BaseMDXEditorProps & {\n EditorComponent: React.ForwardRefExoticComponent<BaseMDXEditorProps & React.RefAttributes<MDXEditorMethods>>;\n editorRef: React.RefObject<MDXEditorMethods | null>;\n}) {\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setIsReady(true);\n }, 10);\n\n return () => clearTimeout(timer);\n }, []);\n\n if (!isReady) {\n return (\n <div className=\"flex items-center justify-center h-full text-gray-500\" data-testid=\"deferred-editor-loading\">\n Initializing editor...\n </div>\n );\n }\n\n return (\n <div data-testid=\"deferred-editor-ready\">\n <EditorComponent ref={editorRef} {...props} />\n </div>\n );\n}\n\ninterface DialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n children: React.ReactNode;\n}\n\nfunction Dialog({ open, onOpenChange, children }: DialogProps) {\n if (!open) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n <div role=\"presentation\" className=\"fixed inset-0 bg-black/50\" onClick={() => onOpenChange(false)} />\n <div className=\"relative z-50 bg-white dark:bg-grey-03 rounded-lg shadow-lg max-w-[90vw] max-h-[90vh] overflow-hidden\">\n {children}\n </div>\n </div>\n );\n}\n\nfunction DialogContent({ children, className = '' }: { children: React.ReactNode; className?: string }) {\n return <div className={`p-6 ${className}`}>{children}</div>;\n}\n\nfunction DialogHeader({ children }: { children: React.ReactNode }) {\n return <div className=\"mb-4\">{children}</div>;\n}\n\nfunction DialogTitle({ children }: { children: React.ReactNode }) {\n return <h2 className=\"text-xl font-semibold text-grey-01 dark:text-grey-12\">{children}</h2>;\n}\n\nexport function BaseMDXEditorModal({\n isOpen,\n onClose,\n filePath,\n initialContent,\n onSave,\n headerExtra,\n headerTools,\n onBeforeClose,\n EditorComponent,\n editorClassName,\n}: BaseMDXEditorModalProps) {\n const editorRef = React.useRef<MDXEditorMethods>(null);\n const [content, setContent] = useState(initialContent);\n const [isEditorReady, setIsEditorReady] = useState(false);\n const [isSaving, setIsSaving] = useState(false);\n\n useEffect(() => {\n setContent(initialContent);\n }, [initialContent]);\n\n const handleClose = () => {\n if (onBeforeClose && !onBeforeClose()) {\n return;\n }\n\n onClose();\n };\n\n useEffect(() => {\n if (isOpen) {\n const timer = setTimeout(() => {\n setIsEditorReady(true);\n }, 0);\n\n return () => clearTimeout(timer);\n }\n\n setIsEditorReady(false);\n return undefined;\n }, [isOpen]);\n\n const handleSave = async () => {\n setIsSaving(true);\n\n try {\n await onSave(content);\n handleClose();\n } catch (error) {\n console.error('Save failed:', error);\n } finally {\n setIsSaving(false);\n }\n };\n\n if (!isOpen) {\n return null;\n }\n\n return (\n <Dialog open={isOpen} onOpenChange={handleClose}>\n <DialogContent className=\"w-[90vw] h-[90vh] flex flex-col\" data-testid=\"mdx-editor-modal\">\n <DialogHeader>\n <div className=\"flex items-center justify-between gap-4\">\n <DialogTitle>{filePath ? `Edit: ${filePath}` : 'New MDX File'}</DialogTitle>\n {(headerExtra || headerTools) && (\n <div className=\"flex items-center gap-2\">\n {headerExtra}\n {headerTools?.({ content, setContent, editorRef })}\n </div>\n )}\n <button\n type=\"button\"\n onClick={handleClose}\n className=\"p-2 rounded text-grey-04 dark:text-grey-07 hover:bg-gray-100 dark:hover:bg-grey-04 hover:text-grey-01 dark:hover:text-grey-12\"\n aria-label=\"Close\"\n >\n ✕\n </button>\n </div>\n </DialogHeader>\n <div className=\"flex-1 overflow-hidden\">\n {isEditorReady ? (\n <MDXEditorErrorBoundary logPrefix=\"[MDXEditor]\">\n <DeferredMDXEditor\n EditorComponent={EditorComponent}\n editorRef={editorRef}\n value={content}\n onChange={setContent}\n onSave={handleSave}\n className={editorClassName}\n />\n </MDXEditorErrorBoundary>\n ) : (\n <div className=\"flex items-center justify-center h-full\">\n <div className=\"text-gray-500 dark:text-grey-07\" data-testid=\"modal-editor-loading\">\n Loading editor...\n </div>\n </div>\n )}\n </div>\n <div className=\"flex justify-end gap-2 mt-4\">\n <button\n type=\"button\"\n onClick={handleClose}\n className=\"px-4 py-2 border border-gray-300 dark:border-grey-04 rounded text-grey-01 dark:text-grey-12 hover:bg-gray-50 dark:hover:bg-grey-04\"\n disabled={isSaving}\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={handleSave}\n className=\"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed\"\n disabled={isSaving}\n >\n {isSaving ? 'Saving...' : 'Save'}\n </button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n","import type React from 'react';\nimport { useEffect, useState } from 'react';\nimport * as devRuntime from 'react/jsx-dev-runtime';\nimport * as runtime from 'react/jsx-runtime';\n\n// Cache for compiled MDX components\nconst compiledCache = new Map<string, React.ComponentType>();\n\n/**\n * Execute pre-compiled MDX code (compiled with outputFormat: 'function-body').\n * This is the same as @mdx-js/mdx's run() — inlined here to avoid importing\n * the full @mdx-js/mdx package (which pulls acorn + remark + unified into the browser).\n *\n * Note: Uses AsyncFunction constructor which requires CSP `unsafe-eval`.\n * This is acceptable since the CMS admin UI runs in a trusted environment.\n */\nconst AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;\nasync function runMDX(code: string, options: Record<string, unknown>): Promise<{ default: React.ComponentType }> {\n return new AsyncFunction(String(code))(options);\n}\n\n/**\n * Create the JSX runtime options for runMDX().\n * Checked once at module load to avoid repeated environment checks.\n */\nfunction createRunOptions() {\n const isDevelopment = process.env.NODE_ENV === 'development';\n return isDevelopment ? { ...devRuntime, development: true } : { ...runtime };\n}\n\nconst runOptions = createRunOptions();\n\n/**\n * Simple hash function for generating cache keys from MDX content.\n */\nfunction hashString(str: string): string {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash;\n }\n return hash.toString(36);\n}\n\nexport interface UseMDXEvaluationOptions {\n compiledCode: string | null;\n cacheKey?: string;\n}\n\nexport interface UseMDXEvaluationResult {\n Component: React.ComponentType | null;\n error: Error | null;\n isLoading: boolean;\n retry: () => void;\n}\n\n/**\n * Hook for evaluating pre-compiled MDX code into React components.\n *\n * Uses the browser-side half of a server-compile + browser-run pattern:\n * 1. The server compiles MDX → JavaScript function body\n * 2. The browser executes the pre-compiled code with run() (zero compiler dependencies)\n *\n * This keeps the full MDX compilation pipeline on the server and only ships\n * a tiny runtime helper to the browser.\n *\n * @param options.compiledCode - The pre-compiled MDX function body. If null, returns null component\n * @param options.cacheKey - Optional cache key. If not provided, uses hash of code\n *\n * @returns Object containing Component, error, isLoading, retry\n */\nexport function useMDXEvaluation({ compiledCode, cacheKey }: UseMDXEvaluationOptions): UseMDXEvaluationResult {\n const [Component, setComponent] = useState<React.ComponentType | null>(null);\n const [error, setError] = useState<Error | null>(null);\n const [isLoading, setIsLoading] = useState(() => {\n if (!compiledCode) return false;\n const key = cacheKey || `mdx-${hashString(compiledCode)}`;\n return !compiledCache.has(key);\n });\n const [retryCount, setRetryCount] = useState(0);\n\n const retry = () => {\n if (compiledCode) {\n const key = cacheKey || `mdx-${hashString(compiledCode)}`;\n compiledCache.delete(key);\n }\n setRetryCount((prev) => prev + 1);\n };\n\n useEffect(() => {\n void retryCount;\n\n if (!compiledCode) {\n setComponent(null);\n setError(null);\n setIsLoading(false);\n return;\n }\n\n const key = cacheKey || `mdx-${hashString(compiledCode)}`;\n const cached = compiledCache.get(key);\n if (cached) {\n setComponent(() => cached);\n setError(null);\n setIsLoading(false);\n return;\n }\n\n let cancelled = false;\n\n const compileAndRun = async () => {\n try {\n setError(null);\n setIsLoading(true);\n\n const { default: MDXComponent } = await runMDX(compiledCode, runOptions);\n\n if (cancelled) return;\n\n compiledCache.set(key, MDXComponent);\n setComponent(() => MDXComponent);\n } catch (err) {\n if (cancelled) return;\n const evaluationError = err instanceof Error ? err : new Error('MDX evaluation failed');\n setError(evaluationError);\n setComponent(null);\n } finally {\n if (!cancelled) {\n setIsLoading(false);\n }\n }\n };\n\n compileAndRun();\n\n return () => {\n cancelled = true;\n };\n }, [compiledCode, cacheKey, retryCount]);\n\n return { Component, error, isLoading, retry };\n}\n","import type { MDXEditorMethods } from '@mdxeditor/editor';\nimport React from 'react';\nimport {\n BaseMDXEditor,\n BaseMDXEditorModal,\n type BaseMDXEditorModalProps,\n type BaseMDXEditorProps,\n} from './editor-core.js';\n\nexport interface MDXEditorProps\n extends Omit<\n BaseMDXEditorProps,\n 'disableImageSettingsButton' | 'imageButtonRef' | 'imageDialog' | 'onImageShortcut'\n > {}\n\nexport const MDXEditor = React.forwardRef<MDXEditorMethods, MDXEditorProps>((props, ref) => {\n return <BaseMDXEditor ref={ref} {...props} />;\n});\n\nMDXEditor.displayName = 'MDXEditor';\n\nexport interface MDXEditorModalProps extends Omit<BaseMDXEditorModalProps, 'EditorComponent'> {}\n\nexport function MDXEditorModal(props: MDXEditorModalProps) {\n return <BaseMDXEditorModal {...props} EditorComponent={MDXEditor} />;\n}\n"],"mappings":";;;;;;;;AA0EA,MAAM,qBAAqB;CACzB,MAAM;CACN,IAAI;CACJ,KAAK;CACL,IAAI;CACJ,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAM;CACN,IAAI;CACJ,KAAK;CACL,MAAM;CACN,QAAQ;CACT;AAED,SAAS,wBAAwB,gBAA+C;AAC9E,KAAI,CAAC,eACH,QAAO,oBAAC,gBAAc;AAGxB,QAAO,MAAM,cAAc,aAA2E,EACpG,KAAK,gBACN,CAAC;;AAGJ,IAAM,yBAAN,cAAqC,MAAM,UAGzC;CACA,YAAY,OAAyD;AACnE,QAAM,MAAM;AACZ,OAAK,QAAQ,EAAE,UAAU,OAAO;;CAGlC,OAAO,yBAAyB,OAAc;AAC5C,SAAO;GAAE,UAAU;GAAM;GAAO;;CAGlC,AAAS,kBAAkB,OAAc,WAA4B;AACnE,UAAQ,MAAM,GAAG,KAAK,MAAM,UAAU,0BAA0B,OAAO,UAAU;;CAGnF,AAAS,SAAS;AAChB,MAAI,KAAK,MAAM,SACb,QACE,q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;;AAGnC,iBAAgB;AAGd,MAAI,CAAC,cAAc;AACjB,gBAAa,KAAK;AAClB,YAAS,KAAK;AACd,gBAAa,MAAM;AACnB;;EAGF,MAAM,MAAM,YAAY,OAAO,WAAW,aAAa;EACvD,MAAM,SAAS,cAAc,IAAI,IAAI;AACrC,MAAI,QAAQ;AACV,sBAAmB,OAAO;AAC1B,YAAS,KAAK;AACd,gBAAa,MAAM;AACnB;;EAGF,IAAI,YAAY;EAEhB,MAAM,gBAAgB,YAAY;AAChC,OAAI;AACF,aAAS,KAAK;AACd,iBAAa,KAAK;IAElB,MAAM,EAAE,SAAS,iBAAiB,MAAM,OAAO,cAAc,WAAW;AAExE,QAAI,UAAW;AAEf,kBAAc,IAAI,KAAK,aAAa;AACpC,uBAAmB,aAAa;YACzB,KAAK;AACZ,QAAI,UAAW;AAEf,aADwB,eAAe,QAAQ,sBAAM,IAAI,MAAM,wBAAwB,CAC9D;AACzB,iBAAa,KAAK;aACV;AACR,QAAI,CAAC,UACH,cAAa,MAAM;;;AAKzB,iBAAe;AAEf,eAAa;AACX,eAAY;;IAEb;EAAC;EAAc;EAAU;EAAW,CAAC;AAExC,QAAO;EAAE;EAAW;EAAO;EAAW;EAAO;;;;;AC9H/C,MAAa,YAAY,MAAM,YAA8C,OAAO,QAAQ;AAC1F,QAAO,oBAAC;EAAmB;EAAK,GAAI;GAAS;EAC7C;AAEF,UAAU,cAAc;AAIxB,SAAgB,eAAe,OAA4B;AACzD,QAAO,oBAAC;EAAmB,GAAI;EAAO,iBAAiB;GAAa"}
1
+ {"version":3,"file":"index.mjs","names":["MDXEditorLib"],"sources":["../src/code-block-frame.tsx","../src/markdown-options.ts","../src/editor-core.tsx","../src/hooks/useMDXEvaluation.ts","../src/mdx-editor.tsx"],"sourcesContent":["import {\n Cell,\n type CodeBlockEditorDescriptor,\n type CodeBlockEditorProps,\n CodeMirrorEditor,\n useCellValue,\n useCodeBlockEditorContext,\n} from '@mdxeditor/editor';\nimport { Check, Copy } from 'lucide-react';\nimport { type ChangeEvent, createElement, type ReactElement, useCallback, useEffect, useMemo, useState } from 'react';\n\n/**\n * Frame chrome around the editor's fenced code blocks — header bar with\n * filename, language tag, and a copy button. The outer wrapper picks up\n * the host's code-block classes (published via `codeBlockWrapperInfo$`\n * by the host-wrapper plugin in cms-spa), so the host's actual code-\n * block CSS (Starlight's expressive-code, Tailwind's pre styling, etc.)\n * reaches the editor's frame through the cascade — no shipped mirror.\n *\n * Host-agnostic: no Shiki / Starlight / ExpressiveCode imports. Class\n * names are discovered at runtime from the host's live HTML.\n */\n\n/**\n * Realm-published cell carrying the host's code-block wrapper chain,\n * outermost first. For Starlight's expressive-code:\n *\n * [\n * { tagName: 'div', className: 'expressive-code' },\n * { tagName: 'figure', className: 'frame has-title not-content' },\n * ]\n *\n * The cms-spa `hostWrapperPlugin` writes to this whenever the fetched\n * wrapper info changes; the code-block frame reads from it to render\n * each chain link as a nested element with the host's expected tag\n * name. Same publish-pattern as the content-wrapper plugin in cms-spa.\n *\n * Null when the host has no code-block chrome (or the fetch is in\n * flight). The frame then falls back to its base `.conloca-code-block`\n * wrapper with no host inheritance — \"looks plain but not broken.\"\n */\nexport const codeBlockWrapperInfo$ = Cell<{ tagName: string; className: string }[] | null>(null);\n\nconst TITLE_META_RE = /\\btitle=(?:\"([^\"]*)\"|'([^']*)'|(\\S+))/;\n// First-line filename comment, the convention ExpressiveCode's frames\n// plugin recognizes when no explicit `title=` is set on the fence —\n// `// foo.ts`, `# foo.py`, `<!-- foo.html -->`, `/* foo.css */`,\n// `; foo.ini`, `-- foo.sql`. Requires a dot-extension so plain prose\n// comments don't get mistaken for filenames.\nconst FILENAME_COMMENT_RE = /^\\s*(?:\\/\\/|#|;|--|<!--|\\/\\*)\\s*([\\w.\\-/@]+\\.[\\w.-]+)\\s*(?:-->|\\*\\/)?\\s*$/;\n\ninterface MetaParts {\n /** The current title value (empty string when no title meta is set). */\n title: string;\n /** Everything else in the meta string, with the title slice removed. */\n rest: string;\n}\n\nfunction parseMeta(meta: string): MetaParts {\n const match = meta.match(TITLE_META_RE);\n if (!match) return { title: '', rest: meta.trim() };\n const value = match[1] ?? match[2] ?? match[3] ?? '';\n const rest = (meta.slice(0, match.index) + meta.slice(match.index! + match[0].length)).replace(/\\s+/g, ' ').trim();\n return { title: value, rest };\n}\n\n/** Reassemble a meta string with `title` set (or stripped when empty). */\nfunction buildMeta(title: string, rest: string): string {\n const trimmedTitle = title.trim();\n const titleFragment = trimmedTitle ? `title=\"${trimmedTitle.replace(/\"/g, '\\\\\"')}\"` : '';\n if (titleFragment && rest) return `${titleFragment} ${rest}`;\n return titleFragment || rest;\n}\n\n/**\n * Detect a leading filename comment, the convention EC's frames plugin\n * uses on the published page when no explicit `title=` is set. Returns\n * the filename when line 1 of the code is a single-line comment ending\n * in a dot-extension; empty string otherwise.\n *\n * Used to pre-fill the editor's filename input on legacy fences so\n * authors see the same value the reader sees in the rendered tab. Pure\n * read — the underlying code/comment is never touched.\n */\nfunction detectFilenameComment(code: string): string {\n const firstLine = code.split('\\n', 1)[0] ?? '';\n const match = firstLine.match(FILENAME_COMMENT_RE);\n return match ? (match[1] ?? '') : '';\n}\n\nfunction CopyButton({ code }: { code: string }) {\n const [copied, setCopied] = useState(false);\n const onClick = useCallback(() => {\n void navigator.clipboard.writeText(code).then(() => {\n setCopied(true);\n window.setTimeout(() => setCopied(false), 1200);\n });\n }, [code]);\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"conloca-code-copy\"\n aria-label={copied ? 'Copied' : 'Copy code'}\n title={copied ? 'Copied' : 'Copy code'}\n >\n {copied ? <Check size={14} aria-hidden=\"true\" /> : <Copy size={14} aria-hidden=\"true\" />}\n </button>\n );\n}\n\n/**\n * Editable filename slot. Rewrites the code block's meta string via\n * `setMeta` from `useCodeBlockEditorContext` so authors can author the\n * frame title (`\\`\\`\\`ts title=\"src/foo.ts\"`) directly from the editor —\n * the meta string round-trips through MDXEditor's markdown serializer\n * and ExpressiveCode picks it up as the frame header on the published\n * page. Other meta fragments (ins/del/mark/wrap) are preserved.\n *\n * Legacy fences with a filename comment on line 1 (`// foo.ts`) — EC's\n * pre-meta convention for tab titles — are detected and pre-filled in\n * the input as a read-only display. Opening such a fence does NOT\n * mutate the source. Editing the field is an explicit author intent:\n * the new value is written as `title=` meta AND the original comment\n * line is stripped, so the editor's input becomes the single source of\n * truth without breaking the published render.\n */\nfunction FilenameInput({ meta, code }: { meta: string; code: string }) {\n const { setMeta, setCode } = useCodeBlockEditorContext();\n const parsed = useMemo(() => parseMeta(meta), [meta]);\n const detectedFromComment = useMemo(() => (parsed.title ? '' : detectFilenameComment(code)), [parsed.title, code]);\n const displayed = parsed.title || detectedFromComment;\n const [title, setTitle] = useState(displayed);\n const [interacted, setInteracted] = useState(false);\n\n // External updates (HMR, language change, sibling code edits) reset\n // the local view to the canonical value and clear the \"user edited\"\n // flag — so the next blur after an external update doesn't write\n // anything until the author actively types again.\n useEffect(() => {\n setTitle(displayed);\n setInteracted(false);\n }, [displayed]);\n\n const commit = useCallback(\n (next: string) => {\n if (!interacted) return;\n if (next === parsed.title) return;\n setMeta(buildMeta(next, parsed.rest));\n // If the pre-fill came from a leading filename comment and the\n // author has now committed an explicit title, strip the comment\n // so EC doesn't render the title twice (once as the tab, once as\n // a stray code comment) on the published page.\n if (detectedFromComment) {\n const lines = code.split('\\n');\n if (lines[0] && FILENAME_COMMENT_RE.test(lines[0])) {\n setCode(lines.slice(1).join('\\n').replace(/^\\n+/, ''));\n }\n }\n },\n [interacted, parsed.title, parsed.rest, detectedFromComment, code, setMeta, setCode],\n );\n\n const onChange = (e: ChangeEvent<HTMLInputElement>) => {\n setInteracted(true);\n setTitle(e.target.value);\n };\n const onBlur = () => commit(title);\n\n return (\n <input\n type=\"text\"\n className=\"conloca-code-block__filename\"\n value={title}\n placeholder=\"filename\"\n spellCheck={false}\n onChange={onChange}\n onBlur={onBlur}\n aria-label=\"Code block filename\"\n />\n );\n}\n\nfunction ConlocaCodeBlockEditor(props: CodeBlockEditorProps) {\n // Materialise the host's discovered code-block chain as nested\n // elements. The INNERMOST link in the chain becomes the \"frame\"\n // element that directly holds the filename header, the code body,\n // and the copy slot — matching ExpressiveCode's authoring shape:\n //\n // <div class=\"expressive-code\"> ← outer link\n // <figure class=\"frame has-title …\"> ← inner link (frame)\n // <figcaption class=\"header\">\n // <span class=\"title\"><FilenameInput /></span>\n // </figcaption>\n // <pre><CodeMirror /></pre>\n // <div class=\"copy\"><CopyButton /></div>\n // </figure>\n // </div>\n //\n // Rendering with the host's expected tags (figure / figcaption / pre)\n // and nesting depth lets descendant CSS selectors land — both single-\n // class (`.frame { ... }`) and descendant (`.expressive-code .frame\n // .header > .title { ... }`) rules paint without us shipping a\n // parallel copy.\n //\n // When chain is null/empty (host has no code-block chrome, or the\n // wrapper fetch hasn't resolved yet) we fall back to a bare\n // `<div class=\"conloca-code-block\">` containing the same inner\n // shape — \"looks plain but not broken.\"\n const chain = useCellValue(codeBlockWrapperInfo$) ?? [];\n const frameLink = chain.length > 0 ? chain[chain.length - 1] : null;\n const outerLinks = frameLink ? chain.slice(0, -1) : [];\n\n const frameInner = (\n <>\n <figcaption className=\"conloca-code-block__header header\">\n <span className=\"title\">\n <FilenameInput meta={props.meta} code={props.code} />\n </span>\n </figcaption>\n <pre className=\"conloca-code-block__pre\">\n <CodeMirrorEditor {...props} />\n </pre>\n {/* `.copy` matches expressive-code's expected slot name so any\n `.frame .copy` styling from the host paints. We host only the\n copy button here — language selection lives in MDXEditor's\n own `_codeMirrorToolbar_*` (combobox), positioned via\n editor-styles.css so it doesn't overlap the code. */}\n <div className=\"conloca-code-block__copy copy\">\n <CopyButton code={props.code} />\n </div>\n </>\n );\n\n // The frame element carries `conloca-code-block` (our own targeting\n // hook) alongside the host's discovered classes. When the host has\n // no chain, we still wrap in a plain `<div>` so the inner shape is\n // consistent for our utility selectors.\n const frame = frameLink ? (\n createElement(frameLink.tagName, { className: `conloca-code-block ${frameLink.className}` }, frameInner)\n ) : (\n <div className=\"conloca-code-block\">{frameInner}</div>\n );\n\n // Wrap outer links from inside out. `reduceRight` so the first\n // chain link ends up as the outermost rendered element.\n return outerLinks.reduceRight<ReactElement>(\n (kids, link) => createElement(link.tagName, { className: link.className }, kids),\n frame,\n );\n}\n\n/**\n * Catch-all descriptor — `priority: 100`, `match: () => true` — registered\n * via `codeBlockPlugin({ codeBlockEditorDescriptors: [conlocaCodeBlockDescriptor] })`.\n * Wraps the upstream `CodeMirrorEditor` with the host-themed frame.\n */\nexport const conlocaCodeBlockDescriptor: CodeBlockEditorDescriptor = {\n priority: 100,\n match: () => true,\n Editor: ConlocaCodeBlockEditor,\n};\n","import type { Options as ToMarkdownOptions } from 'mdast-util-to-markdown';\n\n// MDXEditor rebuilds the markdown body from its Lexical AST on every change\n// via `mdast-util-to-markdown`. Without explicit options, the library defaults\n// flip canonical project style: thematic breaks render as `***` instead of\n// `---`, bullets pick `*` over `-`, and emphasis ambiguity inside GFM table\n// cells inserts backslash escapes on every save. Pinning these to match the\n// committed fixtures keeps no-op round-trips diff-clean.\n//\n// Exported as a plain TS module (no React deps) so it can be exercised\n// directly from tests against `mdast-util-to-markdown` without mounting the\n// editor.\nexport const TO_MARKDOWN_OPTIONS: ToMarkdownOptions = {\n bullet: '-',\n rule: '-',\n emphasis: '_',\n strong: '*',\n fence: '`',\n listItemIndent: 'one',\n tightDefinitions: true,\n};\n","import {\n BlockTypeSelect,\n BoldItalicUnderlineToggles,\n ButtonWithTooltip,\n ChangeCodeMirrorLanguage,\n ConditionalContents,\n CreateLink,\n codeBlockPlugin,\n codeMirrorPlugin,\n DiffSourceToggleWrapper,\n diffSourcePlugin,\n GenericJsxEditor,\n HighlightToggle,\n headingsPlugin,\n InsertCodeBlock,\n InsertImage,\n InsertTable,\n InsertThematicBreak,\n imagePlugin,\n type JsxComponentDescriptor,\n jsxPlugin,\n ListsToggle,\n linkDialogPlugin,\n linkPlugin,\n listsPlugin,\n MDXEditor as MDXEditorLib,\n type MDXEditorMethods,\n markdownShortcutPlugin,\n quotePlugin,\n type RealmPlugin,\n Separator,\n StrikeThroughSupSubToggles,\n tablePlugin,\n thematicBreakPlugin,\n toolbarPlugin,\n UndoRedo,\n} from '@mdxeditor/editor';\nimport { Maximize2, Minimize2 } from 'lucide-react';\nimport React, { useCallback, useEffect, useSyncExternalStore } from 'react';\nimport '@mdxeditor/editor/style.css';\nimport './editor-styles.css';\nimport { conlocaCodeBlockDescriptor } from './code-block-frame';\nimport { TO_MARKDOWN_OPTIONS } from './markdown-options';\n\nconst FOCUS_MODE_STORAGE_KEY = 'conloca.mdxeditor.focusMode';\nconst FOCUS_MODE_BODY_CLASS = 'mdxeditor-focus-mode';\n\n/**\n * Toggle focus-mode by writing the class on `document.body`. Direct DOM\n * mutation (vs. piping a boolean through React state into the editor's\n * `className` prop) avoids re-rendering Lexical on every toggle — the\n * editor's prop is the only entry point and changing it forces a parse\n * round-trip. Persisted in localStorage so the preference survives reloads.\n */\nfunction readFocusMode(): boolean {\n if (typeof document === 'undefined') return false;\n return document.body.classList.contains(FOCUS_MODE_BODY_CLASS);\n}\n\nfunction subscribeFocusMode(callback: () => void): () => void {\n if (typeof window === 'undefined') return () => {};\n const handler = () => callback();\n window.addEventListener('conloca:focusModeChange', handler);\n return () => window.removeEventListener('conloca:focusModeChange', handler);\n}\n\nfunction setFocusMode(next: boolean): void {\n if (typeof document === 'undefined') return;\n document.body.classList.toggle(FOCUS_MODE_BODY_CLASS, next);\n try {\n if (next) {\n window.localStorage.setItem(FOCUS_MODE_STORAGE_KEY, '1');\n } else {\n window.localStorage.removeItem(FOCUS_MODE_STORAGE_KEY);\n }\n } catch {\n // localStorage may be unavailable (private mode, SSR) — ignore.\n }\n window.dispatchEvent(new Event('conloca:focusModeChange'));\n}\n\nfunction FocusModeToggle() {\n const focusMode = useSyncExternalStore(subscribeFocusMode, readFocusMode, () => false);\n const onClick = useCallback(() => setFocusMode(!focusMode), [focusMode]);\n const Icon = focusMode ? Minimize2 : Maximize2;\n return (\n <ButtonWithTooltip\n title={focusMode ? 'Exit focus mode (wider column)' : 'Enter focus mode (narrow column)'}\n onClick={onClick}\n >\n <Icon size={16} aria-hidden />\n </ButtonWithTooltip>\n );\n}\n\nexport interface BaseMDXEditorProps {\n value: string;\n /**\n * Called whenever the editor content changes. The second argument is `true`\n * the first time the library normalizes the parsed markdown back to its\n * canonical form (bullet style, trailing newline, etc.) — consumers tracking\n * dirty state should treat that call as a re-baseline rather than a user\n * edit, otherwise the editor looks dirty the moment the page loads.\n */\n onChange: (value: string, initialMarkdownNormalize?: boolean) => void;\n onSave?: (value: string) => void;\n readOnly?: boolean;\n imageDialog?: React.FC | null;\n disableImageSettingsButton?: boolean;\n onImageShortcut?: () => void;\n imageButtonRef?: React.Ref<HTMLButtonElement>;\n /**\n * Upload handler for images pasted or dropped directly into the editor. When\n * provided, the underlying imagePlugin will route those events through this\n * function and insert the returned URL as the image src. Independent of the\n * library/picker `imageDialog` flow — both can be active simultaneously.\n */\n imageUploadHandler?: (file: File) => Promise<string>;\n jsxComponentDescriptors?: JsxComponentDescriptor[];\n /**\n * Additional @mdxeditor/editor RealmPlugins appended to the built-in\n * plugin list. Used by the SPA shell to register the MDX components\n * registry-driven slash menu without coupling @conloca/mdx to\n * @conloca/cms-spa.\n */\n extraPlugins?: RealmPlugin[];\n /**\n * Extra toolbar buttons inserted between `<InsertAdmonition />` and the\n * separator preceding focus mode. Pass `null` (default) to keep the\n * stock toolbar.\n */\n extraToolbarItems?: React.ReactNode;\n /**\n * Class applied to the MDXEditor root element (library forwards it to the\n * toolbar and portaled popups too). Pass `\"dark-theme\"` to activate the\n * library's built-in Radix dark palette.\n * See https://mdxeditor.dev/editor/docs/theming\n */\n className?: string;\n /** Placeholder shown when the editor is empty. Forwarded to MDXEditorLib. */\n placeholder?: React.ReactNode;\n /** Auto-focus the editor on mount. Forwarded to MDXEditorLib. */\n autoFocus?: boolean | { defaultSelection?: 'rootStart' | 'rootEnd'; preventScroll?: boolean };\n}\n\n// The empty-string entry is the documented escape hatch for code blocks\n// authored without a language hint. Without it, fences like ```\\nfoo\\n``` (which\n// the parser tags as language `null` / meta `'N/A'`) trip a hard error in\n// older versions and emit a noisy warning even on v3.55+. See mdx-editor/editor\n// issues #370, #423, #463, #885, #886, #901.\nconst codeBlockLanguages: Record<string, string> = {\n '': 'Plain text',\n text: 'Plain Text',\n js: 'JavaScript',\n jsx: 'JavaScript (React)',\n ts: 'TypeScript',\n tsx: 'TypeScript (React)',\n css: 'CSS',\n html: 'HTML',\n json: 'JSON',\n md: 'Markdown',\n mdx: 'MDX',\n bash: 'Bash',\n python: 'Python',\n};\n\n/**\n * Wildcard fallback so any unknown JSX tag round-trips through GenericJsxEditor\n * instead of crashing the importer with \"Parsing of the following markdown\n * structure failed\". Two entries because the upstream visitor dispatches by\n * `kind` (block vs inline JSX) — without the inline one, an inline `<Badge>`\n * mid-paragraph would be matched by the flow wildcard and lifted out of its\n * paragraph in Lexical. Consumers passing typed descriptors win via the\n * exact-name match in the visitor; the wildcard only handles the leftovers.\n */\nconst wildcardJsxDescriptors: JsxComponentDescriptor[] = [\n { name: '*', kind: 'flow', props: [], hasChildren: true, Editor: GenericJsxEditor },\n { name: '*', kind: 'text', props: [], hasChildren: true, Editor: GenericJsxEditor },\n];\n\nfunction renderInsertImageButton(imageButtonRef?: React.Ref<HTMLButtonElement>) {\n if (!imageButtonRef) {\n return <InsertImage />;\n }\n\n return React.createElement(InsertImage as unknown as React.FC<{ ref: React.Ref<HTMLButtonElement> }>, {\n ref: imageButtonRef,\n });\n}\n\n/**\n * Restore the persisted focus-mode preference on first import. Runs once at\n * module load so the class is in place before any editor mounts — avoids a\n * flash of wide column when the user previously selected focus mode.\n */\nif (typeof window !== 'undefined') {\n try {\n if (window.localStorage.getItem(FOCUS_MODE_STORAGE_KEY) === '1') {\n document.body.classList.add(FOCUS_MODE_BODY_CLASS);\n }\n } catch {\n // ignore\n }\n}\n\nexport const BaseMDXEditor = React.forwardRef<MDXEditorMethods, BaseMDXEditorProps>(\n (\n {\n value,\n onChange,\n onSave,\n readOnly = false,\n imageDialog,\n disableImageSettingsButton = false,\n onImageShortcut,\n imageButtonRef,\n imageUploadHandler,\n jsxComponentDescriptors,\n extraPlugins,\n extraToolbarItems,\n className,\n placeholder,\n autoFocus,\n },\n ref,\n ) => {\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if ((event.ctrlKey || event.metaKey) && event.key === 's') {\n event.preventDefault();\n onSave?.(value);\n }\n\n if ((event.ctrlKey || event.metaKey) && event.shiftKey && event.key.toLowerCase() === 'i') {\n if (!onImageShortcut) {\n return;\n }\n\n event.preventDefault();\n onImageShortcut();\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [onImageShortcut, onSave, value]);\n\n return (\n <MDXEditorLib\n ref={ref}\n markdown={value}\n toMarkdownOptions={TO_MARKDOWN_OPTIONS}\n onChange={onChange}\n onError={({ error, source }) => {\n // Library invokes this synchronously inside a gurx signal, so don't\n // setState here — that triggers a render-phase warning (#872).\n // Logging only is enough; the React error boundary still catches\n // anything that escapes from rendering.\n console.error('[MDXEditor] parse error:', error, '\\nsource:', source);\n }}\n readOnly={readOnly}\n className={className}\n placeholder={placeholder}\n autoFocus={autoFocus}\n contentEditableClassName=\"conloca-prose conloca-prose--editor\"\n plugins={[\n headingsPlugin(),\n listsPlugin(),\n quotePlugin(),\n linkPlugin(),\n linkDialogPlugin(),\n tablePlugin(),\n thematicBreakPlugin(),\n // frontmatterPlugin intentionally omitted: metadata (title,\n // description, id, created, modified) is server-owned and stripped\n // from `content.mdx` on load. Re-introducing the plugin would let\n // the editor round-trip a YAML block as body text, corrupting the\n // file when content is inserted above it.\n codeBlockPlugin({\n defaultCodeBlockLanguage: 'ts',\n codeBlockEditorDescriptors: [conlocaCodeBlockDescriptor],\n }),\n codeMirrorPlugin({ codeBlockLanguages }),\n diffSourcePlugin({ viewMode: 'rich-text' }),\n markdownShortcutPlugin(),\n jsxPlugin({\n jsxComponentDescriptors: [...(jsxComponentDescriptors ?? []), ...wildcardJsxDescriptors],\n }),\n imagePlugin({\n ...(imageDialog ? { ImageDialog: imageDialog, disableImageSettingsButton } : {}),\n ...(imageUploadHandler ? { imageUploadHandler } : {}),\n }),\n ...(extraPlugins ?? []),\n toolbarPlugin({\n // flex-wrap so the toolbar reflows on narrow viewports instead of\n // overflowing horizontally — workaround documented in\n // mdx-editor/editor#908.\n toolbarClassName: 'mdxeditor-toolbar-wrap',\n toolbarContents: () => (\n <DiffSourceToggleWrapper>\n <ConditionalContents\n options={[\n {\n // When the user clicks into a code block, swap most of\n // the rich-text toolbar for the language picker — those\n // controls are no-ops inside CodeMirror anyway.\n when: (editor) => editor?.editorType === 'codeblock',\n contents: () => <ChangeCodeMirrorLanguage />,\n },\n {\n fallback: () => (\n <>\n <UndoRedo />\n <Separator />\n <BoldItalicUnderlineToggles />\n <StrikeThroughSupSubToggles />\n <HighlightToggle />\n <Separator />\n <ListsToggle />\n <Separator />\n <BlockTypeSelect />\n <Separator />\n <CreateLink />\n {renderInsertImageButton(imageButtonRef)}\n <InsertTable />\n <InsertThematicBreak />\n <Separator />\n <InsertCodeBlock />\n {extraToolbarItems}\n <Separator />\n <FocusModeToggle />\n </>\n ),\n },\n ]}\n />\n </DiffSourceToggleWrapper>\n ),\n }),\n ]}\n />\n );\n },\n);\n\nBaseMDXEditor.displayName = 'BaseMDXEditor';\n","import type React from 'react';\nimport { useEffect, useState } from 'react';\nimport * as devRuntime from 'react/jsx-dev-runtime';\nimport * as runtime from 'react/jsx-runtime';\n\n// Cache for compiled MDX components\nconst compiledCache = new Map<string, React.ComponentType>();\n\n/**\n * Execute pre-compiled MDX code (compiled with outputFormat: 'function-body').\n * This is the same as @mdx-js/mdx's run() — inlined here to avoid importing\n * the full @mdx-js/mdx package (which pulls acorn + remark + unified into the browser).\n *\n * Note: Uses AsyncFunction constructor which requires CSP `unsafe-eval`.\n * This is acceptable since the CMS admin UI runs in a trusted environment.\n */\nconst AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;\nasync function runMDX(code: string, options: Record<string, unknown>): Promise<{ default: React.ComponentType }> {\n return new AsyncFunction(String(code))(options);\n}\n\n/**\n * Create the JSX runtime options for runMDX().\n * Checked once at module load to avoid repeated environment checks.\n */\nfunction createRunOptions() {\n const isDevelopment = process.env.NODE_ENV === 'development';\n return isDevelopment ? { ...devRuntime, development: true } : { ...runtime };\n}\n\nconst runOptions = createRunOptions();\n\n/**\n * Simple hash function for generating cache keys from MDX content.\n */\nfunction hashString(str: string): string {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash;\n }\n return hash.toString(36);\n}\n\nexport interface UseMDXEvaluationOptions {\n compiledCode: string | null;\n cacheKey?: string;\n}\n\nexport interface UseMDXEvaluationResult {\n Component: React.ComponentType | null;\n error: Error | null;\n isLoading: boolean;\n retry: () => void;\n}\n\n/**\n * Hook for evaluating pre-compiled MDX code into React components.\n *\n * Uses the browser-side half of a server-compile + browser-run pattern:\n * 1. The server compiles MDX → JavaScript function body\n * 2. The browser executes the pre-compiled code with run() (zero compiler dependencies)\n *\n * This keeps the full MDX compilation pipeline on the server and only ships\n * a tiny runtime helper to the browser.\n *\n * @param options.compiledCode - The pre-compiled MDX function body. If null, returns null component\n * @param options.cacheKey - Optional cache key. If not provided, uses hash of code\n *\n * @returns Object containing Component, error, isLoading, retry\n */\nexport function useMDXEvaluation({ compiledCode, cacheKey }: UseMDXEvaluationOptions): UseMDXEvaluationResult {\n const [Component, setComponent] = useState<React.ComponentType | null>(null);\n const [error, setError] = useState<Error | null>(null);\n const [isLoading, setIsLoading] = useState(() => {\n if (!compiledCode) return false;\n const key = cacheKey || `mdx-${hashString(compiledCode)}`;\n return !compiledCache.has(key);\n });\n const [retryCount, setRetryCount] = useState(0);\n\n const retry = () => {\n if (compiledCode) {\n const key = cacheKey || `mdx-${hashString(compiledCode)}`;\n compiledCache.delete(key);\n }\n setRetryCount((prev) => prev + 1);\n };\n\n useEffect(() => {\n void retryCount;\n\n if (!compiledCode) {\n setComponent(null);\n setError(null);\n setIsLoading(false);\n return;\n }\n\n const key = cacheKey || `mdx-${hashString(compiledCode)}`;\n const cached = compiledCache.get(key);\n if (cached) {\n setComponent(() => cached);\n setError(null);\n setIsLoading(false);\n return;\n }\n\n let cancelled = false;\n\n const compileAndRun = async () => {\n try {\n setError(null);\n setIsLoading(true);\n\n const { default: MDXComponent } = await runMDX(compiledCode, runOptions);\n\n if (cancelled) return;\n\n compiledCache.set(key, MDXComponent);\n setComponent(() => MDXComponent);\n } catch (err) {\n if (cancelled) return;\n const evaluationError = err instanceof Error ? err : new Error('MDX evaluation failed');\n setError(evaluationError);\n setComponent(null);\n } finally {\n if (!cancelled) {\n setIsLoading(false);\n }\n }\n };\n\n compileAndRun();\n\n return () => {\n cancelled = true;\n };\n }, [compiledCode, cacheKey, retryCount]);\n\n return { Component, error, isLoading, retry };\n}\n","import type { MDXEditorMethods } from '@mdxeditor/editor';\nimport React from 'react';\nimport { BaseMDXEditor, type BaseMDXEditorProps } from './editor-core.js';\n\nexport interface MDXEditorProps\n extends Omit<\n BaseMDXEditorProps,\n 'disableImageSettingsButton' | 'imageButtonRef' | 'imageDialog' | 'onImageShortcut'\n > {}\n\nexport const MDXEditor = React.forwardRef<MDXEditorMethods, MDXEditorProps>((props, ref) => {\n return <BaseMDXEditor ref={ref} {...props} />;\n});\n\nMDXEditor.displayName = 'MDXEditor';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,wBAAwB,KAAsD,IAAI;AAE/F,MAAM,gBAAgB;AAMtB,MAAM,sBAAsB;AAS5B,SAAS,UAAU,MAAyB;CAC1C,MAAM,QAAQ,KAAK,MAAM,aAAa;CACtC,IAAI,CAAC,OAAO,OAAO;EAAE,OAAO;EAAI,MAAM,KAAK,KAAK;CAAE;CAGlD,OAAO;EA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,CAAC,WACH,aAAa,KAAK;GAEtB;EACF;EAEA,cAAc;EAEd,aAAa;GACX,YAAY;EACd;CACF,GAAG;EAAC;EAAc;EAAU;CAAU,CAAC;CAEvC,OAAO;EAAE;EAAW;EAAO;EAAW;CAAM;AAC9C;;;ACpIA,MAAa,YAAY,MAAM,YAA8C,OAAO,QAAQ;CAC1F,OAAO,oBAAC,eAAD;EAAoB;EAAK,GAAI;CAAQ,CAAA;AAC9C,CAAC;AAED,UAAU,cAAc"}
@@ -0,0 +1,3 @@
1
+ import type { Options as ToMarkdownOptions } from 'mdast-util-to-markdown';
2
+ export declare const TO_MARKDOWN_OPTIONS: ToMarkdownOptions;
3
+ //# sourceMappingURL=markdown-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-options.d.ts","sourceRoot":"","sources":["../src/markdown-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAY3E,eAAO,MAAM,mBAAmB,EAAE,iBAQjC,CAAC"}
@@ -0,0 +1,19 @@
1
+ // MDXEditor rebuilds the markdown body from its Lexical AST on every change
2
+ // via `mdast-util-to-markdown`. Without explicit options, the library defaults
3
+ // flip canonical project style: thematic breaks render as `***` instead of
4
+ // `---`, bullets pick `*` over `-`, and emphasis ambiguity inside GFM table
5
+ // cells inserts backslash escapes on every save. Pinning these to match the
6
+ // committed fixtures keeps no-op round-trips diff-clean.
7
+ //
8
+ // Exported as a plain TS module (no React deps) so it can be exercised
9
+ // directly from tests against `mdast-util-to-markdown` without mounting the
10
+ // editor.
11
+ export const TO_MARKDOWN_OPTIONS = {
12
+ bullet: '-',
13
+ rule: '-',
14
+ emphasis: '_',
15
+ strong: '*',
16
+ fence: '`',
17
+ listItemIndent: 'one',
18
+ tightDefinitions: true,
19
+ };
@@ -0,0 +1,3 @@
1
+ import type { MDXCompileResult } from '../types.js';
2
+ export declare function compileMDX(content: string): Promise<MDXCompileResult>;
3
+ //# sourceMappingURL=compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/mdx/compile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuB3E"}
@@ -0,0 +1,27 @@
1
+ import { compile as mdxCompile } from '@mdx-js/mdx';
2
+ import matter from 'gray-matter';
3
+ import remarkFrontmatter from 'remark-frontmatter';
4
+ import remarkGfm from 'remark-gfm';
5
+ import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
6
+ export async function compileMDX(content) {
7
+ try {
8
+ const { data: metadata } = matter(content, {});
9
+ const compiled = await mdxCompile(content, {
10
+ outputFormat: 'function-body',
11
+ development: process.env.NODE_ENV === 'development',
12
+ remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],
13
+ });
14
+ return {
15
+ code: String(compiled.value),
16
+ metadata: metadata,
17
+ };
18
+ }
19
+ catch (error) {
20
+ if (error instanceof Error) {
21
+ const enhancedError = new Error(`MDX compilation failed: ${error.message}`);
22
+ enhancedError.stack = error.stack;
23
+ throw enhancedError;
24
+ }
25
+ throw error;
26
+ }
27
+ }
@@ -0,0 +1,44 @@
1
+ import type { ComponentType } from 'react';
2
+ /**
3
+ * Evaluate MDX content string to a React component.
4
+ *
5
+ * This is a framework-agnostic utility for converting MDX strings into
6
+ * executable React components. Works in any Node.js environment (Astro,
7
+ * Next.js, Remix, etc.) at build time or server-side.
8
+ *
9
+ * **When to use:**
10
+ * - Building static sites with MDX content
11
+ * - Server-side rendering MDX as React components
12
+ * - Need React components (not HTML strings)
13
+ *
14
+ * @param mdxContent - The MDX string to evaluate
15
+ * @param options - Optional configuration
16
+ * @param options.development - Whether to use development mode (default: false)
17
+ * @returns Object containing Component (or null) and optional error
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { evaluateMDXToComponent } from '@conloca/mdx/node';
22
+ *
23
+ * const { Component, error } = await evaluateMDXToComponent('# Hello\n\nThis is **MDX**');
24
+ * if (error) {
25
+ * console.error('Failed to evaluate:', error);
26
+ * } else if (Component) {
27
+ * // Render <Component /> in your React app
28
+ * }
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // In Astro pages
34
+ * const { Component } = await evaluateMDXToComponent(mdxContent);
35
+ * // Then render in JSX: <Component />
36
+ * ```
37
+ */
38
+ export declare function evaluateMDXToComponent(mdxContent: string, options?: {
39
+ development?: boolean;
40
+ }): Promise<{
41
+ Component: ComponentType | null;
42
+ error?: Error;
43
+ }>;
44
+ //# sourceMappingURL=evaluate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/mdx/evaluate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAM3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAClC,OAAO,CAAC;IAAE,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAe7D"}
@@ -0,0 +1,57 @@
1
+ import { evaluate } from '@mdx-js/mdx';
2
+ import * as runtime from 'react/jsx-runtime';
3
+ import remarkFrontmatter from 'remark-frontmatter';
4
+ import remarkGfm from 'remark-gfm';
5
+ import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
6
+ /**
7
+ * Evaluate MDX content string to a React component.
8
+ *
9
+ * This is a framework-agnostic utility for converting MDX strings into
10
+ * executable React components. Works in any Node.js environment (Astro,
11
+ * Next.js, Remix, etc.) at build time or server-side.
12
+ *
13
+ * **When to use:**
14
+ * - Building static sites with MDX content
15
+ * - Server-side rendering MDX as React components
16
+ * - Need React components (not HTML strings)
17
+ *
18
+ * @param mdxContent - The MDX string to evaluate
19
+ * @param options - Optional configuration
20
+ * @param options.development - Whether to use development mode (default: false)
21
+ * @returns Object containing Component (or null) and optional error
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * import { evaluateMDXToComponent } from '@conloca/mdx/node';
26
+ *
27
+ * const { Component, error } = await evaluateMDXToComponent('# Hello\n\nThis is **MDX**');
28
+ * if (error) {
29
+ * console.error('Failed to evaluate:', error);
30
+ * } else if (Component) {
31
+ * // Render <Component /> in your React app
32
+ * }
33
+ * ```
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * // In Astro pages
38
+ * const { Component } = await evaluateMDXToComponent(mdxContent);
39
+ * // Then render in JSX: <Component />
40
+ * ```
41
+ */
42
+ export async function evaluateMDXToComponent(mdxContent, options) {
43
+ try {
44
+ const { default: MDXComponent } = await evaluate(mdxContent, {
45
+ ...runtime,
46
+ remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],
47
+ development: options?.development ?? false,
48
+ });
49
+ return { Component: MDXComponent };
50
+ }
51
+ catch (error) {
52
+ return {
53
+ Component: null,
54
+ error: error instanceof Error ? error : new Error('MDX evaluation failed'),
55
+ };
56
+ }
57
+ }
@@ -0,0 +1,7 @@
1
+ import type { MDXEditorMethods } from '@mdxeditor/editor';
2
+ import React from 'react';
3
+ import { type BaseMDXEditorProps } from './editor-core.js';
4
+ export interface MDXEditorProps extends Omit<BaseMDXEditorProps, 'disableImageSettingsButton' | 'imageButtonRef' | 'imageDialog' | 'onImageShortcut'> {
5
+ }
6
+ export declare const MDXEditor: React.ForwardRefExoticComponent<MDXEditorProps & React.RefAttributes<MDXEditorMethods>>;
7
+ //# sourceMappingURL=mdx-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-editor.d.ts","sourceRoot":"","sources":["../src/mdx-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,WAAW,cACf,SAAQ,IAAI,CACV,kBAAkB,EAClB,4BAA4B,GAAG,gBAAgB,GAAG,aAAa,GAAG,iBAAiB,CACpF;CAAG;AAEN,eAAO,MAAM,SAAS,yFAEpB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { BaseMDXEditor } from './editor-core.js';
4
+ export const MDXEditor = React.forwardRef((props, ref) => {
5
+ return _jsx(BaseMDXEditor, { ref: ref, ...props });
6
+ });
7
+ MDXEditor.displayName = 'MDXEditor';
package/dist/node.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ComponentType } from "react";
2
2
  import { MDXCompileResponse as MDXCompileResult } from "@conloca/content-api";
3
-
4
3
  //#region src/types.d.ts
5
4
  interface EvaluatedMDXBlock {
6
5
  ok: true;
@@ -53,10 +52,6 @@ interface BlockAPI {
53
52
  declare function evaluateMDXBlocks(api: BlockAPI, locale: string): Promise<MDXBlockEvaluationResult[]>;
54
53
  //#endregion
55
54
  //#region src/mdx/compile.d.ts
56
- /**
57
- * Compile MDX content to executable JavaScript.
58
- * Delegates to the shared compiler in @conloca/content-api.
59
- */
60
55
  declare function compileMDX(content: string): Promise<MDXCompileResult>;
61
56
  //#endregion
62
57
  //#region src/mdx/evaluate.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.mts","names":[],"sources":["../src/types.ts","../src/blocks.ts","../src/mdx/compile.ts","../src/mdx/evaluate.ts"],"mappings":";;;;UAIiB,iBAAA;EACf,EAAA;EACA,EAAA;EACA,KAAA;EACA,SAAA,EAAW,aAAA;AAAA;AAAA,UAGI,wBAAA;EACf,EAAA;EACA,EAAA;EACA,KAAA;EACA,KAAA,EAAO,KAAA;AAAA;AAAA,KAGG,wBAAA,GAA2B,iBAAA,GAAoB,wBAAA;;;UCfjD,kBAAA;EACR,IAAA;IACE,KAAA;EAAA;EAEF,IAAA;AAAA;AAAA,UAGQ,aAAA;EACR,EAAA;EACA,OAAA,EAAS,MAAA,SAAe,kBAAA;AAAA;AAAA,UAGhB,mBAAA;EACR,SAAA;IACE,IAAA;MACE,KAAA;IAAA;IAEF,IAAA;IACA,OAAA;MACE,GAAA;IAAA;EAAA;AAAA;AAAA,UAKI,QAAA;EACR,cAAA,CAAe,OAAA;IAAW,IAAA;EAAA,IAAkB,QAAA,CAAS,aAAA;EACrD,YAAA,CAAa,EAAA,UAAY,MAAA,WAAiB,OAAA,CAAQ,mBAAA;AAAA;;;;;;;iBAS9B,iBAAA,CAAkB,GAAA,EAAK,QAAA,EAAU,MAAA,WAAiB,OAAA,CAAQ,wBAAA;;;;;;ADlChF;iBEGsB,UAAA,CAAW,OAAA,WAAkB,OAAA,CAAQ,gBAAA;;;;;;AFH3D;;;;;;;;;;;AAOA;;;;;;;;;;;AAOA;;;;;;;;ACjB2D;;;iBE0CrC,sBAAA,CACpB,UAAA,UACA,OAAA;EAAY,WAAA;AAAA,IACX,OAAA;EAAU,SAAA,EAAW,aAAA;EAAsB,KAAA,GAAQ,KAAA;AAAA"}
1
+ {"version":3,"file":"node.d.mts","names":[],"sources":["../src/types.ts","../src/blocks.ts","../src/mdx/compile.ts","../src/mdx/evaluate.ts"],"mappings":";;;UAIiB;EACf;EACA;EACA;EACA,WAAW;;UAGI;EACf;EACA;EACA;EACA,OAAO;;KAGG,2BAA2B,oBAAoB;;;UCfjD;EACR;IACE;;EAEF;;UAGQ;EACR;EACA,SAAS,eAAe;;UAGhB;EACR;IACE;MACE;;IAEF;IACA;MACE;;;;UAKI;EACR,eAAe;IAAW;MAAkB,SAAS;EACrD,aAAa,YAAY,iBAAiB,QAAQ;;;;;;;;iBAS9B,kBAAkB,KAAK,UAAU,iBAAiB,QAAQ;;;iBC/B1D,WAAW,kBAAkB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCoCrC,uBACpB,oBACA;EAAY;IACX;EAAU,WAAW;EAAsB,QAAQ"}
package/dist/node.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Node.js-specific exports for @conloca/mdx
3
+ *
4
+ * These exports require Node.js runtime APIs and should not be imported in browser environments.
5
+ * Import from '@conloca/mdx/node' for server-side MDX operations.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // Server-side code (Astro, Next.js, etc.)
10
+ * import { evaluateMDXToComponent } from '@conloca/mdx/node';
11
+ * ```
12
+ */
13
+ export { evaluateMDXBlocks } from './blocks.js';
14
+ export { compileMDX } from './mdx/compile.js';
15
+ export { evaluateMDXToComponent } from './mdx/evaluate.js';
16
+ export type { EvaluatedMDXBlock, FailedMDXBlockEvaluation, MDXBlockEvaluationResult, MDXCompileResult, } from './types.js';
17
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
package/dist/node.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Node.js-specific exports for @conloca/mdx
3
+ *
4
+ * These exports require Node.js runtime APIs and should not be imported in browser environments.
5
+ * Import from '@conloca/mdx/node' for server-side MDX operations.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // Server-side code (Astro, Next.js, etc.)
10
+ * import { evaluateMDXToComponent } from '@conloca/mdx/node';
11
+ * ```
12
+ */
13
+ export { evaluateMDXBlocks } from './blocks.js';
14
+ // MDX compilation and evaluation (Node.js only)
15
+ export { compileMDX } from './mdx/compile.js';
16
+ export { evaluateMDXToComponent } from './mdx/evaluate.js';
package/dist/node.mjs CHANGED
@@ -1,10 +1,9 @@
1
1
  import * as runtime from "react/jsx-runtime";
2
- import { evaluate } from "@mdx-js/mdx";
2
+ import { compile, evaluate } from "@mdx-js/mdx";
3
3
  import remarkFrontmatter from "remark-frontmatter";
4
4
  import remarkGfm from "remark-gfm";
5
5
  import remarkMdxFrontmatter from "remark-mdx-frontmatter";
6
- import { compileMDX as compileMDX$1 } from "@conloca/content-api/node";
7
-
6
+ import matter from "gray-matter";
8
7
  //#region src/mdx/evaluate.ts
9
8
  /**
10
9
  * Evaluate MDX content string to a React component.
@@ -61,7 +60,6 @@ async function evaluateMDXToComponent(mdxContent, options) {
61
60
  };
62
61
  }
63
62
  }
64
-
65
63
  //#endregion
66
64
  //#region src/blocks.ts
67
65
  /**
@@ -109,17 +107,34 @@ async function evaluateMDXBlocks(api, locale) {
109
107
  }
110
108
  }));
111
109
  }
112
-
113
110
  //#endregion
114
111
  //#region src/mdx/compile.ts
115
- /**
116
- * Compile MDX content to executable JavaScript.
117
- * Delegates to the shared compiler in @conloca/content-api.
118
- */
119
112
  async function compileMDX(content) {
120
- return compileMDX$1(content);
113
+ try {
114
+ const { data: metadata } = matter(content, {});
115
+ const compiled = await compile(content, {
116
+ outputFormat: "function-body",
117
+ development: process.env.NODE_ENV === "development",
118
+ remarkPlugins: [
119
+ remarkFrontmatter,
120
+ remarkMdxFrontmatter,
121
+ remarkGfm
122
+ ]
123
+ });
124
+ return {
125
+ code: String(compiled.value),
126
+ metadata
127
+ };
128
+ } catch (error) {
129
+ if (error instanceof Error) {
130
+ const enhancedError = /* @__PURE__ */ new Error(`MDX compilation failed: ${error.message}`);
131
+ enhancedError.stack = error.stack;
132
+ throw enhancedError;
133
+ }
134
+ throw error;
135
+ }
121
136
  }
122
-
123
137
  //#endregion
124
138
  export { compileMDX, evaluateMDXBlocks, evaluateMDXToComponent };
139
+
125
140
  //# sourceMappingURL=node.mjs.map
package/dist/node.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.mjs","names":["compileSharedMDX"],"sources":["../src/mdx/evaluate.ts","../src/blocks.ts","../src/mdx/compile.ts"],"sourcesContent":["import { evaluate } from '@mdx-js/mdx';\nimport type { ComponentType } from 'react';\nimport * as runtime from 'react/jsx-runtime';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdxFrontmatter from 'remark-mdx-frontmatter';\n\n/**\n * Evaluate MDX content string to a React component.\n *\n * This is a framework-agnostic utility for converting MDX strings into\n * executable React components. Works in any Node.js environment (Astro,\n * Next.js, Remix, etc.) at build time or server-side.\n *\n * **When to use:**\n * - Building static sites with MDX content\n * - Server-side rendering MDX as React components\n * - Need React components (not HTML strings)\n *\n * @param mdxContent - The MDX string to evaluate\n * @param options - Optional configuration\n * @param options.development - Whether to use development mode (default: false)\n * @returns Object containing Component (or null) and optional error\n *\n * @example\n * ```typescript\n * import { evaluateMDXToComponent } from '@conloca/mdx/node';\n *\n * const { Component, error } = await evaluateMDXToComponent('# Hello\\n\\nThis is **MDX**');\n * if (error) {\n * console.error('Failed to evaluate:', error);\n * } else if (Component) {\n * // Render <Component /> in your React app\n * }\n * ```\n *\n * @example\n * ```typescript\n * // In Astro pages\n * const { Component } = await evaluateMDXToComponent(mdxContent);\n * // Then render in JSX: <Component />\n * ```\n */\nexport async function evaluateMDXToComponent(\n mdxContent: string,\n options?: { development?: boolean },\n): Promise<{ Component: ComponentType | null; error?: Error }> {\n try {\n // Use evaluate() to compile and execute MDX in one step\n const { default: MDXComponent } = await evaluate(mdxContent, {\n ...runtime,\n remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],\n development: options?.development ?? false,\n });\n\n return { Component: MDXComponent };\n } catch (error) {\n return {\n Component: null,\n error: error instanceof Error ? error : new Error('MDX evaluation failed'),\n };\n }\n}\n","import { evaluateMDXToComponent } from './mdx/evaluate.js';\nimport type { MDXBlockEvaluationResult } from './types.js';\n\ninterface BlockLocaleSummary {\n meta?: {\n title?: string;\n };\n name?: string;\n}\n\ninterface BlockManifest {\n id: string;\n locales: Record<string, BlockLocaleSummary | undefined>;\n}\n\ninterface BlockLocalizedEntry {\n localized?: {\n meta?: {\n title?: string;\n };\n name?: string;\n content?: {\n mdx?: string;\n };\n };\n}\n\ninterface BlockAPI {\n listAllContent(filters: { kind: 'block' }): Iterable<BlockManifest>;\n getLocalized(id: string, locale: string): Promise<BlockLocalizedEntry | null>;\n}\n\n/**\n * Evaluate all MDX blocks from a compatible content API.\n *\n * Returns structured success/error results so callers can decide how to\n * surface broken blocks instead of hardcoding fallback UI in this package.\n */\nexport async function evaluateMDXBlocks(api: BlockAPI, locale: string): Promise<MDXBlockEvaluationResult[]> {\n const blocks = Array.from(api.listAllContent({ kind: 'block' }));\n\n return Promise.all(\n blocks.map(async (block) => {\n const locales = Object.keys(block.locales);\n const firstLocale = locales.length > 0 ? block.locales[locales[0]] : null;\n const manifestTitle = firstLocale?.meta?.title || firstLocale?.name || block.id;\n\n try {\n const blockLocalized = await api.getLocalized(block.id, locale);\n const blockTitle = blockLocalized?.localized?.meta?.title || blockLocalized?.localized?.name || manifestTitle;\n const mdxContent = blockLocalized?.localized?.content?.mdx;\n\n if (!mdxContent) {\n return {\n ok: false,\n id: block.id,\n title: blockTitle,\n error: new Error(`No MDX content found for block: ${block.id}`),\n };\n }\n\n const { Component: EvaluatedComponent, error } = await evaluateMDXToComponent(mdxContent);\n\n if (error || !EvaluatedComponent) {\n return {\n ok: false,\n id: block.id,\n title: blockTitle,\n error: error || new Error(`MDX evaluation failed for block: ${block.id}`),\n };\n }\n\n return {\n ok: true,\n id: block.id,\n title: blockTitle,\n Component: EvaluatedComponent,\n };\n } catch (error) {\n return {\n ok: false,\n id: block.id,\n title: manifestTitle,\n error: error instanceof Error ? error : new Error(`Failed to evaluate block: ${block.id}`),\n };\n }\n }),\n );\n}\n","import { compileMDX as compileSharedMDX } from '@conloca/content-api/node';\nimport type { MDXCompileResult } from '../types.js';\n\n/**\n * Compile MDX content to executable JavaScript.\n * Delegates to the shared compiler in @conloca/content-api.\n */\nexport async function compileMDX(content: string): Promise<MDXCompileResult> {\n return compileSharedMDX(content);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,eAAsB,uBACpB,YACA,SAC6D;AAC7D,KAAI;EAEF,MAAM,EAAE,SAAS,iBAAiB,MAAM,SAAS,YAAY;GAC3D,GAAG;GACH,eAAe;IAAC;IAAmB;IAAsB;IAAU;GACnE,aAAa,SAAS,eAAe;GACtC,CAAC;AAEF,SAAO,EAAE,WAAW,cAAc;UAC3B,OAAO;AACd,SAAO;GACL,WAAW;GACX,OAAO,iBAAiB,QAAQ,wBAAQ,IAAI,MAAM,wBAAwB;GAC3E;;;;;;;;;;;;ACtBL,eAAsB,kBAAkB,KAAe,QAAqD;CAC1G,MAAM,SAAS,MAAM,KAAK,IAAI,eAAe,EAAE,MAAM,SAAS,CAAC,CAAC;AAEhE,QAAO,QAAQ,IACb,OAAO,IAAI,OAAO,UAAU;EAC1B,MAAM,UAAU,OAAO,KAAK,MAAM,QAAQ;EAC1C,MAAM,cAAc,QAAQ,SAAS,IAAI,MAAM,QAAQ,QAAQ,MAAM;EACrE,MAAM,gBAAgB,aAAa,MAAM,SAAS,aAAa,QAAQ,MAAM;AAE7E,MAAI;GACF,MAAM,iBAAiB,MAAM,IAAI,aAAa,MAAM,IAAI,OAAO;GAC/D,MAAM,aAAa,gBAAgB,WAAW,MAAM,SAAS,gBAAgB,WAAW,QAAQ;GAChG,MAAM,aAAa,gBAAgB,WAAW,SAAS;AAEvD,OAAI,CAAC,WACH,QAAO;IACL,IAAI;IACJ,IAAI,MAAM;IACV,OAAO;IACP,uBAAO,IAAI,MAAM,mCAAmC,MAAM,KAAK;IAChE;GAGH,MAAM,EAAE,WAAW,oBAAoB,UAAU,MAAM,uBAAuB,WAAW;AAEzF,OAAI,SAAS,CAAC,mBACZ,QAAO;IACL,IAAI;IACJ,IAAI,MAAM;IACV,OAAO;IACP,OAAO,yBAAS,IAAI,MAAM,oCAAoC,MAAM,KAAK;IAC1E;AAGH,UAAO;IACL,IAAI;IACJ,IAAI,MAAM;IACV,OAAO;IACP,WAAW;IACZ;WACM,OAAO;AACd,UAAO;IACL,IAAI;IACJ,IAAI,MAAM;IACV,OAAO;IACP,OAAO,iBAAiB,QAAQ,wBAAQ,IAAI,MAAM,6BAA6B,MAAM,KAAK;IAC3F;;GAEH,CACH;;;;;;;;;AChFH,eAAsB,WAAW,SAA4C;AAC3E,QAAOA,aAAiB,QAAQ"}
1
+ {"version":3,"file":"node.mjs","names":["mdxCompile"],"sources":["../src/mdx/evaluate.ts","../src/blocks.ts","../src/mdx/compile.ts"],"sourcesContent":["import { evaluate } from '@mdx-js/mdx';\nimport type { ComponentType } from 'react';\nimport * as runtime from 'react/jsx-runtime';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdxFrontmatter from 'remark-mdx-frontmatter';\n\n/**\n * Evaluate MDX content string to a React component.\n *\n * This is a framework-agnostic utility for converting MDX strings into\n * executable React components. Works in any Node.js environment (Astro,\n * Next.js, Remix, etc.) at build time or server-side.\n *\n * **When to use:**\n * - Building static sites with MDX content\n * - Server-side rendering MDX as React components\n * - Need React components (not HTML strings)\n *\n * @param mdxContent - The MDX string to evaluate\n * @param options - Optional configuration\n * @param options.development - Whether to use development mode (default: false)\n * @returns Object containing Component (or null) and optional error\n *\n * @example\n * ```typescript\n * import { evaluateMDXToComponent } from '@conloca/mdx/node';\n *\n * const { Component, error } = await evaluateMDXToComponent('# Hello\\n\\nThis is **MDX**');\n * if (error) {\n * console.error('Failed to evaluate:', error);\n * } else if (Component) {\n * // Render <Component /> in your React app\n * }\n * ```\n *\n * @example\n * ```typescript\n * // In Astro pages\n * const { Component } = await evaluateMDXToComponent(mdxContent);\n * // Then render in JSX: <Component />\n * ```\n */\nexport async function evaluateMDXToComponent(\n mdxContent: string,\n options?: { development?: boolean },\n): Promise<{ Component: ComponentType | null; error?: Error }> {\n try {\n const { default: MDXComponent } = await evaluate(mdxContent, {\n ...runtime,\n remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],\n development: options?.development ?? false,\n });\n\n return { Component: MDXComponent };\n } catch (error) {\n return {\n Component: null,\n error: error instanceof Error ? error : new Error('MDX evaluation failed'),\n };\n }\n}\n","import { evaluateMDXToComponent } from './mdx/evaluate.js';\nimport type { MDXBlockEvaluationResult } from './types.js';\n\ninterface BlockLocaleSummary {\n meta?: {\n title?: string;\n };\n name?: string;\n}\n\ninterface BlockManifest {\n id: string;\n locales: Record<string, BlockLocaleSummary | undefined>;\n}\n\ninterface BlockLocalizedEntry {\n localized?: {\n meta?: {\n title?: string;\n };\n name?: string;\n content?: {\n mdx?: string;\n };\n };\n}\n\ninterface BlockAPI {\n listAllContent(filters: { kind: 'block' }): Iterable<BlockManifest>;\n getLocalized(id: string, locale: string): Promise<BlockLocalizedEntry | null>;\n}\n\n/**\n * Evaluate all MDX blocks from a compatible content API.\n *\n * Returns structured success/error results so callers can decide how to\n * surface broken blocks instead of hardcoding fallback UI in this package.\n */\nexport async function evaluateMDXBlocks(api: BlockAPI, locale: string): Promise<MDXBlockEvaluationResult[]> {\n const blocks = Array.from(api.listAllContent({ kind: 'block' }));\n\n return Promise.all(\n blocks.map(async (block) => {\n const locales = Object.keys(block.locales);\n const firstLocale = locales.length > 0 ? block.locales[locales[0]] : null;\n const manifestTitle = firstLocale?.meta?.title || firstLocale?.name || block.id;\n\n try {\n const blockLocalized = await api.getLocalized(block.id, locale);\n const blockTitle = blockLocalized?.localized?.meta?.title || blockLocalized?.localized?.name || manifestTitle;\n const mdxContent = blockLocalized?.localized?.content?.mdx;\n\n if (!mdxContent) {\n return {\n ok: false,\n id: block.id,\n title: blockTitle,\n error: new Error(`No MDX content found for block: ${block.id}`),\n };\n }\n\n const { Component: EvaluatedComponent, error } = await evaluateMDXToComponent(mdxContent);\n\n if (error || !EvaluatedComponent) {\n return {\n ok: false,\n id: block.id,\n title: blockTitle,\n error: error || new Error(`MDX evaluation failed for block: ${block.id}`),\n };\n }\n\n return {\n ok: true,\n id: block.id,\n title: blockTitle,\n Component: EvaluatedComponent,\n };\n } catch (error) {\n return {\n ok: false,\n id: block.id,\n title: manifestTitle,\n error: error instanceof Error ? error : new Error(`Failed to evaluate block: ${block.id}`),\n };\n }\n }),\n );\n}\n","import { compile as mdxCompile } from '@mdx-js/mdx';\nimport matter from 'gray-matter';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdxFrontmatter from 'remark-mdx-frontmatter';\nimport type { MDXCompileResult } from '../types.js';\n\nexport async function compileMDX(content: string): Promise<MDXCompileResult> {\n try {\n const { data: metadata } = matter(content, {});\n\n const compiled = await mdxCompile(content, {\n outputFormat: 'function-body',\n development: process.env.NODE_ENV === 'development',\n remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],\n });\n\n return {\n code: String(compiled.value),\n metadata: metadata as Record<string, unknown>,\n };\n } catch (error) {\n if (error instanceof Error) {\n const enhancedError = new Error(`MDX compilation failed: ${error.message}`);\n enhancedError.stack = error.stack;\n throw enhancedError;\n }\n\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,eAAsB,uBACpB,YACA,SAC6D;CAC7D,IAAI;EACF,MAAM,EAAE,SAAS,iBAAiB,MAAM,SAAS,YAAY;GAC3D,GAAG;GACH,eAAe;IAAC;IAAmB;IAAsB;GAAS;GAClE,aAAa,SAAS,eAAe;EACvC,CAAC;EAED,OAAO,EAAE,WAAW,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AE,MAAM,aAAa,OAAO,SAAS,CAAC,CAAC;EAE7C,MAAM,WAAW,MAAMA,QAAW,SAAS;GACzC,cAAc;GACd,aAAa,QAAQ,IAAI,aAAa;GACtC,eAAe;IAAC;IAAmB;IAAsB;GAAS;EACpE,CAAC;EAED,OAAO;GACL,MAAM,OAAO,SAAS,KAAK;GACjB;EACZ;CACF,SAAS,OAAO;EACd,IAAI,iBAAiB,OAAO;GAC1B,MAAM,gCAAgB,IAAI,MAAM,2BAA2B,MAAM,SAAS;GAC1E,cAAc,QAAQ,MAAM;GAC5B,MAAM;EACR;EAEA,MAAM;CACR;AACF"}
package/dist/style.css ADDED
@@ -0,0 +1,88 @@
1
+ .mdxeditor-toolbar-wrap {
2
+ flex-wrap: wrap;
3
+ flex-shrink: 0;
4
+ row-gap: 4px;
5
+ }
6
+
7
+ .mdxeditor {
8
+ flex-direction: column;
9
+ height: 100%;
10
+ min-height: 0;
11
+ display: flex;
12
+ }
13
+
14
+ .mdxeditor-diff-source-wrapper {
15
+ flex: 1;
16
+ min-height: 0;
17
+ overflow-y: auto;
18
+ }
19
+
20
+ .mdxeditor-toolbar-wrap [aria-label="Block type"] > span:first-child:empty:before {
21
+ content: "Block";
22
+ opacity: .6;
23
+ }
24
+
25
+ @media (width <= 640px) {
26
+ .mdxeditor-toolbar-wrap {
27
+ gap: 2px;
28
+ }
29
+
30
+ .mdxeditor-toolbar-wrap button {
31
+ padding-inline: 4px;
32
+ }
33
+
34
+ .mdxeditor-toolbar-wrap [data-orientation="vertical"] {
35
+ display: none;
36
+ }
37
+
38
+ .mdxeditor-toolbar-wrap > div:first-child {
39
+ flex-wrap: wrap;
40
+ row-gap: 2px;
41
+ }
42
+ }
43
+
44
+ [class*="_contentEditable_"].conloca-prose {
45
+ font-family: var(--conloca-host-font-family, inherit);
46
+ font-size: var(--conloca-host-font-size, inherit);
47
+ font-weight: var(--conloca-host-font-weight, inherit);
48
+ font-style: var(--conloca-host-font-style, inherit);
49
+ line-height: var(--conloca-host-line-height, inherit);
50
+ letter-spacing: var(--conloca-host-letter-spacing, inherit);
51
+ color: var(--conloca-host-color, inherit);
52
+ }
53
+
54
+ .conloca-prose [class*="_listitem_"] {
55
+ margin-block: 0;
56
+ }
57
+
58
+ .conloca-code-block [class*="codeMirrorWrapper"] {
59
+ background: none;
60
+ border: 0;
61
+ border-radius: 0;
62
+ margin: 0;
63
+ padding: 0;
64
+ position: static;
65
+ }
66
+
67
+ .conloca-code-block {
68
+ position: relative;
69
+ }
70
+
71
+ .conloca-code-block__filename {
72
+ all: unset;
73
+ font: inherit;
74
+ color: inherit;
75
+ cursor: text;
76
+ box-sizing: border-box;
77
+ width: 100%;
78
+ min-width: 0;
79
+ }
80
+
81
+ .conloca-code-block__filename:focus {
82
+ outline-offset: 2px;
83
+ outline: 1px dashed;
84
+ }
85
+
86
+ .conloca-code-block .cm-editor, .conloca-code-block .cm-editor .cm-scroller, .conloca-code-block .cm-editor .cm-gutters, .conloca-code-block .cm-editor .cm-content, .conloca-code-block .cm-editor .cm-line {
87
+ background: none;
88
+ }
@@ -0,0 +1,16 @@
1
+ import type { ComponentType } from 'react';
2
+ export type { MDXCompileResponse as MDXCompileResult } from '@conloca/content-api';
3
+ export interface EvaluatedMDXBlock {
4
+ ok: true;
5
+ id: string;
6
+ title: string;
7
+ Component: ComponentType;
8
+ }
9
+ export interface FailedMDXBlockEvaluation {
10
+ ok: false;
11
+ id: string;
12
+ title: string;
13
+ error: Error;
14
+ }
15
+ export type MDXBlockEvaluationResult = EvaluatedMDXBlock | FailedMDXBlockEvaluation;
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,YAAY,EAAE,kBAAkB,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,IAAI,CAAC;IACT,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,KAAK,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,GAAG,wBAAwB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};