From 0c551765ab3fd4c7bd8ad2e7c6dfbbd2ce55f23a Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 17:49:28 +0200 Subject: [PATCH 01/12] =?UTF-8?q?=E2=9C=A8=20added=20default=20`Obj`=20par?= =?UTF-8?q?ameters=20w/=20`ObjDef`=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3/functions.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/typings/grandMA3/functions.d.ts b/typings/grandMA3/functions.d.ts index eeba1dd..1f91a5b 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; From 193cbfa5379e81c651fd481d402997e4dfe6c35e Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 17:52:34 +0200 Subject: [PATCH 02/12] =?UTF-8?q?=E2=9C=A8=20added=20types=20for=20Remotes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3.Remotes/functions.d.ts | 28 +++++++++++++++++++++++++ typings/grandMA3.Remotes/index.d.ts | 3 +++ typings/grandMA3/types/ShowData.d.ts | 1 + typings/index.d.ts | 1 + 4 files changed, 33 insertions(+) create mode 100644 typings/grandMA3.Remotes/functions.d.ts create mode 100644 typings/grandMA3.Remotes/index.d.ts diff --git a/typings/grandMA3.Remotes/functions.d.ts b/typings/grandMA3.Remotes/functions.d.ts new file mode 100644 index 0000000..3f5d1fb --- /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..615b10a --- /dev/null +++ b/typings/grandMA3.Remotes/index.d.ts @@ -0,0 +1,3 @@ +import './types'; +import './functions'; + \ No newline at end of file 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/index.d.ts b/typings/index.d.ts index 97d0805..e86390f 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1,6 +1,7 @@ import './grandMA3'; import './grandMA3.DataPool'; import './grandMA3.Patch'; +import './grandMA3.Remotes'; import './grandMA3.UserProfile'; import './grandMA3.Appearances'; import './grandMA3.lua'; From 4e7f80943dbb17c95e5abd348af26e21fcb6db0f Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 17:54:43 +0200 Subject: [PATCH 03/12] =?UTF-8?q?=E2=9C=A8=20added=20types=20for=20Obj.Has?= =?UTF-8?q?ActivePlayback()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3/functions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/grandMA3/functions.d.ts b/typings/grandMA3/functions.d.ts index 1f91a5b..3da64b7 100644 --- a/typings/grandMA3/functions.d.ts +++ b/typings/grandMA3/functions.d.ts @@ -84,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; From bb2ac5039a12cadb2e79b6d10175399acfa57f99 Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 17:54:50 +0200 Subject: [PATCH 04/12] =?UTF-8?q?=E2=9C=A8=20added=20types=20for=20HookObj?= =?UTF-8?q?ectChange()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3.lua/functions.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; From 8c04db997d041446fd758d404e3f2b483c06ea7b Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 17:56:33 +0200 Subject: [PATCH 05/12] =?UTF-8?q?=F0=9F=90=9B=20fixed=20import=20of=20`ftp?= =?UTF-8?q?`=20library?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/lua.ftp/functions.d.ts | 2 ++ 1 file changed, 2 insertions(+) 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' { /** From 654bbc2d383aacde1725aed926697d30d723f165 Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 17:59:37 +0200 Subject: [PATCH 06/12] =?UTF-8?q?=E2=9C=A8=20added=20type=20for=20UserProf?= =?UTF-8?q?ile.SelectedPage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3.UserProfile/functions.d.ts | 1 + 1 file changed, 1 insertion(+) 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; }; From 6985f79f5d756c1d1ae4a8a8bcdf2aae0cc5c413 Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 18:00:24 +0200 Subject: [PATCH 07/12] =?UTF-8?q?=E2=9C=A8=20added=20types=20for=20Pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3.DataPool/functions.d.ts | 1 + typings/grandMA3.DataPool/types/Pages.d.ts | 5 +++++ typings/grandMA3.DataPool/types/index.d.ts | 1 + 3 files changed, 7 insertions(+) create mode 100644 typings/grandMA3.DataPool/types/Pages.d.ts 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/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'; From 5aa94b251055cf5327c7264a52b501634d10872d Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 18:01:17 +0200 Subject: [PATCH 08/12] =?UTF-8?q?=F0=9F=90=9B=20userprofile=20can=20now=20?= =?UTF-8?q?be=20`null`=20depending=20on=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3/types/UserProfiles.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 }; From 8aac76cb9a915f877e3c69d1307c74f5becd0159 Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 18:02:05 +0200 Subject: [PATCH 09/12] =?UTF-8?q?=E2=9C=A8=20added=20type=20for=20Sequence?= =?UTF-8?q?.appearance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3.DataPool/types/Sequences.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/grandMA3.DataPool/types/Sequences.d.ts b/typings/grandMA3.DataPool/types/Sequences.d.ts index 636fef8..edf6a74 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 & From c6ab288f4e5582679f5d2b61bba19725a8fd5058 Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 18:02:55 +0200 Subject: [PATCH 10/12] =?UTF-8?q?=E2=9C=A8=20added=20types=20for=20appeara?= =?UTF-8?q?nce=20color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3.Appearances/functions.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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; }; From 28c25d2b966f339a32c8420a9ea83dbac8af2844 Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 18:03:51 +0200 Subject: [PATCH 11/12] =?UTF-8?q?=E2=9C=A8=20added=20declaration=20for=20`?= =?UTF-8?q?gma3=5Fhelpers`=20library?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/index.d.ts | 1 + typings/lua.gma3_helpers/functions.d.ts | 128 ++++++++++++++++++++++++ typings/lua.gma3_helpers/index.d.ts | 1 + 3 files changed, 130 insertions(+) create mode 100644 typings/lua.gma3_helpers/functions.d.ts create mode 100644 typings/lua.gma3_helpers/index.d.ts diff --git a/typings/index.d.ts b/typings/index.d.ts index e86390f..693dbf4 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -6,3 +6,4 @@ import './grandMA3.UserProfile'; import './grandMA3.Appearances'; import './grandMA3.lua'; import './lua.ftp'; +import './lua.gma3_helpers'; 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'; From 8c90079f03f4acbd33563aa05f6e09bfc5670750 Mon Sep 17 00:00:00 2001 From: Lukas Runge Date: Tue, 11 Oct 2022 18:14:24 +0200 Subject: [PATCH 12/12] =?UTF-8?q?=F0=9F=92=84=20ran=20linter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typings/grandMA3.DataPool/types/Sequences.d.ts | 2 +- typings/grandMA3.Remotes/functions.d.ts | 12 ++++++------ typings/grandMA3.Remotes/index.d.ts | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/typings/grandMA3.DataPool/types/Sequences.d.ts b/typings/grandMA3.DataPool/types/Sequences.d.ts index edf6a74..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]>; - appearance: Appearance | null + appearance: Appearance | null; }; type Cue = Obj & diff --git a/typings/grandMA3.Remotes/functions.d.ts b/typings/grandMA3.Remotes/functions.d.ts index 3f5d1fb..c16704a 100644 --- a/typings/grandMA3.Remotes/functions.d.ts +++ b/typings/grandMA3.Remotes/functions.d.ts @@ -17,12 +17,12 @@ type DCRemote = Obj, null> & null[] & { [index: string]: nu type MIDIRemote = Obj, null> & null[] & { [index: string]: null } & { - target: Sequence - fader: string - key: string - midichannel: number - midiindex: number - miditype: number + 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 index 615b10a..18c2f13 100644 --- a/typings/grandMA3.Remotes/index.d.ts +++ b/typings/grandMA3.Remotes/index.d.ts @@ -1,3 +1,2 @@ import './types'; import './functions'; - \ No newline at end of file