glimpse-custom-applet-sdk 0.1.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/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/src/app.d.ts +53 -0
- package/dist/src/app.js +187 -0
- package/dist/src/events.d.ts +36 -0
- package/dist/src/events.js +37 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/protocol.d.ts +43 -0
- package/dist/src/protocol.js +58 -0
- package/dist/src/widgets.d.ts +351 -0
- package/dist/src/widgets.js +626 -0
- package/package.json +53 -0
- package/src/app.ts +241 -0
- package/src/events.ts +85 -0
- package/src/index.ts +57 -0
- package/src/protocol.ts +73 -0
- package/src/widgets.ts +820 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { Icon, MenuItem } from "./protocol.js";
|
|
2
|
+
export type Align = "fill" | "start" | "end" | "center" | "baseline";
|
|
3
|
+
export type Orientation = "horizontal" | "vertical";
|
|
4
|
+
export type Variant = "normal" | "muted" | "accent" | "success" | "warning" | "danger";
|
|
5
|
+
export interface WidgetNode {
|
|
6
|
+
toProtocol(): Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface CommonProps {
|
|
9
|
+
id?: string;
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
hexpand?: boolean;
|
|
12
|
+
vexpand?: boolean;
|
|
13
|
+
halign?: Align;
|
|
14
|
+
valign?: Align;
|
|
15
|
+
tooltip?: string;
|
|
16
|
+
variant?: Variant;
|
|
17
|
+
}
|
|
18
|
+
declare abstract class WidgetBase implements WidgetNode {
|
|
19
|
+
protected readonly common: CommonProps;
|
|
20
|
+
protected constructor(common?: CommonProps);
|
|
21
|
+
protected withCommon(payload: Record<string, unknown>): Record<string, unknown>;
|
|
22
|
+
abstract toProtocol(): Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export declare class Label extends WidgetBase {
|
|
25
|
+
readonly text: string;
|
|
26
|
+
private readonly options;
|
|
27
|
+
constructor(text: string, options?: CommonProps & {
|
|
28
|
+
wrap?: boolean;
|
|
29
|
+
xalign?: number;
|
|
30
|
+
selectable?: boolean;
|
|
31
|
+
});
|
|
32
|
+
toProtocol(): Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
export declare class Image extends WidgetBase {
|
|
35
|
+
readonly icon: Icon;
|
|
36
|
+
private readonly options;
|
|
37
|
+
constructor(icon: Icon, options?: CommonProps & {
|
|
38
|
+
pixel_size?: number;
|
|
39
|
+
});
|
|
40
|
+
toProtocol(): Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export declare class IconWidget extends WidgetBase {
|
|
43
|
+
readonly icon: Icon;
|
|
44
|
+
private readonly options;
|
|
45
|
+
constructor(icon: Icon, options?: CommonProps & {
|
|
46
|
+
pixel_size?: number;
|
|
47
|
+
});
|
|
48
|
+
toProtocol(): Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
export declare class Progress extends WidgetBase {
|
|
51
|
+
private readonly options;
|
|
52
|
+
constructor(options: CommonProps & {
|
|
53
|
+
value: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
show_text?: boolean;
|
|
56
|
+
text?: string;
|
|
57
|
+
});
|
|
58
|
+
toProtocol(): Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
export declare class Button extends WidgetBase {
|
|
61
|
+
private readonly options;
|
|
62
|
+
constructor(options?: CommonProps & {
|
|
63
|
+
label?: string;
|
|
64
|
+
icon?: Icon;
|
|
65
|
+
child?: TreeNode;
|
|
66
|
+
});
|
|
67
|
+
toProtocol(): Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
export declare class Switch extends WidgetBase {
|
|
70
|
+
private readonly options;
|
|
71
|
+
constructor(options?: CommonProps & {
|
|
72
|
+
label?: string;
|
|
73
|
+
active?: boolean;
|
|
74
|
+
});
|
|
75
|
+
toProtocol(): Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
export declare class Scale extends WidgetBase {
|
|
78
|
+
private readonly options;
|
|
79
|
+
constructor(options?: CommonProps & {
|
|
80
|
+
min?: number;
|
|
81
|
+
max?: number;
|
|
82
|
+
step?: number;
|
|
83
|
+
value?: number;
|
|
84
|
+
orientation?: Orientation;
|
|
85
|
+
draw_value?: boolean;
|
|
86
|
+
});
|
|
87
|
+
toProtocol(): Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
export declare class Checkbox extends WidgetBase {
|
|
90
|
+
private readonly options;
|
|
91
|
+
constructor(options?: CommonProps & {
|
|
92
|
+
label?: string;
|
|
93
|
+
active?: boolean;
|
|
94
|
+
});
|
|
95
|
+
toProtocol(): Record<string, unknown>;
|
|
96
|
+
}
|
|
97
|
+
export declare class DropdownItem {
|
|
98
|
+
readonly id: string;
|
|
99
|
+
readonly label: string;
|
|
100
|
+
constructor(id: string, label: string);
|
|
101
|
+
toProtocol(): Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
export declare class Dropdown extends WidgetBase {
|
|
104
|
+
private readonly options;
|
|
105
|
+
constructor(options?: CommonProps & {
|
|
106
|
+
items?: DropdownItem[];
|
|
107
|
+
selected?: number;
|
|
108
|
+
});
|
|
109
|
+
toProtocol(): Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
export declare class Separator extends WidgetBase {
|
|
112
|
+
private readonly options;
|
|
113
|
+
constructor(options?: CommonProps & {
|
|
114
|
+
orientation?: Orientation;
|
|
115
|
+
});
|
|
116
|
+
toProtocol(): Record<string, unknown>;
|
|
117
|
+
}
|
|
118
|
+
export declare class Scroll extends WidgetBase {
|
|
119
|
+
private readonly child;
|
|
120
|
+
constructor(child: TreeNode, options?: CommonProps);
|
|
121
|
+
toProtocol(): Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
export declare class GridChild {
|
|
124
|
+
readonly row: number;
|
|
125
|
+
readonly column: number;
|
|
126
|
+
readonly child: TreeNode;
|
|
127
|
+
readonly width: number;
|
|
128
|
+
readonly height: number;
|
|
129
|
+
constructor(row: number, column: number, child: TreeNode, width?: number, height?: number);
|
|
130
|
+
toProtocol(): Record<string, unknown>;
|
|
131
|
+
}
|
|
132
|
+
export declare class Grid extends WidgetBase {
|
|
133
|
+
private readonly options;
|
|
134
|
+
constructor(options?: CommonProps & {
|
|
135
|
+
children?: GridChild[];
|
|
136
|
+
row_spacing?: number;
|
|
137
|
+
column_spacing?: number;
|
|
138
|
+
});
|
|
139
|
+
toProtocol(): Record<string, unknown>;
|
|
140
|
+
}
|
|
141
|
+
export declare class Hero extends WidgetBase {
|
|
142
|
+
private readonly options;
|
|
143
|
+
constructor(options: CommonProps & {
|
|
144
|
+
title: string;
|
|
145
|
+
subtitle: string;
|
|
146
|
+
icon?: Icon;
|
|
147
|
+
});
|
|
148
|
+
toProtocol(): Record<string, unknown>;
|
|
149
|
+
}
|
|
150
|
+
export declare class Card extends WidgetBase {
|
|
151
|
+
private readonly options;
|
|
152
|
+
constructor(options?: CommonProps & {
|
|
153
|
+
children?: TreeNode[];
|
|
154
|
+
});
|
|
155
|
+
toProtocol(): Record<string, unknown>;
|
|
156
|
+
}
|
|
157
|
+
export declare class Header {
|
|
158
|
+
readonly title: string;
|
|
159
|
+
readonly subtitle: string;
|
|
160
|
+
constructor(title: string, subtitle?: string);
|
|
161
|
+
toProtocol(): Record<string, unknown>;
|
|
162
|
+
}
|
|
163
|
+
export declare class Section extends WidgetBase {
|
|
164
|
+
private readonly options;
|
|
165
|
+
constructor(options: CommonProps & {
|
|
166
|
+
title?: string;
|
|
167
|
+
subtitle?: string;
|
|
168
|
+
header?: Header;
|
|
169
|
+
body?: TreeNode[];
|
|
170
|
+
children?: TreeNode[];
|
|
171
|
+
});
|
|
172
|
+
toProtocol(): Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
export declare class Collapsible extends WidgetBase {
|
|
175
|
+
private readonly options;
|
|
176
|
+
constructor(options: CommonProps & {
|
|
177
|
+
title?: string;
|
|
178
|
+
subtitle?: string;
|
|
179
|
+
header?: Header;
|
|
180
|
+
expanded?: boolean;
|
|
181
|
+
body?: TreeNode[];
|
|
182
|
+
children?: TreeNode[];
|
|
183
|
+
});
|
|
184
|
+
toProtocol(): Record<string, unknown>;
|
|
185
|
+
}
|
|
186
|
+
export declare class Item extends WidgetBase {
|
|
187
|
+
private readonly options;
|
|
188
|
+
constructor(options?: CommonProps & {
|
|
189
|
+
left?: TreeNode;
|
|
190
|
+
label?: string;
|
|
191
|
+
right?: TreeNode;
|
|
192
|
+
clickable?: boolean;
|
|
193
|
+
menu?: MenuItem[];
|
|
194
|
+
});
|
|
195
|
+
toProtocol(): Record<string, unknown>;
|
|
196
|
+
}
|
|
197
|
+
export declare class CollapsibleItem extends WidgetBase {
|
|
198
|
+
private readonly options;
|
|
199
|
+
constructor(options?: CommonProps & {
|
|
200
|
+
left?: TreeNode;
|
|
201
|
+
label?: string;
|
|
202
|
+
right?: TreeNode;
|
|
203
|
+
expanded?: boolean;
|
|
204
|
+
body?: TreeNode[];
|
|
205
|
+
children?: TreeNode[];
|
|
206
|
+
});
|
|
207
|
+
toProtocol(): Record<string, unknown>;
|
|
208
|
+
}
|
|
209
|
+
export declare class Meter extends WidgetBase {
|
|
210
|
+
private readonly options;
|
|
211
|
+
constructor(options: CommonProps & {
|
|
212
|
+
icon?: Icon;
|
|
213
|
+
label?: string;
|
|
214
|
+
value: number;
|
|
215
|
+
min?: number;
|
|
216
|
+
max?: number;
|
|
217
|
+
step?: number;
|
|
218
|
+
text?: string;
|
|
219
|
+
interactive?: boolean;
|
|
220
|
+
});
|
|
221
|
+
toProtocol(): Record<string, unknown>;
|
|
222
|
+
}
|
|
223
|
+
export declare class Copyable extends WidgetBase {
|
|
224
|
+
private readonly options;
|
|
225
|
+
constructor(options: CommonProps & {
|
|
226
|
+
label?: string;
|
|
227
|
+
value: string;
|
|
228
|
+
});
|
|
229
|
+
toProtocol(): Record<string, unknown>;
|
|
230
|
+
}
|
|
231
|
+
export declare class ToastAction {
|
|
232
|
+
readonly id: string;
|
|
233
|
+
readonly label: string;
|
|
234
|
+
constructor(id: string, label: string);
|
|
235
|
+
toProtocol(): Record<string, unknown>;
|
|
236
|
+
}
|
|
237
|
+
export declare class Toast extends WidgetBase {
|
|
238
|
+
private readonly options;
|
|
239
|
+
constructor(options: CommonProps & {
|
|
240
|
+
icon?: Icon;
|
|
241
|
+
title: string;
|
|
242
|
+
message?: string;
|
|
243
|
+
action?: ToastAction;
|
|
244
|
+
});
|
|
245
|
+
toProtocol(): Record<string, unknown>;
|
|
246
|
+
}
|
|
247
|
+
export declare class ActionRow extends WidgetBase {
|
|
248
|
+
private readonly options;
|
|
249
|
+
constructor(options: CommonProps & {
|
|
250
|
+
title: string;
|
|
251
|
+
subtitle?: string;
|
|
252
|
+
meta?: string;
|
|
253
|
+
icon?: Icon;
|
|
254
|
+
});
|
|
255
|
+
toProtocol(): Record<string, unknown>;
|
|
256
|
+
}
|
|
257
|
+
export declare class Row extends WidgetBase {
|
|
258
|
+
private readonly options;
|
|
259
|
+
constructor(options?: CommonProps & {
|
|
260
|
+
spacing?: number;
|
|
261
|
+
children?: TreeNode[];
|
|
262
|
+
});
|
|
263
|
+
toProtocol(): Record<string, unknown>;
|
|
264
|
+
}
|
|
265
|
+
export declare class Column extends WidgetBase {
|
|
266
|
+
private readonly options;
|
|
267
|
+
constructor(options?: CommonProps & {
|
|
268
|
+
spacing?: number;
|
|
269
|
+
children?: TreeNode[];
|
|
270
|
+
});
|
|
271
|
+
toProtocol(): Record<string, unknown>;
|
|
272
|
+
}
|
|
273
|
+
export declare class ActionMenuItem {
|
|
274
|
+
readonly options: {
|
|
275
|
+
id: string;
|
|
276
|
+
label: string;
|
|
277
|
+
icon?: Icon;
|
|
278
|
+
visible?: boolean;
|
|
279
|
+
checked?: boolean;
|
|
280
|
+
selectable?: boolean;
|
|
281
|
+
};
|
|
282
|
+
constructor(options: {
|
|
283
|
+
id: string;
|
|
284
|
+
label: string;
|
|
285
|
+
icon?: Icon;
|
|
286
|
+
visible?: boolean;
|
|
287
|
+
checked?: boolean;
|
|
288
|
+
selectable?: boolean;
|
|
289
|
+
});
|
|
290
|
+
toProtocol(): Record<string, unknown>;
|
|
291
|
+
}
|
|
292
|
+
export declare class ActionMenu extends WidgetBase {
|
|
293
|
+
private readonly options;
|
|
294
|
+
constructor(options?: CommonProps & {
|
|
295
|
+
header?: string;
|
|
296
|
+
items?: ActionMenuItem[];
|
|
297
|
+
});
|
|
298
|
+
toProtocol(): Record<string, unknown>;
|
|
299
|
+
}
|
|
300
|
+
export declare class Spinner extends WidgetBase {
|
|
301
|
+
private readonly options;
|
|
302
|
+
constructor(options?: CommonProps & {
|
|
303
|
+
spinning?: boolean;
|
|
304
|
+
});
|
|
305
|
+
toProtocol(): Record<string, unknown>;
|
|
306
|
+
}
|
|
307
|
+
export declare class DetailGridItem {
|
|
308
|
+
readonly key: string;
|
|
309
|
+
readonly value: string;
|
|
310
|
+
constructor(key: string, value: string);
|
|
311
|
+
toProtocol(): Record<string, unknown>;
|
|
312
|
+
}
|
|
313
|
+
export declare class DetailGrid extends WidgetBase {
|
|
314
|
+
private readonly options;
|
|
315
|
+
constructor(options?: CommonProps & {
|
|
316
|
+
rows?: DetailGridItem[];
|
|
317
|
+
});
|
|
318
|
+
toProtocol(): Record<string, unknown>;
|
|
319
|
+
}
|
|
320
|
+
export declare class EmptyState extends WidgetBase {
|
|
321
|
+
private readonly options;
|
|
322
|
+
constructor(options: CommonProps & {
|
|
323
|
+
title: string;
|
|
324
|
+
subtitle?: string;
|
|
325
|
+
});
|
|
326
|
+
toProtocol(): Record<string, unknown>;
|
|
327
|
+
}
|
|
328
|
+
export declare class Badge extends WidgetBase {
|
|
329
|
+
private readonly options;
|
|
330
|
+
constructor(options: CommonProps & {
|
|
331
|
+
label: string;
|
|
332
|
+
});
|
|
333
|
+
toProtocol(): Record<string, unknown>;
|
|
334
|
+
}
|
|
335
|
+
export declare class StatusDot extends WidgetBase {
|
|
336
|
+
constructor(options?: CommonProps);
|
|
337
|
+
toProtocol(): Record<string, unknown>;
|
|
338
|
+
}
|
|
339
|
+
export declare class Box extends WidgetBase {
|
|
340
|
+
private readonly options;
|
|
341
|
+
constructor(options?: CommonProps & {
|
|
342
|
+
orientation?: Orientation;
|
|
343
|
+
spacing?: number;
|
|
344
|
+
children?: TreeNode[];
|
|
345
|
+
});
|
|
346
|
+
static vertical(children: TreeNode[], spacing?: number, options?: CommonProps): Box;
|
|
347
|
+
static horizontal(children: TreeNode[], spacing?: number, options?: CommonProps): Box;
|
|
348
|
+
toProtocol(): Record<string, unknown>;
|
|
349
|
+
}
|
|
350
|
+
export type TreeNode = Hero | Card | Section | Collapsible | Item | CollapsibleItem | Meter | Copyable | Toast | ActionRow | ActionMenu | DetailGrid | EmptyState | Badge | StatusDot | Box | Row | Column | Grid | Scroll | Progress | Separator | Spinner | Label | IconWidget | Image | Button | Switch | Scale | Dropdown | Checkbox;
|
|
351
|
+
export {};
|