diff --git a/typescript/types/ClockFace.d.ts b/typescript/types/ClockFace.d.ts index 173b83c39..7f906e0d6 100644 --- a/typescript/types/ClockFace.d.ts +++ b/typescript/types/ClockFace.d.ts @@ -1,56 +1,56 @@ declare module ClockFace_ { - export class ClockFace { - constructor(options: Options | Draw); + export class ClockFace { + constructor(options: Options | Draw); - is12Hour: boolean; - paused: boolean; - showDate: boolean; // default true - loadWidgets: boolean; // default true + is12Hour: boolean; + paused: boolean; + showDate: boolean; // default true + loadWidgets: boolean; // default true - start(): void; + start(): void; - tick(): void; - pause(): void; - resume(): void; - remove(): void; - redraw(): void; - } + tick(): void; + pause(): void; + resume(): void; + remove(): void; + redraw(): void; + } - type Options = { - precision?: number, // seconds + type Options = { + precision?: number, // seconds - init?: () => void, + init?: () => void, - pause?: () => void, - resume?: () => void, - remove?: () => void, + pause?: () => void, + resume?: () => void, + remove?: () => void, - settingsFile?: string, - } & ( - { - draw: Draw - } | { - update: Update, - } | { - draw: Draw, - update: Update, - } - ) & ( - { - up?: () => void, - down?: () => void, - } | { - upDown?: (dir: -1 | 1) => void, - } - ); + settingsFile?: string, + } & ( + { + draw: Draw + } | { + update: Update, + } | { + draw: Draw, + update: Update, + } + ) & ( + { + up?: () => void, + down?: () => void, + } | { + upDown?: (dir: -1 | 1) => void, + } + ); - type Draw = (d: Date, changed: Changed) => void; - type Update = (d: Date, changed: Changed) => void; + type Draw = (d: Date, changed: Changed) => void; + type Update = (d: Date, changed: Changed) => void; - type Changed = { - d: T, - h: T, - m: T, - s: T, - } + type Changed = { + d: T, + h: T, + m: T, + s: T, + } } diff --git a/typescript/types/clock_info.d.ts b/typescript/types/clock_info.d.ts index df5dd1f9b..ce8c78d72 100644 --- a/typescript/types/clock_info.d.ts +++ b/typescript/types/clock_info.d.ts @@ -1,58 +1,58 @@ declare module ClockInfo { - function load(): Menu[]; - function addInteractive(menu: Menu[], options: Options): InteractiveOptions; + function load(): Menu[]; + function addInteractive(menu: Menu[], options: Options): InteractiveOptions; - type Menu = { - name: string, - img: string, - dynamic?: boolean, - items: MenuItem[], - }; + type Menu = { + name: string, + img: string, + dynamic?: boolean, + items: MenuItem[], + }; - type MenuItem = { - name: string, - show(): void, - hide(): void, - on(what: "redraw", cb: () => void): void, // extending from Object - run?(): void, - } & ( - { - hasRange: true, - get(): RangeItem, - } | { - hasRange: false, - get(): Item, - } - ); + type MenuItem = { + name: string, + show(): void, + hide(): void, + on(what: "redraw", cb: () => void): void, // extending from Object + run?(): void, + } & ( + { + hasRange: true, + get(): RangeItem, + } | { + hasRange: false, + get(): Item, + } + ); - type Item = { - text: string, - short?: string, - img?: string, - }; + type Item = { + text: string, + short?: string, + img?: string, + }; - type RangeItem = - Item & { - v: number, - min: number, - max: number, - }; + type RangeItem = + Item & { + v: number, + min: number, + max: number, + }; - type Options = { - x: number, - y: number, - w: number, - h: number, - draw(itm: MenuItem, info: Item, options: InteractiveOptions): void, - }; + type Options = { + x: number, + y: number, + w: number, + h: number, + draw(itm: MenuItem, info: Item, options: InteractiveOptions): void, + }; - type InteractiveOptions = - Options & { - index: number, - menuA: number, - menuB: number, - remove(): void, - redraw(): void, - focus: boolean, - }; + type InteractiveOptions = + Options & { + index: number, + menuA: number, + menuB: number, + remove(): void, + redraw(): void, + focus: boolean, + }; } diff --git a/typescript/types/layout.d.ts b/typescript/types/layout.d.ts index 2240ef55b..8c5706d0b 100644 --- a/typescript/types/layout.d.ts +++ b/typescript/types/layout.d.ts @@ -1,125 +1,125 @@ type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; type ExtractIds = - [Depth] extends [never] - ? never - : (T extends { id: infer Id extends string } - ? { [k in Id]: T } - : never) - | - ( - T extends { c: Array } - ? ExtractIds - : never - ); + [Depth] extends [never] + ? never + : (T extends { id: infer Id extends string } + ? { [k in Id]: T } + : never) + | + ( + T extends { c: Array } + ? ExtractIds + : never + ); declare module Layout_ { - type Layouter = - ExtractIds - & - { - // these actually change T - render(l?: T): void; - layout(l: T): void; + type Layouter = + ExtractIds + & + { + // these actually change T + render(l?: T): void; + layout(l: T): void; - debug(l?: T, c?: ColorResolvable): void; - update(): void; // changes layoutObject into a RenderedHierarchy - clear(obj?: T): void; + debug(l?: T, c?: ColorResolvable): void; + update(): void; // changes layoutObject into a RenderedHierarchy + clear(obj?: T): void; - forgetLazyState(): void; + forgetLazyState(): void; - setUI(): void; - }; + setUI(): void; + }; - var Layout: { - new ( - hier: T, - options?: { - lazy: boolean, - btns?: { - label: string, - cb: () => void, - cbl: () => void, - }[], - back?: () => void, - remove?: () => void, - }, - ): Layouter; - }; + var Layout: { + new ( + hier: T, + options?: { + lazy: boolean, + btns?: { + label: string, + cb: () => void, + cbl: () => void, + }[], + back?: () => void, + remove?: () => void, + }, + ): Layouter; + }; - export type Layout = typeof Layout; + export type Layout = typeof Layout; - type Image = string; + type Image = string; - type Fill = 0 | 1 | 2; // 0=no, 1=yes, 2=2x more space + type Fill = 0 | 1 | 2; // 0=no, 1=yes, 2=2x more space - type RenderedHierarchy = - Hierarchy & { - // top left position - x: number, - y: number, - // width and height - w: number, - h: number, - // minimum width and height - _w: number, - _h: number, - }; + type RenderedHierarchy = + Hierarchy & { + // top left position + x: number, + y: number, + // width and height + w: number, + h: number, + // minimum width and height + _w: number, + _h: number, + }; - type Hierarchy = - HierarchyParts & { - id?: string, - font?: FontNameWithScaleFactor, - scale?: number, - col?: ColorResolvable, - bgCol?: ColorResolvable, - pad?: number, - fillx?: Fill, - filly?: Fill, - width?: number, - height?: number, - } & ( - { - r?: number, // 0: 0°, 1: 90°, 2: 180°, 3: 270°. - } | { - wrap?: boolean, - } - ); + type Hierarchy = + HierarchyParts & { + id?: string, + font?: FontNameWithScaleFactor, + scale?: number, + col?: ColorResolvable, + bgCol?: ColorResolvable, + pad?: number, + fillx?: Fill, + filly?: Fill, + width?: number, + height?: number, + } & ( + { + r?: number, // 0: 0°, 1: 90°, 2: 180°, 3: 270°. + } | { + wrap?: boolean, + } + ); - type Align = -1 | 0 | 1; + type Align = -1 | 0 | 1; - type HierarchyParts = - { - type: "v", - c: Hierarchy[], - halign?: Align, - } | { - type: "h" - c: Hierarchy[], - valign?: Align, - } | { - type: "txt", - label: string, - font: FontNameWithScaleFactor, - } | { - type: undefined, // blank, for padding - } | ( - { - type: "btn", - src: Image, - cb: () => void, - } | { - type: "btn", - cb: () => void, - label: string, - font?: FontNameWithScaleFactor, - scale?: number, - } - ) | { - type: "img", - src: Image | (() => Image), - } | { - type: "custom", - render: (h: Hierarchy) => void, - }; + type HierarchyParts = + { + type: "v", + c: Hierarchy[], + halign?: Align, + } | { + type: "h" + c: Hierarchy[], + valign?: Align, + } | { + type: "txt", + label: string, + font: FontNameWithScaleFactor, + } | { + type: undefined, // blank, for padding + } | ( + { + type: "btn", + src: Image, + cb: () => void, + } | { + type: "btn", + cb: () => void, + label: string, + font?: FontNameWithScaleFactor, + scale?: number, + } + ) | { + type: "img", + src: Image | (() => Image), + } | { + type: "custom", + render: (h: Hierarchy) => void, + }; } diff --git a/typescript/types/main.d.ts b/typescript/types/main.d.ts index 3a52fa316..cd7b364a6 100644 --- a/typescript/types/main.d.ts +++ b/typescript/types/main.d.ts @@ -54,7 +54,7 @@ type MenuOptions = { type Menu = { ""?: MenuOptions; [key: string]: - | MenuOptions // not actually an option here + | MenuOptions | (() => void) | MenuBooleanItem | MenuNumberItem @@ -13299,4 +13299,4 @@ declare module "Storage" { * @url http://www.espruino.com/Reference#l_Storage_open */ function open(name: string, mode: "r" | "w" | "a"): StorageFile; -} +} \ No newline at end of file