@ts-for-gir/lib 3.0.0 → 3.0.2

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.
Files changed (103) hide show
  1. package/lib/constants.d.ts +9 -1
  2. package/lib/constants.js +4 -1
  3. package/lib/constants.js.map +1 -1
  4. package/lib/dependency-manager.d.ts +11 -0
  5. package/lib/dependency-manager.js +28 -14
  6. package/lib/dependency-manager.js.map +1 -1
  7. package/lib/gir-module.js +2 -3
  8. package/lib/gir-module.js.map +1 -1
  9. package/lib/index.d.ts +0 -3
  10. package/lib/index.js +0 -3
  11. package/lib/index.js.map +1 -1
  12. package/lib/symtable.js +1 -2
  13. package/lib/symtable.js.map +1 -1
  14. package/lib/types/generate-config.d.ts +2 -0
  15. package/lib/types/user-config.d.ts +2 -0
  16. package/lib/utils.d.ts +6 -0
  17. package/lib/utils.js +10 -0
  18. package/lib/utils.js.map +1 -1
  19. package/package.json +9 -10
  20. package/lib/injection/classes/GLib-2-0.d.ts +0 -2
  21. package/lib/injection/classes/GLib-2-0.js +0 -35
  22. package/lib/injection/classes/GLib-2-0.js.map +0 -1
  23. package/lib/injection/classes/gjs/GLib-2.0.d.ts +0 -2
  24. package/lib/injection/classes/gjs/GLib-2.0.js +0 -205
  25. package/lib/injection/classes/gjs/GLib-2.0.js.map +0 -1
  26. package/lib/injection/classes/gjs/GObject-2.0.d.ts +0 -2
  27. package/lib/injection/classes/gjs/GObject-2.0.js +0 -634
  28. package/lib/injection/classes/gjs/GObject-2.0.js.map +0 -1
  29. package/lib/injection/classes/gjs/Gio-2.0.d.ts +0 -5
  30. package/lib/injection/classes/gjs/Gio-2.0.js +0 -218
  31. package/lib/injection/classes/gjs/Gio-2.0.js.map +0 -1
  32. package/lib/injection/classes/node-gtk/GLib-2.0.d.ts +0 -2
  33. package/lib/injection/classes/node-gtk/GLib-2.0.js +0 -19
  34. package/lib/injection/classes/node-gtk/GLib-2.0.js.map +0 -1
  35. package/lib/injection/classes/node-gtk/GObject-2.0.d.ts +0 -2
  36. package/lib/injection/classes/node-gtk/GObject-2.0.js +0 -66
  37. package/lib/injection/classes/node-gtk/GObject-2.0.js.map +0 -1
  38. package/lib/injection/classes/node-gtk/Gdk-4.0.d.ts +0 -2
  39. package/lib/injection/classes/node-gtk/Gdk-4.0.js +0 -32
  40. package/lib/injection/classes/node-gtk/Gdk-4.0.js.map +0 -1
  41. package/lib/injection/classes/node-gtk/Gio-2.0.d.ts +0 -2
  42. package/lib/injection/classes/node-gtk/Gio-2.0.js +0 -14
  43. package/lib/injection/classes/node-gtk/Gio-2.0.js.map +0 -1
  44. package/lib/injection/classes/node-gtk/Graphene-1.0.d.ts +0 -2
  45. package/lib/injection/classes/node-gtk/Graphene-1.0.js +0 -133
  46. package/lib/injection/classes/node-gtk/Graphene-1.0.js.map +0 -1
  47. package/lib/injection/classes/node-gtk/Gtk-3.0.d.ts +0 -2
  48. package/lib/injection/classes/node-gtk/Gtk-3.0.js +0 -31
  49. package/lib/injection/classes/node-gtk/Gtk-3.0.js.map +0 -1
  50. package/lib/injection/classes/node-gtk/Gtk-4.0.d.ts +0 -2
  51. package/lib/injection/classes/node-gtk/Gtk-4.0.js +0 -52
  52. package/lib/injection/classes/node-gtk/Gtk-4.0.js.map +0 -1
  53. package/lib/injection/classes/node-gtk/Pango-1.0.d.ts +0 -2
  54. package/lib/injection/classes/node-gtk/Pango-1.0.js +0 -31
  55. package/lib/injection/classes/node-gtk/Pango-1.0.js.map +0 -1
  56. package/lib/package-data-parser.d.ts +0 -13
  57. package/lib/package-data-parser.js +0 -67
  58. package/lib/package-data-parser.js.map +0 -1
  59. package/lib/package-data.d.ts +0 -9
  60. package/lib/package-data.js +0 -41
  61. package/lib/package-data.js.map +0 -1
  62. package/lib/template-processor.d.ts +0 -114
  63. package/lib/template-processor.js +0 -252
  64. package/lib/template-processor.js.map +0 -1
  65. package/lib/types/package-section.d.ts +0 -8
  66. package/lib/types/package-section.js +0 -2
  67. package/lib/types/package-section.js.map +0 -1
  68. package/templates/README.md +0 -102
  69. package/templates/cogl-2-0.d.ts +0 -0
  70. package/templates/gjs/README-GJS.md +0 -109
  71. package/templates/gjs/ambient.d.ts +0 -59
  72. package/templates/gjs/cairo-1.0.d.ts +0 -9
  73. package/templates/gjs/cairo.d.ts +0 -8
  74. package/templates/gjs/cairo.js +0 -11
  75. package/templates/gjs/gettext.d.ts +0 -41
  76. package/templates/gjs/gettext.js +0 -11
  77. package/templates/gjs/gio-2.0.d.ts +0 -101
  78. package/templates/gjs/gjs.d.ts +0 -757
  79. package/templates/gjs/gjs.js +0 -10
  80. package/templates/gjs/gobject-2.0.d.ts +0 -238
  81. package/templates/gjs/module-ambient.d.ts +0 -31
  82. package/templates/gjs/module-import.d.ts +0 -33
  83. package/templates/gjs/module.append.d.ts +0 -1
  84. package/templates/gjs/module.d.ts +0 -12
  85. package/templates/gjs/module.js +0 -17
  86. package/templates/gjs/system.d.ts +0 -32
  87. package/templates/gjs/system.js +0 -11
  88. package/templates/gjs/tsconfig.alias.json +0 -12
  89. package/templates/granite-1.0.d.ts +0 -7
  90. package/templates/granite-7.0.d.ts +0 -7
  91. package/templates/gstbase-0.10.d.ts +0 -5
  92. package/templates/node-gtk/README-NODE-GTK.md +0 -71
  93. package/templates/node-gtk/ambient.d.ts +0 -19
  94. package/templates/node-gtk/gobject-2.0.d.ts +0 -57
  95. package/templates/node-gtk/module-import.d.ts +0 -29
  96. package/templates/node-gtk/module.append.d.ts +0 -1
  97. package/templates/node-gtk/module.d.ts +0 -10
  98. package/templates/node-gtk/module.js +0 -18
  99. package/templates/node-gtk/node-gtk.d.ts +0 -25
  100. package/templates/node-gtk/node-gtk.js +0 -7
  101. package/templates/package.json +0 -173
  102. package/templates/rygelserver-2.6.d.ts +0 -3
  103. package/templates/tsconfig.doc.json +0 -30
@@ -1,10 +0,0 @@
1
- const imports = globalThis.imports || {};
2
-
3
- <%_ if(moduleType === 'esm') { _%>
4
- export { imports }
5
- export default imports;
6
- <%_ } else { _%>
7
- module.exports = imports;
8
- exports.default = imports;
9
- <%_ } _%>
10
-
@@ -1,238 +0,0 @@
1
- // A few things here are inspired by gi.ts
2
- // See https://gitlab.gnome.org/ewlsh/gi.ts/-/blob/master/packages/lib/src/generators/dts/gobject.ts
3
- // Copyright Evan Welsh
4
-
5
- export type GType<T = unknown> = {
6
- __type__(arg: never): T
7
- name: string
8
- };
9
-
10
- // Extra interfaces used to help define GObject classes in js; these
11
- // aren't part of gi.
12
- export interface SignalDefinition {
13
- flags?: SignalFlags
14
- accumulator: number
15
- return_type?: GType
16
- param_types?: GType[]
17
- }
18
-
19
- export interface MetaInfo<Props, Interfaces, Sigs> {
20
- GTypeName?: string
21
- GTypeFlags?: TypeFlags
22
- Properties?: Props
23
- Signals?: Sigs
24
- Implements?: Interfaces
25
- CssName?: string
26
- Template?: Uint8Array | GLib.Bytes | string
27
- Children?: string[]
28
- InternalChildren?: string[]
29
- }
30
-
31
- /** Interface of GObject Interface should be implemented by all GObject interfaces */
32
- export class Interface<T = unknown> {
33
- static _classInit: (cls: any) => any;
34
- __name__: string;
35
- _construct: (params: any, ...otherArgs: any[]) => any;
36
- _init: (params: any) => void;
37
- $gtype?: GType<T>;
38
- }
39
-
40
- /**
41
- * Use this to signify a function that must be overridden in an
42
- * implementation of the interface.
43
- */
44
- export class NotImplementedError extends Error {
45
- get name(): 'NotImplementedError'
46
- }
47
-
48
- // Expose GObject static properties for ES6 classes
49
-
50
- export const GTypeName: unique symbol;
51
- export const requires: unique symbol;
52
- export const interfaces: unique symbol;
53
- export const properties: unique symbol;
54
- export const signals: unique symbol;
55
-
56
- export let gtypeNameBasedOnJSPath: boolean;
57
-
58
- export let TYPE_BOOLEAN: GType<boolean>;
59
- export let Boolean: BooleanConstructor;
60
-
61
- export let TYPE_ENUM: GType<number>;
62
- export let TYPE_FLAGS: GType<number>;
63
-
64
- export let TYPE_DOUBLE: GType<number>;
65
- export let Double: NumberConstructor;
66
-
67
- export let TYPE_STRING: GType<string>;
68
- export let String: StringConstructor;
69
-
70
- export let TYPE_NONE: GType<undefined>;
71
- export let TYPE_POINTER: GType<undefined>;
72
- export let TYPE_BOXED: GType<unknown>;
73
- export let TYPE_PARAM: GType<unknown>;
74
- export let TYPE_INTERFACE: GType<unknown>;
75
- export let TYPE_OBJECT: GType<object>;
76
- export let TYPE_VARIANT: GType<GLib.Variant>;
77
- export let TYPE_INT: GType<number>;
78
- export let TYPE_UINT: GType<number>;
79
- export let TYPE_INT64: GType<number>;
80
- export let TYPE_UINT64: GType<number>;
81
-
82
- // fake enum for signal accumulators, keep in sync with gi/object.c
83
- export enum AccumulatorType {
84
- NONE=0,
85
- FIRST_WINS=1,
86
- TRUE_HANDLED=2,
87
- }
88
-
89
- // A simple workaround if you have a class with .connect, .disconnect or .emit
90
- // methods (such as Gio.Socket.connect or NMClient.Device.disconnect)
91
- // The original g_signal_* functions are not introspectable anyway, because
92
- // we need our own handling of signal argument marshalling
93
- export function signal_connect(object: Object, name: string, handler: (...args: any[]) => any): number
94
- export function signal_connect_after(object: Object, name: string, handler: (...args: any[]) => any): number
95
- export function signal_emit_by_name(object: Object, ...nameAndArgs: any[]): void
96
-
97
- /**
98
- * Finds the first signal handler that matches certain selection criteria.
99
- * The criteria are passed as properties of a match object.
100
- * The match object has to be non-empty for successful matches.
101
- * If no handler was found, a falsy value is returned.
102
- *
103
- * @param instance the instance owning the signal handler to be found.
104
- * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
105
- * @param match.signalId signal the handler has to be connected to.
106
- * @param match.detail signal detail the handler has to be connected to.
107
- * @param match.func the callback function the handler will invoke.
108
- * @returns A valid non-0 signal handler ID for a successful match.
109
- */
110
- export function signal_handler_find(instance: Object, match: {signalId: string, detail: string, func: (...args: any[]) => any}): number | bigint | object | null
111
-
112
- /**
113
- * Blocks all handlers on an instance that match certain selection criteria.
114
- * The criteria are passed as properties of a match object.
115
- * The match object has to have at least `func` for successful matches.
116
- * If no handlers were found, 0 is returned, the number of blocked handlers
117
- * otherwise.
118
- *
119
- * @param instance the instance owning the signal handler to be found.
120
- * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
121
- * @param match.signalId signal the handler has to be connected to.
122
- * @param match.detail signal detail the handler has to be connected to.
123
- * @param match.func the callback function the handler will invoke.
124
- * @returns The number of handlers that matched.
125
- */
126
- export function signal_handlers_block_matched(instance: Object, match: {signalId: string, detail: string, func: (...args: any[]) => any}): number
127
-
128
- /**
129
- * Disconnects all handlers on an instance that match certain selection
130
- * criteria.
131
- * The criteria are passed as properties of a match object.
132
- * The match object has to have at least `func` for successful matches.
133
- * If no handlers were found, 0 is returned, the number of disconnected
134
- * handlers otherwise.
135
- *
136
- * @param instance the instance owning the signal handler
137
- * to be found.
138
- * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
139
- * @param match.signalId signal the handler has to be connected to.
140
- * @param match.detail signal detail the handler has to be connected to.
141
- * @param match.func the callback function the handler will invoke.
142
- * @returns The number of handlers that matched.
143
- */
144
- export function signal_handlers_unblock_matched(instance: Object, match: {signalId: string, detail: string, func: (...args: any[]) => any}): number
145
-
146
- /**
147
- * Disconnects all handlers on an instance that match certain selection
148
- * criteria.
149
- * The criteria are passed as properties of a match object.
150
- * The match object has to have at least `func` for successful matches.
151
- * If no handlers were found, 0 is returned, the number of disconnected
152
- * handlers otherwise.
153
- *
154
- * @param instance the instance owning the signal handler
155
- * to be found.
156
- * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
157
- * @param match.signalId signal the handler has to be connected to.
158
- * @param match.detail signal detail the handler has to be connected to.
159
- * @param match.func the callback function the handler will invoke.
160
- * @returns The number of handlers that matched.
161
- */
162
- export function signal_handlers_disconnect_matched(instance: Object, match: {signalId: string, detail: string, func: (...args: any[]) => any}): number
163
-
164
- // Also match the macros used in C APIs, even though they're not introspected
165
-
166
- /**
167
- * Blocks all handlers on an instance that match `func`.
168
- *
169
- * @param instance the instance to block handlers from.
170
- * @param func the callback function the handler will invoke.
171
- * @returns The number of handlers that matched.
172
- */
173
- export function signal_handlers_block_by_func(instance: Object, func: (...args: any[]) => any): number;
174
-
175
- /**
176
- * Unblocks all handlers on an instance that match `func`.
177
- *
178
- * @function
179
- * @param instance the instance to unblock handlers from.
180
- * @param func the callback function the handler will invoke.
181
- * @returns The number of handlers that matched.
182
- */
183
- export function signal_handlers_unblock_by_func(instance: Object, func: (...args: any[]) => any): number;
184
-
185
- /**
186
- * Disconnects all handlers on an instance that match `func`.
187
- *
188
- * @param instance the instance to remove handlers from.
189
- * @param func the callback function the handler will invoke.
190
- * @returns The number of handlers that matched.
191
- */
192
- export function signal_handlers_disconnect_by_func(instance: Object, func: (...args: any[]) => any): number;
193
- export function signal_handlers_disconnect_by_data(): void;
194
-
195
- export type Property<K extends ParamSpec> = K extends ParamSpecBoolean
196
- ? boolean
197
- : K extends ParamSpecDouble | ParamSpecInt | ParamSpecUInt | ParamSpecFloat | ParamSpecLong
198
- ? number
199
- : K extends ParamSpecInt64 | ParamSpecUInt64 | ParamSpecULong
200
- ? number
201
- : K extends ParamSpecFlags
202
- ? number
203
- : K extends ParamSpecString | ParamSpecUnichar
204
- ? string
205
- : K extends ParamSpecValueArray
206
- ? any[]
207
- : K extends ParamSpecObject // TODO?: <infer T>
208
- ? ParamSpecObject // T
209
- : K extends ParamSpecEnum // TODO?: <infer T><infer E>
210
- ? ParamSpecEnum // E
211
- : K extends ParamSpecBoxed // TODO?: <infer T><infer B>
212
- ? ParamSpecBoxed //B
213
- : K extends ParamSpecVariant
214
- ? GLib.Variant
215
- : any;
216
-
217
- // TODO: What about the generated class Closure
218
- export type TClosure<R = any, P = any> = (...args: P[]) => R;
219
-
220
- // This should be replaces by a class of GObject.Object as soon as once we have implemented inheritance
221
- export class AnyClass {}
222
-
223
- export function registerClass<
224
- T extends AnyClass,
225
- Props extends { [key: string]: ParamSpec },
226
- Interfaces extends { $gtype: GType }[],
227
- Sigs extends {
228
- [key: string]: {
229
- param_types?: readonly GType[];
230
- [key: string]: any;
231
- };
232
- }
233
- >(
234
- options: MetaInfo<Props, Interfaces, Sigs>,
235
- cls: T
236
- ): T;
237
-
238
- export function registerClass<T extends AnyClass>(cls: T): T
@@ -1,31 +0,0 @@
1
- <%#
2
- This EJS template is used for the generated .d.ts files for ambient typescript module support.
3
- See https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules
4
- %>
5
- <%_ const pkg = dep.get(girModule.namespace, girModule.version) _%>
6
- <%_ let moduleImportStr = ""; _%>
7
- <%_ if(package){ _%>
8
- <%_ if(noNamespace){ _%>
9
- <%_ moduleImportStr = `import * as ${girModule.importNamespace} from '${pkg.importPath}'`; _%>
10
- <%_ } else { _%>
11
- <%_ moduleImportStr = `import ${girModule.importNamespace} from '${pkg.importPath}'`; _%>
12
- <%_ } _%>
13
- <%_ } else { _%>
14
- <%_ if(noNamespace){ _%>
15
- <%_ moduleImportStr = `const ${girModule.importNamespace}: typeof import('${pkg.importPath}')`; _%>
16
- <%_ } else { _%>
17
- <%_ moduleImportStr = `const ${girModule.importNamespace}: typeof import('${pkg.importPath}').default`; _%>
18
- <%_ } _%>
19
- <%_ } _%>
20
-
21
- declare module 'gi://<%= name %>?version=<%= version %>' {
22
- <%- moduleImportStr %>;
23
- export default <%- girModule.importNamespace -%>;
24
- }
25
-
26
- <%_ if(!dep.hasConflict(name, version)){ _%>
27
- declare module 'gi://<%= name %>' {
28
- <%- moduleImportStr %>;
29
- export default <%- girModule.importNamespace -%>;
30
- }
31
- <%_ } _%>
@@ -1,33 +0,0 @@
1
- <%#
2
- This EJS template is used to extend the global GjsGiImports interface with the GIR module, for `imports.gi[namespace] GJS GIR types`
3
- %>
4
- <%_ if(!package && !dep.isLatestVersion(girModule.namespace, girModule.version)){ _%>
5
- <%_ return `// Module import type definition not generated, otherwise this would cause a type conflict, this is because several GIR modules were generated with the same namespace: "${ girModule.namespace }"` _%>
6
- <%_ } _%>
7
-
8
- <%_ const pkg = dep.get(girModule.namespace, girModule.version) _%>
9
- <%_ if(package){ _%>
10
- <%_ if(noNamespace){ _%>
11
- import * as <%= girModule.importNamespace %> from '<%= pkg.importPath %>';
12
- <%_ } else { _%>
13
- import <%= girModule.importNamespace %> from '<%= pkg.importPath %>';
14
- <%_ } _%>
15
- <%_ } else { _%>
16
- <%_ if(noNamespace){ _%>
17
- type <%= girModule.importNamespace %> = typeof import('<%= pkg.importPath %>');
18
- <%_ } else { _%>
19
- type <%= girModule.importNamespace %> = typeof import('<%= pkg.importPath %>').default;
20
- <%_ } _%>
21
- <%_ } _%>
22
-
23
- declare global {
24
- export interface GjsGiImports {
25
- <%_ if(package){ _%>
26
- <%= name %>: typeof <%= girModule.importNamespace %>;
27
- <%_ } else { _%>
28
- <%= name %>: <%= girModule.importNamespace %>;
29
- <%_ } _%>
30
- }
31
- }
32
-
33
- export default GjsGiImports;
@@ -1 +0,0 @@
1
- // END
@@ -1,12 +0,0 @@
1
- <%# This EJS template is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ... %>
2
- /*
3
- * Type Definitions for Gjs (https://gjs.guide/)
4
- *
5
- * These type definitions are automatically generated, do not edit them by hand.
6
- * If you found a bug fix it in `<%= APP_NAME %>` or create a bug report on <%= APP_SOURCE %>
7
- */
8
-
9
- <%_ if(package){ _%>
10
- import './<%= importName %>-ambient.d.ts';
11
- <%_ } _%>
12
- import './<%= importName %>-import.d.ts';
@@ -1,17 +0,0 @@
1
- <%# This template is used for the generated `.js` file of each GIR module like Gtk-4.0, GObject-2.0, ... %>
2
- <% if(moduleType === 'esm'){ %>
3
- // @ts-expect-error
4
- import <%= name %> from 'gi://<%= name %>?version=<%= version %>';
5
- export { <%= name %> };
6
- export default <%= name %>;
7
- <% } else { %>
8
- imports.gi.versions.<%= name %> = '<%= version %>'
9
- const <%= name %> = imports.gi.<%= name %>;
10
- <% if(!noNamespace){ %>
11
- module.exports = { <%= name %> };
12
- exports.default = <%= name %>;
13
- <% } else { %>
14
- module.exports = <%= name %>;
15
- <% } %>
16
- <% } %>
17
-
@@ -1,32 +0,0 @@
1
- <%_ const GObject = dep.find('GObject') _%>
2
- <%- GObject ? GObject.importDef : '' %>
3
-
4
- export const programInvocationName: string
5
- export const version: number
6
- export const programPath: string | null
7
- /** Equal to ARGV */
8
- export const programArgs: string[]
9
- export function exit(code: number): void
10
- export function addressOfGObject(o: GObject.Object): object
11
- export function addressOf(o: any): object
12
- /** Runs the garbage collector */
13
- export function gc(): void
14
- export function refcount(o: GObject.Object): number
15
- export function dumpHeap(path: string): void
16
- export function dumpMemoryInfo(path: string): void
17
-
18
- declare const System: {
19
- programInvocationName: typeof programInvocationName,
20
- version: typeof version,
21
- programPath: typeof programPath,
22
- programArgs: typeof programArgs,
23
- exit: typeof exit,
24
- addressOfGObject: typeof addressOfGObject,
25
- addressOf: typeof addressOf,
26
- gc: typeof gc,
27
- refcount: typeof refcount,
28
- dumpHeap: typeof dumpHeap,
29
- dumpMemoryInfo: typeof dumpMemoryInfo,
30
- }
31
-
32
- export default System
@@ -1,11 +0,0 @@
1
- <% if(moduleType === 'esm') { %>
2
- import System, { programInvocationName, version, programPath, programArgs, exit, addressOfGObject, addressOf, gc, refcount, dumpHeap, dumpMemoryInfo } from 'system';
3
-
4
- export { programInvocationName, version, programPath, programArgs, exit, addressOfGObject, addressOf, gc, refcount, dumpHeap, dumpMemoryInfo };
5
- export default System;
6
- <% } else { %>
7
- const System = imports.system;
8
-
9
- module.exports = System;
10
- exports.default = System;
11
- <% } %>
@@ -1,12 +0,0 @@
1
- <%# This template is used if the Option `generateAlias` is enabled %>
2
- {
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "paths": { <% girModules.forEach(function(module, idx) { %>
6
- <%_ const pkg = dep.get(module.namespace, module.version) _%>
7
- <%_ const path = package ? join(typeDir, pkg.importName, pkg.importName) : join(typeDir, pkg.importName) _%>
8
- "gi://<%= module.namespace %>?version=<%= module.version %>": ["<%= path %>.d.ts"]<% if (idx < girModules.length - 1) { %>,<% } %><% }); %>
9
- }
10
- },
11
- "include": ["<%= typeDir %>/*.ts"]
12
- }
@@ -1,7 +0,0 @@
1
- // Workaround
2
- /** @ignore */
3
- export module GraniteServicesSettingsSerializable {
4
- export interface ConstructorProperties extends ServicesSettingsSerializable.ConstructorProperties {}
5
- }
6
- /** @ignore */
7
- export interface GraniteServicesSettingsSerializable extends ServicesSettingsSerializable {}
@@ -1,7 +0,0 @@
1
- // Workaround
2
- /** @ignore */
3
- export module GraniteServicesSettingsSerializable {
4
- export interface ConstructorProperties extends ServicesSettingsSerializable.ConstructorProperties {}
5
- }
6
- /** @ignore */
7
- export interface GraniteServicesSettingsSerializable extends ServicesSettingsSerializable {}
@@ -1,5 +0,0 @@
1
- // Workaround
2
- /** @ignore */
3
- export module BaseSink {
4
- export type ConstructorProperties = Gst.BaseSink.ConstructorProperties;
5
- }
@@ -1,71 +0,0 @@
1
- <%# This template is used if the Option `package` is enabled %>
2
- # <%- packageName %>
3
-
4
- <%- PACKAGE_DESC %> using [<%- APP_NAME %>](<%- APP_SOURCE %>) v<%- APP_VERSION %>.
5
-
6
- <%_ if (typeof pkgData !== 'undefined' && pkgData.description) { _%>
7
- <%- pkgData.description %>
8
- <%_ } else { _%>
9
- [node-gtk](https://github.com/romgrk/node-gtk) is a [GObject Introspection](https://gi.readthedocs.io/en/latest/) import library for Node.js. Using node-gtk with the type definitions in this NPM package, you can build GTK applications in JavaScript or TypeScript with type checking, better autocompletion and inline documentations.
10
- <%_ } _%>
11
-
12
- ## Install
13
-
14
- To use this type definitions, install them with NPM:
15
- ```bash
16
- npm install <%- npmScope %>/<%- importName %>
17
- ```
18
-
19
- <%_ const pkg = dep.get(packageName) _%>
20
- <%_ if(!pkg){ _%>
21
- <%_ return `Package with package name "${packageName}" not found!` _%>
22
- <%_ } _%>
23
-
24
- ## Usage
25
-
26
- You can import this package into your project like this:
27
- ```ts
28
- import <%- pkg.namespace %> from '<%- pkg.importPath %>';
29
- ```
30
-
31
- Or if you prefer CommonJS, you can also use this:
32
- ```ts
33
- const <%- pkg.namespace %> = require('<%- pkg.importPath %>');
34
- ```
35
-
36
- ### Ambient Modules
37
-
38
- You can import core [ambient module](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) types.
39
- For this you need to include the `<%- npmScope %>/<%- importName %>` or `<%- npmScope %>/<%- importName %>/ambient` in your `tsconfig` or entry point Typescript file:
40
-
41
- `index.ts`:
42
- ```ts
43
- import '<%- npmScope %>/<%- importName %>'
44
- ```
45
-
46
- `tsconfig.json`:
47
- ```json
48
- {
49
- "compilerOptions": {
50
- ...
51
- },
52
- "include": ["<%- npmScope %>/<%- importName %>"],
53
- ...
54
- }
55
- ```
56
-
57
- Now you can import `node-gtk` with Typescript support:
58
- ```ts
59
- const gi = require('node-gtk');
60
- gi.startLoop();
61
- ```
62
-
63
- If you want to have types for [GObject Introspection](https://gi.readthedocs.io/en/latest/) modules, you have to add them to your dependencies and import them as well, see the description of these modules, e.g. [node-gtk-4.0](https://www.npmjs.com/package/@girs/node-gtk-4.0), [node-gio-2.0](https://www.npmjs.com/package/@girs/node-gio-2.0), [node-adw-1](https://www.npmjs.com/package/@girs/node-adw-1) and [much more](https://github.com/gjsify/types).
64
-
65
- ### Bundle
66
-
67
- Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
68
-
69
- ## Other packages
70
-
71
- All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
@@ -1,19 +0,0 @@
1
- // https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules
2
- // https://stackoverflow.com/questions/45099605/ambient-declaration-with-an-imported-type-in-typescript
3
- declare module 'node-gtk' {
4
- <%_ const pkg = dep.getNodeGtk() _%>
5
- <%_ if(package){ _%>
6
- <% if(moduleType === 'esm'){ %>
7
- import gi from '<%= pkg.importPath %>';
8
- <% } else { %>
9
- import * as gi from '<%= pkg.importPath %>';
10
- <% } %>
11
- <%_ } else { _%>
12
- <% if(moduleType === 'esm'){ %>
13
- const gi: typeof import('<%= pkg.importPath %>').default;
14
- <% } else { %>
15
- const gi: typeof import('<%= pkg.importPath %>');
16
- <% } %>
17
- <%_ } _%>
18
- export = gi;
19
- }
@@ -1,57 +0,0 @@
1
- // See https://github.com/romgrk/node-gtk/blob/master/lib/overrides/GObject.js
2
-
3
- export type GType<T = unknown> = {
4
- __type__(arg: never): T
5
- name: string
6
- };
7
-
8
- // TODO: What about the generated class Closure
9
- export type TClosure<R = any, P = any> = (...args: P[]) => R;
10
-
11
- export let TYPE_INVALID : 0n
12
- export let TYPE_NONE : GType<undefined>;
13
- export let TYPE_INTERFACE : GType<unknown>;
14
- export let TYPE_CHAR : GType<string>;
15
- export let TYPE_UCHAR : GType<string>;
16
- export let TYPE_BOOLEAN : GType<boolean>;
17
- export let TYPE_INT : GType<number>;
18
- export let TYPE_UINT : GType<number>;
19
- export let TYPE_LONG : GType<number>;
20
- export let TYPE_ULONG : GType<number>;
21
- export let TYPE_INT64 : GType<number>;
22
- export let TYPE_UINT64 : GType<number>;
23
- export let TYPE_ENUM : GType<number>;
24
- export let TYPE_FLAGS : GType<number>;
25
- export let TYPE_FLOAT : GType<number>;
26
- export let TYPE_DOUBLE : GType<number>;
27
- export let TYPE_STRING : GType<string>;
28
- export let TYPE_POINTER : GType<undefined>;
29
- export let TYPE_BOXED : GType<unknown>;
30
- export let TYPE_PARAM : GType<unknown>;
31
- export let TYPE_OBJECT : GType<object>;
32
- export let TYPE_GTYPE : GType<unknown>;
33
- export let TYPE_VARIANT : GType<unknown>;
34
- export let TYPE_UNICHAR : GType<number>;
35
-
36
- export function typeFromName(name: 'void'): typeof TYPE_INVALID
37
- export function typeFromName(name: 'GInterface'): typeof TYPE_INTERFACE
38
- export function typeFromName(name: 'gchar'): typeof TYPE_CHAR
39
- export function typeFromName(name: 'guchar'): typeof TYPE_UCHAR
40
- export function typeFromName(name: 'gboolean'): typeof TYPE_BOOLEAN
41
- export function typeFromName(name: 'gint'): typeof TYPE_INT
42
- export function typeFromName(name: 'guint'): typeof TYPE_UINT
43
- export function typeFromName(name: 'glong'): typeof TYPE_LONG
44
- export function typeFromName(name: 'gulong'): typeof TYPE_ULONG
45
- export function typeFromName(name: 'gint64'): typeof TYPE_INT64
46
- export function typeFromName(name: 'guint64'): typeof TYPE_UINT64
47
- export function typeFromName(name: 'GEnum'): typeof TYPE_ENUM
48
- export function typeFromName(name: 'GFlags'): typeof TYPE_FLAGS
49
- export function typeFromName(name: 'gfloat'): typeof TYPE_FLOAT
50
- export function typeFromName(name: 'gdouble'): typeof TYPE_DOUBLE
51
- export function typeFromName(name: 'gchararray'): typeof TYPE_STRING
52
- export function typeFromName(name: 'gpointer'): typeof TYPE_POINTER
53
- export function typeFromName(name: 'GBoxed'): typeof TYPE_BOXED
54
- export function typeFromName(name: 'GParam'): typeof TYPE_PARAM
55
- export function typeFromName(name: 'GObject'): typeof TYPE_OBJECT
56
- export function typeFromName(name: 'GType'): typeof TYPE_GTYPE
57
- export function typeFromName(name: 'GVariant'): typeof TYPE_VARIANT
@@ -1,29 +0,0 @@
1
- <%#
2
- This EJS template is used to extend the global NodeGtkGi interface with the GIR module, for `gi.require(namespace) node-gtk GIR types`
3
- %>
4
- <%_ const pkg = dep.get(girModule.namespace, girModule.version) _%>
5
- <%_ if(package){ _%>
6
- <%_ if(noNamespace){ _%>
7
- import * as <%= girModule.importNamespace %> from '<%= pkg.importPath %>';
8
- <%_ } else { _%>
9
- import <%= girModule.importNamespace %> from '<%= pkg.importPath %>';
10
- <%_ } _%>
11
- <%_ } else { _%>
12
- <%_ if(noNamespace){ _%>
13
- type <%= girModule.importNamespace %> = typeof import('<%= pkg.importPath %>');
14
- <%_ } else { _%>
15
- type <%= girModule.importNamespace %> = typeof import('<%= pkg.importPath %>').default;
16
- <%_ } _%>
17
- <%_ } _%>
18
-
19
- declare global {
20
- interface NodeGtkGi {
21
- <%_ if(package){ _%>
22
- require(ns: '<%= girModule.namespace %>', ver?: '<%= girModule.version %>'): typeof <%= girModule.importNamespace %>;
23
- <%_ } else { _%>
24
- require(ns: '<%= girModule.namespace %>', ver?: '<%= girModule.version %>'): <%= girModule.importNamespace %>;
25
- <%_ } _%>
26
- }
27
- }
28
-
29
- export default NodeGtkGi;
@@ -1 +0,0 @@
1
- // END
@@ -1,10 +0,0 @@
1
- <%# This template is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ... %>
2
- /*
3
- * Type Definitions for node-gtk (https://github.com/romgrk/node-gtk)
4
- *
5
- * These type definitions are automatically generated, do not edit them by hand.
6
- * If you found a bug fix it in <%= APP_NAME %> itself or create a bug report on <%= APP_SOURCE %>
7
- */
8
-
9
- import './<%= importName %>-import.d.ts';
10
-
@@ -1,18 +0,0 @@
1
- <% if(moduleType === 'esm'){ %>
2
- import gi from 'node-gtk';
3
- const { require: giRequire } = gi;
4
- const <%= name %> = giRequire('<%= name %>', '<%= version %>');
5
- export { <%= name %> };
6
- export default <%= name %>;
7
- <% } else { %>
8
- const { require: giRequire } = require('node-gtk');
9
- const <%= name %> = giRequire('<%= name %>', '<%= version %>');
10
- <% if(!noNamespace){ %>
11
- module.exports = { <%= name %> };
12
- exports.default = <%= name %>;
13
- <% } else { %>
14
- module.exports = <%= name %>;
15
- <% } %>
16
- <% } %>
17
-
18
-