@nubisco/ui 2.6.0 → 2.8.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.
Files changed (44) hide show
  1. package/dist/components/Banner.d.ts +53 -0
  2. package/dist/components/Banner.vue.d.ts +31 -0
  3. package/dist/components/Banner.vue.d.ts.map +1 -0
  4. package/dist/components/Blueprint.types.d.ts +40 -1
  5. package/dist/components/Blueprint.types.d.ts.map +1 -1
  6. package/dist/components/Blueprint.vue.d.ts +4 -11
  7. package/dist/components/Blueprint.vue.d.ts.map +1 -1
  8. package/dist/components/BlueprintCard.types.d.ts +28 -0
  9. package/dist/components/BlueprintCard.types.d.ts.map +1 -1
  10. package/dist/components/BlueprintCard.vue.d.ts +10 -23
  11. package/dist/components/BlueprintCard.vue.d.ts.map +1 -1
  12. package/dist/components/Button.vue.d.ts +2 -2
  13. package/dist/components/Charts/BarChart.vue.d.ts +1 -1
  14. package/dist/components/Charts/GanttChart.vue.d.ts +1 -1
  15. package/dist/components/Charts/InterpolationChart.vue.d.ts +1 -1
  16. package/dist/components/Charts/LineChart.vue.d.ts +1 -1
  17. package/dist/components/Charts/PieChart.vue.d.ts +1 -1
  18. package/dist/components/Charts/Sparkline.vue.d.ts +1 -1
  19. package/dist/components/Charts/shared/ChartFrame.vue.d.ts +1 -1
  20. package/dist/components/Charts/shared/ChartFrame.vue.d.ts.map +1 -1
  21. package/dist/components/DatePicker.vue.d.ts +1 -1
  22. package/dist/components/Icon.vue.d.ts +1 -1
  23. package/dist/components/MenuItem.vue.d.ts +1 -1
  24. package/dist/components/NumberInput.vue.d.ts +1 -1
  25. package/dist/components/NumberInput.vue.d.ts.map +1 -1
  26. package/dist/components/ProgressBar.vue.d.ts +1 -1
  27. package/dist/components/Select.vue.d.ts +1 -1
  28. package/dist/components/SidebarBrand.vue.d.ts +1 -1
  29. package/dist/components/SidebarMenuItem.vue.d.ts +1 -1
  30. package/dist/components/TextInput.vue.d.ts +2 -2
  31. package/dist/components/TextInput.vue.d.ts.map +1 -1
  32. package/dist/components/Tree.vue.d.ts +1 -1
  33. package/dist/components/TreeNode.vue.d.ts +1 -1
  34. package/dist/components/index.d.ts.map +1 -1
  35. package/dist/composables/useTheme.composable.d.ts +76 -0
  36. package/dist/composables/useTheme.composable.d.ts.map +1 -0
  37. package/dist/global.d.ts +2 -0
  38. package/dist/index.cjs +9 -9
  39. package/dist/index.mjs +11936 -11575
  40. package/dist/main.d.ts +5 -0
  41. package/dist/main.d.ts.map +1 -1
  42. package/dist/ui.css +1 -1
  43. package/package.json +1 -1
  44. package/src/styles/_theme.scss +139 -0
@@ -0,0 +1,76 @@
1
+ import { type ComputedRef, type Ref } from 'vue';
2
+ /**
3
+ * The three states a theme preference can be in.
4
+ *
5
+ * `system` is a preference in its own right, not the absence of one: it means
6
+ * "keep following the OS", and it stays selected while the resolved theme
7
+ * changes underneath it.
8
+ */
9
+ export type TTheme = 'light' | 'dark' | 'system';
10
+ /** The two themes that can actually be painted. */
11
+ export type TResolvedTheme = 'light' | 'dark';
12
+ export interface IThemeOptions {
13
+ /**
14
+ * localStorage key the preference is persisted under. Namespace it per
15
+ * application (`'analytics.theme'`), so two Nubisco products served from the
16
+ * same origin do not fight over one value.
17
+ */
18
+ storageKey?: string;
19
+ /** Preference to use when nothing is stored yet. */
20
+ defaultTheme?: TTheme;
21
+ /**
22
+ * Class placed on `<html>` for the dark theme. Matches the selector the
23
+ * library's own dark ramp is emitted under; override only if an application
24
+ * has its own dark stylesheet keyed on something else.
25
+ */
26
+ darkClass?: string;
27
+ }
28
+ export interface IThemeController {
29
+ /** The stored preference, including `system`. */
30
+ theme: Readonly<Ref<TTheme>>;
31
+ /** The theme actually showing right now. Never `system`. */
32
+ resolved: Readonly<Ref<TResolvedTheme>>;
33
+ /** True while the preference is `system`, for a control that marks it. */
34
+ followsSystem: ComputedRef<boolean>;
35
+ /** Pin a preference, or hand control back to the OS with `'system'`. */
36
+ setTheme: (value: TTheme) => void;
37
+ /**
38
+ * Flip to the opposite of what is currently showing. Always lands on an
39
+ * explicit `light` or `dark`, which is what a single-button toggle in a
40
+ * topbar wants; a three-state control should call `setTheme` instead.
41
+ */
42
+ toggle: () => void;
43
+ }
44
+ /**
45
+ * Names the storage key (and any other option) before the first `useTheme()`.
46
+ *
47
+ * Call it once, at application start, next to the other boot-time wiring:
48
+ *
49
+ * ```ts
50
+ * configureTheme({ storageKey: 'analytics.theme' })
51
+ * ```
52
+ *
53
+ * Calling it later re-reads storage and repaints, which is what an application
54
+ * that switches identity mid-session (or a test) wants, but it is not a
55
+ * per-component knob: the preference is one global piece of state, exactly like
56
+ * the document it paints.
57
+ */
58
+ export declare function configureTheme(next?: IThemeOptions): void;
59
+ /**
60
+ * Light/dark theming, with `system` as a first-class third state.
61
+ *
62
+ * The library ships both ramps and switches between them on a single class, so
63
+ * all this owns is the decision about when that class is present, where the
64
+ * preference is stored, and what happens when the OS setting changes while the
65
+ * application is open.
66
+ *
67
+ * ```vue
68
+ * const { theme, resolved, setTheme, toggle } = useTheme()
69
+ * ```
70
+ *
71
+ * `theme` is what the person chose (`'system'` included) and is what a settings
72
+ * control should bind to. `resolved` is what is actually painted, and is what
73
+ * an icon should follow.
74
+ */
75
+ export declare function useTheme(): IThemeController;
76
+ //# sourceMappingURL=useTheme.composable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.composable.d.ts","sourceRoot":"","sources":["../../src/composables/useTheme.composable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAEhF;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEhD,mDAAmD;AACnD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAA;AAE7C,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,4DAA4D;IAC5D,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAA;IACvC,0EAA0E;IAC1E,aAAa,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IACnC,wEAAwE;IACxE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC;;;;OAIG;IACH,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AA4GD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,aAAkB,GAAG,IAAI,CAG7D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,IAAI,gBAAgB,CAc3C"}
package/dist/global.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // Re-run the build to update this file when components change
3
3
  import AiLabel from './components/AiLabel.vue'
4
4
  import Badge from './components/Badge.vue'
5
+ import Banner from './components/Banner.vue'
5
6
  import BarChart from './components/Charts/BarChart.vue'
6
7
  import Blueprint from './components/Blueprint.vue'
7
8
  import BlueprintBackground from './components/BlueprintBackground.vue'
@@ -76,6 +77,7 @@ declare module 'vue' {
76
77
  interface GlobalComponents {
77
78
  NbAiLabel: typeof AiLabel
78
79
  NbBadge: typeof Badge
80
+ NbBanner: typeof Banner
79
81
  NbBarChart: typeof BarChart
80
82
  NbBlueprint: typeof Blueprint
81
83
  NbBlueprintBackground: typeof BlueprintBackground