@nice2dev/ui-core 1.3.1 → 1.3.3
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 +52 -0
- package/dist/core/theme.d.ts +18 -0
- package/dist/index.cjs +15 -15
- package/dist/index.mjs +1637 -1613
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @nice2dev/ui-core — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.3
|
|
4
|
+
|
|
5
|
+
No changes in this release.
|
|
6
|
+
|
|
7
|
+
## 1.3.2
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- c8bea88: Sidebar menus nested to any depth, coloured by level and by branch; tabs in the colour of their branch.
|
|
12
|
+
|
|
13
|
+
- `NiceSidebarNav`: views nest through `children` to any depth (`SidebarNavView.children`). The
|
|
14
|
+
deep tree works everywhere:
|
|
15
|
+
- `maxDepth` now defaults to every level (it stopped at 4), and its slider goes to 10 = all;
|
|
16
|
+
- search finds nested views with their whole path and leaves out those under a hidden item;
|
|
17
|
+
- favorites, hiding and icons-only mode work on every level; in icons-only mode the tooltip
|
|
18
|
+
shows the item's path;
|
|
19
|
+
- levels 5+ are indented by `--nice-sidebar-indent-step` (16px);
|
|
20
|
+
- the branches above the active route open once when the route changes, and every branch on
|
|
21
|
+
the way down gets a bold label.
|
|
22
|
+
- A group with its own `route`: clicking its label opens the route and expands the group; the
|
|
23
|
+
arrow only expands or collapses it.
|
|
24
|
+
- Colours — a full row background with readable text, hover and active derived from it:
|
|
25
|
+
- `levelColors` colours the levels of the whole tree: `[0]` the source header, `[1]` the first
|
|
26
|
+
level, and so on; past the end, tints of the last colour;
|
|
27
|
+
- `color` / `levelColors` on a source, module, role, unit or view overrides it for that subtree;
|
|
28
|
+
one `color` gives the deeper levels tints of it (shades in a dark theme, `levelShading`);
|
|
29
|
+
- colours are written as the `--nice-sidebar-level-N-*` vars a theme's `nesting.sidebar` emits,
|
|
30
|
+
so the source header now takes level 1 when it is set;
|
|
31
|
+
- **`SidebarNavDataSource.color` was ignored until now — it colours the source's subtree from
|
|
32
|
+
this release on.**
|
|
33
|
+
- `onNavigate`'s third argument (`SidebarNavNavigateOptions`) carries `color` (the row's colour),
|
|
34
|
+
`branchColor` (the nearest branch with its own colour, e.g. the database a source stands for)
|
|
35
|
+
and `path`, besides `forceNew`.
|
|
36
|
+
- New exports: `walkSidebarNav`, `findSidebarItemByRoute` and `mapSidebarViews`, for walking the
|
|
37
|
+
data at any depth instead of loops over source → module → view.
|
|
38
|
+
- `NiceNavShell`:
|
|
39
|
+
- tabs have `color`, drawn as a 3px bar along the top and a light tint, and kept with the
|
|
40
|
+
persisted tabs;
|
|
41
|
+
- `tabColors` (`'none'` default, `'branch'`, `'level'`) gives tabs opened from the sidebar the
|
|
42
|
+
colour of their branch or row, and `api.openFromSidebar` does the same for a `sidebar` slot of
|
|
43
|
+
your own;
|
|
44
|
+
- tabs opened from the sidebar take the item's label and icon when `routeLabels` / `routeIcons`
|
|
45
|
+
do not name the route;
|
|
46
|
+
- `openRoute(route, { color })` repaints a tab that is already open;
|
|
47
|
+
- `sidebarProps` passes props to the built-in sidebar;
|
|
48
|
+
- home tiles of coloured tabs show the colour.
|
|
49
|
+
- `NiceTopNav`'s mobile drawer passes `onSidebarNavigate`'s third argument on.
|
|
50
|
+
- Sidebar prefs passed as `preferences` no longer get re-applied on mount over what the sidebar
|
|
51
|
+
saved in its first effect.
|
|
52
|
+
- `@nice2dev/ui-core`: `nestingLevelColors()` and `isDerivableColor()` exported — the theme's
|
|
53
|
+
nesting colour derivation, for colouring a subtree with the same rules.
|
|
54
|
+
|
|
3
55
|
## 1.3.1
|
|
4
56
|
|
|
5
57
|
No changes in this release.
|
package/dist/core/theme.d.ts
CHANGED
|
@@ -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;
|