dsh-prism-plugin 0.0.0-stage → 3.0.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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +121 -2
- package/README.zh.md +122 -0
- package/assets/icon-180.png +0 -0
- package/cordis.patch.yml +9 -0
- package/lib/client.js +4191 -0
- package/lib/index.js +11 -0
- package/lib/invariant.js +19 -0
- package/lib/types/client/PrismAppearancePanel.d.ts +50 -0
- package/lib/types/client/color.d.ts +24 -0
- package/lib/types/client/controls.d.ts +105 -0
- package/lib/types/client/fonts.d.ts +27 -0
- package/lib/types/client/index.d.ts +12 -0
- package/lib/types/client/locales.d.ts +251 -0
- package/lib/types/client/prism-settings.d.ts +251 -0
- package/lib/types/client/settings-store.d.ts +31 -0
- package/lib/types/client/spring.d.ts +56 -0
- package/lib/types/client/theme-io.d.ts +33 -0
- package/lib/types/client/theme-layer.d.ts +185 -0
- package/lib/types/client/tokens.d.ts +16 -0
- package/lib/types/client/video-store.d.ts +49 -0
- package/lib/types/client/wallpaper.d.ts +112 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +111 -4
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable Prism settings model: the knob document persisted as one JSON blob
|
|
3
|
+
* in localStorage, its defaults, clamps, presets, material and font tables.
|
|
4
|
+
* The layer is the only writer; every consumer (settings UI mirrors) reads
|
|
5
|
+
* through the layer's getters.
|
|
6
|
+
*/
|
|
7
|
+
/** The six independently adjustable glass zones (opacity 0-100; 100 = follow
|
|
8
|
+
* the global frost, lower values thin that zone's surfaces). */
|
|
9
|
+
export interface PrismZones {
|
|
10
|
+
/** App base background. */
|
|
11
|
+
base: number;
|
|
12
|
+
/** Sidebar column. */
|
|
13
|
+
sidebar: number;
|
|
14
|
+
/** Cards and panels. */
|
|
15
|
+
card: number;
|
|
16
|
+
/** Composer input. */
|
|
17
|
+
input: number;
|
|
18
|
+
/** Menus, dropdowns, overlays. */
|
|
19
|
+
overlay: number;
|
|
20
|
+
/** Chat bubbles. */
|
|
21
|
+
bubble: number;
|
|
22
|
+
}
|
|
23
|
+
/** The complete durable knob document. */
|
|
24
|
+
export interface PrismSettings {
|
|
25
|
+
/** Master switch for the whole layer. */
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
/** Glass material preset id. */
|
|
28
|
+
material: PrismMaterial;
|
|
29
|
+
/** Glass backdrop blur radius, px (0-40). */
|
|
30
|
+
blur: number;
|
|
31
|
+
/** Global frost amount, 0-100 (50 = 1x) — the global transparency knob. */
|
|
32
|
+
frost: number;
|
|
33
|
+
/** Per-zone glass opacities, 0-100 (100 = follow the global frost). */
|
|
34
|
+
zones: PrismZones;
|
|
35
|
+
/** Background brightness, 0-100 (50 = off; direction follows the scheme). */
|
|
36
|
+
bgBrightness: number;
|
|
37
|
+
/** Font scale percent, 85-120. */
|
|
38
|
+
fontScale: number;
|
|
39
|
+
/** UI font choice id (see FONT_CHOICES). */
|
|
40
|
+
fontChoice: PrismFontChoice;
|
|
41
|
+
/** Custom UI font family (used when fontChoice is 'custom'). */
|
|
42
|
+
customFont: string;
|
|
43
|
+
/** Text ink for the light scheme: hue, degrees. */
|
|
44
|
+
inkLightHue: number;
|
|
45
|
+
/** Text ink for the light scheme: saturation, 0-100. */
|
|
46
|
+
inkLightSat: number;
|
|
47
|
+
/** Text ink for the light scheme: lightness, 0-100. */
|
|
48
|
+
inkLightLight: number;
|
|
49
|
+
/** Text ink for the dark scheme: hue, degrees. */
|
|
50
|
+
inkDarkHue: number;
|
|
51
|
+
/** Text ink for the dark scheme: saturation, 0-100. */
|
|
52
|
+
inkDarkSat: number;
|
|
53
|
+
/** Text ink for the dark scheme: lightness, 0-100. */
|
|
54
|
+
inkDarkLight: number;
|
|
55
|
+
/** Accent hue, degrees (0-360). */
|
|
56
|
+
accentHue: number;
|
|
57
|
+
/** Accent saturation, 0-100. */
|
|
58
|
+
accentSat: number;
|
|
59
|
+
/** Accent lightness, 0-100 (0 = black, 100 = white — the full range). */
|
|
60
|
+
accentLight: number;
|
|
61
|
+
/** Accent opacity, 0-100 (applies to every accent-colored surface). */
|
|
62
|
+
accentOpacity: number;
|
|
63
|
+
/** Backdrop hue, degrees (0-360). */
|
|
64
|
+
bgHue: number;
|
|
65
|
+
/** Backdrop saturation, 0-100. */
|
|
66
|
+
bgSat: number;
|
|
67
|
+
/** Backdrop lightness, 0-100. */
|
|
68
|
+
bgLight: number;
|
|
69
|
+
/** Ambient motion intensity, 0-100 (0 = static). */
|
|
70
|
+
motion: number;
|
|
71
|
+
/** Backdrop source: animated aurora or uploaded wallpaper. */
|
|
72
|
+
background: 'aurora' | 'wallpaper';
|
|
73
|
+
/** Wallpaper data URLs per scheme (rotation list). */
|
|
74
|
+
wallpaperDark: string[];
|
|
75
|
+
/** Wallpaper data URLs for the light scheme. */
|
|
76
|
+
wallpaperLight: string[];
|
|
77
|
+
/** Auto-analyzed wallpaper luminance per scheme, 0-1 (0.5 = unknown). */
|
|
78
|
+
wallpaperDimDark: number[];
|
|
79
|
+
/** Auto-analyzed wallpaper luminance for the light scheme. */
|
|
80
|
+
wallpaperDimLight: number[];
|
|
81
|
+
/** Per-image carousel membership for the dark scheme (false = skipped). */
|
|
82
|
+
wallpaperCycleDark: boolean[];
|
|
83
|
+
/** Per-image carousel membership for the light scheme (false = skipped). */
|
|
84
|
+
wallpaperCycleLight: boolean[];
|
|
85
|
+
/** Wallpaper rotation interval, seconds (used while looping). */
|
|
86
|
+
wallpaperInterval: number;
|
|
87
|
+
/** Whether wallpapers rotate automatically (false = the pinned image). */
|
|
88
|
+
wallpaperLoop: boolean;
|
|
89
|
+
/** Pinned wallpaper index per scheme (used while not looping). */
|
|
90
|
+
wallpaperPinnedDark: number;
|
|
91
|
+
/** Pinned wallpaper index for the light scheme. */
|
|
92
|
+
wallpaperPinnedLight: number;
|
|
93
|
+
/** Wallpaper blur amount, 0-100 (mapped to a perceptual px curve). */
|
|
94
|
+
wallpaperBlur: number;
|
|
95
|
+
/** Wallpaper frost veil, 0-100. */
|
|
96
|
+
wallpaperFrost: number;
|
|
97
|
+
/** Portable user-created themes (wallpaper pixels and the master switch excluded). */
|
|
98
|
+
customThemes: PrismCustomTheme[];
|
|
99
|
+
}
|
|
100
|
+
/** Glass material presets (saturation + opacity-depth recipe). */
|
|
101
|
+
export type PrismMaterial = 'clear' | 'frosted' | 'velvet';
|
|
102
|
+
/** UI font choice ids. */
|
|
103
|
+
export type PrismFontChoice = 'system' | 'rounded' | 'serif' | 'mono' | 'custom';
|
|
104
|
+
/** Named whole-skin presets. */
|
|
105
|
+
export type PrismPreset = 'night' | 'aurora' | 'crystal' | 'dune' | 'rose' | 'forest';
|
|
106
|
+
/** Maximum saved looks; reaching it never evicts an existing theme silently. */
|
|
107
|
+
export declare const MAX_CUSTOM_THEMES = 24;
|
|
108
|
+
/** Stable internal error message used to localize the saved-theme limit. */
|
|
109
|
+
export declare const PRISM_THEME_LIMIT_ERROR = "prism-theme-limit";
|
|
110
|
+
/** Stable error raised when a library edit cannot be durably persisted. */
|
|
111
|
+
export declare const PRISM_THEME_PERSIST_ERROR = "prism-theme-persist-failed";
|
|
112
|
+
/** Portable appearance values: no wallpaper bytes, rotation state, or master switch. */
|
|
113
|
+
export type PrismThemeValues = Omit<PrismSettings, 'enabled' | 'customThemes' | 'background' | 'wallpaperDark' | 'wallpaperLight' | 'wallpaperDimDark' | 'wallpaperDimLight' | 'wallpaperCycleDark' | 'wallpaperCycleLight' | 'wallpaperInterval' | 'wallpaperLoop' | 'wallpaperPinnedDark' | 'wallpaperPinnedLight' | 'wallpaperBlur' | 'wallpaperFrost'>;
|
|
114
|
+
/** One user-created theme stored alongside the durable settings document. */
|
|
115
|
+
export interface PrismCustomTheme {
|
|
116
|
+
/** Stable local identifier. */
|
|
117
|
+
id: string;
|
|
118
|
+
/** User-visible name, trimmed and length-limited. */
|
|
119
|
+
name: string;
|
|
120
|
+
/** Portable appearance values. */
|
|
121
|
+
values: PrismThemeValues;
|
|
122
|
+
}
|
|
123
|
+
/** One material's recipe. */
|
|
124
|
+
export interface MaterialRecipe {
|
|
125
|
+
/** Backdrop saturation percent (velvet desaturates for a matte feel). */
|
|
126
|
+
saturate: number;
|
|
127
|
+
/** Glass fill opacity depth multiplier (velvet sits denser). */
|
|
128
|
+
depth: number;
|
|
129
|
+
}
|
|
130
|
+
/** Material recipes: clear glass, frosted glass, and matte velvet. */
|
|
131
|
+
export declare const MATERIALS: Readonly<Record<PrismMaterial, MaterialRecipe>>;
|
|
132
|
+
/** UI font stacks by choice id (system = the stock stack). */
|
|
133
|
+
export declare const FONT_CHOICES: Readonly<Record<PrismFontChoice, string>>;
|
|
134
|
+
/** Code font stacks by choice id. */
|
|
135
|
+
export declare const CODE_FONT_CHOICES: Readonly<Record<PrismFontChoice, string>>;
|
|
136
|
+
/** localStorage key carrying the knob document. */
|
|
137
|
+
export declare const PRISM_SETTINGS_KEY = "dsh.ui-prism.settings.v1";
|
|
138
|
+
/** The neutral zone bundle (100 = follow the global frost). */
|
|
139
|
+
export declare const DEFAULT_ZONES: PrismZones;
|
|
140
|
+
/** Defaults a first-time install sees (the shipped look). */
|
|
141
|
+
export declare const SETTINGS_DEFAULTS: PrismSettings;
|
|
142
|
+
/** One named preset's knob bundle. */
|
|
143
|
+
export interface PresetRecipe {
|
|
144
|
+
/** Accent hue. */
|
|
145
|
+
accentHue: number;
|
|
146
|
+
/** Accent saturation, 0-100. */
|
|
147
|
+
accentSat: number;
|
|
148
|
+
/** Accent lightness, 0-100. */
|
|
149
|
+
accentLight: number;
|
|
150
|
+
/** Backdrop hue. */
|
|
151
|
+
bgHue: number;
|
|
152
|
+
/** Backdrop saturation, 0-100. */
|
|
153
|
+
bgSat: number;
|
|
154
|
+
/** Backdrop lightness, 0-100. */
|
|
155
|
+
bgLight: number;
|
|
156
|
+
/** Glass material id. */
|
|
157
|
+
material: PrismMaterial;
|
|
158
|
+
/** Backdrop blur, px. */
|
|
159
|
+
blur: number;
|
|
160
|
+
/** Global frost, 0-100. */
|
|
161
|
+
frost: number;
|
|
162
|
+
/** Background brightness, 0-100. */
|
|
163
|
+
bgBrightness: number;
|
|
164
|
+
/** Motion intensity, 0-100. */
|
|
165
|
+
motion: number;
|
|
166
|
+
}
|
|
167
|
+
/** Curated whole-skin presets. Every recipe is intentionally complete: one
|
|
168
|
+
* click changes a coherent palette and material rather than only the hue. */
|
|
169
|
+
export declare const PRESETS: Readonly<Record<PrismPreset, PresetRecipe>>;
|
|
170
|
+
/** Numeric knob ranges. */
|
|
171
|
+
export declare const RANGES: Readonly<{
|
|
172
|
+
blur: {
|
|
173
|
+
min: number;
|
|
174
|
+
max: number;
|
|
175
|
+
};
|
|
176
|
+
frost: {
|
|
177
|
+
min: number;
|
|
178
|
+
max: number;
|
|
179
|
+
};
|
|
180
|
+
zone: {
|
|
181
|
+
min: number;
|
|
182
|
+
max: number;
|
|
183
|
+
};
|
|
184
|
+
bgBrightness: {
|
|
185
|
+
min: number;
|
|
186
|
+
max: number;
|
|
187
|
+
};
|
|
188
|
+
fontScale: {
|
|
189
|
+
min: number;
|
|
190
|
+
max: number;
|
|
191
|
+
};
|
|
192
|
+
hue: {
|
|
193
|
+
min: number;
|
|
194
|
+
max: number;
|
|
195
|
+
};
|
|
196
|
+
sat: {
|
|
197
|
+
min: number;
|
|
198
|
+
max: number;
|
|
199
|
+
};
|
|
200
|
+
light: {
|
|
201
|
+
min: number;
|
|
202
|
+
max: number;
|
|
203
|
+
};
|
|
204
|
+
accentOpacity: {
|
|
205
|
+
min: number;
|
|
206
|
+
max: number;
|
|
207
|
+
};
|
|
208
|
+
motion: {
|
|
209
|
+
min: number;
|
|
210
|
+
max: number;
|
|
211
|
+
};
|
|
212
|
+
wallpaperInterval: {
|
|
213
|
+
min: number;
|
|
214
|
+
max: number;
|
|
215
|
+
};
|
|
216
|
+
wallpaperBlur: {
|
|
217
|
+
min: number;
|
|
218
|
+
max: number;
|
|
219
|
+
};
|
|
220
|
+
wallpaperFrost: {
|
|
221
|
+
min: number;
|
|
222
|
+
max: number;
|
|
223
|
+
};
|
|
224
|
+
}>;
|
|
225
|
+
/**
|
|
226
|
+
* Indices that take part in the carousel, in list order.
|
|
227
|
+
* A flag that is missing (array shorter than the wallpaper list) counts as
|
|
228
|
+
* included, so appending an image never silently drops it from the rotation.
|
|
229
|
+
* @param count - number of wallpapers in the scheme's list.
|
|
230
|
+
* @param flags - stored carousel membership flags.
|
|
231
|
+
* @returns the participating indices (empty when the user excluded every image).
|
|
232
|
+
*/
|
|
233
|
+
export declare function carouselIndices(count: number, flags: readonly boolean[] | undefined): number[];
|
|
234
|
+
/**
|
|
235
|
+
* Read the persisted document, folding defaults over partial storage and
|
|
236
|
+
* migrating legacy shapes (single-wallpaper strings, retired zone bundles,
|
|
237
|
+
* the retired 'apple' material id, single ink hue/saturation pairs).
|
|
238
|
+
* @returns the merged settings document.
|
|
239
|
+
*/
|
|
240
|
+
export declare function readSettings(): PrismSettings;
|
|
241
|
+
/** Persist the document.
|
|
242
|
+
* @returns false when serialization or localStorage (including quota) fails.
|
|
243
|
+
*/
|
|
244
|
+
export declare function writeSettings(settings: PrismSettings): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Whether a stored document is this plugin's own key (storage-event filter).
|
|
247
|
+
* @param key - the StorageEvent key.
|
|
248
|
+
* @returns true when the event targets the Prism document.
|
|
249
|
+
*/
|
|
250
|
+
export declare function isPrismStorageKey(key: string | null): boolean;
|
|
251
|
+
//# sourceMappingURL=prism-settings.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prism row slot stores: mirrors of the layer's settings document. The
|
|
3
|
+
* plugin's apply-world change listener is the only writer; the row components
|
|
4
|
+
* read via props.useStore. DSH 0.2.2 uses one General appearance surface;
|
|
5
|
+
* the master switch is mirrored through this same store.
|
|
6
|
+
*/
|
|
7
|
+
import { type EngineStoreHandle } from '@deepseek-ai/dsh-client-store';
|
|
8
|
+
import type { PrismSettings } from './prism-settings.ts';
|
|
9
|
+
/** Store state mirrored from the Prism layer. */
|
|
10
|
+
export interface PrismRowState extends PrismSettings {
|
|
11
|
+
/** Resolved palette is dark (brightness knob = darkening half). */
|
|
12
|
+
dark: boolean;
|
|
13
|
+
/** Monotonic revision; -1 until first sync so revision 0 lands as a change. */
|
|
14
|
+
revision: number;
|
|
15
|
+
}
|
|
16
|
+
/** The full payload the layer pushes into the row stores on every change. */
|
|
17
|
+
export interface PrismSettingsPayload extends PrismSettings {
|
|
18
|
+
/** Resolved palette is dark. */
|
|
19
|
+
dark: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Declared action shape giving the exported factory a stable return type. */
|
|
22
|
+
type PrismRowActions = {
|
|
23
|
+
sync: (draft: PrismRowState, next: PrismSettingsPayload, revision: number) => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Declares the Prism row state and write surface.
|
|
27
|
+
* @returns the store handle.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createPrismRowStore(): EngineStoreHandle<PrismRowState, PrismRowActions>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=settings-store.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Damped knob engine: a critically damped spring integrator per numeric knob.
|
|
3
|
+
* The settings UI writes target values; the layer advances each spring on a
|
|
4
|
+
* requestAnimationFrame loop and applies the smooth positions to CSS
|
|
5
|
+
* variables, so every slider drag settles with a weighty glide instead of a
|
|
6
|
+
* hard jump. Pure math — no DOM, no timers — so tests run in node.
|
|
7
|
+
*/
|
|
8
|
+
/** One spring's state: current position and velocity. */
|
|
9
|
+
export interface SpringState {
|
|
10
|
+
/** Current output position. */
|
|
11
|
+
position: number;
|
|
12
|
+
/** Current velocity (units per second). */
|
|
13
|
+
velocity: number;
|
|
14
|
+
}
|
|
15
|
+
/** Spring stiffness (higher = faster settle). */
|
|
16
|
+
export declare const SPRING_STIFFNESS = 260;
|
|
17
|
+
/** Damping ratio: 1 = critical damping (fastest settle without overshoot). */
|
|
18
|
+
export declare const SPRING_DAMPING_RATIO = 1;
|
|
19
|
+
/** Snap distance under which the spring locks to the target. */
|
|
20
|
+
export declare const SPRING_SNAP_DISTANCE = 0.05;
|
|
21
|
+
/** Snap velocity under which the spring locks to the target. */
|
|
22
|
+
export declare const SPRING_SNAP_VELOCITY = 0.5;
|
|
23
|
+
/** Simulation step cap, seconds (substepped for stability). */
|
|
24
|
+
export declare const SPRING_STEP: number;
|
|
25
|
+
/**
|
|
26
|
+
* Create a spring resting exactly on a value.
|
|
27
|
+
* @param target - initial position.
|
|
28
|
+
* @returns a settled spring state.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createSpring(target: number): SpringState;
|
|
31
|
+
/**
|
|
32
|
+
* Advance one spring toward a target by `dt` seconds (semi-implicit Euler
|
|
33
|
+
* with fixed substeps; the step cap keeps large frame gaps stable).
|
|
34
|
+
* @param state - current spring state (mutated in place).
|
|
35
|
+
* @param target - desired position.
|
|
36
|
+
* @param dt - elapsed seconds since the previous frame.
|
|
37
|
+
* @returns the same state object, advanced.
|
|
38
|
+
*/
|
|
39
|
+
export declare function advanceSpring(state: SpringState, target: number, dt: number): SpringState;
|
|
40
|
+
/**
|
|
41
|
+
* Whether a spring has settled exactly on its target.
|
|
42
|
+
* @param state - spring state to check.
|
|
43
|
+
* @param target - the target the spring was chasing.
|
|
44
|
+
* @returns true when position equals target and velocity is zero.
|
|
45
|
+
*/
|
|
46
|
+
export declare function springSettled(state: SpringState, target: number): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Bound a value into [min, max], returning `fallback` for non-finite input.
|
|
49
|
+
* @param value - value to clamp.
|
|
50
|
+
* @param min - inclusive lower bound.
|
|
51
|
+
* @param max - inclusive upper bound.
|
|
52
|
+
* @param fallback - value returned when input is not a finite number.
|
|
53
|
+
* @returns the clamped value.
|
|
54
|
+
*/
|
|
55
|
+
export declare function clampValue(value: number, min: number, max: number, fallback: number): number;
|
|
56
|
+
//# sourceMappingURL=spring.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable DSH Background theme documents. A theme contains appearance values only:
|
|
3
|
+
* wallpaper bytes, rotation state, the master switch, and the custom-theme
|
|
4
|
+
* library itself never cross the file boundary. Every imported number is
|
|
5
|
+
* finite-checked and clamped before it reaches the token layer.
|
|
6
|
+
*/
|
|
7
|
+
import { type PrismCustomTheme, type PrismSettings, type PrismThemeValues } from './prism-settings.ts';
|
|
8
|
+
/** Current interchange format identifier. */
|
|
9
|
+
export declare const PRISM_THEME_FORMAT = "dsh-prism-theme";
|
|
10
|
+
/** Current interchange schema version. */
|
|
11
|
+
export declare const PRISM_THEME_VERSION = 1;
|
|
12
|
+
/** Import is deliberately small because wallpaper data is not part of it. */
|
|
13
|
+
export declare const PRISM_THEME_MAX_BYTES: number;
|
|
14
|
+
/** The JSON file produced by export and accepted by import. */
|
|
15
|
+
export interface PrismThemeDocument {
|
|
16
|
+
format: typeof PRISM_THEME_FORMAT;
|
|
17
|
+
version: typeof PRISM_THEME_VERSION;
|
|
18
|
+
name: string;
|
|
19
|
+
values: PrismThemeValues;
|
|
20
|
+
}
|
|
21
|
+
/** Copy the portable appearance subset out of a complete settings object. */
|
|
22
|
+
export declare function themeSnapshot(settings: PrismSettings): PrismThemeValues;
|
|
23
|
+
/** Normalize untrusted portable values over the shipped defaults. */
|
|
24
|
+
export declare function normalizeThemeValues(input: unknown): PrismThemeValues;
|
|
25
|
+
/** Serialize a named snapshot with stable formatting. */
|
|
26
|
+
export declare function serializeTheme(settings: PrismSettings, name?: string): string;
|
|
27
|
+
/** Parse and normalize an imported JSON document.
|
|
28
|
+
* @throws Error with a stable code for localized UI feedback.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseThemeDocument(raw: string): PrismThemeDocument;
|
|
31
|
+
/** Create a sanitized library entry; the caller owns persistence. */
|
|
32
|
+
export declare function makeCustomTheme(settings: PrismSettings, name: string, id: string): PrismCustomTheme;
|
|
33
|
+
//# sourceMappingURL=theme-io.d.ts.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
2
|
+
import { type WallpaperError } from './wallpaper.ts';
|
|
3
|
+
import { type PrismPreset, type PrismSettings, type PrismZones } from './prism-settings.ts';
|
|
4
|
+
/** html attribute selecting the Prism layer (all CSS hooks are gated on it). */
|
|
5
|
+
export declare const PRISM_ATTRIBUTE = "data-dsh-prism";
|
|
6
|
+
/**
|
|
7
|
+
* Owns the Prism layer lifecycle: durable settings, the token override layer,
|
|
8
|
+
* the damped knob loop, the wallpaper rotation timer, and the ambient DOM.
|
|
9
|
+
* Every subscription is released through ctx.effect on dispose.
|
|
10
|
+
*/
|
|
11
|
+
export declare class PrismLayer {
|
|
12
|
+
private readonly ctx;
|
|
13
|
+
private settings;
|
|
14
|
+
private dark;
|
|
15
|
+
private tokenDisposer;
|
|
16
|
+
private rafId;
|
|
17
|
+
private lastFrame;
|
|
18
|
+
private rotateTimer;
|
|
19
|
+
/** Object URL of the clip currently on screen (revoked on swap/dispose). */
|
|
20
|
+
private clipUrl;
|
|
21
|
+
/** Object URL of its poster frame. */
|
|
22
|
+
private posterUrl;
|
|
23
|
+
/** Id of the clip the layer believes is loaded. */
|
|
24
|
+
private clipId;
|
|
25
|
+
/** Guards async loads so a fast rotation cannot paint a stale clip. */
|
|
26
|
+
private clipToken;
|
|
27
|
+
private readonly knobs;
|
|
28
|
+
private readonly notify;
|
|
29
|
+
/** Trailing-debounce timer for localStorage writes (the document can carry
|
|
30
|
+
* megabyte-sized wallpaper data URLs — persisting on every pointermove
|
|
31
|
+
* would serialize them at drag cadence and stutter the sliders). */
|
|
32
|
+
private persistTimer;
|
|
33
|
+
/** False until construction completes: mount() emits theme/change, whose
|
|
34
|
+
* handler notifies — the owner's sync closure must not run mid-construction. */
|
|
35
|
+
private ready;
|
|
36
|
+
/**
|
|
37
|
+
* @param ctx - client cordis context (theme override stack + events).
|
|
38
|
+
* @param notify - callback invoked after every applied settings change so
|
|
39
|
+
* the settings-row stores re-sync.
|
|
40
|
+
*/
|
|
41
|
+
constructor(ctx: ClientContext, notify: () => void);
|
|
42
|
+
/** Notify the owner after construction completes (never mid-construction). */
|
|
43
|
+
private signal;
|
|
44
|
+
/** Persist the settings document on a trailing 300ms debounce so rapid
|
|
45
|
+
* knob gestures never serialize the (possibly multi-megabyte) document
|
|
46
|
+
* at drag cadence. */
|
|
47
|
+
private persist;
|
|
48
|
+
/** Flush any pending debounced write immediately.
|
|
49
|
+
* @returns whether the pending document reached durable storage.
|
|
50
|
+
*/
|
|
51
|
+
private flushPersist;
|
|
52
|
+
/** Roll back a library edit whose synchronous durable write failed. */
|
|
53
|
+
private rejectFailedLibraryWrite;
|
|
54
|
+
/** Current enable state (the plugin card mirrors this). */
|
|
55
|
+
getEnabled(): boolean;
|
|
56
|
+
/** Current knob document (the settings rows mirror this). */
|
|
57
|
+
getSettings(): PrismSettings;
|
|
58
|
+
/** Whether the resolved palette is dark (brightness knob darkens). */
|
|
59
|
+
getDark(): boolean;
|
|
60
|
+
/** Resolved scheme from the theme service (falls back to the body attribute). */
|
|
61
|
+
private resolveScheme;
|
|
62
|
+
/** Flip the master switch: mount or tear down the whole layer. */
|
|
63
|
+
setEnabled(enabled: boolean): void;
|
|
64
|
+
/**
|
|
65
|
+
* Merge a settings patch, clamp every numeric field, persist, then push the
|
|
66
|
+
* touched knobs through the damping loop.
|
|
67
|
+
* @param patch - fields to change (wallpaper lists replace whole).
|
|
68
|
+
*/
|
|
69
|
+
update(patch: Omit<Partial<PrismSettings>, 'zones'> & {
|
|
70
|
+
zones?: Partial<PrismZones>;
|
|
71
|
+
}): void;
|
|
72
|
+
/** Apply a complete curated preset (palette, material, depth, and motion). */
|
|
73
|
+
applyPreset(preset: PrismPreset): void;
|
|
74
|
+
/** Save the current appearance as a portable custom theme. Duplicate names
|
|
75
|
+
* receive a numeric suffix instead of silently replacing a saved look. */
|
|
76
|
+
saveTheme(name: string): string | null;
|
|
77
|
+
/** Apply one saved theme; unknown ids are harmless no-ops. */
|
|
78
|
+
applyCustomTheme(id: string): void;
|
|
79
|
+
/** Delete one saved theme without touching the active appearance. */
|
|
80
|
+
deleteCustomTheme(id: string): void;
|
|
81
|
+
/** Export the current appearance as a portable, human-readable JSON file. */
|
|
82
|
+
exportTheme(): string;
|
|
83
|
+
/** Import, save, and immediately apply a portable theme.
|
|
84
|
+
* @returns the imported display name.
|
|
85
|
+
*/
|
|
86
|
+
importTheme(raw: string): string;
|
|
87
|
+
/** Restore only the six glass zones, leaving palette and typography intact. */
|
|
88
|
+
resetZones(): void;
|
|
89
|
+
/** Reset every appearance knob to the shipped defaults; saved themes and
|
|
90
|
+
* uploaded wallpapers remain available. */
|
|
91
|
+
reset(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Ingest an uploaded wallpaper file for one scheme: downscale (or GIF
|
|
94
|
+
* passthrough), auto-analyze luminance, and append to the rotation list.
|
|
95
|
+
* @param scheme - which palette the wallpaper belongs to.
|
|
96
|
+
* @param file - the picked file.
|
|
97
|
+
* @returns null on success, or a typed rejection for the settings row.
|
|
98
|
+
*/
|
|
99
|
+
setWallpaperFromFile(scheme: 'dark' | 'light', file: File): Promise<WallpaperError | null>;
|
|
100
|
+
/**
|
|
101
|
+
* Ingest several uploaded wallpapers for one scheme in a single settings
|
|
102
|
+
* write. Files are decoded one at a time so a large pick does not allocate
|
|
103
|
+
* every data URL at once, and a rejected file never aborts the batch.
|
|
104
|
+
* @param scheme - which palette the wallpapers belong to.
|
|
105
|
+
* @param files - the picked files, in pick order.
|
|
106
|
+
* @returns how many were appended and the typed rejections.
|
|
107
|
+
*/
|
|
108
|
+
setWallpapersFromFiles(scheme: 'dark' | 'light', files: readonly File[]): Promise<{
|
|
109
|
+
added: number;
|
|
110
|
+
errors: WallpaperError[];
|
|
111
|
+
}>;
|
|
112
|
+
/** Remove one scheme's wallpaper at a rotation-list index. */
|
|
113
|
+
clearWallpaper(scheme: 'dark' | 'light', index: number): void;
|
|
114
|
+
/** Toggle automatic rotation (on = cycle the selected images; off = pinned image). */
|
|
115
|
+
setWallpaperLoop(loop: boolean): void;
|
|
116
|
+
/**
|
|
117
|
+
* Include or exclude one image from the automatic carousel.
|
|
118
|
+
* Membership is independent of the loop switch, so a selection made while
|
|
119
|
+
* the carousel is off still applies the next time it is turned on.
|
|
120
|
+
* @param scheme - which palette's list to edit.
|
|
121
|
+
* @param index - rotation-list index.
|
|
122
|
+
* @param include - true to rotate through it, false to skip it.
|
|
123
|
+
*/
|
|
124
|
+
setWallpaperCycle(scheme: 'dark' | 'light', index: number, include: boolean): void;
|
|
125
|
+
/**
|
|
126
|
+
* Include or exclude every image of one scheme at once.
|
|
127
|
+
* @param scheme - which palette's list to edit.
|
|
128
|
+
* @param include - true to rotate through all, false to rotate through none.
|
|
129
|
+
*/
|
|
130
|
+
setWallpaperCycleAll(scheme: 'dark' | 'light', include: boolean): void;
|
|
131
|
+
/**
|
|
132
|
+
* Move one image inside its palette's list.
|
|
133
|
+
* The list order is the carousel order, so dragging in the panel is what
|
|
134
|
+
* decides which image follows which. Membership flags and the pinned index
|
|
135
|
+
* move with their image instead of staying at the old slot.
|
|
136
|
+
* @param scheme - which palette's list to edit.
|
|
137
|
+
* @param from - current index of the image.
|
|
138
|
+
* @param to - index it should land on.
|
|
139
|
+
*/
|
|
140
|
+
reorderWallpapers(scheme: 'dark' | 'light', from: number, to: number): void;
|
|
141
|
+
/** Pin one rotation-list image as the fixed background (stops the loop). */
|
|
142
|
+
pinWallpaper(scheme: 'dark' | 'light', index: number): void;
|
|
143
|
+
/** Mount every layer-owned effect. */
|
|
144
|
+
private mount;
|
|
145
|
+
/** Tear down every layer-owned effect (stock UI exactly). */
|
|
146
|
+
private unmount;
|
|
147
|
+
/** Discrete (non-damped) applications: material, fonts, backdrop source, wallpaper. */
|
|
148
|
+
private applyDiscrete;
|
|
149
|
+
/** The scheme's carousel membership flags (missing slots count as included). */
|
|
150
|
+
private wallpaperCycle;
|
|
151
|
+
/** The active index: wall-clock rotation across the selected images while
|
|
152
|
+
* looping, the pinned image otherwise (clicking a thumbnail pins it and
|
|
153
|
+
* stops the loop). Excluding every image falls back to the pinned one
|
|
154
|
+
* instead of blanking the backdrop. */
|
|
155
|
+
private wallpaperIndex;
|
|
156
|
+
/** Pause the clip and drop the URLs it was using. */
|
|
157
|
+
private stopClip;
|
|
158
|
+
/** Whether the clip is allowed to move: visible tab, focused window, motion allowed. */
|
|
159
|
+
private clipShouldPlay;
|
|
160
|
+
/** Resume the clip when policy allows it. */
|
|
161
|
+
private playClip;
|
|
162
|
+
/** Load a clip from IndexedDB and hand it to the video element. */
|
|
163
|
+
private showClip;
|
|
164
|
+
/** Point the wallpaper layer at the active scheme's rotating image. */
|
|
165
|
+
private applyWallpaperSource;
|
|
166
|
+
/** Re-evaluate the rotation index exactly at the next boundary. */
|
|
167
|
+
private scheduleRotation;
|
|
168
|
+
/** Stop the rotation timer (unmount / wallpaper source change). */
|
|
169
|
+
private stopRotation;
|
|
170
|
+
/** Re-apply everything that changes with the light/dark scheme. */
|
|
171
|
+
private applySchemeDependent;
|
|
172
|
+
/** Push every knob through the damping loop (targets unchanged, positions glide). */
|
|
173
|
+
private applyAllKnobs;
|
|
174
|
+
/** Set one knob's target and start (or skip) the damping loop. */
|
|
175
|
+
private applyKnob;
|
|
176
|
+
/** Read the current target value for one knob. */
|
|
177
|
+
private knobTarget;
|
|
178
|
+
/** Write one smoothed knob value to its `--prism-*` variables. */
|
|
179
|
+
private writeKnobVar;
|
|
180
|
+
/** Run the shared rAF loop until every spring settles. */
|
|
181
|
+
private startLoop;
|
|
182
|
+
/** Stop the shared rAF loop (keeps the springs' last positions). */
|
|
183
|
+
private stopLoop;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=theme-layer.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token derivation engine: one static override layer that turns the accent
|
|
3
|
+
* hue, contrast, frost, and six zone opacities into the full glass palette.
|
|
4
|
+
* Every dynamic part is a `var(--prism-*)` reference, so knob changes are
|
|
5
|
+
* single CSS-variable writes on <html> — the layer itself is registered once
|
|
6
|
+
* through the official {@link ThemeService.overrideTokens} stack and never
|
|
7
|
+
* re-applied while the knobs move.
|
|
8
|
+
*/
|
|
9
|
+
import type { ThemeTokenOverrides } from '@deepseek-ai/dsh-client-ui-theme/client';
|
|
10
|
+
/**
|
|
11
|
+
* Build the complete Prism token layer. Values are static strings; the
|
|
12
|
+
* dynamic knobs arrive through `--prism-*` variables written by the layer.
|
|
13
|
+
* @returns token-name → { light, dark } override dictionary.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildTokenOverrides(): ThemeTokenOverrides;
|
|
16
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IndexedDB home for video wallpapers.
|
|
3
|
+
*
|
|
4
|
+
* The settings document lives in `localStorage` and is rewritten as one JSON
|
|
5
|
+
* blob on every change, so a multi-megabyte MP4 cannot live there: the quota is
|
|
6
|
+
* 5-10MB and a failed write rolls the whole document back. Video clips therefore
|
|
7
|
+
* go to IndexedDB as Blobs, and the settings document only carries the
|
|
8
|
+
* `video:<id>` reference. Both stores share the renderer origin, so they travel
|
|
9
|
+
* together when the app's user-data directory moves.
|
|
10
|
+
*/
|
|
11
|
+
/** Name of the IndexedDB database owned by the plugin. */
|
|
12
|
+
export declare const MEDIA_DB_NAME = "dsh-prism-media";
|
|
13
|
+
/** Object store holding one record per video wallpaper. */
|
|
14
|
+
export declare const MEDIA_STORE = "videos";
|
|
15
|
+
/** Current schema version; bump together with an upgrade step. */
|
|
16
|
+
export declare const MEDIA_DB_VERSION = 1;
|
|
17
|
+
/** One stored clip plus everything the layer needs without decoding it. */
|
|
18
|
+
export interface VideoRecord {
|
|
19
|
+
/** Stable id referenced from the settings document as `video:<id>`. */
|
|
20
|
+
id: string;
|
|
21
|
+
/** The clip itself. */
|
|
22
|
+
blob: Blob;
|
|
23
|
+
/** First-frame JPEG used as thumbnail, poster, and luminance source. */
|
|
24
|
+
poster: Blob | null;
|
|
25
|
+
/** Length in seconds, 0 when the browser could not report it. */
|
|
26
|
+
duration: number;
|
|
27
|
+
/** Average luminance of the poster frame, 0-1. */
|
|
28
|
+
luminance: number;
|
|
29
|
+
/** Intrinsic pixel size, 0 when unknown. */
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
/** Byte size of the clip. */
|
|
33
|
+
bytes: number;
|
|
34
|
+
/** Epoch millis, for pruning oldest entries first. */
|
|
35
|
+
addedAt: number;
|
|
36
|
+
}
|
|
37
|
+
/** Persist one clip, replacing any record with the same id. */
|
|
38
|
+
export declare function putVideo(record: VideoRecord): Promise<void>;
|
|
39
|
+
/** Read one clip by id. */
|
|
40
|
+
export declare function getVideo(id: string): Promise<VideoRecord | null>;
|
|
41
|
+
/** Delete one clip; missing ids are not an error. */
|
|
42
|
+
export declare function deleteVideo(id: string): Promise<void>;
|
|
43
|
+
/** Every stored id, used to sweep clips the settings document no longer references. */
|
|
44
|
+
export declare function listVideoIds(): Promise<string[]>;
|
|
45
|
+
/** Total bytes held by stored clips (0 when IndexedDB is unavailable). */
|
|
46
|
+
export declare function videoUsage(): Promise<number>;
|
|
47
|
+
/** Drop clips whose ids no longer appear in the given references. */
|
|
48
|
+
export declare function pruneVideos(keepIds: readonly string[]): Promise<number>;
|
|
49
|
+
//# sourceMappingURL=video-store.d.ts.map
|