@gjsify/node-gi 0.26.1 → 0.27.1

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/gettext.d.ts CHANGED
@@ -17,9 +17,9 @@ export function pgettext(context: string, msgid: string): string;
17
17
  export function dpgettext(domain: string | null, context: string, msgid: string): string;
18
18
  /** Domain-bound gettext bindings. */
19
19
  export function domain(domainName: string): {
20
- gettext(msgid: string): string;
21
- ngettext(msgid1: string, msgid2: string, n: number): string;
22
- pgettext(context: string, msgid: string): string;
20
+ gettext(msgid: string): string;
21
+ ngettext(msgid1: string, msgid2: string, n: number): string;
22
+ pgettext(context: string, msgid: string): string;
23
23
  };
24
24
  /** Set the locale for `category` (no-op on Node). */
25
25
  export function setlocale(category: number, locale: string | null): null;
@@ -31,34 +31,34 @@ export function bindtextdomain(domainName: string, dirName: string | null): null
31
31
  export function bindtextdomainCodeset(domainName: string, codeset: string | null): null;
32
32
  /** The standard POSIX locale category constants. */
33
33
  export const LocaleCategory: {
34
- CTYPE: number;
35
- NUMERIC: number;
36
- TIME: number;
37
- COLLATE: number;
38
- MONETARY: number;
39
- MESSAGES: number;
40
- ALL: number;
34
+ CTYPE: number;
35
+ NUMERIC: number;
36
+ TIME: number;
37
+ COLLATE: number;
38
+ MONETARY: number;
39
+ MESSAGES: number;
40
+ ALL: number;
41
41
  };
42
42
 
43
43
  /** The GJS `Gettext` module object (`import Gettext from 'gettext'`). */
44
44
  export interface GettextModule {
45
- gettext(msgid: string): string;
46
- dgettext(domain: string | null, msgid: string): string;
47
- dcgettext(domain: string | null, msgid: string, category: number): string;
48
- ngettext(msgid1: string, msgid2: string, n: number): string;
49
- dngettext(domain: string | null, msgid1: string, msgid2: string, n: number): string;
50
- pgettext(context: string, msgid: string): string;
51
- dpgettext(domain: string | null, context: string, msgid: string): string;
52
- domain(domainName: string): {
53
45
  gettext(msgid: string): string;
46
+ dgettext(domain: string | null, msgid: string): string;
47
+ dcgettext(domain: string | null, msgid: string, category: number): string;
54
48
  ngettext(msgid1: string, msgid2: string, n: number): string;
49
+ dngettext(domain: string | null, msgid1: string, msgid2: string, n: number): string;
55
50
  pgettext(context: string, msgid: string): string;
56
- };
57
- setlocale(category: number, locale: string | null): null;
58
- textdomain(domainName: string | null): null;
59
- bindtextdomain(domainName: string, dirName: string | null): null;
60
- bindtextdomainCodeset(domainName: string, codeset: string | null): null;
61
- LocaleCategory: typeof LocaleCategory;
51
+ dpgettext(domain: string | null, context: string, msgid: string): string;
52
+ domain(domainName: string): {
53
+ gettext(msgid: string): string;
54
+ ngettext(msgid1: string, msgid2: string, n: number): string;
55
+ pgettext(context: string, msgid: string): string;
56
+ };
57
+ setlocale(category: number, locale: string | null): null;
58
+ textdomain(domainName: string | null): null;
59
+ bindtextdomain(domainName: string, dirName: string | null): null;
60
+ bindtextdomainCodeset(domainName: string, codeset: string | null): null;
61
+ LocaleCategory: typeof LocaleCategory;
62
62
  }
63
63
 
64
64
  declare const Gettext: GettextModule;
package/gettext.js CHANGED
@@ -19,37 +19,37 @@
19
19
 
20
20
  /** Look up `msgid` in the default domain. Passthrough — returns `msgid`. */
21
21
  export function gettext(msgid) {
22
- return msgid;
22
+ return msgid;
23
23
  }
24
24
 
25
25
  /** Look up `msgid` in `domain`. Passthrough — returns `msgid`. */
26
26
  export function dgettext(_domain, msgid) {
27
- return msgid;
27
+ return msgid;
28
28
  }
29
29
 
30
30
  /** Look up `msgid` in `domain`/`category`. Passthrough — returns `msgid`. */
31
31
  export function dcgettext(_domain, msgid, _category) {
32
- return msgid;
32
+ return msgid;
33
33
  }
34
34
 
35
35
  /** Plural lookup in the default domain. Passthrough — singular for n===1, else plural. */
36
36
  export function ngettext(msgid1, msgid2, n) {
37
- return n === 1 ? msgid1 : msgid2;
37
+ return n === 1 ? msgid1 : msgid2;
38
38
  }
39
39
 
40
40
  /** Plural lookup in `domain`. Passthrough — singular for n===1, else plural. */
41
41
  export function dngettext(_domain, msgid1, msgid2, n) {
42
- return n === 1 ? msgid1 : msgid2;
42
+ return n === 1 ? msgid1 : msgid2;
43
43
  }
44
44
 
45
45
  /** Context lookup in the default domain. Passthrough — returns `msgid`. */
46
46
  export function pgettext(_context, msgid) {
47
- return msgid;
47
+ return msgid;
48
48
  }
49
49
 
50
50
  /** Context lookup in `domain`. Passthrough — returns `msgid`. */
51
51
  export function dpgettext(_domain, _context, msgid) {
52
- return msgid;
52
+ return msgid;
53
53
  }
54
54
 
55
55
  /**
@@ -58,37 +58,37 @@ export function dpgettext(_domain, _context, msgid) {
58
58
  * `pgettext` bound to `domainName` (passthrough here).
59
59
  */
60
60
  export function domain(_domainName) {
61
- return {
62
- gettext(msgid) {
63
- return msgid;
64
- },
65
- ngettext(msgid1, msgid2, n) {
66
- return n === 1 ? msgid1 : msgid2;
67
- },
68
- pgettext(_context, msgid) {
69
- return msgid;
70
- },
71
- };
61
+ return {
62
+ gettext(msgid) {
63
+ return msgid;
64
+ },
65
+ ngettext(msgid1, msgid2, n) {
66
+ return n === 1 ? msgid1 : msgid2;
67
+ },
68
+ pgettext(_context, msgid) {
69
+ return msgid;
70
+ },
71
+ };
72
72
  }
73
73
 
74
74
  /** Set the locale for `category`. No-op on Node — returns null. */
75
75
  export function setlocale(_category, _locale) {
76
- return null;
76
+ return null;
77
77
  }
78
78
 
79
79
  /** Set the default text domain. No-op on Node — returns null. */
80
80
  export function textdomain(_domainName) {
81
- return null;
81
+ return null;
82
82
  }
83
83
 
84
84
  /** Bind a text domain to a directory. No-op on Node — returns null. */
85
85
  export function bindtextdomain(_domainName, _dirName) {
86
- return null;
86
+ return null;
87
87
  }
88
88
 
89
89
  /** Set the output codeset for a text domain. No-op on Node — returns null. */
90
90
  export function bindtextdomainCodeset(_domainName, _codeset) {
91
- return null;
91
+ return null;
92
92
  }
93
93
 
94
94
  /**
@@ -96,13 +96,13 @@ export function bindtextdomainCodeset(_domainName, _codeset) {
96
96
  * surfaces via `GjsPrivate.LocaleCategory`.
97
97
  */
98
98
  export const LocaleCategory = {
99
- CTYPE: 0,
100
- NUMERIC: 1,
101
- TIME: 2,
102
- COLLATE: 3,
103
- MONETARY: 4,
104
- MESSAGES: 5,
105
- ALL: 6,
99
+ CTYPE: 0,
100
+ NUMERIC: 1,
101
+ TIME: 2,
102
+ COLLATE: 3,
103
+ MONETARY: 4,
104
+ MESSAGES: 5,
105
+ ALL: 6,
106
106
  };
107
107
 
108
108
  /**
@@ -110,19 +110,19 @@ export const LocaleCategory = {
110
110
  * `import Gettext from 'gettext'` returns.
111
111
  */
112
112
  const Gettext = {
113
- gettext,
114
- dgettext,
115
- dcgettext,
116
- ngettext,
117
- dngettext,
118
- pgettext,
119
- dpgettext,
120
- domain,
121
- setlocale,
122
- textdomain,
123
- bindtextdomain,
124
- bindtextdomainCodeset,
125
- LocaleCategory,
113
+ gettext,
114
+ dgettext,
115
+ dcgettext,
116
+ ngettext,
117
+ dngettext,
118
+ pgettext,
119
+ dpgettext,
120
+ domain,
121
+ setlocale,
122
+ textdomain,
123
+ bindtextdomain,
124
+ bindtextdomainCodeset,
125
+ LocaleCategory,
126
126
  };
127
127
 
128
128
  export default Gettext;
package/gi.d.ts CHANGED
@@ -16,63 +16,111 @@ export type GiNamespace = Record<string, unknown>;
16
16
  * property spec). Not used directly.
17
17
  */
18
18
  export interface ParamSpecDescriptor {
19
- $paramSpec: true;
20
- type: 'string' | 'boolean' | 'int' | 'uint' | 'int64' | 'uint64' | 'double' | 'float' | 'object' | 'boxed';
21
- name: string;
22
- nick?: string;
23
- blurb?: string;
24
- flags?: number;
25
- default?: string | number | boolean;
26
- minimum?: number;
27
- maximum?: number;
28
- /** For `object`/`boxed`: the value GType handle (resolved from a class ctor's `$gtype`). */
29
- gtype?: unknown;
19
+ $paramSpec: true;
20
+ type: 'string' | 'boolean' | 'int' | 'uint' | 'int64' | 'uint64' | 'double' | 'float' | 'object' | 'boxed';
21
+ name: string;
22
+ nick?: string;
23
+ blurb?: string;
24
+ flags?: number;
25
+ default?: string | number | boolean;
26
+ minimum?: number;
27
+ maximum?: number;
28
+ /** For `object`/`boxed`: the value GType handle (resolved from a class ctor's `$gtype`). */
29
+ gtype?: unknown;
30
30
  }
31
31
 
32
32
  /** The `GObject.ParamSpec.*` factories surfaced on the GObject namespace. */
33
33
  export interface ParamSpecFactories {
34
- string(name: string, nick: string, blurb: string, flags: number, defaultValue?: string): ParamSpecDescriptor;
35
- boolean(name: string, nick: string, blurb: string, flags: number, defaultValue?: boolean): ParamSpecDescriptor;
36
- int(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue?: number): ParamSpecDescriptor;
37
- uint(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue?: number): ParamSpecDescriptor;
38
- int64(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue?: number): ParamSpecDescriptor;
39
- uint64(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue?: number): ParamSpecDescriptor;
40
- double(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue?: number): ParamSpecDescriptor;
41
- float(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue?: number): ParamSpecDescriptor;
42
- /** A GObject-typed property; `gtype` is a class ctor (its `$gtype` is read) or a GType handle. */
43
- object(name: string, nick: string, blurb: string, flags: number, gtype: unknown): ParamSpecDescriptor;
44
- /** A boxed-typed property; `gtype` is a boxed class ctor (its `$gtype` is read) or a GType handle. */
45
- boxed(name: string, nick: string, blurb: string, flags: number, gtype: unknown): ParamSpecDescriptor;
34
+ string(name: string, nick: string, blurb: string, flags: number, defaultValue?: string): ParamSpecDescriptor;
35
+ boolean(name: string, nick: string, blurb: string, flags: number, defaultValue?: boolean): ParamSpecDescriptor;
36
+ int(
37
+ name: string,
38
+ nick: string,
39
+ blurb: string,
40
+ flags: number,
41
+ minimum: number,
42
+ maximum: number,
43
+ defaultValue?: number,
44
+ ): ParamSpecDescriptor;
45
+ uint(
46
+ name: string,
47
+ nick: string,
48
+ blurb: string,
49
+ flags: number,
50
+ minimum: number,
51
+ maximum: number,
52
+ defaultValue?: number,
53
+ ): ParamSpecDescriptor;
54
+ int64(
55
+ name: string,
56
+ nick: string,
57
+ blurb: string,
58
+ flags: number,
59
+ minimum: number,
60
+ maximum: number,
61
+ defaultValue?: number,
62
+ ): ParamSpecDescriptor;
63
+ uint64(
64
+ name: string,
65
+ nick: string,
66
+ blurb: string,
67
+ flags: number,
68
+ minimum: number,
69
+ maximum: number,
70
+ defaultValue?: number,
71
+ ): ParamSpecDescriptor;
72
+ double(
73
+ name: string,
74
+ nick: string,
75
+ blurb: string,
76
+ flags: number,
77
+ minimum: number,
78
+ maximum: number,
79
+ defaultValue?: number,
80
+ ): ParamSpecDescriptor;
81
+ float(
82
+ name: string,
83
+ nick: string,
84
+ blurb: string,
85
+ flags: number,
86
+ minimum: number,
87
+ maximum: number,
88
+ defaultValue?: number,
89
+ ): ParamSpecDescriptor;
90
+ /** A GObject-typed property; `gtype` is a class ctor (its `$gtype` is read) or a GType handle. */
91
+ object(name: string, nick: string, blurb: string, flags: number, gtype: unknown): ParamSpecDescriptor;
92
+ /** A boxed-typed property; `gtype` is a boxed class ctor (its `$gtype` is read) or a GType handle. */
93
+ boxed(name: string, nick: string, blurb: string, flags: number, gtype: unknown): ParamSpecDescriptor;
46
94
  }
47
95
 
48
96
  /** A `meta.Signals` entry for {@link GObjectNamespace.registerClass}. */
49
97
  export interface SignalDeclaration {
50
- /** Parameter types in the node-gi vocabulary (e.g. `'int'`, `'string'`, `'object'`). */
51
- param_types?: string[];
52
- /** Return type (default `'void'`). */
53
- return_type?: string;
54
- /** `GSignalFlags` bitfield (default `RUN_LAST`). */
55
- flags?: number;
98
+ /** Parameter types in the node-gi vocabulary (e.g. `'int'`, `'string'`, `'object'`). */
99
+ param_types?: string[];
100
+ /** Return type (default `'void'`). */
101
+ return_type?: string;
102
+ /** `GSignalFlags` bitfield (default `RUN_LAST`). */
103
+ flags?: number;
56
104
  }
57
105
 
58
106
  /** The class-registration metadata accepted by {@link GObjectNamespace.registerClass}. */
59
107
  export interface RegisterClassMeta {
60
- GTypeName?: string;
61
- Properties?: Record<string, ParamSpecDescriptor>;
62
- Signals?: Record<string, SignalDeclaration>;
63
- /**
64
- * A Gtk.Widget composite template: inline UI-XML (`Uint8Array`/Buffer or string)
65
- * or a `"resource:///…"` path string. Installed on the subclass in `class_init`;
66
- * `gtk_widget_init_template` runs at construction. (Gtk.Widget subclasses only.)
67
- */
68
- Template?: Uint8Array | string;
69
- /** Template child ids exposed publicly on the instance as `this.<name>`. */
70
- Children?: string[];
71
- /** Template child ids exposed privately on the instance as `this._<name>`. */
72
- InternalChildren?: string[];
73
- /** `gtk_widget_class_set_css_name` for the subclass (Gtk.Widget subclasses only). */
74
- CssName?: string;
75
- [key: string]: unknown;
108
+ GTypeName?: string;
109
+ Properties?: Record<string, ParamSpecDescriptor>;
110
+ Signals?: Record<string, SignalDeclaration>;
111
+ /**
112
+ * A Gtk.Widget composite template: inline UI-XML (`Uint8Array`/Buffer or string)
113
+ * or a `"resource:///…"` path string. Installed on the subclass in `class_init`;
114
+ * `gtk_widget_init_template` runs at construction. (Gtk.Widget subclasses only.)
115
+ */
116
+ Template?: Uint8Array | string;
117
+ /** Template child ids exposed publicly on the instance as `this.<name>`. */
118
+ Children?: string[];
119
+ /** Template child ids exposed privately on the instance as `this._<name>`. */
120
+ InternalChildren?: string[];
121
+ /** `gtk_widget_class_set_css_name` for the subclass (Gtk.Widget subclasses only). */
122
+ CssName?: string;
123
+ [key: string]: unknown;
76
124
  }
77
125
 
78
126
  /**
@@ -81,53 +129,53 @@ export interface RegisterClassMeta {
81
129
  * surface.
82
130
  */
83
131
  export interface GObjectNamespace extends GiNamespace {
84
- /**
85
- * Register a GObject subclass declared as a JS class. Supports both
86
- * `registerClass(class)` and `registerClass(meta, class)`. Returns a
87
- * constructor whose `new`-ed instances are usable as GObjects (property get/set,
88
- * `.connect/.emit/.disconnect`) and expose the user class's own prototype
89
- * methods. `vfunc_<name>` prototype methods override the parent GObject vfuncs.
90
- */
91
- registerClass(klass: Function): Function;
92
- registerClass(meta: RegisterClassMeta, klass: Function): Function;
93
- ParamSpec: ParamSpecFactories;
94
- /**
95
- * The FULL introspected `GParamFlags` bitfield (READABLE/WRITABLE/READWRITE/
96
- * CONSTRUCT/CONSTRUCT_ONLY/LAX_VALIDATION/STATIC_.../EXPLICIT_NOTIFY/DEPRECATED/
97
- * …) — the named members below are the common convenience bits; the index
98
- * signature covers the remaining introspected members.
99
- */
100
- ParamFlags: {
101
- READABLE: number;
102
- WRITABLE: number;
103
- READWRITE: number;
104
- CONSTRUCT: number;
105
- CONSTRUCT_ONLY: number;
106
- [member: string]: number;
107
- };
108
- /** The FULL introspected `GSignalFlags` bitfield (RUN_FIRST/RUN_LAST/RUN_CLEANUP/NO_RECURSE/DETAILED/ACTION/NO_HOOKS/MUST_COLLECT/DEPRECATED/…). */
109
- SignalFlags: { RUN_FIRST: number; RUN_LAST: number; RUN_CLEANUP: number; [member: string]: number };
110
- /**
111
- * `GObject.Value` — `new GObject.Value()` / `new GObject.Value(gtype, value)`
112
- * build a GValue; the boxed instance exposes `.init(gtype)`/`.set_*`/`.get_*`/
113
- * `.copy`/`.unset`; static `type_compatible`/`type_transformable` route to the
114
- * engine. `value instanceof GObject.Value` recognises a wrapped GValue.
115
- */
116
- Value: { new (): unknown; new (gtype: unknown, value: unknown): unknown; [staticMethod: string]: unknown };
117
- /** gjs's fake enum for signal accumulators. */
118
- AccumulatorType: { NONE: number; FIRST_WINS: number; TRUE_HANDLED: number };
119
- /** Block every handler on `instance` connected with `fn`; returns the count matched. */
120
- signal_handlers_block_by_func(instance: unknown, fn: Function): number;
121
- /** Unblock every handler on `instance` connected with `fn`; returns the count matched. */
122
- signal_handlers_unblock_by_func(instance: unknown, fn: Function): number;
123
- /** Disconnect every handler on `instance` connected with `fn`; returns the count matched. */
124
- signal_handlers_disconnect_by_func(instance: unknown, fn: Function): number;
125
- /** Connect `handler` to `object`'s `name` signal via the instance's own `.connect`. */
126
- signal_connect(object: unknown, name: string, handler: Function): number;
127
- /** Connect `handler` in the after-phase via the instance's own `.connect_after`. */
128
- signal_connect_after(object: unknown, name: string, handler: Function): number;
129
- /** Emit `name` on `object` via the instance's own `.emit`. */
130
- signal_emit_by_name(object: unknown, ...nameAndArgs: unknown[]): unknown;
132
+ /**
133
+ * Register a GObject subclass declared as a JS class. Supports both
134
+ * `registerClass(class)` and `registerClass(meta, class)`. Returns a
135
+ * constructor whose `new`-ed instances are usable as GObjects (property get/set,
136
+ * `.connect/.emit/.disconnect`) and expose the user class's own prototype
137
+ * methods. `vfunc_<name>` prototype methods override the parent GObject vfuncs.
138
+ */
139
+ registerClass(klass: Function): Function;
140
+ registerClass(meta: RegisterClassMeta, klass: Function): Function;
141
+ ParamSpec: ParamSpecFactories;
142
+ /**
143
+ * The FULL introspected `GParamFlags` bitfield (READABLE/WRITABLE/READWRITE/
144
+ * CONSTRUCT/CONSTRUCT_ONLY/LAX_VALIDATION/STATIC_.../EXPLICIT_NOTIFY/DEPRECATED/
145
+ * …) — the named members below are the common convenience bits; the index
146
+ * signature covers the remaining introspected members.
147
+ */
148
+ ParamFlags: {
149
+ READABLE: number;
150
+ WRITABLE: number;
151
+ READWRITE: number;
152
+ CONSTRUCT: number;
153
+ CONSTRUCT_ONLY: number;
154
+ [member: string]: number;
155
+ };
156
+ /** The FULL introspected `GSignalFlags` bitfield (RUN_FIRST/RUN_LAST/RUN_CLEANUP/NO_RECURSE/DETAILED/ACTION/NO_HOOKS/MUST_COLLECT/DEPRECATED/…). */
157
+ SignalFlags: { RUN_FIRST: number; RUN_LAST: number; RUN_CLEANUP: number; [member: string]: number };
158
+ /**
159
+ * `GObject.Value` — `new GObject.Value()` / `new GObject.Value(gtype, value)`
160
+ * build a GValue; the boxed instance exposes `.init(gtype)`/`.set_*`/`.get_*`/
161
+ * `.copy`/`.unset`; static `type_compatible`/`type_transformable` route to the
162
+ * engine. `value instanceof GObject.Value` recognises a wrapped GValue.
163
+ */
164
+ Value: { new (): unknown; new (gtype: unknown, value: unknown): unknown; [staticMethod: string]: unknown };
165
+ /** gjs's fake enum for signal accumulators. */
166
+ AccumulatorType: { NONE: number; FIRST_WINS: number; TRUE_HANDLED: number };
167
+ /** Block every handler on `instance` connected with `fn`; returns the count matched. */
168
+ signal_handlers_block_by_func(instance: unknown, fn: Function): number;
169
+ /** Unblock every handler on `instance` connected with `fn`; returns the count matched. */
170
+ signal_handlers_unblock_by_func(instance: unknown, fn: Function): number;
171
+ /** Disconnect every handler on `instance` connected with `fn`; returns the count matched. */
172
+ signal_handlers_disconnect_by_func(instance: unknown, fn: Function): number;
173
+ /** Connect `handler` to `object`'s `name` signal via the instance's own `.connect`. */
174
+ signal_connect(object: unknown, name: string, handler: Function): number;
175
+ /** Connect `handler` in the after-phase via the instance's own `.connect_after`. */
176
+ signal_connect_after(object: unknown, name: string, handler: Function): number;
177
+ /** Emit `name` on `object` via the instance's own `.emit`. */
178
+ signal_emit_by_name(object: unknown, ...nameAndArgs: unknown[]): unknown;
131
179
  }
132
180
 
133
181
  /**
@@ -135,22 +183,22 @@ export interface GObjectNamespace extends GiNamespace {
135
183
  * or returned/unpacked from the engine). Mirrors the GJS GLib.Variant override.
136
184
  */
137
185
  export interface Variant {
138
- /** Single-level unpack: container children stay {@link Variant}s. */
139
- unpack(): unknown;
140
- /**
141
- * Deep unpack: container children are unpacked to JS, but a nested `v`
142
- * (variant) value — e.g. an `a{sv}` value — STAYS a {@link Variant}.
143
- */
144
- deepUnpack(): unknown;
145
- /** Backwards-compatible alias of {@link Variant.deepUnpack}. */
146
- deep_unpack(): unknown;
147
- /** Fully recursive unpack to plain JS (nested `v` variants are unwrapped). */
148
- recursiveUnpack(): unknown;
149
- /** The GVariant type string (e.g. `"a{sv}"`). */
150
- get_type_string(): string;
151
- toString(): string;
152
- /** Other GVariant methods (n_children, get_child_value, print, …). */
153
- [method: string]: unknown;
186
+ /** Single-level unpack: container children stay {@link Variant}s. */
187
+ unpack(): unknown;
188
+ /**
189
+ * Deep unpack: container children are unpacked to JS, but a nested `v`
190
+ * (variant) value — e.g. an `a{sv}` value — STAYS a {@link Variant}.
191
+ */
192
+ deepUnpack(): unknown;
193
+ /** Backwards-compatible alias of {@link Variant.deepUnpack}. */
194
+ deep_unpack(): unknown;
195
+ /** Fully recursive unpack to plain JS (nested `v` variants are unwrapped). */
196
+ recursiveUnpack(): unknown;
197
+ /** The GVariant type string (e.g. `"a{sv}"`). */
198
+ get_type_string(): string;
199
+ toString(): string;
200
+ /** Other GVariant methods (n_children, get_child_value, print, …). */
201
+ [method: string]: unknown;
154
202
  }
155
203
 
156
204
  /**
@@ -159,8 +207,8 @@ export interface Variant {
159
207
  * index signature.
160
208
  */
161
209
  export interface VariantConstructor {
162
- new (signature: string, value?: unknown): Variant;
163
- [staticMethod: string]: unknown;
210
+ new (signature: string, value?: unknown): Variant;
211
+ [staticMethod: string]: unknown;
164
212
  }
165
213
 
166
214
  /**
@@ -169,18 +217,18 @@ export interface VariantConstructor {
169
217
  * ergonomics replace the introspected struct-based Variant.
170
218
  */
171
219
  export interface GLibNamespace extends GiNamespace {
172
- Variant: VariantConstructor;
173
- /**
174
- * Pack `fields` (string / Uint8Array / {@link Variant} values) into an `a{sv}` and
175
- * hand it to `g_log_variant` — gjs's `GLib.log_structured`.
176
- */
177
- log_structured(logDomain: string, logLevel: number, fields: Record<string, unknown>): void;
178
- /** One-shot `idle_add` — the callback runs once, then the source is removed. */
179
- idle_add_once(priority: number, callback: () => void): number;
180
- /** One-shot `timeout_add` — the callback runs once, then the source is removed. */
181
- timeout_add_once(priority: number, interval: number, callback: () => void): number;
182
- /** One-shot `timeout_add_seconds` — the callback runs once, then the source is removed. */
183
- timeout_add_seconds_once(priority: number, interval: number, callback: () => void): number;
220
+ Variant: VariantConstructor;
221
+ /**
222
+ * Pack `fields` (string / Uint8Array / {@link Variant} values) into an `a{sv}` and
223
+ * hand it to `g_log_variant` — gjs's `GLib.log_structured`.
224
+ */
225
+ log_structured(logDomain: string, logLevel: number, fields: Record<string, unknown>): void;
226
+ /** One-shot `idle_add` — the callback runs once, then the source is removed. */
227
+ idle_add_once(priority: number, callback: () => void): number;
228
+ /** One-shot `timeout_add` — the callback runs once, then the source is removed. */
229
+ timeout_add_once(priority: number, interval: number, callback: () => void): number;
230
+ /** One-shot `timeout_add_seconds` — the callback runs once, then the source is removed. */
231
+ timeout_add_seconds_once(priority: number, interval: number, callback: () => void): number;
184
232
  }
185
233
 
186
234
  /**