@keboola/design 11.0.0 → 11.2.0
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/AGENTS.md +16 -1
- package/CHANGELOG.md +2138 -0
- package/COMPONENT-API.md +40 -1
- package/dist/AIKit-DiS0CVOW.js +1320 -0
- package/dist/AIKit-DiS0CVOW.js.map +1 -0
- package/dist/Alert-DfZq9kGe.js +133 -0
- package/dist/Alert-DfZq9kGe.js.map +1 -0
- package/dist/AlertModal-Dp_XuJBW.js +219 -0
- package/dist/AlertModal-Dp_XuJBW.js.map +1 -0
- package/dist/AppShell-B5GQN6Zs.js +143 -0
- package/dist/AppShell-B5GQN6Zs.js.map +1 -0
- package/dist/AutoSaveTextarea-BeuWuszr.js +58 -0
- package/dist/{chunk-UGT6DKWM.js.map → AutoSaveTextarea-BeuWuszr.js.map} +1 -1
- package/dist/Badge-Ch26CXoP.js +195 -0
- package/dist/Badge-Ch26CXoP.js.map +1 -0
- package/dist/BrandEditor-DyzgfVkl.js +903 -0
- package/dist/BrandEditor-DyzgfVkl.js.map +1 -0
- package/dist/BrandLogo-CJkRd0F8.js +46 -0
- package/dist/BrandLogo-CJkRd0F8.js.map +1 -0
- package/dist/Breadcrumb-Frst8MTA.js +330 -0
- package/dist/Breadcrumb-Frst8MTA.js.map +1 -0
- package/dist/Button-6xBX0nNl.js +391 -0
- package/dist/Button-6xBX0nNl.js.map +1 -0
- package/dist/Calendar-cG5NIJ4O.js +6768 -0
- package/dist/Calendar-cG5NIJ4O.js.map +1 -0
- package/dist/Card-BAoZ35CV.js +105 -0
- package/dist/Card-BAoZ35CV.js.map +1 -0
- package/dist/Checkbox-GJ8-srt4.js +97 -0
- package/dist/Checkbox-GJ8-srt4.js.map +1 -0
- package/dist/Clipboard-CBJZiviP.js +58 -0
- package/dist/Clipboard-CBJZiviP.js.map +1 -0
- package/dist/ClipboardButton-ClcluT0C.js +43 -0
- package/dist/ClipboardButton-ClcluT0C.js.map +1 -0
- package/dist/CodeEditor-DyaN-Ij2.js +1000 -0
- package/dist/CodeEditor-DyaN-Ij2.js.map +1 -0
- package/dist/Collapsible-BQXWEOBC.js +34 -0
- package/dist/Collapsible-BQXWEOBC.js.map +1 -0
- package/dist/ColorInput-B8z4j4Y_.js +180 -0
- package/dist/ColorInput-B8z4j4Y_.js.map +1 -0
- package/dist/ColorModeSwitch-dZFZyqy1.js +77 -0
- package/dist/ColorModeSwitch-dZFZyqy1.js.map +1 -0
- package/dist/Combobox-Dgm6Z4ib.js +443 -0
- package/dist/Combobox-Dgm6Z4ib.js.map +1 -0
- package/dist/Command-C0aZfVTq.js +102 -0
- package/dist/Command-C0aZfVTq.js.map +1 -0
- package/dist/CopyField-BJ96zvXs.js +322 -0
- package/dist/CopyField-BJ96zvXs.js.map +1 -0
- package/dist/DateInput-B3UdzRfW.js +141 -0
- package/dist/DateInput-B3UdzRfW.js.map +1 -0
- package/dist/DatePicker-Dw3DpbUh.js +24 -0
- package/dist/DatePicker-Dw3DpbUh.js.map +1 -0
- package/dist/DateRangeInput-DTuySEiq.js +139 -0
- package/dist/DateRangeInput-DTuySEiq.js.map +1 -0
- package/dist/DateRangePicker-DCmMHg4s.js +159 -0
- package/dist/DateRangePicker-DCmMHg4s.js.map +1 -0
- package/dist/DiagramSkeleton-lwBS2YBa.js +11 -0
- package/dist/DiagramSkeleton-lwBS2YBa.js.map +1 -0
- package/dist/DiffView-ppTIzh2h.js +429 -0
- package/dist/DiffView-ppTIzh2h.js.map +1 -0
- package/dist/DropdownMenu-t90tVw6l.js +327 -0
- package/dist/DropdownMenu-t90tVw6l.js.map +1 -0
- package/dist/FieldBox-D7DYtX_m.js +70 -0
- package/dist/FieldBox-D7DYtX_m.js.map +1 -0
- package/dist/FieldItem-CAPj9lj3.d.ts +111 -0
- package/dist/FieldItem-D-h1NeBo.js +108 -0
- package/dist/FieldItem-D-h1NeBo.js.map +1 -0
- package/dist/FileUpload-BRv0TaZk.js +2527 -0
- package/dist/FileUpload-BRv0TaZk.js.map +1 -0
- package/dist/Form-DHvcFoEi.js +311 -0
- package/dist/Form-DHvcFoEi.js.map +1 -0
- package/dist/FormGroup-C41n65cE.js +124 -0
- package/dist/FormGroup-C41n65cE.js.map +1 -0
- package/dist/FullScreenModal-Cb3PGgh4.js +96 -0
- package/dist/FullScreenModal-Cb3PGgh4.js.map +1 -0
- package/dist/HoverCard-WfDkLK1s.js +31 -0
- package/dist/HoverCard-WfDkLK1s.js.map +1 -0
- package/dist/InputGroup-CdTq8H7c.js +292 -0
- package/dist/InputGroup-CdTq8H7c.js.map +1 -0
- package/dist/Kbd-CxHAo1oo.js +111 -0
- package/dist/Kbd-CxHAo1oo.js.map +1 -0
- package/dist/MarkedText-Ckbft5mw.js +44 -0
- package/dist/MarkedText-Ckbft5mw.js.map +1 -0
- package/dist/MermaidDiagram-ChL3WIQT.js +399 -0
- package/dist/MermaidDiagram-ChL3WIQT.js.map +1 -0
- package/dist/Modal-wqG8nJiK.js +185 -0
- package/dist/Modal-wqG8nJiK.js.map +1 -0
- package/dist/ModalTitle-C76ke2eo.js +28 -0
- package/dist/ModalTitle-C76ke2eo.js.map +1 -0
- package/dist/MultiActionButtonGroup-BiIIubiL.js +33 -0
- package/dist/MultiActionButtonGroup-BiIIubiL.js.map +1 -0
- package/dist/Navbar-BfaPeLUL.js +325 -0
- package/dist/Navbar-BfaPeLUL.js.map +1 -0
- package/dist/OtpInput-CbbymqYs.js +93 -0
- package/dist/OtpInput-CbbymqYs.js.map +1 -0
- package/dist/PageHeader-Q3IpCnQd.js +177 -0
- package/dist/PageHeader-Q3IpCnQd.js.map +1 -0
- package/dist/PageLayout-DSVM-ASz.js +176 -0
- package/dist/PageLayout-DSVM-ASz.js.map +1 -0
- package/dist/PageToolbar-OQg3mPF-.js +153 -0
- package/dist/PageToolbar-OQg3mPF-.js.map +1 -0
- package/dist/Pagination-Cjfda8KG.js +70 -0
- package/dist/Pagination-Cjfda8KG.js.map +1 -0
- package/dist/Popconfirm-D7_vfxFd.js +167 -0
- package/dist/Popconfirm-D7_vfxFd.js.map +1 -0
- package/dist/Popover-CzeHjvrB.js +85 -0
- package/dist/Popover-CzeHjvrB.js.map +1 -0
- package/dist/RadioGroup-sIveSsNa.js +233 -0
- package/dist/RadioGroup-sIveSsNa.js.map +1 -0
- package/dist/Resizable-D3vYToZH.js +52 -0
- package/dist/Resizable-D3vYToZH.js.map +1 -0
- package/dist/Search-3UiqNZRj.js +184 -0
- package/dist/Search-3UiqNZRj.js.map +1 -0
- package/dist/SearchInput-C7dF_Ir-.js +102 -0
- package/dist/SearchInput-C7dF_Ir-.js.map +1 -0
- package/dist/SectionNav-8NoTOKO8.js +276 -0
- package/dist/SectionNav-8NoTOKO8.js.map +1 -0
- package/dist/Select-Is0VkePH.js +181 -0
- package/dist/Select-Is0VkePH.js.map +1 -0
- package/dist/Sheet-Dw9BDvjI.js +169 -0
- package/dist/Sheet-Dw9BDvjI.js.map +1 -0
- package/dist/Sidebar-Dcb4rinA.js +799 -0
- package/dist/Sidebar-Dcb4rinA.js.map +1 -0
- package/dist/Slider-BOPfMOMm.js +127 -0
- package/dist/Slider-BOPfMOMm.js.map +1 -0
- package/dist/Stepper-C8sm9ZFM.js +325 -0
- package/dist/Stepper-C8sm9ZFM.js.map +1 -0
- package/dist/Switch-CX2A0v50.js +201 -0
- package/dist/Switch-CX2A0v50.js.map +1 -0
- package/dist/Table-CvYuTuNU.js +104 -0
- package/dist/Table-CvYuTuNU.js.map +1 -0
- package/dist/Tabs-UMQuDoW8.js +74 -0
- package/dist/Tabs-UMQuDoW8.js.map +1 -0
- package/dist/TextInput-CMuN1WfY.js +110 -0
- package/dist/TextInput-CMuN1WfY.js.map +1 -0
- package/dist/ThemeProvider-QncUrfJn.js +203 -0
- package/dist/ThemeProvider-QncUrfJn.js.map +1 -0
- package/dist/TimePicker-D9zktB8A.js +98 -0
- package/dist/TimePicker-D9zktB8A.js.map +1 -0
- package/dist/Timeline-6btyJl4D.js +154 -0
- package/dist/Timeline-6btyJl4D.js.map +1 -0
- package/dist/Toast-DQSbs3oA.js +49 -0
- package/dist/Toast-DQSbs3oA.js.map +1 -0
- package/dist/ToggleGroup-Cy_10Mvu.js +47 -0
- package/dist/ToggleGroup-Cy_10Mvu.js.map +1 -0
- package/dist/Workbench-BzE-Vvd9.js +293 -0
- package/dist/Workbench-BzE-Vvd9.js.map +1 -0
- package/dist/ZoomableSvg-CZEu6sAq.js +248 -0
- package/dist/ZoomableSvg-CZEu6sAq.js.map +1 -0
- package/dist/charts.d.ts +110 -103
- package/dist/charts.js +303 -254
- package/dist/charts.js.map +1 -1
- package/dist/classNames-BzrkDnOD.js +9 -0
- package/dist/classNames-BzrkDnOD.js.map +1 -0
- package/dist/context-KxxeMHbR.js +62 -0
- package/dist/context-KxxeMHbR.js.map +1 -0
- package/dist/editors.d.ts +244 -175
- package/dist/editors.js +802 -428
- package/dist/editors.js.map +1 -1
- package/dist/escapeStringRegexp-8MxP2knR.js +6 -0
- package/dist/escapeStringRegexp-8MxP2knR.js.map +1 -0
- package/dist/icons-Cek151jC.js +640 -0
- package/dist/icons-Cek151jC.js.map +1 -0
- package/dist/icons.d.ts +2 -41
- package/dist/icons.js +2 -9
- package/dist/index-m-kQEWiY.d.ts +54 -0
- package/dist/index.d.ts +6191 -9891
- package/dist/index.js +113 -124
- package/dist/internal/blocks/AIKit.js +2 -30
- package/dist/internal/blocks/AppShell.js +2 -11
- package/dist/internal/blocks/AutoSaveTextarea.js +2 -14
- package/dist/internal/blocks/BrandEditor.js +2 -23
- package/dist/internal/blocks/ChartPanel.js +45 -9
- package/dist/internal/blocks/ChartPanel.js.map +1 -1
- package/dist/internal/blocks/ClipboardButton.js +2 -12
- package/dist/internal/blocks/ColorInput.js +2 -13
- package/dist/internal/blocks/ColorModeSwitch.js +2 -13
- package/dist/internal/blocks/Command.js +2 -15
- package/dist/internal/blocks/CopyField.js +2 -11
- package/dist/internal/blocks/DashboardHero.js +58 -8
- package/dist/internal/blocks/DashboardHero.js.map +1 -1
- package/dist/internal/blocks/DateInput.js +2 -16
- package/dist/internal/blocks/DateRangeInput.js +2 -16
- package/dist/internal/blocks/EmptyConfigurationActionCard.js +15 -9
- package/dist/internal/blocks/EmptyConfigurationActionCard.js.map +1 -1
- package/dist/internal/blocks/EmptyState.js +141 -3
- package/dist/internal/blocks/EmptyState.js.map +1 -1
- package/dist/internal/blocks/ErrorState.js +178 -4
- package/dist/internal/blocks/ErrorState.js.map +1 -1
- package/dist/internal/blocks/ExportMenu.js +40 -12
- package/dist/internal/blocks/ExportMenu.js.map +1 -1
- package/dist/internal/blocks/Form/connectors/MultiComboboxField.js +56 -0
- package/dist/internal/blocks/Form/connectors/MultiComboboxField.js.map +1 -0
- package/dist/internal/blocks/Form.js +2 -29
- package/dist/internal/blocks/FormGroup.js +2 -18
- package/dist/internal/blocks/GoogleButton.js +94 -9
- package/dist/internal/blocks/GoogleButton.js.map +1 -1
- package/dist/internal/blocks/MicrosoftButton.js +63 -9
- package/dist/internal/blocks/MicrosoftButton.js.map +1 -1
- package/dist/internal/blocks/MultiActionButtonGroup.js +2 -12
- package/dist/internal/blocks/MultiCombobox.js +192 -13
- package/dist/internal/blocks/MultiCombobox.js.map +1 -1
- package/dist/internal/blocks/NumberInput.js +43 -11
- package/dist/internal/blocks/NumberInput.js.map +1 -1
- package/dist/internal/blocks/OtpInput.js +2 -10
- package/dist/internal/blocks/PageHeader.js +2 -9
- package/dist/internal/blocks/PageLayout.js +2 -9
- package/dist/internal/blocks/PageToolbar.js +2 -13
- package/dist/internal/blocks/PasswordInput.js +96 -12
- package/dist/internal/blocks/PasswordInput.js.map +1 -1
- package/dist/internal/blocks/SearchInput.js +2 -12
- package/dist/internal/blocks/SearchInputWithNavigation.js +64 -15
- package/dist/internal/blocks/SearchInputWithNavigation.js.map +1 -1
- package/dist/internal/blocks/SectionNav.js +2 -15
- package/dist/internal/blocks/SplitButton.js +45 -13
- package/dist/internal/blocks/SplitButton.js.map +1 -1
- package/dist/internal/blocks/StatCard.js +96 -9
- package/dist/internal/blocks/StatCard.js.map +1 -1
- package/dist/internal/blocks/TextInput.js +2 -13
- package/dist/internal/blocks/Textarea.js +31 -12
- package/dist/internal/blocks/Textarea.js.map +1 -1
- package/dist/internal/blocks/TimeInput.js +76 -16
- package/dist/internal/blocks/TimeInput.js.map +1 -1
- package/dist/internal/components/Alert.js +2 -11
- package/dist/internal/components/AlertModal.js +2 -11
- package/dist/internal/components/Avatar.js +52 -8
- package/dist/internal/components/Avatar.js.map +1 -1
- package/dist/internal/components/Badge.js +2 -9
- package/dist/internal/components/BrandLogo.js +2 -11
- package/dist/internal/components/Breadcrumb.js +2 -14
- package/dist/internal/components/Button.js +2 -10
- package/dist/internal/components/ButtonGroup.js +65 -8
- package/dist/internal/components/ButtonGroup.js.map +1 -1
- package/dist/internal/components/Calendar.js +2 -9
- package/dist/internal/components/Card.js +2 -9
- package/dist/internal/components/Checkbox.js +2 -11
- package/dist/internal/components/Clipboard.js +2 -9
- package/dist/internal/components/Collapsible.js +2 -9
- package/dist/internal/components/CollapsiblePanel.js +86 -10
- package/dist/internal/components/CollapsiblePanel.js.map +1 -1
- package/dist/internal/components/Combobox.js +2 -13
- package/dist/internal/components/DatePicker.js +2 -11
- package/dist/internal/components/DateRangePicker.js +2 -17
- package/dist/internal/components/DiffView.js +2 -9
- package/dist/internal/components/DotsLoader.js +17 -4
- package/dist/internal/components/DotsLoader.js.map +1 -1
- package/dist/internal/components/DropdownMenu.js +2 -11
- package/dist/internal/components/EmptySearchContent.js +11 -3
- package/dist/internal/components/EmptySearchContent.js.map +1 -1
- package/dist/internal/components/FileUpload.js +2 -11
- package/dist/internal/components/FullScreenModal.js +2 -12
- package/dist/internal/components/HelpBlock.js +24 -3
- package/dist/internal/components/HelpBlock.js.map +1 -1
- package/dist/internal/components/HoverCard.js +2 -9
- package/dist/internal/components/InputGroup.js +2 -11
- package/dist/internal/components/Kbd.js +2 -9
- package/dist/internal/components/Label.js +38 -8
- package/dist/internal/components/Label.js.map +1 -1
- package/dist/internal/components/Link.js +21 -8
- package/dist/internal/components/Link.js.map +1 -1
- package/dist/internal/components/MarkedText.js +2 -5
- package/dist/internal/components/MergeEditor/ConflictStatus/ConflictStatusIndicator.js +19 -9
- package/dist/internal/components/MergeEditor/ConflictStatus/ConflictStatusIndicator.js.map +1 -1
- package/dist/internal/components/MergeEditor/PaneHeader.js +12 -3
- package/dist/internal/components/MergeEditor/PaneHeader.js.map +1 -1
- package/dist/internal/components/MergeEditor/constants.js +17 -3
- package/dist/internal/components/MergeEditor/constants.js.map +1 -1
- package/dist/internal/components/MergeEditor/useMergeDiff.js +2 -5
- package/dist/internal/components/Modal.js +2 -13
- package/dist/internal/components/Navbar.js +2 -14
- package/dist/internal/components/Pagination.js +2 -11
- package/dist/internal/components/PanelWithDetails.js +30 -10
- package/dist/internal/components/PanelWithDetails.js.map +1 -1
- package/dist/internal/components/Popconfirm.js +2 -12
- package/dist/internal/components/Popover.js +2 -9
- package/dist/internal/components/Progress.js +46 -8
- package/dist/internal/components/Progress.js.map +1 -1
- package/dist/internal/components/RadioGroup.js +2 -12
- package/dist/internal/components/Resizable.js +2 -9
- package/dist/internal/components/ScrollArea.js +41 -8
- package/dist/internal/components/ScrollArea.js.map +1 -1
- package/dist/internal/components/Search.js +2 -10
- package/dist/internal/components/Select.js +2 -12
- package/dist/internal/components/Separator.js +83 -8
- package/dist/internal/components/Separator.js.map +1 -1
- package/dist/internal/components/Sheet.js +2 -12
- package/dist/internal/components/Sidebar.js +2 -20
- package/dist/internal/components/Skeleton/Skeleton.js +38 -8
- package/dist/internal/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/internal/components/Skeleton/SkeletonList.js +40 -9
- package/dist/internal/components/Skeleton/SkeletonList.js.map +1 -1
- package/dist/internal/components/Slider.js +2 -11
- package/dist/internal/components/SpotlightBackdrop.js +131 -8
- package/dist/internal/components/SpotlightBackdrop.js.map +1 -1
- package/dist/internal/components/Stepper.js +2 -10
- package/dist/internal/components/Switch.js +2 -10
- package/dist/internal/components/Table.js +2 -10
- package/dist/internal/components/Tabs.js +2 -12
- package/dist/internal/components/ThemeProvider.js +3 -10
- package/dist/internal/components/TimePicker.js +2 -12
- package/dist/internal/components/Timeline.js +2 -10
- package/dist/internal/components/Toast.js +3 -11
- package/dist/internal/components/Toggle.js +168 -8
- package/dist/internal/components/Toggle.js.map +1 -1
- package/dist/internal/components/ToggleGroup.js +2 -9
- package/dist/internal/components/Tooltip.js +2 -8
- package/dist/internal/components/Truncated.js +44 -8
- package/dist/internal/components/Truncated.js.map +1 -1
- package/dist/internal/components/Workbench.js +2 -11
- package/dist/internal/components/ZoomableSvg.js +2 -13
- package/dist/internal/hooks/useAutosizeInput.js +76 -3
- package/dist/internal/hooks/useAutosizeInput.js.map +1 -1
- package/dist/internal/hooks/useScrollbarPosition.js +44 -4
- package/dist/internal/hooks/useScrollbarPosition.js.map +1 -1
- package/dist/internal/hooks/useStableCallback.js +28 -3
- package/dist/internal/hooks/useStableCallback.js.map +1 -1
- package/dist/internal/utils/mergeRefs.js +19 -3
- package/dist/internal/utils/mergeRefs.js.map +1 -1
- package/dist/internal/utils.js +5 -8
- package/dist/markdown-editor.d.ts +72 -72
- package/dist/markdown-editor.js +1122 -1207
- package/dist/markdown-editor.js.map +1 -1
- package/dist/mermaid.d.ts +12 -12
- package/dist/mermaid.js +2 -18
- package/dist/rjsf.d.ts +45 -34
- package/dist/rjsf.js +1601 -1671
- package/dist/rjsf.js.map +1 -1
- package/dist/rolldown-runtime-Bdc48AWt.js +33 -0
- package/dist/styles-DSUP_-9Z.js +158 -0
- package/dist/styles-DSUP_-9Z.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/testing.d.ts +8 -7
- package/dist/testing.js +36 -21
- package/dist/testing.js.map +1 -1
- package/dist/themeTokens-BNg98Mu9.js +85 -0
- package/dist/themeTokens-BNg98Mu9.js.map +1 -0
- package/dist/toast-CjkURw0M.js +184 -0
- package/dist/toast-CjkURw0M.js.map +1 -0
- package/dist/useColorSchemeState-CYqcUfSH.js +61 -0
- package/dist/useColorSchemeState-CYqcUfSH.js.map +1 -0
- package/dist/useControllableState-M6494mCT.js +31 -0
- package/dist/useControllableState-M6494mCT.js.map +1 -0
- package/dist/useElement-DkF6esWL.js +15 -0
- package/dist/useElement-DkF6esWL.js.map +1 -0
- package/dist/useMergeDiff-CvowEXJ1.js +465 -0
- package/dist/useMergeDiff-CvowEXJ1.js.map +1 -0
- package/dist/utils-D0c5VAyF.js +308 -0
- package/dist/utils-D0c5VAyF.js.map +1 -0
- package/package.json +11 -10
- package/dist/MermaidDiagram-ZU5KAVRT.js +0 -18
- package/dist/MermaidDiagram-ZU5KAVRT.js.map +0 -1
- package/dist/chunk-2YYJDKSP.js +0 -51
- package/dist/chunk-2YYJDKSP.js.map +0 -1
- package/dist/chunk-3P5UUCFI.js +0 -385
- package/dist/chunk-3P5UUCFI.js.map +0 -1
- package/dist/chunk-3QDFDDWZ.js +0 -99
- package/dist/chunk-3QDFDDWZ.js.map +0 -1
- package/dist/chunk-3W27OLK5.js +0 -15
- package/dist/chunk-3W27OLK5.js.map +0 -1
- package/dist/chunk-4FIZZONW.js +0 -40
- package/dist/chunk-4FIZZONW.js.map +0 -1
- package/dist/chunk-4GIAXOJG.js +0 -133
- package/dist/chunk-4GIAXOJG.js.map +0 -1
- package/dist/chunk-52NDNMK7.js +0 -99
- package/dist/chunk-52NDNMK7.js.map +0 -1
- package/dist/chunk-576G5OES.js +0 -201
- package/dist/chunk-576G5OES.js.map +0 -1
- package/dist/chunk-5AIE6SET.js +0 -659
- package/dist/chunk-5AIE6SET.js.map +0 -1
- package/dist/chunk-5FTNAZRW.js +0 -327
- package/dist/chunk-5FTNAZRW.js.map +0 -1
- package/dist/chunk-5IG2S7ZY.js +0 -70
- package/dist/chunk-5IG2S7ZY.js.map +0 -1
- package/dist/chunk-5QCXHNCW.js +0 -404
- package/dist/chunk-5QCXHNCW.js.map +0 -1
- package/dist/chunk-6DUMGC7Y.js +0 -105
- package/dist/chunk-6DUMGC7Y.js.map +0 -1
- package/dist/chunk-6J25CVST.js +0 -174
- package/dist/chunk-6J25CVST.js.map +0 -1
- package/dist/chunk-6NN35XOP.js +0 -120
- package/dist/chunk-6NN35XOP.js.map +0 -1
- package/dist/chunk-6NZBVA4T.js +0 -24
- package/dist/chunk-6NZBVA4T.js.map +0 -1
- package/dist/chunk-6W5BHRCL.js +0 -295
- package/dist/chunk-6W5BHRCL.js.map +0 -1
- package/dist/chunk-72BKRCEG.js +0 -409
- package/dist/chunk-72BKRCEG.js.map +0 -1
- package/dist/chunk-7GTI3PPI.js +0 -95
- package/dist/chunk-7GTI3PPI.js.map +0 -1
- package/dist/chunk-7P6PLZ4B.js +0 -74
- package/dist/chunk-7P6PLZ4B.js.map +0 -1
- package/dist/chunk-7WZWY5IA.js +0 -46
- package/dist/chunk-7WZWY5IA.js.map +0 -1
- package/dist/chunk-AIYO2632.js +0 -489
- package/dist/chunk-AIYO2632.js.map +0 -1
- package/dist/chunk-ANFZWPNE.js +0 -112
- package/dist/chunk-ANFZWPNE.js.map +0 -1
- package/dist/chunk-ANZTVAJU.js +0 -73
- package/dist/chunk-ANZTVAJU.js.map +0 -1
- package/dist/chunk-BD5BTJKX.js +0 -166
- package/dist/chunk-BD5BTJKX.js.map +0 -1
- package/dist/chunk-BHGIDSRJ.js +0 -140
- package/dist/chunk-BHGIDSRJ.js.map +0 -1
- package/dist/chunk-BSQWZITZ.js +0 -507
- package/dist/chunk-BSQWZITZ.js.map +0 -1
- package/dist/chunk-D3LAIK62.js +0 -23
- package/dist/chunk-D3LAIK62.js.map +0 -1
- package/dist/chunk-DODCR43C.js +0 -155
- package/dist/chunk-DODCR43C.js.map +0 -1
- package/dist/chunk-EEK5NGZF.js +0 -40
- package/dist/chunk-EEK5NGZF.js.map +0 -1
- package/dist/chunk-ENRG7TXA.js +0 -11
- package/dist/chunk-ENRG7TXA.js.map +0 -1
- package/dist/chunk-EQRMGIGY.js +0 -239
- package/dist/chunk-EQRMGIGY.js.map +0 -1
- package/dist/chunk-ERAHK5YQ.js +0 -495
- package/dist/chunk-ERAHK5YQ.js.map +0 -1
- package/dist/chunk-F3FOFY2P.js +0 -124
- package/dist/chunk-F3FOFY2P.js.map +0 -1
- package/dist/chunk-F6BTWFOC.js +0 -507
- package/dist/chunk-F6BTWFOC.js.map +0 -1
- package/dist/chunk-F6J6NNAL.js +0 -34
- package/dist/chunk-F6J6NNAL.js.map +0 -1
- package/dist/chunk-FCHJ7D5O.js +0 -59
- package/dist/chunk-FCHJ7D5O.js.map +0 -1
- package/dist/chunk-FFJTEQCC.js +0 -80
- package/dist/chunk-FFJTEQCC.js.map +0 -1
- package/dist/chunk-FUFMVW7O.js +0 -64
- package/dist/chunk-FUFMVW7O.js.map +0 -1
- package/dist/chunk-FVPGQ6UE.js +0 -25
- package/dist/chunk-FVPGQ6UE.js.map +0 -1
- package/dist/chunk-G3PMV62Z.js +0 -33
- package/dist/chunk-G3PMV62Z.js.map +0 -1
- package/dist/chunk-GACFOW3E.js +0 -51
- package/dist/chunk-GACFOW3E.js.map +0 -1
- package/dist/chunk-GDT6HQMK.js +0 -42
- package/dist/chunk-GDT6HQMK.js.map +0 -1
- package/dist/chunk-HLGU22C6.js +0 -2589
- package/dist/chunk-HLGU22C6.js.map +0 -1
- package/dist/chunk-HPMYYGP7.js +0 -134
- package/dist/chunk-HPMYYGP7.js.map +0 -1
- package/dist/chunk-I2UCOD45.js +0 -197
- package/dist/chunk-I2UCOD45.js.map +0 -1
- package/dist/chunk-IEGDZUVM.js +0 -75
- package/dist/chunk-IEGDZUVM.js.map +0 -1
- package/dist/chunk-IIS7INHF.js +0 -47
- package/dist/chunk-IIS7INHF.js.map +0 -1
- package/dist/chunk-ITELSEFU.js +0 -256
- package/dist/chunk-ITELSEFU.js.map +0 -1
- package/dist/chunk-IXAYNBOY.js +0 -407
- package/dist/chunk-IXAYNBOY.js.map +0 -1
- package/dist/chunk-JUW2ETEI.js +0 -191
- package/dist/chunk-JUW2ETEI.js.map +0 -1
- package/dist/chunk-K65C7CVE.js +0 -127
- package/dist/chunk-K65C7CVE.js.map +0 -1
- package/dist/chunk-KDI64MCY.js +0 -189
- package/dist/chunk-KDI64MCY.js.map +0 -1
- package/dist/chunk-KN4ASMH5.js +0 -160
- package/dist/chunk-KN4ASMH5.js.map +0 -1
- package/dist/chunk-KQW7QNTU.js +0 -1549
- package/dist/chunk-KQW7QNTU.js.map +0 -1
- package/dist/chunk-KR7NXXHC.js +0 -66
- package/dist/chunk-KR7NXXHC.js.map +0 -1
- package/dist/chunk-KRZKIVMA.js +0 -142
- package/dist/chunk-KRZKIVMA.js.map +0 -1
- package/dist/chunk-KTTLLKGQ.js +0 -185
- package/dist/chunk-KTTLLKGQ.js.map +0 -1
- package/dist/chunk-KWKSHPDP.js +0 -234
- package/dist/chunk-KWKSHPDP.js.map +0 -1
- package/dist/chunk-KZVC7OYG.js +0 -57
- package/dist/chunk-KZVC7OYG.js.map +0 -1
- package/dist/chunk-L5DHUN2V.js +0 -204
- package/dist/chunk-L5DHUN2V.js.map +0 -1
- package/dist/chunk-LCTGEH57.js +0 -1376
- package/dist/chunk-LCTGEH57.js.map +0 -1
- package/dist/chunk-LXLIQ2D6.js +0 -12
- package/dist/chunk-LXLIQ2D6.js.map +0 -1
- package/dist/chunk-M4CTURKX.js +0 -84
- package/dist/chunk-M4CTURKX.js.map +0 -1
- package/dist/chunk-M6LTUPVP.js +0 -301
- package/dist/chunk-M6LTUPVP.js.map +0 -1
- package/dist/chunk-MA6RRHDT.js +0 -291
- package/dist/chunk-MA6RRHDT.js.map +0 -1
- package/dist/chunk-MODE4QIA.js +0 -6
- package/dist/chunk-MODE4QIA.js.map +0 -1
- package/dist/chunk-MVILMVGG.js +0 -118
- package/dist/chunk-MVILMVGG.js.map +0 -1
- package/dist/chunk-MWS4VCLV.js +0 -17
- package/dist/chunk-MWS4VCLV.js.map +0 -1
- package/dist/chunk-NEUX74SO.js +0 -315
- package/dist/chunk-NEUX74SO.js.map +0 -1
- package/dist/chunk-NFHKYBRD.js +0 -156
- package/dist/chunk-NFHKYBRD.js.map +0 -1
- package/dist/chunk-NHJNNXD3.js +0 -89
- package/dist/chunk-NHJNNXD3.js.map +0 -1
- package/dist/chunk-O2BF3HZL.js +0 -33
- package/dist/chunk-O2BF3HZL.js.map +0 -1
- package/dist/chunk-OANXCZYD.js +0 -212
- package/dist/chunk-OANXCZYD.js.map +0 -1
- package/dist/chunk-ODJF7YIP.js +0 -230
- package/dist/chunk-ODJF7YIP.js.map +0 -1
- package/dist/chunk-ON4BJTHI.js +0 -101
- package/dist/chunk-ON4BJTHI.js.map +0 -1
- package/dist/chunk-OTL5WXIJ.js +0 -16
- package/dist/chunk-OTL5WXIJ.js.map +0 -1
- package/dist/chunk-PACNBKJV.js +0 -47
- package/dist/chunk-PACNBKJV.js.map +0 -1
- package/dist/chunk-PROCA7K7.js +0 -23
- package/dist/chunk-PROCA7K7.js.map +0 -1
- package/dist/chunk-QGMIPA67.js +0 -85
- package/dist/chunk-QGMIPA67.js.map +0 -1
- package/dist/chunk-QQA37LFB.js +0 -190
- package/dist/chunk-QQA37LFB.js.map +0 -1
- package/dist/chunk-QZAWRSEB.js +0 -61
- package/dist/chunk-QZAWRSEB.js.map +0 -1
- package/dist/chunk-R74KGWNS.js +0 -699
- package/dist/chunk-R74KGWNS.js.map +0 -1
- package/dist/chunk-RFDLHMKL.js +0 -110
- package/dist/chunk-RFDLHMKL.js.map +0 -1
- package/dist/chunk-RL64HN7S.js +0 -40
- package/dist/chunk-RL64HN7S.js.map +0 -1
- package/dist/chunk-RMRQKPL7.js +0 -115
- package/dist/chunk-RMRQKPL7.js.map +0 -1
- package/dist/chunk-RQVK4IYC.js +0 -606
- package/dist/chunk-RQVK4IYC.js.map +0 -1
- package/dist/chunk-RTW56PWZ.js +0 -59
- package/dist/chunk-RTW56PWZ.js.map +0 -1
- package/dist/chunk-RUTPQNLR.js +0 -266
- package/dist/chunk-RUTPQNLR.js.map +0 -1
- package/dist/chunk-S6TAF63G.js +0 -25
- package/dist/chunk-S6TAF63G.js.map +0 -1
- package/dist/chunk-SBGAUGXY.js +0 -224
- package/dist/chunk-SBGAUGXY.js.map +0 -1
- package/dist/chunk-SC275NHZ.js +0 -407
- package/dist/chunk-SC275NHZ.js.map +0 -1
- package/dist/chunk-SCQPU4UE.js +0 -97
- package/dist/chunk-SCQPU4UE.js.map +0 -1
- package/dist/chunk-SFFF2WQP.js +0 -8
- package/dist/chunk-SFFF2WQP.js.map +0 -1
- package/dist/chunk-SJYMHZKA.js +0 -36
- package/dist/chunk-SJYMHZKA.js.map +0 -1
- package/dist/chunk-SLCCUJVN.js +0 -125
- package/dist/chunk-SLCCUJVN.js.map +0 -1
- package/dist/chunk-SVBSNSD4.js +0 -259
- package/dist/chunk-SVBSNSD4.js.map +0 -1
- package/dist/chunk-SVPLTL35.js +0 -62
- package/dist/chunk-SVPLTL35.js.map +0 -1
- package/dist/chunk-SWQFYNYG.js +0 -338
- package/dist/chunk-SWQFYNYG.js.map +0 -1
- package/dist/chunk-THHB4EWS.js +0 -72
- package/dist/chunk-THHB4EWS.js.map +0 -1
- package/dist/chunk-TUCDD33E.js +0 -246
- package/dist/chunk-TUCDD33E.js.map +0 -1
- package/dist/chunk-TV4WAP2R.js +0 -14
- package/dist/chunk-TV4WAP2R.js.map +0 -1
- package/dist/chunk-U3A6YBTZ.js +0 -134
- package/dist/chunk-U3A6YBTZ.js.map +0 -1
- package/dist/chunk-UGT6DKWM.js +0 -95
- package/dist/chunk-VSERHUWD.js +0 -212
- package/dist/chunk-VSERHUWD.js.map +0 -1
- package/dist/chunk-VYG7BDXC.js +0 -49
- package/dist/chunk-VYG7BDXC.js.map +0 -1
- package/dist/chunk-WETKNYZX.js +0 -52
- package/dist/chunk-WETKNYZX.js.map +0 -1
- package/dist/chunk-WGG4AML3.js +0 -216
- package/dist/chunk-WGG4AML3.js.map +0 -1
- package/dist/chunk-WKAUEL6I.js +0 -30
- package/dist/chunk-WKAUEL6I.js.map +0 -1
- package/dist/chunk-WPOLA5CG.js +0 -81
- package/dist/chunk-WPOLA5CG.js.map +0 -1
- package/dist/chunk-WPVETCGJ.js +0 -254
- package/dist/chunk-WPVETCGJ.js.map +0 -1
- package/dist/chunk-WTSM3A7E.js +0 -13
- package/dist/chunk-WTSM3A7E.js.map +0 -1
- package/dist/chunk-WU3F2K3T.js +0 -148
- package/dist/chunk-WU3F2K3T.js.map +0 -1
- package/dist/chunk-WZZK2DTZ.js +0 -39
- package/dist/chunk-WZZK2DTZ.js.map +0 -1
- package/dist/chunk-X4IHLKRD.js +0 -42
- package/dist/chunk-X4IHLKRD.js.map +0 -1
- package/dist/chunk-XAHEXZJC.js +0 -80
- package/dist/chunk-XAHEXZJC.js.map +0 -1
- package/dist/chunk-XCYGJDUX.js +0 -31
- package/dist/chunk-XCYGJDUX.js.map +0 -1
- package/dist/chunk-Y4W3JORC.js +0 -104
- package/dist/chunk-Y4W3JORC.js.map +0 -1
- package/dist/chunk-YFZJ3ZLG.js +0 -1297
- package/dist/chunk-YFZJ3ZLG.js.map +0 -1
- package/dist/chunk-YI3WLXEN.js +0 -4387
- package/dist/chunk-YI3WLXEN.js.map +0 -1
- package/dist/chunk-ZBKFSPD3.js +0 -29
- package/dist/chunk-ZBKFSPD3.js.map +0 -1
- package/dist/chunk-ZOERRQ6A.js +0 -79
- package/dist/chunk-ZOERRQ6A.js.map +0 -1
- package/dist/chunk-ZSTGUKHU.js +0 -10
- package/dist/chunk-ZSTGUKHU.js.map +0 -1
- package/dist/chunk-ZUEHDL27.js +0 -65
- package/dist/chunk-ZUEHDL27.js.map +0 -1
- package/dist/constants-D3gaMY-W.d.ts +0 -39
- package/dist/icons.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/internal/blocks/AIKit.js.map +0 -1
- package/dist/internal/blocks/AppShell.js.map +0 -1
- package/dist/internal/blocks/AutoSaveTextarea.js.map +0 -1
- package/dist/internal/blocks/BrandEditor.js.map +0 -1
- package/dist/internal/blocks/ClipboardButton.js.map +0 -1
- package/dist/internal/blocks/ColorInput.js.map +0 -1
- package/dist/internal/blocks/ColorModeSwitch.js.map +0 -1
- package/dist/internal/blocks/Command.js.map +0 -1
- package/dist/internal/blocks/CopyField.js.map +0 -1
- package/dist/internal/blocks/DateInput.js.map +0 -1
- package/dist/internal/blocks/DateRangeInput.js.map +0 -1
- package/dist/internal/blocks/Form.js.map +0 -1
- package/dist/internal/blocks/FormGroup.js.map +0 -1
- package/dist/internal/blocks/MultiActionButtonGroup.js.map +0 -1
- package/dist/internal/blocks/OtpInput.js.map +0 -1
- package/dist/internal/blocks/PageHeader.js.map +0 -1
- package/dist/internal/blocks/PageLayout.js.map +0 -1
- package/dist/internal/blocks/PageToolbar.js.map +0 -1
- package/dist/internal/blocks/SearchInput.js.map +0 -1
- package/dist/internal/blocks/SectionNav.js.map +0 -1
- package/dist/internal/blocks/TextInput.js.map +0 -1
- package/dist/internal/components/Alert.js.map +0 -1
- package/dist/internal/components/AlertModal.js.map +0 -1
- package/dist/internal/components/Badge.js.map +0 -1
- package/dist/internal/components/BrandLogo.js.map +0 -1
- package/dist/internal/components/Breadcrumb.js.map +0 -1
- package/dist/internal/components/Button.js.map +0 -1
- package/dist/internal/components/Calendar.js.map +0 -1
- package/dist/internal/components/Card.js.map +0 -1
- package/dist/internal/components/Checkbox.js.map +0 -1
- package/dist/internal/components/Clipboard.js.map +0 -1
- package/dist/internal/components/Collapsible.js.map +0 -1
- package/dist/internal/components/Combobox.js.map +0 -1
- package/dist/internal/components/DatePicker.js.map +0 -1
- package/dist/internal/components/DateRangePicker.js.map +0 -1
- package/dist/internal/components/DiffView.js.map +0 -1
- package/dist/internal/components/DropdownMenu.js.map +0 -1
- package/dist/internal/components/FileUpload.js.map +0 -1
- package/dist/internal/components/FullScreenModal.js.map +0 -1
- package/dist/internal/components/HoverCard.js.map +0 -1
- package/dist/internal/components/InputGroup.js.map +0 -1
- package/dist/internal/components/Kbd.js.map +0 -1
- package/dist/internal/components/MarkedText.js.map +0 -1
- package/dist/internal/components/MergeEditor/useMergeDiff.js.map +0 -1
- package/dist/internal/components/Modal.js.map +0 -1
- package/dist/internal/components/Navbar.js.map +0 -1
- package/dist/internal/components/Pagination.js.map +0 -1
- package/dist/internal/components/Popconfirm.js.map +0 -1
- package/dist/internal/components/Popover.js.map +0 -1
- package/dist/internal/components/RadioGroup.js.map +0 -1
- package/dist/internal/components/Resizable.js.map +0 -1
- package/dist/internal/components/Search.js.map +0 -1
- package/dist/internal/components/Select.js.map +0 -1
- package/dist/internal/components/Sheet.js.map +0 -1
- package/dist/internal/components/Sidebar.js.map +0 -1
- package/dist/internal/components/Slider.js.map +0 -1
- package/dist/internal/components/Stepper.js.map +0 -1
- package/dist/internal/components/Switch.js.map +0 -1
- package/dist/internal/components/Table.js.map +0 -1
- package/dist/internal/components/Tabs.js.map +0 -1
- package/dist/internal/components/ThemeProvider.js.map +0 -1
- package/dist/internal/components/TimePicker.js.map +0 -1
- package/dist/internal/components/Timeline.js.map +0 -1
- package/dist/internal/components/Toast.js.map +0 -1
- package/dist/internal/components/ToggleGroup.js.map +0 -1
- package/dist/internal/components/Tooltip.js.map +0 -1
- package/dist/internal/components/Workbench.js.map +0 -1
- package/dist/internal/components/ZoomableSvg.js.map +0 -1
- package/dist/internal/utils.js.map +0 -1
- package/dist/mermaid.js.map +0 -1
package/dist/editors.js
CHANGED
|
@@ -1,441 +1,815 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { cn } from "./classNames-BzrkDnOD.js";
|
|
2
|
+
import { ChevronsLeft, ChevronsRight, X } from "./icons-Cek151jC.js";
|
|
3
|
+
import { Button } from "./Button-6xBX0nNl.js";
|
|
4
|
+
import { FieldItem, useFieldContext } from "./FieldItem-D-h1NeBo.js";
|
|
5
|
+
import { CHANGE_CLASS } from "./internal/components/MergeEditor/constants.js";
|
|
6
|
+
import { useStableCallback } from "./internal/hooks/useStableCallback.js";
|
|
7
|
+
import { resolveToken } from "./themeTokens-BNg98Mu9.js";
|
|
8
|
+
import { CodeEditor, LANGUAGE_MODES, buildBaseThemeStyles, buildBasicSetup, buildCanvasChrome, buildChromeStyles, buildCustomTheme, isLanguageMode, searchExtension, updateSearch, useThemedExtension, useTooltipsExtension, useVariableCompletion } from "./CodeEditor-DyaN-Ij2.js";
|
|
9
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Decoration, EditorView, GutterMarker, ViewPlugin, gutter, gutterLineClass } from "@codemirror/view";
|
|
12
|
+
import CodeMirror, { EditorView as EditorView$1, keymap as keymap$1 } from "@uiw/react-codemirror";
|
|
13
|
+
import colors from "@keboola/tailwind-config/colors";
|
|
14
|
+
import { installExtensions } from "@keboola/codemirror-lang-sql";
|
|
15
|
+
import { RangeSet, RangeSetBuilder, StateEffect, StateField } from "@codemirror/state";
|
|
16
|
+
import { defaultKeymap } from "@codemirror/commands";
|
|
17
|
+
//#region src/components/CodeEditor/activeQueryHighlight.ts
|
|
18
|
+
const activeQueryFirstLine = Decoration.line({ class: "cm-active-query cm-active-query-first" });
|
|
19
|
+
const activeQueryMiddleLine = Decoration.line({ class: "cm-active-query" });
|
|
20
|
+
const activeQueryLastLine = Decoration.line({ class: "cm-active-query cm-active-query-last" });
|
|
21
|
+
const activeQuerySingleLine = Decoration.line({ class: "cm-active-query cm-active-query-first cm-active-query-last" });
|
|
22
|
+
/**
|
|
23
|
+
* Given pre-computed query boundaries and a cursor position, find which query
|
|
24
|
+
* the cursor is in. Returns trimmed character offsets or null.
|
|
25
|
+
*/
|
|
26
|
+
const findActiveQueryRange = (doc, cursorPos, boundaries) => {
|
|
27
|
+
if (boundaries.length === 0) return null;
|
|
28
|
+
let match = boundaries[boundaries.length - 1];
|
|
29
|
+
for (const boundary of boundaries) if (cursorPos <= boundary.to) {
|
|
30
|
+
match = boundary;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
if (!match) return null;
|
|
34
|
+
const queryText = doc.slice(match.from, match.to);
|
|
35
|
+
const leadingWhitespace = queryText.length - queryText.trimStart().length;
|
|
36
|
+
const trailingWhitespace = queryText.length - queryText.trimEnd().length;
|
|
37
|
+
const trimmedStart = match.from + leadingWhitespace;
|
|
38
|
+
const trimmedEnd = match.to - trailingWhitespace;
|
|
39
|
+
if (trimmedStart >= trimmedEnd) return null;
|
|
40
|
+
return {
|
|
41
|
+
from: trimmedStart,
|
|
42
|
+
to: trimmedEnd
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Convert splitSqlQueries result (array of query strings that join back to the
|
|
47
|
+
* original doc) into character-offset boundaries.
|
|
48
|
+
*/
|
|
49
|
+
const computeBoundaries = (queries) => {
|
|
50
|
+
const boundaries = [];
|
|
51
|
+
let offset = 0;
|
|
52
|
+
for (const query of queries) {
|
|
53
|
+
boundaries.push({
|
|
54
|
+
from: offset,
|
|
55
|
+
to: offset + query.length
|
|
56
|
+
});
|
|
57
|
+
offset += query.length;
|
|
58
|
+
}
|
|
59
|
+
return boundaries;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Synchronously map cached boundaries through a changeset.
|
|
63
|
+
*
|
|
64
|
+
* Boundaries can outlive the document state they were computed from (the async
|
|
65
|
+
* re-parse in `scheduleDocParse` is debounced, so several edits may land
|
|
66
|
+
* before new boundaries are produced). When that happens a cached position
|
|
67
|
+
* can exceed the changeset's pre-change length and `ChangeSet.mapPos` throws
|
|
68
|
+
* `RangeError: Position X is out of range for changeset of length Y`.
|
|
69
|
+
*
|
|
70
|
+
* Clamp positions into the valid `[0, changes.length]` range before mapping
|
|
71
|
+
* and drop degenerate boundaries so the mapping is safe even with stale cache.
|
|
72
|
+
*/
|
|
73
|
+
const mapBoundariesThroughChanges = (boundaries, changes) => {
|
|
74
|
+
const prevLen = changes.length;
|
|
75
|
+
const mapped = [];
|
|
76
|
+
for (const b of boundaries) {
|
|
77
|
+
const from = changes.mapPos(Math.max(0, Math.min(b.from, prevLen)), -1);
|
|
78
|
+
const to = changes.mapPos(Math.max(0, Math.min(b.to, prevLen)), 1);
|
|
79
|
+
if (from < to) mapped.push({
|
|
80
|
+
from,
|
|
81
|
+
to
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return mapped;
|
|
85
|
+
};
|
|
86
|
+
const buildDecorations = (view, range) => {
|
|
87
|
+
const startLine = view.state.doc.lineAt(range.from).number;
|
|
88
|
+
const endLine = view.state.doc.lineAt(range.to).number;
|
|
89
|
+
const decorations = [];
|
|
90
|
+
for (let lineNum = startLine; lineNum <= endLine; lineNum++) {
|
|
91
|
+
const lineStart = view.state.doc.line(lineNum).from;
|
|
92
|
+
if (startLine === endLine) decorations.push(activeQuerySingleLine.range(lineStart));
|
|
93
|
+
else if (lineNum === startLine) decorations.push(activeQueryFirstLine.range(lineStart));
|
|
94
|
+
else if (lineNum === endLine) decorations.push(activeQueryLastLine.range(lineStart));
|
|
95
|
+
else decorations.push(activeQueryMiddleLine.range(lineStart));
|
|
96
|
+
}
|
|
97
|
+
return Decoration.set(decorations);
|
|
98
|
+
};
|
|
99
|
+
const activeQueryHighlight = (splitQueries) => {
|
|
100
|
+
return [ViewPlugin.fromClass(class {
|
|
101
|
+
decorations = Decoration.none;
|
|
102
|
+
debounceTimer = null;
|
|
103
|
+
seq = 0;
|
|
104
|
+
cachedDoc = "";
|
|
105
|
+
cachedBoundaries = [];
|
|
106
|
+
destroyed = false;
|
|
107
|
+
constructor(view) {
|
|
108
|
+
this.scheduleDocParse(view);
|
|
109
|
+
}
|
|
110
|
+
update(update) {
|
|
111
|
+
if (update.focusChanged && !update.view.hasFocus) {
|
|
112
|
+
this.decorations = Decoration.none;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (update.docChanged) {
|
|
116
|
+
if (this.cachedBoundaries.length > 0) {
|
|
117
|
+
this.cachedBoundaries = mapBoundariesThroughChanges(this.cachedBoundaries, update.changes);
|
|
118
|
+
this.cachedDoc = update.state.doc.toString();
|
|
119
|
+
this.updateFromCache(update.view);
|
|
120
|
+
}
|
|
121
|
+
this.scheduleDocParse(update.view);
|
|
122
|
+
} else if (update.selectionSet || update.focusChanged && update.view.hasFocus) this.updateFromCache(update.view);
|
|
123
|
+
}
|
|
124
|
+
destroy() {
|
|
125
|
+
this.destroyed = true;
|
|
126
|
+
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Update decorations using cached query boundaries.
|
|
130
|
+
* Only mutates this.decorations — does NOT call view.dispatch().
|
|
131
|
+
* When called from update() (sync), CodeMirror picks up the new
|
|
132
|
+
* decorations via the accessor. When called from the async
|
|
133
|
+
* scheduleDocParse callback, the caller must dispatch separately.
|
|
134
|
+
*/
|
|
135
|
+
updateFromCache(view) {
|
|
136
|
+
if (!view.hasFocus) {
|
|
137
|
+
this.decorations = Decoration.none;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const { main } = view.state.selection;
|
|
141
|
+
if (main.from !== main.to) {
|
|
142
|
+
this.decorations = Decoration.none;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const doc = view.state.doc.toString();
|
|
146
|
+
if (doc !== this.cachedDoc) return;
|
|
147
|
+
if (this.cachedBoundaries.length === 0) {
|
|
148
|
+
this.decorations = Decoration.none;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const range = findActiveQueryRange(doc, main.head, this.cachedBoundaries);
|
|
152
|
+
this.decorations = range ? buildDecorations(view, range) : Decoration.none;
|
|
153
|
+
}
|
|
154
|
+
/** Parse queries async (debounced) and update decorations. */
|
|
155
|
+
scheduleDocParse(view) {
|
|
156
|
+
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
157
|
+
this.debounceTimer = setTimeout(async () => {
|
|
158
|
+
const seq = ++this.seq;
|
|
159
|
+
const doc = view.state.doc.toString();
|
|
160
|
+
if (!doc.trim()) {
|
|
161
|
+
this.cachedDoc = doc;
|
|
162
|
+
this.cachedBoundaries = [];
|
|
163
|
+
if (this.decorations !== Decoration.none) {
|
|
164
|
+
this.decorations = Decoration.none;
|
|
165
|
+
if (!this.destroyed) view.dispatch();
|
|
166
|
+
}
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
let queries;
|
|
170
|
+
try {
|
|
171
|
+
queries = await splitQueries(doc);
|
|
172
|
+
} catch {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (this.destroyed || seq !== this.seq) return;
|
|
176
|
+
this.cachedDoc = doc;
|
|
177
|
+
this.cachedBoundaries = computeBoundaries(queries);
|
|
178
|
+
this.updateFromCache(view);
|
|
179
|
+
if (!this.destroyed) view.dispatch();
|
|
180
|
+
}, 100);
|
|
181
|
+
}
|
|
182
|
+
}, { decorations: (v) => v.decorations }), EditorView.baseTheme({
|
|
183
|
+
".cm-active-query": {
|
|
184
|
+
boxShadow: `inset -1px 0 0 0 ${colors.blue[300]}, inset 1px 0 0 0 ${colors.blue[300]}`,
|
|
185
|
+
marginRight: "8px"
|
|
186
|
+
},
|
|
187
|
+
".cm-active-query-first": {
|
|
188
|
+
boxShadow: `inset -1px 0 0 0 ${colors.blue[300]}, inset 1px 0 0 0 ${colors.blue[300]}, inset 0 1px 0 0 ${colors.blue[300]}`,
|
|
189
|
+
borderRadius: "4px 4px 0 0"
|
|
190
|
+
},
|
|
191
|
+
".cm-active-query-last": {
|
|
192
|
+
boxShadow: `inset -1px 0 0 0 ${colors.blue[300]}, inset 1px 0 0 0 ${colors.blue[300]}, inset 0 -1px 0 0 ${colors.blue[300]}`,
|
|
193
|
+
borderRadius: "0 0 4px 4px"
|
|
194
|
+
},
|
|
195
|
+
".cm-active-query-first.cm-active-query-last": {
|
|
196
|
+
boxShadow: `inset 0 0 0 1px ${colors.blue[300]}`,
|
|
197
|
+
borderRadius: "4px"
|
|
198
|
+
}
|
|
199
|
+
})];
|
|
200
|
+
};
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/components/CodeEditor/highlighting.ts
|
|
203
|
+
var HighlightMarker = class extends GutterMarker {
|
|
204
|
+
toDOM() {
|
|
205
|
+
const marker = document.createElement("div");
|
|
206
|
+
marker.className = "cm-highlight-marker";
|
|
207
|
+
return marker;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const highlightMarker = new HighlightMarker();
|
|
211
|
+
const forEachLineInRange = (doc, from, to, callback) => {
|
|
212
|
+
const results = [];
|
|
213
|
+
const fromLine = Math.max(1, from + 1);
|
|
214
|
+
const toLine = Math.min(doc.lines, to + 1);
|
|
215
|
+
for (let i = fromLine; i <= toLine; i++) {
|
|
216
|
+
const line = doc.line(i);
|
|
217
|
+
results.push(callback(line.from));
|
|
218
|
+
}
|
|
219
|
+
return results;
|
|
220
|
+
};
|
|
221
|
+
const setHighlightedLinesEffect = StateEffect.define();
|
|
222
|
+
const highlightedLinesField = StateField.define({
|
|
223
|
+
create() {
|
|
224
|
+
return null;
|
|
225
|
+
},
|
|
226
|
+
update(value, transaction) {
|
|
227
|
+
for (const effect of transaction.effects) if (effect.is(setHighlightedLinesEffect)) return effect.value;
|
|
228
|
+
return value;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
const highlightGutter = gutter({
|
|
232
|
+
class: "cm-highlight-gutter",
|
|
233
|
+
markers: (view) => {
|
|
234
|
+
const highlightInfo = view.state.field(highlightedLinesField, false);
|
|
235
|
+
if (!highlightInfo) return RangeSet.empty;
|
|
236
|
+
const markers = forEachLineInRange(view.state.doc, highlightInfo.from, highlightInfo.to, (lineFrom) => highlightMarker.range(lineFrom));
|
|
237
|
+
return RangeSet.of(markers);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
const errorLineDecorations = StateField.define({
|
|
241
|
+
create() {
|
|
242
|
+
return Decoration.none;
|
|
243
|
+
},
|
|
244
|
+
update(decorations, transaction) {
|
|
245
|
+
decorations = decorations.map(transaction.changes);
|
|
246
|
+
for (const effect of transaction.effects) {
|
|
247
|
+
if (!effect.is(setHighlightedLinesEffect)) continue;
|
|
248
|
+
if (!effect.value || !effect.value.error) return Decoration.none;
|
|
249
|
+
const decorationArray = forEachLineInRange(transaction.state.doc, effect.value.error.from, effect.value.error.to, (lineFrom) => Decoration.line({ class: "cm-error-line" }).range(lineFrom));
|
|
250
|
+
return Decoration.set(decorationArray);
|
|
251
|
+
}
|
|
252
|
+
return decorations;
|
|
253
|
+
},
|
|
254
|
+
provide: (f) => EditorView.decorations.from(f)
|
|
255
|
+
});
|
|
256
|
+
const processingLineDecorations = StateField.define({
|
|
257
|
+
create() {
|
|
258
|
+
return Decoration.none;
|
|
259
|
+
},
|
|
260
|
+
update(decorations, transaction) {
|
|
261
|
+
decorations = decorations.map(transaction.changes);
|
|
262
|
+
for (const effect of transaction.effects) {
|
|
263
|
+
if (!effect.is(setHighlightedLinesEffect)) continue;
|
|
264
|
+
if (!effect.value || !effect.value.processing) return Decoration.none;
|
|
265
|
+
const decorationArray = forEachLineInRange(transaction.state.doc, effect.value.processing.from, effect.value.processing.to, (lineFrom) => Decoration.line({ class: "cm-processing-line" }).range(lineFrom));
|
|
266
|
+
return Decoration.set(decorationArray);
|
|
267
|
+
}
|
|
268
|
+
return decorations;
|
|
269
|
+
},
|
|
270
|
+
provide: (f) => EditorView.decorations.from(f)
|
|
271
|
+
});
|
|
272
|
+
const highlightedLinesTheme = EditorView.baseTheme({
|
|
273
|
+
".cm-highlight-gutter": {
|
|
274
|
+
width: "2px",
|
|
275
|
+
marginRight: "2px"
|
|
276
|
+
},
|
|
277
|
+
".cm-highlight-marker": {
|
|
278
|
+
width: "2px",
|
|
279
|
+
height: "100%",
|
|
280
|
+
backgroundColor: colors.blue[500]
|
|
281
|
+
},
|
|
282
|
+
".cm-error-line": { backgroundColor: `${colors.error[100]} !important` },
|
|
283
|
+
".cm-processing-line": { backgroundColor: `${colors.blue[100]} !important` }
|
|
284
|
+
});
|
|
285
|
+
function highlightingExtension() {
|
|
286
|
+
return [
|
|
287
|
+
highlightedLinesField,
|
|
288
|
+
highlightGutter,
|
|
289
|
+
errorLineDecorations,
|
|
290
|
+
processingLineDecorations,
|
|
291
|
+
highlightedLinesTheme
|
|
292
|
+
];
|
|
293
|
+
}
|
|
294
|
+
function updateHighlighting(view, lines) {
|
|
295
|
+
view.dispatch({ effects: setHighlightedLinesEffect.of(lines ?? null) });
|
|
296
|
+
}
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/components/CodeEditor/SqlEditor.tsx
|
|
299
|
+
const OWN_KEYMAPS = {
|
|
300
|
+
defaultKeymap: false,
|
|
301
|
+
completionKeymap: false,
|
|
302
|
+
searchKeymap: false
|
|
30
303
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
304
|
+
const CUSTOM_KEYMAP = [{
|
|
305
|
+
key: "Escape",
|
|
306
|
+
stopPropagation: true,
|
|
307
|
+
run: (view) => {
|
|
308
|
+
view.contentDOM.blur();
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
}];
|
|
312
|
+
const OWN_KEYMAP_EXTENSION = keymap$1.of([...defaultKeymap, ...CUSTOM_KEYMAP]);
|
|
313
|
+
const buildTheme = () => ({
|
|
314
|
+
...buildBaseThemeStyles(),
|
|
315
|
+
...buildChromeStyles(buildCanvasChrome())
|
|
316
|
+
});
|
|
317
|
+
const SqlEditor = ({ value, onChange, onSelectionChange, onCreateEditor, onDestroyEditor, onBlurEditor, onFocusEditor, placeholder = "", searchQuery = "", searchMatchIndex, readOnly = false, queryParser, autoFocus = false, lineNumbers = true, className, schema, completionSource, variables, defaultDatabase, defaultSchema, highlightLines, dialect }) => {
|
|
318
|
+
const editorRef = useRef(null);
|
|
319
|
+
const handleChange = useStableCallback((next) => onChange?.(next));
|
|
320
|
+
const parseQueries = useStableCallback(async (sql) => await queryParser?.(sql) ?? []);
|
|
321
|
+
const handleBlur = useStableCallback((view) => onBlurEditor?.(view));
|
|
322
|
+
const handleFocus = useStableCallback((view) => onFocusEditor?.(view));
|
|
323
|
+
const handleUpdate = useStableCallback((update) => {
|
|
324
|
+
if (update.selectionSet) {
|
|
325
|
+
const { main } = update.state.selection;
|
|
326
|
+
onSelectionChange?.(update.state.sliceDoc(main.from, main.to));
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
const variableCompletion = useVariableCompletion(variables);
|
|
330
|
+
const withQueryParser = queryParser !== void 0;
|
|
331
|
+
const tooltipLayer = useTooltipsExtension();
|
|
332
|
+
const customTheme = useThemedExtension("editor:syntax", buildCustomTheme);
|
|
333
|
+
const themeExtension = useThemedExtension("sql-editor:chrome", () => EditorView$1.theme(buildTheme()));
|
|
334
|
+
const extensions = useMemo(() => {
|
|
335
|
+
return [
|
|
336
|
+
EditorView$1.lineWrapping,
|
|
337
|
+
OWN_KEYMAP_EXTENSION,
|
|
338
|
+
...installExtensions({
|
|
339
|
+
schema,
|
|
340
|
+
defaultDatabase,
|
|
341
|
+
defaultSchema,
|
|
342
|
+
variableCompletion,
|
|
343
|
+
completionSource,
|
|
344
|
+
dialect
|
|
345
|
+
}),
|
|
346
|
+
searchExtension(),
|
|
347
|
+
highlightingExtension(),
|
|
348
|
+
withQueryParser ? activeQueryHighlight(parseQueries) : [],
|
|
349
|
+
tooltipLayer,
|
|
350
|
+
themeExtension,
|
|
351
|
+
EditorView$1.domEventHandlers({
|
|
352
|
+
blur: (_, view) => handleBlur(view),
|
|
353
|
+
focus: (_, view) => handleFocus(view)
|
|
354
|
+
})
|
|
355
|
+
];
|
|
356
|
+
}, [
|
|
357
|
+
withQueryParser,
|
|
358
|
+
parseQueries,
|
|
359
|
+
schema,
|
|
360
|
+
completionSource,
|
|
361
|
+
defaultDatabase,
|
|
362
|
+
defaultSchema,
|
|
363
|
+
variableCompletion,
|
|
364
|
+
dialect,
|
|
365
|
+
handleBlur,
|
|
366
|
+
handleFocus,
|
|
367
|
+
themeExtension,
|
|
368
|
+
tooltipLayer
|
|
369
|
+
]);
|
|
370
|
+
const defaultSetup = useMemo(() => {
|
|
371
|
+
return {
|
|
372
|
+
...buildBasicSetup(readOnly),
|
|
373
|
+
...OWN_KEYMAPS,
|
|
374
|
+
lineNumbers
|
|
375
|
+
};
|
|
376
|
+
}, [readOnly, lineNumbers]);
|
|
377
|
+
useEffect(() => {
|
|
378
|
+
if (editorRef.current?.view) updateHighlighting(editorRef.current.view, highlightLines);
|
|
379
|
+
}, [highlightLines]);
|
|
380
|
+
useEffect(() => {
|
|
381
|
+
if (editorRef.current?.view) updateSearch(editorRef.current.view, searchQuery, searchMatchIndex);
|
|
382
|
+
}, [searchQuery, searchMatchIndex]);
|
|
383
|
+
const handleDestroy = useStableCallback(() => onDestroyEditor?.());
|
|
384
|
+
useEffect(() => handleDestroy, [handleDestroy]);
|
|
385
|
+
const handleCreate = useStableCallback((view, state) => {
|
|
386
|
+
onCreateEditor?.(view, state);
|
|
387
|
+
if (highlightLines) updateHighlighting(view, highlightLines);
|
|
388
|
+
if (searchQuery) updateSearch(view, searchQuery, searchMatchIndex);
|
|
389
|
+
});
|
|
390
|
+
return /* @__PURE__ */ jsx(CodeMirror, {
|
|
391
|
+
ref: editorRef,
|
|
392
|
+
theme: customTheme,
|
|
393
|
+
extensions,
|
|
394
|
+
value,
|
|
395
|
+
onChange: handleChange,
|
|
396
|
+
onUpdate: handleUpdate,
|
|
397
|
+
onCreateEditor: handleCreate,
|
|
398
|
+
autoFocus,
|
|
399
|
+
placeholder,
|
|
400
|
+
className,
|
|
401
|
+
readOnly,
|
|
402
|
+
editable: !readOnly,
|
|
403
|
+
basicSetup: defaultSetup
|
|
404
|
+
});
|
|
405
|
+
};
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/components/MergeEditor/AcceptControls/AcceptButton.tsx
|
|
408
|
+
const AcceptButton = ({ side, onAccept }) => {
|
|
409
|
+
const label = `Accept ${side === "left" ? "production" : "branch"} version`;
|
|
410
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
411
|
+
onClick: onAccept,
|
|
412
|
+
variant: "outline",
|
|
413
|
+
size: "icon-sm",
|
|
414
|
+
title: label,
|
|
415
|
+
"aria-label": label,
|
|
416
|
+
children: /* @__PURE__ */ jsx(side === "left" ? ChevronsRight : ChevronsLeft, { className: "tw:size-5" })
|
|
417
|
+
});
|
|
418
|
+
};
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/components/MergeEditor/AcceptControls/AcceptControls.tsx
|
|
421
|
+
const AcceptControls = ({ conflicts, side, onAccept, onDismiss, contentRef }) => /* @__PURE__ */ jsx("div", {
|
|
422
|
+
className: cn("tw:z-10 tw:flex tw:shrink-0 tw:flex-col tw:items-center", conflicts.length > 0 ? "tw:w-7" : "tw:w-0"),
|
|
423
|
+
children: conflicts.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
424
|
+
className: "tw:shrink-0",
|
|
425
|
+
style: { height: `58px` }
|
|
426
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
427
|
+
className: "tw:relative tw:w-full tw:flex-1 tw:overflow-y-clip tw:overflow-x-visible",
|
|
428
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
429
|
+
ref: contentRef,
|
|
430
|
+
className: "tw:relative tw:size-full",
|
|
431
|
+
children: conflicts.map((conflict) => {
|
|
432
|
+
const topOffset = ((side === "left" ? conflict.oldStartLine : conflict.newStartLine) - 1) * 20 - 2;
|
|
433
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
434
|
+
className: "tw:absolute tw:inset-x-0 tw:flex tw:flex-col tw:items-center tw:gap-0.5",
|
|
435
|
+
style: { top: `${topOffset}px` },
|
|
436
|
+
children: [/* @__PURE__ */ jsx(AcceptButton, {
|
|
437
|
+
side,
|
|
438
|
+
onAccept: () => onAccept(conflict)
|
|
439
|
+
}), onDismiss && /* @__PURE__ */ jsx(Button, {
|
|
440
|
+
onClick: () => onDismiss(conflict),
|
|
441
|
+
variant: "outline",
|
|
442
|
+
size: "icon-sm",
|
|
443
|
+
title: "Dismiss",
|
|
444
|
+
"aria-label": `Dismiss ${side === "left" ? "production" : "branch"} change`,
|
|
445
|
+
children: /* @__PURE__ */ jsx(X, { className: "tw:size-4" })
|
|
446
|
+
})]
|
|
447
|
+
}, conflict.id);
|
|
448
|
+
})
|
|
449
|
+
})
|
|
450
|
+
})] })
|
|
451
|
+
});
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/components/MergeEditor/decorations.ts
|
|
454
|
+
const setHighlightedLines = StateEffect.define();
|
|
455
|
+
const safeDecoration = Decoration.line({ class: "cm-merge-safe-line" });
|
|
456
|
+
const conflictDecoration = Decoration.line({ class: "cm-merge-conflict-line" });
|
|
72
457
|
var SafeGutterMarker = class extends GutterMarker {
|
|
73
|
-
|
|
458
|
+
elementClass = "cm-merge-safe-gutter";
|
|
74
459
|
};
|
|
75
460
|
var ConflictGutterMarker = class extends GutterMarker {
|
|
76
|
-
|
|
461
|
+
elementClass = "cm-merge-conflict-gutter";
|
|
77
462
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
provide: (f) => [
|
|
114
|
-
EditorView.decorations.from(f, (val) => val.decorations),
|
|
115
|
-
gutterLineClass.from(f, (val) => val.gutterMarkers)
|
|
116
|
-
]
|
|
463
|
+
const safeGutterMarker = new SafeGutterMarker();
|
|
464
|
+
const conflictGutterMarker = new ConflictGutterMarker();
|
|
465
|
+
const createDiffHighlightExtension = () => StateField.define({
|
|
466
|
+
create: () => ({
|
|
467
|
+
decorations: Decoration.none,
|
|
468
|
+
gutterMarkers: RangeSet.empty
|
|
469
|
+
}),
|
|
470
|
+
update(value, tr) {
|
|
471
|
+
let payload = null;
|
|
472
|
+
for (const effect of tr.effects) if (effect.is(setHighlightedLines)) payload = effect.value;
|
|
473
|
+
if (!payload) return {
|
|
474
|
+
decorations: value.decorations.map(tr.changes),
|
|
475
|
+
gutterMarkers: value.gutterMarkers.map(tr.changes)
|
|
476
|
+
};
|
|
477
|
+
const decoBuilder = new RangeSetBuilder();
|
|
478
|
+
const gutterBuilder = new RangeSetBuilder();
|
|
479
|
+
const doc = tr.state.doc;
|
|
480
|
+
const { lines, classification } = payload;
|
|
481
|
+
const sorted = [...lines].filter((l) => l >= 1 && l <= doc.lines).sort((a, b) => a - b);
|
|
482
|
+
for (const i of sorted) {
|
|
483
|
+
const cls = classification.get(i);
|
|
484
|
+
if (!cls) continue;
|
|
485
|
+
const isSafe = cls === CHANGE_CLASS.SAFE;
|
|
486
|
+
const line = doc.line(i);
|
|
487
|
+
decoBuilder.add(line.from, line.from, isSafe ? safeDecoration : conflictDecoration);
|
|
488
|
+
gutterBuilder.add(line.from, line.from, isSafe ? safeGutterMarker : conflictGutterMarker);
|
|
489
|
+
}
|
|
490
|
+
return {
|
|
491
|
+
decorations: decoBuilder.finish(),
|
|
492
|
+
gutterMarkers: gutterBuilder.finish()
|
|
493
|
+
};
|
|
494
|
+
},
|
|
495
|
+
provide: (f) => [EditorView.decorations.from(f, (val) => val.decorations), gutterLineClass.from(f, (val) => val.gutterMarkers)]
|
|
117
496
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
497
|
+
const DARK_LINE_ALPHA = "29";
|
|
498
|
+
const DARK_GUTTER_ALPHA = "47";
|
|
499
|
+
/**
|
|
500
|
+
* The highlight palette, split out of the StateField above so it can be built
|
|
501
|
+
* through `useThemedExtension` — the field instance must stay stable across a
|
|
502
|
+
* scheme change (a fresh one would drop the current highlights), the colours
|
|
503
|
+
* must not.
|
|
504
|
+
*
|
|
505
|
+
* `!important` overrides CodeMirror's built-in active-line and selection
|
|
506
|
+
* backgrounds. SAFE = change present on one side only (green). CONFLICT = both
|
|
507
|
+
* sides edited this region (amber/warning — NOT red, since red reads as
|
|
508
|
+
* "deletion" and the 3-pane editor only ever displays additions in each side
|
|
509
|
+
* pane). The colored left border doubles as a scan-lane so changes are easy to
|
|
510
|
+
* spot when zoomed out.
|
|
511
|
+
*
|
|
512
|
+
* Light mode paints an opaque pastel wash. Dark mode tints the same hue at low
|
|
513
|
+
* alpha over the pane's token-driven surface instead — the pastel is opaque, so
|
|
514
|
+
* it put the dark scheme's near-white line text and grey line numbers on a
|
|
515
|
+
* light slab.
|
|
516
|
+
*
|
|
517
|
+
* A pure function of `scheme`, which `useThemedExtension` passes from the same
|
|
518
|
+
* read that produced its cache key.
|
|
519
|
+
*/
|
|
520
|
+
const buildDiffHighlightTheme = (scheme) => {
|
|
521
|
+
const dark = scheme === "dark";
|
|
522
|
+
const line = (hue, pastel) => dark ? `${hue}${DARK_LINE_ALPHA}` : pastel;
|
|
523
|
+
const gutter = (hue, pastel) => dark ? `${hue}${DARK_GUTTER_ALPHA}` : pastel;
|
|
524
|
+
const safeNumber = dark ? colors.green[300] : colors.green[900];
|
|
525
|
+
const conflictNumber = dark ? colors.warning[300] : colors.warning[800];
|
|
526
|
+
return EditorView.theme({
|
|
527
|
+
".cm-merge-safe-line": {
|
|
528
|
+
backgroundColor: `${line(colors.green[500], colors.green[100])} !important`,
|
|
529
|
+
boxShadow: `inset 3px 0 0 ${colors.green[500]}`
|
|
530
|
+
},
|
|
531
|
+
".cm-merge-conflict-line": {
|
|
532
|
+
backgroundColor: `${line(colors.warning[500], colors.warning[100])} !important`,
|
|
533
|
+
boxShadow: `inset 3px 0 0 ${colors.warning[500]}`
|
|
534
|
+
},
|
|
535
|
+
".cm-merge-safe-gutter": {
|
|
536
|
+
backgroundColor: `${gutter(colors.green[500], colors.green[200])} !important`,
|
|
537
|
+
color: safeNumber
|
|
538
|
+
},
|
|
539
|
+
".cm-merge-conflict-gutter": {
|
|
540
|
+
backgroundColor: `${gutter(colors.warning[500], colors.warning[200])} !important`,
|
|
541
|
+
color: conflictNumber
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
};
|
|
545
|
+
const updateHighlightedLines = (view, lines, classification) => {
|
|
546
|
+
view.dispatch({ effects: setHighlightedLines.of({
|
|
547
|
+
lines,
|
|
548
|
+
classification
|
|
549
|
+
}) });
|
|
144
550
|
};
|
|
145
|
-
|
|
146
|
-
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/components/MergeEditor/MergePane.tsx
|
|
553
|
+
const EMPTY_LINES$1 = /* @__PURE__ */ new Set();
|
|
554
|
+
const EMPTY_CLASSIFICATION$1 = /* @__PURE__ */ new Map();
|
|
555
|
+
const MergePane = ({ value, highlightedLines, lineClassification, readOnly = false, onChange, header, headerClassName, className, onScrollDOMReady, deleted = false }) => {
|
|
556
|
+
const editorRef = useRef(null);
|
|
557
|
+
const handleChange = useStableCallback((next) => onChange?.(next));
|
|
558
|
+
const themeExtension = useThemedExtension(`merge-pane:${deleted}`, (scheme) => {
|
|
559
|
+
const dark = scheme === "dark";
|
|
560
|
+
const deletedSurface = dark ? `${colors.error[500]}1f` : colors.error[100];
|
|
561
|
+
const deletedGutter = dark ? `${colors.error[500]}3d` : colors.error[200];
|
|
562
|
+
const deletedGutterText = dark ? colors.error[300] : colors.error[700];
|
|
563
|
+
return EditorView.theme({
|
|
564
|
+
"&.cm-editor": {
|
|
565
|
+
height: "100%",
|
|
566
|
+
backgroundColor: deleted ? deletedSurface : resolveToken("background", "249 250 251"),
|
|
567
|
+
color: resolveToken("foreground", "30 41 59"),
|
|
568
|
+
outline: "none"
|
|
569
|
+
},
|
|
570
|
+
".cm-gutters": {
|
|
571
|
+
backgroundColor: deleted ? deletedGutter : resolveToken("muted", "241 245 249"),
|
|
572
|
+
color: deleted ? deletedGutterText : resolveToken("muted-foreground", "100 116 139")
|
|
573
|
+
},
|
|
574
|
+
"*": { lineHeight: `20px` },
|
|
575
|
+
".cm-lineNumbers .cm-gutterElement": { padding: "0 0 0 25px" }
|
|
576
|
+
});
|
|
577
|
+
});
|
|
578
|
+
const diffHighlightExtension = useMemo(() => createDiffHighlightExtension(), []);
|
|
579
|
+
const diffHighlightTheme = useThemedExtension("merge-diff-highlight", buildDiffHighlightTheme);
|
|
580
|
+
const basicSetup = useMemo(() => ({
|
|
581
|
+
...buildBasicSetup(readOnly),
|
|
582
|
+
lineNumbers: true
|
|
583
|
+
}), [readOnly]);
|
|
584
|
+
const extensions = useMemo(() => [
|
|
585
|
+
diffHighlightExtension,
|
|
586
|
+
diffHighlightTheme,
|
|
587
|
+
themeExtension,
|
|
588
|
+
EditorView.updateListener.of((update) => {
|
|
589
|
+
if (update.docChanged) requestAnimationFrame(() => update.view.dispatch({}));
|
|
590
|
+
})
|
|
591
|
+
], [
|
|
592
|
+
diffHighlightExtension,
|
|
593
|
+
diffHighlightTheme,
|
|
594
|
+
themeExtension
|
|
595
|
+
]);
|
|
596
|
+
useEffect(() => {
|
|
597
|
+
const view = editorRef.current?.view;
|
|
598
|
+
if (!view) return;
|
|
599
|
+
updateHighlightedLines(view, deleted ? EMPTY_LINES$1 : highlightedLines, deleted ? EMPTY_CLASSIFICATION$1 : lineClassification);
|
|
600
|
+
}, [
|
|
601
|
+
highlightedLines,
|
|
602
|
+
lineClassification,
|
|
603
|
+
deleted
|
|
604
|
+
]);
|
|
605
|
+
const handleCreateEditor = useCallback((view) => {
|
|
606
|
+
updateHighlightedLines(view, deleted ? EMPTY_LINES$1 : highlightedLines, deleted ? EMPTY_CLASSIFICATION$1 : lineClassification);
|
|
607
|
+
onScrollDOMReady?.(view.scrollDOM);
|
|
608
|
+
}, [
|
|
609
|
+
highlightedLines,
|
|
610
|
+
lineClassification,
|
|
611
|
+
onScrollDOMReady,
|
|
612
|
+
deleted
|
|
613
|
+
]);
|
|
614
|
+
useEffect(() => {
|
|
615
|
+
return () => onScrollDOMReady?.(null);
|
|
616
|
+
}, [onScrollDOMReady]);
|
|
617
|
+
useEffect(() => {
|
|
618
|
+
const view = editorRef.current?.view;
|
|
619
|
+
const wrapper = view?.dom.parentElement;
|
|
620
|
+
if (!view || !wrapper) return;
|
|
621
|
+
const observer = new ResizeObserver(() => view.dispatch({}));
|
|
622
|
+
observer.observe(wrapper);
|
|
623
|
+
return () => observer.disconnect();
|
|
624
|
+
}, []);
|
|
625
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
626
|
+
className: cn("tw:flex tw:min-w-0 tw:flex-1 tw:flex-col tw:overflow-hidden", className, deleted && "tw:border-error-300 tw:[[data-theme=dark]_&]:border-error-500/50"),
|
|
627
|
+
children: [header && /* @__PURE__ */ jsx("div", {
|
|
628
|
+
className: cn("tw:px-4 tw:py-3", deleted ? "tw:border-b tw:border-error-200 tw:bg-error-100 tw:[[data-theme=dark]_&]:border-error-500/30 tw:[[data-theme=dark]_&]:bg-error-500/15" : "tw:bg-background", headerClassName),
|
|
629
|
+
children: header
|
|
630
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
631
|
+
className: "tw:flex tw:h-0 tw:flex-1 tw:flex-col tw:[&_>div]:h-full",
|
|
632
|
+
children: /* @__PURE__ */ jsx(CodeMirror, {
|
|
633
|
+
ref: editorRef,
|
|
634
|
+
height: "100%",
|
|
635
|
+
value,
|
|
636
|
+
onChange: handleChange,
|
|
637
|
+
extensions,
|
|
638
|
+
readOnly,
|
|
639
|
+
onCreateEditor: handleCreateEditor,
|
|
640
|
+
basicSetup
|
|
641
|
+
})
|
|
642
|
+
})]
|
|
643
|
+
});
|
|
147
644
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
})
|
|
204
|
-
],
|
|
205
|
-
[diffHighlightExtension, diffHighlightTheme, themeExtension]
|
|
206
|
-
);
|
|
207
|
-
useEffect(() => {
|
|
208
|
-
const view = editorRef.current?.view;
|
|
209
|
-
if (!view) return;
|
|
210
|
-
updateHighlightedLines(
|
|
211
|
-
view,
|
|
212
|
-
deleted ? EMPTY_LINES : highlightedLines,
|
|
213
|
-
deleted ? EMPTY_CLASSIFICATION : lineClassification
|
|
214
|
-
);
|
|
215
|
-
}, [highlightedLines, lineClassification, deleted]);
|
|
216
|
-
const handleCreateEditor = useCallback(
|
|
217
|
-
(view) => {
|
|
218
|
-
updateHighlightedLines(
|
|
219
|
-
view,
|
|
220
|
-
deleted ? EMPTY_LINES : highlightedLines,
|
|
221
|
-
deleted ? EMPTY_CLASSIFICATION : lineClassification
|
|
222
|
-
);
|
|
223
|
-
onScrollDOMReady?.(view.scrollDOM);
|
|
224
|
-
},
|
|
225
|
-
[highlightedLines, lineClassification, onScrollDOMReady, deleted]
|
|
226
|
-
);
|
|
227
|
-
useEffect(() => {
|
|
228
|
-
return () => onScrollDOMReady?.(null);
|
|
229
|
-
}, [onScrollDOMReady]);
|
|
230
|
-
useEffect(() => {
|
|
231
|
-
const view = editorRef.current?.view;
|
|
232
|
-
const wrapper = view?.dom.parentElement;
|
|
233
|
-
if (!view || !wrapper) return;
|
|
234
|
-
const observer = new ResizeObserver(() => view.dispatch({}));
|
|
235
|
-
observer.observe(wrapper);
|
|
236
|
-
return () => observer.disconnect();
|
|
237
|
-
}, []);
|
|
238
|
-
return /* @__PURE__ */ jsxs(
|
|
239
|
-
"div",
|
|
240
|
-
{
|
|
241
|
-
className: cn(
|
|
242
|
-
"tw:flex tw:min-w-0 tw:flex-1 tw:flex-col tw:overflow-hidden",
|
|
243
|
-
className,
|
|
244
|
-
deleted && "tw:border-error-300 tw:[[data-theme=dark]_&]:border-error-500/50"
|
|
245
|
-
),
|
|
246
|
-
children: [
|
|
247
|
-
header && /* @__PURE__ */ jsx(
|
|
248
|
-
"div",
|
|
249
|
-
{
|
|
250
|
-
className: cn(
|
|
251
|
-
"tw:px-4 tw:py-3",
|
|
252
|
-
// Same light/dark split as the editor wash below — `PaneHeader` pins
|
|
253
|
-
// `text-foreground`, which goes near-white and vanishes on the
|
|
254
|
-
// opaque light-red band.
|
|
255
|
-
deleted ? "tw:border-b tw:border-error-200 tw:bg-error-100 tw:[[data-theme=dark]_&]:border-error-500/30 tw:[[data-theme=dark]_&]:bg-error-500/15" : "tw:bg-background",
|
|
256
|
-
headerClassName
|
|
257
|
-
),
|
|
258
|
-
children: header
|
|
259
|
-
}
|
|
260
|
-
),
|
|
261
|
-
/* @__PURE__ */ jsx("div", { className: "tw:flex tw:h-0 tw:flex-1 tw:flex-col tw:[&_>div]:h-full", children: /* @__PURE__ */ jsx(
|
|
262
|
-
CodeMirror,
|
|
263
|
-
{
|
|
264
|
-
ref: editorRef,
|
|
265
|
-
height: "100%",
|
|
266
|
-
value,
|
|
267
|
-
onChange: handleChange,
|
|
268
|
-
extensions,
|
|
269
|
-
readOnly,
|
|
270
|
-
onCreateEditor: handleCreateEditor,
|
|
271
|
-
basicSetup
|
|
272
|
-
}
|
|
273
|
-
) })
|
|
274
|
-
]
|
|
275
|
-
}
|
|
276
|
-
);
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/components/MergeEditor/useScrollSync.ts
|
|
647
|
+
const useScrollSync = () => {
|
|
648
|
+
const scrollersRef = useRef([]);
|
|
649
|
+
const followersRef = useRef(/* @__PURE__ */ new Map());
|
|
650
|
+
const isSyncingRef = useRef(false);
|
|
651
|
+
const scrollerCallbacksRef = useRef(/* @__PURE__ */ new Map());
|
|
652
|
+
const followerCallbacksRef = useRef(/* @__PURE__ */ new Map());
|
|
653
|
+
const updateFollowers = useCallback(() => {
|
|
654
|
+
for (const [, { paneIndex, el }] of followersRef.current) {
|
|
655
|
+
const scroller = scrollersRef.current[paneIndex];
|
|
656
|
+
if (!scroller) continue;
|
|
657
|
+
el.style.transform = `translateY(-${scroller.scrollTop}px)`;
|
|
658
|
+
}
|
|
659
|
+
}, []);
|
|
660
|
+
const handleScroll = useCallback((e) => {
|
|
661
|
+
if (isSyncingRef.current) return;
|
|
662
|
+
isSyncingRef.current = true;
|
|
663
|
+
const sourceScrollTop = e.target.scrollTop;
|
|
664
|
+
for (const scroller of scrollersRef.current) {
|
|
665
|
+
if (!scroller || scroller === e.target) continue;
|
|
666
|
+
const targetMax = Math.max(0, scroller.scrollHeight - scroller.clientHeight);
|
|
667
|
+
scroller.scrollTop = Math.min(sourceScrollTop, targetMax);
|
|
668
|
+
}
|
|
669
|
+
updateFollowers();
|
|
670
|
+
isSyncingRef.current = false;
|
|
671
|
+
}, [updateFollowers]);
|
|
672
|
+
return {
|
|
673
|
+
registerScroller: useCallback((index) => {
|
|
674
|
+
const existing = scrollerCallbacksRef.current.get(index);
|
|
675
|
+
if (existing) return existing;
|
|
676
|
+
const callback = (el) => {
|
|
677
|
+
const prev = scrollersRef.current[index];
|
|
678
|
+
if (prev === el) return;
|
|
679
|
+
prev?.removeEventListener("scroll", handleScroll);
|
|
680
|
+
scrollersRef.current[index] = el;
|
|
681
|
+
el?.addEventListener("scroll", handleScroll, { passive: true });
|
|
682
|
+
};
|
|
683
|
+
scrollerCallbacksRef.current.set(index, callback);
|
|
684
|
+
return callback;
|
|
685
|
+
}, [handleScroll]),
|
|
686
|
+
registerFollower: useCallback((paneIndex, key) => {
|
|
687
|
+
const existing = followerCallbacksRef.current.get(key);
|
|
688
|
+
if (existing) return existing;
|
|
689
|
+
const callback = (el) => {
|
|
690
|
+
if (el) followersRef.current.set(key, {
|
|
691
|
+
paneIndex,
|
|
692
|
+
el
|
|
693
|
+
});
|
|
694
|
+
else followersRef.current.delete(key);
|
|
695
|
+
};
|
|
696
|
+
followerCallbacksRef.current.set(key, callback);
|
|
697
|
+
return callback;
|
|
698
|
+
}, [])
|
|
699
|
+
};
|
|
277
700
|
};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}, []);
|
|
335
|
-
return { registerScroller, registerFollower };
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region src/components/MergeEditor/MergeEditor.tsx
|
|
703
|
+
const EMPTY_LINES = /* @__PURE__ */ new Set();
|
|
704
|
+
const EMPTY_CLASSIFICATION = /* @__PURE__ */ new Map();
|
|
705
|
+
const MergeEditor = ({ mergeValue, handleMergeChange, leftText, rightText, leftConflicts, rightConflicts, leftHighlightedLines, rightHighlightedLines, leftClassification, rightClassification, mergeHighlightedLines, mergeClassification, acceptLeft, acceptRight, dismissLeft, dismissRight, leftHeader, middleHeader, middleHeaderClassName, middleClassName, rightHeader, className, leftDeleted = false, rightDeleted = false }) => {
|
|
706
|
+
const { registerScroller, registerFollower } = useScrollSync();
|
|
707
|
+
const anySideDeleted = leftDeleted || rightDeleted;
|
|
708
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
709
|
+
className: cn("tw:flex tw:h-full tw:min-h-0 tw:overflow-hidden tw:bg-background tw:gap-3", className),
|
|
710
|
+
children: [
|
|
711
|
+
/* @__PURE__ */ jsx(MergePane, {
|
|
712
|
+
value: leftText,
|
|
713
|
+
highlightedLines: leftHighlightedLines,
|
|
714
|
+
lineClassification: leftClassification,
|
|
715
|
+
readOnly: true,
|
|
716
|
+
header: leftHeader,
|
|
717
|
+
className: "tw:rounded-r-lg tw:border tw:border-border",
|
|
718
|
+
onScrollDOMReady: registerScroller(0),
|
|
719
|
+
deleted: leftDeleted
|
|
720
|
+
}),
|
|
721
|
+
/* @__PURE__ */ jsx(AcceptControls, {
|
|
722
|
+
conflicts: leftDeleted ? [] : leftConflicts,
|
|
723
|
+
side: "left",
|
|
724
|
+
onAccept: acceptLeft,
|
|
725
|
+
onDismiss: dismissLeft,
|
|
726
|
+
contentRef: registerFollower(0, "left-controls")
|
|
727
|
+
}),
|
|
728
|
+
/* @__PURE__ */ jsx(MergePane, {
|
|
729
|
+
value: mergeValue,
|
|
730
|
+
highlightedLines: anySideDeleted ? EMPTY_LINES : mergeHighlightedLines,
|
|
731
|
+
lineClassification: anySideDeleted ? EMPTY_CLASSIFICATION : mergeClassification,
|
|
732
|
+
onChange: handleMergeChange,
|
|
733
|
+
header: middleHeader,
|
|
734
|
+
headerClassName: middleHeaderClassName,
|
|
735
|
+
className: cn("tw:border tw:border-border tw:rounded-lg", middleClassName),
|
|
736
|
+
onScrollDOMReady: registerScroller(1)
|
|
737
|
+
}),
|
|
738
|
+
/* @__PURE__ */ jsx(AcceptControls, {
|
|
739
|
+
conflicts: rightDeleted ? [] : rightConflicts,
|
|
740
|
+
side: "right",
|
|
741
|
+
onAccept: acceptRight,
|
|
742
|
+
onDismiss: dismissRight,
|
|
743
|
+
contentRef: registerFollower(2, "right-controls")
|
|
744
|
+
}),
|
|
745
|
+
/* @__PURE__ */ jsx(MergePane, {
|
|
746
|
+
value: rightText,
|
|
747
|
+
highlightedLines: rightHighlightedLines,
|
|
748
|
+
lineClassification: rightClassification,
|
|
749
|
+
readOnly: true,
|
|
750
|
+
header: rightHeader,
|
|
751
|
+
className: "tw:rounded-l-lg tw:border tw:border-border",
|
|
752
|
+
onScrollDOMReady: registerScroller(2),
|
|
753
|
+
deleted: rightDeleted
|
|
754
|
+
})
|
|
755
|
+
]
|
|
756
|
+
});
|
|
336
757
|
};
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}) => {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
{
|
|
391
|
-
conflicts: leftDeleted ? [] : leftConflicts,
|
|
392
|
-
side: "left",
|
|
393
|
-
onAccept: acceptLeft,
|
|
394
|
-
onDismiss: dismissLeft,
|
|
395
|
-
contentRef: registerFollower(0, "left-controls")
|
|
396
|
-
}
|
|
397
|
-
),
|
|
398
|
-
/* @__PURE__ */ jsx(
|
|
399
|
-
MergePane,
|
|
400
|
-
{
|
|
401
|
-
value: mergeValue,
|
|
402
|
-
highlightedLines: anySideDeleted ? EMPTY_LINES2 : mergeHighlightedLines,
|
|
403
|
-
lineClassification: anySideDeleted ? EMPTY_CLASSIFICATION2 : mergeClassification,
|
|
404
|
-
onChange: handleMergeChange,
|
|
405
|
-
header: middleHeader,
|
|
406
|
-
headerClassName: middleHeaderClassName,
|
|
407
|
-
className: cn("tw:border tw:border-border tw:rounded-lg", middleClassName),
|
|
408
|
-
onScrollDOMReady: registerScroller(1)
|
|
409
|
-
}
|
|
410
|
-
),
|
|
411
|
-
/* @__PURE__ */ jsx(
|
|
412
|
-
AcceptControls,
|
|
413
|
-
{
|
|
414
|
-
conflicts: rightDeleted ? [] : rightConflicts,
|
|
415
|
-
side: "right",
|
|
416
|
-
onAccept: acceptRight,
|
|
417
|
-
onDismiss: dismissRight,
|
|
418
|
-
contentRef: registerFollower(2, "right-controls")
|
|
419
|
-
}
|
|
420
|
-
),
|
|
421
|
-
/* @__PURE__ */ jsx(
|
|
422
|
-
MergePane,
|
|
423
|
-
{
|
|
424
|
-
value: rightText,
|
|
425
|
-
highlightedLines: rightHighlightedLines,
|
|
426
|
-
lineClassification: rightClassification,
|
|
427
|
-
readOnly: true,
|
|
428
|
-
header: rightHeader,
|
|
429
|
-
className: "tw:rounded-l-lg tw:border tw:border-border",
|
|
430
|
-
onScrollDOMReady: registerScroller(2),
|
|
431
|
-
deleted: rightDeleted
|
|
432
|
-
}
|
|
433
|
-
)
|
|
434
|
-
]
|
|
435
|
-
}
|
|
436
|
-
);
|
|
758
|
+
//#endregion
|
|
759
|
+
//#region src/components/CodeEditor/CodeEditorField.tsx
|
|
760
|
+
/**
|
|
761
|
+
* Code / JSON editor field. State is the raw editor text (`string`) — never a parsed value.
|
|
762
|
+
*
|
|
763
|
+
* ⚠️ Shipped from **`@keboola/design/editors`**, not as a `field.*` connector on `useAppForm`, and
|
|
764
|
+
* deliberately: CodeMirror plus its language modes is ~170 kB brotlied, and registering this in the root
|
|
765
|
+
* form hook pulled all of it into `@keboola/design`'s main entry — every consumer paying for an editor
|
|
766
|
+
* most of them never render. That is the whole reason the `editors` subpath exists.
|
|
767
|
+
*
|
|
768
|
+
* It still reads the field from context, so it composes exactly like a connector:
|
|
769
|
+
*
|
|
770
|
+
* ```tsx
|
|
771
|
+
* import { CodeEditorField } from '@keboola/design/editors';
|
|
772
|
+
*
|
|
773
|
+
* <form.AppField name="schema">{() => <CodeEditorField label="Schema" />}</form.AppField>
|
|
774
|
+
* ```
|
|
775
|
+
*
|
|
776
|
+
* Text in, text out, deliberately: a JSON field is mid-edit invalid for most of the time the user is
|
|
777
|
+
* typing in it, and parsing on every keystroke would either throw away their cursor position or throw
|
|
778
|
+
* away the text. Parse in the schema (or at submit) and keep the editor's own content authoritative.
|
|
779
|
+
*
|
|
780
|
+
* `variant="field"` by default so it reads as a form control rather than a code block.
|
|
781
|
+
*
|
|
782
|
+
* Labelled with `aria-labelledby`, not `for`: CodeMirror's editable node is a `div[role="textbox"]`,
|
|
783
|
+
* which is not a labelable element.
|
|
784
|
+
*/
|
|
785
|
+
const CodeEditorField = ({ label, action, required, requiredMark, help, tooltip, className, "aria-describedby": ariaDescribedBy, editorClassName, variant = "field", ...editorProps }) => {
|
|
786
|
+
const field = useFieldContext();
|
|
787
|
+
return /* @__PURE__ */ jsx(FieldItem, {
|
|
788
|
+
label,
|
|
789
|
+
action,
|
|
790
|
+
required,
|
|
791
|
+
requiredMark,
|
|
792
|
+
labelling: "aria-labelledby",
|
|
793
|
+
help,
|
|
794
|
+
tooltip,
|
|
795
|
+
className,
|
|
796
|
+
"aria-describedby": ariaDescribedBy,
|
|
797
|
+
children: (control) => /* @__PURE__ */ jsx(CodeEditor, {
|
|
798
|
+
...editorProps,
|
|
799
|
+
variant,
|
|
800
|
+
className: editorClassName,
|
|
801
|
+
ariaLabelledBy: control["aria-labelledby"],
|
|
802
|
+
ariaDescribedBy: control["aria-describedby"],
|
|
803
|
+
ariaInvalid: control["aria-invalid"],
|
|
804
|
+
ariaRequired: control["aria-required"],
|
|
805
|
+
allowBlankDocument: !required,
|
|
806
|
+
value: field.state.value ?? "",
|
|
807
|
+
onChange: field.handleChange,
|
|
808
|
+
onBlur: field.handleBlur
|
|
809
|
+
})
|
|
810
|
+
});
|
|
437
811
|
};
|
|
812
|
+
//#endregion
|
|
813
|
+
export { CodeEditor, CodeEditorField, LANGUAGE_MODES, MergeEditor, SqlEditor, isLanguageMode };
|
|
438
814
|
|
|
439
|
-
export { MergeEditor };
|
|
440
|
-
//# sourceMappingURL=editors.js.map
|
|
441
815
|
//# sourceMappingURL=editors.js.map
|