@girs/gjs 4.0.0-beta.7 → 4.0.0-beta.8
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/gjs.d.ts +161 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.
|
|
7
|
+
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.8.
|
|
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/gjs.d.ts
CHANGED
|
@@ -20,33 +20,168 @@ declare namespace package {
|
|
|
20
20
|
* and all the other have their values derived from them.
|
|
21
21
|
*/
|
|
22
22
|
interface PackageInitParams {
|
|
23
|
+
/** The base name of the entry point (eg. org.foo.Bar.App) */
|
|
23
24
|
name: string;
|
|
25
|
+
/** The version of the package */
|
|
24
26
|
version: string;
|
|
27
|
+
/** The prefix of the package */
|
|
25
28
|
prefix: string;
|
|
29
|
+
/**
|
|
30
|
+
* The final datadir and libdir when installed;
|
|
31
|
+
* usually, these would be prefix + '/share' and
|
|
32
|
+
* and prefix + '/lib' (or '/lib64')
|
|
33
|
+
*/
|
|
26
34
|
libdir: string;
|
|
35
|
+
/**
|
|
36
|
+
* The final datadir and libdir when installed;
|
|
37
|
+
* usually, these would be prefix + '/share' and
|
|
38
|
+
* and prefix + '/lib' (or '/lib64')
|
|
39
|
+
*/
|
|
40
|
+
datadir?: string;
|
|
27
41
|
}
|
|
28
42
|
|
|
43
|
+
/** The base name of the entry point (eg. org.foo.Bar.App) */
|
|
29
44
|
export const name: string | undefined;
|
|
45
|
+
/** The version of the package */
|
|
30
46
|
export const version: string | undefined;
|
|
47
|
+
/** The prefix of the package */
|
|
31
48
|
export const prefix: string | undefined;
|
|
49
|
+
/** The final datadir when installed; usually, these would be prefix + '/share' */
|
|
32
50
|
export const datadir: string | undefined;
|
|
51
|
+
/** The final libdir when installed; usually, these would be prefix + '/lib' (or '/lib64') */
|
|
33
52
|
export const libdir: string | undefined;
|
|
53
|
+
/** The final pkgdatadir when installed; usually, this would be prefix + '/share' */
|
|
34
54
|
export const pkgdatadir: string | undefined;
|
|
55
|
+
/** The final pkglibdir when installed; usually, this would be prefix + '/lib' (or '/lib64') */
|
|
35
56
|
export const pkglibdir: string | undefined;
|
|
57
|
+
/** The final moduledir when installed; usually, this would be prefix + '/lib' (or '/lib64') */
|
|
36
58
|
export const moduledir: string | undefined;
|
|
59
|
+
/** The directory containing gettext translation files; this will be datadir + '/locale' when installed and './po' in the source tree */
|
|
37
60
|
export const localedir: string | undefined;
|
|
38
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Initialize directories and global variables. Must be called
|
|
64
|
+
* before any of other API in Package is used.
|
|
65
|
+
* `params` must be an object with at least the following keys:
|
|
66
|
+
* - name: the package name ($(PACKAGE_NAME) in autotools,
|
|
67
|
+
* eg. org.foo.Bar)
|
|
68
|
+
* - version: the package version
|
|
69
|
+
* - prefix: the installation prefix
|
|
70
|
+
*
|
|
71
|
+
* init() will take care to check if the program is running from
|
|
72
|
+
* the source directory or not, by looking for a 'src' directory.
|
|
73
|
+
*
|
|
74
|
+
* At the end, the global variable 'pkg' will contain the
|
|
75
|
+
* Package module (imports.package). Additionally, the following
|
|
76
|
+
* module variables will be available:
|
|
77
|
+
* - name: the base name of the entry point (eg. org.foo.Bar.App)
|
|
78
|
+
* - version: same as in @params
|
|
79
|
+
* - prefix: the installation prefix (as passed in @params)
|
|
80
|
+
* - datadir, libdir: the final datadir and libdir when installed;
|
|
81
|
+
* usually, these would be prefix + '/share' and
|
|
82
|
+
* and prefix + '/lib' (or '/lib64')
|
|
83
|
+
* - pkgdatadir: the directory to look for private data files, such as
|
|
84
|
+
* images, stylesheets and UI definitions;
|
|
85
|
+
* this will be datadir + name when installed and
|
|
86
|
+
* './data' when running from the source tree
|
|
87
|
+
* - pkglibdir: the directory to look for private typelibs and C
|
|
88
|
+
* libraries;
|
|
89
|
+
* this will be libdir + name when installed and
|
|
90
|
+
* './lib' when running from the source tree
|
|
91
|
+
* - moduledir: the directory to look for JS modules;
|
|
92
|
+
* this will be pkglibdir when installed and
|
|
93
|
+
* './src' when running from the source tree
|
|
94
|
+
* - localedir: the directory containing gettext translation files;
|
|
95
|
+
* this will be datadir + '/locale' when installed
|
|
96
|
+
* and './po' in the source tree
|
|
97
|
+
*
|
|
98
|
+
* All paths are absolute and will not end with '/'.
|
|
99
|
+
*
|
|
100
|
+
* As a side effect, init() calls GLib.set_prgname().
|
|
101
|
+
*
|
|
102
|
+
* @param {object} params package parameters
|
|
103
|
+
*/
|
|
39
104
|
export function init(params: PackageInitParams): void;
|
|
40
|
-
|
|
41
|
-
|
|
105
|
+
/**
|
|
106
|
+
* This is the function to use if you want to have multiple
|
|
107
|
+
* entry points in one package.
|
|
108
|
+
* You must define a main(ARGV) function inside the passed
|
|
109
|
+
* in module, and then the launcher would be
|
|
110
|
+
*
|
|
111
|
+
* imports.package.init(...);
|
|
112
|
+
* imports.package.run(imports.entrypoint);
|
|
113
|
+
*
|
|
114
|
+
* @param module the module to run
|
|
115
|
+
* @returns the exit code of the module's main() function
|
|
116
|
+
*/
|
|
117
|
+
export function run(module: { main: (argv: string[]) => void }): number | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* This is a convenience function if your package has a
|
|
120
|
+
* single entry point.
|
|
121
|
+
* You must define a main(ARGV) function inside a main.js
|
|
122
|
+
* module in moduledir.
|
|
123
|
+
*
|
|
124
|
+
* @param params see init()
|
|
125
|
+
*/
|
|
42
126
|
export function start(params: PackageInitParams): void;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Mark a dependency on a specific version of one or more
|
|
129
|
+
* external GI typelibs.
|
|
130
|
+
* `libs` must be an object whose keys are a typelib name,
|
|
131
|
+
* and values are the respective version. The empty string
|
|
132
|
+
* indicates any version.
|
|
133
|
+
* @param deps The external dependencies to import
|
|
134
|
+
*/
|
|
135
|
+
export function require(deps: Record<string, string>): void;
|
|
136
|
+
/**
|
|
137
|
+
* As checkSymbol(), but exit with an error if the
|
|
138
|
+
* dependency cannot be satisfied.
|
|
139
|
+
*
|
|
140
|
+
* @param lib an external dependency to import
|
|
141
|
+
* @param ver version of the dependency
|
|
142
|
+
* @param symbol symbol to check for
|
|
143
|
+
*/
|
|
144
|
+
export function requireSymbol(lib: string, ver?: string, symbol?: string): void;
|
|
145
|
+
/**
|
|
146
|
+
* Check whether an external GI typelib can be imported
|
|
147
|
+
* and provides @symbol.
|
|
148
|
+
*
|
|
149
|
+
* Symbols may refer to
|
|
150
|
+
* - global functions ('main_quit')
|
|
151
|
+
* - classes ('Window')
|
|
152
|
+
* - class / instance methods ('IconTheme.get_default' / 'IconTheme.has_icon')
|
|
153
|
+
* - GObject properties ('Window.default_height')
|
|
154
|
+
*
|
|
155
|
+
* @param lib an external dependency to import
|
|
156
|
+
* @param ver version of the dependency
|
|
157
|
+
* @param symbol symbol to check for
|
|
158
|
+
* @returns true if `lib` can be imported and provides `symbol`, false
|
|
159
|
+
* otherwise
|
|
160
|
+
*/
|
|
161
|
+
export function checkSymbol(lib: string, ver: string, symbol: string): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Initialize `gettext`.
|
|
164
|
+
* After calling this method `globalThis._`, `globalThis.C_` and `globalThis.N_` will be available.
|
|
165
|
+
*/
|
|
46
166
|
export function initGettext(): void;
|
|
47
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* @deprecated Use JS string interpolation
|
|
169
|
+
*/
|
|
48
170
|
export function initFormat(): void;
|
|
49
|
-
|
|
171
|
+
/**
|
|
172
|
+
* As checkSymbol(), but exit with an error if the
|
|
173
|
+
* dependency cannot be satisfied.
|
|
174
|
+
*
|
|
175
|
+
* @param lib an external dependency to import
|
|
176
|
+
* @param ver version of the dependency
|
|
177
|
+
* @param symbol symbol to check for
|
|
178
|
+
*/
|
|
179
|
+
export function initSubmodule(lib: string, ver?: string, symbol?: string): void;
|
|
180
|
+
/**
|
|
181
|
+
* Load and register a GResource named @name. @name is optional and defaults to ${package-name}
|
|
182
|
+
* @param name The name of the GResource to load
|
|
183
|
+
*/
|
|
184
|
+
export function loadResource(name?: string): void;
|
|
50
185
|
}
|
|
51
186
|
|
|
52
187
|
declare namespace byteArray {
|
|
@@ -426,9 +561,27 @@ declare global {
|
|
|
426
561
|
cairo: typeof cairo;
|
|
427
562
|
}
|
|
428
563
|
|
|
564
|
+
// Overwrites, see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/script/package.js
|
|
565
|
+
/**
|
|
566
|
+
* Run `pkg.initGettext()` before using this.
|
|
567
|
+
* See {@link gettext.gettext}
|
|
568
|
+
*/
|
|
569
|
+
const _: undefined | typeof gettext.gettext;
|
|
570
|
+
/**
|
|
571
|
+
* Run `pkg.initGettext()` before using this.
|
|
572
|
+
* See {@link gettext.pgettext}
|
|
573
|
+
*/
|
|
574
|
+
const C_: undefined | typeof gettext.pgettext;
|
|
575
|
+
/**
|
|
576
|
+
* Run `pkg.initGettext()` before using this.
|
|
577
|
+
* Currently not implemented.
|
|
578
|
+
*/
|
|
579
|
+
const N_: undefined | ((x: string) => string);
|
|
580
|
+
|
|
429
581
|
function print(...args: any[]): void;
|
|
430
582
|
function printerr(...args: any[]): void;
|
|
431
|
-
function log(
|
|
583
|
+
function log(obj: object, others?: object[]): void;
|
|
584
|
+
function log(msg: string, substitutions?: any[]): void;
|
|
432
585
|
function logError(exception: object, message?: any): void;
|
|
433
586
|
function logError(message?: any): void;
|
|
434
587
|
|
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.8",
|
|
4
4
|
"description": "GJS TypeScript type definitions for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "gjs.js",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"test": "tsc --project tsconfig.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@girs/gio-2.0": "^2.80.2-4.0.0-beta.
|
|
50
|
-
"@girs/glib-2.0": "^2.80.2-4.0.0-beta.
|
|
51
|
-
"@girs/gobject-2.0": "^2.80.2-4.0.0-beta.
|
|
49
|
+
"@girs/gio-2.0": "^2.80.2-4.0.0-beta.8",
|
|
50
|
+
"@girs/glib-2.0": "^2.80.2-4.0.0-beta.8",
|
|
51
|
+
"@girs/gobject-2.0": "^2.80.2-4.0.0-beta.8"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"typescript": "*"
|