@await-widget/runtime 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,274 @@
1
+ type AudioOption = 'mix' | 'duckOthers' | 'solo';
2
+
3
+ type ColorScheme = 'light' | 'dark';
4
+
5
+ type RenderingMode = 'fullColor' | 'accented' | 'vibrant';
6
+
7
+ type Update = Date | 'end' | 'rapid' | 'never';
8
+
9
+ type WidgetFamily =
10
+ | 'small'
11
+ | 'medium'
12
+ | 'large'
13
+ | 'extraLarge'
14
+ | 'extraLargePortrait'
15
+ | 'accessoryInline'
16
+ | 'accessoryCircular'
17
+ | 'accessoryRectangular'
18
+ | 'unknown';
19
+
20
+ type SingleNativeView =
21
+ | string
22
+ | number
23
+ | undefined
24
+ | {
25
+ kind: string;
26
+ flat?: unknown[];
27
+ children?: NativeView;
28
+ };
29
+
30
+ type NativeView = SingleNativeView | NativeView[];
31
+
32
+ type AudioConfig = {
33
+ soundFont?: string;
34
+ volume?: number;
35
+ duration?: number;
36
+ delay?: number;
37
+ velocity?: number;
38
+ preset?: number;
39
+ bank?: number;
40
+ loop?: boolean;
41
+ audioOption?: AudioOption;
42
+ };
43
+
44
+ type SoundFontManualMapping = {
45
+ path: string;
46
+ key: number;
47
+ };
48
+
49
+ type SoundFontBuildConfig = {
50
+ savePath: string;
51
+ dataSizeLimitMB?: number;
52
+ mediaFiles?: string[];
53
+ mappings?: SoundFontManualMapping[];
54
+ };
55
+
56
+ type SoundFontCompressConfig = {
57
+ fromPath: string;
58
+ savePath: string;
59
+ dataSizeLimitMB?: number;
60
+ };
61
+
62
+ type SoundFontBuildResult = {
63
+ ok: true;
64
+ output: string;
65
+ resolvedOutput: string;
66
+ sizeBytes: number;
67
+ };
68
+
69
+ type AwaitWeatherConfig = {
70
+ latitude?: number;
71
+ longitude?: number;
72
+ hourlyLimit?: number;
73
+ dailyLimit?: number;
74
+ };
75
+
76
+ type AwaitWeatherCurrent = {
77
+ date: string;
78
+ condition: string;
79
+ symbolName: string;
80
+ temperatureCelsius: number;
81
+ apparentTemperatureCelsius: number;
82
+ humidity: number;
83
+ uvIndex: number;
84
+ windSpeedMetersPerSecond: number;
85
+ windDirectionDegrees: number;
86
+ pressureHectopascals: number;
87
+ visibilityKilometers: number;
88
+ };
89
+
90
+ type AwaitWeatherHourly = {
91
+ date: string;
92
+ condition: string;
93
+ symbolName: string;
94
+ temperatureCelsius: number;
95
+ humidity: number;
96
+ uvIndex: number;
97
+ windSpeedMetersPerSecond: number;
98
+ precipitationChance: number;
99
+ };
100
+
101
+ type AwaitWeatherDaily = {
102
+ date: string;
103
+ condition: string;
104
+ symbolName: string;
105
+ highTemperatureCelsius: number;
106
+ lowTemperatureCelsius: number;
107
+ precipitationChance: number;
108
+ uvIndex: number;
109
+ };
110
+
111
+ type AwaitWeatherResult = {
112
+ location: {
113
+ latitude: number;
114
+ longitude: number;
115
+ };
116
+ current: AwaitWeatherCurrent;
117
+ hourly: AwaitWeatherHourly[];
118
+ daily: AwaitWeatherDaily[];
119
+ };
120
+
121
+ type AwaitHealthInfo = {
122
+ stepCount?: number;
123
+ distanceWalkingRunning?: number;
124
+ flightsClimbed?: number;
125
+ };
126
+
127
+ type AwaitLocationConfig = {
128
+ desiredAccuracyMeters?: number;
129
+ timeoutSeconds?: number;
130
+ };
131
+
132
+ type AwaitLocationInfo = {
133
+ latitude: number;
134
+ longitude: number;
135
+ date: Date;
136
+ altitudeMeters?: number;
137
+ speedMetersPerSecond?: number;
138
+ courseDegrees?: number;
139
+ };
140
+
141
+ type AwaitNowPlayingConfig = {
142
+ artworkSize?: number;
143
+ };
144
+
145
+ type AwaitNowPlayingInfo = {
146
+ state?:
147
+ | 'playing'
148
+ | 'paused'
149
+ | 'stopped'
150
+ | 'interrupted'
151
+ | 'seekingForward'
152
+ | 'seekingBackward';
153
+ sourceConfig?: AwaitMediaPlayConfig;
154
+ id?: string;
155
+ title?: string;
156
+ artistName?: string;
157
+ albumTitle?: string;
158
+ artworkURL?: string;
159
+ maximumWidth?: number;
160
+ maximumHeight?: number;
161
+ backgroundColor?: Color;
162
+ primaryTextColor?: Color;
163
+ secondaryTextColor?: Color;
164
+ tertiaryTextColor?: Color;
165
+ quaternaryTextColor?: Color;
166
+ };
167
+
168
+ type AwaitMusicPlayerCommand = 'start' | 'toggle' | 'next' | 'previous';
169
+
170
+ type AwaitMediaPlayConfig =
171
+ | {
172
+ source: 'song';
173
+ id?: string;
174
+ query?: string;
175
+ limit?: number;
176
+ shuffle?: boolean;
177
+ loop?: boolean;
178
+ offset?: number;
179
+ }
180
+ | {
181
+ source: 'album';
182
+ id?: string;
183
+ query?: string;
184
+ shuffle?: boolean;
185
+ loop?: boolean;
186
+ }
187
+ | {
188
+ source: 'station';
189
+ query?: string;
190
+ type?: 'discovery' | 'user';
191
+ id?: string;
192
+ };
193
+
194
+ type AwaitCalendarConfig = {
195
+ start?: Date;
196
+ end?: Date;
197
+ limit?: number;
198
+ };
199
+
200
+ type AwaitCalendarItem = {
201
+ calendarTitle: string;
202
+ title: string;
203
+ startDate: Date;
204
+ endDate: Date;
205
+ isAllDay: boolean;
206
+ location?: string;
207
+ notes?: string;
208
+ url?: string;
209
+ };
210
+
211
+ type AwaitReminderConfig = {
212
+ type?: 'all' | 'incomplete' | 'completed';
213
+ limit?: number;
214
+ };
215
+
216
+ type AwaitReminderItem = {
217
+ calendarTitle: string;
218
+ title: string;
219
+ notes?: string;
220
+ isCompleted: boolean;
221
+ priority: number;
222
+ startDate?: Date;
223
+ dueDate?: Date;
224
+ completionDate?: Date;
225
+ };
226
+
227
+ type AwaitSystemInfo = {
228
+ battery: {
229
+ state: 'charging' | 'full' | 'unplugged' | 'unknown';
230
+ percent: number;
231
+ lowPowerMode: boolean;
232
+ };
233
+ memory?: {
234
+ used: number;
235
+ free: number;
236
+ total: number;
237
+ percent: number;
238
+ };
239
+ cpu: {
240
+ percent?: number;
241
+ };
242
+ storage?: {
243
+ total: number;
244
+ free: number;
245
+ used: number;
246
+ percent: number;
247
+ };
248
+ };
249
+
250
+ type AwaitAlarmScheduleConfig = {
251
+ title?: string;
252
+ duration?: number;
253
+ date?: Date;
254
+ tint?: Color;
255
+ };
256
+
257
+ type WidgetEntry<T extends Record<string, unknown> = Record<string, unknown>> =
258
+ TimelineContext &
259
+ T & {
260
+ date: Date;
261
+ colorScheme: ColorScheme;
262
+ renderingMode: RenderingMode;
263
+ };
264
+
265
+ type TimelineContext = {
266
+ size: Size;
267
+ family: WidgetFamily;
268
+ };
269
+
270
+ type Timeline<T extends Record<string, unknown> = Record<string, unknown>> = {
271
+ entries: Array<{date: Date} & T>;
272
+ update?: Update;
273
+ skipOnPlayingNote?: boolean;
274
+ };
package/types/prop.d.ts CHANGED
@@ -1,231 +1,233 @@
1
1
  type Props = Record<string, unknown>;
2
2
 
3
3
  type VStackValue = {
4
- spacing?: number;
5
- /** Horizontal alignment for child views. */
6
- alignment?: HorizontalAlignment;
4
+ /** Default 0. */
5
+ spacing?: number;
6
+ /** Horizontal alignment for child views. */
7
+ alignment?: HorizontalAlignment;
7
8
  };
8
9
 
9
10
  type HStackValue = {
10
- spacing?: number;
11
- /** Vertical alignment for child views. */
12
- alignment?: VerticalAlignment;
11
+ /** Default 0. */
12
+ spacing?: number;
13
+ /** Vertical alignment for child views. */
14
+ alignment?: VerticalAlignment;
13
15
  };
14
16
 
15
17
  type ZStackValue = {
16
- /** Horizontal and vertical alignment for child views. */
17
- alignment?: Alignment;
18
+ /** Horizontal and vertical alignment for child views. */
19
+ alignment?: Alignment;
18
20
  };
19
21
 
20
22
  type ButtonValue = {
21
- /** Intent returned by `Await.define(...)`, used to run a registered widget intent when the button is tapped. */
22
- intent?: IntentInfo;
23
- /** Only applies in the app; triggers the button as soon as the touch begins. */
24
- fast?: boolean;
25
- /** Requests permission to play audio. */
26
- audio?: boolean;
27
- /** Opens a universal link directly, such as `https://github.com/await-widget/skills`. */
28
- url?: string;
23
+ /** Intent returned by `Await.define(...)`, used to run a registered widget intent when the button is tapped. */
24
+ intent?: IntentInfo;
25
+ /** Only applies in the app; triggers the button as soon as the touch begins. */
26
+ fast?: boolean;
27
+ /** Requests permission to play audio. */
28
+ audio?: boolean;
29
+ /** Opens a universal link directly, such as `https://github.com/await-widget/skills`. */
30
+ url?: string;
29
31
  };
30
32
 
31
33
  type ShapeValue = {
32
- fill?: ShapeStyle;
33
- /** Only centered strokes are supported. */
34
- stroke?: {
35
- color?: Color;
36
- lineWidth?: number;
37
- lineCap?: string;
38
- lineJoin?: string;
39
- miterLimit?: number;
40
- dash?: number[];
41
- dashPhase?: number;
42
- };
43
- shape?: {
44
- trim?: [number, number];
45
- rotation?: RotationEffect;
46
- offset?: Point;
47
- scale?: ScaleEffect;
48
- in?: {
49
- x: number;
50
- y: number;
51
- width: number;
52
- height: number;
53
- };
54
- };
34
+ /** Default black on light theme, white on dark theme. */
35
+ fill?: ShapeStyle;
36
+ /** Only centered strokes are supported. */
37
+ stroke?: {
38
+ color?: Color;
39
+ lineWidth?: number;
40
+ lineCap?: string;
41
+ lineJoin?: string;
42
+ miterLimit?: number;
43
+ dash?: number[];
44
+ dashPhase?: number;
45
+ };
46
+ shape?: {
47
+ trim?: [number, number];
48
+ rotation?: RotationEffect;
49
+ offset?: Point;
50
+ scale?: ScaleEffect;
51
+ in?: {
52
+ x: number;
53
+ y: number;
54
+ width: number;
55
+ height: number;
56
+ };
57
+ };
55
58
  };
56
59
 
57
60
  type RoundedRectangleValue = {
58
- rectRadius?: Dimension;
59
- style?: CornerRadiusStyle;
61
+ rectRadius?: Dimension;
62
+ /** Default `continuous`. */
63
+ style?: CornerRadiusStyle;
60
64
  };
61
65
 
62
66
  type UnevenRoundedRectangleValue = {
63
- rectRadius?: {
64
- topLeft?: Dimension;
65
- topRight?: Dimension;
66
- bottomRight?: Dimension;
67
- bottomLeft?: Dimension;
68
- bottom?: Dimension;
69
- top?: Dimension;
70
- left?: Dimension;
71
- right?: Dimension;
72
- };
73
- style?: CornerRadiusStyle;
67
+ rectRadius?: {
68
+ topLeft?: Dimension;
69
+ topRight?: Dimension;
70
+ bottomRight?: Dimension;
71
+ bottomLeft?: Dimension;
72
+ bottom?: Dimension;
73
+ top?: Dimension;
74
+ left?: Dimension;
75
+ right?: Dimension;
76
+ };
77
+ style?: CornerRadiusStyle;
74
78
  };
75
79
 
76
80
  type CapsuleValue = {
77
- style?: CornerRadiusStyle;
81
+ style?: CornerRadiusStyle;
78
82
  };
79
83
 
80
84
  type SectorValue = {
81
- value: [start: number, end: number];
85
+ value: [start: number, end: number];
82
86
  };
83
87
 
84
88
  type PolygonValue = {
85
- value: Array<[x: number, y: number]>;
89
+ value: Array<[x: number, y: number]>;
86
90
  };
87
91
 
88
92
  type LinkValue = {
89
- url?: string;
93
+ url?: string;
90
94
  };
91
95
 
92
96
  type ColorValue = {
93
- value?: Color;
97
+ value?: Color;
94
98
  };
95
99
 
96
100
  type TextValue = {
97
- /** Text or encodable value rendered by the component. */
98
- value?: Encodable;
101
+ /** Text or encodable value rendered by the component. */
102
+ value?: Encodable;
99
103
  };
100
104
 
101
105
  type ImageValue = {
102
- /** Local or remote path such as `img.png` `path/img.png` `https://example.com/img.png` */
103
- url?: string;
104
- /** The modes used to resize an image to fit within its containing view. */
105
- resizable?: Resizable;
106
- /** The level of quality for rendering an image that requires interpolation, such as a scaled image. */
107
- interpolation?: Interpolation;
108
- /** A type that indicates how images are rendered */
109
- style?: TemplateRenderingMode;
106
+ /** Local or remote path such as `img.png` `path/img.png` `https://example.com/img.png` */
107
+ url?: string;
108
+ /** The modes used to resize an image to fit within its containing view. */
109
+ resizable?: Resizable;
110
+ /** The level of quality for rendering an image that requires interpolation, such as a scaled image. */
111
+ interpolation?: Interpolation;
112
+ /** A type that indicates how images are rendered */
113
+ style?: TemplateRenderingMode;
110
114
  };
111
115
 
112
116
  type IconValue = {
113
- /** The name of the system symbol image. Use the SF Symbols app to look up the names of system symbol images. */
114
- value?: string;
117
+ /** The name of the system symbol image. Use the SF Symbols app to look up the names of system symbol images. */
118
+ value?: string;
115
119
  };
116
120
 
117
121
  type TimeValue = {
118
- date?: Date;
119
- /** Use `timer` to update once per second. */
120
- style?: TimeStyle;
122
+ date?: Date;
123
+ /** Use `timer` to update once per second. */
124
+ style?: TimeStyle;
121
125
  };
122
126
 
123
127
  type SvgValue = {
124
- /** For example, `img.png`, `path/img.png`, or `https://example.com/img.png`. */
125
- url?: string;
126
- /** For example, `<svg><path d="M0 0h10v10h-10z"/></svg>`. */
127
- value?: string;
128
+ /** For example, `img.png`, `path/img.png`, or `https://example.com/img.png`. */
129
+ url?: string;
130
+ /** For example, `<svg><path d="M0 0h10v10h-10z"/></svg>`. */
131
+ value?: string;
128
132
  };
129
133
 
130
134
  type SpacerValue = {
131
- minLength?: number;
135
+ minLength?: number;
132
136
  };
133
137
 
134
138
  type GifValue = {
135
- size: Size;
136
- duration: GifDuration;
139
+ size: Size;
140
+ duration: GifDuration;
137
141
  };
138
142
 
139
143
  type Mods = {
140
- [K in keyof BaseMods]?: BaseMods[K];
144
+ [K in keyof BaseMods]?: BaseMods[K];
141
145
  } & {
142
- [K in keyof BaseMods as `${K & string}_${string}`]?: BaseMods[K];
146
+ [K in keyof BaseMods as `${K & string}_${string}`]?: BaseMods[K];
143
147
  };
144
148
 
145
149
  type BaseMods = {
146
- animation?: NativeAnimation | number | "";
147
- aspectRatio?: AspectRatio;
148
- background?:
149
- | ShapeStyle
150
- | NativeView
151
- | { alignment: Alignment; content: NativeView };
152
- baselineOffset?: number;
153
- blendMode?: BlendMode;
154
- blur?: Blur;
155
- brightness?: number;
156
- buttonStyle?: ButtonStyle;
157
- clipped?: boolean;
158
- clipShape?: NativeView | "";
159
- colorInvert?: boolean;
160
- colorMultiply?: Color;
161
- compositingGroup?: boolean;
162
- contentShape?: NativeView | "";
163
- contentTransition?: ContentTransition;
164
- contrast?: number;
165
- cornerRadius?: number;
166
- debug?: boolean;
167
- disable?: boolean;
168
- drawingGroup?: boolean;
169
- fixedSize?: FixedSize;
170
- font?: Font | "";
171
- fontDesign?: FontDesign | "";
172
- fontSize?: number;
173
- fontWeight?: FontWeight | "";
174
- fontWidth?: FontWidth | "";
175
- foreground?: ShapeStyle;
176
- frame?: Frame;
177
- geometryGroup?: boolean;
178
- grayscale?: number;
179
- height?: number;
180
- hidden?: boolean;
181
- hueRotation?: number;
182
- ignoresSafeArea?: boolean;
183
- italic?: boolean;
184
- kerning?: number;
185
- layoutPriority?: number;
186
- lineHeight?: LineHeight | "";
187
- lineLimit?: number | "";
188
- lineSpacing?: number;
189
- luminanceToAlpha?: boolean;
190
- mask?: NativeView;
191
- maxHeight?: Dimension | boolean;
192
- maxSides?: Dimension | boolean;
193
- maxWidth?: Dimension | boolean;
194
- minimumScaleFactor?: number;
195
- monospaced?: boolean;
196
- monospacedDigit?: boolean;
197
- offset?: Point;
198
- offsetX?: number;
199
- offsetY?: number;
200
- opacity?: number;
201
- overlay?:
202
- | ShapeStyle
203
- | NativeView
204
- | { alignment: Alignment; content: NativeView };
205
- padding?: Padding | boolean;
206
- pixelPerfectCenter?: boolean | Point;
207
- position?: Point;
208
- reverseMask?: NativeView;
209
- rotation3DEffect?: Rotation3DEffect;
210
- rotationEffect?: RotationEffect;
211
- saturation?: number;
212
- scaleEffect?: ScaleEffect;
213
- shadow?: Shadow;
214
- sides?: number;
215
- strikethrough?:
216
- | boolean
217
- | { isActive?: boolean; pattern?: Pattern; color?: Color };
218
- test?: unknown;
219
- textAlignment?: TextAlignment;
220
- tint?: ShapeStyle;
221
- tracking?: number;
222
- transform?: [number, number, number, number, number, number];
223
- transition?: Transition;
224
- truncationMode?: "head" | "middle" | "tail";
225
- typesettingLanguage?: string;
226
- underline?:
227
- | boolean
228
- | { isActive?: boolean; pattern?: Pattern; color?: Color };
229
- width?: number;
230
- zIndex?: number;
150
+ animation?: NativeAnimation | number | '';
151
+ aspectRatio?: AspectRatio;
152
+ background?:
153
+ | ShapeStyle
154
+ | NativeView
155
+ | {alignment: Alignment; content: NativeView};
156
+ baselineOffset?: number;
157
+ blendMode?: BlendMode;
158
+ blur?: Blur;
159
+ brightness?: number;
160
+ buttonStyle?: ButtonStyle;
161
+ clipped?: boolean;
162
+ clipShape?: NativeView | '';
163
+ colorInvert?: boolean;
164
+ colorMultiply?: Color;
165
+ compositingGroup?: boolean;
166
+ contentShape?: NativeView | '';
167
+ contentTransition?: ContentTransition;
168
+ contrast?: number;
169
+ cornerRadius?: number;
170
+ debug?: boolean;
171
+ disable?: boolean;
172
+ drawingGroup?: boolean;
173
+ fixedSize?: FixedSize;
174
+ font?: Font | '';
175
+ fontDesign?: FontDesign | '';
176
+ fontSize?: number;
177
+ fontWeight?: FontWeight | '';
178
+ fontWidth?: FontWidth | '';
179
+ foreground?: ShapeStyle;
180
+ frame?: Frame;
181
+ geometryGroup?: boolean;
182
+ grayscale?: number;
183
+ height?: number;
184
+ hidden?: boolean;
185
+ hueRotation?: number;
186
+ ignoresSafeArea?: boolean;
187
+ italic?: boolean;
188
+ kerning?: number;
189
+ layoutPriority?: number;
190
+ lineHeight?: LineHeight | '';
191
+ lineLimit?: number | '';
192
+ lineSpacing?: number;
193
+ luminanceToAlpha?: boolean;
194
+ mask?: NativeView;
195
+ maxHeight?: Dimension | boolean;
196
+ maxSides?: Dimension | boolean;
197
+ maxWidth?: Dimension | boolean;
198
+ minimumScaleFactor?: number;
199
+ monospaced?: boolean;
200
+ monospacedDigit?: boolean;
201
+ offset?: Point;
202
+ offsetX?: number;
203
+ offsetY?: number;
204
+ opacity?: number;
205
+ overlay?:
206
+ | ShapeStyle
207
+ | NativeView
208
+ | {alignment: Alignment; content: NativeView};
209
+ padding?: Padding | boolean;
210
+ pixelPerfectCenter?: boolean | Point;
211
+ position?: Point;
212
+ reverseMask?: NativeView;
213
+ rotation3DEffect?: Rotation3DEffect;
214
+ rotationEffect?: RotationEffect;
215
+ saturation?: number;
216
+ scaleEffect?: ScaleEffect;
217
+ shadow?: Shadow;
218
+ sides?: number;
219
+ strikethrough?:
220
+ | boolean
221
+ | {isActive?: boolean; pattern?: Pattern; color?: Color};
222
+ test?: unknown;
223
+ textAlignment?: TextAlignment;
224
+ tint?: ShapeStyle;
225
+ tracking?: number;
226
+ transform?: [number, number, number, number, number, number];
227
+ transition?: Transition;
228
+ truncationMode?: 'head' | 'middle' | 'tail';
229
+ typesettingLanguage?: string;
230
+ underline?: boolean | {isActive?: boolean; pattern?: Pattern; color?: Color};
231
+ width?: number;
232
+ zIndex?: number;
231
233
  };