@ternarytech-io/gears-ui 0.5.0 → 0.6.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.
- package/README.md +164 -163
- package/package.json +122 -122
- package/src/components/TButtonGroup.vue +48 -0
- package/src/components/TDropdown.vue +5 -35
- package/src/components/TPdfViewer.vue +4 -1
- package/src/components/TSplitButton.vue +54 -0
- package/src/components/TTimeInput.vue +159 -0
- package/src/components/TToaster.vue +38 -7
- package/src/components/internal/DropdownItems.vue +49 -0
- package/src/composables/useToast.ts +26 -4
- package/src/index.ts +249 -243
- package/src/monaco.ts +38 -27
- package/src/plugins/index.ts +62 -59
- package/src/types.ts +234 -222
package/src/index.ts
CHANGED
|
@@ -1,243 +1,249 @@
|
|
|
1
|
-
// Gears UI: Vue components on Tabler. Import the styles once (`@ternarytech-io/gears-ui/styles.css`), then either
|
|
2
|
-
// install the plugin (registers every component globally) or import components one by one.
|
|
3
|
-
// Components that need an optional library have their own entry points, so apps that don't use
|
|
4
|
-
// them don't need the library: `@ternarytech-io/gears-ui/code-editor` (Monaco) and `@ternarytech-io/gears-ui/plugins` (Tom
|
|
5
|
-
// Select, Coloris, Vanilla Calendar Pro, Dropzone, IMask, noUiSlider, SortableJS, HugeRTE).
|
|
6
|
-
import type { App } from 'vue'
|
|
7
|
-
import TAccentPicker from './components/TAccentPicker.vue'
|
|
8
|
-
import TAdvancedTable from './components/TAdvancedTable.vue'
|
|
9
|
-
import TAlert from './components/TAlert.vue'
|
|
10
|
-
import TAppLayout from './components/TAppLayout.vue'
|
|
11
|
-
import TAuthLayout from './components/TAuthLayout.vue'
|
|
12
|
-
import TAvatar from './components/TAvatar.vue'
|
|
13
|
-
import TBadge from './components/TBadge.vue'
|
|
14
|
-
import TButton from './components/TButton.vue'
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import
|
|
61
|
-
import
|
|
62
|
-
import
|
|
63
|
-
import
|
|
64
|
-
import
|
|
65
|
-
import
|
|
66
|
-
import
|
|
67
|
-
import
|
|
68
|
-
import
|
|
69
|
-
import
|
|
70
|
-
import
|
|
71
|
-
import
|
|
72
|
-
import
|
|
73
|
-
import
|
|
74
|
-
import
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
export
|
|
152
|
-
export {
|
|
153
|
-
export {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
1
|
+
// Gears UI: Vue components on Tabler. Import the styles once (`@ternarytech-io/gears-ui/styles.css`), then either
|
|
2
|
+
// install the plugin (registers every component globally) or import components one by one.
|
|
3
|
+
// Components that need an optional library have their own entry points, so apps that don't use
|
|
4
|
+
// them don't need the library: `@ternarytech-io/gears-ui/code-editor` (Monaco) and `@ternarytech-io/gears-ui/plugins` (Tom
|
|
5
|
+
// Select, Coloris, Vanilla Calendar Pro, Dropzone, IMask, noUiSlider, SortableJS, HugeRTE).
|
|
6
|
+
import type { App } from 'vue'
|
|
7
|
+
import TAccentPicker from './components/TAccentPicker.vue'
|
|
8
|
+
import TAdvancedTable from './components/TAdvancedTable.vue'
|
|
9
|
+
import TAlert from './components/TAlert.vue'
|
|
10
|
+
import TAppLayout from './components/TAppLayout.vue'
|
|
11
|
+
import TAuthLayout from './components/TAuthLayout.vue'
|
|
12
|
+
import TAvatar from './components/TAvatar.vue'
|
|
13
|
+
import TBadge from './components/TBadge.vue'
|
|
14
|
+
import TButton from './components/TButton.vue'
|
|
15
|
+
import TButtonGroup from './components/TButtonGroup.vue'
|
|
16
|
+
import TCard from './components/TCard.vue'
|
|
17
|
+
import TCheckbox from './components/TCheckbox.vue'
|
|
18
|
+
import TCheckboxTree from './components/TCheckboxTree.vue'
|
|
19
|
+
import TColorModeButton from './components/TColorModeButton.vue'
|
|
20
|
+
import TCommandPalette from './components/TCommandPalette.vue'
|
|
21
|
+
import TContainerPicker from './components/TContainerPicker.vue'
|
|
22
|
+
import TCopyButton from './components/TCopyButton.vue'
|
|
23
|
+
import TDataGrid from './components/TDataGrid.vue'
|
|
24
|
+
import TDataGridItem from './components/TDataGridItem.vue'
|
|
25
|
+
import TDensityPicker from './components/TDensityPicker.vue'
|
|
26
|
+
import TDropdown from './components/TDropdown.vue'
|
|
27
|
+
import TEditableTable from './components/TEditableTable.vue'
|
|
28
|
+
import TEmpty from './components/TEmpty.vue'
|
|
29
|
+
import TFieldGroup from './components/TFieldGroup.vue'
|
|
30
|
+
import TFileUpload from './components/TFileUpload.vue'
|
|
31
|
+
import TFontPicker from './components/TFontPicker.vue'
|
|
32
|
+
import TFormField from './components/TFormField.vue'
|
|
33
|
+
import TIcon from './components/TIcon.vue'
|
|
34
|
+
import TIconPicker from './components/TIconPicker.vue'
|
|
35
|
+
import TImageUpload from './components/TImageUpload.vue'
|
|
36
|
+
import TInput from './components/TInput.vue'
|
|
37
|
+
import TLightbox from './components/TLightbox.vue'
|
|
38
|
+
import TInputNumber from './components/TInputNumber.vue'
|
|
39
|
+
import TInputTags from './components/TInputTags.vue'
|
|
40
|
+
import TListBox from './components/TListBox.vue'
|
|
41
|
+
import TLogView from './components/TLogView.vue'
|
|
42
|
+
import TModal from './components/TModal.vue'
|
|
43
|
+
import TNav from './components/TNav.vue'
|
|
44
|
+
import TNavPositionPicker from './components/TNavPositionPicker.vue'
|
|
45
|
+
import TPage from './components/TPage.vue'
|
|
46
|
+
import TPagination from './components/TPagination.vue'
|
|
47
|
+
import TPanelList from './components/TPanelList.vue'
|
|
48
|
+
import TProgress from './components/TProgress.vue'
|
|
49
|
+
import TRadioGroup from './components/TRadioGroup.vue'
|
|
50
|
+
import TRadiusPicker from './components/TRadiusPicker.vue'
|
|
51
|
+
import TRating from './components/TRating.vue'
|
|
52
|
+
import TScaledFrame from './components/TScaledFrame.vue'
|
|
53
|
+
import TSearchButton from './components/TSearchButton.vue'
|
|
54
|
+
import TSectionLayout from './components/TSectionLayout.vue'
|
|
55
|
+
import TSelect from './components/TSelect.vue'
|
|
56
|
+
import TSelectMenu from './components/TSelectMenu.vue'
|
|
57
|
+
import TSeparator from './components/TSeparator.vue'
|
|
58
|
+
import TShell from './components/TShell.vue'
|
|
59
|
+
import TSkeleton from './components/TSkeleton.vue'
|
|
60
|
+
import TSlideover from './components/TSlideover.vue'
|
|
61
|
+
import TSparkline from './components/TSparkline.vue'
|
|
62
|
+
import TSpinner from './components/TSpinner.vue'
|
|
63
|
+
import TSplitButton from './components/TSplitButton.vue'
|
|
64
|
+
import TSplitter from './components/TSplitter.vue'
|
|
65
|
+
import TStatCard from './components/TStatCard.vue'
|
|
66
|
+
import TSteps from './components/TSteps.vue'
|
|
67
|
+
import TSwitch from './components/TSwitch.vue'
|
|
68
|
+
import TTable from './components/TTable.vue'
|
|
69
|
+
import TTabs from './components/TTabs.vue'
|
|
70
|
+
import TTextarea from './components/TTextarea.vue'
|
|
71
|
+
import TThemeBasePicker from './components/TThemeBasePicker.vue'
|
|
72
|
+
import TThemeScope from './components/TThemeScope.vue'
|
|
73
|
+
import TToaster from './components/TToaster.vue'
|
|
74
|
+
import TTooltip from './components/TTooltip.vue'
|
|
75
|
+
import TTopbar from './components/TTopbar.vue'
|
|
76
|
+
import TVectorMap from './components/TVectorMap.vue'
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
TAccentPicker,
|
|
80
|
+
TAdvancedTable,
|
|
81
|
+
TAlert,
|
|
82
|
+
TAppLayout,
|
|
83
|
+
TAuthLayout,
|
|
84
|
+
TAvatar,
|
|
85
|
+
TBadge,
|
|
86
|
+
TButton,
|
|
87
|
+
TButtonGroup,
|
|
88
|
+
TCard,
|
|
89
|
+
TCheckbox,
|
|
90
|
+
TCheckboxTree,
|
|
91
|
+
TColorModeButton,
|
|
92
|
+
TCommandPalette,
|
|
93
|
+
TContainerPicker,
|
|
94
|
+
TCopyButton,
|
|
95
|
+
TDataGrid,
|
|
96
|
+
TDataGridItem,
|
|
97
|
+
TDensityPicker,
|
|
98
|
+
TDropdown,
|
|
99
|
+
TEditableTable,
|
|
100
|
+
TEmpty,
|
|
101
|
+
TFieldGroup,
|
|
102
|
+
TFileUpload,
|
|
103
|
+
TFontPicker,
|
|
104
|
+
TFormField,
|
|
105
|
+
TIcon,
|
|
106
|
+
TIconPicker,
|
|
107
|
+
TImageUpload,
|
|
108
|
+
TInput,
|
|
109
|
+
TInputNumber,
|
|
110
|
+
TLightbox,
|
|
111
|
+
TInputTags,
|
|
112
|
+
TListBox,
|
|
113
|
+
TLogView,
|
|
114
|
+
TModal,
|
|
115
|
+
TNav,
|
|
116
|
+
TNavPositionPicker,
|
|
117
|
+
TPage,
|
|
118
|
+
TPagination,
|
|
119
|
+
TPanelList,
|
|
120
|
+
TProgress,
|
|
121
|
+
TRadioGroup,
|
|
122
|
+
TRadiusPicker,
|
|
123
|
+
TRating,
|
|
124
|
+
TScaledFrame,
|
|
125
|
+
TSearchButton,
|
|
126
|
+
TSectionLayout,
|
|
127
|
+
TSelect,
|
|
128
|
+
TSelectMenu,
|
|
129
|
+
TSeparator,
|
|
130
|
+
TShell,
|
|
131
|
+
TSkeleton,
|
|
132
|
+
TSlideover,
|
|
133
|
+
TSparkline,
|
|
134
|
+
TSpinner,
|
|
135
|
+
TSplitButton,
|
|
136
|
+
TSplitter,
|
|
137
|
+
TStatCard,
|
|
138
|
+
TSteps,
|
|
139
|
+
TSwitch,
|
|
140
|
+
TTable,
|
|
141
|
+
TTabs,
|
|
142
|
+
TTextarea,
|
|
143
|
+
TThemeBasePicker,
|
|
144
|
+
TThemeScope,
|
|
145
|
+
TToaster,
|
|
146
|
+
TTooltip,
|
|
147
|
+
TTopbar,
|
|
148
|
+
TVectorMap
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export * from './types'
|
|
152
|
+
export type { LightboxImage } from './components/TLightbox.vue'
|
|
153
|
+
export { isCustomAccent, themeAccents, themeBases, themeContainers, themeDensities, themeFonts, themeNavs, themeRadii, themeRadiusSizes } from './theme'
|
|
154
|
+
export { useColorMode, type ColorMode } from './composables/useColorMode'
|
|
155
|
+
export { useCommandPalette } from './composables/useCommandPalette'
|
|
156
|
+
export { useField } from './composables/useField'
|
|
157
|
+
export { useToast, type Toast, type ToastPosition } from './composables/useToast'
|
|
158
|
+
|
|
159
|
+
const components = {
|
|
160
|
+
TAccentPicker, TAdvancedTable, TAlert, TAppLayout, TAuthLayout, TAvatar, TBadge, TButton, TButtonGroup, TCard,
|
|
161
|
+
TCheckbox, TCheckboxTree, TColorModeButton, TCommandPalette, TContainerPicker, TCopyButton, TDataGrid, TDataGridItem, TDensityPicker,
|
|
162
|
+
TDropdown, TEditableTable, TEmpty, TFieldGroup, TFileUpload, TFontPicker, TFormField, TIcon, TIconPicker, TImageUpload,
|
|
163
|
+
TInput, TInputNumber, TInputTags, TLightbox, TListBox, TLogView, TModal, TNav, TNavPositionPicker, TPage, TPagination,
|
|
164
|
+
TPanelList, TProgress, TRadioGroup, TRadiusPicker, TRating, TScaledFrame, TSearchButton, TSectionLayout,
|
|
165
|
+
TSelect, TSelectMenu, TSeparator, TShell, TSkeleton, TSlideover, TSparkline, TSpinner, TSplitButton, TSplitter, TStatCard,
|
|
166
|
+
TSteps, TSwitch, TTable, TTabs, TTextarea, TThemeBasePicker, TThemeScope, TToaster, TTooltip,
|
|
167
|
+
TTopbar, TVectorMap
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export default {
|
|
171
|
+
install(app: App) {
|
|
172
|
+
for (const [name, component] of Object.entries(components)) app.component(name, component)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare module 'vue' {
|
|
177
|
+
export interface GlobalComponents {
|
|
178
|
+
TAccentPicker: typeof TAccentPicker
|
|
179
|
+
TAdvancedTable: typeof TAdvancedTable
|
|
180
|
+
TAlert: typeof TAlert
|
|
181
|
+
TAppLayout: typeof TAppLayout
|
|
182
|
+
TAuthLayout: typeof TAuthLayout
|
|
183
|
+
TAvatar: typeof TAvatar
|
|
184
|
+
TBadge: typeof TBadge
|
|
185
|
+
TButton: typeof TButton
|
|
186
|
+
TButtonGroup: typeof TButtonGroup
|
|
187
|
+
TCard: typeof TCard
|
|
188
|
+
TCheckbox: typeof TCheckbox
|
|
189
|
+
TCheckboxTree: typeof TCheckboxTree
|
|
190
|
+
TColorModeButton: typeof TColorModeButton
|
|
191
|
+
TCommandPalette: typeof TCommandPalette
|
|
192
|
+
TContainerPicker: typeof TContainerPicker
|
|
193
|
+
TCopyButton: typeof TCopyButton
|
|
194
|
+
TDataGrid: typeof TDataGrid
|
|
195
|
+
TDataGridItem: typeof TDataGridItem
|
|
196
|
+
TDensityPicker: typeof TDensityPicker
|
|
197
|
+
TDropdown: typeof TDropdown
|
|
198
|
+
TEditableTable: typeof TEditableTable
|
|
199
|
+
TEmpty: typeof TEmpty
|
|
200
|
+
TFieldGroup: typeof TFieldGroup
|
|
201
|
+
TFileUpload: typeof TFileUpload
|
|
202
|
+
TFontPicker: typeof TFontPicker
|
|
203
|
+
TFormField: typeof TFormField
|
|
204
|
+
TIcon: typeof TIcon
|
|
205
|
+
TIconPicker: typeof TIconPicker
|
|
206
|
+
TImageUpload: typeof TImageUpload
|
|
207
|
+
TInput: typeof TInput
|
|
208
|
+
TLightbox: typeof TLightbox
|
|
209
|
+
TInputNumber: typeof TInputNumber
|
|
210
|
+
TInputTags: typeof TInputTags
|
|
211
|
+
TListBox: typeof TListBox
|
|
212
|
+
TLogView: typeof TLogView
|
|
213
|
+
TModal: typeof TModal
|
|
214
|
+
TNav: typeof TNav
|
|
215
|
+
TNavPositionPicker: typeof TNavPositionPicker
|
|
216
|
+
TPage: typeof TPage
|
|
217
|
+
TPagination: typeof TPagination
|
|
218
|
+
TPanelList: typeof TPanelList
|
|
219
|
+
TProgress: typeof TProgress
|
|
220
|
+
TRadioGroup: typeof TRadioGroup
|
|
221
|
+
TRadiusPicker: typeof TRadiusPicker
|
|
222
|
+
TRating: typeof TRating
|
|
223
|
+
TScaledFrame: typeof TScaledFrame
|
|
224
|
+
TSearchButton: typeof TSearchButton
|
|
225
|
+
TSectionLayout: typeof TSectionLayout
|
|
226
|
+
TSelect: typeof TSelect
|
|
227
|
+
TSelectMenu: typeof TSelectMenu
|
|
228
|
+
TSeparator: typeof TSeparator
|
|
229
|
+
TShell: typeof TShell
|
|
230
|
+
TSkeleton: typeof TSkeleton
|
|
231
|
+
TSlideover: typeof TSlideover
|
|
232
|
+
TSparkline: typeof TSparkline
|
|
233
|
+
TSpinner: typeof TSpinner
|
|
234
|
+
TSplitButton: typeof TSplitButton
|
|
235
|
+
TSplitter: typeof TSplitter
|
|
236
|
+
TStatCard: typeof TStatCard
|
|
237
|
+
TSteps: typeof TSteps
|
|
238
|
+
TSwitch: typeof TSwitch
|
|
239
|
+
TTable: typeof TTable
|
|
240
|
+
TTabs: typeof TTabs
|
|
241
|
+
TTextarea: typeof TTextarea
|
|
242
|
+
TThemeBasePicker: typeof TThemeBasePicker
|
|
243
|
+
TThemeScope: typeof TThemeScope
|
|
244
|
+
TToaster: typeof TToaster
|
|
245
|
+
TTooltip: typeof TTooltip
|
|
246
|
+
TTopbar: typeof TTopbar
|
|
247
|
+
TVectorMap: typeof TVectorMap
|
|
248
|
+
}
|
|
249
|
+
}
|
package/src/monaco.ts
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
|
-
// Monaco, set up once: bundled web workers (no CDN; Gears may run offline) and light and dark
|
|
2
|
-
// themes on the Gears palette. TCodeEditor loads this the first time an editor is shown, so apps
|
|
3
|
-
// that never show one don't download Monaco.
|
|
4
|
-
import * as monaco from 'monaco-editor'
|
|
5
|
-
import EditorWorker from 'monaco-editor/editor/editor.worker?worker'
|
|
6
|
-
import JsonWorker from 'monaco-editor/languages/features/json/json.worker?worker'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
// Monaco, set up once: bundled web workers (no CDN; Gears may run offline) and light and dark
|
|
2
|
+
// themes on the Gears palette. TCodeEditor loads this the first time an editor is shown, so apps
|
|
3
|
+
// that never show one don't download Monaco.
|
|
4
|
+
import * as monaco from 'monaco-editor'
|
|
5
|
+
import EditorWorker from 'monaco-editor/editor/editor.worker?worker'
|
|
6
|
+
import JsonWorker from 'monaco-editor/languages/features/json/json.worker?worker'
|
|
7
|
+
import CssWorker from 'monaco-editor/languages/features/css/css.worker?worker'
|
|
8
|
+
import HtmlWorker from 'monaco-editor/languages/features/html/html.worker?worker'
|
|
9
|
+
import TsWorker from 'monaco-editor/languages/features/typescript/ts.worker?worker'
|
|
10
|
+
|
|
11
|
+
// Each language service has its own worker (the editor's can't answer an HTML or CSS editor's
|
|
12
|
+
// requests); each loads only when an editor in its language is shown.
|
|
13
|
+
self.MonacoEnvironment = {
|
|
14
|
+
getWorker(_id: string, label: string) {
|
|
15
|
+
switch (label) {
|
|
16
|
+
case 'json': return new JsonWorker()
|
|
17
|
+
case 'css': case 'scss': case 'less': return new CssWorker()
|
|
18
|
+
case 'html': case 'handlebars': case 'razor': return new HtmlWorker()
|
|
19
|
+
case 'typescript': case 'javascript': return new TsWorker()
|
|
20
|
+
default: return new EditorWorker()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
monaco.editor.defineTheme('gears-light', {
|
|
26
|
+
base: 'vs',
|
|
27
|
+
inherit: true,
|
|
28
|
+
rules: [],
|
|
29
|
+
colors: { 'editor.background': '#ffffff', 'editorLineNumber.foreground': '#a2a8b1', 'editor.lineHighlightBackground': '#f6f7f9' }
|
|
30
|
+
})
|
|
31
|
+
monaco.editor.defineTheme('gears-dark', {
|
|
32
|
+
base: 'vs-dark',
|
|
33
|
+
inherit: true,
|
|
34
|
+
rules: [],
|
|
35
|
+
colors: { 'editor.background': '#232525', 'editorLineNumber.foreground': '#5d6470', 'editor.lineHighlightBackground': '#2c2f2f' }
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export default monaco
|