@nxds/core 0.7.2 → 0.9.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/README.md +16 -16
- package/dist/runtime/catalogue.cjs +113 -20
- package/dist/runtime/catalogue.cjs.map +1 -1
- package/dist/runtime/catalogue.d.cts +8 -8
- package/dist/runtime/catalogue.d.ts +8 -8
- package/dist/runtime/catalogue.js +113 -20
- package/dist/runtime/catalogue.js.map +1 -1
- package/dist/runtime/index.cjs +179 -69
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +61 -28
- package/dist/runtime/index.d.ts +61 -28
- package/dist/runtime/index.js +156 -54
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/{palette-DgJXuoTz.d.cts → palette-BKTIQ0WC.d.cts} +3 -3
- package/dist/runtime/{palette-DgJXuoTz.d.ts → palette-BKTIQ0WC.d.ts} +3 -3
- package/dist/runtime/palette.cjs.map +1 -1
- package/dist/runtime/palette.d.cts +2 -2
- package/dist/runtime/palette.d.ts +2 -2
- package/dist/runtime/palette.js.map +1 -1
- package/dist/runtime/{surface-ladder-yQyRTCRt.d.ts → surface-ladder-B950TU4_.d.ts} +25 -25
- package/dist/runtime/{surface-ladder-C2sSp67b.d.cts → surface-ladder-C8HTwT7z.d.cts} +25 -25
- package/package.json +17 -17
package/dist/runtime/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as Tier, P as PaletteKey, M as Mode } from './palette-
|
|
2
|
-
export { N as
|
|
3
|
-
import { b as
|
|
4
|
-
export { B as BASE_TONE_OPTIONS, e as BASE_TONE_SEEDS, C as CORNER_OPTIONS, f as DEFAULT_BRAND_COLOR, g as
|
|
1
|
+
import { T as Tier, P as PaletteKey, M as Mode } from './palette-BKTIQ0WC.cjs';
|
|
2
|
+
export { N as NxdsSurfaceTone, a as PALETTE_KEYS, b as TIER_THRESHOLDS } from './palette-BKTIQ0WC.cjs';
|
|
3
|
+
import { b as NxdsAppearanceState, d as DerivedTheme } from './surface-ladder-C8HTwT7z.cjs';
|
|
4
|
+
export { B as BASE_TONE_OPTIONS, e as BASE_TONE_SEEDS, C as CORNER_OPTIONS, f as DEFAULT_BRAND_COLOR, g as DEFAULT_NXDS_APPEARANCE, h as DENSITY_OPTIONS, E as ELEVATION_OPTIONS, i as NxdsAppearanceMode, a as NxdsAppearancePrefs, j as NxdsCorners, k as NxdsDensity, l as NxdsElevation, N as NxdsPresetField, m as NxdsStroke, n as NxdsThemeContract, o as STROKE_OPTIONS, p as SurfaceToken, T as ThemeDerivationInput, q as ThemeSeeds, r as TokenMap, s as appearancePrefsToCss, t as createNxdsThemeContract, u as deriveTheme, v as normalizeAppearanceModeIds, w as sanitizeNxdsAppearance, x as sanitizeNxdsAppearancePrefs, y as themeToCss } from './surface-ladder-C8HTwT7z.cjs';
|
|
5
5
|
|
|
6
6
|
type AdjustContrastTier = Tier;
|
|
7
7
|
type AdjustContrastPalette = PaletteKey;
|
|
@@ -29,7 +29,7 @@ interface AdjustContrastOptions {
|
|
|
29
29
|
palette?: AdjustContrastPalette;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Snap a custom color to the nearest
|
|
32
|
+
* Snap a custom color to the nearest nxds palette shade that passes the
|
|
33
33
|
* requested APCA tier on the target background. Lightness comes from the
|
|
34
34
|
* perceptual grid; hue and chroma come from the input (or, for achromatic
|
|
35
35
|
* inputs, from the chosen palette's shade 500).
|
|
@@ -62,42 +62,75 @@ declare function adjustContrast(input: string, options?: AdjustContrastOptions):
|
|
|
62
62
|
*/
|
|
63
63
|
declare function apcaLc(foreground: string, background: string): number;
|
|
64
64
|
|
|
65
|
+
type NxdsResolvedAppearanceMode = 'light' | 'dark';
|
|
66
|
+
type NxdsAppearanceCookieSameSite = 'Lax' | 'Strict' | 'None';
|
|
67
|
+
interface NxdsAppearanceCookieOptions {
|
|
68
|
+
maxAge?: number;
|
|
69
|
+
path?: string;
|
|
70
|
+
sameSite?: NxdsAppearanceCookieSameSite;
|
|
71
|
+
secure?: boolean | 'auto';
|
|
72
|
+
domain?: string;
|
|
73
|
+
}
|
|
74
|
+
interface NxdsAppearancePersistOptions {
|
|
75
|
+
/** localStorage key the first-paint script reads. `false` skips it. */
|
|
76
|
+
storageKey: string | false;
|
|
77
|
+
/** Cookie a server reads to render the saved appearance. `false` skips it. */
|
|
78
|
+
cookieWriteKey?: string | false;
|
|
79
|
+
cookieOptions?: NxdsAppearanceCookieOptions;
|
|
80
|
+
}
|
|
81
|
+
declare const NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS: number;
|
|
82
|
+
declare function prefersDarkColorScheme(): boolean;
|
|
83
|
+
/** Calls `onChange` when the OS colour scheme flips. Returns the unsubscribe. */
|
|
84
|
+
declare function watchColorScheme(onChange: () => void): () => void;
|
|
85
|
+
declare function resolveNxdsAppearanceMode(mode: NxdsAppearanceState['mode'], systemPrefersDark: boolean): NxdsResolvedAppearanceMode;
|
|
86
|
+
/** The appearance saved under `storageKey`, or `fallback` when there is none. */
|
|
87
|
+
declare function readStoredNxdsAppearance(storageKey: string | false, fallback: NxdsAppearanceState): NxdsAppearanceState;
|
|
88
|
+
/**
|
|
89
|
+
* Writes the theme to the page: the `.dark` class and mode attributes on
|
|
90
|
+
* `<html>`, and the derived theme and preference styles in `<head>`.
|
|
91
|
+
*/
|
|
92
|
+
declare function applyNxdsAppearance(state: NxdsAppearanceState, systemPrefersDark: boolean): void;
|
|
93
|
+
/** Undoes `applyNxdsAppearance`. */
|
|
94
|
+
declare function removeNxdsAppearance(): void;
|
|
95
|
+
/** Saves the appearance for the first-paint script and, optionally, the server. */
|
|
96
|
+
declare function persistNxdsAppearance(state: NxdsAppearanceState, { storageKey, cookieWriteKey, cookieOptions, }: NxdsAppearancePersistOptions): void;
|
|
97
|
+
|
|
65
98
|
declare const SNAPSHOT_VERSION = 9;
|
|
66
99
|
declare const STATE_COOKIE_VERSION = 6;
|
|
67
|
-
declare const
|
|
68
|
-
type
|
|
69
|
-
interface
|
|
100
|
+
declare const NXDS_APPEARANCE_DATA_ATTRS: readonly ["data-density", "data-radius", "data-shadow", "data-borderwidth"];
|
|
101
|
+
type NxdsAppearanceDataAttr = (typeof NXDS_APPEARANCE_DATA_ATTRS)[number];
|
|
102
|
+
interface NxdsAppearanceSnapshot {
|
|
70
103
|
version: typeof SNAPSHOT_VERSION;
|
|
71
|
-
state:
|
|
104
|
+
state: NxdsAppearanceState;
|
|
72
105
|
themeCss: string;
|
|
73
106
|
prefsCss: string;
|
|
74
107
|
}
|
|
75
|
-
interface
|
|
108
|
+
interface NxdsAppearanceStateCookie {
|
|
76
109
|
version: typeof STATE_COOKIE_VERSION;
|
|
77
|
-
state:
|
|
110
|
+
state: NxdsAppearanceState;
|
|
78
111
|
}
|
|
79
|
-
interface
|
|
112
|
+
interface NxdsFirstPaintResolution {
|
|
80
113
|
className: '' | 'dark';
|
|
81
|
-
dataAttrs: Record<
|
|
114
|
+
dataAttrs: Record<NxdsAppearanceDataAttr, string>;
|
|
82
115
|
themeCss: string;
|
|
83
116
|
prefsCss: string;
|
|
84
117
|
}
|
|
85
|
-
interface
|
|
118
|
+
interface NxdsAppearanceBootstrapScriptOptions {
|
|
86
119
|
storageKey?: string | false;
|
|
87
|
-
defaultSnapshot?:
|
|
120
|
+
defaultSnapshot?: NxdsAppearanceSnapshot;
|
|
88
121
|
}
|
|
89
|
-
declare const DEFAULT_STORAGE_KEY = "
|
|
90
|
-
declare const DEFAULT_COOKIE_KEY = "
|
|
91
|
-
declare function
|
|
92
|
-
declare function
|
|
93
|
-
declare function
|
|
94
|
-
declare function
|
|
95
|
-
declare function
|
|
96
|
-
declare function
|
|
97
|
-
declare function
|
|
98
|
-
declare function
|
|
99
|
-
declare function resolveFirstPaint(snapshot:
|
|
100
|
-
declare function
|
|
122
|
+
declare const DEFAULT_STORAGE_KEY = "nxds-appearance";
|
|
123
|
+
declare const DEFAULT_COOKIE_KEY = "nxds-appearance-state";
|
|
124
|
+
declare function createNxdsAppearanceSnapshot(state: NxdsAppearanceState, themeCss: string, prefsCss: string): NxdsAppearanceSnapshot;
|
|
125
|
+
declare function createNxdsAppearanceSnapshotFromState(state: NxdsAppearanceState): NxdsAppearanceSnapshot;
|
|
126
|
+
declare function createNxdsAppearanceStateCookie(state: NxdsAppearanceState): NxdsAppearanceStateCookie;
|
|
127
|
+
declare function serializeNxdsAppearanceStateCookie(state: NxdsAppearanceState): string;
|
|
128
|
+
declare function parseNxdsAppearanceStateCookie(raw: unknown): NxdsAppearanceState | null;
|
|
129
|
+
declare function createNxdsAppearanceSnapshotFromCookie(raw: unknown, fallbackState?: NxdsAppearanceState): NxdsAppearanceSnapshot;
|
|
130
|
+
declare function createDefaultNxdsAppearanceSnapshot(): NxdsAppearanceSnapshot;
|
|
131
|
+
declare function sanitizeNxdsAppearanceSnapshot(raw: unknown): NxdsAppearanceSnapshot;
|
|
132
|
+
declare function resolveFirstPaint(snapshot: NxdsAppearanceSnapshot, systemPrefersDark: boolean): NxdsFirstPaintResolution;
|
|
133
|
+
declare function createNxdsAppearanceBootstrapScript(options?: NxdsAppearanceBootstrapScriptOptions): string;
|
|
101
134
|
|
|
102
135
|
declare const BRAND_PRESET_FAMILIES: readonly ["indigo", "blue", "violet", "rose", "orange", "amber", "green", "teal"];
|
|
103
136
|
interface BrandColorPreset {
|
|
@@ -150,4 +183,4 @@ declare const ALPHA_TOKEN_NAMES: readonly ["background-hover-alpha", "border-def
|
|
|
150
183
|
type SemanticColorName = (typeof SURFACE_TOKEN_NAMES)[number] | (typeof TEXT_TOKEN_NAMES)[number] | (typeof BORDER_TOKEN_NAMES)[number] | (typeof BRAND_TOKEN_NAMES)[number] | (typeof STATUS_TOKEN_NAMES)[number] | (typeof CHART_TOKEN_NAMES)[number] | (typeof FOCUS_TOKEN_NAMES)[number] | (typeof ALPHA_TOKEN_NAMES)[number];
|
|
151
184
|
declare const SEMANTIC_TOKEN_REGISTRY: readonly SemanticTokenMeta[];
|
|
152
185
|
|
|
153
|
-
export { type AdjustContrastOptions, type AdjustContrastPalette, type AdjustContrastTier, BRAND_COLOR_PRESETS, type BrandColorPreset, DEFAULT_COOKIE_KEY, DEFAULT_STORAGE_KEY, DerivedTheme, Mode,
|
|
186
|
+
export { type AdjustContrastOptions, type AdjustContrastPalette, type AdjustContrastTier, BRAND_COLOR_PRESETS, type BrandColorPreset, DEFAULT_COOKIE_KEY, DEFAULT_STORAGE_KEY, DerivedTheme, Mode, NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS, NXDS_APPEARANCE_DATA_ATTRS, type NxdsAppearanceBootstrapScriptOptions, type NxdsAppearanceCookieOptions, type NxdsAppearanceCookieSameSite, type NxdsAppearanceDataAttr, type NxdsAppearancePersistOptions, type NxdsAppearanceSnapshot, NxdsAppearanceState, type NxdsAppearanceStateCookie, type NxdsFirstPaintResolution, type NxdsResolvedAppearanceMode, SEMANTIC_TOKEN_REGISTRY, SNAPSHOT_VERSION, type SemanticColorName, type SemanticTokenMeta, type ThemeContrastCheck, Tier, type TokenCategory, adjustContrast, apcaLc, applyNxdsAppearance, createDefaultNxdsAppearanceSnapshot, createNxdsAppearanceBootstrapScript, createNxdsAppearanceSnapshot, createNxdsAppearanceSnapshotFromCookie, createNxdsAppearanceSnapshotFromState, createNxdsAppearanceStateCookie, findBrandColorPreset, isColor, measureThemeContrast, parseNxdsAppearanceStateCookie, persistNxdsAppearance, prefersDarkColorScheme, readStoredNxdsAppearance, removeNxdsAppearance, resolveFirstPaint, resolveNxdsAppearanceMode, sanitizeNxdsAppearanceSnapshot, serializeNxdsAppearanceStateCookie, watchColorScheme };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as Tier, P as PaletteKey, M as Mode } from './palette-
|
|
2
|
-
export { N as
|
|
3
|
-
import { b as
|
|
4
|
-
export { B as BASE_TONE_OPTIONS, e as BASE_TONE_SEEDS, C as CORNER_OPTIONS, f as DEFAULT_BRAND_COLOR, g as
|
|
1
|
+
import { T as Tier, P as PaletteKey, M as Mode } from './palette-BKTIQ0WC.js';
|
|
2
|
+
export { N as NxdsSurfaceTone, a as PALETTE_KEYS, b as TIER_THRESHOLDS } from './palette-BKTIQ0WC.js';
|
|
3
|
+
import { b as NxdsAppearanceState, d as DerivedTheme } from './surface-ladder-B950TU4_.js';
|
|
4
|
+
export { B as BASE_TONE_OPTIONS, e as BASE_TONE_SEEDS, C as CORNER_OPTIONS, f as DEFAULT_BRAND_COLOR, g as DEFAULT_NXDS_APPEARANCE, h as DENSITY_OPTIONS, E as ELEVATION_OPTIONS, i as NxdsAppearanceMode, a as NxdsAppearancePrefs, j as NxdsCorners, k as NxdsDensity, l as NxdsElevation, N as NxdsPresetField, m as NxdsStroke, n as NxdsThemeContract, o as STROKE_OPTIONS, p as SurfaceToken, T as ThemeDerivationInput, q as ThemeSeeds, r as TokenMap, s as appearancePrefsToCss, t as createNxdsThemeContract, u as deriveTheme, v as normalizeAppearanceModeIds, w as sanitizeNxdsAppearance, x as sanitizeNxdsAppearancePrefs, y as themeToCss } from './surface-ladder-B950TU4_.js';
|
|
5
5
|
|
|
6
6
|
type AdjustContrastTier = Tier;
|
|
7
7
|
type AdjustContrastPalette = PaletteKey;
|
|
@@ -29,7 +29,7 @@ interface AdjustContrastOptions {
|
|
|
29
29
|
palette?: AdjustContrastPalette;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Snap a custom color to the nearest
|
|
32
|
+
* Snap a custom color to the nearest nxds palette shade that passes the
|
|
33
33
|
* requested APCA tier on the target background. Lightness comes from the
|
|
34
34
|
* perceptual grid; hue and chroma come from the input (or, for achromatic
|
|
35
35
|
* inputs, from the chosen palette's shade 500).
|
|
@@ -62,42 +62,75 @@ declare function adjustContrast(input: string, options?: AdjustContrastOptions):
|
|
|
62
62
|
*/
|
|
63
63
|
declare function apcaLc(foreground: string, background: string): number;
|
|
64
64
|
|
|
65
|
+
type NxdsResolvedAppearanceMode = 'light' | 'dark';
|
|
66
|
+
type NxdsAppearanceCookieSameSite = 'Lax' | 'Strict' | 'None';
|
|
67
|
+
interface NxdsAppearanceCookieOptions {
|
|
68
|
+
maxAge?: number;
|
|
69
|
+
path?: string;
|
|
70
|
+
sameSite?: NxdsAppearanceCookieSameSite;
|
|
71
|
+
secure?: boolean | 'auto';
|
|
72
|
+
domain?: string;
|
|
73
|
+
}
|
|
74
|
+
interface NxdsAppearancePersistOptions {
|
|
75
|
+
/** localStorage key the first-paint script reads. `false` skips it. */
|
|
76
|
+
storageKey: string | false;
|
|
77
|
+
/** Cookie a server reads to render the saved appearance. `false` skips it. */
|
|
78
|
+
cookieWriteKey?: string | false;
|
|
79
|
+
cookieOptions?: NxdsAppearanceCookieOptions;
|
|
80
|
+
}
|
|
81
|
+
declare const NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS: number;
|
|
82
|
+
declare function prefersDarkColorScheme(): boolean;
|
|
83
|
+
/** Calls `onChange` when the OS colour scheme flips. Returns the unsubscribe. */
|
|
84
|
+
declare function watchColorScheme(onChange: () => void): () => void;
|
|
85
|
+
declare function resolveNxdsAppearanceMode(mode: NxdsAppearanceState['mode'], systemPrefersDark: boolean): NxdsResolvedAppearanceMode;
|
|
86
|
+
/** The appearance saved under `storageKey`, or `fallback` when there is none. */
|
|
87
|
+
declare function readStoredNxdsAppearance(storageKey: string | false, fallback: NxdsAppearanceState): NxdsAppearanceState;
|
|
88
|
+
/**
|
|
89
|
+
* Writes the theme to the page: the `.dark` class and mode attributes on
|
|
90
|
+
* `<html>`, and the derived theme and preference styles in `<head>`.
|
|
91
|
+
*/
|
|
92
|
+
declare function applyNxdsAppearance(state: NxdsAppearanceState, systemPrefersDark: boolean): void;
|
|
93
|
+
/** Undoes `applyNxdsAppearance`. */
|
|
94
|
+
declare function removeNxdsAppearance(): void;
|
|
95
|
+
/** Saves the appearance for the first-paint script and, optionally, the server. */
|
|
96
|
+
declare function persistNxdsAppearance(state: NxdsAppearanceState, { storageKey, cookieWriteKey, cookieOptions, }: NxdsAppearancePersistOptions): void;
|
|
97
|
+
|
|
65
98
|
declare const SNAPSHOT_VERSION = 9;
|
|
66
99
|
declare const STATE_COOKIE_VERSION = 6;
|
|
67
|
-
declare const
|
|
68
|
-
type
|
|
69
|
-
interface
|
|
100
|
+
declare const NXDS_APPEARANCE_DATA_ATTRS: readonly ["data-density", "data-radius", "data-shadow", "data-borderwidth"];
|
|
101
|
+
type NxdsAppearanceDataAttr = (typeof NXDS_APPEARANCE_DATA_ATTRS)[number];
|
|
102
|
+
interface NxdsAppearanceSnapshot {
|
|
70
103
|
version: typeof SNAPSHOT_VERSION;
|
|
71
|
-
state:
|
|
104
|
+
state: NxdsAppearanceState;
|
|
72
105
|
themeCss: string;
|
|
73
106
|
prefsCss: string;
|
|
74
107
|
}
|
|
75
|
-
interface
|
|
108
|
+
interface NxdsAppearanceStateCookie {
|
|
76
109
|
version: typeof STATE_COOKIE_VERSION;
|
|
77
|
-
state:
|
|
110
|
+
state: NxdsAppearanceState;
|
|
78
111
|
}
|
|
79
|
-
interface
|
|
112
|
+
interface NxdsFirstPaintResolution {
|
|
80
113
|
className: '' | 'dark';
|
|
81
|
-
dataAttrs: Record<
|
|
114
|
+
dataAttrs: Record<NxdsAppearanceDataAttr, string>;
|
|
82
115
|
themeCss: string;
|
|
83
116
|
prefsCss: string;
|
|
84
117
|
}
|
|
85
|
-
interface
|
|
118
|
+
interface NxdsAppearanceBootstrapScriptOptions {
|
|
86
119
|
storageKey?: string | false;
|
|
87
|
-
defaultSnapshot?:
|
|
120
|
+
defaultSnapshot?: NxdsAppearanceSnapshot;
|
|
88
121
|
}
|
|
89
|
-
declare const DEFAULT_STORAGE_KEY = "
|
|
90
|
-
declare const DEFAULT_COOKIE_KEY = "
|
|
91
|
-
declare function
|
|
92
|
-
declare function
|
|
93
|
-
declare function
|
|
94
|
-
declare function
|
|
95
|
-
declare function
|
|
96
|
-
declare function
|
|
97
|
-
declare function
|
|
98
|
-
declare function
|
|
99
|
-
declare function resolveFirstPaint(snapshot:
|
|
100
|
-
declare function
|
|
122
|
+
declare const DEFAULT_STORAGE_KEY = "nxds-appearance";
|
|
123
|
+
declare const DEFAULT_COOKIE_KEY = "nxds-appearance-state";
|
|
124
|
+
declare function createNxdsAppearanceSnapshot(state: NxdsAppearanceState, themeCss: string, prefsCss: string): NxdsAppearanceSnapshot;
|
|
125
|
+
declare function createNxdsAppearanceSnapshotFromState(state: NxdsAppearanceState): NxdsAppearanceSnapshot;
|
|
126
|
+
declare function createNxdsAppearanceStateCookie(state: NxdsAppearanceState): NxdsAppearanceStateCookie;
|
|
127
|
+
declare function serializeNxdsAppearanceStateCookie(state: NxdsAppearanceState): string;
|
|
128
|
+
declare function parseNxdsAppearanceStateCookie(raw: unknown): NxdsAppearanceState | null;
|
|
129
|
+
declare function createNxdsAppearanceSnapshotFromCookie(raw: unknown, fallbackState?: NxdsAppearanceState): NxdsAppearanceSnapshot;
|
|
130
|
+
declare function createDefaultNxdsAppearanceSnapshot(): NxdsAppearanceSnapshot;
|
|
131
|
+
declare function sanitizeNxdsAppearanceSnapshot(raw: unknown): NxdsAppearanceSnapshot;
|
|
132
|
+
declare function resolveFirstPaint(snapshot: NxdsAppearanceSnapshot, systemPrefersDark: boolean): NxdsFirstPaintResolution;
|
|
133
|
+
declare function createNxdsAppearanceBootstrapScript(options?: NxdsAppearanceBootstrapScriptOptions): string;
|
|
101
134
|
|
|
102
135
|
declare const BRAND_PRESET_FAMILIES: readonly ["indigo", "blue", "violet", "rose", "orange", "amber", "green", "teal"];
|
|
103
136
|
interface BrandColorPreset {
|
|
@@ -150,4 +183,4 @@ declare const ALPHA_TOKEN_NAMES: readonly ["background-hover-alpha", "border-def
|
|
|
150
183
|
type SemanticColorName = (typeof SURFACE_TOKEN_NAMES)[number] | (typeof TEXT_TOKEN_NAMES)[number] | (typeof BORDER_TOKEN_NAMES)[number] | (typeof BRAND_TOKEN_NAMES)[number] | (typeof STATUS_TOKEN_NAMES)[number] | (typeof CHART_TOKEN_NAMES)[number] | (typeof FOCUS_TOKEN_NAMES)[number] | (typeof ALPHA_TOKEN_NAMES)[number];
|
|
151
184
|
declare const SEMANTIC_TOKEN_REGISTRY: readonly SemanticTokenMeta[];
|
|
152
185
|
|
|
153
|
-
export { type AdjustContrastOptions, type AdjustContrastPalette, type AdjustContrastTier, BRAND_COLOR_PRESETS, type BrandColorPreset, DEFAULT_COOKIE_KEY, DEFAULT_STORAGE_KEY, DerivedTheme, Mode,
|
|
186
|
+
export { type AdjustContrastOptions, type AdjustContrastPalette, type AdjustContrastTier, BRAND_COLOR_PRESETS, type BrandColorPreset, DEFAULT_COOKIE_KEY, DEFAULT_STORAGE_KEY, DerivedTheme, Mode, NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS, NXDS_APPEARANCE_DATA_ATTRS, type NxdsAppearanceBootstrapScriptOptions, type NxdsAppearanceCookieOptions, type NxdsAppearanceCookieSameSite, type NxdsAppearanceDataAttr, type NxdsAppearancePersistOptions, type NxdsAppearanceSnapshot, NxdsAppearanceState, type NxdsAppearanceStateCookie, type NxdsFirstPaintResolution, type NxdsResolvedAppearanceMode, SEMANTIC_TOKEN_REGISTRY, SNAPSHOT_VERSION, type SemanticColorName, type SemanticTokenMeta, type ThemeContrastCheck, Tier, type TokenCategory, adjustContrast, apcaLc, applyNxdsAppearance, createDefaultNxdsAppearanceSnapshot, createNxdsAppearanceBootstrapScript, createNxdsAppearanceSnapshot, createNxdsAppearanceSnapshotFromCookie, createNxdsAppearanceSnapshotFromState, createNxdsAppearanceStateCookie, findBrandColorPreset, isColor, measureThemeContrast, parseNxdsAppearanceStateCookie, persistNxdsAppearance, prefersDarkColorScheme, readStoredNxdsAppearance, removeNxdsAppearance, resolveFirstPaint, resolveNxdsAppearanceMode, sanitizeNxdsAppearanceSnapshot, serializeNxdsAppearanceStateCookie, watchColorScheme };
|
package/dist/runtime/index.js
CHANGED
|
@@ -2562,7 +2562,7 @@ var STROKE_OPTIONS = [
|
|
|
2562
2562
|
{ value: "normal", label: "Normal" },
|
|
2563
2563
|
{ value: "strong", label: "Strong" }
|
|
2564
2564
|
];
|
|
2565
|
-
var
|
|
2565
|
+
var DEFAULT_NXDS_APPEARANCE = {
|
|
2566
2566
|
mode: "light",
|
|
2567
2567
|
brandColor: DEFAULT_BRAND_COLOR,
|
|
2568
2568
|
surfaceTone: "zinc",
|
|
@@ -2614,7 +2614,7 @@ function formatPx(value) {
|
|
|
2614
2614
|
return `${Number(value.toFixed(4))}px`;
|
|
2615
2615
|
}
|
|
2616
2616
|
function typographyScaleVariables(uiPx) {
|
|
2617
|
-
const scale = uiPx /
|
|
2617
|
+
const scale = uiPx / DEFAULT_NXDS_APPEARANCE.prefs.uiFontSize;
|
|
2618
2618
|
const sizeVars = Object.entries(typography_default_default.size).map(
|
|
2619
2619
|
([name, token2]) => ` --nx-typography-size-${name}: ${formatPx(token2.$value.value * scale)};`
|
|
2620
2620
|
);
|
|
@@ -2655,9 +2655,9 @@ function normalizeAppearanceModeIds(raw) {
|
|
|
2655
2655
|
}
|
|
2656
2656
|
return out;
|
|
2657
2657
|
}
|
|
2658
|
-
function
|
|
2658
|
+
function sanitizeNxdsAppearancePrefs(raw) {
|
|
2659
2659
|
const o = isRecord(raw) ? raw : {};
|
|
2660
|
-
const d =
|
|
2660
|
+
const d = DEFAULT_NXDS_APPEARANCE.prefs;
|
|
2661
2661
|
return {
|
|
2662
2662
|
uiFont: fontFamilyOr(o.uiFont, d.uiFont),
|
|
2663
2663
|
codeFont: fontFamilyOr(o.codeFont, d.codeFont),
|
|
@@ -2668,10 +2668,10 @@ function sanitizeNexusAppearancePrefs(raw) {
|
|
|
2668
2668
|
fontSmoothing: boolOr(o.fontSmoothing, d.fontSmoothing)
|
|
2669
2669
|
};
|
|
2670
2670
|
}
|
|
2671
|
-
function
|
|
2672
|
-
if (!isRecord(rawInput)) return
|
|
2671
|
+
function sanitizeNxdsAppearance(rawInput) {
|
|
2672
|
+
if (!isRecord(rawInput)) return DEFAULT_NXDS_APPEARANCE;
|
|
2673
2673
|
const raw = normalizeAppearanceModeIds(rawInput);
|
|
2674
|
-
const d =
|
|
2674
|
+
const d = DEFAULT_NXDS_APPEARANCE;
|
|
2675
2675
|
return {
|
|
2676
2676
|
mode: enumOr(raw.mode, APPEARANCE_MODES, d.mode),
|
|
2677
2677
|
brandColor: typeof raw.brandColor === "string" && isColor(raw.brandColor) ? raw.brandColor : d.brandColor,
|
|
@@ -2682,10 +2682,10 @@ function sanitizeNexusAppearance(rawInput) {
|
|
|
2682
2682
|
corners: enumOr(raw.corners, CORNERS, d.corners),
|
|
2683
2683
|
elevation: enumOr(raw.elevation, ELEVATIONS, d.elevation),
|
|
2684
2684
|
stroke: enumOr(raw.stroke, STROKES, d.stroke),
|
|
2685
|
-
prefs:
|
|
2685
|
+
prefs: sanitizeNxdsAppearancePrefs(raw.prefs)
|
|
2686
2686
|
};
|
|
2687
2687
|
}
|
|
2688
|
-
function
|
|
2688
|
+
function createNxdsThemeContract(state) {
|
|
2689
2689
|
const tone = BASE_TONE_SEEDS[state.surfaceTone];
|
|
2690
2690
|
return {
|
|
2691
2691
|
surfaceTone: state.surfaceTone,
|
|
@@ -2697,11 +2697,11 @@ function createNexusThemeContract(state) {
|
|
|
2697
2697
|
function appearancePrefsToCss(prefs) {
|
|
2698
2698
|
const uiPx = clampFontSize(
|
|
2699
2699
|
prefs.uiFontSize,
|
|
2700
|
-
|
|
2700
|
+
DEFAULT_NXDS_APPEARANCE.prefs.uiFontSize
|
|
2701
2701
|
);
|
|
2702
2702
|
const codePx = clampFontSize(
|
|
2703
2703
|
prefs.codeFontSize,
|
|
2704
|
-
|
|
2704
|
+
DEFAULT_NXDS_APPEARANCE.prefs.codeFontSize
|
|
2705
2705
|
);
|
|
2706
2706
|
const blocks = [
|
|
2707
2707
|
inRuntimeLayer(`:root {
|
|
@@ -4520,14 +4520,14 @@ ${block(":root.dark", derived.dark)}`
|
|
|
4520
4520
|
var SNAPSHOT_VERSION = 9;
|
|
4521
4521
|
var STATE_COOKIE_VERSION = 6;
|
|
4522
4522
|
var SNAPSHOT_CACHE_LIMIT = 50;
|
|
4523
|
-
var
|
|
4523
|
+
var NXDS_APPEARANCE_DATA_ATTRS = [
|
|
4524
4524
|
"data-density",
|
|
4525
4525
|
"data-radius",
|
|
4526
4526
|
"data-shadow",
|
|
4527
4527
|
"data-borderwidth"
|
|
4528
4528
|
];
|
|
4529
|
-
var DEFAULT_STORAGE_KEY = "
|
|
4530
|
-
var DEFAULT_COOKIE_KEY = "
|
|
4529
|
+
var DEFAULT_STORAGE_KEY = "nxds-appearance";
|
|
4530
|
+
var DEFAULT_COOKIE_KEY = "nxds-appearance-state";
|
|
4531
4531
|
var isRecord2 = (value) => typeof value === "object" && value !== null;
|
|
4532
4532
|
var cachedSnapshots = /* @__PURE__ */ new Map();
|
|
4533
4533
|
var cachedModes = /* @__PURE__ */ new Map();
|
|
@@ -4552,7 +4552,7 @@ function deriveModeCached(contract, mode) {
|
|
|
4552
4552
|
return cachedModes.get(key) ?? remember(cachedModes, key, deriveThemeMode(contract, mode));
|
|
4553
4553
|
}
|
|
4554
4554
|
function deriveThemeCss(state) {
|
|
4555
|
-
const contract =
|
|
4555
|
+
const contract = createNxdsThemeContract(state);
|
|
4556
4556
|
return themeToCss({
|
|
4557
4557
|
light: deriveModeCached(contract, "light"),
|
|
4558
4558
|
dark: deriveModeCached(contract, "dark")
|
|
@@ -4561,7 +4561,7 @@ function deriveThemeCss(state) {
|
|
|
4561
4561
|
function derivePrefsCss(state) {
|
|
4562
4562
|
return appearancePrefsToCss(state.prefs);
|
|
4563
4563
|
}
|
|
4564
|
-
function
|
|
4564
|
+
function createNxdsAppearanceSnapshot(state, themeCss, prefsCss) {
|
|
4565
4565
|
return {
|
|
4566
4566
|
version: SNAPSHOT_VERSION,
|
|
4567
4567
|
state,
|
|
@@ -4569,33 +4569,33 @@ function createNexusAppearanceSnapshot(state, themeCss, prefsCss) {
|
|
|
4569
4569
|
prefsCss
|
|
4570
4570
|
};
|
|
4571
4571
|
}
|
|
4572
|
-
function
|
|
4573
|
-
const sanitizedState =
|
|
4572
|
+
function createNxdsAppearanceSnapshotFromState(state) {
|
|
4573
|
+
const sanitizedState = sanitizeNxdsAppearance(state);
|
|
4574
4574
|
const cacheKey = cacheKeyForState(sanitizedState);
|
|
4575
4575
|
const cachedSnapshot = cachedSnapshots.get(cacheKey);
|
|
4576
4576
|
if (cachedSnapshot) return cachedSnapshot;
|
|
4577
4577
|
return remember(
|
|
4578
4578
|
cachedSnapshots,
|
|
4579
4579
|
cacheKey,
|
|
4580
|
-
|
|
4580
|
+
createNxdsAppearanceSnapshot(
|
|
4581
4581
|
sanitizedState,
|
|
4582
4582
|
deriveThemeCss(sanitizedState),
|
|
4583
4583
|
derivePrefsCss(sanitizedState)
|
|
4584
4584
|
)
|
|
4585
4585
|
);
|
|
4586
4586
|
}
|
|
4587
|
-
function
|
|
4587
|
+
function createNxdsAppearanceStateCookie(state) {
|
|
4588
4588
|
return {
|
|
4589
4589
|
version: STATE_COOKIE_VERSION,
|
|
4590
|
-
state:
|
|
4590
|
+
state: sanitizeNxdsAppearance(state)
|
|
4591
4591
|
};
|
|
4592
4592
|
}
|
|
4593
|
-
function
|
|
4593
|
+
function serializeNxdsAppearanceStateCookie(state) {
|
|
4594
4594
|
return encodeURIComponent(
|
|
4595
|
-
JSON.stringify(
|
|
4595
|
+
JSON.stringify(createNxdsAppearanceStateCookie(state))
|
|
4596
4596
|
);
|
|
4597
4597
|
}
|
|
4598
|
-
function
|
|
4598
|
+
function parseNxdsAppearanceStateCookie(raw) {
|
|
4599
4599
|
if (typeof raw !== "string" || raw.length === 0) return null;
|
|
4600
4600
|
try {
|
|
4601
4601
|
const decoded = decodeURIComponent(raw);
|
|
@@ -4603,31 +4603,31 @@ function parseNexusAppearanceStateCookie(raw) {
|
|
|
4603
4603
|
if (!isRecord2(parsed) || parsed.version !== STATE_COOKIE_VERSION || !isRecord2(parsed.state)) {
|
|
4604
4604
|
return null;
|
|
4605
4605
|
}
|
|
4606
|
-
return
|
|
4606
|
+
return sanitizeNxdsAppearance(parsed.state);
|
|
4607
4607
|
} catch {
|
|
4608
4608
|
return null;
|
|
4609
4609
|
}
|
|
4610
4610
|
}
|
|
4611
|
-
function
|
|
4612
|
-
return
|
|
4613
|
-
|
|
4611
|
+
function createNxdsAppearanceSnapshotFromCookie(raw, fallbackState = DEFAULT_NXDS_APPEARANCE) {
|
|
4612
|
+
return createNxdsAppearanceSnapshotFromState(
|
|
4613
|
+
parseNxdsAppearanceStateCookie(raw) ?? sanitizeNxdsAppearance(fallbackState)
|
|
4614
4614
|
);
|
|
4615
4615
|
}
|
|
4616
4616
|
var cachedDefaultSnapshot;
|
|
4617
|
-
function
|
|
4618
|
-
return cachedDefaultSnapshot ?? (cachedDefaultSnapshot =
|
|
4619
|
-
|
|
4617
|
+
function createDefaultNxdsAppearanceSnapshot() {
|
|
4618
|
+
return cachedDefaultSnapshot ?? (cachedDefaultSnapshot = createNxdsAppearanceSnapshotFromState(
|
|
4619
|
+
DEFAULT_NXDS_APPEARANCE
|
|
4620
4620
|
));
|
|
4621
4621
|
}
|
|
4622
|
-
function
|
|
4622
|
+
function sanitizeNxdsAppearanceSnapshot(raw) {
|
|
4623
4623
|
if (!isRecord2(raw) || !isRecord2(raw.state)) {
|
|
4624
|
-
return
|
|
4624
|
+
return createDefaultNxdsAppearanceSnapshot();
|
|
4625
4625
|
}
|
|
4626
|
-
const state =
|
|
4626
|
+
const state = sanitizeNxdsAppearance(raw.state);
|
|
4627
4627
|
if (raw.version === SNAPSHOT_VERSION && typeof raw.themeCss === "string" && typeof raw.prefsCss === "string") {
|
|
4628
|
-
return
|
|
4628
|
+
return createNxdsAppearanceSnapshot(state, raw.themeCss, raw.prefsCss);
|
|
4629
4629
|
}
|
|
4630
|
-
return
|
|
4630
|
+
return createNxdsAppearanceSnapshotFromState(state);
|
|
4631
4631
|
}
|
|
4632
4632
|
function resolveFirstPaint(snapshot, systemPrefersDark) {
|
|
4633
4633
|
const { state } = snapshot;
|
|
@@ -4647,10 +4647,104 @@ function resolveFirstPaint(snapshot, systemPrefersDark) {
|
|
|
4647
4647
|
function escapeInlineScriptJson(value) {
|
|
4648
4648
|
return JSON.stringify(value).replace(/</g, "\\u003C").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
4649
4649
|
}
|
|
4650
|
-
function
|
|
4650
|
+
function createNxdsAppearanceBootstrapScript(options = {}) {
|
|
4651
4651
|
const storageKey = options.storageKey ?? DEFAULT_STORAGE_KEY;
|
|
4652
|
-
const defaultSnapshot = options.defaultSnapshot ?
|
|
4653
|
-
return `(function(){try{var k=${escapeInlineScriptJson(storageKey)};var f=${escapeInlineScriptJson(defaultSnapshot)};var s=f;try{if(k!==false){var r=window.localStorage&&window.localStorage.getItem(k);if(r){var p=JSON.parse(r);if(p&&p.version===f.version&&p.state&&typeof p.themeCss==="string"&&typeof p.prefsCss==="string"){s=p;}}}}catch(e){}var st=s.state||f.state;var m=st.mode==="dark"||st.mode==="light"||st.mode==="system"?st.mode:f.state.mode;var sys=false;try{sys=m==="system"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;}catch(e){}var dark=m==="dark"||sys===true;var root=document.documentElement;root.classList.toggle("dark",dark);root.setAttribute("data-density",typeof st.density==="string"?st.density:f.state.density);root.setAttribute("data-radius",typeof st.corners==="string"?st.corners:f.state.corners);root.setAttribute("data-shadow",typeof st.elevation==="string"?st.elevation:f.state.elevation);root.setAttribute("data-borderwidth",typeof st.stroke==="string"?st.stroke:f.state.stroke);function upsert(attr,css){var list=document.querySelectorAll("style["+attr+"]");var el=list[0]||document.createElement("style");for(var i=1;i<list.length;i++){list[i].remove();}el.setAttribute(attr,"");el.textContent=css||"";if(!el.parentNode){document.head.appendChild(el);}}upsert("data-
|
|
4652
|
+
const defaultSnapshot = options.defaultSnapshot ? sanitizeNxdsAppearanceSnapshot(options.defaultSnapshot) : createDefaultNxdsAppearanceSnapshot();
|
|
4653
|
+
return `(function(){try{var k=${escapeInlineScriptJson(storageKey)};var f=${escapeInlineScriptJson(defaultSnapshot)};var s=f;try{if(k!==false){var r=window.localStorage&&window.localStorage.getItem(k);if(r){var p=JSON.parse(r);if(p&&p.version===f.version&&p.state&&typeof p.themeCss==="string"&&typeof p.prefsCss==="string"){s=p;}}}}catch(e){}var st=s.state||f.state;var m=st.mode==="dark"||st.mode==="light"||st.mode==="system"?st.mode:f.state.mode;var sys=false;try{sys=m==="system"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;}catch(e){}var dark=m==="dark"||sys===true;var root=document.documentElement;root.classList.toggle("dark",dark);root.setAttribute("data-density",typeof st.density==="string"?st.density:f.state.density);root.setAttribute("data-radius",typeof st.corners==="string"?st.corners:f.state.corners);root.setAttribute("data-shadow",typeof st.elevation==="string"?st.elevation:f.state.elevation);root.setAttribute("data-borderwidth",typeof st.stroke==="string"?st.stroke:f.state.stroke);function upsert(attr,css){var list=document.querySelectorAll("style["+attr+"]");var el=list[0]||document.createElement("style");for(var i=1;i<list.length;i++){list[i].remove();}el.setAttribute(attr,"");el.textContent=css||"";if(!el.parentNode){document.head.appendChild(el);}}upsert("data-nxds-appearance-theme",s.themeCss);upsert("data-nxds-appearance-prefs",s.prefsCss);}catch(e){}})();`;
|
|
4654
|
+
}
|
|
4655
|
+
|
|
4656
|
+
// src/lib/appearance-dom.ts
|
|
4657
|
+
var NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 365;
|
|
4658
|
+
var COLOR_SCHEME_QUERY = "(prefers-color-scheme: dark)";
|
|
4659
|
+
var THEME_STYLE_ATTR = "data-nxds-appearance-theme";
|
|
4660
|
+
var PREFS_STYLE_ATTR = "data-nxds-appearance-prefs";
|
|
4661
|
+
function prefersDarkColorScheme() {
|
|
4662
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
4663
|
+
return false;
|
|
4664
|
+
return window.matchMedia(COLOR_SCHEME_QUERY).matches;
|
|
4665
|
+
}
|
|
4666
|
+
function watchColorScheme(onChange) {
|
|
4667
|
+
if (typeof window.matchMedia !== "function") return () => {
|
|
4668
|
+
};
|
|
4669
|
+
const query = window.matchMedia(COLOR_SCHEME_QUERY);
|
|
4670
|
+
query.addEventListener("change", onChange);
|
|
4671
|
+
return () => query.removeEventListener("change", onChange);
|
|
4672
|
+
}
|
|
4673
|
+
function resolveNxdsAppearanceMode(mode, systemPrefersDark) {
|
|
4674
|
+
if (mode === "system") return systemPrefersDark ? "dark" : "light";
|
|
4675
|
+
return mode;
|
|
4676
|
+
}
|
|
4677
|
+
function readStoredNxdsAppearance(storageKey, fallback) {
|
|
4678
|
+
if (storageKey === false || typeof window === "undefined") return fallback;
|
|
4679
|
+
try {
|
|
4680
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
4681
|
+
return raw ? sanitizeNxdsAppearanceSnapshot(JSON.parse(raw)).state : fallback;
|
|
4682
|
+
} catch {
|
|
4683
|
+
return fallback;
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
function upsertStyle(attribute, css) {
|
|
4687
|
+
const styles = Array.from(
|
|
4688
|
+
document.querySelectorAll(`style[${attribute}]`)
|
|
4689
|
+
);
|
|
4690
|
+
const style = styles[0] ?? document.createElement("style");
|
|
4691
|
+
for (const duplicate of styles.slice(1)) duplicate.remove();
|
|
4692
|
+
style.setAttribute(attribute, "");
|
|
4693
|
+
style.textContent = css;
|
|
4694
|
+
if (!style.parentNode) document.head.appendChild(style);
|
|
4695
|
+
}
|
|
4696
|
+
function applyNxdsAppearance(state, systemPrefersDark) {
|
|
4697
|
+
const firstPaint = resolveFirstPaint(
|
|
4698
|
+
createNxdsAppearanceSnapshotFromState(state),
|
|
4699
|
+
systemPrefersDark
|
|
4700
|
+
);
|
|
4701
|
+
const root = document.documentElement;
|
|
4702
|
+
root.classList.toggle("dark", firstPaint.className === "dark");
|
|
4703
|
+
for (const attr of NXDS_APPEARANCE_DATA_ATTRS) {
|
|
4704
|
+
root.setAttribute(attr, firstPaint.dataAttrs[attr]);
|
|
4705
|
+
}
|
|
4706
|
+
upsertStyle(THEME_STYLE_ATTR, firstPaint.themeCss);
|
|
4707
|
+
upsertStyle(PREFS_STYLE_ATTR, firstPaint.prefsCss);
|
|
4708
|
+
}
|
|
4709
|
+
function removeNxdsAppearance() {
|
|
4710
|
+
document.querySelectorAll(`style[${THEME_STYLE_ATTR}], style[${PREFS_STYLE_ATTR}]`).forEach((style) => style.remove());
|
|
4711
|
+
const root = document.documentElement;
|
|
4712
|
+
root.classList.remove("dark");
|
|
4713
|
+
for (const attr of NXDS_APPEARANCE_DATA_ATTRS) root.removeAttribute(attr);
|
|
4714
|
+
}
|
|
4715
|
+
function writeStateCookie(cookieWriteKey, state, options) {
|
|
4716
|
+
const secure = options.secure === true || options.secure !== false && window.location.protocol === "https:";
|
|
4717
|
+
const attrs = [
|
|
4718
|
+
`Path=${(options.path ?? "/").replace(/[;\r\n]/g, "")}`,
|
|
4719
|
+
`SameSite=${options.sameSite ?? "Lax"}`,
|
|
4720
|
+
`Max-Age=${options.maxAge ?? NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS}`,
|
|
4721
|
+
options.domain ? `Domain=${options.domain.replace(/[;\r\n]/g, "")}` : "",
|
|
4722
|
+
secure ? "Secure" : ""
|
|
4723
|
+
].filter(Boolean);
|
|
4724
|
+
document.cookie = `${cookieWriteKey}=${serializeNxdsAppearanceStateCookie(
|
|
4725
|
+
state
|
|
4726
|
+
)}; ${attrs.join("; ")}`;
|
|
4727
|
+
}
|
|
4728
|
+
function persistNxdsAppearance(state, {
|
|
4729
|
+
storageKey,
|
|
4730
|
+
cookieWriteKey = false,
|
|
4731
|
+
cookieOptions = {}
|
|
4732
|
+
}) {
|
|
4733
|
+
if (storageKey !== false) {
|
|
4734
|
+
try {
|
|
4735
|
+
window.localStorage.setItem(
|
|
4736
|
+
storageKey,
|
|
4737
|
+
JSON.stringify(createNxdsAppearanceSnapshotFromState(state))
|
|
4738
|
+
);
|
|
4739
|
+
} catch {
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
if (cookieWriteKey !== false) {
|
|
4743
|
+
try {
|
|
4744
|
+
writeStateCookie(cookieWriteKey, state, cookieOptions);
|
|
4745
|
+
} catch {
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4654
4748
|
}
|
|
4655
4749
|
|
|
4656
4750
|
// src/lib/brand-presets.ts
|
|
@@ -4846,11 +4940,12 @@ export {
|
|
|
4846
4940
|
CORNER_OPTIONS,
|
|
4847
4941
|
DEFAULT_BRAND_COLOR,
|
|
4848
4942
|
DEFAULT_COOKIE_KEY,
|
|
4849
|
-
|
|
4943
|
+
DEFAULT_NXDS_APPEARANCE,
|
|
4850
4944
|
DEFAULT_STORAGE_KEY,
|
|
4851
4945
|
DENSITY_OPTIONS,
|
|
4852
4946
|
ELEVATION_OPTIONS,
|
|
4853
|
-
|
|
4947
|
+
NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS,
|
|
4948
|
+
NXDS_APPEARANCE_DATA_ATTRS,
|
|
4854
4949
|
PALETTE_KEYS,
|
|
4855
4950
|
SEMANTIC_TOKEN_REGISTRY,
|
|
4856
4951
|
SNAPSHOT_VERSION,
|
|
@@ -4859,24 +4954,31 @@ export {
|
|
|
4859
4954
|
adjustContrast,
|
|
4860
4955
|
apcaLc,
|
|
4861
4956
|
appearancePrefsToCss,
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4957
|
+
applyNxdsAppearance,
|
|
4958
|
+
createDefaultNxdsAppearanceSnapshot,
|
|
4959
|
+
createNxdsAppearanceBootstrapScript,
|
|
4960
|
+
createNxdsAppearanceSnapshot,
|
|
4961
|
+
createNxdsAppearanceSnapshotFromCookie,
|
|
4962
|
+
createNxdsAppearanceSnapshotFromState,
|
|
4963
|
+
createNxdsAppearanceStateCookie,
|
|
4964
|
+
createNxdsThemeContract,
|
|
4869
4965
|
deriveTheme,
|
|
4870
4966
|
findBrandColorPreset,
|
|
4871
4967
|
isColor,
|
|
4872
4968
|
measureThemeContrast,
|
|
4873
4969
|
normalizeAppearanceModeIds,
|
|
4874
|
-
|
|
4970
|
+
parseNxdsAppearanceStateCookie,
|
|
4971
|
+
persistNxdsAppearance,
|
|
4972
|
+
prefersDarkColorScheme,
|
|
4973
|
+
readStoredNxdsAppearance,
|
|
4974
|
+
removeNxdsAppearance,
|
|
4875
4975
|
resolveFirstPaint,
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4976
|
+
resolveNxdsAppearanceMode,
|
|
4977
|
+
sanitizeNxdsAppearance,
|
|
4978
|
+
sanitizeNxdsAppearancePrefs,
|
|
4979
|
+
sanitizeNxdsAppearanceSnapshot,
|
|
4980
|
+
serializeNxdsAppearanceStateCookie,
|
|
4981
|
+
themeToCss,
|
|
4982
|
+
watchColorScheme
|
|
4881
4983
|
};
|
|
4882
4984
|
//# sourceMappingURL=index.js.map
|