@nice2dev/ui-core 1.3.1 → 1.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @nice2dev/ui-core — Changelog
2
2
 
3
+ ## 1.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - c8bea88: Sidebar menus nested to any depth, coloured by level and by branch; tabs in the colour of their branch.
8
+
9
+ - `NiceSidebarNav`: views nest through `children` to any depth (`SidebarNavView.children`). The
10
+ deep tree works everywhere:
11
+ - `maxDepth` now defaults to every level (it stopped at 4), and its slider goes to 10 = all;
12
+ - search finds nested views with their whole path and leaves out those under a hidden item;
13
+ - favorites, hiding and icons-only mode work on every level; in icons-only mode the tooltip
14
+ shows the item's path;
15
+ - levels 5+ are indented by `--nice-sidebar-indent-step` (16px);
16
+ - the branches above the active route open once when the route changes, and every branch on
17
+ the way down gets a bold label.
18
+ - A group with its own `route`: clicking its label opens the route and expands the group; the
19
+ arrow only expands or collapses it.
20
+ - Colours — a full row background with readable text, hover and active derived from it:
21
+ - `levelColors` colours the levels of the whole tree: `[0]` the source header, `[1]` the first
22
+ level, and so on; past the end, tints of the last colour;
23
+ - `color` / `levelColors` on a source, module, role, unit or view overrides it for that subtree;
24
+ one `color` gives the deeper levels tints of it (shades in a dark theme, `levelShading`);
25
+ - colours are written as the `--nice-sidebar-level-N-*` vars a theme's `nesting.sidebar` emits,
26
+ so the source header now takes level 1 when it is set;
27
+ - **`SidebarNavDataSource.color` was ignored until now — it colours the source's subtree from
28
+ this release on.**
29
+ - `onNavigate`'s third argument (`SidebarNavNavigateOptions`) carries `color` (the row's colour),
30
+ `branchColor` (the nearest branch with its own colour, e.g. the database a source stands for)
31
+ and `path`, besides `forceNew`.
32
+ - New exports: `walkSidebarNav`, `findSidebarItemByRoute` and `mapSidebarViews`, for walking the
33
+ data at any depth instead of loops over source → module → view.
34
+ - `NiceNavShell`:
35
+ - tabs have `color`, drawn as a 3px bar along the top and a light tint, and kept with the
36
+ persisted tabs;
37
+ - `tabColors` (`'none'` default, `'branch'`, `'level'`) gives tabs opened from the sidebar the
38
+ colour of their branch or row, and `api.openFromSidebar` does the same for a `sidebar` slot of
39
+ your own;
40
+ - tabs opened from the sidebar take the item's label and icon when `routeLabels` / `routeIcons`
41
+ do not name the route;
42
+ - `openRoute(route, { color })` repaints a tab that is already open;
43
+ - `sidebarProps` passes props to the built-in sidebar;
44
+ - home tiles of coloured tabs show the colour.
45
+ - `NiceTopNav`'s mobile drawer passes `onSidebarNavigate`'s third argument on.
46
+ - Sidebar prefs passed as `preferences` no longer get re-applied on mount over what the sidebar
47
+ saved in its first effect.
48
+ - `@nice2dev/ui-core`: `nestingLevelColors()` and `isDerivableColor()` exported — the theme's
49
+ nesting colour derivation, for colouring a subtree with the same rules.
50
+
3
51
  ## 1.3.1
4
52
 
5
53
  No changes in this release.
@@ -243,6 +243,24 @@ export declare function getComputedTheme(element?: HTMLElement): NiceTheme;
243
243
  export declare function serializeTheme(theme: NiceTheme): string;
244
244
  /** Parses a JSON string back into a {@link NiceTheme}. Throws on invalid format. */
245
245
  export declare function deserializeTheme(json: string): NiceTheme;
246
+ /** The colours of one nesting level: background, readable text, hover and active backgrounds. */
247
+ export interface NiceNestingLevelColors {
248
+ bg: string;
249
+ text: string;
250
+ hoverBg: string;
251
+ activeBg: string;
252
+ border?: string;
253
+ }
254
+ /** Whether a colour can be tinted, shaded and checked for contrast: `#rgb`, `#rrggbb` or `rgb()`. */
255
+ export declare function isDerivableColor(value: string): boolean;
256
+ /**
257
+ * The colours of nesting levels 1..`count`, derived the way a theme's `nesting` config derives
258
+ * them (1.3.2: exported, so a component can colour one subtree — a NiceSidebarNav branch — with
259
+ * the same rules as the theme colours the whole surface). Text is white on a dark background and
260
+ * `fallbackText` on a light one. A colour that is not hex or `rgb()` is used as given, with no
261
+ * tints and with `fallbackText`.
262
+ */
263
+ export declare function nestingLevelColors(count: number, cfg: NiceThemeNesting, fallbackBg: string, fallbackText: string): NiceNestingLevelColors[];
246
264
  export interface NiceThemeContextValue {
247
265
  theme: NiceTheme;
248
266
  setTheme: (theme: NiceTheme) => void;