markdown-flow-ui 0.3.2-dev.2 → 0.3.2
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 +0 -13
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/_virtual/index8.cjs +1 -1
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/utils/video-markdown-run.cjs.map +1 -1
- package/dist/components/ContentRender/utils/video-markdown-run.es.js.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js.map +1 -1
- package/dist/components/MarkdownFlow/useScrollToBottom.cjs.map +1 -1
- 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 +2 -2
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +323 -562
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.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 +0 -8
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +64 -107
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editor-context.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/editor-context.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/editor-context.es.js +4 -10
- package/dist/components/MarkdownFlowEditor/editor-context.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -308
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +87 -115
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +88 -116
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +88 -116
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +80 -108
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +82 -110
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.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 +1 -15
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +86 -114
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +88 -116
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +85 -113
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +94 -122
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +74 -102
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +72 -100
- 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.d.ts +2 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +62 -53
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +1 -5
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +149 -154
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +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.d.ts +2 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +53 -42
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/types.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/types.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/types.d.ts +1 -11
- package/dist/components/MarkdownFlowEditor/types.es.js +2 -2
- package/dist/components/MarkdownFlowEditor/types.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.d.ts +0 -10
- package/dist/components/MarkdownFlowEditor/utils.es.js +59 -73
- package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
- package/dist/components/Slide/MarkdownSlideScaling.cjs.map +1 -1
- package/dist/components/Slide/MarkdownSlideScaling.es.js.map +1 -1
- package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +16 -16
- package/dist/components/Slide/Player.cjs.map +1 -1
- package/dist/components/Slide/Player.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs.map +1 -1
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/SubtitleOverlay.cjs.map +1 -1
- package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
- package/dist/components/Slide/slideI18n.cjs.map +1 -1
- package/dist/components/Slide/slideI18n.es.js.map +1 -1
- package/dist/components/Slide/useSlide.cjs.map +1 -1
- package/dist/components/Slide/useSlide.es.js.map +1 -1
- package/dist/components/Slide/utils/streamingNavigation.cjs.map +1 -1
- package/dist/components/Slide/utils/streamingNavigation.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.es.js +27 -27
- package/dist/components/ui/dialog.es.js.map +1 -1
- package/dist/lib/interaction-defaults.cjs.map +1 -1
- package/dist/lib/interaction-defaults.es.js.map +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/markdown-flow-ui.css +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +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 +34 -49
- 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 +1 -5
- 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 +206 -220
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.es.js +50 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.es.js +82 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +216 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.es.js +15 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.es.js +18 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.es.js +104 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js +39 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +13 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js +70 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.es.js +20 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.es.js +7 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.es.js +18 -9
- package/dist/node_modules/@radix-ui/react-focus-guards/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 +148 -100
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js +39 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +13 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.es.js +8 -8
- package/dist/node_modules/@radix-ui/react-id/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 +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js +50 -0
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -0
- 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 +80 -41
- package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
- 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 +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js +12 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -0
- package/dist/node_modules/classnames/index.cjs +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +2 -2
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.es.js +75 -72
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.es.js.map +1 -1
- package/package.json +10 -10
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs +0 -2
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.d.ts +0 -17
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js +0 -46
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs +0 -2
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.d.ts +0 -18
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js +0 -184
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +0 -2
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.d.ts +0 -11
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +0 -172
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs +0 -2
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.d.ts +0 -3
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js +0 -32
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js.map +0 -1
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs +0 -3
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.d.ts +0 -9
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js +0 -53
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js.map +0 -1
- package/dist/components/ui/popover.cjs +0 -2
- package/dist/components/ui/popover.cjs.map +0 -1
- package/dist/components/ui/popover.es.js +0 -24
- package/dist/components/ui/popover.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js +0 -241
- package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/braces.cjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/braces.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/braces.es.js +0 -25
- package/dist/node_modules/lucide-react/dist/esm/icons/braces.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/plus.cjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/plus.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/plus.es.js +0 -16
- package/dist/node_modules/lucide-react/dist/esm/icons/plus.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/search.es.js +0 -16
- package/dist/node_modules/lucide-react/dist/esm/icons/search.es.js.map +0 -1
- /package/dist/components/MarkdownFlowEditor/plugins/{VariablePlaceholder.test.d.ts → MediaPlaceholder.variables.test.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
`,
|
|
3
|
-
`,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("../../../node_modules/@codemirror/view/dist/index.cjs"),P=require("../../../node_modules/@codemirror/state/dist/index.cjs"),_=require("../../ContentRender/utils/inline-code-ranges.cjs"),R=require("../../../_virtual/index.cjs"),F=/<!--[\s\S]*?-->/g,W=n=>{const i=R.distExports.findVariableMarkers(n),f=n.indexOf("{{",i.at(-1)?.end??0);return f===-1?i:[...i,{start:f,end:n.length,name:null}]},M=new RegExp(`\\?\\[(${R.distExports.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,"g"),$=n=>_.getMarkdownSourceAnalysis(n).interactions;function L(n,i){const f=[];let l=null,s=0;for(;s<=n.length;){const u=n.indexOf(`
|
|
2
|
+
`,s),e=u===-1?n.length:u;if(n.slice(s,e).trim()==="!==="&&!i(s)&&(l===null?l=s:(f.push({from:l,to:e,className:"syntax-fixed"}),l=null)),u===-1)break;s=u+1}return f}function j(n,i,f){const l=[];let s=0;const u=t=>{for(;s<i.length&&i[s].to<=t;)s++;const r=i[s];return!!r&&t>=r.from&&t<r.to};let e=0;for(;e<=n.length;){const t=n.indexOf(`
|
|
3
|
+
`,e),r=t===-1?n.length:t,d=n.slice(e,r),x=[];let g=0;for(;g<d.length;){const c=d.indexOf("===",g);if(c===-1)break;const p=e+c;!(p>0&&n[p-1]==="!")&&!u(p)&&!f(p)&&x.push(p),g=c+3}for(let c=0;c+1<x.length;c+=2)l.push({from:x[c],to:x[c+1]+3,className:"syntax-fixed"});if(t===-1)break;e=t+1}return l}function T(n,i){const f=[];let l;for(F.lastIndex=0;(l=F.exec(n))!==null;)i(l.index)||f.push({from:l.index,to:l.index+l[0].length,className:"syntax-comment"});return f}function B(n){const i=R.distExports.findDocumentVariableMarkers(n),f=e=>i.some(t=>e>=t.start&&e<t.end),l=T(n,f),s=[...L(n,f),...j(n,l,f),...l].sort((e,t)=>e.from!==t.from?e.from-t.from:t.to-e.to),u=[];for(const e of s){const t=u[u.length-1];(!t||e.from>=t.to)&&u.push(e)}return u}function D(n,i=()=>!1){const f=[],l=R.distExports.findDocumentVariableMarkers(n),s=[];M.lastIndex=0;const u=(t,r)=>s.some(d=>!(r<=d.from||t>=d.to)),e=(t,r,d)=>t>=r||u(t,r)?!1:(s.push({from:t,to:r}),f.push({from:t,to:r,className:d}),!0);for(const t of B(n))e(t.from,t.to,t.className);for(const t of $(n)){M.lastIndex=t.start;const r=M.exec(n);if(!r||r.index!==t.start||r.index+r[0].length!==t.end)continue;const d=r.index,x=r.index+r[0].length,g=r[1],c=d+2;if(u(d,x)||l.some(b=>b.start<=d&&d<b.end))continue;e(d,d+1,"syntax-keyword"),e(d+1,d+2,"syntax-bracket"),e(x-1,x,"syntax-bracket");const p=W(g),y=p[0],E=y?y.start-1:-1,V=E>=0&&g[E]==="%"&&R.distExports.trimVariablePadding(g.slice(0,E))==="";if(g.startsWith("%")||V){let b="syntax-percent-invalid";if(y&&V){const o=c+y.start,h=c+y.end,I=i(o,h);b=y.name!==null&&!I?"syntax-percent-valid":"syntax-percent-invalid"}const v=c+(V?E:0);e(v,v+1,b);const O=[],S=[],N=[];for(const o of p)S.push({from:c+o.start,to:c+o.end,className:o.name===null?"syntax-variable-invalid":"syntax-variable"});let m=0;for(;m<g.length;){const o=S.find(I=>c+m===I.from);if(o){m=o.to-c;continue}if(R.distExports.isEscape(g,m)){m+=2;continue}const h=g.startsWith("||",m)?"||":g[m]==="|"?"|":g.startsWith("...",m)?"...":null;if(!h){m+=1;continue}O.push({from:c+m,to:c+m+h.length}),m+=h.length}const a=[...O.map(o=>({...o,className:"syntax-keyword"})),...S.map(o=>({...o,className:o.className}))].sort((o,h)=>o.from!==h.from?o.from-h.from:o.to-h.to);for(const o of a)o.className.startsWith("syntax-variable")&&i(o.from,o.to)||e(o.from,o.to,o.className)&&N.push({from:o.from,to:o.to});const w=v+1,C=x-1;let k=w;const H=N.sort((o,h)=>o.from!==h.from?o.from-h.from:o.to-h.to);for(const o of H)k<o.from&&e(k,o.from,"syntax-string"),k=Math.max(k,o.to);k<C&&e(k,C,"syntax-string")}else{const b=[],v=[];for(const a of W(g))b.push({from:c+a.start,to:c+a.end,className:a.name===null?"syntax-variable-invalid":"syntax-variable"});const O=b.sort((a,w)=>a.from!==w.from?a.from-w.from:a.to-w.to);for(const a of O)a.className.startsWith("syntax-variable")&&i(a.from,a.to)||e(a.from,a.to,a.className)&&v.push({from:a.from,to:a.to});const S=c,N=x-1;let m=S;for(const a of v)m<a.from&&e(m,a.from,"syntax-button-text"),m=Math.max(m,a.to);m<N&&e(m,N,"syntax-button-text")}}for(const t of l)t.name!==null&&!i(t.start,t.end)&&e(t.start,t.end,"syntax-variable");return f.sort((t,r)=>t.from!==r.from?t.from-r.from:r.to-t.to),f}function q(n){const i=new P.RangeSetBuilder,f=n.state.doc.toString(),l=D(f,(s,u)=>n.state.selection.ranges.some(e=>e.from>=s&&e.to<=u));for(const s of l)if(s.from<s.to)try{i.add(s.from,s.to,A.Decoration.mark({class:s.className}))}catch(u){console.warn("SyntaxHighlighter: Failed to add decoration",s,u)}return i.finish()}const U=A.ViewPlugin.fromClass(class{constructor(n){this.decorations=q(n)}update(n){(n.docChanged||n.viewportChanged||n.selectionSet)&&(this.decorations=q(n.view))}},{decorations:n=>n.decorations});exports.collectOuterBlockRanges=B;exports.collectSyntaxHighlightRanges=D;exports.default=U;
|
|
4
4
|
//# sourceMappingURL=SyntaxHighlighter.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyntaxHighlighter.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.ts"],"sourcesContent":["import {\n Decoration,\n DecorationSet,\n EditorView,\n ViewPlugin,\n ViewUpdate,\n} from \"@codemirror/view\";\nimport { RangeSetBuilder } from \"@codemirror/state\";\nimport { getMarkdownSourceAnalysis } from \"../../ContentRender/utils/inline-code-ranges\";\nimport { INTERACTION_CONTENT_SOURCE, isEscape } from \"remark-flow\";\n\nimport {\n findVariableMarkers,\n findDocumentVariableMarkers,\n trimVariablePadding,\n} from \"../utils\";\n\nconst commentRegex = /<!--[\\s\\S]*?-->/g;\n\n// An unfinished marker still owns its tail, so nested syntax stays literal while typing.\nconst interactionVariableRanges = (text: string) => {\n const markers = findVariableMarkers(text);\n const pending = text.indexOf(\"{{\", markers.at(-1)?.end ?? 0);\n return pending === -1\n ? markers\n : [...markers, { start: pending, end: text.length, name: null }];\n};\n// The grammar's own definition of where an interaction ends, so a `\\]` an option escaped does\n// not cut the highlight short, and the same `(?!\\()` the parser uses, so `?[text](url)` stays a\n// markdown link. Taken from remark-flow rather than written again here: the editor and the\n// parser have to agree about what they are looking at.\nconst controlBlockRegex = new RegExp(\n `\\\\?\\\\[(${INTERACTION_CONTENT_SOURCE})\\\\](?!\\\\()`,\n \"g\"\n);\n\nconst documentControlRanges = (text: string) =>\n getMarkdownSourceAnalysis(text).interactions;\n\nexport interface SyntaxHighlightRange {\n from: number;\n to: number;\n className: string;\n}\n\nfunction collectMultilineFixedOutputRanges(\n docText: string,\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let pendingStart: number | null = null;\n let lineStart = 0;\n\n while (lineStart <= docText.length) {\n const newlineIndex = docText.indexOf(\"\\n\", lineStart);\n const lineEnd = newlineIndex === -1 ? docText.length : newlineIndex;\n const lineText = docText.slice(lineStart, lineEnd);\n\n if (lineText.trim() === \"!===\" && !isInsideVariable(lineStart)) {\n if (pendingStart === null) {\n pendingStart = lineStart;\n } else {\n ranges.push({\n from: pendingStart,\n to: lineEnd,\n className: \"syntax-fixed\",\n });\n pendingStart = null;\n }\n }\n\n if (newlineIndex === -1) {\n break;\n }\n\n lineStart = newlineIndex + 1;\n }\n\n return ranges;\n}\n\nfunction collectSingleLineFixedOutputRanges(\n docText: string,\n commentRanges: SyntaxHighlightRange[],\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let commentIndex = 0;\n\n const isInsideComment = (index: number) => {\n while (\n commentIndex < commentRanges.length &&\n commentRanges[commentIndex].to <= index\n ) {\n commentIndex++;\n }\n\n const range = commentRanges[commentIndex];\n return !!range && index >= range.from && index < range.to;\n };\n\n let lineStart = 0;\n while (lineStart <= docText.length) {\n const newlineIndex = docText.indexOf(\"\\n\", lineStart);\n const lineEnd = newlineIndex === -1 ? docText.length : newlineIndex;\n const lineText = docText.slice(lineStart, lineEnd);\n const markerPositions: number[] = [];\n let searchFrom = 0;\n\n while (searchFrom < lineText.length) {\n const markerOffset = lineText.indexOf(\"===\", searchFrom);\n if (markerOffset === -1) {\n break;\n }\n\n const markerIndex = lineStart + markerOffset;\n const isNegated = markerIndex > 0 && docText[markerIndex - 1] === \"!\";\n if (\n !isNegated &&\n !isInsideComment(markerIndex) &&\n !isInsideVariable(markerIndex)\n ) {\n markerPositions.push(markerIndex);\n }\n\n searchFrom = markerOffset + 3;\n }\n\n for (let i = 0; i + 1 < markerPositions.length; i += 2) {\n ranges.push({\n from: markerPositions[i],\n to: markerPositions[i + 1] + 3,\n className: \"syntax-fixed\",\n });\n }\n\n if (newlineIndex === -1) {\n break;\n }\n\n lineStart = newlineIndex + 1;\n }\n\n return ranges;\n}\n\nfunction collectCommentRanges(\n docText: string,\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let match;\n\n commentRegex.lastIndex = 0;\n while ((match = commentRegex.exec(docText)) !== null) {\n if (isInsideVariable(match.index)) continue;\n ranges.push({\n from: match.index,\n to: match.index + match[0].length,\n className: \"syntax-comment\",\n });\n }\n\n return ranges;\n}\n\n/**\n * Collects non-overlapping fixed-output and comment wrapper ranges.\n *\n * @param docText - Document text to scan.\n * @returns Outer syntax highlight ranges sorted by document position.\n */\nexport function collectOuterBlockRanges(\n docText: string\n): SyntaxHighlightRange[] {\n const variables = findDocumentVariableMarkers(docText);\n const isInsideVariable = (position: number) =>\n variables.some(\n (marker) => position >= marker.start && position < marker.end\n );\n const commentRanges = collectCommentRanges(docText, isInsideVariable);\n const blockRanges = [\n ...collectMultilineFixedOutputRanges(docText, isInsideVariable),\n ...collectSingleLineFixedOutputRanges(\n docText,\n commentRanges,\n isInsideVariable\n ),\n ...commentRanges,\n ].sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return b.to - a.to;\n });\n\n const outerRanges: SyntaxHighlightRange[] = [];\n\n for (const range of blockRanges) {\n const lastOuter = outerRanges[outerRanges.length - 1];\n if (!lastOuter || range.from >= lastOuter.to) {\n outerRanges.push(range);\n }\n }\n\n return outerRanges;\n}\n\n/**\n * Collects all custom syntax highlight ranges for editor decorations.\n *\n * @param docText - Document text to scan.\n * @param isCursorInside - Returns true when the current cursor is inside a range.\n * @returns Non-overlapping syntax highlight ranges sorted by document position.\n */\nexport function collectSyntaxHighlightRanges(\n docText: string,\n isCursorInside: (from: number, to: number) => boolean = () => false,\n questionMode = false\n): SyntaxHighlightRange[] {\n const matches: SyntaxHighlightRange[] = [];\n const documentVariables = findDocumentVariableMarkers(docText);\n const occupied: { from: number; to: number }[] = [];\n\n controlBlockRegex.lastIndex = 0;\n\n // Prevent overlapping decorations so styling stays deterministic\n const isOverlapping = (from: number, to: number) =>\n occupied.some((range) => !(to <= range.from || from >= range.to));\n\n const addMatch = (from: number, to: number, className: string) => {\n if (from >= to) return false;\n if (isOverlapping(from, to)) return false;\n occupied.push({ from, to });\n matches.push({ from, to, className });\n return true;\n };\n\n // 1. Outer block ranges win over any syntax inside them.\n for (const range of collectOuterBlockRanges(docText)) {\n addMatch(range.from, range.to, range.className);\n }\n\n // 2. Control Blocks\n for (const control of documentControlRanges(docText)) {\n // Native Markdown owns document boundaries. The shared token grammar still\n // supplies the exact source offsets used for individual editor decorations.\n controlBlockRegex.lastIndex = control.start;\n const match = controlBlockRegex.exec(docText);\n if (\n !match ||\n match.index !== control.start ||\n match.index + match[0].length !== control.end\n )\n continue;\n const fullStart = match.index;\n const fullEnd = match.index + match[0].length;\n const content = match[1];\n const contentStart = fullStart + 2; // after ?[\n if (\n isOverlapping(fullStart, fullEnd) ||\n documentVariables.some(\n (marker) => marker.start <= fullStart && fullStart < marker.end\n )\n ) {\n continue;\n }\n\n // Outer brackets and question mark\n addMatch(fullStart, fullStart + 1, \"syntax-keyword\"); // ?\n addMatch(fullStart + 1, fullStart + 2, \"syntax-bracket\"); // [\n addMatch(fullEnd - 1, fullEnd, \"syntax-bracket\"); // ]\n\n const variables = interactionVariableRanges(content);\n const firstVariable = variables[0];\n const percentIndex = firstVariable ? firstVariable.start - 1 : -1;\n const hasLeadingAssignment =\n percentIndex >= 0 &&\n content[percentIndex] === \"%\" &&\n trimVariablePadding(content.slice(0, percentIndex)) === \"\";\n if (content.startsWith(\"%\") || hasLeadingAssignment) {\n // Input / Select\n let percentClass = \"syntax-percent-invalid\";\n if (firstVariable && hasLeadingAssignment) {\n const varFrom = contentStart + firstVariable.start;\n const varTo = contentStart + firstVariable.end;\n const cursorInsideVar = isCursorInside(varFrom, varTo);\n percentClass =\n firstVariable.name !== null && !cursorInsideVar\n ? \"syntax-percent-valid\"\n : \"syntax-percent-invalid\";\n }\n const percentStart =\n contentStart + (hasLeadingAssignment ? percentIndex : 0);\n addMatch(percentStart, percentStart + 1, percentClass); // %\n\n const operatorRanges: { from: number; to: number }[] = [];\n const variableRanges: { from: number; to: number; className: string }[] =\n [];\n const appliedTokenRanges: { from: number; to: number }[] = [];\n\n // Keep a variable name atomic even when it contains option punctuation.\n for (const variable of variables) {\n variableRanges.push({\n from: contentStart + variable.start,\n to: contentStart + variable.end,\n className:\n variable.name === null\n ? \"syntax-variable-invalid\"\n : \"syntax-variable\",\n });\n }\n\n // Inner operators | || ... -- skipping any an option escaped, the way the parser does.\n // Painted as separators, they told the author the grammar had split an option that it\n // had in fact left whole.\n let scanIndex = 0;\n while (scanIndex < content.length) {\n const variable = variableRanges.find(\n (range) => contentStart + scanIndex === range.from\n );\n if (variable) {\n scanIndex = variable.to - contentStart;\n continue;\n }\n if (isEscape(content, scanIndex)) {\n scanIndex += 2;\n continue;\n }\n const operator = content.startsWith(\"||\", scanIndex)\n ? \"||\"\n : content[scanIndex] === \"|\"\n ? \"|\"\n : content.startsWith(\"...\", scanIndex)\n ? \"...\"\n : null;\n if (!operator) {\n scanIndex += 1;\n continue;\n }\n operatorRanges.push({\n from: contentStart + scanIndex,\n to: contentStart + scanIndex + operator.length,\n });\n scanIndex += operator.length;\n }\n\n const allTokens = [\n ...operatorRanges.map((range) => ({\n ...range,\n className: \"syntax-keyword\",\n })),\n ...variableRanges.map((range) => ({\n ...range,\n className: range.className,\n })),\n ].sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const token of allTokens) {\n if (\n token.className.startsWith(\"syntax-variable\") &&\n isCursorInside(token.from, token.to)\n ) {\n continue;\n }\n if (addMatch(token.from, token.to, token.className)) {\n appliedTokenRanges.push({ from: token.from, to: token.to });\n }\n }\n\n // Content (Dark Blue) for remaining text segments\n const stringStart = percentStart + 1;\n const stringEnd = fullEnd - 1;\n let cursor = stringStart;\n const sortedApplied = appliedTokenRanges.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const token of sortedApplied) {\n if (cursor < token.from) {\n addMatch(cursor, token.from, \"syntax-string\");\n }\n cursor = Math.max(cursor, token.to);\n }\n if (cursor < stringEnd) {\n addMatch(cursor, stringEnd, \"syntax-string\");\n }\n } else {\n // Button ?[text]\n const variableRanges: { from: number; to: number; className: string }[] =\n [];\n const appliedVariableRanges: { from: number; to: number }[] = [];\n\n for (const variable of interactionVariableRanges(content)) {\n variableRanges.push({\n from: contentStart + variable.start,\n to: contentStart + variable.end,\n className:\n variable.name === null\n ? \"syntax-variable-invalid\"\n : \"syntax-variable\",\n });\n }\n\n const sortedVariables = variableRanges.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const variable of sortedVariables) {\n if (\n variable.className.startsWith(\"syntax-variable\") &&\n isCursorInside(variable.from, variable.to)\n ) {\n continue;\n }\n if (addMatch(variable.from, variable.to, variable.className)) {\n appliedVariableRanges.push({ from: variable.from, to: variable.to });\n }\n }\n\n const buttonTextStart = contentStart;\n const buttonTextEnd = fullEnd - 1;\n let cursor = buttonTextStart;\n\n for (const variable of appliedVariableRanges) {\n if (cursor < variable.from) {\n addMatch(cursor, variable.from, \"syntax-button-text\");\n }\n cursor = Math.max(cursor, variable.to);\n }\n if (cursor < buttonTextEnd) {\n addMatch(cursor, buttonTextEnd, \"syntax-button-text\");\n }\n }\n }\n\n // 3. Variables (only if not already decorated; invalid ones stay default outside control blocks)\n for (const variable of questionMode ? [] : documentVariables) {\n if (\n variable.name !== null &&\n !isCursorInside(variable.start, variable.end)\n ) {\n addMatch(variable.start, variable.end, \"syntax-variable\");\n }\n }\n\n // Sort matches by 'from' asc, then 'to' desc (longest first)\n matches.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return b.to - a.to;\n });\n\n return matches;\n}\n\nfunction buildDecorations(\n view: EditorView,\n questionMode = false\n): DecorationSet {\n const builder = new RangeSetBuilder<Decoration>();\n const docText = view.state.doc.toString();\n const matches = collectSyntaxHighlightRanges(\n docText,\n (from, to) => {\n return view.state.selection.ranges.some((range) => {\n return range.from >= from && range.to <= to;\n });\n },\n questionMode\n );\n\n for (const m of matches) {\n if (m.from < m.to) {\n try {\n builder.add(m.from, m.to, Decoration.mark({ class: m.className }));\n } catch (e) {\n console.warn(\"SyntaxHighlighter: Failed to add decoration\", m, e);\n }\n }\n }\n\n return builder.finish();\n}\n\nconst createSyntaxHighlighter = (questionMode = false) =>\n ViewPlugin.fromClass(\n class {\n decorations: DecorationSet;\n\n constructor(view: EditorView) {\n this.decorations = buildDecorations(view, questionMode);\n }\n\n update(update: ViewUpdate) {\n if (\n update.docChanged ||\n update.viewportChanged ||\n update.selectionSet\n ) {\n this.decorations = buildDecorations(update.view, questionMode);\n }\n }\n },\n {\n decorations: (instance) => instance.decorations,\n }\n );\n\nconst SyntaxHighlighter = createSyntaxHighlighter();\nexport const QuestionSyntaxHighlighter = createSyntaxHighlighter(true);\n\nexport default SyntaxHighlighter;\n"],"names":["commentRegex","interactionVariableRanges","text","markers","findVariableMarkers","pending","controlBlockRegex","INTERACTION_CONTENT_SOURCE","documentControlRanges","getMarkdownSourceAnalysis","collectMultilineFixedOutputRanges","docText","isInsideVariable","ranges","pendingStart","lineStart","newlineIndex","lineEnd","collectSingleLineFixedOutputRanges","commentRanges","commentIndex","isInsideComment","index","range","lineText","markerPositions","searchFrom","markerOffset","markerIndex","i","collectCommentRanges","match","collectOuterBlockRanges","variables","findDocumentVariableMarkers","position","marker","blockRanges","a","b","outerRanges","lastOuter","collectSyntaxHighlightRanges","isCursorInside","questionMode","matches","documentVariables","occupied","isOverlapping","from","to","addMatch","className","control","fullStart","fullEnd","content","contentStart","firstVariable","percentIndex","hasLeadingAssignment","trimVariablePadding","percentClass","varFrom","varTo","cursorInsideVar","percentStart","operatorRanges","variableRanges","appliedTokenRanges","variable","scanIndex","isEscape","operator","allTokens","token","stringStart","stringEnd","cursor","sortedApplied","appliedVariableRanges","sortedVariables","buttonTextStart","buttonTextEnd","buildDecorations","view","builder","RangeSetBuilder","m","Decoration","e","createSyntaxHighlighter","ViewPlugin","update","instance","SyntaxHighlighter","QuestionSyntaxHighlighter"],"mappings":"gWAiBMA,EAAe,mBAGfC,EAA6BC,GAAiB,CAClD,MAAMC,EAAUC,EAAAA,YAAAA,oBAAoBF,CAAI,EAClCG,EAAUH,EAAK,QAAQ,KAAMC,EAAQ,GAAG,EAAE,GAAG,KAAO,CAAC,EAC3D,OAAOE,IAAY,GACfF,EACA,CAAC,GAAGA,EAAS,CAAE,MAAOE,EAAS,IAAKH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HN,CAAA,EAGF,UAAW4C,KAAK3C,EACd,GAAI2C,EAAE,KAAOA,EAAE,GACb,GAAI,CACFF,EAAQ,IAAIE,EAAE,KAAMA,EAAE,GAAIC,aAAW,KAAK,CAAE,MAAOD,EAAE,SAAA,CAAW,CAAC,CACnE,OAASE,EAAG,CACV,QAAQ,KAAK,8CAA+CF,EAAGE,CAAC,CAClE,CAIJ,OAAOJ,EAAQ,OAAA,CACjB,CAEA,MAAMK,EAA0B,CAAC/C,EAAe,KAC9CgD,EAAAA,WAAW,UACT,KAAM,CAGJ,YAAYP,EAAkB,CAC5B,KAAK,YAAcD,EAAiBC,EAAMzC,CAAY,CACxD,CAEA,OAAOiD,EAAoB,EAEvBA,EAAO,YACPA,EAAO,iBACPA,EAAO,gBAEP,KAAK,YAAcT,EAAiBS,EAAO,KAAMjD,CAAY,EAEjE,CAAA,EAEF,CACE,YAAckD,GAAaA,EAAS,WAAA,CAExC,EAEIC,EAAoBJ,EAAA,EACbK,EAA4BL,EAAwB,EAAI"}
|
|
1
|
+
{"version":3,"file":"SyntaxHighlighter.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.ts"],"sourcesContent":["import {\n Decoration,\n DecorationSet,\n EditorView,\n ViewPlugin,\n ViewUpdate,\n} from \"@codemirror/view\";\nimport { RangeSetBuilder } from \"@codemirror/state\";\nimport { getMarkdownSourceAnalysis } from \"../../ContentRender/utils/inline-code-ranges\";\nimport { INTERACTION_CONTENT_SOURCE, isEscape } from \"remark-flow\";\n\nimport {\n findVariableMarkers,\n findDocumentVariableMarkers,\n trimVariablePadding,\n} from \"../utils\";\n\nconst commentRegex = /<!--[\\s\\S]*?-->/g;\n\n// An unfinished marker still owns its tail, so nested syntax stays literal while typing.\nconst interactionVariableRanges = (text: string) => {\n const markers = findVariableMarkers(text);\n const pending = text.indexOf(\"{{\", markers.at(-1)?.end ?? 0);\n return pending === -1\n ? markers\n : [...markers, { start: pending, end: text.length, name: null }];\n};\n// The grammar's own definition of where an interaction ends, so a `\\]` an option escaped does\n// not cut the highlight short, and the same `(?!\\()` the parser uses, so `?[text](url)` stays a\n// markdown link. Taken from remark-flow rather than written again here: the editor and the\n// parser have to agree about what they are looking at.\nconst controlBlockRegex = new RegExp(\n `\\\\?\\\\[(${INTERACTION_CONTENT_SOURCE})\\\\](?!\\\\()`,\n \"g\"\n);\n\nconst documentControlRanges = (text: string) =>\n getMarkdownSourceAnalysis(text).interactions;\n\nexport interface SyntaxHighlightRange {\n from: number;\n to: number;\n className: string;\n}\n\nfunction collectMultilineFixedOutputRanges(\n docText: string,\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let pendingStart: number | null = null;\n let lineStart = 0;\n\n while (lineStart <= docText.length) {\n const newlineIndex = docText.indexOf(\"\\n\", lineStart);\n const lineEnd = newlineIndex === -1 ? docText.length : newlineIndex;\n const lineText = docText.slice(lineStart, lineEnd);\n\n if (lineText.trim() === \"!===\" && !isInsideVariable(lineStart)) {\n if (pendingStart === null) {\n pendingStart = lineStart;\n } else {\n ranges.push({\n from: pendingStart,\n to: lineEnd,\n className: \"syntax-fixed\",\n });\n pendingStart = null;\n }\n }\n\n if (newlineIndex === -1) {\n break;\n }\n\n lineStart = newlineIndex + 1;\n }\n\n return ranges;\n}\n\nfunction collectSingleLineFixedOutputRanges(\n docText: string,\n commentRanges: SyntaxHighlightRange[],\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let commentIndex = 0;\n\n const isInsideComment = (index: number) => {\n while (\n commentIndex < commentRanges.length &&\n commentRanges[commentIndex].to <= index\n ) {\n commentIndex++;\n }\n\n const range = commentRanges[commentIndex];\n return !!range && index >= range.from && index < range.to;\n };\n\n let lineStart = 0;\n while (lineStart <= docText.length) {\n const newlineIndex = docText.indexOf(\"\\n\", lineStart);\n const lineEnd = newlineIndex === -1 ? docText.length : newlineIndex;\n const lineText = docText.slice(lineStart, lineEnd);\n const markerPositions: number[] = [];\n let searchFrom = 0;\n\n while (searchFrom < lineText.length) {\n const markerOffset = lineText.indexOf(\"===\", searchFrom);\n if (markerOffset === -1) {\n break;\n }\n\n const markerIndex = lineStart + markerOffset;\n const isNegated = markerIndex > 0 && docText[markerIndex - 1] === \"!\";\n if (\n !isNegated &&\n !isInsideComment(markerIndex) &&\n !isInsideVariable(markerIndex)\n ) {\n markerPositions.push(markerIndex);\n }\n\n searchFrom = markerOffset + 3;\n }\n\n for (let i = 0; i + 1 < markerPositions.length; i += 2) {\n ranges.push({\n from: markerPositions[i],\n to: markerPositions[i + 1] + 3,\n className: \"syntax-fixed\",\n });\n }\n\n if (newlineIndex === -1) {\n break;\n }\n\n lineStart = newlineIndex + 1;\n }\n\n return ranges;\n}\n\nfunction collectCommentRanges(\n docText: string,\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let match;\n\n commentRegex.lastIndex = 0;\n while ((match = commentRegex.exec(docText)) !== null) {\n if (isInsideVariable(match.index)) continue;\n ranges.push({\n from: match.index,\n to: match.index + match[0].length,\n className: \"syntax-comment\",\n });\n }\n\n return ranges;\n}\n\n/**\n * Collects non-overlapping fixed-output and comment wrapper ranges.\n *\n * @param docText - Document text to scan.\n * @returns Outer syntax highlight ranges sorted by document position.\n */\nexport function collectOuterBlockRanges(\n docText: string\n): SyntaxHighlightRange[] {\n const variables = findDocumentVariableMarkers(docText);\n const isInsideVariable = (position: number) =>\n variables.some(\n (marker) => position >= marker.start && position < marker.end\n );\n const commentRanges = collectCommentRanges(docText, isInsideVariable);\n const blockRanges = [\n ...collectMultilineFixedOutputRanges(docText, isInsideVariable),\n ...collectSingleLineFixedOutputRanges(\n docText,\n commentRanges,\n isInsideVariable\n ),\n ...commentRanges,\n ].sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return b.to - a.to;\n });\n\n const outerRanges: SyntaxHighlightRange[] = [];\n\n for (const range of blockRanges) {\n const lastOuter = outerRanges[outerRanges.length - 1];\n if (!lastOuter || range.from >= lastOuter.to) {\n outerRanges.push(range);\n }\n }\n\n return outerRanges;\n}\n\n/**\n * Collects all custom syntax highlight ranges for editor decorations.\n *\n * @param docText - Document text to scan.\n * @param isCursorInside - Returns true when the current cursor is inside a range.\n * @returns Non-overlapping syntax highlight ranges sorted by document position.\n */\nexport function collectSyntaxHighlightRanges(\n docText: string,\n isCursorInside: (from: number, to: number) => boolean = () => false\n): SyntaxHighlightRange[] {\n const matches: SyntaxHighlightRange[] = [];\n const documentVariables = findDocumentVariableMarkers(docText);\n const occupied: { from: number; to: number }[] = [];\n\n controlBlockRegex.lastIndex = 0;\n\n // Prevent overlapping decorations so styling stays deterministic\n const isOverlapping = (from: number, to: number) =>\n occupied.some((range) => !(to <= range.from || from >= range.to));\n\n const addMatch = (from: number, to: number, className: string) => {\n if (from >= to) return false;\n if (isOverlapping(from, to)) return false;\n occupied.push({ from, to });\n matches.push({ from, to, className });\n return true;\n };\n\n // 1. Outer block ranges win over any syntax inside them.\n for (const range of collectOuterBlockRanges(docText)) {\n addMatch(range.from, range.to, range.className);\n }\n\n // 2. Control Blocks\n for (const control of documentControlRanges(docText)) {\n // Native Markdown owns document boundaries. The shared token grammar still\n // supplies the exact source offsets used for individual editor decorations.\n controlBlockRegex.lastIndex = control.start;\n const match = controlBlockRegex.exec(docText);\n if (\n !match ||\n match.index !== control.start ||\n match.index + match[0].length !== control.end\n )\n continue;\n const fullStart = match.index;\n const fullEnd = match.index + match[0].length;\n const content = match[1];\n const contentStart = fullStart + 2; // after ?[\n if (\n isOverlapping(fullStart, fullEnd) ||\n documentVariables.some(\n (marker) => marker.start <= fullStart && fullStart < marker.end\n )\n ) {\n continue;\n }\n\n // Outer brackets and question mark\n addMatch(fullStart, fullStart + 1, \"syntax-keyword\"); // ?\n addMatch(fullStart + 1, fullStart + 2, \"syntax-bracket\"); // [\n addMatch(fullEnd - 1, fullEnd, \"syntax-bracket\"); // ]\n\n const variables = interactionVariableRanges(content);\n const firstVariable = variables[0];\n const percentIndex = firstVariable ? firstVariable.start - 1 : -1;\n const hasLeadingAssignment =\n percentIndex >= 0 &&\n content[percentIndex] === \"%\" &&\n trimVariablePadding(content.slice(0, percentIndex)) === \"\";\n if (content.startsWith(\"%\") || hasLeadingAssignment) {\n // Input / Select\n let percentClass = \"syntax-percent-invalid\";\n if (firstVariable && hasLeadingAssignment) {\n const varFrom = contentStart + firstVariable.start;\n const varTo = contentStart + firstVariable.end;\n const cursorInsideVar = isCursorInside(varFrom, varTo);\n percentClass =\n firstVariable.name !== null && !cursorInsideVar\n ? \"syntax-percent-valid\"\n : \"syntax-percent-invalid\";\n }\n const percentStart =\n contentStart + (hasLeadingAssignment ? percentIndex : 0);\n addMatch(percentStart, percentStart + 1, percentClass); // %\n\n const operatorRanges: { from: number; to: number }[] = [];\n const variableRanges: { from: number; to: number; className: string }[] =\n [];\n const appliedTokenRanges: { from: number; to: number }[] = [];\n\n // Keep a variable name atomic even when it contains option punctuation.\n for (const variable of variables) {\n variableRanges.push({\n from: contentStart + variable.start,\n to: contentStart + variable.end,\n className:\n variable.name === null\n ? \"syntax-variable-invalid\"\n : \"syntax-variable\",\n });\n }\n\n // Inner operators | || ... -- skipping any an option escaped, the way the parser does.\n // Painted as separators, they told the author the grammar had split an option that it\n // had in fact left whole.\n let scanIndex = 0;\n while (scanIndex < content.length) {\n const variable = variableRanges.find(\n (range) => contentStart + scanIndex === range.from\n );\n if (variable) {\n scanIndex = variable.to - contentStart;\n continue;\n }\n if (isEscape(content, scanIndex)) {\n scanIndex += 2;\n continue;\n }\n const operator = content.startsWith(\"||\", scanIndex)\n ? \"||\"\n : content[scanIndex] === \"|\"\n ? \"|\"\n : content.startsWith(\"...\", scanIndex)\n ? \"...\"\n : null;\n if (!operator) {\n scanIndex += 1;\n continue;\n }\n operatorRanges.push({\n from: contentStart + scanIndex,\n to: contentStart + scanIndex + operator.length,\n });\n scanIndex += operator.length;\n }\n\n const allTokens = [\n ...operatorRanges.map((range) => ({\n ...range,\n className: \"syntax-keyword\",\n })),\n ...variableRanges.map((range) => ({\n ...range,\n className: range.className,\n })),\n ].sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const token of allTokens) {\n if (\n token.className.startsWith(\"syntax-variable\") &&\n isCursorInside(token.from, token.to)\n ) {\n continue;\n }\n if (addMatch(token.from, token.to, token.className)) {\n appliedTokenRanges.push({ from: token.from, to: token.to });\n }\n }\n\n // Content (Dark Blue) for remaining text segments\n const stringStart = percentStart + 1;\n const stringEnd = fullEnd - 1;\n let cursor = stringStart;\n const sortedApplied = appliedTokenRanges.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const token of sortedApplied) {\n if (cursor < token.from) {\n addMatch(cursor, token.from, \"syntax-string\");\n }\n cursor = Math.max(cursor, token.to);\n }\n if (cursor < stringEnd) {\n addMatch(cursor, stringEnd, \"syntax-string\");\n }\n } else {\n // Button ?[text]\n const variableRanges: { from: number; to: number; className: string }[] =\n [];\n const appliedVariableRanges: { from: number; to: number }[] = [];\n\n for (const variable of interactionVariableRanges(content)) {\n variableRanges.push({\n from: contentStart + variable.start,\n to: contentStart + variable.end,\n className:\n variable.name === null\n ? \"syntax-variable-invalid\"\n : \"syntax-variable\",\n });\n }\n\n const sortedVariables = variableRanges.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const variable of sortedVariables) {\n if (\n variable.className.startsWith(\"syntax-variable\") &&\n isCursorInside(variable.from, variable.to)\n ) {\n continue;\n }\n if (addMatch(variable.from, variable.to, variable.className)) {\n appliedVariableRanges.push({ from: variable.from, to: variable.to });\n }\n }\n\n const buttonTextStart = contentStart;\n const buttonTextEnd = fullEnd - 1;\n let cursor = buttonTextStart;\n\n for (const variable of appliedVariableRanges) {\n if (cursor < variable.from) {\n addMatch(cursor, variable.from, \"syntax-button-text\");\n }\n cursor = Math.max(cursor, variable.to);\n }\n if (cursor < buttonTextEnd) {\n addMatch(cursor, buttonTextEnd, \"syntax-button-text\");\n }\n }\n }\n\n // 3. Variables (only if not already decorated; invalid ones stay default outside control blocks)\n for (const variable of documentVariables) {\n if (\n variable.name !== null &&\n !isCursorInside(variable.start, variable.end)\n ) {\n addMatch(variable.start, variable.end, \"syntax-variable\");\n }\n }\n\n // Sort matches by 'from' asc, then 'to' desc (longest first)\n matches.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return b.to - a.to;\n });\n\n return matches;\n}\n\nfunction buildDecorations(view: EditorView): DecorationSet {\n const builder = new RangeSetBuilder<Decoration>();\n const docText = view.state.doc.toString();\n const matches = collectSyntaxHighlightRanges(docText, (from, to) => {\n return view.state.selection.ranges.some((range) => {\n return range.from >= from && range.to <= to;\n });\n });\n\n for (const m of matches) {\n if (m.from < m.to) {\n try {\n builder.add(m.from, m.to, Decoration.mark({ class: m.className }));\n } catch (e) {\n console.warn(\"SyntaxHighlighter: Failed to add decoration\", m, e);\n }\n }\n }\n\n return builder.finish();\n}\n\nconst SyntaxHighlighter = ViewPlugin.fromClass(\n class {\n decorations: DecorationSet;\n\n constructor(view: EditorView) {\n this.decorations = buildDecorations(view);\n }\n\n update(update: ViewUpdate) {\n if (update.docChanged || update.viewportChanged || update.selectionSet) {\n this.decorations = buildDecorations(update.view);\n }\n }\n },\n {\n decorations: (instance) => instance.decorations,\n }\n);\n\nexport default SyntaxHighlighter;\n"],"names":["commentRegex","interactionVariableRanges","text","markers","findVariableMarkers","pending","controlBlockRegex","INTERACTION_CONTENT_SOURCE","documentControlRanges","getMarkdownSourceAnalysis","collectMultilineFixedOutputRanges","docText","isInsideVariable","ranges","pendingStart","lineStart","newlineIndex","lineEnd","collectSingleLineFixedOutputRanges","commentRanges","commentIndex","isInsideComment","index","range","lineText","markerPositions","searchFrom","markerOffset","markerIndex","i","collectCommentRanges","match","collectOuterBlockRanges","variables","findDocumentVariableMarkers","position","marker","blockRanges","a","b","outerRanges","lastOuter","collectSyntaxHighlightRanges","isCursorInside","matches","documentVariables","occupied","isOverlapping","from","to","addMatch","className","control","fullStart","fullEnd","content","contentStart","firstVariable","percentIndex","hasLeadingAssignment","trimVariablePadding","percentClass","varFrom","varTo","cursorInsideVar","percentStart","operatorRanges","variableRanges","appliedTokenRanges","variable","scanIndex","isEscape","operator","allTokens","token","stringStart","stringEnd","cursor","sortedApplied","appliedVariableRanges","sortedVariables","buttonTextStart","buttonTextEnd","buildDecorations","view","builder","RangeSetBuilder","m","Decoration","e","SyntaxHighlighter","ViewPlugin","update","instance"],"mappings":"gWAiBMA,EAAe,mBAGfC,EAA6BC,GAAiB,CAClD,MAAMC,EAAUC,EAAAA,YAAAA,oBAAoBF,CAAI,EAClCG,EAAUH,EAAK,QAAQ,KAAMC,EAAQ,GAAG,EAAE,GAAG,KAAO,CAAC,EAC3D,OAAOE,IAAY,GACfF,EACA,CAAC,GAAGA,EAAS,CAAE,MAAOE,EAAS,IAAKH,EAAK,OAAQ,KAAM,KAAM,CACnE,EAKMI,EAAoB,IAAI,OAC5B,UAAUC,EAAAA,YAAAA,0BAA0B,cACpC,GACF,EAEMC,EAAyBN,GAC7BO,4BAA0BP,CAAI,EAAE,aAQlC,SAASQ,EACPC,EACAC,EACwB,CACxB,MAAMC,EAAiC,CAAA,EACvC,IAAIC,EAA8B,KAC9BC,EAAY,EAEhB,KAAOA,GAAaJ,EAAQ,QAAQ,CAClC,MAAMK,EAAeL,EAAQ,QAAQ;AAAA,EAAMI,CAAS,EAC9CE,EAAUD,IAAiB,GAAKL,EAAQ,OAASK,EAgBvD,GAfiBL,EAAQ,MAAMI,EAAWE,CAAO,EAEpC,KAAA,IAAW,QAAU,CAACL,EAAiBG,CAAS,IACvDD,IAAiB,KACnBA,EAAeC,GAEfF,EAAO,KAAK,CACV,KAAMC,EACN,GAAIG,EACJ,UAAW,cAAA,CACZ,EACDH,EAAe,OAIfE,IAAiB,GACnB,MAGFD,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E,EAEnCQ,EAASK,GACXhC,EAAS2B,EAAQK,EAAe,oBAAoB,CAExD,CACF,CAGA,UAAWb,KAAYxB,EAEnBwB,EAAS,OAAS,MAClB,CAAC1B,EAAe0B,EAAS,MAAOA,EAAS,GAAG,GAE5CnB,EAASmB,EAAS,MAAOA,EAAS,IAAK,iBAAiB,EAK5D,OAAAzB,EAAQ,KAAK,CAACN,EAAGC,IACXD,EAAE,OAASC,EAAE,KAAaD,EAAE,KAAOC,EAAE,KAClCA,EAAE,GAAKD,EAAE,EACjB,EAEMM,CACT,CAEA,SAASuC,EAAiBC,EAAiC,CACzD,MAAMC,EAAU,IAAIC,kBACd3E,EAAUyE,EAAK,MAAM,IAAI,SAAA,EACzBxC,EAAUF,EAA6B/B,EAAS,CAACqC,EAAMC,IACpDmC,EAAK,MAAM,UAAU,OAAO,KAAM7D,GAChCA,EAAM,MAAQyB,GAAQzB,EAAM,IAAM0B,CAC1C,CACF,EAED,UAAWsC,KAAK3C,EACd,GAAI2C,EAAE,KAAOA,EAAE,GACb,GAAI,CACFF,EAAQ,IAAIE,EAAE,KAAMA,EAAE,GAAIC,aAAW,KAAK,CAAE,MAAOD,EAAE,SAAA,CAAW,CAAC,CACnE,OAASE,EAAG,CACV,QAAQ,KAAK,8CAA+CF,EAAGE,CAAC,CAClE,CAIJ,OAAOJ,EAAQ,OAAA,CACjB,CAEA,MAAMK,EAAoBC,EAAAA,WAAW,UACnC,KAAM,CAGJ,YAAYP,EAAkB,CAC5B,KAAK,YAAcD,EAAiBC,CAAI,CAC1C,CAEA,OAAOQ,EAAoB,EACrBA,EAAO,YAAcA,EAAO,iBAAmBA,EAAO,gBACxD,KAAK,YAAcT,EAAiBS,EAAO,IAAI,EAEnD,CAAA,EAEF,CACE,YAAcC,GAAaA,EAAS,WAAA,CAExC"}
|
|
@@ -18,13 +18,9 @@ export declare function collectOuterBlockRanges(docText: string): SyntaxHighligh
|
|
|
18
18
|
* @param isCursorInside - Returns true when the current cursor is inside a range.
|
|
19
19
|
* @returns Non-overlapping syntax highlight ranges sorted by document position.
|
|
20
20
|
*/
|
|
21
|
-
export declare function collectSyntaxHighlightRanges(docText: string, isCursorInside?: (from: number, to: number) => boolean
|
|
21
|
+
export declare function collectSyntaxHighlightRanges(docText: string, isCursorInside?: (from: number, to: number) => boolean): SyntaxHighlightRange[];
|
|
22
22
|
declare const SyntaxHighlighter: ViewPlugin<{
|
|
23
23
|
decorations: DecorationSet;
|
|
24
24
|
update(update: ViewUpdate): void;
|
|
25
25
|
}, undefined>;
|
|
26
|
-
export declare const QuestionSyntaxHighlighter: ViewPlugin<{
|
|
27
|
-
decorations: DecorationSet;
|
|
28
|
-
update(update: ViewUpdate): void;
|
|
29
|
-
}, undefined>;
|
|
30
26
|
export default SyntaxHighlighter;
|
|
@@ -1,220 +1,215 @@
|
|
|
1
|
-
import { ViewPlugin as
|
|
2
|
-
import { RangeSetBuilder as
|
|
3
|
-
import { getMarkdownSourceAnalysis as
|
|
1
|
+
import { ViewPlugin as B, Decoration as H } from "../../../node_modules/@codemirror/view/dist/index.es.js";
|
|
2
|
+
import { RangeSetBuilder as P } from "../../../node_modules/@codemirror/state/dist/index.es.js";
|
|
3
|
+
import { getMarkdownSourceAnalysis as L } from "../../ContentRender/utils/inline-code-ranges.es.js";
|
|
4
4
|
import { d as N } from "../../../_virtual/index.es.js";
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
return f === -1 ?
|
|
5
|
+
const F = /<!--[\s\S]*?-->/g, W = (n) => {
|
|
6
|
+
const i = N.findVariableMarkers(n), f = n.indexOf("{{", i.at(-1)?.end ?? 0);
|
|
7
|
+
return f === -1 ? i : [...i, { start: f, end: n.length, name: null }];
|
|
8
8
|
}, M = new RegExp(
|
|
9
9
|
`\\?\\[(${N.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,
|
|
10
10
|
"g"
|
|
11
|
-
),
|
|
12
|
-
function
|
|
11
|
+
), _ = (n) => L(n).interactions;
|
|
12
|
+
function U(n, i) {
|
|
13
13
|
const f = [];
|
|
14
|
-
let
|
|
15
|
-
for (;
|
|
16
|
-
const
|
|
17
|
-
`,
|
|
18
|
-
if (n.slice(
|
|
19
|
-
from:
|
|
20
|
-
to:
|
|
14
|
+
let l = null, s = 0;
|
|
15
|
+
for (; s <= n.length; ) {
|
|
16
|
+
const u = n.indexOf(`
|
|
17
|
+
`, s), e = u === -1 ? n.length : u;
|
|
18
|
+
if (n.slice(s, e).trim() === "!===" && !i(s) && (l === null ? l = s : (f.push({
|
|
19
|
+
from: l,
|
|
20
|
+
to: e,
|
|
21
21
|
className: "syntax-fixed"
|
|
22
|
-
}),
|
|
22
|
+
}), l = null)), u === -1)
|
|
23
23
|
break;
|
|
24
|
-
|
|
24
|
+
s = u + 1;
|
|
25
25
|
}
|
|
26
26
|
return f;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
const
|
|
32
|
-
for (;
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
return !!
|
|
28
|
+
function $(n, i, f) {
|
|
29
|
+
const l = [];
|
|
30
|
+
let s = 0;
|
|
31
|
+
const u = (t) => {
|
|
32
|
+
for (; s < i.length && i[s].to <= t; )
|
|
33
|
+
s++;
|
|
34
|
+
const r = i[s];
|
|
35
|
+
return !!r && t >= r.from && t < r.to;
|
|
36
36
|
};
|
|
37
|
-
let
|
|
38
|
-
for (;
|
|
37
|
+
let e = 0;
|
|
38
|
+
for (; e <= n.length; ) {
|
|
39
39
|
const t = n.indexOf(`
|
|
40
|
-
`,
|
|
41
|
-
let
|
|
42
|
-
for (;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
40
|
+
`, e), r = t === -1 ? n.length : t, d = n.slice(e, r), x = [];
|
|
41
|
+
let g = 0;
|
|
42
|
+
for (; g < d.length; ) {
|
|
43
|
+
const c = d.indexOf("===", g);
|
|
44
|
+
if (c === -1)
|
|
45
45
|
break;
|
|
46
|
-
const
|
|
47
|
-
!(
|
|
46
|
+
const p = e + c;
|
|
47
|
+
!(p > 0 && n[p - 1] === "!") && !u(p) && !f(p) && x.push(p), g = c + 3;
|
|
48
48
|
}
|
|
49
|
-
for (let
|
|
50
|
-
|
|
51
|
-
from:
|
|
52
|
-
to:
|
|
49
|
+
for (let c = 0; c + 1 < x.length; c += 2)
|
|
50
|
+
l.push({
|
|
51
|
+
from: x[c],
|
|
52
|
+
to: x[c + 1] + 3,
|
|
53
53
|
className: "syntax-fixed"
|
|
54
54
|
});
|
|
55
55
|
if (t === -1)
|
|
56
56
|
break;
|
|
57
|
-
|
|
57
|
+
e = t + 1;
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return l;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function j(n, i) {
|
|
62
62
|
const f = [];
|
|
63
|
-
let
|
|
64
|
-
for (
|
|
65
|
-
|
|
66
|
-
from:
|
|
67
|
-
to:
|
|
63
|
+
let l;
|
|
64
|
+
for (F.lastIndex = 0; (l = F.exec(n)) !== null; )
|
|
65
|
+
i(l.index) || f.push({
|
|
66
|
+
from: l.index,
|
|
67
|
+
to: l.index + l[0].length,
|
|
68
68
|
className: "syntax-comment"
|
|
69
69
|
});
|
|
70
70
|
return f;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const
|
|
74
|
-
(t) =>
|
|
75
|
-
),
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
function q(n) {
|
|
73
|
+
const i = N.findDocumentVariableMarkers(n), f = (e) => i.some(
|
|
74
|
+
(t) => e >= t.start && e < t.end
|
|
75
|
+
), l = j(n, f), s = [
|
|
76
|
+
...U(n, f),
|
|
77
|
+
...$(
|
|
78
78
|
n,
|
|
79
|
-
|
|
79
|
+
l,
|
|
80
80
|
f
|
|
81
81
|
),
|
|
82
|
-
...
|
|
83
|
-
].sort((
|
|
84
|
-
for (const
|
|
85
|
-
const t =
|
|
86
|
-
(!t ||
|
|
82
|
+
...l
|
|
83
|
+
].sort((e, t) => e.from !== t.from ? e.from - t.from : t.to - e.to), u = [];
|
|
84
|
+
for (const e of s) {
|
|
85
|
+
const t = u[u.length - 1];
|
|
86
|
+
(!t || e.from >= t.to) && u.push(e);
|
|
87
87
|
}
|
|
88
|
-
return
|
|
88
|
+
return u;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
90
|
+
function z(n, i = () => !1) {
|
|
91
|
+
const f = [], l = N.findDocumentVariableMarkers(n), s = [];
|
|
92
92
|
M.lastIndex = 0;
|
|
93
|
-
const
|
|
94
|
-
for (const
|
|
95
|
-
t
|
|
96
|
-
for (const
|
|
97
|
-
M.lastIndex =
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
93
|
+
const u = (t, r) => s.some((d) => !(r <= d.from || t >= d.to)), e = (t, r, d) => t >= r || u(t, r) ? !1 : (s.push({ from: t, to: r }), f.push({ from: t, to: r, className: d }), !0);
|
|
94
|
+
for (const t of q(n))
|
|
95
|
+
e(t.from, t.to, t.className);
|
|
96
|
+
for (const t of _(n)) {
|
|
97
|
+
M.lastIndex = t.start;
|
|
98
|
+
const r = M.exec(n);
|
|
99
|
+
if (!r || r.index !== t.start || r.index + r[0].length !== t.end)
|
|
100
100
|
continue;
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
(
|
|
101
|
+
const d = r.index, x = r.index + r[0].length, g = r[1], c = d + 2;
|
|
102
|
+
if (u(d, x) || l.some(
|
|
103
|
+
(b) => b.start <= d && d < b.end
|
|
104
104
|
))
|
|
105
105
|
continue;
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
let
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
112
|
-
|
|
106
|
+
e(d, d + 1, "syntax-keyword"), e(d + 1, d + 2, "syntax-bracket"), e(x - 1, x, "syntax-bracket");
|
|
107
|
+
const p = W(g), y = p[0], O = y ? y.start - 1 : -1, E = O >= 0 && g[O] === "%" && N.trimVariablePadding(g.slice(0, O)) === "";
|
|
108
|
+
if (g.startsWith("%") || E) {
|
|
109
|
+
let b = "syntax-percent-invalid";
|
|
110
|
+
if (y && E) {
|
|
111
|
+
const o = c + y.start, h = c + y.end, I = i(o, h);
|
|
112
|
+
b = y.name !== null && !I ? "syntax-percent-valid" : "syntax-percent-invalid";
|
|
113
113
|
}
|
|
114
|
-
const v =
|
|
115
|
-
|
|
116
|
-
const V = [],
|
|
117
|
-
for (const
|
|
118
|
-
|
|
119
|
-
from:
|
|
120
|
-
to:
|
|
121
|
-
className:
|
|
114
|
+
const v = c + (E ? O : 0);
|
|
115
|
+
e(v, v + 1, b);
|
|
116
|
+
const V = [], R = [], S = [];
|
|
117
|
+
for (const o of p)
|
|
118
|
+
R.push({
|
|
119
|
+
from: c + o.start,
|
|
120
|
+
to: c + o.end,
|
|
121
|
+
className: o.name === null ? "syntax-variable-invalid" : "syntax-variable"
|
|
122
122
|
});
|
|
123
|
-
let
|
|
124
|
-
for (;
|
|
125
|
-
const
|
|
126
|
-
(
|
|
123
|
+
let m = 0;
|
|
124
|
+
for (; m < g.length; ) {
|
|
125
|
+
const o = R.find(
|
|
126
|
+
(I) => c + m === I.from
|
|
127
127
|
);
|
|
128
|
-
if (
|
|
129
|
-
|
|
128
|
+
if (o) {
|
|
129
|
+
m = o.to - c;
|
|
130
130
|
continue;
|
|
131
131
|
}
|
|
132
|
-
if (N.isEscape(
|
|
133
|
-
|
|
132
|
+
if (N.isEscape(g, m)) {
|
|
133
|
+
m += 2;
|
|
134
134
|
continue;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
if (!
|
|
138
|
-
|
|
136
|
+
const h = g.startsWith("||", m) ? "||" : g[m] === "|" ? "|" : g.startsWith("...", m) ? "..." : null;
|
|
137
|
+
if (!h) {
|
|
138
|
+
m += 1;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
141
|
V.push({
|
|
142
|
-
from:
|
|
143
|
-
to:
|
|
144
|
-
}),
|
|
142
|
+
from: c + m,
|
|
143
|
+
to: c + m + h.length
|
|
144
|
+
}), m += h.length;
|
|
145
145
|
}
|
|
146
|
-
const
|
|
147
|
-
...V.map((
|
|
148
|
-
...
|
|
146
|
+
const a = [
|
|
147
|
+
...V.map((o) => ({
|
|
148
|
+
...o,
|
|
149
149
|
className: "syntax-keyword"
|
|
150
150
|
})),
|
|
151
|
-
...
|
|
152
|
-
...
|
|
153
|
-
className:
|
|
151
|
+
...R.map((o) => ({
|
|
152
|
+
...o,
|
|
153
|
+
className: o.className
|
|
154
154
|
}))
|
|
155
|
-
].sort((
|
|
156
|
-
for (const
|
|
157
|
-
|
|
158
|
-
const w = v + 1,
|
|
155
|
+
].sort((o, h) => o.from !== h.from ? o.from - h.from : o.to - h.to);
|
|
156
|
+
for (const o of a)
|
|
157
|
+
o.className.startsWith("syntax-variable") && i(o.from, o.to) || e(o.from, o.to, o.className) && S.push({ from: o.from, to: o.to });
|
|
158
|
+
const w = v + 1, C = x - 1;
|
|
159
159
|
let k = w;
|
|
160
|
-
const
|
|
161
|
-
for (const
|
|
162
|
-
k <
|
|
163
|
-
k <
|
|
160
|
+
const D = S.sort((o, h) => o.from !== h.from ? o.from - h.from : o.to - h.to);
|
|
161
|
+
for (const o of D)
|
|
162
|
+
k < o.from && e(k, o.from, "syntax-string"), k = Math.max(k, o.to);
|
|
163
|
+
k < C && e(k, C, "syntax-string");
|
|
164
164
|
} else {
|
|
165
|
-
const
|
|
166
|
-
for (const
|
|
167
|
-
|
|
168
|
-
from:
|
|
169
|
-
to:
|
|
170
|
-
className:
|
|
165
|
+
const b = [], v = [];
|
|
166
|
+
for (const a of W(g))
|
|
167
|
+
b.push({
|
|
168
|
+
from: c + a.start,
|
|
169
|
+
to: c + a.end,
|
|
170
|
+
className: a.name === null ? "syntax-variable-invalid" : "syntax-variable"
|
|
171
171
|
});
|
|
172
|
-
const V =
|
|
173
|
-
for (const
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
let
|
|
177
|
-
for (const
|
|
178
|
-
|
|
179
|
-
|
|
172
|
+
const V = b.sort((a, w) => a.from !== w.from ? a.from - w.from : a.to - w.to);
|
|
173
|
+
for (const a of V)
|
|
174
|
+
a.className.startsWith("syntax-variable") && i(a.from, a.to) || e(a.from, a.to, a.className) && v.push({ from: a.from, to: a.to });
|
|
175
|
+
const R = c, S = x - 1;
|
|
176
|
+
let m = R;
|
|
177
|
+
for (const a of v)
|
|
178
|
+
m < a.from && e(m, a.from, "syntax-button-text"), m = Math.max(m, a.to);
|
|
179
|
+
m < S && e(m, S, "syntax-button-text");
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
for (const
|
|
183
|
-
|
|
184
|
-
return
|
|
182
|
+
for (const t of l)
|
|
183
|
+
t.name !== null && !i(t.start, t.end) && e(t.start, t.end, "syntax-variable");
|
|
184
|
+
return f.sort((t, r) => t.from !== r.from ? t.from - r.from : r.to - t.to), f;
|
|
185
185
|
}
|
|
186
|
-
function A(n
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
s
|
|
191
|
-
);
|
|
192
|
-
for (const a of d)
|
|
193
|
-
if (a.from < a.to)
|
|
186
|
+
function A(n) {
|
|
187
|
+
const i = new P(), f = n.state.doc.toString(), l = z(f, (s, u) => n.state.selection.ranges.some((e) => e.from >= s && e.to <= u));
|
|
188
|
+
for (const s of l)
|
|
189
|
+
if (s.from < s.to)
|
|
194
190
|
try {
|
|
195
|
-
|
|
196
|
-
} catch (
|
|
197
|
-
console.warn("SyntaxHighlighter: Failed to add decoration",
|
|
191
|
+
i.add(s.from, s.to, H.mark({ class: s.className }));
|
|
192
|
+
} catch (u) {
|
|
193
|
+
console.warn("SyntaxHighlighter: Failed to add decoration", s, u);
|
|
198
194
|
}
|
|
199
|
-
return
|
|
195
|
+
return i.finish();
|
|
200
196
|
}
|
|
201
|
-
const
|
|
197
|
+
const T = B.fromClass(
|
|
202
198
|
class {
|
|
203
|
-
constructor(
|
|
204
|
-
this.decorations = A(
|
|
199
|
+
constructor(n) {
|
|
200
|
+
this.decorations = A(n);
|
|
205
201
|
}
|
|
206
|
-
update(
|
|
207
|
-
(
|
|
202
|
+
update(n) {
|
|
203
|
+
(n.docChanged || n.viewportChanged || n.selectionSet) && (this.decorations = A(n.view));
|
|
208
204
|
}
|
|
209
205
|
},
|
|
210
206
|
{
|
|
211
|
-
decorations: (
|
|
207
|
+
decorations: (n) => n.decorations
|
|
212
208
|
}
|
|
213
|
-
)
|
|
209
|
+
);
|
|
214
210
|
export {
|
|
215
|
-
q as
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
Z as default
|
|
211
|
+
q as collectOuterBlockRanges,
|
|
212
|
+
z as collectSyntaxHighlightRanges,
|
|
213
|
+
T as default
|
|
219
214
|
};
|
|
220
215
|
//# sourceMappingURL=SyntaxHighlighter.es.js.map
|