@ternarytech-io/gears-ui 0.1.0 → 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/README.md +161 -161
- package/package.json +9 -2
- package/src/components/TAppLayout.vue +76 -0
- package/src/components/TContainerPicker.vue +22 -0
- package/src/components/TDensityPicker.vue +19 -0
- package/src/components/TNavPositionPicker.vue +22 -0
- package/src/components/TScaledFrame.vue +36 -0
- package/src/components/TSortableTree.vue +73 -0
- package/src/components/TSortableTreeList.vue +60 -0
- package/src/components/TThemeScope.vue +23 -22
- package/src/components/sortableTree.ts +19 -0
- package/src/index.ts +24 -8
- package/src/plugins/index.ts +5 -2
- package/src/styles/gears.css +70 -5
- package/src/theme.ts +20 -3
- package/src/types.ts +177 -160
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// One level of a TSortableTree: its items, each with a list for its children under it (empty
|
|
3
|
+
// ones open up while something is dragged, to drop into). Not used on its own.
|
|
4
|
+
import { inject, onBeforeUnmount, onMounted, ref, watch, type FunctionalComponent } from 'vue'
|
|
5
|
+
import type Sortable from 'sortablejs'
|
|
6
|
+
import { treeKey, type TreeItemScope } from './sortableTree'
|
|
7
|
+
|
|
8
|
+
defineOptions({ name: 'TSortableTreeList' })
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{ items: object[]; parent: object | null; depth: number }>()
|
|
11
|
+
const tree = inject(treeKey)!
|
|
12
|
+
|
|
13
|
+
const list = ref<HTMLElement>()
|
|
14
|
+
let sortable: Sortable | null = null
|
|
15
|
+
|
|
16
|
+
// An item's height: 1, plus its deepest child's.
|
|
17
|
+
const heightOf = (item: object): number => 1 + Math.max(0, ...tree.childrenOf(item).map(heightOf))
|
|
18
|
+
|
|
19
|
+
const Row: FunctionalComponent<TreeItemScope<object>> = scope => tree.render(scope)
|
|
20
|
+
|
|
21
|
+
onMounted(async () => {
|
|
22
|
+
const SortableClass = (await import('sortablejs')).default
|
|
23
|
+
if (!list.value) return
|
|
24
|
+
sortable = new SortableClass(list.value, {
|
|
25
|
+
group: tree.group,
|
|
26
|
+
animation: 150,
|
|
27
|
+
draggable: '.t-tree-node',
|
|
28
|
+
handle: tree.handle ? '.sortable-handle' : undefined,
|
|
29
|
+
disabled: tree.disabled,
|
|
30
|
+
// SortableJS's own dragging (not the browser's): the same in every browser and on touch screens.
|
|
31
|
+
forceFallback: true,
|
|
32
|
+
fallbackOnBody: true,
|
|
33
|
+
swapThreshold: 0.65,
|
|
34
|
+
onStart: () => { tree.dragging.value = true },
|
|
35
|
+
// A drop may not take the item's deepest child past the tree's depth.
|
|
36
|
+
onMove: event => Number(event.to.dataset.depth) - 1 + Number(event.dragged.dataset.height) <= tree.maxDepth,
|
|
37
|
+
onEnd: ({ oldIndex, newIndex, item, from, to }) => {
|
|
38
|
+
tree.dragging.value = false
|
|
39
|
+
if (oldIndex == null || newIndex == null || (from === to && oldIndex === newIndex)) return
|
|
40
|
+
// SortableJS moved the element; put it back and let Vue move it, so the lists stay right.
|
|
41
|
+
to.removeChild(item)
|
|
42
|
+
from.insertBefore(item, from.children[oldIndex] ?? null)
|
|
43
|
+
tree.move(from.dataset.parent ?? '', oldIndex, to.dataset.parent ?? '', newIndex)
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
watch(() => tree.disabled, disabled => sortable?.option('disabled', !!disabled))
|
|
49
|
+
onBeforeUnmount(() => sortable?.destroy())
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<div ref="list" :class="['t-tree-list', { 't-tree-children': depth > 1, 't-tree-empty': !items.length }]"
|
|
54
|
+
:data-parent="parent ? tree.keyOf(parent) : ''" :data-depth="depth">
|
|
55
|
+
<div v-for="item in items" :key="tree.keyOf(item)" class="t-tree-node" :data-height="heightOf(item)">
|
|
56
|
+
<Row :item="item" :depth="depth" :parent="parent" />
|
|
57
|
+
<TSortableTreeList v-if="depth < tree.maxDepth" :items="tree.childrenOf(item)" :parent="item" :depth="depth + 1" />
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
// Tabler's theme settings for part of a page: what's inside takes the theme's accent color, font,
|
|
3
|
-
// base grays, corner radius and light or dark mode, whatever the page around it uses. For
|
|
4
|
-
// of an application's theme. A custom accent (#rrggbb) is set as the primary color
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
:data-bs-theme-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Tabler's theme settings for part of a page: what's inside takes the theme's accent color, font,
|
|
3
|
+
// base grays, corner radius, density and light or dark mode, whatever the page around it uses. For
|
|
4
|
+
// previews of an application's theme. A custom accent (#rrggbb) is set as the primary color
|
|
5
|
+
// directly. Layout (navigation, container) is TAppLayout's.
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { useColorMode } from '../composables/useColorMode'
|
|
8
|
+
import { isCustomAccent } from '../theme'
|
|
9
|
+
import type { ThemeSettings } from '../types'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{ theme: ThemeSettings }>()
|
|
12
|
+
const { resolved } = useColorMode()
|
|
13
|
+
|
|
14
|
+
const custom = computed(() => isCustomAccent(props.theme.accent))
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div class="t-theme-scope" :data-bs-theme="theme.mode ?? resolved" :data-bs-theme-base="theme.base"
|
|
19
|
+
:data-bs-theme-font="theme.font" :data-bs-theme-radius="theme.radius" :data-t-density="theme.density"
|
|
20
|
+
:data-bs-theme-primary="custom ? undefined : theme.accent" :style="custom ? { '--tblr-primary': theme.accent } : undefined">
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// What TSortableTree shares with its lists (TSortableTreeList), one per level.
|
|
2
|
+
import type { InjectionKey, Ref, VNode } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface TreeItemScope<T> { item: T; depth: number; parent: T | null }
|
|
5
|
+
|
|
6
|
+
export interface TreeContext<T> {
|
|
7
|
+
// The SortableJS group: items move between this tree's lists, and no other's.
|
|
8
|
+
group: string
|
|
9
|
+
handle?: boolean
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
maxDepth: number
|
|
12
|
+
dragging: Ref<boolean>
|
|
13
|
+
keyOf(item: T): string
|
|
14
|
+
childrenOf(item: T): T[]
|
|
15
|
+
move(fromKey: string, oldIndex: number, toKey: string, newIndex: number): void
|
|
16
|
+
render(scope: TreeItemScope<T>): VNode[] | undefined
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const treeKey: InjectionKey<TreeContext<object>> = Symbol('t-sortable-tree')
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { App } from 'vue'
|
|
|
7
7
|
import TAccentPicker from './components/TAccentPicker.vue'
|
|
8
8
|
import TAdvancedTable from './components/TAdvancedTable.vue'
|
|
9
9
|
import TAlert from './components/TAlert.vue'
|
|
10
|
+
import TAppLayout from './components/TAppLayout.vue'
|
|
10
11
|
import TAuthLayout from './components/TAuthLayout.vue'
|
|
11
12
|
import TAvatar from './components/TAvatar.vue'
|
|
12
13
|
import TBadge from './components/TBadge.vue'
|
|
@@ -15,7 +16,9 @@ import TCard from './components/TCard.vue'
|
|
|
15
16
|
import TCheckbox from './components/TCheckbox.vue'
|
|
16
17
|
import TColorModeButton from './components/TColorModeButton.vue'
|
|
17
18
|
import TCommandPalette from './components/TCommandPalette.vue'
|
|
19
|
+
import TContainerPicker from './components/TContainerPicker.vue'
|
|
18
20
|
import TCopyButton from './components/TCopyButton.vue'
|
|
21
|
+
import TDensityPicker from './components/TDensityPicker.vue'
|
|
19
22
|
import TDropdown from './components/TDropdown.vue'
|
|
20
23
|
import TEmpty from './components/TEmpty.vue'
|
|
21
24
|
import TFieldGroup from './components/TFieldGroup.vue'
|
|
@@ -30,12 +33,14 @@ import TInputTags from './components/TInputTags.vue'
|
|
|
30
33
|
import TLogView from './components/TLogView.vue'
|
|
31
34
|
import TModal from './components/TModal.vue'
|
|
32
35
|
import TNav from './components/TNav.vue'
|
|
36
|
+
import TNavPositionPicker from './components/TNavPositionPicker.vue'
|
|
33
37
|
import TPage from './components/TPage.vue'
|
|
34
38
|
import TPagination from './components/TPagination.vue'
|
|
35
39
|
import TPanelList from './components/TPanelList.vue'
|
|
36
40
|
import TProgress from './components/TProgress.vue'
|
|
37
41
|
import TRadioGroup from './components/TRadioGroup.vue'
|
|
38
42
|
import TRadiusPicker from './components/TRadiusPicker.vue'
|
|
43
|
+
import TScaledFrame from './components/TScaledFrame.vue'
|
|
39
44
|
import TSearchButton from './components/TSearchButton.vue'
|
|
40
45
|
import TSectionLayout from './components/TSectionLayout.vue'
|
|
41
46
|
import TSelect from './components/TSelect.vue'
|
|
@@ -63,6 +68,7 @@ export {
|
|
|
63
68
|
TAccentPicker,
|
|
64
69
|
TAdvancedTable,
|
|
65
70
|
TAlert,
|
|
71
|
+
TAppLayout,
|
|
66
72
|
TAuthLayout,
|
|
67
73
|
TAvatar,
|
|
68
74
|
TBadge,
|
|
@@ -71,7 +77,9 @@ export {
|
|
|
71
77
|
TCheckbox,
|
|
72
78
|
TColorModeButton,
|
|
73
79
|
TCommandPalette,
|
|
80
|
+
TContainerPicker,
|
|
74
81
|
TCopyButton,
|
|
82
|
+
TDensityPicker,
|
|
75
83
|
TDropdown,
|
|
76
84
|
TEmpty,
|
|
77
85
|
TFieldGroup,
|
|
@@ -86,12 +94,14 @@ export {
|
|
|
86
94
|
TLogView,
|
|
87
95
|
TModal,
|
|
88
96
|
TNav,
|
|
97
|
+
TNavPositionPicker,
|
|
89
98
|
TPage,
|
|
90
99
|
TPagination,
|
|
91
100
|
TPanelList,
|
|
92
101
|
TProgress,
|
|
93
102
|
TRadioGroup,
|
|
94
103
|
TRadiusPicker,
|
|
104
|
+
TScaledFrame,
|
|
95
105
|
TSearchButton,
|
|
96
106
|
TSectionLayout,
|
|
97
107
|
TSelect,
|
|
@@ -117,20 +127,21 @@ export {
|
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
export * from './types'
|
|
120
|
-
export { isCustomAccent, themeAccents, themeBases, themeFonts, themeRadii } from './theme'
|
|
130
|
+
export { isCustomAccent, themeAccents, themeBases, themeContainers, themeDensities, themeFonts, themeNavs, themeRadii } from './theme'
|
|
121
131
|
export { useColorMode, type ColorMode } from './composables/useColorMode'
|
|
122
132
|
export { useCommandPalette } from './composables/useCommandPalette'
|
|
123
133
|
export { useField } from './composables/useField'
|
|
124
134
|
export { useToast, type Toast } from './composables/useToast'
|
|
125
135
|
|
|
126
136
|
const components = {
|
|
127
|
-
TAccentPicker, TAdvancedTable, TAlert, TAuthLayout, TAvatar, TBadge, TButton, TCard,
|
|
128
|
-
TColorModeButton, TCommandPalette,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
export default {
|
|
@@ -144,6 +155,7 @@ declare module 'vue' {
|
|
|
144
155
|
TAccentPicker: typeof TAccentPicker
|
|
145
156
|
TAdvancedTable: typeof TAdvancedTable
|
|
146
157
|
TAlert: typeof TAlert
|
|
158
|
+
TAppLayout: typeof TAppLayout
|
|
147
159
|
TAuthLayout: typeof TAuthLayout
|
|
148
160
|
TAvatar: typeof TAvatar
|
|
149
161
|
TBadge: typeof TBadge
|
|
@@ -152,7 +164,9 @@ declare module 'vue' {
|
|
|
152
164
|
TCheckbox: typeof TCheckbox
|
|
153
165
|
TColorModeButton: typeof TColorModeButton
|
|
154
166
|
TCommandPalette: typeof TCommandPalette
|
|
167
|
+
TContainerPicker: typeof TContainerPicker
|
|
155
168
|
TCopyButton: typeof TCopyButton
|
|
169
|
+
TDensityPicker: typeof TDensityPicker
|
|
156
170
|
TDropdown: typeof TDropdown
|
|
157
171
|
TEmpty: typeof TEmpty
|
|
158
172
|
TFieldGroup: typeof TFieldGroup
|
|
@@ -167,12 +181,14 @@ declare module 'vue' {
|
|
|
167
181
|
TLogView: typeof TLogView
|
|
168
182
|
TModal: typeof TModal
|
|
169
183
|
TNav: typeof TNav
|
|
184
|
+
TNavPositionPicker: typeof TNavPositionPicker
|
|
170
185
|
TPage: typeof TPage
|
|
171
186
|
TPagination: typeof TPagination
|
|
172
187
|
TPanelList: typeof TPanelList
|
|
173
188
|
TProgress: typeof TProgress
|
|
174
189
|
TRadioGroup: typeof TRadioGroup
|
|
175
190
|
TRadiusPicker: typeof TRadiusPicker
|
|
191
|
+
TScaledFrame: typeof TScaledFrame
|
|
176
192
|
TSearchButton: typeof TSearchButton
|
|
177
193
|
TSectionLayout: typeof TSectionLayout
|
|
178
194
|
TSelect: typeof TSelect
|
package/src/plugins/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import TInputMask from '../components/TInputMask.vue'
|
|
|
10
10
|
import TRangeSlider from '../components/TRangeSlider.vue'
|
|
11
11
|
import TRichEditor from '../components/TRichEditor.vue'
|
|
12
12
|
import TSortable from '../components/TSortable.vue'
|
|
13
|
+
import TSortableTree from '../components/TSortableTree.vue'
|
|
13
14
|
|
|
14
15
|
export {
|
|
15
16
|
TAdvancedSelect,
|
|
@@ -19,14 +20,15 @@ export {
|
|
|
19
20
|
TInputMask,
|
|
20
21
|
TRangeSlider,
|
|
21
22
|
TRichEditor,
|
|
22
|
-
TSortable
|
|
23
|
+
TSortable,
|
|
24
|
+
TSortableTree
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export type { RichEditorPlugin } from './richEditor'
|
|
26
28
|
|
|
27
29
|
const components = {
|
|
28
30
|
TAdvancedSelect, TColorPicker, TDatePicker, TDropzone, TInputMask, TRangeSlider, TRichEditor,
|
|
29
|
-
TSortable
|
|
31
|
+
TSortable, TSortableTree
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export const GearsUIPlugins = {
|
|
@@ -45,5 +47,6 @@ declare module 'vue' {
|
|
|
45
47
|
TRangeSlider: typeof TRangeSlider
|
|
46
48
|
TRichEditor: typeof TRichEditor
|
|
47
49
|
TSortable: typeof TSortable
|
|
50
|
+
TSortableTree: typeof TSortableTree
|
|
48
51
|
}
|
|
49
52
|
}
|
package/src/styles/gears.css
CHANGED
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
.ti-spin { animation: t-spin 1s linear infinite; }
|
|
65
65
|
@keyframes t-spin { to { transform: rotate(360deg); } }
|
|
66
66
|
|
|
67
|
-
/* The sidebar's fold toggle: a small
|
|
67
|
+
/* The sidebar's fold toggle: a small circle on the sidebar's edge, in the sidebar's colors (its
|
|
68
|
+
background, its border, and its menu icons' color), so it suits a dark sidebar or a light one. */
|
|
68
69
|
.t-fold-toggle {
|
|
69
70
|
position: absolute;
|
|
70
71
|
top: 1.375rem;
|
|
@@ -74,13 +75,13 @@
|
|
|
74
75
|
width: 24px;
|
|
75
76
|
height: 24px;
|
|
76
77
|
padding: 0;
|
|
77
|
-
color:
|
|
78
|
-
background:
|
|
79
|
-
border: 1px solid var(--tblr-navbar-border-color,
|
|
78
|
+
color: color-mix(in oklab, var(--tblr-navbar-color, var(--tblr-body-color)) 70%, transparent);
|
|
79
|
+
background: var(--tblr-navbar-bg, var(--tblr-bg-surface));
|
|
80
|
+
border: 1px solid var(--tblr-navbar-border-color, var(--tblr-border-color));
|
|
80
81
|
border-radius: 50%;
|
|
81
82
|
cursor: pointer;
|
|
82
83
|
}
|
|
83
|
-
.t-fold-toggle:hover { border-color:
|
|
84
|
+
.t-fold-toggle:hover { color: var(--tblr-navbar-hover-color, var(--tblr-body-color)); border-color: color-mix(in oklab, var(--tblr-navbar-color, var(--tblr-body-color)) 45%, transparent); }
|
|
84
85
|
.t-fold-toggle:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 2px; }
|
|
85
86
|
.t-fold-toggle .ti { font-size: 14px; width: 14px; height: 14px; line-height: 14px; vertical-align: 0; }
|
|
86
87
|
|
|
@@ -558,3 +559,67 @@
|
|
|
558
559
|
border-radius: var(--tblr-border-radius);
|
|
559
560
|
}
|
|
560
561
|
.t-image-upload-preview img { width: 100%; height: 100%; object-fit: contain; }
|
|
562
|
+
|
|
563
|
+
/* Density (TThemeScope's theme.density, or data-t-density on any element): the padding inside
|
|
564
|
+
cards, tables, buttons and fields, and the page's gaps (--t-gap, for layouts to use).
|
|
565
|
+
Comfortable is Tabler's own spacing. */
|
|
566
|
+
[data-t-density] { --t-gap: 1rem; }
|
|
567
|
+
[data-t-density=compact] { --t-gap: 0.625rem; --tblr-page-padding-y: 0.75rem; }
|
|
568
|
+
[data-t-density=spacious] { --t-gap: 1.5rem; --tblr-page-padding-y: 2rem; }
|
|
569
|
+
[data-t-density=compact] .card { --tblr-card-spacer-y: 0.75rem; --tblr-card-spacer-x: 0.875rem; --tblr-card-cap-padding-y: 0.625rem; --tblr-card-cap-padding-x: 0.875rem; --tblr-card-title-spacer-y: 0.625rem; }
|
|
570
|
+
[data-t-density=spacious] .card { --tblr-card-spacer-y: 1.75rem; --tblr-card-spacer-x: 1.75rem; --tblr-card-cap-padding-y: 1.5rem; --tblr-card-cap-padding-x: 1.75rem; --tblr-card-title-spacer-y: 1.5rem; }
|
|
571
|
+
[data-t-density=compact] .table:not(.table-sm) > :not(caption) > * > * { padding: 0.375rem 0.625rem; }
|
|
572
|
+
[data-t-density=spacious] .table:not(.table-sm) > :not(caption) > * > * { padding: 1rem 1.25rem; }
|
|
573
|
+
[data-t-density=compact] .btn:not(.btn-sm, .btn-lg, .btn-xs, .btn-icon) { --tblr-btn-padding-y: 0.3125rem; --tblr-btn-padding-x: 0.75rem; }
|
|
574
|
+
[data-t-density=spacious] .btn:not(.btn-sm, .btn-lg, .btn-xs, .btn-icon) { --tblr-btn-padding-y: 0.75rem; --tblr-btn-padding-x: 1.375rem; }
|
|
575
|
+
[data-t-density=compact] :is(.form-control, .form-select):not(.form-control-sm, .form-select-sm, .form-control-lg, .form-select-lg) { --tblr-control-padding-y: 0.3125rem; --tblr-control-padding-x: 0.625rem; }
|
|
576
|
+
[data-t-density=spacious] :is(.form-control, .form-select):not(.form-control-sm, .form-select-sm, .form-control-lg, .form-select-lg) { --tblr-control-padding-y: 0.75rem; --tblr-control-padding-x: 1.125rem; }
|
|
577
|
+
[data-t-density=compact] .navbar-vertical .nav-link { padding-block: 0.3125rem; }
|
|
578
|
+
[data-t-density=spacious] .navbar-vertical .nav-link { padding-block: 0.75rem; }
|
|
579
|
+
|
|
580
|
+
/* Layout sketches (TNavPositionPicker, TContainerPicker, TDensityPicker): a page drawn in a tile. */
|
|
581
|
+
.t-sketch { display: flex; gap: 3px; width: 5.5rem; height: 3.5rem; padding: 3px; border-radius: 4px; }
|
|
582
|
+
.t-sketch-top { flex-direction: column; }
|
|
583
|
+
.t-sketch-nav { flex-shrink: 0; border-radius: 2px; background: color-mix(in oklab, var(--tblr-body-color) 35%, transparent); }
|
|
584
|
+
.t-sketch-left .t-sketch-nav { width: 0.875rem; }
|
|
585
|
+
.t-sketch-top .t-sketch-nav { height: 0.5rem; }
|
|
586
|
+
.t-sketch-page { display: flex; flex: 1; flex-direction: column; gap: 3px; padding: 3px; border-radius: 2px; background: var(--tblr-bg-surface); }
|
|
587
|
+
.t-sketch-page span { height: 0.375rem; border-radius: 1px; background: color-mix(in oklab, var(--tblr-body-color) 15%, transparent); }
|
|
588
|
+
.t-sketch-page span:first-child { width: 60%; background: var(--tblr-primary); opacity: 0.7; }
|
|
589
|
+
.t-sketch-boxed { padding: 3px 0.75rem; background: color-mix(in oklab, var(--tblr-body-color) 18%, transparent); }
|
|
590
|
+
.t-sketch-rows { display: flex; flex-direction: column; justify-content: center; width: 5.5rem; height: 3.5rem; }
|
|
591
|
+
.t-sketch-rows span { height: 0.3125rem; border-radius: 1px; background: color-mix(in oklab, var(--tblr-body-color) 25%, transparent); }
|
|
592
|
+
.t-sketch-compact { gap: 2px; }
|
|
593
|
+
.t-sketch-comfortable { gap: 5px; }
|
|
594
|
+
.t-sketch-spacious { gap: 9px; }
|
|
595
|
+
.t-sketch-rows span:first-child { background: var(--tblr-primary); opacity: 0.7; }
|
|
596
|
+
|
|
597
|
+
/* An application's frame (TAppLayout). The sidebar follows the theme (the Studio's is always
|
|
598
|
+
dark); a floating top bar sits apart from the page's edges, rounded, with a shadow. */
|
|
599
|
+
.t-app { min-height: 100%; display: flex; flex-direction: column; }
|
|
600
|
+
.t-app > .page { flex: 1; width: 100%; }
|
|
601
|
+
.t-app-logo { width: 2rem; height: 2rem; object-fit: contain; border-radius: var(--tblr-border-radius-sm); }
|
|
602
|
+
.t-app .navbar-brand { display: flex; align-items: center; gap: 0.5rem; min-width: 0; font-weight: var(--tblr-font-weight-bold); }
|
|
603
|
+
/* Tabler spreads a vertical navbar's brand across it; keep the name beside the logo. */
|
|
604
|
+
.t-app .t-app-sidebar.navbar-vertical .navbar-brand { justify-content: flex-start; }
|
|
605
|
+
.t-app-floating { margin: var(--t-gap, 1rem) var(--t-gap, 1rem) 0; border: var(--tblr-border-width) solid var(--tblr-border-color); border-radius: var(--tblr-border-radius-lg); box-shadow: var(--tblr-shadow-card, 0 4px 16px rgba(0, 0, 0, 0.08)); }
|
|
606
|
+
.t-app-floating.sticky-top { top: var(--t-gap, 1rem); }
|
|
607
|
+
.layout-boxed .t-app-floating { margin-inline: 0; }
|
|
608
|
+
|
|
609
|
+
/* A scaled frame (TScaledFrame): a whole screen, scaled down to fit. The screen is the containing
|
|
610
|
+
block for fixed parts, so a fixed sidebar stays in the frame. */
|
|
611
|
+
.t-scaled-frame { position: relative; height: 100%; min-height: 0; overflow: hidden; }
|
|
612
|
+
.t-scaled-screen { position: absolute; top: 0; left: 0; overflow: hidden; transform-origin: top left; }
|
|
613
|
+
.t-scaled-scroll { height: 100%; overflow: auto; }
|
|
614
|
+
|
|
615
|
+
/* A sortable tree (TSortableTree): children indented under their item. While something is dragged,
|
|
616
|
+
each empty child list opens to a dashed slot, to drop into. */
|
|
617
|
+
.t-tree-children { margin-inline-start: 1.75rem; }
|
|
618
|
+
.t-tree-dragging .t-tree-children.t-tree-empty {
|
|
619
|
+
min-height: 0.875rem;
|
|
620
|
+
margin-block: 2px;
|
|
621
|
+
border: 1px dashed color-mix(in oklab, var(--tblr-primary) 45%, var(--tblr-border-color));
|
|
622
|
+
border-radius: var(--tblr-border-radius-sm);
|
|
623
|
+
}
|
|
624
|
+
.t-tree .sortable-ghost { opacity: 0.4; }
|
|
625
|
+
.t-tree .sortable-chosen > :first-child { background: color-mix(in oklab, var(--tblr-primary) 6%, transparent); }
|
package/src/theme.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// The choices
|
|
2
|
-
// own theme settings list them.
|
|
3
|
-
import type { SelectItem, ThemeBase, ThemeFont, ThemeRadius } from './types'
|
|
1
|
+
// The choices an application's theme offers, with their labels: Tabler's theme settings
|
|
2
|
+
// (tabler-themes.css) in the order its own theme settings list them, then layout.
|
|
3
|
+
import type { SelectItem, ThemeBase, ThemeContainer, ThemeDensity, ThemeFont, ThemeNav, ThemeRadius } from './types'
|
|
4
4
|
|
|
5
5
|
export const themeAccents = [
|
|
6
6
|
'blue', 'azure', 'indigo', 'purple', 'pink', 'red', 'orange', 'yellow', 'lime', 'green', 'teal', 'cyan'
|
|
@@ -24,5 +24,22 @@ export const themeBases: SelectItem<ThemeBase>[] = [
|
|
|
24
24
|
|
|
25
25
|
export const themeRadii: SelectItem<ThemeRadius>[] = ['0', '0.5', '1', '1.5', '2'].map(r => ({ label: r, value: r as ThemeRadius }))
|
|
26
26
|
|
|
27
|
+
// Layout choices (not Tabler theme settings; TThemeScope and TAppLayout apply them).
|
|
28
|
+
export const themeNavs: SelectItem<ThemeNav>[] = [
|
|
29
|
+
{ label: 'Left', value: 'left' },
|
|
30
|
+
{ label: 'Top', value: 'top' }
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
export const themeDensities: SelectItem<ThemeDensity>[] = [
|
|
34
|
+
{ label: 'Compact', value: 'compact' },
|
|
35
|
+
{ label: 'Comfortable', value: 'comfortable' },
|
|
36
|
+
{ label: 'Spacious', value: 'spacious' }
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
export const themeContainers: SelectItem<ThemeContainer>[] = [
|
|
40
|
+
{ label: 'Boxed', value: 'boxed' },
|
|
41
|
+
{ label: 'Fluid', value: 'fluid' }
|
|
42
|
+
]
|
|
43
|
+
|
|
27
44
|
/** Whether an accent is a custom color (#rrggbb) rather than one of Tabler's named colors. */
|
|
28
45
|
export const isCustomAccent = (accent: string | undefined) => !!accent && accent.startsWith('#')
|