markdown-flow-ui 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index8.cjs +1 -1
- package/dist/_virtual/index8.es.js +2 -2
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/_virtual/index9.es.js +2 -2
- package/dist/assets/markdown-flow-ui.css +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 +2 -0
- package/dist/components/ContentRender/ContentRender.es.js +513 -509
- package/dist/components/ContentRender/ContentRender.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 +2 -0
- package/dist/components/ContentRender/MarkdownFlowInput.es.js +40 -38
- package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
- 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 +2 -1
- package/dist/components/ContentRender/plugins/CustomVariable.es.js +110 -90
- package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
- package/dist/components/ContentRender/utils/accept-placeholder.cjs +2 -0
- package/dist/components/ContentRender/utils/accept-placeholder.cjs.map +1 -0
- package/dist/components/ContentRender/utils/accept-placeholder.d.ts +3 -0
- package/dist/components/ContentRender/utils/accept-placeholder.es.js +10 -0
- package/dist/components/ContentRender/utils/accept-placeholder.es.js.map +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 +2 -0
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js +23 -21
- package/dist/components/MarkdownFlow/MarkdownFlow.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.es.js +145 -143
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.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 +2 -0
- package/dist/components/Slide/Slide.es.js +348 -344
- package/dist/components/Slide/Slide.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-arrow/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.es.js.map +1 -0
- 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 +92 -89
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/{react-tooltip/node_modules/@radix-ui/react-popper → react-popper}/dist/index.es.js +5 -5
- package/dist/node_modules/@radix-ui/react-popper/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 +50 -47
- 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 +9 -9
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +10 -7
- package/dist/node_modules/@radix-ui/react-use-callback-ref/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 +1 -1
- package/dist/node_modules/classnames/index.cjs +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/i18next/dist/esm/i18next.cjs +1 -1
- package/dist/node_modules/i18next/dist/esm/i18next.cjs.map +1 -1
- package/dist/node_modules/i18next/dist/esm/i18next.es.js +809 -900
- package/dist/node_modules/i18next/dist/esm/i18next.es.js.map +1 -1
- package/dist/node_modules/katex/dist/katex.cjs +14 -14
- package/dist/node_modules/katex/dist/katex.cjs.map +1 -1
- package/dist/node_modules/katex/dist/katex.es.js +1302 -1192
- package/dist/node_modules/katex/dist/katex.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/Icon.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/Icon.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/Icon.es.js +52 -29
- package/dist/node_modules/lucide-react/dist/esm/Icon.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/context.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/context.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/context.es.js +6 -0
- package/dist/node_modules/lucide-react/dist/esm/context.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.es.js +13 -16
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.es.js +16 -10
- package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/captions.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/captions.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/captions.es.js +13 -6
- package/dist/node_modules/lucide-react/dist/esm/icons/captions.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/check.es.js +8 -2
- package/dist/node_modules/lucide-react/dist/esm/icons/check.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.es.js +10 -4
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js +12 -6
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.es.js +14 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/copy.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/copy.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/copy.es.js +11 -5
- package/dist/node_modules/lucide-react/dist/esm/icons/copy.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js +13 -6
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js +22 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/file-type.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/file-type.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/file-type.es.js +20 -8
- package/dist/node_modules/lucide-react/dist/esm/icons/file-type.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js +17 -11
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/image.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/image.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/image.es.js +14 -8
- package/dist/node_modules/lucide-react/dist/esm/icons/image.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js +11 -4
- package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/maximize.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/maximize.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/maximize.es.js +15 -9
- package/dist/node_modules/lucide-react/dist/esm/icons/maximize.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js +25 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.es.js +16 -10
- package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js +19 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js +19 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/square-check.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/square-check.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/square-check.es.js +14 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/square-check.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/square-play.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/square-play.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/square-play.es.js +19 -6
- package/dist/node_modules/lucide-react/dist/esm/icons/square-play.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.es.js +15 -9
- package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/upload.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/upload.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/upload.es.js +13 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/upload.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.es.js +19 -13
- package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/x.cjs +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/x.cjs.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/x.es.js +13 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/x.es.js.map +1 -1
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.es.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.es.js +44 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/{defaultAttributes.es.js → shared/src/build/defaultAttributes.es.js} +4 -4
- package/dist/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.es.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.es.js +5 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.es.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.es.js +5 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.es.js +15 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.es.js.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.es.js +9 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.es.js.map +1 -0
- package/dist/node_modules/micromark/lib/create-tokenizer.cjs +3 -3
- package/dist/node_modules/micromark/lib/create-tokenizer.cjs.map +1 -1
- package/dist/node_modules/micromark/lib/create-tokenizer.es.js +78 -76
- package/dist/node_modules/micromark/lib/create-tokenizer.es.js.map +1 -1
- package/dist/node_modules/micromark/lib/initialize/document.cjs +1 -1
- package/dist/node_modules/micromark/lib/initialize/document.cjs.map +1 -1
- package/dist/node_modules/micromark/lib/initialize/document.es.js +77 -75
- package/dist/node_modules/micromark/lib/initialize/document.es.js.map +1 -1
- package/dist/node_modules/micromark/lib/initialize/text.cjs +1 -1
- package/dist/node_modules/micromark/lib/initialize/text.cjs.map +1 -1
- package/dist/node_modules/micromark/lib/initialize/text.es.js +67 -64
- package/dist/node_modules/micromark/lib/initialize/text.es.js.map +1 -1
- package/dist/node_modules/micromark/lib/preprocess.cjs +1 -1
- package/dist/node_modules/micromark/lib/preprocess.cjs.map +1 -1
- package/dist/node_modules/micromark/lib/preprocess.es.js +19 -14
- package/dist/node_modules/micromark/lib/preprocess.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/attention.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/attention.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/attention.es.js +36 -32
- package/dist/node_modules/micromark-core-commonmark/lib/attention.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.es.js +49 -61
- package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/code-indented.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/code-indented.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/code-indented.es.js +21 -27
- package/dist/node_modules/micromark-core-commonmark/lib/code-indented.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.es.js +18 -14
- package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/html-flow.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/html-flow.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/html-flow.es.js +59 -71
- package/dist/node_modules/micromark-core-commonmark/lib/html-flow.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-end.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-end.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-end.es.js +87 -85
- package/dist/node_modules/micromark-core-commonmark/lib/label-end.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.es.js +11 -10
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.es.js +12 -11
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.es.js.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.cjs +2 -0
- package/dist/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.cjs.map +1 -0
- package/dist/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.es.js +18 -0
- package/dist/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.es.js.map +1 -0
- package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.cjs +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.cjs.map +1 -1
- package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.es.js +35 -33
- package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.es.js.map +1 -1
- package/dist/node_modules/micromark-extension-gfm-table/lib/edit-map.cjs +1 -1
- package/dist/node_modules/micromark-extension-gfm-table/lib/edit-map.cjs.map +1 -1
- package/dist/node_modules/micromark-extension-gfm-table/lib/edit-map.es.js +32 -28
- package/dist/node_modules/micromark-extension-gfm-table/lib/edit-map.es.js.map +1 -1
- package/dist/node_modules/micromark-extension-gfm-table/lib/syntax.cjs +1 -1
- package/dist/node_modules/micromark-extension-gfm-table/lib/syntax.cjs.map +1 -1
- package/dist/node_modules/micromark-extension-gfm-table/lib/syntax.es.js +18 -14
- package/dist/node_modules/micromark-extension-gfm-table/lib/syntax.es.js.map +1 -1
- package/dist/node_modules/micromark-factory-space/index.cjs +1 -1
- package/dist/node_modules/micromark-factory-space/index.cjs.map +1 -1
- package/dist/node_modules/micromark-factory-space/index.es.js +24 -10
- package/dist/node_modules/micromark-factory-space/index.es.js.map +1 -1
- package/dist/node_modules/micromark-util-edit-map/index.cjs +2 -0
- package/dist/node_modules/micromark-util-edit-map/index.cjs.map +1 -0
- package/dist/node_modules/micromark-util-edit-map/index.es.js +83 -0
- package/dist/node_modules/micromark-util-edit-map/index.es.js.map +1 -0
- package/package.json +24 -17
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive/dist/index.es.js +0 -50
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-arrow/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-arrow/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.es.js +0 -82
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +0 -216
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +0 -105
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.es.js +0 -18
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.es.js +0 -39
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js +0 -99
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +0 -16
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js +0 -70
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive/dist/index.es.js +0 -39
- package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot/dist/index.es.js +0 -99
- package/dist/node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot/dist/index.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs +0 -2
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs +0 -2
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.es.js +0 -19
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.es.js.map +0 -1
- /package/dist/node_modules/@radix-ui/{react-tooltip/node_modules/@radix-ui/react-arrow → react-arrow}/dist/index.cjs +0 -0
- /package/dist/node_modules/@radix-ui/{react-tooltip/node_modules/@radix-ui/react-arrow → react-arrow}/dist/index.es.js +0 -0
|
@@ -1,207 +1,209 @@
|
|
|
1
|
-
import { ViewPlugin as
|
|
2
|
-
import { RangeSetBuilder as
|
|
3
|
-
import { getMarkdownSourceAnalysis as
|
|
4
|
-
import { d as
|
|
5
|
-
import { findDocumentVariableMarkers as B, trimVariablePadding as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
return f === -1 ?
|
|
9
|
-
},
|
|
10
|
-
`\\?\\[(${
|
|
1
|
+
import { ViewPlugin as _, Decoration as U } from "../../../node_modules/@codemirror/view/dist/index.es.js";
|
|
2
|
+
import { RangeSetBuilder as $ } from "../../../node_modules/@codemirror/state/dist/index.es.js";
|
|
3
|
+
import { getMarkdownSourceAnalysis as j } from "../../ContentRender/utils/inline-code-ranges.es.js";
|
|
4
|
+
import { d as P } from "../../../_virtual/index.es.js";
|
|
5
|
+
import { findDocumentVariableMarkers as B, trimVariablePadding as M, findVariableMarkers as q } from "../utils.es.js";
|
|
6
|
+
const F = /<!--[\s\S]*?-->/g, W = (n) => {
|
|
7
|
+
const l = q(n), f = n.indexOf("{{", l.at(-1)?.end ?? 0);
|
|
8
|
+
return f === -1 ? l : [...l, { start: f, end: n.length, name: null }];
|
|
9
|
+
}, C = new RegExp(
|
|
10
|
+
`\\?\\[(${P.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,
|
|
11
11
|
"g"
|
|
12
|
-
),
|
|
13
|
-
function
|
|
12
|
+
), z = (n) => j(n).interactions;
|
|
13
|
+
function G(n, l) {
|
|
14
14
|
const f = [];
|
|
15
|
-
let
|
|
15
|
+
let c = null, s = 0;
|
|
16
16
|
for (; s <= n.length; ) {
|
|
17
|
-
const
|
|
18
|
-
`, s),
|
|
19
|
-
if (n.slice(s,
|
|
20
|
-
from:
|
|
21
|
-
to:
|
|
17
|
+
const m = n.indexOf(`
|
|
18
|
+
`, s), o = m === -1 ? n.length : m;
|
|
19
|
+
if (n.slice(s, o).trim() === "!===" && !l(s) && (c === null ? c = s : (f.push({
|
|
20
|
+
from: c,
|
|
21
|
+
to: o,
|
|
22
22
|
className: "syntax-fixed"
|
|
23
|
-
}),
|
|
23
|
+
}), c = null)), m === -1)
|
|
24
24
|
break;
|
|
25
|
-
s =
|
|
25
|
+
s = m + 1;
|
|
26
26
|
}
|
|
27
27
|
return f;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const
|
|
29
|
+
function J(n, l, f) {
|
|
30
|
+
const c = [];
|
|
31
31
|
let s = 0;
|
|
32
|
-
const
|
|
33
|
-
for (; s <
|
|
32
|
+
const m = (t) => {
|
|
33
|
+
for (; s < l.length && l[s].to <= t; )
|
|
34
34
|
s++;
|
|
35
|
-
const r =
|
|
35
|
+
const r = l[s];
|
|
36
36
|
return !!r && t >= r.from && t < r.to;
|
|
37
37
|
};
|
|
38
|
-
let
|
|
39
|
-
for (;
|
|
38
|
+
let o = 0;
|
|
39
|
+
for (; o <= n.length; ) {
|
|
40
40
|
const t = n.indexOf(`
|
|
41
|
-
`,
|
|
42
|
-
let
|
|
43
|
-
for (;
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
41
|
+
`, o), r = t === -1 ? n.length : t, u = n.slice(o, r), x = [];
|
|
42
|
+
let d = 0;
|
|
43
|
+
for (; d < u.length; ) {
|
|
44
|
+
const a = u.indexOf("===", d);
|
|
45
|
+
if (a === -1)
|
|
46
46
|
break;
|
|
47
|
-
const
|
|
48
|
-
!(
|
|
47
|
+
const y = o + a;
|
|
48
|
+
!(y > 0 && n[y - 1] === "!") && !m(y) && !f(y) && x.push(y), d = a + 3;
|
|
49
49
|
}
|
|
50
|
-
for (let
|
|
51
|
-
|
|
52
|
-
from: x[
|
|
53
|
-
to: x[
|
|
50
|
+
for (let a = 0; a + 1 < x.length; a += 2)
|
|
51
|
+
c.push({
|
|
52
|
+
from: x[a],
|
|
53
|
+
to: x[a + 1] + 3,
|
|
54
54
|
className: "syntax-fixed"
|
|
55
55
|
});
|
|
56
56
|
if (t === -1)
|
|
57
57
|
break;
|
|
58
|
-
|
|
58
|
+
o = t + 1;
|
|
59
59
|
}
|
|
60
|
-
return
|
|
60
|
+
return c;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function K(n, l) {
|
|
63
63
|
const f = [];
|
|
64
|
-
let
|
|
65
|
-
for (
|
|
66
|
-
|
|
67
|
-
from:
|
|
68
|
-
to:
|
|
64
|
+
let c;
|
|
65
|
+
for (F.lastIndex = 0; (c = F.exec(n)) !== null; )
|
|
66
|
+
l(c.index) || f.push({
|
|
67
|
+
from: c.index,
|
|
68
|
+
to: c.index + c[0].length,
|
|
69
69
|
className: "syntax-comment"
|
|
70
70
|
});
|
|
71
71
|
return f;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const
|
|
75
|
-
(t) =>
|
|
76
|
-
),
|
|
77
|
-
...
|
|
78
|
-
...
|
|
73
|
+
function Q(n) {
|
|
74
|
+
const l = B(n), f = (o) => l.some(
|
|
75
|
+
(t) => o >= t.start && o < t.end
|
|
76
|
+
), c = K(n, f), s = [
|
|
77
|
+
...G(n, f),
|
|
78
|
+
...J(
|
|
79
79
|
n,
|
|
80
|
-
|
|
80
|
+
c,
|
|
81
81
|
f
|
|
82
82
|
),
|
|
83
|
-
...
|
|
84
|
-
].sort((
|
|
85
|
-
for (const
|
|
86
|
-
const t =
|
|
87
|
-
(!t ||
|
|
83
|
+
...c
|
|
84
|
+
].sort((o, t) => o.from !== t.from ? o.from - t.from : t.to - o.to), m = [];
|
|
85
|
+
for (const o of s) {
|
|
86
|
+
const t = m[m.length - 1];
|
|
87
|
+
(!t || o.from >= t.to) && m.push(o);
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return m;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const f = [],
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
for (const t of
|
|
96
|
-
|
|
97
|
-
for (const t of
|
|
98
|
-
|
|
99
|
-
const r =
|
|
91
|
+
function T(n, l = () => !1) {
|
|
92
|
+
const f = [], c = B(n), s = [];
|
|
93
|
+
C.lastIndex = 0;
|
|
94
|
+
const m = (t, r) => s.some((u) => !(r <= u.from || t >= u.to)), o = (t, r, u) => t >= r || m(t, r) ? !1 : (s.push({ from: t, to: r }), f.push({ from: t, to: r, className: u }), !0);
|
|
95
|
+
for (const t of Q(n))
|
|
96
|
+
o(t.from, t.to, t.className);
|
|
97
|
+
for (const t of z(n)) {
|
|
98
|
+
C.lastIndex = t.start;
|
|
99
|
+
const r = C.exec(n);
|
|
100
100
|
if (!r || r.index !== t.start || r.index + r[0].length !== t.end)
|
|
101
101
|
continue;
|
|
102
|
-
const
|
|
103
|
-
if (u
|
|
104
|
-
(b) => b.start <=
|
|
102
|
+
const u = r.index, x = r.index + r[0].length, d = r[1], a = u + 2;
|
|
103
|
+
if (m(u, x) || c.some(
|
|
104
|
+
(b) => b.start <= u && u < b.end
|
|
105
105
|
))
|
|
106
106
|
continue;
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
o(u, u + 1, "syntax-keyword"), o(u + 1, u + 2, "syntax-bracket"), o(x - 1, x, "syntax-bracket");
|
|
108
|
+
const y = W(d), p = y[0], w = p ? p.start - 1 : -1, V = w >= 0 && d[w] === "%" && M(d.slice(0, w)) === "", D = p && M(d.slice(0, p.start)) === "", E = d.startsWith("%") || V;
|
|
109
|
+
if (E || D) {
|
|
110
|
+
const b = a + (V ? w : 0);
|
|
111
|
+
if (E) {
|
|
112
|
+
let e = "syntax-percent-invalid";
|
|
113
|
+
if (p && V) {
|
|
114
|
+
const h = a + p.start, I = a + p.end, L = l(h, I);
|
|
115
|
+
e = p.name !== null && !L ? "syntax-percent-valid" : "syntax-percent-invalid";
|
|
116
|
+
}
|
|
117
|
+
o(b, b + 1, e);
|
|
114
118
|
}
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
to: c + o.end,
|
|
122
|
-
className: o.name === null ? "syntax-variable-invalid" : "syntax-variable"
|
|
119
|
+
const R = [], S = [], O = [];
|
|
120
|
+
for (const e of y)
|
|
121
|
+
S.push({
|
|
122
|
+
from: a + e.start,
|
|
123
|
+
to: a + e.end,
|
|
124
|
+
className: e.name === null ? "syntax-variable-invalid" : "syntax-variable"
|
|
123
125
|
});
|
|
124
|
-
let
|
|
125
|
-
for (;
|
|
126
|
-
const
|
|
127
|
-
(I) =>
|
|
126
|
+
let g = 0;
|
|
127
|
+
for (; g < d.length; ) {
|
|
128
|
+
const e = S.find(
|
|
129
|
+
(I) => a + g === I.from
|
|
128
130
|
);
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
+
if (e) {
|
|
132
|
+
g = e.to - a;
|
|
131
133
|
continue;
|
|
132
134
|
}
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
+
if (P.isEscape(d, g)) {
|
|
136
|
+
g += 2;
|
|
135
137
|
continue;
|
|
136
138
|
}
|
|
137
|
-
const h =
|
|
139
|
+
const h = d.startsWith("||", g) ? "||" : d[g] === "|" ? "|" : d.startsWith("...", g) ? "..." : null;
|
|
138
140
|
if (!h) {
|
|
139
|
-
|
|
141
|
+
g += 1;
|
|
140
142
|
continue;
|
|
141
143
|
}
|
|
142
|
-
|
|
143
|
-
from:
|
|
144
|
-
to:
|
|
145
|
-
}),
|
|
144
|
+
R.push({
|
|
145
|
+
from: a + g,
|
|
146
|
+
to: a + g + h.length
|
|
147
|
+
}), g += h.length;
|
|
146
148
|
}
|
|
147
|
-
const
|
|
148
|
-
...
|
|
149
|
-
...
|
|
149
|
+
const v = [
|
|
150
|
+
...R.map((e) => ({
|
|
151
|
+
...e,
|
|
150
152
|
className: "syntax-keyword"
|
|
151
153
|
})),
|
|
152
|
-
...
|
|
153
|
-
...
|
|
154
|
-
className:
|
|
154
|
+
...S.map((e) => ({
|
|
155
|
+
...e,
|
|
156
|
+
className: e.className
|
|
155
157
|
}))
|
|
156
|
-
].sort((
|
|
157
|
-
for (const
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
let
|
|
161
|
-
const
|
|
162
|
-
for (const
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
].sort((e, h) => e.from !== h.from ? e.from - h.from : e.to - h.to);
|
|
159
|
+
for (const e of v)
|
|
160
|
+
e.className.startsWith("syntax-variable") && l(e.from, e.to) || o(e.from, e.to, e.className) && O.push({ from: e.from, to: e.to });
|
|
161
|
+
const i = E ? b + 1 : a, k = x - 1;
|
|
162
|
+
let N = i;
|
|
163
|
+
const H = O.sort((e, h) => e.from !== h.from ? e.from - h.from : e.to - h.to);
|
|
164
|
+
for (const e of H)
|
|
165
|
+
N < e.from && o(N, e.from, "syntax-string"), N = Math.max(N, e.to);
|
|
166
|
+
N < k && o(N, k, "syntax-string");
|
|
165
167
|
} else {
|
|
166
|
-
const b = [],
|
|
167
|
-
for (const
|
|
168
|
+
const b = [], R = [];
|
|
169
|
+
for (const i of W(d))
|
|
168
170
|
b.push({
|
|
169
|
-
from:
|
|
170
|
-
to:
|
|
171
|
-
className:
|
|
171
|
+
from: a + i.start,
|
|
172
|
+
to: a + i.end,
|
|
173
|
+
className: i.name === null ? "syntax-variable-invalid" : "syntax-variable"
|
|
172
174
|
});
|
|
173
|
-
const
|
|
174
|
-
for (const
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
let
|
|
178
|
-
for (const
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
const S = b.sort((i, k) => i.from !== k.from ? i.from - k.from : i.to - k.to);
|
|
176
|
+
for (const i of S)
|
|
177
|
+
i.className.startsWith("syntax-variable") && l(i.from, i.to) || o(i.from, i.to, i.className) && R.push({ from: i.from, to: i.to });
|
|
178
|
+
const O = a, g = x - 1;
|
|
179
|
+
let v = O;
|
|
180
|
+
for (const i of R)
|
|
181
|
+
v < i.from && o(v, i.from, "syntax-button-text"), v = Math.max(v, i.to);
|
|
182
|
+
v < g && o(v, g, "syntax-button-text");
|
|
181
183
|
}
|
|
182
184
|
}
|
|
183
|
-
for (const t of
|
|
184
|
-
t.name !== null && !
|
|
185
|
+
for (const t of c)
|
|
186
|
+
t.name !== null && !l(t.start, t.end) && o(t.start, t.end, "syntax-variable");
|
|
185
187
|
return f.sort((t, r) => t.from !== r.from ? t.from - r.from : r.to - t.to), f;
|
|
186
188
|
}
|
|
187
|
-
function
|
|
188
|
-
const
|
|
189
|
-
for (const s of
|
|
189
|
+
function A(n) {
|
|
190
|
+
const l = new $(), f = n.state.doc.toString(), c = T(f, (s, m) => n.state.selection.ranges.some((o) => o.from >= s && o.to <= m));
|
|
191
|
+
for (const s of c)
|
|
190
192
|
if (s.from < s.to)
|
|
191
193
|
try {
|
|
192
|
-
|
|
193
|
-
} catch (
|
|
194
|
-
console.warn("SyntaxHighlighter: Failed to add decoration", s,
|
|
194
|
+
l.add(s.from, s.to, U.mark({ class: s.className }));
|
|
195
|
+
} catch (m) {
|
|
196
|
+
console.warn("SyntaxHighlighter: Failed to add decoration", s, m);
|
|
195
197
|
}
|
|
196
|
-
return
|
|
198
|
+
return l.finish();
|
|
197
199
|
}
|
|
198
|
-
const
|
|
200
|
+
const et = _.fromClass(
|
|
199
201
|
class {
|
|
200
202
|
constructor(n) {
|
|
201
|
-
this.decorations =
|
|
203
|
+
this.decorations = A(n);
|
|
202
204
|
}
|
|
203
205
|
update(n) {
|
|
204
|
-
(n.docChanged || n.viewportChanged || n.selectionSet) && (this.decorations =
|
|
206
|
+
(n.docChanged || n.viewportChanged || n.selectionSet) && (this.decorations = A(n.view));
|
|
205
207
|
}
|
|
206
208
|
},
|
|
207
209
|
{
|
|
@@ -209,8 +211,8 @@ const tt = H.fromClass(
|
|
|
209
211
|
}
|
|
210
212
|
);
|
|
211
213
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
Q as collectOuterBlockRanges,
|
|
215
|
+
T as collectSyntaxHighlightRanges,
|
|
216
|
+
et as default
|
|
215
217
|
};
|
|
216
218
|
//# sourceMappingURL=SyntaxHighlighter.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyntaxHighlighter.es.js","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 preserved 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":";;;;;AAiBA,MAAMA,IAAe,oBAGfC,IAA4B,CAACC,MAAiB;AAClD,QAAMC,IAAUC,EAAoBF,CAAI,GAClCG,IAAUH,EAAK,QAAQ,MAAMC,EAAQ,GAAG,EAAE,GAAG,OAAO,CAAC;AAC3D,SAAOE,MAAY,KACfF,IACA,CAAC,GAAGA,GAAS,EAAE,OAAOE,GAAS,KAAKH,EAAK,QAAQ,MAAM,MAAM;AACnE,GAKMI,IAAoB,IAAI;AAAA,EAC5B,UAAUC,EAAAA,0BAA0B;AAAA,EACpC;AACF,GAEMC,IAAwB,CAACN,MAC7BO,EAA0BP,CAAI,EAAE;AAQlC,SAASQ,EACPC,GACAC,GACwB;AACxB,QAAMC,IAAiC,CAAA;AACvC,MAAIC,IAA8B,MAC9BC,IAAY;AAEhB,SAAOA,KAAaJ,EAAQ,UAAQ;AAClC,UAAMK,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MAAM,IAAI,SAAA,GACzBxC,IAAUF,EAA6B/B,GAAS,CAACqC,GAAMC,MACpDmC,EAAK,MAAM,UAAU,OAAO,KAAK,CAAC7D,MAChCA,EAAM,QAAQyB,KAAQzB,EAAM,MAAM0B,CAC1C,CACF;AAED,aAAWsC,KAAK3C;AACd,QAAI2C,EAAE,OAAOA,EAAE;AACb,UAAI;AACF,QAAAF,EAAQ,IAAIE,EAAE,MAAMA,EAAE,IAAIC,EAAW,KAAK,EAAE,OAAOD,EAAE,UAAA,CAAW,CAAC;AAAA,MACnE,SAASE,GAAG;AACV,gBAAQ,KAAK,+CAA+CF,GAAGE,CAAC;AAAA,MAClE;AAIJ,SAAOJ,EAAQ,OAAA;AACjB;AAEA,MAAMK,KAAoBC,EAAW;AAAA,EACnC,MAAM;AAAA,IAGJ,YAAYP,GAAkB;AAC5B,WAAK,cAAcD,EAAiBC,CAAI;AAAA,IAC1C;AAAA,IAEA,OAAOQ,GAAoB;AACzB,OAAIA,EAAO,cAAcA,EAAO,mBAAmBA,EAAO,kBACxD,KAAK,cAAcT,EAAiBS,EAAO,IAAI;AAAA,IAEnD;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,aAAa,CAACC,MAAaA,EAAS;AAAA,EAAA;AAExC;"}
|
|
1
|
+
{"version":3,"file":"SyntaxHighlighter.es.js","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 preserved 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 const hasLeadingVariable =\n firstVariable &&\n trimVariablePadding(content.slice(0, firstVariable.start)) === \"\";\n const hasPercent = content.startsWith(\"%\") || hasLeadingAssignment;\n if (hasPercent || hasLeadingVariable) {\n // Input / Select\n const percentStart =\n contentStart + (hasLeadingAssignment ? percentIndex : 0);\n if (hasPercent) {\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 addMatch(percentStart, percentStart + 1, percentClass); // %\n }\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 = hasPercent ? percentStart + 1 : contentStart;\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","hasLeadingVariable","hasPercent","percentStart","percentClass","varFrom","varTo","cursorInsideVar","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":";;;;;AAiBA,MAAMA,IAAe,oBAGfC,IAA4B,CAACC,MAAiB;AAClD,QAAMC,IAAUC,EAAoBF,CAAI,GAClCG,IAAUH,EAAK,QAAQ,MAAMC,EAAQ,GAAG,EAAE,GAAG,OAAO,CAAC;AAC3D,SAAOE,MAAY,KACfF,IACA,CAAC,GAAGA,GAAS,EAAE,OAAOE,GAAS,KAAKH,EAAK,QAAQ,MAAM,MAAM;AACnE,GAKMI,IAAoB,IAAI;AAAA,EAC5B,UAAUC,EAAAA,0BAA0B;AAAA,EACpC;AACF,GAEMC,IAAwB,CAACN,MAC7BO,EAA0BP,CAAI,EAAE;AAQlC,SAASQ,EACPC,GACAC,GACwB;AACxB,QAAMC,IAAiC,CAAA;AACvC,MAAIC,IAA8B,MAC9BC,IAAY;AAEhB,SAAOA,KAAaJ,EAAQ,UAAQ;AAClC,UAAMK,IAAeL,E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