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.
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Wallpaper ingestion: reads an uploaded photo or animated GIF, downscales
3
+ * static images (GIFs pass through untouched so their animation survives),
4
+ * enforces the byte cap, and analyzes average luminance so the layer can
5
+ * auto-dim the backdrop and keep text readable.
6
+ */
7
+ /** Maximum accepted image/GIF wallpaper file size, bytes (30MB). */
8
+ export declare const MAX_WALLPAPER_BYTES: number;
9
+ /** Upper bound on how many files one pick may ingest at once. */
10
+ export declare const MAX_WALLPAPER_BATCH = 20;
11
+ /** Longest edge a static wallpaper is downscaled to, px. */
12
+ export declare const MAX_STATIC_EDGE = 1920;
13
+ /** JPEG quality for downscaled static wallpapers. */
14
+ export declare const WALLPAPER_JPEG_QUALITY = 0.85;
15
+ /** Luminance returned when the analysis environment cannot draw pixels. */
16
+ export declare const UNKNOWN_LUMINANCE = 0.5;
17
+ /** Wallpaper rejection reasons, surfaced through the settings row. */
18
+ export type WallpaperError = {
19
+ kind: 'size';
20
+ bytes: number;
21
+ } | {
22
+ kind: 'read';
23
+ } | {
24
+ kind: 'decode';
25
+ };
26
+ /**
27
+ * Whether the file is an animated GIF (every GIF is treated as animated:
28
+ * the format cannot be reliably detected without a full decode, and
29
+ * downscaling a GIF through a canvas would flatten its animation).
30
+ * @param file - the picked file.
31
+ * @returns true for image/gif inputs.
32
+ */
33
+ export declare function isAnimatedGif(file: File): boolean;
34
+ /**
35
+ * Read a wallpaper file into a compact data URL.
36
+ * Static images are downscaled to {@link MAX_STATIC_EDGE} and re-encoded as
37
+ * JPEG; GIFs return their original data URL byte-for-byte.
38
+ * @param file - the picked file.
39
+ * @returns the data URL, or a typed rejection.
40
+ */
41
+ export declare function readWallpaper(file: File): Promise<string | WallpaperError>;
42
+ /**
43
+ * Load a data URL into an Image (resolves null when decoding fails).
44
+ * @param url - image data URL.
45
+ * @returns the decoded image or null.
46
+ */
47
+ export declare function decodeImage(url: string): Promise<HTMLImageElement | null>;
48
+ /**
49
+ * Downscale an image to {@link MAX_STATIC_EDGE} and re-encode as JPEG.
50
+ * Falls back to the original when no 2d context exists (test environments).
51
+ * @param image - decoded source image.
52
+ * @param original - original data URL, returned when drawing is unavailable.
53
+ * @returns a compact JPEG data URL (or the original).
54
+ */
55
+ export declare function downscaleToJpeg(image: HTMLImageElement, original: string): string;
56
+ /**
57
+ * Average pixel luminance (0-1) of an image, sampled on a tiny grid.
58
+ * @param dataUrl - image data URL (a GIF's first frame is decoded).
59
+ * @returns 0-1 average luminance, or {@link UNKNOWN_LUMINANCE} when the
60
+ * environment cannot draw (jsdom, blocked canvases).
61
+ */
62
+ export declare function analyzeLuminance(dataUrl: string): Promise<number>;
63
+ /**
64
+ * Auto dim veil for a wallpaper: dark mode darkens bright wallpapers, light
65
+ * mode brightens dark ones, so chat text always keeps contrast.
66
+ * @param luminance - average wallpaper luminance, 0-1.
67
+ * @param dark - resolved scheme is dark.
68
+ * @returns veil alpha, 0-0.75.
69
+ */
70
+ export declare function veilAlpha(luminance: number, dark: boolean): number;
71
+ /** Maximum accepted video wallpaper file size, bytes (40MB). */
72
+ export declare const MAX_VIDEO_BYTES: number;
73
+ /** Longest clip accepted, seconds. Longer files cost battery for no gain. */
74
+ export declare const MAX_VIDEO_DURATION = 60;
75
+ /** Longest edge the poster frame is captured at, px. */
76
+ export declare const MAX_POSTER_EDGE = 1280;
77
+ /** Prefix that turns a stored clip id into the string kept in settings. */
78
+ export declare const VIDEO_PREFIX = "video:";
79
+ /** Whether the picked file is a video the layer can play. */
80
+ export declare function isVideoFile(file: File): boolean;
81
+ /** Whether a settings entry points at a clip instead of an inline image. */
82
+ export declare function isVideoRef(source: string): boolean;
83
+ /** The clip id inside a `video:<id>` reference (empty when not a reference). */
84
+ export declare function videoIdOf(source: string): string;
85
+ /** Build the settings entry for a stored clip. */
86
+ export declare function videoRef(id: string): string;
87
+ /** What a successful video ingestion yields. */
88
+ export interface VideoIngest {
89
+ /** The `video:<id>` string to store in settings. */
90
+ ref: string;
91
+ /** Average luminance of the poster frame, 0-1. */
92
+ luminance: number;
93
+ /** Poster JPEG, or null when the browser could not capture a frame. */
94
+ poster: Blob | null;
95
+ /** Clip length, seconds (0 when unknown). */
96
+ duration: number;
97
+ /** Intrinsic pixel size (0 when unknown). */
98
+ width: number;
99
+ height: number;
100
+ }
101
+ /**
102
+ * Read, validate, and describe a video wallpaper without storing it.
103
+ *
104
+ * The caller persists the blob and poster through the video store; this
105
+ * function only measures the clip, captures a poster frame, and derives the
106
+ * luminance the backdrop veil needs.
107
+ * @param file - picked video file.
108
+ * @param id - id the caller will store the clip under.
109
+ * @returns the ingestion result, or a typed rejection.
110
+ */
111
+ export declare function readVideo(file: File, id: string): Promise<VideoIngest | WallpaperError>;
112
+ //# sourceMappingURL=wallpaper.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Prism theme-layer plugin, node half. Pure UI plugin: the empty apply exists
3
+ * so the plugin appears in the host cordis.yml / Loader; the browser half
4
+ * ships via exports["./client"], discovered through the package.json
5
+ * dsh.client declaration. Every preference is a browser-local setting
6
+ * (localStorage) — a client-only visual layer owns no host configuration.
7
+ */
8
+ /** Host plugin body — no host-side behavior for this surface plugin. */
9
+ export declare function apply(): void;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Package-owned invariant companion for `dsh-prism-plugin`.
3
+ * @module dsh-prism-plugin/invariant
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "client-ui-prism-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
16
+ //# sourceMappingURL=invariant.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,113 @@
1
1
  {
2
2
  "name": "dsh-prism-plugin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "DSH Background: photo, GIF, and MP4/WebM backdrops for the DSH Web GUI, with per-image carousel picks, drag ordering, glassmorphism, typography, accent colors, aurora, and portable themes",
4
+ "version": "3.0.0",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/mantonlove/dsh-prism-plugin.git"
11
+ },
12
+ "type": "module",
13
+ "packageManager": "pnpm@11.7.0",
14
+ "icon": "assets/icon-180.png",
15
+ "main": "lib/index.js",
16
+ "types": "lib/types/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./lib/types/index.d.ts",
20
+ "default": "./lib/index.js"
21
+ },
22
+ "./invariant": {
23
+ "types": "./lib/types/invariant.d.ts",
24
+ "default": "./lib/invariant.js"
25
+ },
26
+ "./client": {
27
+ "types": "./lib/types/client/index.d.ts",
28
+ "default": "./lib/client.js"
29
+ },
30
+ "./src/*": "./src/*",
31
+ "./package.json": "./package.json"
32
+ },
33
+ "dsh": {
34
+ "bundle": {
35
+ "patch": "./cordis.patch.yml"
36
+ },
37
+ "client": {
38
+ "inject": [
39
+ "@deepseek-ai/dsh-client-locale",
40
+ "@deepseek-ai/dsh-client-ui-theme",
41
+ "@deepseek-ai/dsh-client-ui-settings",
42
+ "@deepseek-ai/dsh-client-ui-renderer"
43
+ ],
44
+ "platform": "web"
45
+ }
46
+ },
47
+ "license": "MIT",
48
+ "peerDependencies": {
49
+ "@deepseek-ai/cordis": "^4.0.1-rc.4",
50
+ "@deepseek-ai/dsh-client-locale": "^0.2.2-rc.1",
51
+ "@deepseek-ai/dsh-client-store": "^0.2.2-rc.1",
52
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.2.2-rc.1",
53
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.2-rc.1",
54
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.1",
55
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.2-rc.1",
56
+ "@deepseek-ai/dsh-client-ui-theme": "^0.2.2-rc.1",
57
+ "@deepseek-ai/dsh-invariants": "^0.2.0-rc.2",
58
+ "react": "^18.2.0"
59
+ },
60
+ "devDependencies": {
61
+ "@deepseek-ai/cordis": "4.1.0",
62
+ "@deepseek-ai/dsh-client-locale": "0.2.2-rc.3",
63
+ "@deepseek-ai/dsh-client-store": "0.2.2-rc.3",
64
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.3",
65
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.3",
66
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.3",
67
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.3",
68
+ "@deepseek-ai/dsh-client-ui-theme": "0.2.2-rc.3",
69
+ "@deepseek-ai/dsh-invariants": "0.2.0-rc.2",
70
+ "@types/node": "^22.20.0",
71
+ "@types/react": "~18.3.1",
72
+ "@types/react-dom": "~18.3.0",
73
+ "immer": "^10.1.1",
74
+ "jsdom": "^26.0.0",
75
+ "lightningcss": "^1.32.0",
76
+ "react": "^18.3.1",
77
+ "react-dom": "^18.3.1",
78
+ "tsdown": "^0.22.2",
79
+ "typescript": "^5.9.3",
80
+ "vitest": "^3.2.4",
81
+ "zustand": "~4.5.7"
82
+ },
83
+ "files": [
84
+ "lib/index.js",
85
+ "lib/invariant.js",
86
+ "lib/client.js",
87
+ "lib/types/**/*.d.ts",
88
+ "assets/icon-180.png",
89
+ "cordis.patch.yml",
90
+ "README.md",
91
+ "README.zh.md",
92
+ "LICENSE"
93
+ ],
94
+ "scripts": {
95
+ "bundle": "tsdown && tsc -p tsconfig.types.json",
96
+ "watch": "tsdown --watch",
97
+ "typecheck": "tsc -p tsconfig.json",
98
+ "test": "vitest run"
99
+ },
100
+ "homepage": "https://github.com/mantonlove/dsh-prism-plugin#readme",
101
+ "bugs": {
102
+ "url": "https://github.com/mantonlove/dsh-prism-plugin/issues"
103
+ },
104
+ "keywords": [
105
+ "dsh",
106
+ "dsh-plugin",
107
+ "theme",
108
+ "wallpaper",
109
+ "glassmorphism",
110
+ "background",
111
+ "prism"
112
+ ]
113
+ }