@ternarytech-io/gears-ui 0.10.0 → 0.11.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 CHANGED
@@ -109,7 +109,7 @@ add a page, add an entry to `preview/registry.ts` and a folder of examples.
109
109
  | Overlays | `TModal`, `TSlideover`, `TDropdown`, `TSplitButton` (a main action and a menu of others), `TToaster` (with `useToast()`: neutral, success, warning, error or a custom `accent` color; a corner or the middle of the top or bottom, per toast or for all; `onClick`, `onClose`), `TLightbox` (images shown large: previous and next, arrow keys, swipes, captions) |
110
110
  | Navigation | `TTabs`, `TPagination`, `TSteps`, `TNav`, `TPanelList`, `TCommandPalette`, `TSearchButton` |
111
111
  | Data | `TTable` (sorting, `selectable` rows), `TAdvancedTable` (filters by column), `TEditableTable` (editing in place, bulk actions, search, pages, column kinds; client-side or `manual`), `TDataGrid` and `TDataGridItem` (Tabler's datagrid: labels and values for detail panels), `TStatCard` (with a trend and a sparkline; `loading`, `clickable`), `TSparkline` (Tabler's, no library), `TLogView`, `TCodeBlock` (JSON or YAML to read and copy: light highlighting by `codeTokens()`, wrapping, a header with actions; no editor, so no Monaco) |
112
- | Layout | `TAppLayout` (an application's frame, laid out by its theme, with a menu button on small screens), `TScaledFrame` (a whole screen scaled to fit), `TShell`, `TTopbar`, `TPage`, `TSectionLayout`, `TSplitter`, `TAuthLayout`, `TColorModeButton` |
112
+ | Layout | `TAppLayout` (an application's frame, laid out by its theme, with its menu's colors, a footer slot, and a menu button on small screens), `TScaledFrame` (a whole screen scaled to fit), `TShell`, `TTopbar`, `TPage`, `TSectionLayout`, `TSplitter`, `TAuthLayout`, `TColorModeButton` |
113
113
  | Plugins | `TAdvancedSelect`, `TChart`, `TPdfViewer`, `TCopyButton`, `TColorPicker`, `TDatePicker`, `TDropzone`, `TInputMask`, `TRangeSlider`, `TSortable`, `TSortableTree`, `TTimeInput`, `TVectorMap`, `TRichEditor` |
114
114
 
115
115
  ### Plugins
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ternarytech-io/gears-ui",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "description": "Gears UI: Vue 3 components on Tabler, used by the Gears Studio and the applications it builds.",
6
6
  "license": "MPL-2.0",
@@ -7,6 +7,10 @@
7
7
  // too, in a centered box with the background around it. Without a setting, it's default.
8
8
  // The brand is the logo and name, or the `brand` slot; the links are `items` (TNav), or the `nav`
9
9
  // slot for links of your own. `actions` go at the top bar's end, or at the foot of the sidebar.
10
+ // The `footer` slot is a footer under the page's content, across the content's width: at the
11
+ // window's bottom when the page is short, after the content when it's long.
12
+ // The theme's navColor/navText and footerColor/footerText color the navigation and the footer
13
+ // (unset, the theme's own), the same in light and dark mode.
10
14
  // Tabler's page, navbar and layout-boxed classes do the work, so it looks like Tabler's layouts.
11
15
  // On small screens the links fold away behind a menu button, and close again on navigating.
12
16
  import { computed, ref, watch } from 'vue'
@@ -29,6 +33,12 @@ const boxed = computed(() => props.theme.container === 'boxed')
29
33
  const foldable = computed(() => !top.value && props.theme.navFoldable === true)
30
34
  const container = computed(() => props.theme.container === 'fluid' ? 'container-fluid' : 'container-xl')
31
35
 
36
+ // The colors, as custom properties gears.css turns into Tabler's navbar and footer variables.
37
+ const navClasses = computed(() => ({ 't-app-nav-bg': !!props.theme.navColor, 't-app-nav-text': !!props.theme.navText }))
38
+ const navStyle = computed(() => ({ '--t-nav-bg': props.theme.navColor || undefined, '--t-nav-text': props.theme.navText || undefined }))
39
+ const footerClasses = computed(() => ({ 't-app-footer-bg': !!props.theme.footerColor, 't-app-footer-text': !!props.theme.footerText }))
40
+ const footerStyle = computed(() => ({ '--t-footer-bg': props.theme.footerColor || undefined, '--t-footer-text': props.theme.footerText || undefined }))
41
+
32
42
  const menuOpen = ref(false)
33
43
  const route = useRoute()
34
44
  watch(() => route.fullPath, () => { menuOpen.value = false })
@@ -37,7 +47,7 @@ watch(() => route.fullPath, () => { menuOpen.value = false })
37
47
  <template>
38
48
  <div :class="['t-app', { 'layout-boxed': boxed }]">
39
49
  <div class="page">
40
- <aside v-if="!top" :class="['navbar navbar-vertical navbar-expand-lg t-app-sidebar', { 'navbar-folded': foldable && folded }]">
50
+ <aside v-if="!top" :class="['navbar navbar-vertical navbar-expand-lg t-app-sidebar', navClasses, { 'navbar-folded': foldable && folded }]" :style="navStyle">
41
51
  <div class="container-fluid">
42
52
  <button type="button" class="navbar-toggler" :aria-expanded="menuOpen" aria-label="Menu" @click="menuOpen = !menuOpen">
43
53
  <span class="navbar-toggler-icon" />
@@ -60,7 +70,8 @@ watch(() => route.fullPath, () => { menuOpen.value = false })
60
70
  </div>
61
71
  </div>
62
72
  </aside>
63
- <header v-else :class="['navbar navbar-expand-md t-app-topbar', { 'sticky-top': theme.navSticky, 't-app-floating': theme.navFloating }]">
73
+ <header v-else :class="['navbar navbar-expand-md t-app-topbar', navClasses, { 'sticky-top': theme.navSticky, 't-app-floating': theme.navFloating }]"
74
+ :style="navStyle">
64
75
  <div :class="[container, 'gap-3']">
65
76
  <button type="button" class="navbar-toggler" :aria-expanded="menuOpen" aria-label="Menu" @click="menuOpen = !menuOpen">
66
77
  <span class="navbar-toggler-icon" />
@@ -85,6 +96,11 @@ watch(() => route.fullPath, () => { menuOpen.value = false })
85
96
  <slot />
86
97
  </div>
87
98
  </div>
99
+ <footer v-if="$slots.footer" :class="['footer t-app-footer', footerClasses]" :style="footerStyle">
100
+ <div :class="container">
101
+ <slot name="footer" />
102
+ </div>
103
+ </footer>
88
104
  </div>
89
105
  </div>
90
106
  </div>
@@ -806,6 +806,56 @@
806
806
  .t-app-floating.sticky-top { top: var(--t-gap, 1rem); }
807
807
  .layout-boxed .t-app-floating { margin-inline: 0; }
808
808
 
809
+ /* The navigation's own colors (TAppLayout, theme navColor/navText): its background, with a border
810
+ a shade darker; its text, links a little softer until hovered or selected, the selected one on a
811
+ tint of the text. Its menus and buttons keep their own colors, but ghost buttons take the text. */
812
+ .t-app .t-app-nav-bg {
813
+ --tblr-navbar-bg: var(--t-nav-bg);
814
+ --tblr-navbar-border-color: color-mix(in oklab, var(--t-nav-bg) 85%, #000);
815
+ }
816
+ .t-app .t-app-nav-text {
817
+ --tblr-navbar-color: color-mix(in oklab, var(--t-nav-text) 80%, transparent);
818
+ --tblr-navbar-hover-color: var(--t-nav-text);
819
+ --tblr-navbar-active-color: var(--t-nav-text);
820
+ --tblr-navbar-brand-color: var(--t-nav-text);
821
+ --tblr-navbar-brand-hover-color: var(--t-nav-text);
822
+ --tblr-navbar-active-bg: color-mix(in oklab, var(--t-nav-text) 12%, transparent);
823
+ --tblr-navbar-toggler-icon-color: var(--t-nav-text);
824
+ color: var(--t-nav-text);
825
+ }
826
+ .t-app .t-app-nav-text .navbar-brand { color: var(--t-nav-text); }
827
+ .t-app .t-app-nav-text .btn-ghost-secondary {
828
+ --tblr-btn-color: var(--t-nav-text);
829
+ --tblr-btn-hover-color: var(--t-nav-text);
830
+ --tblr-btn-active-color: var(--t-nav-text);
831
+ --tblr-btn-hover-bg: color-mix(in oklab, var(--t-nav-text) 12%, transparent);
832
+ --tblr-btn-active-bg: color-mix(in oklab, var(--t-nav-text) 18%, transparent);
833
+ }
834
+
835
+ /* The footer (TAppLayout's footer slot): Tabler's footer at the page's foot (its margin-top: auto
836
+ keeps it at the window's bottom on a short page), with its own colors (theme footerColor and
837
+ footerText). Its text and links take the text color; cards and menus in it keep the page's. */
838
+ .t-app { --t-page-color: var(--tblr-body-color); --t-page-secondary: var(--tblr-secondary-color); --t-page-link: var(--tblr-link-color); }
839
+ .t-app-footer { padding: var(--t-gap, 1rem) 0; }
840
+ .t-app-footer.t-app-footer-bg {
841
+ background-color: var(--t-footer-bg);
842
+ border-top-color: color-mix(in oklab, var(--t-footer-bg) 85%, #000);
843
+ }
844
+ .t-app-footer.t-app-footer-text {
845
+ color: var(--t-footer-text);
846
+ --tblr-body-color: var(--t-footer-text);
847
+ --tblr-secondary-color: color-mix(in oklab, var(--t-footer-text) 75%, transparent);
848
+ --tblr-link-color: var(--t-footer-text);
849
+ --tblr-link-hover-color: var(--t-footer-text);
850
+ }
851
+ .t-app-footer.t-app-footer-text :is(.card, .dropdown-menu, .popover, .modal, .btn:not([class*=btn-ghost]):not(.btn-link), .form-control, .form-select, .input-group-text) {
852
+ --tblr-body-color: var(--t-page-color);
853
+ --tblr-secondary-color: var(--t-page-secondary);
854
+ --tblr-link-color: var(--t-page-link);
855
+ --tblr-link-hover-color: var(--t-page-link);
856
+ }
857
+ .t-app-footer.t-app-footer-text :is(.card, .dropdown-menu, .popover, .modal) { color: var(--t-page-color); }
858
+
809
859
  /* A scaled frame (TScaledFrame): a whole screen, scaled down to fit. The screen is the containing
810
860
  block for fixed parts, so a fixed sidebar stays in the frame. */
811
861
  .t-scaled-frame { position: relative; height: 100%; min-height: 0; overflow: hidden; }
package/src/types.ts CHANGED
@@ -232,5 +232,12 @@ export interface ThemeSettings {
232
232
  // apart from the page's edges.
233
233
  navSticky?: boolean
234
234
  navFloating?: boolean
235
+ // The navigation's background and text colors (any CSS color, such as #1c3d6e); unset for the
236
+ // theme's own. The same in light and dark mode.
237
+ navColor?: string
238
+ navText?: string
239
+ // The footer's background and text colors, likewise (TAppLayout's `footer` slot).
240
+ footerColor?: string
241
+ footerText?: string
235
242
  container?: ThemeContainer
236
243
  }