@homebridge/plugin-ui-utils 2.3.0 → 2.3.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/README.md +7 -7
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +18 -2
- package/dist/server.js +74 -26
- package/dist/server.js.map +1 -1
- package/dist/ui.d.ts +65 -30
- package/dist/ui.interface.d.ts +43 -12
- package/dist/ui.interface.js.map +1 -1
- package/dist/ui.js +44 -101
- package/dist/ui.js.map +1 -1
- package/dist/ui.mock.d.ts +5 -6
- package/dist/ui.mock.js +8 -7
- package/dist/ui.mock.js.map +1 -1
- package/package.json +11 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.interface.d.ts.map +0 -1
- package/dist/ui.mock.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -240,7 +240,7 @@ Returns the lighting mode currently being used by the UI.
|
|
|
240
240
|
|
|
241
241
|
> `homebridge.fixScrollHeight(): void`
|
|
242
242
|
|
|
243
|
-
Force the Homebridge UI to resize the iframe to match `document.body.scrollHeight`. The library already does this automatically via `ResizeObserver`
|
|
243
|
+
Force the Homebridge UI to resize the iframe to match `document.body.scrollHeight`. The library already does this automatically via `ResizeObserver` — you should only need to call this manually if you're animating content in a way that bypasses the observer, or if you want to trigger a resize before the next observer tick.
|
|
244
244
|
|
|
245
245
|
|
|
246
246
|
### Requests
|
|
@@ -543,8 +543,8 @@ Is an object that contains plugin metadata. Mirrors the `PluginMetadata` type ex
|
|
|
543
543
|
globalInstall: boolean
|
|
544
544
|
settingsSchema: boolean
|
|
545
545
|
installPath: string
|
|
546
|
-
links:
|
|
547
|
-
funding?:
|
|
546
|
+
links: { npm?: string, homepage?: string, bugs?: string | null }
|
|
547
|
+
funding?: string | { type: string, url: string } | Array<string | { type: string, url: string }>
|
|
548
548
|
}
|
|
549
549
|
```
|
|
550
550
|
|
|
@@ -556,11 +556,11 @@ Is an object containing server metadata. Mirrors the `ServerEnvMetadata` type ex
|
|
|
556
556
|
|
|
557
557
|
```ts
|
|
558
558
|
{
|
|
559
|
-
theme: string //
|
|
559
|
+
theme: string // the colour theme, e.g. 'deep-purple' (light or dark: userCurrentLightingMode())
|
|
560
560
|
serverTimestamp: string // ISO timestamp captured at render time
|
|
561
|
-
formAuth: boolean
|
|
561
|
+
formAuth: boolean // whether the user has to log in to the UI
|
|
562
562
|
env: {
|
|
563
|
-
ableToConfigureSelf:
|
|
563
|
+
ableToConfigureSelf?: boolean // deprecated: not sent since UI v4.45.0
|
|
564
564
|
dockerOfflineUpdate: boolean
|
|
565
565
|
enableAccessories: boolean
|
|
566
566
|
enableTerminalAccess: boolean
|
|
@@ -571,7 +571,7 @@ Is an object containing server metadata. Mirrors the `ServerEnvMetadata` type ex
|
|
|
571
571
|
platform: string // darwin, win32, linux, freebsd etc.
|
|
572
572
|
runningInDocker: boolean
|
|
573
573
|
runningInLinux: boolean
|
|
574
|
-
serviceMode:
|
|
574
|
+
serviceMode?: boolean // deprecated: not sent since UI v5.0.0
|
|
575
575
|
temperatureUnits: string // 'c' | 'f'
|
|
576
576
|
lang: string | null
|
|
577
577
|
instanceId: string
|
package/dist/index.d.ts
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA","sourcesContent":["export { HomebridgePluginUiServer, RequestError } from './server.js'\nexport type { IHomebridgePluginUi, IHomebridgeUiFormHelper, IHomebridgeUiToastHelper } from './ui.interface.js'\n"]}
|
package/dist/server.d.ts
CHANGED
|
@@ -34,8 +34,25 @@ export declare class HomebridgePluginUiServer {
|
|
|
34
34
|
get homebridgeStoragePath(): string | undefined;
|
|
35
35
|
get homebridgeConfigPath(): string | undefined;
|
|
36
36
|
get homebridgeUiVersion(): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Send a message to the Homebridge UI, unless the channel to it is closed.
|
|
39
|
+
* The channel closes when the user closes the settings modal. A send after
|
|
40
|
+
* that does not throw: Node emits an 'error' event on `process`, and with no
|
|
41
|
+
* listener for it the process crashes with ERR_IPC_CHANNEL_CLOSED. A request
|
|
42
|
+
* that finishes late, or a timer that pushes events, would hit this.
|
|
43
|
+
* @param message - the message to send
|
|
44
|
+
*/
|
|
45
|
+
private send;
|
|
37
46
|
private sendResponse;
|
|
38
47
|
private processRequest;
|
|
48
|
+
/**
|
|
49
|
+
* Answer a request whose handler threw. Nothing here may throw: this runs in
|
|
50
|
+
* a catch with no catch above it, so a throw would be an unhandled rejection,
|
|
51
|
+
* which ends the process and leaves the UI waiting for an answer.
|
|
52
|
+
* @param request - the request to answer
|
|
53
|
+
* @param e - what the handler threw
|
|
54
|
+
*/
|
|
55
|
+
private sendError;
|
|
39
56
|
/**
|
|
40
57
|
* Let the server and UI know you are ready to receive requests.
|
|
41
58
|
* This method must be called when you are ready to process requests!
|
|
@@ -84,7 +101,7 @@ export declare class HomebridgePluginUiServer {
|
|
|
84
101
|
* });
|
|
85
102
|
* ```
|
|
86
103
|
*/
|
|
87
|
-
pushEvent(event: string, data:
|
|
104
|
+
pushEvent(event: string, data: unknown): void;
|
|
88
105
|
}
|
|
89
106
|
export declare class RequestError extends Error {
|
|
90
107
|
requestError: any;
|
|
@@ -93,4 +110,3 @@ export declare class RequestError extends Error {
|
|
|
93
110
|
type RequestResponse = string | number | boolean | null | void | Record<any, any> | Array<any>;
|
|
94
111
|
type RequestHandler = (arg: any) => Promise<RequestResponse> | RequestResponse;
|
|
95
112
|
export {};
|
|
96
|
-
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.js
CHANGED
|
@@ -30,17 +30,23 @@ import process from 'node:process';
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
export class HomebridgePluginUiServer {
|
|
33
|
-
|
|
33
|
+
// A Map, not a plain object: on an object, a path such as 'constructor' or
|
|
34
|
+
// 'toString' would find a method of Object.prototype and call it as a handler.
|
|
35
|
+
handlers = new Map();
|
|
34
36
|
constructor() {
|
|
35
37
|
if (!process.send) {
|
|
36
38
|
console.error('This script can only run as a child process.');
|
|
37
39
|
process.exit(1);
|
|
38
40
|
}
|
|
39
41
|
process.addListener('message', (request) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// The Homebridge UI passes on what the browser sends, so a message can
|
|
43
|
+
// be anything that survives JSON, null included. Reading .action of
|
|
44
|
+
// null would throw here and end the process.
|
|
45
|
+
if (typeof request !== 'object' || request === null) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (request.action === 'request') {
|
|
49
|
+
this.processRequest(request);
|
|
44
50
|
}
|
|
45
51
|
});
|
|
46
52
|
// Node emits 'disconnect' on the child as soon as the parent's IPC channel
|
|
@@ -63,11 +69,22 @@ export class HomebridgePluginUiServer {
|
|
|
63
69
|
get homebridgeUiVersion() {
|
|
64
70
|
return process.env.HOMEBRIDGE_UI_VERSION;
|
|
65
71
|
}
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Send a message to the Homebridge UI, unless the channel to it is closed.
|
|
74
|
+
* The channel closes when the user closes the settings modal. A send after
|
|
75
|
+
* that does not throw: Node emits an 'error' event on `process`, and with no
|
|
76
|
+
* listener for it the process crashes with ERR_IPC_CHANNEL_CLOSED. A request
|
|
77
|
+
* that finishes late, or a timer that pushes events, would hit this.
|
|
78
|
+
* @param message - the message to send
|
|
79
|
+
*/
|
|
80
|
+
send(message) {
|
|
81
|
+
if (!process.send || !process.connected) {
|
|
68
82
|
return;
|
|
69
83
|
}
|
|
70
|
-
process.send(
|
|
84
|
+
process.send(message);
|
|
85
|
+
}
|
|
86
|
+
sendResponse(request, data, success = true) {
|
|
87
|
+
this.send({
|
|
71
88
|
action: 'response',
|
|
72
89
|
payload: {
|
|
73
90
|
requestId: request.requestId,
|
|
@@ -77,21 +94,16 @@ export class HomebridgePluginUiServer {
|
|
|
77
94
|
});
|
|
78
95
|
}
|
|
79
96
|
async processRequest(request) {
|
|
80
|
-
|
|
97
|
+
const handler = this.handlers.get(request.path);
|
|
98
|
+
if (handler) {
|
|
81
99
|
try {
|
|
82
100
|
// eslint-disable-next-line no-console
|
|
83
101
|
console.log('Incoming Request:', request.path);
|
|
84
|
-
const resp = await
|
|
102
|
+
const resp = await handler(request.body ?? {});
|
|
85
103
|
return this.sendResponse(request, resp, true);
|
|
86
104
|
}
|
|
87
105
|
catch (e) {
|
|
88
|
-
|
|
89
|
-
return this.sendResponse(request, { message: e.message, error: e.requestError }, false);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
console.error(e);
|
|
93
|
-
return this.sendResponse(request, { message: e.message }, false);
|
|
94
|
-
}
|
|
106
|
+
return this.sendError(request, e);
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
else {
|
|
@@ -99,6 +111,30 @@ export class HomebridgePluginUiServer {
|
|
|
99
111
|
return this.sendResponse(request, { message: 'Not Found', path: request.path }, false);
|
|
100
112
|
}
|
|
101
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Answer a request whose handler threw. Nothing here may throw: this runs in
|
|
116
|
+
* a catch with no catch above it, so a throw would be an unhandled rejection,
|
|
117
|
+
* which ends the process and leaves the UI waiting for an answer.
|
|
118
|
+
* @param request - the request to answer
|
|
119
|
+
* @param e - what the handler threw
|
|
120
|
+
*/
|
|
121
|
+
sendError(request, e) {
|
|
122
|
+
if (e instanceof RequestError) {
|
|
123
|
+
try {
|
|
124
|
+
return this.sendResponse(request, { message: e.message, error: e.requestError }, false);
|
|
125
|
+
}
|
|
126
|
+
catch (sendError) {
|
|
127
|
+
// process.send throws at once when the payload can not become JSON,
|
|
128
|
+
// for example a circular object or a BigInt. Send the message alone.
|
|
129
|
+
console.error(sendError);
|
|
130
|
+
return this.sendResponse(request, { message: e.message }, false);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
console.error(e);
|
|
134
|
+
return this.sendResponse(request, {
|
|
135
|
+
message: describeThrown(e),
|
|
136
|
+
}, false);
|
|
137
|
+
}
|
|
102
138
|
/**
|
|
103
139
|
* Let the server and UI know you are ready to receive requests.
|
|
104
140
|
* This method must be called when you are ready to process requests!
|
|
@@ -108,10 +144,7 @@ export class HomebridgePluginUiServer {
|
|
|
108
144
|
* ```
|
|
109
145
|
*/
|
|
110
146
|
ready() {
|
|
111
|
-
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
process.send({
|
|
147
|
+
this.send({
|
|
115
148
|
action: 'ready',
|
|
116
149
|
payload: {
|
|
117
150
|
server: true,
|
|
@@ -138,7 +171,7 @@ export class HomebridgePluginUiServer {
|
|
|
138
171
|
*
|
|
139
172
|
*/
|
|
140
173
|
onRequest(path, fn) {
|
|
141
|
-
this.handlers
|
|
174
|
+
this.handlers.set(path, fn);
|
|
142
175
|
}
|
|
143
176
|
/**
|
|
144
177
|
* Push an event or stream data to the UI.
|
|
@@ -160,10 +193,7 @@ export class HomebridgePluginUiServer {
|
|
|
160
193
|
* ```
|
|
161
194
|
*/
|
|
162
195
|
pushEvent(event, data) {
|
|
163
|
-
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
process.send({
|
|
196
|
+
this.send({
|
|
167
197
|
action: 'stream',
|
|
168
198
|
payload: {
|
|
169
199
|
event,
|
|
@@ -177,7 +207,25 @@ export class RequestError extends Error {
|
|
|
177
207
|
constructor(message, requestError) {
|
|
178
208
|
super(message);
|
|
179
209
|
Object.setPrototypeOf(this, RequestError.prototype);
|
|
210
|
+
this.name = 'RequestError';
|
|
180
211
|
this.requestError = requestError;
|
|
181
212
|
}
|
|
182
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Turn any thrown value into a message. A handler can throw anything, not only
|
|
216
|
+
* an Error: `.message` of `null` throws, and so does `String()` of an object
|
|
217
|
+
* with no prototype.
|
|
218
|
+
* @param e - the thrown value
|
|
219
|
+
*/
|
|
220
|
+
function describeThrown(e) {
|
|
221
|
+
if (e instanceof Error) {
|
|
222
|
+
return e.message;
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
return String(e);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
return Object.prototype.toString.call(e);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
183
231
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,wBAAwB;IAC3B,QAAQ,GAAmC,EAAE,CAAA;IAErD;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAA;YAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;QAED,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,OAAY,EAAE,EAAE;YAC9C,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;gBACvB,KAAK,SAAS,CAAC,CAAC,CAAC;oBACf,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,2EAA2E;QAC3E,sEAAsE;QACtE,qEAAqE;QACrE,uEAAuE;QACvE,wEAAwE;QACxE,wEAAwE;QACxE,4BAA4B;QAC5B,OAA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kBG;IACI,SAAS,CAAC,IAAY,EAAE,EAAkB;QAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACI,SAAS,CAAC,KAAa,EAAE,IAAa;QAC3C,IAAI,CAAC,IAAI,CAAC;YACR,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE;gBACP,KAAK;gBACL,IAAI;aACL;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC9B,YAAY,CAAK;IAExB,YAAY,OAAe,EAAE,YAAiB;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAA;QAEnD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;QAC1B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;CACF;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,CAAU;IAChC,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC,OAAO,CAAA;IAClB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,CAAC,CAAC,CAAA;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC","sourcesContent":["import process from 'node:process'\n\n/**\n * Homebridge Custom Plugin UI Base Class\n * This provides the api to facilitate two-way communication between a plugin\n * custom UI HTML code and the server.\n *\n * This is a base class and is intended to be extended.\n *\n * @example\n * ```ts\n * class MyPluginUiServer extends HomebridgePluginUiServer {\n * constructor() {\n * // this MUST be called first\n * super();\n *\n * // this MUST be called to let the UI know your script is ready for requests\n * this.ready();\n *\n * // example handling requests\n * this.onRequest('/hello', (payload) => {\n * return { hello: 'world' };\n * });\n * }\n * }\n *\n * // start the class\n * (() => {\n * return new MyPluginUiServer();\n * })();\n * ```\n */\nexport class HomebridgePluginUiServer {\n // A Map, not a plain object: on an object, a path such as 'constructor' or\n // 'toString' would find a method of Object.prototype and call it as a handler.\n private handlers = new Map<string, RequestHandler>()\n\n constructor() {\n if (!process.send) {\n console.error('This script can only run as a child process.')\n process.exit(1)\n }\n\n process.addListener('message', (request: unknown) => {\n // The Homebridge UI passes on what the browser sends, so a message can\n // be anything that survives JSON, null included. Reading .action of\n // null would throw here and end the process.\n if (typeof request !== 'object' || request === null) {\n return\n }\n if ((request as { action?: unknown }).action === 'request') {\n this.processRequest(request as UiRequest)\n }\n })\n\n // Node emits 'disconnect' on the child as soon as the parent's IPC channel\n // closes (either via child.disconnect() or because the parent process\n // exited), so this single handler is enough to terminate the server.\n // Registered here rather than at module scope so that merely importing\n // the package (e.g. for RequestError in a plugin's main code, which may\n // itself run as an IPC child such as a child bridge) does not install a\n // self-terminating handler.\n process.on('disconnect', () => {\n process.kill(process.pid, 'SIGTERM')\n })\n }\n\n get homebridgeStoragePath() {\n return process.env.HOMEBRIDGE_STORAGE_PATH\n }\n\n get homebridgeConfigPath() {\n return process.env.HOMEBRIDGE_CONFIG_PATH\n }\n\n get homebridgeUiVersion() {\n return process.env.HOMEBRIDGE_UI_VERSION\n }\n\n /**\n * Send a message to the Homebridge UI, unless the channel to it is closed.\n * The channel closes when the user closes the settings modal. A send after\n * that does not throw: Node emits an 'error' event on `process`, and with no\n * listener for it the process crashes with ERR_IPC_CHANNEL_CLOSED. A request\n * that finishes late, or a timer that pushes events, would hit this.\n * @param message - the message to send\n */\n private send(message: Record<string, unknown>) {\n if (!process.send || !process.connected) {\n return\n }\n process.send(message)\n }\n\n private sendResponse(request: UiRequest, data: unknown, success = true) {\n this.send({\n action: 'response',\n payload: {\n requestId: request.requestId,\n success,\n data,\n },\n })\n }\n\n private async processRequest(request: UiRequest) {\n const handler = this.handlers.get(request.path)\n if (handler) {\n try {\n // eslint-disable-next-line no-console\n console.log('Incoming Request:', request.path)\n const resp = await handler(request.body ?? {})\n return this.sendResponse(request, resp, true)\n } catch (e) {\n return this.sendError(request, e)\n }\n } else {\n console.error('No Registered Handler:', request.path)\n return this.sendResponse(request, { message: 'Not Found', path: request.path }, false)\n }\n }\n\n /**\n * Answer a request whose handler threw. Nothing here may throw: this runs in\n * a catch with no catch above it, so a throw would be an unhandled rejection,\n * which ends the process and leaves the UI waiting for an answer.\n * @param request - the request to answer\n * @param e - what the handler threw\n */\n private sendError(request: UiRequest, e: unknown) {\n if (e instanceof RequestError) {\n try {\n return this.sendResponse(request, { message: e.message, error: e.requestError }, false)\n } catch (sendError) {\n // process.send throws at once when the payload can not become JSON,\n // for example a circular object or a BigInt. Send the message alone.\n console.error(sendError)\n return this.sendResponse(request, { message: e.message }, false)\n }\n }\n console.error(e)\n return this.sendResponse(request, {\n message: describeThrown(e),\n }, false)\n }\n\n /**\n * Let the server and UI know you are ready to receive requests.\n * This method must be called when you are ready to process requests!\n * @example\n * ```ts\n * this.ready();\n * ```\n */\n public ready(): void {\n this.send({\n action: 'ready',\n payload: {\n server: true,\n },\n })\n }\n\n /**\n * Register a new request handler for a given route.\n * @param path the request route name\n * @param fn the function to handle the request and provide a response\n *\n * @example\n * ```ts\n * this.onRequest('/hello', async (payload) => {\n * return {hello: 'user'};\n * });\n * ```\n *\n * You can then make requests to this endpoint from the client / ui using `homebridge.request`:\n * @example\n * ```ts\n * homebridge.request('/hello', {some: 'payload data'});\n * ```\n *\n */\n public onRequest(path: string, fn: RequestHandler) {\n this.handlers.set(path, fn)\n }\n\n /**\n * Push an event or stream data to the UI.\n * @param event the event name, the plugin UI can listen for this event\n * @param data the data to send\n *\n * @example\n * ```ts\n * this.pushEvent('my-event', {some: 'data'});\n * ```\n *\n * In the client / ui, you would then listen to this event using `homebridge.addEventListener`:\n *\n * @example\n * ```ts\n * homebridge.addEventListener('my-event', (event) => {\n * // do something with the event\n * });\n * ```\n */\n public pushEvent(event: string, data: unknown) {\n this.send({\n action: 'stream',\n payload: {\n event,\n data,\n },\n })\n }\n}\n\nexport class RequestError extends Error {\n public requestError: any\n\n constructor(message: string, requestError: any) {\n super(message)\n Object.setPrototypeOf(this, RequestError.prototype)\n\n this.name = 'RequestError'\n this.requestError = requestError\n }\n}\n\n/**\n * Turn any thrown value into a message. A handler can throw anything, not only\n * an Error: `.message` of `null` throws, and so does `String()` of an object\n * with no prototype.\n * @param e - the thrown value\n */\nfunction describeThrown(e: unknown): string {\n if (e instanceof Error) {\n return e.message\n }\n try {\n return String(e)\n } catch {\n return Object.prototype.toString.call(e)\n }\n}\n\n/**\n * A request from the plugin's custom UI, as the Homebridge UI passes it on.\n * The fields come from the browser and are not checked.\n */\ninterface UiRequest {\n action: 'request'\n requestId: string\n path: string\n body?: unknown\n}\n\n// `any`, not `unknown`, where a plugin author's own code meets these types:\n// a handler written as `(payload: { name: string }) => ...` must still be\n// accepted, and RequestError.requestError is read back by plugin code.\ntype RequestResponse = string | number | boolean | null | void | Record<any, any> | Array<any>\n\ntype RequestHandler = (arg: any) => Promise<RequestResponse> | RequestResponse\n"]}
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,27 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The Homebridge UI loads this script into a plugin's custom settings UI and
|
|
3
|
+
* sets `window.homebridge` to the object it creates. Do not include it in your
|
|
4
|
+
* own code. For its types, use `@homebridge/plugin-ui-utils/ui.interface`.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
type IHomebridgePluginUi = import('./ui.interface.js').IHomebridgePluginUi;
|
|
7
|
+
type PluginMetadata = import('./ui.interface.js').PluginMetadata;
|
|
8
|
+
type ServerEnvMetadata = import('./ui.interface.js').ServerEnvMetadata;
|
|
9
|
+
type AccessoryLayoutRoom = import('./ui.interface.js').AccessoryLayoutRoom;
|
|
10
|
+
type CachedAccessory = import('./ui.interface.js').CachedAccessory;
|
|
11
|
+
type CachedMatterAccessory = import('./ui.interface.js').CachedMatterAccessory;
|
|
12
|
+
type IHomebridgeUiFormHelper = import('./ui.interface.js').IHomebridgeUiFormHelper;
|
|
13
|
+
type IHomebridgeUiToastHelper = import('./ui.interface.js').IHomebridgeUiToastHelper;
|
|
14
|
+
type PluginConfig = import('./ui.interface.js').PluginConfig;
|
|
15
|
+
type PluginFormSchema = import('./ui.interface.js').PluginFormSchema;
|
|
16
|
+
type PluginSchema = import('./ui.interface.js').PluginSchema;
|
|
10
17
|
/**
|
|
11
|
-
*
|
|
12
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
|
|
18
|
+
* A message from the Homebridge UI. Which fields are set depends on `action`.
|
|
13
19
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
interface ParentMessage {
|
|
21
|
+
action?: string;
|
|
22
|
+
requestId?: string;
|
|
23
|
+
success?: boolean;
|
|
24
|
+
data?: unknown;
|
|
25
|
+
event?: string;
|
|
26
|
+
class?: string;
|
|
27
|
+
style?: string;
|
|
28
|
+
href?: string;
|
|
29
|
+
rel?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* What a form event carries, sent as a stream event named after the form id.
|
|
33
|
+
*/
|
|
34
|
+
interface FormEventData {
|
|
35
|
+
formEvent?: 'cancel' | 'change' | 'submit';
|
|
36
|
+
formData?: Record<string, any>;
|
|
37
|
+
}
|
|
38
|
+
type FormHandler = (change: Record<string, any>) => any;
|
|
39
|
+
interface Window {
|
|
40
|
+
_homebridge: {
|
|
41
|
+
plugin: PluginMetadata;
|
|
42
|
+
serverEnv: ServerEnvMetadata;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
declare class HomebridgePluginUi extends EventTarget implements IHomebridgePluginUi {
|
|
46
|
+
private static lastId;
|
|
47
|
+
/**
|
|
48
|
+
* Make an id that links a reply to its request, or a form's events to the
|
|
49
|
+
* form. Ids are also event names on window.homebridge, so they must never
|
|
50
|
+
* repeat: the counter makes each one unique, the random part hard to guess.
|
|
51
|
+
*/
|
|
52
|
+
static uniqueId(): string;
|
|
16
53
|
private origin;
|
|
17
|
-
private lastBodyHeight;
|
|
18
54
|
private linkRequests;
|
|
19
55
|
toast: HomebridgeUiToastHelper;
|
|
20
|
-
plugin:
|
|
21
|
-
serverEnv:
|
|
56
|
+
plugin: import("./ui.interface.js").PluginMetadata;
|
|
57
|
+
serverEnv: import("./ui.interface.js").ServerEnvMetadata;
|
|
22
58
|
constructor();
|
|
23
59
|
private _handleIncomingMessage;
|
|
24
|
-
_postMessage(message:
|
|
60
|
+
_postMessage(message: Record<string, unknown>): void;
|
|
25
61
|
private _setBodyClass;
|
|
26
62
|
private _setInlineStyle;
|
|
27
63
|
private _setLinkElement;
|
|
@@ -35,21 +71,21 @@ declare class HomebridgePluginUi extends EventTargetConstructor {
|
|
|
35
71
|
enableSaveButton(): void;
|
|
36
72
|
showSchemaForm(): void;
|
|
37
73
|
hideSchemaForm(): void;
|
|
38
|
-
createForm(schema:
|
|
74
|
+
createForm(schema: PluginFormSchema, data: any, submitButton?: string, cancelButton?: string): IHomebridgeUiFormHelper;
|
|
39
75
|
endForm(): void;
|
|
40
|
-
getPluginConfig(): Promise<
|
|
41
|
-
updatePluginConfig(pluginConfig:
|
|
42
|
-
savePluginConfig(): Promise<
|
|
43
|
-
getPluginConfigSchema(): Promise<
|
|
44
|
-
getCachedAccessories(): Promise<
|
|
45
|
-
getCachedMatterAccessories(): Promise<
|
|
46
|
-
getAccessoryLayout(): Promise<
|
|
76
|
+
getPluginConfig(): Promise<PluginConfig[]>;
|
|
77
|
+
updatePluginConfig(pluginConfig: PluginConfig[]): Promise<PluginConfig[]>;
|
|
78
|
+
savePluginConfig(): Promise<void>;
|
|
79
|
+
getPluginConfigSchema(): Promise<PluginSchema>;
|
|
80
|
+
getCachedAccessories(): Promise<CachedAccessory[]>;
|
|
81
|
+
getCachedMatterAccessories(): Promise<CachedMatterAccessory[]>;
|
|
82
|
+
getAccessoryLayout(): Promise<AccessoryLayoutRoom[]>;
|
|
47
83
|
request(path: string, body?: any): Promise<any>;
|
|
48
84
|
userCurrentLightingMode(): Promise<'dark' | 'light'>;
|
|
49
85
|
i18nCurrentLang(): Promise<string>;
|
|
50
86
|
i18nGetTranslation(): Promise<Record<string, string>>;
|
|
51
87
|
}
|
|
52
|
-
declare class HomebridgeUiToastHelper {
|
|
88
|
+
declare class HomebridgeUiToastHelper implements IHomebridgeUiToastHelper {
|
|
53
89
|
private parent;
|
|
54
90
|
constructor(parent: HomebridgePluginUi);
|
|
55
91
|
private _postMessage;
|
|
@@ -58,17 +94,16 @@ declare class HomebridgeUiToastHelper {
|
|
|
58
94
|
warning(message: string, title?: string): void;
|
|
59
95
|
info(message: string, title?: string): void;
|
|
60
96
|
}
|
|
61
|
-
declare class HomebridgeUiFormHelper {
|
|
97
|
+
declare class HomebridgeUiFormHelper implements IHomebridgeUiFormHelper {
|
|
62
98
|
private parent;
|
|
63
99
|
private formId;
|
|
64
100
|
private _changeHandle?;
|
|
65
101
|
private _submitHandle?;
|
|
66
102
|
private _cancelHandle?;
|
|
67
103
|
end: () => void;
|
|
68
|
-
constructor(parent: HomebridgePluginUi, schema:
|
|
104
|
+
constructor(parent: HomebridgePluginUi, schema: PluginFormSchema, data: any, submitButton?: string, cancelButton?: string);
|
|
69
105
|
private _eventHandle;
|
|
70
|
-
onChange(fn:
|
|
71
|
-
onSubmit(fn:
|
|
72
|
-
onCancel(fn:
|
|
106
|
+
onChange(fn: FormHandler): void;
|
|
107
|
+
onSubmit(fn: FormHandler): void;
|
|
108
|
+
onCancel(fn: FormHandler): void;
|
|
73
109
|
}
|
|
74
|
-
//# sourceMappingURL=ui.d.ts.map
|
package/dist/ui.interface.d.ts
CHANGED
|
@@ -31,15 +31,42 @@ export interface PluginMetadata {
|
|
|
31
31
|
globalInstall: boolean;
|
|
32
32
|
settingsSchema: boolean;
|
|
33
33
|
installPath: string;
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Links for the plugin, for example `{ npm: 'https://www.npmjs.com/package/homebridge-example', homepage: '...', bugs: '...' }`.
|
|
36
|
+
* Empty for a plugin that is not on npm.
|
|
37
|
+
*/
|
|
38
|
+
links: {
|
|
39
|
+
npm?: string;
|
|
40
|
+
homepage?: string;
|
|
41
|
+
bugs?: string | null;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The `funding` field of the plugin's package.json, in any of the shapes npm allows.
|
|
45
|
+
*/
|
|
46
|
+
funding?: PluginFunding;
|
|
36
47
|
}
|
|
48
|
+
export type PluginFunding = string | {
|
|
49
|
+
type: string;
|
|
50
|
+
url: string;
|
|
51
|
+
} | Array<string | {
|
|
52
|
+
type: string;
|
|
53
|
+
url: string;
|
|
54
|
+
}>;
|
|
37
55
|
export interface ServerEnvMetadata {
|
|
56
|
+
/**
|
|
57
|
+
* The colour theme, for example `deep-purple`. For light or dark mode, use `homebridge.userCurrentLightingMode()`.
|
|
58
|
+
*/
|
|
38
59
|
theme: string;
|
|
39
60
|
serverTimestamp: string;
|
|
40
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Whether the user has to log in to the Homebridge UI.
|
|
63
|
+
*/
|
|
64
|
+
formAuth: boolean;
|
|
41
65
|
env: {
|
|
42
|
-
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Not sent since Homebridge UI v4.45.0.
|
|
68
|
+
*/
|
|
69
|
+
ableToConfigureSelf?: boolean;
|
|
43
70
|
dockerOfflineUpdate: boolean;
|
|
44
71
|
enableAccessories: boolean;
|
|
45
72
|
enableTerminalAccess: boolean;
|
|
@@ -50,7 +77,10 @@ export interface ServerEnvMetadata {
|
|
|
50
77
|
platform: string;
|
|
51
78
|
runningInDocker: boolean;
|
|
52
79
|
runningInLinux: boolean;
|
|
53
|
-
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated Not sent since Homebridge UI v5.0.0, which always runs in service mode.
|
|
82
|
+
*/
|
|
83
|
+
serviceMode?: boolean;
|
|
54
84
|
temperatureUnits: string;
|
|
55
85
|
lang: string | null;
|
|
56
86
|
instanceId: string;
|
|
@@ -62,7 +92,10 @@ export interface CachedAccessory {
|
|
|
62
92
|
context: Record<string, any>;
|
|
63
93
|
displayName: string;
|
|
64
94
|
UUID: string;
|
|
65
|
-
|
|
95
|
+
/**
|
|
96
|
+
* The HAP accessory category, as a number (for example 5 = lightbulb).
|
|
97
|
+
*/
|
|
98
|
+
category: number;
|
|
66
99
|
services: any[];
|
|
67
100
|
}
|
|
68
101
|
export interface CachedMatterAccessory {
|
|
@@ -169,7 +202,7 @@ export declare class IHomebridgePluginUi extends EventTarget {
|
|
|
169
202
|
*
|
|
170
203
|
* @example
|
|
171
204
|
* ```ts
|
|
172
|
-
*
|
|
205
|
+
* homebridge.hideSchemaForm()
|
|
173
206
|
* ```
|
|
174
207
|
*/
|
|
175
208
|
hideSchemaForm(): void;
|
|
@@ -179,9 +212,8 @@ export declare class IHomebridgePluginUi extends EventTarget {
|
|
|
179
212
|
*
|
|
180
213
|
* @param schema the schema used to generate the standalone form. See [schema guide](https://developers.homebridge.io/#/config-screen/schema).
|
|
181
214
|
* @param data the initial form data
|
|
182
|
-
*
|
|
183
|
-
* @param
|
|
184
|
-
* @param cancelButton
|
|
215
|
+
* @param submitButton optional label for a submit button; without it, no submit button is shown
|
|
216
|
+
* @param cancelButton optional label for a cancel button; without it, no cancel button is shown
|
|
185
217
|
* @example
|
|
186
218
|
* ```ts
|
|
187
219
|
* const myForm = homebridge.createForm(
|
|
@@ -191,7 +223,7 @@ export declare class IHomebridgePluginUi extends EventTarget {
|
|
|
191
223
|
* properties: {
|
|
192
224
|
* name: {
|
|
193
225
|
* title: 'Name',
|
|
194
|
-
* type: string,
|
|
226
|
+
* type: 'string',
|
|
195
227
|
* required: true,
|
|
196
228
|
* }
|
|
197
229
|
* }
|
|
@@ -375,4 +407,3 @@ export declare class IHomebridgeUiFormHelper {
|
|
|
375
407
|
*/
|
|
376
408
|
onCancel(fn: (change: Record<string, any>) => any): void;
|
|
377
409
|
}
|
|
378
|
-
//# sourceMappingURL=ui.interface.d.ts.map
|
package/dist/ui.interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.interface.js","sourceRoot":"","sources":["../src/ui.interface.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ui.interface.js","sourceRoot":"","sources":["../src/ui.interface.ts"],"names":[],"mappings":"","sourcesContent":["declare global {\n interface Window {\n homebridge: IHomebridgePluginUi\n }\n}\n\nexport interface PluginSchema extends Record<string, unknown> {\n pluginAlias: string\n pluginType: string\n singular?: boolean\n customUi?: boolean\n headerDisplay?: string\n footerDisplay?: string\n schema?: Record<string, any>\n layout?: Record<string, any>[]\n form?: Record<string, any>[]\n}\n\nexport interface PluginFormSchema {\n schema: Record<string, any>\n layout?: Record<string, any>[] | null\n form?: Record<string, any>[] | null\n}\n\nexport interface PluginMetadata {\n name: string\n displayName?: string\n description: string\n verifiedPlugin: boolean\n installedVersion: string\n latestVersion: string | null\n updateAvailable: boolean\n publicPackage: boolean\n globalInstall: boolean\n settingsSchema: boolean\n installPath: string\n /**\n * Links for the plugin, for example `{ npm: 'https://www.npmjs.com/package/homebridge-example', homepage: '...', bugs: '...' }`.\n * Empty for a plugin that is not on npm.\n */\n links: {\n npm?: string\n homepage?: string\n bugs?: string | null\n }\n /**\n * The `funding` field of the plugin's package.json, in any of the shapes npm allows.\n */\n funding?: PluginFunding\n}\n\nexport type PluginFunding = string | { type: string, url: string } | Array<string | { type: string, url: string }>\n\nexport interface ServerEnvMetadata {\n /**\n * The colour theme, for example `deep-purple`. For light or dark mode, use `homebridge.userCurrentLightingMode()`.\n */\n theme: string\n serverTimestamp: string\n /**\n * Whether the user has to log in to the Homebridge UI.\n */\n formAuth: boolean\n env: {\n /**\n * @deprecated Not sent since Homebridge UI v4.45.0.\n */\n ableToConfigureSelf?: boolean\n dockerOfflineUpdate: boolean\n enableAccessories: boolean\n enableTerminalAccess: boolean\n homebridgeInstanceName: string\n nodeVersion: string\n packageName: string\n packageVersion: string\n platform: string\n runningInDocker: boolean\n runningInLinux: boolean\n /**\n * @deprecated Not sent since Homebridge UI v5.0.0, which always runs in service mode.\n */\n serviceMode?: boolean\n temperatureUnits: string\n lang: string | null\n instanceId: string\n }\n}\n\nexport interface CachedAccessory {\n plugin: string\n platform: string\n context: Record<string, any>\n displayName: string\n UUID: string\n /**\n * The HAP accessory category, as a number (for example 5 = lightbulb).\n */\n category: number\n services: any[]\n}\n\nexport interface CachedMatterAccessory {\n plugin: string\n platform: string\n uuid: string\n displayName: string\n deviceType: {\n name: string\n }\n serialNumber: string\n manufacturer: string\n model: string\n clusters: Record<string, any>\n $deviceId: string\n $protocol: string\n}\n\nexport interface AccessoryLayoutService {\n /**\n * The service's `uniqueId`, as reported by `@homebridge/hap-client`.\n */\n uniqueId: string\n}\n\nexport interface AccessoryLayoutRoom {\n name: string\n /**\n * Set on the room that holds accessories the user has not placed in a room.\n */\n isDefault?: boolean\n services: AccessoryLayoutService[]\n}\n\nexport declare type PluginConfig = Record<string, any>\n\nexport declare class IHomebridgePluginUi extends EventTarget {\n /**\n * Send a popup toast notification to the UI.\n */\n public toast: IHomebridgeUiToastHelper\n\n /**\n * An object containing information about the current plugin.\n */\n public plugin: PluginMetadata\n\n /**\n * An object containing information about the server.\n */\n public serverEnv: ServerEnvMetadata\n\n /**\n * Tell the UI to adjust the height of the iframe container to the same as your document body\n */\n public fixScrollHeight(): void\n\n /**\n * Close the Plugin Settings modal.\n * This action does not save any config changes.\n */\n public closeSettings(): void\n\n /**\n * Show a loading spinner overlay.\n * Prevents user input until cleared with `homebridge.hideSpinner()`\n *\n * @example\n * ```ts\n * homebridge.showSpinner()\n * ```\n */\n public showSpinner(): void\n\n /**\n * Hide the loading spinner overlay.\n *\n * @example\n * ```ts\n * homebridge.hideSpinner()\n * ```\n */\n public hideSpinner(): void\n\n /**\n * Disable the save button in the UI.\n *\n * @example\n * ```ts\n * homebridge.disableSaveButton()\n * ```\n */\n public disableSaveButton(): void\n\n /**\n * Enable the save button in the UI.\n *\n * @example\n * ```ts\n * homebridge.enableSaveButton()\n * ```\n */\n public enableSaveButton(): void\n\n /**\n * Show the schema-generated form below the custom UI.\n * This only works for platform plugins that have set `singular` = `true` in their config.schema.json file.\n *\n * @example\n * ```ts\n * homebridge.showSchemaForm()\n * ```\n */\n public showSchemaForm(): void\n\n /**\n * Hides the schema-generated form.\n *\n * @example\n * ```ts\n * homebridge.hideSchemaForm()\n * ```\n */\n public hideSchemaForm(): void\n\n /**\n * Create a standalone form using a generic schema.\n * This is not linked to the main config schema model, and you must listen for changes yourself.\n *\n * @param schema the schema used to generate the standalone form. See [schema guide](https://developers.homebridge.io/#/config-screen/schema).\n * @param data the initial form data\n * @param submitButton optional label for a submit button; without it, no submit button is shown\n * @param cancelButton optional label for a cancel button; without it, no cancel button is shown\n * @example\n * ```ts\n * const myForm = homebridge.createForm(\n * {\n * schema: {\n * type: 'object',\n * properties: {\n * name: {\n * title: 'Name',\n * type: 'string',\n * required: true,\n * }\n * }\n * },\n * layout: null,\n * form: null,\n * },\n * {\n * name: 'initial name value'\n * }\n * );\n *\n * // listen for input changes\n * myForm.onChange((change) => {\n * console.log(change);\n * });\n *\n * // stop listening / hide the form\n * myForm.end()\n * ```\n */\n public createForm(schema: PluginFormSchema, data: any, submitButton?: string, cancelButton?: string): IHomebridgeUiFormHelper\n\n /**\n * Removes the form.\n */\n public endForm(): void\n\n /**\n * Get the current config for the plugin.\n * @returns an array of platforms or accessory config blocks.\n * @returns an empty array if the plugin has no current config.\n *\n * @example\n * ```ts\n * const pluginConfigBlocks = await homebridge.getPluginConfig()\n * ```\n */\n public getPluginConfig(): Promise<PluginConfig[]>\n\n /**\n * Update the plugin config.\n * This should be called whenever a change to the config is made.\n * This method does not save the changes to the config.json file.\n * Existing blocks not included will be removed.\n *\n * @example\n * ```ts\n * await homebridge.updatePluginConfig(\n * [\n * {\n * \"name\": \"my light\",\n * \"platform\": \"example_platform\"\n * }\n * ]\n * );\n * ```\n */\n public updatePluginConfig(pluginConfig: PluginConfig[]): Promise<PluginConfig[]>\n\n /**\n * Save the plugin config.\n * You must call `homebridge.updatePluginConfig` first.\n *\n * @example\n * ```ts\n * await homebridge.savePluginConfig()\n * ```\n */\n public savePluginConfig(): Promise<void>\n\n /**\n * Returns the plugin's config.schema.json\n *\n * @example\n * ```ts\n * const schema = await homebridge.getPluginConfigSchema()\n * ```\n */\n public getPluginConfigSchema(): Promise<PluginSchema>\n\n /**\n * Return an array of cached accessories for your plugin.\n */\n public getCachedAccessories(): Promise<CachedAccessory[]>\n\n /**\n * Return an array of cached Matter accessories for your plugin.\n */\n public getCachedMatterAccessories(): Promise<CachedMatterAccessory[]>\n\n /**\n * Return the rooms the logged-in user has arranged their accessories into\n * on the Homebridge UI's Accessories page. Each service is identified by its\n * `uniqueId`; services the user has not placed are not listed.\n *\n * The Homebridge UI supplies this method, so check that it exists before\n * calling it: older UI versions do not have it.\n *\n * @example\n * ```ts\n * const rooms = typeof homebridge.getAccessoryLayout === 'function'\n * ? await homebridge.getAccessoryLayout()\n * : []\n * ```\n */\n public getAccessoryLayout(): Promise<AccessoryLayoutRoom[]>\n\n /**\n * Make a request to the plugins server side script\n * @param path - the path handler on the server that the request should be sent to\n * @param body - an optional payload\n *\n * @example\n * ```ts\n *\n * const response = await homebridge.request('/hello', { who: 'world' });\n * console.log(response); // the response from the server\n * ```\n *\n * The server side component would handle this using `this.onRequest`.\n *\n * @example\n * ```ts\n * this.onRequest('/hello', async (payload) => {\n * return {hello: 'user'};\n * });\n * ```\n */\n public request(path: string, body?: any): Promise<any>\n\n /**\n * Return the current language the user interface is displayed in.\n * Returns the i18n language code (e.g. `en`, `de`, `fr`).\n */\n public i18nCurrentLang(): Promise<string>\n\n /**\n * Returns the full translation object for the current language.\n */\n public i18nGetTranslation(): Promise<Record<string, string>>\n\n /**\n * Returns the lighting mode currently being used by the UI.\n */\n public userCurrentLightingMode(): Promise<'light' | 'dark'>\n}\n\nexport declare class IHomebridgeUiToastHelper {\n /**\n * Trigger a success toast notification in the UI\n * @param message\n * @param title - optional title\n */\n public success(message: string, title?: string): void\n\n /**\n * Trigger an error toast notification in the UI\n * @param message\n * @param title - optional title\n */\n public error(message: string, title?: string): void\n\n /**\n * Trigger a warning toast notification in the UI\n * @param message\n * @param title - optional title\n */\n public warning(message: string, title?: string): void\n\n /**\n * Trigger an info toast notification in the UI\n * @param message\n * @param title - optional title\n */\n public info(message: string, title?: string): void\n}\n\nexport declare class IHomebridgeUiFormHelper {\n constructor(\n parent: IHomebridgePluginUi,\n schema: PluginFormSchema,\n data: any,\n submitButton?: string,\n cancelButton?: string,\n )\n\n /**\n * Hide the form and stop listening to events\n */\n public end(): void\n\n /**\n * Listen to input / change events emitted by the standalone form\n * @param fn\n */\n public onChange(fn: (change: Record<string, any>) => any): void\n\n /**\n * Listen submit button form events\n * @param fn\n */\n public onSubmit(fn: (change: Record<string, any>) => any): void\n\n /**\n * Listen cancel button form events\n * @param fn\n */\n public onCancel(fn: (change: Record<string, any>) => any): void\n}\n"]}
|
package/dist/ui.js
CHANGED
|
@@ -1,76 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return false;
|
|
3
|
+
// No EventTarget polyfill: the Homebridge UI supports only the last two
|
|
4
|
+
// versions of each browser, and all of them can construct an EventTarget.
|
|
5
|
+
class HomebridgePluginUi extends EventTarget {
|
|
6
|
+
// A static, not a top-level `let` or `function`: this file runs as a plain
|
|
7
|
+
// script, so every top-level name is shared with the plugin's own scripts,
|
|
8
|
+
// and a plugin script that declares the same name would fail to run.
|
|
9
|
+
static lastId = 0;
|
|
10
|
+
/**
|
|
11
|
+
* Make an id that links a reply to its request, or a form's events to the
|
|
12
|
+
* form. Ids are also event names on window.homebridge, so they must never
|
|
13
|
+
* repeat: the counter makes each one unique, the random part hard to guess.
|
|
14
|
+
*/
|
|
15
|
+
static uniqueId() {
|
|
16
|
+
HomebridgePluginUi.lastId += 1;
|
|
17
|
+
return `${HomebridgePluginUi.lastId}-${Math.random().toString(36).substring(2)}`;
|
|
21
18
|
}
|
|
22
|
-
}
|
|
23
|
-
if (!isEventTargetConstructible()) {
|
|
24
|
-
EventTargetConstructor = function () {
|
|
25
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
26
|
-
this.listeners = {};
|
|
27
|
-
};
|
|
28
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
29
|
-
EventTargetConstructor.prototype.listeners = null;
|
|
30
|
-
EventTargetConstructor.prototype.addEventListener = function (type, callback) {
|
|
31
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
32
|
-
if (!(type in this.listeners)) {
|
|
33
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
34
|
-
this.listeners[type] = [];
|
|
35
|
-
}
|
|
36
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
37
|
-
this.listeners[type].push(callback);
|
|
38
|
-
};
|
|
39
|
-
EventTargetConstructor.prototype.removeEventListener = function (type, callback) {
|
|
40
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
41
|
-
if (!(type in this.listeners)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
45
|
-
const stack = this.listeners[type];
|
|
46
|
-
for (let i = 0, l = stack.length; i < l; i++) {
|
|
47
|
-
if (stack[i] === callback) {
|
|
48
|
-
stack.splice(i, 1);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
EventTargetConstructor.prototype.dispatchEvent = function (event) {
|
|
54
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
55
|
-
if (!(event.type in this.listeners)) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
// @ts-expect-error - TS2339: Property listeners does not exist on type EventTarget
|
|
59
|
-
const stack = this.listeners[event.type].slice();
|
|
60
|
-
for (let i = 0, l = stack.length; i < l; i++) {
|
|
61
|
-
stack[i].call(this, event);
|
|
62
|
-
}
|
|
63
|
-
return !event.defaultPrevented;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
class HomebridgePluginUi extends EventTargetConstructor {
|
|
67
19
|
origin = '';
|
|
68
|
-
lastBodyHeight = 0;
|
|
69
20
|
linkRequests = [];
|
|
70
21
|
toast = new HomebridgeUiToastHelper(this);
|
|
71
|
-
// @ts-expect-error - TS2339: Property _homebridge does not exist on type Window & typeof globalThis
|
|
72
22
|
plugin = window._homebridge.plugin;
|
|
73
|
-
// @ts-expect-error - TS2339: Property _homebridge does not exist on type Window & typeof globalThis
|
|
74
23
|
serverEnv = window._homebridge.serverEnv;
|
|
75
24
|
constructor() {
|
|
76
25
|
super();
|
|
@@ -106,13 +55,13 @@ class HomebridgePluginUi extends EventTargetConstructor {
|
|
|
106
55
|
break;
|
|
107
56
|
}
|
|
108
57
|
case 'response': {
|
|
109
|
-
this.dispatchEvent(new MessageEvent(e.data.requestId, {
|
|
58
|
+
this.dispatchEvent(new MessageEvent(String(e.data.requestId), {
|
|
110
59
|
data: e.data,
|
|
111
60
|
}));
|
|
112
61
|
break;
|
|
113
62
|
}
|
|
114
63
|
case 'stream': {
|
|
115
|
-
this.dispatchEvent(new MessageEvent(e.data.event, {
|
|
64
|
+
this.dispatchEvent(new MessageEvent(String(e.data.event), {
|
|
116
65
|
data: e.data.data,
|
|
117
66
|
}));
|
|
118
67
|
break;
|
|
@@ -141,15 +90,19 @@ class HomebridgePluginUi extends EventTargetConstructor {
|
|
|
141
90
|
}
|
|
142
91
|
_setInlineStyle(e) {
|
|
143
92
|
const styleElement = document.createElement('style');
|
|
144
|
-
styleElement.textContent = e.data.style;
|
|
93
|
+
styleElement.textContent = e.data.style ?? '';
|
|
145
94
|
document.head.appendChild(styleElement);
|
|
146
95
|
}
|
|
147
96
|
_setLinkElement(e) {
|
|
148
97
|
const request = new Promise((resolve) => {
|
|
149
|
-
|
|
98
|
+
let timer;
|
|
99
|
+
const done = () => {
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
resolve();
|
|
102
|
+
};
|
|
150
103
|
const linkElement = document.createElement('link');
|
|
151
|
-
linkElement.setAttribute('href', e.data.href);
|
|
152
|
-
linkElement.setAttribute('rel', e.data.rel);
|
|
104
|
+
linkElement.setAttribute('href', e.data.href ?? '');
|
|
105
|
+
linkElement.setAttribute('rel', e.data.rel ?? '');
|
|
153
106
|
linkElement.onload = done;
|
|
154
107
|
linkElement.onerror = done;
|
|
155
108
|
document.head.appendChild(linkElement);
|
|
@@ -157,31 +110,20 @@ class HomebridgePluginUi extends EventTargetConstructor {
|
|
|
157
110
|
// block, blocked extension, browsers that swallow the events). The
|
|
158
111
|
// 'ready' event awaits every link request, so a stuck link would
|
|
159
112
|
// otherwise leave the plugin UI hidden indefinitely.
|
|
160
|
-
setTimeout(done, 5000);
|
|
113
|
+
timer = setTimeout(done, 5000);
|
|
161
114
|
});
|
|
162
115
|
this.linkRequests.push(request);
|
|
163
116
|
}
|
|
164
117
|
_monitorFrameHeight() {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
// fall back to polling
|
|
174
|
-
setInterval(() => {
|
|
175
|
-
if (document.body.scrollHeight !== this.lastBodyHeight) {
|
|
176
|
-
this.lastBodyHeight = document.body.scrollHeight;
|
|
177
|
-
this.fixScrollHeight();
|
|
178
|
-
}
|
|
179
|
-
}, 250);
|
|
180
|
-
}
|
|
118
|
+
// Every browser the Homebridge UI supports has ResizeObserver, so the old
|
|
119
|
+
// fall back (checking the height every 250 ms) is gone.
|
|
120
|
+
const resizeObserver = new window.ResizeObserver(() => {
|
|
121
|
+
this.fixScrollHeight();
|
|
122
|
+
});
|
|
123
|
+
resizeObserver.observe(document.body);
|
|
181
124
|
}
|
|
182
125
|
async _requestResponse(payload) {
|
|
183
|
-
|
|
184
|
-
const requestId = Math.random().toString(36).substring(2);
|
|
126
|
+
const requestId = HomebridgePluginUi.uniqueId();
|
|
185
127
|
payload.requestId = requestId;
|
|
186
128
|
// post message to parent
|
|
187
129
|
this._postMessage(payload);
|
|
@@ -189,11 +131,12 @@ class HomebridgePluginUi extends EventTargetConstructor {
|
|
|
189
131
|
return new Promise((resolve, reject) => {
|
|
190
132
|
const responseHandler = (event) => {
|
|
191
133
|
this.removeEventListener(requestId, responseHandler);
|
|
192
|
-
|
|
193
|
-
|
|
134
|
+
const { data } = event;
|
|
135
|
+
if (data.success) {
|
|
136
|
+
resolve(data.data);
|
|
194
137
|
}
|
|
195
138
|
else {
|
|
196
|
-
reject(
|
|
139
|
+
reject(data.data);
|
|
197
140
|
}
|
|
198
141
|
};
|
|
199
142
|
this.addEventListener(requestId, responseHandler);
|
|
@@ -288,7 +231,7 @@ class HomebridgeUiToastHelper {
|
|
|
288
231
|
}
|
|
289
232
|
class HomebridgeUiFormHelper {
|
|
290
233
|
parent;
|
|
291
|
-
formId =
|
|
234
|
+
formId = HomebridgePluginUi.uniqueId();
|
|
292
235
|
_changeHandle;
|
|
293
236
|
_submitHandle;
|
|
294
237
|
_cancelHandle;
|
|
@@ -316,11 +259,12 @@ class HomebridgeUiFormHelper {
|
|
|
316
259
|
};
|
|
317
260
|
}
|
|
318
261
|
_eventHandle(event) {
|
|
319
|
-
|
|
262
|
+
const { data } = event;
|
|
263
|
+
switch (data.formEvent) {
|
|
320
264
|
case 'change': {
|
|
321
265
|
// general change events
|
|
322
266
|
if (this._changeHandle && typeof this._changeHandle === 'function') {
|
|
323
|
-
this._changeHandle(
|
|
267
|
+
this._changeHandle(data.formData);
|
|
324
268
|
}
|
|
325
269
|
else {
|
|
326
270
|
console.info('Homebridge Custom Plugin UI: Missing form onChange handler.');
|
|
@@ -330,7 +274,7 @@ class HomebridgeUiFormHelper {
|
|
|
330
274
|
case 'submit': {
|
|
331
275
|
// submit form events
|
|
332
276
|
if (this._submitHandle && typeof this._submitHandle === 'function') {
|
|
333
|
-
this._submitHandle(
|
|
277
|
+
this._submitHandle(data.formData);
|
|
334
278
|
}
|
|
335
279
|
else {
|
|
336
280
|
console.info('Homebridge Custom Plugin UI: Missing form onSubmit handler.');
|
|
@@ -340,7 +284,7 @@ class HomebridgeUiFormHelper {
|
|
|
340
284
|
case 'cancel': {
|
|
341
285
|
// cancel form events
|
|
342
286
|
if (this._cancelHandle && typeof this._cancelHandle === 'function') {
|
|
343
|
-
this._cancelHandle(
|
|
287
|
+
this._cancelHandle(data.formData);
|
|
344
288
|
}
|
|
345
289
|
else {
|
|
346
290
|
console.info('Homebridge Custom Plugin UI: Missing form onCancel handler.');
|
|
@@ -348,7 +292,7 @@ class HomebridgeUiFormHelper {
|
|
|
348
292
|
break;
|
|
349
293
|
}
|
|
350
294
|
default: {
|
|
351
|
-
console.info('Unknown form event type:',
|
|
295
|
+
console.info('Unknown form event type:', data);
|
|
352
296
|
}
|
|
353
297
|
}
|
|
354
298
|
}
|
|
@@ -374,6 +318,5 @@ class HomebridgeUiFormHelper {
|
|
|
374
318
|
this._cancelHandle = fn;
|
|
375
319
|
}
|
|
376
320
|
}
|
|
377
|
-
// @ts-expect-error - TS2339: Property _homebridge does not exist on type Window & typeof globalThis
|
|
378
321
|
window.homebridge = new HomebridgePluginUi();
|
|
379
322
|
//# sourceMappingURL=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AE,CAAC;oBACnE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAS,CAAC,CAAA;gBACpC,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAA;gBAC7E,CAAC;gBACD,MAAK;YACP,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAA;YAChD,CAAC;QACH,CAAC;IACH,CAAC;IAEM,QAAQ,CAAC,EAAe;QAC7B,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAA;YACvF,OAAM;QACR,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;IACzB,CAAC;IAEM,QAAQ,CAAC,EAAe;QAC7B,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAA;YACvF,OAAM;QACR,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;IACzB,CAAC;IAEM,QAAQ,CAAC,EAAe;QAC7B,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAA;YACvF,OAAM;QACR,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;IACzB,CAAC;CACF;AAED,MAAM,CAAC,UAAU,GAAG,IAAI,kBAAkB,EAAE,CAAA","sourcesContent":["/* eslint-disable no-console */\n\n/**\n * The Homebridge UI loads this script into a plugin's custom settings UI and\n * sets `window.homebridge` to the object it creates. Do not include it in your\n * own code. For its types, use `@homebridge/plugin-ui-utils/ui.interface`.\n */\n\n// Type-only imports written as import() types: a top-level `import` would turn\n// this file into a module, and the Homebridge UI loads it with a plain\n// <script> tag, which can not run one. Implementing the published interface\n// makes the build fail when this file and ui.interface.ts drift apart.\ntype IHomebridgePluginUi = import('./ui.interface.js').IHomebridgePluginUi\ntype PluginMetadata = import('./ui.interface.js').PluginMetadata\ntype ServerEnvMetadata = import('./ui.interface.js').ServerEnvMetadata\ntype AccessoryLayoutRoom = import('./ui.interface.js').AccessoryLayoutRoom\ntype CachedAccessory = import('./ui.interface.js').CachedAccessory\ntype CachedMatterAccessory = import('./ui.interface.js').CachedMatterAccessory\ntype IHomebridgeUiFormHelper = import('./ui.interface.js').IHomebridgeUiFormHelper\ntype IHomebridgeUiToastHelper = import('./ui.interface.js').IHomebridgeUiToastHelper\ntype PluginConfig = import('./ui.interface.js').PluginConfig\ntype PluginFormSchema = import('./ui.interface.js').PluginFormSchema\ntype PluginSchema = import('./ui.interface.js').PluginSchema\n\n/**\n * A message from the Homebridge UI. Which fields are set depends on `action`.\n */\ninterface ParentMessage {\n action?: string\n // response\n requestId?: string\n success?: boolean\n data?: unknown\n // stream\n event?: string\n // body-class, inline-style, link-element\n class?: string\n style?: string\n href?: string\n rel?: string\n}\n\n/**\n * What a form event carries, sent as a stream event named after the form id.\n */\ninterface FormEventData {\n formEvent?: 'cancel' | 'change' | 'submit'\n formData?: Record<string, any>\n}\n\ntype FormHandler = (change: Record<string, any>) => any\n\n// Set by the Homebridge UI in an inline script before it loads this one.\n// A global interface (this file is a script), so ESLint sees no use of it.\n// eslint-disable-next-line unused-imports/no-unused-vars\ninterface Window {\n _homebridge: {\n plugin: PluginMetadata\n serverEnv: ServerEnvMetadata\n }\n}\n\n// No EventTarget polyfill: the Homebridge UI supports only the last two\n// versions of each browser, and all of them can construct an EventTarget.\nclass HomebridgePluginUi extends EventTarget implements IHomebridgePluginUi {\n // A static, not a top-level `let` or `function`: this file runs as a plain\n // script, so every top-level name is shared with the plugin's own scripts,\n // and a plugin script that declares the same name would fail to run.\n private static lastId = 0\n\n /**\n * Make an id that links a reply to its request, or a form's events to the\n * form. Ids are also event names on window.homebridge, so they must never\n * repeat: the counter makes each one unique, the random part hard to guess.\n */\n public static uniqueId(): string {\n HomebridgePluginUi.lastId += 1\n return `${HomebridgePluginUi.lastId}-${Math.random().toString(36).substring(2)}`\n }\n\n private origin = ''\n private linkRequests: Promise<unknown>[] = []\n\n public toast = new HomebridgeUiToastHelper(this)\n public plugin = window._homebridge.plugin\n\n public serverEnv = window._homebridge.serverEnv\n\n constructor() {\n super()\n window.addEventListener('message', this._handleIncomingMessage.bind(this), false)\n }\n\n private async _handleIncomingMessage(e: MessageEvent<ParentMessage>) {\n // Only accept messages from the parent window. Sibling iframes or popups\n // could otherwise inject styles / links via body-class, inline-style and\n // link-element, or spoof responses.\n if (e.source !== window.parent) {\n return\n }\n\n // Pin the origin to whatever the first message arrived from, and reject\n // anything from a different origin afterwards. The parent's wrapper script\n // posts body-class / link-element / inline-style before 'ready', so we\n // can't wait for 'ready' to capture the origin.\n if (!this.origin) {\n this.origin = e.origin\n } else if (e.origin !== this.origin) {\n return\n }\n\n if (!e.data || typeof e.data !== 'object') {\n return\n }\n\n switch (e.data.action) {\n case 'ready': {\n await Promise.all(this.linkRequests)\n document.body.style.display = 'block'\n this.dispatchEvent(new Event('ready'))\n this.fixScrollHeight()\n this._monitorFrameHeight()\n break\n }\n case 'response': {\n this.dispatchEvent(new MessageEvent(String(e.data.requestId), {\n data: e.data,\n }))\n break\n }\n case 'stream': {\n this.dispatchEvent(new MessageEvent(String(e.data.event), {\n data: e.data.data,\n }))\n break\n }\n case 'body-class': {\n this._setBodyClass(e)\n break\n }\n case 'inline-style': {\n this._setInlineStyle(e)\n break\n }\n case 'link-element': {\n this._setLinkElement(e)\n break\n }\n default:\n console.log(e.data)\n }\n }\n\n public _postMessage(message: Record<string, unknown>) {\n window.parent.postMessage(message, this.origin || '*')\n }\n\n private _setBodyClass(e: MessageEvent<ParentMessage>) {\n document.body.classList.add(e.data.class!)\n }\n\n private _setInlineStyle(e: MessageEvent<ParentMessage>) {\n const styleElement = document.createElement('style')\n styleElement.textContent = e.data.style ?? ''\n document.head.appendChild(styleElement)\n }\n\n private _setLinkElement(e: MessageEvent<ParentMessage>) {\n const request = new Promise<void>((resolve) => {\n let timer: ReturnType<typeof setTimeout> | undefined\n const done = () => {\n clearTimeout(timer)\n resolve()\n }\n const linkElement = document.createElement('link')\n linkElement.setAttribute('href', e.data.href ?? '')\n linkElement.setAttribute('rel', e.data.rel ?? '')\n linkElement.onload = done\n linkElement.onerror = done\n document.head.appendChild(linkElement)\n // Resolve after 5s even if neither onload nor onerror fires (e.g. CSP\n // block, blocked extension, browsers that swallow the events). The\n // 'ready' event awaits every link request, so a stuck link would\n // otherwise leave the plugin UI hidden indefinitely.\n timer = setTimeout(done, 5000)\n })\n this.linkRequests.push(request)\n }\n\n private _monitorFrameHeight() {\n // Every browser the Homebridge UI supports has ResizeObserver, so the old\n // fall back (checking the height every 250 ms) is gone.\n const resizeObserver = new window.ResizeObserver(() => {\n this.fixScrollHeight()\n })\n resizeObserver.observe(document.body)\n }\n\n private async _requestResponse<T>(payload: Record<string, unknown>): Promise<T> {\n const requestId = HomebridgePluginUi.uniqueId()\n payload.requestId = requestId\n\n // post message to parent\n this._postMessage(payload)\n\n // wait for response\n return new Promise<T>((resolve, reject) => {\n const responseHandler = (event: Event) => {\n this.removeEventListener(requestId, responseHandler)\n const { data } = event as MessageEvent<ParentMessage>\n if (data.success) {\n resolve(data.data as T)\n } else {\n reject(data.data)\n }\n }\n\n this.addEventListener(requestId, responseHandler)\n })\n }\n\n public fixScrollHeight(): void {\n this._postMessage({ action: 'scrollHeight', scrollHeight: document.body.scrollHeight })\n }\n\n public closeSettings(): void {\n this._postMessage({ action: 'close' })\n }\n\n public showSpinner(): void {\n this._postMessage({ action: 'spinner.show' })\n }\n\n public hideSpinner(): void {\n this._postMessage({ action: 'spinner.hide' })\n }\n\n public disableSaveButton(): void {\n this._postMessage({ action: 'button.save.disabled' })\n }\n\n public enableSaveButton(): void {\n this._postMessage({ action: 'button.save.enabled' })\n }\n\n public showSchemaForm(): void {\n this._postMessage({ action: 'schema.show' })\n }\n\n public hideSchemaForm(): void {\n this._postMessage({ action: 'schema.hide' })\n }\n\n public createForm(schema: PluginFormSchema, data: any, submitButton?: string, cancelButton?: string): IHomebridgeUiFormHelper {\n return new HomebridgeUiFormHelper(this, schema, data, submitButton, cancelButton)\n }\n\n public endForm() {\n this._postMessage({ action: 'form.end' })\n }\n\n public async getPluginConfig(): Promise<PluginConfig[]> {\n return await this._requestResponse({ action: 'config.get' })\n }\n\n public async updatePluginConfig(pluginConfig: PluginConfig[]): Promise<PluginConfig[]> {\n return await this._requestResponse({ action: 'config.update', pluginConfig })\n }\n\n public async savePluginConfig(): Promise<void> {\n return await this._requestResponse({ action: 'config.save' })\n }\n\n public async getPluginConfigSchema(): Promise<PluginSchema> {\n return await this._requestResponse({ action: 'config.schema' })\n }\n\n public async getCachedAccessories(): Promise<CachedAccessory[]> {\n return await this._requestResponse({ action: 'cachedAccessories.get' })\n }\n\n public async getCachedMatterAccessories(): Promise<CachedMatterAccessory[]> {\n return await this._requestResponse({ action: 'cachedMatterAccessories.get' })\n }\n\n public async getAccessoryLayout(): Promise<AccessoryLayoutRoom[]> {\n return await this._requestResponse({ action: 'accessoryLayout.get' })\n }\n\n public async request(path: string, body?: any): Promise<any> {\n return await this._requestResponse({ action: 'request', path, body })\n }\n\n public async userCurrentLightingMode(): Promise<'dark' | 'light'> {\n return await this._requestResponse({ action: 'user.lightingMode' })\n }\n\n public async i18nCurrentLang(): Promise<string> {\n return await this._requestResponse({ action: 'i18n.lang' })\n }\n\n public async i18nGetTranslation(): Promise<Record<string, string>> {\n return await this._requestResponse({ action: 'i18n.translations' })\n }\n}\n\nclass HomebridgeUiToastHelper implements IHomebridgeUiToastHelper {\n constructor(private parent: HomebridgePluginUi) {}\n\n private _postMessage(type: string, message: string, title?: string) {\n // Route through the parent so toast payloads inherit the pinned origin\n // and aren't readable by sibling frames before the ready handshake.\n this.parent._postMessage({ action: `toast.${type}`, message, title })\n }\n\n public success(message: string, title?: string): void {\n this._postMessage('success', message, title)\n }\n\n public error(message: string, title?: string): void {\n this._postMessage('error', message, title)\n }\n\n public warning(message: string, title?: string): void {\n this._postMessage('warning', message, title)\n }\n\n public info(message: string, title?: string): void {\n this._postMessage('info', message, title)\n }\n}\n\nclass HomebridgeUiFormHelper implements IHomebridgeUiFormHelper {\n private formId = HomebridgePluginUi.uniqueId()\n private _changeHandle?: FormHandler\n private _submitHandle?: FormHandler\n private _cancelHandle?: FormHandler\n public end: () => void\n\n constructor(\n private parent: HomebridgePluginUi,\n schema: PluginFormSchema,\n data: any,\n submitButton?: string,\n cancelButton?: string,\n ) {\n this.parent._postMessage({\n action: 'form.create',\n formId: this.formId,\n schema,\n data,\n submitButton,\n cancelButton,\n })\n\n const handle = this._eventHandle.bind(this)\n\n this.parent.addEventListener(this.formId, handle)\n\n this.end = () => {\n this.parent.removeEventListener(this.formId, handle)\n this.parent._postMessage({\n action: 'form.end',\n formId: this.formId,\n schema,\n data,\n })\n }\n }\n\n private _eventHandle(event: Event) {\n const { data } = event as MessageEvent<FormEventData>\n switch (data.formEvent) {\n case 'change': {\n // general change events\n if (this._changeHandle && typeof this._changeHandle === 'function') {\n this._changeHandle(data.formData!)\n } else {\n console.info('Homebridge Custom Plugin UI: Missing form onChange handler.')\n }\n break\n }\n case 'submit': {\n // submit form events\n if (this._submitHandle && typeof this._submitHandle === 'function') {\n this._submitHandle(data.formData!)\n } else {\n console.info('Homebridge Custom Plugin UI: Missing form onSubmit handler.')\n }\n break\n }\n case 'cancel': {\n // cancel form events\n if (this._cancelHandle && typeof this._cancelHandle === 'function') {\n this._cancelHandle(data.formData!)\n } else {\n console.info('Homebridge Custom Plugin UI: Missing form onCancel handler.')\n }\n break\n }\n default: {\n console.info('Unknown form event type:', data)\n }\n }\n }\n\n public onChange(fn: FormHandler) {\n if (typeof fn !== 'function') {\n console.error('Homebridge Custom Plugin UI: Form onChange handler must be a function.')\n return\n }\n this._changeHandle = fn\n }\n\n public onSubmit(fn: FormHandler) {\n if (typeof fn !== 'function') {\n console.error('Homebridge Custom Plugin UI: Form onSubmit handler must be a function.')\n return\n }\n this._submitHandle = fn\n }\n\n public onCancel(fn: FormHandler) {\n if (typeof fn !== 'function') {\n console.error('Homebridge Custom Plugin UI: Form onCancel handler must be a function.')\n return\n }\n this._cancelHandle = fn\n }\n}\n\nwindow.homebridge = new HomebridgePluginUi()\n"]}
|
package/dist/ui.mock.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccessoryLayoutRoom, IHomebridgePluginUi, IHomebridgeUiFormHelper, IHomebridgeUiToastHelper, PluginConfig, PluginFormSchema, PluginMetadata, PluginSchema, ServerEnvMetadata } from './ui.interface';
|
|
1
|
+
import type { AccessoryLayoutRoom, CachedAccessory, CachedMatterAccessory, IHomebridgePluginUi, IHomebridgeUiFormHelper, IHomebridgeUiToastHelper, PluginConfig, PluginFormSchema, PluginMetadata, PluginSchema, ServerEnvMetadata } from './ui.interface.js';
|
|
2
2
|
export declare class MockHomebridgePluginUi extends EventTarget implements IHomebridgePluginUi {
|
|
3
3
|
mockPluginConfig: PluginConfig[];
|
|
4
4
|
mockAccessoryLayout: AccessoryLayoutRoom[];
|
|
@@ -21,12 +21,12 @@ export declare class MockHomebridgePluginUi extends EventTarget implements IHome
|
|
|
21
21
|
updatePluginConfig(pluginConfig: PluginConfig[]): Promise<PluginConfig[]>;
|
|
22
22
|
savePluginConfig(): Promise<void>;
|
|
23
23
|
getPluginConfigSchema(): Promise<PluginSchema>;
|
|
24
|
-
request(path: string, body?: any): Promise<
|
|
24
|
+
request(path: string, body?: any): Promise<any>;
|
|
25
25
|
userCurrentLightingMode(): Promise<'light' | 'dark'>;
|
|
26
26
|
i18nCurrentLang(): Promise<string>;
|
|
27
|
-
i18nGetTranslation(): Promise<
|
|
28
|
-
getCachedAccessories(): Promise<
|
|
29
|
-
getCachedMatterAccessories(): Promise<
|
|
27
|
+
i18nGetTranslation(): Promise<Record<string, string>>;
|
|
28
|
+
getCachedAccessories(): Promise<CachedAccessory[]>;
|
|
29
|
+
getCachedMatterAccessories(): Promise<CachedMatterAccessory[]>;
|
|
30
30
|
getAccessoryLayout(): Promise<AccessoryLayoutRoom[]>;
|
|
31
31
|
}
|
|
32
32
|
export declare class MockHomebridgeUiToastHelper implements IHomebridgeUiToastHelper {
|
|
@@ -42,4 +42,3 @@ export declare class MockHomebridgeUiFormHelper implements IHomebridgeUiFormHelp
|
|
|
42
42
|
onSubmit(fn: (change: Record<string, any>) => any): void;
|
|
43
43
|
onCancel(fn: (change: Record<string, any>) => any): void;
|
|
44
44
|
}
|
|
45
|
-
//# sourceMappingURL=ui.mock.d.ts.map
|
package/dist/ui.mock.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
2
|
+
// Return types written out, not inferred: `return []` alone is typed as
|
|
3
|
+
// never[], and a plugin's test could then not stub in its own accessories.
|
|
2
4
|
export class MockHomebridgePluginUi extends EventTarget {
|
|
3
5
|
mockPluginConfig = [];
|
|
4
6
|
mockAccessoryLayout = [
|
|
@@ -19,29 +21,28 @@ export class MockHomebridgePluginUi extends EventTarget {
|
|
|
19
21
|
globalInstall: true,
|
|
20
22
|
settingsSchema: true,
|
|
21
23
|
publicPackage: true,
|
|
22
|
-
links:
|
|
23
|
-
|
|
24
|
+
links: {
|
|
25
|
+
npm: 'https://www.npmjs.com/package/homebridge-test',
|
|
26
|
+
},
|
|
24
27
|
};
|
|
25
28
|
serverEnv = {
|
|
26
29
|
env: {
|
|
27
|
-
ableToConfigureSelf: true,
|
|
28
30
|
enableAccessories: true,
|
|
29
31
|
enableTerminalAccess: true,
|
|
30
32
|
homebridgeInstanceName: 'Homebridge 1B77',
|
|
31
|
-
nodeVersion: '
|
|
33
|
+
nodeVersion: 'v24.11.0',
|
|
32
34
|
packageName: 'homebridge-config-ui-x',
|
|
33
|
-
packageVersion: '
|
|
35
|
+
packageVersion: '5.30.1',
|
|
34
36
|
platform: 'darwin',
|
|
35
37
|
runningInDocker: false,
|
|
36
38
|
runningInLinux: false,
|
|
37
39
|
dockerOfflineUpdate: false,
|
|
38
|
-
serviceMode: true,
|
|
39
40
|
temperatureUnits: 'c',
|
|
40
41
|
lang: null,
|
|
41
42
|
instanceId: 'eca2e929f20e8a1292893a2852cba6c10d5efb1a77e20238ce9fe2da8da75b88',
|
|
42
43
|
},
|
|
43
44
|
formAuth: true,
|
|
44
|
-
theme: '
|
|
45
|
+
theme: 'deep-purple',
|
|
45
46
|
serverTimestamp: new Date().toISOString(),
|
|
46
47
|
};
|
|
47
48
|
constructor() {
|
package/dist/ui.mock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.mock.js","sourceRoot":"","sources":["../src/ui.mock.ts"],"names":[],"mappings":"AAAA,kDAAkD;
|
|
1
|
+
{"version":3,"file":"ui.mock.js","sourceRoot":"","sources":["../src/ui.mock.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAgBlD,wEAAwE;AACxE,2EAA2E;AAC3E,MAAM,OAAO,sBAAuB,SAAQ,WAAW;IAC9C,gBAAgB,GAAmB,EAAE,CAAA;IAErC,mBAAmB,GAA0B;QAClD,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;KACxD,CAAA;IAEM,gBAAgB,GAAiB;QACtC,WAAW,EAAE,gBAAgB;QAC7B,UAAU,EAAE,UAAU;KACvB,CAAA;IAEM,MAAM,GAAmB;QAC9B,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,yBAAyB;QACtC,cAAc,EAAE,KAAK;QACrB,WAAW,EAAE,iBAAiB;QAC9B,aAAa,EAAE,QAAQ;QACvB,gBAAgB,EAAE,QAAQ;QAC1B,eAAe,EAAE,KAAK;QACtB,aAAa,EAAE,IAAI;QACnB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE;YACL,GAAG,EAAE,+CAA+C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-unused-vars */\n\nimport type {\n AccessoryLayoutRoom,\n CachedAccessory,\n CachedMatterAccessory,\n IHomebridgePluginUi,\n IHomebridgeUiFormHelper,\n IHomebridgeUiToastHelper,\n PluginConfig,\n PluginFormSchema,\n PluginMetadata,\n PluginSchema,\n ServerEnvMetadata,\n} from './ui.interface.js'\n\n// Return types written out, not inferred: `return []` alone is typed as\n// never[], and a plugin's test could then not stub in its own accessories.\nexport class MockHomebridgePluginUi extends EventTarget implements IHomebridgePluginUi {\n public mockPluginConfig: PluginConfig[] = []\n\n public mockAccessoryLayout: AccessoryLayoutRoom[] = [\n { name: 'Default Room', isDefault: true, services: [] },\n ]\n\n public mockPluginSchema: PluginSchema = {\n pluginAlias: 'HomebridgeTest',\n pluginType: 'platform',\n }\n\n public plugin: PluginMetadata = {\n name: 'homebridge-test',\n description: 'description sample text',\n verifiedPlugin: false,\n installPath: '/path/to/plugin',\n latestVersion: 'v1.0.0',\n installedVersion: 'v1.0.0',\n updateAvailable: false,\n globalInstall: true,\n settingsSchema: true,\n publicPackage: true,\n links: {\n npm: 'https://www.npmjs.com/package/homebridge-test',\n },\n }\n\n public serverEnv: ServerEnvMetadata = {\n env: {\n enableAccessories: true,\n enableTerminalAccess: true,\n homebridgeInstanceName: 'Homebridge 1B77',\n nodeVersion: 'v24.11.0',\n packageName: 'homebridge-config-ui-x',\n packageVersion: '5.30.1',\n platform: 'darwin',\n runningInDocker: false,\n runningInLinux: false,\n dockerOfflineUpdate: false,\n temperatureUnits: 'c',\n lang: null,\n instanceId: 'eca2e929f20e8a1292893a2852cba6c10d5efb1a77e20238ce9fe2da8da75b88',\n },\n formAuth: true,\n theme: 'deep-purple',\n serverTimestamp: new Date().toISOString(),\n }\n\n constructor() {\n super()\n // Defer so consumers that call `addEventListener('ready', ...)` after\n // `new MockHomebridgePluginUi()` still observe the event. Firing\n // synchronously from the constructor leaves the listener attached too late.\n queueMicrotask(() => this.dispatchEvent(new Event('ready')))\n }\n\n public toast = new MockHomebridgeUiToastHelper()\n\n public fixScrollHeight() { }\n public closeSettings() { }\n public showSpinner() { }\n public hideSpinner() { }\n public disableSaveButton() {}\n public enableSaveButton() {}\n public showSchemaForm() { }\n public hideSchemaForm() { }\n public endForm() { }\n\n public createForm(schema: PluginFormSchema, data: any, submitButton?: string, cancelButton?: string) {\n return new MockHomebridgeUiFormHelper(this, schema, data, submitButton, cancelButton)\n }\n\n public async getPluginConfig() {\n return this.mockPluginConfig\n }\n\n public async updatePluginConfig(pluginConfig: PluginConfig[]) {\n this.mockPluginConfig = pluginConfig\n return this.mockPluginConfig\n }\n\n public async savePluginConfig() { }\n\n public async getPluginConfigSchema() {\n return this.mockPluginSchema\n }\n\n public async request(path: string, body?: any): Promise<any> {\n return {}\n }\n\n public async userCurrentLightingMode(): Promise<'light' | 'dark'> {\n return 'light'\n }\n\n public async i18nCurrentLang() {\n return 'en'\n }\n\n public async i18nGetTranslation(): Promise<Record<string, string>> {\n return {}\n }\n\n public async getCachedAccessories(): Promise<CachedAccessory[]> {\n return []\n }\n\n public async getCachedMatterAccessories(): Promise<CachedMatterAccessory[]> {\n return []\n }\n\n public async getAccessoryLayout() {\n return this.mockAccessoryLayout\n }\n}\n\nexport class MockHomebridgeUiToastHelper implements IHomebridgeUiToastHelper {\n success(message: string, title?: string) { }\n error(message: string, title?: string) { }\n warning(message: string, title?: string) { }\n info(message: string, title?: string) { }\n}\n\nexport class MockHomebridgeUiFormHelper implements IHomebridgeUiFormHelper {\n constructor(\n parent: IHomebridgePluginUi,\n schema: PluginFormSchema,\n data: any,\n submitButton?: string,\n cancelButton?: string,\n ) { }\n\n public end() { }\n public onChange(fn: (change: Record<string, any>) => any) {}\n public onSubmit(fn: (change: Record<string, any>) => any) {}\n public onCancel(fn: (change: Record<string, any>) => any) {}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homebridge/plugin-ui-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.1",
|
|
5
5
|
"description": "A tool to help plugins provide custom UI screens in the Homebridge UI.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "oznu",
|
|
@@ -47,22 +47,25 @@
|
|
|
47
47
|
"README.md",
|
|
48
48
|
"dist"
|
|
49
49
|
],
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": "^22.12.0 || ^24 || ^26"
|
|
52
|
+
},
|
|
50
53
|
"scripts": {
|
|
51
54
|
"check": "npm install && npm outdated",
|
|
52
55
|
"build": "rimraf ./dist && tsc --project tsconfig.json && tsc --project tsconfig.ui.json",
|
|
53
56
|
"lint": "eslint .",
|
|
54
57
|
"lint:fix": "npm run lint -- --fix",
|
|
55
58
|
"prepublishOnly": "npm run lint && npm run build",
|
|
56
|
-
"test": "vitest run",
|
|
57
|
-
"test-coverage": "echo \"No test-coverage script specified\" && exit 0"
|
|
59
|
+
"test": "npm run typecheck && vitest run",
|
|
60
|
+
"test-coverage": "echo \"No test-coverage script specified\" && exit 0",
|
|
61
|
+
"typecheck": "tsc --project tsconfig.test.json"
|
|
58
62
|
},
|
|
59
63
|
"devDependencies": {
|
|
60
64
|
"@antfu/eslint-config": "^10.0.0",
|
|
61
65
|
"@types/node": "^26.6.6",
|
|
62
66
|
"eslint-plugin-format": "^2.0.1",
|
|
63
|
-
"jsdom": "^31.0.
|
|
67
|
+
"jsdom": "^31.0.1",
|
|
64
68
|
"rimraf": "^6.1.4",
|
|
65
|
-
"ts-node": "^10.9.2",
|
|
66
69
|
"typescript": "^6.0.3",
|
|
67
70
|
"vitest": "^5.1.0"
|
|
68
71
|
},
|
|
@@ -73,5 +76,8 @@
|
|
|
73
76
|
"oxfmt": {
|
|
74
77
|
"tinypool": "^2.2.0"
|
|
75
78
|
}
|
|
79
|
+
},
|
|
80
|
+
"allowScripts": {
|
|
81
|
+
"fsevents@2.3.3": true
|
|
76
82
|
}
|
|
77
83
|
}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACpE,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/server.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAqC;;IA4BrD,IAAI,qBAAqB,uBAExB;IAED,IAAI,oBAAoB,uBAEvB;IAED,IAAI,mBAAmB,uBAEtB;IAED,OAAO,CAAC,YAAY;YAeN,cAAc;IAqB5B;;;;;;;OAOG;IACI,KAAK,IAAI,IAAI;IAapB;;;;;;;;;;;;;;;;;;OAkBG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc;IAIjD;;;;;;;;;;;;;;;;;;OAkBG;IACI,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CAa1C;AAED,qBAAa,YAAa,SAAQ,KAAK;IAC9B,YAAY,EAAE,GAAG,CAAA;gBAEZ,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG;CAM/C;AAED,KAAK,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;AAE9F,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA"}
|
package/dist/ui.d.ts.map
DELETED
|
@@ -1 +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