@keboola/design 9.1.0 → 11.0.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 +119 -40
- package/COMPONENT-API.md +31 -9
- package/README.md +3 -3
- package/dist/MermaidDiagram-ZU5KAVRT.js +18 -0
- package/dist/MermaidDiagram-ZU5KAVRT.js.map +1 -0
- package/dist/charts.d.ts +37 -2
- package/dist/charts.js +11 -9
- package/dist/charts.js.map +1 -1
- package/dist/chunk-2YYJDKSP.js +51 -0
- package/dist/chunk-2YYJDKSP.js.map +1 -0
- package/dist/chunk-3P5UUCFI.js +385 -0
- package/dist/chunk-3P5UUCFI.js.map +1 -0
- package/dist/chunk-3QDFDDWZ.js +99 -0
- package/dist/chunk-3QDFDDWZ.js.map +1 -0
- package/dist/chunk-3W27OLK5.js +15 -0
- package/dist/chunk-3W27OLK5.js.map +1 -0
- package/dist/chunk-4FIZZONW.js +40 -0
- package/dist/chunk-4FIZZONW.js.map +1 -0
- package/dist/chunk-4GIAXOJG.js +133 -0
- package/dist/chunk-4GIAXOJG.js.map +1 -0
- package/dist/chunk-52NDNMK7.js +99 -0
- package/dist/chunk-52NDNMK7.js.map +1 -0
- package/dist/chunk-576G5OES.js +201 -0
- package/dist/chunk-576G5OES.js.map +1 -0
- package/dist/chunk-5AIE6SET.js +659 -0
- package/dist/chunk-5AIE6SET.js.map +1 -0
- package/dist/chunk-5FTNAZRW.js +327 -0
- package/dist/chunk-5FTNAZRW.js.map +1 -0
- package/dist/chunk-5IG2S7ZY.js +70 -0
- package/dist/chunk-5IG2S7ZY.js.map +1 -0
- package/dist/chunk-5QCXHNCW.js +404 -0
- package/dist/chunk-5QCXHNCW.js.map +1 -0
- package/dist/chunk-6DUMGC7Y.js +105 -0
- package/dist/chunk-6DUMGC7Y.js.map +1 -0
- package/dist/chunk-6J25CVST.js +174 -0
- package/dist/chunk-6J25CVST.js.map +1 -0
- package/dist/chunk-6NN35XOP.js +120 -0
- package/dist/chunk-6NN35XOP.js.map +1 -0
- package/dist/chunk-6NZBVA4T.js +24 -0
- package/dist/chunk-6NZBVA4T.js.map +1 -0
- package/dist/chunk-6W5BHRCL.js +295 -0
- package/dist/chunk-6W5BHRCL.js.map +1 -0
- package/dist/chunk-72BKRCEG.js +409 -0
- package/dist/chunk-72BKRCEG.js.map +1 -0
- package/dist/chunk-7GTI3PPI.js +95 -0
- package/dist/chunk-7GTI3PPI.js.map +1 -0
- package/dist/chunk-7P6PLZ4B.js +74 -0
- package/dist/chunk-7P6PLZ4B.js.map +1 -0
- package/dist/chunk-7WZWY5IA.js +46 -0
- package/dist/chunk-7WZWY5IA.js.map +1 -0
- package/dist/chunk-AIYO2632.js +489 -0
- package/dist/chunk-AIYO2632.js.map +1 -0
- package/dist/chunk-ANFZWPNE.js +112 -0
- package/dist/chunk-ANFZWPNE.js.map +1 -0
- package/dist/chunk-ANZTVAJU.js +73 -0
- package/dist/chunk-ANZTVAJU.js.map +1 -0
- package/dist/chunk-BD5BTJKX.js +166 -0
- package/dist/chunk-BD5BTJKX.js.map +1 -0
- package/dist/chunk-BHGIDSRJ.js +140 -0
- package/dist/chunk-BHGIDSRJ.js.map +1 -0
- package/dist/chunk-BSQWZITZ.js +507 -0
- package/dist/chunk-BSQWZITZ.js.map +1 -0
- package/dist/chunk-D3LAIK62.js +23 -0
- package/dist/chunk-D3LAIK62.js.map +1 -0
- package/dist/chunk-DODCR43C.js +155 -0
- package/dist/chunk-DODCR43C.js.map +1 -0
- package/dist/chunk-EEK5NGZF.js +40 -0
- package/dist/chunk-EEK5NGZF.js.map +1 -0
- package/dist/chunk-ENRG7TXA.js +11 -0
- package/dist/chunk-ENRG7TXA.js.map +1 -0
- package/dist/chunk-EQRMGIGY.js +239 -0
- package/dist/chunk-EQRMGIGY.js.map +1 -0
- package/dist/chunk-ERAHK5YQ.js +495 -0
- package/dist/chunk-ERAHK5YQ.js.map +1 -0
- package/dist/chunk-F3FOFY2P.js +124 -0
- package/dist/chunk-F3FOFY2P.js.map +1 -0
- package/dist/chunk-F6BTWFOC.js +507 -0
- package/dist/chunk-F6BTWFOC.js.map +1 -0
- package/dist/chunk-F6J6NNAL.js +34 -0
- package/dist/chunk-F6J6NNAL.js.map +1 -0
- package/dist/chunk-FCHJ7D5O.js +59 -0
- package/dist/chunk-FCHJ7D5O.js.map +1 -0
- package/dist/chunk-FFJTEQCC.js +80 -0
- package/dist/chunk-FFJTEQCC.js.map +1 -0
- package/dist/chunk-FUFMVW7O.js +64 -0
- package/dist/chunk-FUFMVW7O.js.map +1 -0
- package/dist/chunk-FVPGQ6UE.js +25 -0
- package/dist/chunk-FVPGQ6UE.js.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-GACFOW3E.js +51 -0
- package/dist/chunk-GACFOW3E.js.map +1 -0
- package/dist/chunk-GDT6HQMK.js +42 -0
- package/dist/chunk-GDT6HQMK.js.map +1 -0
- package/dist/chunk-HLGU22C6.js +2589 -0
- package/dist/chunk-HLGU22C6.js.map +1 -0
- package/dist/chunk-HPMYYGP7.js +134 -0
- package/dist/chunk-HPMYYGP7.js.map +1 -0
- package/dist/chunk-I2UCOD45.js +197 -0
- package/dist/chunk-I2UCOD45.js.map +1 -0
- package/dist/chunk-IEGDZUVM.js +75 -0
- package/dist/chunk-IEGDZUVM.js.map +1 -0
- package/dist/chunk-IIS7INHF.js +47 -0
- package/dist/chunk-IIS7INHF.js.map +1 -0
- package/dist/chunk-ITELSEFU.js +256 -0
- package/dist/chunk-ITELSEFU.js.map +1 -0
- package/dist/chunk-IXAYNBOY.js +407 -0
- package/dist/chunk-IXAYNBOY.js.map +1 -0
- package/dist/chunk-JUW2ETEI.js +191 -0
- package/dist/chunk-JUW2ETEI.js.map +1 -0
- package/dist/chunk-K65C7CVE.js +127 -0
- package/dist/chunk-K65C7CVE.js.map +1 -0
- package/dist/chunk-KDI64MCY.js +189 -0
- package/dist/chunk-KDI64MCY.js.map +1 -0
- package/dist/chunk-KN4ASMH5.js +160 -0
- package/dist/chunk-KN4ASMH5.js.map +1 -0
- package/dist/chunk-KQW7QNTU.js +1549 -0
- package/dist/chunk-KQW7QNTU.js.map +1 -0
- package/dist/chunk-KR7NXXHC.js +66 -0
- package/dist/chunk-KR7NXXHC.js.map +1 -0
- package/dist/chunk-KRZKIVMA.js +142 -0
- package/dist/chunk-KRZKIVMA.js.map +1 -0
- package/dist/chunk-KTTLLKGQ.js +185 -0
- package/dist/chunk-KTTLLKGQ.js.map +1 -0
- package/dist/chunk-KWKSHPDP.js +234 -0
- package/dist/chunk-KWKSHPDP.js.map +1 -0
- package/dist/chunk-KZVC7OYG.js +57 -0
- package/dist/chunk-KZVC7OYG.js.map +1 -0
- package/dist/chunk-L5DHUN2V.js +204 -0
- package/dist/chunk-L5DHUN2V.js.map +1 -0
- package/dist/chunk-LCTGEH57.js +1376 -0
- package/dist/chunk-LCTGEH57.js.map +1 -0
- package/dist/chunk-LXLIQ2D6.js +12 -0
- package/dist/chunk-LXLIQ2D6.js.map +1 -0
- package/dist/chunk-M4CTURKX.js +84 -0
- package/dist/chunk-M4CTURKX.js.map +1 -0
- package/dist/chunk-M6LTUPVP.js +301 -0
- package/dist/chunk-M6LTUPVP.js.map +1 -0
- package/dist/chunk-MA6RRHDT.js +291 -0
- package/dist/chunk-MA6RRHDT.js.map +1 -0
- package/dist/chunk-MODE4QIA.js +6 -0
- package/dist/chunk-MODE4QIA.js.map +1 -0
- package/dist/chunk-MVILMVGG.js +118 -0
- package/dist/chunk-MVILMVGG.js.map +1 -0
- package/dist/chunk-MWS4VCLV.js +17 -0
- package/dist/chunk-MWS4VCLV.js.map +1 -0
- package/dist/chunk-NEUX74SO.js +315 -0
- package/dist/chunk-NEUX74SO.js.map +1 -0
- package/dist/chunk-NFHKYBRD.js +156 -0
- package/dist/chunk-NFHKYBRD.js.map +1 -0
- package/dist/chunk-NHJNNXD3.js +89 -0
- package/dist/chunk-NHJNNXD3.js.map +1 -0
- package/dist/chunk-O2BF3HZL.js +33 -0
- package/dist/chunk-O2BF3HZL.js.map +1 -0
- package/dist/chunk-OANXCZYD.js +212 -0
- package/dist/chunk-OANXCZYD.js.map +1 -0
- package/dist/chunk-ODJF7YIP.js +230 -0
- package/dist/chunk-ODJF7YIP.js.map +1 -0
- package/dist/chunk-ON4BJTHI.js +101 -0
- package/dist/chunk-ON4BJTHI.js.map +1 -0
- package/dist/chunk-OTL5WXIJ.js +16 -0
- package/dist/chunk-OTL5WXIJ.js.map +1 -0
- package/dist/chunk-PACNBKJV.js +47 -0
- package/dist/chunk-PACNBKJV.js.map +1 -0
- package/dist/chunk-PROCA7K7.js +23 -0
- package/dist/chunk-PROCA7K7.js.map +1 -0
- package/dist/chunk-QGMIPA67.js +85 -0
- package/dist/chunk-QGMIPA67.js.map +1 -0
- package/dist/chunk-QQA37LFB.js +190 -0
- package/dist/chunk-QQA37LFB.js.map +1 -0
- package/dist/chunk-QZAWRSEB.js +61 -0
- package/dist/chunk-QZAWRSEB.js.map +1 -0
- package/dist/chunk-R74KGWNS.js +699 -0
- package/dist/chunk-R74KGWNS.js.map +1 -0
- package/dist/chunk-RFDLHMKL.js +110 -0
- package/dist/chunk-RFDLHMKL.js.map +1 -0
- package/dist/chunk-RL64HN7S.js +40 -0
- package/dist/chunk-RL64HN7S.js.map +1 -0
- package/dist/chunk-RMRQKPL7.js +115 -0
- package/dist/chunk-RMRQKPL7.js.map +1 -0
- package/dist/chunk-RQVK4IYC.js +606 -0
- package/dist/chunk-RQVK4IYC.js.map +1 -0
- package/dist/chunk-RTW56PWZ.js +59 -0
- package/dist/chunk-RTW56PWZ.js.map +1 -0
- package/dist/chunk-RUTPQNLR.js +266 -0
- package/dist/chunk-RUTPQNLR.js.map +1 -0
- package/dist/chunk-S6TAF63G.js +25 -0
- package/dist/chunk-S6TAF63G.js.map +1 -0
- package/dist/chunk-SBGAUGXY.js +224 -0
- package/dist/chunk-SBGAUGXY.js.map +1 -0
- package/dist/chunk-SC275NHZ.js +407 -0
- package/dist/chunk-SC275NHZ.js.map +1 -0
- package/dist/chunk-SCQPU4UE.js +97 -0
- package/dist/chunk-SCQPU4UE.js.map +1 -0
- package/dist/chunk-SFFF2WQP.js +8 -0
- package/dist/chunk-SFFF2WQP.js.map +1 -0
- package/dist/chunk-SJYMHZKA.js +36 -0
- package/dist/chunk-SJYMHZKA.js.map +1 -0
- package/dist/chunk-SLCCUJVN.js +125 -0
- package/dist/chunk-SLCCUJVN.js.map +1 -0
- package/dist/chunk-SVBSNSD4.js +259 -0
- package/dist/chunk-SVBSNSD4.js.map +1 -0
- package/dist/chunk-SVPLTL35.js +62 -0
- package/dist/chunk-SVPLTL35.js.map +1 -0
- package/dist/chunk-SWQFYNYG.js +338 -0
- package/dist/chunk-SWQFYNYG.js.map +1 -0
- package/dist/chunk-THHB4EWS.js +72 -0
- package/dist/chunk-THHB4EWS.js.map +1 -0
- package/dist/chunk-TUCDD33E.js +246 -0
- package/dist/chunk-TUCDD33E.js.map +1 -0
- package/dist/chunk-TV4WAP2R.js +14 -0
- package/dist/chunk-TV4WAP2R.js.map +1 -0
- package/dist/chunk-U3A6YBTZ.js +134 -0
- package/dist/chunk-U3A6YBTZ.js.map +1 -0
- package/dist/chunk-UGT6DKWM.js +95 -0
- package/dist/chunk-UGT6DKWM.js.map +1 -0
- package/dist/chunk-VSERHUWD.js +212 -0
- package/dist/chunk-VSERHUWD.js.map +1 -0
- package/dist/chunk-VYG7BDXC.js +49 -0
- package/dist/chunk-VYG7BDXC.js.map +1 -0
- package/dist/chunk-WETKNYZX.js +52 -0
- package/dist/chunk-WETKNYZX.js.map +1 -0
- package/dist/chunk-WGG4AML3.js +216 -0
- package/dist/chunk-WGG4AML3.js.map +1 -0
- package/dist/chunk-WKAUEL6I.js +30 -0
- package/dist/chunk-WKAUEL6I.js.map +1 -0
- package/dist/chunk-WPOLA5CG.js +81 -0
- package/dist/chunk-WPOLA5CG.js.map +1 -0
- package/dist/chunk-WPVETCGJ.js +254 -0
- package/dist/chunk-WPVETCGJ.js.map +1 -0
- package/dist/chunk-WTSM3A7E.js +13 -0
- package/dist/chunk-WTSM3A7E.js.map +1 -0
- package/dist/chunk-WU3F2K3T.js +148 -0
- package/dist/chunk-WU3F2K3T.js.map +1 -0
- package/dist/chunk-WZZK2DTZ.js +39 -0
- package/dist/chunk-WZZK2DTZ.js.map +1 -0
- package/dist/chunk-X4IHLKRD.js +42 -0
- package/dist/chunk-X4IHLKRD.js.map +1 -0
- package/dist/chunk-XAHEXZJC.js +80 -0
- package/dist/chunk-XAHEXZJC.js.map +1 -0
- package/dist/chunk-XCYGJDUX.js +31 -0
- package/dist/chunk-XCYGJDUX.js.map +1 -0
- package/dist/chunk-Y4W3JORC.js +104 -0
- package/dist/chunk-Y4W3JORC.js.map +1 -0
- package/dist/chunk-YFZJ3ZLG.js +1297 -0
- package/dist/chunk-YFZJ3ZLG.js.map +1 -0
- package/dist/chunk-YI3WLXEN.js +4387 -0
- package/dist/chunk-YI3WLXEN.js.map +1 -0
- package/dist/chunk-ZBKFSPD3.js +29 -0
- package/dist/chunk-ZBKFSPD3.js.map +1 -0
- package/dist/chunk-ZOERRQ6A.js +79 -0
- package/dist/chunk-ZOERRQ6A.js.map +1 -0
- package/dist/chunk-ZSTGUKHU.js +10 -0
- package/dist/chunk-ZSTGUKHU.js.map +1 -0
- package/dist/chunk-ZUEHDL27.js +65 -0
- package/dist/chunk-ZUEHDL27.js.map +1 -0
- package/dist/editors.d.ts +27 -3
- package/dist/editors.js +93 -2081
- package/dist/editors.js.map +1 -1
- package/dist/icons.d.ts +29 -8
- package/dist/icons.js +7 -361
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +715 -441
- package/dist/index.js +121 -24643
- package/dist/index.js.map +1 -1
- package/dist/internal/blocks/AIKit.js +30 -0
- package/dist/internal/blocks/AIKit.js.map +1 -0
- package/dist/internal/blocks/AppShell.js +11 -0
- package/dist/internal/blocks/AppShell.js.map +1 -0
- package/dist/internal/blocks/AutoSaveTextarea.js +14 -0
- package/dist/internal/blocks/AutoSaveTextarea.js.map +1 -0
- package/dist/internal/blocks/BrandEditor.js +23 -0
- package/dist/internal/blocks/BrandEditor.js.map +1 -0
- package/dist/internal/blocks/ChartPanel.js +10 -0
- package/dist/internal/blocks/ChartPanel.js.map +1 -0
- package/dist/internal/blocks/ClipboardButton.js +12 -0
- package/dist/internal/blocks/ClipboardButton.js.map +1 -0
- package/dist/internal/blocks/ColorInput.js +13 -0
- package/dist/internal/blocks/ColorInput.js.map +1 -0
- package/dist/internal/blocks/ColorModeSwitch.js +13 -0
- package/dist/internal/blocks/ColorModeSwitch.js.map +1 -0
- package/dist/internal/blocks/Command.js +15 -0
- package/dist/internal/blocks/Command.js.map +1 -0
- package/dist/internal/blocks/CopyField.js +11 -0
- package/dist/internal/blocks/CopyField.js.map +1 -0
- package/dist/internal/blocks/DashboardHero.js +9 -0
- package/dist/internal/blocks/DashboardHero.js.map +1 -0
- package/dist/internal/blocks/DateInput.js +16 -0
- package/dist/internal/blocks/DateInput.js.map +1 -0
- package/dist/internal/blocks/DateRangeInput.js +16 -0
- package/dist/internal/blocks/DateRangeInput.js.map +1 -0
- package/dist/internal/blocks/EmptyConfigurationActionCard.js +10 -0
- package/dist/internal/blocks/EmptyConfigurationActionCard.js.map +1 -0
- package/dist/internal/blocks/EmptyState.js +4 -0
- package/dist/internal/blocks/EmptyState.js.map +1 -0
- package/dist/internal/blocks/ErrorState.js +5 -0
- package/dist/internal/blocks/ErrorState.js.map +1 -0
- package/dist/internal/blocks/ExportMenu.js +13 -0
- package/dist/internal/blocks/ExportMenu.js.map +1 -0
- package/dist/internal/blocks/Form.js +29 -0
- package/dist/internal/blocks/Form.js.map +1 -0
- package/dist/internal/blocks/FormGroup.js +18 -0
- package/dist/internal/blocks/FormGroup.js.map +1 -0
- package/dist/internal/blocks/GoogleButton.js +10 -0
- package/dist/internal/blocks/GoogleButton.js.map +1 -0
- package/dist/internal/blocks/MicrosoftButton.js +10 -0
- package/dist/internal/blocks/MicrosoftButton.js.map +1 -0
- package/dist/internal/blocks/MultiActionButtonGroup.js +12 -0
- package/dist/internal/blocks/MultiActionButtonGroup.js.map +1 -0
- package/dist/internal/blocks/MultiCombobox.js +14 -0
- package/dist/internal/blocks/MultiCombobox.js.map +1 -0
- package/dist/internal/blocks/NumberInput.js +12 -0
- package/dist/internal/blocks/NumberInput.js.map +1 -0
- package/dist/internal/blocks/OtpInput.js +10 -0
- package/dist/internal/blocks/OtpInput.js.map +1 -0
- package/dist/internal/blocks/PageHeader.js +9 -0
- package/dist/internal/blocks/PageHeader.js.map +1 -0
- package/dist/internal/blocks/PageLayout.js +9 -0
- package/dist/internal/blocks/PageLayout.js.map +1 -0
- package/dist/internal/blocks/PageToolbar.js +13 -0
- package/dist/internal/blocks/PageToolbar.js.map +1 -0
- package/dist/internal/blocks/PasswordInput.js +13 -0
- package/dist/internal/blocks/PasswordInput.js.map +1 -0
- package/dist/internal/blocks/SearchInput.js +12 -0
- package/dist/internal/blocks/SearchInput.js.map +1 -0
- package/dist/internal/blocks/SearchInputWithNavigation.js +16 -0
- package/dist/internal/blocks/SearchInputWithNavigation.js.map +1 -0
- package/dist/internal/blocks/SectionNav.js +15 -0
- package/dist/internal/blocks/SectionNav.js.map +1 -0
- package/dist/internal/blocks/SplitButton.js +14 -0
- package/dist/internal/blocks/SplitButton.js.map +1 -0
- package/dist/internal/blocks/StatCard.js +10 -0
- package/dist/internal/blocks/StatCard.js.map +1 -0
- package/dist/internal/blocks/TextInput.js +13 -0
- package/dist/internal/blocks/TextInput.js.map +1 -0
- package/dist/internal/blocks/Textarea.js +13 -0
- package/dist/internal/blocks/Textarea.js.map +1 -0
- package/dist/internal/blocks/TimeInput.js +17 -0
- package/dist/internal/blocks/TimeInput.js.map +1 -0
- package/dist/internal/components/Alert.js +11 -0
- package/dist/internal/components/Alert.js.map +1 -0
- package/dist/internal/components/AlertModal.js +11 -0
- package/dist/internal/components/AlertModal.js.map +1 -0
- package/dist/internal/components/Avatar.js +9 -0
- package/dist/internal/components/Avatar.js.map +1 -0
- package/dist/internal/components/Badge.js +9 -0
- package/dist/internal/components/Badge.js.map +1 -0
- package/dist/internal/components/BrandLogo.js +11 -0
- package/dist/internal/components/BrandLogo.js.map +1 -0
- package/dist/internal/components/Breadcrumb.js +14 -0
- package/dist/internal/components/Breadcrumb.js.map +1 -0
- package/dist/internal/components/Button.js +10 -0
- package/dist/internal/components/Button.js.map +1 -0
- package/dist/internal/components/ButtonGroup.js +9 -0
- package/dist/internal/components/ButtonGroup.js.map +1 -0
- package/dist/internal/components/Calendar.js +9 -0
- package/dist/internal/components/Calendar.js.map +1 -0
- package/dist/internal/components/Card.js +9 -0
- package/dist/internal/components/Card.js.map +1 -0
- package/dist/internal/components/Checkbox.js +11 -0
- package/dist/internal/components/Checkbox.js.map +1 -0
- package/dist/internal/components/Clipboard.js +9 -0
- package/dist/internal/components/Clipboard.js.map +1 -0
- package/dist/internal/components/Collapsible.js +9 -0
- package/dist/internal/components/Collapsible.js.map +1 -0
- package/dist/internal/components/CollapsiblePanel.js +11 -0
- package/dist/internal/components/CollapsiblePanel.js.map +1 -0
- package/dist/internal/components/Combobox.js +13 -0
- package/dist/internal/components/Combobox.js.map +1 -0
- package/dist/internal/components/DatePicker.js +11 -0
- package/dist/internal/components/DatePicker.js.map +1 -0
- package/dist/internal/components/DateRangePicker.js +17 -0
- package/dist/internal/components/DateRangePicker.js.map +1 -0
- package/dist/internal/components/DiffView.js +9 -0
- package/dist/internal/components/DiffView.js.map +1 -0
- package/dist/internal/components/DotsLoader.js +5 -0
- package/dist/internal/components/DotsLoader.js.map +1 -0
- package/dist/internal/components/DropdownMenu.js +11 -0
- package/dist/internal/components/DropdownMenu.js.map +1 -0
- package/dist/internal/components/EmptySearchContent.js +4 -0
- package/dist/internal/components/EmptySearchContent.js.map +1 -0
- package/dist/internal/components/FileUpload.js +11 -0
- package/dist/internal/components/FileUpload.js.map +1 -0
- package/dist/internal/components/FullScreenModal.js +12 -0
- package/dist/internal/components/FullScreenModal.js.map +1 -0
- package/dist/internal/components/HelpBlock.js +4 -0
- package/dist/internal/components/HelpBlock.js.map +1 -0
- package/dist/internal/components/HoverCard.js +9 -0
- package/dist/internal/components/HoverCard.js.map +1 -0
- package/dist/internal/components/InputGroup.js +11 -0
- package/dist/internal/components/InputGroup.js.map +1 -0
- package/dist/internal/components/Kbd.js +9 -0
- package/dist/internal/components/Kbd.js.map +1 -0
- package/dist/internal/components/Label.js +9 -0
- package/dist/internal/components/Label.js.map +1 -0
- package/dist/internal/components/Link.js +9 -0
- package/dist/internal/components/Link.js.map +1 -0
- package/dist/internal/components/MarkedText.js +5 -0
- package/dist/internal/components/MarkedText.js.map +1 -0
- package/dist/internal/components/MergeEditor/ConflictStatus/ConflictStatusIndicator.js +10 -0
- package/dist/internal/components/MergeEditor/ConflictStatus/ConflictStatusIndicator.js.map +1 -0
- package/dist/internal/components/MergeEditor/PaneHeader.js +4 -0
- package/dist/internal/components/MergeEditor/PaneHeader.js.map +1 -0
- package/dist/internal/components/MergeEditor/constants.js +4 -0
- package/dist/internal/components/MergeEditor/constants.js.map +1 -0
- package/dist/internal/components/MergeEditor/useMergeDiff.js +5 -0
- package/dist/internal/components/MergeEditor/useMergeDiff.js.map +1 -0
- package/dist/internal/components/Modal.js +13 -0
- package/dist/internal/components/Modal.js.map +1 -0
- package/dist/internal/components/Navbar.js +14 -0
- package/dist/internal/components/Navbar.js.map +1 -0
- package/dist/internal/components/Pagination.js +11 -0
- package/dist/internal/components/Pagination.js.map +1 -0
- package/dist/internal/components/PanelWithDetails.js +11 -0
- package/dist/internal/components/PanelWithDetails.js.map +1 -0
- package/dist/internal/components/Popconfirm.js +12 -0
- package/dist/internal/components/Popconfirm.js.map +1 -0
- package/dist/internal/components/Popover.js +9 -0
- package/dist/internal/components/Popover.js.map +1 -0
- package/dist/internal/components/Progress.js +9 -0
- package/dist/internal/components/Progress.js.map +1 -0
- package/dist/internal/components/RadioGroup.js +12 -0
- package/dist/internal/components/RadioGroup.js.map +1 -0
- package/dist/internal/components/Resizable.js +9 -0
- package/dist/internal/components/Resizable.js.map +1 -0
- package/dist/internal/components/ScrollArea.js +9 -0
- package/dist/internal/components/ScrollArea.js.map +1 -0
- package/dist/internal/components/Search.js +10 -0
- package/dist/internal/components/Search.js.map +1 -0
- package/dist/internal/components/Select.js +12 -0
- package/dist/internal/components/Select.js.map +1 -0
- package/dist/internal/components/Separator.js +9 -0
- package/dist/internal/components/Separator.js.map +1 -0
- package/dist/internal/components/Sheet.js +12 -0
- package/dist/internal/components/Sheet.js.map +1 -0
- package/dist/internal/components/Sidebar.js +20 -0
- package/dist/internal/components/Sidebar.js.map +1 -0
- package/dist/internal/components/Skeleton/Skeleton.js +9 -0
- package/dist/internal/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/internal/components/Skeleton/SkeletonList.js +10 -0
- package/dist/internal/components/Skeleton/SkeletonList.js.map +1 -0
- package/dist/internal/components/Slider.js +11 -0
- package/dist/internal/components/Slider.js.map +1 -0
- package/dist/internal/components/SpotlightBackdrop.js +9 -0
- package/dist/internal/components/SpotlightBackdrop.js.map +1 -0
- package/dist/internal/components/Stepper.js +10 -0
- package/dist/internal/components/Stepper.js.map +1 -0
- package/dist/internal/components/Switch.js +10 -0
- package/dist/internal/components/Switch.js.map +1 -0
- package/dist/internal/components/Table.js +10 -0
- package/dist/internal/components/Table.js.map +1 -0
- package/dist/internal/components/Tabs.js +12 -0
- package/dist/internal/components/Tabs.js.map +1 -0
- package/dist/internal/components/ThemeProvider.js +10 -0
- package/dist/internal/components/ThemeProvider.js.map +1 -0
- package/dist/internal/components/TimePicker.js +12 -0
- package/dist/internal/components/TimePicker.js.map +1 -0
- package/dist/internal/components/Timeline.js +10 -0
- package/dist/internal/components/Timeline.js.map +1 -0
- package/dist/internal/components/Toast.js +11 -0
- package/dist/internal/components/Toast.js.map +1 -0
- package/dist/internal/components/Toggle.js +9 -0
- package/dist/internal/components/Toggle.js.map +1 -0
- package/dist/internal/components/ToggleGroup.js +9 -0
- package/dist/internal/components/ToggleGroup.js.map +1 -0
- package/dist/internal/components/Tooltip.js +8 -0
- package/dist/internal/components/Tooltip.js.map +1 -0
- package/dist/internal/components/Truncated.js +9 -0
- package/dist/internal/components/Truncated.js.map +1 -0
- package/dist/internal/components/Workbench.js +11 -0
- package/dist/internal/components/Workbench.js.map +1 -0
- package/dist/internal/components/ZoomableSvg.js +13 -0
- package/dist/internal/components/ZoomableSvg.js.map +1 -0
- package/dist/internal/hooks/useAutosizeInput.js +4 -0
- package/dist/internal/hooks/useAutosizeInput.js.map +1 -0
- package/dist/internal/hooks/useScrollbarPosition.js +5 -0
- package/dist/internal/hooks/useScrollbarPosition.js.map +1 -0
- package/dist/internal/hooks/useStableCallback.js +4 -0
- package/dist/internal/hooks/useStableCallback.js.map +1 -0
- package/dist/internal/utils/mergeRefs.js +4 -0
- package/dist/internal/utils/mergeRefs.js.map +1 -0
- package/dist/internal/utils.js +8 -0
- package/dist/internal/utils.js.map +1 -0
- package/dist/markdown-editor.js +55 -3426
- package/dist/markdown-editor.js.map +1 -1
- package/dist/mermaid.js +16 -1129
- package/dist/mermaid.js.map +1 -1
- package/dist/rjsf.js +252 -9380
- package/dist/rjsf.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/testing.js +10 -357
- package/dist/testing.js.map +1 -1
- package/package.json +31 -75
- package/src/styles.css +95 -10
- package/src/theme.css +65 -0
- package/dist/charts.cjs +0 -268
- package/dist/charts.cjs.map +0 -1
- package/dist/charts.d.cts +0 -181
- package/dist/constants-D3gaMY-W.d.cts +0 -39
- package/dist/editors.cjs +0 -2440
- package/dist/editors.cjs.map +0 -1
- package/dist/editors.d.cts +0 -165
- package/dist/icons.cjs +0 -23888
- package/dist/icons.cjs.map +0 -1
- package/dist/icons.d.cts +0 -20
- package/dist/index.cjs +0 -24894
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -10438
- package/dist/markdown-editor.cjs +0 -4636
- package/dist/markdown-editor.cjs.map +0 -1
- package/dist/markdown-editor.d.cts +0 -75
- package/dist/mermaid.cjs +0 -1138
- package/dist/mermaid.cjs.map +0 -1
- package/dist/mermaid.d.cts +0 -15
- package/dist/rjsf.cjs +0 -10893
- package/dist/rjsf.cjs.map +0 -1
- package/dist/rjsf.d.cts +0 -55
- package/dist/testing.cjs +0 -373
- package/dist/testing.cjs.map +0 -1
- package/dist/testing.d.cts +0 -25
package/dist/editors.js
CHANGED
|
@@ -1,2031 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
1
|
+
import { LINE_HEIGHT_PX, PANE_HEADER_HEIGHT_PX, CHANGE_CLASS } from './chunk-OTL5WXIJ.js';
|
|
2
|
+
import { useThemedExtension, buildBasicSetup } from './chunk-YFZJ3ZLG.js';
|
|
3
|
+
export { CodeEditor, LANGUAGE_MODES, SqlEditor, isLanguageMode } from './chunk-YFZJ3ZLG.js';
|
|
4
|
+
import { useStableCallback } from './chunk-TV4WAP2R.js';
|
|
5
|
+
import './chunk-7GTI3PPI.js';
|
|
6
|
+
import { resolveToken } from './chunk-IIS7INHF.js';
|
|
7
|
+
import './chunk-FUFMVW7O.js';
|
|
8
|
+
import './chunk-7P6PLZ4B.js';
|
|
9
|
+
import './chunk-PROCA7K7.js';
|
|
10
|
+
import { Button } from './chunk-IXAYNBOY.js';
|
|
11
|
+
import { X, ChevronsRight, ChevronsLeft } from './chunk-RQVK4IYC.js';
|
|
12
|
+
import './chunk-KR7NXXHC.js';
|
|
13
|
+
import './chunk-SWQFYNYG.js';
|
|
14
|
+
import './chunk-3W27OLK5.js';
|
|
15
|
+
import './chunk-MODE4QIA.js';
|
|
16
|
+
import './chunk-WETKNYZX.js';
|
|
17
|
+
import { cn } from './chunk-LXLIQ2D6.js';
|
|
18
|
+
import './chunk-G3PMV62Z.js';
|
|
13
19
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import { python } from '@codemirror/lang-python';
|
|
18
|
-
import { sql, PLSQL, MSSQL, PostgreSQL, MySQL } from '@codemirror/lang-sql';
|
|
19
|
-
import { StreamLanguage } from '@codemirror/language';
|
|
20
|
-
import { r } from '@codemirror/legacy-modes/mode/r';
|
|
21
|
-
import { shell } from '@codemirror/legacy-modes/mode/shell';
|
|
22
|
-
import { toml } from '@codemirror/legacy-modes/mode/toml';
|
|
23
|
-
import { githubLightInit } from '@uiw/codemirror-theme-github';
|
|
24
|
-
import { installExtensions, getSqlDialect } from '@keboola/codemirror-lang-sql';
|
|
20
|
+
import { useRef, useCallback, useMemo, useEffect } from 'react';
|
|
21
|
+
import { Decoration, GutterMarker, EditorView, gutterLineClass } from '@codemirror/view';
|
|
22
|
+
import CodeMirror from '@uiw/react-codemirror';
|
|
25
23
|
import colors from '@keboola/tailwind-config/colors';
|
|
26
|
-
import {
|
|
27
|
-
import { StateEffect, StateField, RangeSet, Compartment, RangeSetBuilder } from '@codemirror/state';
|
|
28
|
-
import { defaultKeymap } from '@codemirror/commands';
|
|
24
|
+
import { StateEffect, StateField, RangeSet, RangeSetBuilder } from '@codemirror/state';
|
|
29
25
|
|
|
30
|
-
// src/components/CodeEditor/CodeEditor.tsx
|
|
31
|
-
|
|
32
|
-
// src/constants/keyCodes.ts
|
|
33
|
-
var keyCodes = {
|
|
34
|
-
ENTER: "Enter",
|
|
35
|
-
ESCAPE: "Escape",
|
|
36
|
-
SPACE: " "
|
|
37
|
-
};
|
|
38
|
-
var useStableCallback = (callback) => {
|
|
39
|
-
const latestRef = useRef(callback);
|
|
40
|
-
useLayoutEffect(() => {
|
|
41
|
-
latestRef.current = callback;
|
|
42
|
-
}, [callback]);
|
|
43
|
-
return useCallback((...args) => latestRef.current(...args), []);
|
|
44
|
-
};
|
|
45
|
-
var twMerge = extendTailwindMerge({
|
|
46
|
-
prefix: "tw"
|
|
47
|
-
});
|
|
48
|
-
var cn = (...classes) => twMerge(clsx(...classes));
|
|
49
|
-
|
|
50
|
-
// src/utils/copyToClipboard.ts
|
|
51
|
-
var copyToClipboard = (text) => {
|
|
52
|
-
return navigator.clipboard.writeText(text);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// src/components/ThemeProvider/utils.ts
|
|
56
|
-
var createTheme = (brand) => ({
|
|
57
|
-
id: brand.id,
|
|
58
|
-
name: brand.name,
|
|
59
|
-
shell: brand.shell,
|
|
60
|
-
logo: brand.logo
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// src/components/ThemeProvider/defaults.ts
|
|
64
|
-
[keboolaLegacySidebar.id, keboolaLegacyTopnav.id];
|
|
65
|
-
var DEFAULT_COLOR_SCHEME = "light";
|
|
66
|
-
var DEFAULT_BRAND_ID = "design-system";
|
|
67
|
-
var defaultBrand = {
|
|
68
|
-
id: DEFAULT_BRAND_ID,
|
|
69
|
-
name: "Design System",
|
|
70
|
-
shell: "sidebar"};
|
|
71
|
-
var defaultTheme = createTheme(defaultBrand);
|
|
72
|
-
|
|
73
|
-
// src/components/ThemeProvider/context.tsx
|
|
74
|
-
var noop = () => void 0;
|
|
75
|
-
var defaultContext = {
|
|
76
|
-
scheme: DEFAULT_COLOR_SCHEME,
|
|
77
|
-
resolvedScheme: DEFAULT_COLOR_SCHEME,
|
|
78
|
-
setScheme: noop,
|
|
79
|
-
brandId: defaultTheme.id,
|
|
80
|
-
setBrand: noop,
|
|
81
|
-
themes: [defaultTheme],
|
|
82
|
-
currentTheme: defaultTheme
|
|
83
|
-
};
|
|
84
|
-
createContext(defaultContext);
|
|
85
|
-
var ArgoDesignContext = createContext(true);
|
|
86
|
-
var useArgoDesign = () => use(ArgoDesignContext);
|
|
87
|
-
var tooltipVariants = cva(
|
|
88
|
-
[
|
|
89
|
-
"tailwindcss-preflight",
|
|
90
|
-
"tw:inline-block",
|
|
91
|
-
"tw:break-anywhere",
|
|
92
|
-
"tw:max-h-96",
|
|
93
|
-
"tw:overflow-y-auto",
|
|
94
|
-
"tw:z-[1060]",
|
|
95
|
-
// legacy (dark) chrome — default
|
|
96
|
-
"tw:rounded",
|
|
97
|
-
"tw:bg-neutral-800",
|
|
98
|
-
"tw:text-white",
|
|
99
|
-
// argo chrome overrides — semantic floating-panel tokens
|
|
100
|
-
"tw:data-[argo=true]:rounded-2xl",
|
|
101
|
-
"tw:data-[argo=true]:border",
|
|
102
|
-
"tw:data-[argo=true]:border-solid",
|
|
103
|
-
"tw:data-[argo=true]:border-border",
|
|
104
|
-
"tw:data-[argo=true]:bg-popover",
|
|
105
|
-
"tw:data-[argo=true]:text-popover-foreground",
|
|
106
|
-
"tw:data-[argo=true]:shadow-md",
|
|
107
|
-
// argo open animation
|
|
108
|
-
"tw:data-[argo=true]:data-[state=delayed-open]:animate-in",
|
|
109
|
-
"tw:data-[argo=true]:data-[state=instant-open]:animate-in",
|
|
110
|
-
"tw:data-[argo=true]:data-[state=delayed-open]:fade-in-0",
|
|
111
|
-
"tw:data-[argo=true]:data-[state=instant-open]:fade-in-0",
|
|
112
|
-
"tw:data-[argo=true]:data-[state=delayed-open]:zoom-in-95",
|
|
113
|
-
"tw:data-[argo=true]:data-[state=instant-open]:zoom-in-95",
|
|
114
|
-
// argo closed animation
|
|
115
|
-
"tw:data-[argo=true]:data-[state=closed]:animate-out",
|
|
116
|
-
"tw:data-[argo=true]:data-[state=closed]:fade-out-0",
|
|
117
|
-
"tw:data-[argo=true]:data-[state=closed]:zoom-out-95",
|
|
118
|
-
// argo position animation
|
|
119
|
-
"tw:data-[argo=true]:data-[side=bottom]:slide-in-from-top-2",
|
|
120
|
-
"tw:data-[argo=true]:data-[side=left]:slide-in-from-right-2",
|
|
121
|
-
"tw:data-[argo=true]:data-[side=right]:slide-in-from-left-2",
|
|
122
|
-
"tw:data-[argo=true]:data-[side=top]:slide-in-from-bottom-2"
|
|
123
|
-
],
|
|
124
|
-
{
|
|
125
|
-
defaultVariants: {
|
|
126
|
-
variant: "action"
|
|
127
|
-
},
|
|
128
|
-
variants: {
|
|
129
|
-
variant: {
|
|
130
|
-
action: [
|
|
131
|
-
"tw:max-w-fit",
|
|
132
|
-
"tw:px-3",
|
|
133
|
-
"tw:py-2",
|
|
134
|
-
"tw:text-center",
|
|
135
|
-
"tw:text-xs",
|
|
136
|
-
"tw:font-medium",
|
|
137
|
-
// Legacy chrome uppercases the action tooltip; the Keboola V2 brand
|
|
138
|
-
// (`data-brand="keboola"`) renders it in standard case instead.
|
|
139
|
-
"tw:uppercase",
|
|
140
|
-
"tw:tracking-wider",
|
|
141
|
-
"tw:[[data-brand=keboola]_&]:normal-case",
|
|
142
|
-
"tw:[[data-brand=keboola]_&]:tracking-normal"
|
|
143
|
-
],
|
|
144
|
-
explanatory: [
|
|
145
|
-
"tw:max-w-80",
|
|
146
|
-
"tw:px-4",
|
|
147
|
-
"tw:py-3",
|
|
148
|
-
"tw:text-left",
|
|
149
|
-
"tw:text-sm",
|
|
150
|
-
"tw:font-normal"
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
var TooltipContent = ({
|
|
157
|
-
className,
|
|
158
|
-
variant,
|
|
159
|
-
keepOpenOnPointerDownOutside = false,
|
|
160
|
-
children,
|
|
161
|
-
onPointerDownOutside,
|
|
162
|
-
sideOffset = 8,
|
|
163
|
-
collisionPadding = 8,
|
|
164
|
-
hideWhenDetached = true,
|
|
165
|
-
placement = "right",
|
|
166
|
-
...rest
|
|
167
|
-
}) => {
|
|
168
|
-
const renderArgo = useArgoDesign();
|
|
169
|
-
const handlePointerDownOutside = (event) => {
|
|
170
|
-
if (keepOpenOnPointerDownOutside) event.preventDefault();
|
|
171
|
-
onPointerDownOutside?.(event);
|
|
172
|
-
};
|
|
173
|
-
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
|
|
174
|
-
Content,
|
|
175
|
-
{
|
|
176
|
-
...rest,
|
|
177
|
-
"data-tooltip-content": renderArgo ? void 0 : true,
|
|
178
|
-
"data-argo": renderArgo,
|
|
179
|
-
sideOffset,
|
|
180
|
-
collisionPadding,
|
|
181
|
-
onPointerDownOutside: handlePointerDownOutside,
|
|
182
|
-
className: tooltipVariants({ className, variant }),
|
|
183
|
-
hideWhenDetached,
|
|
184
|
-
side: placement,
|
|
185
|
-
children
|
|
186
|
-
}
|
|
187
|
-
) });
|
|
188
|
-
};
|
|
189
|
-
var DELAY_SHOW_TOOLTIP = 300;
|
|
190
|
-
var TooltipRoot = ({ children, delayDuration = DELAY_SHOW_TOOLTIP, ...rest }) => /* @__PURE__ */ jsx(Root$1, { ...rest, delayDuration, children });
|
|
191
|
-
var TooltipTrigger = ({
|
|
192
|
-
ref,
|
|
193
|
-
children,
|
|
194
|
-
className,
|
|
195
|
-
keepOpenOnClick = false,
|
|
196
|
-
onClick,
|
|
197
|
-
onPointerDown,
|
|
198
|
-
asChild,
|
|
199
|
-
...rest
|
|
200
|
-
}) => {
|
|
201
|
-
const handleClick = (event) => {
|
|
202
|
-
if (keepOpenOnClick) event.preventDefault();
|
|
203
|
-
onClick?.(event);
|
|
204
|
-
};
|
|
205
|
-
const handlePointerDown = (event) => {
|
|
206
|
-
if (keepOpenOnClick) event.preventDefault();
|
|
207
|
-
onPointerDown?.(event);
|
|
208
|
-
};
|
|
209
|
-
return /* @__PURE__ */ jsx(
|
|
210
|
-
Trigger,
|
|
211
|
-
{
|
|
212
|
-
...rest,
|
|
213
|
-
asChild: true,
|
|
214
|
-
ref,
|
|
215
|
-
className: cn("tailwindcss-preflight", className),
|
|
216
|
-
onClick: handleClick,
|
|
217
|
-
onPointerDown: handlePointerDown,
|
|
218
|
-
children: asChild ? children : (
|
|
219
|
-
// Default-mode trigger wraps children in a span so Radix has a
|
|
220
|
-
// single DOM element to attach handlers to. `tailwindcss-preflight`
|
|
221
|
-
// (merged in via Slot) activates Tailwind's preflight inside the
|
|
222
|
-
// span, which sets `svg { display: block }` — without an inline-flex
|
|
223
|
-
// container that would stack any bare Lucide icon onto its own
|
|
224
|
-
// line. `tw:inline-flex tw:items-center` keeps icon + text aligned.
|
|
225
|
-
/* @__PURE__ */ jsx("span", { className: "tw:inline-flex tw:items-center", children })
|
|
226
|
-
)
|
|
227
|
-
}
|
|
228
|
-
);
|
|
229
|
-
};
|
|
230
|
-
var ACTION_TOOLTIP_LIMIT = 30;
|
|
231
|
-
var Tooltip = ({
|
|
232
|
-
tooltip,
|
|
233
|
-
children,
|
|
234
|
-
className,
|
|
235
|
-
keepOpenOnTriggerClick = false,
|
|
236
|
-
variant,
|
|
237
|
-
placement = "right",
|
|
238
|
-
forceHide = false,
|
|
239
|
-
forceShow = false,
|
|
240
|
-
delayDuration,
|
|
241
|
-
// trigger props
|
|
242
|
-
triggerAsChild = false
|
|
243
|
-
}) => {
|
|
244
|
-
const [open, setOpen] = useState(false);
|
|
245
|
-
const resolvedVariant = (() => {
|
|
246
|
-
if (!!variant) return variant;
|
|
247
|
-
if (typeof tooltip === "string" && tooltip.length > ACTION_TOOLTIP_LIMIT) return "explanatory";
|
|
248
|
-
return "action";
|
|
249
|
-
})();
|
|
250
|
-
const isActionVariant = resolvedVariant === "action";
|
|
251
|
-
const handleKeyUp = (event) => {
|
|
252
|
-
if (![keyCodes.ENTER, keyCodes.SPACE].includes(event.key)) return;
|
|
253
|
-
event.stopPropagation();
|
|
254
|
-
};
|
|
255
|
-
return /* @__PURE__ */ jsxs(
|
|
256
|
-
TooltipRoot,
|
|
257
|
-
{
|
|
258
|
-
open: !!tooltip && (open || forceShow) && !forceHide,
|
|
259
|
-
onOpenChange: setOpen,
|
|
260
|
-
delayDuration,
|
|
261
|
-
disableHoverableContent: isActionVariant,
|
|
262
|
-
children: [
|
|
263
|
-
/* @__PURE__ */ jsx(
|
|
264
|
-
TooltipTrigger,
|
|
265
|
-
{
|
|
266
|
-
asChild: triggerAsChild,
|
|
267
|
-
keepOpenOnClick: keepOpenOnTriggerClick,
|
|
268
|
-
onKeyUp: handleKeyUp,
|
|
269
|
-
children
|
|
270
|
-
}
|
|
271
|
-
),
|
|
272
|
-
/* @__PURE__ */ jsx(
|
|
273
|
-
TooltipContent,
|
|
274
|
-
{
|
|
275
|
-
className,
|
|
276
|
-
variant: resolvedVariant,
|
|
277
|
-
placement,
|
|
278
|
-
keepOpenOnPointerDownOutside: keepOpenOnTriggerClick,
|
|
279
|
-
children: tooltip
|
|
280
|
-
}
|
|
281
|
-
)
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
);
|
|
285
|
-
};
|
|
286
|
-
Tooltip.Root = TooltipRoot;
|
|
287
|
-
Tooltip.Content = TooltipContent;
|
|
288
|
-
Tooltip.Trigger = TooltipTrigger;
|
|
289
|
-
|
|
290
|
-
// src/utils/escapeStringRegexp.ts
|
|
291
|
-
var escapeStringRegexp = (string) => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
292
|
-
|
|
293
|
-
// src/utils/isMac.ts
|
|
294
|
-
var getIsMac = () => {
|
|
295
|
-
if (typeof navigator !== "undefined" && "userAgentData" in navigator) {
|
|
296
|
-
const platform = navigator.userAgentData.platform;
|
|
297
|
-
if (typeof platform === "string") {
|
|
298
|
-
return platform.toLowerCase() === "macos";
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
if (typeof navigator !== "undefined" && typeof navigator.platform === "string") {
|
|
302
|
-
return navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|
|
303
|
-
}
|
|
304
|
-
return false;
|
|
305
|
-
};
|
|
306
|
-
var isMac = getIsMac();
|
|
307
|
-
var helpVariants = cva(["tw:m-0", "tw:text-xs"], {
|
|
308
|
-
defaultVariants: {
|
|
309
|
-
state: "default"
|
|
310
|
-
},
|
|
311
|
-
variants: {
|
|
312
|
-
state: {
|
|
313
|
-
default: ["tw:text-muted-foreground"],
|
|
314
|
-
warning: ["tw:text-warning"]
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
var HelpBlock = ({ children, className, state = "default", ...rest }) => {
|
|
319
|
-
if (!children) return null;
|
|
320
|
-
return /* @__PURE__ */ jsx("p", { ...rest, className: helpVariants({ state, className }), children });
|
|
321
|
-
};
|
|
322
|
-
var variants = cva(
|
|
323
|
-
[
|
|
324
|
-
"tailwindcss-preflight",
|
|
325
|
-
"tw:group/button",
|
|
326
|
-
"tw:border-box",
|
|
327
|
-
// layout
|
|
328
|
-
"tw:relative",
|
|
329
|
-
"tw:flex",
|
|
330
|
-
"tw:items-center",
|
|
331
|
-
"tw:justify-center",
|
|
332
|
-
"tw:gap-2",
|
|
333
|
-
// text — chrome weight/tracking are brand-overridable tokens
|
|
334
|
-
// (`--font-weight-medium` / `--letter-spacing-chrome`). Casing: standard case is
|
|
335
|
-
// the default; only legacy brands (`keboola-legacy-*`) uppercase the chrome, so
|
|
336
|
-
// modern brands (incl. Keboola V2) read naturally. Mirrors the V2 standard-case
|
|
337
|
-
// treatment shipped for Tooltip/Badge (PR 7629).
|
|
338
|
-
"tw:text-xs",
|
|
339
|
-
"tw:leading-5",
|
|
340
|
-
"tw:font-medium",
|
|
341
|
-
"tw:[[data-brand^=keboola-legacy]_&]:tracking-chrome",
|
|
342
|
-
"tw:[[data-brand^=keboola-legacy]_&]:uppercase",
|
|
343
|
-
// border — legacy (non-argo) chrome uses a fixed radius, not the brand token.
|
|
344
|
-
"tw:rounded",
|
|
345
|
-
"tw:border",
|
|
346
|
-
"tw:border-transparent",
|
|
347
|
-
// styling
|
|
348
|
-
"tw:shadow-none",
|
|
349
|
-
"tw:[a]:cursor-pointer",
|
|
350
|
-
// explicitly set for anchor
|
|
351
|
-
"tw:focus-visible:outline",
|
|
352
|
-
"tw:focus-visible:outline-1",
|
|
353
|
-
"tw:focus-visible:-outline-offset-1",
|
|
354
|
-
"tw:focus-visible:outline-ring",
|
|
355
|
-
"tw:focus-visible:ring-4",
|
|
356
|
-
"tw:focus-visible:ring-ring/30",
|
|
357
|
-
// disabled
|
|
358
|
-
"tw:disabled:opacity-40",
|
|
359
|
-
"tw:disabled:cursor-not-allowed",
|
|
360
|
-
// anchor support
|
|
361
|
-
"tw:!no-underline",
|
|
362
|
-
"tw:aria-disabled:opacity-40",
|
|
363
|
-
"tw:aria-disabled:cursor-not-allowed",
|
|
364
|
-
"tw:[&_svg]:shrink-0"
|
|
365
|
-
],
|
|
366
|
-
{
|
|
367
|
-
defaultVariants: {
|
|
368
|
-
size: "medium",
|
|
369
|
-
variant: "primary",
|
|
370
|
-
block: false
|
|
371
|
-
},
|
|
372
|
-
variants: {
|
|
373
|
-
block: {
|
|
374
|
-
true: ["tw:w-full"]
|
|
375
|
-
},
|
|
376
|
-
variant: {
|
|
377
|
-
primary: [
|
|
378
|
-
"tw:text-white",
|
|
379
|
-
"tw:bg-primary-500",
|
|
380
|
-
"tw:focus:text-white",
|
|
381
|
-
"tw:hover:text-white",
|
|
382
|
-
"tw:hover:not-disabled:bg-primary-600",
|
|
383
|
-
"tw:active:not-disabled:bg-primary-800",
|
|
384
|
-
// anchor disabled override
|
|
385
|
-
"tw:aria-disabled:!bg-primary-500"
|
|
386
|
-
],
|
|
387
|
-
secondary: [
|
|
388
|
-
"tw:text-white",
|
|
389
|
-
"tw:bg-secondary-500",
|
|
390
|
-
"tw:focus:text-white",
|
|
391
|
-
"tw:hover:text-white",
|
|
392
|
-
"tw:hover:not-disabled:bg-secondary-700",
|
|
393
|
-
"tw:active:not-disabled:bg-secondary-800",
|
|
394
|
-
// anchor disabled override
|
|
395
|
-
"tw:aria-disabled:!bg-secondary-500"
|
|
396
|
-
],
|
|
397
|
-
danger: [
|
|
398
|
-
"tw:text-white",
|
|
399
|
-
"tw:bg-error-500",
|
|
400
|
-
"tw:focus:text-white",
|
|
401
|
-
"tw:hover:text-white",
|
|
402
|
-
"tw:hover:not-disabled:bg-error-600",
|
|
403
|
-
"tw:active:not-disabled:bg-error-700",
|
|
404
|
-
// anchor disabled override
|
|
405
|
-
"tw:aria-disabled:!bg-error-500"
|
|
406
|
-
],
|
|
407
|
-
invisible: [
|
|
408
|
-
"tw:text-neutral-800",
|
|
409
|
-
"tw:bg-transparent",
|
|
410
|
-
"tw:focus:text-neutral-800",
|
|
411
|
-
"tw:hover:not-disabled:bg-neutral-100",
|
|
412
|
-
"tw:hover:text-neutral-800",
|
|
413
|
-
"tw:active:not-disabled:bg-neutral-150",
|
|
414
|
-
// contrasting icon on hover/active
|
|
415
|
-
"tw:[&_svg]:text-neutral-400",
|
|
416
|
-
"tw:hover:not-disabled:[&_svg]:text-secondary-600",
|
|
417
|
-
"tw:active:not-disabled:[&_svg]:text-secondary-600",
|
|
418
|
-
// anchor disabled override
|
|
419
|
-
"tw:aria-disabled:!bg-transparent"
|
|
420
|
-
],
|
|
421
|
-
outline: [
|
|
422
|
-
"tw:text-neutral-800",
|
|
423
|
-
"tw:bg-white",
|
|
424
|
-
// border
|
|
425
|
-
"tw:!border-neutral-200",
|
|
426
|
-
"tw:hover:text-neutral-800",
|
|
427
|
-
"tw:focus:text-neutral-800",
|
|
428
|
-
"tw:hover:not-disabled:!border-neutral-300",
|
|
429
|
-
"tw:hover:not-disabled:bg-neutral-100",
|
|
430
|
-
"tw:active:not-disabled:bg-neutral-200",
|
|
431
|
-
// contrasting icon hover, same as invisible
|
|
432
|
-
"tw:[&_svg]:text-neutral-400",
|
|
433
|
-
"tw:not-disabled:hover:[&_svg]:text-secondary-600",
|
|
434
|
-
"tw:active:not-disabled:[&_svg]:text-secondary-600",
|
|
435
|
-
// anchor disabled override
|
|
436
|
-
"tw:aria-disabled:!bg-white",
|
|
437
|
-
"tw:aria-disabled:!border-neutral-200"
|
|
438
|
-
],
|
|
439
|
-
inline: [
|
|
440
|
-
"tw:text-neutral-800",
|
|
441
|
-
"tw:bg-transparent",
|
|
442
|
-
"tw:rounded-full",
|
|
443
|
-
"tw:[&_svg]:text-neutral-400",
|
|
444
|
-
"tw:not-disabled:hover:[&_svg]:text-secondary-600",
|
|
445
|
-
"tw:not-disabled:focus:[&_svg]:text-secondary-600"
|
|
446
|
-
]
|
|
447
|
-
},
|
|
448
|
-
size: {
|
|
449
|
-
medium: [
|
|
450
|
-
"tw:max-h-10",
|
|
451
|
-
"tw:min-h-10",
|
|
452
|
-
"tw:px-4",
|
|
453
|
-
"tw:py-2.5",
|
|
454
|
-
'tw:[&_svg:not([class*="tw:size-"])]:size-4'
|
|
455
|
-
],
|
|
456
|
-
small: [
|
|
457
|
-
"tw:max-h-8",
|
|
458
|
-
"tw:min-h-8",
|
|
459
|
-
"tw:px-4",
|
|
460
|
-
"tw:py-1.5",
|
|
461
|
-
'tw:[&_svg:not([class*="tw:size-"])]:size-4'
|
|
462
|
-
],
|
|
463
|
-
large: [
|
|
464
|
-
"tw:max-h-12",
|
|
465
|
-
"tw:min-h-12",
|
|
466
|
-
"tw:px-4",
|
|
467
|
-
"tw:py-3.5",
|
|
468
|
-
'tw:[&_svg:not([class*="tw:size-"])]:size-4'
|
|
469
|
-
],
|
|
470
|
-
"icon-lg": ["tw:size-12", "tw:p-0", 'tw:[&_svg:not([class*="tw:size-"])]:size-6'],
|
|
471
|
-
icon: ["tw:size-10", "tw:p-0", 'tw:[&_svg:not([class*="tw:size-"])]:size-4'],
|
|
472
|
-
"icon-sm": ["tw:size-8", "tw:p-0", 'tw:[&_svg:not([class*="tw:size-"])]:size-4'],
|
|
473
|
-
"icon-xs": ["tw:size-6", "tw:p-0", 'tw:[&_svg:not([class*="tw:size-"])]:size-4'],
|
|
474
|
-
"icon-2xs": [
|
|
475
|
-
"tw:!inline-flex",
|
|
476
|
-
"tw:size-5",
|
|
477
|
-
"tw:max-h-5",
|
|
478
|
-
'tw:[&_svg:not([class*="tw:size-"])]:size-3'
|
|
479
|
-
],
|
|
480
|
-
"icon-3xs": ["tw:h-fit", "tw:w-fit", 'tw:[&_svg:not([class*="tw:size-"])]:size-4']
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
);
|
|
485
|
-
var argoVariants = cva(
|
|
486
|
-
[
|
|
487
|
-
"tailwindcss-preflight",
|
|
488
|
-
// layout
|
|
489
|
-
"tw:relative",
|
|
490
|
-
"tw:inline-flex",
|
|
491
|
-
"tw:items-center",
|
|
492
|
-
"tw:justify-center",
|
|
493
|
-
"tw:whitespace-nowrap",
|
|
494
|
-
"tw:gap-2",
|
|
495
|
-
// border
|
|
496
|
-
"tw:border",
|
|
497
|
-
"tw:border-transparent",
|
|
498
|
-
"tw:rounded-[var(--radius-lg,0.25rem)]",
|
|
499
|
-
// text
|
|
500
|
-
"tw:font-medium",
|
|
501
|
-
"tw:select-none",
|
|
502
|
-
// focus visible
|
|
503
|
-
"tw:!outline-hidden",
|
|
504
|
-
"tw:focus-visible:ring-2",
|
|
505
|
-
// disabled
|
|
506
|
-
"tw:disabled:cursor-not-allowed",
|
|
507
|
-
"tw:disabled:opacity-50",
|
|
508
|
-
"tw:active:opacity-60",
|
|
509
|
-
"tw:transition-all",
|
|
510
|
-
"tw:bg-clip-padding",
|
|
511
|
-
// anchor support
|
|
512
|
-
"tw:!no-underline",
|
|
513
|
-
"tw:aria-disabled:cursor-not-allowed",
|
|
514
|
-
"tw:aria-disabled:opacity-50",
|
|
515
|
-
// icon
|
|
516
|
-
"tw:shrink-0",
|
|
517
|
-
"tw:[&_svg]:pointer-events-none",
|
|
518
|
-
"tw:[&_svg]:shrink-0",
|
|
519
|
-
"tw:[&_svg:not([class*='tw:size-'])]:size-4"
|
|
520
|
-
],
|
|
521
|
-
{
|
|
522
|
-
defaultVariants: {
|
|
523
|
-
variant: "primary",
|
|
524
|
-
size: "medium"
|
|
525
|
-
},
|
|
526
|
-
variants: {
|
|
527
|
-
block: {
|
|
528
|
-
true: ["tw:w-full"]
|
|
529
|
-
},
|
|
530
|
-
variant: {
|
|
531
|
-
primary: [
|
|
532
|
-
"tw:bg-primary",
|
|
533
|
-
"tw:text-primary-foreground",
|
|
534
|
-
"tw:[a]:hover:bg-primary/80",
|
|
535
|
-
"tw:hover:not-disabled:bg-primary/90",
|
|
536
|
-
"tw:hover:text-primary-foreground",
|
|
537
|
-
"tw:focus:text-primary-foreground",
|
|
538
|
-
"tw:focus-visible:border-primary",
|
|
539
|
-
"tw:focus-visible:ring-ring/50"
|
|
540
|
-
],
|
|
541
|
-
secondary: [
|
|
542
|
-
"tw:bg-primary/10",
|
|
543
|
-
"tw:text-primary",
|
|
544
|
-
"tw:hover:not-disabled:bg-primary/20",
|
|
545
|
-
"tw:focus-visible:border-primary",
|
|
546
|
-
"tw:focus-visible:ring-ring/50"
|
|
547
|
-
],
|
|
548
|
-
// should be called "destructive" by Figma
|
|
549
|
-
danger: [
|
|
550
|
-
"tw:bg-destructive",
|
|
551
|
-
"tw:text-destructive-foreground",
|
|
552
|
-
"tw:hover:text-destructive-foreground",
|
|
553
|
-
"tw:focus:text-destructive-foreground",
|
|
554
|
-
"tw:focus-visible:border-destructive",
|
|
555
|
-
"tw:focus-visible:ring-destructive/20"
|
|
556
|
-
],
|
|
557
|
-
outline: [
|
|
558
|
-
"tw:!border-input",
|
|
559
|
-
"tw:bg-background",
|
|
560
|
-
// Semantic base text color so the label/icon flips in dark mode
|
|
561
|
-
// (matches `invisible`); previously unset → inherited a fixed dark color.
|
|
562
|
-
"tw:text-foreground",
|
|
563
|
-
// Hover follows the brand primary (translucent tint), matching the
|
|
564
|
-
// `secondary` variant — not the fixed `accent` blue.
|
|
565
|
-
"tw:hover:not-disabled:bg-primary/10",
|
|
566
|
-
"tw:hover:not-disabled:text-primary",
|
|
567
|
-
"tw:hover:active:bg-background",
|
|
568
|
-
"tw:focus-visible:!border-primary",
|
|
569
|
-
"tw:focus-visible:ring-ring/50"
|
|
570
|
-
],
|
|
571
|
-
// should be called "ghost" by Figma
|
|
572
|
-
invisible: [
|
|
573
|
-
"tw:bg-transparent",
|
|
574
|
-
"tw:text-foreground",
|
|
575
|
-
"tw:hover:not-disabled:bg-primary/10",
|
|
576
|
-
"tw:hover:not-disabled:text-primary",
|
|
577
|
-
"tw:hover:not-disabled:border-primary/10",
|
|
578
|
-
"tw:focus-visible:ring-ring/50"
|
|
579
|
-
],
|
|
580
|
-
// should be called "link" by Figma
|
|
581
|
-
inline: [
|
|
582
|
-
"tw:bg-transparent",
|
|
583
|
-
"tw:text-primary",
|
|
584
|
-
"tw:hover:underline",
|
|
585
|
-
"tw:hover:active:bg-transparent",
|
|
586
|
-
"tw:focus-visible:ring-ring/50"
|
|
587
|
-
]
|
|
588
|
-
},
|
|
589
|
-
size: {
|
|
590
|
-
// should be called "default" by Figma
|
|
591
|
-
medium: ["tw:max-h-9", "tw:py-2", "tw:px-4", "tw:text-sm"],
|
|
592
|
-
// should be called "small" by Figma
|
|
593
|
-
small: ["tw:max-h-8", "tw:py-2", "tw:px-3", "tw:text-xs"],
|
|
594
|
-
// should be called "large" by Figma
|
|
595
|
-
large: ["tw:max-h-10", "tw:py-2.5", "tw:px-6", "tw:text-sm"],
|
|
596
|
-
"icon-lg": ["tw:size-10"],
|
|
597
|
-
icon: ["tw:size-9"],
|
|
598
|
-
"icon-sm": ["tw:size-8"],
|
|
599
|
-
// unsupported in ARGO, remove when old design is gone
|
|
600
|
-
"icon-xs": [],
|
|
601
|
-
"icon-2xs": [],
|
|
602
|
-
"icon-3xs": []
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
);
|
|
607
|
-
var Button = ({
|
|
608
|
-
ref,
|
|
609
|
-
children,
|
|
610
|
-
disabled = false,
|
|
611
|
-
className,
|
|
612
|
-
type = "button",
|
|
613
|
-
isLoading = false,
|
|
614
|
-
asChild = false,
|
|
615
|
-
onClick,
|
|
616
|
-
variant = "primary",
|
|
617
|
-
size = "medium",
|
|
618
|
-
block = false,
|
|
619
|
-
...buttonProps
|
|
620
|
-
}) => {
|
|
621
|
-
const renderArgo = useArgoDesign();
|
|
622
|
-
const Comp = asChild ? Root : "button";
|
|
623
|
-
const isIconOnly = String(size).startsWith("icon");
|
|
624
|
-
const classNames = renderArgo ? argoVariants({ variant, size, block, className }) : variants({ size, variant, block, className });
|
|
625
|
-
const handleClick = (event) => {
|
|
626
|
-
const isAnchor = event.currentTarget.tagName === "A";
|
|
627
|
-
if (isAnchor && disabled) {
|
|
628
|
-
event.preventDefault();
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
onClick?.(event);
|
|
632
|
-
};
|
|
633
|
-
return /* @__PURE__ */ jsxs(
|
|
634
|
-
Comp,
|
|
635
|
-
{
|
|
636
|
-
...buttonProps,
|
|
637
|
-
ref,
|
|
638
|
-
disabled,
|
|
639
|
-
"aria-disabled": disabled,
|
|
640
|
-
"data-variant": variant,
|
|
641
|
-
"data-icon-only": isIconOnly,
|
|
642
|
-
type,
|
|
643
|
-
onClick: handleClick,
|
|
644
|
-
className: cn(classNames),
|
|
645
|
-
children: [
|
|
646
|
-
isLoading && /* @__PURE__ */ jsx(Loader2, { className: "tw:size-4 tw:shrink-0 tw:animate-spin" }),
|
|
647
|
-
/* @__PURE__ */ jsx(Slottable, { children: isLoading && isIconOnly ? null : children })
|
|
648
|
-
]
|
|
649
|
-
}
|
|
650
|
-
);
|
|
651
|
-
};
|
|
652
|
-
var Clipboard2 = ({
|
|
653
|
-
ref,
|
|
654
|
-
text: textProp,
|
|
655
|
-
children,
|
|
656
|
-
tooltip = "Copy to Clipboard",
|
|
657
|
-
tooltipPlacement = "top",
|
|
658
|
-
tooltipVariant: tooltipVariantProp = "action",
|
|
659
|
-
asChild = false,
|
|
660
|
-
onClick,
|
|
661
|
-
className,
|
|
662
|
-
...restButtonProps
|
|
663
|
-
}) => {
|
|
664
|
-
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
665
|
-
const [state, setState] = useState("ready");
|
|
666
|
-
const text = typeof textProp === "function" ? textProp() : textProp;
|
|
667
|
-
const copy = async (text2) => {
|
|
668
|
-
try {
|
|
669
|
-
if (!document.hasFocus()) window.focus();
|
|
670
|
-
await copyToClipboard(text2);
|
|
671
|
-
setState("copied");
|
|
672
|
-
} catch {
|
|
673
|
-
setState("error");
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
const handleOnClick = (event) => {
|
|
677
|
-
setIsTooltipOpen(true);
|
|
678
|
-
if (text && state === "ready") void copy(text);
|
|
679
|
-
onClick?.(event);
|
|
680
|
-
};
|
|
681
|
-
const handleOnOpenChange = (open) => {
|
|
682
|
-
if (!open && state !== "ready") setState("ready");
|
|
683
|
-
setIsTooltipOpen(open);
|
|
684
|
-
};
|
|
685
|
-
const tooltipContent = (() => {
|
|
686
|
-
if (!text) return "Nothing to copy";
|
|
687
|
-
if (state === "error") return "Failed to copy";
|
|
688
|
-
if (state === "copied") return "Copied to Clipboard";
|
|
689
|
-
return tooltip;
|
|
690
|
-
})();
|
|
691
|
-
const tooltipVariant = state === "ready" && !!text ? tooltipVariantProp : "action";
|
|
692
|
-
const hasTooltipContent = tooltipContent !== null && tooltipContent !== void 0;
|
|
693
|
-
return /* @__PURE__ */ jsxs(Tooltip.Root, { open: isTooltipOpen, onOpenChange: handleOnOpenChange, children: [
|
|
694
|
-
/* @__PURE__ */ jsx(
|
|
695
|
-
Tooltip.Trigger,
|
|
696
|
-
{
|
|
697
|
-
...restButtonProps,
|
|
698
|
-
asChild,
|
|
699
|
-
keepOpenOnClick: true,
|
|
700
|
-
onClick: handleOnClick,
|
|
701
|
-
className: cn("tw:cursor-pointer", className),
|
|
702
|
-
ref,
|
|
703
|
-
children: children ?? text
|
|
704
|
-
}
|
|
705
|
-
),
|
|
706
|
-
hasTooltipContent && /* @__PURE__ */ jsx(
|
|
707
|
-
Tooltip.Content,
|
|
708
|
-
{
|
|
709
|
-
keepOpenOnPointerDownOutside: true,
|
|
710
|
-
placement: tooltipPlacement,
|
|
711
|
-
variant: tooltipVariant,
|
|
712
|
-
children: tooltipContent
|
|
713
|
-
}
|
|
714
|
-
)
|
|
715
|
-
] });
|
|
716
|
-
};
|
|
717
|
-
var DEFAULT_ICON = /* @__PURE__ */ jsx(Copy, {});
|
|
718
|
-
var DEFAULT_ARIA_LABEL = "Copy";
|
|
719
|
-
var ClipboardButton = ({
|
|
720
|
-
// clipboard props
|
|
721
|
-
text,
|
|
722
|
-
tooltip,
|
|
723
|
-
tooltipPlacement,
|
|
724
|
-
tooltipVariant,
|
|
725
|
-
// button props
|
|
726
|
-
icon = DEFAULT_ICON,
|
|
727
|
-
variant = "outline",
|
|
728
|
-
children,
|
|
729
|
-
...rest
|
|
730
|
-
}) => {
|
|
731
|
-
const defaultAriaLabel = typeof tooltip === "string" && tooltip.trim() ? tooltip : DEFAULT_ARIA_LABEL;
|
|
732
|
-
const ariaLabel = rest["aria-label"] ?? (children == null ? defaultAriaLabel : void 0);
|
|
733
|
-
return /* @__PURE__ */ jsx(
|
|
734
|
-
Clipboard2,
|
|
735
|
-
{
|
|
736
|
-
asChild: true,
|
|
737
|
-
tooltip,
|
|
738
|
-
tooltipPlacement,
|
|
739
|
-
tooltipVariant,
|
|
740
|
-
text,
|
|
741
|
-
children: /* @__PURE__ */ jsxs(Button, { ...rest, "aria-label": ariaLabel, variant, disabled: !text, children: [
|
|
742
|
-
icon,
|
|
743
|
-
children
|
|
744
|
-
] })
|
|
745
|
-
}
|
|
746
|
-
);
|
|
747
|
-
};
|
|
748
|
-
var ButtonToolbar = ({ value, children }) => {
|
|
749
|
-
if (!value && !children) return null;
|
|
750
|
-
return /* @__PURE__ */ jsxs("div", { className: "tw:pointer-events-auto tw:ml-auto tw:mr-4 tw:flex tw:w-fit tw:gap-1 tw:overflow-visible tw:rounded-lg tw:border tw:border-solid tw:border-border tw:!bg-background tw:p-[3px] tw:shadow", children: [
|
|
751
|
-
!!value && /* @__PURE__ */ jsx(ClipboardButton, { size: "icon-sm", variant: "invisible", text: value }),
|
|
752
|
-
children
|
|
753
|
-
] });
|
|
754
|
-
};
|
|
755
|
-
var COMMANDS = [
|
|
756
|
-
"run-operation",
|
|
757
|
-
"run",
|
|
758
|
-
"test",
|
|
759
|
-
"seed",
|
|
760
|
-
"snapshot",
|
|
761
|
-
"list",
|
|
762
|
-
"ls",
|
|
763
|
-
"compile",
|
|
764
|
-
"build",
|
|
765
|
-
"deps",
|
|
766
|
-
"docs",
|
|
767
|
-
"source"
|
|
768
|
-
];
|
|
769
|
-
var SUBCOMMANDS = { docs: ["generate"], source: ["freshness"] };
|
|
770
|
-
var ARGUMENTS = ["--select", "--exclude", "--selector", "--defer", "--resource-type", "-s"];
|
|
771
|
-
var SELECTORS = ["--select", "--exclude", "-s"];
|
|
772
|
-
var METHODS = [
|
|
773
|
-
"path:",
|
|
774
|
-
"source:",
|
|
775
|
-
"tag:",
|
|
776
|
-
"package:",
|
|
777
|
-
"config:",
|
|
778
|
-
"test_type:",
|
|
779
|
-
"test_name:",
|
|
780
|
-
"state:",
|
|
781
|
-
"exposure:",
|
|
782
|
-
"metric:",
|
|
783
|
-
"result:",
|
|
784
|
-
"source_status:",
|
|
785
|
-
"column_name:"
|
|
786
|
-
];
|
|
787
|
-
var FLAGS = [
|
|
788
|
-
"--fail-fast",
|
|
789
|
-
"--warn-error",
|
|
790
|
-
"--favor-state",
|
|
791
|
-
"--vars",
|
|
792
|
-
"--models",
|
|
793
|
-
"--threads",
|
|
794
|
-
"--profiles-dir",
|
|
795
|
-
"--profile",
|
|
796
|
-
"--full-refresh"
|
|
797
|
-
];
|
|
798
|
-
var COMMAND_PHRASES = COMMANDS.flatMap((command) => {
|
|
799
|
-
const subcommands = SUBCOMMANDS[command];
|
|
800
|
-
return subcommands ? subcommands.map((subcommand) => `${command} ${subcommand}`) : [command];
|
|
801
|
-
});
|
|
802
|
-
var alternation = (list) => [...list].sort((a, b) => b.length - a.length).join("|");
|
|
803
|
-
var word = (list) => new RegExp(`^\\s+(?:${alternation(list)})\\b`, "i");
|
|
804
|
-
var prefix = (list) => new RegExp(`^\\s+(?:${alternation(list)})`, "i");
|
|
805
|
-
var WORD = /[\w:-]*$/;
|
|
806
|
-
var asOptions = (list, type) => list.map((label) => ({ label, type }));
|
|
807
|
-
var DBT = [{ label: "dbt", type: "keyword" }];
|
|
808
|
-
var COMMAND_OPTIONS = asOptions(COMMANDS, "keyword");
|
|
809
|
-
var SUBCOMMAND_OPTIONS = Object.fromEntries(
|
|
810
|
-
Object.entries(SUBCOMMANDS).map(([command, subcommands]) => [
|
|
811
|
-
command,
|
|
812
|
-
asOptions(subcommands, "keyword")
|
|
813
|
-
])
|
|
814
|
-
);
|
|
815
|
-
var ARGUMENT_OPTIONS = asOptions(ARGUMENTS, "variable");
|
|
816
|
-
var FLAG_OPTIONS = asOptions(FLAGS, "constant");
|
|
817
|
-
var METHOD_OPTIONS = asOptions(METHODS, "property");
|
|
818
|
-
var optionsAfter = (words) => {
|
|
819
|
-
const [step, command, ...rest] = words;
|
|
820
|
-
if (step === void 0) return DBT;
|
|
821
|
-
if (step.toLowerCase() !== "dbt") return [];
|
|
822
|
-
if (command === void 0) return COMMAND_OPTIONS;
|
|
823
|
-
const subcommands = SUBCOMMAND_OPTIONS[command.toLowerCase()];
|
|
824
|
-
if (subcommands && rest.length === 0) return subcommands;
|
|
825
|
-
const lastArgument = rest.filter((it) => it.startsWith("-")).at(-1);
|
|
826
|
-
const selecting = lastArgument !== void 0 && SELECTORS.includes(lastArgument.toLowerCase());
|
|
827
|
-
return selecting ? [...ARGUMENT_OPTIONS, ...FLAG_OPTIONS, ...METHOD_OPTIONS] : [...ARGUMENT_OPTIONS, ...FLAG_OPTIONS];
|
|
828
|
-
};
|
|
829
|
-
var complete = (context) => {
|
|
830
|
-
const typed = context.matchBefore(WORD);
|
|
831
|
-
if (!typed?.text && !context.explicit) return null;
|
|
832
|
-
const from = typed?.from ?? context.pos;
|
|
833
|
-
const line = context.state.doc.lineAt(from);
|
|
834
|
-
const options = optionsAfter(
|
|
835
|
-
line.text.slice(0, from - line.from).split(/\s+/).filter(Boolean)
|
|
836
|
-
);
|
|
837
|
-
return options.length > 0 ? { from, options, validFor: WORD } : null;
|
|
838
|
-
};
|
|
839
|
-
var dbt = simpleMode({
|
|
840
|
-
languageData: {
|
|
841
|
-
// `toggleComment` is a no-op without these, so Mod-/ silently does nothing.
|
|
842
|
-
commentTokens: { line: "--", block: { open: "/*", close: "*/" } },
|
|
843
|
-
autocomplete: complete
|
|
844
|
-
},
|
|
845
|
-
start: [
|
|
846
|
-
{ regex: /"(?:[^\\]|\\.)*?(?:"|$)/, token: "string" },
|
|
847
|
-
// Word-bounded, so `dbtX` is not a dbt step whose first word happens to
|
|
848
|
-
// colour — the same thing the completion source asks of it.
|
|
849
|
-
{ regex: /dbt\b/, token: "keyword", sol: true },
|
|
850
|
-
{ regex: word(COMMAND_PHRASES), token: "keyword" },
|
|
851
|
-
{ regex: word(ARGUMENTS), token: "variableName" },
|
|
852
|
-
{ regex: prefix(METHODS), token: "propertyName" },
|
|
853
|
-
{ regex: prefix(FLAGS), token: "attributeName" },
|
|
854
|
-
{ regex: /(?:@|\*|,|\+\d+|\d+\+|\+)/, token: "operator" },
|
|
855
|
-
{ regex: /'.*'/, token: "string" },
|
|
856
|
-
{ regex: /true|false/, token: "atom" }
|
|
857
|
-
]
|
|
858
|
-
});
|
|
859
|
-
|
|
860
|
-
// src/components/CodeEditor/modes/jsonnet.ts
|
|
861
|
-
var COMMENT_END = /^\*\//;
|
|
862
|
-
var COMMENT_START = /^\/\/|^#/;
|
|
863
|
-
var C_COMMENT_START = /^\/\*/;
|
|
864
|
-
var TEXT_BLOCK = /^\|\|\|/;
|
|
865
|
-
var TEXT_BLOCK_END = /^\s*\|\|\|/;
|
|
866
|
-
var RAW_DOUBLE = /^""/;
|
|
867
|
-
var RAW_SINGLE = /^''/;
|
|
868
|
-
var CLOSE_DOUBLE = /^"/;
|
|
869
|
-
var CLOSE_SINGLE = /^'/;
|
|
870
|
-
var ESCAPE = /^\\[\\"'/bfnrt0]/;
|
|
871
|
-
var UNICODE_ESCAPE = /^\\u[0-9a-fA-F]{4}/;
|
|
872
|
-
var BACKSLASH = /^\\/;
|
|
873
|
-
var IMPORT = /^import(?:str)?\s*(@?)(["'])/;
|
|
874
|
-
var QUOTE = /^(@?)(["'])/;
|
|
875
|
-
var ROOT = /^\$/;
|
|
876
|
-
var NUMBER = /^(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i;
|
|
877
|
-
var OPERATOR = /^[-+/*=<>!&~^|$%]+/;
|
|
878
|
-
var IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_]*/;
|
|
879
|
-
var KEYWORDS = {
|
|
880
|
-
local: "keyword",
|
|
881
|
-
self: "keyword",
|
|
882
|
-
super: "keyword",
|
|
883
|
-
assert: "keyword",
|
|
884
|
-
function: "keyword",
|
|
885
|
-
if: "keyword",
|
|
886
|
-
then: "keyword",
|
|
887
|
-
else: "keyword",
|
|
888
|
-
for: "keyword",
|
|
889
|
-
in: "keyword",
|
|
890
|
-
tailstrict: "keyword",
|
|
891
|
-
error: "keyword",
|
|
892
|
-
true: "atom",
|
|
893
|
-
false: "atom",
|
|
894
|
-
null: "atom"
|
|
895
|
-
};
|
|
896
|
-
var jsonnet = {
|
|
897
|
-
name: "jsonnet",
|
|
898
|
-
// `toggleComment` is a no-op without these, so Mod-/ silently does nothing.
|
|
899
|
-
languageData: { commentTokens: { line: "//", block: { open: "/*", close: "*/" } } },
|
|
900
|
-
startState: () => ({
|
|
901
|
-
cComment: false,
|
|
902
|
-
textBlock: false,
|
|
903
|
-
textBlockIndent: null,
|
|
904
|
-
string: false,
|
|
905
|
-
importString: false,
|
|
906
|
-
stringSingle: false,
|
|
907
|
-
stringRaw: false
|
|
908
|
-
}),
|
|
909
|
-
token: (stream, state) => {
|
|
910
|
-
if (state.cComment) {
|
|
911
|
-
if (stream.match(COMMENT_END)) {
|
|
912
|
-
state.cComment = false;
|
|
913
|
-
return "comment";
|
|
914
|
-
}
|
|
915
|
-
stream.next();
|
|
916
|
-
return "comment";
|
|
917
|
-
}
|
|
918
|
-
if (state.textBlock) {
|
|
919
|
-
if (state.textBlockIndent == null) {
|
|
920
|
-
if (stream.match(TEXT_BLOCK_END)) {
|
|
921
|
-
state.textBlock = false;
|
|
922
|
-
return "string";
|
|
923
|
-
}
|
|
924
|
-
state.textBlockIndent = stream.indentation();
|
|
925
|
-
}
|
|
926
|
-
if (stream.indentation() >= state.textBlockIndent) {
|
|
927
|
-
stream.skipToEnd();
|
|
928
|
-
return "string";
|
|
929
|
-
}
|
|
930
|
-
if (stream.match(TEXT_BLOCK_END)) {
|
|
931
|
-
state.textBlock = false;
|
|
932
|
-
return "string";
|
|
933
|
-
}
|
|
934
|
-
stream.next();
|
|
935
|
-
return "invalid";
|
|
936
|
-
}
|
|
937
|
-
if (state.string || state.importString) {
|
|
938
|
-
const style = state.string ? "string" : "meta";
|
|
939
|
-
if (state.stringRaw) {
|
|
940
|
-
if (stream.match(state.stringSingle ? RAW_SINGLE : RAW_DOUBLE)) return "escape";
|
|
941
|
-
} else {
|
|
942
|
-
if (stream.match(ESCAPE)) return "escape";
|
|
943
|
-
if (stream.match(UNICODE_ESCAPE)) return "escape";
|
|
944
|
-
if (stream.match(BACKSLASH)) return "invalid";
|
|
945
|
-
}
|
|
946
|
-
if (stream.match(state.stringSingle ? CLOSE_SINGLE : CLOSE_DOUBLE)) {
|
|
947
|
-
state.string = false;
|
|
948
|
-
state.importString = false;
|
|
949
|
-
return style;
|
|
950
|
-
}
|
|
951
|
-
stream.next();
|
|
952
|
-
return style;
|
|
953
|
-
}
|
|
954
|
-
if (stream.match(COMMENT_START)) {
|
|
955
|
-
stream.skipToEnd();
|
|
956
|
-
return "comment";
|
|
957
|
-
}
|
|
958
|
-
if (stream.match(C_COMMENT_START)) {
|
|
959
|
-
state.cComment = true;
|
|
960
|
-
return "comment";
|
|
961
|
-
}
|
|
962
|
-
const imported = stream.match(IMPORT);
|
|
963
|
-
if (Array.isArray(imported)) {
|
|
964
|
-
state.importString = true;
|
|
965
|
-
state.stringRaw = imported[1] === "@";
|
|
966
|
-
state.stringSingle = imported[2] === "'";
|
|
967
|
-
return "meta";
|
|
968
|
-
}
|
|
969
|
-
const quoted = stream.match(QUOTE);
|
|
970
|
-
if (Array.isArray(quoted)) {
|
|
971
|
-
state.string = true;
|
|
972
|
-
state.stringRaw = quoted[1] === "@";
|
|
973
|
-
state.stringSingle = quoted[2] === "'";
|
|
974
|
-
return "string";
|
|
975
|
-
}
|
|
976
|
-
if (stream.match(TEXT_BLOCK)) {
|
|
977
|
-
state.textBlock = true;
|
|
978
|
-
state.textBlockIndent = null;
|
|
979
|
-
return "string";
|
|
980
|
-
}
|
|
981
|
-
if (stream.match(ROOT)) return "keyword";
|
|
982
|
-
if (stream.match(NUMBER)) return "number";
|
|
983
|
-
if (stream.match(OPERATOR)) return "operator";
|
|
984
|
-
const identifier = stream.match(IDENTIFIER);
|
|
985
|
-
if (Array.isArray(identifier)) return KEYWORDS[identifier[0]] ?? null;
|
|
986
|
-
stream.next();
|
|
987
|
-
return null;
|
|
988
|
-
}
|
|
989
|
-
};
|
|
990
|
-
var resolveToken = (token, fallbackChannels, alpha) => {
|
|
991
|
-
const channels = typeof document === "undefined" ? fallbackChannels : getComputedStyle(document.documentElement).getPropertyValue(`--${token}`).trim() || fallbackChannels;
|
|
992
|
-
return alpha === void 0 ? `rgb(${channels})` : `rgb(${channels} / ${alpha})`;
|
|
993
|
-
};
|
|
994
|
-
var SSR_SIGNAL = "ssr";
|
|
995
|
-
var readThemeSignal = () => {
|
|
996
|
-
if (typeof document === "undefined") return SSR_SIGNAL;
|
|
997
|
-
const root = document.documentElement;
|
|
998
|
-
return `${root.getAttribute("data-theme") ?? ""}:${root.getAttribute("data-brand") ?? ""}`;
|
|
999
|
-
};
|
|
1000
|
-
var subscribeThemeSignal = (onChange) => {
|
|
1001
|
-
if (typeof document === "undefined") return () => {
|
|
1002
|
-
};
|
|
1003
|
-
const observer = new MutationObserver(onChange);
|
|
1004
|
-
observer.observe(document.documentElement, {
|
|
1005
|
-
attributes: true,
|
|
1006
|
-
attributeFilter: ["data-theme", "data-brand"]
|
|
1007
|
-
});
|
|
1008
|
-
return () => observer.disconnect();
|
|
1009
|
-
};
|
|
1010
|
-
var useThemeSignal = () => useSyncExternalStore(subscribeThemeSignal, readThemeSignal, () => SSR_SIGNAL);
|
|
1011
|
-
var themeCache = /* @__PURE__ */ new Map();
|
|
1012
|
-
var useThemedExtension = (cacheKey, build) => {
|
|
1013
|
-
const themeSignal = useThemeSignal();
|
|
1014
|
-
const key = `${themeSignal} ${cacheKey}`;
|
|
1015
|
-
let cached = themeCache.get(key);
|
|
1016
|
-
if (!cached) {
|
|
1017
|
-
cached = build();
|
|
1018
|
-
themeCache.set(key, cached);
|
|
1019
|
-
}
|
|
1020
|
-
return cached;
|
|
1021
|
-
};
|
|
1022
|
-
|
|
1023
|
-
// src/components/CodeEditor/helpers.ts
|
|
1024
|
-
var LANGUAGE_MODES = [
|
|
1025
|
-
"application/json",
|
|
1026
|
-
"text/plain",
|
|
1027
|
-
"text/x-python",
|
|
1028
|
-
"text/x-sql",
|
|
1029
|
-
"text/x-mysql",
|
|
1030
|
-
"text/x-pgsql",
|
|
1031
|
-
"text/x-mssql",
|
|
1032
|
-
// Snowflake, under a historical name — these strings are a published prop contract.
|
|
1033
|
-
"text/x-sfsql",
|
|
1034
|
-
"text/x-plsql",
|
|
1035
|
-
"text/x-rsrc",
|
|
1036
|
-
"text/x-sh",
|
|
1037
|
-
"text/x-toml",
|
|
1038
|
-
"text/jsonnet",
|
|
1039
|
-
"text/x-dbt",
|
|
1040
|
-
"text/javascript",
|
|
1041
|
-
"text/typescript"
|
|
1042
|
-
];
|
|
1043
|
-
var isLanguageMode = (mode) => LANGUAGE_MODES.includes(mode);
|
|
1044
|
-
var buildBaseThemeStyles = () => ({
|
|
1045
|
-
"*": { lineHeight: "20px" },
|
|
1046
|
-
"*::selection": {
|
|
1047
|
-
backgroundColor: resolveToken("primary", "31 143 255"),
|
|
1048
|
-
color: `${resolveToken("primary-foreground", "255 255 255")} !important`
|
|
1049
|
-
},
|
|
1050
|
-
'&.cm-editor:has(.cm-content[contenteditable="false"])': {
|
|
1051
|
-
backgroundColor: resolveToken("secondary", "226 232 240")
|
|
1052
|
-
},
|
|
1053
|
-
'&.cm-editor:has(.cm-content[contenteditable="false"]) .cm-gutters': {
|
|
1054
|
-
backgroundColor: resolveToken("border", "229 231 235")
|
|
1055
|
-
},
|
|
1056
|
-
"&.cm-editor .cm-scroller": { overflowAnchor: "none" },
|
|
1057
|
-
"&.cm-editor, &.cm-editor .cm-scroller": {
|
|
1058
|
-
minHeight: "100%",
|
|
1059
|
-
flexGrow: 1,
|
|
1060
|
-
alignItems: "stretch !important",
|
|
1061
|
-
outline: "none"
|
|
1062
|
-
},
|
|
1063
|
-
".cm-gutter.cm-foldGutter": { display: "none !important" },
|
|
1064
|
-
".cm-gutter.cm-lineNumbers": { paddingLeft: "20px", paddingRight: "6px" },
|
|
1065
|
-
".cm-gutters": { height: "auto" },
|
|
1066
|
-
// tokens overrides
|
|
1067
|
-
".cm-line .tok-string": { color: colors.warning[700] },
|
|
1068
|
-
// merge (diff) view
|
|
1069
|
-
'&[class*="cm-merge-"] .cm-deletedLine': { backgroundColor: colors.error[100] },
|
|
1070
|
-
'&[class*="cm-merge-"] .cm-changedLine': { backgroundColor: colors.green[100] },
|
|
1071
|
-
'&[class*="cm-merge-"] .cm-deletedLineGutter': { backgroundColor: colors.error[200] },
|
|
1072
|
-
'&[class*="cm-merge-"] .cm-changedLineGutter': { backgroundColor: colors.green[200] },
|
|
1073
|
-
'&[class*="cm-merge-"] .cm-deletedText': { background: colors.error[200] },
|
|
1074
|
-
'&[class*="cm-merge-"] .cm-changedText': { background: colors.green[200] },
|
|
1075
|
-
'&[class*="cm-merge-"]': {
|
|
1076
|
-
backgroundColor: `${colors.white} !important`
|
|
1077
|
-
},
|
|
1078
|
-
'&[class*="cm-merge-"] .cm-gutters': {
|
|
1079
|
-
backgroundColor: `${colors.white} !important`
|
|
1080
|
-
},
|
|
1081
|
-
".cm-changeGutter": { position: "absolute", zIndex: -1, width: "100%", paddingLeft: 0 },
|
|
1082
|
-
'&[class*="cm-merge-"] .cm-changedLine,&[class*="cm-merge-"] .cm-line, &[class*="cm-merge-"] .cm-deletedChunk': { paddingLeft: 0 }
|
|
1083
|
-
});
|
|
1084
|
-
var ALWAYS_OFF = {
|
|
1085
|
-
drawSelection: false,
|
|
1086
|
-
foldGutter: false,
|
|
1087
|
-
foldKeymap: false,
|
|
1088
|
-
highlightActiveLine: false,
|
|
1089
|
-
highlightActiveLineGutter: false
|
|
1090
|
-
};
|
|
1091
|
-
var buildBasicSetup = (readOnly) => ({
|
|
1092
|
-
...ALWAYS_OFF,
|
|
1093
|
-
...readOnly ? {
|
|
1094
|
-
closeBrackets: false,
|
|
1095
|
-
closeBracketsKeymap: false,
|
|
1096
|
-
lintKeymap: false,
|
|
1097
|
-
indentOnInput: false,
|
|
1098
|
-
rectangularSelection: false,
|
|
1099
|
-
dropCursor: false,
|
|
1100
|
-
highlightSelectionMatches: false
|
|
1101
|
-
} : null
|
|
1102
|
-
});
|
|
1103
|
-
var buildCustomTheme = () => githubLightInit({
|
|
1104
|
-
settings: {
|
|
1105
|
-
fontFamily: `'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New'`,
|
|
1106
|
-
background: resolveToken("background", "249 250 251"),
|
|
1107
|
-
foreground: resolveToken("foreground", "30 41 59"),
|
|
1108
|
-
gutterBackground: resolveToken("muted", "241 245 249"),
|
|
1109
|
-
gutterForeground: resolveToken("muted-foreground", "100 116 139"),
|
|
1110
|
-
gutterBorder: "transparent",
|
|
1111
|
-
lineHighlight: "transparent",
|
|
1112
|
-
selection: resolveToken("primary", "31 143 255")
|
|
1113
|
-
}
|
|
1114
|
-
});
|
|
1115
|
-
var getLanguageMode = (mode) => {
|
|
1116
|
-
switch (mode) {
|
|
1117
|
-
case void 0:
|
|
1118
|
-
case "application/json":
|
|
1119
|
-
return json();
|
|
1120
|
-
case "text/x-python":
|
|
1121
|
-
return python();
|
|
1122
|
-
case "text/x-sql":
|
|
1123
|
-
return sql({ upperCaseKeywords: true });
|
|
1124
|
-
case "text/x-mysql":
|
|
1125
|
-
return sql({ upperCaseKeywords: true, dialect: MySQL });
|
|
1126
|
-
case "text/x-pgsql":
|
|
1127
|
-
return sql({ upperCaseKeywords: true, dialect: PostgreSQL });
|
|
1128
|
-
case "text/x-mssql":
|
|
1129
|
-
return sql({ upperCaseKeywords: true, dialect: MSSQL });
|
|
1130
|
-
case "text/x-sfsql":
|
|
1131
|
-
return sql({ upperCaseKeywords: true, dialect: getSqlDialect("snowflake") });
|
|
1132
|
-
case "text/x-plsql":
|
|
1133
|
-
return sql({ upperCaseKeywords: true, dialect: PLSQL });
|
|
1134
|
-
case "text/x-rsrc":
|
|
1135
|
-
return StreamLanguage.define(r);
|
|
1136
|
-
case "text/x-sh":
|
|
1137
|
-
return StreamLanguage.define(shell);
|
|
1138
|
-
case "text/x-toml":
|
|
1139
|
-
return StreamLanguage.define(toml);
|
|
1140
|
-
case "text/jsonnet":
|
|
1141
|
-
return StreamLanguage.define(jsonnet);
|
|
1142
|
-
case "text/x-dbt":
|
|
1143
|
-
return StreamLanguage.define(dbt);
|
|
1144
|
-
case "text/javascript":
|
|
1145
|
-
return javascript({ jsx: true });
|
|
1146
|
-
case "text/typescript":
|
|
1147
|
-
return javascript({ jsx: true, typescript: true });
|
|
1148
|
-
// No language — `text/plain` lands here, and so does any mode added to
|
|
1149
|
-
// LANGUAGE_MODES without an arm above. Unstyled text is the safe degradation;
|
|
1150
|
-
// a `json()` default would colour unrelated content as if it were JSON.
|
|
1151
|
-
default:
|
|
1152
|
-
return [];
|
|
1153
|
-
}
|
|
1154
|
-
};
|
|
1155
|
-
var shouldLintJson = (mode, readOnly) => mode === "application/json" && !readOnly;
|
|
1156
|
-
var setSearchEffect = StateEffect.define();
|
|
1157
|
-
function findMatches(doc, query) {
|
|
1158
|
-
if (!query) return [];
|
|
1159
|
-
const text = doc.toString();
|
|
1160
|
-
try {
|
|
1161
|
-
const regex = new RegExp(escapeStringRegexp(query), "gi");
|
|
1162
|
-
return Array.from(text.matchAll(regex)).map((match, index) => {
|
|
1163
|
-
const from = match.index;
|
|
1164
|
-
const to = from + match[0].length;
|
|
1165
|
-
return { from, to, text: match[0], localIndex: index };
|
|
1166
|
-
});
|
|
1167
|
-
} catch (e) {
|
|
1168
|
-
console.warn("Invalid search regex:", e);
|
|
1169
|
-
return [];
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
function createDecorations(matches, selectedLocalIndex) {
|
|
1173
|
-
const decorations = matches.map((match) => {
|
|
1174
|
-
const isSelected = match.localIndex === selectedLocalIndex;
|
|
1175
|
-
const decoration = Decoration.mark({
|
|
1176
|
-
class: isSelected ? "cm-searchMatch-selected" : "cm-searchMatch"
|
|
1177
|
-
});
|
|
1178
|
-
return decoration.range(match.from, match.to);
|
|
1179
|
-
});
|
|
1180
|
-
return Decoration.set(decorations, true);
|
|
1181
|
-
}
|
|
1182
|
-
var searchField = StateField.define({
|
|
1183
|
-
create() {
|
|
1184
|
-
return {
|
|
1185
|
-
query: "",
|
|
1186
|
-
selectedMatchIndex: void 0,
|
|
1187
|
-
matches: [],
|
|
1188
|
-
decorations: Decoration.none
|
|
1189
|
-
};
|
|
1190
|
-
},
|
|
1191
|
-
update(state, tr) {
|
|
1192
|
-
let newState = state;
|
|
1193
|
-
for (const effect of tr.effects) {
|
|
1194
|
-
if (!effect.is(setSearchEffect)) {
|
|
1195
|
-
continue;
|
|
1196
|
-
}
|
|
1197
|
-
const { query, selectedMatchIndex } = effect.value;
|
|
1198
|
-
const matches = findMatches(tr.state.doc, query);
|
|
1199
|
-
const decorations = createDecorations(matches, selectedMatchIndex);
|
|
1200
|
-
newState = {
|
|
1201
|
-
query,
|
|
1202
|
-
selectedMatchIndex,
|
|
1203
|
-
matches,
|
|
1204
|
-
decorations
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
if (tr.docChanged && newState.query) {
|
|
1208
|
-
const matches = findMatches(tr.state.doc, newState.query);
|
|
1209
|
-
const decorations = createDecorations(matches, newState.selectedMatchIndex);
|
|
1210
|
-
newState = {
|
|
1211
|
-
...newState,
|
|
1212
|
-
matches,
|
|
1213
|
-
decorations
|
|
1214
|
-
};
|
|
1215
|
-
}
|
|
1216
|
-
return newState;
|
|
1217
|
-
},
|
|
1218
|
-
provide: (field) => EditorView.decorations.from(field, (state) => state.decorations)
|
|
1219
|
-
});
|
|
1220
|
-
var searchViewPlugin = ViewPlugin.fromClass(
|
|
1221
|
-
class {
|
|
1222
|
-
lastSelectedIndex;
|
|
1223
|
-
update(update) {
|
|
1224
|
-
const state = update.state.field(searchField);
|
|
1225
|
-
if (state.selectedMatchIndex !== void 0 && state.selectedMatchIndex !== this.lastSelectedIndex) {
|
|
1226
|
-
const match = state.matches[state.selectedMatchIndex];
|
|
1227
|
-
if (match) {
|
|
1228
|
-
requestAnimationFrame(() => {
|
|
1229
|
-
update.view.dispatch({
|
|
1230
|
-
effects: EditorView.scrollIntoView(match.from, { y: "center" })
|
|
1231
|
-
});
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
this.lastSelectedIndex = state.selectedMatchIndex;
|
|
1235
|
-
}
|
|
1236
|
-
if (state.selectedMatchIndex === void 0) {
|
|
1237
|
-
this.lastSelectedIndex = void 0;
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
);
|
|
1242
|
-
var searchTheme = EditorView.baseTheme({
|
|
1243
|
-
".cm-searchMatch": {
|
|
1244
|
-
backgroundColor: colors.blue[100]
|
|
1245
|
-
},
|
|
1246
|
-
".cm-searchMatch > span": {
|
|
1247
|
-
color: `${colors.blue[600]} !important`
|
|
1248
|
-
},
|
|
1249
|
-
".cm-searchMatch-selected": {
|
|
1250
|
-
backgroundColor: colors.blue[600]
|
|
1251
|
-
},
|
|
1252
|
-
".cm-searchMatch-selected > span": {
|
|
1253
|
-
color: `${colors.white} !important`
|
|
1254
|
-
}
|
|
1255
|
-
});
|
|
1256
|
-
function searchExtension() {
|
|
1257
|
-
return [searchField, searchViewPlugin, searchTheme];
|
|
1258
|
-
}
|
|
1259
|
-
function updateSearch(view, query, selectedMatchIndex) {
|
|
1260
|
-
view.dispatch({ effects: setSearchEffect.of({ query, selectedMatchIndex }) });
|
|
1261
|
-
}
|
|
1262
|
-
var KbdSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, className: cn("tw:text-xs tw:text-muted-foreground", className) });
|
|
1263
|
-
var KbdGroup = ({ ref, className, children, separator, ...props }) => {
|
|
1264
|
-
return /* @__PURE__ */ jsx(
|
|
1265
|
-
"kbd",
|
|
1266
|
-
{
|
|
1267
|
-
...props,
|
|
1268
|
-
ref,
|
|
1269
|
-
className: cn("tw:inline-flex", "tw:items-center", "tw:gap-1", className),
|
|
1270
|
-
children: separator ? (
|
|
1271
|
-
// oxlint-disable-next-line react-x/no-children-to-array
|
|
1272
|
-
Children.toArray(children).map((child, index) => (
|
|
1273
|
-
// oxlint-disable-next-line
|
|
1274
|
-
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1275
|
-
index > 0 && /* @__PURE__ */ jsx(KbdSeparator, { children: separator }),
|
|
1276
|
-
child
|
|
1277
|
-
] }, index)
|
|
1278
|
-
))
|
|
1279
|
-
) : children
|
|
1280
|
-
}
|
|
1281
|
-
);
|
|
1282
|
-
};
|
|
1283
|
-
var kbdVariants = cva(
|
|
1284
|
-
[
|
|
1285
|
-
"tailwindcss-preflight",
|
|
1286
|
-
// style
|
|
1287
|
-
"tw:pointer-events-none",
|
|
1288
|
-
"tw:w-fit",
|
|
1289
|
-
"tw:h-5",
|
|
1290
|
-
"tw:min-w-5",
|
|
1291
|
-
// layout
|
|
1292
|
-
"tw:inline-flex",
|
|
1293
|
-
"tw:items-center",
|
|
1294
|
-
"tw:justify-center",
|
|
1295
|
-
"tw:gap-1",
|
|
1296
|
-
"tw:shrink-0",
|
|
1297
|
-
// spacing
|
|
1298
|
-
"tw:px-1",
|
|
1299
|
-
'tw:[&_svg:not([class*="size-"])]:size-2.5',
|
|
1300
|
-
"tw:text-xs",
|
|
1301
|
-
"tw:font-medium",
|
|
1302
|
-
"tw:rounded"
|
|
1303
|
-
],
|
|
1304
|
-
{
|
|
1305
|
-
defaultVariants: {
|
|
1306
|
-
variant: "default"
|
|
1307
|
-
},
|
|
1308
|
-
variants: {
|
|
1309
|
-
variant: {
|
|
1310
|
-
default: "tw:bg-muted tw:text-muted-foreground",
|
|
1311
|
-
primary: "tw:bg-white/20 tw:text-white"
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
);
|
|
1316
|
-
var Kbd = ({ children, className, variant, ...rest }) => /* @__PURE__ */ jsx("kbd", { ...rest, className: kbdVariants({ className, variant }), children });
|
|
1317
|
-
Kbd.Group = KbdGroup;
|
|
1318
|
-
Kbd.Separator = KbdSeparator;
|
|
1319
|
-
var ToggleComponentHelp = () => /* @__PURE__ */ jsxs("div", { children: [
|
|
1320
|
-
"Use ",
|
|
1321
|
-
/* @__PURE__ */ jsx(Kbd, { children: isMac ? "Command+/" : "Ctrl+/" }),
|
|
1322
|
-
" to toggle comments."
|
|
1323
|
-
] });
|
|
1324
|
-
var 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);
|
|
1325
|
-
var crops = (style) => style.overflowX !== "visible" || style.overflowY !== "visible" || style.maskImage !== "none" || style.contentVisibility !== "visible" || /\b(paint|strict|content)\b/.test(style.contain);
|
|
1326
|
-
var findTooltipHost = (from) => {
|
|
1327
|
-
let outermostCropper = null;
|
|
1328
|
-
for (let node = from.parentElement; node && node !== document.body; node = node.parentElement) {
|
|
1329
|
-
const style = getComputedStyle(node);
|
|
1330
|
-
if (crops(style)) {
|
|
1331
|
-
outermostCropper = node;
|
|
1332
|
-
} else if (establishesFixedContainingBlock(style)) {
|
|
1333
|
-
return outermostCropper?.parentElement ?? node;
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
return outermostCropper?.parentElement ?? null;
|
|
1337
|
-
};
|
|
1338
|
-
var tooltipsExtension = () => {
|
|
1339
|
-
const layer = new Compartment();
|
|
1340
|
-
return [
|
|
1341
|
-
layer.of(tooltips()),
|
|
1342
|
-
ViewPlugin.define((view) => {
|
|
1343
|
-
const scheduled = setTimeout(() => {
|
|
1344
|
-
if (!view.dom.isConnected) return;
|
|
1345
|
-
const parent = findTooltipHost(view.dom);
|
|
1346
|
-
if (parent) view.dispatch({ effects: layer.reconfigure(tooltips({ parent })) });
|
|
1347
|
-
});
|
|
1348
|
-
return { destroy: () => clearTimeout(scheduled) };
|
|
1349
|
-
})
|
|
1350
|
-
];
|
|
1351
|
-
};
|
|
1352
|
-
var useTooltipsExtension = () => useMemo(tooltipsExtension, []);
|
|
1353
|
-
|
|
1354
|
-
// src/components/CodeEditor/variableCompletion.ts
|
|
1355
|
-
var BOOST = 2e3;
|
|
1356
|
-
var NAME = String.raw`[\w-]*`;
|
|
1357
|
-
var AT_CARET = new RegExp(String.raw`(?:\{{1,2} ?)?${NAME}$`);
|
|
1358
|
-
var NAME_AT_END = new RegExp(`${NAME}$`);
|
|
1359
|
-
var OPENING = /\{{1,2} ?$/;
|
|
1360
|
-
var CLOSING = /^ ?\}{1,2}/;
|
|
1361
|
-
var completeVariables = (variables = []) => {
|
|
1362
|
-
if (variables.length === 0) return () => null;
|
|
1363
|
-
const options = variables.map(({ name, value }) => ({
|
|
1364
|
-
// The bare name: `SqlEditor` filters prefix-only while `CodeEditor` filters
|
|
1365
|
-
// fuzzily, and this is the only spelling both accept whether or not the caret
|
|
1366
|
-
// has typed the braces. The braces are `displayLabel`, which is what renders.
|
|
1367
|
-
label: name,
|
|
1368
|
-
displayLabel: `{{${name}}}`,
|
|
1369
|
-
detail: value,
|
|
1370
|
-
type: "variable",
|
|
1371
|
-
boost: BOOST,
|
|
1372
|
-
apply: (view, completion, from, to) => {
|
|
1373
|
-
const { doc } = view.state;
|
|
1374
|
-
const line = doc.lineAt(from);
|
|
1375
|
-
const insert = `{{${completion.label}}}`;
|
|
1376
|
-
const opening = OPENING.exec(doc.sliceString(line.from, from));
|
|
1377
|
-
const closing = CLOSING.exec(doc.sliceString(to, line.to));
|
|
1378
|
-
const start = opening ? from - opening[0].length : from;
|
|
1379
|
-
const end = closing ? to + closing[0].length : to;
|
|
1380
|
-
view.dispatch({
|
|
1381
|
-
changes: { from: start, to: end, insert },
|
|
1382
|
-
selection: { anchor: start + insert.length }
|
|
1383
|
-
});
|
|
1384
|
-
}
|
|
1385
|
-
}));
|
|
1386
|
-
return (context) => {
|
|
1387
|
-
const match = context.matchBefore(AT_CARET);
|
|
1388
|
-
if (!match?.text) return null;
|
|
1389
|
-
const [name = ""] = NAME_AT_END.exec(match.text) ?? [];
|
|
1390
|
-
return { from: match.to - name.length, options };
|
|
1391
|
-
};
|
|
1392
|
-
};
|
|
1393
|
-
var useVariableCompletion = (variables = []) => useStableCallback(completeVariables(variables));
|
|
1394
|
-
var emptyObject = {};
|
|
1395
|
-
var CodeEditor = ({
|
|
1396
|
-
value,
|
|
1397
|
-
previousValue,
|
|
1398
|
-
onChange,
|
|
1399
|
-
mode = "application/json",
|
|
1400
|
-
placeholder: placeholder$1 = "",
|
|
1401
|
-
ariaLabel,
|
|
1402
|
-
searchQuery,
|
|
1403
|
-
searchMatchIndex,
|
|
1404
|
-
readOnly = false,
|
|
1405
|
-
inputLocked = false,
|
|
1406
|
-
autocompletions,
|
|
1407
|
-
completionSource,
|
|
1408
|
-
variables,
|
|
1409
|
-
extraKeys = emptyObject,
|
|
1410
|
-
withToggleCommentHint = false,
|
|
1411
|
-
withAutofocus = false,
|
|
1412
|
-
withLineNumbers = true,
|
|
1413
|
-
withLineWrapping = true,
|
|
1414
|
-
withCollapseUnchanged = false,
|
|
1415
|
-
withCopyButton = false,
|
|
1416
|
-
completeAny = false,
|
|
1417
|
-
help = null,
|
|
1418
|
-
helpPostfix = null,
|
|
1419
|
-
renderAdditionalButtons,
|
|
1420
|
-
className
|
|
1421
|
-
}) => {
|
|
1422
|
-
const handleChange = useStableCallback((next) => onChange?.(next));
|
|
1423
|
-
const withSearch = searchQuery !== void 0;
|
|
1424
|
-
const editorRef = useRef(null);
|
|
1425
|
-
useEffect(() => {
|
|
1426
|
-
const view = editorRef.current?.view;
|
|
1427
|
-
if (view && withSearch) updateSearch(view, searchQuery, searchMatchIndex);
|
|
1428
|
-
}, [withSearch, searchQuery, searchMatchIndex]);
|
|
1429
|
-
const handleCreateEditor = useStableCallback((view) => {
|
|
1430
|
-
if (searchQuery) updateSearch(view, searchQuery, searchMatchIndex);
|
|
1431
|
-
});
|
|
1432
|
-
const extraKeysRef = useRef(extraKeys);
|
|
1433
|
-
useLayoutEffect(() => {
|
|
1434
|
-
extraKeysRef.current = extraKeys;
|
|
1435
|
-
});
|
|
1436
|
-
const boundKeysSignature = Object.keys(extraKeys).join("\n");
|
|
1437
|
-
const boundKeys = useMemo(
|
|
1438
|
-
() => boundKeysSignature.split("\n").filter(Boolean),
|
|
1439
|
-
[boundKeysSignature]
|
|
1440
|
-
);
|
|
1441
|
-
const tooltipLayer = useTooltipsExtension();
|
|
1442
|
-
const variableCompletion = useVariableCompletion(variables);
|
|
1443
|
-
const customTheme = useThemedExtension("editor:syntax", buildCustomTheme);
|
|
1444
|
-
const baseTheme = useThemedExtension(
|
|
1445
|
-
"code-editor:chrome",
|
|
1446
|
-
() => EditorView.theme(buildBaseThemeStyles())
|
|
1447
|
-
);
|
|
1448
|
-
const commonExtensions = useMemo(() => {
|
|
1449
|
-
const callerCompletions = completionSource ?? (completeAny ? completeAnyWord : autocompletions?.length ? autocompletions : null);
|
|
1450
|
-
const completionEntries = [
|
|
1451
|
-
...callerCompletions ? [{ autocomplete: callerCompletions }] : [],
|
|
1452
|
-
{ autocomplete: variableCompletion }
|
|
1453
|
-
];
|
|
1454
|
-
return [
|
|
1455
|
-
getLanguageMode(mode),
|
|
1456
|
-
shouldLintJson(mode, readOnly) ? linter(jsonParseLinter()) : [],
|
|
1457
|
-
withLineWrapping ? EditorView.lineWrapping : [],
|
|
1458
|
-
EditorState.languageData.of(() => completionEntries),
|
|
1459
|
-
keymap$1.of(
|
|
1460
|
-
boundKeys.map((key) => ({
|
|
1461
|
-
key,
|
|
1462
|
-
run: () => {
|
|
1463
|
-
extraKeysRef.current[key]?.();
|
|
1464
|
-
return true;
|
|
1465
|
-
}
|
|
1466
|
-
}))
|
|
1467
|
-
),
|
|
1468
|
-
readOnly ? [] : [
|
|
1469
|
-
// CodeMirror's own default. Gating it on the props hid completions the
|
|
1470
|
-
// *language* supplies — dbt's vocabulary, Snowflake's keywords — behind
|
|
1471
|
-
// a shortcut, and macOS leaves no usable one. With nothing to offer, no
|
|
1472
|
-
// popup opens anyway.
|
|
1473
|
-
autocompletion()
|
|
1474
|
-
],
|
|
1475
|
-
ariaLabel ? EditorView.contentAttributes.of({ "aria-label": ariaLabel }) : [],
|
|
1476
|
-
withSearch ? searchExtension() : [],
|
|
1477
|
-
tooltipLayer,
|
|
1478
|
-
baseTheme
|
|
1479
|
-
];
|
|
1480
|
-
}, [
|
|
1481
|
-
autocompletions,
|
|
1482
|
-
completionSource,
|
|
1483
|
-
variableCompletion,
|
|
1484
|
-
completeAny,
|
|
1485
|
-
boundKeys,
|
|
1486
|
-
mode,
|
|
1487
|
-
readOnly,
|
|
1488
|
-
withLineWrapping,
|
|
1489
|
-
baseTheme,
|
|
1490
|
-
ariaLabel,
|
|
1491
|
-
withSearch,
|
|
1492
|
-
tooltipLayer
|
|
1493
|
-
]);
|
|
1494
|
-
const extensions = useMemo(() => {
|
|
1495
|
-
return [
|
|
1496
|
-
...commonExtensions,
|
|
1497
|
-
placeholder(placeholder$1),
|
|
1498
|
-
EditorView.editable.of(!readOnly),
|
|
1499
|
-
// The lock is this facet and nothing else. `contenteditable` is what the
|
|
1500
|
-
// read-only wash keys off, and `basicSetup` is what holds the undo history,
|
|
1501
|
-
// so leaving both alone is what makes the lock invisible.
|
|
1502
|
-
EditorState.readOnly.of(readOnly || inputLocked),
|
|
1503
|
-
previousValue ? unifiedMergeView({
|
|
1504
|
-
original: previousValue,
|
|
1505
|
-
mergeControls: false,
|
|
1506
|
-
highlightChanges: false,
|
|
1507
|
-
collapseUnchanged: withCollapseUnchanged ? {} : void 0
|
|
1508
|
-
}) : []
|
|
1509
|
-
];
|
|
1510
|
-
}, [commonExtensions, placeholder$1, readOnly, inputLocked, previousValue, withCollapseUnchanged]);
|
|
1511
|
-
const config = useMemo(() => {
|
|
1512
|
-
return {
|
|
1513
|
-
...buildBasicSetup(readOnly),
|
|
1514
|
-
lineNumbers: withLineNumbers,
|
|
1515
|
-
// Mod-f opens CodeMirror's own panel, which would run a second query and a
|
|
1516
|
-
// second match count over the same document beside the caller's input.
|
|
1517
|
-
...withSearch ? { searchKeymap: false } : null
|
|
1518
|
-
};
|
|
1519
|
-
}, [withLineNumbers, readOnly, withSearch]);
|
|
1520
|
-
const additionalButtons = renderAdditionalButtons?.(value);
|
|
1521
|
-
const hasToolbar = withCopyButton && !!value || !!additionalButtons;
|
|
1522
|
-
return (
|
|
1523
|
-
// oxlint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
1524
|
-
/* @__PURE__ */ jsxs(
|
|
1525
|
-
"div",
|
|
1526
|
-
{
|
|
1527
|
-
className: cn(
|
|
1528
|
-
"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:[&_>div]:h-full tw:[&_>div]:overflow-auto tw:[&_>div]:bg-background",
|
|
1529
|
-
{ "tw:mt-8": hasToolbar },
|
|
1530
|
-
className
|
|
1531
|
-
),
|
|
1532
|
-
onKeyDown: (event) => {
|
|
1533
|
-
if (event.key === keyCodes.ESCAPE) {
|
|
1534
|
-
event.stopPropagation();
|
|
1535
|
-
}
|
|
1536
|
-
},
|
|
1537
|
-
children: [
|
|
1538
|
-
hasToolbar && /* @__PURE__ */ jsx("div", { className: "tw:pointer-events-none tw:absolute tw:z-10 tw:flex tw:!h-auto tw:w-full tw:translate-y-[calc(-100%_+_8px)] tw:!overflow-visible tw:!bg-transparent", children: /* @__PURE__ */ jsx("div", { className: "tw:flex-1", children: /* @__PURE__ */ jsx(ButtonToolbar, { value: withCopyButton ? value : void 0, children: additionalButtons }) }) }),
|
|
1539
|
-
/* @__PURE__ */ jsx(
|
|
1540
|
-
CodeMirror,
|
|
1541
|
-
{
|
|
1542
|
-
ref: editorRef,
|
|
1543
|
-
onCreateEditor: handleCreateEditor,
|
|
1544
|
-
theme: customTheme,
|
|
1545
|
-
value,
|
|
1546
|
-
onChange: handleChange,
|
|
1547
|
-
extensions,
|
|
1548
|
-
autoFocus: withAutofocus,
|
|
1549
|
-
basicSetup: config
|
|
1550
|
-
}
|
|
1551
|
-
),
|
|
1552
|
-
!readOnly && (withToggleCommentHint || help || helpPostfix) && /* @__PURE__ */ jsxs(HelpBlock, { className: "tw:mt-2 tw:flex tw:flex-wrap tw:gap-1", children: [
|
|
1553
|
-
help,
|
|
1554
|
-
withToggleCommentHint ? /* @__PURE__ */ jsx(ToggleComponentHelp, {}) : null,
|
|
1555
|
-
helpPostfix
|
|
1556
|
-
] })
|
|
1557
|
-
]
|
|
1558
|
-
}
|
|
1559
|
-
)
|
|
1560
|
-
);
|
|
1561
|
-
};
|
|
1562
|
-
var activeQueryFirstLine = Decoration.line({ class: "cm-active-query cm-active-query-first" });
|
|
1563
|
-
var activeQueryMiddleLine = Decoration.line({ class: "cm-active-query" });
|
|
1564
|
-
var activeQueryLastLine = Decoration.line({ class: "cm-active-query cm-active-query-last" });
|
|
1565
|
-
var activeQuerySingleLine = Decoration.line({
|
|
1566
|
-
class: "cm-active-query cm-active-query-first cm-active-query-last"
|
|
1567
|
-
});
|
|
1568
|
-
var findActiveQueryRange = (doc, cursorPos, boundaries) => {
|
|
1569
|
-
if (boundaries.length === 0) return null;
|
|
1570
|
-
let match = boundaries[boundaries.length - 1];
|
|
1571
|
-
for (const boundary of boundaries) {
|
|
1572
|
-
if (cursorPos <= boundary.to) {
|
|
1573
|
-
match = boundary;
|
|
1574
|
-
break;
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
if (!match) return null;
|
|
1578
|
-
const queryText = doc.slice(match.from, match.to);
|
|
1579
|
-
const leadingWhitespace = queryText.length - queryText.trimStart().length;
|
|
1580
|
-
const trailingWhitespace = queryText.length - queryText.trimEnd().length;
|
|
1581
|
-
const trimmedStart = match.from + leadingWhitespace;
|
|
1582
|
-
const trimmedEnd = match.to - trailingWhitespace;
|
|
1583
|
-
if (trimmedStart >= trimmedEnd) return null;
|
|
1584
|
-
return { from: trimmedStart, to: trimmedEnd };
|
|
1585
|
-
};
|
|
1586
|
-
var computeBoundaries = (queries) => {
|
|
1587
|
-
const boundaries = [];
|
|
1588
|
-
let offset = 0;
|
|
1589
|
-
for (const query of queries) {
|
|
1590
|
-
boundaries.push({ from: offset, to: offset + query.length });
|
|
1591
|
-
offset += query.length;
|
|
1592
|
-
}
|
|
1593
|
-
return boundaries;
|
|
1594
|
-
};
|
|
1595
|
-
var mapBoundariesThroughChanges = (boundaries, changes) => {
|
|
1596
|
-
const prevLen = changes.length;
|
|
1597
|
-
const mapped = [];
|
|
1598
|
-
for (const b of boundaries) {
|
|
1599
|
-
const from = changes.mapPos(Math.max(0, Math.min(b.from, prevLen)), -1);
|
|
1600
|
-
const to = changes.mapPos(Math.max(0, Math.min(b.to, prevLen)), 1);
|
|
1601
|
-
if (from < to) mapped.push({ from, to });
|
|
1602
|
-
}
|
|
1603
|
-
return mapped;
|
|
1604
|
-
};
|
|
1605
|
-
var buildDecorations = (view, range) => {
|
|
1606
|
-
const startLine = view.state.doc.lineAt(range.from).number;
|
|
1607
|
-
const endLine = view.state.doc.lineAt(range.to).number;
|
|
1608
|
-
const decorations = [];
|
|
1609
|
-
for (let lineNum = startLine; lineNum <= endLine; lineNum++) {
|
|
1610
|
-
const lineStart = view.state.doc.line(lineNum).from;
|
|
1611
|
-
if (startLine === endLine) {
|
|
1612
|
-
decorations.push(activeQuerySingleLine.range(lineStart));
|
|
1613
|
-
} else if (lineNum === startLine) {
|
|
1614
|
-
decorations.push(activeQueryFirstLine.range(lineStart));
|
|
1615
|
-
} else if (lineNum === endLine) {
|
|
1616
|
-
decorations.push(activeQueryLastLine.range(lineStart));
|
|
1617
|
-
} else {
|
|
1618
|
-
decorations.push(activeQueryMiddleLine.range(lineStart));
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
return Decoration.set(decorations);
|
|
1622
|
-
};
|
|
1623
|
-
var activeQueryHighlight = (splitQueries) => {
|
|
1624
|
-
return [
|
|
1625
|
-
ViewPlugin.fromClass(
|
|
1626
|
-
class {
|
|
1627
|
-
decorations = Decoration.none;
|
|
1628
|
-
debounceTimer = null;
|
|
1629
|
-
seq = 0;
|
|
1630
|
-
cachedDoc = "";
|
|
1631
|
-
cachedBoundaries = [];
|
|
1632
|
-
destroyed = false;
|
|
1633
|
-
constructor(view) {
|
|
1634
|
-
this.scheduleDocParse(view);
|
|
1635
|
-
}
|
|
1636
|
-
update(update) {
|
|
1637
|
-
if (update.focusChanged && !update.view.hasFocus) {
|
|
1638
|
-
this.decorations = Decoration.none;
|
|
1639
|
-
return;
|
|
1640
|
-
}
|
|
1641
|
-
if (update.docChanged) {
|
|
1642
|
-
if (this.cachedBoundaries.length > 0) {
|
|
1643
|
-
this.cachedBoundaries = mapBoundariesThroughChanges(
|
|
1644
|
-
this.cachedBoundaries,
|
|
1645
|
-
update.changes
|
|
1646
|
-
);
|
|
1647
|
-
this.cachedDoc = update.state.doc.toString();
|
|
1648
|
-
this.updateFromCache(update.view);
|
|
1649
|
-
}
|
|
1650
|
-
this.scheduleDocParse(update.view);
|
|
1651
|
-
} else if (update.selectionSet || update.focusChanged && update.view.hasFocus) {
|
|
1652
|
-
this.updateFromCache(update.view);
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
destroy() {
|
|
1656
|
-
this.destroyed = true;
|
|
1657
|
-
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
1658
|
-
}
|
|
1659
|
-
/**
|
|
1660
|
-
* Update decorations using cached query boundaries.
|
|
1661
|
-
* Only mutates this.decorations — does NOT call view.dispatch().
|
|
1662
|
-
* When called from update() (sync), CodeMirror picks up the new
|
|
1663
|
-
* decorations via the accessor. When called from the async
|
|
1664
|
-
* scheduleDocParse callback, the caller must dispatch separately.
|
|
1665
|
-
*/
|
|
1666
|
-
updateFromCache(view) {
|
|
1667
|
-
if (!view.hasFocus) {
|
|
1668
|
-
this.decorations = Decoration.none;
|
|
1669
|
-
return;
|
|
1670
|
-
}
|
|
1671
|
-
const { main } = view.state.selection;
|
|
1672
|
-
if (main.from !== main.to) {
|
|
1673
|
-
this.decorations = Decoration.none;
|
|
1674
|
-
return;
|
|
1675
|
-
}
|
|
1676
|
-
const doc = view.state.doc.toString();
|
|
1677
|
-
if (doc !== this.cachedDoc) return;
|
|
1678
|
-
if (this.cachedBoundaries.length === 0) {
|
|
1679
|
-
this.decorations = Decoration.none;
|
|
1680
|
-
return;
|
|
1681
|
-
}
|
|
1682
|
-
const range = findActiveQueryRange(doc, main.head, this.cachedBoundaries);
|
|
1683
|
-
this.decorations = range ? buildDecorations(view, range) : Decoration.none;
|
|
1684
|
-
}
|
|
1685
|
-
/** Parse queries async (debounced) and update decorations. */
|
|
1686
|
-
scheduleDocParse(view) {
|
|
1687
|
-
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
1688
|
-
this.debounceTimer = setTimeout(async () => {
|
|
1689
|
-
const seq = ++this.seq;
|
|
1690
|
-
const doc = view.state.doc.toString();
|
|
1691
|
-
if (!doc.trim()) {
|
|
1692
|
-
this.cachedDoc = doc;
|
|
1693
|
-
this.cachedBoundaries = [];
|
|
1694
|
-
if (this.decorations !== Decoration.none) {
|
|
1695
|
-
this.decorations = Decoration.none;
|
|
1696
|
-
if (!this.destroyed) view.dispatch();
|
|
1697
|
-
}
|
|
1698
|
-
return;
|
|
1699
|
-
}
|
|
1700
|
-
let queries;
|
|
1701
|
-
try {
|
|
1702
|
-
queries = await splitQueries(doc);
|
|
1703
|
-
} catch {
|
|
1704
|
-
return;
|
|
1705
|
-
}
|
|
1706
|
-
if (this.destroyed || seq !== this.seq) return;
|
|
1707
|
-
this.cachedDoc = doc;
|
|
1708
|
-
this.cachedBoundaries = computeBoundaries(queries);
|
|
1709
|
-
this.updateFromCache(view);
|
|
1710
|
-
if (!this.destroyed) view.dispatch();
|
|
1711
|
-
}, 100);
|
|
1712
|
-
}
|
|
1713
|
-
},
|
|
1714
|
-
{ decorations: (v) => v.decorations }
|
|
1715
|
-
),
|
|
1716
|
-
EditorView.baseTheme({
|
|
1717
|
-
".cm-active-query": {
|
|
1718
|
-
boxShadow: `inset -1px 0 0 0 ${colors.blue[300]}, inset 1px 0 0 0 ${colors.blue[300]}`,
|
|
1719
|
-
marginRight: "8px"
|
|
1720
|
-
},
|
|
1721
|
-
".cm-active-query-first": {
|
|
1722
|
-
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]}`,
|
|
1723
|
-
borderRadius: "4px 4px 0 0"
|
|
1724
|
-
},
|
|
1725
|
-
".cm-active-query-last": {
|
|
1726
|
-
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]}`,
|
|
1727
|
-
borderRadius: "0 0 4px 4px"
|
|
1728
|
-
},
|
|
1729
|
-
".cm-active-query-first.cm-active-query-last": {
|
|
1730
|
-
boxShadow: `inset 0 0 0 1px ${colors.blue[300]}`,
|
|
1731
|
-
borderRadius: "4px"
|
|
1732
|
-
}
|
|
1733
|
-
})
|
|
1734
|
-
];
|
|
1735
|
-
};
|
|
1736
|
-
var HighlightMarker = class extends GutterMarker {
|
|
1737
|
-
toDOM() {
|
|
1738
|
-
const marker = document.createElement("div");
|
|
1739
|
-
marker.className = "cm-highlight-marker";
|
|
1740
|
-
return marker;
|
|
1741
|
-
}
|
|
1742
|
-
};
|
|
1743
|
-
var highlightMarker = new HighlightMarker();
|
|
1744
|
-
var forEachLineInRange = (doc, from, to, callback) => {
|
|
1745
|
-
const results = [];
|
|
1746
|
-
const fromLine = Math.max(1, from + 1);
|
|
1747
|
-
const toLine = Math.min(doc.lines, to + 1);
|
|
1748
|
-
for (let i = fromLine; i <= toLine; i++) {
|
|
1749
|
-
const line = doc.line(i);
|
|
1750
|
-
results.push(callback(line.from));
|
|
1751
|
-
}
|
|
1752
|
-
return results;
|
|
1753
|
-
};
|
|
1754
|
-
var setHighlightedLinesEffect = StateEffect.define();
|
|
1755
|
-
var highlightedLinesField = StateField.define({
|
|
1756
|
-
create() {
|
|
1757
|
-
return null;
|
|
1758
|
-
},
|
|
1759
|
-
update(value, transaction) {
|
|
1760
|
-
for (const effect of transaction.effects) {
|
|
1761
|
-
if (effect.is(setHighlightedLinesEffect)) {
|
|
1762
|
-
return effect.value;
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
return value;
|
|
1766
|
-
}
|
|
1767
|
-
});
|
|
1768
|
-
var highlightGutter = gutter({
|
|
1769
|
-
class: "cm-highlight-gutter",
|
|
1770
|
-
markers: (view) => {
|
|
1771
|
-
const highlightInfo = view.state.field(highlightedLinesField, false);
|
|
1772
|
-
if (!highlightInfo) {
|
|
1773
|
-
return RangeSet.empty;
|
|
1774
|
-
}
|
|
1775
|
-
const markers = forEachLineInRange(
|
|
1776
|
-
view.state.doc,
|
|
1777
|
-
highlightInfo.from,
|
|
1778
|
-
highlightInfo.to,
|
|
1779
|
-
(lineFrom) => highlightMarker.range(lineFrom)
|
|
1780
|
-
);
|
|
1781
|
-
return RangeSet.of(markers);
|
|
1782
|
-
}
|
|
1783
|
-
});
|
|
1784
|
-
var errorLineDecorations = StateField.define({
|
|
1785
|
-
create() {
|
|
1786
|
-
return Decoration.none;
|
|
1787
|
-
},
|
|
1788
|
-
update(decorations, transaction) {
|
|
1789
|
-
decorations = decorations.map(transaction.changes);
|
|
1790
|
-
for (const effect of transaction.effects) {
|
|
1791
|
-
if (!effect.is(setHighlightedLinesEffect)) {
|
|
1792
|
-
continue;
|
|
1793
|
-
}
|
|
1794
|
-
if (!effect.value || !effect.value.error) {
|
|
1795
|
-
return Decoration.none;
|
|
1796
|
-
}
|
|
1797
|
-
const decorationArray = forEachLineInRange(
|
|
1798
|
-
transaction.state.doc,
|
|
1799
|
-
effect.value.error.from,
|
|
1800
|
-
effect.value.error.to,
|
|
1801
|
-
(lineFrom) => Decoration.line({ class: "cm-error-line" }).range(lineFrom)
|
|
1802
|
-
);
|
|
1803
|
-
return Decoration.set(decorationArray);
|
|
1804
|
-
}
|
|
1805
|
-
return decorations;
|
|
1806
|
-
},
|
|
1807
|
-
provide: (f) => EditorView.decorations.from(f)
|
|
1808
|
-
});
|
|
1809
|
-
var processingLineDecorations = StateField.define({
|
|
1810
|
-
create() {
|
|
1811
|
-
return Decoration.none;
|
|
1812
|
-
},
|
|
1813
|
-
update(decorations, transaction) {
|
|
1814
|
-
decorations = decorations.map(transaction.changes);
|
|
1815
|
-
for (const effect of transaction.effects) {
|
|
1816
|
-
if (!effect.is(setHighlightedLinesEffect)) {
|
|
1817
|
-
continue;
|
|
1818
|
-
}
|
|
1819
|
-
if (!effect.value || !effect.value.processing) {
|
|
1820
|
-
return Decoration.none;
|
|
1821
|
-
}
|
|
1822
|
-
const decorationArray = forEachLineInRange(
|
|
1823
|
-
transaction.state.doc,
|
|
1824
|
-
effect.value.processing.from,
|
|
1825
|
-
effect.value.processing.to,
|
|
1826
|
-
(lineFrom) => Decoration.line({ class: "cm-processing-line" }).range(lineFrom)
|
|
1827
|
-
);
|
|
1828
|
-
return Decoration.set(decorationArray);
|
|
1829
|
-
}
|
|
1830
|
-
return decorations;
|
|
1831
|
-
},
|
|
1832
|
-
provide: (f) => EditorView.decorations.from(f)
|
|
1833
|
-
});
|
|
1834
|
-
var highlightedLinesTheme = EditorView.baseTheme({
|
|
1835
|
-
".cm-highlight-gutter": {
|
|
1836
|
-
width: "2px",
|
|
1837
|
-
marginRight: "2px"
|
|
1838
|
-
},
|
|
1839
|
-
".cm-highlight-marker": {
|
|
1840
|
-
width: "2px",
|
|
1841
|
-
height: "100%",
|
|
1842
|
-
backgroundColor: colors.blue[500]
|
|
1843
|
-
},
|
|
1844
|
-
".cm-error-line": {
|
|
1845
|
-
backgroundColor: `${colors.error[100]} !important`
|
|
1846
|
-
},
|
|
1847
|
-
".cm-processing-line": {
|
|
1848
|
-
backgroundColor: `${colors.blue[100]} !important`
|
|
1849
|
-
}
|
|
1850
|
-
});
|
|
1851
|
-
function highlightingExtension() {
|
|
1852
|
-
return [
|
|
1853
|
-
highlightedLinesField,
|
|
1854
|
-
highlightGutter,
|
|
1855
|
-
errorLineDecorations,
|
|
1856
|
-
processingLineDecorations,
|
|
1857
|
-
highlightedLinesTheme
|
|
1858
|
-
];
|
|
1859
|
-
}
|
|
1860
|
-
function updateHighlighting(view, lines) {
|
|
1861
|
-
view.dispatch({ effects: setHighlightedLinesEffect.of(lines ?? null) });
|
|
1862
|
-
}
|
|
1863
|
-
var OWN_KEYMAPS = {
|
|
1864
|
-
defaultKeymap: false,
|
|
1865
|
-
completionKeymap: false,
|
|
1866
|
-
searchKeymap: false
|
|
1867
|
-
};
|
|
1868
|
-
var CUSTOM_KEYMAP = [
|
|
1869
|
-
{
|
|
1870
|
-
key: "Escape",
|
|
1871
|
-
stopPropagation: true,
|
|
1872
|
-
run: (view) => {
|
|
1873
|
-
view.contentDOM.blur();
|
|
1874
|
-
return true;
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
];
|
|
1878
|
-
var OWN_KEYMAP_EXTENSION = keymap.of([...defaultKeymap, ...CUSTOM_KEYMAP]);
|
|
1879
|
-
var buildTheme = () => ({
|
|
1880
|
-
...buildBaseThemeStyles(),
|
|
1881
|
-
"&.cm-editor": {
|
|
1882
|
-
border: "solid 1px transparent",
|
|
1883
|
-
background: resolveToken("card", "255 255 255"),
|
|
1884
|
-
borderRadius: "8px",
|
|
1885
|
-
paddingTop: "8px",
|
|
1886
|
-
paddingBottom: "8px"
|
|
1887
|
-
},
|
|
1888
|
-
'&.cm-editor:has(.cm-content[contenteditable="true"]):hover': {
|
|
1889
|
-
borderColor: resolveToken("ring", "31 143 255")
|
|
1890
|
-
},
|
|
1891
|
-
'&.cm-editor:has(.cm-content[contenteditable="true"]):focus-within': {
|
|
1892
|
-
borderColor: resolveToken("ring", "31 143 255"),
|
|
1893
|
-
boxShadow: `0 0 0 4px ${resolveToken("ring", "31 143 255", 0.3)}`
|
|
1894
|
-
},
|
|
1895
|
-
"&.cm-editor .cm-scroller": { overflowAnchor: "none" },
|
|
1896
|
-
"&.cm-editor :is(.cm-gutters,.cm-scroller)": { background: resolveToken("card", "255 255 255") },
|
|
1897
|
-
'&.cm-editor:has(.cm-content[contenteditable="false"])': {
|
|
1898
|
-
background: resolveToken("muted", "241 245 249")
|
|
1899
|
-
},
|
|
1900
|
-
'&.cm-editor:has(.cm-content[contenteditable="false"]) :is(.cm-scroller,.cm-gutters)': {
|
|
1901
|
-
background: resolveToken("muted", "241 245 249")
|
|
1902
|
-
}
|
|
1903
|
-
});
|
|
1904
|
-
var SqlEditor = ({
|
|
1905
|
-
value,
|
|
1906
|
-
onChange,
|
|
1907
|
-
onSelectionChange,
|
|
1908
|
-
onCreateEditor,
|
|
1909
|
-
onDestroyEditor,
|
|
1910
|
-
onBlurEditor,
|
|
1911
|
-
onFocusEditor,
|
|
1912
|
-
placeholder = "",
|
|
1913
|
-
searchQuery = "",
|
|
1914
|
-
searchMatchIndex,
|
|
1915
|
-
readOnly = false,
|
|
1916
|
-
queryParser,
|
|
1917
|
-
autoFocus = false,
|
|
1918
|
-
lineNumbers = true,
|
|
1919
|
-
className,
|
|
1920
|
-
schema,
|
|
1921
|
-
variables,
|
|
1922
|
-
defaultDatabase,
|
|
1923
|
-
defaultSchema,
|
|
1924
|
-
highlightLines,
|
|
1925
|
-
dialect
|
|
1926
|
-
}) => {
|
|
1927
|
-
const editorRef = useRef(null);
|
|
1928
|
-
const handleChange = useStableCallback((next) => onChange?.(next));
|
|
1929
|
-
const parseQueries = useStableCallback(async (sql2) => await queryParser?.(sql2) ?? []);
|
|
1930
|
-
const handleBlur = useStableCallback((view) => onBlurEditor?.(view));
|
|
1931
|
-
const handleFocus = useStableCallback((view) => onFocusEditor?.(view));
|
|
1932
|
-
const handleUpdate = useStableCallback((update) => {
|
|
1933
|
-
if (update.selectionSet) {
|
|
1934
|
-
const { main } = update.state.selection;
|
|
1935
|
-
onSelectionChange?.(update.state.sliceDoc(main.from, main.to));
|
|
1936
|
-
}
|
|
1937
|
-
});
|
|
1938
|
-
const variableCompletion = useVariableCompletion(variables);
|
|
1939
|
-
const withQueryParser = queryParser !== void 0;
|
|
1940
|
-
const tooltipLayer = useTooltipsExtension();
|
|
1941
|
-
const customTheme = useThemedExtension("editor:syntax", buildCustomTheme);
|
|
1942
|
-
const themeExtension = useThemedExtension(
|
|
1943
|
-
"sql-editor:chrome",
|
|
1944
|
-
() => EditorView$1.theme(buildTheme())
|
|
1945
|
-
);
|
|
1946
|
-
const extensions = useMemo(() => {
|
|
1947
|
-
return [
|
|
1948
|
-
EditorView$1.lineWrapping,
|
|
1949
|
-
OWN_KEYMAP_EXTENSION,
|
|
1950
|
-
...installExtensions({
|
|
1951
|
-
schema,
|
|
1952
|
-
defaultDatabase,
|
|
1953
|
-
defaultSchema,
|
|
1954
|
-
variableCompletion,
|
|
1955
|
-
dialect
|
|
1956
|
-
}),
|
|
1957
|
-
searchExtension(),
|
|
1958
|
-
highlightingExtension(),
|
|
1959
|
-
withQueryParser ? activeQueryHighlight(parseQueries) : [],
|
|
1960
|
-
tooltipLayer,
|
|
1961
|
-
themeExtension,
|
|
1962
|
-
EditorView$1.domEventHandlers({
|
|
1963
|
-
blur: (_, view) => handleBlur(view),
|
|
1964
|
-
focus: (_, view) => handleFocus(view)
|
|
1965
|
-
})
|
|
1966
|
-
];
|
|
1967
|
-
}, [
|
|
1968
|
-
withQueryParser,
|
|
1969
|
-
parseQueries,
|
|
1970
|
-
schema,
|
|
1971
|
-
defaultDatabase,
|
|
1972
|
-
defaultSchema,
|
|
1973
|
-
variableCompletion,
|
|
1974
|
-
dialect,
|
|
1975
|
-
handleBlur,
|
|
1976
|
-
handleFocus,
|
|
1977
|
-
themeExtension,
|
|
1978
|
-
tooltipLayer
|
|
1979
|
-
]);
|
|
1980
|
-
const defaultSetup = useMemo(() => {
|
|
1981
|
-
return { ...buildBasicSetup(readOnly), ...OWN_KEYMAPS, lineNumbers };
|
|
1982
|
-
}, [readOnly, lineNumbers]);
|
|
1983
|
-
useEffect(() => {
|
|
1984
|
-
if (editorRef.current?.view) {
|
|
1985
|
-
updateHighlighting(editorRef.current.view, highlightLines);
|
|
1986
|
-
}
|
|
1987
|
-
}, [highlightLines]);
|
|
1988
|
-
useEffect(() => {
|
|
1989
|
-
if (editorRef.current?.view) {
|
|
1990
|
-
updateSearch(editorRef.current.view, searchQuery, searchMatchIndex);
|
|
1991
|
-
}
|
|
1992
|
-
}, [searchQuery, searchMatchIndex]);
|
|
1993
|
-
const handleDestroy = useStableCallback(() => onDestroyEditor?.());
|
|
1994
|
-
useEffect(() => handleDestroy, [handleDestroy]);
|
|
1995
|
-
const handleCreate = useStableCallback((view, state) => {
|
|
1996
|
-
onCreateEditor?.(view, state);
|
|
1997
|
-
if (highlightLines) {
|
|
1998
|
-
updateHighlighting(view, highlightLines);
|
|
1999
|
-
}
|
|
2000
|
-
if (searchQuery) {
|
|
2001
|
-
updateSearch(view, searchQuery, searchMatchIndex);
|
|
2002
|
-
}
|
|
2003
|
-
});
|
|
2004
|
-
return /* @__PURE__ */ jsx(
|
|
2005
|
-
CodeMirror,
|
|
2006
|
-
{
|
|
2007
|
-
ref: editorRef,
|
|
2008
|
-
theme: customTheme,
|
|
2009
|
-
extensions,
|
|
2010
|
-
value,
|
|
2011
|
-
onChange: handleChange,
|
|
2012
|
-
onUpdate: handleUpdate,
|
|
2013
|
-
onCreateEditor: handleCreate,
|
|
2014
|
-
autoFocus,
|
|
2015
|
-
placeholder,
|
|
2016
|
-
className,
|
|
2017
|
-
readOnly,
|
|
2018
|
-
editable: !readOnly,
|
|
2019
|
-
basicSetup: defaultSetup
|
|
2020
|
-
}
|
|
2021
|
-
);
|
|
2022
|
-
};
|
|
2023
|
-
|
|
2024
|
-
// src/components/MergeEditor/constants.ts
|
|
2025
|
-
var CHANGE_CLASS = {
|
|
2026
|
-
SAFE: "safe"};
|
|
2027
|
-
var LINE_HEIGHT_PX = 20;
|
|
2028
|
-
var PANE_HEADER_HEIGHT_PX = 58;
|
|
2029
26
|
var AcceptButton = ({ side, onAccept }) => {
|
|
2030
27
|
const label = `Accept ${side === "left" ? "production" : "branch"} version`;
|
|
2031
28
|
const Chevron = side === "left" ? ChevronsRight : ChevronsLeft;
|
|
@@ -2080,62 +77,70 @@ var ConflictGutterMarker = class extends GutterMarker {
|
|
|
2080
77
|
};
|
|
2081
78
|
var safeGutterMarker = new SafeGutterMarker();
|
|
2082
79
|
var conflictGutterMarker = new ConflictGutterMarker();
|
|
2083
|
-
var createDiffHighlightExtension = () => {
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
payload = effect.value;
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
if (!payload) {
|
|
2094
|
-
return {
|
|
2095
|
-
decorations: value.decorations.map(tr.changes),
|
|
2096
|
-
gutterMarkers: value.gutterMarkers.map(tr.changes)
|
|
2097
|
-
};
|
|
2098
|
-
}
|
|
2099
|
-
const decoBuilder = new RangeSetBuilder();
|
|
2100
|
-
const gutterBuilder = new RangeSetBuilder();
|
|
2101
|
-
const doc = tr.state.doc;
|
|
2102
|
-
const { lines, classification } = payload;
|
|
2103
|
-
const sorted = [...lines].filter((l) => l >= 1 && l <= doc.lines).sort((a, b) => a - b);
|
|
2104
|
-
for (const i of sorted) {
|
|
2105
|
-
const cls = classification.get(i);
|
|
2106
|
-
if (!cls) continue;
|
|
2107
|
-
const isSafe = cls === CHANGE_CLASS.SAFE;
|
|
2108
|
-
const line = doc.line(i);
|
|
2109
|
-
decoBuilder.add(line.from, line.from, isSafe ? safeDecoration : conflictDecoration);
|
|
2110
|
-
gutterBuilder.add(line.from, line.from, isSafe ? safeGutterMarker : conflictGutterMarker);
|
|
80
|
+
var createDiffHighlightExtension = () => StateField.define({
|
|
81
|
+
create: () => ({ decorations: Decoration.none, gutterMarkers: RangeSet.empty }),
|
|
82
|
+
update(value, tr) {
|
|
83
|
+
let payload = null;
|
|
84
|
+
for (const effect of tr.effects) {
|
|
85
|
+
if (effect.is(setHighlightedLines)) {
|
|
86
|
+
payload = effect.value;
|
|
2111
87
|
}
|
|
88
|
+
}
|
|
89
|
+
if (!payload) {
|
|
2112
90
|
return {
|
|
2113
|
-
decorations:
|
|
2114
|
-
gutterMarkers:
|
|
91
|
+
decorations: value.decorations.map(tr.changes),
|
|
92
|
+
gutterMarkers: value.gutterMarkers.map(tr.changes)
|
|
2115
93
|
};
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
94
|
+
}
|
|
95
|
+
const decoBuilder = new RangeSetBuilder();
|
|
96
|
+
const gutterBuilder = new RangeSetBuilder();
|
|
97
|
+
const doc = tr.state.doc;
|
|
98
|
+
const { lines, classification } = payload;
|
|
99
|
+
const sorted = [...lines].filter((l) => l >= 1 && l <= doc.lines).sort((a, b) => a - b);
|
|
100
|
+
for (const i of sorted) {
|
|
101
|
+
const cls = classification.get(i);
|
|
102
|
+
if (!cls) continue;
|
|
103
|
+
const isSafe = cls === CHANGE_CLASS.SAFE;
|
|
104
|
+
const line = doc.line(i);
|
|
105
|
+
decoBuilder.add(line.from, line.from, isSafe ? safeDecoration : conflictDecoration);
|
|
106
|
+
gutterBuilder.add(line.from, line.from, isSafe ? safeGutterMarker : conflictGutterMarker);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
decorations: decoBuilder.finish(),
|
|
110
|
+
gutterMarkers: gutterBuilder.finish()
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
provide: (f) => [
|
|
114
|
+
EditorView.decorations.from(f, (val) => val.decorations),
|
|
115
|
+
gutterLineClass.from(f, (val) => val.gutterMarkers)
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
var DARK_LINE_ALPHA = "29";
|
|
119
|
+
var DARK_GUTTER_ALPHA = "47";
|
|
120
|
+
var buildDiffHighlightTheme = (scheme) => {
|
|
121
|
+
const dark = scheme === "dark";
|
|
122
|
+
const line = (hue, pastel) => dark ? `${hue}${DARK_LINE_ALPHA}` : pastel;
|
|
123
|
+
const gutter = (hue, pastel) => dark ? `${hue}${DARK_GUTTER_ALPHA}` : pastel;
|
|
124
|
+
const safeNumber = dark ? colors.green[300] : colors.green[900];
|
|
125
|
+
const conflictNumber = dark ? colors.warning[300] : colors.warning[800];
|
|
126
|
+
return EditorView.theme({
|
|
2123
127
|
".cm-merge-safe-line": {
|
|
2124
|
-
backgroundColor: `${colors.green[100]} !important`,
|
|
128
|
+
backgroundColor: `${line(colors.green[500], colors.green[100])} !important`,
|
|
2125
129
|
boxShadow: `inset 3px 0 0 ${colors.green[500]}`
|
|
2126
130
|
},
|
|
2127
131
|
".cm-merge-conflict-line": {
|
|
2128
|
-
backgroundColor: `${colors.warning[100]} !important`,
|
|
132
|
+
backgroundColor: `${line(colors.warning[500], colors.warning[100])} !important`,
|
|
2129
133
|
boxShadow: `inset 3px 0 0 ${colors.warning[500]}`
|
|
2130
134
|
},
|
|
2131
135
|
".cm-merge-safe-gutter": {
|
|
2132
|
-
backgroundColor: `${colors.green[200]} !important
|
|
136
|
+
backgroundColor: `${gutter(colors.green[500], colors.green[200])} !important`,
|
|
137
|
+
color: safeNumber
|
|
2133
138
|
},
|
|
2134
139
|
".cm-merge-conflict-gutter": {
|
|
2135
|
-
backgroundColor: `${colors.warning[200]} !important
|
|
140
|
+
backgroundColor: `${gutter(colors.warning[500], colors.warning[200])} !important`,
|
|
141
|
+
color: conflictNumber
|
|
2136
142
|
}
|
|
2137
143
|
});
|
|
2138
|
-
return [field, theme];
|
|
2139
144
|
};
|
|
2140
145
|
var updateHighlightedLines = (view, lines, classification) => {
|
|
2141
146
|
view.dispatch({ effects: setHighlightedLines.of({ lines, classification }) });
|
|
@@ -2156,27 +161,30 @@ var MergePane = ({
|
|
|
2156
161
|
}) => {
|
|
2157
162
|
const editorRef = useRef(null);
|
|
2158
163
|
const handleChange = useStableCallback((next) => onChange?.(next));
|
|
2159
|
-
const themeExtension = useThemedExtension(
|
|
2160
|
-
|
|
2161
|
-
|
|
164
|
+
const themeExtension = useThemedExtension(`merge-pane:${deleted}`, (scheme) => {
|
|
165
|
+
const dark = scheme === "dark";
|
|
166
|
+
const deletedSurface = dark ? `${colors.error[500]}1f` : colors.error[100];
|
|
167
|
+
const deletedGutter = dark ? `${colors.error[500]}3d` : colors.error[200];
|
|
168
|
+
const deletedGutterText = dark ? colors.error[300] : colors.error[700];
|
|
169
|
+
return EditorView.theme({
|
|
2162
170
|
"&.cm-editor": {
|
|
2163
171
|
height: "100%",
|
|
2164
|
-
backgroundColor: deleted ?
|
|
172
|
+
backgroundColor: deleted ? deletedSurface : resolveToken("background", "249 250 251"),
|
|
2165
173
|
// Pair the token-driven surface with a token-driven text color so line
|
|
2166
174
|
// content stays readable when the pane's `--background` goes dark.
|
|
2167
|
-
|
|
2168
|
-
...deleted ? {} : { color: resolveToken("foreground", "30 41 59") },
|
|
175
|
+
color: resolveToken("foreground", "30 41 59"),
|
|
2169
176
|
outline: "none"
|
|
2170
177
|
},
|
|
2171
178
|
".cm-gutters": {
|
|
2172
|
-
backgroundColor: deleted ?
|
|
2173
|
-
|
|
179
|
+
backgroundColor: deleted ? deletedGutter : resolveToken("muted", "241 245 249"),
|
|
180
|
+
color: deleted ? deletedGutterText : resolveToken("muted-foreground", "100 116 139")
|
|
2174
181
|
},
|
|
2175
182
|
"*": { lineHeight: `${LINE_HEIGHT_PX}px` },
|
|
2176
183
|
".cm-lineNumbers .cm-gutterElement": { padding: "0 0 0 25px" }
|
|
2177
|
-
})
|
|
2178
|
-
);
|
|
184
|
+
});
|
|
185
|
+
});
|
|
2179
186
|
const diffHighlightExtension = useMemo(() => createDiffHighlightExtension(), []);
|
|
187
|
+
const diffHighlightTheme = useThemedExtension("merge-diff-highlight", buildDiffHighlightTheme);
|
|
2180
188
|
const basicSetup = useMemo(
|
|
2181
189
|
() => ({ ...buildBasicSetup(readOnly), lineNumbers: true }),
|
|
2182
190
|
[readOnly]
|
|
@@ -2184,6 +192,7 @@ var MergePane = ({
|
|
|
2184
192
|
const extensions = useMemo(
|
|
2185
193
|
() => [
|
|
2186
194
|
diffHighlightExtension,
|
|
195
|
+
diffHighlightTheme,
|
|
2187
196
|
themeExtension,
|
|
2188
197
|
// Recalc viewport after every doc change so late-settling layouts (alerts
|
|
2189
198
|
// appearing above the editor) don't leave trailing lines blank.
|
|
@@ -2193,7 +202,7 @@ var MergePane = ({
|
|
|
2193
202
|
}
|
|
2194
203
|
})
|
|
2195
204
|
],
|
|
2196
|
-
[diffHighlightExtension, themeExtension]
|
|
205
|
+
[diffHighlightExtension, diffHighlightTheme, themeExtension]
|
|
2197
206
|
);
|
|
2198
207
|
useEffect(() => {
|
|
2199
208
|
const view = editorRef.current?.view;
|
|
@@ -2232,7 +241,7 @@ var MergePane = ({
|
|
|
2232
241
|
className: cn(
|
|
2233
242
|
"tw:flex tw:min-w-0 tw:flex-1 tw:flex-col tw:overflow-hidden",
|
|
2234
243
|
className,
|
|
2235
|
-
deleted && "tw:border-error-300"
|
|
244
|
+
deleted && "tw:border-error-300 tw:[[data-theme=dark]_&]:border-error-500/50"
|
|
2236
245
|
),
|
|
2237
246
|
children: [
|
|
2238
247
|
header && /* @__PURE__ */ jsx(
|
|
@@ -2240,7 +249,10 @@ var MergePane = ({
|
|
|
2240
249
|
{
|
|
2241
250
|
className: cn(
|
|
2242
251
|
"tw:px-4 tw:py-3",
|
|
2243
|
-
|
|
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",
|
|
2244
256
|
headerClassName
|
|
2245
257
|
),
|
|
2246
258
|
children: header
|
|
@@ -2424,6 +436,6 @@ var MergeEditor = ({
|
|
|
2424
436
|
);
|
|
2425
437
|
};
|
|
2426
438
|
|
|
2427
|
-
export {
|
|
439
|
+
export { MergeEditor };
|
|
2428
440
|
//# sourceMappingURL=editors.js.map
|
|
2429
441
|
//# sourceMappingURL=editors.js.map
|