@ts-for-gir/templates 4.0.0-beta.26

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 (41) hide show
  1. package/package.json +24 -0
  2. package/templates/README-GJS.md +129 -0
  3. package/templates/README.md +88 -0
  4. package/templates/cogl-2-0.d.ts +1 -0
  5. package/templates/gi.d.ts +8 -0
  6. package/templates/gimp-3.0.d.ts +24 -0
  7. package/templates/gio-2.0.d.ts +37 -0
  8. package/templates/gjs/cairo-1.0.d.ts +0 -0
  9. package/templates/gjs/cairo.d.ts +855 -0
  10. package/templates/gjs/cairo.js +4 -0
  11. package/templates/gjs/console.d.ts +30 -0
  12. package/templates/gjs/console.js +4 -0
  13. package/templates/gjs/dom.d.ts +312 -0
  14. package/templates/gjs/dom.js +1 -0
  15. package/templates/gjs/gettext.d.ts +48 -0
  16. package/templates/gjs/gettext.js +4 -0
  17. package/templates/gjs/gjs-ambient.d.ts +26 -0
  18. package/templates/gjs/gjs-ambient.js +1 -0
  19. package/templates/gjs/gjs.d.ts +753 -0
  20. package/templates/gjs/gjs.js +4 -0
  21. package/templates/gjs/system.d.ts +187 -0
  22. package/templates/gjs/system.js +4 -0
  23. package/templates/glib-2.0.d.ts +1125 -0
  24. package/templates/gobject-2.0.d.ts +361 -0
  25. package/templates/granite-1.0.d.ts +8 -0
  26. package/templates/granite-7.0.d.ts +8 -0
  27. package/templates/gstbase-0.10.d.ts +6 -0
  28. package/templates/index-locally.d.ts +8 -0
  29. package/templates/index.d.ts +17 -0
  30. package/templates/index.js +4 -0
  31. package/templates/module-ambient.d.ts +18 -0
  32. package/templates/module-ambient.js +1 -0
  33. package/templates/module-import.d.ts +16 -0
  34. package/templates/module-import.js +2 -0
  35. package/templates/module.append.d.ts +17 -0
  36. package/templates/module.d.ts +53 -0
  37. package/templates/module.js +4 -0
  38. package/templates/package.json +95 -0
  39. package/templates/rygelserver-2.6.d.ts +4 -0
  40. package/templates/tsconfig.json +32 -0
  41. package/templates/typedoc.json +26 -0
@@ -0,0 +1,753 @@
1
+ <%_ const GObject = await dep.get('GObject', '2.0') _%>
2
+ <%_ const GLib = await dep.get('GLib', '2.0') _%>
3
+ <%_ if(!package){ -%>
4
+ <%_ if(GObject){ -%>
5
+ /// <reference path="./<%- GObject.importName %>.d.ts" />
6
+ <% } -%>
7
+ <%_ if(GLib){ -%>
8
+ /// <reference path="./<%- GLib.importName %>.d.ts" />
9
+ <% } -%>
10
+ /// <reference path="./gettext.d.ts" />
11
+ /// <reference path="./system.d.ts" />
12
+ /// <reference path="./cairo.d.ts" />
13
+ <% } -%>
14
+
15
+ /**
16
+ * Type Definitions for Gjs (https://gjs.guide/)
17
+ *
18
+ * These type definitions are automatically generated, do not edit them by hand.
19
+ * If you found a bug fix it in <%= APP_NAME %> itself or create a bug report on <%= APP_SOURCE %>
20
+ */
21
+
22
+ <%- GObject ? GObject.importDef : '' %>
23
+ <%- GLib ? GLib.importDef : '' %>
24
+
25
+ <%_ if(package){ _%>
26
+ import gettext from './gettext.js';
27
+ import system from './system.js';
28
+ import cairo from './cairo.js';
29
+ <%_ } else { _%>
30
+ import gettext from 'gettext';
31
+ import system from 'system';
32
+ import cairo from 'cairo';
33
+ <%_ } _%>
34
+
35
+ // https://gitlab.gnome.org/GNOME/gjs/-/blob/1.72.0/modules/script/package.js
36
+ declare namespace package {
37
+ /**
38
+ * Although there are references in the documentation of more properties that
39
+ * this object should accepts, only the following are actually used in the init code,
40
+ * and all the other have their values derived from them.
41
+ */
42
+ interface PackageInitParams {
43
+ /** The base name of the entry point (eg. org.foo.Bar.App) */
44
+ name: string
45
+ /** The version of the package */
46
+ version: string
47
+ /** The prefix of the package */
48
+ prefix: string
49
+ /**
50
+ * The final datadir and libdir when installed;
51
+ * usually, these would be prefix + '/share' and
52
+ * and prefix + '/lib' (or '/lib64')
53
+ */
54
+ libdir: string
55
+ /**
56
+ * The final datadir and libdir when installed;
57
+ * usually, these would be prefix + '/share' and
58
+ * and prefix + '/lib' (or '/lib64')
59
+ */
60
+ datadir?: string
61
+ }
62
+
63
+ /**
64
+ * The base name of the entry point (eg. org.foo.Bar.App)
65
+ *
66
+ * Note: Run `pkg.init()` before accessing this property.
67
+ */
68
+ export const name: string
69
+ /**
70
+ * The version of the package
71
+ *
72
+ * Note: Run `pkg.init()` before accessing this property.
73
+ */
74
+ export const version: string
75
+ /**
76
+ * The prefix of the package
77
+ *
78
+ * Note: Run `pkg.init()` before accessing this property.
79
+ */
80
+ export const prefix: string
81
+ /**
82
+ * The final datadir when installed; usually, these would be prefix + '/share'
83
+ *
84
+ * Note: Run `pkg.init()` before accessing this property.
85
+ */
86
+ export const datadir: string
87
+ /**
88
+ * The final libdir when installed; usually, these would be prefix + '/lib' (or '/lib64')
89
+ *
90
+ * Note: Run `pkg.init()` before accessing this property.
91
+ */
92
+ export const libdir: string
93
+ /**
94
+ * The final pkglibdir when installed; usually, this would be prefix + '/lib' (or '/lib64')
95
+ *
96
+ * Note: Run `pkg.init()` before accessing this property.
97
+ */
98
+ export const pkglibdir: string
99
+ /**
100
+ * The final moduledir when installed; usually, this would be prefix + '/lib' (or '/lib64')
101
+ *
102
+ * Note: Run `pkg.init()` before accessing this property.
103
+ */
104
+ export const moduledir: string
105
+ /**
106
+ * The directory containing gettext translation files; this will be datadir + '/locale' when installed and './po' in the source tree
107
+ *
108
+ * Note: Run `pkg.init()` before accessing this property.
109
+ */
110
+ export const localedir: string
111
+
112
+ /**
113
+ * Initialize directories and global variables. Must be called
114
+ * before any of other API in Package is used.
115
+ * `params` must be an object with at least the following keys:
116
+ * - name: the package name ($(PACKAGE_NAME) in autotools,
117
+ * eg. org.foo.Bar)
118
+ * - version: the package version
119
+ * - prefix: the installation prefix
120
+ *
121
+ * init() will take care to check if the program is running from
122
+ * the source directory or not, by looking for a 'src' directory.
123
+ *
124
+ * At the end, the global variable 'pkg' will contain the
125
+ * Package module (imports.package). Additionally, the following
126
+ * module variables will be available:
127
+ * - name: the base name of the entry point (eg. org.foo.Bar.App)
128
+ * - version: same as in @params
129
+ * - prefix: the installation prefix (as passed in @params)
130
+ * - datadir, libdir: the final datadir and libdir when installed;
131
+ * usually, these would be prefix + '/share' and
132
+ * and prefix + '/lib' (or '/lib64')
133
+ * - pkgdatadir: the directory to look for private data files, such as
134
+ * images, stylesheets and UI definitions;
135
+ * this will be datadir + name when installed and
136
+ * './data' when running from the source tree
137
+ * - pkglibdir: the directory to look for private typelibs and C
138
+ * libraries;
139
+ * this will be libdir + name when installed and
140
+ * './lib' when running from the source tree
141
+ * - moduledir: the directory to look for JS modules;
142
+ * this will be pkglibdir when installed and
143
+ * './src' when running from the source tree
144
+ * - localedir: the directory containing gettext translation files;
145
+ * this will be datadir + '/locale' when installed
146
+ * and './po' in the source tree
147
+ *
148
+ * All paths are absolute and will not end with '/'.
149
+ *
150
+ * As a side effect, init() calls GLib.set_prgname().
151
+ *
152
+ * @param {object} params package parameters
153
+ */
154
+ export function init(params: PackageInitParams): void;
155
+ /**
156
+ * This is the function to use if you want to have multiple
157
+ * entry points in one package.
158
+ * You must define a main(ARGV) function inside the passed
159
+ * in module, and then the launcher would be
160
+ *
161
+ * imports.package.init(...);
162
+ * imports.package.run(imports.entrypoint);
163
+ *
164
+ * @param module the module to run
165
+ * @returns the exit code of the module's main() function
166
+ */
167
+ export function run(module: { main: (argv: string[]) => void }): number | undefined;
168
+ /**
169
+ * This is a convenience function if your package has a
170
+ * single entry point.
171
+ * You must define a main(ARGV) function inside a main.js
172
+ * module in moduledir.
173
+ *
174
+ * @param params see init()
175
+ */
176
+ export function start(params: PackageInitParams): void;
177
+ /**
178
+ * Mark a dependency on a specific version of one or more
179
+ * external GI typelibs.
180
+ * `libs` must be an object whose keys are a typelib name,
181
+ * and values are the respective version. The empty string
182
+ * indicates any version.
183
+ * @param deps The external dependencies to import
184
+ */
185
+ export function require(deps: Record<string, string>): void;
186
+ /**
187
+ * As checkSymbol(), but exit with an error if the
188
+ * dependency cannot be satisfied.
189
+ *
190
+ * @param lib an external dependency to import
191
+ * @param ver version of the dependency
192
+ * @param symbol symbol to check for
193
+ */
194
+ export function requireSymbol(lib: string, ver?: string, symbol?: string): void;
195
+ /**
196
+ * Check whether an external GI typelib can be imported
197
+ * and provides @symbol.
198
+ *
199
+ * Symbols may refer to
200
+ * - global functions ('main_quit')
201
+ * - classes ('Window')
202
+ * - class / instance methods ('IconTheme.get_default' / 'IconTheme.has_icon')
203
+ * - GObject properties ('Window.default_height')
204
+ *
205
+ * @param lib an external dependency to import
206
+ * @param ver version of the dependency
207
+ * @param symbol symbol to check for
208
+ * @returns true if `lib` can be imported and provides `symbol`, false
209
+ * otherwise
210
+ */
211
+ export function checkSymbol(lib: string, ver: string, symbol: string): boolean;
212
+ /**
213
+ * Initialize `gettext`.
214
+ * After calling this method `globalThis._`, `globalThis.C_` and `globalThis.N_` will be available.
215
+ */
216
+ export function initGettext(): void;
217
+ /**
218
+ * Initializes string formatting capabilities by adding a format() method to String.prototype.
219
+ *
220
+ * After calling this method, you can use a printf-style string formatting by calling
221
+ * the format() method on any string:
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * pkg.initFormat();
226
+ *
227
+ * // Now you can use format() on any string
228
+ * const name = "User";
229
+ * const count = 5;
230
+ * const formatted = "Hello %s, you have %d items".format(name, count);
231
+ * // formatted = "Hello User, you have 5 items"
232
+ *
233
+ * // Format numbers with precision
234
+ * const price = 10.5;
235
+ * const priceStr = "Price: $%.2f".format(price);
236
+ * // priceStr = "Price: $10.50"
237
+ *
238
+ * // Pad with zeros
239
+ * const id = 42;
240
+ * const idStr = "ID: %05d".format(id);
241
+ * // idStr = "ID: 00042"
242
+ * ```
243
+ */
244
+ export function initFormat(): void;
245
+ /**
246
+ * As checkSymbol(), but exit with an error if the
247
+ * dependency cannot be satisfied.
248
+ *
249
+ * @param lib an external dependency to import
250
+ * @param ver version of the dependency
251
+ * @param symbol symbol to check for
252
+ */
253
+ export function initSubmodule(lib: string, ver?: string, symbol?: string): void;
254
+ /**
255
+ * Load and register a GResource named @name. @name is optional and defaults to ${package-name}
256
+ * @param name The name of the GResource to load
257
+ */
258
+ export function loadResource(name?: string): void;
259
+ }
260
+
261
+ declare namespace byteArray {
262
+ export class ByteArray {
263
+ static get(target: any, property: string, receiver: any): any
264
+ static set(target: any, property: string, value: any, receiver: any): boolean
265
+
266
+ length: number
267
+ protected _array: Uint8Array
268
+
269
+ constructor(x: Uint8Array | number)
270
+ toString(encoding?: TextDecoderEncoding): string
271
+ fromString(input: string, encoding?: TextDecoderEncoding): ByteArray
272
+ toGBytes(): GLib.Bytes
273
+ }
274
+
275
+ /** @deprecated Use {@link TextEncoder.encode} instead */
276
+ export function fromString(input: string, encoding?: TextDecoderEncoding): Uint8Array
277
+
278
+ /** @deprecated Use {@link GLib.Bytes.toArray} instead */
279
+ export function fromGBytes(input: GLib.Bytes): Uint8Array
280
+
281
+ /** @deprecated Use {@link TextDecoder.decode} instead */
282
+ export function toString(x: Uint8Array, encoding?: TextDecoderEncoding): string
283
+
284
+ /** @deprecated Use {@link GLib.Bytes new GLib.Bytes() } instead */
285
+ export function toGBytes(x: Uint8Array): GLib.Bytes
286
+
287
+ /** @deprecated Use {@link ByteArray new ByteArray()} instead */
288
+ export function fromArray(array: Iterable<number>): ByteArray
289
+ }
290
+
291
+ declare namespace lang {
292
+ // TODO: There is a lot more in Lang
293
+ export function Class(props: any): void
294
+ }
295
+
296
+ declare namespace format {
297
+ /**
298
+ * Formats a string using printf-style format specifiers.
299
+ *
300
+ * @param str The format string
301
+ * @param args The arguments to be formatted
302
+ * @returns The formatted string
303
+ */
304
+ export function vprintf(str: string, args: (string | number | boolean | null | undefined)[]): string;
305
+
306
+ /**
307
+ * Prints a formatted string to the console.
308
+ * Similar to C's printf function.
309
+ *
310
+ * @param fmt The format string
311
+ * @param args The arguments to be formatted
312
+ */
313
+ export function printf(fmt: string, ...args: (string | number | boolean | null | undefined)[]): void;
314
+
315
+ /**
316
+ * Formats a string with the given arguments.
317
+ * This is the implementation that backs String.prototype.format
318
+ * when pkg.initFormat() is called.
319
+ *
320
+ * Supported format specifiers:
321
+ * - %s: Formats as a string
322
+ * - %d: Formats as an integer
323
+ * - %x: Formats as a hexadecimal number
324
+ * - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
325
+ *
326
+ * All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
327
+ * If the width is prefixed with '0', it will pad with zeroes instead of spaces.
328
+ *
329
+ * @example
330
+ * ```ts
331
+ * format.format("Hello %s, you have %d items", "User", 5);
332
+ * // Returns: "Hello User, you have 5 items"
333
+ * ```
334
+ *
335
+ * @param fmt The format string
336
+ * @param args The arguments to format the string with
337
+ * @returns The formatted string
338
+ */
339
+ export function format(fmt: string, ...args: (string | number | boolean | null | undefined)[]): string;
340
+ }
341
+
342
+ declare namespace mainloop {
343
+ export function quit(name: string): void
344
+ export function idle_source(handler: any, priority?: number): any
345
+ export function idle_add(handler: any, priority?: number): any
346
+ export function timeout_source(timeout: any, handler: any, priority?: number): any
347
+ export function timeout_seconds_source(timeout: any, handler: any, priority?: number): any
348
+ export function timeout_add(timeout: any, handler: any, priority?: number): any
349
+ export function timeout_add_seconds(timeout: any, handler: any, priority?: number): any
350
+ export function source_remove(id: any): any
351
+ export function run(name: string): void
352
+ }
353
+
354
+ /**
355
+ * You can use the `Signals.addSignalMethods` method to apply the `Signals` convenience methods to an `Object`.
356
+ * Generally, this is called on an object prototype, but may also be called on an object instance.
357
+ * You can use this Interface for this object or prototype to make the methods in typescript known
358
+ * @example
359
+ * ```ts
360
+ * const Signals = imports.signals;
361
+ *
362
+ * // Define an interface with the same name of your class to make the methods known
363
+ * interface Events extends Signals.Methods {}
364
+ *
365
+ * class Events {}
366
+ * Signals.addSignalMethods(Events.prototype);
367
+ *
368
+ * const events = new Events();
369
+ *
370
+ * // Typescript will not complain here
371
+ * events.emit("test-signal", "test argument");
372
+ * ```
373
+ */
374
+ export interface SignalMethods {
375
+ /**
376
+ * Connects a callback to a signal for an object. Pass the returned ID to
377
+ * `disconnect()` to remove the handler.
378
+ *
379
+ * If `callback` returns `true`, emission will stop and no other handlers will be
380
+ * invoked.
381
+ *
382
+ * > Warning: Unlike GObject signals, `this` within a signal callback will always
383
+ * > refer to the global object (ie. `globalThis`).
384
+ *
385
+ * @param sigName A signal name
386
+ * @param callback A callback function
387
+ * @returns A handler ID
388
+ */
389
+ connect(sigName: string, callback: (self: any, ...args: any[]) => void): number;
390
+ /**
391
+ * Emits a signal for an object. Emission stops if a signal handler returns `true`.
392
+ *
393
+ * Unlike GObject signals, it is not necessary to declare signals or define their
394
+ * signature. Simply call `emit()` with whatever signal name you wish, with
395
+ * whatever arguments you wish.
396
+ * @param sigName A signal name
397
+ * @param args Any number of arguments, of any type
398
+ */
399
+ emit(sigName: string, ...args: any[]): void;
400
+ /**
401
+ * Disconnects a handler for a signal.
402
+ * @param id The ID of the handler to be disconnected
403
+ */
404
+ disconnect(id: number): void;
405
+ /**
406
+ * Disconnects all signal handlers for an object.
407
+ */
408
+ disconnectAll(): void
409
+ /**
410
+ * Checks if a handler ID is connected.
411
+ * @param id The ID of the handler to be disconnected
412
+ * @returns `true` if connected, or `false` if not
413
+ */
414
+ signalHandlerIsConnected(id: number): boolean;
415
+ }
416
+
417
+ declare namespace signals {
418
+ export function addSignalMethods<T = any>(proto: T): proto is T & SignalMethods;
419
+ }
420
+
421
+ declare global {
422
+
423
+ // https://gitlab.gnome.org/GNOME/gjs/-/blob/1.73.2/modules/esm/_encoding/encodingMap.js#L7-232
424
+ type TextDecoderEncoding =
425
+ | 'unicode-1-1-utf-8'
426
+ | 'unicode11utf8'
427
+ | 'unicode20utf8'
428
+ | 'utf-8'
429
+ | 'utf8'
430
+ | 'x-unicode20utf8'
431
+ | '866'
432
+ | 'cp866'
433
+ | 'csibm866'
434
+ | 'ibm866'
435
+ | 'csisolatin2'
436
+ | 'iso-8859-2'
437
+ | 'iso-ir-101'
438
+ | 'iso8859-2'
439
+ | 'iso88592'
440
+ | 'iso_8859-2'
441
+ | 'iso_8859-2:1987'
442
+ | 'l2'
443
+ | 'latin2'
444
+ | 'csisolatin3'
445
+ | 'iso-8859-3'
446
+ | 'iso-ir-109'
447
+ | 'iso8859-3'
448
+ | 'iso88593'
449
+ | 'iso_8859-3'
450
+ | 'iso_8859-3:1988'
451
+ | 'l3'
452
+ | 'latin3'
453
+ | 'csisolatin4'
454
+ | 'iso-8859-4'
455
+ | 'iso-ir-110'
456
+ | 'iso8859-4'
457
+ | 'iso88594'
458
+ | 'iso_8859-4'
459
+ | 'iso_8859-4:1988'
460
+ | 'l4'
461
+ | 'latin4'
462
+ | 'csisolatincyrillic'
463
+ | 'cyrillic'
464
+ | 'iso-8859-5'
465
+ | 'iso-ir-144'
466
+ | 'iso8859-5'
467
+ | 'iso88595'
468
+ | 'iso_8859-5'
469
+ | 'iso_8859-5:1988'
470
+ | 'arabic'
471
+ | 'asmo-708'
472
+ | 'csiso88596e'
473
+ | 'csiso88596i'
474
+ | 'csisolatinarabic'
475
+ | 'ecma-114'
476
+ | 'iso-8859-6'
477
+ | 'iso-8859-6-e'
478
+ | 'iso-8859-6-i'
479
+ | 'iso-ir-127'
480
+ | 'iso8859-6'
481
+ | 'iso88596'
482
+ | 'iso_8859-6'
483
+ | 'iso_8859-6:1987'
484
+ | 'csisolatingreek'
485
+ | 'ecma-118'
486
+ | 'elot_928'
487
+ | 'greek'
488
+ | 'greek8'
489
+ | 'iso-8859-7'
490
+ | 'iso-ir-126'
491
+ | 'iso8859-7'
492
+ | 'iso88597'
493
+ | 'iso_8859-7'
494
+ | 'iso_8859-7:1987'
495
+ | 'sun_eu_greek'
496
+ | 'csiso88598e'
497
+ | 'csisolatinhebrew'
498
+ | 'hebrew'
499
+ | 'iso-8859-8'
500
+ | 'iso-8859-8-e'
501
+ | 'iso-ir-138'
502
+ | 'iso8859-8'
503
+ | 'iso88598'
504
+ | 'iso_8859-8'
505
+ | 'iso_8859-8:1988'
506
+ | 'visual'
507
+ | 'csiso88598i'
508
+ | 'iso-8859-8-i'
509
+ | 'logical'
510
+ | 'csisolatin6'
511
+ | 'iso-8859-10'
512
+ | 'iso-ir-157'
513
+ | 'iso8859-10'
514
+ | 'iso885910'
515
+ | 'l6'
516
+ | 'latin6'
517
+ | 'iso-8859-13'
518
+ | 'iso8859-13'
519
+ | 'iso885913'
520
+ | 'iso-8859-14'
521
+ | 'iso8859-14'
522
+ | 'iso885914'
523
+ | 'csisolatin9'
524
+ | 'iso-8859-15'
525
+ | 'iso8859-15'
526
+ | 'iso885915'
527
+ | 'iso_8859-15'
528
+ | 'l9'
529
+ | 'iso-8859-16'
530
+ | 'cskoi8r'
531
+ | 'koi'
532
+ | 'koi8'
533
+ | 'koi8-r'
534
+ | 'koi8_r'
535
+ | 'koi8-ru'
536
+ | 'koi8-u'
537
+ | 'csmacintosh'
538
+ | 'mac'
539
+ | 'macintosh'
540
+ | 'x-mac-roman'
541
+ | 'dos-874'
542
+ | 'iso-8859-11'
543
+ | 'iso8859-11'
544
+ | 'iso885911'
545
+ | 'tis-620'
546
+ | 'windows-874'
547
+ | 'cp1250'
548
+ | 'windows-1250'
549
+ | 'x-cp1250'
550
+ | 'cp1251'
551
+ | 'windows-1251'
552
+ | 'x-cp1251'
553
+ | 'ansi_x3.4-1968'
554
+ | 'ascii'
555
+ | 'cp1252'
556
+ | 'cp819'
557
+ | 'csisolatin1'
558
+ | 'ibm819'
559
+ | 'iso-8859-1'
560
+ | 'iso-ir-100'
561
+ | 'iso8859-1'
562
+ | 'iso88591'
563
+ | 'iso_8859-1'
564
+ | 'iso_8859-1:1987'
565
+ | 'l1'
566
+ | 'latin1'
567
+ | 'us-ascii'
568
+ | 'windows-1252'
569
+ | 'x-cp1252'
570
+ | 'cp1253'
571
+ | 'windows-1253'
572
+ | 'x-cp1253'
573
+ | 'cp1254'
574
+ | 'csisolatin5'
575
+ | 'iso-8859-9'
576
+ | 'iso-ir-148'
577
+ | 'iso8859-9'
578
+ | 'iso88599'
579
+ | 'iso_8859-9'
580
+ | 'iso_8859-9:1989'
581
+ | 'l5'
582
+ | 'latin5'
583
+ | 'windows-1254'
584
+ | 'x-cp1254'
585
+ | 'cp1255'
586
+ | 'windows-1255'
587
+ | 'x-cp1255'
588
+ | 'cp1256'
589
+ | 'windows-1256'
590
+ | 'x-cp1256'
591
+ | 'cp1257'
592
+ | 'windows-1257'
593
+ | 'x-cp1257'
594
+ | 'cp1258'
595
+ | 'windows-1258'
596
+ | 'x-cp1258'
597
+ | 'x-mac-cyrillic'
598
+ | 'x-mac-ukrainian'
599
+ | 'chinese'
600
+ | 'csgb2312'
601
+ | 'csiso58gb231280'
602
+ | 'gb2312'
603
+ | 'gb_2312'
604
+ | 'gb_2312-80'
605
+ | 'gbk'
606
+ | 'iso-ir-58'
607
+ | 'x-gbk'
608
+ | 'gb18030'
609
+ | 'big5'
610
+ | 'cn-big5'
611
+ | 'csbig5'
612
+ | 'x-x-big5'
613
+ | 'cseucpkdfmtjapanese'
614
+ | 'euc-jp'
615
+ | 'x-euc-jp'
616
+ | 'csiso2022jp'
617
+ | 'iso-2022-jp'
618
+ | 'csshiftjis'
619
+ | 'ms932'
620
+ | 'ms_kanji'
621
+ | 'shift-jis'
622
+ | 'shift_jis'
623
+ | 'sjis'
624
+ | 'windows-31j'
625
+ | 'x-sjis'
626
+ | 'cseuckr'
627
+ | 'csksc56011987'
628
+ | 'euc-kr'
629
+ | 'iso-ir-149'
630
+ | 'korean'
631
+ | 'ks_c_5601-1987'
632
+ | 'ks_c_5601-1989'
633
+ | 'ksc5601'
634
+ | 'ksc_5601'
635
+ | 'windows-949'
636
+ | 'unicodefffe'
637
+ | 'utf-16be'
638
+ | 'csunicode'
639
+ | 'iso-10646-ucs-2'
640
+ | 'ucs-2'
641
+ | 'unicode'
642
+ | 'unicodefeff'
643
+ | 'utf-16'
644
+ | 'utf-16le'
645
+
646
+ interface GjsGiImports {
647
+ // Will be extended by the import of more gir types
648
+ versions: {
649
+ [namespace: string]: string
650
+ }
651
+ }
652
+
653
+ interface GjsImports {
654
+ gi: GjsGiImports
655
+ lang: typeof lang
656
+ system: typeof system
657
+ signals: typeof signals
658
+ package: typeof package
659
+ mainloop: typeof mainloop
660
+ searchPath: string[]
661
+ gettext: typeof gettext
662
+ byteArray: typeof byteArray
663
+ format: typeof format
664
+ cairo: typeof cairo
665
+ }
666
+
667
+ // Overwrites, see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/script/package.js
668
+ /**
669
+ * Run `pkg.initGettext()` before using this.
670
+ * See {@link gettext.gettext}
671
+ */
672
+ const _: typeof gettext.gettext
673
+ /**
674
+ * Run `pkg.initGettext()` before using this.
675
+ * See {@link gettext.pgettext}
676
+ */
677
+ const C_: typeof gettext.pgettext
678
+ /**
679
+ * Run `pkg.initGettext()` before using this.
680
+ * Currently not implemented.
681
+ */
682
+ const N_: ((x: string) => string)
683
+
684
+ function print(...args: any[]): void
685
+ function printerr(...args: any[]): void
686
+ function log(obj: object, others?: object[]): void;
687
+ function log(msg: string, substitutions?: any[]): void;
688
+ function logError(exception: object, message?: any): void
689
+ function logError(message?: any): void
690
+
691
+ const pkg: typeof package
692
+
693
+ interface BooleanConstructor {
694
+ $gtype: GObject.GType<boolean>
695
+ }
696
+
697
+ interface NumberConstructor {
698
+ $gtype: GObject.GType<number>
699
+ }
700
+
701
+ interface StringConstructor {
702
+ $gtype: GObject.GType<string>
703
+ }
704
+
705
+ interface StringConstructor {
706
+ $gtype: GObject.GType<string>
707
+ }
708
+
709
+ interface ObjectConstructor {
710
+ $gtype: GObject.GType<Object>;
711
+ }
712
+
713
+ const imports: GjsImports
714
+
715
+ const ARGV: string[]
716
+
717
+ interface String {
718
+ /**
719
+ * Formats a string with the given arguments.
720
+ * This method is made available by calling `pkg.initFormat()`.
721
+ *
722
+ * Supported format specifiers:
723
+ * - %s: Formats as a string
724
+ * - %d: Formats as an integer
725
+ * - %x: Formats as a hexadecimal number
726
+ * - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
727
+ *
728
+ * All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
729
+ * If the width is prefixed with '0', it will pad with zeroes instead of spaces.
730
+ *
731
+ * @example
732
+ * ```ts
733
+ * // After calling pkg.initFormat()
734
+ * "Hello %s, you have %d items".format("User", 5);
735
+ * // Returns: "Hello User, you have 5 items"
736
+ *
737
+ * "Price: $%.2f".format(10.5);
738
+ * // Returns: "Price: $10.50"
739
+ *
740
+ * "ID: %05d".format(42);
741
+ * // Returns: "ID: 00042"
742
+ * ```
743
+ *
744
+ * @param args The arguments to format the string with
745
+ * @returns The formatted string
746
+ */
747
+ format(...args: (string | number | boolean | null | undefined)[]): string;
748
+ }
749
+ }
750
+
751
+ declare const _imports: GjsImports
752
+ export default _imports
753
+ export { _imports as imports }