@girs/gjs 4.0.0-beta.21 → 4.0.0-beta.24
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 +732 -377
- package/gjs.d.ts +150 -35
- package/package.json +5 -5
package/gjs.d.ts
CHANGED
|
@@ -40,24 +40,54 @@ declare namespace package {
|
|
|
40
40
|
datadir?: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export const
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export const
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export const
|
|
43
|
+
/**
|
|
44
|
+
* The base name of the entry point (eg. org.foo.Bar.App)
|
|
45
|
+
*
|
|
46
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
47
|
+
*/
|
|
48
|
+
export const name: string;
|
|
49
|
+
/**
|
|
50
|
+
* The version of the package
|
|
51
|
+
*
|
|
52
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
53
|
+
*/
|
|
54
|
+
export const version: string;
|
|
55
|
+
/**
|
|
56
|
+
* The prefix of the package
|
|
57
|
+
*
|
|
58
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
59
|
+
*/
|
|
60
|
+
export const prefix: string;
|
|
61
|
+
/**
|
|
62
|
+
* The final datadir when installed; usually, these would be prefix + '/share'
|
|
63
|
+
*
|
|
64
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
65
|
+
*/
|
|
66
|
+
export const datadir: string;
|
|
67
|
+
/**
|
|
68
|
+
* The final libdir when installed; usually, these would be prefix + '/lib' (or '/lib64')
|
|
69
|
+
*
|
|
70
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
71
|
+
*/
|
|
72
|
+
export const libdir: string;
|
|
73
|
+
/**
|
|
74
|
+
* The final pkglibdir when installed; usually, this would be prefix + '/lib' (or '/lib64')
|
|
75
|
+
*
|
|
76
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
77
|
+
*/
|
|
78
|
+
export const pkglibdir: string;
|
|
79
|
+
/**
|
|
80
|
+
* The final moduledir when installed; usually, this would be prefix + '/lib' (or '/lib64')
|
|
81
|
+
*
|
|
82
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
83
|
+
*/
|
|
84
|
+
export const moduledir: string;
|
|
85
|
+
/**
|
|
86
|
+
* The directory containing gettext translation files; this will be datadir + '/locale' when installed and './po' in the source tree
|
|
87
|
+
*
|
|
88
|
+
* Note: Run `pkg.init()` before accessing this property.
|
|
89
|
+
*/
|
|
90
|
+
export const localedir: string;
|
|
61
91
|
|
|
62
92
|
/**
|
|
63
93
|
* Initialize directories and global variables. Must be called
|
|
@@ -165,7 +195,31 @@ declare namespace package {
|
|
|
165
195
|
*/
|
|
166
196
|
export function initGettext(): void;
|
|
167
197
|
/**
|
|
168
|
-
*
|
|
198
|
+
* Initializes string formatting capabilities by adding a format() method to String.prototype.
|
|
199
|
+
*
|
|
200
|
+
* After calling this method, you can use a printf-style string formatting by calling
|
|
201
|
+
* the format() method on any string:
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* pkg.initFormat();
|
|
206
|
+
*
|
|
207
|
+
* // Now you can use format() on any string
|
|
208
|
+
* const name = "User";
|
|
209
|
+
* const count = 5;
|
|
210
|
+
* const formatted = "Hello %s, you have %d items".format(name, count);
|
|
211
|
+
* // formatted = "Hello User, you have 5 items"
|
|
212
|
+
*
|
|
213
|
+
* // Format numbers with precision
|
|
214
|
+
* const price = 10.5;
|
|
215
|
+
* const priceStr = "Price: $%.2f".format(price);
|
|
216
|
+
* // priceStr = "Price: $10.50"
|
|
217
|
+
*
|
|
218
|
+
* // Pad with zeros
|
|
219
|
+
* const id = 42;
|
|
220
|
+
* const idStr = "ID: %05d".format(id);
|
|
221
|
+
* // idStr = "ID: 00042"
|
|
222
|
+
* ```
|
|
169
223
|
*/
|
|
170
224
|
export function initFormat(): void;
|
|
171
225
|
/**
|
|
@@ -220,21 +274,49 @@ declare namespace lang {
|
|
|
220
274
|
}
|
|
221
275
|
|
|
222
276
|
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
277
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
278
|
+
* Formats a string using printf-style format specifiers.
|
|
279
|
+
*
|
|
280
|
+
* @param str The format string
|
|
281
|
+
* @param args The arguments to be formatted
|
|
282
|
+
* @returns The formatted string
|
|
283
|
+
*/
|
|
284
|
+
export function vprintf(str: string, args: (string | number | boolean | null | undefined)[]): string;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Prints a formatted string to the console.
|
|
288
|
+
* Similar to C's printf function.
|
|
289
|
+
*
|
|
290
|
+
* @param fmt The format string
|
|
291
|
+
* @param args The arguments to be formatted
|
|
292
|
+
*/
|
|
293
|
+
export function printf(fmt: string, ...args: (string | number | boolean | null | undefined)[]): void;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Formats a string with the given arguments.
|
|
297
|
+
* This is the implementation that backs String.prototype.format
|
|
298
|
+
* when pkg.initFormat() is called.
|
|
299
|
+
*
|
|
300
|
+
* Supported format specifiers:
|
|
301
|
+
* - %s: Formats as a string
|
|
302
|
+
* - %d: Formats as an integer
|
|
303
|
+
* - %x: Formats as a hexadecimal number
|
|
304
|
+
* - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
|
|
305
|
+
*
|
|
306
|
+
* All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
|
|
307
|
+
* If the width is prefixed with '0', it will pad with zeroes instead of spaces.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* format.format("Hello %s, you have %d items", "User", 5);
|
|
312
|
+
* // Returns: "Hello User, you have 5 items"
|
|
313
|
+
* ```
|
|
314
|
+
*
|
|
315
|
+
* @param fmt The format string
|
|
316
|
+
* @param args The arguments to format the string with
|
|
317
|
+
* @returns The formatted string
|
|
236
318
|
*/
|
|
237
|
-
export function format(fmt: string, ...args:
|
|
319
|
+
export function format(fmt: string, ...args: (string | number | boolean | null | undefined)[]): string;
|
|
238
320
|
}
|
|
239
321
|
|
|
240
322
|
declare namespace mainloop {
|
|
@@ -566,17 +648,17 @@ declare global {
|
|
|
566
648
|
* Run `pkg.initGettext()` before using this.
|
|
567
649
|
* See {@link gettext.gettext}
|
|
568
650
|
*/
|
|
569
|
-
const _:
|
|
651
|
+
const _: typeof gettext.gettext;
|
|
570
652
|
/**
|
|
571
653
|
* Run `pkg.initGettext()` before using this.
|
|
572
654
|
* See {@link gettext.pgettext}
|
|
573
655
|
*/
|
|
574
|
-
const C_:
|
|
656
|
+
const C_: typeof gettext.pgettext;
|
|
575
657
|
/**
|
|
576
658
|
* Run `pkg.initGettext()` before using this.
|
|
577
659
|
* Currently not implemented.
|
|
578
660
|
*/
|
|
579
|
-
const N_:
|
|
661
|
+
const N_: (x: string) => string;
|
|
580
662
|
|
|
581
663
|
function print(...args: any[]): void;
|
|
582
664
|
function printerr(...args: any[]): void;
|
|
@@ -610,6 +692,39 @@ declare global {
|
|
|
610
692
|
const imports: GjsImports;
|
|
611
693
|
|
|
612
694
|
const ARGV: string[];
|
|
695
|
+
|
|
696
|
+
interface String {
|
|
697
|
+
/**
|
|
698
|
+
* Formats a string with the given arguments.
|
|
699
|
+
* This method is made available by calling `pkg.initFormat()`.
|
|
700
|
+
*
|
|
701
|
+
* Supported format specifiers:
|
|
702
|
+
* - %s: Formats as a string
|
|
703
|
+
* - %d: Formats as an integer
|
|
704
|
+
* - %x: Formats as a hexadecimal number
|
|
705
|
+
* - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
|
|
706
|
+
*
|
|
707
|
+
* All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
|
|
708
|
+
* If the width is prefixed with '0', it will pad with zeroes instead of spaces.
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```ts
|
|
712
|
+
* // After calling pkg.initFormat()
|
|
713
|
+
* "Hello %s, you have %d items".format("User", 5);
|
|
714
|
+
* // Returns: "Hello User, you have 5 items"
|
|
715
|
+
*
|
|
716
|
+
* "Price: $%.2f".format(10.5);
|
|
717
|
+
* // Returns: "Price: $10.50"
|
|
718
|
+
*
|
|
719
|
+
* "ID: %05d".format(42);
|
|
720
|
+
* // Returns: "ID: 00042"
|
|
721
|
+
* ```
|
|
722
|
+
*
|
|
723
|
+
* @param args The arguments to format the string with
|
|
724
|
+
* @returns The formatted string
|
|
725
|
+
*/
|
|
726
|
+
format(...args: (string | number | boolean | null | undefined)[]): string;
|
|
727
|
+
}
|
|
613
728
|
}
|
|
614
729
|
|
|
615
730
|
declare const _imports: GjsImports;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/gjs",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.24",
|
|
4
4
|
"description": "GJS TypeScript type definitions for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "gjs.js",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"test": "tsc --project tsconfig.json"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@girs/cairo-1.0": "^1.0.0-4.0.0-beta.
|
|
55
|
-
"@girs/gio-2.0": "^2.
|
|
56
|
-
"@girs/glib-2.0": "^2.
|
|
57
|
-
"@girs/gobject-2.0": "^2.
|
|
54
|
+
"@girs/cairo-1.0": "^1.0.0-4.0.0-beta.24",
|
|
55
|
+
"@girs/gio-2.0": "^2.84.2-4.0.0-beta.24",
|
|
56
|
+
"@girs/glib-2.0": "^2.84.2-4.0.0-beta.24",
|
|
57
|
+
"@girs/gobject-2.0": "^2.84.2-4.0.0-beta.24"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"typescript": "*"
|