@moddable/typings 7.2.0 → 8.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.
@@ -66,8 +66,8 @@ declare module "embedded:storage/files" {
66
66
  status(path: string, options?: DirectoryStatusOptions): Status;
67
67
 
68
68
  createDirectory(path: string): boolean;
69
- createLink(path: string, target: string): void;
70
- readLink(path: string): string;
69
+ createLink?(path: string, target: string): void;
70
+ readLink?(path: string): string;
71
71
 
72
72
  scan(path?: string): IterableIterator<string>;
73
73
  [Symbol.iterator](): IterableIterator<string>;
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) 2026 Satoshi Tanaka
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 "mod/config" {
22
+ var Config: {file: {root: string}} & Record<string, any>;
23
+ export {Config as default};
24
+ }
package/mod/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ // Blank
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "7.2.0",
3
+ "version": "8.0.0",
4
4
  "main": "",
5
5
  "types": [
6
6
  "xs.d.ts",
@@ -85,33 +85,34 @@ declare function clearTimeout(id: number): void;
85
85
  declare const URL: typeof import('url').URL;
86
86
  declare const URLSearchParams: typeof import('url').URLSearchParams;
87
87
  declare const Headers: typeof import('headers').default;
88
- declare const localStorage: import('web/webstorage').default;
88
+ declare const localStorage: import('webstorage').default;
89
89
  declare const WebSocket: typeof import('web/websocket').default;
90
- declare const fetch: typeof import('web/fetch').fetch;
90
+ declare const fetch: typeof import('fetch').fetch;
91
91
 
92
92
  /*
93
93
  Piu
94
94
  */
95
95
 
96
- declare const Application: ApplicationConstructor;
97
- declare const Behavior: BehaviorConstructor;
98
- declare const Column: ColumnConstructor;
99
- declare const Container: ContainerConstructor;
100
- declare const Content: ContentConstructor;
101
- declare const Label: LabelConstructor;
102
- declare const Link: LinkConstructor;
103
- declare const Locals: Locals;
104
- declare const Port: PortConstructor;
105
- declare const Row: RowConstructor;
106
- declare const Skin: SkinConstructor;
107
- declare const Style: StyleConstructor;
108
- declare const Text: TextConstructor;
109
- declare const Texture: TextureConstructor;
110
- declare const Transition: TransitionConstructor;
111
-
112
- declare const InverterConstructor: InverterConstructor;
113
- declare const RoundRect: RoundRectConstructor;
114
- declare const ScreenBufferConstructor: ScreenBufferConstructor;
96
+ type Application = import("piu/MC-types").Application;
97
+ type Behavior = import("piu/MC-types").Behavior;
98
+ type Column = import("piu/MC-types").Column;
99
+ type Container = import("piu/MC-types").Container;
100
+ type Content = import("piu/MC-types").Content;
101
+ type ContentDictionary = import("piu/MC-types").ContentDictionary;
102
+ type Label = import("piu/MC-types").Label;
103
+ type Link = import("piu/MC-types").Link;
104
+ type Locals = import("piu/MC-types").Locals;
105
+ type Port = import("piu/MC-types").Port;
106
+ type Row = import("piu/MC-types").Row;
107
+ type Skin = import("piu/MC-types").Skin;
108
+ type Style = import("piu/MC-types").Style;
109
+ type Text = import("piu/MC-types").Text;
110
+ type Texture = import("piu/MC-types").Texture;
111
+ type Transition = import("piu/MC-types").Transition;
112
+
113
+ declare const Inverter: InverterConstructor;
114
+ declare const RonndRect: RoundRectConstructor;
115
+ declare const ScreenBuffer: ScreenBufferConstructor;
115
116
  declare const SVGImage: SVGImageConsructor;
116
117
 
117
118
  /*
package/pebble/piu.d.ts CHANGED
@@ -25,6 +25,7 @@
25
25
  interface SVGImageDictionary extends ContentDictionary {
26
26
  clip?: boolean;
27
27
  id?: number;
28
+ path?: string;
28
29
  }
29
30
 
30
31
  interface SVGImage extends Content {
@@ -46,6 +47,7 @@ interface SVGImage extends Content {
46
47
  interface SVGImageConsructor {
47
48
  new(behaviorData?: any, dictionary?: SVGImageDictionary): SVGImage;
48
49
  template<T>(this: T, fn: (arg: any) => SVGImageDictionary): T;
50
+ (behaviorData?: any, dictionary?: SVGImageDictionary): SVGImage;
49
51
  }
50
52
 
51
53
  /*
@@ -65,6 +67,7 @@ interface RoundRect extends Content {
65
67
  interface RoundRectConstructor {
66
68
  new(behaviorData?: any, dictionary?: RoundRectDictionary): RoundRect;
67
69
  template<T>(this: T, fn: (arg: any) => RoundRectDictionary): T;
70
+ (behaviorData?: any, dictionary?: RoundRectDictionary): RoundRect;
68
71
 
69
72
  readonly topLeft: 1;
70
73
  readonly topRight: 2;
package/piu/MC-types.d.ts CHANGED
@@ -18,387 +18,387 @@
18
18
  *
19
19
  */
20
20
 
21
- /* type aliases */
22
- type Coordinates = {
23
- top?: number;
24
- right?: number;
25
- bottom?: number;
26
- left?: number;
27
- };
28
- type Position = {
29
- x?: number;
30
- y?: number;
31
- };
32
- type Size = {
33
- width?: number;
34
- height?: number;
35
- };
36
- type Bounds = Position & Size;
37
- type Color = string;
38
- type ContentState = {
39
- state?: number;
40
- variant?: number;
41
- };
42
- type TimeProperty = {
43
- time?: number;
44
- duration?: number;
45
- fraction?: number;
46
- interval?: number;
47
- loop?: boolean;
48
- };
49
- type TouchProperty = {
50
- active?: boolean;
51
- backgroundTouch?: boolean;
52
- exclusiveTouch?: boolean;
53
- multipleTouch?: boolean;
54
- };
55
-
56
- // TODO: more accurate constructor parameters
57
- type TemplateStyle<P, C extends new (...args: any) => any> = {
58
- new (dictionary?: P): InstanceType<C>;
59
- template: TemplateStyleFactory<C>;
60
- };
61
- type TemplateStyleFactory<T extends new (...args: any) => any> = (
62
- param: ConstructorParameters<T>[0]
63
- ) => TemplateStyle<Partial<ConstructorParameters<T>[1]>, T>;
64
-
65
- type TemplateComponent<P, C extends new (...args: any) => any> = {
66
- new (behaviorData?: any, dictionary?: P): InstanceType<C>;
67
- template: TemplateComponentFactory<C>;
68
- };
69
- type TemplateComponentFactory<T extends new (...args: any) => any> = (
70
- func: (param: any) => ConstructorParameters<T>[1]
71
- ) => TemplateComponent<Parameters<typeof func>[0], T>;
72
-
73
- interface Behavior<T extends Content = Content>{
74
- onCreate?(content: T, data: object, context: any): void;
75
- onDisplaying?(content: T): void;
76
- onFinished?(content: T): void;
77
- onTimeChanged?(content: T): void;
78
- onTouchBegan?(content: T, id: number, x: number, y: number, ticks: number): void;
79
- onTouchCancelled?(content: T, id: number): void;
80
- onTouchended?( content: T, id: number, x: number, y: number, ticks: number): void;
81
- onTouchMoved?( content: T, id: number, x: number, y: number, ticks: number): void;
82
- // TODO: complete callbacks
83
- }
84
-
85
- interface BehaviorConstructor<T extends Content = Content> {
86
- new(): Behavior<T>;
87
- }
88
-
89
- interface Content {
90
- // TODO: consider type parameter to avoid any
91
- adjust(x: number, y: number): void;
92
- bubble(id: string, ...extras: any[]): void;
93
- captureTouch(id: string, x: number, y: number, ticks: number): void;
94
- defer(id: string, ...extras: any[]): void;
95
- delegate(id: string, ...extras: any[]): void;
96
- distribute(id: string, ...extras: any[]): void;
97
- focus(): void;
98
- hit(x: number, y: number): Content | undefined;
99
- measure(): Size;
100
- moveBy(x: number, y: number): void;
101
- render(): void;
102
- sizeBy(width: number, height: number): void;
103
- start(): void;
104
- stop(): void;
105
-
106
- readonly previous: Content | null;
107
- readonly next: Content | null;
108
- readonly container: Container | null;
109
- readonly index: number;
110
- name: string;
111
- active: boolean;
112
- anchor: string;
113
- behavior: object;
114
- coordinates: Coordinates;
115
- bounds: Bounds;
116
- backgroundTouch: boolean;
117
- exclusiveTouch: boolean;
118
- multipleTouch: boolean;
119
-
120
- time: number;
121
- duration: number;
122
- fraction: number;
123
- interval: number;
124
- loop: boolean;
125
- running: boolean;
126
- offset: undefined | Position;
127
- position: undefined | Position;
128
- size: Size;
129
- state: number;
130
- variant: number;
131
- skin: Skin | null;
132
- style: Style | null;
133
- visible: boolean;
134
- x: number;
135
- y: number;
136
- width: number;
137
- height: number;
138
- }
139
- interface ContentDictionary
140
- extends Coordinates,
141
- Size,
142
- ContentState,
143
- TimeProperty,
144
- TouchProperty {
145
- name?: string;
146
- anchor?: string;
147
- Behavior?: BehaviorConstructor;
148
- skin?: Skin | SkinDictionary;
149
- Skin?: SkinConstructor;
150
- style?: Style | StyleDictionary;
151
- Style?: StyleConstructor;
152
- visible?: boolean;
153
- }
154
- interface ContentConstructor {
155
- new(behaviorData?: any, dictionary?: ContentDictionary): Content;
156
- (behaviorData?: any, dictionary?: ContentDictionary): Content;
157
- readonly prototype: Content;
158
-
159
- template: TemplateComponentFactory<ContentConstructor>;
160
- }
161
-
162
- interface Style {
163
- measure(string: string): Size;
164
- }
165
- interface StyleDictionaryBase {
166
- color?: Color | Color[];
167
- font?: string;
168
- horizontal?: string;
169
- top?: number;
170
- }
171
- interface StyleConstructor {
172
- new(dictionary: StyleDictionary): Style;
173
-
174
- template<T>(this: T, dictionary: StyleDictionary): T;
175
- }
176
-
177
- interface TextStyleDictionary extends StyleDictionaryBase {
178
- leading?: number;
179
- right?: number;
180
- bottom?: number;
181
- left?: number;
182
- }
183
- interface LabelStyleDictionary extends StyleDictionaryBase {
184
- vertical?: string;
185
- }
186
- type StyleDictionary = LabelStyleDictionary | TextStyleDictionary;
187
-
188
- interface Texture {
189
- readonly height: number;
190
- readonly width: number;
191
- }
192
- interface TextureDictionary {
193
- path: string;
194
- }
195
- interface TextureConstructor {
196
- new(path: string): Texture;
197
- new(dictionary: TextureDictionary): Texture;
198
- readonly prototype: Texture;
199
-
200
- template: TemplateStyleFactory<TextureConstructor>;
201
- }
202
-
203
- interface Skin {
204
- borders: Coordinates;
205
- fill: Color | Color[];
206
- stroke: Color | Color[];
207
- texture: Texture;
208
- color: Color;
209
- bounds: Bounds;
210
- height: number;
211
- width: number;
212
- states?: number;
213
- variants?: number;
214
- tiles?: Coordinates;
215
- top?: number;
216
- right?: number;
217
- bottom?: number;
218
- left?: number;
219
- }
220
- interface SkinConstructor {
221
- new(dictionary: SkinDictionary): Skin;
222
- readonly prototype: Skin;
223
-
224
- template: TemplateStyleFactory<SkinConstructor>;
225
- }
226
-
227
- interface TextureSkinDictionary extends Coordinates, Bounds {
228
- texture?: Texture | TextureDictionary;
229
- Texture?: TextureConstructor;
230
- color?: Color | Color[];
231
- states?: number;
232
- variants?: number;
233
- tiles?: Coordinates;
234
- }
235
- interface ColorSkinDictionary {
236
- borders?: Coordinates;
237
- fill?: Color | Color[];
238
- stroke?: Color | Color[];
239
- }
240
- type SkinDictionary = ColorSkinDictionary | TextureSkinDictionary;
241
-
242
- interface Transition {
243
- onBegin(container: Container, ...extras: any[]): void;
244
- onEnd(container: Container, ...extras: any[]): void;
245
- onStep(fraction: number): void;
246
- duration?: number;
247
- }
248
- interface TransitionConstructor {
249
- new(duration: number, interpolator?: (value: number) => number, first?: any, last?: any): Transition
250
- }
251
-
252
- interface Container extends Content {
253
- clip: boolean;
254
- readonly first: Content | null;
255
- readonly last: Content | null;
256
- readonly length: number;
257
- readonly transitioning: boolean;
258
- add(content: Content): void;
259
- content(at: number | string): Content | undefined;
260
- empty(start?: number, stop?: number): void;
261
- firstThat(id: string, ...extras: any[]): void;
262
- insert(content: Content, before: Content): void;
263
- lastThat(id: string, ...extras: any[]): void;
264
- remove(content: Content): void;
265
- replace(content: Content, by: Content): void;
266
- run(transition: Transition, ...extras: any[]): void;
267
- swap(content0: Content, content1: Content): void;
268
- onTransitionBeginning(container: Container): void;
269
- onTransitionEnded(container: Container): void;
270
- }
271
- interface ContainerDictionary extends ContentDictionary {
272
- clip?: boolean;
273
- contents?: Content[];
274
- }
275
- interface ContainerConstructor {
276
- new(behaviorData?: any, dictionary?: ContainerDictionary): Container;
277
- (behaviorData?: any, dictionary?: ContainerDictionary): Container;
278
-
279
- template<T>(this: T, fn: (arg: any) => ContainerDictionary): T;
280
- }
281
-
282
- interface Label extends Content {
283
- string: string;
284
- }
285
- interface LabelDictionary extends ContentDictionary {
286
- string?: string;
287
- }
288
- interface LabelConstructor {
289
- new(behaviorData?: any, dictionary?: LabelDictionary): Label;
290
- (behaviorData?: any, dictionary?: LabelDictionary): Label;
291
-
292
- template<T>(this: T, fn: (arg: any) => LabelDictionary): T;
293
- }
294
-
295
- interface Port extends Content {
296
- drawContent(
297
- x: number,
298
- y: number,
299
- width: number,
300
- height: number
301
- ): void;
302
- drawLabel(
303
- string: string,
304
- x: number,
305
- y: number,
306
- width: number,
307
- height: number
308
- ): void;
309
- drawSkin(
310
- skin: Skin,
311
- x: number,
312
- y: number,
313
- width: number,
314
- height: number,
315
- variant?: number,
316
- state?: number
317
- ): void;
318
- drawString(
319
- string: string,
320
- style: Style,
321
- color: Color,
322
- x: number,
323
- y: number,
324
- width: number,
325
- height: number
326
- ): void;
327
- drawStyle(
328
- string: string,
329
- style: Style,
330
- x: number,
331
- y: number,
332
- width: number,
333
- height: number,
334
- ellipsis?: boolean,
335
- state?: number
336
- ): void;
337
- drawTexture(
338
- texture: Texture,
339
- color: Color,
340
- x: number,
341
- y: number,
342
- sx: number,
343
- sy: number,
344
- sw: number,
345
- sh: number
346
- ): void;
347
- fillColor(
348
- color: Color,
349
- x: number,
350
- y: number,
351
- width: number,
352
- height: number
353
- ): void;
354
- fillTexture(
355
- texture: Texture,
356
- color: Color,
357
- x: number,
358
- y: number,
359
- width: number,
360
- height: number,
361
- sx?: number,
362
- sy?: number,
363
- sw?: number,
364
- sh?: number
365
- ): void;
366
- invalidate(
367
- x?: number,
368
- y?: number,
369
- width?: number,
370
- height?: number
371
- ): void;
372
- measureString(string: string, style: Style): Size;
373
- popClip(): void;
374
- pushClip(
375
- x?: number,
376
- y?: number,
377
- width?: number,
378
- height?: number
379
- ): void;
380
- onDraw(
381
- port: Port,
382
- x: number,
383
- y: number,
384
- width: number,
385
- height: number
386
- ): void;
387
- }
388
- interface PortConstructor extends ContentConstructor {
389
- }
390
-
391
- interface TextBlock {
392
- behavior?: object | null;
393
- style?: Style | null;
394
- spans: (string | TextSpan)[] | string,
395
- }
396
-
397
- interface TextSpan extends TextBlock {
398
- link?: any
399
- }
400
-
401
- interface Text extends Content {
21
+ /* type aliases */
22
+ export type Coordinates = {
23
+ top?: number;
24
+ right?: number;
25
+ bottom?: number;
26
+ left?: number;
27
+ };
28
+ export type Position = {
29
+ x?: number;
30
+ y?: number;
31
+ };
32
+ export type Size = {
33
+ width?: number;
34
+ height?: number;
35
+ };
36
+ export type Bounds = Position & Size;
37
+ export type Color = string;
38
+ export type ContentState = {
39
+ state?: number;
40
+ variant?: number;
41
+ };
42
+ export type TimeProperty = {
43
+ time?: number;
44
+ duration?: number;
45
+ fraction?: number;
46
+ interval?: number;
47
+ loop?: boolean;
48
+ };
49
+ export type TouchProperty = {
50
+ active?: boolean;
51
+ backgroundTouch?: boolean;
52
+ exclusiveTouch?: boolean;
53
+ multipleTouch?: boolean;
54
+ };
55
+
56
+ // TODO: more accurate constructor parameters
57
+ export type TemplateStyle<P, C extends new (...args: any) => any> = {
58
+ new (dictionary?: P): InstanceType<C>;
59
+ template: TemplateStyleFactory<C>;
60
+ };
61
+ export type TemplateStyleFactory<T extends new (...args: any) => any> = (
62
+ param: ConstructorParameters<T>[0]
63
+ ) => TemplateStyle<Partial<ConstructorParameters<T>[1]>, T>;
64
+
65
+ export type TemplateComponent<P, C extends new (...args: any) => any> = {
66
+ new (behaviorData?: any, dictionary?: P): InstanceType<C>;
67
+ template: TemplateComponentFactory<C>;
68
+ };
69
+ export type TemplateComponentFactory<T extends new (...args: any) => any> = (
70
+ func: (param: any) => ConstructorParameters<T>[1]
71
+ ) => TemplateComponent<Parameters<typeof func>[0], T>;
72
+
73
+ export interface Behavior<T extends Content = Content> {
74
+ onCreate?(content: T, data: object, context: any): void;
75
+ onDisplaying?(content: T): void;
76
+ onFinished?(content: T): void;
77
+ onTimeChanged?(content: T): void;
78
+ onTouchBegan?(content: T, id: number, x: number, y: number, ticks: number): void;
79
+ onTouchCancelled?(content: T, id: number): void;
80
+ onTouchended?(content: T, id: number, x: number, y: number, ticks: number): void;
81
+ onTouchMoved?(content: T, id: number, x: number, y: number, ticks: number): void;
82
+ // TODO: complete callbacks
83
+ }
84
+
85
+ export interface BehaviorConstructor<T extends Content = Content> {
86
+ new(): Behavior<T>;
87
+ }
88
+
89
+ export interface Content {
90
+ // TODO: consider type parameter to avoid any
91
+ adjust(x: number, y: number): void;
92
+ bubble(id: string, ...extras: any[]): void;
93
+ captureTouch(id: string, x: number, y: number, ticks: number): void;
94
+ defer(id: string, ...extras: any[]): void;
95
+ delegate(id: string, ...extras: any[]): void;
96
+ distribute(id: string, ...extras: any[]): void;
97
+ focus(): void;
98
+ hit(x: number, y: number): Content | undefined;
99
+ measure(): Size;
100
+ moveBy(x: number, y: number): void;
101
+ render(): void;
102
+ sizeBy(width: number, height: number): void;
103
+ start(): void;
104
+ stop(): void;
105
+
106
+ readonly previous: Content | null;
107
+ readonly next: Content | null;
108
+ readonly container: Container | null;
109
+ readonly index: number;
110
+ name: string;
111
+ active: boolean;
112
+ anchor: string;
113
+ behavior: object;
114
+ coordinates: Coordinates;
115
+ bounds: Bounds;
116
+ backgroundTouch: boolean;
117
+ exclusiveTouch: boolean;
118
+ multipleTouch: boolean;
119
+
120
+ time: number;
121
+ duration: number;
122
+ fraction: number;
123
+ interval: number;
124
+ loop: boolean;
125
+ running: boolean;
126
+ offset: undefined | Position;
127
+ position: undefined | Position;
128
+ size: Size;
129
+ state: number;
130
+ variant: number;
131
+ skin: Skin | null;
132
+ style: Style | null;
133
+ visible: boolean;
134
+ x: number;
135
+ y: number;
136
+ width: number;
137
+ height: number;
138
+ }
139
+ export interface ContentDictionary
140
+ extends Coordinates,
141
+ Size,
142
+ ContentState,
143
+ TimeProperty,
144
+ TouchProperty {
145
+ name?: string;
146
+ anchor?: string;
147
+ Behavior?: BehaviorConstructor;
148
+ skin?: Skin | SkinDictionary;
149
+ Skin?: SkinConstructor;
150
+ style?: Style | StyleDictionary;
151
+ Style?: StyleConstructor;
152
+ visible?: boolean;
153
+ }
154
+ export interface ContentConstructor {
155
+ new(behaviorData?: any, dictionary?: ContentDictionary): Content;
156
+ (behaviorData?: any, dictionary?: ContentDictionary): Content;
157
+ readonly prototype: Content;
158
+
159
+ template: TemplateComponentFactory<ContentConstructor>;
160
+ }
161
+
162
+ export interface Style {
163
+ measure(string: string): Size;
164
+ }
165
+ export interface StyleDictionaryBase {
166
+ color?: Color | Color[];
167
+ font?: string;
168
+ horizontal?: string;
169
+ top?: number;
170
+ }
171
+ export interface StyleConstructor {
172
+ new(dictionary: StyleDictionary): Style;
173
+
174
+ template<T>(this: T, dictionary: StyleDictionary): T;
175
+ }
176
+
177
+ export interface TextStyleDictionary extends StyleDictionaryBase {
178
+ leading?: number;
179
+ right?: number;
180
+ bottom?: number;
181
+ left?: number;
182
+ }
183
+ export interface LabelStyleDictionary extends StyleDictionaryBase {
184
+ vertical?: string;
185
+ }
186
+ export type StyleDictionary = LabelStyleDictionary | TextStyleDictionary;
187
+
188
+ export interface Texture {
189
+ readonly height: number;
190
+ readonly width: number;
191
+ }
192
+ export interface TextureDictionary {
193
+ path: string;
194
+ }
195
+ export interface TextureConstructor {
196
+ new(path: string): Texture;
197
+ new(dictionary: TextureDictionary): Texture;
198
+ readonly prototype: Texture;
199
+
200
+ template: TemplateStyleFactory<TextureConstructor>;
201
+ }
202
+
203
+ export interface Skin {
204
+ borders: Coordinates;
205
+ fill: Color | Color[];
206
+ stroke: Color | Color[];
207
+ texture: Texture;
208
+ color: Color;
209
+ bounds: Bounds;
210
+ height: number;
211
+ width: number;
212
+ states?: number;
213
+ variants?: number;
214
+ tiles?: Coordinates;
215
+ top?: number;
216
+ right?: number;
217
+ bottom?: number;
218
+ left?: number;
219
+ }
220
+ export interface SkinConstructor {
221
+ new(dictionary: SkinDictionary): Skin;
222
+ readonly prototype: Skin;
223
+
224
+ template: TemplateStyleFactory<SkinConstructor>;
225
+ }
226
+
227
+ export interface TextureSkinDictionary extends Coordinates, Bounds {
228
+ texture?: Texture | TextureDictionary;
229
+ Texture?: TextureConstructor;
230
+ color?: Color | Color[];
231
+ states?: number;
232
+ variants?: number;
233
+ tiles?: Coordinates;
234
+ }
235
+ export interface ColorSkinDictionary {
236
+ borders?: Coordinates;
237
+ fill?: Color | Color[];
238
+ stroke?: Color | Color[];
239
+ }
240
+ export type SkinDictionary = ColorSkinDictionary | TextureSkinDictionary;
241
+
242
+ export interface Transition {
243
+ onBegin(container: Container, ...extras: any[]): void;
244
+ onEnd(container: Container, ...extras: any[]): void;
245
+ onStep(fraction: number): void;
246
+ duration?: number;
247
+ }
248
+ export interface TransitionConstructor {
249
+ new(duration: number, interpolator?: (value: number) => number, first?: any, last?: any): Transition
250
+ }
251
+
252
+ export interface Container extends Content {
253
+ clip: boolean;
254
+ readonly first: Content | null;
255
+ readonly last: Content | null;
256
+ readonly length: number;
257
+ readonly transitioning: boolean;
258
+ add(content: Content): void;
259
+ content(at: number | string): Content | undefined;
260
+ empty(start?: number, stop?: number): void;
261
+ firstThat(id: string, ...extras: any[]): void;
262
+ insert(content: Content, before: Content): void;
263
+ lastThat(id: string, ...extras: any[]): void;
264
+ remove(content: Content): void;
265
+ replace(content: Content, by: Content): void;
266
+ run(transition: Transition, ...extras: any[]): void;
267
+ swap(content0: Content, content1: Content): void;
268
+ onTransitionBeginning(container: Container): void;
269
+ onTransitionEnded(container: Container): void;
270
+ }
271
+ export interface ContainerDictionary extends ContentDictionary {
272
+ clip?: boolean;
273
+ contents?: Content[];
274
+ }
275
+ export interface ContainerConstructor {
276
+ new(behaviorData?: any, dictionary?: ContainerDictionary): Container;
277
+ (behaviorData?: any, dictionary?: ContainerDictionary): Container;
278
+
279
+ template<T>(this: T, fn: (arg: any) => ContainerDictionary): T;
280
+ }
281
+
282
+ export interface Label extends Content {
283
+ string: string;
284
+ }
285
+ export interface LabelDictionary extends ContentDictionary {
286
+ string?: string;
287
+ }
288
+ export interface LabelConstructor {
289
+ new(behaviorData?: any, dictionary?: LabelDictionary): Label;
290
+ (behaviorData?: any, dictionary?: LabelDictionary): Label;
291
+
292
+ template<T>(this: T, fn: (arg: any) => LabelDictionary): T;
293
+ }
294
+
295
+ export interface Port extends Content {
296
+ drawContent(
297
+ x: number,
298
+ y: number,
299
+ width: number,
300
+ height: number
301
+ ): void;
302
+ drawLabel(
303
+ string: string,
304
+ x: number,
305
+ y: number,
306
+ width: number,
307
+ height: number
308
+ ): void;
309
+ drawSkin(
310
+ skin: Skin,
311
+ x: number,
312
+ y: number,
313
+ width: number,
314
+ height: number,
315
+ variant?: number,
316
+ state?: number
317
+ ): void;
318
+ drawString(
319
+ string: string,
320
+ style: Style,
321
+ color: Color,
322
+ x: number,
323
+ y: number,
324
+ width: number,
325
+ height: number
326
+ ): void;
327
+ drawStyle(
328
+ string: string,
329
+ style: Style,
330
+ x: number,
331
+ y: number,
332
+ width: number,
333
+ height: number,
334
+ ellipsis?: boolean,
335
+ state?: number
336
+ ): void;
337
+ drawTexture(
338
+ texture: Texture,
339
+ color: Color,
340
+ x: number,
341
+ y: number,
342
+ sx: number,
343
+ sy: number,
344
+ sw: number,
345
+ sh: number
346
+ ): void;
347
+ fillColor(
348
+ color: Color,
349
+ x: number,
350
+ y: number,
351
+ width: number,
352
+ height: number
353
+ ): void;
354
+ fillTexture(
355
+ texture: Texture,
356
+ color: Color,
357
+ x: number,
358
+ y: number,
359
+ width: number,
360
+ height: number,
361
+ sx?: number,
362
+ sy?: number,
363
+ sw?: number,
364
+ sh?: number
365
+ ): void;
366
+ invalidate(
367
+ x?: number,
368
+ y?: number,
369
+ width?: number,
370
+ height?: number
371
+ ): void;
372
+ measureString(string: string, style: Style): Size;
373
+ popClip(): void;
374
+ pushClip(
375
+ x?: number,
376
+ y?: number,
377
+ width?: number,
378
+ height?: number
379
+ ): void;
380
+ onDraw(
381
+ port: Port,
382
+ x: number,
383
+ y: number,
384
+ width: number,
385
+ height: number
386
+ ): void;
387
+ }
388
+ export interface PortConstructor extends ContentConstructor {
389
+ }
390
+
391
+ export interface TextBlock {
392
+ behavior?: object | null;
393
+ style?: Style | null;
394
+ spans: (string | TextSpan)[] | string,
395
+ }
396
+
397
+ export interface TextSpan extends TextBlock {
398
+ link?: any
399
+ }
400
+
401
+ export interface Text extends Content {
402
402
  blocks: TextBlock[],
403
403
  string: string;
404
404
  begin(): void;
@@ -409,63 +409,63 @@ interface Text extends Content {
409
409
  endBlock(): void;
410
410
  endSpan(): void;
411
411
  }
412
- interface TextDictionary extends ContentDictionary {
412
+ export interface TextDictionary extends ContentDictionary {
413
413
  blocks?: TextBlock[],
414
414
  string?: string;
415
415
  }
416
- interface TextConstructor {
416
+ export interface TextConstructor {
417
417
  new(behaviorData?: any, dictionary?: TextDictionary): Text;
418
418
  (behaviorData?: any, dictionary?: TextDictionary): Text;
419
419
 
420
420
  template<T>(this: T, fn: (arg: any) => TextDictionary): T;
421
421
  }
422
422
 
423
- interface Application extends Container {
423
+ export interface Application extends Container {
424
424
  displayListLength: number;
425
425
  commandListLength: number;
426
426
  touchCount: number;
427
427
  }
428
- interface ApplicationDictionary extends ContainerDictionary {
428
+ export interface ApplicationDictionary extends ContainerDictionary {
429
429
  displayListLength?: number;
430
430
  commandListLength?: number;
431
431
  touchCount?: number;
432
432
  pixels?: number;
433
433
  }
434
- interface ApplicationConstructor {
434
+ export interface ApplicationConstructor {
435
435
  new(behaviorData?: any, dictionary?: ApplicationDictionary): Application;
436
436
 
437
437
  template<T>(this: T, fn: (arg: any) => ApplicationDictionary): T;
438
438
  }
439
439
 
440
- interface Column extends Container {
440
+ export interface Column extends Container {
441
441
  }
442
- interface ColumnConstructor extends ContainerConstructor {
442
+ export interface ColumnConstructor extends ContainerConstructor {
443
443
  }
444
444
 
445
- interface Layout extends Container {
445
+ export interface Layout extends Container {
446
446
  onFitHorizontally(layout: Layout, width: number): void;
447
447
  onFitVertically(layout: Layout, height: number): void;
448
448
  onMeasureHorizontally(layout: Layout, width: number): void;
449
449
  onMeasureVertically(layout: Layout, height: number): void;
450
450
  }
451
- interface LayoutConstructor extends ContainerConstructor {
451
+ export interface LayoutConstructor extends ContainerConstructor {
452
452
  }
453
453
 
454
- interface Image extends Content {
454
+ export interface Image extends Content {
455
455
  readonly frameCount: never;
456
456
  frameIndex: number;
457
457
  }
458
- interface ImageDictionary extends ContentDictionary {
458
+ export interface ImageDictionary extends ContentDictionary {
459
459
  path: string;
460
460
  }
461
- interface ImageConstructor {
461
+ export interface ImageConstructor {
462
462
  new(behaviorData?: any, dictionary?: ImageDictionary): Image;
463
463
  (behaviorData?: any, dictionary?: ImageDictionary): Image;
464
464
 
465
465
  template<T>(this: T, fn: (arg: any) => ImageDictionary): T;
466
466
  }
467
467
 
468
- interface Die extends Layout {
468
+ export interface Die extends Layout {
469
469
  set(x: number, y: number, width: number, height: number): Die;
470
470
  sub(x: number, y: number, width: number, height: number): Die;
471
471
  and(x: number, y: number, width: number, height: number): Die;
@@ -477,15 +477,15 @@ interface Die extends Layout {
477
477
  attach(content: Content): void;
478
478
  detach(): void;
479
479
  }
480
- interface DieConstructor extends LayoutConstructor {
480
+ export interface DieConstructor extends LayoutConstructor {
481
481
  }
482
482
 
483
- interface Row extends Container {
483
+ export interface Row extends Container {
484
484
  }
485
- interface RowConstructor extends ContainerConstructor {
485
+ export interface RowConstructor extends ContainerConstructor {
486
486
  }
487
487
 
488
- interface Scroller extends Container {
488
+ export interface Scroller extends Container {
489
489
  readonly constraint: Position;
490
490
  loop: boolean;
491
491
  scroll: Position;
@@ -495,49 +495,52 @@ interface Scroller extends Container {
495
495
  scrollTo(x: number, y: number): void;
496
496
  onScrolled(scroller: Scroller): void;
497
497
  }
498
- interface ScrollerDictionary extends ContainerDictionary {
498
+ export interface ScrollerDictionary extends ContainerDictionary {
499
499
  loop?: boolean;
500
500
  }
501
- interface ScrollerConstructor {
501
+ export interface ScrollerConstructor {
502
502
  new(behaviorData?: any, dictionary?: ScrollerDictionary): Scroller;
503
503
  (behaviorData?: any, dictionary?: ScrollerDictionary): Scroller;
504
504
 
505
505
  template<T>(this: T, fn: (arg: any) => ScrollerDictionary): T;
506
506
  }
507
507
 
508
- interface LinkDictionary {
508
+ export interface LinkDictionary {
509
509
  Behavior?: BehaviorConstructor;
510
510
  }
511
- interface Link {
511
+ export interface Link {
512
512
  readonly container: Container;
513
513
  state: number;
514
514
  captureTouch(id: number, x: number, y: number, ticks: number): void;
515
515
  }
516
- interface LinkConstructor {
516
+ export interface LinkConstructor {
517
517
  new(behaviorData?: any, dictionary?: LinkDictionary): Link;
518
518
  (behaviorData?: any, dictionary?: LinkDictionary): Link;
519
519
 
520
520
  template<T>(this: T, fn: (arg: any) => LinkDictionary): T;
521
521
  }
522
522
 
523
- interface Locals {
523
+ export interface Locals {
524
524
  new(name?: string, language?: string): Locals
525
525
  language: string;
526
526
  get(textToLocalize: string): string
527
527
  }
528
528
 
529
- interface blendColors {
529
+ export interface blendColors {
530
530
  (a: number, c1: number, c2: number): Color
531
531
  }
532
- interface hsl {
532
+ export interface hsl {
533
533
  (h: number, s: number, l: number): Color
534
534
  }
535
- interface hsla {
535
+ export interface hsla {
536
536
  (h: number, s: number, l: number, a: number): Color
537
537
  }
538
- interface rgb {
538
+ export interface rgb {
539
539
  (r: number, g: number, b: number): Color
540
540
  }
541
- interface rgba {
541
+ export interface rgba {
542
542
  (r: number, g: number, b: number, a: number): Color
543
543
  }
544
+
545
+
546
+ export {};
package/piu/MC.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2025 Shinya Ishikawa
2
+ * Copyright (c) 2020-2026 Shinya Ishikawa
3
3
  *
4
4
  * This file is part of the Moddable SDK Tools.
5
5
  *
@@ -18,111 +18,37 @@
18
18
  *
19
19
  */
20
20
 
21
- /// <reference path="./MC-types.d.ts" />
22
-
23
21
  declare module "piu/MC" {
24
22
  import {} from "commodetto/Poco"; // for global screen
23
+ import type * as MC from "piu/MC-types";
25
24
 
26
25
  global {
27
- const Skin: SkinConstructor
28
- const Texture: TextureConstructor
29
- const Style: StyleConstructor
30
- const Behavior: BehaviorConstructor
31
- const Content: ContentConstructor
32
- const Container: ContainerConstructor
33
- const Application: ApplicationConstructor
34
- const Scroller: ScrollerConstructor
35
- const Row: RowConstructor
36
- const Column: ColumnConstructor
37
- const Layout: LayoutConstructor
38
- const Image: ImageConstructor
39
- const Die: DieConstructor
40
- const Port: PortConstructor
41
- const Label: LabelConstructor
42
- const Transition: TransitionConstructor
43
- const Text: TextConstructor
44
- const Link: LinkConstructor
45
- const application: Application
46
- const Locals: Locals
47
- const blendColors: blendColors
48
- const hsl: hsl
49
- const hsla: hsla
50
- const rgb: rgb
51
- const rgba: rgba
26
+ const Skin: MC.SkinConstructor
27
+ const Texture: MC.TextureConstructor
28
+ const Style: MC.StyleConstructor
29
+ const Behavior: MC.BehaviorConstructor
30
+ const Content: MC.ContentConstructor
31
+ const Container: MC.ContainerConstructor
32
+ const Application: MC.ApplicationConstructor
33
+ const Scroller: MC.ScrollerConstructor
34
+ const Row: MC.RowConstructor
35
+ const Column: MC.ColumnConstructor
36
+ const Layout: MC.LayoutConstructor
37
+ const Image: MC.ImageConstructor
38
+ const Die: MC.DieConstructor
39
+ const Port: MC.PortConstructor
40
+ const Label: MC.LabelConstructor
41
+ const Transition: MC.TransitionConstructor
42
+ const Text: MC.TextConstructor
43
+ const Link: MC.LinkConstructor
44
+ const application: MC.Application
45
+ const Locals: MC.Locals
46
+ const blendColors: MC.blendColors
47
+ const hsl: MC.hsl
48
+ const hsla: MC.hsla
49
+ const rgb: MC.rgb
50
+ const rgba: MC.rgba
52
51
  }
53
52
 
54
- export {
55
- Coordinates,
56
- Position,
57
- Size,
58
- Bounds,
59
- Color,
60
- ContentState,
61
- TimeProperty,
62
- TouchProperty,
63
- TemplateStyle,
64
- TemplateStyleFactory,
65
- TemplateComponent,
66
- TemplateComponentFactory,
67
- Behavior,
68
- BehaviorConstructor,
69
- Content,
70
- ContentDictionary,
71
- ContentConstructor,
72
- Style,
73
- StyleDictionaryBase,
74
- StyleConstructor,
75
- TextStyleDictionary,
76
- LabelStyleDictionary,
77
- StyleDictionary,
78
- Texture,
79
- TextureDictionary,
80
- TextureConstructor,
81
- Skin,
82
- SkinConstructor,
83
- TextureSkinDictionary,
84
- ColorSkinDictionary,
85
- SkinDictionary,
86
- Transition,
87
- TransitionConstructor,
88
- Container,
89
- ContainerDictionary,
90
- ContainerConstructor,
91
- Label,
92
- LabelDictionary,
93
- LabelConstructor,
94
- Port,
95
- PortConstructor,
96
- TextBlock,
97
- TextSpan,
98
- Text,
99
- TextDictionary,
100
- TextConstructor,
101
- Application,
102
- ApplicationDictionary,
103
- ApplicationConstructor,
104
- Column,
105
- ColumnConstructor,
106
- Layout,
107
- LayoutConstructor,
108
- Image,
109
- ImageDictionary,
110
- ImageConstructor,
111
- Die,
112
- DieConstructor,
113
- Row,
114
- RowConstructor,
115
- Scroller,
116
- ScrollerDictionary,
117
- ScrollerConstructor,
118
- LinkDictionary,
119
- Link,
120
- LinkConstructor,
121
- Locals,
122
- blendColors,
123
- hsl,
124
- hsla,
125
- rgb,
126
- rgba,
127
- }
53
+ export * from "piu/MC-types";
128
54
  }
package/web/fetch.d.ts CHANGED
@@ -1,4 +1,24 @@
1
- declare module "web/fetch" {
1
+ /*
2
+ * Copyright (c) 2025-2026 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 "fetch" {
2
22
  import {URL, URLSearchParams} from "url"
3
23
  import Headers from "headers"
4
24
 
@@ -1,3 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 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
+
1
21
  declare module "web/websocket" {
2
22
  import Headers from "headers"
3
23
 
@@ -1,11 +1,33 @@
1
- declare class WebStorage {
2
- constructor(kvp: any);
3
- get length(): number;
4
- key(index: number): string | null;
5
- getItem(key: string): string | null;
6
- setItem(key: string, value: string): void;
7
- remove(key: string): void;
8
- clear(): void;
9
- }
1
+ /*
2
+ * Copyright (c) 2025-2026 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 "webstorage" {
22
+ class WebStorage {
23
+ constructor(kvp: any);
24
+ get length(): number;
25
+ key(index: number): string | null;
26
+ getItem(key: string): string | null;
27
+ setItem(key: string, value: string): void;
28
+ remove(key: string): void;
29
+ clear(): void;
30
+ }
10
31
 
11
- export default WebStorage;
32
+ export default WebStorage;
33
+ }