@ternarytech-io/gears-ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +161 -3
- package/package.json +111 -6
- package/src/code-editor.ts +25 -0
- package/src/components/TAccentPicker.vue +41 -0
- package/src/components/TAdvancedSelect.vue +128 -0
- package/src/components/TAdvancedTable.vue +130 -0
- package/src/components/TAlert.vue +41 -0
- package/src/components/TAppLayout.vue +76 -0
- package/src/components/TAuthLayout.vue +32 -0
- package/src/components/TAvatar.vue +28 -0
- package/src/components/TBadge.vue +29 -0
- package/src/components/TButton.vue +60 -0
- package/src/components/TCard.vue +40 -0
- package/src/components/TCheckbox.vue +29 -0
- package/src/components/TCodeEditor.vue +128 -0
- package/src/components/TColorModeButton.vue +14 -0
- package/src/components/TColorPicker.vue +61 -0
- package/src/components/TCommandPalette.vue +109 -0
- package/src/components/TContainerPicker.vue +22 -0
- package/src/components/TCopyButton.vue +72 -0
- package/src/components/TDatePicker.vue +83 -0
- package/src/components/TDensityPicker.vue +19 -0
- package/src/components/TDropdown.vue +76 -0
- package/src/components/TDropzone.vue +76 -0
- package/src/components/TEmpty.vue +21 -0
- package/src/components/TFieldGroup.vue +11 -0
- package/src/components/TFileUpload.vue +92 -0
- package/src/components/TFontPicker.vue +23 -0
- package/src/components/TFormField.vue +40 -0
- package/src/components/TIcon.vue +12 -0
- package/src/components/TImageUpload.vue +131 -0
- package/src/components/TInput.vue +52 -0
- package/src/components/TInputMask.vue +70 -0
- package/src/components/TInputNumber.vue +62 -0
- package/src/components/TInputTags.vue +53 -0
- package/src/components/TLogView.vue +39 -0
- package/src/components/TModal.vue +54 -0
- package/src/components/TNav.vue +75 -0
- package/src/components/TNavPositionPicker.vue +22 -0
- package/src/components/TPage.vue +48 -0
- package/src/components/TPagination.vue +44 -0
- package/src/components/TPanelList.vue +29 -0
- package/src/components/TProgress.vue +18 -0
- package/src/components/TRadioGroup.vue +68 -0
- package/src/components/TRadiusPicker.vue +21 -0
- package/src/components/TRangeSlider.vue +63 -0
- package/src/components/TRichEditor.vue +82 -0
- package/src/components/TScaledFrame.vue +36 -0
- package/src/components/TSearchButton.vue +20 -0
- package/src/components/TSectionLayout.vue +37 -0
- package/src/components/TSelect.vue +60 -0
- package/src/components/TSelectMenu.vue +126 -0
- package/src/components/TSeparator.vue +10 -0
- package/src/components/TShell.vue +72 -0
- package/src/components/TSkeleton.vue +17 -0
- package/src/components/TSlideover.vue +47 -0
- package/src/components/TSortable.vue +61 -0
- package/src/components/TSortableTree.vue +73 -0
- package/src/components/TSortableTreeList.vue +60 -0
- package/src/components/TSpinner.vue +14 -0
- package/src/components/TSplitter.vue +85 -0
- package/src/components/TStatCard.vue +26 -0
- package/src/components/TSteps.vue +19 -0
- package/src/components/TSwitch.vue +18 -0
- package/src/components/TTable.vue +134 -0
- package/src/components/TTabs.vue +38 -0
- package/src/components/TTextarea.vue +42 -0
- package/src/components/TThemeBasePicker.vue +22 -0
- package/src/components/TThemeScope.vue +23 -0
- package/src/components/TToaster.vue +27 -0
- package/src/components/TTooltip.vue +33 -0
- package/src/components/TTopbar.vue +17 -0
- package/src/components/TVectorMap.vue +74 -0
- package/src/components/sortableTree.ts +19 -0
- package/src/composables/useColorMode.ts +41 -0
- package/src/composables/useCommandPalette.ts +11 -0
- package/src/composables/useField.ts +26 -0
- package/src/composables/useOverlay.ts +55 -0
- package/src/composables/useToast.ts +33 -0
- package/src/index.ts +215 -0
- package/src/monaco.ts +27 -0
- package/src/plugins/coloris.ts +8 -0
- package/src/plugins/datepicker.ts +7 -0
- package/src/plugins/dropzone.ts +5 -0
- package/src/plugins/index.ts +52 -0
- package/src/plugins/inputMask.ts +7 -0
- package/src/plugins/once.ts +8 -0
- package/src/plugins/richEditor.ts +37 -0
- package/src/plugins/slider.ts +4 -0
- package/src/plugins/sortable.ts +7 -0
- package/src/plugins/tomSelect.ts +4 -0
- package/src/shims.d.ts +17 -0
- package/src/styles/gears.css +625 -0
- package/src/styles/plugins.css +10 -0
- package/src/theme.ts +45 -0
- package/src/types.ts +177 -0
- package/src/vectorMap.ts +14 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
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 TCard from './components/TCard.vue'
|
|
16
|
+
import TCheckbox from './components/TCheckbox.vue'
|
|
17
|
+
import TColorModeButton from './components/TColorModeButton.vue'
|
|
18
|
+
import TCommandPalette from './components/TCommandPalette.vue'
|
|
19
|
+
import TContainerPicker from './components/TContainerPicker.vue'
|
|
20
|
+
import TCopyButton from './components/TCopyButton.vue'
|
|
21
|
+
import TDensityPicker from './components/TDensityPicker.vue'
|
|
22
|
+
import TDropdown from './components/TDropdown.vue'
|
|
23
|
+
import TEmpty from './components/TEmpty.vue'
|
|
24
|
+
import TFieldGroup from './components/TFieldGroup.vue'
|
|
25
|
+
import TFileUpload from './components/TFileUpload.vue'
|
|
26
|
+
import TFontPicker from './components/TFontPicker.vue'
|
|
27
|
+
import TFormField from './components/TFormField.vue'
|
|
28
|
+
import TIcon from './components/TIcon.vue'
|
|
29
|
+
import TImageUpload from './components/TImageUpload.vue'
|
|
30
|
+
import TInput from './components/TInput.vue'
|
|
31
|
+
import TInputNumber from './components/TInputNumber.vue'
|
|
32
|
+
import TInputTags from './components/TInputTags.vue'
|
|
33
|
+
import TLogView from './components/TLogView.vue'
|
|
34
|
+
import TModal from './components/TModal.vue'
|
|
35
|
+
import TNav from './components/TNav.vue'
|
|
36
|
+
import TNavPositionPicker from './components/TNavPositionPicker.vue'
|
|
37
|
+
import TPage from './components/TPage.vue'
|
|
38
|
+
import TPagination from './components/TPagination.vue'
|
|
39
|
+
import TPanelList from './components/TPanelList.vue'
|
|
40
|
+
import TProgress from './components/TProgress.vue'
|
|
41
|
+
import TRadioGroup from './components/TRadioGroup.vue'
|
|
42
|
+
import TRadiusPicker from './components/TRadiusPicker.vue'
|
|
43
|
+
import TScaledFrame from './components/TScaledFrame.vue'
|
|
44
|
+
import TSearchButton from './components/TSearchButton.vue'
|
|
45
|
+
import TSectionLayout from './components/TSectionLayout.vue'
|
|
46
|
+
import TSelect from './components/TSelect.vue'
|
|
47
|
+
import TSelectMenu from './components/TSelectMenu.vue'
|
|
48
|
+
import TSeparator from './components/TSeparator.vue'
|
|
49
|
+
import TShell from './components/TShell.vue'
|
|
50
|
+
import TSkeleton from './components/TSkeleton.vue'
|
|
51
|
+
import TSlideover from './components/TSlideover.vue'
|
|
52
|
+
import TSpinner from './components/TSpinner.vue'
|
|
53
|
+
import TSplitter from './components/TSplitter.vue'
|
|
54
|
+
import TStatCard from './components/TStatCard.vue'
|
|
55
|
+
import TSteps from './components/TSteps.vue'
|
|
56
|
+
import TSwitch from './components/TSwitch.vue'
|
|
57
|
+
import TTable from './components/TTable.vue'
|
|
58
|
+
import TTabs from './components/TTabs.vue'
|
|
59
|
+
import TTextarea from './components/TTextarea.vue'
|
|
60
|
+
import TThemeBasePicker from './components/TThemeBasePicker.vue'
|
|
61
|
+
import TThemeScope from './components/TThemeScope.vue'
|
|
62
|
+
import TToaster from './components/TToaster.vue'
|
|
63
|
+
import TTooltip from './components/TTooltip.vue'
|
|
64
|
+
import TTopbar from './components/TTopbar.vue'
|
|
65
|
+
import TVectorMap from './components/TVectorMap.vue'
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
TAccentPicker,
|
|
69
|
+
TAdvancedTable,
|
|
70
|
+
TAlert,
|
|
71
|
+
TAppLayout,
|
|
72
|
+
TAuthLayout,
|
|
73
|
+
TAvatar,
|
|
74
|
+
TBadge,
|
|
75
|
+
TButton,
|
|
76
|
+
TCard,
|
|
77
|
+
TCheckbox,
|
|
78
|
+
TColorModeButton,
|
|
79
|
+
TCommandPalette,
|
|
80
|
+
TContainerPicker,
|
|
81
|
+
TCopyButton,
|
|
82
|
+
TDensityPicker,
|
|
83
|
+
TDropdown,
|
|
84
|
+
TEmpty,
|
|
85
|
+
TFieldGroup,
|
|
86
|
+
TFileUpload,
|
|
87
|
+
TFontPicker,
|
|
88
|
+
TFormField,
|
|
89
|
+
TIcon,
|
|
90
|
+
TImageUpload,
|
|
91
|
+
TInput,
|
|
92
|
+
TInputNumber,
|
|
93
|
+
TInputTags,
|
|
94
|
+
TLogView,
|
|
95
|
+
TModal,
|
|
96
|
+
TNav,
|
|
97
|
+
TNavPositionPicker,
|
|
98
|
+
TPage,
|
|
99
|
+
TPagination,
|
|
100
|
+
TPanelList,
|
|
101
|
+
TProgress,
|
|
102
|
+
TRadioGroup,
|
|
103
|
+
TRadiusPicker,
|
|
104
|
+
TScaledFrame,
|
|
105
|
+
TSearchButton,
|
|
106
|
+
TSectionLayout,
|
|
107
|
+
TSelect,
|
|
108
|
+
TSelectMenu,
|
|
109
|
+
TSeparator,
|
|
110
|
+
TShell,
|
|
111
|
+
TSkeleton,
|
|
112
|
+
TSlideover,
|
|
113
|
+
TSpinner,
|
|
114
|
+
TSplitter,
|
|
115
|
+
TStatCard,
|
|
116
|
+
TSteps,
|
|
117
|
+
TSwitch,
|
|
118
|
+
TTable,
|
|
119
|
+
TTabs,
|
|
120
|
+
TTextarea,
|
|
121
|
+
TThemeBasePicker,
|
|
122
|
+
TThemeScope,
|
|
123
|
+
TToaster,
|
|
124
|
+
TTooltip,
|
|
125
|
+
TTopbar,
|
|
126
|
+
TVectorMap
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export * from './types'
|
|
130
|
+
export { isCustomAccent, themeAccents, themeBases, themeContainers, themeDensities, themeFonts, themeNavs, themeRadii } from './theme'
|
|
131
|
+
export { useColorMode, type ColorMode } from './composables/useColorMode'
|
|
132
|
+
export { useCommandPalette } from './composables/useCommandPalette'
|
|
133
|
+
export { useField } from './composables/useField'
|
|
134
|
+
export { useToast, type Toast } from './composables/useToast'
|
|
135
|
+
|
|
136
|
+
const components = {
|
|
137
|
+
TAccentPicker, TAdvancedTable, TAlert, TAppLayout, TAuthLayout, TAvatar, TBadge, TButton, TCard,
|
|
138
|
+
TCheckbox, TColorModeButton, TCommandPalette, TContainerPicker, TCopyButton, TDensityPicker,
|
|
139
|
+
TDropdown, TEmpty, TFieldGroup, TFileUpload, TFontPicker, TFormField, TIcon, TImageUpload,
|
|
140
|
+
TInput, TInputNumber, TInputTags, TLogView, TModal, TNav, TNavPositionPicker, TPage, TPagination,
|
|
141
|
+
TPanelList, TProgress, TRadioGroup, TRadiusPicker, TScaledFrame, TSearchButton, TSectionLayout,
|
|
142
|
+
TSelect, TSelectMenu, TSeparator, TShell, TSkeleton, TSlideover, TSpinner, TSplitter, TStatCard,
|
|
143
|
+
TSteps, TSwitch, TTable, TTabs, TTextarea, TThemeBasePicker, TThemeScope, TToaster, TTooltip,
|
|
144
|
+
TTopbar, TVectorMap
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export default {
|
|
148
|
+
install(app: App) {
|
|
149
|
+
for (const [name, component] of Object.entries(components)) app.component(name, component)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare module 'vue' {
|
|
154
|
+
export interface GlobalComponents {
|
|
155
|
+
TAccentPicker: typeof TAccentPicker
|
|
156
|
+
TAdvancedTable: typeof TAdvancedTable
|
|
157
|
+
TAlert: typeof TAlert
|
|
158
|
+
TAppLayout: typeof TAppLayout
|
|
159
|
+
TAuthLayout: typeof TAuthLayout
|
|
160
|
+
TAvatar: typeof TAvatar
|
|
161
|
+
TBadge: typeof TBadge
|
|
162
|
+
TButton: typeof TButton
|
|
163
|
+
TCard: typeof TCard
|
|
164
|
+
TCheckbox: typeof TCheckbox
|
|
165
|
+
TColorModeButton: typeof TColorModeButton
|
|
166
|
+
TCommandPalette: typeof TCommandPalette
|
|
167
|
+
TContainerPicker: typeof TContainerPicker
|
|
168
|
+
TCopyButton: typeof TCopyButton
|
|
169
|
+
TDensityPicker: typeof TDensityPicker
|
|
170
|
+
TDropdown: typeof TDropdown
|
|
171
|
+
TEmpty: typeof TEmpty
|
|
172
|
+
TFieldGroup: typeof TFieldGroup
|
|
173
|
+
TFileUpload: typeof TFileUpload
|
|
174
|
+
TFontPicker: typeof TFontPicker
|
|
175
|
+
TFormField: typeof TFormField
|
|
176
|
+
TIcon: typeof TIcon
|
|
177
|
+
TImageUpload: typeof TImageUpload
|
|
178
|
+
TInput: typeof TInput
|
|
179
|
+
TInputNumber: typeof TInputNumber
|
|
180
|
+
TInputTags: typeof TInputTags
|
|
181
|
+
TLogView: typeof TLogView
|
|
182
|
+
TModal: typeof TModal
|
|
183
|
+
TNav: typeof TNav
|
|
184
|
+
TNavPositionPicker: typeof TNavPositionPicker
|
|
185
|
+
TPage: typeof TPage
|
|
186
|
+
TPagination: typeof TPagination
|
|
187
|
+
TPanelList: typeof TPanelList
|
|
188
|
+
TProgress: typeof TProgress
|
|
189
|
+
TRadioGroup: typeof TRadioGroup
|
|
190
|
+
TRadiusPicker: typeof TRadiusPicker
|
|
191
|
+
TScaledFrame: typeof TScaledFrame
|
|
192
|
+
TSearchButton: typeof TSearchButton
|
|
193
|
+
TSectionLayout: typeof TSectionLayout
|
|
194
|
+
TSelect: typeof TSelect
|
|
195
|
+
TSelectMenu: typeof TSelectMenu
|
|
196
|
+
TSeparator: typeof TSeparator
|
|
197
|
+
TShell: typeof TShell
|
|
198
|
+
TSkeleton: typeof TSkeleton
|
|
199
|
+
TSlideover: typeof TSlideover
|
|
200
|
+
TSpinner: typeof TSpinner
|
|
201
|
+
TSplitter: typeof TSplitter
|
|
202
|
+
TStatCard: typeof TStatCard
|
|
203
|
+
TSteps: typeof TSteps
|
|
204
|
+
TSwitch: typeof TSwitch
|
|
205
|
+
TTable: typeof TTable
|
|
206
|
+
TTabs: typeof TTabs
|
|
207
|
+
TTextarea: typeof TTextarea
|
|
208
|
+
TThemeBasePicker: typeof TThemeBasePicker
|
|
209
|
+
TThemeScope: typeof TThemeScope
|
|
210
|
+
TToaster: typeof TToaster
|
|
211
|
+
TTooltip: typeof TTooltip
|
|
212
|
+
TTopbar: typeof TTopbar
|
|
213
|
+
TVectorMap: typeof TVectorMap
|
|
214
|
+
}
|
|
215
|
+
}
|
package/src/monaco.ts
ADDED
|
@@ -0,0 +1,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
|
+
|
|
8
|
+
self.MonacoEnvironment = {
|
|
9
|
+
getWorker(_id: string, label: string) {
|
|
10
|
+
return label === 'json' ? new JsonWorker() : new EditorWorker()
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
monaco.editor.defineTheme('gears-light', {
|
|
15
|
+
base: 'vs',
|
|
16
|
+
inherit: true,
|
|
17
|
+
rules: [],
|
|
18
|
+
colors: { 'editor.background': '#ffffff', 'editorLineNumber.foreground': '#a2a8b1', 'editor.lineHighlightBackground': '#f6f7f9' }
|
|
19
|
+
})
|
|
20
|
+
monaco.editor.defineTheme('gears-dark', {
|
|
21
|
+
base: 'vs-dark',
|
|
22
|
+
inherit: true,
|
|
23
|
+
rules: [],
|
|
24
|
+
colors: { 'editor.background': '#232525', 'editorLineNumber.foreground': '#5d6470', 'editor.lineHighlightBackground': '#2c2f2f' }
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export default monaco
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Loads Vanilla Calendar Pro and Tabler's date picker, the first time a TDatePicker is shown.
|
|
2
|
+
import { globals, once } from './once'
|
|
3
|
+
|
|
4
|
+
export const loadDatepicker = once(async () => {
|
|
5
|
+
globals.VanillaCalendarPro = await import('vanilla-calendar-pro')
|
|
6
|
+
return (await import('@tabler/core')).Datepicker
|
|
7
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Gears UI's plugin components, on the libraries Tabler's plugins use. Each library is an optional
|
|
2
|
+
// peer dependency that loads the first time its component is shown. Installing this plugin needs
|
|
3
|
+
// all of them; to use only some, import those components from `@ternarytech-io/gears-ui/components/…` instead.
|
|
4
|
+
import type { App } from 'vue'
|
|
5
|
+
import TAdvancedSelect from '../components/TAdvancedSelect.vue'
|
|
6
|
+
import TColorPicker from '../components/TColorPicker.vue'
|
|
7
|
+
import TDatePicker from '../components/TDatePicker.vue'
|
|
8
|
+
import TDropzone from '../components/TDropzone.vue'
|
|
9
|
+
import TInputMask from '../components/TInputMask.vue'
|
|
10
|
+
import TRangeSlider from '../components/TRangeSlider.vue'
|
|
11
|
+
import TRichEditor from '../components/TRichEditor.vue'
|
|
12
|
+
import TSortable from '../components/TSortable.vue'
|
|
13
|
+
import TSortableTree from '../components/TSortableTree.vue'
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
TAdvancedSelect,
|
|
17
|
+
TColorPicker,
|
|
18
|
+
TDatePicker,
|
|
19
|
+
TDropzone,
|
|
20
|
+
TInputMask,
|
|
21
|
+
TRangeSlider,
|
|
22
|
+
TRichEditor,
|
|
23
|
+
TSortable,
|
|
24
|
+
TSortableTree
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type { RichEditorPlugin } from './richEditor'
|
|
28
|
+
|
|
29
|
+
const components = {
|
|
30
|
+
TAdvancedSelect, TColorPicker, TDatePicker, TDropzone, TInputMask, TRangeSlider, TRichEditor,
|
|
31
|
+
TSortable, TSortableTree
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const GearsUIPlugins = {
|
|
35
|
+
install(app: App) {
|
|
36
|
+
for (const [name, component] of Object.entries(components)) app.component(name, component)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare module 'vue' {
|
|
41
|
+
export interface GlobalComponents {
|
|
42
|
+
TAdvancedSelect: typeof TAdvancedSelect
|
|
43
|
+
TColorPicker: typeof TColorPicker
|
|
44
|
+
TDatePicker: typeof TDatePicker
|
|
45
|
+
TDropzone: typeof TDropzone
|
|
46
|
+
TInputMask: typeof TInputMask
|
|
47
|
+
TRangeSlider: typeof TRangeSlider
|
|
48
|
+
TRichEditor: typeof TRichEditor
|
|
49
|
+
TSortable: typeof TSortable
|
|
50
|
+
TSortableTree: typeof TSortableTree
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Loads IMask and Tabler's input mask, the first time a TInputMask is shown.
|
|
2
|
+
import { globals, once } from './once'
|
|
3
|
+
|
|
4
|
+
export const loadInputMask = once(async () => {
|
|
5
|
+
globals.IMask = (await import('imask')).default
|
|
6
|
+
return (await import('@tabler/core')).InputMask
|
|
7
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Runs a loader once; later calls get the same promise.
|
|
2
|
+
export function once<T>(load: () => Promise<T>) {
|
|
3
|
+
let promise: Promise<T> | undefined
|
|
4
|
+
return () => promise ??= load()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Tabler's wrappers for the date picker, input mask and sortable find their library on `window`.
|
|
8
|
+
export const globals = window as unknown as { VanillaCalendarPro?: unknown; IMask?: unknown; Sortable?: unknown }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference path="../shims.d.ts" />
|
|
2
|
+
import { once } from './once'
|
|
3
|
+
|
|
4
|
+
// HugeRTE with everything bundled: theme, model, icons, both skins and both content styles, and
|
|
5
|
+
// the plugins TRichEditor offers. Skins are registered as resources, so nothing is fetched.
|
|
6
|
+
export const richEditorPlugins = {
|
|
7
|
+
advlist: () => import('hugerte/plugins/advlist'),
|
|
8
|
+
autolink: () => import('hugerte/plugins/autolink'),
|
|
9
|
+
autoresize: () => import('hugerte/plugins/autoresize'),
|
|
10
|
+
code: () => import('hugerte/plugins/code'),
|
|
11
|
+
codesample: () => import('hugerte/plugins/codesample'),
|
|
12
|
+
fullscreen: () => import('hugerte/plugins/fullscreen'),
|
|
13
|
+
image: () => import('hugerte/plugins/image'),
|
|
14
|
+
link: () => import('hugerte/plugins/link'),
|
|
15
|
+
lists: () => import('hugerte/plugins/lists'),
|
|
16
|
+
searchreplace: () => import('hugerte/plugins/searchreplace'),
|
|
17
|
+
table: () => import('hugerte/plugins/table'),
|
|
18
|
+
wordcount: () => import('hugerte/plugins/wordcount')
|
|
19
|
+
}
|
|
20
|
+
export type RichEditorPlugin = keyof typeof richEditorPlugins
|
|
21
|
+
|
|
22
|
+
export const loadRichEditor = once(async () => {
|
|
23
|
+
const hugerte = (await import('hugerte')).default
|
|
24
|
+
await Promise.all([
|
|
25
|
+
import('hugerte/models/dom'),
|
|
26
|
+
import('hugerte/themes/silver'),
|
|
27
|
+
import('hugerte/icons/default'),
|
|
28
|
+
import('hugerte/skins/ui/oxide/skin.js'),
|
|
29
|
+
import('hugerte/skins/ui/oxide/content.js'),
|
|
30
|
+
import('hugerte/skins/ui/oxide-dark/skin.js'),
|
|
31
|
+
import('hugerte/skins/ui/oxide-dark/content.js'),
|
|
32
|
+
import('hugerte/skins/content/default/content.js'),
|
|
33
|
+
import('hugerte/skins/content/dark/content.js'),
|
|
34
|
+
...Object.values(richEditorPlugins).map(load => load())
|
|
35
|
+
])
|
|
36
|
+
return hugerte
|
|
37
|
+
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Loads SortableJS and Tabler's sortable, the first time a TSortable is shown.
|
|
2
|
+
import { globals, once } from './once'
|
|
3
|
+
|
|
4
|
+
export const loadSortable = once(async () => {
|
|
5
|
+
globals.Sortable = (await import('sortablejs')).default
|
|
6
|
+
return (await import('@tabler/core')).Sortable
|
|
7
|
+
})
|
package/src/shims.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Types for module files that ship without their own declarations next to them.
|
|
2
|
+
|
|
3
|
+
declare module '@tabler/core/dist/js/tabler-vector-map.esm.js' {
|
|
4
|
+
export { default as VectorMap } from '@tabler/core/dist/types/src/vector-map'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare module '@tabler/core/dist/js/maps/world.esm.js' {
|
|
8
|
+
import type { VectorMapData } from '@tabler/core/dist/types/src/vector-map'
|
|
9
|
+
export const world: VectorMapData
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// HugeRTE's models, themes, icons, skins and plugins register themselves with the editor.
|
|
13
|
+
declare module 'hugerte/models/*'
|
|
14
|
+
declare module 'hugerte/themes/*'
|
|
15
|
+
declare module 'hugerte/icons/*'
|
|
16
|
+
declare module 'hugerte/skins/*'
|
|
17
|
+
declare module 'hugerte/plugins/*'
|