@girs/gjs 4.0.0-beta.9 → 4.0.0-rc.10
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 +1 -1
- package/cairo.d.ts +941 -3
- package/console.d.ts +26 -0
- package/console.js +6 -0
- package/dom.d.ts +57 -64
- package/gettext.d.ts +31 -28
- package/gi.d.ts +32 -0
- package/gi.js +6 -0
- package/gjs-ambient.d.ts +22 -8
- package/gjs.d.ts +243 -100
- package/index.d.ts +3 -1
- package/package.json +73 -68
- package/system.d.ts +39 -34
- package/tsconfig.json +4 -3
- package/typedoc.json +4 -2
package/gjs.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
/**
|
|
2
3
|
* Type Definitions for Gjs (https://gjs.guide/)
|
|
3
4
|
*
|
|
@@ -21,43 +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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export const
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export const
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export const
|
|
44
|
+
/**
|
|
45
|
+
* The base name of the entry point (eg. org.foo.Bar.App)
|
|
46
|
+
*
|
|
47
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
48
|
+
*/
|
|
49
|
+
export const name: string
|
|
50
|
+
/**
|
|
51
|
+
* The version of the package
|
|
52
|
+
*
|
|
53
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
54
|
+
*/
|
|
55
|
+
export const version: string
|
|
56
|
+
/**
|
|
57
|
+
* The prefix of the package
|
|
58
|
+
*
|
|
59
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
60
|
+
*/
|
|
61
|
+
export const prefix: string
|
|
62
|
+
/**
|
|
63
|
+
* The final datadir when installed; usually, these would be prefix + '/share'
|
|
64
|
+
*
|
|
65
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
66
|
+
*/
|
|
67
|
+
export const datadir: string
|
|
68
|
+
/**
|
|
69
|
+
* The final libdir when installed; usually, these would be prefix + '/lib' (or '/lib64')
|
|
70
|
+
*
|
|
71
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
72
|
+
*/
|
|
73
|
+
export const libdir: string
|
|
74
|
+
/**
|
|
75
|
+
* The final pkglibdir when installed; usually, this would be prefix + '/lib' (or '/lib64')
|
|
76
|
+
*
|
|
77
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
78
|
+
*/
|
|
79
|
+
export const pkglibdir: string
|
|
80
|
+
/**
|
|
81
|
+
* The final moduledir when installed; usually, this would be prefix + '/lib' (or '/lib64')
|
|
82
|
+
*
|
|
83
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
84
|
+
*/
|
|
85
|
+
export const moduledir: string
|
|
86
|
+
/**
|
|
87
|
+
* The directory containing gettext translation files; this will be datadir + '/locale' when installed and './po' in the source tree
|
|
88
|
+
*
|
|
89
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
90
|
+
*/
|
|
91
|
+
export const localedir: string
|
|
61
92
|
|
|
62
93
|
/**
|
|
63
94
|
* Initialize directories and global variables. Must be called
|
|
@@ -165,7 +196,31 @@ declare namespace package {
|
|
|
165
196
|
*/
|
|
166
197
|
export function initGettext(): void;
|
|
167
198
|
/**
|
|
168
|
-
*
|
|
199
|
+
* Initializes string formatting capabilities by adding a format() method to String.prototype.
|
|
200
|
+
*
|
|
201
|
+
* After calling this method, you can use a printf-style string formatting by calling
|
|
202
|
+
* the format() method on any string:
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```ts
|
|
206
|
+
* pkg.initFormat();
|
|
207
|
+
*
|
|
208
|
+
* // Now you can use format() on any string
|
|
209
|
+
* const name = "User";
|
|
210
|
+
* const count = 5;
|
|
211
|
+
* const formatted = "Hello %s, you have %d items".format(name, count);
|
|
212
|
+
* // formatted = "Hello User, you have 5 items"
|
|
213
|
+
*
|
|
214
|
+
* // Format numbers with precision
|
|
215
|
+
* const price = 10.5;
|
|
216
|
+
* const priceStr = "Price: $%.2f".format(price);
|
|
217
|
+
* // priceStr = "Price: $10.50"
|
|
218
|
+
*
|
|
219
|
+
* // Pad with zeros
|
|
220
|
+
* const id = 42;
|
|
221
|
+
* const idStr = "ID: %05d".format(id);
|
|
222
|
+
* // idStr = "ID: 00042"
|
|
223
|
+
* ```
|
|
169
224
|
*/
|
|
170
225
|
export function initFormat(): void;
|
|
171
226
|
/**
|
|
@@ -186,67 +241,95 @@ declare namespace package {
|
|
|
186
241
|
|
|
187
242
|
declare namespace byteArray {
|
|
188
243
|
export class ByteArray {
|
|
189
|
-
static get(target: any, property: string, receiver: any): any
|
|
190
|
-
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
|
|
191
246
|
|
|
192
|
-
length: number
|
|
193
|
-
protected _array: Uint8Array
|
|
247
|
+
length: number
|
|
248
|
+
protected _array: Uint8Array
|
|
194
249
|
|
|
195
|
-
constructor(x: Uint8Array | number)
|
|
196
|
-
toString(encoding?: TextDecoderEncoding): string
|
|
197
|
-
fromString(input: string, encoding?: TextDecoderEncoding): ByteArray
|
|
198
|
-
toGBytes(): GLib.Bytes
|
|
250
|
+
constructor(x: Uint8Array | number)
|
|
251
|
+
toString(encoding?: TextDecoderEncoding): string
|
|
252
|
+
fromString(input: string, encoding?: TextDecoderEncoding): ByteArray
|
|
253
|
+
toGBytes(): GLib.Bytes
|
|
199
254
|
}
|
|
200
255
|
|
|
201
256
|
/** @deprecated Use {@link TextEncoder.encode} instead */
|
|
202
|
-
export function fromString(input: string, encoding?: TextDecoderEncoding): Uint8Array
|
|
257
|
+
export function fromString(input: string, encoding?: TextDecoderEncoding): Uint8Array
|
|
203
258
|
|
|
204
259
|
/** @deprecated Use {@link GLib.Bytes.toArray} instead */
|
|
205
|
-
export function fromGBytes(input: GLib.Bytes): Uint8Array
|
|
260
|
+
export function fromGBytes(input: GLib.Bytes): Uint8Array
|
|
206
261
|
|
|
207
262
|
/** @deprecated Use {@link TextDecoder.decode} instead */
|
|
208
|
-
export function toString(x: Uint8Array, encoding?: TextDecoderEncoding): string
|
|
263
|
+
export function toString(x: Uint8Array, encoding?: TextDecoderEncoding): string
|
|
209
264
|
|
|
210
265
|
/** @deprecated Use {@link GLib.Bytes new GLib.Bytes() } instead */
|
|
211
|
-
export function toGBytes(x: Uint8Array): GLib.Bytes
|
|
266
|
+
export function toGBytes(x: Uint8Array): GLib.Bytes
|
|
212
267
|
|
|
213
268
|
/** @deprecated Use {@link ByteArray new ByteArray()} instead */
|
|
214
|
-
export function fromArray(array: Iterable<number>): ByteArray
|
|
269
|
+
export function fromArray(array: Iterable<number>): ByteArray
|
|
215
270
|
}
|
|
216
271
|
|
|
217
272
|
declare namespace lang {
|
|
218
273
|
// TODO: There is a lot more in Lang
|
|
219
|
-
export function Class(props: any): void
|
|
274
|
+
export function Class(props: any): void
|
|
220
275
|
}
|
|
221
276
|
|
|
222
277
|
declare namespace format {
|
|
223
|
-
export function vprintf(str: string, args: string[]): string;
|
|
224
|
-
export function printf(fmt: string, ...args: any[]): void;
|
|
225
|
-
// Following docs from gjs/modules/format.js
|
|
226
278
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* It supports %s, %d, %x and %f, for %f it also support precisions like
|
|
233
|
-
* "%.2f".format(1.526). All specifiers can be prefixed with a minimum
|
|
234
|
-
* field width, e.g. "%5s".format("foo"). Unless the width is prefixed
|
|
235
|
-
* with '0', the formatted string will be padded with spaces.
|
|
279
|
+
* Formats a string using printf-style format specifiers.
|
|
280
|
+
*
|
|
281
|
+
* @param str The format string
|
|
282
|
+
* @param args The arguments to be formatted
|
|
283
|
+
* @returns The formatted string
|
|
236
284
|
*/
|
|
237
|
-
export function
|
|
285
|
+
export function vprintf(str: string, args: (string | number | boolean | null | undefined)[]): string;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Prints a formatted string to the console.
|
|
289
|
+
* Similar to C's printf function.
|
|
290
|
+
*
|
|
291
|
+
* @param fmt The format string
|
|
292
|
+
* @param args The arguments to be formatted
|
|
293
|
+
*/
|
|
294
|
+
export function printf(fmt: string, ...args: (string | number | boolean | null | undefined)[]): void;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Formats a string with the given arguments.
|
|
298
|
+
* This is the implementation that backs String.prototype.format
|
|
299
|
+
* when pkg.initFormat() is called.
|
|
300
|
+
*
|
|
301
|
+
* Supported format specifiers:
|
|
302
|
+
* - %s: Formats as a string
|
|
303
|
+
* - %d: Formats as an integer
|
|
304
|
+
* - %x: Formats as a hexadecimal number
|
|
305
|
+
* - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
|
|
306
|
+
*
|
|
307
|
+
* All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
|
|
308
|
+
* If the width is prefixed with '0', it will pad with zeroes instead of spaces.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```ts
|
|
312
|
+
* format.format("Hello %s, you have %d items", "User", 5);
|
|
313
|
+
* // Returns: "Hello User, you have 5 items"
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @param fmt The format string
|
|
317
|
+
* @param args The arguments to format the string with
|
|
318
|
+
* @returns The formatted string
|
|
319
|
+
*/
|
|
320
|
+
export function format(fmt: string, ...args: (string | number | boolean | null | undefined)[]): string;
|
|
238
321
|
}
|
|
239
322
|
|
|
240
323
|
declare namespace mainloop {
|
|
241
|
-
export function quit(name: string): void
|
|
242
|
-
export function idle_source(handler: any, priority?: number): any
|
|
243
|
-
export function idle_add(handler: any, priority?: number): any
|
|
244
|
-
export function timeout_source(timeout: any, handler: any, priority?: number): any
|
|
245
|
-
export function timeout_seconds_source(timeout: any, handler: any, priority?: number): any
|
|
246
|
-
export function timeout_add(timeout: any, handler: any, priority?: number): any
|
|
247
|
-
export function timeout_add_seconds(timeout: any, handler: any, priority?: number): any
|
|
248
|
-
export function source_remove(id: any): any
|
|
249
|
-
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
|
|
250
333
|
}
|
|
251
334
|
|
|
252
335
|
/**
|
|
@@ -256,15 +339,15 @@ declare namespace mainloop {
|
|
|
256
339
|
* @example
|
|
257
340
|
* ```ts
|
|
258
341
|
* const Signals = imports.signals;
|
|
259
|
-
*
|
|
342
|
+
*
|
|
260
343
|
* // Define an interface with the same name of your class to make the methods known
|
|
261
344
|
* interface Events extends Signals.Methods {}
|
|
262
|
-
*
|
|
345
|
+
*
|
|
263
346
|
* class Events {}
|
|
264
347
|
* Signals.addSignalMethods(Events.prototype);
|
|
265
|
-
*
|
|
348
|
+
*
|
|
266
349
|
* const events = new Events();
|
|
267
|
-
*
|
|
350
|
+
*
|
|
268
351
|
* // Typescript will not complain here
|
|
269
352
|
* events.emit("test-signal", "test argument");
|
|
270
353
|
* ```
|
|
@@ -273,13 +356,13 @@ export interface SignalMethods {
|
|
|
273
356
|
/**
|
|
274
357
|
* Connects a callback to a signal for an object. Pass the returned ID to
|
|
275
358
|
* `disconnect()` to remove the handler.
|
|
276
|
-
*
|
|
359
|
+
*
|
|
277
360
|
* If `callback` returns `true`, emission will stop and no other handlers will be
|
|
278
361
|
* invoked.
|
|
279
|
-
*
|
|
362
|
+
*
|
|
280
363
|
* > Warning: Unlike GObject signals, `this` within a signal callback will always
|
|
281
364
|
* > refer to the global object (ie. `globalThis`).
|
|
282
|
-
*
|
|
365
|
+
*
|
|
283
366
|
* @param sigName A signal name
|
|
284
367
|
* @param callback A callback function
|
|
285
368
|
* @returns A handler ID
|
|
@@ -287,7 +370,7 @@ export interface SignalMethods {
|
|
|
287
370
|
connect(sigName: string, callback: (self: any, ...args: any[]) => void): number;
|
|
288
371
|
/**
|
|
289
372
|
* Emits a signal for an object. Emission stops if a signal handler returns `true`.
|
|
290
|
-
*
|
|
373
|
+
*
|
|
291
374
|
* Unlike GObject signals, it is not necessary to declare signals or define their
|
|
292
375
|
* signature. Simply call `emit()` with whatever signal name you wish, with
|
|
293
376
|
* whatever arguments you wish.
|
|
@@ -303,7 +386,7 @@ export interface SignalMethods {
|
|
|
303
386
|
/**
|
|
304
387
|
* Disconnects all signal handlers for an object.
|
|
305
388
|
*/
|
|
306
|
-
disconnectAll(): void
|
|
389
|
+
disconnectAll(): void
|
|
307
390
|
/**
|
|
308
391
|
* Checks if a handler ID is connected.
|
|
309
392
|
* @param id The ID of the handler to be disconnected
|
|
@@ -317,6 +400,7 @@ declare namespace signals {
|
|
|
317
400
|
}
|
|
318
401
|
|
|
319
402
|
declare global {
|
|
403
|
+
|
|
320
404
|
// https://gitlab.gnome.org/GNOME/gjs/-/blob/1.73.2/modules/esm/_encoding/encodingMap.js#L7-232
|
|
321
405
|
type TextDecoderEncoding =
|
|
322
406
|
| 'unicode-1-1-utf-8'
|
|
@@ -538,27 +622,27 @@ declare global {
|
|
|
538
622
|
| 'unicode'
|
|
539
623
|
| 'unicodefeff'
|
|
540
624
|
| 'utf-16'
|
|
541
|
-
| 'utf-16le'
|
|
625
|
+
| 'utf-16le'
|
|
542
626
|
|
|
543
627
|
interface GjsGiImports {
|
|
544
628
|
// Will be extended by the import of more gir types
|
|
545
629
|
versions: {
|
|
546
|
-
[namespace: string]: string
|
|
547
|
-
}
|
|
630
|
+
[namespace: string]: string
|
|
631
|
+
}
|
|
548
632
|
}
|
|
549
|
-
|
|
633
|
+
|
|
550
634
|
interface GjsImports {
|
|
551
|
-
gi: GjsGiImports
|
|
552
|
-
lang: typeof lang
|
|
553
|
-
system: typeof system
|
|
554
|
-
signals: typeof signals
|
|
555
|
-
package: typeof package
|
|
556
|
-
mainloop: typeof mainloop
|
|
557
|
-
searchPath: string[]
|
|
558
|
-
gettext: typeof gettext
|
|
559
|
-
byteArray: typeof byteArray
|
|
560
|
-
format: typeof format
|
|
561
|
-
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
|
|
562
646
|
}
|
|
563
647
|
|
|
564
648
|
// Overwrites, see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/script/package.js
|
|
@@ -566,44 +650,103 @@ declare global {
|
|
|
566
650
|
* Run `pkg.initGettext()` before using this.
|
|
567
651
|
* See {@link gettext.gettext}
|
|
568
652
|
*/
|
|
569
|
-
const _:
|
|
653
|
+
const _: typeof gettext.gettext
|
|
570
654
|
/**
|
|
571
655
|
* Run `pkg.initGettext()` before using this.
|
|
572
656
|
* See {@link gettext.pgettext}
|
|
573
657
|
*/
|
|
574
|
-
const C_:
|
|
658
|
+
const C_: typeof gettext.pgettext
|
|
575
659
|
/**
|
|
576
660
|
* Run `pkg.initGettext()` before using this.
|
|
577
661
|
* Currently not implemented.
|
|
578
662
|
*/
|
|
579
|
-
const N_:
|
|
663
|
+
const N_: ((x: string) => string)
|
|
580
664
|
|
|
581
|
-
function print(...args: any[]): void
|
|
582
|
-
function printerr(...args: any[]): void
|
|
665
|
+
function print(...args: any[]): void
|
|
666
|
+
function printerr(...args: any[]): void
|
|
583
667
|
function log(obj: object, others?: object[]): void;
|
|
584
668
|
function log(msg: string, substitutions?: any[]): void;
|
|
585
|
-
function logError(exception: object, message?: any): void
|
|
586
|
-
function logError(message?: any): void
|
|
669
|
+
function logError(exception: object, message?: any): void
|
|
670
|
+
function logError(message?: any): void
|
|
587
671
|
|
|
588
|
-
const pkg: typeof package
|
|
672
|
+
const pkg: typeof package
|
|
589
673
|
|
|
590
674
|
interface BooleanConstructor {
|
|
591
|
-
$gtype: GObject.GType<boolean
|
|
675
|
+
$gtype: GObject.GType<boolean>
|
|
592
676
|
}
|
|
593
677
|
|
|
594
678
|
interface NumberConstructor {
|
|
595
|
-
$gtype: GObject.GType<number
|
|
679
|
+
$gtype: GObject.GType<number>
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
interface StringConstructor {
|
|
683
|
+
$gtype: GObject.GType<string>
|
|
596
684
|
}
|
|
597
685
|
|
|
598
686
|
interface StringConstructor {
|
|
599
|
-
$gtype: GObject.GType<string
|
|
687
|
+
$gtype: GObject.GType<string>
|
|
600
688
|
}
|
|
601
689
|
|
|
602
|
-
|
|
690
|
+
interface ObjectConstructor {
|
|
691
|
+
$gtype: GObject.GType<Object>;
|
|
692
|
+
}
|
|
603
693
|
|
|
604
|
-
const
|
|
694
|
+
const imports: GjsImports
|
|
695
|
+
|
|
696
|
+
const ARGV: string[]
|
|
697
|
+
|
|
698
|
+
interface String {
|
|
699
|
+
/**
|
|
700
|
+
* Formats a string with the given arguments.
|
|
701
|
+
* This method is made available by calling `pkg.initFormat()`.
|
|
702
|
+
*
|
|
703
|
+
* Supported format specifiers:
|
|
704
|
+
* - %s: Formats as a string
|
|
705
|
+
* - %d: Formats as an integer
|
|
706
|
+
* - %x: Formats as a hexadecimal number
|
|
707
|
+
* - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
|
|
708
|
+
*
|
|
709
|
+
* All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
|
|
710
|
+
* If the width is prefixed with '0', it will pad with zeroes instead of spaces.
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```ts
|
|
714
|
+
* // After calling pkg.initFormat()
|
|
715
|
+
* "Hello %s, you have %d items".format("User", 5);
|
|
716
|
+
* // Returns: "Hello User, you have 5 items"
|
|
717
|
+
*
|
|
718
|
+
* "Price: $%.2f".format(10.5);
|
|
719
|
+
* // Returns: "Price: $10.50"
|
|
720
|
+
*
|
|
721
|
+
* "ID: %05d".format(42);
|
|
722
|
+
* // Returns: "ID: 00042"
|
|
723
|
+
* ```
|
|
724
|
+
*
|
|
725
|
+
* @param args The arguments to format the string with
|
|
726
|
+
* @returns The formatted string
|
|
727
|
+
*/
|
|
728
|
+
format(...args: (string | number | boolean | null | undefined)[]): string;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
interface Error {
|
|
732
|
+
/**
|
|
733
|
+
* Checks if this error matches a GLib error domain and code.
|
|
734
|
+
*
|
|
735
|
+
* Added to the global `Error` prototype by the GLib override so that
|
|
736
|
+
* `e.matches(Ns.FooError, Ns.FooError.SOME_CODE)` works without an
|
|
737
|
+
* `instanceof` check. Always returns `false` for standard JavaScript
|
|
738
|
+
* errors; only `GLib.Error` instances provide a meaningful implementation.
|
|
739
|
+
*
|
|
740
|
+
* @param domain A GLib error domain (error class constructor or quark)
|
|
741
|
+
* @param code The error code to match against
|
|
742
|
+
* @returns `false` for native JS errors, `true` if a GLib.Error matches
|
|
743
|
+
*/
|
|
744
|
+
matches(domain: unknown, code: number): boolean;
|
|
745
|
+
}
|
|
605
746
|
}
|
|
606
747
|
|
|
607
|
-
declare const _imports: GjsImports
|
|
608
|
-
export default _imports
|
|
609
|
-
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,74 +1,79 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
"name": "@girs/gjs",
|
|
3
|
+
"version": "4.0.0-rc.10",
|
|
4
|
+
"description": "GJS TypeScript type definitions for Gjs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "gjs.js",
|
|
7
|
+
"main": "gjs.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./ambient": {
|
|
10
|
+
"types": "./gjs-ambient.d.ts",
|
|
11
|
+
"import": "./gjs-ambient.js",
|
|
12
|
+
"default": "./gjs-ambient.js"
|
|
13
|
+
},
|
|
14
|
+
"./dom": {
|
|
15
|
+
"types": "./dom.d.ts",
|
|
16
|
+
"import": "./dom.js",
|
|
17
|
+
"default": "./dom.js"
|
|
18
|
+
},
|
|
19
|
+
"./gettext": {
|
|
20
|
+
"types": "./gettext.d.ts",
|
|
21
|
+
"import": "./gettext.js",
|
|
22
|
+
"default": "./gettext.js"
|
|
23
|
+
},
|
|
24
|
+
"./system": {
|
|
25
|
+
"types": "./system.d.ts",
|
|
26
|
+
"import": "./system.js",
|
|
27
|
+
"default": "./system.js"
|
|
28
|
+
},
|
|
29
|
+
"./cairo": {
|
|
30
|
+
"types": "./cairo.d.ts",
|
|
31
|
+
"import": "./cairo.js",
|
|
32
|
+
"default": "./cairo.js"
|
|
33
|
+
},
|
|
34
|
+
"./console": {
|
|
35
|
+
"types": "./console.d.ts",
|
|
36
|
+
"import": "./console.js",
|
|
37
|
+
"default": "./console.js"
|
|
38
|
+
},
|
|
39
|
+
"./gi": {
|
|
40
|
+
"types": "./gi.d.ts",
|
|
41
|
+
"import": "./gi.js",
|
|
42
|
+
"default": "./gi.js"
|
|
43
|
+
},
|
|
44
|
+
"./gjs": {
|
|
45
|
+
"types": "./gjs.d.ts",
|
|
46
|
+
"import": "./gjs.js",
|
|
47
|
+
"default": "./gjs.js"
|
|
48
|
+
},
|
|
49
|
+
".": {
|
|
50
|
+
"types": "./index.d.ts",
|
|
51
|
+
"import": "./index.js",
|
|
52
|
+
"default": "./index.js"
|
|
53
|
+
}
|
|
13
54
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"import": "./dom.js",
|
|
17
|
-
"default": "./dom.js"
|
|
55
|
+
"scripts": {
|
|
56
|
+
"test": "tsc --project tsconfig.json"
|
|
18
57
|
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@girs/gobject-2.0": "2.88.0-4.0.0-rc.10",
|
|
60
|
+
"@girs/glib-2.0": "2.88.0-4.0.0-rc.10",
|
|
61
|
+
"@girs/gio-2.0": "2.88.0-4.0.0-rc.10",
|
|
62
|
+
"@girs/cairo-1.0": "1.0.0-4.0.0-rc.10" },
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"typescript": "*"
|
|
23
65
|
},
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
66
|
+
"keywords": ["Gir", "TypeScript", "types", "GObject-Introspection", "GJS", "Gjs"],
|
|
67
|
+
"author": "ts-for-gir",
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/gjsify/types.git"
|
|
28
72
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"import": "./cairo.js",
|
|
32
|
-
"default": "./cairo.js"
|
|
73
|
+
"bugs": {
|
|
74
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
33
75
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
".": {
|
|
40
|
-
"types": "./index.d.ts",
|
|
41
|
-
"import": "./index.js",
|
|
42
|
-
"default": "./index.js"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"test": "tsc --project tsconfig.json"
|
|
47
|
-
},
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"@girs/gio-2.0": "^2.80.2-4.0.0-beta.9",
|
|
50
|
-
"@girs/glib-2.0": "^2.80.2-4.0.0-beta.9",
|
|
51
|
-
"@girs/gobject-2.0": "^2.80.2-4.0.0-beta.9"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"typescript": "*"
|
|
55
|
-
},
|
|
56
|
-
"keywords": [
|
|
57
|
-
"Gir",
|
|
58
|
-
"TypeScript",
|
|
59
|
-
"types",
|
|
60
|
-
"GObject-Introspection",
|
|
61
|
-
"GJS",
|
|
62
|
-
"Gjs"
|
|
63
|
-
],
|
|
64
|
-
"author": "ts-for-gir",
|
|
65
|
-
"license": "MIT",
|
|
66
|
-
"repository": {
|
|
67
|
-
"type": "git",
|
|
68
|
-
"url": "git+https://github.com/gjsify/ts-for-gir.git"
|
|
69
|
-
},
|
|
70
|
-
"bugs": {
|
|
71
|
-
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
72
|
-
},
|
|
73
|
-
"homepage": "https://github.com/gjsify/types/tree/main/gjs#readme"
|
|
74
|
-
}
|
|
76
|
+
"homepage": "https://github.com/gjsify/types/tree/main/gjs#readme"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|