markdown-flow-ui 0.2.14 → 0.2.16-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/assets/markdown-flow-ui.css +10 -1
- package/dist/components/ContentRender/CodeBlock.cjs +1 -1
- package/dist/components/ContentRender/CodeBlock.cjs.map +1 -1
- package/dist/components/ContentRender/CodeBlock.d.ts +5 -0
- package/dist/components/ContentRender/CodeBlock.es.js +41 -38
- package/dist/components/ContentRender/CodeBlock.es.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.cjs +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
- package/dist/components/ContentRender/ContentRender.d.ts +12 -4
- package/dist/components/ContentRender/ContentRender.es.js +436 -306
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.cjs +7 -7
- package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.d.ts +5 -1
- package/dist/components/ContentRender/IframeSandbox.es.js +311 -266
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.cjs +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.cjs.map +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.d.ts +5 -1
- package/dist/components/ContentRender/MarkdownFlowInput.es.js +37 -32
- package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.cjs +2 -2
- package/dist/components/ContentRender/SandboxApp.cjs.map +1 -1
- package/dist/components/ContentRender/SandboxApp.d.ts +5 -1
- package/dist/components/ContentRender/SandboxApp.es.js +108 -103
- package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
- package/dist/components/ContentRender/blackboard-vendor.d.ts +1 -1
- package/dist/components/ContentRender/contentRenderI18n.cjs +1 -1
- package/dist/components/ContentRender/contentRenderI18n.cjs.map +1 -1
- package/dist/components/ContentRender/contentRenderI18n.d.ts +6 -1
- package/dist/components/ContentRender/contentRenderI18n.es.js +5 -56
- package/dist/components/ContentRender/contentRenderI18n.es.js.map +1 -1
- package/dist/components/ContentRender/contentRenderI18n.test.d.ts +1 -0
- package/dist/components/ContentRender/index.cjs +1 -1
- package/dist/components/ContentRender/index.d.ts +11 -11
- package/dist/components/ContentRender/index.es.js +1 -2
- package/dist/components/ContentRender/index.es.js.map +1 -1
- package/dist/components/ContentRender/locales/contentRender.json.cjs +2 -0
- package/dist/components/ContentRender/locales/contentRender.json.cjs.map +1 -0
- package/dist/components/ContentRender/locales/contentRender.json.d.ts +90 -0
- package/dist/components/ContentRender/locales/contentRender.json.es.js +11 -0
- package/dist/components/ContentRender/locales/contentRender.json.es.js.map +1 -0
- package/dist/components/ContentRender/plugins/CustomVariable.cjs +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.d.ts +7 -3
- package/dist/components/ContentRender/plugins/CustomVariable.es.js +165 -151
- package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
- package/dist/components/ContentRender/plugins/MermaidChart.cjs +1 -1
- package/dist/components/ContentRender/plugins/MermaidChart.cjs.map +1 -1
- package/dist/components/ContentRender/plugins/MermaidChart.d.ts +1 -0
- package/dist/components/ContentRender/plugins/MermaidChart.es.js +68 -44
- package/dist/components/ContentRender/plugins/MermaidChart.es.js.map +1 -1
- package/dist/components/ContentRender/typewriterPacing.fixtures.d.ts +14 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.cjs +3 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.cjs.map +1 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.d.ts +27 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.es.js +98 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.es.js.map +1 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.test.d.ts +1 -0
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +12 -4
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js +51 -39
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomButton.d.ts +31 -1
- package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js +46 -17
- package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs +2 -0
- package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs.map +1 -0
- package/dist/components/MarkdownFlow/ScrollToBottomControl.d.ts +18 -0
- package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js +47 -0
- package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js.map +1 -0
- package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.cjs +1 -1
- package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.cjs.map +1 -1
- package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.d.ts +1 -1
- package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.es.js +33 -52
- package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.es.js.map +1 -1
- package/dist/components/MarkdownFlow/index.cjs +1 -1
- package/dist/components/MarkdownFlow/index.d.ts +9 -6
- package/dist/components/MarkdownFlow/index.es.js +6 -6
- package/dist/components/MarkdownFlow/index.es.js.map +1 -1
- package/dist/components/MarkdownFlow/useScrollToBottom.cjs +1 -1
- package/dist/components/MarkdownFlow/useScrollToBottom.cjs.map +1 -1
- package/dist/components/MarkdownFlow/useScrollToBottom.d.ts +40 -8
- package/dist/components/MarkdownFlow/useScrollToBottom.es.js +352 -83
- package/dist/components/MarkdownFlow/useScrollToBottom.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +5 -3
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +371 -324
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/CustomDialog.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/CustomDialog.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/CustomDialog.d.ts +10 -0
- package/dist/components/MarkdownFlowEditor/components/CustomDialog.es.js +22 -19
- package/dist/components/MarkdownFlowEditor/components/CustomDialog.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.d.ts +8 -0
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js +19 -15
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.d.ts +4 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +99 -93
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/ImageInject.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/ImageInject.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/ImageInject.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/components/ImageInject.es.js +183 -182
- package/dist/components/MarkdownFlowEditor/components/ImageInject.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js +107 -103
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +106 -106
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/VideoInject.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/VideoInject.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/VideoInject.es.js +64 -63
- package/dist/components/MarkdownFlowEditor/components/VideoInject.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.es.js +13 -13
- package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js +12 -12
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editor-context.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +290 -0
- package/dist/components/MarkdownFlowEditor/editorI18n.es.js +12 -8
- package/dist/components/MarkdownFlowEditor/editorI18n.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.test.d.ts +1 -0
- package/dist/components/MarkdownFlowEditor/index.d.ts +6 -6
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +2 -0
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs.map +1 -0
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +72 -0
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +140 -0
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -0
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +2 -0
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +118 -114
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +2 -0
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +118 -114
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +2 -0
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs.map +1 -0
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +72 -0
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +140 -0
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -0
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +2 -0
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +70 -66
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +40 -35
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +27 -23
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.cjs +2 -0
- package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.cjs.map +1 -0
- package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.d.ts +7 -0
- package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.es.js +12 -0
- package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.es.js.map +1 -0
- package/dist/components/MarkdownFlowEditor/utils.d.ts +1 -1
- package/dist/components/Slide/MarkdownSlideScaling.cjs +1 -1
- package/dist/components/Slide/MarkdownSlideScaling.cjs.map +1 -1
- package/dist/components/Slide/MarkdownSlideScaling.d.ts +1 -1
- package/dist/components/Slide/MarkdownSlideScaling.es.js +20 -20
- package/dist/components/Slide/MarkdownSlideScaling.es.js.map +1 -1
- package/dist/components/Slide/MobilePlayerSettingsSheet.cjs +1 -1
- package/dist/components/Slide/MobilePlayerSettingsSheet.cjs.map +1 -1
- package/dist/components/Slide/MobilePlayerSettingsSheet.d.ts +7 -2
- package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +61 -57
- package/dist/components/Slide/MobilePlayerSettingsSheet.es.js.map +1 -1
- package/dist/components/Slide/Player.cjs +1 -1
- package/dist/components/Slide/Player.cjs.map +1 -1
- package/dist/components/Slide/Player.d.ts +6 -6
- package/dist/components/Slide/Player.es.js +547 -541
- package/dist/components/Slide/Player.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs +1 -1
- package/dist/components/Slide/Slide.cjs.map +1 -1
- package/dist/components/Slide/Slide.d.ts +14 -12
- package/dist/components/Slide/Slide.es.js +745 -726
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/SubtitleOverlay.cjs +1 -1
- package/dist/components/Slide/SubtitleOverlay.cjs.map +1 -1
- package/dist/components/Slide/SubtitleOverlay.d.ts +2 -2
- package/dist/components/Slide/SubtitleOverlay.es.js +17 -17
- package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
- package/dist/components/Slide/diff-utils.d.ts +1 -1
- package/dist/components/Slide/index.d.ts +12 -12
- package/dist/components/Slide/locales/slide.json.cjs +2 -0
- package/dist/components/Slide/locales/slide.json.cjs.map +1 -0
- package/dist/components/Slide/locales/slide.json.d.ts +205 -0
- package/dist/components/Slide/locales/slide.json.es.js +11 -0
- package/dist/components/Slide/locales/slide.json.es.js.map +1 -0
- package/dist/components/Slide/slideI18n.cjs +1 -1
- package/dist/components/Slide/slideI18n.cjs.map +1 -1
- package/dist/components/Slide/slideI18n.d.ts +6 -3
- package/dist/components/Slide/slideI18n.es.js +10 -155
- package/dist/components/Slide/slideI18n.es.js.map +1 -1
- package/dist/components/Slide/useSlide.d.ts +1 -1
- package/dist/components/Slide/utils/appendedMarkerAdvance.d.ts +1 -1
- package/dist/components/Slide/utils/audioSegments.d.ts +1 -1
- package/dist/components/Slide/utils/interactionResolution.d.ts +2 -2
- package/dist/components/Slide/utils/listenModeElementList.d.ts +2 -2
- package/dist/components/Slide/utils/markdownScaling.d.ts +1 -1
- package/dist/components/Slide/utils/playerCustomActions.d.ts +2 -2
- package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.map +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +20 -20
- package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -1
- package/dist/components/Slide/utils/runStreamFixture.d.ts +1 -1
- package/dist/components/Slide/utils/segmentSeek.d.ts +1 -1
- package/dist/components/Slide/utils/silentStepAutoAdvance.d.ts +1 -1
- package/dist/components/Slide/utils/streamingNavigation.d.ts +1 -1
- package/dist/components/Slide/utils/subtitleCue.d.ts +1 -1
- package/dist/components/Slide/utils/subtitleJumpNavigation.d.ts +1 -1
- package/dist/components/index.d.ts +22 -18
- package/dist/components/ui/button.cjs +1 -1
- package/dist/components/ui/button.cjs.map +1 -1
- package/dist/components/ui/button.es.js +12 -13
- package/dist/components/ui/button.es.js.map +1 -1
- package/dist/components/ui/checkbox.cjs +1 -1
- package/dist/components/ui/checkbox.cjs.map +1 -1
- package/dist/components/ui/checkbox.es.js +35 -35
- package/dist/components/ui/checkbox.es.js.map +1 -1
- package/dist/components/ui/dialog.cjs +1 -1
- package/dist/components/ui/dialog.cjs.map +1 -1
- package/dist/components/ui/dialog.d.ts +5 -1
- package/dist/components/ui/dialog.es.js +37 -37
- package/dist/components/ui/dialog.es.js.map +1 -1
- package/dist/components/ui/input.cjs +1 -1
- package/dist/components/ui/input.cjs.map +1 -1
- package/dist/components/ui/input.es.js +4 -4
- package/dist/components/ui/input.es.js.map +1 -1
- package/dist/components/ui/inputGroup/button.cjs +1 -1
- package/dist/components/ui/inputGroup/button.cjs.map +1 -1
- package/dist/components/ui/inputGroup/button.es.js +9 -10
- package/dist/components/ui/inputGroup/button.es.js.map +1 -1
- package/dist/components/ui/inputGroup/input-group.cjs +1 -1
- package/dist/components/ui/inputGroup/input-group.cjs.map +1 -1
- package/dist/components/ui/inputGroup/input-group.d.ts +1 -1
- package/dist/components/ui/inputGroup/input-group.es.js +10 -10
- package/dist/components/ui/inputGroup/input-group.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs.map +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +2 -2
- package/dist/components/ui/inputGroup/textarea.es.js.map +1 -1
- package/dist/components/ui/loading-overlay-card.cjs +2 -2
- package/dist/components/ui/loading-overlay-card.cjs.map +1 -1
- package/dist/components/ui/loading-overlay-card.es.js +11 -11
- package/dist/components/ui/loading-overlay-card.es.js.map +1 -1
- package/dist/components/ui/popover.cjs +1 -1
- package/dist/components/ui/popover.cjs.map +1 -1
- package/dist/components/ui/popover.es.js +6 -6
- package/dist/components/ui/popover.es.js.map +1 -1
- package/dist/components/ui/tooltip.cjs +1 -1
- package/dist/components/ui/tooltip.cjs.map +1 -1
- package/dist/components/ui/tooltip.es.js +16 -16
- package/dist/components/ui/tooltip.es.js.map +1 -1
- package/dist/editor.d.ts +2 -2
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +22 -19
- package/dist/index.es.js.map +1 -1
- package/dist/lib/locale.cjs +1 -1
- package/dist/lib/locale.cjs.map +1 -1
- package/dist/lib/locale.d.ts +5 -1
- package/dist/lib/locale.es.js +26 -13
- package/dist/lib/locale.es.js.map +1 -1
- package/dist/lib/locale.test.d.ts +1 -0
- package/dist/lib/useDetachedLanguage.cjs +2 -0
- package/dist/lib/useDetachedLanguage.cjs.map +1 -0
- package/dist/lib/useDetachedLanguage.d.ts +3 -0
- package/dist/lib/useDetachedLanguage.es.js +25 -0
- package/dist/lib/useDetachedLanguage.es.js.map +1 -0
- package/dist/lib/useResolvedDirection.cjs +2 -0
- package/dist/lib/useResolvedDirection.cjs.map +1 -0
- package/dist/lib/useResolvedDirection.d.ts +6 -0
- package/dist/lib/useResolvedDirection.es.js +37 -0
- package/dist/lib/useResolvedDirection.es.js.map +1 -0
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.es.js +6 -6
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.es.js +21 -21
- package/dist/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs +2 -2
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js +100 -100
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +38 -38
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +9 -9
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js +95 -95
- package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.es.js +48 -48
- package/dist/node_modules/@radix-ui/react-popper/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-portal/dist/index.es.js +6 -6
- package/dist/node_modules/@radix-ui/react-portal/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js +9 -9
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js +17 -17
- package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js +100 -100
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.es.js +6 -6
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.es.js.map +1 -1
- package/dist/node_modules/@uiw/react-codemirror/esm/index.cjs +1 -1
- package/dist/node_modules/@uiw/react-codemirror/esm/index.cjs.map +1 -1
- package/dist/node_modules/@uiw/react-codemirror/esm/index.es.js +27 -27
- package/dist/node_modules/@uiw/react-codemirror/esm/index.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/{chevron-down.cjs → chevrons-down.cjs} +2 -2
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/{chevron-down.es.js → chevrons-down.es.js} +6 -3
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js.map +1 -0
- package/dist/node_modules/react-markdown/lib/index.cjs +1 -1
- package/dist/node_modules/react-markdown/lib/index.cjs.map +1 -1
- package/dist/node_modules/react-markdown/lib/index.es.js +39 -39
- package/dist/node_modules/react-markdown/lib/index.es.js.map +1 -1
- package/dist/renderer.cjs +1 -1
- package/dist/renderer.d.ts +18 -17
- package/dist/renderer.es.js +20 -17
- package/dist/renderer.es.js.map +1 -1
- package/dist/scroll.cjs +1 -1
- package/dist/scroll.d.ts +6 -3
- package/dist/scroll.es.js +4 -2
- package/dist/scroll.es.js.map +1 -1
- package/dist/slide.d.ts +3 -3
- package/package.json +5 -2
- package/dist/_virtual/jsx-runtime.cjs +0 -2
- package/dist/_virtual/jsx-runtime.cjs.map +0 -1
- package/dist/_virtual/jsx-runtime.es.js +0 -6
- package/dist/_virtual/jsx-runtime.es.js.map +0 -1
- package/dist/_virtual/jsx-runtime.es2.js +0 -5
- package/dist/_virtual/jsx-runtime.es2.js.map +0 -1
- package/dist/_virtual/jsx-runtime2.cjs +0 -2
- package/dist/_virtual/jsx-runtime2.cjs.map +0 -1
- package/dist/_virtual/react-jsx-runtime.development.cjs +0 -2
- package/dist/_virtual/react-jsx-runtime.development.cjs.map +0 -1
- package/dist/_virtual/react-jsx-runtime.development.es.js +0 -5
- package/dist/_virtual/react-jsx-runtime.development.es.js.map +0 -1
- package/dist/_virtual/react-jsx-runtime.production.cjs +0 -2
- package/dist/_virtual/react-jsx-runtime.production.cjs.map +0 -1
- package/dist/_virtual/react-jsx-runtime.production.es.js +0 -5
- package/dist/_virtual/react-jsx-runtime.production.es.js.map +0 -1
- package/dist/lib/localeTextMap.cjs +0 -2
- package/dist/lib/localeTextMap.cjs.map +0 -1
- package/dist/lib/localeTextMap.es.js +0 -5
- package/dist/lib/localeTextMap.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.es.js.map +0 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +0 -24
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs.map +0 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js +0 -409
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js.map +0 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.cjs +0 -10
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.cjs.map +0 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.es.js +0 -36
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.es.js.map +0 -1
- package/dist/node_modules/react/jsx-runtime.cjs +0 -2
- package/dist/node_modules/react/jsx-runtime.cjs.map +0 -1
- package/dist/node_modules/react/jsx-runtime.es.js +0 -11
- package/dist/node_modules/react/jsx-runtime.es.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),t=require("react");;/* empty css */const h=require("../../node_modules/lucide-react/dist/esm/icons/check.cjs"),j=require("../../node_modules/lucide-react/dist/esm/icons/copy.cjs"),p=t.createContext(!1),m=s=>{let c="";return t.Children.forEach(s,o=>{typeof o=="string"?c+=o:t.isValidElement(o)&&o?.props?.children&&(c+=m(o.props.children))}),c},f=({children:s,className:c,dir:o="ltr",lang:C,copyButtonText:x="Copy",copiedButtonText:g="Copied"})=>{const[l,i]=t.useState(!1),r=t.useRef(null);t.useEffect(()=>()=>{r.current&&window.clearTimeout(r.current)},[]);let u="";t.Children.forEach(s,a=>{if(t.isValidElement(a)){const n=a.props;n.className&&(u=n.className)}});const d=/language-(\w+)/.exec(u||""),y=d?d[1]:"",N=async()=>{const a=m(s);try{await navigator.clipboard.writeText(a),i(!0),r.current&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>{i(!1)},2e3)}catch(n){console.error("Failed to copy text: ",n)}};return e.jsxs("div",{className:"code-block-container",children:[e.jsxs("div",{className:"code-block-header",children:[e.jsx("span",{className:"language-name",children:y}),e.jsxs("button",{onClick:N,className:"copy-button",children:[l?e.jsx(h.default,{className:"copy-icon"}):e.jsx(j.default,{className:"copy-icon"}),l?g:x]})]}),e.jsx(p.Provider,{value:!0,children:e.jsx("pre",{className:c,dir:o,lang:C,children:s})})]})};f.displayName="CodeBlock";exports.CodeBlockContext=p;exports.default=f;
|
|
2
2
|
//# sourceMappingURL=CodeBlock.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.cjs","sources":["../../../src/components/ContentRender/CodeBlock.tsx"],"sourcesContent":["import React, { useState, ReactNode } from \"react\";\nimport \"./CodeBlock.css\";\nimport { Copy, Check } from \"lucide-react\";\n\n/**\n * Props for the CodeBlock component.\n */\nexport interface CodeBlockProps {\n /** The code content and nested elements to render.*/\n children?: React.ReactNode;\n /** Optional CSS class name for the pre element. */\n className?: string;\n /** Text to display on the copy button (i18n support). */\n copyButtonText?: string;\n /** Text to display when code is copied (i18n support). */\n copiedButtonText?: string;\n}\n\nconst getCodeString = (children: ReactNode): string => {\n let text = \"\";\n React.Children.forEach(children, (child) => {\n if (typeof child === \"string\") {\n text += child;\n } else if (\n React.isValidElement(child) &&\n (child?.props as { children?: ReactNode })?.children\n ) {\n text += getCodeString((child.props as { children: ReactNode }).children);\n }\n });\n return text;\n};\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({\n children,\n className: preClassName,\n copyButtonText = \"Copy\",\n copiedButtonText = \"Copied\",\n}) => {\n const [isCopied, setIsCopied] = useState(false);\n const timeoutRef = React.useRef<number | null>(null);\n\n React.useEffect(() => {\n // Cleanup timeout on component unmount\n return () => {\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n let codeClassName = \"\";\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = child.props as { className?: string };\n if (childProps.className) {\n codeClassName = childProps.className;\n }\n }\n });\n\n const match = /language-(\\w+)/.exec(codeClassName || \"\");\n const language = match ? match[1] : \"\";\n\n const handleCopy = async () => {\n const codeString = getCodeString(children);\n try {\n await navigator.clipboard.writeText(codeString);\n setIsCopied(true);\n\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n }\n timeoutRef.current = window.setTimeout(() => {\n setIsCopied(false);\n }, 2000);\n } catch (err) {\n console.error(\"Failed to copy text: \", err);\n }\n };\n\n return (\n <div className=\"code-block-container\">\n <div className=\"code-block-header\">\n <span className=\"language-name\">{language}</span>\n <button onClick={handleCopy} className=\"copy-button\">\n {isCopied ? (\n <Check className=\"copy-icon\" />\n ) : (\n <Copy className=\"copy-icon\" />\n )}\n {isCopied ? copiedButtonText : copyButtonText}\n </button>\n </div>\n <pre className={preClassName}
|
|
1
|
+
{"version":3,"file":"CodeBlock.cjs","sources":["../../../src/components/ContentRender/CodeBlock.tsx"],"sourcesContent":["import React, { useState, ReactNode } from \"react\";\nimport \"./CodeBlock.css\";\nimport { Copy, Check } from \"lucide-react\";\n\n// Nested code inherits the pre element's direction unless the author overrides it.\nexport const CodeBlockContext = React.createContext(false);\n\n/**\n * Props for the CodeBlock component.\n */\nexport interface CodeBlockProps {\n /** The code content and nested elements to render.*/\n children?: React.ReactNode;\n /** Optional CSS class name for the pre element. */\n className?: string;\n /** Authored text direction; defaults to LTR for ordinary source code. */\n dir?: React.HTMLAttributes<HTMLPreElement>[\"dir\"];\n /** Preserves the language supplied on authored preformatted content. */\n lang?: string;\n /** Text to display on the copy button (i18n support). */\n copyButtonText?: string;\n /** Text to display when code is copied (i18n support). */\n copiedButtonText?: string;\n}\n\nconst getCodeString = (children: ReactNode): string => {\n let text = \"\";\n React.Children.forEach(children, (child) => {\n if (typeof child === \"string\") {\n text += child;\n } else if (\n React.isValidElement(child) &&\n (child?.props as { children?: ReactNode })?.children\n ) {\n text += getCodeString((child.props as { children: ReactNode }).children);\n }\n });\n return text;\n};\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({\n children,\n className: preClassName,\n dir = \"ltr\",\n lang,\n copyButtonText = \"Copy\",\n copiedButtonText = \"Copied\",\n}) => {\n const [isCopied, setIsCopied] = useState(false);\n const timeoutRef = React.useRef<number | null>(null);\n\n React.useEffect(() => {\n // Cleanup timeout on component unmount\n return () => {\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n let codeClassName = \"\";\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = child.props as { className?: string };\n if (childProps.className) {\n codeClassName = childProps.className;\n }\n }\n });\n\n const match = /language-(\\w+)/.exec(codeClassName || \"\");\n const language = match ? match[1] : \"\";\n\n const handleCopy = async () => {\n const codeString = getCodeString(children);\n try {\n await navigator.clipboard.writeText(codeString);\n setIsCopied(true);\n\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n }\n timeoutRef.current = window.setTimeout(() => {\n setIsCopied(false);\n }, 2000);\n } catch (err) {\n console.error(\"Failed to copy text: \", err);\n }\n };\n\n return (\n <div className=\"code-block-container\">\n <div className=\"code-block-header\">\n <span className=\"language-name\">{language}</span>\n <button onClick={handleCopy} className=\"copy-button\">\n {isCopied ? (\n <Check className=\"copy-icon\" />\n ) : (\n <Copy className=\"copy-icon\" />\n )}\n {isCopied ? copiedButtonText : copyButtonText}\n </button>\n </div>\n <CodeBlockContext.Provider value={true}>\n <pre className={preClassName} dir={dir} lang={lang}>\n {children}\n </pre>\n </CodeBlockContext.Provider>\n </div>\n );\n};\n\nCodeBlock.displayName = \"CodeBlock\";\nexport default CodeBlock;\n"],"names":["CodeBlockContext","React","getCodeString","children","text","child","CodeBlock","preClassName","dir","lang","copyButtonText","copiedButtonText","isCopied","setIsCopied","useState","timeoutRef","codeClassName","childProps","match","language","handleCopy","codeString","err","jsxs","jsx","Check","Copy"],"mappings":"oVAKaA,EAAmBC,EAAM,cAAc,EAAK,EAoBnDC,EAAiBC,GAAgC,CACrD,IAAIC,EAAO,GACX,OAAAH,EAAM,SAAS,QAAQE,EAAWE,GAAU,CACtC,OAAOA,GAAU,SACnBD,GAAQC,EAERJ,EAAM,eAAeI,CAAK,GACzBA,GAAO,OAAoC,WAE5CD,GAAQF,EAAeG,EAAM,MAAkC,QAAQ,EAE3E,CAAC,EACMD,CACT,EAEME,EAAsC,CAAC,CAC3C,SAAAH,EACA,UAAWI,EACX,IAAAC,EAAM,MACN,KAAAC,EACA,eAAAC,EAAiB,OACjB,iBAAAC,EAAmB,QACrB,IAAM,CACJ,KAAM,CAACC,EAAUC,CAAW,EAAIC,EAAAA,SAAS,EAAK,EACxCC,EAAad,EAAM,OAAsB,IAAI,EAEnDA,EAAM,UAAU,IAEP,IAAM,CACPc,EAAW,SACb,OAAO,aAAaA,EAAW,OAAO,CAE1C,EACC,CAAA,CAAE,EAEL,IAAIC,EAAgB,GACpBf,EAAM,SAAS,QAAQE,EAAWE,GAAU,CAC1C,GAAIJ,EAAM,eAAeI,CAAK,EAAG,CAC/B,MAAMY,EAAaZ,EAAM,MACrBY,EAAW,YACbD,EAAgBC,EAAW,UAE/B,CACF,CAAC,EAED,MAAMC,EAAQ,iBAAiB,KAAKF,GAAiB,EAAE,EACjDG,EAAWD,EAAQA,EAAM,CAAC,EAAI,GAE9BE,EAAa,SAAY,CAC7B,MAAMC,EAAanB,EAAcC,CAAQ,EACzC,GAAI,CACF,MAAM,UAAU,UAAU,UAAUkB,CAAU,EAC9CR,EAAY,EAAI,EAEZE,EAAW,SACb,OAAO,aAAaA,EAAW,OAAO,EAExCA,EAAW,QAAU,OAAO,WAAW,IAAM,CAC3CF,EAAY,EAAK,CACnB,EAAG,GAAI,CACT,OAASS,EAAK,CACZ,QAAQ,MAAM,wBAAyBA,CAAG,CAC5C,CACF,EAEA,OACEC,EAAAA,KAAC,MAAA,CAAI,UAAU,uBACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,oBACb,SAAA,CAAAC,EAAAA,IAAC,OAAA,CAAK,UAAU,gBAAiB,SAAAL,EAAS,EAC1CI,EAAAA,KAAC,SAAA,CAAO,QAASH,EAAY,UAAU,cACpC,SAAA,CAAAR,EACCY,EAAAA,IAACC,WAAM,UAAU,WAAA,CAAY,EAE7BD,EAAAA,IAACE,EAAAA,QAAA,CAAK,UAAU,WAAA,CAAY,EAE7Bd,EAAWD,EAAmBD,CAAA,CAAA,CACjC,CAAA,EACF,EACAc,EAAAA,IAACxB,EAAiB,SAAjB,CAA0B,MAAO,GAChC,SAAAwB,EAAAA,IAAC,MAAA,CAAI,UAAWjB,EAAc,IAAAC,EAAU,KAAAC,EACrC,SAAAN,EACH,CAAA,CACF,CAAA,EACF,CAEJ,EAEAG,EAAU,YAAc"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
export declare const CodeBlockContext: React.Context<boolean>;
|
|
2
3
|
/**
|
|
3
4
|
* Props for the CodeBlock component.
|
|
4
5
|
*/
|
|
@@ -7,6 +8,10 @@ export interface CodeBlockProps {
|
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
/** Optional CSS class name for the pre element. */
|
|
9
10
|
className?: string;
|
|
11
|
+
/** Authored text direction; defaults to LTR for ordinary source code. */
|
|
12
|
+
dir?: React.HTMLAttributes<HTMLPreElement>["dir"];
|
|
13
|
+
/** Preserves the language supplied on authored preformatted content. */
|
|
14
|
+
lang?: string;
|
|
10
15
|
/** Text to display on the copy button (i18n support). */
|
|
11
16
|
copyButtonText?: string;
|
|
12
17
|
/** Text to display when code is copied (i18n support). */
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as l, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import o, { useState as g } from "react";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
let
|
|
8
|
-
return
|
|
9
|
-
typeof e == "string" ?
|
|
10
|
-
}),
|
|
11
|
-
},
|
|
4
|
+
import h from "../../node_modules/lucide-react/dist/esm/icons/check.es.js";
|
|
5
|
+
import w from "../../node_modules/lucide-react/dist/esm/icons/copy.es.js";
|
|
6
|
+
const x = o.createContext(!1), u = (t) => {
|
|
7
|
+
let r = "";
|
|
8
|
+
return o.Children.forEach(t, (e) => {
|
|
9
|
+
typeof e == "string" ? r += e : o.isValidElement(e) && e?.props?.children && (r += u(e.props.children));
|
|
10
|
+
}), r;
|
|
11
|
+
}, k = ({
|
|
12
12
|
children: t,
|
|
13
|
-
className:
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
className: r,
|
|
14
|
+
dir: e = "ltr",
|
|
15
|
+
lang: f,
|
|
16
|
+
copyButtonText: C = "Copy",
|
|
17
|
+
copiedButtonText: y = "Copied"
|
|
16
18
|
}) => {
|
|
17
|
-
const [i,
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const [i, d] = g(!1), a = o.useRef(null);
|
|
20
|
+
o.useEffect(() => () => {
|
|
21
|
+
a.current && window.clearTimeout(a.current);
|
|
20
22
|
}, []);
|
|
21
23
|
let m = "";
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
const n =
|
|
24
|
+
o.Children.forEach(t, (s) => {
|
|
25
|
+
if (o.isValidElement(s)) {
|
|
26
|
+
const n = s.props;
|
|
25
27
|
n.className && (m = n.className);
|
|
26
28
|
}
|
|
27
29
|
});
|
|
28
|
-
const p = /language-(\w+)/.exec(m || ""),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
i ? /* @__PURE__ */
|
|
43
|
-
i ?
|
|
30
|
+
const p = /language-(\w+)/.exec(m || ""), N = p ? p[1] : "";
|
|
31
|
+
return /* @__PURE__ */ l("div", { className: "code-block-container", children: [
|
|
32
|
+
/* @__PURE__ */ l("div", { className: "code-block-header", children: [
|
|
33
|
+
/* @__PURE__ */ c("span", { className: "language-name", children: N }),
|
|
34
|
+
/* @__PURE__ */ l("button", { onClick: async () => {
|
|
35
|
+
const s = u(t);
|
|
36
|
+
try {
|
|
37
|
+
await navigator.clipboard.writeText(s), d(!0), a.current && window.clearTimeout(a.current), a.current = window.setTimeout(() => {
|
|
38
|
+
d(!1);
|
|
39
|
+
}, 2e3);
|
|
40
|
+
} catch (n) {
|
|
41
|
+
console.error("Failed to copy text: ", n);
|
|
42
|
+
}
|
|
43
|
+
}, className: "copy-button", children: [
|
|
44
|
+
i ? /* @__PURE__ */ c(h, { className: "copy-icon" }) : /* @__PURE__ */ c(w, { className: "copy-icon" }),
|
|
45
|
+
i ? y : C
|
|
44
46
|
] })
|
|
45
47
|
] }),
|
|
46
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ c(x.Provider, { value: !0, children: /* @__PURE__ */ c("pre", { className: r, dir: e, lang: f, children: t }) })
|
|
47
49
|
] });
|
|
48
50
|
};
|
|
49
|
-
|
|
51
|
+
k.displayName = "CodeBlock";
|
|
50
52
|
export {
|
|
51
|
-
|
|
53
|
+
x as CodeBlockContext,
|
|
54
|
+
k as default
|
|
52
55
|
};
|
|
53
56
|
//# sourceMappingURL=CodeBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.es.js","sources":["../../../src/components/ContentRender/CodeBlock.tsx"],"sourcesContent":["import React, { useState, ReactNode } from \"react\";\nimport \"./CodeBlock.css\";\nimport { Copy, Check } from \"lucide-react\";\n\n/**\n * Props for the CodeBlock component.\n */\nexport interface CodeBlockProps {\n /** The code content and nested elements to render.*/\n children?: React.ReactNode;\n /** Optional CSS class name for the pre element. */\n className?: string;\n /** Text to display on the copy button (i18n support). */\n copyButtonText?: string;\n /** Text to display when code is copied (i18n support). */\n copiedButtonText?: string;\n}\n\nconst getCodeString = (children: ReactNode): string => {\n let text = \"\";\n React.Children.forEach(children, (child) => {\n if (typeof child === \"string\") {\n text += child;\n } else if (\n React.isValidElement(child) &&\n (child?.props as { children?: ReactNode })?.children\n ) {\n text += getCodeString((child.props as { children: ReactNode }).children);\n }\n });\n return text;\n};\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({\n children,\n className: preClassName,\n copyButtonText = \"Copy\",\n copiedButtonText = \"Copied\",\n}) => {\n const [isCopied, setIsCopied] = useState(false);\n const timeoutRef = React.useRef<number | null>(null);\n\n React.useEffect(() => {\n // Cleanup timeout on component unmount\n return () => {\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n let codeClassName = \"\";\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = child.props as { className?: string };\n if (childProps.className) {\n codeClassName = childProps.className;\n }\n }\n });\n\n const match = /language-(\\w+)/.exec(codeClassName || \"\");\n const language = match ? match[1] : \"\";\n\n const handleCopy = async () => {\n const codeString = getCodeString(children);\n try {\n await navigator.clipboard.writeText(codeString);\n setIsCopied(true);\n\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n }\n timeoutRef.current = window.setTimeout(() => {\n setIsCopied(false);\n }, 2000);\n } catch (err) {\n console.error(\"Failed to copy text: \", err);\n }\n };\n\n return (\n <div className=\"code-block-container\">\n <div className=\"code-block-header\">\n <span className=\"language-name\">{language}</span>\n <button onClick={handleCopy} className=\"copy-button\">\n {isCopied ? (\n <Check className=\"copy-icon\" />\n ) : (\n <Copy className=\"copy-icon\" />\n )}\n {isCopied ? copiedButtonText : copyButtonText}\n </button>\n </div>\n <pre className={preClassName}
|
|
1
|
+
{"version":3,"file":"CodeBlock.es.js","sources":["../../../src/components/ContentRender/CodeBlock.tsx"],"sourcesContent":["import React, { useState, ReactNode } from \"react\";\nimport \"./CodeBlock.css\";\nimport { Copy, Check } from \"lucide-react\";\n\n// Nested code inherits the pre element's direction unless the author overrides it.\nexport const CodeBlockContext = React.createContext(false);\n\n/**\n * Props for the CodeBlock component.\n */\nexport interface CodeBlockProps {\n /** The code content and nested elements to render.*/\n children?: React.ReactNode;\n /** Optional CSS class name for the pre element. */\n className?: string;\n /** Authored text direction; defaults to LTR for ordinary source code. */\n dir?: React.HTMLAttributes<HTMLPreElement>[\"dir\"];\n /** Preserves the language supplied on authored preformatted content. */\n lang?: string;\n /** Text to display on the copy button (i18n support). */\n copyButtonText?: string;\n /** Text to display when code is copied (i18n support). */\n copiedButtonText?: string;\n}\n\nconst getCodeString = (children: ReactNode): string => {\n let text = \"\";\n React.Children.forEach(children, (child) => {\n if (typeof child === \"string\") {\n text += child;\n } else if (\n React.isValidElement(child) &&\n (child?.props as { children?: ReactNode })?.children\n ) {\n text += getCodeString((child.props as { children: ReactNode }).children);\n }\n });\n return text;\n};\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({\n children,\n className: preClassName,\n dir = \"ltr\",\n lang,\n copyButtonText = \"Copy\",\n copiedButtonText = \"Copied\",\n}) => {\n const [isCopied, setIsCopied] = useState(false);\n const timeoutRef = React.useRef<number | null>(null);\n\n React.useEffect(() => {\n // Cleanup timeout on component unmount\n return () => {\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n }\n };\n }, []);\n\n let codeClassName = \"\";\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = child.props as { className?: string };\n if (childProps.className) {\n codeClassName = childProps.className;\n }\n }\n });\n\n const match = /language-(\\w+)/.exec(codeClassName || \"\");\n const language = match ? match[1] : \"\";\n\n const handleCopy = async () => {\n const codeString = getCodeString(children);\n try {\n await navigator.clipboard.writeText(codeString);\n setIsCopied(true);\n\n if (timeoutRef.current) {\n window.clearTimeout(timeoutRef.current);\n }\n timeoutRef.current = window.setTimeout(() => {\n setIsCopied(false);\n }, 2000);\n } catch (err) {\n console.error(\"Failed to copy text: \", err);\n }\n };\n\n return (\n <div className=\"code-block-container\">\n <div className=\"code-block-header\">\n <span className=\"language-name\">{language}</span>\n <button onClick={handleCopy} className=\"copy-button\">\n {isCopied ? (\n <Check className=\"copy-icon\" />\n ) : (\n <Copy className=\"copy-icon\" />\n )}\n {isCopied ? copiedButtonText : copyButtonText}\n </button>\n </div>\n <CodeBlockContext.Provider value={true}>\n <pre className={preClassName} dir={dir} lang={lang}>\n {children}\n </pre>\n </CodeBlockContext.Provider>\n </div>\n );\n};\n\nCodeBlock.displayName = \"CodeBlock\";\nexport default CodeBlock;\n"],"names":["CodeBlockContext","React","getCodeString","children","text","child","CodeBlock","preClassName","dir","lang","copyButtonText","copiedButtonText","isCopied","setIsCopied","useState","timeoutRef","codeClassName","childProps","match","language","jsxs","jsx","codeString","err","Check","Copy"],"mappings":";;;;;AAKO,MAAMA,IAAmBC,EAAM,cAAc,EAAK,GAoBnDC,IAAgB,CAACC,MAAgC;AACrD,MAAIC,IAAO;AACXH,SAAAA,EAAM,SAAS,QAAQE,GAAU,CAACE,MAAU;AAC1C,IAAI,OAAOA,KAAU,WACnBD,KAAQC,IAERJ,EAAM,eAAeI,CAAK,KACzBA,GAAO,OAAoC,aAE5CD,KAAQF,EAAeG,EAAM,MAAkC,QAAQ;AAAA,EAE3E,CAAC,GACMD;AACT,GAEME,IAAsC,CAAC;AAAA,EAC3C,UAAAH;AAAA,EACA,WAAWI;AAAA,EACX,KAAAC,IAAM;AAAA,EACN,MAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,kBAAAC,IAAmB;AACrB,MAAM;AACJ,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAK,GACxC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AiB,UAAjB,EAA0B,OAAO,IAChC,UAAA,gBAAAqB,EAAC,OAAA,EAAI,WAAWd,GAAc,KAAAC,GAAU,MAAAC,GACrC,UAAAN,GACH,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;AAEAG,EAAU,cAAc;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),r=require("react"),_e=require("../../_virtual/index.cjs"),Fe=require("./utils/sanitize-invalid-tag-name.cjs"),We=require("./utils/strip-svg-text-line-breaks.cjs");;/* empty css */;/* empty css */;/* empty css */;/* empty css */const Be=require("./CodeBlock.cjs"),$e=require("./plugins/CustomVariable.cjs"),re=require("./plugins/MermaidChart.cjs"),Ce=require("./utils/custom-variable-props.cjs"),be=require("./utils/highlight-languages.cjs"),se=require("./utils/mermaid-parse.cjs"),ke=require("./utils/normalize-inline-html.cjs"),He=require("./IframeSandbox.cjs"),F=require("./utils/typewriter-pacing.cjs"),Qe=require("./utils/split-content.cjs"),Oe=require("../../lib/interaction-defaults.cjs"),Re=require("../../lib/locale.cjs"),Ne=require("./contentRenderI18n.cjs"),Ue=require("../../node_modules/react-markdown/lib/index.cjs"),Ge=require("../../node_modules/rehype-raw/lib/index.cjs"),Ke=require("../../node_modules/rehype-highlight/lib/index.cjs"),Xe=require("../../node_modules/rehype-katex/lib/index.cjs"),Ye=require("../../node_modules/remark-gfm/lib/index.cjs"),Ze=require("../../node_modules/remark-math/lib/index.cjs"),Je=require("../../node_modules/remark-breaks/lib/index.cjs"),et=/<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i,tt=2,Se=({svg:t})=>{const s=r.useRef(null);return r.useEffect(()=>{const o=s.current;if(!o)return;const a=o.shadowRoot??o.attachShadow({mode:"open"}),T="content-render-svg-style";let d=a.getElementById(T);d||(d=document.createElement("style"),d.id=T,d.textContent=`
|
|
2
2
|
svg { height: auto; display: inline-block; }
|
|
3
3
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
4
4
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
5
|
-
`,u.appendChild(h)),Array.from(u.childNodes).filter(a=>a!==h).forEach(a=>u.removeChild(a));const N=document.createElement("template"),L=Te.stripSvgTextLineBreaks(t);N.innerHTML=L,u.append(N.content.cloneNode(!0));let v=!1,k=!1;u.querySelectorAll("svg").forEach(a=>{const q=a.getAttribute("viewBox");if(!q)return;const T=q.trim().split(/[\s,]+/).map(x=>Number(x));if(T.length!==4||T.some(Number.isNaN))return;const[,,w,y]=T,S=a.getAttribute("width"),E=a.getAttribute("height"),$=x=>{if(!x)return!1;const f=x.trim().toLowerCase();return f==="auto"||f.endsWith("%")},A=x=>{if(!x)return null;const f=x.trim().toLowerCase();if(f==="auto"||f.endsWith("%"))return null;const F=Number.parseFloat(f);return Number.isNaN(F)?null:F},P=$(S),H=$(E),z=!S||S==="0",V=!E||E==="0",I=A(S),D=A(E);if(P||H||z&&V||I===w&&D===y){v=!0,a.classList.add("content-render-svg-el--responsive"),a.classList.remove("content-render-svg-el--fixed"),a.style.width="100%",a.style.height="auto",!a.style.aspectRatio&&y>0&&(a.style.aspectRatio=`${w} / ${y}`);return}k=!0,a.classList.add("content-render-svg-el--fixed"),a.classList.remove("content-render-svg-el--responsive"),z&&w>0&&a.setAttribute("width",`${w}`),V&&y>0&&a.setAttribute("height",`${y}`)});const M=v&&!k;i.classList.toggle("content-render-svg--responsive",M),i.classList.toggle("content-render-svg--fixed",!M)},[t]),n.jsxRuntimeExports.jsx("div",{className:"content-render-svg-scroll",children:n.jsxRuntimeExports.jsx("div",{className:"content-render-svg",ref:r})})},Ie=[$e.default,Ae.default,Re.default,ze.default],De=[ce.preserveCustomVariableProperties,qe.default,be.sanitizeInvalidTagName,ce.restoreCustomVariableProperties,[Le.default,{languages:le.highlightLanguages,subset:le.subsetLanguages}],Me.default],Q=({content:t,components:r})=>n.jsxRuntimeExports.jsx("div",{className:"markdown-renderer",children:n.jsxRuntimeExports.jsx(ke.Markdown,{remarkPlugins:Ie,rehypePlugins:De,components:r,children:t})}),Fe=t=>{if(t.length<=1)return t;const r=[];return t.forEach(i=>{if(i.type==="sandbox"){r.push(i);return}const u=r[r.length-1];if(u&&u.type!=="sandbox"){r[r.length-1]={type:"markdown",value:`${u.value}${i.value}`};return}r.push({type:"markdown",value:i.value})}),r},Pe=(t,r)=>{const i=Math.max(1,r),u=Array.from(t);return{chunk:u.slice(0,i).join(""),rest:u.slice(i).join("")}},He=(t,r)=>t===r?!0:!t||!r||t.length!==r.length?!1:t.every((i,u)=>i===r[u]),We=t=>{const r=o.useRef(t);return He(r.current,t)||(r.current=t),r.current},_e=({content:t,contentType:r,locale:i,customRenderBar:u,onSend:b,typingSpeed:h=40,enableTypewriter:Y=!1,onTypeFinished:N,onTypewriterStateChange:L,userInput:v,interactionDefaultValueOptions:k,defaultButtonText:M,defaultInputText:a,defaultSelectedValues:q,readonly:T=!1,confirmButtonText:w,copyButtonText:y,copiedButtonText:S,sandboxLoadingText:E,sandboxStyleLoadingText:$,sandboxScriptLoadingText:A,disableSandboxLoadingOverlay:P=!1,sandboxFullscreenButtonText:H,sandboxExitFullscreenButtonText:z,sandboxMode:V="content",onClickCustomButtonAfterContent:I,beforeSend:D})=>{const B=Ne.getContentRenderLocaleTexts(i),W=w||B.confirmButtonText,x=y||B.copyButtonText,f=S||B.copiedButtonText,F=H||B.sandboxFullscreenButtonText,xe=z||B.sandboxExitFullscreenButtonText,l=!!Y&&(!r||r==="text"),Z=2,ee=Math.max(0,h),[g,_]=o.useState(()=>l?"":t),R=o.useRef(""),te=o.useRef(l),O=o.useRef(!1);o.useEffect(()=>{const e=te.current;if(te.current=l,O.current=!1,!l){R.current="",_(t);return}_(s=>{const c=!e,j=t.startsWith(s);if(!c&&!j)return R.current="",t;const m=c||!j?"":s;return R.current=t.slice(m.length),m})},[t,l]),o.useEffect(()=>{l&&(O.current||R.current||g!==t||(O.current=!0,N?.()))},[t,g,l,N]),o.useEffect(()=>{if(!l||!R.current)return;const e=window.setTimeout(()=>{_(s=>{const{chunk:c,rest:j}=Pe(R.current,Z);return c?(R.current=j,`${s}${c}`):s})},ee);return()=>window.clearTimeout(e)},[t,g,l,Z,ee]);const ne=o.useMemo(()=>({isTypewriterEnabled:l,isTyping:l&&g!==t,isComplete:g===t,renderedLength:g.length,totalLength:t.length}),[t,g,l]);o.useEffect(()=>{L?.(ne)},[L,ne]);const p=l?g:t,U=o.useMemo(()=>de.normalizeInlineHtml(p),[p]),G=o.useMemo(()=>Ce.getInteractionDefaultValues(p,v,k),[k,p,v]),re=M?.trim()||G.buttonText,se=a?.trim()||G.inputText,pe=o.useMemo(()=>v?v.split(",").map(e=>e.trim()).filter(Boolean):void 0,[v]),fe=q?.length?q:G.selectedValues||pe,oe=We(fe),d=o.useRef({beforeSend:D,locale:i,onClickCustomButtonAfterContent:I,onSend:b,readonly:T,renderContent:p,resolvedConfirmButtonText:W,resolvedCopiedButtonText:f,resolvedCopyButtonText:x,resolvedDefaultButtonText:re,resolvedDefaultInputText:se,resolvedDefaultSelectedValues:oe});d.current={beforeSend:D,locale:i,onClickCustomButtonAfterContent:I,onSend:b,readonly:T,renderContent:p,resolvedConfirmButtonText:W,resolvedCopiedButtonText:f,resolvedCopyButtonText:x,resolvedDefaultButtonText:re,resolvedDefaultInputText:se,resolvedDefaultSelectedValues:oe};const ie=o.useMemo(()=>({"custom-button-after-content":({children:e})=>n.jsxRuntimeExports.jsx("button",{className:"content-render-custom-button-after-content",onClick:d.current.onClickCustomButtonAfterContent,children:n.jsxRuntimeExports.jsx("span",{className:"content-render-custom-button-after-content-inner",children:e})}),"custom-variable":e=>n.jsxRuntimeExports.jsx(Se.default,{...e,readonly:d.current.readonly,defaultButtonText:d.current.resolvedDefaultButtonText,defaultInputText:d.current.resolvedDefaultInputText,defaultSelectedValues:d.current.resolvedDefaultSelectedValues,onSend:d.current.onSend,beforeSend:d.current.beforeSend,locale:d.current.locale,confirmButtonText:d.current.resolvedConfirmButtonText}),code:e=>{const{className:s,children:c,...j}=e;if(/language-(\w+)/.exec(s||"")?.[1]==="mermaid"){const C=c?.toString().replace(/\n$/,"")||"",ye=K.mermaidBlockIsComplete(d.current.renderContent,C);return n.jsxRuntimeExports.jsx(J.default,{chart:C,frozen:ye})}return n.jsxRuntimeExports.jsx("code",{className:s,...j,children:c})},table:({...e})=>n.jsxRuntimeExports.jsx("div",{className:"content-render-table-container",children:n.jsxRuntimeExports.jsx("table",{className:"content-render-table",...e})}),th:({...e})=>n.jsxRuntimeExports.jsx("th",{className:"content-render-th",...e}),td:({...e})=>n.jsxRuntimeExports.jsx("td",{className:"content-render-td",...e}),tr:({...e})=>n.jsxRuntimeExports.jsx("tr",{className:"content-render-tr",...e}),li:({node:e,...s})=>{const c=e?.properties?.className;return typeof c=="string"&&c.includes("task-list-item")||Array.isArray(c)&&c.includes("task-list-item")?n.jsxRuntimeExports.jsx("li",{className:"content-render-task-list-item",...s}):n.jsxRuntimeExports.jsx("li",{...s})},ol:({...e})=>n.jsxRuntimeExports.jsx("ol",{className:"content-render-ol",...e}),ul:({...e})=>n.jsxRuntimeExports.jsx("ul",{className:"content-render-ul",...e}),input:({...e})=>e.type==="checkbox"?n.jsxRuntimeExports.jsx("input",{type:"checkbox",className:"content-render-checkbox",disabled:!0,...e}):n.jsxRuntimeExports.jsx("input",{...e}),a:({children:e,...s})=>n.jsxRuntimeExports.jsx("a",{target:"_blank",rel:"noopener noreferrer",...s,children:e}),pre:e=>n.jsxRuntimeExports.jsx(we.default,{...e,copyButtonText:d.current.resolvedCopyButtonText,copiedButtonText:d.current.resolvedCopiedButtonText})}),[]),ae=o.useMemo(()=>Ve.test(p),[p]),X=o.useMemo(()=>ae?Be.splitContentSegments(p,!0):[],[p,ae]),he=X.some(e=>e.type==="sandbox"),ve=o.useMemo(()=>Fe(X),[X]),ge=o.useMemo(()=>K.parseMarkdownSegments(U),[U]),je=(e,s)=>{const c=de.normalizeInlineHtml(e);return K.parseMarkdownSegments(c).map((m,ue)=>{const C=`${s}-${m.type}-${ue}`;return m.type==="text"?n.jsxRuntimeExports.jsx(Q,{components:ie,content:m.value},C):m.type==="mermaid"?n.jsxRuntimeExports.jsx(J.default,{chart:m.value,frozen:!m.complete},C):m.type==="svg"?n.jsxRuntimeExports.jsx(me,{svg:m.value},C):null})};return he?n.jsxRuntimeExports.jsx("div",{className:"content-render markdown-body",children:ve.map((e,s)=>e.type==="sandbox"?n.jsxRuntimeExports.jsx(Ee.default,{hideFullScreen:!0,type:"sandbox",content:e.value,className:"content-render-iframe",locale:i,loadingText:E,styleLoadingText:$,scriptLoadingText:A,disableLoadingOverlay:P,fullScreenButtonText:F,exitFullScreenButtonText:xe,mode:V},`sandbox-${s}`):n.jsxRuntimeExports.jsx(o.Fragment,{children:je(e.value,`md-${s}`)},`md-${s}`))}):n.jsxRuntimeExports.jsxs("div",{className:"content-render markdown-body",children:[ge.map((e,s)=>{if(e.type==="text")return n.jsxRuntimeExports.jsx(Q,{components:ie,content:e.value},s);if(e.type==="mermaid")return n.jsxRuntimeExports.jsx(J.default,{chart:e.value,frozen:!e.complete},s);if(e.type==="svg")return n.jsxRuntimeExports.jsx(me,{svg:e.value},s)}),u&&n.jsxRuntimeExports.jsx("div",{className:"content-render-custom-bar",children:o.createElement(u,{content:t,displayContent:U,onSend:b})})]})};exports.MarkdownRenderer=Q;exports.default=_e;
|
|
5
|
+
`,a.appendChild(d)),Array.from(a.childNodes).filter(c=>c!==d).forEach(c=>a.removeChild(c));const A=document.createElement("template"),j=We.stripSvgTextLineBreaks(t);A.innerHTML=j,a.append(A.content.cloneNode(!0));let h=!1,E=!1;a.querySelectorAll("svg").forEach(c=>{const D=c.getAttribute("viewBox");if(!D)return;const V=D.trim().split(/[\s,]+/).map(g=>Number(g));if(V.length!==4||V.some(Number.isNaN))return;const[,,q,C]=V,R=c.getAttribute("width"),M=c.getAttribute("height"),W=g=>{if(!g)return!1;const u=g.trim().toLowerCase();return u==="auto"||u.endsWith("%")},$=g=>{if(!g)return null;const u=g.trim().toLowerCase();if(u==="auto"||u.endsWith("%"))return null;const S=Number.parseFloat(u);return Number.isNaN(S)?null:S},U=W(R),G=W(M),H=!R||R==="0",Q=!M||M==="0",K=$(R),X=$(M);if(U||G||H&&Q||K===q&&X===C){h=!0,c.classList.add("content-render-svg-el--responsive"),c.classList.remove("content-render-svg-el--fixed"),c.style.width="100%",c.style.height="auto",!c.style.aspectRatio&&C>0&&(c.style.aspectRatio=`${q} / ${C}`);return}E=!0,c.classList.add("content-render-svg-el--fixed"),c.classList.remove("content-render-svg-el--responsive"),H&&q>0&&c.setAttribute("width",`${q}`),Q&&C>0&&c.setAttribute("height",`${C}`)});const I=h&&!E;o.classList.toggle("content-render-svg--responsive",I),o.classList.toggle("content-render-svg--fixed",!I)},[t]),n.jsx("div",{className:"content-render-svg-scroll",children:n.jsx("div",{className:"content-render-svg",ref:s})})},oe=r.createContext(null),nt=t=>{const s=r.useContext(oe),o=r.useContext(Be.CodeBlockContext);if(!s)throw new Error("Markdown code renderer requires ContentRender context.");const{className:a,children:T,...d}=t;if(/language-(\w+)/.exec(a||"")?.[1]==="mermaid"){const j=T?.toString().replace(/\n$/,"")||"",h=se.mermaidBlockIsComplete(s.current.renderContent,j);return n.jsx(re.default,{chart:j,frozen:h,messages:s.current.mermaidMessages})}return n.jsx("code",{className:a,...d,dir:d.dir??(o?void 0:"ltr"),children:T})},rt=[Ye.default,Ze.default,_e.default,Je.default],st=[Ce.preserveCustomVariableProperties,Ge.default,Fe.sanitizeInvalidTagName,Ce.restoreCustomVariableProperties,[Ke.default,{languages:be.highlightLanguages,subset:be.subsetLanguages}],Xe.default],ae=({content:t,components:s,locale:o})=>{const a=Ne.getContentRenderLocaleTexts(o);return n.jsx("div",{className:"markdown-renderer",children:n.jsx(Ue.Markdown,{remarkPlugins:rt,rehypePlugins:st,remarkRehypeOptions:{footnoteLabel:a.footnoteLabel,footnoteBackLabel:(T,d)=>{const k=String(T+1)+(d>1?`-${d}`:"");return a.footnoteBackLabel.replace("{reference}",k)}},components:s,children:t})})},ot=t=>{if(t.length<=1)return t;const s=[];return t.forEach(o=>{if(o.type==="sandbox"){s.push(o);return}const a=s[s.length-1];if(a&&a.type!=="sandbox"){s[s.length-1]={type:"markdown",value:`${a.value}${o.value}`};return}s.push({type:"markdown",value:o.value})}),s},at=(t,s)=>{const o=Math.max(1,s),a=Array.from(t);return{chunk:a.slice(0,o).join(""),rest:a.slice(o).join("")}},ct=(t,s)=>t===s?!0:!t||!s||t.length!==s.length?!1:t.every((o,a)=>o===s[a]),it=t=>{const s=r.useRef(t);return ct(s.current,t)||(s.current=t),s.current},ut=({content:t,contentType:s,locale:o,lang:a,dir:T,customRenderBar:d,onSend:k,typingSpeed:A=40,enableTypewriter:j=!1,typewriterPacing:h="fixed",onTypeFinished:E,onTypewriterStateChange:I,userInput:c,interactionDefaultValueOptions:D,defaultButtonText:V,defaultInputText:q,defaultSelectedValues:C,readonly:R=!1,confirmButtonText:M,copyButtonText:W,copiedButtonText:$,sandboxLoadingText:U,sandboxStyleLoadingText:G,sandboxScriptLoadingText:H,disableSandboxLoadingOverlay:Q=!1,sandboxFullscreenButtonText:K,sandboxExitFullscreenButtonText:X,sandboxMode:ce="content",onClickCustomButtonAfterContent:Y,beforeSend:g})=>{const u=Ne.getContentRenderLocaleTexts(o),S=r.useMemo(()=>({loading:u.mermaidLoadingText,emptyChart:u.mermaidEmptyChartText,error:u.mermaidErrorText}),[u]),z=T??Re.getMarkdownFlowDirection(o),P=a??Re.getMarkdownFlowLanguage(o),ie=M||u.confirmButtonText,ue=W||u.copyButtonText,le=$||u.copiedButtonText,je=K||u.sandboxFullscreenButtonText,qe=X||u.sandboxExitFullscreenButtonText,m=!!j&&(!s||s==="text"),de=Math.max(0,A),Me=h==="fixed"?t:void 0,[y,me]=r.useState(()=>m?"":t),O=r.useRef(y),p=r.useRef(""),b=r.useRef({tokens:[],head:0}),B=r.useRef(0),fe=r.useRef(m),xe=r.useRef(h),he=r.useRef(t),Z=r.useRef(!1),[Le,Ae]=r.useState(0);r.useEffect(()=>{const e=fe.current,i=xe.current,f=he.current,w=!!p.current;fe.current=m,xe.current=h,he.current=t,(t!==f||m!==e)&&(Z.current=!1);const x=()=>{p.current="",b.current={tokens:[],head:0},B.current=0},_=L=>{O.current=L,me(L)};if(!m){x(),_(t);return}e||(x(),_(""));const N=e?O.current:"";if(!t.startsWith(N)){x(),_(t);return}const ne=t.slice(N.length);if(!ne){x();return}if(h==="content-aware"){const L=f.slice(N.length);e&&i==="content-aware"&&t.startsWith(f)&&p.current===L?b.current=F.appendContentAwareTypewriterQueue(b.current,t.slice(f.length)):(b.current=F.createContentAwareTypewriterQueue(ne),B.current=0)}else b.current={tokens:[],head:0},B.current=0;p.current=ne,w||Ae(L=>L+1)},[t,m,h]),r.useEffect(()=>{m&&(Z.current||p.current||y!==t||(Z.current=!0,E?.()))},[t,y,m,E]),r.useEffect(()=>{if(!m||!p.current)return;const e=window.setTimeout(()=>{if(!p.current)return;let i="";if(h==="content-aware"){const w=F.consumeContentAwareTypewriterQueue(b.current,B.current+F.CONTENT_AWARE_TYPEWRITER_TICK_BUDGET);i=w.chunk,b.current=w.queue,F.isContentAwareTypewriterQueueEmpty(w.queue)?B.current=0:B.current=w.remainingBudget}else i=at(p.current,tt).chunk;if(!i)return;p.current=p.current.slice(i.length),p.current||(b.current={tokens:[],head:0},B.current=0);const f=`${O.current}${i}`;O.current=f,me(f)},de);return()=>window.clearTimeout(e)},[y,Me,m,h,de,Le]);const pe=r.useMemo(()=>({isTypewriterEnabled:m,isTyping:m&&y!==t,isComplete:y===t,renderedLength:y.length,totalLength:t.length}),[t,y,m]);r.useEffect(()=>{I?.(pe)},[I,pe]);const v=m?y:t,J=r.useMemo(()=>ke.normalizeInlineHtml(v),[v]),ee=r.useMemo(()=>Oe.getInteractionDefaultValues(v,c,D),[D,v,c]),ge=V?.trim()||ee.buttonText,ve=q?.trim()||ee.inputText,Ee=r.useMemo(()=>c?c.split(",").map(e=>e.trim()).filter(Boolean):void 0,[c]),Ie=C?.length?C:ee.selectedValues||Ee,Te=it(Ie),l=r.useRef({direction:z,language:P,mermaidMessages:S,beforeSend:g,locale:o,onClickCustomButtonAfterContent:Y,onSend:k,readonly:R,renderContent:v,resolvedConfirmButtonText:ie,resolvedCopiedButtonText:le,resolvedCopyButtonText:ue,resolvedDefaultButtonText:ge,resolvedDefaultInputText:ve,resolvedDefaultSelectedValues:Te});l.current={direction:z,language:P,mermaidMessages:S,beforeSend:g,locale:o,onClickCustomButtonAfterContent:Y,onSend:k,readonly:R,renderContent:v,resolvedConfirmButtonText:ie,resolvedCopiedButtonText:le,resolvedCopyButtonText:ue,resolvedDefaultButtonText:ge,resolvedDefaultInputText:ve,resolvedDefaultSelectedValues:Te};const ye=r.useMemo(()=>({"custom-button-after-content":({children:e})=>n.jsx("button",{className:"content-render-custom-button-after-content",onClick:l.current.onClickCustomButtonAfterContent,children:n.jsx("span",{className:"content-render-custom-button-after-content-inner",children:e})}),"custom-variable":e=>n.jsx($e.default,{...e,readonly:l.current.readonly,defaultButtonText:l.current.resolvedDefaultButtonText,defaultInputText:l.current.resolvedDefaultInputText,defaultSelectedValues:l.current.resolvedDefaultSelectedValues,onSend:l.current.onSend,beforeSend:l.current.beforeSend,locale:l.current.locale,dir:l.current.direction,lang:l.current.language,confirmButtonText:l.current.resolvedConfirmButtonText}),code:nt,table:({...e})=>n.jsx("div",{className:"content-render-table-container",children:n.jsx("table",{className:"content-render-table",...e})}),th:({...e})=>n.jsx("th",{className:"content-render-th",...e}),td:({...e})=>n.jsx("td",{className:"content-render-td",...e}),tr:({...e})=>n.jsx("tr",{className:"content-render-tr",...e}),li:({node:e,...i})=>{const f=e?.properties?.className;return typeof f=="string"&&f.includes("task-list-item")||Array.isArray(f)&&f.includes("task-list-item")?n.jsx("li",{className:"content-render-task-list-item",...i}):n.jsx("li",{...i})},ol:({...e})=>n.jsx("ol",{className:"content-render-ol",...e}),ul:({...e})=>n.jsx("ul",{className:"content-render-ul",...e}),input:({...e})=>e.type==="checkbox"?n.jsx("input",{type:"checkbox",className:"content-render-checkbox",disabled:!0,...e}):n.jsx("input",{...e}),a:({children:e,...i})=>n.jsx("a",{target:"_blank",rel:"noopener noreferrer",...i,children:e}),pre:e=>n.jsx(Be.default,{...e,copyButtonText:l.current.resolvedCopyButtonText,copiedButtonText:l.current.resolvedCopiedButtonText})}),[]),we=r.useMemo(()=>et.test(v),[v]),te=r.useMemo(()=>we?Qe.splitContentSegments(v,!0):[],[v,we]),De=te.some(e=>e.type==="sandbox"),Ve=r.useMemo(()=>ot(te),[te]),ze=r.useMemo(()=>se.parseMarkdownSegments(J),[J]),Pe=(e,i)=>{const f=ke.normalizeInlineHtml(e);return se.parseMarkdownSegments(f).map((x,_)=>{const N=`${i}-${x.type}-${_}`;return x.type==="text"?n.jsx(oe.Provider,{value:l,children:n.jsx(ae,{locale:o,components:ye,content:x.value})},N):x.type==="mermaid"?n.jsx(re.default,{chart:x.value,frozen:!x.complete,messages:S},N):x.type==="svg"?n.jsx(Se,{svg:x.value},N):null})};return De?n.jsx("div",{className:"content-render markdown-body",dir:z,lang:P,children:Ve.map((e,i)=>e.type==="sandbox"?n.jsx(He.default,{hideFullScreen:!0,type:"sandbox",content:e.value,className:"content-render-iframe",locale:o,dir:z,lang:P,loadingText:U,styleLoadingText:G,scriptLoadingText:H,disableLoadingOverlay:Q,fullScreenButtonText:je,exitFullScreenButtonText:qe,mode:ce},`sandbox-${i}`):n.jsx(r.Fragment,{children:Pe(e.value,`md-${i}`)},`md-${i}`))}):n.jsxs("div",{className:"content-render markdown-body",dir:z,lang:P,children:[ze.map((e,i)=>{if(e.type==="text")return n.jsx(oe.Provider,{value:l,children:n.jsx(ae,{locale:o,components:ye,content:e.value})},i);if(e.type==="mermaid")return n.jsx(re.default,{chart:e.value,frozen:!e.complete,messages:S},i);if(e.type==="svg")return n.jsx(Se,{svg:e.value},i)}),d&&n.jsx("div",{className:"content-render-custom-bar",children:r.createElement(d,{content:t,displayContent:J,onSend:k})})]})};exports.MarkdownRenderer=ae;exports.default=ut;
|
|
6
6
|
//# sourceMappingURL=ContentRender.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentRender.cjs","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport remarkBreaks from \"remark-breaks\";\nimport remarkFlow from \"remark-flow\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport type { PluggableList } from \"unified\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport CodeBlock from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\n// import { processMarkdownText } from \"./utils/process-markdown\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport type { MarkdownFlowLocale } from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\n\nconst SANDBOX_TAG_HINT_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\\b/i;\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /** Locale used for built-in UI text when a more specific text prop is not provided. */\n locale?: MarkdownFlowLocale;\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onTypeFinished?: () => void;\n onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Exit fullscreen button text for iframe sandbox\n sandboxExitFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n // tooltipMinLength?: number; // Control minimum character length for tooltip display, default 10\n}\n\nexport interface ContentRenderTypewriterState {\n isTypewriterEnabled: boolean;\n isTyping: boolean;\n isComplete: boolean;\n renderedLength: number;\n totalLength: number;\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string }> = ({ svg }) => {\n const hostRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <div className=\"content-render-svg-scroll\">\n <div className=\"content-render-svg\" ref={hostRef} />\n </div>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\ntype MarkdownComponentRuntimeValues = {\n beforeSend?: (param: OnSendContentParams) => boolean;\n locale?: MarkdownFlowLocale;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n readonly: boolean;\n renderContent: string;\n resolvedConfirmButtonText: string;\n resolvedCopiedButtonText: string;\n resolvedCopyButtonText: string;\n resolvedDefaultButtonText?: string;\n resolvedDefaultInputText?: string;\n resolvedDefaultSelectedValues?: string[];\n};\n\nconst remarkPlugins: PluggableList = [\n remarkGfm,\n remarkMath,\n remarkFlow,\n remarkBreaks,\n];\n\nconst rehypePlugins: PluggableList = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n}> = ({ content: markdownContent, components }) => (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n);\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\") {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\") {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst areStringArraysEqual = (left?: string[], right?: string[]) => {\n if (left === right) {\n return true;\n }\n if (!left || !right || left.length !== right.length) {\n return false;\n }\n return left.every((value, index) => value === right[index]);\n};\n\nconst useStableStringArray = (values?: string[]) => {\n const valuesRef = useRef<string[] | undefined>(values);\n\n if (!areStringArraysEqual(valuesRef.current, values)) {\n valuesRef.current = values;\n }\n\n return valuesRef.current;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n contentType,\n locale,\n customRenderBar,\n onSend,\n typingSpeed = 40,\n enableTypewriter = false,\n onTypeFinished,\n onTypewriterStateChange,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxExitFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n // tooltipMinLength,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const resolvedCopyButtonText = copyButtonText || localeTexts.copyButtonText;\n const resolvedCopiedButtonText =\n copiedButtonText || localeTexts.copiedButtonText;\n const resolvedSandboxFullscreenButtonText =\n sandboxFullscreenButtonText || localeTexts.sandboxFullscreenButtonText;\n const resolvedSandboxExitFullscreenButtonText =\n sandboxExitFullscreenButtonText ||\n localeTexts.sandboxExitFullscreenButtonText;\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const typewriterChunkSize = 2;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : content\n );\n const pendingContentRef = useRef(\"\");\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n const hasReportedTypeFinishedRef = useRef(false);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n hasReportedTypeFinishedRef.current = false;\n\n if (!isTypewriterEnabled) {\n pendingContentRef.current = \"\";\n setDisplayContent(content);\n return;\n }\n\n setDisplayContent((current) => {\n const shouldRestartTyping = !wasTypewriterEnabled;\n const canContinueTyping = content.startsWith(current);\n\n if (!shouldRestartTyping && !canContinueTyping) {\n pendingContentRef.current = \"\";\n return content;\n }\n\n const nextVisibleContent =\n shouldRestartTyping || !canContinueTyping ? \"\" : current;\n\n pendingContentRef.current = content.slice(nextVisibleContent.length);\n return nextVisibleContent;\n });\n }, [content, isTypewriterEnabled]);\n\n useEffect(() => {\n if (!isTypewriterEnabled) {\n return;\n }\n\n if (\n hasReportedTypeFinishedRef.current ||\n pendingContentRef.current ||\n displayContent !== content\n ) {\n return;\n }\n\n hasReportedTypeFinishedRef.current = true;\n onTypeFinished?.();\n }, [content, displayContent, isTypewriterEnabled, onTypeFinished]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n setDisplayContent((current) => {\n const { chunk, rest } = splitTextByCharacterChunk(\n pendingContentRef.current,\n typewriterChunkSize\n );\n\n if (!chunk) {\n return current;\n }\n\n pendingContentRef.current = rest;\n return `${current}${chunk}`;\n });\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n content,\n displayContent,\n isTypewriterEnabled,\n typewriterChunkSize,\n typewriterTickMs,\n ]);\n\n const typewriterState = useMemo<ContentRenderTypewriterState>(\n () => ({\n isTypewriterEnabled,\n isTyping: isTypewriterEnabled && displayContent !== content,\n isComplete: displayContent === content,\n renderedLength: displayContent.length,\n totalLength: content.length,\n }),\n [content, displayContent, isTypewriterEnabled]\n );\n\n useEffect(() => {\n onTypewriterStateChange?.(typewriterState);\n }, [onTypewriterStateChange, typewriterState]);\n\n const renderContent = isTypewriterEnabled ? displayContent : content;\n const normalizedContent = useMemo(\n () => normalizeInlineHtml(renderContent),\n [renderContent]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n defaultButtonText?.trim() || interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n const stableDefaultSelectedValues = useStableStringArray(\n resolvedDefaultSelectedValues\n );\n const componentRuntimeValuesRef = useRef<MarkdownComponentRuntimeValues>({\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n });\n\n componentRuntimeValuesRef.current = {\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n };\n\n const components = useMemo<CustomComponents>(\n () => ({\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={\n componentRuntimeValuesRef.current.onClickCustomButtonAfterContent\n }\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={componentRuntimeValuesRef.current.readonly}\n defaultButtonText={\n componentRuntimeValuesRef.current.resolvedDefaultButtonText\n }\n defaultInputText={\n componentRuntimeValuesRef.current.resolvedDefaultInputText\n }\n defaultSelectedValues={\n componentRuntimeValuesRef.current.resolvedDefaultSelectedValues\n }\n onSend={componentRuntimeValuesRef.current.onSend}\n beforeSend={componentRuntimeValuesRef.current.beforeSend}\n locale={componentRuntimeValuesRef.current.locale}\n confirmButtonText={\n componentRuntimeValuesRef.current.resolvedConfirmButtonText\n }\n // tooltipMinLength={tooltipMinLength}\n />\n ),\n code: (props) => {\n const { className, children, ...rest } = props as {\n className?: string;\n children?: React.ReactNode;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const frozen = mermaidBlockIsComplete(\n componentRuntimeValuesRef.current.renderContent,\n chartContent\n );\n return <MermaidChart chart={chartContent} frozen={frozen} />;\n }\n\n return (\n <code className={className} {...rest}>\n {children}\n </code>\n );\n },\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={\n componentRuntimeValuesRef.current.resolvedCopyButtonText\n }\n copiedButtonText={\n componentRuntimeValuesRef.current.resolvedCopiedButtonText\n }\n />\n ),\n }),\n []\n );\n\n const hasPotentialSandboxTags = useMemo(\n () => SANDBOX_TAG_HINT_PATTERN.test(renderContent),\n [renderContent]\n );\n\n const renderSegments = useMemo(\n () =>\n hasPotentialSandboxTags ? splitContentSegments(renderContent, true) : [],\n [renderContent, hasPotentialSandboxTags]\n );\n\n const hasSandbox = renderSegments.some(\n (segment) => segment.type === \"sandbox\"\n );\n const mergedRenderSegments = useMemo(\n () => mergeNonSandboxSegments(renderSegments),\n [renderSegments]\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(normalizedContent),\n [normalizedContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={key}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart key={key} chart={seg.value} frozen={!seg.complete} />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n if (hasSandbox) {\n return (\n <div className=\"content-render markdown-body\">\n {mergedRenderSegments.map((segment, idx) =>\n segment.type === \"sandbox\" ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n locale={locale}\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={resolvedSandboxFullscreenButtonText}\n exitFullScreenButtonText={resolvedSandboxExitFullscreenButtonText}\n mode={sandboxMode}\n />\n ) : (\n <React.Fragment key={`md-${idx}`}>\n {renderMarkdownSegments(segment.value, `md-${idx}`)}\n </React.Fragment>\n )\n )}\n </div>\n );\n }\n\n return (\n <div className=\"content-render markdown-body\">\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownRenderer\n key={index}\n components={components}\n content={seg.value}\n />\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customRenderBar && (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["SANDBOX_TAG_HINT_PATTERN","SvgBlockInShadow","svg","hostRef","useRef","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","remarkPlugins","remarkGfm","remarkMath","remarkFlow","remarkBreaks","rehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","MarkdownRenderer","markdownContent","components","ReactMarkdown","mergeNonSandboxSegments","segments","merged","segment","last","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","areStringArraysEqual","left","right","index","useStableStringArray","values","valuesRef","ContentRender","content","contentType","locale","customRenderBar","onSend","typingSpeed","enableTypewriter","onTypeFinished","onTypewriterStateChange","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","localeTexts","getContentRenderLocaleTexts","resolvedConfirmButtonText","resolvedCopyButtonText","resolvedCopiedButtonText","resolvedSandboxFullscreenButtonText","resolvedSandboxExitFullscreenButtonText","isTypewriterEnabled","typewriterChunkSize","typewriterTickMs","displayContent","setDisplayContent","useState","pendingContentRef","previousTypewriterEnabledRef","hasReportedTypeFinishedRef","wasTypewriterEnabled","current","shouldRestartTyping","canContinueTyping","nextVisibleContent","typewriterTimer","chunk","rest","typewriterState","useMemo","renderContent","normalizedContent","normalizeInlineHtml","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","stableDefaultSelectedValues","componentRuntimeValuesRef","children","props","CustomButtonInputVariable","className","chartContent","frozen","mermaidBlockIsComplete","MermaidChart","CodeBlock","hasPotentialSandboxTags","renderSegments","splitContentSegments","hasSandbox","mergedRenderSegments","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","key","idx","IframeSandbox","React","jsxs"],"mappings":"kwCA8CMA,GACJ,kGAmEIC,GAA8C,CAAC,CAAE,IAAAC,KAAU,CAC/D,MAAMC,EAAUC,EAAAA,OAAu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C1B,KAAMT,CAAA,EAZD,WAAW4D,CAAG,EAAA,EAerBxH,EAAAA,kBAAAA,IAAC0H,EAAM,SAAN,CACE,SAAAP,GAAuB7F,EAAQ,MAAO,MAAMkG,CAAG,EAAE,CAAA,EAD/B,MAAMA,CAAG,EAE9B,CAAA,EAGN,EAKFG,EAAAA,kBAAAA,KAAC,MAAA,CAAI,UAAU,+BACZ,SAAA,CAAAvG,GAAS,IAAI,CAACkG,EAAKvF,IAAU,CAC5B,GAAIuF,EAAI,OAAS,OACf,OACEtH,EAAAA,kBAAAA,IAACe,EAAA,CAEC,WAAAE,GACA,QAASqG,EAAI,KAAA,EAFRvF,CAAA,EAOX,GAAIuF,EAAI,OAAS,UACf,OACEtH,EAAAA,kBAAAA,IAAC2G,EAAAA,QAAA,CAEC,MAAOW,EAAI,MACX,OAAQ,CAACA,EAAI,QAAA,EAFRvF,CAAA,EAOX,GAAIuF,EAAI,OAAS,MACf,OAAOtH,EAAAA,kBAAAA,IAAClC,GAAA,CAA6B,IAAKwJ,EAAI,OAAhBvF,CAAuB,CAEzD,CAAC,EAEAQ,GACCvC,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,4BACZ,SAAA0H,EAAM,cAAcnF,EAAiB,CACpC,QAAAH,EACA,eAAgBsD,EAChB,OAAAlD,CAAA,CACD,CAAA,CACH,CAAA,EAEJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"ContentRender.cjs","sources":["../../../src/components/ContentRender/ContentRender.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport rehypeHighlight from \"rehype-highlight\";\nimport rehypeKatex from \"rehype-katex\";\nimport rehypeRaw from \"rehype-raw\";\nimport remarkBreaks from \"remark-breaks\";\nimport remarkFlow from \"remark-flow\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\nimport type { PluggableList } from \"unified\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport { sanitizeInvalidTagName } from \"./utils/sanitize-invalid-tag-name\";\nimport { stripSvgTextLineBreaks } from \"./utils/strip-svg-text-line-breaks\";\nimport \"./contentRender.css\";\nimport \"./github-markdown-light.css\";\nimport \"highlight.js/styles/github.css\";\nimport \"katex/dist/katex.min.css\";\nimport CodeBlock, { CodeBlockContext } from \"./CodeBlock\";\nimport CustomButtonInputVariable, {\n ComponentsWithCustomVariable,\n} from \"./plugins/CustomVariable\";\nimport MermaidChart, { type MermaidChartProps } from \"./plugins/MermaidChart\";\nimport {\n preserveCustomVariableProperties,\n restoreCustomVariableProperties,\n} from \"./utils/custom-variable-props\";\nimport {\n highlightLanguages,\n subsetLanguages,\n} from \"./utils/highlight-languages\";\n// import { processMarkdownText } from \"./utils/process-markdown\";\nimport {\n parseMarkdownSegments,\n mermaidBlockIsComplete,\n} from \"./utils/mermaid-parse\";\nimport { normalizeInlineHtml } from \"./utils/normalize-inline-html\";\nimport IframeSandbox from \"./IframeSandbox\";\nimport {\n appendContentAwareTypewriterQueue,\n CONTENT_AWARE_TYPEWRITER_TICK_BUDGET,\n consumeContentAwareTypewriterQueue,\n createContentAwareTypewriterQueue,\n isContentAwareTypewriterQueueEmpty,\n type ContentAwareTypewriterQueue,\n} from \"./utils/typewriter-pacing\";\nimport {\n splitContentSegments,\n type RenderSegment,\n} from \"./utils/split-content\";\nimport {\n getInteractionDefaultValues,\n type InteractionDefaultValueOptions,\n} from \"../../lib/interaction-defaults\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\n\nconst SANDBOX_TAG_HINT_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\\b/i;\nconst FIXED_TYPEWRITER_CHUNK_SIZE = 2;\n\nexport type ContentRenderTypewriterPacing = \"fixed\" | \"content-aware\";\n\n// Define component Props type\nexport interface ContentRenderProps {\n content: string;\n contentType?: string;\n /** Locale used for built-in UI text when a more specific text prop is not provided. */\n locale?: MarkdownFlowLocale;\n /** Overrides the locale-derived language; omitted values inherit from the host. */\n lang?: string;\n /** Overrides locale-derived direction; omitted values inherit when no locale is set. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n /**\n * Callback invoked when the custom button after content is clicked.\n * This button is rendered via the `<custom-button-after-content>` tag in markdown content.\n * @example\n * ```tsx\n * <ContentRender\n * content=\"Hello <custom-button-after-content>Ask</custom-button-after-content>\"\n * onClickCustomButtonAfterContent={() => console.log('Button clicked')}\n * />\n * ```\n */\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n /** Controls how much text is revealed per tick. Defaults to the legacy fixed pacing. */\n typewriterPacing?: ContentRenderTypewriterPacing;\n onTypeFinished?: () => void;\n onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;\n userInput?: string;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n defaultButtonText?: string;\n defaultInputText?: string; // Text input by user\n defaultSelectedValues?: string[]; // Default selected values for multi-select\n readonly?: boolean;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text (i18n support)\n copyButtonText?: string;\n // Copied state text (i18n support)\n copiedButtonText?: string;\n // Dynamic interaction format for multi-select support\n dynamicInteractionFormat?: string;\n // Loading text before first HTML block renders inside iframe (i18n support)\n sandboxLoadingText?: string;\n // Loading text while styles are being generated inside iframe\n sandboxStyleLoadingText?: string;\n // Loading text while scripts are being cached/executed inside iframe\n sandboxScriptLoadingText?: string;\n // Disable sandbox loading overlays when upper layers have already entered an error state\n disableSandboxLoadingOverlay?: boolean;\n // Fullscreen button text for iframe sandbox\n sandboxFullscreenButtonText?: string;\n // Exit fullscreen button text for iframe sandbox\n sandboxExitFullscreenButtonText?: string;\n // Sandbox render mode\n sandboxMode?: \"content\" | \"blackboard\";\n beforeSend?: (param: OnSendContentParams) => boolean;\n // tooltipMinLength?: number; // Control minimum character length for tooltip display, default 10\n}\n\nexport interface ContentRenderTypewriterState {\n isTypewriterEnabled: boolean;\n isTyping: boolean;\n isComplete: boolean;\n renderedLength: number;\n totalLength: number;\n}\n\n// Render svg string via Shadow DOM to avoid markdown wrapping\nconst SvgBlockInShadow: React.FC<{ svg: string }> = ({ svg }) => {\n const hostRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const host = hostRef.current;\n if (!host) return;\n const shadowRoot = host.shadowRoot ?? host.attachShadow({ mode: \"open\" });\n const styleId = \"content-render-svg-style\";\n let styleEl = shadowRoot.getElementById(styleId) as HTMLStyleElement | null;\n\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = styleId;\n // Keep intrinsic SVG width so the wrapper can scroll horizontally when needed\n styleEl.textContent = `\n svg { height: auto; display: inline-block; }\n svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }\n svg.content-render-svg-el--fixed { max-width: none; }\n `;\n shadowRoot.appendChild(styleEl);\n }\n\n const nodesToRemove = Array.from(shadowRoot.childNodes).filter(\n (node) => node !== styleEl\n );\n nodesToRemove.forEach((node) => shadowRoot.removeChild(node));\n\n const template = document.createElement(\"template\");\n const cleanedSvg = stripSvgTextLineBreaks(svg);\n template.innerHTML = cleanedSvg;\n shadowRoot.append(template.content.cloneNode(true));\n\n let hasResponsiveSvg = false;\n let hasFixedSvg = false;\n\n shadowRoot.querySelectorAll(\"svg\").forEach((svgEl) => {\n // Derive responsive sizing from viewBox so pure viewBox SVGs stay visible and fluid\n const viewBox = svgEl.getAttribute(\"viewBox\");\n if (!viewBox) return;\n\n const dimensions = viewBox\n .trim()\n .split(/[\\s,]+/)\n .map((value) => Number(value));\n\n if (dimensions.length !== 4 || dimensions.some(Number.isNaN)) return;\n\n const [, , viewBoxWidth, viewBoxHeight] = dimensions;\n const widthAttr = svgEl.getAttribute(\"width\");\n const heightAttr = svgEl.getAttribute(\"height\");\n const isRelativeLength = (value?: string | null) => {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"auto\" || normalized.endsWith(\"%\");\n };\n const toNumericLength = (value?: string | null) => {\n if (!value) return null;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"auto\" || normalized.endsWith(\"%\")) {\n return null;\n }\n const parsed = Number.parseFloat(normalized);\n return Number.isNaN(parsed) ? null : parsed;\n };\n // Treat percentage/auto sizing as responsive so viewBox drives the layout\n const isWidthRelative = isRelativeLength(widthAttr);\n const isHeightRelative = isRelativeLength(heightAttr);\n const widthMissing = !widthAttr || widthAttr === \"0\";\n const heightMissing = !heightAttr || heightAttr === \"0\";\n const numericWidth = toNumericLength(widthAttr);\n const numericHeight = toNumericLength(heightAttr);\n const matchesViewBox =\n numericWidth === viewBoxWidth && numericHeight === viewBoxHeight;\n\n // Prefer responsive layout when sizing is relative or matches the viewBox\n const shouldUseResponsiveSize =\n isWidthRelative ||\n isHeightRelative ||\n (widthMissing && heightMissing) ||\n matchesViewBox;\n\n if (shouldUseResponsiveSize) {\n hasResponsiveSvg = true;\n svgEl.classList.add(\"content-render-svg-el--responsive\");\n svgEl.classList.remove(\"content-render-svg-el--fixed\");\n svgEl.style.width = \"100%\";\n svgEl.style.height = \"auto\";\n if (!svgEl.style.aspectRatio && viewBoxHeight > 0) {\n svgEl.style.aspectRatio = `${viewBoxWidth} / ${viewBoxHeight}`;\n }\n return;\n }\n\n hasFixedSvg = true;\n svgEl.classList.add(\"content-render-svg-el--fixed\");\n svgEl.classList.remove(\"content-render-svg-el--responsive\");\n if (widthMissing && viewBoxWidth > 0) {\n svgEl.setAttribute(\"width\", `${viewBoxWidth}`);\n }\n if (heightMissing && viewBoxHeight > 0) {\n svgEl.setAttribute(\"height\", `${viewBoxHeight}`);\n }\n });\n\n const hostResponsive = hasResponsiveSvg && !hasFixedSvg;\n host.classList.toggle(\"content-render-svg--responsive\", hostResponsive);\n host.classList.toggle(\"content-render-svg--fixed\", !hostResponsive);\n }, [svg]);\n\n return (\n <div className=\"content-render-svg-scroll\">\n <div className=\"content-render-svg\" ref={hostRef} />\n </div>\n );\n};\n\n// Extended component interface\ntype CustomComponents = ComponentsWithCustomVariable & {\n \"custom-button-after-content\"?: React.ComponentType<{\n children: React.ReactNode;\n }>;\n};\n\ntype MarkdownComponentRuntimeValues = {\n direction?: ContentRenderProps[\"dir\"];\n language?: string;\n mermaidMessages: MermaidChartProps[\"messages\"];\n beforeSend?: (param: OnSendContentParams) => boolean;\n locale?: MarkdownFlowLocale;\n onClickCustomButtonAfterContent?: () => void;\n onSend?: (content: OnSendContentParams) => void;\n readonly: boolean;\n renderContent: string;\n resolvedConfirmButtonText: string;\n resolvedCopiedButtonText: string;\n resolvedCopyButtonText: string;\n resolvedDefaultButtonText?: string;\n resolvedDefaultInputText?: string;\n resolvedDefaultSelectedValues?: string[];\n};\n\nconst MarkdownComponentRuntimeContext =\n React.createContext<React.RefObject<MarkdownComponentRuntimeValues> | null>(\n null\n );\n\nconst MarkdownCode = (props: React.ComponentProps<\"code\">) => {\n const runtimeValuesRef = React.useContext(MarkdownComponentRuntimeContext);\n const isInCodeBlock = React.useContext(CodeBlockContext);\n if (!runtimeValuesRef) {\n throw new Error(\"Markdown code renderer requires ContentRender context.\");\n }\n const { className, children, ...rest } = props as {\n className?: string;\n children?: React.ReactNode;\n dir?: string;\n };\n const match = /language-(\\w+)/.exec(className || \"\");\n const language = match?.[1];\n if (language === \"mermaid\") {\n const chartContent = children?.toString().replace(/\\n$/, \"\") || \"\";\n const frozen = mermaidBlockIsComplete(\n runtimeValuesRef.current.renderContent,\n chartContent\n );\n return (\n <MermaidChart\n chart={chartContent}\n frozen={frozen}\n messages={runtimeValuesRef.current.mermaidMessages}\n />\n );\n }\n\n return (\n <code\n className={className}\n {...rest}\n dir={rest.dir ?? (isInCodeBlock ? undefined : \"ltr\")}\n >\n {children}\n </code>\n );\n};\n\nconst remarkPlugins: PluggableList = [\n remarkGfm,\n remarkMath,\n remarkFlow,\n remarkBreaks,\n];\n\nconst rehypePlugins: PluggableList = [\n preserveCustomVariableProperties,\n rehypeRaw,\n sanitizeInvalidTagName,\n restoreCustomVariableProperties,\n [rehypeHighlight, { languages: highlightLanguages, subset: subsetLanguages }],\n rehypeKatex,\n];\n\nexport const MarkdownRenderer: React.FC<{\n content: string;\n components: CustomComponents;\n locale?: MarkdownFlowLocale;\n}> = ({ content: markdownContent, components, locale }) => {\n const texts = getContentRenderLocaleTexts(locale);\n return (\n <div className=\"markdown-renderer\">\n <ReactMarkdown\n remarkPlugins={remarkPlugins}\n rehypePlugins={rehypePlugins}\n remarkRehypeOptions={{\n footnoteLabel: texts.footnoteLabel,\n footnoteBackLabel: (referenceIndex, rereferenceIndex) => {\n const reference =\n String(referenceIndex + 1) +\n (rereferenceIndex > 1 ? `-${rereferenceIndex}` : \"\");\n return texts.footnoteBackLabel.replace(\"{reference}\", reference);\n },\n }}\n components={components}\n >\n {markdownContent}\n </ReactMarkdown>\n </div>\n );\n};\n\nconst mergeNonSandboxSegments = (segments: RenderSegment[]) => {\n if (segments.length <= 1) return segments;\n const merged: RenderSegment[] = [];\n\n segments.forEach((segment) => {\n if (segment.type === \"sandbox\") {\n merged.push(segment);\n return;\n }\n\n const last = merged[merged.length - 1];\n if (last && last.type !== \"sandbox\") {\n merged[merged.length - 1] = {\n type: \"markdown\",\n value: `${last.value}${segment.value}`,\n };\n return;\n }\n\n merged.push({ type: \"markdown\", value: segment.value });\n });\n\n return merged;\n};\n\nconst splitTextByCharacterChunk = (value: string, chunkSize: number) => {\n const safeChunkSize = Math.max(1, chunkSize);\n const characters = Array.from(value);\n\n return {\n chunk: characters.slice(0, safeChunkSize).join(\"\"),\n rest: characters.slice(safeChunkSize).join(\"\"),\n };\n};\n\nconst areStringArraysEqual = (left?: string[], right?: string[]) => {\n if (left === right) {\n return true;\n }\n if (!left || !right || left.length !== right.length) {\n return false;\n }\n return left.every((value, index) => value === right[index]);\n};\n\nconst useStableStringArray = (values?: string[]) => {\n const valuesRef = useRef<string[] | undefined>(values);\n\n if (!areStringArraysEqual(valuesRef.current, values)) {\n valuesRef.current = values;\n }\n\n return valuesRef.current;\n};\n\nconst ContentRender: React.FC<ContentRenderProps> = ({\n content,\n contentType,\n locale,\n lang,\n dir,\n customRenderBar,\n onSend,\n typingSpeed = 40,\n enableTypewriter = false,\n typewriterPacing = \"fixed\",\n onTypeFinished,\n onTypewriterStateChange,\n userInput,\n interactionDefaultValueOptions,\n defaultButtonText,\n defaultInputText,\n defaultSelectedValues,\n readonly = false,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n sandboxLoadingText,\n sandboxStyleLoadingText,\n sandboxScriptLoadingText,\n disableSandboxLoadingOverlay = false,\n sandboxFullscreenButtonText,\n sandboxExitFullscreenButtonText,\n sandboxMode = \"content\",\n onClickCustomButtonAfterContent,\n beforeSend,\n // tooltipMinLength,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const mermaidMessages = useMemo(\n () => ({\n loading: localeTexts.mermaidLoadingText,\n emptyChart: localeTexts.mermaidEmptyChartText,\n error: localeTexts.mermaidErrorText,\n }),\n [localeTexts]\n );\n const direction = dir ?? getMarkdownFlowDirection(locale);\n const language = lang ?? getMarkdownFlowLanguage(locale);\n const resolvedConfirmButtonText =\n confirmButtonText || localeTexts.confirmButtonText;\n const resolvedCopyButtonText = copyButtonText || localeTexts.copyButtonText;\n const resolvedCopiedButtonText =\n copiedButtonText || localeTexts.copiedButtonText;\n const resolvedSandboxFullscreenButtonText =\n sandboxFullscreenButtonText || localeTexts.sandboxFullscreenButtonText;\n const resolvedSandboxExitFullscreenButtonText =\n sandboxExitFullscreenButtonText ||\n localeTexts.sandboxExitFullscreenButtonText;\n const shouldApplyTypewriterByContentType =\n !contentType || contentType === \"text\";\n const isTypewriterEnabled =\n Boolean(enableTypewriter) && shouldApplyTypewriterByContentType;\n const typewriterTickMs = Math.max(0, typingSpeed);\n const fixedTypewriterContentVersion =\n typewriterPacing === \"fixed\" ? content : undefined;\n const [displayContent, setDisplayContent] = useState(() =>\n isTypewriterEnabled ? \"\" : content\n );\n const displayContentRef = useRef(displayContent);\n const pendingContentRef = useRef(\"\");\n const contentAwareQueueRef = useRef<ContentAwareTypewriterQueue>({\n tokens: [],\n head: 0,\n });\n const contentAwareBudgetRef = useRef(0);\n const previousTypewriterEnabledRef = useRef(isTypewriterEnabled);\n const previousTypewriterPacingRef = useRef(typewriterPacing);\n const previousSourceContentRef = useRef(content);\n const hasReportedTypeFinishedRef = useRef(false);\n const [typewriterWakeVersion, setTypewriterWakeVersion] = useState(0);\n\n useEffect(() => {\n const wasTypewriterEnabled = previousTypewriterEnabledRef.current;\n const previousTypewriterPacing = previousTypewriterPacingRef.current;\n const previousSourceContent = previousSourceContentRef.current;\n const wasPending = Boolean(pendingContentRef.current);\n\n previousTypewriterEnabledRef.current = isTypewriterEnabled;\n previousTypewriterPacingRef.current = typewriterPacing;\n previousSourceContentRef.current = content;\n\n if (\n content !== previousSourceContent ||\n isTypewriterEnabled !== wasTypewriterEnabled\n ) {\n hasReportedTypeFinishedRef.current = false;\n }\n\n const clearPendingContent = () => {\n pendingContentRef.current = \"\";\n contentAwareQueueRef.current = { tokens: [], head: 0 };\n contentAwareBudgetRef.current = 0;\n };\n\n const updateDisplayContent = (nextContent: string) => {\n displayContentRef.current = nextContent;\n setDisplayContent(nextContent);\n };\n\n if (!isTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(content);\n return;\n }\n\n if (!wasTypewriterEnabled) {\n clearPendingContent();\n updateDisplayContent(\"\");\n }\n\n const visibleContent = !wasTypewriterEnabled\n ? \"\"\n : displayContentRef.current;\n\n if (!content.startsWith(visibleContent)) {\n clearPendingContent();\n updateDisplayContent(content);\n return;\n }\n\n const nextPendingContent = content.slice(visibleContent.length);\n if (!nextPendingContent) {\n clearPendingContent();\n return;\n }\n\n if (typewriterPacing === \"content-aware\") {\n const previousPendingContent = previousSourceContent.slice(\n visibleContent.length\n );\n const canAppendToCachedQueue =\n wasTypewriterEnabled &&\n previousTypewriterPacing === \"content-aware\" &&\n content.startsWith(previousSourceContent) &&\n pendingContentRef.current === previousPendingContent;\n\n if (canAppendToCachedQueue) {\n contentAwareQueueRef.current = appendContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n content.slice(previousSourceContent.length)\n );\n } else {\n contentAwareQueueRef.current =\n createContentAwareTypewriterQueue(nextPendingContent);\n contentAwareBudgetRef.current = 0;\n }\n } else {\n contentAwareQueueRef.current = { tokens: [], head: 0 };\n contentAwareBudgetRef.current = 0;\n }\n\n pendingContentRef.current = nextPendingContent;\n\n if (!wasPending) {\n setTypewriterWakeVersion((version) => version + 1);\n }\n }, [content, isTypewriterEnabled, typewriterPacing]);\n\n useEffect(() => {\n if (!isTypewriterEnabled) {\n return;\n }\n\n if (\n hasReportedTypeFinishedRef.current ||\n pendingContentRef.current ||\n displayContent !== content\n ) {\n return;\n }\n\n hasReportedTypeFinishedRef.current = true;\n onTypeFinished?.();\n }, [content, displayContent, isTypewriterEnabled, onTypeFinished]);\n\n useEffect(() => {\n if (!isTypewriterEnabled || !pendingContentRef.current) {\n return undefined;\n }\n\n const typewriterTimer = window.setTimeout(() => {\n if (!pendingContentRef.current) {\n return;\n }\n\n let chunk = \"\";\n\n if (typewriterPacing === \"content-aware\") {\n const result = consumeContentAwareTypewriterQueue(\n contentAwareQueueRef.current,\n contentAwareBudgetRef.current + CONTENT_AWARE_TYPEWRITER_TICK_BUDGET\n );\n\n chunk = result.chunk;\n contentAwareQueueRef.current = result.queue;\n\n if (isContentAwareTypewriterQueueEmpty(result.queue)) {\n contentAwareBudgetRef.current = 0;\n } else {\n contentAwareBudgetRef.current = result.remainingBudget;\n }\n } else {\n const fixedChunk = splitTextByCharacterChunk(\n pendingContentRef.current,\n FIXED_TYPEWRITER_CHUNK_SIZE\n );\n chunk = fixedChunk.chunk;\n }\n\n if (!chunk) {\n return;\n }\n\n pendingContentRef.current = pendingContentRef.current.slice(chunk.length);\n if (!pendingContentRef.current) {\n contentAwareQueueRef.current = { tokens: [], head: 0 };\n contentAwareBudgetRef.current = 0;\n }\n\n const nextDisplayContent = `${displayContentRef.current}${chunk}`;\n displayContentRef.current = nextDisplayContent;\n setDisplayContent(nextDisplayContent);\n }, typewriterTickMs);\n\n return () => window.clearTimeout(typewriterTimer);\n }, [\n displayContent,\n fixedTypewriterContentVersion,\n isTypewriterEnabled,\n typewriterPacing,\n typewriterTickMs,\n typewriterWakeVersion,\n ]);\n\n const typewriterState = useMemo<ContentRenderTypewriterState>(\n () => ({\n isTypewriterEnabled,\n isTyping: isTypewriterEnabled && displayContent !== content,\n isComplete: displayContent === content,\n renderedLength: displayContent.length,\n totalLength: content.length,\n }),\n [content, displayContent, isTypewriterEnabled]\n );\n\n useEffect(() => {\n onTypewriterStateChange?.(typewriterState);\n }, [onTypewriterStateChange, typewriterState]);\n\n const renderContent = isTypewriterEnabled ? displayContent : content;\n const normalizedContent = useMemo(\n () => normalizeInlineHtml(renderContent),\n [renderContent]\n );\n\n const interactionDefaults = useMemo(\n () =>\n getInteractionDefaultValues(\n renderContent,\n userInput,\n interactionDefaultValueOptions\n ),\n [interactionDefaultValueOptions, renderContent, userInput]\n );\n\n const resolvedDefaultButtonText =\n defaultButtonText?.trim() || interactionDefaults.buttonText;\n const resolvedDefaultInputText =\n defaultInputText?.trim() || interactionDefaults.inputText;\n const fallbackSelectedValues = useMemo(\n () =>\n userInput\n ? userInput\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean)\n : undefined,\n [userInput]\n );\n const resolvedDefaultSelectedValues = defaultSelectedValues?.length\n ? defaultSelectedValues\n : interactionDefaults.selectedValues || fallbackSelectedValues;\n const stableDefaultSelectedValues = useStableStringArray(\n resolvedDefaultSelectedValues\n );\n const componentRuntimeValuesRef = useRef<MarkdownComponentRuntimeValues>({\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n });\n\n componentRuntimeValuesRef.current = {\n direction,\n language,\n mermaidMessages,\n beforeSend,\n locale,\n onClickCustomButtonAfterContent,\n onSend,\n readonly,\n renderContent,\n resolvedConfirmButtonText,\n resolvedCopiedButtonText,\n resolvedCopyButtonText,\n resolvedDefaultButtonText,\n resolvedDefaultInputText,\n resolvedDefaultSelectedValues: stableDefaultSelectedValues,\n };\n\n const components = useMemo<CustomComponents>(\n () => ({\n \"custom-button-after-content\": ({\n children,\n }: {\n children: React.ReactNode;\n }) => {\n return (\n <button\n className=\"content-render-custom-button-after-content\"\n onClick={\n componentRuntimeValuesRef.current.onClickCustomButtonAfterContent\n }\n >\n <span className=\"content-render-custom-button-after-content-inner\">\n {children}\n </span>\n </button>\n );\n },\n \"custom-variable\": (props) => (\n <CustomButtonInputVariable\n {...props}\n readonly={componentRuntimeValuesRef.current.readonly}\n defaultButtonText={\n componentRuntimeValuesRef.current.resolvedDefaultButtonText\n }\n defaultInputText={\n componentRuntimeValuesRef.current.resolvedDefaultInputText\n }\n defaultSelectedValues={\n componentRuntimeValuesRef.current.resolvedDefaultSelectedValues\n }\n onSend={componentRuntimeValuesRef.current.onSend}\n beforeSend={componentRuntimeValuesRef.current.beforeSend}\n locale={componentRuntimeValuesRef.current.locale}\n dir={componentRuntimeValuesRef.current.direction}\n lang={componentRuntimeValuesRef.current.language}\n confirmButtonText={\n componentRuntimeValuesRef.current.resolvedConfirmButtonText\n }\n // tooltipMinLength={tooltipMinLength}\n />\n ),\n code: MarkdownCode,\n table: ({ ...props }) => (\n <div className=\"content-render-table-container\">\n <table className=\"content-render-table\" {...props} />\n </div>\n ),\n th: ({ ...props }) => <th className=\"content-render-th\" {...props} />,\n td: ({ ...props }) => <td className=\"content-render-td\" {...props} />,\n tr: ({ ...props }) => <tr className=\"content-render-tr\" {...props} />,\n li: ({ node, ...props }) => {\n const className = node?.properties?.className;\n const hasTaskListItem =\n (typeof className === \"string\" &&\n className.includes(\"task-list-item\")) ||\n (Array.isArray(className) && className.includes(\"task-list-item\"));\n if (hasTaskListItem) {\n return <li className=\"content-render-task-list-item\" {...props} />;\n }\n return <li {...props} />;\n },\n ol: ({ ...props }) => <ol className=\"content-render-ol\" {...props} />,\n ul: ({ ...props }) => <ul className=\"content-render-ul\" {...props} />,\n input: ({ ...props }) => {\n if (props.type === \"checkbox\") {\n return (\n <input\n type=\"checkbox\"\n className=\"content-render-checkbox\"\n disabled\n {...props}\n />\n );\n }\n return <input {...props} />;\n },\n a: ({ children, ...props }) => (\n <a target=\"_blank\" rel=\"noopener noreferrer\" {...props}>\n {children}\n </a>\n ),\n pre: (props) => (\n <CodeBlock\n {...props}\n copyButtonText={\n componentRuntimeValuesRef.current.resolvedCopyButtonText\n }\n copiedButtonText={\n componentRuntimeValuesRef.current.resolvedCopiedButtonText\n }\n />\n ),\n }),\n []\n );\n\n const hasPotentialSandboxTags = useMemo(\n () => SANDBOX_TAG_HINT_PATTERN.test(renderContent),\n [renderContent]\n );\n\n const renderSegments = useMemo(\n () =>\n hasPotentialSandboxTags ? splitContentSegments(renderContent, true) : [],\n [renderContent, hasPotentialSandboxTags]\n );\n\n const hasSandbox = renderSegments.some(\n (segment) => segment.type === \"sandbox\"\n );\n const mergedRenderSegments = useMemo(\n () => mergeNonSandboxSegments(renderSegments),\n [renderSegments]\n );\n\n const segments = useMemo(\n () => parseMarkdownSegments(normalizedContent),\n [normalizedContent]\n );\n\n const renderMarkdownSegments = (raw: string, keyPrefix: string) => {\n const normalized = normalizeInlineHtml(raw);\n const parsed = parseMarkdownSegments(normalized);\n\n return parsed.map((seg, index) => {\n const key = `${keyPrefix}-${seg.type}-${index}`;\n\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={key}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={key}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={key} svg={seg.value} />;\n }\n\n return null;\n });\n };\n\n if (hasSandbox) {\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {mergedRenderSegments.map((segment, idx) =>\n segment.type === \"sandbox\" ? (\n <IframeSandbox\n key={`sandbox-${idx}`}\n hideFullScreen\n type=\"sandbox\"\n content={segment.value}\n className=\"content-render-iframe\"\n locale={locale}\n dir={direction}\n lang={language}\n loadingText={sandboxLoadingText}\n styleLoadingText={sandboxStyleLoadingText}\n scriptLoadingText={sandboxScriptLoadingText}\n disableLoadingOverlay={disableSandboxLoadingOverlay}\n fullScreenButtonText={resolvedSandboxFullscreenButtonText}\n exitFullScreenButtonText={resolvedSandboxExitFullscreenButtonText}\n mode={sandboxMode}\n />\n ) : (\n <React.Fragment key={`md-${idx}`}>\n {renderMarkdownSegments(segment.value, `md-${idx}`)}\n </React.Fragment>\n )\n )}\n </div>\n );\n }\n\n return (\n <div\n className=\"content-render markdown-body\"\n dir={direction}\n lang={language}\n >\n {segments.map((seg, index) => {\n if (seg.type === \"text\") {\n return (\n <MarkdownComponentRuntimeContext.Provider\n key={index}\n value={componentRuntimeValuesRef}\n >\n <MarkdownRenderer\n locale={locale}\n components={components}\n content={seg.value}\n />\n </MarkdownComponentRuntimeContext.Provider>\n );\n }\n\n if (seg.type === \"mermaid\") {\n return (\n <MermaidChart\n key={index}\n chart={seg.value}\n frozen={!seg.complete}\n messages={mermaidMessages}\n />\n );\n }\n\n if (seg.type === \"svg\") {\n return <SvgBlockInShadow key={index} svg={seg.value} />;\n }\n })}\n\n {customRenderBar && (\n <div className=\"content-render-custom-bar\">\n {React.createElement(customRenderBar, {\n content,\n displayContent: normalizedContent,\n onSend,\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport default ContentRender;\n"],"names":["SANDBOX_TAG_HINT_PATTERN","FIXED_TYPEWRITER_CHUNK_SIZE","SvgBlockInShadow","svg","hostRef","useRef","useEffect","host","shadowRoot","styleId","styleEl","node","template","cleanedSvg","stripSvgTextLineBreaks","hasResponsiveSvg","hasFixedSvg","svgEl","viewBox","dimensions","value","viewBoxWidth","viewBoxHeight","widthAttr","heightAttr","isRelativeLength","normalized","toNumericLength","parsed","isWidthRelative","isHeightRelative","widthMissing","heightMissing","numericWidth","numericHeight","hostResponsive","jsx","MarkdownComponentRuntimeContext","React","MarkdownCode","props","runtimeValuesRef","isInCodeBlock","CodeBlockContext","className","children","rest","chartContent","frozen","mermaidBlockIsComplete","MermaidChart","remarkPlugins","remarkGfm","remarkMath","remarkFlow","remarkBreaks","rehypePlugins","preserveCustomVariableProperties","rehypeRaw","sanitizeInvalidTagName","restoreCustomVariableProperties","rehypeHighlight","highlightLanguages","subsetLanguages","rehypeKatex","MarkdownRenderer","markdownContent","components","locale","texts","getContentRenderLocaleTexts","ReactMarkdown","referenceIndex","rereferenceIndex","reference","mergeNonSandboxSegments","segments","merged","segment","last","splitTextByCharacterChunk","chunkSize","safeChunkSize","characters","areStringArraysEqual","left","right","index","useStableStringArray","values","valuesRef","ContentRender","content","contentType","lang","dir","customRenderBar","onSend","typingSpeed","enableTypewriter","typewriterPacing","onTypeFinished","onTypewriterStateChange","userInput","interactionDefaultValueOptions","defaultButtonText","defaultInputText","defaultSelectedValues","readonly","confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","disableSandboxLoadingOverlay","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sandboxMode","onClickCustomButtonAfterContent","beforeSend","localeTexts","mermaidMessages","useMemo","direction","getMarkdownFlowDirection","language","getMarkdownFlowLanguage","resolvedConfirmButtonText","resolvedCopyButtonText","resolvedCopiedButtonText","resolvedSandboxFullscreenButtonText","resolvedSandboxExitFullscreenButtonText","isTypewriterEnabled","typewriterTickMs","fixedTypewriterContentVersion","displayContent","setDisplayContent","useState","displayContentRef","pendingContentRef","contentAwareQueueRef","contentAwareBudgetRef","previousTypewriterEnabledRef","previousTypewriterPacingRef","previousSourceContentRef","hasReportedTypeFinishedRef","typewriterWakeVersion","setTypewriterWakeVersion","wasTypewriterEnabled","previousTypewriterPacing","previousSourceContent","wasPending","clearPendingContent","updateDisplayContent","nextContent","visibleContent","nextPendingContent","previousPendingContent","appendContentAwareTypewriterQueue","createContentAwareTypewriterQueue","version","typewriterTimer","chunk","result","consumeContentAwareTypewriterQueue","CONTENT_AWARE_TYPEWRITER_TICK_BUDGET","isContentAwareTypewriterQueueEmpty","nextDisplayContent","typewriterState","renderContent","normalizedContent","normalizeInlineHtml","interactionDefaults","getInteractionDefaultValues","resolvedDefaultButtonText","resolvedDefaultInputText","fallbackSelectedValues","resolvedDefaultSelectedValues","stableDefaultSelectedValues","componentRuntimeValuesRef","CustomButtonInputVariable","CodeBlock","hasPotentialSandboxTags","renderSegments","splitContentSegments","hasSandbox","mergedRenderSegments","parseMarkdownSegments","renderMarkdownSegments","raw","keyPrefix","seg","key","idx","IframeSandbox","jsxs"],"mappings":"i8CA4DMA,GACJ,kGACIC,GAA8B,EA2E9BC,GAA8C,CAAC,CAAE,IAAAC,KAAU,CAC/D,MAAMC,EAAUC,EAAAA,OAAuB,IAAI,EAE3CC,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAOH,EAAQ,QACrB,GAAI,CAACG,EAAM,OACX,MAAMC,EAAaD,EAAK,YAAcA,EAAK,aAAa,CAAE,KAAM,OAAQ,EAClEE,EAAU,2BAChB,IAAIC,EAAUF,EAAW,eAAeC,CAAO,EAE1CC,IACHA,EAAU,SAAS,cAAc,OAAO,EACxCA,EAAQ,GAAKD,EAEbC,EAAQ,YAAc;AAAA;AAAA;AAAA;AAAA,QAKtBF,EAAW,Y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I,CAACoH,EAAKzG,IAAU,CAC5B,GAAIyG,EAAI,OAAS,OACf,OACE5J,EAAAA,IAACC,GAAgC,SAAhC,CAEC,MAAO+I,EAEP,SAAAhJ,EAAAA,IAAC6B,GAAA,CAAA,OACCG,EACA,WAAAD,GACA,QAAS6H,EAAI,KAAA,CAAA,CACf,EAPKzG,CAAA,EAYX,GAAIyG,EAAI,OAAS,UACf,OACE5J,EAAAA,IAACc,GAAAA,QAAA,CAEC,MAAO8I,EAAI,MACX,OAAQ,CAACA,EAAI,SACb,SAAUtE,CAAA,EAHLnC,CAAA,EAQX,GAAIyG,EAAI,OAAS,MACf,OAAO5J,EAAAA,IAAClC,GAAA,CAA6B,IAAK8L,EAAI,OAAhBzG,CAAuB,CAEzD,CAAC,EAEAS,GACC5D,EAAAA,IAAC,MAAA,CAAI,UAAU,4BACZ,SAAAE,EAAM,cAAc0D,EAAiB,CACpC,QAAAJ,EACA,eAAgB+E,EAChB,OAAA1E,CAAA,CACD,CAAA,CACH,CAAA,CAAA,CAAA,CAIR"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { CustomRenderBarProps, OnSendContentParams } from '../types';
|
|
3
|
-
import { ComponentsWithCustomVariable } from './plugins/CustomVariable';
|
|
4
|
-
import { InteractionDefaultValueOptions } from '../../lib/interaction-defaults';
|
|
5
|
-
import { MarkdownFlowLocale } from '../../lib/locale';
|
|
2
|
+
import { CustomRenderBarProps, OnSendContentParams } from '../types.js';
|
|
3
|
+
import { ComponentsWithCustomVariable } from './plugins/CustomVariable.js';
|
|
4
|
+
import { InteractionDefaultValueOptions } from '../../lib/interaction-defaults.js';
|
|
5
|
+
import { MarkdownFlowLocale } from '../../lib/locale.js';
|
|
6
|
+
export type ContentRenderTypewriterPacing = "fixed" | "content-aware";
|
|
6
7
|
export interface ContentRenderProps {
|
|
7
8
|
content: string;
|
|
8
9
|
contentType?: string;
|
|
9
10
|
/** Locale used for built-in UI text when a more specific text prop is not provided. */
|
|
10
11
|
locale?: MarkdownFlowLocale;
|
|
12
|
+
/** Overrides the locale-derived language; omitted values inherit from the host. */
|
|
13
|
+
lang?: string;
|
|
14
|
+
/** Overrides locale-derived direction; omitted values inherit when no locale is set. */
|
|
15
|
+
dir?: React.HTMLAttributes<HTMLDivElement>["dir"];
|
|
11
16
|
/**
|
|
12
17
|
* Callback invoked when the custom button after content is clicked.
|
|
13
18
|
* This button is rendered via the `<custom-button-after-content>` tag in markdown content.
|
|
@@ -24,6 +29,8 @@ export interface ContentRenderProps {
|
|
|
24
29
|
onSend?: (content: OnSendContentParams) => void;
|
|
25
30
|
typingSpeed?: number;
|
|
26
31
|
enableTypewriter?: boolean;
|
|
32
|
+
/** Controls how much text is revealed per tick. Defaults to the legacy fixed pacing. */
|
|
33
|
+
typewriterPacing?: ContentRenderTypewriterPacing;
|
|
27
34
|
onTypeFinished?: () => void;
|
|
28
35
|
onTypewriterStateChange?: (state: ContentRenderTypewriterState) => void;
|
|
29
36
|
userInput?: string;
|
|
@@ -60,6 +67,7 @@ type CustomComponents = ComponentsWithCustomVariable & {
|
|
|
60
67
|
export declare const MarkdownRenderer: React.FC<{
|
|
61
68
|
content: string;
|
|
62
69
|
components: CustomComponents;
|
|
70
|
+
locale?: MarkdownFlowLocale;
|
|
63
71
|
}>;
|
|
64
72
|
declare const ContentRender: React.FC<ContentRenderProps>;
|
|
65
73
|
export default ContentRender;
|