@dataloop-ai/components 0.17.134 → 0.18.1

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.
Files changed (180) hide show
  1. package/package.json +3 -1
  2. package/src/App.vue +5 -227
  3. package/src/assets/globals.scss +4 -0
  4. package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
  5. package/src/components/basic/DlButton/DlButton.vue +2 -6
  6. package/src/components/basic/DlChip/DlChip.vue +1 -5
  7. package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
  8. package/src/components/basic/DlEmptyState/index.ts +2 -0
  9. package/src/components/basic/DlEmptyState/types.ts +20 -0
  10. package/src/components/basic/DlListItem/DlListItem.vue +96 -63
  11. package/src/components/basic/DlListItem/utils.ts +0 -3
  12. package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +35 -12
  13. package/src/components/basic/DlPopup/DlPopup.vue +29 -7
  14. package/src/components/basic/DlWidget/DlWidget.vue +32 -4
  15. package/src/components/basic/index.ts +2 -1
  16. package/src/components/basic/types.ts +2 -0
  17. package/src/components/compound/DlCard/DlCard.vue +796 -0
  18. package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
  19. package/src/components/compound/DlCard/types.ts +38 -0
  20. package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +35 -3
  21. package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +51 -12
  22. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +71 -14
  23. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +28 -4
  24. package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +1 -1
  25. package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +46 -8
  26. package/src/components/compound/DlCharts/components/DlBrush.vue +2 -2
  27. package/src/components/compound/DlCharts/types/props.ts +5 -1
  28. package/src/components/compound/DlCharts/utils.ts +1 -1
  29. package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +171 -0
  30. package/src/components/compound/DlCodeEditor/README.md +11 -0
  31. package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
  32. package/src/components/compound/DlCodeEditor/index.ts +3 -0
  33. package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
  34. package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
  35. package/src/components/compound/DlCodeEditor/types.ts +21 -0
  36. package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
  37. package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +8 -8
  38. package/src/components/compound/DlDialogBox/DlDialogBox.vue +26 -2
  39. package/src/components/compound/DlInput/DlInput.vue +2 -2
  40. package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
  41. package/src/components/compound/DlRange/DlRange.vue +2 -2
  42. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +1 -1
  43. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +1 -1
  44. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
  45. package/src/components/compound/DlSelect/DlSelect.vue +78 -70
  46. package/src/components/compound/DlSlider/components/DlSliderBase.vue +2 -2
  47. package/src/components/compound/DlSlider/useSlider.ts +2 -2
  48. package/src/components/compound/DlStepper/DlStepper.vue +33 -3
  49. package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
  50. package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +12 -6
  51. package/src/components/compound/DlTable/DlTable.vue +30 -4
  52. package/src/components/compound/DlTable/components/DlTd.vue +8 -8
  53. package/src/components/compound/DlTable/components/DlTh.vue +1 -1
  54. package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
  55. package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
  56. package/src/components/compound/DlTable/hooks/tablePagination.ts +10 -13
  57. package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
  58. package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
  59. package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
  60. package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
  61. package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
  62. package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
  63. package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
  64. package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
  65. package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
  66. package/src/components/compound/DlTreeTable/index.ts +3 -0
  67. package/src/components/compound/DlTreeTable/types.ts +1 -0
  68. package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
  69. package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
  70. package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
  71. package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
  72. package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
  73. package/src/components/compound/index.ts +5 -0
  74. package/src/components/compound/types.ts +2 -0
  75. package/src/components/essential/DlBadge/DlBadge.vue +3 -3
  76. package/src/components/essential/DlCheckbox/DlCheckbox.vue +6 -3
  77. package/src/components/essential/DlEllipsis/DlEllipsis.vue +18 -14
  78. package/src/components/essential/DlIcon/DlIcon.vue +1 -1
  79. package/src/components/essential/DlLabel/DlLabel.vue +174 -0
  80. package/src/components/essential/DlLabel/index.ts +2 -0
  81. package/src/components/essential/DlList/DlList.vue +2 -2
  82. package/src/components/essential/DlMenu/DlMenu.vue +26 -20
  83. package/src/components/essential/DlMenu/utils.ts +7 -6
  84. package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
  85. package/src/components/essential/DlPageLayout/index.ts +2 -0
  86. package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
  87. package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
  88. package/src/components/essential/index.ts +2 -1
  89. package/src/components/shared/DlTooltip/DlTooltip.vue +9 -10
  90. package/src/demos/BarChartDemo.vue +47 -2
  91. package/src/demos/ColumnChartDemo.vue +51 -2
  92. package/src/demos/DlAccordionDemo.vue +92 -43
  93. package/src/demos/DlCardDemo.vue +156 -19
  94. package/src/demos/DlChartDoughnutDemo.vue +49 -2
  95. package/src/demos/DlCheckboxDemo.vue +13 -0
  96. package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
  97. package/src/demos/DlCodeEditor/index.ts +2 -0
  98. package/src/demos/DlConfusionMatrixDemo.vue +51 -6
  99. package/src/demos/DlDemoPage.vue +235 -0
  100. package/src/demos/DlDialogBoxDemo.vue +56 -51
  101. package/src/demos/DlDropdownButtonDemo.vue +1 -1
  102. package/src/demos/DlEmptyStateDemo.vue +81 -0
  103. package/src/demos/DlLabelDemo.vue +128 -0
  104. package/src/demos/DlLineChartDemo.vue +50 -2
  105. package/src/demos/DlListDemo.vue +12 -9
  106. package/src/demos/DlMenuDemo.vue +13 -14
  107. package/src/demos/DlPageLayoutDemo.vue +146 -0
  108. package/src/demos/DlPanelContainerDemo.vue +113 -2
  109. package/src/demos/DlPopupDemo.vue +51 -0
  110. package/src/demos/DlSelectDemo.vue +14 -5
  111. package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
  112. package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
  113. package/src/demos/DlTableDemo.vue +65 -2
  114. package/src/demos/DlTabsDemo.vue +1 -1
  115. package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
  116. package/src/demos/DlTreeTableDemo.vue +694 -0
  117. package/src/demos/DlWidgetDemo.vue +48 -3
  118. package/src/demos/index.ts +17 -4
  119. package/src/hooks/use-anchor.ts +14 -16
  120. package/src/hooks/use-model-toggle.ts +12 -14
  121. package/src/hooks/use-portal.ts +2 -2
  122. package/src/hooks/use-scroll-target.ts +2 -4
  123. package/src/hooks/use-size-observer.ts +3 -2
  124. package/src/hooks/use-transition.ts +10 -4
  125. package/src/index.ts +22 -1
  126. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
  127. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
  128. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
  129. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
  130. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
  131. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
  132. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
  133. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
  134. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
  135. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
  136. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
  137. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
  138. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
  139. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
  140. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
  141. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
  142. package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
  143. package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
  144. package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
  145. package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
  146. package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
  147. package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
  148. package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
  149. package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
  150. package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
  151. package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
  152. package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
  153. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
  154. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
  155. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
  156. package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
  157. package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
  158. package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
  159. package/src/layouts/DlStudioLayout/index.ts +2 -0
  160. package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
  161. package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
  162. package/src/simple-code-editor.d.ts +1 -0
  163. package/src/utils/click-outside.ts +1 -1
  164. package/src/utils/dom.ts +5 -5
  165. package/src/utils/events.ts +3 -3
  166. package/src/utils/global-nodes.ts +2 -2
  167. package/src/utils/is-ellipsis-active.ts +4 -1
  168. package/src/utils/portal.ts +5 -5
  169. package/src/utils/position-engine.ts +5 -5
  170. package/src/utils/render.ts +1 -1
  171. package/src/utils/scroll.ts +2 -2
  172. package/src/utils/selection.ts +3 -3
  173. package/vite.config.ts +9 -1
  174. package/src/components/basic/DlCard/DlCard.vue +0 -242
  175. package/src/components/basic/DlCard/types.ts +0 -20
  176. package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -93
  177. package/src/components/essential/DlTextHolder/index.ts +0 -2
  178. package/src/demos/DlTextHolderDemo.vue +0 -50
  179. /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
  180. /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
@@ -3,7 +3,22 @@
3
3
  :style="cssVars"
4
4
  :class="chartWrapperClasses"
5
5
  >
6
+ <dl-empty-state
7
+ v-if="isEmpty"
8
+ v-bind="emptyStateProps"
9
+ >
10
+ <template
11
+ v-for="(_, slot) in $slots"
12
+ #[slot]="props"
13
+ >
14
+ <slot
15
+ :name="slot"
16
+ v-bind="props"
17
+ />
18
+ </template>
19
+ </dl-empty-state>
6
20
  <DlLine
21
+ v-if="!isEmpty"
7
22
  :id="id"
8
23
  ref="lineChart"
9
24
  :class="chartClasses"
@@ -13,7 +28,7 @@
13
28
  @mouseout="onChartLeave"
14
29
  />
15
30
  <slot
16
- v-if="displayLabels"
31
+ v-if="!isEmpty || displayLabels"
17
32
  v-bind="{ ...labelStyles, labels: xLabels, chartWidth }"
18
33
  name="axe-x-labels"
19
34
  >
@@ -28,7 +43,7 @@
28
43
  />
29
44
  </slot>
30
45
  <slot
31
- v-if="displayBrush"
46
+ v-if="displayBrush || !isEmpty"
32
47
  v-bind="{
33
48
  chartWidth,
34
49
  modelValue: brush.value,
@@ -52,7 +67,7 @@
52
67
  />
53
68
  </slot>
54
69
  <slot
55
- v-if="displayLegend"
70
+ v-if="displayLegend || !isEmpty"
56
71
  v-bind="{
57
72
  data: legendDatasets,
58
73
  chartWidth,
@@ -81,9 +96,20 @@ import { Line as DlLine } from '../../types/typedCharts'
81
96
  import {
82
97
  CommonProps,
83
98
  ColumnChartProps,
84
- defaultLineChartProps
99
+ defaultLineChartProps,
100
+ ColumnChartPropsType,
101
+ CommonPropsType
85
102
  } from '../../types/props'
86
- import { defineComponent, reactive, watch, ref, computed } from 'vue-demi'
103
+ import {
104
+ defineComponent,
105
+ reactive,
106
+ watch,
107
+ ref,
108
+ computed,
109
+ PropType
110
+ } from 'vue-demi'
111
+ import DlEmptyState from '../../../../basic/DlEmptyState/DlEmptyState.vue'
112
+ import { DlEmptyStateProps } from '../../../../basic/DlEmptyState/types'
87
113
  import DlBrush from '../../components/DlBrush.vue'
88
114
  import DlChartLegend from '../../components/DlChartLegend.vue'
89
115
  import DlChartLabels from '../../components/DlChartLabels.vue'
@@ -125,6 +151,12 @@ ChartJS.register(
125
151
  LineElement,
126
152
  TimeScale
127
153
  )
154
+ type ComponentType = {
155
+ id: string
156
+ isEmpty: boolean
157
+ emptyStateProps: DlEmptyStateProps
158
+ } & CommonPropsType &
159
+ ColumnChartPropsType
128
160
 
129
161
  export default defineComponent({
130
162
  name: 'DlLineChart',
@@ -132,16 +164,22 @@ export default defineComponent({
132
164
  DlBrush,
133
165
  DlChartLegend,
134
166
  DlLine,
135
- DlChartLabels
167
+ DlChartLabels,
168
+ DlEmptyState
136
169
  },
137
170
  props: {
138
171
  id: {
139
172
  type: String,
140
173
  default: null
141
174
  },
175
+ isEmpty: Boolean,
176
+ emptyStateProps: {
177
+ type: Object as PropType<DlEmptyStateProps>,
178
+ default: null
179
+ },
142
180
  ...CommonProps,
143
181
  ...ColumnChartProps
144
- },
182
+ } as { [key: string]: any },
145
183
  setup(props, { slots }) {
146
184
  const { variables } = useThemeVariables()
147
185
 
@@ -302,7 +340,7 @@ export default defineComponent({
302
340
  props.legendProps?.datasets || [],
303
341
  props.data?.datasets || [],
304
342
  'label'
305
- )
343
+ ) as { [key: string]: any }[]
306
344
  )
307
345
 
308
346
  const onChartLeave = () => {
@@ -239,14 +239,14 @@ export default defineComponent({
239
239
  width: 0.5 * parseInt(props.thumbSize) + 'px',
240
240
  height: props.thumbSize,
241
241
  left: `${100 * ratioMin.value}%`,
242
- zIndex: state.focus.value === 'min' ? 2 : void 0
242
+ zIndex: state.focus.value === 'min' ? 2 : null
243
243
  }))
244
244
 
245
245
  const maxThumbStyle = computed(() => ({
246
246
  width: 0.5 * parseInt(props.thumbSize) + 'px',
247
247
  height: props.thumbSize,
248
248
  left: `${100 * ratioMax.value}%`,
249
- zIndex: state.focus.value === 'max' ? 2 : void 0
249
+ zIndex: state.focus.value === 'max' ? 2 : null
250
250
  }))
251
251
 
252
252
  function updateValue(change = false) {
@@ -33,6 +33,8 @@ export const CommonProps = {
33
33
  }
34
34
  } as const
35
35
 
36
+ export type CommonPropsType = typeof CommonProps
37
+
36
38
  export const Props = {
37
39
  type: {
38
40
  type: String as PropType<ChartType>,
@@ -100,6 +102,8 @@ export const ColumnChartProps = {
100
102
  }
101
103
  }
102
104
 
105
+ export type ColumnChartPropsType = typeof ColumnChartProps
106
+
103
107
  export const defaultColumnChartProps = {
104
108
  brushProps: {
105
109
  width: '100%',
@@ -348,7 +352,7 @@ export const defaultLineChartProps = {
348
352
  }
349
353
 
350
354
  export const defaultDoughnutChartProps: TDoughnutProps = {
351
- data: <TDoughnutChartData>{},
355
+ data: {} as TDoughnutChartData,
352
356
  isSmall: false,
353
357
  hasSummary: false,
354
358
  options: {
@@ -65,7 +65,7 @@ export function setDatasets<
65
65
  ) {
66
66
  const addedDatasets: ChartDataset<TType, TData>[] = []
67
67
 
68
- currentData.datasets = nextDatasets.map(
68
+ currentData.datasets = (nextDatasets || []).map(
69
69
  (nextDataset: Record<string, unknown>) => {
70
70
  // given the new set, find it's current match
71
71
  const currentDataset = currentData.datasets.find(
@@ -0,0 +1,171 @@
1
+ <template>
2
+ <div
3
+ class="dl-code-editor-wrapper"
4
+ :style="cssVars"
5
+ >
6
+ <code-editor
7
+ v-model="code"
8
+ class="dl-code-editor"
9
+ :line-nums="!!options.lineNumbers"
10
+ :languages="[[language, languageTitle]]"
11
+ :read-only="readonly"
12
+ :theme="theme"
13
+ :font-size="styleFontSize"
14
+ :tab-spaces="options.tabSpaces ? options.tabSpaces : 4"
15
+ :wrap="!!options.textWrapping"
16
+ :width="styleWidth"
17
+ :height="styleHeight"
18
+ :header="!options.hideHeader"
19
+ :display-language="!options.hideLanguage"
20
+ :copy-button="!options.hideCopyButton"
21
+ />
22
+ </div>
23
+ </template>
24
+
25
+ <script lang="ts">
26
+ import { defineComponent, computed, PropType, toRefs } from 'vue-demi'
27
+ import { DlCodeEditorTheme, DlCodeEditorOptions } from './types'
28
+ import CodeEditor from './components/CodeEditor.vue'
29
+
30
+ export default defineComponent({
31
+ name: 'DlCodeEditor',
32
+ components: {
33
+ CodeEditor
34
+ },
35
+ model: {
36
+ prop: 'modelValue',
37
+ event: 'update:model-value'
38
+ },
39
+ props: {
40
+ modelValue: {
41
+ type: String as PropType<string>,
42
+ default: ''
43
+ },
44
+ width: {
45
+ type: [String, Number] as PropType<string | number>,
46
+ default: '100%'
47
+ },
48
+ height: {
49
+ type: [String, Number] as PropType<string | number>,
50
+ default: '100%'
51
+ },
52
+ language: {
53
+ type: String as PropType<string>,
54
+ default: 'javascript'
55
+ },
56
+ theme: {
57
+ required: false,
58
+ type: String as PropType<DlCodeEditorTheme>,
59
+ default: DlCodeEditorTheme.Light
60
+ },
61
+ readonly: {
62
+ type: Boolean as PropType<boolean>,
63
+ default: false
64
+ },
65
+ title: {
66
+ type: String,
67
+ default: null
68
+ },
69
+ options: {
70
+ type: Object as PropType<DlCodeEditorOptions>,
71
+ default: () => ({} as DlCodeEditorOptions)
72
+ }
73
+ },
74
+ emits: ['update:model-value', 'change'],
75
+ setup(props, { emit }) {
76
+ const { modelValue, language, options, height, width } = toRefs(props)
77
+ const dlFontSize = `12px`
78
+
79
+ const code = computed({
80
+ get() {
81
+ return modelValue.value as string
82
+ },
83
+ set(value) {
84
+ emit('update:model-value', value)
85
+ emit('change', value)
86
+ }
87
+ })
88
+
89
+ const languageTitle = computed(() => {
90
+ switch (language.value.toLowerCase()) {
91
+ case 'python':
92
+ return 'Python'
93
+ case 'javascript':
94
+ return 'JavaScript'
95
+ case 'typescript':
96
+ return 'TypeScript'
97
+ case 'py':
98
+ return 'Python'
99
+ case 'js':
100
+ return 'JavaScript'
101
+ default:
102
+ return (
103
+ language.value.charAt(0).toUpperCase() +
104
+ language.value.slice(1)
105
+ )
106
+ }
107
+ })
108
+
109
+ const cssVars = computed(() => {
110
+ return {
111
+ '--dl-code-editor-header-border-bottom': !options.value
112
+ ?.lineNumbers
113
+ ? `1px solid var(--dl-color-separator)`
114
+ : `none`
115
+ } as Record<string, any>
116
+ })
117
+
118
+ const styleWidth = computed(() => {
119
+ if (typeof width.value === 'number') {
120
+ return `${width.value}px`
121
+ }
122
+ return width.value
123
+ })
124
+ const styleHeight = computed(() => {
125
+ if (typeof height.value === 'number') {
126
+ return `${height.value}px`
127
+ }
128
+ return height.value
129
+ })
130
+ const styleFontSize = computed(() => {
131
+ if (!options.value.fontSize) {
132
+ return dlFontSize
133
+ }
134
+ const frontSize = options.value.fontSize
135
+ if (typeof frontSize === 'number') {
136
+ return `${frontSize}px`
137
+ }
138
+ return frontSize
139
+ })
140
+
141
+ return {
142
+ code,
143
+ languageTitle,
144
+ dlFontSize,
145
+ cssVars,
146
+ styleHeight,
147
+ styleWidth,
148
+ styleFontSize
149
+ }
150
+ }
151
+ })
152
+ </script>
153
+ <style scoped lang="scss">
154
+ .dl-code-editor-wrapper {
155
+ border: 1px solid var(--dl-color-separator);
156
+ border-radius: 2px;
157
+ }
158
+ </style>
159
+
160
+ <style lang="scss">
161
+ .dl-code-editor-wrapper {
162
+ .dl-code-editor {
163
+ .header {
164
+ border-bottom: var(--dl-code-editor-header-border-bottom);
165
+ }
166
+ textarea {
167
+ color: var(--dl-code-editor-text-area-color);
168
+ }
169
+ }
170
+ }
171
+ </style>
@@ -0,0 +1,11 @@
1
+ # DlCodeEditor
2
+
3
+ The DlCodeEditor component is based off the [simple-code-editor](https://github.com/justcaliturner/simple-code-editor) written by [Vic](https://github.com/justcaliturner)
4
+
5
+
6
+ #### Modifications
7
+ The code itself was modified a bit to support vue 2.6 and vue3 together using the library vue-demi and general vue changes.
8
+ 1. moved to composition api
9
+ 2. used vue-demi to support transition between library versions
10
+ 3. used library version agnostic terms and behaviors
11
+ 4. use custom components for the header and other elements