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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideEffect.es.js","sources":["../../../../../node_modules/react-remove-scroll/dist/es2015/SideEffect.js"],"sourcesContent":["import { __spreadArray } from \"tslib\";\nimport * as React from 'react';\nimport { RemoveScrollBar } from 'react-remove-scroll-bar';\nimport { styleSingleton } from 'react-style-singleton';\nimport { nonPassive } from './aggresiveCapture';\nimport { handleScroll, locationCouldBeScrolled } from './handleScroll';\nexport var getTouchXY = function (event) {\n return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];\n};\nexport var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };\nvar extractRef = function (ref) {\n return ref && 'current' in ref ? ref.current : ref;\n};\nvar deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };\nvar generateStyle = function (id) { return \"\\n .block-interactivity-\".concat(id, \" {pointer-events: none;}\\n .allow-interactivity-\").concat(id, \" {pointer-events: all;}\\n\"); };\nvar idCounter = 0;\nvar lockStack = [];\nexport function RemoveScrollSideCar(props) {\n var shouldPreventQueue = React.useRef([]);\n var touchStartRef = React.useRef([0, 0]);\n var activeAxis = React.useRef();\n var id = React.useState(idCounter++)[0];\n var Style = React.useState(styleSingleton)[0];\n var lastProps = React.useRef(props);\n React.useEffect(function () {\n lastProps.current = props;\n }, [props]);\n React.useEffect(function () {\n if (props.inert) {\n document.body.classList.add(\"block-interactivity-\".concat(id));\n var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);\n allow_1.forEach(function (el) { return el.classList.add(\"allow-interactivity-\".concat(id)); });\n return function () {\n document.body.classList.remove(\"block-interactivity-\".concat(id));\n allow_1.forEach(function (el) { return el.classList.remove(\"allow-interactivity-\".concat(id)); });\n };\n }\n return;\n }, [props.inert, props.lockRef.current, props.shards]);\n var shouldCancelEvent = React.useCallback(function (event, parent) {\n if (('touches' in event && event.touches.length === 2) || (event.type === 'wheel' && event.ctrlKey)) {\n return !lastProps.current.allowPinchZoom;\n }\n var touch = getTouchXY(event);\n var touchStart = touchStartRef.current;\n var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];\n var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];\n var currentAxis;\n var target = event.target;\n var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';\n // allow horizontal touch move on Range inputs. They will not cause any scroll\n if ('touches' in event && moveDirection === 'h' && target.type === 'range') {\n return false;\n }\n var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);\n if (!canBeScrolledInMainDirection) {\n return true;\n }\n if (canBeScrolledInMainDirection) {\n currentAxis = moveDirection;\n }\n else {\n currentAxis = moveDirection === 'v' ? 'h' : 'v';\n canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);\n // other axis might be not scrollable\n }\n if (!canBeScrolledInMainDirection) {\n return false;\n }\n if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {\n activeAxis.current = currentAxis;\n }\n if (!currentAxis) {\n return true;\n }\n var cancelingAxis = activeAxis.current || currentAxis;\n return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);\n }, []);\n var shouldPrevent = React.useCallback(function (_event) {\n var event = _event;\n if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {\n // not the last active\n return;\n }\n var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);\n var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); })[0];\n // self event, and should be canceled\n if (sourceEvent && sourceEvent.should) {\n if (event.cancelable) {\n event.preventDefault();\n }\n return;\n }\n // outside or shard event\n if (!sourceEvent) {\n var shardNodes = (lastProps.current.shards || [])\n .map(extractRef)\n .filter(Boolean)\n .filter(function (node) { return node.contains(event.target); });\n var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;\n if (shouldStop) {\n if (event.cancelable) {\n event.preventDefault();\n }\n }\n }\n }, []);\n var shouldCancel = React.useCallback(function (name, delta, target, should) {\n var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };\n shouldPreventQueue.current.push(event);\n setTimeout(function () {\n shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });\n }, 1);\n }, []);\n var scrollTouchStart = React.useCallback(function (event) {\n touchStartRef.current = getTouchXY(event);\n activeAxis.current = undefined;\n }, []);\n var scrollWheel = React.useCallback(function (event) {\n shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));\n }, []);\n var scrollTouchMove = React.useCallback(function (event) {\n shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));\n }, []);\n React.useEffect(function () {\n lockStack.push(Style);\n props.setCallbacks({\n onScrollCapture: scrollWheel,\n onWheelCapture: scrollWheel,\n onTouchMoveCapture: scrollTouchMove,\n });\n document.addEventListener('wheel', shouldPrevent, nonPassive);\n document.addEventListener('touchmove', shouldPrevent, nonPassive);\n document.addEventListener('touchstart', scrollTouchStart, nonPassive);\n return function () {\n lockStack = lockStack.filter(function (inst) { return inst !== Style; });\n document.removeEventListener('wheel', shouldPrevent, nonPassive);\n document.removeEventListener('touchmove', shouldPrevent, nonPassive);\n document.removeEventListener('touchstart', scrollTouchStart, nonPassive);\n };\n }, []);\n var removeScrollBar = props.removeScrollBar, inert = props.inert;\n return (React.createElement(React.Fragment, null,\n inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,\n removeScrollBar ? React.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null));\n}\nfunction getOutermostShadowParent(node) {\n var shadowParent = null;\n while (node !== null) {\n if (node instanceof ShadowRoot) {\n shadowParent = node.host;\n node = node.host;\n }\n node = node.parentNode;\n }\n return shadowParent;\n}\n"],"names":["getTouchXY","event","getDeltaXY","extractRef","ref","deltaCompare","x","y","generateStyle","id","idCounter","lockStack","RemoveScrollSideCar","props","shouldPreventQueue","React","touchStartRef","activeAxis","Style","styleSingleton","lastProps","allow_1","__spreadArray","el","shouldCancelEvent","parent","touch","touchStart","deltaX","deltaY","currentAxis","target","moveDirection","canBeScrolledInMainDirection","locationCouldBeScrolled","cancelingAxis","handleScroll","shouldPrevent","_event","delta","sourceEvent","e","shardNodes","node","shouldStop","shouldCancel","name","should","getOutermostShadowParent","scrollTouchStart","scrollWheel","scrollTouchMove","nonPassive","inst","removeScrollBar","inert","RemoveScrollBar","shadowParent"],"mappings":";;;;;;AAMU,IAACA,IAAa,SAAUC,GAAO;AACrC,SAAO,oBAAoBA,IAAQ,CAACA,EAAM,eAAe,CAAC,EAAE,SAASA,EAAM,eAAe,CAAC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC;AACjH,GACWC,IAAa,SAAUD,GAAO;AAAE,SAAO,CAACA,EAAM,QAAQA,EAAM,MAAM;AAAG,GAC5EE,IAAa,SAAUC,GAAK;AAC5B,SAAOA,KAAO,aAAaA,IAAMA,EAAI,UAAUA;AACnD,GACIC,IAAe,SAAUC,GAAGC,GAAG;AAAE,SAAOD,EAAE,CAAC,MAAMC,EAAE,CAAC,KAAKD,EAAE,CAAC,MAAMC,EAAE,CAAC;AAAG,GACxEC,IAAgB,SAAUC,GAAI;AAAE,SAAO;AAAA,yBAA4B,OAAOA,GAAI;AAAA,wBAAmD,EAAE,OAAOA,GAAI;AAAA,CAA2B;AAAG,GAC5KC,IAAY,GACZC,IAAY,CAAA;AACT,SAASC,EAAoBC,GAAO;AACvC,MAAIC,IAAqBC,EAAM,OAAO,EAAE,GACpCC,IAAgBD,EAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GACnCE,IAAaF,EAAM,OAAM,GACzBN,IAAKM,EAAM,SAASL,GAAW,EAAE,CAAC,GAClCQ,IAAQH,EAAM,SAASI,CAAc,EAAE,CAAC,GACxCC,IAAYL,EAAM,OAAOF,CAAK;AAClC,EAAAE,EAAM,UAAU,WAAY;AACxB,IA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Aaf,GAAee,CAAU,GAChE,SAAS,iBAAiB,cAAcH,GAAkBG,CAAU,GAC7D,WAAY;AACf,MAAAzC,IAAYA,EAAU,OAAO,SAAU0C,GAAM;AAAE,eAAOA,MAASnC;AAAA,MAAO,CAAC,GACvE,SAAS,oBAAoB,SAASmB,GAAee,CAAU,GAC/D,SAAS,oBAAoB,aAAaf,GAAee,CAAU,GACnE,SAAS,oBAAoB,cAAcH,GAAkBG,CAAU;AAAA,IAC3E;AAAA,EACJ,GAAG,CAAA,CAAE;AACL,MAAIE,IAAkBzC,EAAM,iBAAiB0C,IAAQ1C,EAAM;AAC3D,SAAQE,EAAM;AAAA,IAAcA,EAAM;AAAA,IAAU;AAAA,IACxCwC,IAAQxC,EAAM,cAAcG,GAAO,EAAE,QAAQV,EAAcC,CAAE,EAAC,CAAE,IAAI;AAAA,IACpE6C,IAAkBvC,EAAM,cAAcyC,GAAiB,EAAE,YAAY3C,EAAM,YAAY,SAASA,EAAM,QAAO,CAAE,IAAI;AAAA,EAAI;AAC/H;AACA,SAASmC,EAAyBL,GAAM;AAEpC,WADIc,IAAe,MACZd,MAAS;AACZ,IAAIA,aAAgB,eAChBc,IAAed,EAAK,MACpBA,IAAOA,EAAK,OAEhBA,IAAOA,EAAK;AAEhB,SAAOc;AACX;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"SideEffect.es.js","sources":["../../../../../node_modules/react-remove-scroll/dist/es2015/SideEffect.js"],"sourcesContent":["import { __spreadArray } from \"tslib\";\nimport * as React from 'react';\nimport { RemoveScrollBar } from 'react-remove-scroll-bar';\nimport { styleSingleton } from 'react-style-singleton';\nimport { nonPassive } from './aggresiveCapture';\nimport { handleScroll, locationCouldBeScrolled } from './handleScroll';\nexport var getTouchXY = function (event) {\n return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];\n};\nexport var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };\nvar extractRef = function (ref) {\n return ref && 'current' in ref ? ref.current : ref;\n};\nvar deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };\nvar generateStyle = function (id) { return \"\\n .block-interactivity-\".concat(id, \" {pointer-events: none;}\\n .allow-interactivity-\").concat(id, \" {pointer-events: all;}\\n\"); };\nvar idCounter = 0;\nvar lockStack = [];\nexport function RemoveScrollSideCar(props) {\n var shouldPreventQueue = React.useRef([]);\n var touchStartRef = React.useRef([0, 0]);\n var activeAxis = React.useRef();\n var id = React.useState(idCounter++)[0];\n var Style = React.useState(styleSingleton)[0];\n var lastProps = React.useRef(props);\n React.useEffect(function () {\n lastProps.current = props;\n }, [props]);\n React.useEffect(function () {\n if (props.inert) {\n document.body.classList.add(\"block-interactivity-\".concat(id));\n var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);\n allow_1.forEach(function (el) { return el.classList.add(\"allow-interactivity-\".concat(id)); });\n return function () {\n document.body.classList.remove(\"block-interactivity-\".concat(id));\n allow_1.forEach(function (el) { return el.classList.remove(\"allow-interactivity-\".concat(id)); });\n };\n }\n return;\n }, [props.inert, props.lockRef.current, props.shards]);\n var shouldCancelEvent = React.useCallback(function (event, parent) {\n if (('touches' in event && event.touches.length === 2) || (event.type === 'wheel' && event.ctrlKey)) {\n return !lastProps.current.allowPinchZoom;\n }\n var touch = getTouchXY(event);\n var touchStart = touchStartRef.current;\n var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];\n var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];\n var currentAxis;\n var target = event.target;\n var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';\n // allow horizontal touch move on Range inputs. They will not cause any scroll\n if ('touches' in event && moveDirection === 'h' && target.type === 'range') {\n return false;\n }\n // allow drag selection (iOS); check if selection's anchorNode is the same as target or contains target\n var selection = window.getSelection();\n var anchorNode = selection && selection.anchorNode;\n var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;\n if (isTouchingSelection) {\n return false;\n }\n var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);\n if (!canBeScrolledInMainDirection) {\n return true;\n }\n if (canBeScrolledInMainDirection) {\n currentAxis = moveDirection;\n }\n else {\n currentAxis = moveDirection === 'v' ? 'h' : 'v';\n canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);\n // other axis might be not scrollable\n }\n if (!canBeScrolledInMainDirection) {\n return false;\n }\n if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {\n activeAxis.current = currentAxis;\n }\n if (!currentAxis) {\n return true;\n }\n var cancelingAxis = activeAxis.current || currentAxis;\n return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);\n }, []);\n var shouldPrevent = React.useCallback(function (_event) {\n var event = _event;\n if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {\n // not the last active\n return;\n }\n var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);\n var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); })[0];\n // self event, and should be canceled\n if (sourceEvent && sourceEvent.should) {\n if (event.cancelable) {\n event.preventDefault();\n }\n return;\n }\n // outside or shard event\n if (!sourceEvent) {\n var shardNodes = (lastProps.current.shards || [])\n .map(extractRef)\n .filter(Boolean)\n .filter(function (node) { return node.contains(event.target); });\n var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;\n if (shouldStop) {\n if (event.cancelable) {\n event.preventDefault();\n }\n }\n }\n }, []);\n var shouldCancel = React.useCallback(function (name, delta, target, should) {\n var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };\n shouldPreventQueue.current.push(event);\n setTimeout(function () {\n shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });\n }, 1);\n }, []);\n var scrollTouchStart = React.useCallback(function (event) {\n touchStartRef.current = getTouchXY(event);\n activeAxis.current = undefined;\n }, []);\n var scrollWheel = React.useCallback(function (event) {\n shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));\n }, []);\n var scrollTouchMove = React.useCallback(function (event) {\n shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));\n }, []);\n React.useEffect(function () {\n lockStack.push(Style);\n props.setCallbacks({\n onScrollCapture: scrollWheel,\n onWheelCapture: scrollWheel,\n onTouchMoveCapture: scrollTouchMove,\n });\n document.addEventListener('wheel', shouldPrevent, nonPassive);\n document.addEventListener('touchmove', shouldPrevent, nonPassive);\n document.addEventListener('touchstart', scrollTouchStart, nonPassive);\n return function () {\n lockStack = lockStack.filter(function (inst) { return inst !== Style; });\n document.removeEventListener('wheel', shouldPrevent, nonPassive);\n document.removeEventListener('touchmove', shouldPrevent, nonPassive);\n document.removeEventListener('touchstart', scrollTouchStart, nonPassive);\n };\n }, []);\n var removeScrollBar = props.removeScrollBar, inert = props.inert;\n return (React.createElement(React.Fragment, null,\n inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,\n removeScrollBar ? React.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null));\n}\nfunction getOutermostShadowParent(node) {\n var shadowParent = null;\n while (node !== null) {\n if (node instanceof ShadowRoot) {\n shadowParent = node.host;\n node = node.host;\n }\n node = node.parentNode;\n }\n return shadowParent;\n}\n"],"names":["getTouchXY","event","getDeltaXY","extractRef","ref","deltaCompare","x","y","generateStyle","id","idCounter","lockStack","RemoveScrollSideCar","props","shouldPreventQueue","React","touchStartRef","activeAxis","Style","styleSingleton","lastProps","allow_1","__spreadArray","el","shouldCancelEvent","parent","touch","touchStart","deltaX","deltaY","currentAxis","target","moveDirection","selection","anchorNode","isTouchingSelection","canBeScrolledInMainDirection","locationCouldBeScrolled","cancelingAxis","handleScroll","shouldPrevent","_event","delta","sourceEvent","e","shardNodes","node","shouldStop","shouldCancel","name","should","getOutermostShadowParent","scrollTouchStart","scrollWheel","scrollTouchMove","nonPassive","inst","removeScrollBar","inert","RemoveScrollBar","shadowParent"],"mappings":";;;;;;AAMU,IAACA,IAAa,SAAUC,GAAO;AACrC,SAAO,oBAAoBA,IAAQ,CAACA,EAAM,eAAe,CAAC,EAAE,SAASA,EAAM,eAAe,CAAC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC;AACjH,GACWC,IAAa,SAAUD,GAAO;AAAE,SAAO,CAACA,EAAM,QAAQA,EAAM,MAAM;AAAG,GAC5EE,IAAa,SAAUC,GAAK;AAC5B,SAAOA,KAAO,aAAaA,IAAMA,EAAI,UAAUA;AACnD,GACIC,IAAe,SAAUC,GAAGC,GAAG;AAAE,SAAOD,EAAE,CAAC,MAAMC,EAAE,CAAC,KAAKD,EAAE,CAAC,MAAMC,EAAE,CAAC;AAAG,GACxEC,IAAgB,SAAUC,GAAI;AAAE,SAAO;AAAA,yBAA4B,OAAOA,GAAI;AAAA,wBAAmD,EAAE,OAAOA,GAAI;AAAA,CAA2B;AAAG,GAC5KC,IAAY,GACZC,IAAY,CAAA;AACT,SAASC,EAAoBC,GAAO;AACvC,MAAIC,IAAqBC,EAAM,OAAO,EAAE,GACpCC,IAAgBD,EAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GACnCE,IAAaF,EAAM,OAAM,GACzBN,IAAKM,EAAM,SAASL,GAAW,EAAE,CAAC,GAClCQ,IAAQH,EAAM,SAASI,CAAc,EAAE,CAAC,GACxCC,IAAYL,EAAM,OAAOF,CAAK;AAClC,EAAAE,EAAM,UAAU,WAAY;AACxB,IAAAK,EAAU,UAAUP;AAAA,EACxB,GAAG,CAACA,CAAK,CAAC,GACVE,EAAM,UAAU,WAAY;AACxB,QAAIF,EAAM,OAAO;AACb,eAAS,KAAK,UAAU,IAAI,uBAAuB,OAAOJ,CAAE,CAAC;AAC7D,UAAIY,IAAUC,EAAc,CAACT,EAAM,QAAQ,OAAO,IAAI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ACf,MAAA5C,IAAYA,EAAU,OAAO,SAAU6C,GAAM;AAAE,eAAOA,MAAStC;AAAA,MAAO,CAAC,GACvE,SAAS,oBAAoB,SAASsB,GAAee,CAAU,GAC/D,SAAS,oBAAoB,aAAaf,GAAee,CAAU,GACnE,SAAS,oBAAoB,cAAcH,GAAkBG,CAAU;AAAA,IAC3E;AAAA,EACJ,GAAG,CAAA,CAAE;AACL,MAAIE,IAAkB5C,EAAM,iBAAiB6C,IAAQ7C,EAAM;AAC3D,SAAQE,EAAM;AAAA,IAAcA,EAAM;AAAA,IAAU;AAAA,IACxC2C,IAAQ3C,EAAM,cAAcG,GAAO,EAAE,QAAQV,EAAcC,CAAE,EAAC,CAAE,IAAI;AAAA,IACpEgD,IAAkB1C,EAAM,cAAc4C,GAAiB,EAAE,YAAY9C,EAAM,YAAY,SAASA,EAAM,QAAO,CAAE,IAAI;AAAA,EAAI;AAC/H;AACA,SAASsC,EAAyBL,GAAM;AAEpC,WADIc,IAAe,MACZd,MAAS;AACZ,IAAIA,aAAgB,eAChBc,IAAed,EAAK,MACpBA,IAAOA,EAAK,OAEhBA,IAAOA,EAAK;AAEhB,SAAOc;AACX;","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"@codemirror/view": "^6.38.1",
|
|
18
18
|
"@fontsource/inter": "^5.2.8",
|
|
19
19
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
20
|
-
"@radix-ui/react-dialog": "1.
|
|
21
|
-
"@radix-ui/react-popover": "1.
|
|
22
|
-
"@radix-ui/react-slot": "1.
|
|
20
|
+
"@radix-ui/react-dialog": "1.2.0",
|
|
21
|
+
"@radix-ui/react-popover": "1.2.0",
|
|
22
|
+
"@radix-ui/react-slot": "1.4.0",
|
|
23
23
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
24
24
|
"@types/hast": "^3.0.4",
|
|
25
25
|
"@types/mdast": "^4.0.4",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@storybook/nextjs-vite": "^9.0.16",
|
|
68
68
|
"@tailwindcss/cli": "^4.1.11",
|
|
69
69
|
"@tailwindcss/postcss": "^4",
|
|
70
|
-
"@testing-library/react": "16.3.
|
|
70
|
+
"@testing-library/react": "16.3.3",
|
|
71
71
|
"@types/node": "^20",
|
|
72
72
|
"@types/react": "^19",
|
|
73
73
|
"@types/react-dom": "^19",
|
|
@@ -82,16 +82,16 @@
|
|
|
82
82
|
"eslint-config-prettier": "^10.1.8",
|
|
83
83
|
"eslint-plugin-prettier": "^5.5.4",
|
|
84
84
|
"eslint-plugin-storybook": "^9.0.16",
|
|
85
|
-
"gsap": "3.
|
|
85
|
+
"gsap": "3.15.0",
|
|
86
86
|
"husky": "^9.1.7",
|
|
87
87
|
"jsdom": "26.1.0",
|
|
88
88
|
"lint-staged": "^16.1.6",
|
|
89
|
-
"markdownlint-cli": "^0.
|
|
89
|
+
"markdownlint-cli": "^0.49.1",
|
|
90
90
|
"next": "15.3.6",
|
|
91
91
|
"playwright": "^1.54.1",
|
|
92
|
-
"prettier": "
|
|
93
|
-
"react": "19.0
|
|
94
|
-
"react-dom": "19.0
|
|
92
|
+
"prettier": "3.9.9",
|
|
93
|
+
"react": "19.3.0",
|
|
94
|
+
"react-dom": "19.3.0",
|
|
95
95
|
"rollup": "^4.46.2",
|
|
96
96
|
"rollup-plugin-dts": "^6.2.1",
|
|
97
97
|
"standard-version": "^9.5.0",
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
]
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
|
-
"version": "0.3.2
|
|
199
|
+
"version": "0.3.2",
|
|
200
200
|
"type": "module",
|
|
201
201
|
"exports": {
|
|
202
202
|
".": {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),l=require("react"),t=require("../../ui/popover.cjs"),c=require("../editor-context.cjs"),d=require("../../../lib/utils.cjs"),n=({children:s,className:i,dir:p,lang:u})=>{const{popoverOpen:r,setPopoverOpen:a,popoverPosition:e}=l.useContext(c.default);return!r||!e?null:o.jsxs(t.Popover,{open:r,onOpenChange:a,children:[o.jsx(t.PopoverAnchor,{style:{position:"fixed",left:`${e.x}px`,top:`${e.y}px`,width:0,height:0}}),o.jsx(t.PopoverContent,{className:d.cn("p-0 border-0 shadow-none bg-transparent w-auto",i),align:"start",dir:p,lang:u,sideOffset:5,children:s})]})};n.displayName="CustomPopover";exports.default=n;
|
|
2
|
-
//# sourceMappingURL=CustomPopover.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomPopover.cjs","sources":["../../../../src/components/MarkdownFlowEditor/components/CustomPopover.tsx"],"sourcesContent":["import React, { useContext } from \"react\";\nimport { Popover, PopoverContent, PopoverAnchor } from \"../../ui/popover\";\nimport EditorContext from \"../editor-context\";\nimport type { MarkdownFlowDirection } from \"../../../lib/locale\";\nimport { cn } from \"../../../lib/utils\";\n\ntype CustomPopoverProps = {\n children?: React.ReactNode;\n};\n\nexport interface CustomPopoverAllProps extends CustomPopoverProps {\n className?: string;\n /**\n * Sets \"ltr\" or \"rtl\" on the popover content, including its reading and layout direction.\n * When omitted, the content inherits direction from its portal container, not the trigger.\n */\n dir?: MarkdownFlowDirection;\n /** Language of the detached popover content. */\n lang?: string;\n}\n\nconst CustomPopover: React.FC<CustomPopoverAllProps> = ({\n children,\n className,\n dir,\n lang,\n}) => {\n const { popoverOpen, setPopoverOpen, popoverPosition } =\n useContext(EditorContext);\n\n if (!popoverOpen || !popoverPosition) {\n return null;\n }\n\n return (\n <Popover open={popoverOpen} onOpenChange={setPopoverOpen}>\n <PopoverAnchor\n style={{\n position: \"fixed\",\n left: `${popoverPosition.x}px`,\n top: `${popoverPosition.y}px`,\n width: 0,\n height: 0,\n }}\n />\n <PopoverContent\n className={cn(\n \"p-0 border-0 shadow-none bg-transparent w-auto\",\n className\n )}\n align=\"start\"\n dir={dir}\n lang={lang}\n sideOffset={5}\n >\n {children}\n </PopoverContent>\n </Popover>\n );\n};\n\nCustomPopover.displayName = \"CustomPopover\";\n\nexport default CustomPopover;\n"],"names":["CustomPopover","children","className","dir","lang","popoverOpen","setPopoverOpen","popoverPosition","useContext","EditorContext","jsxs","Popover","jsx","PopoverAnchor","PopoverContent","cn"],"mappings":"6QAqBMA,EAAiD,CAAC,CACtD,SAAAC,EACA,UAAAC,EACA,IAAAC,EACA,KAAAC,CACF,IAAM,CACJ,KAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,gBAAAC,CAAA,EACnCC,EAAAA,WAAWC,EAAAA,OAAa,EAE1B,MAAI,CAACJ,GAAe,CAACE,EACZ,KAIPG,EAAAA,KAACC,EAAAA,QAAA,CAAQ,KAAMN,EAAa,aAAcC,EACxC,SAAA,CAAAM,EAAAA,IAACC,EAAAA,cAAA,CACC,MAAO,CACL,SAAU,QACV,KAAM,GAAGN,EAAgB,CAAC,KAC1B,IAAK,GAAGA,EAAgB,CAAC,KACzB,MAAO,EACP,OAAQ,CAAA,CACV,CAAA,EAEFK,EAAAA,IAACE,EAAAA,eAAA,CACC,UAAWC,EAAAA,GACT,iDACAb,CAAA,EAEF,MAAM,QACN,IAAAC,EACA,KAAAC,EACA,WAAY,EAEX,SAAAH,CAAA,CAAA,CACH,EACF,CAEJ,EAEAD,EAAc,YAAc"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { MarkdownFlowDirection } from '../../../lib/locale.js';
|
|
3
|
-
type CustomPopoverProps = {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
};
|
|
6
|
-
export interface CustomPopoverAllProps extends CustomPopoverProps {
|
|
7
|
-
className?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Sets "ltr" or "rtl" on the popover content, including its reading and layout direction.
|
|
10
|
-
* When omitted, the content inherits direction from its portal container, not the trigger.
|
|
11
|
-
*/
|
|
12
|
-
dir?: MarkdownFlowDirection;
|
|
13
|
-
/** Language of the detached popover content. */
|
|
14
|
-
lang?: string;
|
|
15
|
-
}
|
|
16
|
-
declare const CustomPopover: React.FC<CustomPopoverAllProps>;
|
|
17
|
-
export default CustomPopover;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useContext as a } from "react";
|
|
3
|
-
import { Popover as f, PopoverAnchor as d, PopoverContent as l } from "../../ui/popover.es.js";
|
|
4
|
-
import x from "../editor-context.es.js";
|
|
5
|
-
import { cn as u } from "../../../lib/utils.es.js";
|
|
6
|
-
const v = ({
|
|
7
|
-
children: r,
|
|
8
|
-
className: p,
|
|
9
|
-
dir: n,
|
|
10
|
-
lang: s
|
|
11
|
-
}) => {
|
|
12
|
-
const { popoverOpen: e, setPopoverOpen: i, popoverPosition: o } = a(x);
|
|
13
|
-
return !e || !o ? null : /* @__PURE__ */ m(f, { open: e, onOpenChange: i, children: [
|
|
14
|
-
/* @__PURE__ */ t(
|
|
15
|
-
d,
|
|
16
|
-
{
|
|
17
|
-
style: {
|
|
18
|
-
position: "fixed",
|
|
19
|
-
left: `${o.x}px`,
|
|
20
|
-
top: `${o.y}px`,
|
|
21
|
-
width: 0,
|
|
22
|
-
height: 0
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
),
|
|
26
|
-
/* @__PURE__ */ t(
|
|
27
|
-
l,
|
|
28
|
-
{
|
|
29
|
-
className: u(
|
|
30
|
-
"p-0 border-0 shadow-none bg-transparent w-auto",
|
|
31
|
-
p
|
|
32
|
-
),
|
|
33
|
-
align: "start",
|
|
34
|
-
dir: n,
|
|
35
|
-
lang: s,
|
|
36
|
-
sideOffset: 5,
|
|
37
|
-
children: r
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
] });
|
|
41
|
-
};
|
|
42
|
-
v.displayName = "CustomPopover";
|
|
43
|
-
export {
|
|
44
|
-
v as default
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=CustomPopover.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomPopover.es.js","sources":["../../../../src/components/MarkdownFlowEditor/components/CustomPopover.tsx"],"sourcesContent":["import React, { useContext } from \"react\";\nimport { Popover, PopoverContent, PopoverAnchor } from \"../../ui/popover\";\nimport EditorContext from \"../editor-context\";\nimport type { MarkdownFlowDirection } from \"../../../lib/locale\";\nimport { cn } from \"../../../lib/utils\";\n\ntype CustomPopoverProps = {\n children?: React.ReactNode;\n};\n\nexport interface CustomPopoverAllProps extends CustomPopoverProps {\n className?: string;\n /**\n * Sets \"ltr\" or \"rtl\" on the popover content, including its reading and layout direction.\n * When omitted, the content inherits direction from its portal container, not the trigger.\n */\n dir?: MarkdownFlowDirection;\n /** Language of the detached popover content. */\n lang?: string;\n}\n\nconst CustomPopover: React.FC<CustomPopoverAllProps> = ({\n children,\n className,\n dir,\n lang,\n}) => {\n const { popoverOpen, setPopoverOpen, popoverPosition } =\n useContext(EditorContext);\n\n if (!popoverOpen || !popoverPosition) {\n return null;\n }\n\n return (\n <Popover open={popoverOpen} onOpenChange={setPopoverOpen}>\n <PopoverAnchor\n style={{\n position: \"fixed\",\n left: `${popoverPosition.x}px`,\n top: `${popoverPosition.y}px`,\n width: 0,\n height: 0,\n }}\n />\n <PopoverContent\n className={cn(\n \"p-0 border-0 shadow-none bg-transparent w-auto\",\n className\n )}\n align=\"start\"\n dir={dir}\n lang={lang}\n sideOffset={5}\n >\n {children}\n </PopoverContent>\n </Popover>\n );\n};\n\nCustomPopover.displayName = \"CustomPopover\";\n\nexport default CustomPopover;\n"],"names":["CustomPopover","children","className","dir","lang","popoverOpen","setPopoverOpen","popoverPosition","useContext","EditorContext","jsxs","Popover","jsx","PopoverAnchor","PopoverContent","cn"],"mappings":";;;;;AAqBA,MAAMA,IAAiD,CAAC;AAAA,EACtD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,KAAAC;AAAA,EACA,MAAAC;AACF,MAAM;AACJ,QAAM,EAAE,aAAAC,GAAa,gBAAAC,GAAgB,iBAAAC,EAAA,IACnCC,EAAWC,CAAa;AAE1B,SAAI,CAACJ,KAAe,CAACE,IACZ,OAIP,gBAAAG,EAACC,GAAA,EAAQ,MAAMN,GAAa,cAAcC,GACxC,UAAA;AAAA,IAAA,gBAAAM;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,UAAU;AAAA,UACV,MAAM,GAAGN,EAAgB,CAAC;AAAA,UAC1B,KAAK,GAAGA,EAAgB,CAAC;AAAA,UACzB,OAAO;AAAA,UACP,QAAQ;AAAA,QAAA;AAAA,MACV;AAAA,IAAA;AAAA,IAEF,gBAAAK;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,UACAb;AAAA,QAAA;AAAA,QAEF,OAAM;AAAA,QACN,KAAAC;AAAA,QACA,MAAAC;AAAA,QACA,YAAY;AAAA,QAEX,UAAAH;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ;AAEAD,EAAc,cAAc;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),a=require("react"),q=require("../../ui/input.cjs"),R=require("../../../lib/utils.cjs"),I=require("../../../node_modules/lucide-react/dist/esm/icons/search.cjs"),V=({open:u,anchorElement:r,onClose:l,onSelect:j,variables:N,systemVariables:L,labels:h})=>{const f=a.useRef(null),M=a.useRef(null),[k,D]=a.useState(""),[C,$]=a.useState({left:0,top:0}),[x,o]=a.useState(-1),v=a.useCallback(()=>{if(!r)return;const e=r.getBoundingClientRect(),t=r.ownerDocument,n=t.defaultView;if(!n)return;const c=f.current?.getBoundingClientRect().width??0,w=n.getComputedStyle(r).direction==="rtl"?e.right-c:e.left,b=Math.max(8,t.documentElement.clientWidth-c-8);$({left:Math.min(Math.max(8,w),b),top:e.bottom+8})},[r]);a.useEffect(()=>{if(!u){D(""),o(-1);return}const e=r?.ownerDocument.defaultView;if(!e)return;v();const t=e.setTimeout(()=>{M.current?.focus()},0),n=w=>{const b=w.target;f.current&&!f.current.contains(b)&&r&&!r.contains(b)&&l()},c=()=>v();return e.addEventListener("mousedown",n),e.addEventListener("scroll",c,!0),e.addEventListener("resize",c),()=>{e.clearTimeout(t),e.removeEventListener("mousedown",n),e.removeEventListener("scroll",c,!0),e.removeEventListener("resize",c)}},[u,r,l,v]);const p=k.trim().toLowerCase(),g=a.useCallback(e=>{if(!p)return!0;const t=e.name.toLowerCase().includes(p),n=e.label?e.label.toLowerCase().includes(p):!1;return t||n},[p]),m=a.useMemo(()=>L.filter(g),[L,g]),d=a.useMemo(()=>N.filter(g),[N,g]),i=a.useMemo(()=>[...m.map(e=>({group:"system",variable:e})),...d.map(e=>({group:"custom",variable:e}))],[m,d]),S=a.useMemo(()=>{const e=new Map;return i.forEach((t,n)=>{e.set(`${t.group}-${t.variable.name}`,n)}),e},[i]);a.useEffect(()=>{(!u||!i.length)&&o(-1)},[u,i.length]);const y=a.useCallback(e=>{j(e),l()},[l,j]),E=e=>{if(!i.length){e.key==="Escape"&&l();return}if(e.key==="ArrowDown")e.preventDefault(),o(t=>(t+1)%i.length);else if(e.key==="ArrowUp")e.preventDefault(),o(t=>t<=0?i.length-1:t-1);else if(e.key==="Enter"){e.preventDefault();const t=i[x];t&&y(t.variable)}else e.key==="Escape"&&(e.preventDefault(),l())};return u?s.jsxs("div",{ref:f,className:"markdown-flow-editor-variable-search",style:{position:"fixed",left:`${C.left}px`,top:`${C.top}px`},children:[s.jsxs("div",{className:"relative",children:[s.jsx(I.default,{className:"variable-search-icon"}),s.jsx(q.Input,{ref:M,value:k,placeholder:h.searchPlaceholder,onChange:e=>D(e.target.value),onKeyDown:E,className:"variable-search-input"})]}),s.jsxs("div",{className:"variable-search-list",children:[m.length>0&&s.jsxs("div",{className:"variable-search-section",children:[s.jsx("p",{className:"variable-search-section-title",children:h.systemLabel}),m.map(e=>{const t=S.get(`system-${e.name}`)??-1,n=x===t;return s.jsxs("button",{type:"button",onClick:()=>y(e),onMouseEnter:()=>{t>=0&&o(t)},className:R.cn("variable-search-item",n&&"variable-search-item-active"),children:[s.jsx("span",{className:"variable-search-item-name",children:e.name}),e.label&&s.jsx("span",{className:"variable-search-item-label",children:e.label})]},`system-${e.name}`)})]}),d.length>0&&s.jsxs("div",{className:"variable-search-section",children:[s.jsx("p",{className:"variable-search-section-title",children:h.customLabel}),d.map(e=>{const t=S.get(`custom-${e.name}`)??-1,n=x===t;return s.jsxs("button",{type:"button",onClick:()=>y(e),onMouseEnter:()=>{t>=0&&o(t)},className:R.cn("variable-search-item",n&&"variable-search-item-active"),children:[s.jsx("span",{className:"variable-search-item-name",children:e.name}),e.label&&s.jsx("span",{className:"variable-search-item-label",children:e.label})]},`custom-${e.name}`)})]}),m.length===0&&d.length===0&&s.jsx("div",{className:"variable-search-empty",children:h.emptyLabel})]})]}):null};exports.default=V;
|
|
2
|
-
//# sourceMappingURL=VariableSearchDropdown.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VariableSearchDropdown.cjs","sources":["../../../../src/components/MarkdownFlowEditor/components/VariableSearchDropdown.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Search } from \"lucide-react\";\nimport { Variable } from \"../types\";\nimport { Input } from \"../../ui/input\";\nimport { cn } from \"../../../lib/utils\";\n\ninterface VariableSearchDropdownProps {\n open: boolean;\n anchorElement: HTMLElement | null;\n onClose: () => void;\n onSelect: (variable: Variable) => void;\n variables: Variable[];\n systemVariables: Variable[];\n labels: {\n searchPlaceholder: string;\n systemLabel: string;\n customLabel: string;\n emptyLabel: string;\n };\n}\n\nconst VariableSearchDropdown: React.FC<VariableSearchDropdownProps> = ({\n open,\n anchorElement,\n onClose,\n onSelect,\n variables,\n systemVariables,\n labels,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const [query, setQuery] = useState(\"\");\n const [position, setPosition] = useState({ left: 0, top: 0 });\n const [highlightIndex, setHighlightIndex] = useState(-1);\n\n const updatePosition = useCallback(() => {\n if (!anchorElement) return;\n const rect = anchorElement.getBoundingClientRect();\n const doc = anchorElement.ownerDocument;\n const view = doc.defaultView;\n if (!view) return;\n const width = containerRef.current?.getBoundingClientRect().width ?? 0;\n const desiredLeft =\n view.getComputedStyle(anchorElement).direction === \"rtl\"\n ? rect.right - width\n : rect.left;\n const maxLeft = Math.max(8, doc.documentElement.clientWidth - width - 8);\n setPosition({\n left: Math.min(Math.max(8, desiredLeft), maxLeft),\n top: rect.bottom + 8,\n });\n }, [anchorElement]);\n\n useEffect(() => {\n if (!open) {\n setQuery(\"\");\n setHighlightIndex(-1);\n return;\n }\n const view = anchorElement?.ownerDocument.defaultView;\n if (!view) return;\n updatePosition();\n const focusTimer = view.setTimeout(() => {\n inputRef.current?.focus();\n }, 0);\n const handleClick = (event: MouseEvent) => {\n const target = event.target as Node | null;\n if (\n containerRef.current &&\n !containerRef.current.contains(target) &&\n anchorElement &&\n !anchorElement.contains(target)\n ) {\n onClose();\n }\n };\n const handleScroll = () => updatePosition();\n view.addEventListener(\"mousedown\", handleClick);\n view.addEventListener(\"scroll\", handleScroll, true);\n view.addEventListener(\"resize\", handleScroll);\n\n return () => {\n view.clearTimeout(focusTimer);\n view.removeEventListener(\"mousedown\", handleClick);\n view.removeEventListener(\"scroll\", handleScroll, true);\n view.removeEventListener(\"resize\", handleScroll);\n };\n }, [open, anchorElement, onClose, updatePosition]);\n\n const normalizedQuery = query.trim().toLowerCase();\n const filterVariable = useCallback(\n (variable: Variable) => {\n if (!normalizedQuery) return true;\n const nameMatch = variable.name.toLowerCase().includes(normalizedQuery);\n const labelMatch = variable.label\n ? variable.label.toLowerCase().includes(normalizedQuery)\n : false;\n return nameMatch || labelMatch;\n },\n [normalizedQuery]\n );\n\n const filteredSystemVariables = useMemo(\n () => systemVariables.filter(filterVariable),\n [systemVariables, filterVariable]\n );\n const filteredCustomVariables = useMemo(\n () => variables.filter(filterVariable),\n [variables, filterVariable]\n );\n\n const orderedItems = useMemo(\n () => [\n ...filteredSystemVariables.map((variable) => ({\n group: \"system\" as const,\n variable,\n })),\n ...filteredCustomVariables.map((variable) => ({\n group: \"custom\" as const,\n variable,\n })),\n ],\n [filteredSystemVariables, filteredCustomVariables]\n );\n\n const indexesByKey = useMemo(() => {\n const map = new Map<string, number>();\n orderedItems.forEach((item, index) => {\n map.set(`${item.group}-${item.variable.name}`, index);\n });\n return map;\n }, [orderedItems]);\n\n useEffect(() => {\n if (!open || !orderedItems.length) {\n setHighlightIndex(-1);\n }\n }, [open, orderedItems.length]);\n\n const handleSelect = useCallback(\n (variable: Variable) => {\n onSelect(variable);\n onClose();\n },\n [onClose, onSelect]\n );\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!orderedItems.length) {\n if (event.key === \"Escape\") {\n onClose();\n }\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n setHighlightIndex((prev) => (prev + 1) % orderedItems.length);\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n setHighlightIndex((prev) =>\n prev <= 0 ? orderedItems.length - 1 : prev - 1\n );\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n const item = orderedItems[highlightIndex];\n if (item) {\n handleSelect(item.variable);\n }\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n onClose();\n }\n };\n\n if (!open) {\n return null;\n }\n\n return (\n <div\n ref={containerRef}\n className=\"markdown-flow-editor-variable-search\"\n style={{\n position: \"fixed\",\n left: `${position.left}px`,\n top: `${position.top}px`,\n }}\n >\n <div className=\"relative\">\n <Search className=\"variable-search-icon\" />\n <Input\n ref={inputRef}\n value={query}\n placeholder={labels.searchPlaceholder}\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={handleInputKeyDown}\n className=\"variable-search-input\"\n />\n </div>\n <div className=\"variable-search-list\">\n {filteredSystemVariables.length > 0 && (\n <div className=\"variable-search-section\">\n <p className=\"variable-search-section-title\">\n {labels.systemLabel}\n </p>\n {filteredSystemVariables.map((variable) => {\n const index = indexesByKey.get(`system-${variable.name}`) ?? -1;\n const isActive = highlightIndex === index;\n return (\n <button\n key={`system-${variable.name}`}\n type=\"button\"\n onClick={() => handleSelect(variable)}\n onMouseEnter={() => {\n if (index >= 0) {\n setHighlightIndex(index);\n }\n }}\n className={cn(\n \"variable-search-item\",\n isActive && \"variable-search-item-active\"\n )}\n >\n <span className=\"variable-search-item-name\">\n {variable.name}\n </span>\n {variable.label && (\n <span className=\"variable-search-item-label\">\n {variable.label}\n </span>\n )}\n </button>\n );\n })}\n </div>\n )}\n\n {filteredCustomVariables.length > 0 && (\n <div className=\"variable-search-section\">\n <p className=\"variable-search-section-title\">\n {labels.customLabel}\n </p>\n {filteredCustomVariables.map((variable) => {\n const index = indexesByKey.get(`custom-${variable.name}`) ?? -1;\n const isActive = highlightIndex === index;\n return (\n <button\n key={`custom-${variable.name}`}\n type=\"button\"\n onClick={() => handleSelect(variable)}\n onMouseEnter={() => {\n if (index >= 0) {\n setHighlightIndex(index);\n }\n }}\n className={cn(\n \"variable-search-item\",\n isActive && \"variable-search-item-active\"\n )}\n >\n <span className=\"variable-search-item-name\">\n {variable.name}\n </span>\n {variable.label && (\n <span className=\"variable-search-item-label\">\n {variable.label}\n </span>\n )}\n </button>\n );\n })}\n </div>\n )}\n\n {filteredSystemVariables.length === 0 &&\n filteredCustomVariables.length === 0 && (\n <div className=\"variable-search-empty\">{labels.emptyLabel}</div>\n )}\n </div>\n </div>\n );\n};\n\nexport default VariableSearchDropdown;\n"],"names":["VariableSearchDropdown","open","anchorElement","onClose","onSelect","variables","systemVariables","labels","containerRef","useRef","inputRef","query","setQuery","useState","position","setPosition","highlightIndex","setHighlightIndex","updatePosition","useCallback","rect","doc","view","width","desiredLeft","maxLeft","useEffect","focusTimer","handleClick","event","target","handleScroll","normalizedQuery","filterVariable","variable","nameMatch","labelMatch","filteredSystemVariables","useMemo","filteredCustomVariables","orderedItems","indexesByKey","map","item","index","handleSelect","handleInputKeyDown","prev","jsxs","jsx","Search","Input","isActive","cn"],"mappings":"kTA2BMA,EAAgE,CAAC,CACrE,KAAAC,EACA,cAAAC,EACA,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,OAAAC,CACF,IAAM,CACJ,MAAMC,EAAeC,EAAAA,OAA8B,IAAI,EACjDC,EAAWD,EAAAA,OAAgC,IAAI,EAC/C,CAACE,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAC/B,CAACC,EAAUC,CAAW,EAAIF,EAAAA,SAAS,CAAE,KAAM,EAAG,IAAK,EAAG,EACtD,CAACG,EAAgBC,CAAiB,EAAIJ,EAAAA,SAAS,EAAE,EAEjDK,EAAiBC,EAAAA,YAAY,IAAM,CACvC,GAAI,CAACjB,EAAe,OACpB,MAAMkB,EAAOlB,EAAc,sBAAA,EACrBmB,EAAMnB,EAAc,cACpBoB,EAAOD,EAAI,YACjB,GAAI,CAACC,EAAM,OACX,MAAMC,EAAQf,EAAa,SAAS,sBAAA,EAAwB,OAAS,EAC/DgB,EACJF,EAAK,iBAAiBpB,CAAa,EAAE,YAAc,MAC/CkB,EAAK,MAAQG,EACbH,EAAK,KACLK,EAAU,KAAK,IAAI,EAAGJ,EAAI,gBAAgB,YAAcE,EAAQ,CAAC,EACvER,EAAY,CACV,KAAM,KAAK,IAAI,KAAK,IAAI,EAAGS,CAAW,EAAGC,CAAO,EAChD,IAAKL,EAAK,OAAS,CAAA,CACpB,CACH,EAAG,CAAClB,CAAa,CAAC,EAElBwB,EAAAA,UAAU,IAAM,CACd,GAAI,CAACzB,EAAM,CACTW,EAAS,EAAE,EACXK,EAAkB,EAAE,EACpB,MACF,CACA,MAAMK,EAAO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B,EAAWpC,IAAmB4B,EACpC,OACEI,EAAAA,KAAC,SAAA,CAEC,KAAK,SACL,QAAS,IAAMH,EAAaX,CAAQ,EACpC,aAAc,IAAM,CACdU,GAAS,GACX3B,EAAkB2B,CAAK,CAE3B,EACA,UAAWS,EAAAA,GACT,uBACAD,GAAY,6BAAA,EAGd,SAAA,CAAAH,EAAAA,IAAC,OAAA,CAAK,UAAU,4BACb,SAAAf,EAAS,KACZ,EACCA,EAAS,OACRe,EAAAA,IAAC,QAAK,UAAU,6BACb,WAAS,KAAA,CACZ,CAAA,CAAA,EAnBG,UAAUf,EAAS,IAAI,EAAA,CAuBlC,CAAC,CAAA,EACH,EAGDG,EAAwB,SAAW,GAClCE,EAAwB,SAAW,GACjCU,EAAAA,IAAC,MAAA,CAAI,UAAU,wBAAyB,SAAA1C,EAAO,UAAA,CAAW,CAAA,CAAA,CAEhE,CAAA,CAAA,CAAA,EAvGK,IA0GX"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { Variable } from '../types.js';
|
|
3
|
-
interface VariableSearchDropdownProps {
|
|
4
|
-
open: boolean;
|
|
5
|
-
anchorElement: HTMLElement | null;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
onSelect: (variable: Variable) => void;
|
|
8
|
-
variables: Variable[];
|
|
9
|
-
systemVariables: Variable[];
|
|
10
|
-
labels: {
|
|
11
|
-
searchPlaceholder: string;
|
|
12
|
-
systemLabel: string;
|
|
13
|
-
customLabel: string;
|
|
14
|
-
emptyLabel: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
declare const VariableSearchDropdown: React.FC<VariableSearchDropdownProps>;
|
|
18
|
-
export default VariableSearchDropdown;
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as R, useState as L, useCallback as k, useEffect as V, useMemo as b } from "react";
|
|
3
|
-
import { Input as P } from "../../ui/input.es.js";
|
|
4
|
-
import { cn as z } from "../../../lib/utils.es.js";
|
|
5
|
-
import T from "../../../node_modules/lucide-react/dist/esm/icons/search.es.js";
|
|
6
|
-
const W = ({
|
|
7
|
-
open: m,
|
|
8
|
-
anchorElement: r,
|
|
9
|
-
onClose: l,
|
|
10
|
-
onSelect: D,
|
|
11
|
-
variables: M,
|
|
12
|
-
systemVariables: $,
|
|
13
|
-
labels: h
|
|
14
|
-
}) => {
|
|
15
|
-
const f = R(null), C = R(null), [A, E] = L(""), [S, B] = L({ left: 0, top: 0 }), [w, o] = L(-1), y = k(() => {
|
|
16
|
-
if (!r) return;
|
|
17
|
-
const e = r.getBoundingClientRect(), t = r.ownerDocument, s = t.defaultView;
|
|
18
|
-
if (!s) return;
|
|
19
|
-
const i = f.current?.getBoundingClientRect().width ?? 0, x = s.getComputedStyle(r).direction === "rtl" ? e.right - i : e.left, v = Math.max(8, t.documentElement.clientWidth - i - 8);
|
|
20
|
-
B({
|
|
21
|
-
left: Math.min(Math.max(8, x), v),
|
|
22
|
-
top: e.bottom + 8
|
|
23
|
-
});
|
|
24
|
-
}, [r]);
|
|
25
|
-
V(() => {
|
|
26
|
-
if (!m) {
|
|
27
|
-
E(""), o(-1);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const e = r?.ownerDocument.defaultView;
|
|
31
|
-
if (!e) return;
|
|
32
|
-
y();
|
|
33
|
-
const t = e.setTimeout(() => {
|
|
34
|
-
C.current?.focus();
|
|
35
|
-
}, 0), s = (x) => {
|
|
36
|
-
const v = x.target;
|
|
37
|
-
f.current && !f.current.contains(v) && r && !r.contains(v) && l();
|
|
38
|
-
}, i = () => y();
|
|
39
|
-
return e.addEventListener("mousedown", s), e.addEventListener("scroll", i, !0), e.addEventListener("resize", i), () => {
|
|
40
|
-
e.clearTimeout(t), e.removeEventListener("mousedown", s), e.removeEventListener("scroll", i, !0), e.removeEventListener("resize", i);
|
|
41
|
-
};
|
|
42
|
-
}, [m, r, l, y]);
|
|
43
|
-
const p = A.trim().toLowerCase(), g = k(
|
|
44
|
-
(e) => {
|
|
45
|
-
if (!p) return !0;
|
|
46
|
-
const t = e.name.toLowerCase().includes(p), s = e.label ? e.label.toLowerCase().includes(p) : !1;
|
|
47
|
-
return t || s;
|
|
48
|
-
},
|
|
49
|
-
[p]
|
|
50
|
-
), u = b(
|
|
51
|
-
() => $.filter(g),
|
|
52
|
-
[$, g]
|
|
53
|
-
), d = b(
|
|
54
|
-
() => M.filter(g),
|
|
55
|
-
[M, g]
|
|
56
|
-
), n = b(
|
|
57
|
-
() => [
|
|
58
|
-
...u.map((e) => ({
|
|
59
|
-
group: "system",
|
|
60
|
-
variable: e
|
|
61
|
-
})),
|
|
62
|
-
...d.map((e) => ({
|
|
63
|
-
group: "custom",
|
|
64
|
-
variable: e
|
|
65
|
-
}))
|
|
66
|
-
],
|
|
67
|
-
[u, d]
|
|
68
|
-
), I = b(() => {
|
|
69
|
-
const e = /* @__PURE__ */ new Map();
|
|
70
|
-
return n.forEach((t, s) => {
|
|
71
|
-
e.set(`${t.group}-${t.variable.name}`, s);
|
|
72
|
-
}), e;
|
|
73
|
-
}, [n]);
|
|
74
|
-
V(() => {
|
|
75
|
-
(!m || !n.length) && o(-1);
|
|
76
|
-
}, [m, n.length]);
|
|
77
|
-
const N = k(
|
|
78
|
-
(e) => {
|
|
79
|
-
D(e), l();
|
|
80
|
-
},
|
|
81
|
-
[l, D]
|
|
82
|
-
), K = (e) => {
|
|
83
|
-
if (!n.length) {
|
|
84
|
-
e.key === "Escape" && l();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (e.key === "ArrowDown")
|
|
88
|
-
e.preventDefault(), o((t) => (t + 1) % n.length);
|
|
89
|
-
else if (e.key === "ArrowUp")
|
|
90
|
-
e.preventDefault(), o(
|
|
91
|
-
(t) => t <= 0 ? n.length - 1 : t - 1
|
|
92
|
-
);
|
|
93
|
-
else if (e.key === "Enter") {
|
|
94
|
-
e.preventDefault();
|
|
95
|
-
const t = n[w];
|
|
96
|
-
t && N(t.variable);
|
|
97
|
-
} else e.key === "Escape" && (e.preventDefault(), l());
|
|
98
|
-
};
|
|
99
|
-
return m ? /* @__PURE__ */ c(
|
|
100
|
-
"div",
|
|
101
|
-
{
|
|
102
|
-
ref: f,
|
|
103
|
-
className: "markdown-flow-editor-variable-search",
|
|
104
|
-
style: {
|
|
105
|
-
position: "fixed",
|
|
106
|
-
left: `${S.left}px`,
|
|
107
|
-
top: `${S.top}px`
|
|
108
|
-
},
|
|
109
|
-
children: [
|
|
110
|
-
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
111
|
-
/* @__PURE__ */ a(T, { className: "variable-search-icon" }),
|
|
112
|
-
/* @__PURE__ */ a(
|
|
113
|
-
P,
|
|
114
|
-
{
|
|
115
|
-
ref: C,
|
|
116
|
-
value: A,
|
|
117
|
-
placeholder: h.searchPlaceholder,
|
|
118
|
-
onChange: (e) => E(e.target.value),
|
|
119
|
-
onKeyDown: K,
|
|
120
|
-
className: "variable-search-input"
|
|
121
|
-
}
|
|
122
|
-
)
|
|
123
|
-
] }),
|
|
124
|
-
/* @__PURE__ */ c("div", { className: "variable-search-list", children: [
|
|
125
|
-
u.length > 0 && /* @__PURE__ */ c("div", { className: "variable-search-section", children: [
|
|
126
|
-
/* @__PURE__ */ a("p", { className: "variable-search-section-title", children: h.systemLabel }),
|
|
127
|
-
u.map((e) => {
|
|
128
|
-
const t = I.get(`system-${e.name}`) ?? -1;
|
|
129
|
-
return /* @__PURE__ */ c(
|
|
130
|
-
"button",
|
|
131
|
-
{
|
|
132
|
-
type: "button",
|
|
133
|
-
onClick: () => N(e),
|
|
134
|
-
onMouseEnter: () => {
|
|
135
|
-
t >= 0 && o(t);
|
|
136
|
-
},
|
|
137
|
-
className: z(
|
|
138
|
-
"variable-search-item",
|
|
139
|
-
w === t && "variable-search-item-active"
|
|
140
|
-
),
|
|
141
|
-
children: [
|
|
142
|
-
/* @__PURE__ */ a("span", { className: "variable-search-item-name", children: e.name }),
|
|
143
|
-
e.label && /* @__PURE__ */ a("span", { className: "variable-search-item-label", children: e.label })
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
`system-${e.name}`
|
|
147
|
-
);
|
|
148
|
-
})
|
|
149
|
-
] }),
|
|
150
|
-
d.length > 0 && /* @__PURE__ */ c("div", { className: "variable-search-section", children: [
|
|
151
|
-
/* @__PURE__ */ a("p", { className: "variable-search-section-title", children: h.customLabel }),
|
|
152
|
-
d.map((e) => {
|
|
153
|
-
const t = I.get(`custom-${e.name}`) ?? -1;
|
|
154
|
-
return /* @__PURE__ */ c(
|
|
155
|
-
"button",
|
|
156
|
-
{
|
|
157
|
-
type: "button",
|
|
158
|
-
onClick: () => N(e),
|
|
159
|
-
onMouseEnter: () => {
|
|
160
|
-
t >= 0 && o(t);
|
|
161
|
-
},
|
|
162
|
-
className: z(
|
|
163
|
-
"variable-search-item",
|
|
164
|
-
w === t && "variable-search-item-active"
|
|
165
|
-
),
|
|
166
|
-
children: [
|
|
167
|
-
/* @__PURE__ */ a("span", { className: "variable-search-item-name", children: e.name }),
|
|
168
|
-
e.label && /* @__PURE__ */ a("span", { className: "variable-search-item-label", children: e.label })
|
|
169
|
-
]
|
|
170
|
-
},
|
|
171
|
-
`custom-${e.name}`
|
|
172
|
-
);
|
|
173
|
-
})
|
|
174
|
-
] }),
|
|
175
|
-
u.length === 0 && d.length === 0 && /* @__PURE__ */ a("div", { className: "variable-search-empty", children: h.emptyLabel })
|
|
176
|
-
] })
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
) : null;
|
|
180
|
-
};
|
|
181
|
-
export {
|
|
182
|
-
W as default
|
|
183
|
-
};
|
|
184
|
-
//# sourceMappingURL=VariableSearchDropdown.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VariableSearchDropdown.es.js","sources":["../../../../src/components/MarkdownFlowEditor/components/VariableSearchDropdown.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Search } from \"lucide-react\";\nimport { Variable } from \"../types\";\nimport { Input } from \"../../ui/input\";\nimport { cn } from \"../../../lib/utils\";\n\ninterface VariableSearchDropdownProps {\n open: boolean;\n anchorElement: HTMLElement | null;\n onClose: () => void;\n onSelect: (variable: Variable) => void;\n variables: Variable[];\n systemVariables: Variable[];\n labels: {\n searchPlaceholder: string;\n systemLabel: string;\n customLabel: string;\n emptyLabel: string;\n };\n}\n\nconst VariableSearchDropdown: React.FC<VariableSearchDropdownProps> = ({\n open,\n anchorElement,\n onClose,\n onSelect,\n variables,\n systemVariables,\n labels,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const [query, setQuery] = useState(\"\");\n const [position, setPosition] = useState({ left: 0, top: 0 });\n const [highlightIndex, setHighlightIndex] = useState(-1);\n\n const updatePosition = useCallback(() => {\n if (!anchorElement) return;\n const rect = anchorElement.getBoundingClientRect();\n const doc = anchorElement.ownerDocument;\n const view = doc.defaultView;\n if (!view) return;\n const width = containerRef.current?.getBoundingClientRect().width ?? 0;\n const desiredLeft =\n view.getComputedStyle(anchorElement).direction === \"rtl\"\n ? rect.right - width\n : rect.left;\n const maxLeft = Math.max(8, doc.documentElement.clientWidth - width - 8);\n setPosition({\n left: Math.min(Math.max(8, desiredLeft), maxLeft),\n top: rect.bottom + 8,\n });\n }, [anchorElement]);\n\n useEffect(() => {\n if (!open) {\n setQuery(\"\");\n setHighlightIndex(-1);\n return;\n }\n const view = anchorElement?.ownerDocument.defaultView;\n if (!view) return;\n updatePosition();\n const focusTimer = view.setTimeout(() => {\n inputRef.current?.focus();\n }, 0);\n const handleClick = (event: MouseEvent) => {\n const target = event.target as Node | null;\n if (\n containerRef.current &&\n !containerRef.current.contains(target) &&\n anchorElement &&\n !anchorElement.contains(target)\n ) {\n onClose();\n }\n };\n const handleScroll = () => updatePosition();\n view.addEventListener(\"mousedown\", handleClick);\n view.addEventListener(\"scroll\", handleScroll, true);\n view.addEventListener(\"resize\", handleScroll);\n\n return () => {\n view.clearTimeout(focusTimer);\n view.removeEventListener(\"mousedown\", handleClick);\n view.removeEventListener(\"scroll\", handleScroll, true);\n view.removeEventListener(\"resize\", handleScroll);\n };\n }, [open, anchorElement, onClose, updatePosition]);\n\n const normalizedQuery = query.trim().toLowerCase();\n const filterVariable = useCallback(\n (variable: Variable) => {\n if (!normalizedQuery) return true;\n const nameMatch = variable.name.toLowerCase().includes(normalizedQuery);\n const labelMatch = variable.label\n ? variable.label.toLowerCase().includes(normalizedQuery)\n : false;\n return nameMatch || labelMatch;\n },\n [normalizedQuery]\n );\n\n const filteredSystemVariables = useMemo(\n () => systemVariables.filter(filterVariable),\n [systemVariables, filterVariable]\n );\n const filteredCustomVariables = useMemo(\n () => variables.filter(filterVariable),\n [variables, filterVariable]\n );\n\n const orderedItems = useMemo(\n () => [\n ...filteredSystemVariables.map((variable) => ({\n group: \"system\" as const,\n variable,\n })),\n ...filteredCustomVariables.map((variable) => ({\n group: \"custom\" as const,\n variable,\n })),\n ],\n [filteredSystemVariables, filteredCustomVariables]\n );\n\n const indexesByKey = useMemo(() => {\n const map = new Map<string, number>();\n orderedItems.forEach((item, index) => {\n map.set(`${item.group}-${item.variable.name}`, index);\n });\n return map;\n }, [orderedItems]);\n\n useEffect(() => {\n if (!open || !orderedItems.length) {\n setHighlightIndex(-1);\n }\n }, [open, orderedItems.length]);\n\n const handleSelect = useCallback(\n (variable: Variable) => {\n onSelect(variable);\n onClose();\n },\n [onClose, onSelect]\n );\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (!orderedItems.length) {\n if (event.key === \"Escape\") {\n onClose();\n }\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n setHighlightIndex((prev) => (prev + 1) % orderedItems.length);\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n setHighlightIndex((prev) =>\n prev <= 0 ? orderedItems.length - 1 : prev - 1\n );\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n const item = orderedItems[highlightIndex];\n if (item) {\n handleSelect(item.variable);\n }\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n onClose();\n }\n };\n\n if (!open) {\n return null;\n }\n\n return (\n <div\n ref={containerRef}\n className=\"markdown-flow-editor-variable-search\"\n style={{\n position: \"fixed\",\n left: `${position.left}px`,\n top: `${position.top}px`,\n }}\n >\n <div className=\"relative\">\n <Search className=\"variable-search-icon\" />\n <Input\n ref={inputRef}\n value={query}\n placeholder={labels.searchPlaceholder}\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={handleInputKeyDown}\n className=\"variable-search-input\"\n />\n </div>\n <div className=\"variable-search-list\">\n {filteredSystemVariables.length > 0 && (\n <div className=\"variable-search-section\">\n <p className=\"variable-search-section-title\">\n {labels.systemLabel}\n </p>\n {filteredSystemVariables.map((variable) => {\n const index = indexesByKey.get(`system-${variable.name}`) ?? -1;\n const isActive = highlightIndex === index;\n return (\n <button\n key={`system-${variable.name}`}\n type=\"button\"\n onClick={() => handleSelect(variable)}\n onMouseEnter={() => {\n if (index >= 0) {\n setHighlightIndex(index);\n }\n }}\n className={cn(\n \"variable-search-item\",\n isActive && \"variable-search-item-active\"\n )}\n >\n <span className=\"variable-search-item-name\">\n {variable.name}\n </span>\n {variable.label && (\n <span className=\"variable-search-item-label\">\n {variable.label}\n </span>\n )}\n </button>\n );\n })}\n </div>\n )}\n\n {filteredCustomVariables.length > 0 && (\n <div className=\"variable-search-section\">\n <p className=\"variable-search-section-title\">\n {labels.customLabel}\n </p>\n {filteredCustomVariables.map((variable) => {\n const index = indexesByKey.get(`custom-${variable.name}`) ?? -1;\n const isActive = highlightIndex === index;\n return (\n <button\n key={`custom-${variable.name}`}\n type=\"button\"\n onClick={() => handleSelect(variable)}\n onMouseEnter={() => {\n if (index >= 0) {\n setHighlightIndex(index);\n }\n }}\n className={cn(\n \"variable-search-item\",\n isActive && \"variable-search-item-active\"\n )}\n >\n <span className=\"variable-search-item-name\">\n {variable.name}\n </span>\n {variable.label && (\n <span className=\"variable-search-item-label\">\n {variable.label}\n </span>\n )}\n </button>\n );\n })}\n </div>\n )}\n\n {filteredSystemVariables.length === 0 &&\n filteredCustomVariables.length === 0 && (\n <div className=\"variable-search-empty\">{labels.emptyLabel}</div>\n )}\n </div>\n </div>\n );\n};\n\nexport default VariableSearchDropdown;\n"],"names":["VariableSearchDropdown","open","anchorElement","onClose","onSelect","variables","systemVariables","labels","containerRef","useRef","inputRef","query","setQuery","useState","position","setPosition","highlightIndex","setHighlightIndex","updatePosition","useCallback","rect","doc","view","width","desiredLeft","maxLeft","useEffect","focusTimer","handleClick","event","target","handleScroll","normalizedQuery","filterVariable","variable","nameMatch","labelMatch","filteredSystemVariables","useMemo","filteredCustomVariables","orderedItems","indexesByKey","map","item","index","handleSelect","handleInputKeyDown","prev","jsxs","jsx","Search","Input","cn"],"mappings":";;;;;AA2BA,MAAMA,IAAgE,CAAC;AAAA,EACrE,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,QAAAC;AACF,MAAM;AACJ,QAAMC,IAAeC,EAA8B,IAAI,GACjDC,IAAWD,EAAgC,IAAI,GAC/C,CAACE,GAAOC,CAAQ,IAAIC,EAAS,EAAE,GAC/B,CAACC,GAAUC,CAAW,IAAIF,EAAS,EAAE,MAAM,GAAG,KAAK,GAAG,GACtD,CAACG,GAAgBC,CAAiB,IAAIJ,EAAS,EAAE,GAEjDK,IAAiBC,EAAY,MAAM;AACvC,QAAI,CAACjB,EAAe;AACpB,UAAMkB,IAAOlB,EAAc,sBAAA,GACrBmB,IAAMnB,EAAc,eACpBoB,IAAOD,EAAI;AACjB,QAAI,CAACC,EAAM;AACX,UAAMC,IAAQf,EAAa,SAAS,sBAAA,EAAwB,SAAS,GAC/DgB,IACJF,EAAK,i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BAE3B;AAAA,kBACA,WAAWQ;AAAA,oBACT;AAAA,oBAZWpC,MAAmB4B,KAalB;AAAA,kBAAA;AAAA,kBAGd,UAAA;AAAA,oBAAA,gBAAAK,EAAC,QAAA,EAAK,WAAU,6BACb,UAAAf,EAAS,MACZ;AAAA,oBACCA,EAAS,SACR,gBAAAe,EAAC,UAAK,WAAU,8BACb,YAAS,MAAA,CACZ;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAnBG,UAAUf,EAAS,IAAI;AAAA,cAAA;AAAA,YAuBlC,CAAC;AAAA,UAAA,GACH;AAAA,UAGDG,EAAwB,WAAW,KAClCE,EAAwB,WAAW,KACjC,gBAAAU,EAAC,OAAA,EAAI,WAAU,yBAAyB,UAAA1C,EAAO,WAAA,CAAW;AAAA,QAAA,EAAA,CAEhE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAvGK;AA0GX;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),a=require("react"),I=require("../../ui/input.cjs"),v=require("../../ui/button.cjs"),M=require("../../../lib/utils.cjs"),z=require("../../../_virtual/index.cjs"),Q=require("../../../node_modules/react-i18next/dist/es/useTranslation.cjs"),$=require("../../../node_modules/lucide-react/dist/esm/icons/search.cjs"),y=require("../../../node_modules/lucide-react/dist/esm/icons/check.cjs"),O=require("../../../node_modules/lucide-react/dist/esm/icons/x.cjs"),U=require("../../../node_modules/lucide-react/dist/esm/icons/plus.cjs"),D=[],Y=({variables:P,systemVariables:B,selectedName:r,onSelect:o,onAddVariable:L})=>{const{t}=Q.useTranslation(),i=P??D,R=B??D,[c,w]=a.useState(i);a.useEffect(()=>{w(i)},[i]);const d=R,[u,V]=a.useState(""),[T,m]=a.useState(!1),[S,x]=a.useState(""),[f,h]=a.useState(!1),[C,b]=a.useState(!1),p=()=>{h(!1),b(!1)},n=u.toLowerCase(),E=s=>{const A=s.name.toLowerCase().includes(n),l=s.label?s.label.toLowerCase().includes(n):!1;return A||l},g=a.useMemo(()=>d.filter(E),[d,n]),N=a.useMemo(()=>c.filter(E),[c,n]),_=g.length>0||N.length>0,k=()=>{const s=z.distExports.normalizeVariableName(S);if(!s){b(!0),h(!1);return}if([...c,...d].some(j=>z.distExports.normalizeVariableName(j.name)===s)){h(!0),b(!1);return}const l={name:s};w(j=>[l,...j]),L?.({name:s}),x(""),m(!1),V(""),p(),o?.(l)},q=()=>{m(!1),x(""),p()},F=s=>{x(s.target.value),(f||C)&&p()},K=s=>{s.key==="Enter"?k():s.key==="Escape"&&q()};return e.jsxs("div",{className:"w-full max-w-sm rounded-lg border bg-white",children:[e.jsxs("div",{className:"relative",children:[e.jsx($.default,{className:"absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(I.Input,{type:"text",placeholder:t("variableSearchPlaceholder","Search variable"),value:u,onChange:s=>V(s.target.value),className:"ps-8 h-8 border-0 focus-visible:ring-0 focus-visible:ring-offset-0"})]}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto p-2",children:_?e.jsxs("div",{className:"space-y-4",children:[g.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"px-3 text-xs font-medium text-muted-foreground",children:t("variableSectionSystem","System Variables")}),e.jsx("div",{className:"space-y-1",children:g.map(s=>e.jsxs("button",{onClick:()=>o?.(s),className:M.cn("flex w-full items-start justify-between rounded-md px-3 py-2 text-start transition-colors hover:bg-accent",r===s.name&&"bg-accent"),children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name}),s.label&&e.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]}),r===s.name&&e.jsx(y.default,{className:"mt-1 h-4 w-4 text-foreground"})]},`system-${s.name}`))})]}),N.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"px-3 text-xs font-medium text-muted-foreground",children:t("variableSectionCustom","Custom Variables")}),e.jsx("div",{className:"space-y-1",children:N.map(s=>e.jsxs("button",{onClick:()=>o?.(s),className:M.cn("flex w-full items-start justify-between rounded-md px-3 py-2 text-start transition-colors hover:bg-accent",r===s.name&&"bg-accent"),children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name}),s.label&&e.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]}),r===s.name&&e.jsx(y.default,{className:"mt-1 h-4 w-4 text-foreground"})]},`custom-${s.name}`))})]})]}):e.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:u?t("variableNotFound","No variables found"):t("variableEmpty","No variables yet")})}),e.jsx("div",{className:"border-t border-border p-2",children:T?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2",children:[e.jsx(I.Input,{type:"text",placeholder:t("variableNamePlaceholder","Variable name"),value:S,onChange:F,onKeyDown:K,autoFocus:!0,className:"h-8 flex-1 border-0 px-0 focus-visible:ring-0 focus-visible:ring-offset-0"}),e.jsx(v.Button,{variant:"ghost",size:"icon",onClick:q,className:"h-8 w-8 shrink-0 text-muted-foreground hover:text-foreground",children:e.jsx(O.default,{className:"h-4 w-4"})}),e.jsx(v.Button,{variant:"ghost",size:"icon",onClick:k,className:"h-8 w-8 shrink-0 text-muted-foreground hover:text-foreground",children:e.jsx(y.default,{className:"h-4 w-4"})})]}),(f||C)&&e.jsx("p",{className:"mt-1 px-3 text-xs text-red-500",children:f?t("variableAlreadyExists","Variable already exists"):t("variableNameInvalid","Use a non-empty name without control characters, line breaks, or }}")})]}):e.jsxs(v.Button,{variant:"ghost",size:"sm",onClick:()=>m(!0),className:"w-full justify-start text-muted-foreground hover:text-foreground",children:[e.jsx(U.default,{className:"me-2 h-4 w-4"}),t("variableAddNew","Add new variable")]})})]})};exports.default=Y;
|
|
2
|
-
//# sourceMappingURL=VariableSelect.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VariableSelect.cjs","sources":["../../../../src/components/MarkdownFlowEditor/components/VariableSelect.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { Search, Plus, Check, X } from \"lucide-react\";\nimport { Input } from \"../../ui/input\";\nimport { Button } from \"../../ui/button\";\nimport { cn } from \"../../../lib/utils\";\nimport { Variable } from \"../types\";\nimport { normalizeVariableName } from \"../utils\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface VariableSelectProps {\n variables?: Variable[];\n systemVariables?: Variable[];\n selectedName?: string;\n onSelect?: (variable: Variable) => void;\n onAddVariable?: (variable: Variable) => void;\n}\n\nconst EMPTY_VARIABLES: Variable[] = [];\n\nconst VariableSelect = ({\n variables: initialVariables,\n systemVariables: initialSystemVariables,\n selectedName,\n onSelect,\n onAddVariable,\n}: VariableSelectProps) => {\n const { t } = useTranslation();\n const safeInitialVariables = initialVariables ?? EMPTY_VARIABLES;\n const safeInitialSystemVariables = initialSystemVariables ?? EMPTY_VARIABLES;\n\n const [variables, setVariables] = useState<Variable[]>(safeInitialVariables);\n useEffect(() => {\n setVariables(safeInitialVariables);\n }, [safeInitialVariables]);\n const systemVariables = safeInitialSystemVariables;\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [isAddingNew, setIsAddingNew] = useState(false);\n const [newVariableName, setNewVariableName] = useState(\"\");\n const [duplicateError, setDuplicateError] = useState(false);\n const [invalidNameError, setInvalidNameError] = useState(false);\n const resetErrors = () => {\n setDuplicateError(false);\n setInvalidNameError(false);\n };\n const normalizedSearch = searchQuery.toLowerCase();\n const filterPredicate = (variable: Variable) => {\n const nameMatch = variable.name.toLowerCase().includes(normalizedSearch);\n const labelMatch = variable.label\n ? variable.label.toLowerCase().includes(normalizedSearch)\n : false;\n return nameMatch || labelMatch;\n };\n\n const filteredSystemVariables = useMemo(\n () => systemVariables.filter(filterPredicate),\n [systemVariables, normalizedSearch]\n );\n const filteredCustomVariables = useMemo(\n () => variables.filter(filterPredicate),\n [variables, normalizedSearch]\n );\n const hasAnyResult =\n filteredSystemVariables.length > 0 || filteredCustomVariables.length > 0;\n\n const handleAddVariable = () => {\n const inputValue = normalizeVariableName(newVariableName);\n if (!inputValue) {\n setInvalidNameError(true);\n setDuplicateError(false);\n return;\n }\n\n const isDuplicate = [...variables, ...systemVariables].some(\n (v) => normalizeVariableName(v.name) === inputValue\n );\n\n if (isDuplicate) {\n setDuplicateError(true);\n setInvalidNameError(false);\n return;\n }\n\n const newVariable: Variable = {\n name: inputValue,\n };\n setVariables((prev) => [newVariable, ...prev]);\n onAddVariable?.({ name: inputValue });\n setNewVariableName(\"\");\n setIsAddingNew(false);\n setSearchQuery(\"\");\n resetErrors();\n onSelect?.(newVariable);\n };\n\n const handleCancelAdd = () => {\n setIsAddingNew(false);\n setNewVariableName(\"\");\n resetErrors();\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setNewVariableName(e.target.value);\n if (duplicateError || invalidNameError) {\n resetErrors();\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\") {\n handleAddVariable();\n } else if (e.key === \"Escape\") {\n handleCancelAdd();\n }\n };\n return (\n <div className=\"w-full max-w-sm rounded-lg border bg-white\">\n <div className=\"relative\">\n <Search className=\"absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground\" />\n <Input\n type=\"text\"\n placeholder={t(\"variableSearchPlaceholder\", \"Search variable\")}\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"ps-8 h-8 border-0 focus-visible:ring-0 focus-visible:ring-offset-0\"\n />\n </div>\n\n <div className=\"max-h-[300px] overflow-y-auto p-2\">\n {hasAnyResult ? (\n <div className=\"space-y-4\">\n {filteredSystemVariables.length > 0 && (\n <div className=\"space-y-1\">\n <p className=\"px-3 text-xs font-medium text-muted-foreground\">\n {t(\"variableSectionSystem\", \"System Variables\")}\n </p>\n <div className=\"space-y-1\">\n {filteredSystemVariables.map((variable) => (\n <button\n key={`system-${variable.name}`}\n onClick={() => onSelect?.(variable)}\n className={cn(\n \"flex w-full items-start justify-between rounded-md px-3 py-2 text-start transition-colors hover:bg-accent\",\n selectedName === variable.name && \"bg-accent\"\n )}\n >\n <div className=\"flex flex-col\">\n <span className=\"text-sm font-medium text-foreground\">\n {variable.name}\n </span>\n {variable.label && (\n <span className=\"text-xs text-muted-foreground\">\n {variable.label}\n </span>\n )}\n </div>\n {selectedName === variable.name && (\n <Check className=\"mt-1 h-4 w-4 text-foreground\" />\n )}\n </button>\n ))}\n </div>\n </div>\n )}\n\n {filteredCustomVariables.length > 0 && (\n <div className=\"space-y-1\">\n <p className=\"px-3 text-xs font-medium text-muted-foreground\">\n {t(\"variableSectionCustom\", \"Custom Variables\")}\n </p>\n <div className=\"space-y-1\">\n {filteredCustomVariables.map((variable) => (\n <button\n key={`custom-${variable.name}`}\n onClick={() => onSelect?.(variable)}\n className={cn(\n \"flex w-full items-start justify-between rounded-md px-3 py-2 text-start transition-colors hover:bg-accent\",\n selectedName === variable.name && \"bg-accent\"\n )}\n >\n <div className=\"flex flex-col\">\n <span className=\"text-sm font-medium text-foreground\">\n {variable.name}\n </span>\n {variable.label && (\n <span className=\"text-xs text-muted-foreground\">\n {variable.label}\n </span>\n )}\n </div>\n {selectedName === variable.name && (\n <Check className=\"mt-1 h-4 w-4 text-foreground\" />\n )}\n </button>\n ))}\n </div>\n </div>\n )}\n </div>\n ) : (\n <div className=\"px-3 py-6 text-center text-sm text-muted-foreground\">\n {searchQuery\n ? t(\"variableNotFound\", \"No variables found\")\n : t(\"variableEmpty\", \"No variables yet\")}\n </div>\n )}\n </div>\n\n <div className=\"border-t border-border p-2\">\n {isAddingNew ? (\n <div>\n <div className=\"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2\">\n <Input\n type=\"text\"\n placeholder={t(\"variableNamePlaceholder\", \"Variable name\")}\n value={newVariableName}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n autoFocus\n className=\"h-8 flex-1 border-0 px-0 focus-visible:ring-0 focus-visible:ring-offset-0\"\n />\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={handleCancelAdd}\n className=\"h-8 w-8 shrink-0 text-muted-foreground hover:text-foreground\"\n >\n <X className=\"h-4 w-4\" />\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={handleAddVariable}\n className=\"h-8 w-8 shrink-0 text-muted-foreground hover:text-foreground\"\n >\n <Check className=\"h-4 w-4\" />\n </Button>\n </div>\n {(duplicateError || invalidNameError) && (\n <p className=\"mt-1 px-3 text-xs text-red-500\">\n {duplicateError\n ? t(\"variableAlreadyExists\", \"Variable already exists\")\n : t(\n \"variableNameInvalid\",\n \"Use a non-empty name without control characters, line breaks, or }}\"\n )}\n </p>\n )}\n </div>\n ) : (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setIsAddingNew(true)}\n className=\"w-full justify-start text-muted-foreground hover:text-foreground\"\n >\n <Plus className=\"me-2 h-4 w-4\" />\n {t(\"variableAddNew\", \"Add new variable\")}\n </Button>\n )}\n </div>\n </div>\n );\n};\nexport default VariableSelect;\n"],"names":["EMPTY_VARIABLES","VariableSelect","initialVariables","initialSystemVariables","selectedName","onSelect","onAddVariable","useTranslation","safeInitialVariables","safeInitialSystemVariables","variables","setVariables","useState","useEffect","systemVariables","searchQuery","setSearchQuery","isAddingNew","setIsAddingNew","newVariableName","setNewVariableName","duplicateError","setDuplicateError","invalidNameError","setInvalidNameError","resetErrors","normalizedSearch","filterPredicate","variable","nameMatch","labelMatch","filteredSystemVariables","useMemo","filteredCustomVariables","hasAnyResult","handleAddVariable","inputValue","normalizeVariableName","v","newVariable","prev","handleCancelAdd","handleInputChange","e","handleKeyDown","jsxs","jsx","Search","Input","cn","Check","Button","X","Plus"],"mappings":"8pBAiBMA,EAA8B,CAAA,EAE9BC,EAAiB,CAAC,CACtB,UAAWC,EACX,gBAAiBC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types.js';
|
|
3
|
-
interface VariableSelectProps {
|
|
4
|
-
variables?: Variable[];
|
|
5
|
-
systemVariables?: Variable[];
|
|
6
|
-
selectedName?: string;
|
|
7
|
-
onSelect?: (variable: Variable) => void;
|
|
8
|
-
onAddVariable?: (variable: Variable) => void;
|
|
9
|
-
}
|
|
10
|
-
declare const VariableSelect: ({ variables: initialVariables, systemVariables: initialSystemVariables, selectedName, onSelect, onAddVariable, }: VariableSelectProps) => React.JSX.Element;
|
|
11
|
-
export default VariableSelect;
|