dsh-prism-plugin 0.0.0-stage → 3.0.0

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/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // src/index.ts
2
+ /**
3
+ * Prism theme-layer plugin, node half. Pure UI plugin: the empty apply exists
4
+ * so the plugin appears in the host cordis.yml / Loader; the browser half
5
+ * ships via exports["./client"], discovered through the package.json
6
+ * dsh.client declaration. Every preference is a browser-local setting
7
+ * (localStorage) — a client-only visual layer owns no host configuration.
8
+ */
9
+ /** Host plugin body — no host-side behavior for this surface plugin. */
10
+ function apply() {}
11
+ export { apply };
@@ -0,0 +1,19 @@
1
+ // src/invariant.ts
2
+ const PACKAGE_NAME = "dsh-prism-plugin";
3
+ /** Cordis companion plugin name. */
4
+ const name = "client-ui-prism-invariant";
5
+ /** Service required before the companion can reserve package ownership. */
6
+ const inject = ["invariants"];
7
+ /**
8
+ * No runtime invariant: the theme layer holds no cross-plugin mutable state —
9
+ * token overrides, the html attribute, the ambient and wallpaper layers, and
10
+ * the damped-knob loop are all owned effects disposed with the plugin fiber.
11
+ */
12
+ const install = () => {};
13
+ /**
14
+ * Register this package's invariant companion.
15
+ * @param ctx - Cordis context carrying the invariant service.
16
+ * @returns the installed registration's disposer after setup succeeds.
17
+ */
18
+ const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
19
+ export { apply, inject, name };
@@ -0,0 +1,50 @@
1
+ import type { InjectFace, PropsLocale, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import type { NS } from './locales.ts';
3
+ import type { createPrismRowStore } from './settings-store.ts';
4
+ import { type PrismFontChoice, type PrismMaterial, type PrismPreset, type PrismZones } from './prism-settings.ts';
5
+ import { type WallpaperError } from './wallpaper.ts';
6
+ /** Injected business face: the layer remains the single writer. */
7
+ export interface PrismAppearanceInjected {
8
+ setEnabled: (enabled: boolean) => void;
9
+ setMaterial: (value: PrismMaterial) => void;
10
+ setBlur: (value: number) => void;
11
+ setFrost: (value: number) => void;
12
+ setBgBrightness: (value: number) => void;
13
+ setFontScale: (value: number) => void;
14
+ setFontChoice: (value: PrismFontChoice) => void;
15
+ setCustomFont: (value: string) => void;
16
+ setZone: (zone: keyof PrismZones, value: number) => void;
17
+ setInkLightColor: (hue: number, sat: number, light: number) => void;
18
+ setInkDarkColor: (hue: number, sat: number, light: number) => void;
19
+ setAccentColor: (hue: number, sat: number, light: number) => void;
20
+ setBgColor: (hue: number, sat: number, light: number) => void;
21
+ setAccentOpacity: (value: number) => void;
22
+ setMotion: (value: number) => void;
23
+ setBackground: (value: 'aurora' | 'wallpaper') => void;
24
+ setWallpaperInterval: (value: number) => void;
25
+ setWallpaperLoop: (loop: boolean) => void;
26
+ pinWallpaper: (scheme: 'dark' | 'light', index: number) => void;
27
+ setWallpaperBlur: (value: number) => void;
28
+ setWallpaperFrost: (value: number) => void;
29
+ pickWallpapers: (scheme: 'dark' | 'light', files: readonly File[]) => Promise<{
30
+ added: number;
31
+ errors: WallpaperError[];
32
+ }>;
33
+ clearWallpaper: (scheme: 'dark' | 'light', index: number) => void;
34
+ setWallpaperCycle: (scheme: 'dark' | 'light', index: number, include: boolean) => void;
35
+ setWallpaperCycleAll: (scheme: 'dark' | 'light', include: boolean) => void;
36
+ reorderWallpapers: (scheme: 'dark' | 'light', from: number, to: number) => void;
37
+ applyPreset: (preset: PrismPreset) => void;
38
+ saveTheme: (name: string) => string | null;
39
+ applyCustomTheme: (id: string) => void;
40
+ deleteCustomTheme: (id: string) => void;
41
+ exportTheme: () => string;
42
+ importTheme: (raw: string) => string;
43
+ resetZones: () => void;
44
+ reset: () => void;
45
+ }
46
+ /** Full component props: runtime share + store share + locale seat + injected face. */
47
+ export type PrismAppearancePanelProps = PropsRuntime<'settings.general.item'> & PropsStore<ReturnType<typeof createPrismRowStore>> & PropsLocale<typeof NS> & InjectFace<PrismAppearanceInjected>;
48
+ /** Render the Prism appearance panel. */
49
+ export declare function PrismAppearancePanel(props: PrismAppearanceInjected & PrismAppearancePanelProps): import("react").JSX.Element;
50
+ //# sourceMappingURL=PrismAppearancePanel.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * HSL <-> hex conversions for the full-range color controls: the hue slider
3
+ * covers the fast path, the native color input covers the whole space
4
+ * (including black, white, and grays, which a hue-only slider cannot reach).
5
+ */
6
+ /** One color in HSL space (h 0-360, s/l 0-100). */
7
+ export interface ColorHSL {
8
+ h: number;
9
+ s: number;
10
+ l: number;
11
+ }
12
+ /**
13
+ * Convert HSL to a `#rrggbb` hex string.
14
+ * @param color - HSL color.
15
+ * @returns hex string.
16
+ */
17
+ export declare function hslToHex(color: ColorHSL): string;
18
+ /**
19
+ * Convert a `#rrggbb` hex string to HSL.
20
+ * @param hex - hex string (3- or 6-digit form).
21
+ * @returns HSL color.
22
+ */
23
+ export declare function hexToHsl(hex: string): ColorHSL;
24
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1,105 @@
1
+ /** Common slider props. */
2
+ export interface PrismSliderProps {
3
+ /** Row label. */
4
+ label: string;
5
+ /** Current target value. */
6
+ value: number;
7
+ /** Inclusive lower bound. */
8
+ min: number;
9
+ /** Inclusive upper bound. */
10
+ max: number;
11
+ /** Keyboard / drag granularity. */
12
+ step: number;
13
+ /** Value suffix shown in the readout (empty hides the readout). */
14
+ unit?: string;
15
+ /** Called with the new target on every interaction. */
16
+ onChange: (value: number) => void;
17
+ /** Optional reset target: double-clicking the track restores this value. */
18
+ defaultValue?: number;
19
+ /** Localized hint shown when a per-control reset is available. */
20
+ resetHint?: string;
21
+ }
22
+ /**
23
+ * Render one damped slider row: label, track with accent fill, draggable
24
+ * thumb, and a numeric readout. The element is a real WAI-ARIA slider.
25
+ * @param props - slider props.
26
+ * @returns the slider row.
27
+ */
28
+ export declare function PrismSlider({ label, value, min, max, step, unit, onChange, defaultValue, resetHint }: PrismSliderProps): import("react").JSX.Element;
29
+ /** Shared action-button variants. */
30
+ export type PrismButtonVariant = 'primary' | 'secondary' | 'quiet' | 'danger';
31
+ /** A compact native button with consistent state styling. */
32
+ export declare function PrismButton({ variant, className, children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement> & {
33
+ variant?: PrismButtonVariant;
34
+ }): import("react").JSX.Element;
35
+ /** Accessible master/feature switch. */
36
+ export declare function Switch({ label, checked, onChange }: {
37
+ label: string;
38
+ checked: boolean;
39
+ onChange: (checked: boolean) => void;
40
+ }): import("react").JSX.Element;
41
+ /** One option of a segmented picker. */
42
+ export interface SegmentedOption<T extends string> {
43
+ id: T;
44
+ label: string;
45
+ }
46
+ /** Segmented picker props. */
47
+ export interface SegmentedProps<T extends string> {
48
+ /** Accessible name for the button group. */
49
+ label: string;
50
+ /** Selected option id. */
51
+ value: T;
52
+ /** Options, in display order. */
53
+ options: ReadonlyArray<SegmentedOption<T>>;
54
+ /** Called with the selected id. */
55
+ onSelect: (value: T) => void;
56
+ }
57
+ /**
58
+ * Render a two-or-more-button segmented picker.
59
+ * @param props - segmented props.
60
+ * @returns the button group.
61
+ */
62
+ export declare function Segmented<T extends string>({ label, value, options, onSelect }: SegmentedProps<T>): import("react").JSX.Element;
63
+ /** Collapsible group props. */
64
+ export interface GroupProps {
65
+ /** Group title (rendered as the toggle header). */
66
+ title: string;
67
+ /** Initial expanded state. */
68
+ defaultOpen?: boolean;
69
+ /** Group body. */
70
+ children: React.ReactNode;
71
+ }
72
+ /**
73
+ * Render a collapsible settings group: a header toggle with an aria-expanded
74
+ * state and the body mounted only while open.
75
+ * @param props - group props.
76
+ * @returns the group block.
77
+ */
78
+ export declare function Group({ title, defaultOpen, children }: GroupProps): import("react").JSX.Element;
79
+ /** Full-range color control props. */
80
+ export interface ColorControlProps {
81
+ /** Row label. */
82
+ label: string;
83
+ /** Localized suffix that distinguishes the text field for assistive technology. */
84
+ hexLabel: string;
85
+ /** Localized suffix that distinguishes the native picker for assistive technology. */
86
+ pickerLabel: string;
87
+ /** Localized hex-input placeholder. */
88
+ placeholder: string;
89
+ /** Current hue, degrees. */
90
+ hue: number;
91
+ /** Current saturation, 0-100. */
92
+ sat: number;
93
+ /** Current lightness, 0-100. */
94
+ light: number;
95
+ /** Called with the new channels. */
96
+ onChange: (hue: number, sat: number, light: number) => void;
97
+ }
98
+ /**
99
+ * Render a Codex-style full-range color control: a hex code input (type any
100
+ * color code directly) plus the click-to-pick swatch button on the right.
101
+ * @param props - color control props.
102
+ * @returns the color control row.
103
+ */
104
+ export declare function ColorControl({ label, hexLabel, pickerLabel, placeholder, hue, sat, light, onChange }: ColorControlProps): import("react").JSX.Element;
105
+ //# sourceMappingURL=controls.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Font token scale layer: every composite `--dsw-font-*` token from the theme
3
+ * package's gradient-shadow-text sheet, transcribed once, transformed to
4
+ * `calc(...px * var(--prism-font-scale))` forms so the font-size knob scales
5
+ * the whole UI through the official theme override stack. The size/line-height
6
+ * pair is the only scaled part; weight, style, and family survive untouched
7
+ * (the family var resolves lazily at use-site).
8
+ */
9
+ import type { ThemeTokenOverrides } from '@deepseek-ai/dsh-client-ui-theme/client';
10
+ /** One font token: its name and the exact stock shorthand string. */
11
+ export type FontEntry = readonly [name: string, shorthand: string];
12
+ /** The complete composite-font inventory (source: ui-theme gradient-shadow-text.css). */
13
+ export declare const FONT_ENTRIES: readonly FontEntry[];
14
+ /**
15
+ * Rewrite a stock shorthand's size/line-height pair into scale-aware calc()
16
+ * expressions.
17
+ * @param shorthand - the stock shorthand string.
18
+ * @returns the same string with both px values replaced by calc().
19
+ */
20
+ export declare function scaleShorthand(shorthand: string): string;
21
+ /**
22
+ * Build the complete font-scale override layer: every shorthand plus its
23
+ * `-font-size` / `-line-height` members, all scheme-invariant.
24
+ * @returns token-name → { light, dark } override dictionary.
25
+ */
26
+ export declare function buildFontOverrides(): ThemeTokenOverrides;
27
+ //# sourceMappingURL=fonts.d.ts.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Prism client plugin body. The official theme override stack owns visual
3
+ * state; the General → Appearance panel owns every control, including the
4
+ * master switch (DSH 0.2.2 removed the legacy settings.plugin.item slot).
5
+ * Disabling Prism retracts every override and returns the stock interface.
6
+ */
7
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
8
+ import './prism.module.css';
9
+ export declare const inject: string[];
10
+ /** Register Prism's single settings surface and its reactive state bridge. */
11
+ export declare function apply(ctx: ClientContext): void;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,251 @@
1
+ /** `settings.prism` namespace dictionaries (the settings-row copy). */
2
+ /** Dictionary namespace owned by this plugin. */
3
+ export declare const NS = "settings.prism";
4
+ /** Simplified Chinese dictionary (the key-set source of truth). */
5
+ export declare const zh: {
6
+ 'prism.title': string;
7
+ 'prism.description': string;
8
+ 'prism.enable': string;
9
+ 'prism.disable': string;
10
+ 'prism.material': string;
11
+ 'prism.materialClear': string;
12
+ 'prism.materialFrosted': string;
13
+ 'prism.materialVelvet': string;
14
+ 'prism.blur': string;
15
+ 'prism.frost': string;
16
+ 'prism.zones': string;
17
+ 'prism.zoneBase': string;
18
+ 'prism.zoneSidebar': string;
19
+ 'prism.zoneCard': string;
20
+ 'prism.zoneInput': string;
21
+ 'prism.zoneOverlay': string;
22
+ 'prism.zoneBubble': string;
23
+ 'prism.bgBrightness': string;
24
+ 'prism.fontSize': string;
25
+ 'prism.font': string;
26
+ 'prism.fontSystem': string;
27
+ 'prism.fontRounded': string;
28
+ 'prism.fontSerif': string;
29
+ 'prism.fontMono': string;
30
+ 'prism.fontCustom': string;
31
+ 'prism.customFontLabel': string;
32
+ 'prism.customFontPlaceholder': string;
33
+ 'prism.colors': string;
34
+ 'prism.colorPlaceholder': string;
35
+ 'prism.colorHexLabel': string;
36
+ 'prism.colorPickerLabel': string;
37
+ 'prism.inkHue': string;
38
+ 'prism.inkDarkHue': string;
39
+ 'prism.accentHue': string;
40
+ 'prism.accentHint': string;
41
+ 'prism.bgHue': string;
42
+ 'prism.accentOpacity': string;
43
+ 'prism.motion': string;
44
+ 'prism.background': string;
45
+ 'prism.backgroundAurora': string;
46
+ 'prism.backgroundWallpaper': string;
47
+ 'prism.wallpaperDark': string;
48
+ 'prism.wallpaperLight': string;
49
+ 'prism.chooseImage': string;
50
+ 'prism.deleteWallpaper': string;
51
+ 'prism.manage': string;
52
+ 'prism.manageDone': string;
53
+ 'prism.wallpaperInterval': string;
54
+ 'prism.wallpaperMode': string;
55
+ 'prism.wallpaperFixed': string;
56
+ 'prism.wallpaperLoop': string;
57
+ 'prism.wallpaperPin': string;
58
+ 'prism.wallpaperPinHint': string;
59
+ 'prism.wallpaperIntervalHint': string;
60
+ 'prism.cycleCount': string;
61
+ 'prism.cycleAll': string;
62
+ 'prism.cycleNone': string;
63
+ 'prism.cycleToggle': string;
64
+ 'prism.cycleToggleHint': string;
65
+ 'prism.wallpaperPinWhileLooping': string;
66
+ 'prism.cycleOrder': string;
67
+ 'prism.cycleOrderHint': string;
68
+ 'prism.cycleEmpty': string;
69
+ 'prism.wallpaperBlur': string;
70
+ 'prism.wallpaperFrost': string;
71
+ 'prism.wallpaperHint': string;
72
+ 'prism.brightnessHintDark': string;
73
+ 'prism.brightnessHintLight': string;
74
+ 'prism.presets': string;
75
+ 'prism.presetNight': string;
76
+ 'prism.presetAurora': string;
77
+ 'prism.presetCrystal': string;
78
+ 'prism.reset': string;
79
+ 'prism.errorSize': string;
80
+ 'prism.errorRead': string;
81
+ 'prism.errorDecode': string;
82
+ 'prism.enabled': string;
83
+ 'prism.subtitle': string;
84
+ 'prism.previewTitle': string;
85
+ 'prism.previewText': string;
86
+ 'prism.previewInput': string;
87
+ 'prism.tabTheme': string;
88
+ 'prism.tabGlass': string;
89
+ 'prism.tabBackground': string;
90
+ 'prism.tabType': string;
91
+ 'prism.presetsDesc': string;
92
+ 'prism.presetDune': string;
93
+ 'prism.presetRose': string;
94
+ 'prism.presetForest': string;
95
+ 'prism.customThemes': string;
96
+ 'prism.customThemesDesc': string;
97
+ 'prism.themeNamePlaceholder': string;
98
+ 'prism.saveTheme': string;
99
+ 'prism.importTheme': string;
100
+ 'prism.exportTheme': string;
101
+ 'prism.noCustomThemes': string;
102
+ 'prism.applyTheme': string;
103
+ 'prism.deleteTheme': string;
104
+ 'prism.themeSaved': string;
105
+ 'prism.themeImported': string;
106
+ 'prism.themeDeleted': string;
107
+ 'prism.themeExported': string;
108
+ 'prism.themeImportFailed': string;
109
+ 'prism.themeLimit': string;
110
+ 'prism.themePersistFailed': string;
111
+ 'prism.resetAll': string;
112
+ 'prism.resetZones': string;
113
+ 'prism.sliderResetHint': string;
114
+ 'prism.materialDesc': string;
115
+ 'prism.colorsDesc': string;
116
+ 'prism.zonesDesc': string;
117
+ 'prism.fontDesc': string;
118
+ 'prism.backgroundDesc': string;
119
+ 'prism.fontPreview': string;
120
+ 'prism.wallpaperEmpty': string;
121
+ 'prism.wallpaperBatch': string;
122
+ 'prism.errorNone': string;
123
+ };
124
+ export type PrismLocaleKey = keyof typeof zh;
125
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
126
+ interface LocaleNamespaceMap {
127
+ /** The Prism settings row's copy. */
128
+ 'settings.prism': PrismLocaleKey;
129
+ }
130
+ }
131
+ /** English dictionary. */
132
+ export declare const en: {
133
+ 'prism.title': string;
134
+ 'prism.description': string;
135
+ 'prism.enable': string;
136
+ 'prism.disable': string;
137
+ 'prism.material': string;
138
+ 'prism.materialClear': string;
139
+ 'prism.materialFrosted': string;
140
+ 'prism.materialVelvet': string;
141
+ 'prism.blur': string;
142
+ 'prism.frost': string;
143
+ 'prism.zones': string;
144
+ 'prism.zoneBase': string;
145
+ 'prism.zoneSidebar': string;
146
+ 'prism.zoneCard': string;
147
+ 'prism.zoneInput': string;
148
+ 'prism.zoneOverlay': string;
149
+ 'prism.zoneBubble': string;
150
+ 'prism.bgBrightness': string;
151
+ 'prism.fontSize': string;
152
+ 'prism.font': string;
153
+ 'prism.fontSystem': string;
154
+ 'prism.fontRounded': string;
155
+ 'prism.fontSerif': string;
156
+ 'prism.fontMono': string;
157
+ 'prism.fontCustom': string;
158
+ 'prism.customFontLabel': string;
159
+ 'prism.customFontPlaceholder': string;
160
+ 'prism.colors': string;
161
+ 'prism.colorPlaceholder': string;
162
+ 'prism.colorHexLabel': string;
163
+ 'prism.colorPickerLabel': string;
164
+ 'prism.inkHue': string;
165
+ 'prism.inkDarkHue': string;
166
+ 'prism.accentHue': string;
167
+ 'prism.accentHint': string;
168
+ 'prism.bgHue': string;
169
+ 'prism.accentOpacity': string;
170
+ 'prism.motion': string;
171
+ 'prism.background': string;
172
+ 'prism.backgroundAurora': string;
173
+ 'prism.backgroundWallpaper': string;
174
+ 'prism.wallpaperDark': string;
175
+ 'prism.wallpaperLight': string;
176
+ 'prism.chooseImage': string;
177
+ 'prism.deleteWallpaper': string;
178
+ 'prism.manage': string;
179
+ 'prism.manageDone': string;
180
+ 'prism.wallpaperInterval': string;
181
+ 'prism.wallpaperMode': string;
182
+ 'prism.wallpaperFixed': string;
183
+ 'prism.wallpaperLoop': string;
184
+ 'prism.wallpaperPin': string;
185
+ 'prism.wallpaperPinHint': string;
186
+ 'prism.wallpaperIntervalHint': string;
187
+ 'prism.cycleCount': string;
188
+ 'prism.cycleAll': string;
189
+ 'prism.cycleNone': string;
190
+ 'prism.cycleToggle': string;
191
+ 'prism.cycleToggleHint': string;
192
+ 'prism.wallpaperPinWhileLooping': string;
193
+ 'prism.cycleOrder': string;
194
+ 'prism.cycleOrderHint': string;
195
+ 'prism.cycleEmpty': string;
196
+ 'prism.wallpaperBlur': string;
197
+ 'prism.wallpaperFrost': string;
198
+ 'prism.wallpaperHint': string;
199
+ 'prism.brightnessHintDark': string;
200
+ 'prism.brightnessHintLight': string;
201
+ 'prism.presets': string;
202
+ 'prism.presetNight': string;
203
+ 'prism.presetAurora': string;
204
+ 'prism.presetCrystal': string;
205
+ 'prism.reset': string;
206
+ 'prism.errorSize': string;
207
+ 'prism.errorRead': string;
208
+ 'prism.errorDecode': string;
209
+ 'prism.enabled': string;
210
+ 'prism.subtitle': string;
211
+ 'prism.previewTitle': string;
212
+ 'prism.previewText': string;
213
+ 'prism.previewInput': string;
214
+ 'prism.tabTheme': string;
215
+ 'prism.tabGlass': string;
216
+ 'prism.tabBackground': string;
217
+ 'prism.tabType': string;
218
+ 'prism.presetsDesc': string;
219
+ 'prism.presetDune': string;
220
+ 'prism.presetRose': string;
221
+ 'prism.presetForest': string;
222
+ 'prism.customThemes': string;
223
+ 'prism.customThemesDesc': string;
224
+ 'prism.themeNamePlaceholder': string;
225
+ 'prism.saveTheme': string;
226
+ 'prism.importTheme': string;
227
+ 'prism.exportTheme': string;
228
+ 'prism.noCustomThemes': string;
229
+ 'prism.applyTheme': string;
230
+ 'prism.deleteTheme': string;
231
+ 'prism.themeSaved': string;
232
+ 'prism.themeImported': string;
233
+ 'prism.themeDeleted': string;
234
+ 'prism.themeExported': string;
235
+ 'prism.themeImportFailed': string;
236
+ 'prism.themeLimit': string;
237
+ 'prism.themePersistFailed': string;
238
+ 'prism.resetAll': string;
239
+ 'prism.resetZones': string;
240
+ 'prism.sliderResetHint': string;
241
+ 'prism.materialDesc': string;
242
+ 'prism.colorsDesc': string;
243
+ 'prism.zonesDesc': string;
244
+ 'prism.fontDesc': string;
245
+ 'prism.backgroundDesc': string;
246
+ 'prism.fontPreview': string;
247
+ 'prism.wallpaperEmpty': string;
248
+ 'prism.wallpaperBatch': string;
249
+ 'prism.errorNone': string;
250
+ };
251
+ //# sourceMappingURL=locales.d.ts.map