@dataloop-ai/components 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -3
- package/src/App.vue +5 -227
- package/src/assets/constants.scss +2 -1
- package/src/assets/globals.scss +21 -0
- package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
- package/src/components/basic/DlAccordion/components/AccordionHeader.vue +2 -1
- package/src/components/basic/DlAvatar/DlAvatar.vue +1 -1
- package/src/components/basic/DlButton/DlButton.vue +115 -25
- package/src/components/basic/DlButton/utils.ts +45 -2
- package/src/components/basic/DlChip/DlChip.vue +3 -7
- package/src/components/basic/DlChip/utils.ts +4 -4
- package/src/components/basic/DlContainer/DlContainer.vue +70 -0
- package/src/components/basic/DlContainer/index.ts +3 -0
- package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
- package/src/components/basic/DlEmptyState/index.ts +2 -0
- package/src/components/basic/DlEmptyState/types.ts +20 -0
- package/src/components/basic/DlGrid/DlGrid.vue +163 -0
- package/src/components/basic/DlGrid/index.ts +4 -0
- package/src/components/basic/DlGrid/types.ts +5 -0
- package/src/components/basic/DlKpi/components/KpiInfo.vue +2 -1
- package/src/components/basic/DlListItem/DlListItem.vue +96 -66
- package/src/components/basic/DlListItem/utils.ts +0 -3
- package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +37 -13
- package/src/components/basic/DlPopup/DlPopup.vue +58 -11
- package/src/components/basic/DlPopup/components/PopupHeader.vue +11 -6
- package/src/components/basic/DlProgressChart/DlProgressChart.vue +2 -1
- package/src/components/basic/DlWidget/DlWidget.vue +273 -141
- package/src/components/basic/DlWidget/index.ts +1 -3
- package/src/components/basic/DlWidget/utils.ts +90 -8
- package/src/components/basic/index.ts +4 -2
- package/src/components/basic/types.ts +2 -0
- package/src/components/compound/DlCard/DlCard.vue +796 -0
- package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
- package/src/components/compound/DlCard/types.ts +38 -0
- package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +39 -4
- package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +128 -36
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +167 -87
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +2 -1
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +44 -3
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChartWidget.vue +1 -2
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +9 -18
- package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +48 -9
- package/src/components/compound/DlCharts/charts/DlScatterChart/DlScatterChart.vue +667 -0
- package/src/components/compound/DlCharts/charts/DlScatterChart/index.ts +2 -0
- package/src/components/compound/DlCharts/charts/index.ts +1 -0
- package/src/components/compound/DlCharts/components/DlBrush.vue +3 -2
- package/src/components/compound/DlCharts/components/DlChartLabels.vue +2 -1
- package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +1 -0
- package/src/components/compound/DlCharts/types/props.ts +5 -1
- package/src/components/compound/DlCharts/utils.ts +1 -1
- package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +173 -0
- package/src/components/compound/DlCodeEditor/README.md +11 -0
- package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
- package/src/components/compound/DlCodeEditor/index.ts +3 -0
- package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
- package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
- package/src/components/compound/DlCodeEditor/types.ts +21 -0
- package/src/components/compound/DlDateTime/DlDatePicker/DlDatePicker.vue +9 -1
- package/src/components/compound/DlDateTime/DlDatePicker/components/DlCalendar.vue +4 -2
- package/src/components/compound/DlDateTime/DlDatePicker/components/DlMonthCalendar.vue +2 -1
- package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
- package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +18 -9
- package/src/components/compound/DlDateTime/DlTimePicker/DlTimePicker.vue +2 -2
- package/src/components/compound/DlDialogBox/DlDialogBox.vue +74 -15
- package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -1
- package/src/components/compound/DlDialogBox/components/DlDialogBoxHeader.vue +9 -7
- package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +13 -4
- package/src/components/compound/DlInput/DlInput.vue +80 -17
- package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +42 -219
- package/src/components/compound/DlOptionGroup/DlOptionGroup.vue +16 -17
- package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
- package/src/components/compound/DlPagination/DlPagination.vue +1 -1
- package/src/components/compound/DlPagination/components/PaginationLegend.vue +0 -2
- package/src/components/compound/DlPagination/components/RowsSelector.vue +0 -2
- package/src/components/compound/DlRange/DlRange.vue +3 -2
- package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +12 -5
- package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +413 -97
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchFilters.vue +4 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +100 -39
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +12 -7
- package/src/components/compound/DlSearches/DlSmartSearch/components/FiltersQuery.vue +5 -6
- package/src/components/compound/DlSearches/DlSmartSearch/types.ts +14 -0
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
- package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +172 -48
- package/src/components/compound/DlSelect/DlSelect.vue +264 -130
- package/src/components/compound/DlSelect/utils.ts +4 -1
- package/src/components/compound/DlSlider/DlSlider.vue +10 -2
- package/src/components/compound/DlSlider/components/DlSliderBase.vue +3 -3
- package/src/components/compound/DlSlider/components/DlSliderInput.vue +17 -26
- package/src/components/compound/DlSlider/sliderStyles.scss +5 -1
- package/src/components/compound/DlSlider/useSlider.ts +2 -2
- package/src/components/compound/DlSlider/utils.ts +2 -2
- package/src/components/compound/DlStepper/DlStepper.vue +46 -4
- package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
- package/src/components/compound/DlStepper/components/DlStepperFooter.vue +12 -0
- package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +24 -11
- package/src/components/compound/DlStepper/models/Step.ts +37 -8
- package/src/components/compound/DlStepper/models/Stepper.ts +108 -15
- package/src/components/compound/DlStepper/models/interfaces.ts +2 -1
- package/src/components/compound/DlTable/DlTable.vue +49 -14
- package/src/components/compound/DlTable/components/DlTd.vue +9 -9
- package/src/components/compound/DlTable/components/DlTh.vue +3 -2
- package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
- package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
- package/src/components/compound/DlTable/hooks/tablePagination.ts +18 -18
- package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
- package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
- package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
- package/src/components/compound/DlTable/styles/dl-table-styles.scss +8 -0
- package/src/components/compound/DlTabs/DlTabs.vue +83 -31
- package/src/components/compound/DlTabs/components/DlTab.vue +14 -4
- package/src/components/compound/DlTabs/components/TabsWrapper.vue +32 -27
- package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
- package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
- package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
- package/src/components/compound/DlToast/api/useToast.ts +42 -1
- package/src/components/compound/DlToast/components/ToastComponent.vue +24 -32
- package/src/components/compound/DlToast/types.ts +52 -0
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
- package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
- package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
- package/src/components/compound/DlTreeTable/index.ts +3 -0
- package/src/components/compound/DlTreeTable/types.ts +1 -0
- package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
- package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
- package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
- package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
- package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
- package/src/components/compound/index.ts +14 -1
- package/src/components/compound/types.ts +2 -0
- package/src/components/essential/DlBadge/DlBadge.vue +3 -3
- package/src/components/essential/DlCheckbox/DlCheckbox.vue +10 -7
- package/src/components/essential/DlEllipsis/DlEllipsis.vue +141 -0
- package/src/components/essential/DlIcon/DlIcon.vue +5 -5
- package/src/components/essential/DlLabel/DlLabel.vue +190 -0
- package/src/components/essential/DlLabel/index.ts +2 -0
- package/src/components/essential/DlList/DlList.vue +3 -3
- package/src/components/essential/DlMenu/DlMenu.vue +41 -22
- package/src/components/essential/DlMenu/utils.ts +8 -7
- package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
- package/src/components/essential/DlPageLayout/index.ts +2 -0
- package/src/components/essential/DlProgressBar/DlProgressBar.vue +1 -1
- package/src/components/essential/DlRadio/DlRadio.vue +10 -5
- package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
- package/src/components/essential/DlSpinner/index.ts +1 -13
- package/src/components/essential/DlSpinner/styles/spinnerStyles.scss +7 -0
- package/src/components/essential/DlSwitch/DlSwitch.vue +6 -3
- package/src/components/essential/DlTextArea/DlTextArea.vue +212 -7
- package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
- package/src/components/essential/DlTypography/DlTypography.vue +7 -1
- package/src/components/essential/index.ts +3 -2
- package/src/components/shared/DlInfoErrorMessage/DlInfoErrorMessage.vue +1 -1
- package/src/components/{essential → shared}/DlTooltip/DlTooltip.vue +26 -19
- package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +106 -43
- package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +28 -4
- package/src/components/shared/index.ts +1 -0
- package/src/components/types.ts +2 -0
- package/src/demos/BarChartDemo.vue +59 -2
- package/src/demos/ColumnChartDemo.vue +67 -2
- package/src/demos/DlAccordionDemo.vue +92 -43
- package/src/demos/DlAlertDemo.vue +14 -0
- package/src/demos/DlButtonDemo.vue +41 -4
- package/src/demos/DlCardDemo.vue +156 -19
- package/src/demos/DlChartDoughnutDemo.vue +49 -2
- package/src/demos/DlCheckboxDemo.vue +28 -3
- package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
- package/src/demos/DlCodeEditor/index.ts +2 -0
- package/src/demos/DlConfusionMatrixDemo.vue +93 -37
- package/src/demos/DlDemoPage.vue +235 -0
- package/src/demos/DlDialogBoxDemo.vue +56 -51
- package/src/demos/DlDropdownButtonDemo.vue +35 -27
- package/src/demos/DlEmptyStateDemo.vue +81 -0
- package/src/demos/DlGridDemo.vue +40 -0
- package/src/demos/DlInputDemo.vue +21 -1
- package/src/demos/DlJsonEditorDemo.vue +59 -0
- package/src/demos/DlLabelDemo.vue +208 -0
- package/src/demos/DlLineChartDemo.vue +50 -2
- package/src/demos/DlListDemo.vue +12 -9
- package/src/demos/DlMenuDemo.vue +147 -20
- package/src/demos/DlPageLayoutDemo.vue +146 -0
- package/src/demos/DlPanelContainerDemo.vue +113 -2
- package/src/demos/DlPopupDemo.vue +82 -1
- package/src/demos/DlRadioDemo.vue +16 -1
- package/src/demos/DlScatterChartDemo.vue +161 -0
- package/src/demos/DlSearchDemo.vue +9 -0
- package/src/demos/DlSelectDemo.vue +124 -27
- package/src/demos/DlSpinnerDemo.vue +0 -2
- package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
- package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
- package/src/demos/DlStepperDemo/SimpleStepper.vue +4 -0
- package/src/demos/DlStepperDemo/steps/GeneralStep.vue +1 -0
- package/src/demos/DlSwitchDemo.vue +12 -0
- package/src/demos/DlTableDemo.vue +84 -5
- package/src/demos/DlTabsDemo.vue +92 -3
- package/src/demos/DlTextAreaDemo.vue +14 -17
- package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
- package/src/demos/DlToastDemo.vue +3 -9
- package/src/demos/DlTooltipDemo.vue +66 -2
- package/src/demos/DlTreeTableDemo.vue +694 -0
- package/src/demos/DlVirtualScrollDemo.vue +3 -12
- package/src/demos/DlWidgetDemo.vue +252 -61
- package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +151 -32
- package/src/demos/index.ts +23 -4
- package/src/hooks/use-anchor.ts +15 -17
- package/src/hooks/use-arrow-navigation.ts +64 -21
- package/src/hooks/use-model-toggle.ts +14 -16
- package/src/hooks/use-portal.ts +9 -3
- package/src/hooks/use-scroll-target.ts +2 -4
- package/src/hooks/use-size-observer.ts +3 -2
- package/src/hooks/use-suggestions.ts +239 -49
- package/src/hooks/use-transition.ts +10 -4
- package/src/index.ts +22 -1
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
- package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
- package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
- package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
- package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
- package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
- package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
- package/src/layouts/DlStudioLayout/index.ts +2 -0
- package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
- package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
- package/src/simple-code-editor.d.ts +1 -0
- package/src/utils/click-outside.ts +1 -1
- package/src/utils/dom.ts +5 -5
- package/src/utils/events.ts +3 -3
- package/src/utils/global-nodes.ts +2 -2
- package/src/utils/input-sizes.ts +5 -2
- package/src/utils/is-ellipsis-active.ts +4 -1
- package/src/utils/parse-smart-query.ts +209 -111
- package/src/utils/portal.ts +5 -5
- package/src/utils/position-engine.ts +7 -7
- package/src/utils/render.ts +1 -1
- package/src/utils/scroll.ts +2 -2
- package/src/utils/selection.ts +3 -3
- package/vite.config.ts +9 -1
- package/src/components/basic/DlCard/DlCard.vue +0 -241
- package/src/components/basic/DlCard/types.ts +0 -20
- package/src/components/basic/DlEllipsis/DlEllipsis.vue +0 -114
- package/src/components/basic/DlWidget/DlGrid.vue +0 -33
- package/src/components/basic/DlWidget/DlGridRow.vue +0 -32
- package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +0 -124
- package/src/components/compound/DlToast/utils/config.ts +0 -17
- package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -65
- package/src/components/essential/DlTextHolder/index.ts +0 -2
- package/src/demos/DlTextHolderDemo.vue +0 -42
- package/src/utils/swapNodes.ts +0 -30
- /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
- /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
- /package/src/components/{basic → essential}/DlEllipsis/index.ts +0 -0
- /package/src/components/{essential → shared}/DlTooltip/index.ts +0 -0
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:theme="theme"
|
|
4
|
+
class="code-editor"
|
|
5
|
+
:class="{
|
|
6
|
+
'hide-header': !header,
|
|
7
|
+
scroll: scroll,
|
|
8
|
+
'read-only': readOnly,
|
|
9
|
+
wrap: wrap
|
|
10
|
+
}"
|
|
11
|
+
:style="{
|
|
12
|
+
width: width,
|
|
13
|
+
height: height,
|
|
14
|
+
zIndex: zIndex,
|
|
15
|
+
maxWidth: maxWidth,
|
|
16
|
+
minWidth: minWidth,
|
|
17
|
+
maxHeight: maxHeight,
|
|
18
|
+
minHeight: minHeight
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
<div
|
|
22
|
+
class="hljs"
|
|
23
|
+
:style="{ borderRadius: borderRadius }"
|
|
24
|
+
>
|
|
25
|
+
<div
|
|
26
|
+
v-if="header"
|
|
27
|
+
class="header"
|
|
28
|
+
:class="{ border: showLineNums }"
|
|
29
|
+
:style="{
|
|
30
|
+
borderRadius: borderRadius + ' ' + borderRadius + ' 0 0'
|
|
31
|
+
}"
|
|
32
|
+
>
|
|
33
|
+
<div class="row header-content">
|
|
34
|
+
<dl-select
|
|
35
|
+
v-if="displayLanguage"
|
|
36
|
+
v-model="selectedLanguage"
|
|
37
|
+
without-borders
|
|
38
|
+
:options="languagesOptions"
|
|
39
|
+
:disabled="languagesOptions.length <= 1"
|
|
40
|
+
:disabled-tooltip="null"
|
|
41
|
+
width="fit-content"
|
|
42
|
+
/>
|
|
43
|
+
<dl-button
|
|
44
|
+
v-if="copyButton"
|
|
45
|
+
icon-color="dl-color-medium"
|
|
46
|
+
icon="icon-dl-copy"
|
|
47
|
+
size="14px"
|
|
48
|
+
round
|
|
49
|
+
flat
|
|
50
|
+
@click="copy"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div
|
|
55
|
+
class="code-area"
|
|
56
|
+
:style="{
|
|
57
|
+
borderRadius: header
|
|
58
|
+
? '0 0 ' + borderRadius + ' ' + borderRadius
|
|
59
|
+
: borderRadius
|
|
60
|
+
}"
|
|
61
|
+
>
|
|
62
|
+
<div
|
|
63
|
+
v-if="showLineNums"
|
|
64
|
+
ref="lineNumsEl"
|
|
65
|
+
class="line-nums hljs"
|
|
66
|
+
:style="{
|
|
67
|
+
fontSize: fontSize,
|
|
68
|
+
paddingTop: header ? '10px' : padding,
|
|
69
|
+
paddingBottom: padding,
|
|
70
|
+
top: top + 'px'
|
|
71
|
+
}"
|
|
72
|
+
>
|
|
73
|
+
<div>1</div>
|
|
74
|
+
<div
|
|
75
|
+
v-for="(num, index) in lineNum"
|
|
76
|
+
:key="index"
|
|
77
|
+
>
|
|
78
|
+
{{ num + 1 }}
|
|
79
|
+
</div>
|
|
80
|
+
<div> </div>
|
|
81
|
+
</div>
|
|
82
|
+
<textarea
|
|
83
|
+
ref="textarea"
|
|
84
|
+
title="textarea"
|
|
85
|
+
:readOnly="readOnly"
|
|
86
|
+
:style="textAreaStyle"
|
|
87
|
+
:autofocus="autofocus"
|
|
88
|
+
spellcheck="false"
|
|
89
|
+
:value="modelValue == undefined ? content : modelValue"
|
|
90
|
+
@keydown.tab.prevent.stop="tab"
|
|
91
|
+
@scroll="calcScrollDistance"
|
|
92
|
+
@input="updateValue"
|
|
93
|
+
/>
|
|
94
|
+
<pre
|
|
95
|
+
:style="{
|
|
96
|
+
paddingRight: scrollBarWidth + 'px',
|
|
97
|
+
paddingBottom: scrollBarHeight + 'px',
|
|
98
|
+
marginLeft: showLineNums ? lineNumsWidth + 'px' : '0',
|
|
99
|
+
width: showLineNums
|
|
100
|
+
? 'calc(100% - ' + lineNumsWidth + 'px)'
|
|
101
|
+
: '100%'
|
|
102
|
+
}"
|
|
103
|
+
>
|
|
104
|
+
<code
|
|
105
|
+
ref="code"
|
|
106
|
+
:class="languageClass"
|
|
107
|
+
:style="{
|
|
108
|
+
top: top + 'px',
|
|
109
|
+
left: left + 'px',
|
|
110
|
+
fontSize: fontSize,
|
|
111
|
+
padding: !header ? padding : lineNums ? '10px ' + padding + ' ' + padding : '0 ' + padding + ' ' + padding,
|
|
112
|
+
}"
|
|
113
|
+
/>
|
|
114
|
+
</pre>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<script lang="ts">
|
|
121
|
+
import hljs from 'highlight.js'
|
|
122
|
+
import {
|
|
123
|
+
computed,
|
|
124
|
+
defineComponent,
|
|
125
|
+
nextTick,
|
|
126
|
+
onBeforeUnmount,
|
|
127
|
+
onMounted,
|
|
128
|
+
onUpdated,
|
|
129
|
+
PropType,
|
|
130
|
+
ref,
|
|
131
|
+
toRefs,
|
|
132
|
+
watch
|
|
133
|
+
} from 'vue-demi'
|
|
134
|
+
import { DlButton } from '../../../basic'
|
|
135
|
+
import { DlSelect } from '../../DlSelect'
|
|
136
|
+
import { DlToast } from '../../DlToast'
|
|
137
|
+
import '../styles/themes.css'
|
|
138
|
+
import '../styles/themes-base16.css'
|
|
139
|
+
|
|
140
|
+
export default defineComponent({
|
|
141
|
+
name: 'CodeEditor',
|
|
142
|
+
components: {
|
|
143
|
+
DlSelect,
|
|
144
|
+
DlButton
|
|
145
|
+
},
|
|
146
|
+
model: {
|
|
147
|
+
prop: 'modelValue',
|
|
148
|
+
event: 'update:model-value'
|
|
149
|
+
},
|
|
150
|
+
props: {
|
|
151
|
+
modelValue: {
|
|
152
|
+
required: false,
|
|
153
|
+
type: String,
|
|
154
|
+
default: null
|
|
155
|
+
},
|
|
156
|
+
value: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: null
|
|
159
|
+
},
|
|
160
|
+
lineNums: {
|
|
161
|
+
type: Boolean,
|
|
162
|
+
default: false
|
|
163
|
+
},
|
|
164
|
+
theme: {
|
|
165
|
+
type: String,
|
|
166
|
+
default: 'vs'
|
|
167
|
+
},
|
|
168
|
+
tabSpaces: {
|
|
169
|
+
type: Number,
|
|
170
|
+
default: 2
|
|
171
|
+
},
|
|
172
|
+
wrap: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
default: false
|
|
175
|
+
},
|
|
176
|
+
readOnly: {
|
|
177
|
+
type: Boolean,
|
|
178
|
+
default: false
|
|
179
|
+
},
|
|
180
|
+
autofocus: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
default: false
|
|
183
|
+
},
|
|
184
|
+
header: {
|
|
185
|
+
type: Boolean,
|
|
186
|
+
default: true
|
|
187
|
+
},
|
|
188
|
+
width: {
|
|
189
|
+
type: String,
|
|
190
|
+
default: '540px'
|
|
191
|
+
},
|
|
192
|
+
height: {
|
|
193
|
+
type: String,
|
|
194
|
+
default: 'auto'
|
|
195
|
+
},
|
|
196
|
+
maxWidth: {
|
|
197
|
+
type: String,
|
|
198
|
+
default: 'inherit'
|
|
199
|
+
},
|
|
200
|
+
minWidth: {
|
|
201
|
+
type: String,
|
|
202
|
+
default: 'inherit'
|
|
203
|
+
},
|
|
204
|
+
maxHeight: {
|
|
205
|
+
type: String,
|
|
206
|
+
default: 'inherit'
|
|
207
|
+
},
|
|
208
|
+
minHeight: {
|
|
209
|
+
type: String,
|
|
210
|
+
default: 'inherit'
|
|
211
|
+
},
|
|
212
|
+
borderRadius: {
|
|
213
|
+
type: String,
|
|
214
|
+
default: '12px'
|
|
215
|
+
},
|
|
216
|
+
languages: {
|
|
217
|
+
type: Array as PropType<string[][]>,
|
|
218
|
+
default: () => [['javascript', 'JS']] as string[][]
|
|
219
|
+
},
|
|
220
|
+
langListWidth: {
|
|
221
|
+
type: String,
|
|
222
|
+
default: '110px'
|
|
223
|
+
},
|
|
224
|
+
langListHeight: {
|
|
225
|
+
type: String,
|
|
226
|
+
default: 'auto'
|
|
227
|
+
},
|
|
228
|
+
langListDisplay: {
|
|
229
|
+
type: Boolean,
|
|
230
|
+
default: false
|
|
231
|
+
},
|
|
232
|
+
displayLanguage: {
|
|
233
|
+
type: Boolean,
|
|
234
|
+
default: true
|
|
235
|
+
},
|
|
236
|
+
copyButton: {
|
|
237
|
+
type: Boolean,
|
|
238
|
+
default: true
|
|
239
|
+
},
|
|
240
|
+
zIndex: {
|
|
241
|
+
type: String,
|
|
242
|
+
default: '0'
|
|
243
|
+
},
|
|
244
|
+
fontSize: {
|
|
245
|
+
type: String,
|
|
246
|
+
default: '17px'
|
|
247
|
+
},
|
|
248
|
+
padding: {
|
|
249
|
+
type: String,
|
|
250
|
+
default: '20px'
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
setup(props: any, { emit }) {
|
|
254
|
+
const {
|
|
255
|
+
lineNums,
|
|
256
|
+
wrap,
|
|
257
|
+
tabSpaces,
|
|
258
|
+
modelValue,
|
|
259
|
+
height,
|
|
260
|
+
fontSize,
|
|
261
|
+
header,
|
|
262
|
+
padding
|
|
263
|
+
} = toRefs(props)
|
|
264
|
+
const scrollBarWidth = ref(0)
|
|
265
|
+
const scrollBarHeight = ref(0)
|
|
266
|
+
const top = ref(0)
|
|
267
|
+
const left = ref(0)
|
|
268
|
+
const languageClass = ref('hljs language-' + props.languages[0][0])
|
|
269
|
+
const languageTitle = ref(
|
|
270
|
+
props.languages[0][1]
|
|
271
|
+
? props.languages[0][1]
|
|
272
|
+
: props.languages[0][0]
|
|
273
|
+
)
|
|
274
|
+
const content = ref(props.value)
|
|
275
|
+
const cursorPosition = ref(0)
|
|
276
|
+
const insertTab = ref(false)
|
|
277
|
+
const lineNum = ref(0)
|
|
278
|
+
const lineNumsWidth = ref(0)
|
|
279
|
+
const scrolling = ref(false)
|
|
280
|
+
const textareaHeight = ref(0)
|
|
281
|
+
const showLineNums = computed(() => {
|
|
282
|
+
return wrap.value ? false : !!lineNums.value
|
|
283
|
+
})
|
|
284
|
+
const languagesOptions = computed(() => {
|
|
285
|
+
return props.languages.map((lang: string[]) => {
|
|
286
|
+
return {
|
|
287
|
+
value: lang[0],
|
|
288
|
+
label: lang[1] ? lang[1] : lang[0]
|
|
289
|
+
}
|
|
290
|
+
})
|
|
291
|
+
})
|
|
292
|
+
const selectedLanguage = ref(languagesOptions.value[0])
|
|
293
|
+
const code = ref<HTMLElement>(null as any)
|
|
294
|
+
const textarea = ref<HTMLTextAreaElement>(null as any)
|
|
295
|
+
const lineNumsEl = ref<HTMLDivElement>(null as any)
|
|
296
|
+
|
|
297
|
+
const tabWidth = computed(() => {
|
|
298
|
+
let result = ''
|
|
299
|
+
for (let i = 0; i < tabSpaces.value; i++) {
|
|
300
|
+
result += ' '
|
|
301
|
+
}
|
|
302
|
+
return result
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
const contentValue = computed(() => {
|
|
306
|
+
return !modelValue.value && modelValue.value !== ''
|
|
307
|
+
? content.value + '\n'
|
|
308
|
+
: props.modelValue + '\n'
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
const scroll = computed(() => {
|
|
312
|
+
return height.value == 'auto' ? false : true
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
watch(contentValue, () => {
|
|
316
|
+
nextTick(() => {
|
|
317
|
+
code.value!.textContent = contentValue.value
|
|
318
|
+
hljs.highlightElement(code.value!)
|
|
319
|
+
})
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
const textareaResizer = ref<ResizeObserver>(null as any)
|
|
323
|
+
const lineNumsResizer = ref<ResizeObserver>(null as any)
|
|
324
|
+
|
|
325
|
+
const setupTextAreaResizer = () => {
|
|
326
|
+
textareaResizer.value = new ResizeObserver((entries) => {
|
|
327
|
+
scrollBarWidth.value =
|
|
328
|
+
(entries[0].target as HTMLElement).offsetWidth -
|
|
329
|
+
entries[0].target.clientWidth
|
|
330
|
+
scrollBarHeight.value =
|
|
331
|
+
(entries[0].target as HTMLElement).offsetHeight -
|
|
332
|
+
entries[0].target.clientHeight
|
|
333
|
+
textareaHeight.value = (
|
|
334
|
+
entries[0].target as HTMLElement
|
|
335
|
+
).offsetHeight
|
|
336
|
+
})
|
|
337
|
+
|
|
338
|
+
textareaResizer.value.observe(textarea.value)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const setupLineNumsResizer = () => {
|
|
342
|
+
lineNumsResizer.value = new ResizeObserver((entries) => {
|
|
343
|
+
lineNumsWidth.value = (
|
|
344
|
+
entries[0].target as HTMLElement
|
|
345
|
+
).offsetWidth
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
lineNumsResizer.value.observe(lineNumsEl.value)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const disposeTextAreaResizer = () => {
|
|
352
|
+
if (!textareaResizer.value) return
|
|
353
|
+
textareaResizer.value.disconnect()
|
|
354
|
+
textareaResizer.value = null as any
|
|
355
|
+
}
|
|
356
|
+
const disposeLineNumsResizer = () => {
|
|
357
|
+
if (!lineNumsResizer.value) return
|
|
358
|
+
lineNumsResizer.value.disconnect()
|
|
359
|
+
lineNumsResizer.value = null as any
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const getLineNum = () => {
|
|
363
|
+
if (!lineNumsEl.value) return
|
|
364
|
+
|
|
365
|
+
// lineNum
|
|
366
|
+
const str = textarea.value.value
|
|
367
|
+
let localLineNum = 0
|
|
368
|
+
let position = str.indexOf('\n')
|
|
369
|
+
while (position !== -1) {
|
|
370
|
+
localLineNum++
|
|
371
|
+
position = str.indexOf('\n', position + 1)
|
|
372
|
+
}
|
|
373
|
+
// heightNum
|
|
374
|
+
const singleLineHeight = (
|
|
375
|
+
lineNumsEl.value.firstChild as HTMLElement
|
|
376
|
+
).offsetHeight
|
|
377
|
+
const heightNum =
|
|
378
|
+
Math.round(textareaHeight.value / singleLineHeight) - 1
|
|
379
|
+
// displayed lineNum
|
|
380
|
+
lineNum.value =
|
|
381
|
+
height.value == 'auto'
|
|
382
|
+
? localLineNum
|
|
383
|
+
: localLineNum > heightNum
|
|
384
|
+
? localLineNum
|
|
385
|
+
: heightNum
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
onMounted(() => {
|
|
389
|
+
emit('lang', props.languages[0][0])
|
|
390
|
+
emit('content', props.content)
|
|
391
|
+
emit('textarea', textarea.value)
|
|
392
|
+
setupTextAreaResizer()
|
|
393
|
+
if (showLineNums.value) {
|
|
394
|
+
setupLineNumsResizer()
|
|
395
|
+
}
|
|
396
|
+
code.value.textContent = contentValue.value
|
|
397
|
+
hljs.highlightElement(code.value)
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
onBeforeUnmount(() => {
|
|
401
|
+
disposeTextAreaResizer()
|
|
402
|
+
disposeLineNumsResizer()
|
|
403
|
+
})
|
|
404
|
+
|
|
405
|
+
onUpdated(() => {
|
|
406
|
+
if (insertTab.value) {
|
|
407
|
+
textarea.value.setSelectionRange(
|
|
408
|
+
cursorPosition.value,
|
|
409
|
+
cursorPosition.value
|
|
410
|
+
)
|
|
411
|
+
insertTab.value = false
|
|
412
|
+
}
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
watch(showLineNums, (newVal, oldVal) => {
|
|
416
|
+
nextTick(() => {
|
|
417
|
+
if (newVal) {
|
|
418
|
+
setupLineNumsResizer()
|
|
419
|
+
} else {
|
|
420
|
+
disposeLineNumsResizer()
|
|
421
|
+
}
|
|
422
|
+
if (lineNums.value) {
|
|
423
|
+
if (scrolling.value) {
|
|
424
|
+
scrolling.value = false
|
|
425
|
+
} else {
|
|
426
|
+
getLineNum()
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
})
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
const copy = async () => {
|
|
433
|
+
try {
|
|
434
|
+
await navigator.clipboard.writeText(textarea.value.value)
|
|
435
|
+
DlToast.success('Copied to clipboard')
|
|
436
|
+
} catch (e) {
|
|
437
|
+
DlToast.error('Failed to copy to clipboard')
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
const calcScrollDistance = (e: any) => {
|
|
442
|
+
const codeEl = code.value as any
|
|
443
|
+
codeEl.scrolling = true
|
|
444
|
+
scrolling.value = true
|
|
445
|
+
top.value = -e.target.scrollTop
|
|
446
|
+
left.value = -e.target.scrollLeft
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const tab = () => {
|
|
450
|
+
if (document.execCommand('insertText')) {
|
|
451
|
+
document.execCommand('insertText', false, tabWidth.value)
|
|
452
|
+
} else {
|
|
453
|
+
const localCursorPosition = textarea.value.selectionStart
|
|
454
|
+
content.value =
|
|
455
|
+
content.value.substring(0, localCursorPosition) +
|
|
456
|
+
tabWidth.value +
|
|
457
|
+
content.value.substring(localCursorPosition)
|
|
458
|
+
cursorPosition.value =
|
|
459
|
+
localCursorPosition + tabWidth.value.length
|
|
460
|
+
insertTab.value = true
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
const changeLang = (lang: string[][]) => {
|
|
465
|
+
languageTitle.value = lang[1] ? lang[1] : lang[0]
|
|
466
|
+
languageClass.value = 'language-' + lang[0]
|
|
467
|
+
emit('lang', lang[0])
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const updateValue = (e: any) => {
|
|
471
|
+
if (!props.modelValue && props.modelValue !== '') {
|
|
472
|
+
content.value = e.target.value
|
|
473
|
+
} else {
|
|
474
|
+
emit('update:model-value', e.target.value)
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const textAreaStyle = computed<Record<string, any>>(() => {
|
|
479
|
+
const paddingVal = lineNums.value
|
|
480
|
+
? '10px ' + padding.value + ' ' + padding.value
|
|
481
|
+
: '0 ' + padding.value + ' ' + padding.value
|
|
482
|
+
|
|
483
|
+
return {
|
|
484
|
+
fontSize: fontSize.value,
|
|
485
|
+
padding: !header.value ? padding.value : paddingVal,
|
|
486
|
+
marginLeft: showLineNums.value
|
|
487
|
+
? lineNumsWidth.value + 'px'
|
|
488
|
+
: '0',
|
|
489
|
+
width: showLineNums.value
|
|
490
|
+
? 'calc(100% - ' + lineNumsWidth.value + 'px)'
|
|
491
|
+
: '100%'
|
|
492
|
+
}
|
|
493
|
+
})
|
|
494
|
+
|
|
495
|
+
return {
|
|
496
|
+
scrollBarWidth,
|
|
497
|
+
scrollBarHeight,
|
|
498
|
+
top,
|
|
499
|
+
left,
|
|
500
|
+
languageClass,
|
|
501
|
+
languageTitle,
|
|
502
|
+
content,
|
|
503
|
+
cursorPosition,
|
|
504
|
+
insertTab,
|
|
505
|
+
lineNum,
|
|
506
|
+
lineNumsWidth,
|
|
507
|
+
scrolling,
|
|
508
|
+
textareaHeight,
|
|
509
|
+
showLineNums,
|
|
510
|
+
selectedLanguage,
|
|
511
|
+
languagesOptions,
|
|
512
|
+
tabWidth,
|
|
513
|
+
contentValue,
|
|
514
|
+
scroll,
|
|
515
|
+
code,
|
|
516
|
+
textarea,
|
|
517
|
+
lineNumsEl,
|
|
518
|
+
copy,
|
|
519
|
+
calcScrollDistance,
|
|
520
|
+
tab,
|
|
521
|
+
changeLang,
|
|
522
|
+
updateValue,
|
|
523
|
+
textAreaStyle
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
})
|
|
527
|
+
</script>
|
|
528
|
+
|
|
529
|
+
<style scoped lang="scss">
|
|
530
|
+
.code-editor {
|
|
531
|
+
position: relative;
|
|
532
|
+
}
|
|
533
|
+
.code-editor > div {
|
|
534
|
+
width: 100%;
|
|
535
|
+
height: 100%;
|
|
536
|
+
}
|
|
537
|
+
/* header */
|
|
538
|
+
.code-editor .header {
|
|
539
|
+
box-sizing: border-box;
|
|
540
|
+
position: relative;
|
|
541
|
+
z-index: 1;
|
|
542
|
+
height: 34px;
|
|
543
|
+
}
|
|
544
|
+
.code-editor .header > .dropdown {
|
|
545
|
+
position: absolute;
|
|
546
|
+
top: 12px;
|
|
547
|
+
left: 18px;
|
|
548
|
+
}
|
|
549
|
+
.code-editor .header > .copy-code {
|
|
550
|
+
position: absolute;
|
|
551
|
+
top: 10px;
|
|
552
|
+
right: 12px;
|
|
553
|
+
}
|
|
554
|
+
/* code-area */
|
|
555
|
+
.code-editor .code-area {
|
|
556
|
+
position: relative;
|
|
557
|
+
z-index: 0;
|
|
558
|
+
text-align: left;
|
|
559
|
+
overflow: hidden;
|
|
560
|
+
}
|
|
561
|
+
/* font style */
|
|
562
|
+
.code-editor .code-area > textarea,
|
|
563
|
+
.code-editor .code-area > pre > code,
|
|
564
|
+
.code-editor .line-nums > div {
|
|
565
|
+
font-family: Consolas, Monaco, monospace;
|
|
566
|
+
line-height: 1.5;
|
|
567
|
+
}
|
|
568
|
+
.code-editor .code-area > textarea:hover,
|
|
569
|
+
.code-editor .code-area > textarea:focus-visible {
|
|
570
|
+
outline: none;
|
|
571
|
+
}
|
|
572
|
+
.code-editor .code-area > textarea {
|
|
573
|
+
position: absolute;
|
|
574
|
+
z-index: 1;
|
|
575
|
+
top: 0;
|
|
576
|
+
left: 0;
|
|
577
|
+
overflow-y: hidden;
|
|
578
|
+
box-sizing: border-box;
|
|
579
|
+
caret-color: rgb(127, 127, 127);
|
|
580
|
+
color: transparent;
|
|
581
|
+
white-space: pre;
|
|
582
|
+
word-wrap: normal;
|
|
583
|
+
border: 0;
|
|
584
|
+
width: 100%;
|
|
585
|
+
height: 100%;
|
|
586
|
+
background: none;
|
|
587
|
+
resize: none;
|
|
588
|
+
}
|
|
589
|
+
.code-editor .code-area > pre {
|
|
590
|
+
box-sizing: border-box;
|
|
591
|
+
position: relative;
|
|
592
|
+
z-index: 0;
|
|
593
|
+
overflow: hidden;
|
|
594
|
+
font-size: 0;
|
|
595
|
+
margin: 0;
|
|
596
|
+
}
|
|
597
|
+
.code-editor .code-area > pre > code {
|
|
598
|
+
background: none;
|
|
599
|
+
display: block;
|
|
600
|
+
position: relative;
|
|
601
|
+
overflow-x: visible !important;
|
|
602
|
+
border-radius: 0;
|
|
603
|
+
box-sizing: border-box;
|
|
604
|
+
margin: 0;
|
|
605
|
+
}
|
|
606
|
+
/* wrap code */
|
|
607
|
+
.code-editor.wrap .code-area > textarea,
|
|
608
|
+
.code-editor.wrap .code-area > pre > code {
|
|
609
|
+
white-space: pre-wrap;
|
|
610
|
+
word-wrap: break-word;
|
|
611
|
+
}
|
|
612
|
+
/* hide-header */
|
|
613
|
+
.code-editor.hide-header.scroll .code-area {
|
|
614
|
+
height: 100%;
|
|
615
|
+
}
|
|
616
|
+
/* scroll */
|
|
617
|
+
.code-editor.scroll .code-area {
|
|
618
|
+
height: calc(100% - 34px);
|
|
619
|
+
}
|
|
620
|
+
.code-editor.scroll .code-area > textarea {
|
|
621
|
+
overflow: auto;
|
|
622
|
+
}
|
|
623
|
+
.code-editor.scroll .code-area > pre {
|
|
624
|
+
width: 100%;
|
|
625
|
+
height: 100%;
|
|
626
|
+
overflow: hidden;
|
|
627
|
+
}
|
|
628
|
+
/* dropdown */
|
|
629
|
+
.code-editor .list {
|
|
630
|
+
-webkit-user-select: none;
|
|
631
|
+
user-select: none;
|
|
632
|
+
height: 100%;
|
|
633
|
+
font-family: sans-serif;
|
|
634
|
+
}
|
|
635
|
+
.code-editor .list > .lang-list {
|
|
636
|
+
border-radius: 5px;
|
|
637
|
+
box-sizing: border-box;
|
|
638
|
+
overflow: auto;
|
|
639
|
+
font-size: 13px;
|
|
640
|
+
padding: 0;
|
|
641
|
+
margin: 0;
|
|
642
|
+
list-style: none;
|
|
643
|
+
text-align: left;
|
|
644
|
+
}
|
|
645
|
+
.code-editor .list > .lang-list > li {
|
|
646
|
+
font-size: 13px;
|
|
647
|
+
transition: background 0.16s ease, color 0.16s ease;
|
|
648
|
+
box-sizing: border-box;
|
|
649
|
+
padding: 0 12px;
|
|
650
|
+
white-space: nowrap;
|
|
651
|
+
overflow: hidden;
|
|
652
|
+
text-overflow: ellipsis;
|
|
653
|
+
line-height: 30px;
|
|
654
|
+
}
|
|
655
|
+
.code-editor .list > .lang-list > li:first-child {
|
|
656
|
+
padding-top: 5px;
|
|
657
|
+
}
|
|
658
|
+
.code-editor .list > .lang-list > li:last-child {
|
|
659
|
+
padding-bottom: 5px;
|
|
660
|
+
}
|
|
661
|
+
.code-editor .list > .lang-list > li:hover {
|
|
662
|
+
background: rgba(160, 160, 160, 0.4);
|
|
663
|
+
}
|
|
664
|
+
/* line-nums */
|
|
665
|
+
.code-editor .line-nums {
|
|
666
|
+
min-width: 36px;
|
|
667
|
+
text-align: right;
|
|
668
|
+
box-sizing: border-box;
|
|
669
|
+
position: absolute;
|
|
670
|
+
left: 0;
|
|
671
|
+
padding-right: 8px;
|
|
672
|
+
padding-left: 8px;
|
|
673
|
+
opacity: 0.3;
|
|
674
|
+
}
|
|
675
|
+
.code-editor .line-nums::after {
|
|
676
|
+
content: '';
|
|
677
|
+
position: absolute;
|
|
678
|
+
width: 100%;
|
|
679
|
+
height: 100%;
|
|
680
|
+
top: 0;
|
|
681
|
+
left: 0;
|
|
682
|
+
border-right: 1px solid currentColor;
|
|
683
|
+
opacity: 0.5;
|
|
684
|
+
}
|
|
685
|
+
.code-editor .header.border::after {
|
|
686
|
+
content: '';
|
|
687
|
+
position: absolute;
|
|
688
|
+
width: 100%;
|
|
689
|
+
height: 1px;
|
|
690
|
+
bottom: 0;
|
|
691
|
+
left: 0;
|
|
692
|
+
background: currentColor;
|
|
693
|
+
opacity: 0.15;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
.code-editor {
|
|
697
|
+
.header-content {
|
|
698
|
+
$dl-select-palceholder-color: var(--dl-color-medium);
|
|
699
|
+
height: 100%;
|
|
700
|
+
justify-content: space-between;
|
|
701
|
+
align-items: center;
|
|
702
|
+
padding: 0 10px;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
</style>
|