@nxgt/material 3.7.5 → 3.8.1
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 +56 -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-DNUYg8QM.js} +18625 -18532
- 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/account-menu/account-menu-avatar.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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as e } from "./tooltip-
|
|
2
|
-
import { c as t, n, t as r } from "./dropdown-menu-
|
|
3
|
-
import { t as i } from "./use-material-translation-
|
|
4
|
-
import { a, i as o, n as s, o as c, t as l } from "./code-language-items-
|
|
1
|
+
import { t as e } from "./tooltip-rhbqNmr3.js";
|
|
2
|
+
import { c as t, n, t as r } from "./dropdown-menu-BC5Tbhb9.js";
|
|
3
|
+
import { t as i } from "./use-material-translation-DkxcLbLM.js";
|
|
4
|
+
import { a, i as o, n as s, o as c, t as l } from "./code-language-items-C_dJ6GVs.js";
|
|
5
5
|
import { i as u, n as d, r as f, s as p } from "./dist-C3GR7kJd.js";
|
|
6
6
|
import { t as m } from "./code-block-spec-CGLKRhwD.js";
|
|
7
7
|
import { Check as h, ChevronDown as g, Copy as _, Maximize2 as v, WrapText as y } from "lucide-react";
|
|
@@ -143,7 +143,7 @@ function M({ node: e, editor: t, updateAttributes: n, editable: r, wrap: a, onWr
|
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region lib/components/ui/widgets/editor/extensions/code/code-block-open.tsx
|
|
146
|
-
var N = x(() => import("./code-editor-
|
|
146
|
+
var N = x(() => import("./code-editor-BiA14xua.js").then((e) => e.n).then((e) => ({ default: e.CodeEditor })));
|
|
147
147
|
function P() {
|
|
148
148
|
let { t: e } = i();
|
|
149
149
|
return /* @__PURE__ */ T("div", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./utils-Bcd2Z3ea.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as n } from "./use-material-translation-
|
|
4
|
-
import { t as r } from "./icon-button-
|
|
2
|
+
import { t } from "./dist-DVRQkaTK.js";
|
|
3
|
+
import { t as n } from "./use-material-translation-DkxcLbLM.js";
|
|
4
|
+
import { t as r } from "./icon-button-DJcWpIhu.js";
|
|
5
5
|
import { t as i } from "./compose-refs-DZ0iIVF-.js";
|
|
6
6
|
import { GripVertical as a } from "lucide-react";
|
|
7
7
|
import o, { cloneElement as s, createContext as c, forwardRef as l, memo as u, useCallback as d, useContext as f, useEffect as p, useLayoutEffect as m, useMemo as h, useReducer as g, useRef as _, useState as v } from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./utils-Bcd2Z3ea.js";
|
|
2
|
-
import { o as t } from "./tooltip-
|
|
3
|
-
import { t as n } from "./use-material-translation-
|
|
2
|
+
import { o as t } from "./tooltip-rhbqNmr3.js";
|
|
3
|
+
import { t as n } from "./use-material-translation-DkxcLbLM.js";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
//#region lib/components/ui/feedback/spinner/spinner.tsx
|
|
6
6
|
var i = t("transition-all duration-500", {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { t as e } from "./read-storage-C2J90bNm.js";
|
|
1
2
|
//#endregion
|
|
2
3
|
//#region lib/i18n/resources/resources.ts
|
|
3
|
-
var
|
|
4
|
+
var t = {
|
|
4
5
|
en: { material: {
|
|
5
6
|
"empty-state": {
|
|
6
7
|
"not-found": {
|
|
@@ -1133,6 +1134,10 @@ var e = {
|
|
|
1133
1134
|
empty: "No country found"
|
|
1134
1135
|
},
|
|
1135
1136
|
"rating-field": { star: "{value} of {max}" },
|
|
1137
|
+
"theme-picker": {
|
|
1138
|
+
label: "Theme",
|
|
1139
|
+
mode: "Mode"
|
|
1140
|
+
},
|
|
1136
1141
|
"theme-toggle": {
|
|
1137
1142
|
light: "Light",
|
|
1138
1143
|
dark: "Dark",
|
|
@@ -3727,6 +3732,10 @@ var e = {
|
|
|
3727
3732
|
empty: "Aucun pays trouvé"
|
|
3728
3733
|
},
|
|
3729
3734
|
"rating-field": { star: "{value} sur {max}" },
|
|
3735
|
+
"theme-picker": {
|
|
3736
|
+
label: "Thème",
|
|
3737
|
+
mode: "Mode"
|
|
3738
|
+
},
|
|
3730
3739
|
"theme-toggle": {
|
|
3731
3740
|
light: "Clair",
|
|
3732
3741
|
dark: "Sombre",
|
|
@@ -5189,21 +5198,12 @@ var e = {
|
|
|
5189
5198
|
}
|
|
5190
5199
|
}
|
|
5191
5200
|
} }
|
|
5192
|
-
},
|
|
5193
|
-
//#endregion
|
|
5194
|
-
//#region lib/lib/read-storage.ts
|
|
5195
|
-
function i(e) {
|
|
5196
|
-
try {
|
|
5197
|
-
return globalThis.localStorage?.getItem(e) ?? null;
|
|
5198
|
-
} catch {
|
|
5199
|
-
return null;
|
|
5200
|
-
}
|
|
5201
|
-
}
|
|
5201
|
+
}, n = "language", r = "en", i = Object.keys(t);
|
|
5202
5202
|
//#endregion
|
|
5203
5203
|
//#region lib/i18n/stored-language.ts
|
|
5204
|
-
function a(
|
|
5205
|
-
let
|
|
5206
|
-
return
|
|
5204
|
+
function a(t, n, r) {
|
|
5205
|
+
let i = e(t);
|
|
5206
|
+
return i && r.includes(i) ? i : n;
|
|
5207
5207
|
}
|
|
5208
5208
|
//#endregion
|
|
5209
|
-
export {
|
|
5209
|
+
export { t as a, i, r as n, n as r, a as t };
|
package/dist/styles.css
CHANGED
|
@@ -36,7 +36,12 @@
|
|
|
36
36
|
--radius-field-inner: var(--nxgt-field-inner-radius);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
/* Colours and radius are inline: a utility reads `var(--primary)` where it is
|
|
40
|
+
* used, not a `--color-primary` computed once on :root, so a zone
|
|
41
|
+
* (`[data-nxgt-theme]`, a `.dark` wrapper) that sets `--primary` below :root
|
|
42
|
+
* reaches `bg-primary`. Tailwind still emits the `--color-*` a page uses, as
|
|
43
|
+
* before, for app CSS that reads `var(--color-primary)`. */
|
|
44
|
+
@theme inline {
|
|
40
45
|
--radius-sm: calc(var(--radius) - 4px);
|
|
41
46
|
--radius-md: calc(var(--radius) - 2px);
|
|
42
47
|
--radius-lg: var(--radius);
|
|
@@ -102,7 +107,9 @@
|
|
|
102
107
|
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
103
108
|
--color-sidebar-border: var(--sidebar-border);
|
|
104
109
|
--color-sidebar-ring: var(--sidebar-ring);
|
|
110
|
+
}
|
|
105
111
|
|
|
112
|
+
@theme {
|
|
106
113
|
--ease-spatial-fast: var(--nxgt-motion-spatial-fast);
|
|
107
114
|
--ease-spatial-default: var(--nxgt-motion-spatial-default);
|
|
108
115
|
--ease-spatial-slow: var(--nxgt-motion-spatial-slow);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
//#region lib/themes/theme-context.ts
|
|
3
|
+
var n = e(null), r = e(null), i = {
|
|
4
|
+
preset: "gradient",
|
|
5
|
+
tone: "primary",
|
|
6
|
+
intensity: "default"
|
|
7
|
+
};
|
|
8
|
+
function a() {
|
|
9
|
+
return t(r);
|
|
10
|
+
}
|
|
11
|
+
function o(e) {
|
|
12
|
+
let { preset: t, tone: n, intensity: r, seed: i, motif: a, moon: o, grain: s, animated: c } = e;
|
|
13
|
+
return t === "gradient" && (n ?? "primary") === "primary" && (r ?? "default") === "default" && !i && !a && !o && !s && !c;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { a, o as i, r as n, n as r, i as t };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { t as e } from "./utils-Bcd2Z3ea.js";
|
|
2
|
+
import { a as t, i as n, n as r, o as i, r as a, t as o } from "./bubble-input-B7BVd9fX.js";
|
|
3
|
+
import { t as s } from "./use-material-translation-DkxcLbLM.js";
|
|
4
|
+
import { t as c } from "./use-theme-Cd-aiDJo.js";
|
|
5
|
+
import { a as l, r as u } from "./theme-context-BagPvRcz.js";
|
|
6
|
+
import { t as d } from "./theme-toggle-C8os82b4.js";
|
|
7
|
+
import { n as f, t as p } from "./nxgt-theme-CgSb9Obl.js";
|
|
8
|
+
import { Check as m } from "lucide-react";
|
|
9
|
+
import { useContext as h } from "react";
|
|
10
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
11
|
+
import { THEME_PRESETS as v } from "@nxgt/material-core/theme/presets";
|
|
12
|
+
//#region lib/theme-picker/partials/mode-control.tsx
|
|
13
|
+
function y() {
|
|
14
|
+
let { t: e } = s();
|
|
15
|
+
return /* @__PURE__ */ _("fieldset", {
|
|
16
|
+
"data-slot": "theme-picker-mode",
|
|
17
|
+
className: "m-0 flex min-w-0 items-center justify-between gap-3 border-0 p-0",
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ g("legend", {
|
|
20
|
+
className: "sr-only",
|
|
21
|
+
children: e("material.theme-picker.mode", "Mode")
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ g("span", {
|
|
24
|
+
"aria-hidden": !0,
|
|
25
|
+
className: "text-sm font-medium text-muted-foreground",
|
|
26
|
+
children: e("material.theme-picker.mode", "Mode")
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ g(d, {})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region lib/theme-picker/partials/mini-background.tsx
|
|
34
|
+
function b({ background: e }) {
|
|
35
|
+
return /* @__PURE__ */ g("span", {
|
|
36
|
+
"aria-hidden": !0,
|
|
37
|
+
"data-slot": "theme-tile-background",
|
|
38
|
+
"data-preset": e ? e.preset : "none",
|
|
39
|
+
"data-tone": e ? e.tone ?? "primary" : "none",
|
|
40
|
+
"data-intensity": e ? e.intensity ?? "default" : "none"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region lib/theme-picker/partials/theme-tile.tsx
|
|
45
|
+
function x({ theme: e, label: r, showBackground: s, background: c }) {
|
|
46
|
+
let l = /* @__PURE__ */ g(p, {
|
|
47
|
+
theme: e,
|
|
48
|
+
asChild: !0,
|
|
49
|
+
children: /* @__PURE__ */ _(i, {
|
|
50
|
+
"data-slot": "theme-tile",
|
|
51
|
+
children: [
|
|
52
|
+
s && /* @__PURE__ */ g(b, { background: c }),
|
|
53
|
+
/* @__PURE__ */ _("span", {
|
|
54
|
+
"data-slot": "theme-tile-swatches",
|
|
55
|
+
"aria-hidden": !0,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ g("i", { "data-swatch": "primary" }),
|
|
58
|
+
/* @__PURE__ */ g("i", { "data-swatch": "secondary" }),
|
|
59
|
+
/* @__PURE__ */ g("i", { "data-swatch": "tertiary" })
|
|
60
|
+
]
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ g("span", {
|
|
63
|
+
"data-slot": "theme-tile-label",
|
|
64
|
+
children: r
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ g(a, {
|
|
67
|
+
asChild: !0,
|
|
68
|
+
children: /* @__PURE__ */ g(m, {
|
|
69
|
+
"aria-hidden": !0,
|
|
70
|
+
"data-slot": "theme-tile-check"
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
return /* @__PURE__ */ g(t, {
|
|
77
|
+
value: e.name,
|
|
78
|
+
...o(l, /* @__PURE__ */ g(n, {}))
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region lib/theme-picker/theme-label.ts
|
|
83
|
+
function S(e, t) {
|
|
84
|
+
let { label: n, name: r } = e;
|
|
85
|
+
if (typeof n == "string") return n;
|
|
86
|
+
if (n) {
|
|
87
|
+
let e = t?.split("-")[0], r = t && n[t] || e && n[e] || n.en || Object.values(n)[0];
|
|
88
|
+
if (r) return r;
|
|
89
|
+
}
|
|
90
|
+
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region lib/theme-picker/theme-picker.tsx
|
|
94
|
+
function C({ themes: t, value: n, onValueChange: i, showMode: a = !0, showBackground: o = !0, layout: d = "grid", className: p, ...m }) {
|
|
95
|
+
let { t: b, language: C } = s(), w = h(u), { themeName: T, setThemeName: E } = c(), D = l()?.name ?? T, O = t ?? w ?? v;
|
|
96
|
+
return /* @__PURE__ */ _("div", {
|
|
97
|
+
"data-slot": "theme-picker",
|
|
98
|
+
"data-layout": d,
|
|
99
|
+
className: e("flex flex-col gap-4", p),
|
|
100
|
+
...m,
|
|
101
|
+
children: [/* @__PURE__ */ g(r, {
|
|
102
|
+
"data-slot": "theme-picker-group",
|
|
103
|
+
"aria-label": b("material.theme-picker.label", "Theme"),
|
|
104
|
+
value: n ?? D,
|
|
105
|
+
onValueChange: (e) => {
|
|
106
|
+
n === void 0 && E(e), i?.(e);
|
|
107
|
+
},
|
|
108
|
+
children: O.map((e) => /* @__PURE__ */ g(x, {
|
|
109
|
+
theme: e,
|
|
110
|
+
label: S(e, C),
|
|
111
|
+
showBackground: o,
|
|
112
|
+
background: f(e.name, e).background
|
|
113
|
+
}, e.name))
|
|
114
|
+
}), a && /* @__PURE__ */ g(y, {})]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { C as ThemePicker };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { t as e } from "./read-storage-C2J90bNm.js";
|
|
2
|
+
import { t } from "./warn-once-C_e47JM8.js";
|
|
3
|
+
import { DEFAULT_THEME_NAME as n, THEME_NAME_PATTERN as r } from "@nxgt/material-core/theme/boot";
|
|
4
|
+
//#region lib/hooks/resolve-theme.ts
|
|
5
|
+
function i(e, t, n = "system") {
|
|
6
|
+
let r = e === "light" || e === "dark" || e === "system" ? e : n;
|
|
7
|
+
return {
|
|
8
|
+
theme: r === "system" ? t ? "dark" : "light" : r,
|
|
9
|
+
preference: r
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function a(e) {
|
|
13
|
+
typeof document > "u" || (document.documentElement.classList.toggle("dark", e === "dark"), document.documentElement.style.colorScheme = e);
|
|
14
|
+
}
|
|
15
|
+
var o = n;
|
|
16
|
+
function s(e, t, n) {
|
|
17
|
+
return typeof e != "string" || !r.test(e) || t && !t.includes(e) ? n : e;
|
|
18
|
+
}
|
|
19
|
+
function c(e) {
|
|
20
|
+
if (typeof document > "u") return;
|
|
21
|
+
let t = document.documentElement;
|
|
22
|
+
e === o ? t.removeAttribute("data-nxgt-theme") : t.setAttribute("data-nxgt-theme", e);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region lib/hooks/theme-store.ts
|
|
26
|
+
var l = "theme", u = "nxgt-theme";
|
|
27
|
+
function d(t, n) {
|
|
28
|
+
let r = /* @__PURE__ */ new Set(), i;
|
|
29
|
+
function a() {
|
|
30
|
+
let n = e(t);
|
|
31
|
+
if (n == null) return i;
|
|
32
|
+
try {
|
|
33
|
+
let e = JSON.parse(n);
|
|
34
|
+
return typeof e == "string" ? e : void 0;
|
|
35
|
+
} catch {
|
|
36
|
+
return n;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function o() {
|
|
40
|
+
for (let e of r) e();
|
|
41
|
+
}
|
|
42
|
+
function s(e) {
|
|
43
|
+
e.key !== t && e.key !== null || (n?.(), o());
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
subscribe(e) {
|
|
47
|
+
return r.add(e), r.size === 1 && typeof window < "u" && window.addEventListener("storage", s), () => {
|
|
48
|
+
r.delete(e), r.size === 0 && typeof window < "u" && window.removeEventListener("storage", s);
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
getSnapshot: a,
|
|
52
|
+
getServerSnapshot: () => void 0,
|
|
53
|
+
write(e) {
|
|
54
|
+
i = void 0;
|
|
55
|
+
try {
|
|
56
|
+
e === void 0 ? globalThis.localStorage?.removeItem(t) : globalThis.localStorage?.setItem(t, JSON.stringify(e));
|
|
57
|
+
} catch {
|
|
58
|
+
i = e;
|
|
59
|
+
}
|
|
60
|
+
o();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
var f = d(l), p = {
|
|
65
|
+
subscribe: f.subscribe,
|
|
66
|
+
getSnapshot: f.getSnapshot,
|
|
67
|
+
getServerSnapshot: f.getServerSnapshot,
|
|
68
|
+
set(e, t = "system") {
|
|
69
|
+
f.write(e === "system" && t === "system" ? void 0 : e);
|
|
70
|
+
}
|
|
71
|
+
}, m, h = d(u, () => {
|
|
72
|
+
m || c(s(h.getSnapshot(), void 0, o));
|
|
73
|
+
}), g = {
|
|
74
|
+
subscribe: h.subscribe,
|
|
75
|
+
getSnapshot: h.getSnapshot,
|
|
76
|
+
getServerSnapshot: h.getServerSnapshot,
|
|
77
|
+
claim(e) {
|
|
78
|
+
return m = e, () => {
|
|
79
|
+
m === e && (m = void 0);
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
set(e) {
|
|
83
|
+
if (m && !m.known.includes(e)) {
|
|
84
|
+
t(`setThemeName("${e}") ignored: not one of its themes (${m.known.join(", ")}).`, "NxgtThemeProvider");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
h.write(e), m || c(e);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { c as a, a as i, p as n, i as o, o as r, s, g as t };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { t as e } from "./use-material-translation-DkxcLbLM.js";
|
|
2
|
+
import { i as t } from "./theme-store-CSl51uNH.js";
|
|
3
|
+
import { n, t as r } from "./use-theme-Cd-aiDJo.js";
|
|
4
|
+
import { r as i } from "./theme-context-BagPvRcz.js";
|
|
5
|
+
import { n as a, t as o } from "./toggle-group-j8zaxEg1.js";
|
|
6
|
+
import { Monitor as s, Moon as c, Sun as l } from "lucide-react";
|
|
7
|
+
import { useContext as u, useEffect as d } from "react";
|
|
8
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
|
+
//#region lib/components/ui/actions/theme-toggle/theme-toggle.tsx
|
|
10
|
+
function m({ className: m }) {
|
|
11
|
+
let { t: h } = e(), { theme: g, preference: _, updateTheme: v } = r(), y = n(), b = u(i) !== null;
|
|
12
|
+
return d(() => {
|
|
13
|
+
y && !b && t(g);
|
|
14
|
+
}, [
|
|
15
|
+
y,
|
|
16
|
+
b,
|
|
17
|
+
g
|
|
18
|
+
]), /* @__PURE__ */ p(o, {
|
|
19
|
+
type: "single",
|
|
20
|
+
value: _,
|
|
21
|
+
"data-slot": "theme-toggle",
|
|
22
|
+
variant: "segmented",
|
|
23
|
+
size: "sm",
|
|
24
|
+
className: m,
|
|
25
|
+
onValueChange: (e) => {
|
|
26
|
+
(e === "light" || e === "dark" || e === "system") && v(e);
|
|
27
|
+
},
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ f(a, {
|
|
30
|
+
value: "light",
|
|
31
|
+
"aria-label": h("material.theme-toggle.light", "Light"),
|
|
32
|
+
children: /* @__PURE__ */ f(l, {})
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ f(a, {
|
|
35
|
+
value: "dark",
|
|
36
|
+
"aria-label": h("material.theme-toggle.dark", "Dark"),
|
|
37
|
+
children: /* @__PURE__ */ f(c, {})
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ f(a, {
|
|
40
|
+
value: "system",
|
|
41
|
+
"aria-label": h("material.theme-toggle.system", "System"),
|
|
42
|
+
children: /* @__PURE__ */ f(s, {})
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { m as t };
|
package/dist/themes.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { t as e } from "./is-production-GLw59WU8.js";
|
|
2
|
+
import { t } from "./use-ssr-media-query-C6M5m8sf.js";
|
|
3
|
+
import { a as n, i as r, n as i, o as a, r as o, s, t as c } from "./theme-store-CSl51uNH.js";
|
|
4
|
+
import { a as l, n as u, r as d } from "./theme-context-BagPvRcz.js";
|
|
5
|
+
import { t as f } from "./warn-once-C_e47JM8.js";
|
|
6
|
+
import { n as p, t as m } from "./nxgt-theme-CgSb9Obl.js";
|
|
7
|
+
import { useEffect as h, useLayoutEffect as g, useMemo as _, useSyncExternalStore as v } from "react";
|
|
8
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
9
|
+
import { THEME_BOOT_SCRIPT as b, themeBootScript as x } from "@nxgt/material-core/theme/boot";
|
|
10
|
+
import { ThemeDefinitionError as S, defineTheme as C } from "@nxgt/material-core/theme/define";
|
|
11
|
+
import { THEME_PRESETS as w, THEME_PRESETS as T, ambre as E, ardoise as D, bleumono as O, bluemoon as k, corail as A, foret as j, lavande as M, menthe as N, ocean as P, pink as F, prune as I, sable as L, slate as R, teal as z } from "@nxgt/material-core/theme/presets";
|
|
12
|
+
//#region lib/themes/nxgt-theme-provider.tsx
|
|
13
|
+
var B = () => () => {}, V = () => v(B, () => !1, () => !0);
|
|
14
|
+
function H({ themes: l = T, defaultTheme: m = o, defaultMode: b, children: x }) {
|
|
15
|
+
let S = v(c.subscribe, c.getSnapshot, c.getServerSnapshot), C = V(), w = _(() => l.map((e) => e.name), [l]);
|
|
16
|
+
!e() && !w.includes(m) && f(`defaultTheme "${m}" is not in themes (${w.join(", ")}).`, "NxgtThemeProvider");
|
|
17
|
+
let E = s(S, w, m), D = l.find((e) => e.name === E), O = b ?? D?.colorScheme ?? "system";
|
|
18
|
+
g(() => c.claim({
|
|
19
|
+
known: w,
|
|
20
|
+
fallback: m
|
|
21
|
+
}), [w, m]), h(() => {
|
|
22
|
+
C || n(E);
|
|
23
|
+
}, [E, C]);
|
|
24
|
+
let k = a(v(i.subscribe, i.getSnapshot, i.getServerSnapshot), t("(prefers-color-scheme: dark)", !1), O).theme;
|
|
25
|
+
h(() => {
|
|
26
|
+
C || r(k);
|
|
27
|
+
}, [k, C]);
|
|
28
|
+
let A = _(() => p(E, D, O), [
|
|
29
|
+
E,
|
|
30
|
+
D,
|
|
31
|
+
O
|
|
32
|
+
]);
|
|
33
|
+
return /* @__PURE__ */ y(d.Provider, {
|
|
34
|
+
value: l,
|
|
35
|
+
children: /* @__PURE__ */ y(u.Provider, {
|
|
36
|
+
value: A,
|
|
37
|
+
children: x
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { m as NxgtTheme, H as NxgtThemeProvider, b as THEME_BOOT_SCRIPT, w as THEME_PRESETS, S as ThemeDefinitionError, E as ambre, D as ardoise, O as bleumono, k as bluemoon, A as corail, C as defineTheme, j as foret, M as lavande, N as menthe, P as ocean, F as pink, I as prune, L as sable, R as slate, z as teal, x as themeBootScript, l as useThemeContext };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { t as e } from "./utils-Bcd2Z3ea.js";
|
|
2
|
+
import { n as t } from "./dist-DVRQkaTK.js";
|
|
3
|
+
import { a as n, n as r, t as i } from "./dist-B7RjY7SL.js";
|
|
4
|
+
import { t as a } from "./has-text-content-Ds2dkHX_.js";
|
|
5
|
+
import { Check as o } from "lucide-react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
//#region lib/components/ui/primitives/separator/separator.tsx
|
|
8
|
+
function l({ className: t, orientation: r = "horizontal", decorative: i = !0, ...a }) {
|
|
9
|
+
return /* @__PURE__ */ s(n, {
|
|
10
|
+
"data-slot": "separator",
|
|
11
|
+
decorative: i,
|
|
12
|
+
orientation: r,
|
|
13
|
+
className: e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", t),
|
|
14
|
+
...a
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region lib/components/ui/primitives/toggle-group/toggle-group.variants.ts
|
|
19
|
+
function u(e) {
|
|
20
|
+
return e === "outlined" ? "separate" : e === "segmented" || e === "separate" ? e : "connected";
|
|
21
|
+
}
|
|
22
|
+
function d(e) {
|
|
23
|
+
return e === "sm" || e === "lg" ? e : "md";
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region lib/components/ui/primitives/toggle-group/toggle-group.tsx
|
|
27
|
+
function f({ className: t, variant: n, size: r, orientation: a, children: o, ...l }) {
|
|
28
|
+
let f = u(n);
|
|
29
|
+
return /* @__PURE__ */ c(i, {
|
|
30
|
+
"data-slot": "toggle-group",
|
|
31
|
+
"data-variant": f,
|
|
32
|
+
"data-size": d(r),
|
|
33
|
+
"data-orientation": a ?? "horizontal",
|
|
34
|
+
"data-type": l.type,
|
|
35
|
+
"data-pw": "toggle-group",
|
|
36
|
+
orientation: a,
|
|
37
|
+
className: e("nxgt-toggle-group", t),
|
|
38
|
+
...l,
|
|
39
|
+
children: [o, f === "segmented" && l.type === "single" ? /* @__PURE__ */ s("span", {
|
|
40
|
+
"data-slot": "toggle-group-indicator",
|
|
41
|
+
"aria-hidden": "true"
|
|
42
|
+
}) : null]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function p({ className: n, children: i, variant: l, size: u, ...d }) {
|
|
46
|
+
let f = !a(i) && !!(d["aria-label"] || d["aria-labelledby"]);
|
|
47
|
+
return /* @__PURE__ */ c(r, {
|
|
48
|
+
"data-slot": "toggle-group-item",
|
|
49
|
+
"data-pw": d.value ? `toggle-group-item-${d.value}` : "toggle-group-item",
|
|
50
|
+
"data-icon-only": f ? "" : void 0,
|
|
51
|
+
className: e("nxgt-toggle-group-item", n),
|
|
52
|
+
...d,
|
|
53
|
+
children: [/* @__PURE__ */ s("span", {
|
|
54
|
+
"data-slot": "toggle-group-check",
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: /* @__PURE__ */ s(o, { strokeWidth: 2.75 })
|
|
57
|
+
}), /* @__PURE__ */ s(t, { children: i })]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function m({ className: t, ...n }) {
|
|
61
|
+
return /* @__PURE__ */ s(l, {
|
|
62
|
+
"data-slot": "toggle-group-separator",
|
|
63
|
+
className: e("h-6! bg-muted-foreground/60 mx-1", t),
|
|
64
|
+
orientation: "vertical",
|
|
65
|
+
...n
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { l as i, p as n, m as r, f as t };
|