@girs/gjs 4.0.0-rc.7 → 4.0.0-rc.9

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.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  ![version](https://img.shields.io/npm/v/@girs/gjs)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gjs)
6
6
 
7
- GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-rc.7.
7
+ GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-rc.9.
8
8
 
9
9
  [GJS](https://gitlab.gnome.org/GNOME/gjs) is a JavaScript runtime for the GNOME ecosystem. Using GJS and 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
10
 
package/cairo.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  // Cairo 1.0
2
4
  import Cairo from '@girs/cairo-1.0';
3
5
  import type GObject from '@girs/gobject-2.0';
@@ -64,7 +66,7 @@ declare namespace giCairo {
64
66
 
65
67
  /**
66
68
  * The main Cairo drawing context
67
- *
69
+ *
68
70
  * A Cairo context is used to draw to surfaces and perform drawing operations.
69
71
  * When you're done with a context, you must call $dispose() to free memory.
70
72
  */
@@ -77,7 +79,7 @@ declare namespace giCairo {
77
79
 
78
80
  /**
79
81
  * Free a Cairo.Context and all associated memory
80
- *
82
+ *
81
83
  * Unlike other objects in GJS, Cairo contexts must be explicitly disposed
82
84
  * to avoid memory leaks.
83
85
  */
@@ -576,7 +578,12 @@ declare namespace giCairo {
576
578
  * @param clusters Cluster mapping (bytes to glyphs)
577
579
  * @param clusterFlags Direction of cluster mapping
578
580
  */
579
- showTextGlyphs(utf8: string, glyphs: Glyph[], clusters: TextCluster[], clusterFlags: TextClusterFlags): void;
581
+ showTextGlyphs(
582
+ utf8: string,
583
+ glyphs: Glyph[],
584
+ clusters: TextCluster[],
585
+ clusterFlags: TextClusterFlags,
586
+ ): void;
580
587
 
581
588
  /**
582
589
  * Computes the extents of an array of glyphs in user-space coordinates
@@ -763,7 +770,8 @@ declare namespace giCairo {
763
770
  /**
764
771
  * Base class for all Cairo patterns
765
772
  */
766
- export class Pattern extends Cairo.Pattern {}
773
+ export class Pattern extends Cairo.Pattern {
774
+ }
767
775
 
768
776
  /**
769
777
  * Base class for all gradient patterns
@@ -929,3 +937,6 @@ declare namespace giCairo {
929
937
  }
930
938
 
931
939
  export default giCairo;
940
+
941
+
942
+
package/console.d.ts CHANGED
@@ -1,21 +1,26 @@
1
+
2
+
1
3
  /**
2
4
  * @param logDomain the GLib log domain this Console should print
3
5
  * with. Defaults to 'Gjs-Console'.
4
6
  */
5
- export function setConsoleLogDomain(logDomain: string): void;
7
+ export function setConsoleLogDomain(logDomain: string): void
6
8
 
7
9
  /**
8
10
  * @param logDomain the GLib log domain this Console should print
9
11
  * with. Defaults to 'Gjs-Console'.
10
12
  */
11
- export function getConsoleLogDomain(): string;
13
+ export function getConsoleLogDomain(): string
12
14
 
13
- export declare const DEFAULT_LOG_DOMAIN: string;
15
+ export declare const DEFAULT_LOG_DOMAIN: string
14
16
 
15
17
  declare const Console: {
16
- setConsoleLogDomain: typeof setConsoleLogDomain;
17
- getConsoleLogDomain: typeof getConsoleLogDomain;
18
- DEFAULT_LOG_DOMAIN: typeof DEFAULT_LOG_DOMAIN;
19
- };
18
+ setConsoleLogDomain: typeof setConsoleLogDomain,
19
+ getConsoleLogDomain: typeof getConsoleLogDomain,
20
+ DEFAULT_LOG_DOMAIN: typeof DEFAULT_LOG_DOMAIN
21
+ }
22
+
23
+ export default Console
24
+
25
+
20
26
 
21
- export default Console;
package/dom.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  /**
2
3
  * Gjs has implemented some functionality from the DOM API,
3
4
  * this leads to a conflict when all DOM (`lib.dom.d.ts`) should be used.
@@ -9,10 +10,12 @@
9
10
  * See also https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts
10
11
  */
11
12
 
13
+
12
14
  import type GLib from '@girs/glib-2.0';
13
15
  import type GObject from '@girs/gobject-2.0';
14
16
 
15
17
  declare global {
18
+
16
19
  interface ImportMeta {
17
20
  /**
18
21
  * The absolute file: or resource: URL of the module.
@@ -31,7 +34,7 @@ declare global {
31
34
  * @param delay the duration in milliseconds to wait before running callback
32
35
  * @param args arguments to pass to callback
33
36
  */
34
- function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
37
+ function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
35
38
 
36
39
  /**
37
40
  * @since 1.71.1
@@ -39,19 +42,19 @@ declare global {
39
42
  * @param delay the duration in milliseconds to wait between calling callback
40
43
  * @param args arguments to pass to callback
41
44
  */
42
- function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
45
+ function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
43
46
 
44
47
  /**
45
48
  * @since 1.71.1
46
49
  * @param timeout the timeout to clear
47
50
  */
48
- function clearTimeout(timeout: GLib.Source): void;
51
+ function clearTimeout(timeout: GLib.Source): void
49
52
 
50
53
  /**
51
54
  * @since 1.71.1
52
55
  * @param timeout the timeout to clear
53
56
  */
54
- function clearInterval(timeout: GLib.Source): void;
57
+ function clearInterval(timeout: GLib.Source): void
55
58
 
56
59
  interface Console {
57
60
  /**
@@ -63,7 +66,7 @@ declare global {
63
66
  * @param data formatting substitutions, if applicable
64
67
  * @returns
65
68
  */
66
- assert(condition: boolean, ...data: any[]): void;
69
+ assert(condition: boolean, ...data: any[]): void
67
70
 
68
71
  /**
69
72
  * Resets grouping and clears the terminal on systems supporting ANSI
@@ -73,14 +76,14 @@ declare global {
73
76
  * console.clear() has no visual effect.
74
77
  *
75
78
  */
76
- clear(): void;
79
+ clear(): void
77
80
 
78
81
  /**
79
82
  * Logs a message with severity equal to {@link GLib.LogLevelFlags.DEBUG}.
80
83
  *
81
84
  * @param {...any} data formatting substitutions, if applicable
82
85
  */
83
- debug(...data: any[]): void;
86
+ debug(...data: any[]): void
84
87
 
85
88
  /**
86
89
  * Logs a message with severity equal to {@link GLib.LogLevelFlags.CRITICAL}.
@@ -89,46 +92,46 @@ declare global {
89
92
  *
90
93
  * @param data formatting substitutions, if applicable
91
94
  */
92
- error(...data: any[]): void;
95
+ error(...data: any[]): void
93
96
 
94
97
  /**
95
98
  * Logs a message with severity equal to {@link GLib.LogLevelFlags.INFO}.
96
99
  *
97
100
  * @param data formatting substitutions, if applicable
98
101
  */
99
- info(...data: any[]): void;
102
+ info(...data: any[]): void
100
103
 
101
104
  /**
102
105
  * Logs a message with severity equal to {@link GLib.LogLevelFlags.MESSAGE}.
103
106
  *
104
107
  * @param data formatting substitutions, if applicable
105
108
  */
106
- log(...data: any[]): void;
109
+ log(...data: any[]): void
107
110
 
108
111
  // 1.1.7 table(tabularData, properties)
109
- table(tabularData: any, _properties: never): void;
112
+ table(tabularData: any, _properties: never): void
110
113
 
111
114
  /**
112
115
  * @param data formatting substitutions, if applicable
113
116
  */
114
- trace(...data: any[]): void;
117
+ trace(...data: any[]): void
115
118
 
116
119
  /**
117
120
  * @param data formatting substitutions, if applicable
118
121
  */
119
- warn(...data: any[]): void;
122
+ warn(...data: any[]): void
120
123
 
121
124
  /**
122
125
  * @param item an item to format generically
123
126
  * @param [options] any additional options for the formatter. Unused
124
127
  * in our implementation.
125
128
  */
126
- dir(item: object, options: never): void;
129
+ dir(item: object, options: never): void
127
130
 
128
131
  /**
129
132
  * @param data formatting substitutions, if applicable
130
133
  */
131
- dirxml(...data: any[]): void;
134
+ dirxml(...data: any[]): void
132
135
 
133
136
  // 1.2 Counting functions
134
137
  // https://console.spec.whatwg.org/#counting
@@ -140,12 +143,12 @@ declare global {
140
143
  *
141
144
  * @param label unique identifier for this action
142
145
  */
143
- count(label: string): void;
146
+ count(label: string): void
144
147
 
145
148
  /**
146
149
  * @param label the unique label to reset the count for
147
150
  */
148
- countReset(label: string): void;
151
+ countReset(label: string): void
149
152
 
150
153
  // 1.3 Grouping functions
151
154
  // https://console.spec.whatwg.org/#grouping
@@ -153,18 +156,18 @@ declare global {
153
156
  /**
154
157
  * @param data formatting substitutions, if applicable
155
158
  */
156
- group(...data: any[]): void;
159
+ group(...data: any[]): void
157
160
 
158
161
  /**
159
162
  * Alias for console.group()
160
163
  *
161
164
  * @param {...any} data formatting substitutions, if applicable
162
165
  */
163
- groupCollapsed(...data: any[]): void;
166
+ groupCollapsed(...data: any[]): void
164
167
 
165
168
  /**
166
169
  */
167
- groupEnd(): void;
170
+ groupEnd(): void
168
171
 
169
172
  // 1.4 Timing functions
170
173
  // https://console.spec.whatwg.org/#timing
@@ -173,7 +176,7 @@ declare global {
173
176
  * @param label unique identifier for this action, pass to
174
177
  * console.timeEnd() to complete
175
178
  */
176
- time(label: string): void;
179
+ time(label: string): void
177
180
 
178
181
  /**
179
182
  * Logs the time since the last call to console.time(label) where label is
@@ -183,7 +186,7 @@ declare global {
183
186
  * console.timeEnd() to complete
184
187
  * @param data string substitutions, if applicable
185
188
  */
186
- timeLog(label: string, ...data: any[]): void;
189
+ timeLog(label: string, ...data: any[]): void
187
190
 
188
191
  /**
189
192
  * Logs the time since the last call to console.time(label) and completes
@@ -192,7 +195,7 @@ declare global {
192
195
  *
193
196
  * @param label unique identifier for this action
194
197
  */
195
- timeEnd(label: string): void;
198
+ timeEnd(label: string): void
196
199
 
197
200
  // Non-standard functions which are de-facto standards.
198
201
  // Similar to Node, we define these as no-ops for now.
@@ -203,21 +206,21 @@ declare global {
203
206
  * @param _label unique identifier for this action, pass to
204
207
  * console.profileEnd to complete
205
208
  */
206
- profile(_label: string): void;
209
+ profile(_label: string): void
207
210
 
208
211
  /**
209
212
  * @deprecated Not implemented in GJS
210
213
  *
211
214
  * @param _label unique identifier for this action
212
215
  */
213
- profileEnd(_label: string): void;
216
+ profileEnd(_label: string): void
214
217
 
215
218
  /**
216
219
  * @deprecated Not implemented in GJS
217
220
  *
218
221
  * @param _label unique identifier for this action
219
222
  */
220
- timeStamp(_label: string): void;
223
+ timeStamp(_label: string): void
221
224
  }
222
225
 
223
226
  interface TextDecodeOptions {
@@ -227,9 +230,9 @@ declare global {
227
230
 
228
231
  interface TextDecoderOptions {
229
232
  /** Indicates whether the error mode is fatal. */
230
- fatal?: boolean;
233
+ fatal?: boolean
231
234
  /** Indicates whether whether the byte order mark is ignored. */
232
- ignoreBOM?: boolean;
235
+ ignoreBOM?: boolean
233
236
  }
234
237
 
235
238
  /**
@@ -240,11 +243,11 @@ declare global {
240
243
  */
241
244
  interface TextDecoder {
242
245
  /** A string containing the name of the decoder, that is a string describing the method the TextDecoder will use. */
243
- readonly encoding: TextDecoderEncoding;
246
+ readonly encoding: TextDecoderEncoding
244
247
  /** A Boolean indicating whether the error mode is fatal. */
245
- readonly fatal: boolean;
248
+ readonly fatal: boolean
246
249
  /** A Boolean indicating whether the byte order mark is ignored. */
247
- readonly ignoreBOM: boolean;
250
+ readonly ignoreBOM: boolean
248
251
 
249
252
  /**
250
253
  * Returns a string containing the text decoded with the method of the specific TextDecoder object.
@@ -254,12 +257,12 @@ declare global {
254
257
  * @param input Buffer containing the text to decode
255
258
  * @param options Object defining the decode options
256
259
  */
257
- decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string;
260
+ decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string
258
261
  }
259
262
 
260
263
  interface TextEncoderEncodeIntoResult {
261
- read?: number;
262
- written?: number;
264
+ read?: number
265
+ written?: number
263
266
  }
264
267
 
265
268
  /**
@@ -268,14 +271,14 @@ declare global {
268
271
  * @since 1.69.2
269
272
  */
270
273
  interface TextEncoder {
271
- readonly encoding: 'utf-8';
274
+ readonly encoding: 'utf-8'
272
275
 
273
276
  /**
274
277
  * Takes a string as input, and returns a buffer containing the text given in parameters encoded with the UTF-8 method.
275
278
  *
276
279
  * @param input Text to encode.
277
280
  */
278
- encode(input?: string): Uint8Array;
281
+ encode(input?: string): Uint8Array
279
282
  /**
280
283
  * Takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into,
281
284
  * and returns a dictionary object indicating the progress of the encoding.
@@ -285,20 +288,21 @@ declare global {
285
288
  * @param source Text to encode.
286
289
  * @param destination Buffer where to place the resulting UTF-8 encoded text into.
287
290
  */
288
- encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
291
+ encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult
289
292
  }
290
293
 
291
- const console: Console;
294
+ const console: Console
292
295
 
293
296
  const TextDecoder: {
294
- prototype: TextDecoder;
295
- new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder;
296
- };
297
+ prototype: TextDecoder
298
+ new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder
299
+ }
297
300
 
298
301
  const TextEncoder: {
299
- prototype: TextEncoder;
300
- new (): TextEncoder;
301
- };
302
+ prototype: TextEncoder
303
+ new (): TextEncoder
304
+ }
302
305
  }
303
306
 
304
- export {};
307
+ export {}
308
+
package/gettext.d.ts CHANGED
@@ -7,35 +7,38 @@ export enum LocaleCategory {
7
7
  NUMERIC,
8
8
  TIME,
9
9
  }
10
- export function setlocale(category: number, locale: string | null): string;
11
- export function textdomain(domainname: string | null): string;
12
- export function bindtextdomain(domainname: string, dirname: string | null): string;
13
- export function gettext(msgid: string): string;
14
- export function dgettext(domainname: string | null, msgid: string): string;
15
- export function dcgettext(domainname: string | null, msgid: string, category: number): string;
16
- export function ngettext(msgid: string, msgid_plural: string, n: number): string;
17
- export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string;
18
- export function pgettext(context: string, msgid: string): string;
19
- export function dpgettext(dom: string | null, context: string, msgid: string): string;
10
+ export function setlocale(category: number, locale: string | null): string
11
+ export function textdomain(domainname: string | null): string
12
+ export function bindtextdomain(domainname: string, dirname: string | null): string
13
+ export function gettext(msgid: string): string
14
+ export function dgettext(domainname: string | null, msgid: string): string
15
+ export function dcgettext(domainname: string | null, msgid: string, category: number): string
16
+ export function ngettext(msgid: string, msgid_plural: string, n: number): string
17
+ export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string
18
+ export function pgettext(context: string, msgid: string): string
19
+ export function dpgettext(dom: string | null, context: string, msgid: string): string
20
20
  export function domain(domainName: string): {
21
- gettext: (msgid: string) => string;
22
- ngettext: (msgid: string, msgid_plural: string, n: number) => string;
23
- pgettext: (context: string, msgid: string) => string;
24
- };
21
+ gettext: (msgid: string) => string
22
+ ngettext: (msgid: string, msgid_plural: string, n: number) => string
23
+ pgettext: (context: string, msgid: string) => string
24
+ }
25
25
 
26
26
  declare const Gettext: {
27
- LocaleCategory: typeof LocaleCategory;
28
- setlocale: typeof setlocale;
29
- textdomain: typeof textdomain;
30
- bindtextdomain: typeof bindtextdomain;
31
- gettext: typeof gettext;
32
- dgettext: typeof dgettext;
33
- dcgettext: typeof dcgettext;
34
- ngettext: typeof ngettext;
35
- dngettext: typeof dngettext;
36
- pgettext: typeof pgettext;
37
- dpgettext: typeof dpgettext;
38
- domain: typeof domain;
39
- };
27
+ LocaleCategory: typeof LocaleCategory,
28
+ setlocale: typeof setlocale,
29
+ textdomain: typeof textdomain,
30
+ bindtextdomain: typeof bindtextdomain,
31
+ gettext: typeof gettext,
32
+ dgettext: typeof dgettext,
33
+ dcgettext: typeof dcgettext,
34
+ ngettext: typeof ngettext,
35
+ dngettext: typeof dngettext,
36
+ pgettext: typeof pgettext,
37
+ dpgettext: typeof dpgettext,
38
+ domain: typeof domain,
39
+ }
40
+
41
+ export default Gettext
42
+
43
+
40
44
 
41
- export default Gettext;
package/gi.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  /**
2
3
  * Requires a GObject Introspection namespace, optionally at a specific version.
3
4
  * If a version is specified and a different version of the same namespace is
@@ -7,7 +8,7 @@
7
8
  * @param version The version of the namespace (e.g. '4.0', '2.0')
8
9
  * @returns The imported namespace module
9
10
  */
10
- export function require(namespace: string, version?: string): any;
11
+ export function require(namespace: string, version?: string): any
11
12
 
12
13
  /**
13
14
  * The `gi` module provides a single entry point for importing GObject
@@ -23,6 +24,9 @@ export function require(namespace: string, version?: string): any;
23
24
  */
24
25
  declare const Gi: {
25
26
  readonly require: typeof require;
26
- };
27
+ }
28
+
29
+ export default Gi
30
+
31
+
27
32
 
28
- export default Gi;
package/gjs-ambient.d.ts CHANGED
@@ -2,30 +2,32 @@
2
2
  // https://stackoverflow.com/questions/45099605/ambient-declaration-with-an-imported-type-in-typescript
3
3
 
4
4
  declare module 'gettext' {
5
- export * from '@girs/gjs/gettext';
6
- import Gettext from '@girs/gjs/gettext';
7
- export default Gettext;
5
+ export * from '@girs/gjs/gettext'
6
+ import Gettext from '@girs/gjs/gettext'
7
+ export default Gettext
8
8
  }
9
9
 
10
10
  declare module 'system' {
11
- export * from '@girs/gjs/system';
12
- import System from '@girs/gjs/system';
13
- export default System;
11
+ export * from '@girs/gjs/system'
12
+ import System from '@girs/gjs/system'
13
+ export default System
14
14
  }
15
15
 
16
16
  declare module 'cairo' {
17
- import Cairo from '@girs/gjs/cairo';
18
- export default Cairo;
17
+ import Cairo from '@girs/gjs/cairo'
18
+ export default Cairo
19
19
  }
20
20
 
21
21
  declare module 'console' {
22
- import Console, { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN } from '@girs/gjs/console';
23
- export { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN };
24
- export default Console;
22
+ import Console, { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN } from '@girs/gjs/console'
23
+ export { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN }
24
+ export default Console
25
25
  }
26
26
 
27
27
  declare module 'gi' {
28
- import Gi, { require } from '@girs/gjs/gi';
29
- export { require };
30
- export default Gi;
28
+ import Gi, { require } from '@girs/gjs/gi'
29
+ export { require }
30
+ export default Gi
31
31
  }
32
+
33
+
package/gjs.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  /**
2
3
  * Type Definitions for Gjs (https://gjs.guide/)
3
4
  *
@@ -21,73 +22,73 @@ declare namespace package {
21
22
  */
22
23
  interface PackageInitParams {
23
24
  /** The base name of the entry point (eg. org.foo.Bar.App) */
24
- name: string;
25
+ name: string
25
26
  /** The version of the package */
26
- version: string;
27
+ version: string
27
28
  /** The prefix of the package */
28
- prefix: string;
29
+ prefix: string
29
30
  /**
30
31
  * The final datadir and libdir when installed;
31
32
  * usually, these would be prefix + '/share' and
32
33
  * and prefix + '/lib' (or '/lib64')
33
34
  */
34
- libdir: string;
35
+ libdir: string
35
36
  /**
36
37
  * The final datadir and libdir when installed;
37
38
  * usually, these would be prefix + '/share' and
38
39
  * and prefix + '/lib' (or '/lib64')
39
40
  */
40
- datadir?: string;
41
+ datadir?: string
41
42
  }
42
43
 
43
44
  /**
44
45
  * The base name of the entry point (eg. org.foo.Bar.App)
45
- *
46
+ *
46
47
  * Note: Run `pkg.init()` before accessing this property.
47
48
  */
48
- export const name: string;
49
+ export const name: string
49
50
  /**
50
51
  * The version of the package
51
- *
52
+ *
52
53
  * Note: Run `pkg.init()` before accessing this property.
53
54
  */
54
- export const version: string;
55
+ export const version: string
55
56
  /**
56
57
  * The prefix of the package
57
- *
58
+ *
58
59
  * Note: Run `pkg.init()` before accessing this property.
59
60
  */
60
- export const prefix: string;
61
+ export const prefix: string
61
62
  /**
62
63
  * The final datadir when installed; usually, these would be prefix + '/share'
63
- *
64
+ *
64
65
  * Note: Run `pkg.init()` before accessing this property.
65
66
  */
66
- export const datadir: string;
67
+ export const datadir: string
67
68
  /**
68
69
  * The final libdir when installed; usually, these would be prefix + '/lib' (or '/lib64')
69
- *
70
+ *
70
71
  * Note: Run `pkg.init()` before accessing this property.
71
72
  */
72
- export const libdir: string;
73
+ export const libdir: string
73
74
  /**
74
75
  * The final pkglibdir when installed; usually, this would be prefix + '/lib' (or '/lib64')
75
- *
76
+ *
76
77
  * Note: Run `pkg.init()` before accessing this property.
77
78
  */
78
- export const pkglibdir: string;
79
+ export const pkglibdir: string
79
80
  /**
80
81
  * The final moduledir when installed; usually, this would be prefix + '/lib' (or '/lib64')
81
- *
82
+ *
82
83
  * Note: Run `pkg.init()` before accessing this property.
83
84
  */
84
- export const moduledir: string;
85
+ export const moduledir: string
85
86
  /**
86
87
  * The directory containing gettext translation files; this will be datadir + '/locale' when installed and './po' in the source tree
87
- *
88
+ *
88
89
  * Note: Run `pkg.init()` before accessing this property.
89
90
  */
90
- export const localedir: string;
91
+ export const localedir: string
91
92
 
92
93
  /**
93
94
  * Initialize directories and global variables. Must be called
@@ -196,25 +197,25 @@ declare namespace package {
196
197
  export function initGettext(): void;
197
198
  /**
198
199
  * Initializes string formatting capabilities by adding a format() method to String.prototype.
199
- *
200
+ *
200
201
  * After calling this method, you can use a printf-style string formatting by calling
201
202
  * the format() method on any string:
202
- *
203
+ *
203
204
  * @example
204
205
  * ```ts
205
206
  * pkg.initFormat();
206
- *
207
+ *
207
208
  * // Now you can use format() on any string
208
209
  * const name = "User";
209
210
  * const count = 5;
210
211
  * const formatted = "Hello %s, you have %d items".format(name, count);
211
212
  * // formatted = "Hello User, you have 5 items"
212
- *
213
+ *
213
214
  * // Format numbers with precision
214
215
  * const price = 10.5;
215
216
  * const priceStr = "Price: $%.2f".format(price);
216
217
  * // priceStr = "Price: $10.50"
217
- *
218
+ *
218
219
  * // Pad with zeros
219
220
  * const id = 42;
220
221
  * const idStr = "ID: %05d".format(id);
@@ -240,78 +241,78 @@ declare namespace package {
240
241
 
241
242
  declare namespace byteArray {
242
243
  export class ByteArray {
243
- static get(target: any, property: string, receiver: any): any;
244
- static set(target: any, property: string, value: any, receiver: any): boolean;
244
+ static get(target: any, property: string, receiver: any): any
245
+ static set(target: any, property: string, value: any, receiver: any): boolean
245
246
 
246
- length: number;
247
- protected _array: Uint8Array;
247
+ length: number
248
+ protected _array: Uint8Array
248
249
 
249
- constructor(x: Uint8Array | number);
250
- toString(encoding?: TextDecoderEncoding): string;
251
- fromString(input: string, encoding?: TextDecoderEncoding): ByteArray;
252
- toGBytes(): GLib.Bytes;
250
+ constructor(x: Uint8Array | number)
251
+ toString(encoding?: TextDecoderEncoding): string
252
+ fromString(input: string, encoding?: TextDecoderEncoding): ByteArray
253
+ toGBytes(): GLib.Bytes
253
254
  }
254
255
 
255
256
  /** @deprecated Use {@link TextEncoder.encode} instead */
256
- export function fromString(input: string, encoding?: TextDecoderEncoding): Uint8Array;
257
+ export function fromString(input: string, encoding?: TextDecoderEncoding): Uint8Array
257
258
 
258
259
  /** @deprecated Use {@link GLib.Bytes.toArray} instead */
259
- export function fromGBytes(input: GLib.Bytes): Uint8Array;
260
+ export function fromGBytes(input: GLib.Bytes): Uint8Array
260
261
 
261
262
  /** @deprecated Use {@link TextDecoder.decode} instead */
262
- export function toString(x: Uint8Array, encoding?: TextDecoderEncoding): string;
263
+ export function toString(x: Uint8Array, encoding?: TextDecoderEncoding): string
263
264
 
264
265
  /** @deprecated Use {@link GLib.Bytes new GLib.Bytes() } instead */
265
- export function toGBytes(x: Uint8Array): GLib.Bytes;
266
+ export function toGBytes(x: Uint8Array): GLib.Bytes
266
267
 
267
268
  /** @deprecated Use {@link ByteArray new ByteArray()} instead */
268
- export function fromArray(array: Iterable<number>): ByteArray;
269
+ export function fromArray(array: Iterable<number>): ByteArray
269
270
  }
270
271
 
271
272
  declare namespace lang {
272
273
  // TODO: There is a lot more in Lang
273
- export function Class(props: any): void;
274
+ export function Class(props: any): void
274
275
  }
275
276
 
276
277
  declare namespace format {
277
278
  /**
278
279
  * Formats a string using printf-style format specifiers.
279
- *
280
+ *
280
281
  * @param str The format string
281
282
  * @param args The arguments to be formatted
282
283
  * @returns The formatted string
283
284
  */
284
285
  export function vprintf(str: string, args: (string | number | boolean | null | undefined)[]): string;
285
-
286
+
286
287
  /**
287
288
  * Prints a formatted string to the console.
288
289
  * Similar to C's printf function.
289
- *
290
+ *
290
291
  * @param fmt The format string
291
292
  * @param args The arguments to be formatted
292
293
  */
293
294
  export function printf(fmt: string, ...args: (string | number | boolean | null | undefined)[]): void;
294
-
295
+
295
296
  /**
296
297
  * Formats a string with the given arguments.
297
298
  * This is the implementation that backs String.prototype.format
298
299
  * when pkg.initFormat() is called.
299
- *
300
+ *
300
301
  * Supported format specifiers:
301
302
  * - %s: Formats as a string
302
303
  * - %d: Formats as an integer
303
304
  * - %x: Formats as a hexadecimal number
304
305
  * - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
305
- *
306
+ *
306
307
  * All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
307
308
  * If the width is prefixed with '0', it will pad with zeroes instead of spaces.
308
- *
309
+ *
309
310
  * @example
310
311
  * ```ts
311
312
  * format.format("Hello %s, you have %d items", "User", 5);
312
313
  * // Returns: "Hello User, you have 5 items"
313
314
  * ```
314
- *
315
+ *
315
316
  * @param fmt The format string
316
317
  * @param args The arguments to format the string with
317
318
  * @returns The formatted string
@@ -320,15 +321,15 @@ declare namespace format {
320
321
  }
321
322
 
322
323
  declare namespace mainloop {
323
- export function quit(name: string): void;
324
- export function idle_source(handler: any, priority?: number): any;
325
- export function idle_add(handler: any, priority?: number): any;
326
- export function timeout_source(timeout: any, handler: any, priority?: number): any;
327
- export function timeout_seconds_source(timeout: any, handler: any, priority?: number): any;
328
- export function timeout_add(timeout: any, handler: any, priority?: number): any;
329
- export function timeout_add_seconds(timeout: any, handler: any, priority?: number): any;
330
- export function source_remove(id: any): any;
331
- export function run(name: string): void;
324
+ export function quit(name: string): void
325
+ export function idle_source(handler: any, priority?: number): any
326
+ export function idle_add(handler: any, priority?: number): any
327
+ export function timeout_source(timeout: any, handler: any, priority?: number): any
328
+ export function timeout_seconds_source(timeout: any, handler: any, priority?: number): any
329
+ export function timeout_add(timeout: any, handler: any, priority?: number): any
330
+ export function timeout_add_seconds(timeout: any, handler: any, priority?: number): any
331
+ export function source_remove(id: any): any
332
+ export function run(name: string): void
332
333
  }
333
334
 
334
335
  /**
@@ -338,15 +339,15 @@ declare namespace mainloop {
338
339
  * @example
339
340
  * ```ts
340
341
  * const Signals = imports.signals;
341
- *
342
+ *
342
343
  * // Define an interface with the same name of your class to make the methods known
343
344
  * interface Events extends Signals.Methods {}
344
- *
345
+ *
345
346
  * class Events {}
346
347
  * Signals.addSignalMethods(Events.prototype);
347
- *
348
+ *
348
349
  * const events = new Events();
349
- *
350
+ *
350
351
  * // Typescript will not complain here
351
352
  * events.emit("test-signal", "test argument");
352
353
  * ```
@@ -355,13 +356,13 @@ export interface SignalMethods {
355
356
  /**
356
357
  * Connects a callback to a signal for an object. Pass the returned ID to
357
358
  * `disconnect()` to remove the handler.
358
- *
359
+ *
359
360
  * If `callback` returns `true`, emission will stop and no other handlers will be
360
361
  * invoked.
361
- *
362
+ *
362
363
  * > Warning: Unlike GObject signals, `this` within a signal callback will always
363
364
  * > refer to the global object (ie. `globalThis`).
364
- *
365
+ *
365
366
  * @param sigName A signal name
366
367
  * @param callback A callback function
367
368
  * @returns A handler ID
@@ -369,7 +370,7 @@ export interface SignalMethods {
369
370
  connect(sigName: string, callback: (self: any, ...args: any[]) => void): number;
370
371
  /**
371
372
  * Emits a signal for an object. Emission stops if a signal handler returns `true`.
372
- *
373
+ *
373
374
  * Unlike GObject signals, it is not necessary to declare signals or define their
374
375
  * signature. Simply call `emit()` with whatever signal name you wish, with
375
376
  * whatever arguments you wish.
@@ -385,7 +386,7 @@ export interface SignalMethods {
385
386
  /**
386
387
  * Disconnects all signal handlers for an object.
387
388
  */
388
- disconnectAll(): void;
389
+ disconnectAll(): void
389
390
  /**
390
391
  * Checks if a handler ID is connected.
391
392
  * @param id The ID of the handler to be disconnected
@@ -399,6 +400,7 @@ declare namespace signals {
399
400
  }
400
401
 
401
402
  declare global {
403
+
402
404
  // https://gitlab.gnome.org/GNOME/gjs/-/blob/1.73.2/modules/esm/_encoding/encodingMap.js#L7-232
403
405
  type TextDecoderEncoding =
404
406
  | 'unicode-1-1-utf-8'
@@ -620,27 +622,27 @@ declare global {
620
622
  | 'unicode'
621
623
  | 'unicodefeff'
622
624
  | 'utf-16'
623
- | 'utf-16le';
625
+ | 'utf-16le'
624
626
 
625
627
  interface GjsGiImports {
626
628
  // Will be extended by the import of more gir types
627
629
  versions: {
628
- [namespace: string]: string;
629
- };
630
+ [namespace: string]: string
631
+ }
630
632
  }
631
-
633
+
632
634
  interface GjsImports {
633
- gi: GjsGiImports;
634
- lang: typeof lang;
635
- system: typeof system;
636
- signals: typeof signals;
637
- package: typeof package;
638
- mainloop: typeof mainloop;
639
- searchPath: string[];
640
- gettext: typeof gettext;
641
- byteArray: typeof byteArray;
642
- format: typeof format;
643
- cairo: typeof cairo;
635
+ gi: GjsGiImports
636
+ lang: typeof lang
637
+ system: typeof system
638
+ signals: typeof signals
639
+ package: typeof package
640
+ mainloop: typeof mainloop
641
+ searchPath: string[]
642
+ gettext: typeof gettext
643
+ byteArray: typeof byteArray
644
+ format: typeof format
645
+ cairo: typeof cairo
644
646
  }
645
647
 
646
648
  // Overwrites, see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/script/package.js
@@ -648,50 +650,50 @@ declare global {
648
650
  * Run `pkg.initGettext()` before using this.
649
651
  * See {@link gettext.gettext}
650
652
  */
651
- const _: typeof gettext.gettext;
653
+ const _: typeof gettext.gettext
652
654
  /**
653
655
  * Run `pkg.initGettext()` before using this.
654
656
  * See {@link gettext.pgettext}
655
657
  */
656
- const C_: typeof gettext.pgettext;
658
+ const C_: typeof gettext.pgettext
657
659
  /**
658
660
  * Run `pkg.initGettext()` before using this.
659
661
  * Currently not implemented.
660
662
  */
661
- const N_: (x: string) => string;
663
+ const N_: ((x: string) => string)
662
664
 
663
- function print(...args: any[]): void;
664
- function printerr(...args: any[]): void;
665
+ function print(...args: any[]): void
666
+ function printerr(...args: any[]): void
665
667
  function log(obj: object, others?: object[]): void;
666
668
  function log(msg: string, substitutions?: any[]): void;
667
- function logError(exception: object, message?: any): void;
668
- function logError(message?: any): void;
669
+ function logError(exception: object, message?: any): void
670
+ function logError(message?: any): void
669
671
 
670
- const pkg: typeof package;
672
+ const pkg: typeof package
671
673
 
672
674
  interface BooleanConstructor {
673
- $gtype: GObject.GType<boolean>;
675
+ $gtype: GObject.GType<boolean>
674
676
  }
675
677
 
676
678
  interface NumberConstructor {
677
- $gtype: GObject.GType<number>;
679
+ $gtype: GObject.GType<number>
678
680
  }
679
681
 
680
682
  interface StringConstructor {
681
- $gtype: GObject.GType<string>;
683
+ $gtype: GObject.GType<string>
682
684
  }
683
685
 
684
686
  interface StringConstructor {
685
- $gtype: GObject.GType<string>;
687
+ $gtype: GObject.GType<string>
686
688
  }
687
689
 
688
690
  interface ObjectConstructor {
689
691
  $gtype: GObject.GType<Object>;
690
692
  }
691
693
 
692
- const imports: GjsImports;
694
+ const imports: GjsImports
693
695
 
694
- const ARGV: string[];
696
+ const ARGV: string[]
695
697
 
696
698
  interface String {
697
699
  /**
@@ -743,6 +745,8 @@ declare global {
743
745
  }
744
746
  }
745
747
 
746
- declare const _imports: GjsImports;
747
- export default _imports;
748
- export { _imports as imports };
748
+ declare const _imports: GjsImports
749
+ export default _imports
750
+ export { _imports as imports }
751
+
752
+
package/index.d.ts CHANGED
@@ -3,11 +3,13 @@
3
3
  *
4
4
  * These type definitions are automatically generated, do not edit them by hand.
5
5
  * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
6
- *
6
+ *
7
7
  * This template is used to generate the index.d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
8
8
  */
9
9
 
10
10
  import './gjs-ambient.d.ts';
11
11
 
12
+
12
13
  import gjs from './gjs.js';
13
14
  export default gjs;
15
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gjs",
3
- "version": "4.0.0-rc.7",
3
+ "version": "4.0.0-rc.9",
4
4
  "description": "GJS TypeScript type definitions for Gjs",
5
5
  "type": "module",
6
6
  "module": "gjs.js",
@@ -56,10 +56,10 @@
56
56
  "test": "tsc --project tsconfig.json"
57
57
  },
58
58
  "dependencies": {
59
- "@girs/gobject-2.0": "2.88.0-4.0.0-rc.7",
60
- "@girs/glib-2.0": "2.88.0-4.0.0-rc.7",
61
- "@girs/gio-2.0": "2.88.0-4.0.0-rc.7",
62
- "@girs/cairo-1.0": "1.0.0-4.0.0-rc.7" },
59
+ "@girs/gobject-2.0": "2.88.0-4.0.0-rc.9",
60
+ "@girs/glib-2.0": "2.88.0-4.0.0-rc.9",
61
+ "@girs/gio-2.0": "2.88.0-4.0.0-rc.9",
62
+ "@girs/cairo-1.0": "1.0.0-4.0.0-rc.9" },
63
63
  "devDependencies": {
64
64
  "typescript": "*"
65
65
  },
package/system.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  import type GObject from '@girs/gobject-2.0';
2
4
 
3
5
  /**
@@ -7,18 +9,18 @@ import type GObject from '@girs/gobject-2.0';
7
9
  * subsequent command-line arguments. In other words, `ARGV[0]` in GJS is the same as `argv[1]` in C.
8
10
  * @since 1.68
9
11
  */
10
- export const programInvocationName: string;
12
+ export const programInvocationName: string
11
13
 
12
14
  /**
13
15
  * This property contains version information about GJS.
14
16
  */
15
- export const version: number;
17
+ export const version: number
16
18
 
17
19
  /**
18
20
  * The full path of the executed program.
19
21
  * @since 1.68
20
22
  */
21
- export const programPath: string | null;
23
+ export const programPath: string | null
22
24
 
23
25
  /**
24
26
  * A list of arguments passed to the current process.
@@ -26,7 +28,7 @@ export const programPath: string | null;
26
28
  * it is not equivalent to the platform'`s` argv.
27
29
  * @since 1.68
28
30
  */
29
- export const programArgs: string[];
31
+ export const programArgs: string[]
30
32
 
31
33
  /**
32
34
  * Return the memory address of any object as a string.
@@ -39,7 +41,7 @@ export const programArgs: string[];
39
41
  * @param o Any Object
40
42
  * @returns A hexadecimal string (e.g. `0xb4f170f0`)
41
43
  */
42
- export function addressOf(o: object): string;
44
+ export function addressOf(o: object): string
43
45
 
44
46
  /**
45
47
  * Return the memory address of any GObject as a string.
@@ -48,7 +50,7 @@ export function addressOf(o: object): string;
48
50
  * @returns A hexadecimal string (e.g. `0xb4f170f0`)
49
51
  * @since 1.58
50
52
  */
51
- export function addressOfGObject(o: GObject.Object): string;
53
+ export function addressOfGObject(o: GObject.Object): string
52
54
 
53
55
  /**
54
56
  * Inserts a breakpoint instruction into the code.
@@ -81,30 +83,30 @@ export function addressOfGObject(o: GObject.Object): string;
81
83
  * breakpoint, so make sure to remove any calls to `System.breakpoint()` when
82
84
  * you're done debugging.
83
85
  */
84
- export function breakpoint(): void;
86
+ export function breakpoint(): void
85
87
 
86
88
  /**
87
89
  * Clears the timezone cache.
88
90
  * This is a workaround for SpiderMonkey Bug [#1004706](https://bugzilla.mozilla.org/show_bug.cgi?id=1004706).
89
91
  */
90
- export function clearDateCaches(): void;
92
+ export function clearDateCaches(): void
91
93
 
92
94
  /** Runs the garbage collector */
93
- export function gc(): void;
95
+ export function gc(): void
94
96
 
95
97
  /**
96
98
  * Return the reference count of any GObject-derived type. When an object's
97
99
  * reference count is zero, it is cleaned up and erased from memory.
98
100
  * @param o A {@link GObject.Object}
99
101
  */
100
- export function refcount(o: GObject.Object): number;
102
+ export function refcount(o: GObject.Object): number
101
103
  /**
102
104
  * See also: The [heapgraph](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/tools/heapgraph.md) utility in the GJS repository.
103
105
  * Dump a representation of internal heap memory. If `path` is not given, GJS will
104
106
  * write the contents to `stdout`.
105
107
  * @param path Optional file path
106
108
  */
107
- export function dumpHeap(path?: string): void;
109
+ export function dumpHeap(path?: string): void
108
110
 
109
111
  /**
110
112
  * Dump internal garbage collector statistics. If `path` is not given, GJS will
@@ -134,7 +136,7 @@ export function dumpHeap(path?: string): void;
134
136
  * ```
135
137
  *
136
138
  */
137
- export function dumpMemoryInfo(path?: string): void;
139
+ export function dumpMemoryInfo(path?: string): void
138
140
 
139
141
  /**
140
142
  * This works the same as C's exit() function; exits the program, passing a
@@ -145,7 +147,7 @@ export function dumpMemoryInfo(path?: string): void;
145
147
  * returns a non-zero error code, then `make` aborts the build.
146
148
  * @param code An exit code
147
149
  */
148
- export function exit(code: number): never;
150
+ export function exit(code: number): never
149
151
 
150
152
  /**
151
153
  * The System module provides common low-level facilities such as access to
@@ -156,19 +158,22 @@ export function exit(code: number): never;
156
158
  * be used in normal operation of a GJS application.
157
159
  */
158
160
  declare const System: {
159
- programInvocationName: typeof programInvocationName;
160
- version: typeof version;
161
- programPath: typeof programPath;
162
- programArgs: typeof programArgs;
163
- addressOf: typeof addressOf;
164
- addressOfGObject: typeof addressOfGObject;
165
- breakpoint: typeof breakpoint;
166
- clearDateCaches: typeof clearDateCaches;
167
- gc: typeof gc;
168
- refcount: typeof refcount;
169
- dumpHeap: typeof dumpHeap;
170
- dumpMemoryInfo: typeof dumpMemoryInfo;
171
- exit: typeof exit;
172
- };
173
-
174
- export default System;
161
+ programInvocationName: typeof programInvocationName,
162
+ version: typeof version,
163
+ programPath: typeof programPath,
164
+ programArgs: typeof programArgs,
165
+ addressOf: typeof addressOf,
166
+ addressOfGObject: typeof addressOfGObject,
167
+ breakpoint: typeof breakpoint,
168
+ clearDateCaches: typeof clearDateCaches,
169
+ gc: typeof gc,
170
+ refcount: typeof refcount,
171
+ dumpHeap: typeof dumpHeap,
172
+ dumpMemoryInfo: typeof dumpMemoryInfo,
173
+ exit: typeof exit,
174
+ }
175
+
176
+ export default System
177
+
178
+
179
+