@await-widget/runtime 0.0.1
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 +54 -0
- package/ambient.d.ts +203 -0
- package/global.d.ts +1 -0
- package/index.d.ts +7 -0
- package/jsx-runtime.d.ts +1 -0
- package/package.json +63 -0
- package/runtime/await.d.ts +192 -0
- package/runtime/bridge.d.ts +187 -0
- package/runtime/jsx-runtime.d.ts +1 -0
- package/types/global.d.ts +281 -0
- package/types/jsx.d.ts +4 -0
- package/types/prop.d.ts +569 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
type AwaitNetworkResponse = {
|
|
2
|
+
code: number;
|
|
3
|
+
data: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function setTimeout(
|
|
6
|
+
callback: (...args: unknown[]) => void,
|
|
7
|
+
ms: number,
|
|
8
|
+
): unknown;
|
|
9
|
+
export declare function clearTimeout(timerID: unknown): void;
|
|
10
|
+
export declare function setInterval(
|
|
11
|
+
callback: (...args: unknown[]) => void,
|
|
12
|
+
ms: number,
|
|
13
|
+
): unknown;
|
|
14
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
15
|
+
export declare function clearInterval(timerID: unknown): void;
|
|
16
|
+
export declare function print(...args: unknown[]): void;
|
|
17
|
+
export declare const console: {
|
|
18
|
+
log(...args: unknown[]): void;
|
|
19
|
+
};
|
|
20
|
+
export declare const AwaitClipboard: {
|
|
21
|
+
set(value: string): void;
|
|
22
|
+
};
|
|
23
|
+
type AwaitNetworkConfig = {
|
|
24
|
+
method?: string;
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
body?: Encodable;
|
|
27
|
+
};
|
|
28
|
+
type AwaitFoufouConfig = {
|
|
29
|
+
method?: string;
|
|
30
|
+
image?: string;
|
|
31
|
+
oauthToken?: string;
|
|
32
|
+
oauthTokenSecret?: string;
|
|
33
|
+
parameters?: Record<string, string | number | boolean>;
|
|
34
|
+
};
|
|
35
|
+
export declare const AwaitNetwork: {
|
|
36
|
+
request(
|
|
37
|
+
urlString: string,
|
|
38
|
+
config?: AwaitNetworkConfig,
|
|
39
|
+
): Promise<AwaitNetworkResponse>;
|
|
40
|
+
fanfou(urlString: string, config?: AwaitFoufouConfig): Promise<unknown>;
|
|
41
|
+
};
|
|
42
|
+
export declare const AwaitWeather: {
|
|
43
|
+
get(config?: AwaitWeatherConfig): Promise<AwaitWeatherResult | undefined>;
|
|
44
|
+
};
|
|
45
|
+
export declare const AwaitHealth: {
|
|
46
|
+
get(): Promise<AwaitHealthInfo | undefined>;
|
|
47
|
+
};
|
|
48
|
+
export declare const AwaitLocation: {
|
|
49
|
+
get(config?: AwaitLocationConfig): Promise<AwaitLocationInfo | undefined>;
|
|
50
|
+
};
|
|
51
|
+
export declare const AwaitCalendar: {
|
|
52
|
+
get(config?: AwaitCalendarConfig): Promise<AwaitCalendarItem[] | undefined>;
|
|
53
|
+
};
|
|
54
|
+
export declare const AwaitReminder: {
|
|
55
|
+
get(config?: AwaitReminderConfig): Promise<AwaitReminderItem[] | undefined>;
|
|
56
|
+
};
|
|
57
|
+
export declare const AwaitSystem: {
|
|
58
|
+
get(): AwaitSystemInfo;
|
|
59
|
+
};
|
|
60
|
+
export declare const AwaitAlarm: {
|
|
61
|
+
schedule(config: AwaitAlarmScheduleConfig): Promise<string>;
|
|
62
|
+
cancel(id: string): any;
|
|
63
|
+
};
|
|
64
|
+
export declare const AwaitMedia: {
|
|
65
|
+
nowPlayingMedia(config?: AwaitNowPlayingConfig): Promise<AwaitNowPlayingInfo>;
|
|
66
|
+
mediaPlayerCommand(
|
|
67
|
+
command: AwaitMusicPlayerCommand,
|
|
68
|
+
config?: AwaitMediaPlayConfig,
|
|
69
|
+
): Promise<void>;
|
|
70
|
+
};
|
|
71
|
+
export declare const AwaitStore: {
|
|
72
|
+
get<T>(key: string): T | undefined;
|
|
73
|
+
num(key: string, defaultValue?: number): number;
|
|
74
|
+
bool(key: string, defaultValue?: boolean): boolean;
|
|
75
|
+
string(key: string, defaultValue?: string): string;
|
|
76
|
+
array<T>(key: string, defaultValue?: T[]): T[];
|
|
77
|
+
delete(key: string): void;
|
|
78
|
+
set(key: string, value: Encodable): void;
|
|
79
|
+
};
|
|
80
|
+
export declare const AwaitFile: {
|
|
81
|
+
files(path: string): string[];
|
|
82
|
+
readJSON(path: string): unknown;
|
|
83
|
+
readText(path: string): string | undefined;
|
|
84
|
+
fileSize(path: string): number | undefined;
|
|
85
|
+
readTextByPage(
|
|
86
|
+
path: string,
|
|
87
|
+
page: number,
|
|
88
|
+
pageSize: number,
|
|
89
|
+
): string | undefined;
|
|
90
|
+
readTextByPages(
|
|
91
|
+
path: string,
|
|
92
|
+
pages: number[],
|
|
93
|
+
pageSize: number,
|
|
94
|
+
): Array<string | undefined>;
|
|
95
|
+
saveUIRenderImage(path: string, value: NativeView): void;
|
|
96
|
+
};
|
|
97
|
+
export declare const AwaitAudio: {
|
|
98
|
+
readonly isPlayingNote: boolean;
|
|
99
|
+
setAudioSession(active: boolean, option?: AudioOption): void;
|
|
100
|
+
reinstallInstruments(): void;
|
|
101
|
+
playAudio(url: string, config?: AudioConfig): void;
|
|
102
|
+
pauseAudio(): void;
|
|
103
|
+
playMidi(url: string, config?: AudioConfig): void;
|
|
104
|
+
stopMidi(): void;
|
|
105
|
+
replayMidi(config?: AudioConfig): void;
|
|
106
|
+
recordMidi(): void;
|
|
107
|
+
buildSoundFont(config: SoundFontBuildConfig): Promise<SoundFontBuildResult>;
|
|
108
|
+
compressSoundFont(
|
|
109
|
+
config: SoundFontCompressConfig,
|
|
110
|
+
): Promise<SoundFontBuildResult>;
|
|
111
|
+
playNote(notes: number[] | number, config?: AudioConfig): void;
|
|
112
|
+
};
|
|
113
|
+
export declare const AwaitUI: {
|
|
114
|
+
readonly displayScale: number;
|
|
115
|
+
haptic(type: string): void;
|
|
116
|
+
};
|
|
117
|
+
type AwaitDefineConfig<Intents, T extends Record<string, unknown>> = {
|
|
118
|
+
widget: (entry: WidgetEntry<T>) => NativeView;
|
|
119
|
+
widgetTimeline?: (
|
|
120
|
+
context: TimelineContext,
|
|
121
|
+
) => Timeline<T> | Promise<Timeline<T>>;
|
|
122
|
+
widgetIntents?: {
|
|
123
|
+
[IntentKey in keyof Intents]: Intents[IntentKey] extends (
|
|
124
|
+
...args: infer IntentArguments
|
|
125
|
+
) => void
|
|
126
|
+
? IntentArguments extends Encodable[]
|
|
127
|
+
? Intents[IntentKey]
|
|
128
|
+
: never
|
|
129
|
+
: never;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
type AwaitDefineResult<Intents> = {
|
|
133
|
+
[IntentKey in keyof Intents]: Intents[IntentKey] extends (
|
|
134
|
+
...args: infer IntentArguments
|
|
135
|
+
) => void
|
|
136
|
+
? (...args: IntentArguments) => IntentInfo
|
|
137
|
+
: never;
|
|
138
|
+
};
|
|
139
|
+
export declare const Await: {
|
|
140
|
+
define<Intents, T extends Record<string, unknown>>(
|
|
141
|
+
config: AwaitDefineConfig<Intents, T>,
|
|
142
|
+
): AwaitDefineResult<Intents>;
|
|
143
|
+
};
|
|
144
|
+
export declare const AwaitEnv: {
|
|
145
|
+
readonly id: string;
|
|
146
|
+
readonly tag: number;
|
|
147
|
+
readonly host: "app" | "widget";
|
|
148
|
+
test(...args: unknown[]): unknown;
|
|
149
|
+
};
|
|
150
|
+
type AwaitGlobal = typeof Await;
|
|
151
|
+
type AwaitEnvGlobal = typeof AwaitEnv;
|
|
152
|
+
type AwaitUIGlobal = typeof AwaitUI;
|
|
153
|
+
type AwaitClipboardGlobal = typeof AwaitClipboard;
|
|
154
|
+
type AwaitNetworkGlobal = typeof AwaitNetwork;
|
|
155
|
+
type AwaitWeatherGlobal = typeof AwaitWeather;
|
|
156
|
+
type AwaitHealthGlobal = typeof AwaitHealth;
|
|
157
|
+
type AwaitLocationGlobal = typeof AwaitLocation;
|
|
158
|
+
type AwaitCalendarGlobal = typeof AwaitCalendar;
|
|
159
|
+
type AwaitReminderGlobal = typeof AwaitReminder;
|
|
160
|
+
type AwaitSystemGlobal = typeof AwaitSystem;
|
|
161
|
+
type AwaitAlarmGlobal = typeof AwaitAlarm;
|
|
162
|
+
type AwaitMediaGlobal = typeof AwaitMedia;
|
|
163
|
+
type AwaitStoreGlobal = typeof AwaitStore;
|
|
164
|
+
type AwaitFileGlobal = typeof AwaitFile;
|
|
165
|
+
type AwaitAudioGlobal = typeof AwaitAudio;
|
|
166
|
+
type SleepGlobal = typeof sleep;
|
|
167
|
+
declare global {
|
|
168
|
+
const Await: AwaitGlobal;
|
|
169
|
+
const AwaitEnv: AwaitEnvGlobal;
|
|
170
|
+
const AwaitUI: AwaitUIGlobal;
|
|
171
|
+
const AwaitClipboard: AwaitClipboardGlobal;
|
|
172
|
+
const AwaitNetwork: AwaitNetworkGlobal;
|
|
173
|
+
const AwaitWeather: AwaitWeatherGlobal;
|
|
174
|
+
const AwaitHealth: AwaitHealthGlobal;
|
|
175
|
+
const AwaitLocation: AwaitLocationGlobal;
|
|
176
|
+
const AwaitCalendar: AwaitCalendarGlobal;
|
|
177
|
+
const AwaitReminder: AwaitReminderGlobal;
|
|
178
|
+
const AwaitSystem: AwaitSystemGlobal;
|
|
179
|
+
const AwaitAlarm: AwaitAlarmGlobal;
|
|
180
|
+
const AwaitMedia: AwaitMediaGlobal;
|
|
181
|
+
const AwaitStore: AwaitStoreGlobal;
|
|
182
|
+
const AwaitFile: AwaitFileGlobal;
|
|
183
|
+
const AwaitAudio: AwaitAudioGlobal;
|
|
184
|
+
function print(...args: unknown[]): void;
|
|
185
|
+
const sleep: SleepGlobal;
|
|
186
|
+
}
|
|
187
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { jsx, jsx as jsxs, Fragment } from "await";
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
type Encodable =
|
|
2
|
+
| string
|
|
3
|
+
| number
|
|
4
|
+
| boolean
|
|
5
|
+
| undefined
|
|
6
|
+
| Encodable[]
|
|
7
|
+
| { [key: string]: Encodable };
|
|
8
|
+
type AudioOption = "mix" | "duckOthers" | "solo";
|
|
9
|
+
type ColorScheme = "light" | "dark";
|
|
10
|
+
type RenderingMode = "fullColor" | "accented" | "vibrant";
|
|
11
|
+
type TemplateRenderingMode = "original" | "template";
|
|
12
|
+
type Update = Date | "end" | "never";
|
|
13
|
+
type WidgetFamily =
|
|
14
|
+
| "small"
|
|
15
|
+
| "medium"
|
|
16
|
+
| "large"
|
|
17
|
+
| "extraLarge"
|
|
18
|
+
| "extraLargePortrait"
|
|
19
|
+
| "accessoryInline"
|
|
20
|
+
| "accessoryCircular"
|
|
21
|
+
| "accessoryRectangular"
|
|
22
|
+
| "unknown";
|
|
23
|
+
type Size = { width: number; height: number };
|
|
24
|
+
|
|
25
|
+
type SingleNativeView =
|
|
26
|
+
| {
|
|
27
|
+
kind: string;
|
|
28
|
+
flat?: unknown[];
|
|
29
|
+
children?: NativeView;
|
|
30
|
+
}
|
|
31
|
+
| string
|
|
32
|
+
| number
|
|
33
|
+
| undefined;
|
|
34
|
+
type NativeView = SingleNativeView | NativeView[];
|
|
35
|
+
|
|
36
|
+
type IntentInfo = {
|
|
37
|
+
name: string;
|
|
38
|
+
args: Encodable[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type AudioConfig = {
|
|
42
|
+
soundFont?: string;
|
|
43
|
+
volume?: number;
|
|
44
|
+
duration?: number;
|
|
45
|
+
delay?: number;
|
|
46
|
+
velocity?: number;
|
|
47
|
+
preset?: number;
|
|
48
|
+
bank?: number;
|
|
49
|
+
loop?: boolean;
|
|
50
|
+
audioOption?: AudioOption;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type SoundFontManualMapping = {
|
|
54
|
+
path: string;
|
|
55
|
+
key: number;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type SoundFontBuildConfig = {
|
|
59
|
+
savePath: string;
|
|
60
|
+
dataSizeLimitMB?: number;
|
|
61
|
+
mediaFiles?: string[];
|
|
62
|
+
mappings?: SoundFontManualMapping[];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type SoundFontCompressConfig = {
|
|
66
|
+
fromPath: string;
|
|
67
|
+
savePath: string;
|
|
68
|
+
dataSizeLimitMB?: number;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type SoundFontBuildResult = {
|
|
72
|
+
ok: true;
|
|
73
|
+
output: string;
|
|
74
|
+
resolvedOutput: string;
|
|
75
|
+
sizeBytes: number;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type AwaitWeatherConfig = {
|
|
79
|
+
latitude?: number;
|
|
80
|
+
longitude?: number;
|
|
81
|
+
hourlyLimit?: number;
|
|
82
|
+
dailyLimit?: number;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
type AwaitWeatherCurrent = {
|
|
86
|
+
date: string;
|
|
87
|
+
condition: string;
|
|
88
|
+
symbolName: string;
|
|
89
|
+
temperatureCelsius: number;
|
|
90
|
+
apparentTemperatureCelsius: number;
|
|
91
|
+
humidity: number;
|
|
92
|
+
uvIndex: number;
|
|
93
|
+
windSpeedMetersPerSecond: number;
|
|
94
|
+
windDirectionDegrees: number;
|
|
95
|
+
pressureHectopascals: number;
|
|
96
|
+
visibilityKilometers: number;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
type AwaitWeatherHourly = {
|
|
100
|
+
date: string;
|
|
101
|
+
condition: string;
|
|
102
|
+
symbolName: string;
|
|
103
|
+
temperatureCelsius: number;
|
|
104
|
+
humidity: number;
|
|
105
|
+
uvIndex: number;
|
|
106
|
+
windSpeedMetersPerSecond: number;
|
|
107
|
+
precipitationChance: number;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
type AwaitWeatherDaily = {
|
|
111
|
+
date: string;
|
|
112
|
+
condition: string;
|
|
113
|
+
symbolName: string;
|
|
114
|
+
highTemperatureCelsius: number;
|
|
115
|
+
lowTemperatureCelsius: number;
|
|
116
|
+
precipitationChance: number;
|
|
117
|
+
uvIndex: number;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
type AwaitWeatherResult = {
|
|
121
|
+
location: { latitude: number; longitude: number };
|
|
122
|
+
current: AwaitWeatherCurrent;
|
|
123
|
+
hourly: AwaitWeatherHourly[];
|
|
124
|
+
daily: AwaitWeatherDaily[];
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
type AwaitHealthInfo = {
|
|
128
|
+
stepCount?: number;
|
|
129
|
+
distanceWalkingRunning?: number;
|
|
130
|
+
flightsClimbed?: number;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
type AwaitLocationConfig = {
|
|
134
|
+
desiredAccuracyMeters?: number;
|
|
135
|
+
timeoutSeconds?: number;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
type AwaitLocationInfo = {
|
|
139
|
+
latitude: number;
|
|
140
|
+
longitude: number;
|
|
141
|
+
date: Date;
|
|
142
|
+
altitudeMeters?: number;
|
|
143
|
+
speedMetersPerSecond?: number;
|
|
144
|
+
courseDegrees?: number;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
type AwaitNowPlayingConfig = {
|
|
148
|
+
artworkSize?: number;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
type AwaitNowPlayingInfo = {
|
|
152
|
+
state?:
|
|
153
|
+
| "playing"
|
|
154
|
+
| "paused"
|
|
155
|
+
| "stopped"
|
|
156
|
+
| "interrupted"
|
|
157
|
+
| "seekingForward"
|
|
158
|
+
| "seekingBackward";
|
|
159
|
+
sourceConfig?: AwaitMediaPlayConfig;
|
|
160
|
+
id?: string;
|
|
161
|
+
title?: string;
|
|
162
|
+
artistName?: string;
|
|
163
|
+
albumTitle?: string;
|
|
164
|
+
artworkURL?: string;
|
|
165
|
+
maximumWidth?: number;
|
|
166
|
+
maximumHeight?: number;
|
|
167
|
+
backgroundColor?: Color;
|
|
168
|
+
primaryTextColor?: Color;
|
|
169
|
+
secondaryTextColor?: Color;
|
|
170
|
+
tertiaryTextColor?: Color;
|
|
171
|
+
quaternaryTextColor?: Color;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
type AwaitMusicPlayerCommand = "start" | "toggle" | "next" | "previous";
|
|
175
|
+
|
|
176
|
+
type AwaitMediaPlayConfig =
|
|
177
|
+
| {
|
|
178
|
+
source: "song";
|
|
179
|
+
id?: string;
|
|
180
|
+
query?: string;
|
|
181
|
+
limit?: number;
|
|
182
|
+
shuffle?: boolean;
|
|
183
|
+
loop?: boolean;
|
|
184
|
+
offset?: number;
|
|
185
|
+
}
|
|
186
|
+
| {
|
|
187
|
+
source: "album";
|
|
188
|
+
id?: string;
|
|
189
|
+
query?: string;
|
|
190
|
+
shuffle?: boolean;
|
|
191
|
+
loop?: boolean;
|
|
192
|
+
}
|
|
193
|
+
| {
|
|
194
|
+
source: "station";
|
|
195
|
+
query?: string;
|
|
196
|
+
type?: "discovery" | "user";
|
|
197
|
+
id?: string;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
type AwaitCalendarConfig = {
|
|
201
|
+
start?: Date;
|
|
202
|
+
end?: Date;
|
|
203
|
+
limit?: number;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
type AwaitCalendarItem = {
|
|
207
|
+
calendarTitle: string;
|
|
208
|
+
title: string;
|
|
209
|
+
startDate: Date;
|
|
210
|
+
endDate: Date;
|
|
211
|
+
isAllDay: boolean;
|
|
212
|
+
location?: string;
|
|
213
|
+
notes?: string;
|
|
214
|
+
url?: string;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
type AwaitReminderConfig = {
|
|
218
|
+
type?: "all" | "incomplete" | "completed";
|
|
219
|
+
limit?: number;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
type AwaitReminderItem = {
|
|
223
|
+
calendarTitle: string;
|
|
224
|
+
title: string;
|
|
225
|
+
notes?: string;
|
|
226
|
+
isCompleted: boolean;
|
|
227
|
+
priority: number;
|
|
228
|
+
startDate?: Date;
|
|
229
|
+
dueDate?: Date;
|
|
230
|
+
completionDate?: Date;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
type AwaitSystemInfo = {
|
|
234
|
+
battery: {
|
|
235
|
+
state: "charging" | "full" | "unplugged" | "unknown";
|
|
236
|
+
percent: number;
|
|
237
|
+
lowPowerMode: boolean;
|
|
238
|
+
};
|
|
239
|
+
memory?: {
|
|
240
|
+
used: number;
|
|
241
|
+
free: number;
|
|
242
|
+
total: number;
|
|
243
|
+
percent: number;
|
|
244
|
+
};
|
|
245
|
+
cpu: {
|
|
246
|
+
percent?: number;
|
|
247
|
+
};
|
|
248
|
+
storage?: {
|
|
249
|
+
total: number;
|
|
250
|
+
free: number;
|
|
251
|
+
used: number;
|
|
252
|
+
percent: number;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
type AwaitAlarmScheduleConfig = {
|
|
257
|
+
title?: string;
|
|
258
|
+
duration?: number;
|
|
259
|
+
date?: Date;
|
|
260
|
+
tint?: Color;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
type WidgetEntry<T extends Record<string, unknown> = Record<string, unknown>> =
|
|
264
|
+
{
|
|
265
|
+
colorScheme: ColorScheme;
|
|
266
|
+
renderingMode: RenderingMode;
|
|
267
|
+
size: Size;
|
|
268
|
+
family: WidgetFamily;
|
|
269
|
+
} & {
|
|
270
|
+
date: Date;
|
|
271
|
+
} & T;
|
|
272
|
+
|
|
273
|
+
type TimelineContext = {
|
|
274
|
+
size: Size;
|
|
275
|
+
family: WidgetFamily;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
type Timeline<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
279
|
+
entries: Array<{ date: Date } & T>;
|
|
280
|
+
update?: Update;
|
|
281
|
+
};
|
package/types/jsx.d.ts
ADDED