@await-widget/runtime 0.0.14 → 0.0.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@await-widget/runtime",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "TypeScript declarations for Await widgets.",
5
5
  "license": "MIT",
6
6
  "author": "LitoMore",
package/types/bridge.d.ts CHANGED
@@ -48,6 +48,7 @@ export declare const AwaitWeather: {
48
48
  };
49
49
  export declare const AwaitHealth: {
50
50
  get(): Promise<AwaitHealthInfo | undefined>;
51
+ get(config: AwaitHealthConfig): Promise<AwaitHealthRangeInfo | undefined>;
51
52
  };
52
53
  export declare const AwaitLocation: {
53
54
  get(config?: AwaitLocationConfig): Promise<AwaitLocationInfo | undefined>;
@@ -118,7 +119,7 @@ export declare const AwaitUI: {
118
119
  readonly displayScale: number;
119
120
  haptic(type: string): void;
120
121
  };
121
- type AwaitDefineConfig<Intents, T extends Record<string, unknown>> = {
122
+ type AwaitDefineConfig<T extends Record<string, unknown>, Intents> = {
122
123
  widget: (entry: WidgetEntry<T>) => NativeView;
123
124
  widgetTimeline?: (
124
125
  context: TimelineContext,
@@ -140,10 +141,13 @@ type AwaitDefineResult<Intents> = {
140
141
  ? (...args: IntentArguments) => IntentInfo
141
142
  : never;
142
143
  };
144
+ type AwaitDefineShape = {
145
+ widgetIntents?: Record<string, (...args: any[]) => void>;
146
+ };
143
147
  export declare const Await: {
144
- define<Intents, T extends Record<string, unknown>>(
145
- config: AwaitDefineConfig<Intents, T>,
146
- ): AwaitDefineResult<Intents>;
148
+ define<T extends Record<string, unknown>, Config extends AwaitDefineShape>(
149
+ config: Config & AwaitDefineConfig<T, Config['widgetIntents']>,
150
+ ): AwaitDefineResult<Config['widgetIntents']>;
147
151
  };
148
152
  export declare const AwaitLaunch: {
149
153
  start(bundleId: string): any;
package/types/model.d.ts CHANGED
@@ -117,10 +117,63 @@ type AwaitWeatherResult = {
117
117
  daily: AwaitWeatherDaily[];
118
118
  };
119
119
 
120
+ type AwaitHealthConfig = {
121
+ start: Date;
122
+ end: Date;
123
+ };
124
+
125
+ type AwaitHealthFitnessInfo = {
126
+ activeEnergyBurned?: number;
127
+ activeEnergyBurnedGoal?: number;
128
+ exerciseTime?: number;
129
+ exerciseTimeGoal?: number;
130
+ standHours?: number;
131
+ standHoursGoal?: number;
132
+ };
133
+
134
+ type AwaitHealthQuantitySample = {
135
+ value: number;
136
+ startDate: Date;
137
+ endDate: Date;
138
+ };
139
+
140
+ type AwaitHealthSleepAnalysisValue =
141
+ | 'inBed'
142
+ | 'awake'
143
+ | 'asleepCore'
144
+ | 'asleepDeep'
145
+ | 'asleepREM'
146
+ | 'asleepUnspecified';
147
+
148
+ type AwaitHealthSleepAnalysisSample = {
149
+ value: AwaitHealthSleepAnalysisValue;
150
+ startDate: Date;
151
+ endDate: Date;
152
+ };
153
+
120
154
  type AwaitHealthInfo = {
121
155
  stepCount?: number;
122
156
  distanceWalkingRunning?: number;
123
157
  flightsClimbed?: number;
158
+ fitness?: AwaitHealthFitnessInfo;
159
+ heartRate?: number;
160
+ restingHeartRate?: number;
161
+ oxygenSaturation?: number;
162
+ };
163
+
164
+ type AwaitHealthRangeFitnessInfo = AwaitHealthFitnessInfo & {
165
+ date: Date;
166
+ };
167
+
168
+ type AwaitHealthRangeInfo = {
169
+ stepCount?: AwaitHealthQuantitySample[];
170
+ distanceWalkingRunning?: AwaitHealthQuantitySample[];
171
+ flightsClimbed?: AwaitHealthQuantitySample[];
172
+ fitness?: AwaitHealthRangeFitnessInfo[];
173
+ heartRate?: AwaitHealthQuantitySample[];
174
+ restingHeartRate?: AwaitHealthQuantitySample[];
175
+ oxygenSaturation?: AwaitHealthQuantitySample[];
176
+ sleepAnalysis?: AwaitHealthSleepAnalysisSample[];
124
177
  };
125
178
 
126
179
  type AwaitLocationConfig = {
@@ -188,6 +241,7 @@ type AwaitNowPlayingInfo = {
188
241
 
189
242
  type AwaitMusicPlayerCommand =
190
243
  | 'start'
244
+ | 'stop'
191
245
  | 'toggle'
192
246
  | 'next'
193
247
  | 'previous'
@@ -289,9 +343,14 @@ type AwaitAlarmScheduleConfig = {
289
343
  tint?: Color;
290
344
  };
291
345
 
346
+ type WidgetEntryData<T extends Record<string, unknown>> = Omit<
347
+ T,
348
+ keyof TimelineContext | 'date' | 'colorScheme' | 'renderingMode'
349
+ >;
350
+
292
351
  type WidgetEntry<T extends Record<string, unknown> = Record<string, unknown>> =
293
352
  TimelineContext &
294
- T & {
353
+ WidgetEntryData<T> & {
295
354
  date: Date;
296
355
  colorScheme: ColorScheme;
297
356
  renderingMode: RenderingMode;