diff --git a/typings/grandMA3.Appearances/functions.d.ts b/typings/grandMA3.Appearances/functions.d.ts index d86f04d..43ea87d 100644 --- a/typings/grandMA3.Appearances/functions.d.ts +++ b/typings/grandMA3.Appearances/functions.d.ts @@ -3,4 +3,12 @@ type Appearances = Obj & Appearance[] & { [index: string]: type Appearance = Obj & null[] & { [index: string]: null } & { Image: Image; + ImageR: number; + ImageG: number; + ImageB: number; + ImageAlpha: number; + BackR: number; + BackG: number; + BackB: number; + BackAlpha: number; }; diff --git a/typings/grandMA3.DataPool/functions.d.ts b/typings/grandMA3.DataPool/functions.d.ts index 8dee258..4986655 100644 --- a/typings/grandMA3.DataPool/functions.d.ts +++ b/typings/grandMA3.DataPool/functions.d.ts @@ -3,4 +3,5 @@ type DataPool = Obj & Sequences: Sequences; Layouts: Layouts; Plugins: Plugins; + Pages: Pages; }; diff --git a/typings/grandMA3.DataPool/types/Pages.d.ts b/typings/grandMA3.DataPool/types/Pages.d.ts new file mode 100644 index 0000000..0283299 --- /dev/null +++ b/typings/grandMA3.DataPool/types/Pages.d.ts @@ -0,0 +1,5 @@ +type Pages = Obj & (Page | null)[] & { [index: string]: Page | null }; + +type Page = Obj & (Executor | null)[] & { [index: string]: Executor | null }; + +type Executor = Obj & null[] & { [index: string]: null }; diff --git a/typings/grandMA3.DataPool/types/Sequences.d.ts b/typings/grandMA3.DataPool/types/Sequences.d.ts index 636fef8..1beb3e6 100644 --- a/typings/grandMA3.DataPool/types/Sequences.d.ts +++ b/typings/grandMA3.DataPool/types/Sequences.d.ts @@ -4,7 +4,7 @@ type Sequences = Obj & type Sequence = Obj & (Cue | null)[] & { [index: string]: Cue | null } & { CurrentChild: () => LuaMultiReturn<[Cue | undefined, string]>; - Name: string; + appearance: Appearance | null; }; type Cue = Obj & diff --git a/typings/grandMA3.DataPool/types/index.d.ts b/typings/grandMA3.DataPool/types/index.d.ts index de9d5d6..17a3e38 100644 --- a/typings/grandMA3.DataPool/types/index.d.ts +++ b/typings/grandMA3.DataPool/types/index.d.ts @@ -1,3 +1,4 @@ import './Sequences'; import './Layouts'; import './Plugins'; +import './Pages'; diff --git a/typings/grandMA3.Remotes/functions.d.ts b/typings/grandMA3.Remotes/functions.d.ts new file mode 100644 index 0000000..c16704a --- /dev/null +++ b/typings/grandMA3.Remotes/functions.d.ts @@ -0,0 +1,28 @@ +type RemoteTypes = DCRemote | MIDIRemote | DMXRemote; + +type Remotes = Obj> & + RemoteType[] & { [index: string]: RemoteType } & { + DCRemotes: RemoteType; + MIDIRemotes: RemoteType; + DMXRemotes: RemoteType; + }; + +type RemoteType = Obj & + T[] & { [index: string]: T } & { + enabled: boolean; + feedbackinput: boolean; + }; + +type DCRemote = Obj, null> & null[] & { [index: string]: null } & {}; + +type MIDIRemote = Obj, null> & + null[] & { [index: string]: null } & { + target: Sequence; + fader: string; + key: string; + midichannel: number; + midiindex: number; + miditype: number; + }; + +type DMXRemote = Obj, null> & null[] & { [index: string]: null } & {}; diff --git a/typings/grandMA3.Remotes/index.d.ts b/typings/grandMA3.Remotes/index.d.ts new file mode 100644 index 0000000..18c2f13 --- /dev/null +++ b/typings/grandMA3.Remotes/index.d.ts @@ -0,0 +1,2 @@ +import './types'; +import './functions'; diff --git a/typings/grandMA3.UserProfile/functions.d.ts b/typings/grandMA3.UserProfile/functions.d.ts index c175860..897dcbb 100644 --- a/typings/grandMA3.UserProfile/functions.d.ts +++ b/typings/grandMA3.UserProfile/functions.d.ts @@ -1,5 +1,6 @@ type UserProfile = Obj & any[] & { [index: string]: any } & { LayoutElementDefaultsCollect: LayoutElementDefaultsCollect; + SelectedPage: number; Name: string; }; diff --git a/typings/grandMA3.lua/functions.d.ts b/typings/grandMA3.lua/functions.d.ts index 9b8549f..507f205 100644 --- a/typings/grandMA3.lua/functions.d.ts +++ b/typings/grandMA3.lua/functions.d.ts @@ -78,7 +78,12 @@ declare function GetVar(...args: any): any; declare function GlobalVars(...args: any): any; declare function HandleToInt(...args: any): any; declare function HandleToStr(...args: any): any; -declare function HookObjectChange(...args: any): any; +declare function HookObjectChange( + callback: (obj: T) => void, + obj: T, + plugin: Plugin, + target?: Obj, +): void; declare function HostOS(...args: any): any; declare function HostSubType(...args: any): any; declare function HostType(...args: any): any; diff --git a/typings/grandMA3/functions.d.ts b/typings/grandMA3/functions.d.ts index eeba1dd..3da64b7 100644 --- a/typings/grandMA3/functions.d.ts +++ b/typings/grandMA3/functions.d.ts @@ -1,5 +1,14 @@ -interface Obj { +type ObjDef = { + count: number; + ignorenetwork: boolean | 'UNKNOWN_VALUE'; + index: number; + memoryfootprint: number; name: string; + no: number; + structurelocked: boolean; +} & ChildType[] & { [index: string]: ChildType }; + +interface Obj { AddListChildren(...args: any): any; AddListChildrenNames(...args: any): any; AddListLuaItem(...args: any): any; @@ -75,7 +84,7 @@ interface Obj { GridSetColumnSize(...args: any): any; GridsGetExpandHeaderCell(...args: any): any; GridsGetLevelButtonWidth(...args: any): any; - HasActivePlayback(...args: any): any; + HasActivePlayback(): boolean; HasParent(...args: any): any; HookDelete(...args: any): any; Import(...args: any): any; diff --git a/typings/grandMA3/types/ShowData.d.ts b/typings/grandMA3/types/ShowData.d.ts index 7d41efd..e249a0d 100644 --- a/typings/grandMA3/types/ShowData.d.ts +++ b/typings/grandMA3/types/ShowData.d.ts @@ -4,4 +4,5 @@ type ShowData = Obj & ImagePools: ImagePools; UserProfiles: UserProfiles; Appearances: Appearances; + Remotes: Remotes; }; diff --git a/typings/grandMA3/types/UserProfiles.d.ts b/typings/grandMA3/types/UserProfiles.d.ts index f7b1849..f3d3c02 100644 --- a/typings/grandMA3/types/UserProfiles.d.ts +++ b/typings/grandMA3/types/UserProfiles.d.ts @@ -1 +1,2 @@ -type UserProfiles = Obj & UserProfile[] & { [index: string]: UserProfile }; +type UserProfiles = Obj & + (UserProfile | null)[] & { [index: string]: UserProfile | null }; diff --git a/typings/index.d.ts b/typings/index.d.ts index 97d0805..693dbf4 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1,7 +1,9 @@ import './grandMA3'; import './grandMA3.DataPool'; import './grandMA3.Patch'; +import './grandMA3.Remotes'; import './grandMA3.UserProfile'; import './grandMA3.Appearances'; import './grandMA3.lua'; import './lua.ftp'; +import './lua.gma3_helpers'; diff --git a/typings/lua.ftp/functions.d.ts b/typings/lua.ftp/functions.d.ts index af83471..93aebd2 100644 --- a/typings/lua.ftp/functions.d.ts +++ b/typings/lua.ftp/functions.d.ts @@ -11,6 +11,8 @@ * // to load the FTP module and any libraries it requires run: * import ftp = require('ftp') * ``` + * + * @noResolution */ declare module 'ftp' { /** diff --git a/typings/lua.gma3_helpers/functions.d.ts b/typings/lua.gma3_helpers/functions.d.ts new file mode 100644 index 0000000..1c45891 --- /dev/null +++ b/typings/lua.gma3_helpers/functions.d.ts @@ -0,0 +1,128 @@ +// Based on http://w3.impa.br/~diego/software/luasocket/ftp.html + +/// + +/** @noSelfInFile */ + +/** + * a module that contains general helping functions for gma3 + * @example``` + * // to load the gma3_helpers module run: + * import 'gma3_helpers' + * ``` + * + * @noResolution + */ +declare module 'gma3_helpers' {} + +/** + * a module that contains general helping functions for gma3 + * @example``` + * // to load the gma3_helpers module run: + * import 'gma3_helpers' + * ``` + */ +declare const gma3_helpers: { + /** + * Returns content of given variable as string (works with every type, incl. gma3-objects) + */ + dump: (o: any) => string; + + /** + * Returns content of gma3-object as string + */ + dumpObj: (o: any) => string; + + /** + * Creates fixed width headline + */ + headline: (headlineString: string, myFill: string, size: number) => string; + + /** + * Convert \n and \t for Printf() + */ + printfWithNewline: (str: string) => string; + + /** + * Create tree-like output of gma3-object + */ + tree: (o: any, maxDepth: number) => void; + + /** + * Convert a table like this: + * ```lua + * { + * [1] = {name="testHTP", result=3, min=0, max=100}, + * [2] = {name="testLTP", result=5, min=15, max=100} + * } + * ``` + * to this: + * ```markdown + * |-----------|-----------|-----------|-----------|-----------| + * | | name | result | min | max | + * |-----------|-----------|-----------|-----------|-----------| + * | 1 | testHTP | 3 | 0 | 100 | + * |-----------|-----------|-----------|-----------|-----------| + * | 2 | testLTP | 5 | 15 | 100 | + * |-----------|-----------|-----------|-----------|-----------| + * ``` + * @returns generated string for printing + * @param t is any multidimensional table + * @param forcedColumns is a list of column keys (sorted) + * @param noPrint if Printf to cmdline should be blocked + */ + printTableEntries: (t: any[], forcedColumns: string[], noPrint: boolean) => string; + + /** + * Convert a table like this: + * ```lua + * { + * [1] = { [1] = "something", [2] = "else"}, + * [2] = { [1] = "test", [2] = "abc"} + * } + * ``` + * to this: + * ```markdown + * |-----------|-----------| + * | something | else | + * |-----------|-----------| + * | test | abc | + * |-----------|-----------| + * ``` + * @returns generated string for printing + * @param t is any multidimensional table + * @param noPrint if Printf to cmdline should be blocked + */ + printTable2D: (t: any[], noPrint: boolean) => string; + + /** + * helper function for os.execute that prints it's result + * @param cmd is the instruction you want to run on the host system + */ + osExecute: (cmd: string) => void; + + /** + * helper function for io.popen + * @param path + */ + ioPopen: (path: string) => string; + + getObjectExportPath: (object: Obj) => string; + + getDirectoryContent: ( + path: string, + ) => { type: 'directory' | 'file'; fullPath: string; name: string }[]; + + copyFile: (src: string, dst: string) => void; + + deleteFolderContent: (desc: { + path: string; + confirm: boolean; + recursive: boolean; + filterFn(name: string): boolean; + }) => void; + + repeatUntilTrue: (desc: { func(): boolean; tolerance?: number; interval?: number }) => boolean; + + editLuaTable: (t: any[]) => boolean; +}; diff --git a/typings/lua.gma3_helpers/index.d.ts b/typings/lua.gma3_helpers/index.d.ts new file mode 100644 index 0000000..f144070 --- /dev/null +++ b/typings/lua.gma3_helpers/index.d.ts @@ -0,0 +1 @@ +import './functions';