@moddable/typings 1.0.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.
- package/Resource.d.ts +30 -0
- package/base64.d.ts +27 -0
- package/ble/hidclient.d.ts +95 -0
- package/ble/index.d.ts +1 -0
- package/ble.d.ts +732 -0
- package/commodetto/Bitmap.d.ts +53 -0
- package/commodetto/PixelsOut.d.ts +67 -0
- package/commodetto/Poco.d.ts +104 -0
- package/commodetto/index.d.ts +1 -0
- package/commodetto/outline.d.ts +101 -0
- package/commodetto/parseBMF.d.ts +34 -0
- package/commodetto/parseBMP.d.ts +25 -0
- package/commodetto/parseRLE.d.ts +25 -0
- package/commodetto/readJPEG.d.ts +39 -0
- package/console.d.ts +39 -0
- package/crc.d.ts +35 -0
- package/debug.d.ts +26 -0
- package/deepEqual.d.ts +23 -0
- package/dns/index.d.ts +1 -0
- package/dns/parser.d.ts +37 -0
- package/dns/serializer.d.ts +41 -0
- package/dns/server.d.ts +27 -0
- package/dns.d.ts +55 -0
- package/embedded_io/_common.d.ts +27 -0
- package/embedded_io/analog.d.ts +39 -0
- package/embedded_io/digital.d.ts +65 -0
- package/embedded_io/digitalbank.d.ts +56 -0
- package/embedded_io/i2c.d.ts +44 -0
- package/embedded_io/index.d.ts +1 -0
- package/embedded_io/pulsecount.d.ts +39 -0
- package/embedded_io/pwm.d.ts +38 -0
- package/embedded_io/serial.d.ts +61 -0
- package/embedded_io/smbus.d.ts +43 -0
- package/embedded_io/socket/listener.d.ts +36 -0
- package/embedded_io/socket/tcp.d.ts +51 -0
- package/embedded_io/socket/udp.d.ts +46 -0
- package/embedded_io/spi.d.ts +45 -0
- package/embedded_io/system.d.ts +36 -0
- package/embedded_provider/builtin.d.ts +57 -0
- package/embedded_provider/index.d.ts +1 -0
- package/file.d.ts +67 -0
- package/flash.d.ts +33 -0
- package/global.d.ts +9 -0
- package/hex.d.ts +27 -0
- package/http.d.ts +125 -0
- package/instrumentation.d.ts +60 -0
- package/mc/config.d.ts +24 -0
- package/mc/index.d.ts +1 -0
- package/mcpack.d.ts +41 -0
- package/mdns.d.ts +47 -0
- package/modules.d.ts +28 -0
- package/net.d.ts +67 -0
- package/package.json +14 -0
- package/ping.d.ts +38 -0
- package/pins/analog.d.ts +26 -0
- package/pins/audioin.d.ts +31 -0
- package/pins/audioout.d.ts +85 -0
- package/pins/digital/monitor.d.ts +41 -0
- package/pins/digital.d.ts +46 -0
- package/pins/i2c.d.ts +40 -0
- package/pins/index.d.ts +1 -0
- package/pins/pwm.d.ts +28 -0
- package/pins/rmt.d.ts +48 -0
- package/pins/servo.d.ts +28 -0
- package/pins/smbus.d.ts +47 -0
- package/piu/CombTransition.d.ts +25 -0
- package/piu/MC.d.ts +580 -0
- package/piu/Sound.d.ts +43 -0
- package/piu/Timeline.d.ts +50 -0
- package/piu/WipeTransition.d.ts +25 -0
- package/piu/index.d.ts +1 -0
- package/piu/shape.d.ts +43 -0
- package/preference.d.ts +29 -0
- package/securesocket.d.ts +38 -0
- package/sntp.d.ts +42 -0
- package/socket.d.ts +97 -0
- package/structuredClone.d.ts +23 -0
- package/telnet.d.ts +27 -0
- package/text/decoder.d.ts +46 -0
- package/text/encoder.d.ts +38 -0
- package/text/index.d.ts +1 -0
- package/time.d.ts +31 -0
- package/timer.d.ts +47 -0
- package/uuid.d.ts +24 -0
- package/websocket.d.ts +58 -0
- package/wifi.d.ts +61 -0
- package/worker.d.ts +44 -0
- package/xs.d.ts +89 -0
- package/zip.d.ts +29 -0
package/piu/MC.d.ts
ADDED
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020-21 Shinya Ishikawa
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Tools.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Tools is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Tools is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "piu/MC" {
|
|
22
|
+
/* type aliases */
|
|
23
|
+
type Coordinates = {
|
|
24
|
+
top?: number;
|
|
25
|
+
right?: number;
|
|
26
|
+
bottom?: number;
|
|
27
|
+
left?: number;
|
|
28
|
+
};
|
|
29
|
+
type Position = {
|
|
30
|
+
x?: number;
|
|
31
|
+
y?: number;
|
|
32
|
+
};
|
|
33
|
+
type Size = {
|
|
34
|
+
width?: number;
|
|
35
|
+
height?: number;
|
|
36
|
+
};
|
|
37
|
+
type Bounds = Position & Size;
|
|
38
|
+
type Color = string;
|
|
39
|
+
type ContentState = {
|
|
40
|
+
state?: number;
|
|
41
|
+
variant?: number;
|
|
42
|
+
};
|
|
43
|
+
type TimeProperty = {
|
|
44
|
+
time?: number;
|
|
45
|
+
duration?: number;
|
|
46
|
+
fraction?: number;
|
|
47
|
+
interval?: number;
|
|
48
|
+
loop?: boolean;
|
|
49
|
+
};
|
|
50
|
+
type TouchProperty = {
|
|
51
|
+
active?: boolean;
|
|
52
|
+
backgroundTouch?: boolean;
|
|
53
|
+
exclusiveTouch?: boolean;
|
|
54
|
+
multipleTouch?: boolean;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// TODO: more accurate constructor parameters
|
|
58
|
+
type TemplateStyle<P, C extends new (...args: any) => any> = {
|
|
59
|
+
new (dictionary?: P): InstanceType<C>;
|
|
60
|
+
template: TemplateStyleFactory<C>;
|
|
61
|
+
};
|
|
62
|
+
type TemplateStyleFactory<T extends new (...args: any) => any> = (
|
|
63
|
+
param: ConstructorParameters<T>[0]
|
|
64
|
+
) => TemplateStyle<Partial<ConstructorParameters<T>[1]>, T>;
|
|
65
|
+
|
|
66
|
+
type TemplateComponent<P, C extends new (...args: any) => any> = {
|
|
67
|
+
new (dictionary: P): InstanceType<C>;
|
|
68
|
+
template: TemplateComponentFactory<C>;
|
|
69
|
+
};
|
|
70
|
+
type TemplateComponentFactory<T extends new (...args: any) => any> = (
|
|
71
|
+
func: (param: any) => ConstructorParameters<T>[1]
|
|
72
|
+
) => TemplateComponent<Parameters<typeof func>[0], T>;
|
|
73
|
+
|
|
74
|
+
interface Behavior {}
|
|
75
|
+
|
|
76
|
+
interface BehaviorConstructor {
|
|
77
|
+
new(any): Behavior;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface Content {
|
|
81
|
+
// TODO: consider type parameter to avoid any
|
|
82
|
+
adjust(x: number, y: number): void;
|
|
83
|
+
bubble(id: string, ...extras: any[]): void;
|
|
84
|
+
captureTouch(id: string, x: number, y: number, ticks: number): void;
|
|
85
|
+
defer(id: string, ...extras: any[]): void;
|
|
86
|
+
delegate(id: string, ...extras: any[]): void;
|
|
87
|
+
distribute(id: string, ...extras: any[]): void;
|
|
88
|
+
focus(): void;
|
|
89
|
+
hit(x: number, y: number): Content | undefined;
|
|
90
|
+
measure(): Size;
|
|
91
|
+
moveBy(x: number, y: number): void;
|
|
92
|
+
render(): void;
|
|
93
|
+
sizeBy(width: number, height: number): void;
|
|
94
|
+
start(): void;
|
|
95
|
+
stop(): void;
|
|
96
|
+
onCreate(content: Content, data: object, context: object): void;
|
|
97
|
+
onDisplaying(content: Content): void;
|
|
98
|
+
onFinished(content: Content): void;
|
|
99
|
+
onTimeChanged(content: Content): void;
|
|
100
|
+
onTouchBegan(
|
|
101
|
+
content: Content,
|
|
102
|
+
id: string,
|
|
103
|
+
x: number,
|
|
104
|
+
y: number,
|
|
105
|
+
ticks: number
|
|
106
|
+
): void;
|
|
107
|
+
onTouchCancelled(content: Content, id: string): void;
|
|
108
|
+
onTouchended(
|
|
109
|
+
content: Content,
|
|
110
|
+
id: string,
|
|
111
|
+
x: number,
|
|
112
|
+
y: number,
|
|
113
|
+
ticks: number
|
|
114
|
+
): void;
|
|
115
|
+
onTouchMoved(
|
|
116
|
+
content: Content,
|
|
117
|
+
id: string,
|
|
118
|
+
x: number,
|
|
119
|
+
y: number,
|
|
120
|
+
ticks: number
|
|
121
|
+
): void;
|
|
122
|
+
// TODO: Avoid any
|
|
123
|
+
readonly previous: Content | null;
|
|
124
|
+
readonly next: Content | null;
|
|
125
|
+
readonly container: Container | null;
|
|
126
|
+
readonly index: number;
|
|
127
|
+
name: string;
|
|
128
|
+
active: boolean;
|
|
129
|
+
anchor: string;
|
|
130
|
+
behavior: object;
|
|
131
|
+
coordinates: Coordinates;
|
|
132
|
+
bounds: Bounds;
|
|
133
|
+
backgroundTouch: boolean;
|
|
134
|
+
exclusiveTouch: boolean;
|
|
135
|
+
multipleTouch: boolean;
|
|
136
|
+
|
|
137
|
+
time: number;
|
|
138
|
+
duration: number;
|
|
139
|
+
fraction: number;
|
|
140
|
+
interval: number;
|
|
141
|
+
loop: boolean;
|
|
142
|
+
running: boolean;
|
|
143
|
+
offset: undefined | Position;
|
|
144
|
+
position: undefined | Position;
|
|
145
|
+
size: Size;
|
|
146
|
+
state: number;
|
|
147
|
+
variant: number;
|
|
148
|
+
skin: Skin | null;
|
|
149
|
+
style: Style | null;
|
|
150
|
+
visible: boolean;
|
|
151
|
+
x: number;
|
|
152
|
+
y: number;
|
|
153
|
+
width: number;
|
|
154
|
+
height: number;
|
|
155
|
+
}
|
|
156
|
+
interface ContentDictionary
|
|
157
|
+
extends Coordinates,
|
|
158
|
+
Size,
|
|
159
|
+
ContentState,
|
|
160
|
+
TimeProperty,
|
|
161
|
+
TouchProperty {
|
|
162
|
+
name?: string;
|
|
163
|
+
anchor?: string;
|
|
164
|
+
Behavior?: BehaviorConstructor;
|
|
165
|
+
skin?: Skin | SkinDictionary;
|
|
166
|
+
Skin?: SkinConstructor;
|
|
167
|
+
style?: Style;
|
|
168
|
+
Style?: StyleConstructor;
|
|
169
|
+
visible?: boolean;
|
|
170
|
+
}
|
|
171
|
+
interface ContentConstructor {
|
|
172
|
+
new(behaviorData: any, dictionary: ContentDictionary): Content;
|
|
173
|
+
(behaviorData: any, dictionary: ContentDictionary): Content;
|
|
174
|
+
readonly prototype: Content;
|
|
175
|
+
|
|
176
|
+
template: TemplateComponentFactory<typeof Content>;
|
|
177
|
+
getAll<T>(this: { new (): T }): T[];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface Style {
|
|
181
|
+
measure(string: string): Size;
|
|
182
|
+
}
|
|
183
|
+
interface StyleDictionaryBase {
|
|
184
|
+
color?: Color | Color[];
|
|
185
|
+
font?: string;
|
|
186
|
+
horizontal?: string;
|
|
187
|
+
top?: number;
|
|
188
|
+
}
|
|
189
|
+
interface StyleConstructor {
|
|
190
|
+
new(dictionary: StyleDictionary): Style;
|
|
191
|
+
|
|
192
|
+
template<T>(this: T, any): T;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface TextStyleDictionary extends StyleDictionaryBase {
|
|
196
|
+
leading?: number;
|
|
197
|
+
right?: number;
|
|
198
|
+
bottom?: number;
|
|
199
|
+
left?: number;
|
|
200
|
+
}
|
|
201
|
+
interface LabelStyleDictionary extends StyleDictionaryBase {
|
|
202
|
+
vertical?: string;
|
|
203
|
+
}
|
|
204
|
+
type StyleDictionary = LabelStyleDictionary | TextStyleDictionary;
|
|
205
|
+
|
|
206
|
+
interface Texture {
|
|
207
|
+
readonly height: number;
|
|
208
|
+
readonly width: number;
|
|
209
|
+
}
|
|
210
|
+
interface TextureDictionary {
|
|
211
|
+
path: string;
|
|
212
|
+
}
|
|
213
|
+
interface TextureConstructor {
|
|
214
|
+
new(path: string): Texture;
|
|
215
|
+
new(dictionary: TextureDictionary): Texture;
|
|
216
|
+
readonly prototype: Texture;
|
|
217
|
+
|
|
218
|
+
template: TemplateStyleFactory<typeof Texture>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface Skin {
|
|
222
|
+
borders: Coordinates;
|
|
223
|
+
fill: Color | Color[];
|
|
224
|
+
stroke: Color | Color[];
|
|
225
|
+
texture: Texture;
|
|
226
|
+
color: Color;
|
|
227
|
+
bounds: Bounds;
|
|
228
|
+
height: number;
|
|
229
|
+
width: number;
|
|
230
|
+
states?: number;
|
|
231
|
+
variants?: number;
|
|
232
|
+
tiles?: Coordinates;
|
|
233
|
+
top?: number;
|
|
234
|
+
right?: number;
|
|
235
|
+
bottom?: number;
|
|
236
|
+
left?: number;
|
|
237
|
+
}
|
|
238
|
+
interface SkinConstructor {
|
|
239
|
+
new(dictionary: SkinDictionary): Skin;
|
|
240
|
+
readonly prototype: Skin;
|
|
241
|
+
|
|
242
|
+
template: TemplateStyleFactory<typeof Skin>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
interface TextureSkinDictionary extends Coordinates, Bounds {
|
|
246
|
+
texture?: Texture;
|
|
247
|
+
Texture?: TextureConstructor;
|
|
248
|
+
color?: Color | Color[];
|
|
249
|
+
states?: number;
|
|
250
|
+
variants?: number;
|
|
251
|
+
tiles?: Coordinates;
|
|
252
|
+
}
|
|
253
|
+
interface ColorSkinDictionary {
|
|
254
|
+
borders?: Coordinates;
|
|
255
|
+
fill?: Color | Color[];
|
|
256
|
+
stroke?: Color | Color[];
|
|
257
|
+
}
|
|
258
|
+
type SkinDictionary = ColorSkinDictionary | TextureSkinDictionary;
|
|
259
|
+
|
|
260
|
+
interface Transition {
|
|
261
|
+
onBegin(container: Container, ...extras: any[]): void;
|
|
262
|
+
onEnd(container: Container, ...extras: any[]): void;
|
|
263
|
+
onStep(fraction: number): void;
|
|
264
|
+
duration?: number;
|
|
265
|
+
}
|
|
266
|
+
interface TransitionConstructor {
|
|
267
|
+
new(duration: number, interpolator?: (value: number) => number, first?: any, last?: any): Transition
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface Container extends Content {
|
|
271
|
+
clip: boolean;
|
|
272
|
+
readonly first: Content | null;
|
|
273
|
+
readonly last: Content | null;
|
|
274
|
+
readonly length: number;
|
|
275
|
+
readonly transitioning: boolean;
|
|
276
|
+
add(content: Content): void;
|
|
277
|
+
content(at: number | string): Content | undefined;
|
|
278
|
+
empty(start?: number, stop?: number): void;
|
|
279
|
+
firstThat(id: string, ...extras: any[]): void;
|
|
280
|
+
insert(content: Content, before: Content): void;
|
|
281
|
+
lastThat(id: string, ...extras: any[]): void;
|
|
282
|
+
remove(content: Content): void;
|
|
283
|
+
replace(content: Content, by: Content): void;
|
|
284
|
+
run(transition: Transition, ...extras: any[]): void;
|
|
285
|
+
swap(content0: Content, content1: Content): void;
|
|
286
|
+
onTransitionBeginning(container: Container): void;
|
|
287
|
+
onTransitionEnded(container: Container): void;
|
|
288
|
+
}
|
|
289
|
+
interface ContainerDictionary extends ContentDictionary {
|
|
290
|
+
clip?: boolean;
|
|
291
|
+
contents?: Content[];
|
|
292
|
+
}
|
|
293
|
+
interface ContainerConstructor {
|
|
294
|
+
new(behaviorData: any, dictionary?: ContainerDictionary);
|
|
295
|
+
|
|
296
|
+
template<T>(this: T, any): T;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
interface Label extends Content {
|
|
300
|
+
string: string;
|
|
301
|
+
}
|
|
302
|
+
interface LabelDictionary extends ContentDictionary {
|
|
303
|
+
string?: string;
|
|
304
|
+
}
|
|
305
|
+
interface LabelConstructor {
|
|
306
|
+
new(behaviorData: any, dictionary: LabelDictionary): Label;
|
|
307
|
+
|
|
308
|
+
template<T>(this: T, any): T;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface Port extends Content {
|
|
312
|
+
drawContent(
|
|
313
|
+
x: number,
|
|
314
|
+
y: number,
|
|
315
|
+
width: number,
|
|
316
|
+
height: number
|
|
317
|
+
): void;
|
|
318
|
+
drawLabel(
|
|
319
|
+
string: string,
|
|
320
|
+
x: number,
|
|
321
|
+
y: number,
|
|
322
|
+
width: number,
|
|
323
|
+
height: number
|
|
324
|
+
): void;
|
|
325
|
+
drawSkin(
|
|
326
|
+
skin: Skin,
|
|
327
|
+
x: number,
|
|
328
|
+
y: number,
|
|
329
|
+
width: number,
|
|
330
|
+
height: number,
|
|
331
|
+
variant?: number,
|
|
332
|
+
state?: number
|
|
333
|
+
): void;
|
|
334
|
+
drawString(
|
|
335
|
+
string: string,
|
|
336
|
+
style: Style,
|
|
337
|
+
color: Color,
|
|
338
|
+
x: number,
|
|
339
|
+
y: number,
|
|
340
|
+
width: number,
|
|
341
|
+
height: number
|
|
342
|
+
): void;
|
|
343
|
+
drawStyle(
|
|
344
|
+
string: string,
|
|
345
|
+
style: Style,
|
|
346
|
+
x: number,
|
|
347
|
+
y: number,
|
|
348
|
+
width: number,
|
|
349
|
+
height: number,
|
|
350
|
+
ellipsis?: boolean,
|
|
351
|
+
state?: number
|
|
352
|
+
): void;
|
|
353
|
+
drawTexture(
|
|
354
|
+
texture: Texture,
|
|
355
|
+
color: Color,
|
|
356
|
+
x: number,
|
|
357
|
+
y: number,
|
|
358
|
+
sx: number,
|
|
359
|
+
sy: number,
|
|
360
|
+
sw: number,
|
|
361
|
+
sh: number
|
|
362
|
+
): void;
|
|
363
|
+
fillColor(
|
|
364
|
+
color: Color,
|
|
365
|
+
x: number,
|
|
366
|
+
y: number,
|
|
367
|
+
width: number,
|
|
368
|
+
height: number
|
|
369
|
+
): void;
|
|
370
|
+
fillTexture(
|
|
371
|
+
texture: Texture,
|
|
372
|
+
color: Color,
|
|
373
|
+
x: number,
|
|
374
|
+
y: number,
|
|
375
|
+
width: number,
|
|
376
|
+
height: number,
|
|
377
|
+
sx?: number,
|
|
378
|
+
sy?: number,
|
|
379
|
+
sw?: number,
|
|
380
|
+
sh?: number
|
|
381
|
+
): void;
|
|
382
|
+
invalidate(
|
|
383
|
+
x?: number,
|
|
384
|
+
y?: number,
|
|
385
|
+
width?: number,
|
|
386
|
+
height?: number
|
|
387
|
+
): void;
|
|
388
|
+
measureString(string: string, style: Style): Size;
|
|
389
|
+
popClip(): void;
|
|
390
|
+
pushClip(
|
|
391
|
+
x?: number,
|
|
392
|
+
y?: number,
|
|
393
|
+
width?: number,
|
|
394
|
+
height?: number
|
|
395
|
+
): void;
|
|
396
|
+
onDraw(
|
|
397
|
+
port: Port,
|
|
398
|
+
x: number,
|
|
399
|
+
y: number,
|
|
400
|
+
width: number,
|
|
401
|
+
height: number
|
|
402
|
+
): void;
|
|
403
|
+
}
|
|
404
|
+
interface PortConstructor extends ContentConstructor {
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
interface Text extends Content {
|
|
408
|
+
blocks: {
|
|
409
|
+
behavior: object | null;
|
|
410
|
+
style: Style | null;
|
|
411
|
+
spans: string | string[];
|
|
412
|
+
}[];
|
|
413
|
+
string: string;
|
|
414
|
+
begin(): void;
|
|
415
|
+
beginBlock(style?: Style, behavior?: object): void;
|
|
416
|
+
beginSpan(style: Style, behavior?: object): void;
|
|
417
|
+
concat(string: string): void;
|
|
418
|
+
end(): void;
|
|
419
|
+
endBlock(): void;
|
|
420
|
+
endSpan(): void;
|
|
421
|
+
}
|
|
422
|
+
interface TextDictionary extends ContentDictionary {
|
|
423
|
+
blocks?: {
|
|
424
|
+
behavior?: Behavior;
|
|
425
|
+
style?: Style;
|
|
426
|
+
spans: string | string[];
|
|
427
|
+
}[];
|
|
428
|
+
string: string;
|
|
429
|
+
}
|
|
430
|
+
interface TextConstructor extends ContentConstructor {
|
|
431
|
+
new(behaviorData: any, dictionary: TextDictionary): Text;
|
|
432
|
+
|
|
433
|
+
template<T>(this: T, any): T;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
interface Application extends Container {
|
|
437
|
+
displayListLength: number;
|
|
438
|
+
commandListLength: number;
|
|
439
|
+
touchCount: number;
|
|
440
|
+
}
|
|
441
|
+
interface ApplicationDictionary extends ContainerDictionary {
|
|
442
|
+
displayListLength?: number;
|
|
443
|
+
commandListLength?: number;
|
|
444
|
+
touchCount?: number;
|
|
445
|
+
pixels?: number;
|
|
446
|
+
}
|
|
447
|
+
interface ApplicationConstructor {
|
|
448
|
+
new(behaviorData: any, dictionary: ApplicationDictionary): Application;
|
|
449
|
+
|
|
450
|
+
template<T>(this: T, any): T;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
interface Column extends Container {
|
|
454
|
+
}
|
|
455
|
+
interface ColumnConstructor extends ContainerConstructor {
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
interface Layout extends Container {
|
|
459
|
+
onFitHorizontally(layout: Layout, width: number): void;
|
|
460
|
+
onFitVertically(layout: Layout, height: number): void;
|
|
461
|
+
onMeasureHorizontally(layout: Layout, width: number): void;
|
|
462
|
+
onMeasureVertically(layout: Layout, height: number): void;
|
|
463
|
+
}
|
|
464
|
+
interface LayoutConstructor extends ContainerConstructor {
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
interface Image extends Content {
|
|
468
|
+
readonly frameCount: never;
|
|
469
|
+
frameIndex: number;
|
|
470
|
+
}
|
|
471
|
+
interface ImageDictionary extends ContentDictionary {
|
|
472
|
+
path: string;
|
|
473
|
+
}
|
|
474
|
+
interface ImageConstructor extends ContentConstructor {
|
|
475
|
+
new(behaviorData: any, dictionary: ImageDictionary): Image;
|
|
476
|
+
|
|
477
|
+
template<T>(this: T, any): T;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
interface Die extends Layout {
|
|
481
|
+
set(x: number, y: number, width: number, height: number): Die;
|
|
482
|
+
sub(x: number, y: number, width: number, height: number): Die;
|
|
483
|
+
and(x: number, y: number, width: number, height: number): Die;
|
|
484
|
+
or(x: number, y: number, width: number, height: number): Die;
|
|
485
|
+
xor(x: number, y: number, width: number, height: number): Die;
|
|
486
|
+
fill(): Die;
|
|
487
|
+
empty(): Die;
|
|
488
|
+
cut(): void;
|
|
489
|
+
attach(content: Content): void;
|
|
490
|
+
detach(): void;
|
|
491
|
+
}
|
|
492
|
+
interface DieConstructor extends LayoutConstructor {
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
interface Row extends Container {
|
|
496
|
+
}
|
|
497
|
+
interface RowConstructor extends ContainerConstructor {
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
interface Scroller extends Container {
|
|
501
|
+
readonly constraint: Position;
|
|
502
|
+
loop: boolean;
|
|
503
|
+
scroll: Position;
|
|
504
|
+
tracking: boolean;
|
|
505
|
+
reveal(bounds: Bounds): void;
|
|
506
|
+
scrollBy(dx: number, dy: number): void;
|
|
507
|
+
scrollTo(x: number, y: number): void;
|
|
508
|
+
onScrolled(scroller: Scroller): void;
|
|
509
|
+
}
|
|
510
|
+
interface ScrollerDictionary extends ContainerDictionary {
|
|
511
|
+
loop?: boolean;
|
|
512
|
+
}
|
|
513
|
+
interface ScrollerConstructor extends ContainerConstructor {
|
|
514
|
+
new(behaviorData: any, dictionary: ScrollerDictionary): Scroller;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
interface rgb {
|
|
518
|
+
(r: number, g: number, b: number): Color
|
|
519
|
+
}
|
|
520
|
+
interface rgba {
|
|
521
|
+
(r: number, g: number, b: number, a: number): Color
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
global {
|
|
526
|
+
const Skin: SkinConstructor
|
|
527
|
+
const Texture: TextureConstructor
|
|
528
|
+
const Style: StyleConstructor
|
|
529
|
+
const Behavior: BehaviorConstructor
|
|
530
|
+
const Content: ContentConstructor
|
|
531
|
+
const Container: ContainerConstructor
|
|
532
|
+
const Application: ApplicationConstructor
|
|
533
|
+
const Scroller: ScrollerConstructor
|
|
534
|
+
const Row: RowConstructor
|
|
535
|
+
const Column: ColumnConstructor
|
|
536
|
+
const Layout: LayoutConstructor
|
|
537
|
+
const Die: DieConstructor
|
|
538
|
+
const Port: PortConstructor
|
|
539
|
+
const Label: LabelConstructor
|
|
540
|
+
const Transition: TransitionConstructor
|
|
541
|
+
const Text: TextConstructor
|
|
542
|
+
const rgb: rgb
|
|
543
|
+
const rgba: rgba
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
type PiuInterpolator = (value: number) => number;
|
|
548
|
+
|
|
549
|
+
interface Math {
|
|
550
|
+
backEaseIn: PiuInterpolator,
|
|
551
|
+
backEaseInOut: PiuInterpolator,
|
|
552
|
+
backEaseOut: PiuInterpolator,
|
|
553
|
+
bounceEaseIn: PiuInterpolator,
|
|
554
|
+
bounceEaseInOut: PiuInterpolator,
|
|
555
|
+
bounceEaseOut: PiuInterpolator,
|
|
556
|
+
circularEaseIn: PiuInterpolator,
|
|
557
|
+
circularEaseInOut: PiuInterpolator,
|
|
558
|
+
circularEaseOut: PiuInterpolator,
|
|
559
|
+
cubicEaseIn: PiuInterpolator,
|
|
560
|
+
cubicEaseInOut: PiuInterpolator,
|
|
561
|
+
cubicEaseOut: PiuInterpolator,
|
|
562
|
+
elasticEaseIn: PiuInterpolator,
|
|
563
|
+
elasticEaseInOut: PiuInterpolator,
|
|
564
|
+
elasticEaseOut: PiuInterpolator,
|
|
565
|
+
exponentialEaseIn: PiuInterpolator,
|
|
566
|
+
exponentialEaseInOut: PiuInterpolator,
|
|
567
|
+
exponentialEaseOut: PiuInterpolator,
|
|
568
|
+
quadEaseIn: PiuInterpolator,
|
|
569
|
+
quadEaseInOut: PiuInterpolator,
|
|
570
|
+
quadEaseOut: PiuInterpolator,
|
|
571
|
+
quartEaseIn: PiuInterpolator,
|
|
572
|
+
quartEaseInOut: PiuInterpolator,
|
|
573
|
+
quartEaseOut: PiuInterpolator,
|
|
574
|
+
quintEaseIn: PiuInterpolator,
|
|
575
|
+
quintEaseInOut: PiuInterpolator,
|
|
576
|
+
quintEaseOut: PiuInterpolator,
|
|
577
|
+
sineEaseIn: PiuInterpolator,
|
|
578
|
+
sineEaseInOut: PiuInterpolator,
|
|
579
|
+
sineEaseOut: PiuInterpolator
|
|
580
|
+
}
|
package/piu/Sound.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020 Shinya Ishikawa
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Tools.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Tools is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Tools is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
declare module "piu/Sound" {
|
|
21
|
+
import AudioOut from "pins/audioout"
|
|
22
|
+
class Sound {
|
|
23
|
+
public constructor(dictionary: {
|
|
24
|
+
path: string;
|
|
25
|
+
offset?: number;
|
|
26
|
+
size?: number;
|
|
27
|
+
});
|
|
28
|
+
public constructor(tones: {
|
|
29
|
+
frequency: number,
|
|
30
|
+
samples?: number
|
|
31
|
+
}[]);
|
|
32
|
+
public static callback(index: number): void;
|
|
33
|
+
public static readonly bitsPerSample: number;
|
|
34
|
+
public static readonly numChannels: number;
|
|
35
|
+
public static readonly sampleRate: number;
|
|
36
|
+
public static get volume(): number;
|
|
37
|
+
public static set volume(it: number);
|
|
38
|
+
public static close(): void;
|
|
39
|
+
public static open(stream?: number): AudioOut;
|
|
40
|
+
public play(stream?: number, repeat?: number, callback?: Function): void;
|
|
41
|
+
}
|
|
42
|
+
export { Sound as default }
|
|
43
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020-2021 Shinya Ishikawa
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Tools.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Tools is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Tools is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "piu/Timeline" {
|
|
22
|
+
class Timeline {
|
|
23
|
+
duration: number;
|
|
24
|
+
fraction: number;
|
|
25
|
+
time: number;
|
|
26
|
+
from(
|
|
27
|
+
target: object,
|
|
28
|
+
fromProperties: object,
|
|
29
|
+
duration: number,
|
|
30
|
+
easing?: string,
|
|
31
|
+
delay?: number
|
|
32
|
+
): Timeline;
|
|
33
|
+
on(
|
|
34
|
+
target: object,
|
|
35
|
+
onProperties: object,
|
|
36
|
+
duration: number,
|
|
37
|
+
easing?: number,
|
|
38
|
+
delay?: number
|
|
39
|
+
): Timeline;
|
|
40
|
+
seekTo(time: number): void;
|
|
41
|
+
to(
|
|
42
|
+
target: object,
|
|
43
|
+
fromProperties: object,
|
|
44
|
+
duration: number,
|
|
45
|
+
easing?: string,
|
|
46
|
+
delay?: number
|
|
47
|
+
): Timeline;
|
|
48
|
+
}
|
|
49
|
+
export { Timeline as default }
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020 Moddable Tech, Inc
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Tools.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Tools is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Tools is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "piu/WipeTransition" {
|
|
22
|
+
class WipeTransition extends Transition {
|
|
23
|
+
}
|
|
24
|
+
export { WipeTransition as default }
|
|
25
|
+
}
|
package/piu/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Blank
|