@nxgt/material 3.7.5 → 3.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.
- package/CHANGELOG.md +50 -0
- package/README.md +39 -6
- package/bin/nxgt-theme.js +6 -0
- package/dist/{async-slice-o_fpqeGX.js → async-slice-DDjaJY_F.js} +2 -2
- package/dist/background--Bf_EbFR.js +159 -0
- package/dist/backgrounds/backgrounds.css +2 -0
- package/dist/backgrounds/css-react/moon.css +97 -0
- package/dist/backgrounds.js +3 -139
- package/dist/browser-only-DQ94lWF8.js +18 -0
- package/dist/bubble-input-B7BVd9fX.js +237 -0
- package/dist/{button--cF4gY14.js → button-DbfdITBB.js} +51 -57
- package/dist/charts.js +3 -3
- package/dist/{chip-D1B1dL77.js → chip-DpySRqCy.js} +2 -2
- package/dist/{client-only.utils-lQ7GqP8w.js → client-only.utils-3nHNzCki.js} +1 -1
- package/dist/{code-editor-0CdGwKDg.js → code-editor-BiA14xua.js} +7 -7
- package/dist/code-editor.js +6 -6
- package/dist/{code-language-items-CGARRbVm.js → code-language-items-C_dJ6GVs.js} +2 -2
- package/dist/components/theme-tokens.css +34 -35
- package/dist/components/tones/app-tones.css +2 -1
- package/dist/components/tones/containers.css +4 -1
- package/dist/components/tones/index.css +2 -0
- package/dist/components/tones/surface.css +1 -0
- package/dist/components/tones/tokens.css +8 -3
- package/dist/components/tones/zone-paint.css +15 -0
- package/dist/components/ui/feedback/toast/toast-tokens.css +1 -0
- package/dist/components/ui/layout/app-shell/activity-backdrop.css +26 -0
- package/dist/components/ui/layout/sidebar/sidebar-tokens.css +5 -2
- package/dist/components/ui/media/media-player/nxgt-media-player.css +7 -32
- package/dist/components/ui/primitives/field-box/field-box-tokens.css +5 -2
- package/dist/{components-CDrQCOsU.js → components-B9EIfMdd.js} +18622 -18531
- package/dist/components.js +24 -22
- package/dist/{dialog-DdJ1C4BR.js → dialog-CkIYpJXk.js} +55 -53
- package/dist/dist-B7RjY7SL.js +158 -0
- package/dist/dist-C4wtXCjf.js +593 -0
- package/dist/dist-DVRQkaTK.js +111 -0
- package/dist/dist-lmHmz_bu.js +419 -0
- package/dist/dnd.js +1 -1
- package/dist/dropdown-menu-BC5Tbhb9.js +908 -0
- package/dist/editor.js +527 -527
- package/dist/empty-state-s2CSjKXJ.js +126 -0
- package/dist/{escape-owner-B8k7DvFa.js → escape-owner-CripBce_.js} +2 -1
- package/dist/{field-blur-DFUazxsL.js → field-blur-DPLsMufs.js} +1 -1
- package/dist/{field-blur-context-Dw9ZAgBr.js → field-blur-context-1ZwJgsHE.js} +2 -2
- package/dist/has-text-content-Ds2dkHX_.js +10 -0
- package/dist/hooks.js +35 -33
- package/dist/{hover-card-D5iHS9q1.js → hover-card-Cox-tPDz.js} +41 -39
- package/dist/{i18n-provider-C6SBK_nO.js → i18n-provider-C6HhBw34.js} +1 -1
- package/dist/i18n.js +6 -6
- package/dist/{icon-badge-Bb5-73XP.js → icon-badge-q3Ve8gra.js} +3 -3
- package/dist/{icon-button-5A6Mrj6w.js → icon-button-DJcWpIhu.js} +2 -1
- package/dist/{in-dialog-AiwTD3DK.js → in-dialog-Vwkyp-M5.js} +6 -5
- package/dist/lib/backgrounds/background/available.d.ts +3 -3
- package/dist/lib/backgrounds/background/background.d.ts +7 -3
- package/dist/lib/backgrounds/background/types.d.ts +7 -1
- package/dist/lib/backgrounds/index.d.ts +1 -1
- package/dist/lib/components/ui/layout/app-shell/activity-chrome.d.ts +17 -0
- package/dist/lib/components/ui/layout/app-shell/activity-layout.d.ts +6 -4
- package/dist/lib/components/ui/layout/app-shell/backdrop-layer.d.ts +11 -0
- package/dist/lib/components/ui/layout/app-shell/keep-shapes-inside.d.ts +17 -0
- package/dist/lib/components/ui/layout/app-shell/theme-backdrop.d.ts +6 -0
- package/dist/lib/components/ui/layout/app-shell/use-activity-backdrop.d.ts +18 -0
- package/dist/lib/components/ui/layout/app-shell/use-keep-shapes-inside.d.ts +9 -0
- package/dist/lib/hooks/resolve-theme.d.ts +46 -1
- package/dist/lib/hooks/theme-store.d.ts +35 -4
- package/dist/lib/hooks/use-theme.d.ts +20 -4
- package/dist/lib/i18n/resources/en/en.d.ts +4 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +4 -0
- package/dist/lib/i18n/resources/fr/fr.d.ts +4 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +4 -0
- package/dist/lib/i18n/resources/resources.d.ts +8 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/theme-picker/index.d.ts +7 -0
- package/dist/lib/theme-picker/partials/mini-background.d.ts +10 -0
- package/dist/lib/theme-picker/partials/mode-control.d.ts +5 -0
- package/dist/lib/theme-picker/partials/theme-tile.d.ts +12 -0
- package/dist/lib/theme-picker/theme-label.d.ts +7 -0
- package/dist/lib/theme-picker/theme-picker.d.ts +25 -0
- package/dist/lib/themes/index.d.ts +14 -0
- package/dist/lib/themes/nxgt-theme-provider.d.ts +29 -0
- package/dist/lib/themes/nxgt-theme.d.ts +22 -0
- package/dist/lib/themes/theme-context.d.ts +28 -0
- package/dist/lib/themes/theme-value.d.ts +5 -0
- package/dist/lib/vite/index.d.ts +1 -1
- package/dist/lib.js +3 -3
- package/dist/main.js +43 -39
- package/dist/map.js +8 -8
- package/dist/material.css +1 -1
- package/dist/nxgt-theme-CgSb9Obl.js +37 -0
- package/dist/pdf-reader.js +1 -1
- package/dist/print.js +2 -2
- package/dist/{public-SsiazLEv.js → public-Ce30uvp0.js} +591 -587
- package/dist/read-storage-C2J90bNm.js +10 -0
- package/dist/{rich-code-block-CwNwQs5z.js → rich-code-block-C2Fp_FDU.js} +5 -5
- package/dist/{sortable-provider-BvD98s8Y.js → sortable-provider-pVaEZzty.js} +3 -3
- package/dist/{spinner-CtGCPza-.js → spinner-CsHcmcpF.js} +2 -2
- package/dist/{stored-language-Bb7yX5uE.js → stored-language-BeIKw3-K.js} +15 -15
- package/dist/styles.css +8 -1
- package/dist/theme-context-BagPvRcz.js +16 -0
- package/dist/theme-picker.js +118 -0
- package/dist/theme-store-CSl51uNH.js +91 -0
- package/dist/theme-toggle-C8os82b4.js +48 -0
- package/dist/themes.js +42 -0
- package/dist/toggle-group-j8zaxEg1.js +69 -0
- package/dist/{toolbar-items-DsDDD5AY.js → toolbar-items-CqHvlTU8.js} +443 -589
- package/dist/tooltip-rhbqNmr3.js +1064 -0
- package/dist/{translate-material-Bsjc4Tow.js → translate-material-CGZljjp1.js} +2 -2
- package/dist/{translator-or2y0JJB.js → translator-DCYO4Ij3.js} +3 -3
- package/dist/{use-background-activity-B8jLHNop.js → use-background-activity-KxQgelFF.js} +1 -1
- package/dist/{use-chat-composer-DZ01a16D.js → use-chat-composer-CDrgWGMM.js} +4684 -4886
- package/dist/{use-heading-spy-ByOQNnFZ.js → use-heading-spy-DXo6IOX9.js} +52 -121
- package/dist/{use-material-translation-hLQzOjF0.js → use-material-translation-DkxcLbLM.js} +2 -2
- package/dist/use-slice-reducer-BGkeGtML.js +42 -0
- package/dist/use-theme-Cd-aiDJo.js +31 -0
- package/docs/README.md +2 -1
- package/docs/components/foundations.md +39 -0
- package/docs/components/navigation-and-layout.md +3 -3
- package/docs/getting-started.md +1 -1
- package/docs/guides/app-shell.md +41 -6
- package/docs/guides/backgrounds.md +43 -7
- package/docs/guides/i18n.md +1 -1
- package/docs/guides/themes.md +103 -0
- package/docs/guides/theming.md +288 -84
- package/docs/guides/vite-plugin.md +26 -0
- package/docs/previews/backgrounds-background-from-theme.webp +0 -0
- package/docs/previews/backgrounds-geometry-more.webp +0 -0
- package/docs/previews/backgrounds-geometry.webp +0 -0
- package/docs/previews/backgrounds-illustrated-scenes.webp +0 -0
- package/docs/previews/backgrounds-light-more.webp +0 -0
- package/docs/previews/backgrounds-light.webp +0 -0
- package/docs/previews/backgrounds-material-more.webp +0 -0
- package/docs/previews/backgrounds-matrix.webp +0 -0
- package/docs/previews/backgrounds-moon.webp +0 -0
- package/docs/previews/backgrounds-motif-shapes.webp +0 -0
- package/docs/previews/backgrounds-motifs.webp +0 -0
- package/docs/previews/foundations-themes-themepicker.webp +0 -0
- package/docs/roadmap.md +25 -0
- package/docs/troubleshooting.md +35 -7
- package/lib/backgrounds/backgrounds.css +2 -0
- package/lib/backgrounds/css-react/moon.css +97 -0
- package/lib/components/theme-tokens.css +34 -35
- package/lib/components/tones/app-tones.css +2 -1
- package/lib/components/tones/containers.css +4 -1
- package/lib/components/tones/index.css +2 -0
- package/lib/components/tones/surface.css +1 -0
- package/lib/components/tones/tokens.css +8 -3
- package/lib/components/tones/zone-paint.css +15 -0
- package/lib/components/ui/feedback/toast/toast-tokens.css +1 -0
- package/lib/components/ui/layout/app-shell/activity-backdrop.css +26 -0
- package/lib/components/ui/layout/sidebar/sidebar-tokens.css +5 -2
- package/lib/components/ui/media/media-player/nxgt-media-player.css +7 -32
- package/lib/components/ui/primitives/field-box/field-box-tokens.css +5 -2
- package/lib/styles.css +8 -1
- package/lib/theme-picker/theme-picker-list.css +29 -0
- package/lib/theme-picker/theme-picker.css +192 -0
- package/lib/theme-picker/theme-tile-background.css +77 -0
- package/lib/theme-picker/theme-tile-textures-night.css +63 -0
- package/lib/theme-picker/theme-tile-textures.css +153 -0
- package/lib/themes/ambre.css +134 -0
- package/lib/themes/ardoise.css +133 -0
- package/lib/themes/bleumono.css +136 -0
- package/lib/themes/bluemoon.css +136 -0
- package/lib/themes/corail.css +136 -0
- package/lib/themes/foret.css +133 -0
- package/lib/themes/lavande.css +133 -0
- package/lib/themes/menthe.css +136 -0
- package/lib/themes/ocean.css +136 -0
- package/lib/themes/pink.css +134 -0
- package/lib/themes/prune.css +133 -0
- package/lib/themes/sable.css +133 -0
- package/lib/themes/slate.css +133 -0
- package/lib/themes/teal.css +137 -0
- package/package.json +30 -2
- package/dist/dropdown-menu-DWtgUVW7.js +0 -1490
- package/dist/empty-state-CRWLQ1sM.js +0 -191
- package/dist/tooltip-tmFoTU_d.js +0 -1582
- package/dist/use-slice-reducer-0r5dXnJe.js +0 -58
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Under a `backdrop`: the chrome's fill, from a token (activity-backdrop.css). */
|
|
2
|
+
export declare const CHROME_FILL = "bg-(--nxgt-backdrop-fill-chrome)";
|
|
3
|
+
/** The app bar: that fill, frosted (the blur is 0 when the user asks for less
|
|
4
|
+
* transparency). */
|
|
5
|
+
export declare const CHROME_FROSTED = "bg-(--nxgt-backdrop-fill-chrome) backdrop-blur-(--nxgt-backdrop-blur)";
|
|
6
|
+
/** The sidebar: a little more opaque than the app bar, for its text's contrast. */
|
|
7
|
+
export declare const NAV_FROSTED = "bg-(--nxgt-backdrop-fill-nav) backdrop-blur-(--nxgt-backdrop-blur)";
|
|
8
|
+
/**
|
|
9
|
+
* The top gutter, above the sticky app bar, stays in the viewport and hides
|
|
10
|
+
* what the page scrolls under it: the app bar's own fill, so nothing shows in
|
|
11
|
+
* the 8px strip. Not needed when the content region scrolls inside the frame.
|
|
12
|
+
* Without a `backdrop` it fades in over the first pixels of scroll
|
|
13
|
+
* (activity-backdrop.css), so the page at scroll top is as it always was.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ActivityGutterMask({ hasBackdrop }: {
|
|
16
|
+
hasBackdrop: boolean;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -79,11 +79,13 @@ export type ActivityLayoutProps = {
|
|
|
79
79
|
*/
|
|
80
80
|
routeTransition?: RouteTransition;
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
82
|
+
* An exception to the theme's background, which the layout draws by
|
|
83
|
+
* default: under Lavande, or under no theme, the built-in gradient and its
|
|
84
|
+
* three blobs; under another theme, that theme's `background`. A node
|
|
85
|
+
* replaces it for this screen: typically a `Background` preset from
|
|
84
86
|
* `@nxgt/material/backgrounds`. It fills the whole layout, sits under the
|
|
85
87
|
* sidebar, the header and the content, and is `inert`, `aria-hidden` and
|
|
86
|
-
* never takes a pointer.
|
|
88
|
+
* never takes a pointer. `false` draws no background at all, a plain page.
|
|
87
89
|
* The preset's stylesheet (`@nxgt/material/backgrounds.css`) is the app's to
|
|
88
90
|
* import. See the app shell guide, "Use a background preset behind the shell".
|
|
89
91
|
*
|
|
@@ -99,7 +101,7 @@ export type ActivityLayoutProps = {
|
|
|
99
101
|
* </ActivityLayout>
|
|
100
102
|
* ```
|
|
101
103
|
*/
|
|
102
|
-
backdrop?: ReactNode;
|
|
104
|
+
backdrop?: ReactNode | false;
|
|
103
105
|
} & ComponentProps<'div'>;
|
|
104
106
|
/**
|
|
105
107
|
* The application chrome: sidebar, header, breadcrumbs, and the routed content.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The layer behind the content column that holds the backdrop: the theme's
|
|
4
|
+
* background (`themed`) or the app's own node. It is `inert`, `aria-hidden`
|
|
5
|
+
* and takes no pointer, so what it draws is decoration only. A `Background`
|
|
6
|
+
* node keeps its shapes whole, as the theme's does (use-keep-shapes-inside.ts).
|
|
7
|
+
*/
|
|
8
|
+
export declare function BackdropLayer({ backdrop, themed, }: {
|
|
9
|
+
backdrop: ReactNode;
|
|
10
|
+
themed: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** A box in the page's coordinates: what `getBoundingClientRect()` gives. */
|
|
2
|
+
export interface Box {
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
right: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
}
|
|
8
|
+
/** The space a shape keeps from the layer's edges and from the header band, in pixels. */
|
|
9
|
+
export declare const SHAPE_MARGIN = 8;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a shape of the backdrop must not be drawn: it crosses an edge of the
|
|
12
|
+
* layer (or comes within `margin` of it), or it reaches the header band. The
|
|
13
|
+
* band is a list of horizontal strips (the app bar, the breadcrumb, the
|
|
14
|
+
* header card, an `EntityHeader`), full width: only their top and bottom count.
|
|
15
|
+
* A shape is kept or dropped whole, never cut.
|
|
16
|
+
*/
|
|
17
|
+
export declare function shapeOutside(shape: Box, layer: Box, bands: readonly Box[], margin?: number): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The nearest theme's background, filling the backdrop layer (it reads the
|
|
3
|
+
* theme itself). Its shapes stay whole: none crosses the layer's edge or
|
|
4
|
+
* reaches the header band (use-keep-shapes-inside.ts).
|
|
5
|
+
*/
|
|
6
|
+
export declare function ThemeBackdrop(): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What ActivityLayout draws behind its frame. The theme's background is the
|
|
4
|
+
* default and `backdrop` the exception: `themeBackdrop` is a theme background
|
|
5
|
+
* other than Lavande's (which the built-in gradient is), `plain` is no
|
|
6
|
+
* background at all (`backdrop={false}`, or a theme without one), and
|
|
7
|
+
* `hasBackdrop` says the backdrop layer and the opaque chrome are in use.
|
|
8
|
+
* `attributes` are the root's `data-backdrop` / `data-plain`
|
|
9
|
+
* (activity-backdrop.css hides the built-in blobs and tint for either).
|
|
10
|
+
*/
|
|
11
|
+
export declare function useActivityBackdrop(backdrop: ReactNode | false | undefined): {
|
|
12
|
+
themeBackdrop: boolean;
|
|
13
|
+
hasBackdrop: boolean;
|
|
14
|
+
attributes: {
|
|
15
|
+
'data-backdrop': string | undefined;
|
|
16
|
+
'data-plain': string | undefined;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A callback ref for the theme's `Background`, a child of the backdrop layer (it is loaded lazily, so it mounts after this hook). */
|
|
2
|
+
export declare function useKeepShapesInside(): (el: HTMLElement | null) => void;
|
|
3
|
+
/**
|
|
4
|
+
* The same for a `Background` the app passes as `backdrop`: a callback ref on
|
|
5
|
+
* the backdrop layer, which finds every preset (`[data-background]`) inside it
|
|
6
|
+
* whenever the layer's content changes, so a lazily loaded or swapped preset
|
|
7
|
+
* is kept whole too. Anything else in the layer (a custom node) is left alone.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useKeepNodeShapesInside(): (layer: HTMLElement | null) => void;
|
|
@@ -1,7 +1,52 @@
|
|
|
1
1
|
export type ThemePreference = 'light' | 'dark' | 'system';
|
|
2
2
|
export type ResolvedTheme = 'light' | 'dark';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The mode shown: the stored preference, else `defaultMode` (what a first
|
|
5
|
+
* visit suggests: a theme's `colorScheme`, default `system`). `system`
|
|
6
|
+
* follows `prefers-color-scheme`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveTheme(stored: string | undefined | null, prefersDark: boolean, defaultMode?: ThemePreference): {
|
|
4
9
|
theme: ResolvedTheme;
|
|
5
10
|
preference: ThemePreference;
|
|
6
11
|
};
|
|
7
12
|
export declare function applyResolvedTheme(theme: ResolvedTheme): void;
|
|
13
|
+
/**
|
|
14
|
+
* The theme names an app can use. Augment it, as `AppTones` is, with the
|
|
15
|
+
* app's own themes:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* declare module '@nxgt/material' {
|
|
19
|
+
* interface NxgtThemes { brand: true }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export interface NxgtThemes {
|
|
24
|
+
lavande: true;
|
|
25
|
+
ocean: true;
|
|
26
|
+
foret: true;
|
|
27
|
+
ambre: true;
|
|
28
|
+
ardoise: true;
|
|
29
|
+
corail: true;
|
|
30
|
+
menthe: true;
|
|
31
|
+
prune: true;
|
|
32
|
+
sable: true;
|
|
33
|
+
slate: true;
|
|
34
|
+
pink: true;
|
|
35
|
+
bleumono: true;
|
|
36
|
+
bluemoon: true;
|
|
37
|
+
teal: true;
|
|
38
|
+
}
|
|
39
|
+
export type ThemeName = Extract<keyof NxgtThemes, string>;
|
|
40
|
+
/** The default theme: Lavande, which sets no `data-nxgt-theme`. */
|
|
41
|
+
export declare const DEFAULT_THEME: "lavande";
|
|
42
|
+
/**
|
|
43
|
+
* A stored name when it is a known theme (any well-formed name when `known` is
|
|
44
|
+
* left out), else `fallback`. A name that is no longer known resolves to the
|
|
45
|
+
* default.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveThemeName(stored: string | null | undefined, known: readonly string[] | undefined, fallback: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Puts the name on `<html data-nxgt-theme>`; the default, Lavande, takes the
|
|
50
|
+
* attribute off, as the boot script never sets it. No-op without `document`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function applyThemeName(name: string): void;
|
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
import { ThemePreference } from './resolve-theme.js';
|
|
2
|
-
|
|
2
|
+
/** The theme name's key: the same as core's `THEME_STORAGE_KEY` (a spec holds them together). */
|
|
3
|
+
export declare const THEME_NAME_KEY = "nxgt-theme";
|
|
3
4
|
export declare const themeStore: {
|
|
4
|
-
subscribe(listener: () => void)
|
|
5
|
-
getSnapshot:
|
|
5
|
+
subscribe: (listener: () => void) => () => void;
|
|
6
|
+
getSnapshot: () => string | undefined;
|
|
6
7
|
getServerSnapshot: () => string | undefined;
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* `system` clears the key, unless a first visit would not be `system`
|
|
10
|
+
* (`defaultMode`: a theme's `colorScheme`): then it is stored, or clearing
|
|
11
|
+
* it would bring the suggestion back.
|
|
12
|
+
*/
|
|
13
|
+
set(next: ThemePreference, defaultMode?: ThemePreference): void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The mounted `NxgtThemeProvider`, when there is one: it owns
|
|
17
|
+
* `<html data-nxgt-theme>`, so the store only stores. Its themes say which
|
|
18
|
+
* names are acceptable, and its default is what a cleared key means.
|
|
19
|
+
*/
|
|
20
|
+
interface Owner {
|
|
21
|
+
known: readonly string[];
|
|
22
|
+
fallback: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const themeNameStore: {
|
|
25
|
+
subscribe: (listener: () => void) => () => void;
|
|
26
|
+
getSnapshot: () => string | undefined;
|
|
27
|
+
getServerSnapshot: () => string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Called by the provider while it is mounted; the returned function gives
|
|
30
|
+
* the attribute back to the store.
|
|
31
|
+
*/
|
|
32
|
+
claim(next: Owner): () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Stores the name (JSON, like `theme`). Without a provider it also applies
|
|
35
|
+
* it to `<html>`; under one, a name the provider does not know is ignored
|
|
36
|
+
* (with a warning in development) and the provider writes the attribute.
|
|
37
|
+
*/
|
|
38
|
+
set(next: string): void;
|
|
8
39
|
};
|
|
9
40
|
export {};
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
import { ThemePreference } from './resolve-theme.js';
|
|
1
|
+
import { ThemeName, ThemePreference } from './resolve-theme.js';
|
|
2
|
+
export interface UseThemeOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The mode when none is stored. Default: the one `NxgtThemeProvider`
|
|
5
|
+
* gives (its `defaultMode`, else the active theme's `colorScheme`), else
|
|
6
|
+
* `'system'`.
|
|
7
|
+
*/
|
|
8
|
+
defaultMode?: ThemePreference;
|
|
9
|
+
}
|
|
2
10
|
/**
|
|
3
11
|
* The resolved theme and the stored preference. Every caller reads the same
|
|
4
12
|
* store, so a toggle anywhere re-renders every reader (CodeBlock, CodeEditor…).
|
|
5
|
-
* On the server, and while hydrating, the preference is
|
|
13
|
+
* On the server, and while hydrating, the preference is the first-visit one
|
|
14
|
+
* (`'system'` unless a provider or `defaultMode` says otherwise) and the theme
|
|
15
|
+
* name is the default (`'lavande'`, or the provider's). The name is stored
|
|
16
|
+
* apart from the mode, under `nxgt-theme`; under a `NxgtThemeProvider` or a
|
|
17
|
+
* `NxgtTheme` zone, `themeName` is the nearest one's. With no provider, the
|
|
18
|
+
* stored preset's `colorScheme` is still the first-visit mode (`bluemoon`:
|
|
19
|
+
* dark); an app's own theme needs the provider, or `defaultMode`.
|
|
6
20
|
*/
|
|
7
|
-
export declare function useTheme(): {
|
|
21
|
+
export declare function useTheme(options?: UseThemeOptions): {
|
|
8
22
|
theme: import('./resolve-theme.js').ResolvedTheme;
|
|
9
23
|
preference: ThemePreference;
|
|
10
24
|
updateTheme: (next: ThemePreference) => void;
|
|
25
|
+
themeName: ThemeName;
|
|
26
|
+
setThemeName: (next: ThemeName) => void;
|
|
11
27
|
};
|
|
12
|
-
export type { ResolvedTheme, ThemePreference } from './resolve-theme.js';
|
|
28
|
+
export type { ResolvedTheme, ThemeName, ThemePreference, } from './resolve-theme.js';
|
|
@@ -1176,6 +1176,10 @@ export declare const resources: {
|
|
|
1176
1176
|
"rating-field": {
|
|
1177
1177
|
star: string;
|
|
1178
1178
|
};
|
|
1179
|
+
"theme-picker": {
|
|
1180
|
+
label: string;
|
|
1181
|
+
mode: string;
|
|
1182
|
+
};
|
|
1179
1183
|
"theme-toggle": {
|
|
1180
1184
|
light: string;
|
|
1181
1185
|
dark: string;
|
|
@@ -3838,6 +3842,10 @@ export declare const resources: {
|
|
|
3838
3842
|
"rating-field": {
|
|
3839
3843
|
star: string;
|
|
3840
3844
|
};
|
|
3845
|
+
"theme-picker": {
|
|
3846
|
+
label: string;
|
|
3847
|
+
mode: string;
|
|
3848
|
+
};
|
|
3841
3849
|
"theme-toggle": {
|
|
3842
3850
|
light: string;
|
|
3843
3851
|
dark: string;
|