wallpaper-engine 1.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/dist/helpers.cjs +119 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.d.cts +121 -0
- package/dist/helpers.d.ts +121 -0
- package/dist/helpers.js +86 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.cjs +39 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +529 -0
- package/dist/index.d.ts +529 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/devtools/client.js +15900 -0
- package/dist/plugin/index.d.ts +334 -0
- package/dist/plugin/index.js +132 -0
- package/dist/plugin/index.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runtime value of a color property.
|
|
5
|
+
* `value` is `"R G B"` where each channel is in the **0–1** range.
|
|
6
|
+
* Multiply by 255 to convert for CSS `rgb()`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const [r, g, b] = props.myColor.value.split(' ').map(c => Math.ceil(+c * 255));
|
|
10
|
+
* el.style.color = `rgb(${r},${g},${b})`;
|
|
11
|
+
*/
|
|
12
|
+
interface WallpaperColorValue {
|
|
13
|
+
/** Color string `"R G B"` — each channel 0.0–1.0. */
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
/** Runtime value of a slider property. */
|
|
17
|
+
interface WallpaperSliderValue {
|
|
18
|
+
value: number;
|
|
19
|
+
}
|
|
20
|
+
/** Runtime value of a checkbox (`bool`) property. */
|
|
21
|
+
interface WallpaperBoolValue {
|
|
22
|
+
value: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Runtime value of a combo (dropdown) property.
|
|
26
|
+
* `value` is the hidden key configured in the editor;
|
|
27
|
+
* `text` is the visible display label.
|
|
28
|
+
*/
|
|
29
|
+
interface WallpaperComboValue {
|
|
30
|
+
/** The hidden value configured on the combo option. */
|
|
31
|
+
value: string;
|
|
32
|
+
/** Display label of the selected option (may be a `ui_` localization token). */
|
|
33
|
+
text: string;
|
|
34
|
+
}
|
|
35
|
+
/** Runtime value of a text-input property. */
|
|
36
|
+
interface WallpaperTextValue {
|
|
37
|
+
value: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Runtime value of a file property.
|
|
41
|
+
* Prepend `"file:///"` to `value` before using it as a URL.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* img.src = 'file:///' + props.myImage.value;
|
|
45
|
+
*/
|
|
46
|
+
interface WallpaperFileValue {
|
|
47
|
+
/** File path — prepend `"file:///"` before use as a URL. */
|
|
48
|
+
value: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Runtime value of a directory property in `ondemand` mode.
|
|
52
|
+
* An empty string means no directory is currently selected.
|
|
53
|
+
* Call `wallpaperRequestRandomFileForProperty` to retrieve a random file.
|
|
54
|
+
*/
|
|
55
|
+
interface WallpaperDirectoryValue {
|
|
56
|
+
/** Directory path, or empty string when no directory is selected. */
|
|
57
|
+
value: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** File type accepted by file/directory properties */
|
|
61
|
+
type WallpaperFileType = "image" | "video";
|
|
62
|
+
/**
|
|
63
|
+
* Localization map inside `project.json`'s `general.localization`.
|
|
64
|
+
* Outer key: BCP-47 language code (e.g. `"en-us"`, `"de-de"`, `"zh-chs"`).
|
|
65
|
+
* Inner key: `ui_` token string. Value: translated display text.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* {
|
|
69
|
+
* "en-us": { "ui_mycolor": "Background color" },
|
|
70
|
+
* "de-de": { "ui_mycolor": "Hintergrundfarbe" }
|
|
71
|
+
* }
|
|
72
|
+
*/
|
|
73
|
+
type WallpaperLocalization = Record<string, Record<string, string>>;
|
|
74
|
+
interface WallpaperPropertyBase {
|
|
75
|
+
/** Display label shown in the properties panel, or a `ui_` token for localization */
|
|
76
|
+
text: string;
|
|
77
|
+
/** Sort index within the properties panel */
|
|
78
|
+
order?: number;
|
|
79
|
+
/** Internal sequential index (auto-assigned by the editor) */
|
|
80
|
+
index?: number;
|
|
81
|
+
/**
|
|
82
|
+
* JavaScript expression evaluated to determine visibility.
|
|
83
|
+
* References other property keys, e.g. `"showclock.value == true"`.
|
|
84
|
+
*/
|
|
85
|
+
condition?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Color picker property. Shows a color picker to the user.
|
|
89
|
+
* The runtime value is `"R G B"` where each channel is in the **0–1** range.
|
|
90
|
+
*/
|
|
91
|
+
interface WallpaperColorProperty extends WallpaperPropertyBase {
|
|
92
|
+
type: "color";
|
|
93
|
+
/** Default color as `"R G B"` with each channel in the 0–1 range. */
|
|
94
|
+
value: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Slider property. Lets users pick a number in a defined range.
|
|
98
|
+
* Enable `fraction` for decimal values; `precision` controls decimal places (default: `2`).
|
|
99
|
+
*/
|
|
100
|
+
interface WallpaperSliderProperty extends WallpaperPropertyBase {
|
|
101
|
+
type: "slider";
|
|
102
|
+
/** Default value — should be within `[min, max]`. */
|
|
103
|
+
value: number;
|
|
104
|
+
min: number;
|
|
105
|
+
max: number;
|
|
106
|
+
/** Allow fractional (decimal) values. */
|
|
107
|
+
fraction?: boolean;
|
|
108
|
+
/** Number of decimal places when `fraction` is `true` (default: `2`). */
|
|
109
|
+
precision?: number;
|
|
110
|
+
}
|
|
111
|
+
/** Checkbox (on/off toggle) property. */
|
|
112
|
+
interface WallpaperBoolProperty extends WallpaperPropertyBase {
|
|
113
|
+
type: "bool";
|
|
114
|
+
/** Default checked state. */
|
|
115
|
+
value: boolean;
|
|
116
|
+
}
|
|
117
|
+
interface WallpaperComboOption {
|
|
118
|
+
/** Human-readable label shown in the dropdown, or a `ui_` token */
|
|
119
|
+
label: string;
|
|
120
|
+
/** Hidden value passed to `applyUserProperties` */
|
|
121
|
+
value: string;
|
|
122
|
+
}
|
|
123
|
+
interface WallpaperComboProperty extends WallpaperPropertyBase {
|
|
124
|
+
type: "combo";
|
|
125
|
+
/** Key of the default selected option */
|
|
126
|
+
value: string;
|
|
127
|
+
options: WallpaperComboOption[];
|
|
128
|
+
}
|
|
129
|
+
/** Free-text input property. */
|
|
130
|
+
interface WallpaperTextInputProperty extends WallpaperPropertyBase {
|
|
131
|
+
type: "textinput";
|
|
132
|
+
/** Default text value. */
|
|
133
|
+
value: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* File selector property. Lets users import a single image or video file.
|
|
137
|
+
* The runtime `value` path must be prefixed with `"file:///"` before use as a URL.
|
|
138
|
+
*/
|
|
139
|
+
interface WallpaperFileProperty extends WallpaperPropertyBase {
|
|
140
|
+
type: "file";
|
|
141
|
+
/** Default file path (empty string = no file selected). */
|
|
142
|
+
value: string;
|
|
143
|
+
fileType?: WallpaperFileType;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Directory selector for mass-importing image or video files.
|
|
147
|
+
* Choose between `"ondemand"` (one random file at a time via
|
|
148
|
+
* `wallpaperRequestRandomFileForProperty`) and `"fetchall"` (all files
|
|
149
|
+
* surfaced via `userDirectoryFilesAddedOrChanged` / `userDirectoryFilesRemoved`).
|
|
150
|
+
*/
|
|
151
|
+
interface WallpaperDirectoryProperty extends WallpaperPropertyBase {
|
|
152
|
+
type: "directory";
|
|
153
|
+
/** Default directory path (empty string = no directory selected). */
|
|
154
|
+
value: string;
|
|
155
|
+
fileType?: WallpaperFileType;
|
|
156
|
+
/**
|
|
157
|
+
* - `"ondemand"` — call `wallpaperRequestRandomFileForProperty` to get a file.
|
|
158
|
+
* - `"fetchall"` — all files are surfaced via `userDirectoryFilesAddedOrChanged`.
|
|
159
|
+
*/
|
|
160
|
+
mode: "ondemand" | "fetchall";
|
|
161
|
+
}
|
|
162
|
+
/** Union of all property definition types stored in `project.json`. */
|
|
163
|
+
type WallpaperPropertyDefinition = WallpaperColorProperty | WallpaperSliderProperty | WallpaperBoolProperty | WallpaperComboProperty | WallpaperTextInputProperty | WallpaperFileProperty | WallpaperDirectoryProperty;
|
|
164
|
+
/** The `general` block inside `project.json`. */
|
|
165
|
+
interface WallpaperProjectGeneral {
|
|
166
|
+
properties?: Record<string, WallpaperPropertyDefinition>;
|
|
167
|
+
localization?: WallpaperLocalization;
|
|
168
|
+
}
|
|
169
|
+
/** Full shape of the `project.json` file generated by Wallpaper Engine */
|
|
170
|
+
interface WallpaperProject {
|
|
171
|
+
/** Entry HTML file name relative to the project directory */
|
|
172
|
+
file: string;
|
|
173
|
+
/** Wallpaper title shown in the Wallpaper Engine UI */
|
|
174
|
+
title: string;
|
|
175
|
+
type: "web";
|
|
176
|
+
/**
|
|
177
|
+
* Set to `true` to enable audio data delivery.
|
|
178
|
+
* Wallpaper Engine auto-detects this from `wallpaperRegisterAudioListener`
|
|
179
|
+
* calls, but you can also set it manually.
|
|
180
|
+
*/
|
|
181
|
+
supportsaudioprocessing?: boolean;
|
|
182
|
+
general?: WallpaperProjectGeneral;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type Without<T, K extends keyof T> = Omit<T, K>;
|
|
186
|
+
/** Define a color property (value: `"R G B"` in 0–1 range) */
|
|
187
|
+
declare function colorProperty(opts: Without<WallpaperColorProperty, "type">): WallpaperColorProperty;
|
|
188
|
+
/** Define a numeric slider property */
|
|
189
|
+
declare function sliderProperty(opts: Without<WallpaperSliderProperty, "type">): WallpaperSliderProperty;
|
|
190
|
+
/** Define a boolean checkbox property */
|
|
191
|
+
declare function boolProperty(opts: Without<WallpaperBoolProperty, "type">): WallpaperBoolProperty;
|
|
192
|
+
/** Define a dropdown (combo) property */
|
|
193
|
+
declare function comboProperty(opts: Without<WallpaperComboProperty, "type">): WallpaperComboProperty;
|
|
194
|
+
/** Define a text input property */
|
|
195
|
+
declare function textInputProperty(opts: Without<WallpaperTextInputProperty, "type">): WallpaperTextInputProperty;
|
|
196
|
+
/** Define a file picker property */
|
|
197
|
+
declare function fileProperty(opts: Without<WallpaperFileProperty, "type">): WallpaperFileProperty;
|
|
198
|
+
/** Define a directory picker property */
|
|
199
|
+
declare function directoryProperty(opts: Without<WallpaperDirectoryProperty, "type">): WallpaperDirectoryProperty;
|
|
200
|
+
/**
|
|
201
|
+
* Maps a single property **definition** type to its **runtime value** type.
|
|
202
|
+
*
|
|
203
|
+
* Useful for building generic helpers that operate on any property kind.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* type T = PropertyDefinitionToValue<WallpaperColorProperty>;
|
|
207
|
+
* // → WallpaperColorValue
|
|
208
|
+
*/
|
|
209
|
+
type PropertyDefinitionToValue<T extends WallpaperPropertyDefinition> = T extends {
|
|
210
|
+
type: "color";
|
|
211
|
+
} ? WallpaperColorValue : T extends {
|
|
212
|
+
type: "slider";
|
|
213
|
+
} ? WallpaperSliderValue : T extends {
|
|
214
|
+
type: "bool";
|
|
215
|
+
} ? WallpaperBoolValue : T extends {
|
|
216
|
+
type: "combo";
|
|
217
|
+
} ? WallpaperComboValue : T extends {
|
|
218
|
+
type: "textinput";
|
|
219
|
+
} ? WallpaperTextValue : T extends {
|
|
220
|
+
type: "file";
|
|
221
|
+
} ? WallpaperFileValue : T extends {
|
|
222
|
+
type: "directory";
|
|
223
|
+
} ? WallpaperDirectoryValue : never;
|
|
224
|
+
/**
|
|
225
|
+
* Infer the strongly-typed `applyUserProperties` argument from a property
|
|
226
|
+
* definition record. Define your properties once in a shared file, then pass
|
|
227
|
+
* `typeof yourProperties` here to get full autocomplete on every property key
|
|
228
|
+
* and its value type.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* // properties.ts — shared between vite.config.ts and wallpaper source
|
|
232
|
+
* import { colorProperty, sliderProperty } from 'wallpaper-engine/plugin';
|
|
233
|
+
*
|
|
234
|
+
* export const myProperties = {
|
|
235
|
+
* bgcolor: colorProperty({ text: 'Background Color', value: '0 0 0' }),
|
|
236
|
+
* speed: sliderProperty({ text: 'Speed', value: 1, min: 0, max: 5 }),
|
|
237
|
+
* };
|
|
238
|
+
*
|
|
239
|
+
* // vite.config.ts
|
|
240
|
+
* import { wallpaperEnginePlugin } from 'wallpaper-engine/plugin';
|
|
241
|
+
* import { myProperties } from './properties';
|
|
242
|
+
*
|
|
243
|
+
* export default defineConfig({
|
|
244
|
+
* plugins: [wallpaperEnginePlugin({ title: 'My Wallpaper', properties: myProperties })],
|
|
245
|
+
* });
|
|
246
|
+
*
|
|
247
|
+
* // wallpaper.ts
|
|
248
|
+
* import type { WallpaperUserPropertiesOf } from 'wallpaper-engine/plugin';
|
|
249
|
+
* import type { myProperties } from './properties';
|
|
250
|
+
*
|
|
251
|
+
* type MyProps = WallpaperUserPropertiesOf<typeof myProperties>;
|
|
252
|
+
* // → { bgcolor: WallpaperColorValue; speed: WallpaperSliderValue }
|
|
253
|
+
*
|
|
254
|
+
* window.wallpaperPropertyListener = {
|
|
255
|
+
* applyUserProperties(props: Partial<MyProps>) {
|
|
256
|
+
* if (props.bgcolor) el.style.background = wallpaperColorToRgb(props.bgcolor.value);
|
|
257
|
+
* if (props.speed !== undefined) setSpeed(props.speed.value); // number ✓
|
|
258
|
+
* },
|
|
259
|
+
* };
|
|
260
|
+
*/
|
|
261
|
+
type WallpaperUserPropertiesOf<T extends Record<string, WallpaperPropertyDefinition>> = {
|
|
262
|
+
readonly [K in keyof T]: PropertyDefinitionToValue<T[K]>;
|
|
263
|
+
};
|
|
264
|
+
interface WallpaperEnginePluginOptions {
|
|
265
|
+
/**
|
|
266
|
+
* Entry HTML file name relative to the project root.
|
|
267
|
+
* @default "index.html"
|
|
268
|
+
*/
|
|
269
|
+
file?: string;
|
|
270
|
+
/** Wallpaper title shown in the Wallpaper Engine UI */
|
|
271
|
+
title: string;
|
|
272
|
+
/**
|
|
273
|
+
* Enable audio data delivery to `wallpaperRegisterAudioListener`.
|
|
274
|
+
* Wallpaper Engine can auto-detect this, but you can set it explicitly.
|
|
275
|
+
* @default false
|
|
276
|
+
*/
|
|
277
|
+
supportsAudioProcessing?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* User-configurable properties exposed in the Wallpaper Engine properties panel.
|
|
280
|
+
* Keys become the property identifiers accessed in `applyUserProperties`.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* properties: {
|
|
284
|
+
* bgcolor: colorProperty({ text: 'Background Color', value: '0 0 0' }),
|
|
285
|
+
* speed: sliderProperty({ text: 'Speed', value: 1, min: 0, max: 5 }),
|
|
286
|
+
* }
|
|
287
|
+
*/
|
|
288
|
+
properties?: Record<string, WallpaperPropertyDefinition>;
|
|
289
|
+
/**
|
|
290
|
+
* Localization strings for property labels and combo option labels.
|
|
291
|
+
* Keys are BCP 47 language codes (e.g. `"en-us"`, `"de-de"`, `"zh-chs"`).
|
|
292
|
+
* Property labels that should be translated must start with `ui_`.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* localization: {
|
|
296
|
+
* 'en-us': { 'ui_bgcolor': 'Background Color' },
|
|
297
|
+
* 'de-de': { 'ui_bgcolor': 'Hintergrundfarbe' },
|
|
298
|
+
* }
|
|
299
|
+
*/
|
|
300
|
+
localization?: WallpaperLocalization;
|
|
301
|
+
/**
|
|
302
|
+
* Enable the in-browser dev overlay during `vite dev`. The overlay stubs
|
|
303
|
+
* every `window.wallpaper*` global, renders a draggable panel to edit each
|
|
304
|
+
* property in real time, and lets you fire audio/media/plugin events
|
|
305
|
+
* manually — so wallpapers can be developed without round-tripping through
|
|
306
|
+
* the Wallpaper Engine host application.
|
|
307
|
+
*
|
|
308
|
+
* Disabled automatically for production builds regardless of this setting.
|
|
309
|
+
*
|
|
310
|
+
* @default true
|
|
311
|
+
*/
|
|
312
|
+
devtools?: boolean;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Vite plugin that auto-generates `project.json` into the build output.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* // vite.config.ts
|
|
319
|
+
* import { wallpaperEnginePlugin, colorProperty } from 'wallpaper-engine/plugin';
|
|
320
|
+
*
|
|
321
|
+
* export default defineConfig({
|
|
322
|
+
* plugins: [
|
|
323
|
+
* wallpaperEnginePlugin({
|
|
324
|
+
* title: 'My Wallpaper',
|
|
325
|
+
* properties: {
|
|
326
|
+
* bgcolor: colorProperty({ text: 'Background Color', value: '0 0 0' }),
|
|
327
|
+
* },
|
|
328
|
+
* }),
|
|
329
|
+
* ],
|
|
330
|
+
* });
|
|
331
|
+
*/
|
|
332
|
+
declare function wallpaperEnginePlugin(options: WallpaperEnginePluginOptions): Plugin;
|
|
333
|
+
|
|
334
|
+
export { type PropertyDefinitionToValue, type WallpaperBoolProperty, type WallpaperColorProperty, type WallpaperComboOption, type WallpaperComboProperty, type WallpaperDirectoryProperty, type WallpaperEnginePluginOptions, type WallpaperFileProperty, type WallpaperFileType, type WallpaperLocalization, type WallpaperProject, type WallpaperProjectGeneral, type WallpaperPropertyDefinition, type WallpaperSliderProperty, type WallpaperTextInputProperty, type WallpaperUserPropertiesOf, boolProperty, colorProperty, comboProperty, directoryProperty, fileProperty, sliderProperty, textInputProperty, wallpaperEnginePlugin };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// src/plugin/index.ts
|
|
2
|
+
function colorProperty(opts) {
|
|
3
|
+
return { type: "color", ...opts };
|
|
4
|
+
}
|
|
5
|
+
function sliderProperty(opts) {
|
|
6
|
+
return { type: "slider", ...opts };
|
|
7
|
+
}
|
|
8
|
+
function boolProperty(opts) {
|
|
9
|
+
return { type: "bool", ...opts };
|
|
10
|
+
}
|
|
11
|
+
function comboProperty(opts) {
|
|
12
|
+
return { type: "combo", ...opts };
|
|
13
|
+
}
|
|
14
|
+
function textInputProperty(opts) {
|
|
15
|
+
return { type: "textinput", ...opts };
|
|
16
|
+
}
|
|
17
|
+
function fileProperty(opts) {
|
|
18
|
+
return { type: "file", ...opts };
|
|
19
|
+
}
|
|
20
|
+
function directoryProperty(opts) {
|
|
21
|
+
return { type: "directory", ...opts };
|
|
22
|
+
}
|
|
23
|
+
function wallpaperEnginePlugin(options) {
|
|
24
|
+
const devtoolsEnabled = options.devtools !== false;
|
|
25
|
+
const VIRTUAL_ID = "virtual:wallpaper-engine/devtools";
|
|
26
|
+
const RESOLVED_ID = "\0" + VIRTUAL_ID;
|
|
27
|
+
let isServe = false;
|
|
28
|
+
let cachedClientCode;
|
|
29
|
+
const loadClientCode = async () => {
|
|
30
|
+
if (cachedClientCode !== void 0) return cachedClientCode;
|
|
31
|
+
const { readFileSync } = await import("fs");
|
|
32
|
+
const { fileURLToPath } = await import("url");
|
|
33
|
+
const url = new URL("./devtools/client.js", import.meta.url);
|
|
34
|
+
cachedClientCode = readFileSync(fileURLToPath(url), "utf8");
|
|
35
|
+
return cachedClientCode;
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
name: "wallpaper-engine",
|
|
39
|
+
configResolved(config) {
|
|
40
|
+
isServe = config.command === "serve";
|
|
41
|
+
},
|
|
42
|
+
configureServer(server) {
|
|
43
|
+
if (!devtoolsEnabled) return;
|
|
44
|
+
void Promise.all([import("fs"), import("url")]).then(
|
|
45
|
+
([fs, { fileURLToPath }]) => {
|
|
46
|
+
const clientPath = fileURLToPath(
|
|
47
|
+
new URL("./devtools/client.js", import.meta.url)
|
|
48
|
+
);
|
|
49
|
+
fs.watchFile(clientPath, { interval: 500 }, () => {
|
|
50
|
+
cachedClientCode = void 0;
|
|
51
|
+
const mod = server.moduleGraph.getModuleById(RESOLVED_ID);
|
|
52
|
+
if (mod) server.moduleGraph.invalidateModule(mod);
|
|
53
|
+
server.ws.send({ type: "full-reload" });
|
|
54
|
+
});
|
|
55
|
+
server.httpServer?.once("close", () => {
|
|
56
|
+
fs.unwatchFile(clientPath);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
resolveId(id) {
|
|
62
|
+
if (id === VIRTUAL_ID) return RESOLVED_ID;
|
|
63
|
+
return null;
|
|
64
|
+
},
|
|
65
|
+
async load(id) {
|
|
66
|
+
if (id !== RESOLVED_ID) return null;
|
|
67
|
+
const properties = options.properties ? assignIndices(options.properties) : {};
|
|
68
|
+
const cfg = {
|
|
69
|
+
title: options.title,
|
|
70
|
+
properties,
|
|
71
|
+
localization: options.localization ?? {}
|
|
72
|
+
};
|
|
73
|
+
return "window.__WE_DEVTOOLS_CONFIG__ = " + JSON.stringify(cfg) + ";\n" + await loadClientCode();
|
|
74
|
+
},
|
|
75
|
+
transformIndexHtml() {
|
|
76
|
+
if (!isServe || !devtoolsEnabled) return;
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
tag: "script",
|
|
80
|
+
attrs: { type: "module", src: "/@id/" + VIRTUAL_ID },
|
|
81
|
+
injectTo: "head-prepend"
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
},
|
|
85
|
+
generateBundle() {
|
|
86
|
+
const properties = options.properties ? assignIndices(options.properties) : void 0;
|
|
87
|
+
const general = {};
|
|
88
|
+
if (properties) general.properties = properties;
|
|
89
|
+
if (options.localization) general.localization = options.localization;
|
|
90
|
+
const project = {
|
|
91
|
+
file: options.file ?? "index.html",
|
|
92
|
+
title: options.title,
|
|
93
|
+
type: "web"
|
|
94
|
+
};
|
|
95
|
+
if (options.supportsAudioProcessing) {
|
|
96
|
+
project.supportsaudioprocessing = true;
|
|
97
|
+
}
|
|
98
|
+
if (Object.keys(general).length > 0) {
|
|
99
|
+
project.general = general;
|
|
100
|
+
}
|
|
101
|
+
this.emitFile({
|
|
102
|
+
type: "asset",
|
|
103
|
+
fileName: "project.json",
|
|
104
|
+
source: JSON.stringify(project, null, " ")
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function assignIndices(properties) {
|
|
110
|
+
const result = {};
|
|
111
|
+
let i = 0;
|
|
112
|
+
for (const [key, prop] of Object.entries(properties)) {
|
|
113
|
+
result[key] = {
|
|
114
|
+
index: i,
|
|
115
|
+
order: i,
|
|
116
|
+
...prop
|
|
117
|
+
};
|
|
118
|
+
i++;
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
boolProperty,
|
|
124
|
+
colorProperty,
|
|
125
|
+
comboProperty,
|
|
126
|
+
directoryProperty,
|
|
127
|
+
fileProperty,
|
|
128
|
+
sliderProperty,
|
|
129
|
+
textInputProperty,
|
|
130
|
+
wallpaperEnginePlugin
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/plugin/index.ts"],"sourcesContent":["import type { Plugin } from \"vite\";\r\nimport type {\r\n WallpaperBoolValue,\r\n WallpaperColorValue,\r\n WallpaperComboValue,\r\n WallpaperDirectoryValue,\r\n WallpaperFileValue,\r\n WallpaperSliderValue,\r\n WallpaperTextValue,\r\n} from \"../types/listeners\";\r\nimport type {\r\n WallpaperBoolProperty,\r\n WallpaperColorProperty,\r\n WallpaperComboProperty,\r\n WallpaperDirectoryProperty,\r\n WallpaperFileProperty,\r\n WallpaperLocalization,\r\n WallpaperProject,\r\n WallpaperProjectGeneral,\r\n WallpaperPropertyDefinition,\r\n WallpaperSliderProperty,\r\n WallpaperTextInputProperty,\r\n} from \"../types/project\";\r\n\r\nexport type {\r\n WallpaperBoolProperty,\r\n WallpaperColorProperty,\r\n WallpaperComboProperty,\r\n WallpaperDirectoryProperty,\r\n WallpaperFileProperty,\r\n WallpaperLocalization,\r\n WallpaperProject,\r\n WallpaperProjectGeneral,\r\n WallpaperPropertyDefinition,\r\n WallpaperSliderProperty,\r\n WallpaperTextInputProperty,\r\n};\r\nexport type { WallpaperComboOption, WallpaperFileType } from \"../types/project\";\r\n\r\n// ---------------------------------------------------------------------------\r\n// Property builder helpers\r\n// ---------------------------------------------------------------------------\r\n\r\ntype Without<T, K extends keyof T> = Omit<T, K>;\r\n\r\n/** Define a color property (value: `\"R G B\"` in 0–1 range) */\r\nexport function colorProperty(\r\n opts: Without<WallpaperColorProperty, \"type\">,\r\n): WallpaperColorProperty {\r\n return { type: \"color\", ...opts };\r\n}\r\n\r\n/** Define a numeric slider property */\r\nexport function sliderProperty(\r\n opts: Without<WallpaperSliderProperty, \"type\">,\r\n): WallpaperSliderProperty {\r\n return { type: \"slider\", ...opts };\r\n}\r\n\r\n/** Define a boolean checkbox property */\r\nexport function boolProperty(\r\n opts: Without<WallpaperBoolProperty, \"type\">,\r\n): WallpaperBoolProperty {\r\n return { type: \"bool\", ...opts };\r\n}\r\n\r\n/** Define a dropdown (combo) property */\r\nexport function comboProperty(\r\n opts: Without<WallpaperComboProperty, \"type\">,\r\n): WallpaperComboProperty {\r\n return { type: \"combo\", ...opts };\r\n}\r\n\r\n/** Define a text input property */\r\nexport function textInputProperty(\r\n opts: Without<WallpaperTextInputProperty, \"type\">,\r\n): WallpaperTextInputProperty {\r\n return { type: \"textinput\", ...opts };\r\n}\r\n\r\n/** Define a file picker property */\r\nexport function fileProperty(\r\n opts: Without<WallpaperFileProperty, \"type\">,\r\n): WallpaperFileProperty {\r\n return { type: \"file\", ...opts };\r\n}\r\n\r\n/** Define a directory picker property */\r\nexport function directoryProperty(\r\n opts: Without<WallpaperDirectoryProperty, \"type\">,\r\n): WallpaperDirectoryProperty {\r\n return { type: \"directory\", ...opts };\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Property definition → runtime value type mapping\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Maps a single property **definition** type to its **runtime value** type.\r\n *\r\n * Useful for building generic helpers that operate on any property kind.\r\n *\r\n * @example\r\n * type T = PropertyDefinitionToValue<WallpaperColorProperty>;\r\n * // → WallpaperColorValue\r\n */\r\nexport type PropertyDefinitionToValue<T extends WallpaperPropertyDefinition> =\r\n T extends { type: \"color\" }\r\n ? WallpaperColorValue\r\n : T extends { type: \"slider\" }\r\n ? WallpaperSliderValue\r\n : T extends { type: \"bool\" }\r\n ? WallpaperBoolValue\r\n : T extends { type: \"combo\" }\r\n ? WallpaperComboValue\r\n : T extends { type: \"textinput\" }\r\n ? WallpaperTextValue\r\n : T extends { type: \"file\" }\r\n ? WallpaperFileValue\r\n : T extends { type: \"directory\" }\r\n ? WallpaperDirectoryValue\r\n : never;\r\n\r\n/**\r\n * Infer the strongly-typed `applyUserProperties` argument from a property\r\n * definition record. Define your properties once in a shared file, then pass\r\n * `typeof yourProperties` here to get full autocomplete on every property key\r\n * and its value type.\r\n *\r\n * @example\r\n * // properties.ts — shared between vite.config.ts and wallpaper source\r\n * import { colorProperty, sliderProperty } from 'wallpaper-engine/plugin';\r\n *\r\n * export const myProperties = {\r\n * bgcolor: colorProperty({ text: 'Background Color', value: '0 0 0' }),\r\n * speed: sliderProperty({ text: 'Speed', value: 1, min: 0, max: 5 }),\r\n * };\r\n *\r\n * // vite.config.ts\r\n * import { wallpaperEnginePlugin } from 'wallpaper-engine/plugin';\r\n * import { myProperties } from './properties';\r\n *\r\n * export default defineConfig({\r\n * plugins: [wallpaperEnginePlugin({ title: 'My Wallpaper', properties: myProperties })],\r\n * });\r\n *\r\n * // wallpaper.ts\r\n * import type { WallpaperUserPropertiesOf } from 'wallpaper-engine/plugin';\r\n * import type { myProperties } from './properties';\r\n *\r\n * type MyProps = WallpaperUserPropertiesOf<typeof myProperties>;\r\n * // → { bgcolor: WallpaperColorValue; speed: WallpaperSliderValue }\r\n *\r\n * window.wallpaperPropertyListener = {\r\n * applyUserProperties(props: Partial<MyProps>) {\r\n * if (props.bgcolor) el.style.background = wallpaperColorToRgb(props.bgcolor.value);\r\n * if (props.speed !== undefined) setSpeed(props.speed.value); // number ✓\r\n * },\r\n * };\r\n */\r\nexport type WallpaperUserPropertiesOf<\r\n T extends Record<string, WallpaperPropertyDefinition>,\r\n> = {\r\n readonly [K in keyof T]: PropertyDefinitionToValue<T[K]>;\r\n};\r\n\r\n// ---------------------------------------------------------------------------\r\n// Vite plugin\r\n// ---------------------------------------------------------------------------\r\n\r\nexport interface WallpaperEnginePluginOptions {\r\n /**\r\n * Entry HTML file name relative to the project root.\r\n * @default \"index.html\"\r\n */\r\n file?: string;\r\n /** Wallpaper title shown in the Wallpaper Engine UI */\r\n title: string;\r\n /**\r\n * Enable audio data delivery to `wallpaperRegisterAudioListener`.\r\n * Wallpaper Engine can auto-detect this, but you can set it explicitly.\r\n * @default false\r\n */\r\n supportsAudioProcessing?: boolean;\r\n /**\r\n * User-configurable properties exposed in the Wallpaper Engine properties panel.\r\n * Keys become the property identifiers accessed in `applyUserProperties`.\r\n *\r\n * @example\r\n * properties: {\r\n * bgcolor: colorProperty({ text: 'Background Color', value: '0 0 0' }),\r\n * speed: sliderProperty({ text: 'Speed', value: 1, min: 0, max: 5 }),\r\n * }\r\n */\r\n properties?: Record<string, WallpaperPropertyDefinition>;\r\n /**\r\n * Localization strings for property labels and combo option labels.\r\n * Keys are BCP 47 language codes (e.g. `\"en-us\"`, `\"de-de\"`, `\"zh-chs\"`).\r\n * Property labels that should be translated must start with `ui_`.\r\n *\r\n * @example\r\n * localization: {\r\n * 'en-us': { 'ui_bgcolor': 'Background Color' },\r\n * 'de-de': { 'ui_bgcolor': 'Hintergrundfarbe' },\r\n * }\r\n */\r\n localization?: WallpaperLocalization;\r\n /**\r\n * Enable the in-browser dev overlay during `vite dev`. The overlay stubs\r\n * every `window.wallpaper*` global, renders a draggable panel to edit each\r\n * property in real time, and lets you fire audio/media/plugin events\r\n * manually — so wallpapers can be developed without round-tripping through\r\n * the Wallpaper Engine host application.\r\n *\r\n * Disabled automatically for production builds regardless of this setting.\r\n *\r\n * @default true\r\n */\r\n devtools?: boolean;\r\n}\r\n\r\n/**\r\n * Vite plugin that auto-generates `project.json` into the build output.\r\n *\r\n * @example\r\n * // vite.config.ts\r\n * import { wallpaperEnginePlugin, colorProperty } from 'wallpaper-engine/plugin';\r\n *\r\n * export default defineConfig({\r\n * plugins: [\r\n * wallpaperEnginePlugin({\r\n * title: 'My Wallpaper',\r\n * properties: {\r\n * bgcolor: colorProperty({ text: 'Background Color', value: '0 0 0' }),\r\n * },\r\n * }),\r\n * ],\r\n * });\r\n */\r\nexport function wallpaperEnginePlugin(\r\n options: WallpaperEnginePluginOptions,\r\n): Plugin {\r\n const devtoolsEnabled = options.devtools !== false;\r\n const VIRTUAL_ID = \"virtual:wallpaper-engine/devtools\";\r\n const RESOLVED_ID = \"\\0\" + VIRTUAL_ID;\r\n let isServe = false;\r\n let cachedClientCode: string | undefined;\r\n const loadClientCode = async (): Promise<string> => {\r\n if (cachedClientCode !== undefined) return cachedClientCode;\r\n // Reads the Vue UI bundle emitted by `vite build -c vite.devtools.config.ts`\r\n // into `dist/plugin/devtools/client.js`. Imports are dynamic so this file\r\n // stays browser-safe — property builders below are imported by user code.\r\n const { readFileSync } = await import(\"node:fs\");\r\n const { fileURLToPath } = await import(\"node:url\");\r\n const url = new URL(\"./devtools/client.js\", import.meta.url);\r\n cachedClientCode = readFileSync(fileURLToPath(url), \"utf8\");\r\n return cachedClientCode;\r\n };\r\n\r\n return {\r\n name: \"wallpaper-engine\",\r\n\r\n configResolved(config) {\r\n isServe = config.command === \"serve\";\r\n },\r\n\r\n configureServer(server) {\r\n if (!devtoolsEnabled) return;\r\n void Promise.all([import(\"node:fs\"), import(\"node:url\")]).then(\r\n ([fs, { fileURLToPath }]) => {\r\n const clientPath = fileURLToPath(\r\n new URL(\"./devtools/client.js\", import.meta.url),\r\n );\r\n // Use stat-polling watchFile instead of chokidar: avoids Windows\r\n // path-normalisation mismatches (forward vs back slashes) and works\r\n // correctly across Bun workspace symlinks.\r\n fs.watchFile(clientPath, { interval: 500 }, () => {\r\n cachedClientCode = undefined;\r\n const mod = server.moduleGraph.getModuleById(RESOLVED_ID);\r\n if (mod) server.moduleGraph.invalidateModule(mod);\r\n server.ws.send({ type: \"full-reload\" });\r\n });\r\n server.httpServer?.once(\"close\", () => {\r\n fs.unwatchFile(clientPath);\r\n });\r\n },\r\n );\r\n },\r\n\r\n resolveId(id) {\r\n if (id === VIRTUAL_ID) return RESOLVED_ID;\r\n return null;\r\n },\r\n\r\n async load(id) {\r\n if (id !== RESOLVED_ID) return null;\r\n const properties = options.properties\r\n ? assignIndices(options.properties)\r\n : {};\r\n const cfg = {\r\n title: options.title,\r\n properties,\r\n localization: options.localization ?? {},\r\n };\r\n return (\r\n \"window.__WE_DEVTOOLS_CONFIG__ = \" +\r\n JSON.stringify(cfg) +\r\n \";\\n\" +\r\n (await loadClientCode())\r\n );\r\n },\r\n\r\n transformIndexHtml() {\r\n if (!isServe || !devtoolsEnabled) return;\r\n return [\r\n {\r\n tag: \"script\",\r\n attrs: { type: \"module\", src: \"/@id/\" + VIRTUAL_ID },\r\n injectTo: \"head-prepend\",\r\n },\r\n ];\r\n },\r\n\r\n generateBundle() {\r\n const properties = options.properties\r\n ? assignIndices(options.properties)\r\n : undefined;\r\n\r\n const general: WallpaperProjectGeneral = {};\r\n if (properties) general.properties = properties;\r\n if (options.localization) general.localization = options.localization;\r\n\r\n const project: WallpaperProject = {\r\n file: options.file ?? \"index.html\",\r\n title: options.title,\r\n type: \"web\",\r\n };\r\n\r\n if (options.supportsAudioProcessing) {\r\n project.supportsaudioprocessing = true;\r\n }\r\n\r\n if (Object.keys(general).length > 0) {\r\n project.general = general;\r\n }\r\n\r\n this.emitFile({\r\n type: \"asset\",\r\n fileName: \"project.json\",\r\n source: JSON.stringify(project, null, \"\\t\"),\r\n });\r\n },\r\n };\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Internal helpers\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Auto-assigns `index` and `order` to any properties that don't already have\r\n * them, based on their insertion order in the record.\r\n */\r\nfunction assignIndices(\r\n properties: Record<string, WallpaperPropertyDefinition>,\r\n): Record<string, WallpaperPropertyDefinition> {\r\n const result: Record<string, WallpaperPropertyDefinition> = {};\r\n let i = 0;\r\n\r\n for (const [key, prop] of Object.entries(properties)) {\r\n result[key] = {\r\n index: i,\r\n order: i,\r\n ...prop,\r\n };\r\n i++;\r\n }\r\n\r\n return result;\r\n}\r\n"],"mappings":"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","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wallpaper-engine",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript types, Vite plugin, and runtime helpers for Wallpaper Engine web wallpapers",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"wallpaper-engine",
|
|
7
|
+
"wallpaper engine",
|
|
8
|
+
"web wallpaper",
|
|
9
|
+
"vite plugin",
|
|
10
|
+
"typescript"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "ShadowNineX",
|
|
14
|
+
"homepage": "https://github.com/ShadowNineX/wallpaper-engine#readme",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/ShadowNineX/wallpaper-engine.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/ShadowNineX/wallpaper-engine/issues"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.cjs",
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
31
|
+
},
|
|
32
|
+
"./plugin": {
|
|
33
|
+
"types": "./dist/plugin/index.d.ts",
|
|
34
|
+
"import": "./dist/plugin/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./helpers": {
|
|
37
|
+
"types": "./dist/helpers.d.ts",
|
|
38
|
+
"import": "./dist/helpers.js",
|
|
39
|
+
"require": "./dist/helpers.cjs"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup",
|
|
49
|
+
"build:lib": "tsup",
|
|
50
|
+
"dev": "tsup --watch",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"test": "vitest",
|
|
53
|
+
"test:run": "vitest run",
|
|
54
|
+
"prepublishOnly": "bun run --cwd ../.. build"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"vite": ">=5.0.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"vite": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
66
|
+
"tsup": "^8.5.1",
|
|
67
|
+
"vite": "^8.0.13",
|
|
68
|
+
"vitest": "^4.1.6"
|
|
69
|
+
}
|
|
70
|
+
}
|