@kortix/ui 0.16.3 → 0.16.4
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/dist/_vendor/kortix-shared.js +1 -4
- package/dist/customize/settings/rail-copy-context.d.ts +2 -0
- package/dist/customize/settings/rail-copy-context.js +2 -0
- package/dist/customize/settings/tabs/chrome-connections-tab.js +1 -1
- package/dist/files/renderers/show-content-renderer.js +3 -1
- package/dist/i18n/en.d.ts +14 -9
- package/dist/i18n/en.js +15 -10
- package/dist/internal/chrome/chrome-connect.d.ts +3 -5
- package/dist/internal/chrome/chrome-connect.js +7 -10
- package/dist/internal/chrome/extension.d.ts +1 -8
- package/dist/internal/chrome/extension.js +1 -8
- package/dist/internal/chrome/use-chrome-offered.d.ts +6 -12
- package/dist/internal/chrome/use-chrome-offered.js +13 -15
- package/dist/internal/layout/project-page-header.js +5 -4
- package/dist/internal/stores/user-preferences-store.d.ts +17 -0
- package/dist/internal/stores/user-preferences-store.js +5 -0
- package/dist/primitives/color-picker.d.ts +19 -0
- package/dist/primitives/color-picker.js +27 -0
- package/dist/primitives/faded-scroll-area.js +4 -0
- package/dist/primitives/glyph-picker.d.ts +11 -0
- package/dist/primitives/glyph-picker.js +10 -6
- package/dist/primitives/gradient-wallpaper-gl.d.ts +61 -0
- package/dist/primitives/gradient-wallpaper-gl.js +446 -0
- package/dist/primitives/gradient-wallpaper.d.ts +20 -0
- package/dist/primitives/gradient-wallpaper.js +242 -0
- package/dist/primitives/resizable.d.ts +1 -1
- package/dist/session/composer/ComposerCard.js +0 -3
- package/dist/session/panel/easy/detail-view.js +3 -2
- package/dist/session/panel/shared/collect-tool-parts.js +2 -2
- package/dist/session/panel/shared/use-panel-handoffs.js +23 -2
- package/dist/session/thread/session-body.js +1 -1
- package/dist/session/tool/shared/infrastructure-contexts.d.ts +5 -0
- package/dist/session/tool/shared/infrastructure-contexts.js +7 -0
- package/dist/session/tool/show-group-renderer.d.ts +5 -5
- package/dist/session/tool/show-group-renderer.js +7 -4
- package/dist/session/tool/tool-part-renderer.js +3 -1
- package/dist/session/tool/tool-renderers.d.ts +1 -1
- package/dist/session/tool/tool-renderers.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +14 -9
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/wallpaper-gradients.d.ts +106 -0
- package/dist/theme/wallpaper-gradients.js +347 -0
- package/dist/theme/wallpapers.d.ts +23 -3
- package/dist/theme/wallpapers.js +53 -29
- package/dist/workspace/admin/project-admin-dashboard.js +1 -1
- package/dist/workspace/layout/project-home.js +1 -1
- package/dist/workspace/new/use-create-workspace.d.ts +5 -3
- package/dist/workspace/new/use-create-workspace.js +1 -1
- package/dist/workspace/session-spaces/space-picker.js +3 -3
- package/dist/workspace/setup/setup-banner-snooze.d.ts +10 -0
- package/dist/workspace/setup/setup-banner-snooze.js +44 -0
- package/dist/workspace/setup/setup-banner.js +19 -36
- package/dist/workspace/setup/setup-steps.d.ts +0 -5
- package/dist/workspace/setup/setup-steps.js +0 -7
- package/dist/workspace/setup/workspace-setup-modal.d.ts +39 -0
- package/dist/workspace/setup/workspace-setup-modal.js +202 -0
- package/dist/workspace/sidebar/project-session-list.js +2 -1
- package/dist/workspace/sidebar/project-sidebar.js +6 -5
- package/package.json +14 -10
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/modules.md +3 -1
- package/dist/primitives/toast-clearance.d.ts +0 -36
- package/dist/primitives/toast-clearance.js +0 -94
- package/dist/workspace/setup/workspace-setup-page.d.ts +0 -10
- package/dist/workspace/setup/workspace-setup-page.js +0 -91
|
@@ -362,6 +362,8 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
362
362
|
backToApp: string;
|
|
363
363
|
close: string;
|
|
364
364
|
docs: string;
|
|
365
|
+
search: string;
|
|
366
|
+
searchNoResults: string;
|
|
365
367
|
groups: {
|
|
366
368
|
workspace: string;
|
|
367
369
|
personal: string;
|
|
@@ -7335,7 +7337,6 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
7335
7337
|
title: string;
|
|
7336
7338
|
description: string;
|
|
7337
7339
|
done: string;
|
|
7338
|
-
descriptionUnlisted: string;
|
|
7339
7340
|
};
|
|
7340
7341
|
connect: {
|
|
7341
7342
|
title: string;
|
|
@@ -7389,7 +7390,6 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
7389
7390
|
control: string;
|
|
7390
7391
|
own: string;
|
|
7391
7392
|
};
|
|
7392
|
-
howToInstall: string;
|
|
7393
7393
|
copyLink: string;
|
|
7394
7394
|
linkCopied: string;
|
|
7395
7395
|
copyFailed: string;
|
|
@@ -10622,27 +10622,32 @@ export declare const testUiTranslator: import("use-intl")._Translator<{
|
|
|
10622
10622
|
};
|
|
10623
10623
|
workspaceSetup: {
|
|
10624
10624
|
title: string;
|
|
10625
|
-
|
|
10626
|
-
|
|
10625
|
+
subtitle: string;
|
|
10626
|
+
progress: string;
|
|
10627
|
+
liveNote: string;
|
|
10628
|
+
later: string;
|
|
10627
10629
|
tryAgain: string;
|
|
10628
10630
|
loadFailed: string;
|
|
10629
10631
|
emptyTitle: string;
|
|
10630
10632
|
emptyDescription: string;
|
|
10631
|
-
openWorkspace: string;
|
|
10632
10633
|
completeTitle: string;
|
|
10633
10634
|
completeDescription: string;
|
|
10634
10635
|
slackName: string;
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
kindSlack: string;
|
|
10636
|
+
sectionOpen: string;
|
|
10637
|
+
doneSummary: string;
|
|
10638
10638
|
done: string;
|
|
10639
10639
|
connect: string;
|
|
10640
|
+
connectShort: string;
|
|
10640
10641
|
reconnect: string;
|
|
10642
|
+
reconnectShort: string;
|
|
10641
10643
|
setSecret: string;
|
|
10644
|
+
setShort: string;
|
|
10642
10645
|
addSlack: string;
|
|
10643
10646
|
connectSlack: string;
|
|
10644
10647
|
bannerTitle: string;
|
|
10645
|
-
|
|
10648
|
+
bannerNamed: string;
|
|
10649
|
+
bannerStart: string;
|
|
10650
|
+
bannerContinue: string;
|
|
10646
10651
|
};
|
|
10647
10652
|
sessionSpaces: {
|
|
10648
10653
|
title: string;
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { THEME_COLOR_VARS, themeToCss, themeToCssVars, type KortixTheme, type ThemeColor, type ThemeColors, type ThemeCssVars, type ThemeDurationStep, type ThemeEasing, type ThemeShadowStep, type ThemeTextStep, } from './theme.js';
|
|
2
2
|
export { ThemeScope, type ThemeScopeProps } from './theme-scope.js';
|
|
3
|
-
export { DEFAULT_WALLPAPER_ID, WALLPAPERS, getWallpaperById, type Wallpaper, } from './wallpapers.js';
|
|
3
|
+
export { DEFAULT_WALLPAPER_ID, WALLPAPERS, getSelectableWallpaper, getWallpaperById, type PickerWallpaper, type PickerWallpaperId, type Wallpaper, } from './wallpapers.js';
|
|
4
|
+
export { CUSTOM_COLOR_PRESETS, CUSTOM_PALETTES, DEFAULT_CUSTOM_WALLPAPER, DEFAULT_WALLPAPER_OPACITY, GRADIENT_FINISHES, GRADIENT_MAX_COLORS, GRADIENT_MIN_COLORS, GRADIENT_PATTERNS, GRADIENT_PRESETS, OPACITY_LIMITS, customGradientConfig, gradientColors, nextCustomColor, normalizeCustomWallpaper, normalizePresetOverrides, presetWithOverride, randomCustomColors, randomCustomWallpaper, type CustomWallpaperConfig, type GradientConfig, type GradientFinish, type GradientPattern, type GradientWallpaperId, type PresetOverride, type PresetOverrides, } from './wallpaper-gradients.js';
|
package/dist/theme/index.js
CHANGED
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
// ThemeScope is a client component.
|
|
3
3
|
export { THEME_COLOR_VARS, themeToCss, themeToCssVars, } from './theme.js';
|
|
4
4
|
export { ThemeScope } from './theme-scope.js';
|
|
5
|
-
export { DEFAULT_WALLPAPER_ID, WALLPAPERS, getWallpaperById, } from './wallpapers.js';
|
|
5
|
+
export { DEFAULT_WALLPAPER_ID, WALLPAPERS, getSelectableWallpaper, getWallpaperById, } from './wallpapers.js';
|
|
6
|
+
export { CUSTOM_COLOR_PRESETS, CUSTOM_PALETTES, DEFAULT_CUSTOM_WALLPAPER, DEFAULT_WALLPAPER_OPACITY, GRADIENT_FINISHES, GRADIENT_MAX_COLORS, GRADIENT_MIN_COLORS, GRADIENT_PATTERNS, GRADIENT_PRESETS, OPACITY_LIMITS, customGradientConfig, gradientColors, nextCustomColor, normalizeCustomWallpaper, normalizePresetOverrides, presetWithOverride, randomCustomColors, randomCustomWallpaper, } from './wallpaper-gradients.js';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradient wallpapers: the data half. One WebGL fragment shader
|
|
3
|
+
* (`primitives/gradient-wallpaper-gl.ts`) draws every colored wallpaper and
|
|
4
|
+
* the user's custom one. A wallpaper is a `GradientConfig`: a pattern (where
|
|
5
|
+
* the color sits), a finish (ordered dither or film grain) and a palette.
|
|
6
|
+
*
|
|
7
|
+
* This file holds no DOM or WebGL code, so the presets and the custom-config
|
|
8
|
+
* normalizer are unit-testable and safe to import on the server.
|
|
9
|
+
*/
|
|
10
|
+
/** Where the color sits on the page. */
|
|
11
|
+
export declare const GRADIENT_PATTERNS: readonly ["bloom", "beam", "sheet", "bands", "horizon", "arc", "mesh", "clouds"];
|
|
12
|
+
export type GradientPattern = (typeof GRADIENT_PATTERNS)[number];
|
|
13
|
+
/** `dither` = ordered dots on a pixel grid; `grain` = smooth with film grain. */
|
|
14
|
+
export declare const GRADIENT_FINISHES: readonly ["dither", "grain"];
|
|
15
|
+
export type GradientFinish = (typeof GRADIENT_FINISHES)[number];
|
|
16
|
+
/**
|
|
17
|
+
* Ready-made palettes for the Custom wallpaper's Palette picker, warm to cool
|
|
18
|
+
* and then neutral. Each runs from the faint edge of the shape to its core,
|
|
19
|
+
* like a preset's `colors`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CUSTOM_PALETTES: readonly (readonly string[])[];
|
|
22
|
+
/** The preset dots of a Custom swatch's colour picker: one per hue family. */
|
|
23
|
+
export declare const CUSTOM_COLOR_PRESETS: readonly ["#ef4444", "#f97316", "#eab308", "#22c55e", "#14b8a6", "#3b82f6", "#8b5cf6", "#ec4899"];
|
|
24
|
+
export declare const GRADIENT_MIN_COLORS = 2;
|
|
25
|
+
export declare const GRADIENT_MAX_COLORS = 5;
|
|
26
|
+
export interface GradientConfig {
|
|
27
|
+
pattern: GradientPattern;
|
|
28
|
+
finish: GradientFinish;
|
|
29
|
+
/**
|
|
30
|
+
* 2–5 hex colors, ordered from the faint edge of the shape to its core.
|
|
31
|
+
* The page background shows through wherever the shape is absent, so a
|
|
32
|
+
* palette never names the background.
|
|
33
|
+
*/
|
|
34
|
+
colors: string[];
|
|
35
|
+
/** Colors for light themes. Falls back to `colors`. */
|
|
36
|
+
lightColors?: string[];
|
|
37
|
+
/** 0–1: how much of the shape is cleared behind the centered content. */
|
|
38
|
+
calm: number;
|
|
39
|
+
/** `bloom` and `sheet`: the corner the color grows from, in 0–1 page space. */
|
|
40
|
+
anchor?: [number, number];
|
|
41
|
+
/** 0.2–1, applied as CSS opacity on the canvas: costs the shader nothing.
|
|
42
|
+
* Unset, `DEFAULT_WALLPAPER_OPACITY`. */
|
|
43
|
+
opacity?: number;
|
|
44
|
+
}
|
|
45
|
+
export declare const OPACITY_LIMITS: readonly [0.2, 1];
|
|
46
|
+
/** Every gradient wallpaper draws at 50% until the person changes it. */
|
|
47
|
+
export declare const DEFAULT_WALLPAPER_OPACITY = 0.5;
|
|
48
|
+
/**
|
|
49
|
+
* The Custom wallpaper: 2–5 colours, a finish and a shape. The colour popover
|
|
50
|
+
* edits the colours and the finish; Shuffle rolls all three. Persisted in
|
|
51
|
+
* preferences.
|
|
52
|
+
*/
|
|
53
|
+
export interface CustomWallpaperConfig {
|
|
54
|
+
colors: string[];
|
|
55
|
+
finish: GradientFinish;
|
|
56
|
+
pattern: GradientPattern;
|
|
57
|
+
opacity: number;
|
|
58
|
+
}
|
|
59
|
+
export declare const DEFAULT_CUSTOM_WALLPAPER: CustomWallpaperConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Persisted preferences are untyped JSON that may predate a field or hold a
|
|
62
|
+
* hand-edited value. Returns a config the shader can always draw. Fields an
|
|
63
|
+
* older build stored (shape, finish, placement) are dropped.
|
|
64
|
+
*/
|
|
65
|
+
export declare function normalizeCustomWallpaper(value: unknown): CustomWallpaperConfig;
|
|
66
|
+
/**
|
|
67
|
+
* The color the Custom wallpaper's + button adds: random, but from the
|
|
68
|
+
* palette's own temperature. It finds the palette's mean hue, weighted by
|
|
69
|
+
* saturation so a near-grey swatch does not pull it, then picks a hue within
|
|
70
|
+
* 30° of it and 45° of the first saturated color, a strong saturation and a mid lightness. Of 6 candidates it keeps
|
|
71
|
+
* the one least like the colors already there. A palette of greys gets a
|
|
72
|
+
* random hue. `random` is injectable for tests.
|
|
73
|
+
*/
|
|
74
|
+
export declare function nextCustomColor(colors: string[], random?: () => number): string;
|
|
75
|
+
/**
|
|
76
|
+
* Shuffle: a random Custom palette. A deep base colour, a brighter neighbour
|
|
77
|
+
* 25–60° along the hue wheel, then `nextCustomColor` up to 3 or 4 colours,
|
|
78
|
+
* so every result stays in one temperature. `random` is injectable for tests.
|
|
79
|
+
*/
|
|
80
|
+
export declare function randomCustomColors(random?: () => number): string[];
|
|
81
|
+
/**
|
|
82
|
+
* Shuffle: a whole new Custom wallpaper. A shape other than `previous`'s, a
|
|
83
|
+
* random finish and a `randomCustomColors` palette.
|
|
84
|
+
*/
|
|
85
|
+
export declare function randomCustomWallpaper(previous?: CustomWallpaperConfig, random?: () => number): CustomWallpaperConfig;
|
|
86
|
+
export declare function customGradientConfig(custom: CustomWallpaperConfig): GradientConfig;
|
|
87
|
+
export type GradientWallpaperId = 'ember' | 'prism' | 'tide' | 'aurora' | 'dusk' | 'eclipse' | 'lagoon' | 'cumulus' | 'moss' | 'iris';
|
|
88
|
+
export declare const GRADIENT_PRESETS: Record<GradientWallpaperId, GradientConfig>;
|
|
89
|
+
/** What the person changed on a preset: its colours, finish or opacity. */
|
|
90
|
+
export interface PresetOverride {
|
|
91
|
+
colors?: string[];
|
|
92
|
+
finish?: GradientFinish;
|
|
93
|
+
opacity?: number;
|
|
94
|
+
}
|
|
95
|
+
/** Overrides by preset id. Persisted. */
|
|
96
|
+
export type PresetOverrides = Partial<Record<GradientWallpaperId, PresetOverride>>;
|
|
97
|
+
/**
|
|
98
|
+
* Persisted overrides, cleaned: unknown ids, invalid palettes and unknown
|
|
99
|
+
* finishes are dropped, opacity is clamped, so a preset always draws.
|
|
100
|
+
*/
|
|
101
|
+
export declare function normalizePresetOverrides(value: unknown): PresetOverrides;
|
|
102
|
+
/** A preset with the person's override applied, or as shipped. Picked
|
|
103
|
+
* colours draw in both themes. */
|
|
104
|
+
export declare function presetWithOverride(config: GradientConfig, override?: PresetOverride): GradientConfig;
|
|
105
|
+
/** The palette a config draws with in the given theme. */
|
|
106
|
+
export declare function gradientColors(config: GradientConfig, isDark: boolean): string[];
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradient wallpapers: the data half. One WebGL fragment shader
|
|
3
|
+
* (`primitives/gradient-wallpaper-gl.ts`) draws every colored wallpaper and
|
|
4
|
+
* the user's custom one. A wallpaper is a `GradientConfig`: a pattern (where
|
|
5
|
+
* the color sits), a finish (ordered dither or film grain) and a palette.
|
|
6
|
+
*
|
|
7
|
+
* This file holds no DOM or WebGL code, so the presets and the custom-config
|
|
8
|
+
* normalizer are unit-testable and safe to import on the server.
|
|
9
|
+
*/
|
|
10
|
+
/** Where the color sits on the page. */
|
|
11
|
+
export const GRADIENT_PATTERNS = [
|
|
12
|
+
'bloom',
|
|
13
|
+
'beam',
|
|
14
|
+
'sheet',
|
|
15
|
+
'bands',
|
|
16
|
+
'horizon',
|
|
17
|
+
'arc',
|
|
18
|
+
'mesh',
|
|
19
|
+
'clouds',
|
|
20
|
+
];
|
|
21
|
+
/** `dither` = ordered dots on a pixel grid; `grain` = smooth with film grain. */
|
|
22
|
+
export const GRADIENT_FINISHES = ['dither', 'grain'];
|
|
23
|
+
/**
|
|
24
|
+
* Ready-made palettes for the Custom wallpaper's Palette picker, warm to cool
|
|
25
|
+
* and then neutral. Each runs from the faint edge of the shape to its core,
|
|
26
|
+
* like a preset's `colors`.
|
|
27
|
+
*/
|
|
28
|
+
export const CUSTOM_PALETTES = [
|
|
29
|
+
['#6b1d07', '#b8400f', '#f0661c', '#ffb37a'],
|
|
30
|
+
['#3d0c4f', '#9d174d', '#f43f5e', '#fdba74'],
|
|
31
|
+
['#854d0e', '#ca8a04', '#facc15', '#fef08a'],
|
|
32
|
+
['#7f1d1d', '#dc2626', '#fb7185', '#fecdd3'],
|
|
33
|
+
['#9a3412', '#fb923c', '#fdba74', '#ffedd5'],
|
|
34
|
+
['#14532d', '#15803d', '#4ade80', '#bbf7d0'],
|
|
35
|
+
['#3f6212', '#65a30d', '#a3e635', '#ecfccb'],
|
|
36
|
+
['#134e4a', '#0d9488', '#5eead4', '#ccfbf1'],
|
|
37
|
+
['#0b5c56', '#12b886', '#2fb8cc', '#9be8d8'],
|
|
38
|
+
['#0c4a6e', '#0369a1', '#38bdf8', '#bae6fd'],
|
|
39
|
+
['#1d3fb8', '#2a52c9', '#4f7dff', '#a9c4ff'],
|
|
40
|
+
['#312e81', '#4f46e5', '#818cf8', '#c7d2fe'],
|
|
41
|
+
['#352a85', '#6652e0', '#a78bfa', '#ead7ff'],
|
|
42
|
+
['#701a75', '#c026d3', '#e879f9', '#f5d0fe'],
|
|
43
|
+
['#881337', '#e11d48', '#fb7185', '#ffe4e6'],
|
|
44
|
+
['#22b8cf', '#3b5bdb', '#7950f2', '#e64980'],
|
|
45
|
+
['#1b1f4b', '#c8324e', '#ff8a7a', '#b9b9c2'],
|
|
46
|
+
['#27272a', '#52525b', '#a1a1aa', '#e4e4e7'],
|
|
47
|
+
];
|
|
48
|
+
/** The preset dots of a Custom swatch's colour picker: one per hue family. */
|
|
49
|
+
export const CUSTOM_COLOR_PRESETS = [
|
|
50
|
+
'#ef4444',
|
|
51
|
+
'#f97316',
|
|
52
|
+
'#eab308',
|
|
53
|
+
'#22c55e',
|
|
54
|
+
'#14b8a6',
|
|
55
|
+
'#3b82f6',
|
|
56
|
+
'#8b5cf6',
|
|
57
|
+
'#ec4899',
|
|
58
|
+
];
|
|
59
|
+
export const GRADIENT_MIN_COLORS = 2;
|
|
60
|
+
export const GRADIENT_MAX_COLORS = 5;
|
|
61
|
+
export const OPACITY_LIMITS = [0.2, 1];
|
|
62
|
+
/** Every gradient wallpaper draws at 50% until the person changes it. */
|
|
63
|
+
export const DEFAULT_WALLPAPER_OPACITY = 0.5;
|
|
64
|
+
/** A stored opacity, clamped, or undefined when it is not a number. */
|
|
65
|
+
function validOpacity(value) {
|
|
66
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
67
|
+
return undefined;
|
|
68
|
+
return Math.min(OPACITY_LIMITS[1], Math.max(OPACITY_LIMITS[0], value));
|
|
69
|
+
}
|
|
70
|
+
export const DEFAULT_CUSTOM_WALLPAPER = {
|
|
71
|
+
colors: ['#1d3fb8', '#4f7dff', '#a9c4ff'],
|
|
72
|
+
finish: 'dither',
|
|
73
|
+
pattern: 'bloom',
|
|
74
|
+
opacity: DEFAULT_WALLPAPER_OPACITY,
|
|
75
|
+
};
|
|
76
|
+
const HEX_COLOR = /^#[0-9a-f]{6}$/i;
|
|
77
|
+
const isFinish = (value) => GRADIENT_FINISHES.includes(value);
|
|
78
|
+
/** The valid colours of a stored palette, or undefined when fewer than 2. */
|
|
79
|
+
function validColors(value) {
|
|
80
|
+
const colors = (Array.isArray(value) ? value : [])
|
|
81
|
+
.filter((color) => typeof color === 'string' && HEX_COLOR.test(color))
|
|
82
|
+
.slice(0, GRADIENT_MAX_COLORS);
|
|
83
|
+
return colors.length >= GRADIENT_MIN_COLORS ? colors : undefined;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Persisted preferences are untyped JSON that may predate a field or hold a
|
|
87
|
+
* hand-edited value. Returns a config the shader can always draw. Fields an
|
|
88
|
+
* older build stored (shape, finish, placement) are dropped.
|
|
89
|
+
*/
|
|
90
|
+
export function normalizeCustomWallpaper(value) {
|
|
91
|
+
const input = (value ?? {});
|
|
92
|
+
return {
|
|
93
|
+
colors: validColors(input.colors) ?? DEFAULT_CUSTOM_WALLPAPER.colors,
|
|
94
|
+
finish: isFinish(input.finish) ? input.finish : DEFAULT_CUSTOM_WALLPAPER.finish,
|
|
95
|
+
pattern: GRADIENT_PATTERNS.includes(input.pattern)
|
|
96
|
+
? input.pattern
|
|
97
|
+
: DEFAULT_CUSTOM_WALLPAPER.pattern,
|
|
98
|
+
opacity: validOpacity(input.opacity) ?? DEFAULT_CUSTOM_WALLPAPER.opacity,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function hslToHex(hue, saturation, lightness) {
|
|
102
|
+
const a = saturation * Math.min(lightness, 1 - lightness);
|
|
103
|
+
const channel = (n) => {
|
|
104
|
+
const k = (n + hue / 30) % 12;
|
|
105
|
+
const value = lightness - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));
|
|
106
|
+
return Math.round(value * 255)
|
|
107
|
+
.toString(16)
|
|
108
|
+
.padStart(2, '0');
|
|
109
|
+
};
|
|
110
|
+
return `#${channel(0)}${channel(8)}${channel(4)}`;
|
|
111
|
+
}
|
|
112
|
+
function hexToHsl(hex) {
|
|
113
|
+
const v = Number.parseInt(hex.slice(1), 16);
|
|
114
|
+
const r = ((v >> 16) & 255) / 255;
|
|
115
|
+
const g = ((v >> 8) & 255) / 255;
|
|
116
|
+
const b = (v & 255) / 255;
|
|
117
|
+
const max = Math.max(r, g, b);
|
|
118
|
+
const min = Math.min(r, g, b);
|
|
119
|
+
const lightness = (max + min) / 2;
|
|
120
|
+
const delta = max - min;
|
|
121
|
+
if (delta === 0)
|
|
122
|
+
return [0, 0, lightness];
|
|
123
|
+
const saturation = delta / (1 - Math.abs(2 * lightness - 1));
|
|
124
|
+
const hue = max === r ? ((g - b) / delta + 6) % 6 : max === g ? (b - r) / delta + 2 : (r - g) / delta + 4;
|
|
125
|
+
return [hue * 60, saturation, lightness];
|
|
126
|
+
}
|
|
127
|
+
/** Degrees between two hues, 0–180. */
|
|
128
|
+
const hueGap = (a, b) => {
|
|
129
|
+
const d = Math.abs(a - b) % 360;
|
|
130
|
+
return d > 180 ? 360 - d : d;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* The color the Custom wallpaper's + button adds: random, but from the
|
|
134
|
+
* palette's own temperature. It finds the palette's mean hue, weighted by
|
|
135
|
+
* saturation so a near-grey swatch does not pull it, then picks a hue within
|
|
136
|
+
* 30° of it and 45° of the first saturated color, a strong saturation and a mid lightness. Of 6 candidates it keeps
|
|
137
|
+
* the one least like the colors already there. A palette of greys gets a
|
|
138
|
+
* random hue. `random` is injectable for tests.
|
|
139
|
+
*/
|
|
140
|
+
export function nextCustomColor(colors, random = Math.random) {
|
|
141
|
+
const hsl = colors.map(hexToHsl);
|
|
142
|
+
let x = 0;
|
|
143
|
+
let y = 0;
|
|
144
|
+
for (const [hue, saturation] of hsl) {
|
|
145
|
+
x += Math.cos((hue * Math.PI) / 180) * saturation;
|
|
146
|
+
y += Math.sin((hue * Math.PI) / 180) * saturation;
|
|
147
|
+
}
|
|
148
|
+
const grey = Math.hypot(x, y) < 0.15;
|
|
149
|
+
const mean = grey ? random() * 360 : ((Math.atan2(y, x) * 180) / Math.PI + 360) % 360;
|
|
150
|
+
// The first saturated color anchors the temperature: each added color
|
|
151
|
+
// moves the mean, and without an anchor a palette drifts from orange to
|
|
152
|
+
// green in a few presses.
|
|
153
|
+
const anchor = hsl.find(([, saturation]) => saturation > 0.25)?.[0] ?? mean;
|
|
154
|
+
let best = '';
|
|
155
|
+
let bestDistance = -1;
|
|
156
|
+
for (let attempt = 0; attempt < 6; attempt++) {
|
|
157
|
+
let hue = (mean + (random() * 2 - 1) * 30 + 360) % 360;
|
|
158
|
+
if (hueGap(hue, anchor) > 45)
|
|
159
|
+
hue = (anchor + (random() * 2 - 1) * 30 + 360) % 360;
|
|
160
|
+
const lightness = 0.38 + random() * 0.32;
|
|
161
|
+
const candidate = hslToHex(hue, 0.65 + random() * 0.25, lightness);
|
|
162
|
+
// Hue counts per 40°, lightness per 0.2: the nearest existing color.
|
|
163
|
+
const distance = Math.min(...hsl.map(([h, , l]) => hueGap(h, hue) / 40 + Math.abs(l - lightness) / 0.2));
|
|
164
|
+
if (distance > bestDistance) {
|
|
165
|
+
best = candidate;
|
|
166
|
+
bestDistance = distance;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return best;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Shuffle: a random Custom palette. A deep base colour, a brighter neighbour
|
|
173
|
+
* 25–60° along the hue wheel, then `nextCustomColor` up to 3 or 4 colours,
|
|
174
|
+
* so every result stays in one temperature. `random` is injectable for tests.
|
|
175
|
+
*/
|
|
176
|
+
export function randomCustomColors(random = Math.random) {
|
|
177
|
+
const hue = random() * 360;
|
|
178
|
+
let colors = [hslToHex(hue, 0.75, 0.38), hslToHex((hue + 25 + random() * 35) % 360, 0.85, 0.56)];
|
|
179
|
+
const count = 3 + Math.floor(random() * 2);
|
|
180
|
+
while (colors.length < count)
|
|
181
|
+
colors = [...colors, nextCustomColor(colors, random)];
|
|
182
|
+
return colors;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Shuffle: a whole new Custom wallpaper. A shape other than `previous`'s, a
|
|
186
|
+
* random finish and a `randomCustomColors` palette.
|
|
187
|
+
*/
|
|
188
|
+
export function randomCustomWallpaper(previous, random = Math.random) {
|
|
189
|
+
const shapes = GRADIENT_PATTERNS.filter((pattern) => pattern !== previous?.pattern);
|
|
190
|
+
return {
|
|
191
|
+
pattern: shapes[Math.floor(random() * shapes.length)],
|
|
192
|
+
finish: GRADIENT_FINISHES[Math.floor(random() * GRADIENT_FINISHES.length)],
|
|
193
|
+
colors: randomCustomColors(random),
|
|
194
|
+
// Shuffle keeps how strong the person wants the wallpaper.
|
|
195
|
+
opacity: previous?.opacity ?? DEFAULT_CUSTOM_WALLPAPER.opacity,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/** How much of each shape is cleared behind the centred content: the same
|
|
199
|
+
* value as the preset that uses the shape. */
|
|
200
|
+
const CALM = {
|
|
201
|
+
bloom: 0.35,
|
|
202
|
+
beam: 0.5,
|
|
203
|
+
sheet: 0.4,
|
|
204
|
+
bands: 0.8,
|
|
205
|
+
horizon: 0.3,
|
|
206
|
+
arc: 0.3,
|
|
207
|
+
mesh: 0.75,
|
|
208
|
+
clouds: 0.7,
|
|
209
|
+
};
|
|
210
|
+
export function customGradientConfig(custom) {
|
|
211
|
+
return {
|
|
212
|
+
pattern: custom.pattern,
|
|
213
|
+
finish: custom.finish,
|
|
214
|
+
colors: custom.colors,
|
|
215
|
+
calm: CALM[custom.pattern],
|
|
216
|
+
anchor: [1, 1],
|
|
217
|
+
opacity: custom.opacity,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export const GRADIENT_PRESETS = {
|
|
221
|
+
// An orange bloom dithered out of the bottom-right corner.
|
|
222
|
+
ember: {
|
|
223
|
+
pattern: 'bloom',
|
|
224
|
+
finish: 'dither',
|
|
225
|
+
colors: ['#6b1d07', '#b8400f', '#f0661c', '#ffb37a'],
|
|
226
|
+
lightColors: ['#ffc9a3', '#ff9d5c', '#f4701f', '#d9500b'],
|
|
227
|
+
calm: 0.35,
|
|
228
|
+
anchor: [1, 1],
|
|
229
|
+
},
|
|
230
|
+
// A spectral beam crossing the page: blue haze above, a hot edge below.
|
|
231
|
+
prism: {
|
|
232
|
+
pattern: 'beam',
|
|
233
|
+
finish: 'dither',
|
|
234
|
+
colors: ['#16307a', '#2f7fd6', '#e6dfc4', '#f08a3c', '#d7263d'],
|
|
235
|
+
lightColors: ['#9db8f2', '#4f93e0', '#f2d9a0', '#f08a3c', '#d7263d'],
|
|
236
|
+
calm: 0.5,
|
|
237
|
+
},
|
|
238
|
+
// A deep-blue sheet rising from the bottom-right corner.
|
|
239
|
+
tide: {
|
|
240
|
+
pattern: 'sheet',
|
|
241
|
+
finish: 'dither',
|
|
242
|
+
colors: ['#0d2350', '#1f4f9e', '#4f8fd8', '#9cc3f0'],
|
|
243
|
+
lightColors: ['#c3d8f5', '#7fb0ea', '#3f7fd0', '#1f4f9e'],
|
|
244
|
+
calm: 0.4,
|
|
245
|
+
anchor: [1, 1],
|
|
246
|
+
},
|
|
247
|
+
// Flowing vertical color bands with film grain.
|
|
248
|
+
aurora: {
|
|
249
|
+
pattern: 'bands',
|
|
250
|
+
finish: 'grain',
|
|
251
|
+
// Dark: no orange. Half-covered orange over a near-black page turns brown.
|
|
252
|
+
colors: ['#22b8cf', '#3b5bdb', '#7950f2', '#e64980', '#22b8cf'],
|
|
253
|
+
lightColors: ['#e8502a', '#2f9e6b', '#35bfd0', '#3b5bdb', '#9b5de5'],
|
|
254
|
+
calm: 0.8,
|
|
255
|
+
},
|
|
256
|
+
// A red horizon between grey haze and a navy ground.
|
|
257
|
+
dusk: {
|
|
258
|
+
pattern: 'horizon',
|
|
259
|
+
finish: 'grain',
|
|
260
|
+
colors: ['#1b1f4b', '#c8324e', '#ff8a7a', '#b9b9c2'],
|
|
261
|
+
lightColors: ['#6b70b8', '#d6455f', '#ff9d8f', '#d9d9e0'],
|
|
262
|
+
calm: 0.3,
|
|
263
|
+
},
|
|
264
|
+
// The lit rim of a sphere rising from the bottom edge.
|
|
265
|
+
eclipse: {
|
|
266
|
+
pattern: 'arc',
|
|
267
|
+
finish: 'grain',
|
|
268
|
+
colors: ['#5b2333', '#c94f35', '#f08a52', '#ffd9a8'],
|
|
269
|
+
lightColors: ['#f7d6c6', '#f2a37c', '#ee7f4f', '#f9b877'],
|
|
270
|
+
calm: 0.3,
|
|
271
|
+
},
|
|
272
|
+
// Teal and green light pooled in the corners.
|
|
273
|
+
lagoon: {
|
|
274
|
+
pattern: 'mesh',
|
|
275
|
+
finish: 'grain',
|
|
276
|
+
colors: ['#0b5c56', '#12b886', '#2fb8cc', '#9be8d8'],
|
|
277
|
+
calm: 0.75,
|
|
278
|
+
},
|
|
279
|
+
// Dithered clouds on the lower half of the page.
|
|
280
|
+
cumulus: {
|
|
281
|
+
pattern: 'clouds',
|
|
282
|
+
finish: 'dither',
|
|
283
|
+
// Dark: no near-white core. It glares on a dark page.
|
|
284
|
+
colors: ['#1d3fb8', '#2a52c9', '#4f7dff', '#a9c4ff'],
|
|
285
|
+
lightColors: ['#d3e0ff', '#a9c4ff', '#6f95ff', '#4f7dff'],
|
|
286
|
+
calm: 0.7,
|
|
287
|
+
},
|
|
288
|
+
// Green ribbons, dithered.
|
|
289
|
+
moss: {
|
|
290
|
+
pattern: 'bands',
|
|
291
|
+
finish: 'dither',
|
|
292
|
+
colors: ['#1f3d0c', '#4c7a12', '#86c232', '#4c7a12'],
|
|
293
|
+
lightColors: ['#d9efb0', '#a9d85c', '#74b816', '#a9d85c'],
|
|
294
|
+
calm: 0.85,
|
|
295
|
+
},
|
|
296
|
+
// A violet bloom from the top-right corner, smooth.
|
|
297
|
+
iris: {
|
|
298
|
+
pattern: 'bloom',
|
|
299
|
+
finish: 'grain',
|
|
300
|
+
colors: ['#352a85', '#6652e0', '#a78bfa', '#ead7ff'],
|
|
301
|
+
lightColors: ['#e3d4ff', '#b79cfb', '#7d68ea', '#4c3cb8'],
|
|
302
|
+
calm: 0.35,
|
|
303
|
+
anchor: [1, 0],
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Persisted overrides, cleaned: unknown ids, invalid palettes and unknown
|
|
308
|
+
* finishes are dropped, opacity is clamped, so a preset always draws.
|
|
309
|
+
*/
|
|
310
|
+
export function normalizePresetOverrides(value) {
|
|
311
|
+
if (!value || typeof value !== 'object')
|
|
312
|
+
return {};
|
|
313
|
+
const out = {};
|
|
314
|
+
for (const [id, raw] of Object.entries(value)) {
|
|
315
|
+
if (!(id in GRADIENT_PRESETS) || !raw || typeof raw !== 'object')
|
|
316
|
+
continue;
|
|
317
|
+
const input = raw;
|
|
318
|
+
const override = {};
|
|
319
|
+
const colors = validColors(input.colors);
|
|
320
|
+
if (colors)
|
|
321
|
+
override.colors = colors;
|
|
322
|
+
if (isFinish(input.finish))
|
|
323
|
+
override.finish = input.finish;
|
|
324
|
+
const opacity = validOpacity(input.opacity);
|
|
325
|
+
if (opacity !== undefined)
|
|
326
|
+
override.opacity = opacity;
|
|
327
|
+
if (Object.keys(override).length > 0)
|
|
328
|
+
out[id] = override;
|
|
329
|
+
}
|
|
330
|
+
return out;
|
|
331
|
+
}
|
|
332
|
+
/** A preset with the person's override applied, or as shipped. Picked
|
|
333
|
+
* colours draw in both themes. */
|
|
334
|
+
export function presetWithOverride(config, override) {
|
|
335
|
+
if (!override)
|
|
336
|
+
return config;
|
|
337
|
+
return {
|
|
338
|
+
...config,
|
|
339
|
+
...(override.colors ? { colors: override.colors, lightColors: override.colors } : {}),
|
|
340
|
+
...(override.finish ? { finish: override.finish } : {}),
|
|
341
|
+
...(override.opacity !== undefined ? { opacity: override.opacity } : {}),
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
/** The palette a config draws with in the given theme. */
|
|
345
|
+
export function gradientColors(config, isDark) {
|
|
346
|
+
return isDark ? config.colors : (config.lightColors ?? config.colors);
|
|
347
|
+
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { type GradientConfig, type GradientWallpaperId } from './wallpaper-gradients.js';
|
|
2
|
+
export type WallpaperType = 'svg' | 'shader' | 'gradient' | 'custom' | 'image' | 'none';
|
|
3
|
+
/** Ids that still render (marketing pages, the still-image exporter) but are
|
|
4
|
+
* no longer offered in the picker. */
|
|
5
|
+
type LegacyWallpaperId = 'brandmark' | 'nebula' | 'silk' | 'grain' | 'neuro';
|
|
6
|
+
/** The ids the picker offers. */
|
|
7
|
+
export type PickerWallpaperId = Exclude<Wallpaper['id'], LegacyWallpaperId>;
|
|
8
|
+
export type PickerWallpaper = Wallpaper & {
|
|
9
|
+
id: PickerWallpaperId;
|
|
10
|
+
};
|
|
2
11
|
export interface Wallpaper {
|
|
3
|
-
id: '
|
|
12
|
+
id: 'dither' | 'blank' | 'custom' | GradientWallpaperId | LegacyWallpaperId;
|
|
4
13
|
name: string;
|
|
5
14
|
type: WallpaperType;
|
|
15
|
+
/** For 'gradient' wallpapers — what the gradient shader draws. */
|
|
16
|
+
gradient?: GradientConfig;
|
|
6
17
|
/** For 'svg' wallpapers — path to the SVG file */
|
|
7
18
|
svgUrl?: string;
|
|
8
19
|
/** For 'image' wallpapers — path to the light-mode image */
|
|
@@ -22,5 +33,14 @@ export interface Wallpaper {
|
|
|
22
33
|
};
|
|
23
34
|
}
|
|
24
35
|
export declare const DEFAULT_WALLPAPER_ID = "dither";
|
|
25
|
-
|
|
36
|
+
/** The picker, in order: the default, the ten gradients, Blank, Custom. */
|
|
37
|
+
export declare const WALLPAPERS: PickerWallpaper[];
|
|
38
|
+
/** Resolves any id that can render, picker or legacy. Unknown ids resolve to
|
|
39
|
+
* the default. */
|
|
26
40
|
export declare function getWallpaperById(id: string): Wallpaper;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a persisted preference. A retired id falls back to the default, so
|
|
43
|
+
* a user who had one selected lands on a wallpaper the picker can show.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getSelectableWallpaper(id: string): PickerWallpaper;
|
|
46
|
+
export {};
|
package/dist/theme/wallpapers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GRADIENT_PRESETS } from './wallpaper-gradients.js';
|
|
1
2
|
export const DEFAULT_WALLPAPER_ID = 'dither';
|
|
2
3
|
function shaderThumbs(id) {
|
|
3
4
|
return {
|
|
@@ -5,6 +6,19 @@ function shaderThumbs(id) {
|
|
|
5
6
|
light: `/wallpapers/${id}-light.jpg`,
|
|
6
7
|
};
|
|
7
8
|
}
|
|
9
|
+
const GRADIENT_NAMES = {
|
|
10
|
+
ember: 'Ember',
|
|
11
|
+
prism: 'Prism',
|
|
12
|
+
tide: 'Tide',
|
|
13
|
+
aurora: 'Aurora',
|
|
14
|
+
dusk: 'Dusk',
|
|
15
|
+
eclipse: 'Eclipse',
|
|
16
|
+
lagoon: 'Lagoon',
|
|
17
|
+
cumulus: 'Cumulus',
|
|
18
|
+
moss: 'Moss',
|
|
19
|
+
iris: 'Iris',
|
|
20
|
+
};
|
|
21
|
+
/** The picker, in order: the default, the ten gradients, Blank, Custom. */
|
|
8
22
|
export const WALLPAPERS = [
|
|
9
23
|
{
|
|
10
24
|
id: 'dither',
|
|
@@ -12,6 +26,30 @@ export const WALLPAPERS = [
|
|
|
12
26
|
type: 'shader',
|
|
13
27
|
thumbs: shaderThumbs('dither'),
|
|
14
28
|
},
|
|
29
|
+
...Object.keys(GRADIENT_PRESETS).map((id) => ({
|
|
30
|
+
id,
|
|
31
|
+
name: GRADIENT_NAMES[id],
|
|
32
|
+
type: 'gradient',
|
|
33
|
+
gradient: GRADIENT_PRESETS[id],
|
|
34
|
+
})),
|
|
35
|
+
{
|
|
36
|
+
id: 'blank',
|
|
37
|
+
name: 'Blank',
|
|
38
|
+
type: 'none',
|
|
39
|
+
},
|
|
40
|
+
// Last, so its controls open directly under its card.
|
|
41
|
+
{
|
|
42
|
+
id: 'custom',
|
|
43
|
+
name: 'Custom',
|
|
44
|
+
type: 'custom',
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Retired from the picker on 2026-11-21. They stay resolvable by id because
|
|
49
|
+
* the marketing heroes render `brandmark` and the still-image exporter
|
|
50
|
+
* (`apps/web/scripts/generate-wallpapers.mjs`) renders the rest.
|
|
51
|
+
*/
|
|
52
|
+
const LEGACY_WALLPAPERS = [
|
|
15
53
|
{
|
|
16
54
|
id: 'brandmark',
|
|
17
55
|
name: 'Brandmark',
|
|
@@ -19,36 +57,22 @@ export const WALLPAPERS = [
|
|
|
19
57
|
svgUrl: '/kortix-brandmark-bg.svg',
|
|
20
58
|
thumbnailUrl: '/kortix-brandmark-bg.svg',
|
|
21
59
|
},
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
thumbs: shaderThumbs('nebula'),
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: 'silk',
|
|
30
|
-
name: 'Silk',
|
|
31
|
-
type: 'shader',
|
|
32
|
-
thumbs: shaderThumbs('silk'),
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 'grain',
|
|
36
|
-
name: 'Grain',
|
|
37
|
-
type: 'shader',
|
|
38
|
-
thumbs: shaderThumbs('grain'),
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: 'neuro',
|
|
42
|
-
name: 'Neuro',
|
|
43
|
-
type: 'shader',
|
|
44
|
-
thumbs: shaderThumbs('neuro'),
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: 'blank',
|
|
48
|
-
name: 'Blank',
|
|
49
|
-
type: 'none',
|
|
50
|
-
},
|
|
60
|
+
{ id: 'nebula', name: 'Pixel Beams', type: 'shader', thumbs: shaderThumbs('nebula') },
|
|
61
|
+
{ id: 'silk', name: 'Silk', type: 'shader', thumbs: shaderThumbs('silk') },
|
|
62
|
+
{ id: 'grain', name: 'Grain', type: 'shader', thumbs: shaderThumbs('grain') },
|
|
63
|
+
{ id: 'neuro', name: 'Neuro', type: 'shader', thumbs: shaderThumbs('neuro') },
|
|
51
64
|
];
|
|
65
|
+
/** Resolves any id that can render, picker or legacy. Unknown ids resolve to
|
|
66
|
+
* the default. */
|
|
52
67
|
export function getWallpaperById(id) {
|
|
68
|
+
return (WALLPAPERS.find((w) => w.id === id) ??
|
|
69
|
+
LEGACY_WALLPAPERS.find((w) => w.id === id) ??
|
|
70
|
+
WALLPAPERS[0]);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Resolves a persisted preference. A retired id falls back to the default, so
|
|
74
|
+
* a user who had one selected lands on a wallpaper the picker can show.
|
|
75
|
+
*/
|
|
76
|
+
export function getSelectableWallpaper(id) {
|
|
53
77
|
return WALLPAPERS.find((w) => w.id === id) ?? WALLPAPERS[0];
|
|
54
78
|
}
|