@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
|
@@ -0,0 +1,1000 @@
|
|
|
1
|
+
import { cn } from "./classNames-BzrkDnOD.js";
|
|
2
|
+
import { isMac, keyCodes } from "./utils-D0c5VAyF.js";
|
|
3
|
+
import { useArgoDesign } from "./context-KxxeMHbR.js";
|
|
4
|
+
import { escapeStringRegexp } from "./escapeStringRegexp-8MxP2knR.js";
|
|
5
|
+
import { ClipboardButton } from "./ClipboardButton-ClcluT0C.js";
|
|
6
|
+
import { HelpBlock } from "./internal/components/HelpBlock.js";
|
|
7
|
+
import { Kbd } from "./Kbd-CxHAo1oo.js";
|
|
8
|
+
import { useStableCallback } from "./internal/hooks/useStableCallback.js";
|
|
9
|
+
import { resolveToken, useThemeAttributes } from "./themeTokens-BNg98Mu9.js";
|
|
10
|
+
import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { autocompletion, completeAnyWord } from "@codemirror/autocomplete";
|
|
13
|
+
import { unifiedMergeView } from "@codemirror/merge";
|
|
14
|
+
import { Decoration, EditorView, ViewPlugin, keymap, placeholder, tooltips } from "@codemirror/view";
|
|
15
|
+
import CodeMirror, { EditorState } from "@uiw/react-codemirror";
|
|
16
|
+
import colors from "@keboola/tailwind-config/colors";
|
|
17
|
+
import { javascript } from "@codemirror/lang-javascript";
|
|
18
|
+
import { json, jsonParseLinter } from "@codemirror/lang-json";
|
|
19
|
+
import { python } from "@codemirror/lang-python";
|
|
20
|
+
import { MSSQL, MySQL, PLSQL, PostgreSQL, StandardSQL } from "@codemirror/lang-sql";
|
|
21
|
+
import { StreamLanguage } from "@codemirror/language";
|
|
22
|
+
import { r } from "@codemirror/legacy-modes/mode/r";
|
|
23
|
+
import { shell } from "@codemirror/legacy-modes/mode/shell";
|
|
24
|
+
import { toml } from "@codemirror/legacy-modes/mode/toml";
|
|
25
|
+
import { linter } from "@codemirror/lint";
|
|
26
|
+
import { tags } from "@lezer/highlight";
|
|
27
|
+
import { githubLightInit } from "@uiw/codemirror-theme-github";
|
|
28
|
+
import { getSqlLanguageSupport } from "@keboola/codemirror-lang-sql";
|
|
29
|
+
import { simpleMode } from "@codemirror/legacy-modes/mode/simple-mode";
|
|
30
|
+
import { Compartment, StateEffect, StateField } from "@codemirror/state";
|
|
31
|
+
//#region src/components/CodeEditor/ButtonToolbar.tsx
|
|
32
|
+
const ButtonToolbar = ({ value, children }) => {
|
|
33
|
+
if (!value && !children) return null;
|
|
34
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: "tw:absolute tw:right-3 tw:top-1 tw:z-10 tw:flex tw:gap-0.5 tw:overflow-visible tw:rounded tw:border tw:border-solid tw:border-border tw:!bg-background tw:p-px tw:shadow-sm",
|
|
36
|
+
children: [!!value && /* @__PURE__ */ jsx(ClipboardButton, {
|
|
37
|
+
size: "icon-xs",
|
|
38
|
+
variant: "invisible",
|
|
39
|
+
text: value
|
|
40
|
+
}), children]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/CodeEditor/modes/dbt.ts
|
|
45
|
+
const COMMANDS = [
|
|
46
|
+
"run-operation",
|
|
47
|
+
"run",
|
|
48
|
+
"test",
|
|
49
|
+
"seed",
|
|
50
|
+
"snapshot",
|
|
51
|
+
"list",
|
|
52
|
+
"ls",
|
|
53
|
+
"compile",
|
|
54
|
+
"build",
|
|
55
|
+
"deps",
|
|
56
|
+
"docs",
|
|
57
|
+
"source"
|
|
58
|
+
];
|
|
59
|
+
const SUBCOMMANDS = {
|
|
60
|
+
docs: ["generate"],
|
|
61
|
+
source: ["freshness"]
|
|
62
|
+
};
|
|
63
|
+
const ARGUMENTS = [
|
|
64
|
+
"--select",
|
|
65
|
+
"--exclude",
|
|
66
|
+
"--selector",
|
|
67
|
+
"--defer",
|
|
68
|
+
"--resource-type",
|
|
69
|
+
"-s"
|
|
70
|
+
];
|
|
71
|
+
const SELECTORS = [
|
|
72
|
+
"--select",
|
|
73
|
+
"--exclude",
|
|
74
|
+
"-s"
|
|
75
|
+
];
|
|
76
|
+
const METHODS = [
|
|
77
|
+
"path:",
|
|
78
|
+
"source:",
|
|
79
|
+
"tag:",
|
|
80
|
+
"package:",
|
|
81
|
+
"config:",
|
|
82
|
+
"test_type:",
|
|
83
|
+
"test_name:",
|
|
84
|
+
"state:",
|
|
85
|
+
"exposure:",
|
|
86
|
+
"metric:",
|
|
87
|
+
"result:",
|
|
88
|
+
"source_status:",
|
|
89
|
+
"column_name:"
|
|
90
|
+
];
|
|
91
|
+
const FLAGS = [
|
|
92
|
+
"--fail-fast",
|
|
93
|
+
"--warn-error",
|
|
94
|
+
"--favor-state",
|
|
95
|
+
"--vars",
|
|
96
|
+
"--models",
|
|
97
|
+
"--threads",
|
|
98
|
+
"--profiles-dir",
|
|
99
|
+
"--profile",
|
|
100
|
+
"--full-refresh"
|
|
101
|
+
];
|
|
102
|
+
const COMMAND_PHRASES = COMMANDS.flatMap((command) => {
|
|
103
|
+
const subcommands = SUBCOMMANDS[command];
|
|
104
|
+
return subcommands ? subcommands.map((subcommand) => `${command} ${subcommand}`) : [command];
|
|
105
|
+
});
|
|
106
|
+
const alternation = (list) => [...list].sort((a, b) => b.length - a.length).join("|");
|
|
107
|
+
const word = (list) => new RegExp(`^\\s+(?:${alternation(list)})\\b`, "i");
|
|
108
|
+
const prefix = (list) => new RegExp(`^\\s+(?:${alternation(list)})`, "i");
|
|
109
|
+
const WORD = /[\w:-]*$/;
|
|
110
|
+
const asOptions = (list, type) => list.map((label) => ({
|
|
111
|
+
label,
|
|
112
|
+
type
|
|
113
|
+
}));
|
|
114
|
+
const DBT = [{
|
|
115
|
+
label: "dbt",
|
|
116
|
+
type: "keyword"
|
|
117
|
+
}];
|
|
118
|
+
const COMMAND_OPTIONS = asOptions(COMMANDS, "keyword");
|
|
119
|
+
const SUBCOMMAND_OPTIONS = Object.fromEntries(Object.entries(SUBCOMMANDS).map(([command, subcommands]) => [command, asOptions(subcommands, "keyword")]));
|
|
120
|
+
const ARGUMENT_OPTIONS = asOptions(ARGUMENTS, "variable");
|
|
121
|
+
const FLAG_OPTIONS = asOptions(FLAGS, "constant");
|
|
122
|
+
const METHOD_OPTIONS = asOptions(METHODS, "property");
|
|
123
|
+
const optionsAfter = (words) => {
|
|
124
|
+
const [step, command, ...rest] = words;
|
|
125
|
+
if (step === void 0) return DBT;
|
|
126
|
+
if (step.toLowerCase() !== "dbt") return [];
|
|
127
|
+
if (command === void 0) return COMMAND_OPTIONS;
|
|
128
|
+
const subcommands = SUBCOMMAND_OPTIONS[command.toLowerCase()];
|
|
129
|
+
if (subcommands && rest.length === 0) return subcommands;
|
|
130
|
+
const lastArgument = rest.filter((it) => it.startsWith("-")).at(-1);
|
|
131
|
+
return lastArgument !== void 0 && SELECTORS.includes(lastArgument.toLowerCase()) ? [
|
|
132
|
+
...ARGUMENT_OPTIONS,
|
|
133
|
+
...FLAG_OPTIONS,
|
|
134
|
+
...METHOD_OPTIONS
|
|
135
|
+
] : [...ARGUMENT_OPTIONS, ...FLAG_OPTIONS];
|
|
136
|
+
};
|
|
137
|
+
const complete = (context) => {
|
|
138
|
+
const typed = context.matchBefore(WORD);
|
|
139
|
+
if (!typed?.text && !context.explicit) return null;
|
|
140
|
+
const from = typed?.from ?? context.pos;
|
|
141
|
+
const line = context.state.doc.lineAt(from);
|
|
142
|
+
const options = optionsAfter(line.text.slice(0, from - line.from).split(/\s+/).filter(Boolean));
|
|
143
|
+
return options.length > 0 ? {
|
|
144
|
+
from,
|
|
145
|
+
options,
|
|
146
|
+
validFor: WORD
|
|
147
|
+
} : null;
|
|
148
|
+
};
|
|
149
|
+
const dbt = simpleMode({
|
|
150
|
+
languageData: {
|
|
151
|
+
commentTokens: {
|
|
152
|
+
line: "--",
|
|
153
|
+
block: {
|
|
154
|
+
open: "/*",
|
|
155
|
+
close: "*/"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
autocomplete: complete
|
|
159
|
+
},
|
|
160
|
+
start: [
|
|
161
|
+
{
|
|
162
|
+
regex: /"(?:[^\\]|\\.)*?(?:"|$)/,
|
|
163
|
+
token: "string"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
regex: /dbt\b/,
|
|
167
|
+
token: "keyword",
|
|
168
|
+
sol: true
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
regex: word(COMMAND_PHRASES),
|
|
172
|
+
token: "keyword"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
regex: word(ARGUMENTS),
|
|
176
|
+
token: "variableName"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
regex: prefix(METHODS),
|
|
180
|
+
token: "propertyName"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
regex: prefix(FLAGS),
|
|
184
|
+
token: "attributeName"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
regex: /(?:@|\*|,|\+\d+|\d+\+|\+)/,
|
|
188
|
+
token: "operator"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
regex: /'.*'/,
|
|
192
|
+
token: "string"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
regex: /true|false/,
|
|
196
|
+
token: "atom"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/components/CodeEditor/modes/jsonnet.ts
|
|
202
|
+
/**
|
|
203
|
+
* Ported from google/codemirror-mode-jsonnet (Apache-2.0), the mode written by
|
|
204
|
+
* the language's own authors, which was never taken past CodeMirror 5.
|
|
205
|
+
* CodeMirror 5 style names are replaced by their CodeMirror 6 highlight tags:
|
|
206
|
+
* `string-2` is `escape`, `error` is `invalid`.
|
|
207
|
+
*
|
|
208
|
+
* Every pattern is anchored and hoisted. `StringStream.match` slices the rest of
|
|
209
|
+
* the line and, without `^`, scans all of it for a match it then discards unless
|
|
210
|
+
* it started at the cursor — so an unanchored probe costs the whole remaining
|
|
211
|
+
* line, and this tokenizer makes up to twenty of them per token.
|
|
212
|
+
*/
|
|
213
|
+
const COMMENT_END = /^\*\//;
|
|
214
|
+
const COMMENT_START = /^\/\/|^#/;
|
|
215
|
+
const C_COMMENT_START = /^\/\*/;
|
|
216
|
+
const TEXT_BLOCK = /^\|\|\|/;
|
|
217
|
+
const TEXT_BLOCK_END = /^\s*\|\|\|/;
|
|
218
|
+
const RAW_DOUBLE = /^""/;
|
|
219
|
+
const RAW_SINGLE = /^''/;
|
|
220
|
+
const CLOSE_DOUBLE = /^"/;
|
|
221
|
+
const CLOSE_SINGLE = /^'/;
|
|
222
|
+
const ESCAPE = /^\\[\\"'/bfnrt0]/;
|
|
223
|
+
const UNICODE_ESCAPE = /^\\u[0-9a-fA-F]{4}/;
|
|
224
|
+
const BACKSLASH = /^\\/;
|
|
225
|
+
const IMPORT = /^import(?:str)?\s*(@?)(["'])/;
|
|
226
|
+
const QUOTE = /^(@?)(["'])/;
|
|
227
|
+
const ROOT = /^\$/;
|
|
228
|
+
const NUMBER = /^(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i;
|
|
229
|
+
const OPERATOR = /^[-+/*=<>!&~^|$%]+/;
|
|
230
|
+
const IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_]*/;
|
|
231
|
+
const KEYWORDS = {
|
|
232
|
+
local: "keyword",
|
|
233
|
+
self: "keyword",
|
|
234
|
+
super: "keyword",
|
|
235
|
+
assert: "keyword",
|
|
236
|
+
function: "keyword",
|
|
237
|
+
if: "keyword",
|
|
238
|
+
then: "keyword",
|
|
239
|
+
else: "keyword",
|
|
240
|
+
for: "keyword",
|
|
241
|
+
in: "keyword",
|
|
242
|
+
tailstrict: "keyword",
|
|
243
|
+
error: "keyword",
|
|
244
|
+
true: "atom",
|
|
245
|
+
false: "atom",
|
|
246
|
+
null: "atom"
|
|
247
|
+
};
|
|
248
|
+
const jsonnet = {
|
|
249
|
+
name: "jsonnet",
|
|
250
|
+
languageData: { commentTokens: {
|
|
251
|
+
line: "//",
|
|
252
|
+
block: {
|
|
253
|
+
open: "/*",
|
|
254
|
+
close: "*/"
|
|
255
|
+
}
|
|
256
|
+
} },
|
|
257
|
+
startState: () => ({
|
|
258
|
+
cComment: false,
|
|
259
|
+
textBlock: false,
|
|
260
|
+
textBlockIndent: null,
|
|
261
|
+
string: false,
|
|
262
|
+
importString: false,
|
|
263
|
+
stringSingle: false,
|
|
264
|
+
stringRaw: false
|
|
265
|
+
}),
|
|
266
|
+
token: (stream, state) => {
|
|
267
|
+
if (state.cComment) {
|
|
268
|
+
if (stream.match(COMMENT_END)) {
|
|
269
|
+
state.cComment = false;
|
|
270
|
+
return "comment";
|
|
271
|
+
}
|
|
272
|
+
stream.next();
|
|
273
|
+
return "comment";
|
|
274
|
+
}
|
|
275
|
+
if (state.textBlock) {
|
|
276
|
+
if (state.textBlockIndent == null) {
|
|
277
|
+
if (stream.match(TEXT_BLOCK_END)) {
|
|
278
|
+
state.textBlock = false;
|
|
279
|
+
return "string";
|
|
280
|
+
}
|
|
281
|
+
state.textBlockIndent = stream.indentation();
|
|
282
|
+
}
|
|
283
|
+
if (stream.indentation() >= state.textBlockIndent) {
|
|
284
|
+
stream.skipToEnd();
|
|
285
|
+
return "string";
|
|
286
|
+
}
|
|
287
|
+
if (stream.match(TEXT_BLOCK_END)) {
|
|
288
|
+
state.textBlock = false;
|
|
289
|
+
return "string";
|
|
290
|
+
}
|
|
291
|
+
stream.next();
|
|
292
|
+
return "invalid";
|
|
293
|
+
}
|
|
294
|
+
if (state.string || state.importString) {
|
|
295
|
+
const style = state.string ? "string" : "meta";
|
|
296
|
+
if (state.stringRaw) {
|
|
297
|
+
if (stream.match(state.stringSingle ? RAW_SINGLE : RAW_DOUBLE)) return "escape";
|
|
298
|
+
} else {
|
|
299
|
+
if (stream.match(ESCAPE)) return "escape";
|
|
300
|
+
if (stream.match(UNICODE_ESCAPE)) return "escape";
|
|
301
|
+
if (stream.match(BACKSLASH)) return "invalid";
|
|
302
|
+
}
|
|
303
|
+
if (stream.match(state.stringSingle ? CLOSE_SINGLE : CLOSE_DOUBLE)) {
|
|
304
|
+
state.string = false;
|
|
305
|
+
state.importString = false;
|
|
306
|
+
return style;
|
|
307
|
+
}
|
|
308
|
+
stream.next();
|
|
309
|
+
return style;
|
|
310
|
+
}
|
|
311
|
+
if (stream.match(COMMENT_START)) {
|
|
312
|
+
stream.skipToEnd();
|
|
313
|
+
return "comment";
|
|
314
|
+
}
|
|
315
|
+
if (stream.match(C_COMMENT_START)) {
|
|
316
|
+
state.cComment = true;
|
|
317
|
+
return "comment";
|
|
318
|
+
}
|
|
319
|
+
const imported = stream.match(IMPORT);
|
|
320
|
+
if (Array.isArray(imported)) {
|
|
321
|
+
state.importString = true;
|
|
322
|
+
state.stringRaw = imported[1] === "@";
|
|
323
|
+
state.stringSingle = imported[2] === "'";
|
|
324
|
+
return "meta";
|
|
325
|
+
}
|
|
326
|
+
const quoted = stream.match(QUOTE);
|
|
327
|
+
if (Array.isArray(quoted)) {
|
|
328
|
+
state.string = true;
|
|
329
|
+
state.stringRaw = quoted[1] === "@";
|
|
330
|
+
state.stringSingle = quoted[2] === "'";
|
|
331
|
+
return "string";
|
|
332
|
+
}
|
|
333
|
+
if (stream.match(TEXT_BLOCK)) {
|
|
334
|
+
state.textBlock = true;
|
|
335
|
+
state.textBlockIndent = null;
|
|
336
|
+
return "string";
|
|
337
|
+
}
|
|
338
|
+
if (stream.match(ROOT)) return "keyword";
|
|
339
|
+
if (stream.match(NUMBER)) return "number";
|
|
340
|
+
if (stream.match(OPERATOR)) return "operator";
|
|
341
|
+
const identifier = stream.match(IDENTIFIER);
|
|
342
|
+
if (Array.isArray(identifier)) return KEYWORDS[identifier[0]] ?? null;
|
|
343
|
+
stream.next();
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/components/CodeEditor/helpers.ts
|
|
349
|
+
const LANGUAGE_MODES = [
|
|
350
|
+
"application/json",
|
|
351
|
+
"text/plain",
|
|
352
|
+
"text/x-python",
|
|
353
|
+
"text/x-sql",
|
|
354
|
+
"text/x-mysql",
|
|
355
|
+
"text/x-pgsql",
|
|
356
|
+
"text/x-mssql",
|
|
357
|
+
"text/x-sfsql",
|
|
358
|
+
"text/x-bqsql",
|
|
359
|
+
"text/x-plsql",
|
|
360
|
+
"text/x-rsrc",
|
|
361
|
+
"text/x-sh",
|
|
362
|
+
"text/x-toml",
|
|
363
|
+
"text/jsonnet",
|
|
364
|
+
"text/x-dbt",
|
|
365
|
+
"text/javascript",
|
|
366
|
+
"text/typescript"
|
|
367
|
+
];
|
|
368
|
+
const isLanguageMode = (mode) => LANGUAGE_MODES.includes(mode);
|
|
369
|
+
const READ_ONLY_EDITOR = "&.cm-editor:has(.cm-content[contenteditable=\"false\"])";
|
|
370
|
+
const EDITABLE_EDITOR = "&.cm-editor:has(.cm-content[contenteditable=\"true\"])";
|
|
371
|
+
const buildBaseThemeStyles = () => ({
|
|
372
|
+
"*": { lineHeight: "20px" },
|
|
373
|
+
"*::selection": {
|
|
374
|
+
backgroundColor: resolveToken("primary", "31 143 255"),
|
|
375
|
+
color: `${resolveToken("primary-foreground", "255 255 255")} !important`
|
|
376
|
+
},
|
|
377
|
+
[READ_ONLY_EDITOR]: { backgroundColor: resolveToken("secondary", "226 232 240") },
|
|
378
|
+
[`${READ_ONLY_EDITOR} .cm-gutters`]: { backgroundColor: resolveToken("border", "229 231 235") },
|
|
379
|
+
"&.cm-editor .cm-scroller": { overflowAnchor: "none" },
|
|
380
|
+
"&.cm-editor, &.cm-editor .cm-scroller": {
|
|
381
|
+
minHeight: "100%",
|
|
382
|
+
flexGrow: 1,
|
|
383
|
+
alignItems: "stretch !important",
|
|
384
|
+
outline: "none"
|
|
385
|
+
},
|
|
386
|
+
".cm-gutter.cm-foldGutter": { display: "none !important" },
|
|
387
|
+
".cm-gutter.cm-lineNumbers": {
|
|
388
|
+
paddingLeft: "20px",
|
|
389
|
+
paddingRight: "6px"
|
|
390
|
+
},
|
|
391
|
+
".cm-gutters": { height: "auto" },
|
|
392
|
+
"&[class*=\"cm-merge-\"] .cm-deletedLine": { backgroundColor: colors.error[100] },
|
|
393
|
+
"&[class*=\"cm-merge-\"] .cm-changedLine": { backgroundColor: colors.green[100] },
|
|
394
|
+
"&[class*=\"cm-merge-\"] .cm-deletedLineGutter": { backgroundColor: colors.error[200] },
|
|
395
|
+
"&[class*=\"cm-merge-\"] .cm-changedLineGutter": { backgroundColor: colors.green[200] },
|
|
396
|
+
"&[class*=\"cm-merge-\"] .cm-deletedText": { background: colors.error[200] },
|
|
397
|
+
"&[class*=\"cm-merge-\"] .cm-changedText": { background: colors.green[200] },
|
|
398
|
+
"&[class*=\"cm-merge-\"]": { backgroundColor: `${colors.white} !important` },
|
|
399
|
+
"&[class*=\"cm-merge-\"] .cm-gutters": { backgroundColor: `${colors.white} !important` },
|
|
400
|
+
".cm-changeGutter": {
|
|
401
|
+
position: "absolute",
|
|
402
|
+
zIndex: -1,
|
|
403
|
+
width: "100%",
|
|
404
|
+
paddingLeft: 0
|
|
405
|
+
},
|
|
406
|
+
"&[class*=\"cm-merge-\"] .cm-changedLine,&[class*=\"cm-merge-\"] .cm-line, &[class*=\"cm-merge-\"] .cm-deletedChunk": { paddingLeft: 0 }
|
|
407
|
+
});
|
|
408
|
+
const ALWAYS_OFF = {
|
|
409
|
+
drawSelection: false,
|
|
410
|
+
foldGutter: false,
|
|
411
|
+
foldKeymap: false,
|
|
412
|
+
highlightActiveLine: false,
|
|
413
|
+
highlightActiveLineGutter: false
|
|
414
|
+
};
|
|
415
|
+
const buildBasicSetup = (readOnly) => ({
|
|
416
|
+
...ALWAYS_OFF,
|
|
417
|
+
...readOnly ? {
|
|
418
|
+
closeBrackets: false,
|
|
419
|
+
closeBracketsKeymap: false,
|
|
420
|
+
lintKeymap: false,
|
|
421
|
+
indentOnInput: false,
|
|
422
|
+
rectangularSelection: false,
|
|
423
|
+
dropCursor: false,
|
|
424
|
+
highlightSelectionMatches: false
|
|
425
|
+
} : null
|
|
426
|
+
});
|
|
427
|
+
const buildCustomTheme = (scheme) => {
|
|
428
|
+
const foreground = resolveToken("foreground", "30 41 59");
|
|
429
|
+
const dark = scheme === "dark";
|
|
430
|
+
return githubLightInit({
|
|
431
|
+
settings: {
|
|
432
|
+
fontFamily: `'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New'`,
|
|
433
|
+
background: resolveToken("background", "249 250 251"),
|
|
434
|
+
foreground,
|
|
435
|
+
gutterBackground: resolveToken("muted", "241 245 249"),
|
|
436
|
+
gutterForeground: resolveToken("muted-foreground", "100 116 139"),
|
|
437
|
+
gutterBorder: "transparent",
|
|
438
|
+
lineHighlight: "transparent",
|
|
439
|
+
selection: resolveToken("primary", "31 143 255")
|
|
440
|
+
},
|
|
441
|
+
styles: [
|
|
442
|
+
{
|
|
443
|
+
tag: [
|
|
444
|
+
tags.name,
|
|
445
|
+
tags.special(tags.string),
|
|
446
|
+
tags.bracket
|
|
447
|
+
],
|
|
448
|
+
color: foreground
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
tag: tags.standard(tags.name),
|
|
452
|
+
color: colors.purple[600]
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
tag: tags.special(tags.name),
|
|
456
|
+
color: colors.cyan[700]
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
tag: tags.string,
|
|
460
|
+
color: dark ? colors.warning[300] : colors.warning[800]
|
|
461
|
+
}
|
|
462
|
+
]
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
const getLanguageMode = (mode) => {
|
|
466
|
+
switch (mode) {
|
|
467
|
+
case void 0:
|
|
468
|
+
case "application/json": return json();
|
|
469
|
+
case "text/x-python": return python();
|
|
470
|
+
case "text/x-sql": return getSqlLanguageSupport(StandardSQL);
|
|
471
|
+
case "text/x-mysql": return getSqlLanguageSupport(MySQL);
|
|
472
|
+
case "text/x-pgsql": return getSqlLanguageSupport(PostgreSQL);
|
|
473
|
+
case "text/x-mssql": return getSqlLanguageSupport(MSSQL);
|
|
474
|
+
case "text/x-sfsql": return getSqlLanguageSupport("snowflake");
|
|
475
|
+
case "text/x-bqsql": return getSqlLanguageSupport("bigquery");
|
|
476
|
+
case "text/x-plsql": return getSqlLanguageSupport(PLSQL);
|
|
477
|
+
case "text/x-rsrc": return StreamLanguage.define(r);
|
|
478
|
+
case "text/x-sh": return StreamLanguage.define(shell);
|
|
479
|
+
case "text/x-toml": return StreamLanguage.define(toml);
|
|
480
|
+
case "text/jsonnet": return StreamLanguage.define(jsonnet);
|
|
481
|
+
case "text/x-dbt": return StreamLanguage.define(dbt);
|
|
482
|
+
case "text/javascript": return javascript({ jsx: true });
|
|
483
|
+
case "text/typescript": return javascript({
|
|
484
|
+
jsx: true,
|
|
485
|
+
typescript: true
|
|
486
|
+
});
|
|
487
|
+
default: return [];
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
const shouldLintJson = (mode, readOnly) => mode === "application/json" && !readOnly;
|
|
491
|
+
/**
|
|
492
|
+
* Wraps a lint source so a blank document produces no diagnostics.
|
|
493
|
+
*
|
|
494
|
+
* `jsonParseLinter` reports "Unexpected end of input" for empty content, which is right for a file and
|
|
495
|
+
* wrong for an *optional* form field: it starts empty, and clearing it is how its value is removed.
|
|
496
|
+
* Left unwrapped, every such field opens with a red gutter marker contradicting its own validation —
|
|
497
|
+
* `CodeEditorField` puts six of them on one screen.
|
|
498
|
+
*
|
|
499
|
+
* Exported for its test: the wrapper is the behaviour worth pinning, and it needs no editor to exercise.
|
|
500
|
+
*/
|
|
501
|
+
const skipBlankDocument = (source) => (view) => view.state.doc.toString().trim() === "" ? [] : source(view);
|
|
502
|
+
/**
|
|
503
|
+
* The JSON linter, optionally blind to a blank document.
|
|
504
|
+
*
|
|
505
|
+
* - `allowBlankDocument` is opt-in, and only `CodeEditorField` opts in (from `!required`). Suppressing
|
|
506
|
+
* the marker by default would break callers that treat empty as invalid *and* say so nowhere else:
|
|
507
|
+
* `ex-generic/JsonConfiguration.tsx`, `flows/TaskParamsModalContent.tsx` and
|
|
508
|
+
* `stream/PayloadTest.tsx` all gate their button on `isValidJsonConfig`, which is `false` for `''`,
|
|
509
|
+
* with no `disabledReason` — so the gutter marker is the only thing explaining a dead button.
|
|
510
|
+
* - Not derivable from `variant`: `ex-generic/FunctionControl.tsx` is `variant="field"` and empty is
|
|
511
|
+
* an error there too. Whether blank is valid is the *field's* contract, not the control's shape.
|
|
512
|
+
*/
|
|
513
|
+
const buildJsonLinter = (allowBlankDocument) => {
|
|
514
|
+
const source = jsonParseLinter();
|
|
515
|
+
return linter(allowBlankDocument ? skipBlankDocument(source) : source);
|
|
516
|
+
};
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/components/CodeEditor/editorChrome.ts
|
|
519
|
+
/**
|
|
520
|
+
* Mirrors `InputGroup` at the sizing each design language gives a `TextInput`,
|
|
521
|
+
* so an editor dropped into a form reads as one of its fields.
|
|
522
|
+
*
|
|
523
|
+
* The legacy preset reads the neutral ramp because the legacy `secondary`
|
|
524
|
+
* variant does. No semantic token holds that grey, and the nearest one
|
|
525
|
+
* (`--muted`) is a few points off — which is the "almost, but not quite, the
|
|
526
|
+
* input next to it" mismatch this preset exists to remove.
|
|
527
|
+
*/
|
|
528
|
+
const buildInputChrome = (isArgo) => ({
|
|
529
|
+
surface: isArgo ? resolveToken("muted", "241 245 249") : colors.neutral[100],
|
|
530
|
+
borderColor: isArgo ? resolveToken("input", "203 213 225") : colors.neutral[100],
|
|
531
|
+
readOnlySurface: isArgo ? resolveToken("muted", "241 245 249") : colors.neutral[150],
|
|
532
|
+
readOnlyBorderColor: isArgo ? resolveToken("input", "203 213 225") : colors.neutral[150],
|
|
533
|
+
hoverBorderColor: null,
|
|
534
|
+
focusBorderColor: isArgo ? resolveToken("primary", "37 99 235") : resolveToken("ring", "31 143 255"),
|
|
535
|
+
focusRing: `0 0 0 4px ${resolveToken("ring", "31 143 255", isArgo ? .5 : .3)}`,
|
|
536
|
+
radius: isArgo ? "var(--radius-lg, 0.25rem)" : "0.25rem",
|
|
537
|
+
paddingY: isArgo ? "3px" : "5px",
|
|
538
|
+
paddingX: {
|
|
539
|
+
left: "10px",
|
|
540
|
+
right: "14px"
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
/** The SQL workspace's notebook cell: a white canvas, not a form control. */
|
|
544
|
+
const buildCanvasChrome = () => ({
|
|
545
|
+
surface: resolveToken("card", "255 255 255"),
|
|
546
|
+
borderColor: "transparent",
|
|
547
|
+
readOnlySurface: resolveToken("muted", "241 245 249"),
|
|
548
|
+
readOnlyBorderColor: "transparent",
|
|
549
|
+
hoverBorderColor: resolveToken("ring", "31 143 255"),
|
|
550
|
+
focusBorderColor: resolveToken("ring", "31 143 255"),
|
|
551
|
+
focusRing: `0 0 0 4px ${resolveToken("ring", "31 143 255", .3)}`,
|
|
552
|
+
radius: "8px",
|
|
553
|
+
paddingY: "8px",
|
|
554
|
+
paddingX: null
|
|
555
|
+
});
|
|
556
|
+
/**
|
|
557
|
+
* Spread over `buildBaseThemeStyles()` — never used alone. The read-only keys
|
|
558
|
+
* are the base's own, so they replace its wash instead of landing beside it.
|
|
559
|
+
*/
|
|
560
|
+
const buildChromeStyles = (chrome) => ({
|
|
561
|
+
"&.cm-editor": {
|
|
562
|
+
border: `solid 1px ${chrome.borderColor}`,
|
|
563
|
+
borderRadius: chrome.radius,
|
|
564
|
+
backgroundColor: chrome.surface,
|
|
565
|
+
paddingTop: chrome.paddingY,
|
|
566
|
+
paddingBottom: chrome.paddingY
|
|
567
|
+
},
|
|
568
|
+
"&.cm-editor :is(.cm-gutters,.cm-scroller)": { backgroundColor: chrome.surface },
|
|
569
|
+
...chrome.paddingX ? { "&.cm-editor:not(:has(.cm-gutters)) .cm-content": {
|
|
570
|
+
paddingLeft: chrome.paddingX.left,
|
|
571
|
+
paddingRight: chrome.paddingX.right
|
|
572
|
+
} } : null,
|
|
573
|
+
...chrome.hoverBorderColor ? { [`${EDITABLE_EDITOR}:hover`]: { borderColor: chrome.hoverBorderColor } } : null,
|
|
574
|
+
[`${EDITABLE_EDITOR}:focus-within`]: {
|
|
575
|
+
borderColor: chrome.focusBorderColor,
|
|
576
|
+
boxShadow: chrome.focusRing
|
|
577
|
+
},
|
|
578
|
+
[READ_ONLY_EDITOR]: {
|
|
579
|
+
backgroundColor: chrome.readOnlySurface,
|
|
580
|
+
borderColor: chrome.readOnlyBorderColor
|
|
581
|
+
},
|
|
582
|
+
[`${READ_ONLY_EDITOR} .cm-gutters`]: { backgroundColor: chrome.readOnlySurface },
|
|
583
|
+
[`${READ_ONLY_EDITOR} .cm-scroller`]: { backgroundColor: chrome.readOnlySurface }
|
|
584
|
+
});
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/components/CodeEditor/search.ts
|
|
587
|
+
const setSearchEffect = StateEffect.define();
|
|
588
|
+
function findMatches(doc, query) {
|
|
589
|
+
if (!query) return [];
|
|
590
|
+
const text = doc.toString();
|
|
591
|
+
try {
|
|
592
|
+
const regex = new RegExp(escapeStringRegexp(query), "gi");
|
|
593
|
+
return Array.from(text.matchAll(regex)).map((match, index) => {
|
|
594
|
+
const from = match.index;
|
|
595
|
+
return {
|
|
596
|
+
from,
|
|
597
|
+
to: from + match[0].length,
|
|
598
|
+
text: match[0],
|
|
599
|
+
localIndex: index
|
|
600
|
+
};
|
|
601
|
+
});
|
|
602
|
+
} catch (e) {
|
|
603
|
+
console.warn("Invalid search regex:", e);
|
|
604
|
+
return [];
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
function createDecorations(matches, selectedLocalIndex) {
|
|
608
|
+
const decorations = matches.map((match) => {
|
|
609
|
+
const isSelected = match.localIndex === selectedLocalIndex;
|
|
610
|
+
return Decoration.mark({ class: isSelected ? "cm-searchMatch-selected" : "cm-searchMatch" }).range(match.from, match.to);
|
|
611
|
+
});
|
|
612
|
+
return Decoration.set(decorations, true);
|
|
613
|
+
}
|
|
614
|
+
const searchField = StateField.define({
|
|
615
|
+
create() {
|
|
616
|
+
return {
|
|
617
|
+
query: "",
|
|
618
|
+
selectedMatchIndex: void 0,
|
|
619
|
+
matches: [],
|
|
620
|
+
decorations: Decoration.none
|
|
621
|
+
};
|
|
622
|
+
},
|
|
623
|
+
update(state, tr) {
|
|
624
|
+
let newState = state;
|
|
625
|
+
for (const effect of tr.effects) {
|
|
626
|
+
if (!effect.is(setSearchEffect)) continue;
|
|
627
|
+
const { query, selectedMatchIndex } = effect.value;
|
|
628
|
+
const matches = findMatches(tr.state.doc, query);
|
|
629
|
+
newState = {
|
|
630
|
+
query,
|
|
631
|
+
selectedMatchIndex,
|
|
632
|
+
matches,
|
|
633
|
+
decorations: createDecorations(matches, selectedMatchIndex)
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
if (tr.docChanged && newState.query) {
|
|
637
|
+
const matches = findMatches(tr.state.doc, newState.query);
|
|
638
|
+
const decorations = createDecorations(matches, newState.selectedMatchIndex);
|
|
639
|
+
newState = {
|
|
640
|
+
...newState,
|
|
641
|
+
matches,
|
|
642
|
+
decorations
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
return newState;
|
|
646
|
+
},
|
|
647
|
+
provide: (field) => EditorView.decorations.from(field, (state) => state.decorations)
|
|
648
|
+
});
|
|
649
|
+
const searchViewPlugin = ViewPlugin.fromClass(class {
|
|
650
|
+
lastSelectedIndex;
|
|
651
|
+
update(update) {
|
|
652
|
+
const state = update.state.field(searchField);
|
|
653
|
+
if (state.selectedMatchIndex !== void 0 && state.selectedMatchIndex !== this.lastSelectedIndex) {
|
|
654
|
+
const match = state.matches[state.selectedMatchIndex];
|
|
655
|
+
if (match) requestAnimationFrame(() => {
|
|
656
|
+
update.view.dispatch({ effects: EditorView.scrollIntoView(match.from, { y: "center" }) });
|
|
657
|
+
});
|
|
658
|
+
this.lastSelectedIndex = state.selectedMatchIndex;
|
|
659
|
+
}
|
|
660
|
+
if (state.selectedMatchIndex === void 0) this.lastSelectedIndex = void 0;
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
const searchTheme = EditorView.baseTheme({
|
|
664
|
+
".cm-searchMatch": { backgroundColor: colors.blue[100] },
|
|
665
|
+
".cm-searchMatch > span": { color: `${colors.blue[600]} !important` },
|
|
666
|
+
".cm-searchMatch-selected": { backgroundColor: colors.blue[600] },
|
|
667
|
+
".cm-searchMatch-selected > span": { color: `${colors.white} !important` }
|
|
668
|
+
});
|
|
669
|
+
function searchExtension() {
|
|
670
|
+
return [
|
|
671
|
+
searchField,
|
|
672
|
+
searchViewPlugin,
|
|
673
|
+
searchTheme
|
|
674
|
+
];
|
|
675
|
+
}
|
|
676
|
+
function updateSearch(view, query, selectedMatchIndex) {
|
|
677
|
+
view.dispatch({ effects: setSearchEffect.of({
|
|
678
|
+
query,
|
|
679
|
+
selectedMatchIndex
|
|
680
|
+
}) });
|
|
681
|
+
}
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/components/CodeEditor/ToggleComponentHelp.tsx
|
|
684
|
+
const ToggleComponentHelp = () => /* @__PURE__ */ jsxs("div", { children: [
|
|
685
|
+
"Use ",
|
|
686
|
+
/* @__PURE__ */ jsx(Kbd, { children: isMac ? "Command+/" : "Ctrl+/" }),
|
|
687
|
+
" to toggle comments."
|
|
688
|
+
] });
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region src/components/CodeEditor/tokenTheme.ts
|
|
691
|
+
const themeCache = /* @__PURE__ */ new Map();
|
|
692
|
+
/**
|
|
693
|
+
* Memoize a CodeMirror theme/extension built from `resolveToken`, shared across
|
|
694
|
+
* every instance that passes the same `cacheKey` and rebuilt whenever the active
|
|
695
|
+
* brand / light-dark mode changes. `build` reads live `--*` values off `<html>`,
|
|
696
|
+
* so the active theme is an invisible dependency a deps array can't see.
|
|
697
|
+
*
|
|
698
|
+
* `build` receives the scheme those values were read under, for the theme values
|
|
699
|
+
* that are a light/dark *pair* rather than a token lookup (a categorical diff
|
|
700
|
+
* wash has no semantic token, but an opaque light pastel still has to become a
|
|
701
|
+
* low-alpha tint under dark). It comes from the same read that produced the key,
|
|
702
|
+
* so a builder cannot resolve one scheme's colours under the other one's key.
|
|
703
|
+
*
|
|
704
|
+
* `cacheKey` is the extension's full identity: anything the builder closes over
|
|
705
|
+
* must be part of it (e.g. `` `merge-pane:${deleted}` ``), or instances built
|
|
706
|
+
* from different inputs would share one theme.
|
|
707
|
+
*/
|
|
708
|
+
const useThemedExtension = (cacheKey, build) => {
|
|
709
|
+
const { scheme, cacheKey: themeKey } = useThemeAttributes();
|
|
710
|
+
const key = `${themeKey} ${cacheKey}`;
|
|
711
|
+
let cached = themeCache.get(key);
|
|
712
|
+
if (!cached) {
|
|
713
|
+
cached = build(scheme);
|
|
714
|
+
themeCache.set(key, cached);
|
|
715
|
+
}
|
|
716
|
+
return cached;
|
|
717
|
+
};
|
|
718
|
+
//#endregion
|
|
719
|
+
//#region src/components/CodeEditor/tooltips.ts
|
|
720
|
+
const establishesFixedContainingBlock = (style) => style.transform !== "none" || style.translate !== "none" || style.rotate !== "none" || style.scale !== "none" || style.perspective !== "none" || style.filter !== "none" || style.backdropFilter !== "none" || /\b(paint|layout|strict|content)\b/.test(style.contain) || /\b(transform|perspective|filter|contain)\b/.test(style.willChange);
|
|
721
|
+
const crops = (style) => style.overflowX !== "visible" || style.overflowY !== "visible" || style.maskImage !== "none" || style.contentVisibility !== "visible" || /\b(paint|strict|content)\b/.test(style.contain);
|
|
722
|
+
/**
|
|
723
|
+
* Where a tooltip can hang without being cropped, or `null` for "wherever
|
|
724
|
+
* CodeMirror would put it anyway".
|
|
725
|
+
*
|
|
726
|
+
* Two ancestors matter, and they are not the same ancestor. The **outermost
|
|
727
|
+
* cropper** is the one to get above — landing anywhere below it leaves the
|
|
728
|
+
* tooltip inside the box doing the cropping. The **containing block** is where
|
|
729
|
+
* the search can stop, because from there upwards `position: fixed` is measured
|
|
730
|
+
* against that element and nothing higher can crop it.
|
|
731
|
+
*
|
|
732
|
+
* `document.body` and `<html>` are not treated as croppers: a fixed box whose
|
|
733
|
+
* containing block is the viewport is not clipped by their overflow, and
|
|
734
|
+
* hosting outside `<body>` would drop the tooltip out of the app's stacking and
|
|
735
|
+
* pointer-events scope for no gain.
|
|
736
|
+
*/
|
|
737
|
+
const findTooltipHost = (from) => {
|
|
738
|
+
let outermostCropper = null;
|
|
739
|
+
for (let node = from.parentElement; node && node !== document.body; node = node.parentElement) {
|
|
740
|
+
const style = getComputedStyle(node);
|
|
741
|
+
if (crops(style)) outermostCropper = node;
|
|
742
|
+
else if (establishesFixedContainingBlock(style)) return outermostCropper?.parentElement ?? node;
|
|
743
|
+
}
|
|
744
|
+
return outermostCropper?.parentElement ?? null;
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* `tooltips()`, re-hosted so the completion popup is never cropped.
|
|
748
|
+
*
|
|
749
|
+
* CodeMirror hangs tooltips inside the editor and lets `position: fixed` carry
|
|
750
|
+
* them past its edges. That holds only while the viewport is their containing
|
|
751
|
+
* block — a modal centred with a translate, a sheet sliding in, or a box under
|
|
752
|
+
* paint containment takes that job, and then every scroller, mask and contained
|
|
753
|
+
* box in between crops the popup instead. A tall editor hides the damage; a
|
|
754
|
+
* one-line one shows a sliver of an unreadable list.
|
|
755
|
+
*
|
|
756
|
+
* The two shapes this has to survive in production are a `Modal`, whose body
|
|
757
|
+
* scrolls and carries the argo fade mask, and kbc-ui's SQL editor, which wraps
|
|
758
|
+
* every code block in `content-visibility: auto` to keep long scripts cheap.
|
|
759
|
+
*
|
|
760
|
+
* Hosting the layer above the outermost cropper clears all of that while keeping
|
|
761
|
+
* the popup inside the modal's stacking, focus and pointer-events scope — which
|
|
762
|
+
* `document.body` would not: the popup would sit behind the modal, and Radix
|
|
763
|
+
* leaves the body `pointer-events: none` while a dialog is open.
|
|
764
|
+
*
|
|
765
|
+
* Both editors install this, and it is the only place either of them configures
|
|
766
|
+
* a tooltip host. Keep it that way: CodeMirror's tooltip config takes the first
|
|
767
|
+
* contributor that names a parent, so a second mechanism would not compose with
|
|
768
|
+
* this one — it would silently win or lose on extension order.
|
|
769
|
+
*/
|
|
770
|
+
const tooltipsExtension = () => {
|
|
771
|
+
const layer = new Compartment();
|
|
772
|
+
return [layer.of(tooltips()), ViewPlugin.define((view) => {
|
|
773
|
+
const scheduled = setTimeout(() => {
|
|
774
|
+
if (!view.dom.isConnected) return;
|
|
775
|
+
const parent = findTooltipHost(view.dom);
|
|
776
|
+
if (parent) view.dispatch({ effects: layer.reconfigure(tooltips({ parent })) });
|
|
777
|
+
});
|
|
778
|
+
return { destroy: () => clearTimeout(scheduled) };
|
|
779
|
+
})];
|
|
780
|
+
};
|
|
781
|
+
/**
|
|
782
|
+
* The extension above, built once per editor. Rebuilding it would hand
|
|
783
|
+
* CodeMirror a fresh compartment and plugin on every reconfigure, dropping the
|
|
784
|
+
* host it had already resolved — so it is only ever reached through this hook.
|
|
785
|
+
*/
|
|
786
|
+
const useTooltipsExtension = () => useMemo(tooltipsExtension, []);
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region src/components/CodeEditor/variableCompletion.ts
|
|
789
|
+
const BOOST = 2e3;
|
|
790
|
+
const NAME = String.raw`[\w-]*`;
|
|
791
|
+
const AT_CARET = new RegExp(String.raw`(?:\{{1,2} ?)?${NAME}$`);
|
|
792
|
+
const NAME_AT_END = new RegExp(`${NAME}$`);
|
|
793
|
+
const OPENING = /\{{1,2} ?$/;
|
|
794
|
+
const CLOSING = /^ ?\}{1,2}/;
|
|
795
|
+
/**
|
|
796
|
+
* Completes a mustache-style `{{name}}` placeholder.
|
|
797
|
+
*/
|
|
798
|
+
const completeVariables = (variables = []) => {
|
|
799
|
+
if (variables.length === 0) return () => null;
|
|
800
|
+
const options = variables.map(({ name, value }) => ({
|
|
801
|
+
label: name,
|
|
802
|
+
displayLabel: `{{${name}}}`,
|
|
803
|
+
detail: value,
|
|
804
|
+
type: "variable",
|
|
805
|
+
boost: BOOST,
|
|
806
|
+
apply: (view, completion, from, to) => {
|
|
807
|
+
const { doc } = view.state;
|
|
808
|
+
const line = doc.lineAt(from);
|
|
809
|
+
const insert = `{{${completion.label}}}`;
|
|
810
|
+
const opening = OPENING.exec(doc.sliceString(line.from, from));
|
|
811
|
+
const closing = CLOSING.exec(doc.sliceString(to, line.to));
|
|
812
|
+
const start = opening ? from - opening[0].length : from;
|
|
813
|
+
const end = closing ? to + closing[0].length : to;
|
|
814
|
+
view.dispatch({
|
|
815
|
+
changes: {
|
|
816
|
+
from: start,
|
|
817
|
+
to: end,
|
|
818
|
+
insert
|
|
819
|
+
},
|
|
820
|
+
selection: { anchor: start + insert.length }
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}));
|
|
824
|
+
return (context) => {
|
|
825
|
+
const match = context.matchBefore(AT_CARET);
|
|
826
|
+
if (!match?.text) return null;
|
|
827
|
+
const [name = ""] = NAME_AT_END.exec(match.text) ?? [];
|
|
828
|
+
return {
|
|
829
|
+
from: match.to - name.length,
|
|
830
|
+
options
|
|
831
|
+
};
|
|
832
|
+
};
|
|
833
|
+
};
|
|
834
|
+
/**
|
|
835
|
+
* The completion source both editors install, with an identity that never moves.
|
|
836
|
+
*
|
|
837
|
+
* Both hold it inside the memo that keys their whole extension tree, and callers
|
|
838
|
+
* build the list inline — a config row mapped to `{ name, value }` in a store
|
|
839
|
+
* selector, so a fresh array arrives on every store push. Because CodeMirror asks
|
|
840
|
+
* the source for options rather than reading them up front, holding it steady costs
|
|
841
|
+
* nothing: a completion request always reaches the latest render's variables.
|
|
842
|
+
*/
|
|
843
|
+
const useVariableCompletion = (variables = []) => useStableCallback(completeVariables(variables));
|
|
844
|
+
//#endregion
|
|
845
|
+
//#region src/components/CodeEditor/CodeEditor.tsx
|
|
846
|
+
const emptyObject = {};
|
|
847
|
+
const CodeEditor = ({ value, previousValue, onChange, variant = "plain", mode = "application/json", placeholder: placeholder$1 = "", ariaLabel, ariaLabelledBy, ariaDescribedBy, ariaInvalid, ariaRequired, allowBlankDocument = false, onBlur, searchQuery, searchMatchIndex, readOnly = false, inputLocked = false, autocompletions, completionSource, variables, extraKeys = emptyObject, withToggleCommentHint = false, withAutofocus = false, withLineNumbers = true, withLineWrapping = true, withCollapseUnchanged = false, withCopyButton = false, completeAny = false, help = null, helpPostfix = null, renderAdditionalButtons, className }) => {
|
|
848
|
+
const handleChange = useStableCallback((next) => onChange?.(next));
|
|
849
|
+
const handleBlur = useStableCallback(() => onBlur?.());
|
|
850
|
+
const withSearch = searchQuery !== void 0;
|
|
851
|
+
const withBlur = onBlur !== void 0;
|
|
852
|
+
const editorRef = useRef(null);
|
|
853
|
+
const contentAria = useMemo(() => {
|
|
854
|
+
const attributes = {};
|
|
855
|
+
if (ariaLabel !== void 0) attributes["aria-label"] = ariaLabel;
|
|
856
|
+
if (ariaLabelledBy !== void 0) attributes["aria-labelledby"] = ariaLabelledBy;
|
|
857
|
+
if (ariaDescribedBy !== void 0) attributes["aria-describedby"] = ariaDescribedBy;
|
|
858
|
+
if (ariaInvalid !== void 0) attributes["aria-invalid"] = String(ariaInvalid);
|
|
859
|
+
if (ariaRequired !== void 0) attributes["aria-required"] = String(ariaRequired);
|
|
860
|
+
return Object.keys(attributes).length > 0 ? attributes : null;
|
|
861
|
+
}, [
|
|
862
|
+
ariaLabel,
|
|
863
|
+
ariaLabelledBy,
|
|
864
|
+
ariaDescribedBy,
|
|
865
|
+
ariaInvalid,
|
|
866
|
+
ariaRequired
|
|
867
|
+
]);
|
|
868
|
+
useEffect(() => {
|
|
869
|
+
const view = editorRef.current?.view;
|
|
870
|
+
if (view && withSearch) updateSearch(view, searchQuery, searchMatchIndex);
|
|
871
|
+
}, [
|
|
872
|
+
withSearch,
|
|
873
|
+
searchQuery,
|
|
874
|
+
searchMatchIndex
|
|
875
|
+
]);
|
|
876
|
+
const handleCreateEditor = useStableCallback((view) => {
|
|
877
|
+
if (searchQuery) updateSearch(view, searchQuery, searchMatchIndex);
|
|
878
|
+
});
|
|
879
|
+
const extraKeysRef = useRef(extraKeys);
|
|
880
|
+
useLayoutEffect(() => {
|
|
881
|
+
extraKeysRef.current = extraKeys;
|
|
882
|
+
});
|
|
883
|
+
const boundKeysSignature = Object.keys(extraKeys).join("\n");
|
|
884
|
+
const boundKeys = useMemo(() => boundKeysSignature.split("\n").filter(Boolean), [boundKeysSignature]);
|
|
885
|
+
const tooltipLayer = useTooltipsExtension();
|
|
886
|
+
const variableCompletion = useVariableCompletion(variables);
|
|
887
|
+
const customTheme = useThemedExtension("editor:syntax", buildCustomTheme);
|
|
888
|
+
const isArgo = useArgoDesign();
|
|
889
|
+
const isField = variant === "field";
|
|
890
|
+
const baseTheme = useThemedExtension(isField ? `code-editor:field:${isArgo ? "argo" : "legacy"}` : "code-editor:chrome", () => EditorView.theme({
|
|
891
|
+
...buildBaseThemeStyles(),
|
|
892
|
+
...isField ? buildChromeStyles(buildInputChrome(isArgo)) : null
|
|
893
|
+
}));
|
|
894
|
+
const commonExtensions = useMemo(() => {
|
|
895
|
+
const callerCompletions = completionSource ?? (completeAny ? completeAnyWord : autocompletions?.length ? autocompletions : null);
|
|
896
|
+
const completionEntries = [...callerCompletions ? [{ autocomplete: callerCompletions }] : [], { autocomplete: variableCompletion }];
|
|
897
|
+
return [
|
|
898
|
+
getLanguageMode(mode),
|
|
899
|
+
shouldLintJson(mode, readOnly) ? buildJsonLinter(allowBlankDocument) : [],
|
|
900
|
+
withLineWrapping ? EditorView.lineWrapping : [],
|
|
901
|
+
EditorState.languageData.of(() => completionEntries),
|
|
902
|
+
keymap.of(boundKeys.map((key) => ({
|
|
903
|
+
key,
|
|
904
|
+
run: () => {
|
|
905
|
+
extraKeysRef.current[key]?.();
|
|
906
|
+
return true;
|
|
907
|
+
}
|
|
908
|
+
}))),
|
|
909
|
+
readOnly ? [] : [autocompletion()],
|
|
910
|
+
contentAria ? EditorView.contentAttributes.of(contentAria) : [],
|
|
911
|
+
withBlur ? EditorView.domEventHandlers({ blur: handleBlur }) : [],
|
|
912
|
+
withSearch ? searchExtension() : [],
|
|
913
|
+
tooltipLayer,
|
|
914
|
+
baseTheme
|
|
915
|
+
];
|
|
916
|
+
}, [
|
|
917
|
+
autocompletions,
|
|
918
|
+
completionSource,
|
|
919
|
+
variableCompletion,
|
|
920
|
+
completeAny,
|
|
921
|
+
boundKeys,
|
|
922
|
+
mode,
|
|
923
|
+
readOnly,
|
|
924
|
+
allowBlankDocument,
|
|
925
|
+
withLineWrapping,
|
|
926
|
+
baseTheme,
|
|
927
|
+
contentAria,
|
|
928
|
+
withBlur,
|
|
929
|
+
handleBlur,
|
|
930
|
+
withSearch,
|
|
931
|
+
tooltipLayer
|
|
932
|
+
]);
|
|
933
|
+
const extensions = useMemo(() => {
|
|
934
|
+
return [
|
|
935
|
+
...commonExtensions,
|
|
936
|
+
placeholder(placeholder$1),
|
|
937
|
+
EditorView.editable.of(!readOnly),
|
|
938
|
+
EditorState.readOnly.of(readOnly || inputLocked),
|
|
939
|
+
previousValue ? unifiedMergeView({
|
|
940
|
+
original: previousValue,
|
|
941
|
+
mergeControls: false,
|
|
942
|
+
highlightChanges: false,
|
|
943
|
+
collapseUnchanged: withCollapseUnchanged ? {} : void 0
|
|
944
|
+
}) : []
|
|
945
|
+
];
|
|
946
|
+
}, [
|
|
947
|
+
commonExtensions,
|
|
948
|
+
placeholder$1,
|
|
949
|
+
readOnly,
|
|
950
|
+
inputLocked,
|
|
951
|
+
previousValue,
|
|
952
|
+
withCollapseUnchanged
|
|
953
|
+
]);
|
|
954
|
+
const config = useMemo(() => {
|
|
955
|
+
return {
|
|
956
|
+
...buildBasicSetup(readOnly),
|
|
957
|
+
lineNumbers: withLineNumbers,
|
|
958
|
+
...withSearch ? { searchKeymap: false } : null
|
|
959
|
+
};
|
|
960
|
+
}, [
|
|
961
|
+
withLineNumbers,
|
|
962
|
+
readOnly,
|
|
963
|
+
withSearch
|
|
964
|
+
]);
|
|
965
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
966
|
+
"data-variant": variant,
|
|
967
|
+
className: cn("tw:relative tw:flex tw:min-h-0 tw:flex-col tw:[&_.cm-mergeViewEditor]:overflow-visible tw:[&_.cm-mergeViewEditors]:h-full tw:[&_.cm-mergeView]:h-full tw:[&_>.cm-theme]:h-full", isField ? "tw:[&_>.cm-theme]:overflow-visible tw:[&_>.cm-theme]:bg-transparent" : "tw:[&_>.cm-theme]:overflow-auto tw:[&_>.cm-theme]:bg-background", className),
|
|
968
|
+
onKeyDown: (event) => {
|
|
969
|
+
if (event.key === keyCodes.ESCAPE) event.stopPropagation();
|
|
970
|
+
},
|
|
971
|
+
children: [
|
|
972
|
+
/* @__PURE__ */ jsx(ButtonToolbar, {
|
|
973
|
+
value: withCopyButton ? value : void 0,
|
|
974
|
+
children: renderAdditionalButtons?.(value)
|
|
975
|
+
}),
|
|
976
|
+
/* @__PURE__ */ jsx(CodeMirror, {
|
|
977
|
+
ref: editorRef,
|
|
978
|
+
onCreateEditor: handleCreateEditor,
|
|
979
|
+
theme: customTheme,
|
|
980
|
+
value,
|
|
981
|
+
onChange: handleChange,
|
|
982
|
+
extensions,
|
|
983
|
+
autoFocus: withAutofocus,
|
|
984
|
+
basicSetup: config
|
|
985
|
+
}),
|
|
986
|
+
!readOnly && (withToggleCommentHint || help || helpPostfix) && /* @__PURE__ */ jsxs(HelpBlock, {
|
|
987
|
+
className: "tw:mt-2 tw:flex tw:flex-wrap tw:gap-1",
|
|
988
|
+
children: [
|
|
989
|
+
help,
|
|
990
|
+
withToggleCommentHint ? /* @__PURE__ */ jsx(ToggleComponentHelp, {}) : null,
|
|
991
|
+
helpPostfix
|
|
992
|
+
]
|
|
993
|
+
})
|
|
994
|
+
]
|
|
995
|
+
});
|
|
996
|
+
};
|
|
997
|
+
//#endregion
|
|
998
|
+
export { CodeEditor, LANGUAGE_MODES, buildBaseThemeStyles, buildBasicSetup, buildCanvasChrome, buildChromeStyles, buildCustomTheme, isLanguageMode, searchExtension, updateSearch, useThemedExtension, useTooltipsExtension, useVariableCompletion };
|
|
999
|
+
|
|
1000
|
+
//# sourceMappingURL=CodeEditor-DyaN-Ij2.js.map
|