@girs/gjs 4.0.0-beta.40 → 4.0.0-beta.42

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-beta.40.
7
+ GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.42.
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/dom.d.ts CHANGED
@@ -26,7 +26,7 @@ declare global {
26
26
  // See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/esm/_timers.js
27
27
 
28
28
  /**
29
- * @version Gjs 1.71.1
29
+ * @since 1.71.1
30
30
  * @param callback a callback function
31
31
  * @param delay the duration in milliseconds to wait before running callback
32
32
  * @param args arguments to pass to callback
@@ -34,7 +34,7 @@ declare global {
34
34
  function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
35
35
 
36
36
  /**
37
- * @version Gjs 1.71.1
37
+ * @since 1.71.1
38
38
  * @param callback a callback function
39
39
  * @param delay the duration in milliseconds to wait between calling callback
40
40
  * @param args arguments to pass to callback
@@ -42,13 +42,13 @@ declare global {
42
42
  function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
43
43
 
44
44
  /**
45
- * @version Gjs 1.71.1
45
+ * @since 1.71.1
46
46
  * @param timeout the timeout to clear
47
47
  */
48
48
  function clearTimeout(timeout: GLib.Source): void;
49
49
 
50
50
  /**
51
- * @version Gjs 1.71.1
51
+ * @since 1.71.1
52
52
  * @param timeout the timeout to clear
53
53
  */
54
54
  function clearInterval(timeout: GLib.Source): void;
@@ -236,7 +236,7 @@ declare global {
236
236
  * The TextDecoder interface represents a decoder for a specific text encoding.
237
237
  * It takes a stream of bytes as input and emits a stream of code points.
238
238
  *
239
- * @version Gjs 1.69.2
239
+ * @since 1.69.2
240
240
  */
241
241
  interface TextDecoder {
242
242
  /** A string containing the name of the decoder, that is a string describing the method the TextDecoder will use. */
@@ -265,7 +265,7 @@ declare global {
265
265
  /**
266
266
  * TextEncoder takes a stream of code points as input and emits a stream of bytes.
267
267
  *
268
- * @version Gjs 1.69.2
268
+ * @since 1.69.2
269
269
  */
270
270
  interface TextEncoder {
271
271
  readonly encoding: 'utf-8';
package/gi.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Requires a GObject Introspection namespace, optionally at a specific version.
3
+ * If a version is specified and a different version of the same namespace is
4
+ * already loaded, an error will be thrown.
5
+ *
6
+ * @param namespace The GI namespace to import (e.g. 'Gtk', 'GLib')
7
+ * @param version The version of the namespace (e.g. '4.0', '2.0')
8
+ * @returns The imported namespace module
9
+ */
10
+ export function require(namespace: string, version?: string): any;
11
+
12
+ /**
13
+ * The `gi` module provides a single entry point for importing GObject
14
+ * Introspection namespaces in GJS ESM modules.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import Gi from 'gi';
19
+ * Gi.require('Gtk', '4.0');
20
+ * ```
21
+ *
22
+ * @see https://gjs-docs.gnome.org/gjs/overrides.md#gi-require
23
+ */
24
+ declare const Gi: {
25
+ readonly require: typeof require;
26
+ };
27
+
28
+ export default Gi;
package/gi.js ADDED
@@ -0,0 +1,6 @@
1
+ import Gi, { require } from 'gi';
2
+
3
+ export { require };
4
+ export default Gi;
5
+
6
+
package/gjs-ambient.d.ts CHANGED
@@ -23,3 +23,9 @@ declare module 'console' {
23
23
  export { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN };
24
24
  export default Console;
25
25
  }
26
+
27
+ declare module 'gi' {
28
+ import Gi, { require } from '@girs/gjs/gi';
29
+ export { require };
30
+ export default Gi;
31
+ }
package/gjs.d.ts CHANGED
@@ -725,6 +725,22 @@ declare global {
725
725
  */
726
726
  format(...args: (string | number | boolean | null | undefined)[]): string;
727
727
  }
728
+
729
+ interface Error {
730
+ /**
731
+ * Checks if this error matches a GLib error domain and code.
732
+ *
733
+ * Added to the global `Error` prototype by the GLib override so that
734
+ * `e.matches(Ns.FooError, Ns.FooError.SOME_CODE)` works without an
735
+ * `instanceof` check. Always returns `false` for standard JavaScript
736
+ * errors; only `GLib.Error` instances provide a meaningful implementation.
737
+ *
738
+ * @param domain A GLib error domain (error class constructor or quark)
739
+ * @param code The error code to match against
740
+ * @returns `false` for native JS errors, `true` if a GLib.Error matches
741
+ */
742
+ matches(domain: unknown, code: number): boolean;
743
+ }
728
744
  }
729
745
 
730
746
  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.40",
3
+ "version": "4.0.0-beta.42",
4
4
  "description": "GJS TypeScript type definitions for Gjs",
5
5
  "type": "module",
6
6
  "module": "gjs.js",
@@ -36,6 +36,11 @@
36
36
  "import": "./console.js",
37
37
  "default": "./console.js"
38
38
  },
39
+ "./gi": {
40
+ "types": "./gi.d.ts",
41
+ "import": "./gi.js",
42
+ "default": "./gi.js"
43
+ },
39
44
  "./gjs": {
40
45
  "types": "./gjs.d.ts",
41
46
  "import": "./gjs.js",
@@ -51,10 +56,10 @@
51
56
  "test": "tsc --project tsconfig.json"
52
57
  },
53
58
  "dependencies": {
54
- "@girs/gobject-2.0": "2.86.4-4.0.0-beta.40",
55
- "@girs/glib-2.0": "2.86.4-4.0.0-beta.40",
56
- "@girs/gio-2.0": "2.86.4-4.0.0-beta.40",
57
- "@girs/cairo-1.0": "1.0.0-4.0.0-beta.40" },
59
+ "@girs/gobject-2.0": "2.88.0-4.0.0-beta.42",
60
+ "@girs/glib-2.0": "2.88.0-4.0.0-beta.42",
61
+ "@girs/gio-2.0": "2.88.0-4.0.0-beta.42",
62
+ "@girs/cairo-1.0": "1.0.0-4.0.0-beta.42" },
58
63
  "devDependencies": {
59
64
  "typescript": "*"
60
65
  },
package/system.d.ts CHANGED
@@ -5,7 +5,7 @@ import type GObject from '@girs/gobject-2.0';
5
5
  * line. In C and other languages, this information is contained in the first element of
6
6
  * the platform's equivalent of argv, but GJS's ARGV only contains the
7
7
  * subsequent command-line arguments. In other words, `ARGV[0]` in GJS is the same as `argv[1]` in C.
8
- * @version Gjs 1.68
8
+ * @since 1.68
9
9
  */
10
10
  export const programInvocationName: string;
11
11
 
@@ -16,7 +16,7 @@ export const version: number;
16
16
 
17
17
  /**
18
18
  * The full path of the executed program.
19
- * @version Gjs 1.68
19
+ * @since 1.68
20
20
  */
21
21
  export const programPath: string | null;
22
22
 
@@ -24,7 +24,7 @@ export const programPath: string | null;
24
24
  * A list of arguments passed to the current process.
25
25
  * This is effectively an alias for the global `ARGV`, which is misleading in that
26
26
  * it is not equivalent to the platform'`s` argv.
27
- * @version Gjs 1.68
27
+ * @since 1.68
28
28
  */
29
29
  export const programArgs: string[];
30
30
 
@@ -46,7 +46,7 @@ export function addressOf(o: object): string;
46
46
  * See also {@link addressOf}
47
47
  * @param o Any {@link GObject.Object}-derived instance
48
48
  * @returns A hexadecimal string (e.g. `0xb4f170f0`)
49
- * @version Gjs 1.58
49
+ * @since 1.58
50
50
  */
51
51
  export function addressOfGObject(o: GObject.Object): string;
52
52
 
@@ -110,7 +110,7 @@ export function dumpHeap(path?: string): void;
110
110
  * Dump internal garbage collector statistics. If `path` is not given, GJS will
111
111
  * write the contents to `stdout`.
112
112
  * @param path Optional file path
113
- * @version Gjs 1.70
113
+ * @since 1.70
114
114
  * @example Output:
115
115
  * ```json
116
116
  * {
package/tsconfig.json CHANGED
@@ -17,9 +17,8 @@
17
17
  "inlineSources": false,
18
18
  "newLine": "LF",
19
19
  // Show diagnostics
20
- "diagnostics": true
21
- },
22
- "include": ["./dom.d.ts","./gjs.d.ts"]
20
+ "diagnostics": true },
21
+ "include": ["./dom.d.ts","./cairo.d.ts","./gettext.d.ts","./system.d.ts","./console.d.ts","./gjs-ambient.d.ts","./gjs.d.ts"]
23
22
  }
24
23
 
25
24
 
package/typedoc.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
- "entryPoints": ["./gjs.d.ts"],
2
+ "entryPoints": ["./gjs.d.ts","./cairo.d.ts","./gettext.d.ts","./system.d.ts","./dom.d.ts","./console.d.ts"],
3
3
  "readme": "./README.md",
4
4
  "name": "Gjs",
5
- "tsconfig": "./tsconfig.json"
5
+ "tsconfig": "./tsconfig.json",
6
+ "skipErrorChecking": true,
7
+ "highlightLanguages": ["typescript", "javascript", "c", "cpp", "xml", "bash", "json", "css"]
6
8
  }
7
9