@await-widget/runtime 0.0.5 → 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.
package/types/prop.d.ts CHANGED
@@ -1,563 +1,233 @@
1
- type CornerRadiusStyle = "circular" | "continuous";
2
-
3
- type ShapeStyle =
4
- | Color
5
- | Material
6
- | "primary"
7
- | "secondary"
8
- | "tertiary"
9
- | "quaternary"
10
- | "quinary"
11
- | LinearGradient
12
- | RadialGradient
13
- | AngularGradient;
14
-
15
- type NativeAnimation = (
16
- | {
17
- type?:
18
- | "linear"
19
- | "default"
20
- | "easeIn"
21
- | "easeInOut"
22
- | "easeOut"
23
- | "circularEaseIn"
24
- | "circularEaseInOut"
25
- | "circularEaseOut";
26
- duration?: number;
27
- }
28
- | {
29
- type: "interactiveSpring";
30
- blendDuration?: number;
31
- duration?: number;
32
- bounce?: number;
33
- }
34
- | {
35
- type: "bouncy";
36
- bounce?: number;
37
- duration?: number;
38
- }
39
- | {
40
- type: "smooth";
41
- duration?: number;
42
- bounce?: number;
43
- }
44
- | {
45
- type: "spring";
46
- blendDuration?: number;
47
- duration?: number;
48
- bounce?: number;
49
- }
50
- | {
51
- type: "timingCurve";
52
- start: UnitPoint;
53
- end: UnitPoint;
54
- duration?: number;
55
- }
56
- | {
57
- type: "snappy";
58
- bounce?: number;
59
- duration?: number;
60
- }
61
- ) & {
62
- value?: unknown;
63
- delay?: number;
64
- autoreverses?: boolean;
65
- speed?: number;
66
- loop?: boolean | number;
67
- };
68
-
69
- type ContentTransition =
70
- | "identity"
71
- | "interpolate"
72
- | "opacity"
73
- | "symbolEffect"
74
- | "numericText"
75
- | ["numericText", boolean]
76
- | ["numericText", number];
77
-
78
- type Edge = "top" | "bottom" | "leading" | "trailing";
79
-
80
- type RawTransition =
81
- | "identity"
82
- | "blurReplace"
83
- | "opacity"
84
- | "slide"
85
- | "scale"
86
- | ["scale", number, UnitPoint?]
87
- | ["push", Edge]
88
- | ["offset", number, number]
89
- | ["move", Edge];
90
-
91
- type Transition = RawTransition | [RawTransition, RawTransition];
92
-
93
- type Padding =
94
- | {
95
- left?: number;
96
- right?: number;
97
- top?: number;
98
- bottom?: number;
99
- vertical?: number;
100
- horizontal?: number;
101
- other?: number;
102
- }
103
- | number;
104
-
105
- type UnevenRoundedRectangleValue = {
106
- rectRadius?: {
107
- topLeft?: Dimension;
108
- topRight?: Dimension;
109
- bottomRight?: Dimension;
110
- bottomLeft?: Dimension;
111
- bottom?: Dimension;
112
- top?: Dimension;
113
- left?: Dimension;
114
- right?: Dimension;
115
- };
116
- style?: CornerRadiusStyle;
117
- };
118
-
119
- type ShapeValue = {
120
- fill?: ShapeStyle;
121
- stroke?: {
122
- color?: Color;
123
- lineWidth?: number;
124
- lineCap?: string;
125
- lineJoin?: string;
126
- miterLimit?: number;
127
- dash?: number[];
128
- dashPhase?: number;
129
- };
130
- shape?: {
131
- trim?: [number, number];
132
- rotation?: RotationEffect;
133
- offset?: Point;
134
- scale?: ScaleEffect;
135
- in?: {
136
- x: number;
137
- y: number;
138
- width: number;
139
- height: number;
140
- };
141
- };
142
- };
143
-
144
- type RoundedRectangleValue = {
145
- rectRadius?: Dimension;
146
- style?: CornerRadiusStyle;
147
- };
1
+ type Props = Record<string, unknown>;
148
2
 
149
3
  type VStackValue = {
150
- spacing?: number;
151
- alignment?: HorizontalAlignment;
4
+ /** Default 0. */
5
+ spacing?: number;
6
+ /** Horizontal alignment for child views. */
7
+ alignment?: HorizontalAlignment;
152
8
  };
153
9
 
154
10
  type HStackValue = {
155
- spacing?: number;
156
- alignment?: VerticalAlignment;
11
+ /** Default 0. */
12
+ spacing?: number;
13
+ /** Vertical alignment for child views. */
14
+ alignment?: VerticalAlignment;
157
15
  };
158
16
 
159
17
  type ZStackValue = {
160
- alignment?: Alignment;
161
- };
162
-
163
- type LinkValue = {
164
- url?: string;
18
+ /** Horizontal and vertical alignment for child views. */
19
+ alignment?: Alignment;
165
20
  };
166
21
 
167
22
  type ButtonValue = {
168
- intent?: IntentInfo;
169
- fast?: boolean;
170
- audio?: boolean;
171
- url?: string;
172
- };
173
-
174
- type ColorValue = {
175
- value?: Color;
176
- };
177
-
178
- type TextValue = {
179
- value?: Encodable;
180
- };
181
-
182
- type ImageValue = {
183
- url?: string;
184
- resizable?: Resizable;
185
- interpolation?: Interpolation;
186
- style?: TemplateRenderingMode;
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;
187
31
  };
188
32
 
189
- type IconValue = {
190
- value?: string;
191
- };
192
-
193
- type TimeValueStrict = {
194
- value?: number;
195
- style?: "time" | "date" | "relative" | "offset" | "timer";
33
+ type ShapeValue = {
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
+ };
196
58
  };
197
59
 
198
- type TimeValue = {
199
- date?: Date;
200
- style?: "time" | "date" | "relative" | "offset" | "timer";
60
+ type RoundedRectangleValue = {
61
+ rectRadius?: Dimension;
62
+ /** Default `continuous`. */
63
+ style?: CornerRadiusStyle;
201
64
  };
202
65
 
203
- type SvgValue = {
204
- url?: string;
205
- value?: string;
66
+ type UnevenRoundedRectangleValue = {
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;
206
78
  };
207
79
 
208
80
  type CapsuleValue = {
209
- style?: CornerRadiusStyle;
81
+ style?: CornerRadiusStyle;
210
82
  };
211
83
 
212
84
  type SectorValue = {
213
- value: [start: number, end: number];
85
+ value: [start: number, end: number];
214
86
  };
215
87
 
216
88
  type PolygonValue = {
217
- value: Array<[x: number, y: number]>;
89
+ value: Array<[x: number, y: number]>;
218
90
  };
219
91
 
220
- type SpacerValue = {
221
- minLength?: number;
92
+ type LinkValue = {
93
+ url?: string;
222
94
  };
223
95
 
224
- type RadialGradient = {
225
- gradient: "radial";
226
- colors?: Color[];
227
- stops?: Array<[Color, number]>;
228
- startRadius?: number;
229
- endRadius?: number;
96
+ type ColorValue = {
97
+ value?: Color;
230
98
  };
231
99
 
232
- type AngularGradient = {
233
- gradient: "angular";
234
- colors?: Color[];
235
- stops?: Array<[Color, number]>;
236
- angle?: number;
237
- center?: UnitPoint;
100
+ type TextValue = {
101
+ /** Text or encodable value rendered by the component. */
102
+ value?: Encodable;
238
103
  };
239
104
 
240
- type LinearGradient = {
241
- gradient: "linear";
242
- colors?: Color[];
243
- stops?: Stop[];
244
- startPoint?: UnitPoint;
245
- endPoint?: UnitPoint;
105
+ type ImageValue = {
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;
246
114
  };
247
115
 
248
- type UnitPoint =
249
- | "center"
250
- | "zero"
251
- | "leading"
252
- | "trailing"
253
- | "top"
254
- | "topLeading"
255
- | "topTrailing"
256
- | "bottom"
257
- | "bottomLeading"
258
- | "bottomTrailing"
259
- | Point;
260
-
261
- type Stop = [Color, number];
262
-
263
- type RawColor =
264
- | ""
265
- | "background"
266
- | "black"
267
- | "blue"
268
- | "brown"
269
- | "cyan"
270
- | "gray"
271
- | "green"
272
- | "indigo"
273
- | "magenta"
274
- | "mint"
275
- | "orange"
276
- | "pink"
277
- | "primary"
278
- | "purple"
279
- | "red"
280
- | "secondary"
281
- | "teal"
282
- | "white"
283
- | "yellow"
284
- | string
285
- | number;
286
-
287
- type RawThemeColor = RawColor | [RawColor, number];
288
-
289
- type Color =
290
- | RawThemeColor
291
- | {
292
- dark?: RawThemeColor;
293
- light?: RawThemeColor;
294
- };
295
-
296
- type VerticalAlignment =
297
- | "firstTextBaseline"
298
- | "lastTextBaseline"
299
- | "top"
300
- | "bottom"
301
- | "center";
302
-
303
- type HorizontalAlignment =
304
- | "listRowSeparatorLeading"
305
- | "listRowSeparatorTrailing"
306
- | "leading"
307
- | "trailing"
308
- | "center";
309
-
310
- type Alignment =
311
- | "leading"
312
- | "trailing"
313
- | "top"
314
- | "bottom"
315
- | "topLeading"
316
- | "topTrailing"
317
- | "bottomLeading"
318
- | "bottomTrailing"
319
- | "center"
320
- | "trailingFirstTextBaseline"
321
- | "leadingLastTextBaseline"
322
- | "leadingFirstTextBaseline"
323
- | "centerLastTextBaseline"
324
- | "centerFirstTextBaseline"
325
- | "trailingLastTextBaseline";
326
-
327
- type Dimension = "max" | number;
328
- type AspectRatio =
329
- | "fill"
330
- | "fit"
331
- | [aspectRatio: number, contentMode: "fill" | "fit"];
332
-
333
- type LooseValues = {
334
- [P in keyof (ButtonValue &
335
- HStackValue &
336
- VStackValue &
337
- ZStackValue &
338
- ColorValue &
339
- ImageValue &
340
- LinkValue &
341
- SpacerValue &
342
- SvgValue &
343
- IconValue &
344
- TextValue &
345
- TimeValueStrict &
346
- CapsuleValue &
347
- RoundedRectangleValue &
348
- SectorValue &
349
- ShapeValue &
350
- UnevenRoundedRectangleValue)]?: unknown;
116
+ type IconValue = {
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;
351
119
  };
352
120
 
353
- type Props = ID & Mods & LooseValues & { children?: NativeView };
354
- type ID = { id?: Encodable };
355
- type TextAlignment = "center" | "leading" | "trailing";
356
- type FontDesign = "monospaced" | "rounded" | "serif" | "default";
357
- type FontWeight =
358
- | "black"
359
- | 900
360
- | "heavy"
361
- | 800
362
- | "bold"
363
- | 700
364
- | "semibold"
365
- | 600
366
- | "medium"
367
- | 500
368
- | "light"
369
- | 300
370
- | "thin"
371
- | 200
372
- | "ultraLight"
373
- | 100
374
- | "regular"
375
- | 400;
376
-
377
- type Material = "regular" | "thin" | "thick" | "ultraThin" | "ultraThick";
378
- type FontWidth = "compressed" | "condensed" | "standard" | "expanded" | number;
379
- type Interpolation = "none" | "low" | "medium" | "high";
380
- type Resizable = boolean | "stretch" | "tile";
381
-
382
- type Point = { x?: number; y?: number } | number;
383
- type ScaleEffect =
384
- | { x?: number; y?: number; anchor?: UnitPoint }
385
- | { scale?: number; anchor?: UnitPoint }
386
- | number;
387
- type Font = {
388
- name: string;
389
- size: number;
390
- wght?: number;
391
- wdth?: number;
392
- opsz?: number;
393
- slnt?: number;
394
- ital?: number;
395
-
396
- GRAD?: number;
397
- HGHT?: number;
398
- SOFT?: number;
399
-
400
- monospacedDigit?: boolean;
401
- features?: string[] | string;
402
- };
403
- type Rotation3DEffect = {
404
- angle: number;
405
- x?: number;
406
- y?: number;
407
- z?: number;
408
- anchor?: UnitPoint;
409
- anchorZ?: number;
410
- perspective?: number;
121
+ type TimeValue = {
122
+ date?: Date;
123
+ /** Use `timer` to update once per second. */
124
+ style?: TimeStyle;
411
125
  };
412
- type RotationEffect = { angle: number; anchor: UnitPoint } | number;
413
126
 
414
- type Frame =
415
- | { maxWidth?: Dimension; maxHeight?: Dimension; alignment?: Alignment }
416
- | { width?: number; height?: number; alignment?: Alignment };
417
- type Shadow = {
418
- color?: Color;
419
- x?: number;
420
- y?: number;
421
- blur?: number;
127
+ type SvgValue = {
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;
422
132
  };
423
- type Pattern = "dash" | "dashDot" | "dashDotDot" | "dot" | "solid";
424
- type BlendMode =
425
- | "normal"
426
- | "multiply"
427
- | "screen"
428
- | "overlay"
429
- | "darken"
430
- | "lighten"
431
- | "colorDodge"
432
- | "colorBurn"
433
- | "softLight"
434
- | "hardLight"
435
- | "difference"
436
- | "exclusion"
437
- | "hue"
438
- | "saturation"
439
- | "color"
440
- | "luminosity"
441
- | "sourceAtop"
442
- | "destinationOver"
443
- | "destinationOut"
444
- | "plusDarker"
445
- | "plusLighter";
446
-
447
- type ButtonStyle =
448
- | "automatic"
449
- | "bordered"
450
- | "borderedProminent"
451
- | "borderless"
452
- | "plain"
453
- | CustomButtonStyle;
454
133
 
455
- type CustomButtonStyle = {
456
- press: NativeView;
457
- normal: NativeView;
134
+ type SpacerValue = {
135
+ minLength?: number;
458
136
  };
459
137
 
460
- type LineHeight =
461
- | number
462
- | [type: "multiple" | "leading", value: number]
463
- | "loose"
464
- | "normal"
465
- | "tight"
466
- | "variable";
467
-
468
- type BaseMods = {
469
- animation?: NativeAnimation | number | "";
470
- aspectRatio?: AspectRatio;
471
- background?:
472
- | ShapeStyle
473
- | NativeView
474
- | { alignment: Alignment; content: NativeView };
475
- baselineOffset?: number;
476
- blendMode?: BlendMode;
477
- blur?: number | { blur: number; opaque: boolean };
478
- brightness?: number;
479
- buttonStyle?: ButtonStyle;
480
- clipped?: boolean;
481
- clipShape?: NativeView | "";
482
- colorInvert?: boolean;
483
- colorMultiply?: Color;
484
- compositingGroup?: boolean;
485
- contentShape?: NativeView | "";
486
- contentTransition?: ContentTransition;
487
- contrast?: number;
488
- cornerRadius?: number;
489
- debug?: boolean;
490
- disable?: boolean;
491
- drawingGroup?: boolean;
492
- fixedSize?: boolean | { horizontal?: boolean; vertical?: boolean };
493
- font?: Font | "";
494
- fontDesign?: FontDesign | "";
495
- fontSize?: number;
496
- fontWeight?: FontWeight | "";
497
- fontWidth?: FontWidth | "";
498
- foreground?: ShapeStyle;
499
- frame?: Frame;
500
- geometryGroup?: boolean;
501
- grayscale?: number;
502
- height?: number;
503
- hidden?: boolean;
504
- hueRotation?: number;
505
- ignoresSafeArea?: boolean;
506
- italic?: boolean;
507
- kerning?: number;
508
- layoutPriority?: number;
509
- lineLimit?: number | "";
510
- lineSpacing?: number;
511
- lineHeight?: LineHeight | "";
512
- luminanceToAlpha?: boolean;
513
- mask?: NativeView;
514
- maxHeight?: Dimension | boolean;
515
- maxSides?: Dimension | boolean;
516
- maxWidth?: Dimension | boolean;
517
- minimumScaleFactor?: number;
518
- monospaced?: boolean;
519
- monospacedDigit?: boolean;
520
- offset?: Point;
521
- offsetX?: number;
522
- offsetY?: number;
523
- opacity?: number;
524
- overlay?:
525
- | ShapeStyle
526
- | NativeView
527
- | { alignment: Alignment; content: NativeView };
528
- padding?: Padding | boolean;
529
- pixelPerfectCenter?: boolean | Point;
530
- position?: Point;
531
- reverseMask?: NativeView;
532
- rotation3DEffect?: Rotation3DEffect;
533
- rotationEffect?: RotationEffect;
534
- saturation?: number;
535
- scaleEffect?: ScaleEffect;
536
- shadow?: Shadow;
537
- sides?: number;
538
- strikethrough?: boolean | { isActive?: boolean; color?: Color };
539
- test?: unknown;
540
- textAlignment?: TextAlignment;
541
- tint?: ShapeStyle;
542
- tracking?: number;
543
- transform?: [number, number, number, number, number, number];
544
- transition?: Transition;
545
- truncationMode?: "head" | "middle" | "tail";
546
- underline?:
547
- | boolean
548
- | { isActive?: boolean; pattern?: Pattern; color?: Color };
549
- width?: number;
550
- zIndex?: number;
138
+ type GifValue = {
139
+ size: Size;
140
+ duration: GifDuration;
551
141
  };
552
142
 
553
143
  type Mods = {
554
- [K in keyof BaseMods]?: BaseMods[K];
144
+ [K in keyof BaseMods]?: BaseMods[K];
555
145
  } & {
556
- [K in keyof BaseMods as `${K & string}_${string}`]?: BaseMods[K];
146
+ [K in keyof BaseMods as `${K & string}_${string}`]?: BaseMods[K];
557
147
  };
558
148
 
559
- type ObjectToTuple<T> = {
560
- [K in keyof T]: [K, T[K]];
561
- }[keyof T];
562
-
563
- type ModTuple = ObjectToTuple<BaseMods>;
149
+ type BaseMods = {
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;
233
+ };