glimpse-sdk 0.7.0 → 0.9.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.
@@ -1,22 +0,0 @@
1
- export class StatusItem {
2
- options;
3
- constructor(options = {}) {
4
- this.options = options;
5
- }
6
- toProtocol() {
7
- const payload = {};
8
- if (this.options.id !== undefined) {
9
- payload.id = this.options.id;
10
- }
11
- if (this.options.icon !== undefined) {
12
- payload.icon = this.options.icon;
13
- }
14
- if (this.options.label !== undefined) {
15
- payload.label = this.options.label;
16
- }
17
- if (this.options.tooltip !== undefined) {
18
- payload.tooltip = this.options.tooltip;
19
- }
20
- return payload;
21
- }
22
- }
@@ -1,528 +0,0 @@
1
- export type InlineHandler = (event: unknown) => void | Promise<void>;
2
- export declare class InlineHandlerRegistry {
3
- readonly handlers: Map<string, InlineHandler>;
4
- add(event: "click" | "toggle" | "change", id: string, handler: InlineHandler): void;
5
- }
6
- export type BadgeKind = "default" | "success" | "warning" | "error" | "accent";
7
- export type StatusDotStatus = "neutral" | "success" | "warning" | "error" | "accent";
8
- export type PagerAppearance = "dots" | "numbers";
9
- export type PopoverSize = "small" | "medium" | "large" | "wide";
10
- export interface ProtocolNode {
11
- type: string;
12
- data: Record<string, unknown>;
13
- }
14
- export interface CommonOptions {
15
- visible?: boolean;
16
- tooltip?: string;
17
- css_classes?: string[];
18
- styles?: Record<string, string>;
19
- }
20
- export declare abstract class WidgetBase {
21
- protected readonly common: CommonOptions;
22
- protected constructor(common?: CommonOptions);
23
- abstract readonly type: string;
24
- abstract data(): Record<string, unknown>;
25
- bindHandlers(_registry: InlineHandlerRegistry, _path: number[]): void;
26
- toProtocol(): ProtocolNode;
27
- protected commonData(): Record<string, unknown>;
28
- }
29
- export declare class Label extends WidgetBase {
30
- readonly type = "label";
31
- private readonly options;
32
- constructor(options: string | CommonOptions & {
33
- label: string;
34
- xalign?: number;
35
- wrap?: boolean;
36
- });
37
- data(): Record<string, unknown>;
38
- }
39
- export declare class Header extends WidgetBase {
40
- private readonly options;
41
- readonly type = "header";
42
- constructor(options: CommonOptions & {
43
- label: string;
44
- });
45
- data(): Record<string, unknown>;
46
- }
47
- export declare class Hero extends WidgetBase {
48
- private readonly options;
49
- readonly type = "hero";
50
- constructor(options: CommonOptions & {
51
- title: string;
52
- subtitle?: string;
53
- id?: string;
54
- icon?: string;
55
- icon_size?: number;
56
- toggle?: boolean;
57
- toggle_sensitive?: boolean;
58
- separator?: boolean;
59
- trailing?: TreeNode;
60
- on_toggle?: InlineHandler;
61
- });
62
- data(): Record<string, unknown>;
63
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
64
- }
65
- export declare class Badge extends WidgetBase {
66
- private readonly options;
67
- readonly type = "badge";
68
- constructor(options: CommonOptions & {
69
- label: string;
70
- kind?: BadgeKind;
71
- });
72
- data(): Record<string, unknown>;
73
- }
74
- export declare class StatusDot extends WidgetBase {
75
- private readonly options;
76
- readonly type = "status_dot";
77
- constructor(options?: CommonOptions & {
78
- status?: StatusDotStatus;
79
- });
80
- data(): Record<string, unknown>;
81
- }
82
- export declare class PanelIndicator extends WidgetBase {
83
- private readonly options;
84
- readonly type = "panel_indicator";
85
- constructor(options: CommonOptions & {
86
- id?: string;
87
- icon?: string;
88
- label?: string;
89
- active?: boolean;
90
- checked?: boolean;
91
- needs_attention?: boolean;
92
- extra?: TreeNode;
93
- on_click?: InlineHandler;
94
- });
95
- data(): Record<string, unknown>;
96
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
97
- }
98
- export declare class EmptyState extends WidgetBase {
99
- private readonly options;
100
- readonly type = "empty_state";
101
- constructor(options: CommonOptions & {
102
- title: string;
103
- subtitle?: string;
104
- });
105
- data(): Record<string, unknown>;
106
- }
107
- export declare class Spinner extends WidgetBase {
108
- private readonly options;
109
- readonly type = "spinner";
110
- constructor(options?: CommonOptions & {
111
- spinning?: boolean;
112
- });
113
- data(): Record<string, unknown>;
114
- }
115
- export declare class Meter extends WidgetBase {
116
- private readonly options;
117
- readonly type = "meter";
118
- constructor(options?: CommonOptions & {
119
- id?: string;
120
- icon?: string;
121
- label?: string;
122
- value?: number;
123
- min?: number;
124
- max?: number;
125
- step?: number;
126
- text?: string;
127
- interactive?: boolean;
128
- on_change?: InlineHandler;
129
- });
130
- data(): Record<string, unknown>;
131
- bindHandlers(registry: InlineHandlerRegistry, _path: number[]): void;
132
- }
133
- export declare class Separator extends WidgetBase {
134
- readonly type = "separator";
135
- constructor(common?: CommonOptions);
136
- data(): Record<string, unknown>;
137
- }
138
- export declare class Scroll extends WidgetBase {
139
- private readonly options;
140
- readonly type = "scroll";
141
- constructor(options: CommonOptions & {
142
- child: TreeNode;
143
- });
144
- data(): Record<string, unknown>;
145
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
146
- }
147
- declare abstract class ChildrenWidget extends WidgetBase {
148
- constructor(common?: CommonOptions & {
149
- children?: TreeNode[];
150
- });
151
- protected readonly kids: TreeNode[];
152
- data(): Record<string, unknown>;
153
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
154
- }
155
- export declare class Row extends ChildrenWidget {
156
- readonly type = "row";
157
- }
158
- export declare class Column extends ChildrenWidget {
159
- readonly type = "column";
160
- }
161
- export declare class BoxedList extends ChildrenWidget {
162
- readonly type = "boxed_list";
163
- }
164
- export declare class ButtonRow extends ChildrenWidget {
165
- readonly type = "button_row";
166
- }
167
- export declare class CircleBox extends WidgetBase {
168
- private readonly options;
169
- readonly type = "circle_box";
170
- constructor(options: CommonOptions & {
171
- color: string;
172
- });
173
- data(): Record<string, unknown>;
174
- }
175
- export declare class Container extends ChildrenWidget {
176
- readonly type = "container";
177
- }
178
- export declare class PopoverShell extends ChildrenWidget {
179
- private readonly options;
180
- readonly type = "popover_shell";
181
- constructor(options?: CommonOptions & {
182
- children?: TreeNode[];
183
- size?: PopoverSize;
184
- footer?: TreeNode[];
185
- footer_visible?: boolean;
186
- });
187
- data(): Record<string, unknown>;
188
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
189
- }
190
- export declare class Tile extends WidgetBase {
191
- protected readonly options: CommonOptions & {
192
- primary: string;
193
- id?: string;
194
- secondary?: string;
195
- left_icon?: string;
196
- left?: TreeNode;
197
- right?: TreeNode;
198
- activatable?: boolean;
199
- on_click?: InlineHandler;
200
- };
201
- readonly type: string;
202
- constructor(options: CommonOptions & {
203
- primary: string;
204
- id?: string;
205
- secondary?: string;
206
- left_icon?: string;
207
- left?: TreeNode;
208
- right?: TreeNode;
209
- activatable?: boolean;
210
- on_click?: InlineHandler;
211
- });
212
- data(): Record<string, unknown>;
213
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
214
- }
215
- export declare class SegmentedTile extends Tile {
216
- protected readonly options: ConstructorParameters<typeof Tile>[0] & {
217
- child?: TreeNode;
218
- expanded?: boolean;
219
- on_toggle?: InlineHandler;
220
- };
221
- readonly type = "segmented_tile";
222
- constructor(options: ConstructorParameters<typeof Tile>[0] & {
223
- child?: TreeNode;
224
- expanded?: boolean;
225
- on_toggle?: InlineHandler;
226
- });
227
- data(): Record<string, unknown>;
228
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
229
- }
230
- export declare class SwitchTile extends WidgetBase {
231
- private readonly options;
232
- readonly type = "switch_tile";
233
- constructor(options: CommonOptions & {
234
- id: string;
235
- primary: string;
236
- secondary?: string;
237
- left_icon?: string;
238
- left?: TreeNode;
239
- active?: boolean;
240
- on_toggle?: InlineHandler;
241
- });
242
- data(): Record<string, unknown>;
243
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
244
- }
245
- export declare class ExpanderTile extends WidgetBase {
246
- private readonly options;
247
- readonly type = "expander_tile";
248
- constructor(options: CommonOptions & {
249
- primary: string;
250
- id?: string;
251
- secondary?: string;
252
- left_icon?: string;
253
- left?: TreeNode;
254
- child?: TreeNode;
255
- expanded?: boolean;
256
- on_toggle?: InlineHandler;
257
- });
258
- data(): Record<string, unknown>;
259
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
260
- }
261
- export declare class SliderTile extends WidgetBase {
262
- private readonly options;
263
- readonly type = "slider_tile";
264
- constructor(options: CommonOptions & {
265
- id: string;
266
- label?: string;
267
- left_icon?: string;
268
- left?: TreeNode;
269
- value?: number;
270
- min?: number;
271
- max?: number;
272
- step?: number;
273
- page?: number;
274
- digits?: number;
275
- snap_step?: number;
276
- on_change?: InlineHandler;
277
- });
278
- data(): Record<string, unknown>;
279
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
280
- }
281
- export declare class ChoiceTile extends WidgetBase {
282
- private readonly options;
283
- readonly type = "choice_tile";
284
- constructor(options: CommonOptions & {
285
- primary: string;
286
- id?: string;
287
- secondary?: string;
288
- left_icon?: string;
289
- left?: TreeNode;
290
- selected?: boolean;
291
- on_click?: InlineHandler;
292
- });
293
- data(): Record<string, unknown>;
294
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
295
- }
296
- export declare class Choice {
297
- readonly options: {
298
- id: string;
299
- primary: string;
300
- secondary?: string;
301
- icon?: string;
302
- };
303
- constructor(options: {
304
- id: string;
305
- primary: string;
306
- secondary?: string;
307
- icon?: string;
308
- });
309
- toProtocol(): Record<string, unknown>;
310
- }
311
- export declare class ChoiceList extends WidgetBase {
312
- private readonly options;
313
- readonly type = "choice_list";
314
- constructor(options: CommonOptions & {
315
- id: string;
316
- choices?: Choice[];
317
- active?: string;
318
- on_change?: InlineHandler;
319
- });
320
- data(): Record<string, unknown>;
321
- bindHandlers(registry: InlineHandlerRegistry, _path: number[]): void;
322
- }
323
- export declare class KeyValueGrid extends WidgetBase {
324
- private readonly options;
325
- readonly type = "key_value_grid";
326
- constructor(options?: CommonOptions & {
327
- rows?: {
328
- key: string;
329
- value: string;
330
- }[];
331
- });
332
- data(): Record<string, unknown>;
333
- }
334
- export declare class PagerItem extends WidgetBase {
335
- private readonly options;
336
- readonly type = "pager_item";
337
- constructor(options: CommonOptions & {
338
- id: number;
339
- label?: string;
340
- appearance?: PagerAppearance;
341
- active?: boolean;
342
- inactive?: boolean;
343
- occupied?: boolean;
344
- urgent?: boolean;
345
- on_click?: InlineHandler;
346
- });
347
- data(): Record<string, unknown>;
348
- bindHandlers(registry: InlineHandlerRegistry, _path: number[]): void;
349
- }
350
- export declare class PagerStrip extends WidgetBase {
351
- private readonly options;
352
- readonly type = "pager_strip";
353
- constructor(options?: CommonOptions & {
354
- id?: string;
355
- items?: PagerItem[];
356
- placeholder?: boolean;
357
- on_change?: InlineHandler;
358
- });
359
- data(): Record<string, unknown>;
360
- bindHandlers(registry: InlineHandlerRegistry, path: number[]): void;
361
- }
362
- declare abstract class ActiveIndicator extends WidgetBase {
363
- protected readonly options: CommonOptions & {
364
- active?: boolean;
365
- };
366
- constructor(options?: CommonOptions & {
367
- active?: boolean;
368
- });
369
- data(): Record<string, unknown>;
370
- }
371
- export declare class CameraIndicator extends ActiveIndicator {
372
- readonly type = "camera_indicator";
373
- }
374
- export declare class MicIndicator extends ActiveIndicator {
375
- readonly type = "mic_indicator";
376
- }
377
- export declare class MutedIndicator extends ActiveIndicator {
378
- readonly type = "muted_indicator";
379
- }
380
- export declare class LocationIndicator extends ActiveIndicator {
381
- readonly type = "location_indicator";
382
- }
383
- export declare class ScreenCastIndicator extends ActiveIndicator {
384
- protected readonly options: CommonOptions & {
385
- active?: boolean;
386
- timer_text?: string;
387
- };
388
- readonly type = "screencast_indicator";
389
- constructor(options?: CommonOptions & {
390
- active?: boolean;
391
- timer_text?: string;
392
- });
393
- data(): Record<string, unknown>;
394
- }
395
- export declare class Calendar extends WidgetBase {
396
- private readonly options;
397
- readonly type = "calendar";
398
- constructor(options: CommonOptions & {
399
- selected_date: string;
400
- id?: string;
401
- event_days?: string[];
402
- on_change?: InlineHandler;
403
- });
404
- data(): Record<string, unknown>;
405
- bindHandlers(registry: InlineHandlerRegistry, _path: number[]): void;
406
- }
407
- export declare class BatteryHero extends WidgetBase {
408
- private readonly options;
409
- readonly type = "battery_hero";
410
- constructor(options: CommonOptions & {
411
- icon: string;
412
- percentage: string;
413
- fraction: number;
414
- state: string;
415
- });
416
- data(): Record<string, unknown>;
417
- }
418
- export declare class DateHero extends WidgetBase {
419
- private readonly options;
420
- readonly type = "date_hero";
421
- constructor(options: CommonOptions & {
422
- weekday: string;
423
- date: string;
424
- });
425
- data(): Record<string, unknown>;
426
- }
427
- export declare class EventItem {
428
- readonly options: {
429
- id: string;
430
- title: string;
431
- start: string;
432
- end?: string;
433
- location?: string;
434
- all_day?: boolean;
435
- };
436
- constructor(options: {
437
- id: string;
438
- title: string;
439
- start: string;
440
- end?: string;
441
- location?: string;
442
- all_day?: boolean;
443
- });
444
- toProtocol(): Record<string, unknown>;
445
- }
446
- export declare class Events extends WidgetBase {
447
- private readonly options;
448
- readonly type = "events";
449
- constructor(options: CommonOptions & {
450
- date: string;
451
- events?: EventItem[];
452
- loading?: boolean;
453
- });
454
- data(): Record<string, unknown>;
455
- }
456
- export declare class WeatherForecastItem {
457
- readonly options: {
458
- day_name: string;
459
- icon: string;
460
- condition: string;
461
- temperatures: string;
462
- is_today?: boolean;
463
- };
464
- constructor(options: {
465
- day_name: string;
466
- icon: string;
467
- condition: string;
468
- temperatures: string;
469
- is_today?: boolean;
470
- });
471
- toProtocol(): Record<string, unknown>;
472
- }
473
- export declare class WeatherForecastList extends WidgetBase {
474
- private readonly options;
475
- readonly type = "weather_forecast_list";
476
- constructor(options?: CommonOptions & {
477
- items?: WeatherForecastItem[];
478
- });
479
- data(): Record<string, unknown>;
480
- }
481
- export declare class WeatherHourlyItem {
482
- readonly options: {
483
- time: string;
484
- icon: string;
485
- temperature: string;
486
- };
487
- constructor(options: {
488
- time: string;
489
- icon: string;
490
- temperature: string;
491
- });
492
- toProtocol(): Record<string, unknown>;
493
- }
494
- export declare class WeatherHourlyStrip extends WidgetBase {
495
- private readonly options;
496
- readonly type = "weather_hourly_strip";
497
- constructor(options?: CommonOptions & {
498
- items?: WeatherHourlyItem[];
499
- });
500
- data(): Record<string, unknown>;
501
- }
502
- export declare class WorldClockRow {
503
- readonly options: {
504
- name: string;
505
- timezone: string;
506
- time: string;
507
- offset: string;
508
- day_label?: string;
509
- };
510
- constructor(options: {
511
- name: string;
512
- timezone: string;
513
- time: string;
514
- offset: string;
515
- day_label?: string;
516
- });
517
- toProtocol(): Record<string, unknown>;
518
- }
519
- export declare class WorldClock extends WidgetBase {
520
- private readonly options;
521
- readonly type = "world_clock";
522
- constructor(options?: CommonOptions & {
523
- rows?: WorldClockRow[];
524
- });
525
- data(): Record<string, unknown>;
526
- }
527
- export type TreeNode = Row | Column | Container | CircleBox | BoxedList | PopoverShell | Label | Header | Hero | Badge | StatusDot | PanelIndicator | EmptyState | Spinner | Meter | Separator | Scroll | Tile | SegmentedTile | ButtonRow | SwitchTile | ExpanderTile | SliderTile | ChoiceTile | ChoiceList | KeyValueGrid | PagerItem | PagerStrip | CameraIndicator | MicIndicator | MutedIndicator | ScreenCastIndicator | LocationIndicator | Calendar | BatteryHero | DateHero | Events | WeatherForecastList | WeatherHourlyStrip | WorldClock;
528
- export {};