@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/console.d.ts ADDED
@@ -0,0 +1,26 @@
1
+
2
+
3
+ /**
4
+ * @param logDomain the GLib log domain this Console should print
5
+ * with. Defaults to 'Gjs-Console'.
6
+ */
7
+ export function setConsoleLogDomain(logDomain: string): void
8
+
9
+ /**
10
+ * @param logDomain the GLib log domain this Console should print
11
+ * with. Defaults to 'Gjs-Console'.
12
+ */
13
+ export function getConsoleLogDomain(): string
14
+
15
+ export declare const DEFAULT_LOG_DOMAIN: string
16
+
17
+ declare const Console: {
18
+ setConsoleLogDomain: typeof setConsoleLogDomain,
19
+ getConsoleLogDomain: typeof getConsoleLogDomain,
20
+ DEFAULT_LOG_DOMAIN: typeof DEFAULT_LOG_DOMAIN
21
+ }
22
+
23
+ export default Console
24
+
25
+
26
+
package/console.js ADDED
@@ -0,0 +1,6 @@
1
+ import Console, { getConsoleLogDomain, setConsoleLogDomain, DEFAULT_LOG_DOMAIN } from 'console';
2
+
3
+ export { getConsoleLogDomain, setConsoleLogDomain, DEFAULT_LOG_DOMAIN }
4
+ export default Console;
5
+
6
+
package/dom.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  /**
2
3
  * Gjs has implemented some functionality from the DOM API,
3
4
  * this leads to a conflict when all DOM (`lib.dom.d.ts`) should be used.
@@ -9,48 +10,51 @@
9
10
  * See also https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts
10
11
  */
11
12
 
13
+
12
14
  import type GLib from '@girs/glib-2.0';
15
+ import type GObject from '@girs/gobject-2.0';
13
16
 
14
17
  declare global {
18
+
15
19
  interface ImportMeta {
16
20
  /**
17
21
  * The absolute file: or resource: URL of the module.
18
22
  *
19
23
  * @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/ESModules.md#importmetaurl
20
24
  */
21
- readonly url: string;
25
+ url: string; // with readonly this type is incompatible with e.g. https://github.com/vitejs/vite/blob/main/packages/vite/types/importMeta.d.ts
22
26
  }
23
27
 
24
28
  // Timers
25
29
  // See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/esm/_timers.js
26
30
 
27
31
  /**
28
- * @version Gjs 1.71.1
32
+ * @since 1.71.1
29
33
  * @param callback a callback function
30
34
  * @param delay the duration in milliseconds to wait before running callback
31
35
  * @param args arguments to pass to callback
32
36
  */
33
- function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
37
+ function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
34
38
 
35
39
  /**
36
- * @version Gjs 1.71.1
40
+ * @since 1.71.1
37
41
  * @param callback a callback function
38
42
  * @param delay the duration in milliseconds to wait between calling callback
39
43
  * @param args arguments to pass to callback
40
44
  */
41
- function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
45
+ function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source
42
46
 
43
47
  /**
44
- * @version Gjs 1.71.1
48
+ * @since 1.71.1
45
49
  * @param timeout the timeout to clear
46
50
  */
47
- function clearTimeout(timeout: GLib.Source): void;
51
+ function clearTimeout(timeout: GLib.Source): void
48
52
 
49
53
  /**
50
- * @version Gjs 1.71.1
54
+ * @since 1.71.1
51
55
  * @param timeout the timeout to clear
52
56
  */
53
- function clearInterval(timeout: GLib.Source): void;
57
+ function clearInterval(timeout: GLib.Source): void
54
58
 
55
59
  interface Console {
56
60
  /**
@@ -62,7 +66,7 @@ declare global {
62
66
  * @param data formatting substitutions, if applicable
63
67
  * @returns
64
68
  */
65
- assert(condition: boolean, ...data: any[]): void;
69
+ assert(condition: boolean, ...data: any[]): void
66
70
 
67
71
  /**
68
72
  * Resets grouping and clears the terminal on systems supporting ANSI
@@ -72,14 +76,14 @@ declare global {
72
76
  * console.clear() has no visual effect.
73
77
  *
74
78
  */
75
- clear(): void;
79
+ clear(): void
76
80
 
77
81
  /**
78
82
  * Logs a message with severity equal to {@link GLib.LogLevelFlags.DEBUG}.
79
83
  *
80
84
  * @param {...any} data formatting substitutions, if applicable
81
85
  */
82
- debug(...data: any[]): void;
86
+ debug(...data: any[]): void
83
87
 
84
88
  /**
85
89
  * Logs a message with severity equal to {@link GLib.LogLevelFlags.CRITICAL}.
@@ -88,46 +92,46 @@ declare global {
88
92
  *
89
93
  * @param data formatting substitutions, if applicable
90
94
  */
91
- error(...data: any[]): void;
95
+ error(...data: any[]): void
92
96
 
93
97
  /**
94
98
  * Logs a message with severity equal to {@link GLib.LogLevelFlags.INFO}.
95
99
  *
96
100
  * @param data formatting substitutions, if applicable
97
101
  */
98
- info(...data: any[]): void;
102
+ info(...data: any[]): void
99
103
 
100
104
  /**
101
105
  * Logs a message with severity equal to {@link GLib.LogLevelFlags.MESSAGE}.
102
106
  *
103
107
  * @param data formatting substitutions, if applicable
104
108
  */
105
- log(...data: any[]): void;
109
+ log(...data: any[]): void
106
110
 
107
111
  // 1.1.7 table(tabularData, properties)
108
- table(tabularData: any, _properties: never): void;
112
+ table(tabularData: any, _properties: never): void
109
113
 
110
114
  /**
111
115
  * @param data formatting substitutions, if applicable
112
116
  */
113
- trace(...data: any[]): void;
117
+ trace(...data: any[]): void
114
118
 
115
119
  /**
116
120
  * @param data formatting substitutions, if applicable
117
121
  */
118
- warn(...data: any[]): void;
122
+ warn(...data: any[]): void
119
123
 
120
124
  /**
121
125
  * @param item an item to format generically
122
126
  * @param [options] any additional options for the formatter. Unused
123
127
  * in our implementation.
124
128
  */
125
- dir(item: object, options: never): void;
129
+ dir(item: object, options: never): void
126
130
 
127
131
  /**
128
132
  * @param data formatting substitutions, if applicable
129
133
  */
130
- dirxml(...data: any[]): void;
134
+ dirxml(...data: any[]): void
131
135
 
132
136
  // 1.2 Counting functions
133
137
  // https://console.spec.whatwg.org/#counting
@@ -139,12 +143,12 @@ declare global {
139
143
  *
140
144
  * @param label unique identifier for this action
141
145
  */
142
- count(label: string): void;
146
+ count(label: string): void
143
147
 
144
148
  /**
145
149
  * @param label the unique label to reset the count for
146
150
  */
147
- countReset(label: string): void;
151
+ countReset(label: string): void
148
152
 
149
153
  // 1.3 Grouping functions
150
154
  // https://console.spec.whatwg.org/#grouping
@@ -152,18 +156,18 @@ declare global {
152
156
  /**
153
157
  * @param data formatting substitutions, if applicable
154
158
  */
155
- group(...data: any[]): void;
159
+ group(...data: any[]): void
156
160
 
157
161
  /**
158
162
  * Alias for console.group()
159
163
  *
160
164
  * @param {...any} data formatting substitutions, if applicable
161
165
  */
162
- groupCollapsed(...data: any[]): void;
166
+ groupCollapsed(...data: any[]): void
163
167
 
164
168
  /**
165
169
  */
166
- groupEnd(): void;
170
+ groupEnd(): void
167
171
 
168
172
  // 1.4 Timing functions
169
173
  // https://console.spec.whatwg.org/#timing
@@ -172,7 +176,7 @@ declare global {
172
176
  * @param label unique identifier for this action, pass to
173
177
  * console.timeEnd() to complete
174
178
  */
175
- time(label: string): void;
179
+ time(label: string): void
176
180
 
177
181
  /**
178
182
  * Logs the time since the last call to console.time(label) where label is
@@ -182,7 +186,7 @@ declare global {
182
186
  * console.timeEnd() to complete
183
187
  * @param data string substitutions, if applicable
184
188
  */
185
- timeLog(label: string, ...data: any[]): void;
189
+ timeLog(label: string, ...data: any[]): void
186
190
 
187
191
  /**
188
192
  * Logs the time since the last call to console.time(label) and completes
@@ -191,7 +195,7 @@ declare global {
191
195
  *
192
196
  * @param label unique identifier for this action
193
197
  */
194
- timeEnd(label: string): void;
198
+ timeEnd(label: string): void
195
199
 
196
200
  // Non-standard functions which are de-facto standards.
197
201
  // Similar to Node, we define these as no-ops for now.
@@ -202,33 +206,21 @@ declare global {
202
206
  * @param _label unique identifier for this action, pass to
203
207
  * console.profileEnd to complete
204
208
  */
205
- profile(_label: string): void;
209
+ profile(_label: string): void
206
210
 
207
211
  /**
208
212
  * @deprecated Not implemented in GJS
209
213
  *
210
214
  * @param _label unique identifier for this action
211
215
  */
212
- profileEnd(_label: string): void;
216
+ profileEnd(_label: string): void
213
217
 
214
218
  /**
215
219
  * @deprecated Not implemented in GJS
216
220
  *
217
221
  * @param _label unique identifier for this action
218
222
  */
219
- timeStamp(_label: string): void;
220
-
221
- // GJS-specific extensions for integrating with GLib structured logging
222
-
223
- /**
224
- * @param logDomain the GLib log domain this Console should print
225
- * with. Defaults to 'Gjs-Console'.
226
- */
227
- setLogDomain(logDomain: string): void;
228
-
229
- logDomain: string;
230
-
231
- interact(): void;
223
+ timeStamp(_label: string): void
232
224
  }
233
225
 
234
226
  interface TextDecodeOptions {
@@ -238,24 +230,24 @@ declare global {
238
230
 
239
231
  interface TextDecoderOptions {
240
232
  /** Indicates whether the error mode is fatal. */
241
- fatal?: boolean;
233
+ fatal?: boolean
242
234
  /** Indicates whether whether the byte order mark is ignored. */
243
- ignoreBOM?: boolean;
235
+ ignoreBOM?: boolean
244
236
  }
245
237
 
246
238
  /**
247
239
  * The TextDecoder interface represents a decoder for a specific text encoding.
248
240
  * It takes a stream of bytes as input and emits a stream of code points.
249
241
  *
250
- * @version Gjs 1.69.2
242
+ * @since 1.69.2
251
243
  */
252
244
  interface TextDecoder {
253
245
  /** A string containing the name of the decoder, that is a string describing the method the TextDecoder will use. */
254
- readonly encoding: TextDecoderEncoding;
246
+ readonly encoding: TextDecoderEncoding
255
247
  /** A Boolean indicating whether the error mode is fatal. */
256
- readonly fatal: boolean;
248
+ readonly fatal: boolean
257
249
  /** A Boolean indicating whether the byte order mark is ignored. */
258
- readonly ignoreBOM: boolean;
250
+ readonly ignoreBOM: boolean
259
251
 
260
252
  /**
261
253
  * Returns a string containing the text decoded with the method of the specific TextDecoder object.
@@ -265,28 +257,28 @@ declare global {
265
257
  * @param input Buffer containing the text to decode
266
258
  * @param options Object defining the decode options
267
259
  */
268
- decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string;
260
+ decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string
269
261
  }
270
262
 
271
263
  interface TextEncoderEncodeIntoResult {
272
- read?: number;
273
- written?: number;
264
+ read?: number
265
+ written?: number
274
266
  }
275
267
 
276
268
  /**
277
269
  * TextEncoder takes a stream of code points as input and emits a stream of bytes.
278
270
  *
279
- * @version Gjs 1.69.2
271
+ * @since 1.69.2
280
272
  */
281
273
  interface TextEncoder {
282
- readonly encoding: 'utf-8';
274
+ readonly encoding: 'utf-8'
283
275
 
284
276
  /**
285
277
  * Takes a string as input, and returns a buffer containing the text given in parameters encoded with the UTF-8 method.
286
278
  *
287
279
  * @param input Text to encode.
288
280
  */
289
- encode(input?: string): Uint8Array;
281
+ encode(input?: string): Uint8Array
290
282
  /**
291
283
  * Takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into,
292
284
  * and returns a dictionary object indicating the progress of the encoding.
@@ -296,20 +288,21 @@ declare global {
296
288
  * @param source Text to encode.
297
289
  * @param destination Buffer where to place the resulting UTF-8 encoded text into.
298
290
  */
299
- encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
291
+ encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult
300
292
  }
301
293
 
302
- const console: Console;
294
+ const console: Console
303
295
 
304
296
  const TextDecoder: {
305
- prototype: TextDecoder;
306
- new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder;
307
- };
297
+ prototype: TextDecoder
298
+ new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder
299
+ }
308
300
 
309
301
  const TextEncoder: {
310
- prototype: TextEncoder;
311
- new (): TextEncoder;
312
- };
302
+ prototype: TextEncoder
303
+ new (): TextEncoder
304
+ }
313
305
  }
314
306
 
315
- export {};
307
+ export {}
308
+
package/gettext.d.ts CHANGED
@@ -7,35 +7,38 @@ export enum LocaleCategory {
7
7
  NUMERIC,
8
8
  TIME,
9
9
  }
10
- export function setlocale(category: number, locale: string | null): string;
11
- export function textdomain(domainname: string | null): string;
12
- export function bindtextdomain(domainname: string, dirname: string | null): string;
13
- export function gettext(msgid: string): string;
14
- export function dgettext(domainname: string | null, msgid: string): string;
15
- export function dcgettext(domainname: string | null, msgid: string, category: number): string;
16
- export function ngettext(msgid: string, msgid_plural: string, n: number): string;
17
- export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string;
18
- export function pgettext(context: string, msgid: string): string;
19
- export function dpgettext(dom: string | null, context: string, msgid: string): string;
10
+ export function setlocale(category: number, locale: string | null): string
11
+ export function textdomain(domainname: string | null): string
12
+ export function bindtextdomain(domainname: string, dirname: string | null): string
13
+ export function gettext(msgid: string): string
14
+ export function dgettext(domainname: string | null, msgid: string): string
15
+ export function dcgettext(domainname: string | null, msgid: string, category: number): string
16
+ export function ngettext(msgid: string, msgid_plural: string, n: number): string
17
+ export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string
18
+ export function pgettext(context: string, msgid: string): string
19
+ export function dpgettext(dom: string | null, context: string, msgid: string): string
20
20
  export function domain(domainName: string): {
21
- gettext: (msgid: string) => string;
22
- ngettext: (msgid: string, msgid_plural: string, n: number) => string;
23
- pgettext: (context: string, msgid: string) => string;
24
- };
21
+ gettext: (msgid: string) => string
22
+ ngettext: (msgid: string, msgid_plural: string, n: number) => string
23
+ pgettext: (context: string, msgid: string) => string
24
+ }
25
25
 
26
26
  declare const Gettext: {
27
- LocaleCategory: typeof LocaleCategory;
28
- setlocale: typeof setlocale;
29
- textdomain: typeof textdomain;
30
- bindtextdomain: typeof bindtextdomain;
31
- gettext: typeof gettext;
32
- dgettext: typeof dgettext;
33
- dcgettext: typeof dcgettext;
34
- ngettext: typeof ngettext;
35
- dngettext: typeof dngettext;
36
- pgettext: typeof pgettext;
37
- dpgettext: typeof dpgettext;
38
- domain: typeof domain;
39
- };
27
+ LocaleCategory: typeof LocaleCategory,
28
+ setlocale: typeof setlocale,
29
+ textdomain: typeof textdomain,
30
+ bindtextdomain: typeof bindtextdomain,
31
+ gettext: typeof gettext,
32
+ dgettext: typeof dgettext,
33
+ dcgettext: typeof dcgettext,
34
+ ngettext: typeof ngettext,
35
+ dngettext: typeof dngettext,
36
+ pgettext: typeof pgettext,
37
+ dpgettext: typeof dpgettext,
38
+ domain: typeof domain,
39
+ }
40
+
41
+ export default Gettext
42
+
43
+
40
44
 
41
- export default Gettext;
package/gi.d.ts ADDED
@@ -0,0 +1,32 @@
1
+
2
+ /**
3
+ * Requires a GObject Introspection namespace, optionally at a specific version.
4
+ * If a version is specified and a different version of the same namespace is
5
+ * already loaded, an error will be thrown.
6
+ *
7
+ * @param namespace The GI namespace to import (e.g. 'Gtk', 'GLib')
8
+ * @param version The version of the namespace (e.g. '4.0', '2.0')
9
+ * @returns The imported namespace module
10
+ */
11
+ export function require(namespace: string, version?: string): any
12
+
13
+ /**
14
+ * The `gi` module provides a single entry point for importing GObject
15
+ * Introspection namespaces in GJS ESM modules.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import Gi from 'gi';
20
+ * Gi.require('Gtk', '4.0');
21
+ * ```
22
+ *
23
+ * @see https://gjs-docs.gnome.org/gjs/overrides.md#gi-require
24
+ */
25
+ declare const Gi: {
26
+ readonly require: typeof require;
27
+ }
28
+
29
+ export default Gi
30
+
31
+
32
+
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
@@ -2,18 +2,32 @@
2
2
  // https://stackoverflow.com/questions/45099605/ambient-declaration-with-an-imported-type-in-typescript
3
3
 
4
4
  declare module 'gettext' {
5
- export * from '@girs/gjs/gettext';
6
- import Gettext from '@girs/gjs/gettext';
7
- export default Gettext;
5
+ export * from '@girs/gjs/gettext'
6
+ import Gettext from '@girs/gjs/gettext'
7
+ export default Gettext
8
8
  }
9
9
 
10
10
  declare module 'system' {
11
- export * from '@girs/gjs/system';
12
- import System from '@girs/gjs/system';
13
- export default System;
11
+ export * from '@girs/gjs/system'
12
+ import System from '@girs/gjs/system'
13
+ export default System
14
14
  }
15
15
 
16
16
  declare module 'cairo' {
17
- import Cairo from '@girs/gjs/cairo';
18
- export default Cairo;
17
+ import Cairo from '@girs/gjs/cairo'
18
+ export default Cairo
19
19
  }
20
+
21
+ declare module 'console' {
22
+ import Console, { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN } from '@girs/gjs/console'
23
+ export { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN }
24
+ export default Console
25
+ }
26
+
27
+ declare module 'gi' {
28
+ import Gi, { require } from '@girs/gjs/gi'
29
+ export { require }
30
+ export default Gi
31
+ }
32
+
33
+