@atomazing-org/design-system 1.0.62 → 1.0.63
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/README.md +82 -0
- package/dist/index.d.mts +86 -49
- package/dist/index.d.ts +86 -49
- package/dist/index.js +49 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
- package/README.MD +0 -227
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@atomazing-org/design-system
|
|
2
|
+
|
|
3
|
+
Modern MUI + Emotion design system with a ready theme factory, extended typography, global styles, component overrides, animations, and handy utilities.
|
|
4
|
+
|
|
5
|
+
Contents
|
|
6
|
+
- Introduction
|
|
7
|
+
- Installation
|
|
8
|
+
- Quick Start
|
|
9
|
+
- Extended Palette (4 variants)
|
|
10
|
+
- Ad‑hoc Custom Colors
|
|
11
|
+
- SSR Notes
|
|
12
|
+
- Peer Dependencies
|
|
13
|
+
|
|
14
|
+
Introduction
|
|
15
|
+
The package streamlines consistent theming across apps: dark/light mode, typography variants, global styles, and component defaults. Built on MUI v7 + Emotion.
|
|
16
|
+
|
|
17
|
+
Installation
|
|
18
|
+
```bash
|
|
19
|
+
npm install @atomazing-org/design-system
|
|
20
|
+
npm install @mui/material @mui/icons-material @emotion/react @emotion/styled @emotion/css
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Quick Start
|
|
24
|
+
```tsx
|
|
25
|
+
import { ThemeProviderWrapper } from '@atomazing-org/design-system';
|
|
26
|
+
|
|
27
|
+
export function App() {
|
|
28
|
+
return (
|
|
29
|
+
<ThemeProviderWrapper>
|
|
30
|
+
{/* your app */}
|
|
31
|
+
</ThemeProviderWrapper>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Extended Palette (4 variants)
|
|
37
|
+
The design system adds four typed colors to the MUI palette, available on common components via the `color` prop:
|
|
38
|
+
|
|
39
|
+
- brand: project brand color (independent from `primary`); defaults to the currently selected theme’s primary.
|
|
40
|
+
- neutral: neutral/gray scale color (from the design-system palette).
|
|
41
|
+
- accent: supporting accent color (from palette `accent`).
|
|
42
|
+
- muted: soft/desaturated color (based on neutral by default).
|
|
43
|
+
|
|
44
|
+
Supported components (out of the box): `Button`, `Chip`, `Badge`, `Alert`.
|
|
45
|
+
|
|
46
|
+
Examples
|
|
47
|
+
```tsx
|
|
48
|
+
import { Button, Chip, Alert } from '@mui/material';
|
|
49
|
+
|
|
50
|
+
<Button color="brand" variant="contained">Brand</Button>
|
|
51
|
+
<Button color="neutral" variant="outlined">Neutral</Button>
|
|
52
|
+
<Chip color="accent" label="Accent" />
|
|
53
|
+
<Alert color="muted" variant="filled">Muted Alert</Alert>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Ad‑hoc Custom Colors
|
|
57
|
+
If you need additional colors without extending types, use `customColors`. They will be available under `theme.palette.custom[<name>]` with generated light/dark/contrast shades.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<ThemeProviderWrapper customColors={{ marketing: '#FF6A00', accent2: '#4ADE80' }}>
|
|
61
|
+
{/* ... */}
|
|
62
|
+
</ThemeProviderWrapper>
|
|
63
|
+
|
|
64
|
+
// Usage
|
|
65
|
+
import { Box } from '@mui/material';
|
|
66
|
+
|
|
67
|
+
<Box sx={{ bgcolor: (t) => t.palette.custom?.marketing.main }} />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Notes
|
|
71
|
+
- To add more typed colors to the `color` prop, augment MUI types (see `src/styles/muiAugmentations.d.ts`).
|
|
72
|
+
- You can override the global color palette via `colorPaletteOverride` and theme map via `themeConfigOverride`.
|
|
73
|
+
|
|
74
|
+
SSR Notes
|
|
75
|
+
- The library guards `localStorage`/`navigator` usage. Wrap your app in `<ThemeProviderWrapper>` as usual in SSR frameworks; settings hydrate on the client.
|
|
76
|
+
|
|
77
|
+
Peer Dependencies
|
|
78
|
+
- `@mui/material` ^7
|
|
79
|
+
- `@mui/icons-material` ^7
|
|
80
|
+
- `@emotion/react` ^11
|
|
81
|
+
- `@emotion/styled` ^11
|
|
82
|
+
- `@emotion/css` ^11 (optional)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _emotion_styled from '@emotion/styled';
|
|
2
2
|
import * as _emotion_react from '@emotion/react';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
|
-
import React__default, { ErrorInfo, FC, PropsWithChildren } from 'react';
|
|
4
|
+
import React__default, { ErrorInfo, ReactNode, FC, PropsWithChildren } from 'react';
|
|
5
5
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
6
6
|
import * as _mui_material from '@mui/material';
|
|
7
7
|
import { Theme, PaletteMode } from '@mui/material';
|
|
@@ -46,7 +46,7 @@ type DarkModeOptions = "system" | "auto" | "light" | "dark";
|
|
|
46
46
|
interface OptionItem {
|
|
47
47
|
label: string;
|
|
48
48
|
value: DarkModeOptions;
|
|
49
|
-
icon:
|
|
49
|
+
icon: ReactNode;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Represents user-specific theme preferences stored in the application.
|
|
@@ -198,33 +198,41 @@ declare module "@mui/material/Typography" {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
interface ColorPaletteType {
|
|
202
|
+
fontDark: string;
|
|
203
|
+
fontLight: string;
|
|
204
|
+
brand: string;
|
|
205
|
+
accent: string;
|
|
206
|
+
muted: string;
|
|
207
|
+
success: string;
|
|
208
|
+
info: string;
|
|
209
|
+
warning: string;
|
|
210
|
+
error: string;
|
|
211
|
+
neutral: string;
|
|
212
|
+
}
|
|
202
213
|
|
|
203
|
-
declare const
|
|
214
|
+
declare const darkModeOptions: OptionItem[];
|
|
204
215
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
*/
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*/
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
* @returns `true` if white text is recommended; otherwise, `false`.
|
|
226
|
-
*/
|
|
227
|
-
declare const isFontLight: (color: string) => boolean;
|
|
216
|
+
declare const defaultColorPalette: ColorPaletteType;
|
|
217
|
+
|
|
218
|
+
declare const useThemeSettings: () => ThemeContextProps;
|
|
219
|
+
|
|
220
|
+
type ThemeProviderWrapperProps = PropsWithChildren<{
|
|
221
|
+
/** Optional font stack to apply across the app. */
|
|
222
|
+
fontFamily?: string;
|
|
223
|
+
/** Optional direct override for a single theme primary color. */
|
|
224
|
+
primaryColor?: string;
|
|
225
|
+
/** Optional map to override default themeConfig with custom themes. */
|
|
226
|
+
themeConfigOverride?: Record<string, {
|
|
227
|
+
primaryColor: string;
|
|
228
|
+
secondaryColor?: string;
|
|
229
|
+
}>;
|
|
230
|
+
/** Optional color palette override (e.g., fontLight/fontDark/accent colors). */
|
|
231
|
+
colorPaletteOverride?: Partial<ColorPaletteType>;
|
|
232
|
+
/** Optional registry of ad-hoc colors to inject into theme.palette.custom */
|
|
233
|
+
customColors?: Record<string, string>;
|
|
234
|
+
}>;
|
|
235
|
+
declare const ThemeProviderWrapper: FC<ThemeProviderWrapperProps>;
|
|
228
236
|
|
|
229
237
|
/**
|
|
230
238
|
* Common component style overrides and default props shared across the design system.
|
|
@@ -232,7 +240,7 @@ declare const isFontLight: (color: string) => boolean;
|
|
|
232
240
|
*/
|
|
233
241
|
declare const commonComponentProps: Theme["components"];
|
|
234
242
|
|
|
235
|
-
declare const createCustomTheme: (primaryColor: string, mode?: PaletteMode) => Theme;
|
|
243
|
+
declare const createCustomTheme: (primaryColor: string, mode?: PaletteMode, secondaryColor?: string) => Theme;
|
|
236
244
|
/**
|
|
237
245
|
* A predefined list of named themes based on the `themeConfig` definition.
|
|
238
246
|
*/
|
|
@@ -240,17 +248,6 @@ declare const themes: {
|
|
|
240
248
|
name: string;
|
|
241
249
|
MuiTheme: Theme;
|
|
242
250
|
}[];
|
|
243
|
-
/**
|
|
244
|
-
* Determines whether dark mode should be enabled based on user settings and system conditions.
|
|
245
|
-
*
|
|
246
|
-
* @param darkMode - User preference: 'light' | 'dark' | 'system' | 'auto'.
|
|
247
|
-
* @param systemTheme - Detected OS-level theme: 'light' | 'dark'.
|
|
248
|
-
* @param backgroundColor - The background color to assess contrast in 'auto' mode.
|
|
249
|
-
* @returns True if dark mode should be used.
|
|
250
|
-
*/
|
|
251
|
-
declare const isDarkMode: (darkMode: AppSettings["darkMode"], systemTheme: SystemTheme) => boolean;
|
|
252
|
-
|
|
253
|
-
declare const darkModeOptions: OptionItem[];
|
|
254
251
|
|
|
255
252
|
/**
|
|
256
253
|
* Injects global styles into the document using Emotion.
|
|
@@ -259,7 +256,11 @@ declare const darkModeOptions: OptionItem[];
|
|
|
259
256
|
*
|
|
260
257
|
* Uses the MUI theme to dynamically adjust colors for light/dark mode.
|
|
261
258
|
*/
|
|
262
|
-
|
|
259
|
+
interface GlobalStylesProps {
|
|
260
|
+
/** Optional font stack to apply across the app. */
|
|
261
|
+
fontFamily?: string;
|
|
262
|
+
}
|
|
263
|
+
declare const GlobalStyles: FC<GlobalStylesProps>;
|
|
263
264
|
|
|
264
265
|
/**
|
|
265
266
|
* Fade in from the left with slight movement on the X-axis.
|
|
@@ -352,18 +353,43 @@ declare const installAppAnimation: {
|
|
|
352
353
|
toString: () => string;
|
|
353
354
|
} & string;
|
|
354
355
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
};
|
|
356
|
+
/** Returns the active color palette, allowing app-level overrides. */
|
|
357
|
+
declare const getColorPalette: () => ColorPaletteType;
|
|
358
|
+
/**
|
|
359
|
+
* Overrides the active color palette with app-provided values.
|
|
360
|
+
* Pass `undefined` or empty to reset to defaults.
|
|
361
|
+
*/
|
|
362
|
+
declare const setColorPaletteOverride: (override?: Partial<ColorPaletteType>) => void;
|
|
363
363
|
declare const themeConfig: Record<string, {
|
|
364
364
|
primaryColor: string;
|
|
365
365
|
secondaryColor?: string;
|
|
366
366
|
}>;
|
|
367
|
+
/** Backward-compatible live view of the active palette. */
|
|
368
|
+
declare const ColorPalette: Readonly<ColorPaletteType>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Validates whether a given string is a valid 3- or 6-digit hex color code (e.g., "#fff" or "#ffffff").
|
|
372
|
+
*
|
|
373
|
+
* @param value - The string to check.
|
|
374
|
+
* @returns `true` if the string is a valid hex color; otherwise, `false`.
|
|
375
|
+
*/
|
|
376
|
+
declare const isHexColor: (value: string) => boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Determines the ideal font color (white or black) for contrast against a given background color.
|
|
379
|
+
*
|
|
380
|
+
* Uses luminance calculation (YIQ) to ensure accessibility and visual clarity.
|
|
381
|
+
*
|
|
382
|
+
* @param backgroundColor - A valid hex color (e.g., "#ffffff").
|
|
383
|
+
* @returns A hex color string (`fontLight` or `fontDark`) suitable for overlay text.
|
|
384
|
+
*/
|
|
385
|
+
declare const getFontColor: (backgroundColor: string) => string;
|
|
386
|
+
/**
|
|
387
|
+
* Determines whether the ideal font color for a background is light (i.e., white).
|
|
388
|
+
*
|
|
389
|
+
* @param color - The background color in hex.
|
|
390
|
+
* @returns `true` if white text is recommended; otherwise, `false`.
|
|
391
|
+
*/
|
|
392
|
+
declare const isFontLight: (color: string) => boolean;
|
|
367
393
|
|
|
368
394
|
/**
|
|
369
395
|
* Returns a greeting based on the current time.
|
|
@@ -386,12 +412,23 @@ type OperatingSystem = "Windows" | "macOS" | "Linux" | "iOS" | "Android" | "Unkn
|
|
|
386
412
|
type Browser = "Chrome" | "Firefox" | "Safari" | "Edge" | "Unknown";
|
|
387
413
|
/**
|
|
388
414
|
* Basic information about the user's system (OS and browser).
|
|
415
|
+
* Safe for SSR: resolves to Unknown values on server.
|
|
389
416
|
*/
|
|
390
417
|
declare const systemInfo: {
|
|
391
418
|
os: OperatingSystem;
|
|
392
419
|
browser: Browser;
|
|
393
420
|
};
|
|
394
421
|
|
|
422
|
+
/**
|
|
423
|
+
* Determines whether dark mode should be enabled based on user settings and system conditions.
|
|
424
|
+
*
|
|
425
|
+
* @param darkMode - User preference: 'light' | 'dark' | 'system' | 'auto'.
|
|
426
|
+
* @param systemTheme - Detected OS-level theme: 'light' | 'dark'.
|
|
427
|
+
* @param backgroundColor - The background color to assess contrast in 'auto' mode.
|
|
428
|
+
* @returns True if dark mode should be used.
|
|
429
|
+
*/
|
|
430
|
+
declare const isDarkMode: (darkMode: AppSettings["darkMode"], systemTheme: SystemTheme) => boolean;
|
|
431
|
+
|
|
395
432
|
/**
|
|
396
433
|
* Converts a given date to a human-readable relative time string.
|
|
397
434
|
*
|
|
@@ -416,4 +453,4 @@ declare const useResponsiveDisplay: (breakpoint?: number) => boolean;
|
|
|
416
453
|
*/
|
|
417
454
|
declare const useSystemTheme: () => SystemTheme;
|
|
418
455
|
|
|
419
|
-
export { type AppSettings, ColorPalette, type CustomTypographyVariants, type DarkModeOptions, DialogBtn, ErrorBoundary, GlobalStyles, Loading, type OptionItem, PathName, type SystemTheme, type ThemeContextProps, ThemeProviderWrapper, commonComponentProps, createCustomTheme, darkModeOptions, displayGreeting, fadeIn, fadeInLeft, getDayIdentifier, getFontColor, installAppAnimation, isDarkMode, isFontLight, isHexColor, logoutAnimation, progressPulse, pulseAnimation, scale, slideIn, slideInBottom, systemInfo, themeConfig, themes, timeAgo, timeAgoFromStart, useResponsiveDisplay, useSystemTheme, useThemeSettings };
|
|
456
|
+
export { type AppSettings, ColorPalette, type ColorPaletteType, type CustomTypographyVariants, type DarkModeOptions, DialogBtn, ErrorBoundary, GlobalStyles, Loading, type OptionItem, PathName, type SystemTheme, type ThemeContextProps, ThemeProviderWrapper, commonComponentProps, createCustomTheme, darkModeOptions, defaultColorPalette, displayGreeting, fadeIn, fadeInLeft, getColorPalette, getDayIdentifier, getFontColor, installAppAnimation, isDarkMode, isFontLight, isHexColor, logoutAnimation, progressPulse, pulseAnimation, scale, setColorPaletteOverride, slideIn, slideInBottom, systemInfo, themeConfig, themes, timeAgo, timeAgoFromStart, useResponsiveDisplay, useSystemTheme, useThemeSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _emotion_styled from '@emotion/styled';
|
|
2
2
|
import * as _emotion_react from '@emotion/react';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
|
-
import React__default, { ErrorInfo, FC, PropsWithChildren } from 'react';
|
|
4
|
+
import React__default, { ErrorInfo, ReactNode, FC, PropsWithChildren } from 'react';
|
|
5
5
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
6
6
|
import * as _mui_material from '@mui/material';
|
|
7
7
|
import { Theme, PaletteMode } from '@mui/material';
|
|
@@ -46,7 +46,7 @@ type DarkModeOptions = "system" | "auto" | "light" | "dark";
|
|
|
46
46
|
interface OptionItem {
|
|
47
47
|
label: string;
|
|
48
48
|
value: DarkModeOptions;
|
|
49
|
-
icon:
|
|
49
|
+
icon: ReactNode;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Represents user-specific theme preferences stored in the application.
|
|
@@ -198,33 +198,41 @@ declare module "@mui/material/Typography" {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
interface ColorPaletteType {
|
|
202
|
+
fontDark: string;
|
|
203
|
+
fontLight: string;
|
|
204
|
+
brand: string;
|
|
205
|
+
accent: string;
|
|
206
|
+
muted: string;
|
|
207
|
+
success: string;
|
|
208
|
+
info: string;
|
|
209
|
+
warning: string;
|
|
210
|
+
error: string;
|
|
211
|
+
neutral: string;
|
|
212
|
+
}
|
|
202
213
|
|
|
203
|
-
declare const
|
|
214
|
+
declare const darkModeOptions: OptionItem[];
|
|
204
215
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
*/
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*/
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
* @returns `true` if white text is recommended; otherwise, `false`.
|
|
226
|
-
*/
|
|
227
|
-
declare const isFontLight: (color: string) => boolean;
|
|
216
|
+
declare const defaultColorPalette: ColorPaletteType;
|
|
217
|
+
|
|
218
|
+
declare const useThemeSettings: () => ThemeContextProps;
|
|
219
|
+
|
|
220
|
+
type ThemeProviderWrapperProps = PropsWithChildren<{
|
|
221
|
+
/** Optional font stack to apply across the app. */
|
|
222
|
+
fontFamily?: string;
|
|
223
|
+
/** Optional direct override for a single theme primary color. */
|
|
224
|
+
primaryColor?: string;
|
|
225
|
+
/** Optional map to override default themeConfig with custom themes. */
|
|
226
|
+
themeConfigOverride?: Record<string, {
|
|
227
|
+
primaryColor: string;
|
|
228
|
+
secondaryColor?: string;
|
|
229
|
+
}>;
|
|
230
|
+
/** Optional color palette override (e.g., fontLight/fontDark/accent colors). */
|
|
231
|
+
colorPaletteOverride?: Partial<ColorPaletteType>;
|
|
232
|
+
/** Optional registry of ad-hoc colors to inject into theme.palette.custom */
|
|
233
|
+
customColors?: Record<string, string>;
|
|
234
|
+
}>;
|
|
235
|
+
declare const ThemeProviderWrapper: FC<ThemeProviderWrapperProps>;
|
|
228
236
|
|
|
229
237
|
/**
|
|
230
238
|
* Common component style overrides and default props shared across the design system.
|
|
@@ -232,7 +240,7 @@ declare const isFontLight: (color: string) => boolean;
|
|
|
232
240
|
*/
|
|
233
241
|
declare const commonComponentProps: Theme["components"];
|
|
234
242
|
|
|
235
|
-
declare const createCustomTheme: (primaryColor: string, mode?: PaletteMode) => Theme;
|
|
243
|
+
declare const createCustomTheme: (primaryColor: string, mode?: PaletteMode, secondaryColor?: string) => Theme;
|
|
236
244
|
/**
|
|
237
245
|
* A predefined list of named themes based on the `themeConfig` definition.
|
|
238
246
|
*/
|
|
@@ -240,17 +248,6 @@ declare const themes: {
|
|
|
240
248
|
name: string;
|
|
241
249
|
MuiTheme: Theme;
|
|
242
250
|
}[];
|
|
243
|
-
/**
|
|
244
|
-
* Determines whether dark mode should be enabled based on user settings and system conditions.
|
|
245
|
-
*
|
|
246
|
-
* @param darkMode - User preference: 'light' | 'dark' | 'system' | 'auto'.
|
|
247
|
-
* @param systemTheme - Detected OS-level theme: 'light' | 'dark'.
|
|
248
|
-
* @param backgroundColor - The background color to assess contrast in 'auto' mode.
|
|
249
|
-
* @returns True if dark mode should be used.
|
|
250
|
-
*/
|
|
251
|
-
declare const isDarkMode: (darkMode: AppSettings["darkMode"], systemTheme: SystemTheme) => boolean;
|
|
252
|
-
|
|
253
|
-
declare const darkModeOptions: OptionItem[];
|
|
254
251
|
|
|
255
252
|
/**
|
|
256
253
|
* Injects global styles into the document using Emotion.
|
|
@@ -259,7 +256,11 @@ declare const darkModeOptions: OptionItem[];
|
|
|
259
256
|
*
|
|
260
257
|
* Uses the MUI theme to dynamically adjust colors for light/dark mode.
|
|
261
258
|
*/
|
|
262
|
-
|
|
259
|
+
interface GlobalStylesProps {
|
|
260
|
+
/** Optional font stack to apply across the app. */
|
|
261
|
+
fontFamily?: string;
|
|
262
|
+
}
|
|
263
|
+
declare const GlobalStyles: FC<GlobalStylesProps>;
|
|
263
264
|
|
|
264
265
|
/**
|
|
265
266
|
* Fade in from the left with slight movement on the X-axis.
|
|
@@ -352,18 +353,43 @@ declare const installAppAnimation: {
|
|
|
352
353
|
toString: () => string;
|
|
353
354
|
} & string;
|
|
354
355
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
};
|
|
356
|
+
/** Returns the active color palette, allowing app-level overrides. */
|
|
357
|
+
declare const getColorPalette: () => ColorPaletteType;
|
|
358
|
+
/**
|
|
359
|
+
* Overrides the active color palette with app-provided values.
|
|
360
|
+
* Pass `undefined` or empty to reset to defaults.
|
|
361
|
+
*/
|
|
362
|
+
declare const setColorPaletteOverride: (override?: Partial<ColorPaletteType>) => void;
|
|
363
363
|
declare const themeConfig: Record<string, {
|
|
364
364
|
primaryColor: string;
|
|
365
365
|
secondaryColor?: string;
|
|
366
366
|
}>;
|
|
367
|
+
/** Backward-compatible live view of the active palette. */
|
|
368
|
+
declare const ColorPalette: Readonly<ColorPaletteType>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Validates whether a given string is a valid 3- or 6-digit hex color code (e.g., "#fff" or "#ffffff").
|
|
372
|
+
*
|
|
373
|
+
* @param value - The string to check.
|
|
374
|
+
* @returns `true` if the string is a valid hex color; otherwise, `false`.
|
|
375
|
+
*/
|
|
376
|
+
declare const isHexColor: (value: string) => boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Determines the ideal font color (white or black) for contrast against a given background color.
|
|
379
|
+
*
|
|
380
|
+
* Uses luminance calculation (YIQ) to ensure accessibility and visual clarity.
|
|
381
|
+
*
|
|
382
|
+
* @param backgroundColor - A valid hex color (e.g., "#ffffff").
|
|
383
|
+
* @returns A hex color string (`fontLight` or `fontDark`) suitable for overlay text.
|
|
384
|
+
*/
|
|
385
|
+
declare const getFontColor: (backgroundColor: string) => string;
|
|
386
|
+
/**
|
|
387
|
+
* Determines whether the ideal font color for a background is light (i.e., white).
|
|
388
|
+
*
|
|
389
|
+
* @param color - The background color in hex.
|
|
390
|
+
* @returns `true` if white text is recommended; otherwise, `false`.
|
|
391
|
+
*/
|
|
392
|
+
declare const isFontLight: (color: string) => boolean;
|
|
367
393
|
|
|
368
394
|
/**
|
|
369
395
|
* Returns a greeting based on the current time.
|
|
@@ -386,12 +412,23 @@ type OperatingSystem = "Windows" | "macOS" | "Linux" | "iOS" | "Android" | "Unkn
|
|
|
386
412
|
type Browser = "Chrome" | "Firefox" | "Safari" | "Edge" | "Unknown";
|
|
387
413
|
/**
|
|
388
414
|
* Basic information about the user's system (OS and browser).
|
|
415
|
+
* Safe for SSR: resolves to Unknown values on server.
|
|
389
416
|
*/
|
|
390
417
|
declare const systemInfo: {
|
|
391
418
|
os: OperatingSystem;
|
|
392
419
|
browser: Browser;
|
|
393
420
|
};
|
|
394
421
|
|
|
422
|
+
/**
|
|
423
|
+
* Determines whether dark mode should be enabled based on user settings and system conditions.
|
|
424
|
+
*
|
|
425
|
+
* @param darkMode - User preference: 'light' | 'dark' | 'system' | 'auto'.
|
|
426
|
+
* @param systemTheme - Detected OS-level theme: 'light' | 'dark'.
|
|
427
|
+
* @param backgroundColor - The background color to assess contrast in 'auto' mode.
|
|
428
|
+
* @returns True if dark mode should be used.
|
|
429
|
+
*/
|
|
430
|
+
declare const isDarkMode: (darkMode: AppSettings["darkMode"], systemTheme: SystemTheme) => boolean;
|
|
431
|
+
|
|
395
432
|
/**
|
|
396
433
|
* Converts a given date to a human-readable relative time string.
|
|
397
434
|
*
|
|
@@ -416,4 +453,4 @@ declare const useResponsiveDisplay: (breakpoint?: number) => boolean;
|
|
|
416
453
|
*/
|
|
417
454
|
declare const useSystemTheme: () => SystemTheme;
|
|
418
455
|
|
|
419
|
-
export { type AppSettings, ColorPalette, type CustomTypographyVariants, type DarkModeOptions, DialogBtn, ErrorBoundary, GlobalStyles, Loading, type OptionItem, PathName, type SystemTheme, type ThemeContextProps, ThemeProviderWrapper, commonComponentProps, createCustomTheme, darkModeOptions, displayGreeting, fadeIn, fadeInLeft, getDayIdentifier, getFontColor, installAppAnimation, isDarkMode, isFontLight, isHexColor, logoutAnimation, progressPulse, pulseAnimation, scale, slideIn, slideInBottom, systemInfo, themeConfig, themes, timeAgo, timeAgoFromStart, useResponsiveDisplay, useSystemTheme, useThemeSettings };
|
|
456
|
+
export { type AppSettings, ColorPalette, type ColorPaletteType, type CustomTypographyVariants, type DarkModeOptions, DialogBtn, ErrorBoundary, GlobalStyles, Loading, type OptionItem, PathName, type SystemTheme, type ThemeContextProps, ThemeProviderWrapper, commonComponentProps, createCustomTheme, darkModeOptions, defaultColorPalette, displayGreeting, fadeIn, fadeInLeft, getColorPalette, getDayIdentifier, getFontColor, installAppAnimation, isDarkMode, isFontLight, isHexColor, logoutAnimation, progressPulse, pulseAnimation, scale, setColorPaletteOverride, slideIn, slideInBottom, systemInfo, themeConfig, themes, timeAgo, timeAgoFromStart, useResponsiveDisplay, useSystemTheme, useThemeSettings };
|