@girs/gobject-2.0 2.80.0-4.0.0-beta.4 → 2.80.2-4.0.0-beta.7

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
@@ -5,7 +5,7 @@
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gobject-2.0)
6
6
 
7
7
 
8
- GJS TypeScript type definitions for GObject-2.0, generated from library version 2.80.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.3.
8
+ GJS TypeScript type definitions for GObject-2.0, generated from library version 2.80.2 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.7.
9
9
 
10
10
 
11
11
  ## Install
@@ -1,12 +1,9 @@
1
-
2
1
  declare module 'gi://GObject?version=2.0' {
3
- import GObject from '@girs/gobject-2.0';
4
- export default GObject;
2
+ import GObject20 from '@girs/gobject-2.0';
3
+ export default GObject20;
5
4
  }
6
5
 
7
6
  declare module 'gi://GObject' {
8
7
  import GObject20 from 'gi://GObject?version=2.0';
9
8
  export default GObject20;
10
9
  }
11
-
12
-
@@ -1,4 +1,3 @@
1
-
2
1
  import GObject20 from '@girs/gobject-2.0';
3
2
 
4
3
  declare global {
@@ -8,5 +7,3 @@ declare global {
8
7
  }
9
8
 
10
9
  export default GjsGiImports;
11
-
12
-
package/gobject-2.0.d.ts CHANGED
@@ -1,19 +1,255 @@
1
- /*
1
+ /**
2
2
  * Type Definitions for Gjs (https://gjs.guide/)
3
3
  *
4
4
  * These type definitions are automatically generated, do not edit them by hand.
5
5
  * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
6
+ *
7
+ * The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
6
8
  */
7
9
 
8
- import './gobject-2.0-ambient.d.ts';
9
-
10
- /**
11
- * GObject-2.0
12
- */
13
-
10
+ // Module dependencies
14
11
  import type GLib from '@girs/glib-2.0';
15
12
 
16
13
  export namespace GObject {
14
+ // A few things here are inspired by gi.ts
15
+ // See https://gitlab.gnome.org/ewlsh/gi.ts/-/blob/master/packages/lib/src/generators/dts/gobject.ts
16
+ // Copyright Evan Welsh
17
+
18
+ // __type__ forces all GTypes to not match structurally.
19
+ export type GType<T = unknown> = {
20
+ __type__(arg: never): T;
21
+ name: string;
22
+ };
23
+
24
+ // Extra interfaces used to help define GObject classes in js; these
25
+ // aren't part of gi.
26
+ export interface SignalDefinition {
27
+ flags?: SignalFlags;
28
+ accumulator: number;
29
+ return_type?: GType;
30
+ param_types?: GType[];
31
+ }
32
+
33
+ export interface MetaInfo<Props, Interfaces, Sigs> {
34
+ GTypeName?: string;
35
+ GTypeFlags?: TypeFlags;
36
+ Properties?: Props;
37
+ Signals?: Sigs;
38
+ Implements?: Interfaces;
39
+ CssName?: string;
40
+ Template?: Uint8Array | GLib.Bytes | string;
41
+ Children?: string[];
42
+ InternalChildren?: string[];
43
+ }
44
+
45
+ // Correctly types interface checks.
46
+ export function type_is_a<T extends Object>(obj: Object, is_a_type: { $gtype: GType<T> }): obj is T;
47
+
48
+ export class Interface<T = unknown> {
49
+ static _classInit: (cls: any) => any;
50
+ __name__: string;
51
+ _construct: (params: any, ...otherArgs: any[]) => any;
52
+ _init: (params: any) => void;
53
+ $gtype?: GType<T>;
54
+ }
55
+
56
+ /**
57
+ * Use this to signify a function that must be overridden in an
58
+ * implementation of the interface.
59
+ */
60
+ export class NotImplementedError extends Error {
61
+ get name(): 'NotImplementedError';
62
+ }
63
+
64
+ export const __gtkCssName__: unique symbol;
65
+ export const __gtkTemplate__: unique symbol;
66
+ export const __gtkChildren__: unique symbol;
67
+ export const __gtkInternalChildren__: unique symbol;
68
+
69
+ // Expose GObject static properties for ES6 classes
70
+
71
+ export const GTypeName: unique symbol;
72
+ export const requires: unique symbol;
73
+ export const interfaces: unique symbol;
74
+ export const properties: unique symbol;
75
+ export const signals: unique symbol;
76
+
77
+ export let gtypeNameBasedOnJSPath: boolean;
78
+
79
+ export let TYPE_BOOLEAN: GType<boolean>;
80
+ export let Boolean: BooleanConstructor;
81
+
82
+ export let TYPE_ENUM: GType<number>;
83
+ export let TYPE_FLAGS: GType<number>;
84
+
85
+ export let TYPE_DOUBLE: GType<number>;
86
+ export let Double: NumberConstructor;
87
+
88
+ export let TYPE_STRING: GType<string>;
89
+ export let String: StringConstructor;
90
+
91
+ export let TYPE_NONE: GType<undefined>;
92
+ export let TYPE_POINTER: GType<undefined>;
93
+ export let TYPE_BOXED: GType<unknown>;
94
+ export let TYPE_PARAM: GType<unknown>;
95
+ export let TYPE_INTERFACE: GType<unknown>;
96
+ export let TYPE_OBJECT: GType<object>;
97
+ export let TYPE_VARIANT: GType<GLib.Variant>;
98
+ export let TYPE_INT: GType<number>;
99
+ export let TYPE_UINT: GType<number>;
100
+ export let TYPE_INT64: GType<number>;
101
+ export let TYPE_UINT64: GType<number>;
102
+
103
+ // fake enum for signal accumulators, keep in sync with gi/object.c
104
+ export enum AccumulatorType {
105
+ NONE = 0,
106
+ FIRST_WINS = 1,
107
+ TRUE_HANDLED = 2,
108
+ }
109
+
110
+ // A simple workaround if you have a class with .connect, .disconnect or .emit
111
+ // methods (such as Gio.Socket.connect or NMClient.Device.disconnect)
112
+ // The original g_signal_* functions are not introspectable anyway, because
113
+ // we need our own handling of signal argument marshalling
114
+ export function signal_connect(object: Object, name: string, handler: (...args: any[]) => any): number;
115
+ export function signal_connect_after(object: Object, name: string, handler: (...args: any[]) => any): number;
116
+ export function signal_emit_by_name(object: Object, name: string, ...args: any[]): void;
117
+
118
+ /**
119
+ * Finds the first signal handler that matches certain selection criteria.
120
+ * The criteria are passed as properties of a match object.
121
+ * The match object has to be non-empty for successful matches.
122
+ * If no handler was found, a falsy value is returned.
123
+ *
124
+ * @param instance the instance owning the signal handler to be found.
125
+ * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
126
+ * @param match.signalId signal the handler has to be connected to.
127
+ * @param match.detail signal detail the handler has to be connected to.
128
+ * @param match.func the callback function the handler will invoke.
129
+ * @returns A valid non-0 signal handler ID for a successful match.
130
+ */
131
+ export function signal_handler_find(
132
+ instance: Object,
133
+ match: { signalId: string; detail: string; func: (...args: any[]) => any },
134
+ ): number | bigint | object | null;
135
+
136
+ /**
137
+ * Blocks all handlers on an instance that match certain selection criteria.
138
+ * The criteria are passed as properties of a match object.
139
+ * The match object has to have at least `func` for successful matches.
140
+ * If no handlers were found, 0 is returned, the number of blocked handlers
141
+ * otherwise.
142
+ *
143
+ * @param instance the instance owning the signal handler to be found.
144
+ * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
145
+ * @param match.signalId signal the handler has to be connected to.
146
+ * @param match.detail signal detail the handler has to be connected to.
147
+ * @param match.func the callback function the handler will invoke.
148
+ * @returns The number of handlers that matched.
149
+ */
150
+ export function signal_handlers_block_matched(
151
+ instance: Object,
152
+ match: { signalId: string; detail: string; func: (...args: any[]) => any },
153
+ ): number;
154
+
155
+ /**
156
+ * Disconnects all handlers on an instance that match certain selection
157
+ * criteria.
158
+ * The criteria are passed as properties of a match object.
159
+ * The match object has to have at least `func` for successful matches.
160
+ * If no handlers were found, 0 is returned, the number of disconnected
161
+ * handlers otherwise.
162
+ *
163
+ * @param instance the instance owning the signal handler
164
+ * to be found.
165
+ * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
166
+ * @param match.signalId signal the handler has to be connected to.
167
+ * @param match.detail signal detail the handler has to be connected to.
168
+ * @param match.func the callback function the handler will invoke.
169
+ * @returns The number of handlers that matched.
170
+ */
171
+ export function signal_handlers_unblock_matched(
172
+ instance: Object,
173
+ match: { signalId: string; detail: string; func: (...args: any[]) => any },
174
+ ): number;
175
+
176
+ /**
177
+ * Disconnects all handlers on an instance that match certain selection
178
+ * criteria.
179
+ * The criteria are passed as properties of a match object.
180
+ * The match object has to have at least `func` for successful matches.
181
+ * If no handlers were found, 0 is returned, the number of disconnected
182
+ * handlers otherwise.
183
+ *
184
+ * @param instance the instance owning the signal handler
185
+ * to be found.
186
+ * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
187
+ * @param match.signalId signal the handler has to be connected to.
188
+ * @param match.detail signal detail the handler has to be connected to.
189
+ * @param match.func the callback function the handler will invoke.
190
+ * @returns The number of handlers that matched.
191
+ */
192
+ export function signal_handlers_disconnect_matched(
193
+ instance: Object,
194
+ match: { signalId: string; detail: string; func: (...args: any[]) => any },
195
+ ): number;
196
+
197
+ // Also match the macros used in C APIs, even though they're not introspected
198
+
199
+ /**
200
+ * Blocks all handlers on an instance that match `func`.
201
+ *
202
+ * @param instance the instance to block handlers from.
203
+ * @param func the callback function the handler will invoke.
204
+ * @returns The number of handlers that matched.
205
+ */
206
+ export function signal_handlers_block_by_func(instance: Object, func: (...args: any[]) => any): number;
207
+
208
+ /**
209
+ * Unblocks all handlers on an instance that match `func`.
210
+ *
211
+ * @function
212
+ * @param instance the instance to unblock handlers from.
213
+ * @param func the callback function the handler will invoke.
214
+ * @returns The number of handlers that matched.
215
+ */
216
+ export function signal_handlers_unblock_by_func(instance: Object, func: (...args: any[]) => any): number;
217
+
218
+ /**
219
+ * Disconnects all handlers on an instance that match `func`.
220
+ *
221
+ * @param instance the instance to remove handlers from.
222
+ * @param func the callback function the handler will invoke.
223
+ * @returns The number of handlers that matched.
224
+ */
225
+ export function signal_handlers_disconnect_by_func(instance: Object, func: (...args: any[]) => any): number;
226
+ export function signal_handlers_disconnect_by_data(): void;
227
+
228
+ export type Property<K extends ParamSpec> = K extends ParamSpec<infer T> ? T : any;
229
+
230
+ // TODO: What about the generated class Closure
231
+ export type TClosure<R = any, P = any> = (...args: P[]) => R;
232
+
233
+ type ObjectConstructor = { new (...args: any[]): Object };
234
+
235
+ export function registerClass<
236
+ T extends ObjectConstructor,
237
+ Props extends { [key: string]: ParamSpec },
238
+ Interfaces extends { $gtype: GType }[],
239
+ Sigs extends {
240
+ [key: string]: {
241
+ param_types?: readonly GType[];
242
+ [key: string]: any;
243
+ };
244
+ },
245
+ >(options: MetaInfo<Props, Interfaces, Sigs>, cls: T): T;
246
+
247
+ export function registerClass<T extends ObjectConstructor>(cls: T): T;
248
+
249
+ /**
250
+ * GObject-2.0
251
+ */
252
+
17
253
  /**
18
254
  * Mask containing the bits of #GParamSpec.flags which are reserved for GLib.
19
255
  */
@@ -3036,10 +3272,45 @@ export namespace GObject {
3036
3272
 
3037
3273
  // Own virtual methods of GObject.Object
3038
3274
 
3275
+ /**
3276
+ * the `constructed` function is called by g_object_new() as the
3277
+ * final step of the object creation process. At the point of the call, all
3278
+ * construction properties have been set on the object. The purpose of this
3279
+ * call is to allow for object initialisation steps that can only be performed
3280
+ * after construction properties have been set. `constructed` implementors
3281
+ * should chain up to the `constructed` call of their parent class to allow it
3282
+ * to complete its initialisation.
3283
+ */
3039
3284
  vfunc_constructed(): void;
3285
+ /**
3286
+ * emits property change notification for a bunch
3287
+ * of properties. Overriding `dispatch_properties_changed` should be rarely
3288
+ * needed.
3289
+ * @param n_pspecs
3290
+ * @param pspecs
3291
+ */
3040
3292
  vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: ParamSpec): void;
3293
+ /**
3294
+ * the `dispose` function is supposed to drop all references to other
3295
+ * objects, but keep the instance otherwise intact, so that client method
3296
+ * invocations still work. It may be run multiple times (due to reference
3297
+ * loops). Before returning, `dispose` should chain up to the `dispose` method
3298
+ * of the parent class.
3299
+ */
3041
3300
  vfunc_dispose(): void;
3301
+ /**
3302
+ * instance finalization function, should finish the finalization of
3303
+ * the instance begun in `dispose` and chain up to the `finalize` method of the
3304
+ * parent class.
3305
+ */
3042
3306
  vfunc_finalize(): void;
3307
+ /**
3308
+ * the generic getter for all properties of this type. Should be
3309
+ * overridden for every type with properties.
3310
+ * @param property_id
3311
+ * @param value
3312
+ * @param pspec
3313
+ */
3043
3314
  vfunc_get_property(property_id: number, value: Value | any, pspec: ParamSpec): void;
3044
3315
  /**
3045
3316
  * Emits a "notify" signal for the property `property_name` on `object`.
@@ -3055,7 +3326,17 @@ export namespace GObject {
3055
3326
  * @param pspec
3056
3327
  */
3057
3328
  vfunc_notify(pspec: ParamSpec): void;
3058
- vfunc_set_property(property_id: number, value: Value | any, pspec: ParamSpec): void;
3329
+ /**
3330
+ * the generic setter for all properties of this type. Should be
3331
+ * overridden for every type with properties. If implementations of
3332
+ * `set_property` don't emit property change notification explicitly, this will
3333
+ * be done implicitly by the type system. However, if the notify signal is
3334
+ * emitted explicitly, the type system will not emit it a second time.
3335
+ * @param property_id
3336
+ * @param value
3337
+ * @param pspec
3338
+ */
3339
+ vfunc_set_property(property_id: number, value: Value | any, pspec: ParamSpec): void;
3059
3340
 
3060
3341
  // Own methods of GObject.Object
3061
3342
 
@@ -3584,10 +3865,38 @@ export namespace GObject {
3584
3865
 
3585
3866
  // Own virtual methods of GObject.ParamSpec
3586
3867
 
3868
+ /**
3869
+ * The instance finalization function (optional), should chain
3870
+ * up to the finalize method of the parent class.
3871
+ */
3587
3872
  vfunc_finalize(): void;
3873
+ /**
3874
+ * Checks if contents of `value` comply with the specifications
3875
+ * set out by this type, without modifying the value. This vfunc is optional.
3876
+ * If it isn't set, GObject will use `value_validate`. Since 2.74
3877
+ * @param value
3878
+ */
3588
3879
  vfunc_value_is_valid(value: Value | any): boolean;
3880
+ /**
3881
+ * Resets a `value` to the default value for this type
3882
+ * (recommended, the default is g_value_reset()), see
3883
+ * g_param_value_set_default().
3884
+ * @param value
3885
+ */
3589
3886
  vfunc_value_set_default(value: Value | any): void;
3887
+ /**
3888
+ * Ensures that the contents of `value` comply with the
3889
+ * specifications set out by this type (optional), see
3890
+ * g_param_value_validate().
3891
+ * @param value
3892
+ */
3590
3893
  vfunc_value_validate(value: Value | any): boolean;
3894
+ /**
3895
+ * Compares `value1` with `value2` according to this type
3896
+ * (recommended, the default is memcmp()), see g_param_values_cmp().
3897
+ * @param value1
3898
+ * @param value2
3899
+ */
3591
3900
  vfunc_values_cmp(value1: Value | any, value2: Value | any): number;
3592
3901
 
3593
3902
  // Own methods of GObject.ParamSpec
@@ -3875,7 +4184,14 @@ export namespace GObject {
3875
4184
 
3876
4185
  // Own virtual methods of GObject.TypeModule
3877
4186
 
4187
+ /**
4188
+ * loads the module and registers one or more types using
4189
+ * g_type_module_register_type().
4190
+ */
3878
4191
  vfunc_load(): boolean;
4192
+ /**
4193
+ * unloads the module
4194
+ */
3879
4195
  vfunc_unload(): void;
3880
4196
 
3881
4197
  // Own methods of GObject.TypeModule
@@ -4317,10 +4633,45 @@ export namespace GObject {
4317
4633
  * @param closure #GClosure to watch
4318
4634
  */
4319
4635
  watch_closure(closure: Closure): void;
4636
+ /**
4637
+ * the `constructed` function is called by g_object_new() as the
4638
+ * final step of the object creation process. At the point of the call, all
4639
+ * construction properties have been set on the object. The purpose of this
4640
+ * call is to allow for object initialisation steps that can only be performed
4641
+ * after construction properties have been set. `constructed` implementors
4642
+ * should chain up to the `constructed` call of their parent class to allow it
4643
+ * to complete its initialisation.
4644
+ */
4320
4645
  vfunc_constructed(): void;
4646
+ /**
4647
+ * emits property change notification for a bunch
4648
+ * of properties. Overriding `dispatch_properties_changed` should be rarely
4649
+ * needed.
4650
+ * @param n_pspecs
4651
+ * @param pspecs
4652
+ */
4321
4653
  vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: ParamSpec): void;
4654
+ /**
4655
+ * the `dispose` function is supposed to drop all references to other
4656
+ * objects, but keep the instance otherwise intact, so that client method
4657
+ * invocations still work. It may be run multiple times (due to reference
4658
+ * loops). Before returning, `dispose` should chain up to the `dispose` method
4659
+ * of the parent class.
4660
+ */
4322
4661
  vfunc_dispose(): void;
4662
+ /**
4663
+ * instance finalization function, should finish the finalization of
4664
+ * the instance begun in `dispose` and chain up to the `finalize` method of the
4665
+ * parent class.
4666
+ */
4323
4667
  vfunc_finalize(): void;
4668
+ /**
4669
+ * the generic getter for all properties of this type. Should be
4670
+ * overridden for every type with properties.
4671
+ * @param property_id
4672
+ * @param value
4673
+ * @param pspec
4674
+ */
4324
4675
  vfunc_get_property(property_id: number, value: Value | any, pspec: ParamSpec): void;
4325
4676
  /**
4326
4677
  * Emits a "notify" signal for the property `property_name` on `object`.
@@ -4336,6 +4687,16 @@ export namespace GObject {
4336
4687
  * @param pspec
4337
4688
  */
4338
4689
  vfunc_notify(pspec: ParamSpec): void;
4690
+ /**
4691
+ * the generic setter for all properties of this type. Should be
4692
+ * overridden for every type with properties. If implementations of
4693
+ * `set_property` don't emit property change notification explicitly, this will
4694
+ * be done implicitly by the type system. However, if the notify signal is
4695
+ * emitted explicitly, the type system will not emit it a second time.
4696
+ * @param property_id
4697
+ * @param value
4698
+ * @param pspec
4699
+ */
4339
4700
  vfunc_set_property(property_id: number, value: Value | any, pspec: ParamSpec): void;
4340
4701
  disconnect(id: number): void;
4341
4702
  set(properties: { [key: string]: any }): void;
@@ -6161,241 +6522,6 @@ export namespace GObject {
6161
6522
  func: object | null,
6162
6523
  object: object | null,
6163
6524
  ): number;
6164
- // A few things here are inspired by gi.ts
6165
- // See https://gitlab.gnome.org/ewlsh/gi.ts/-/blob/master/packages/lib/src/generators/dts/gobject.ts
6166
- // Copyright Evan Welsh
6167
-
6168
- // __type__ forces all GTypes to not match structurally.
6169
- export type GType<T = unknown> = {
6170
- __type__(arg: never): T;
6171
- name: string;
6172
- };
6173
-
6174
- // Extra interfaces used to help define GObject classes in js; these
6175
- // aren't part of gi.
6176
- export interface SignalDefinition {
6177
- flags?: SignalFlags;
6178
- accumulator: number;
6179
- return_type?: GType;
6180
- param_types?: GType[];
6181
- }
6182
-
6183
- export interface MetaInfo<Props, Interfaces, Sigs> {
6184
- GTypeName?: string;
6185
- GTypeFlags?: TypeFlags;
6186
- Properties?: Props;
6187
- Signals?: Sigs;
6188
- Implements?: Interfaces;
6189
- CssName?: string;
6190
- Template?: Uint8Array | GLib.Bytes | string;
6191
- Children?: string[];
6192
- InternalChildren?: string[];
6193
- }
6194
-
6195
- // Correctly types interface checks.
6196
- export function type_is_a<T extends Object>(obj: Object, is_a_type: { $gtype: GType<T> }): obj is T;
6197
-
6198
- export class Interface<T = unknown> {
6199
- static _classInit: (cls: any) => any;
6200
- __name__: string;
6201
- _construct: (params: any, ...otherArgs: any[]) => any;
6202
- _init: (params: any) => void;
6203
- $gtype?: GType<T>;
6204
- }
6205
-
6206
- /**
6207
- * Use this to signify a function that must be overridden in an
6208
- * implementation of the interface.
6209
- */
6210
- export class NotImplementedError extends Error {
6211
- get name(): 'NotImplementedError';
6212
- }
6213
-
6214
- export const __gtkCssName__: unique symbol;
6215
- export const __gtkTemplate__: unique symbol;
6216
- export const __gtkChildren__: unique symbol;
6217
- export const __gtkInternalChildren__: unique symbol;
6218
-
6219
- // Expose GObject static properties for ES6 classes
6220
-
6221
- export const GTypeName: unique symbol;
6222
- export const requires: unique symbol;
6223
- export const interfaces: unique symbol;
6224
- export const properties: unique symbol;
6225
- export const signals: unique symbol;
6226
-
6227
- export let gtypeNameBasedOnJSPath: boolean;
6228
-
6229
- export let TYPE_BOOLEAN: GType<boolean>;
6230
- export let Boolean: BooleanConstructor;
6231
-
6232
- export let TYPE_ENUM: GType<number>;
6233
- export let TYPE_FLAGS: GType<number>;
6234
-
6235
- export let TYPE_DOUBLE: GType<number>;
6236
- export let Double: NumberConstructor;
6237
-
6238
- export let TYPE_STRING: GType<string>;
6239
- export let String: StringConstructor;
6240
-
6241
- export let TYPE_NONE: GType<undefined>;
6242
- export let TYPE_POINTER: GType<undefined>;
6243
- export let TYPE_BOXED: GType<unknown>;
6244
- export let TYPE_PARAM: GType<unknown>;
6245
- export let TYPE_INTERFACE: GType<unknown>;
6246
- export let TYPE_OBJECT: GType<object>;
6247
- export let TYPE_VARIANT: GType<GLib.Variant>;
6248
- export let TYPE_INT: GType<number>;
6249
- export let TYPE_UINT: GType<number>;
6250
- export let TYPE_INT64: GType<number>;
6251
- export let TYPE_UINT64: GType<number>;
6252
-
6253
- // fake enum for signal accumulators, keep in sync with gi/object.c
6254
- export enum AccumulatorType {
6255
- NONE = 0,
6256
- FIRST_WINS = 1,
6257
- TRUE_HANDLED = 2,
6258
- }
6259
-
6260
- // A simple workaround if you have a class with .connect, .disconnect or .emit
6261
- // methods (such as Gio.Socket.connect or NMClient.Device.disconnect)
6262
- // The original g_signal_* functions are not introspectable anyway, because
6263
- // we need our own handling of signal argument marshalling
6264
- export function signal_connect(object: Object, name: string, handler: (...args: any[]) => any): number;
6265
- export function signal_connect_after(object: Object, name: string, handler: (...args: any[]) => any): number;
6266
- export function signal_emit_by_name(object: Object, name: string, ...args: any[]): void;
6267
-
6268
- /**
6269
- * Finds the first signal handler that matches certain selection criteria.
6270
- * The criteria are passed as properties of a match object.
6271
- * The match object has to be non-empty for successful matches.
6272
- * If no handler was found, a falsy value is returned.
6273
- *
6274
- * @param instance the instance owning the signal handler to be found.
6275
- * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
6276
- * @param match.signalId signal the handler has to be connected to.
6277
- * @param match.detail signal detail the handler has to be connected to.
6278
- * @param match.func the callback function the handler will invoke.
6279
- * @returns A valid non-0 signal handler ID for a successful match.
6280
- */
6281
- export function signal_handler_find(
6282
- instance: Object,
6283
- match: { signalId: string; detail: string; func: (...args: any[]) => any },
6284
- ): number | bigint | object | null;
6285
-
6286
- /**
6287
- * Blocks all handlers on an instance that match certain selection criteria.
6288
- * The criteria are passed as properties of a match object.
6289
- * The match object has to have at least `func` for successful matches.
6290
- * If no handlers were found, 0 is returned, the number of blocked handlers
6291
- * otherwise.
6292
- *
6293
- * @param instance the instance owning the signal handler to be found.
6294
- * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
6295
- * @param match.signalId signal the handler has to be connected to.
6296
- * @param match.detail signal detail the handler has to be connected to.
6297
- * @param match.func the callback function the handler will invoke.
6298
- * @returns The number of handlers that matched.
6299
- */
6300
- export function signal_handlers_block_matched(
6301
- instance: Object,
6302
- match: { signalId: string; detail: string; func: (...args: any[]) => any },
6303
- ): number;
6304
-
6305
- /**
6306
- * Disconnects all handlers on an instance that match certain selection
6307
- * criteria.
6308
- * The criteria are passed as properties of a match object.
6309
- * The match object has to have at least `func` for successful matches.
6310
- * If no handlers were found, 0 is returned, the number of disconnected
6311
- * handlers otherwise.
6312
- *
6313
- * @param instance the instance owning the signal handler
6314
- * to be found.
6315
- * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
6316
- * @param match.signalId signal the handler has to be connected to.
6317
- * @param match.detail signal detail the handler has to be connected to.
6318
- * @param match.func the callback function the handler will invoke.
6319
- * @returns The number of handlers that matched.
6320
- */
6321
- export function signal_handlers_unblock_matched(
6322
- instance: Object,
6323
- match: { signalId: string; detail: string; func: (...args: any[]) => any },
6324
- ): number;
6325
-
6326
- /**
6327
- * Disconnects all handlers on an instance that match certain selection
6328
- * criteria.
6329
- * The criteria are passed as properties of a match object.
6330
- * The match object has to have at least `func` for successful matches.
6331
- * If no handlers were found, 0 is returned, the number of disconnected
6332
- * handlers otherwise.
6333
- *
6334
- * @param instance the instance owning the signal handler
6335
- * to be found.
6336
- * @param match a properties object indicating whether to match by signal ID, detail, or callback function.
6337
- * @param match.signalId signal the handler has to be connected to.
6338
- * @param match.detail signal detail the handler has to be connected to.
6339
- * @param match.func the callback function the handler will invoke.
6340
- * @returns The number of handlers that matched.
6341
- */
6342
- export function signal_handlers_disconnect_matched(
6343
- instance: Object,
6344
- match: { signalId: string; detail: string; func: (...args: any[]) => any },
6345
- ): number;
6346
-
6347
- // Also match the macros used in C APIs, even though they're not introspected
6348
-
6349
- /**
6350
- * Blocks all handlers on an instance that match `func`.
6351
- *
6352
- * @param instance the instance to block handlers from.
6353
- * @param func the callback function the handler will invoke.
6354
- * @returns The number of handlers that matched.
6355
- */
6356
- export function signal_handlers_block_by_func(instance: Object, func: (...args: any[]) => any): number;
6357
-
6358
- /**
6359
- * Unblocks all handlers on an instance that match `func`.
6360
- *
6361
- * @function
6362
- * @param instance the instance to unblock handlers from.
6363
- * @param func the callback function the handler will invoke.
6364
- * @returns The number of handlers that matched.
6365
- */
6366
- export function signal_handlers_unblock_by_func(instance: Object, func: (...args: any[]) => any): number;
6367
-
6368
- /**
6369
- * Disconnects all handlers on an instance that match `func`.
6370
- *
6371
- * @param instance the instance to remove handlers from.
6372
- * @param func the callback function the handler will invoke.
6373
- * @returns The number of handlers that matched.
6374
- */
6375
- export function signal_handlers_disconnect_by_func(instance: Object, func: (...args: any[]) => any): number;
6376
- export function signal_handlers_disconnect_by_data(): void;
6377
-
6378
- export type Property<K extends ParamSpec> = K extends ParamSpec<infer T> ? T : any;
6379
-
6380
- // TODO: What about the generated class Closure
6381
- export type TClosure<R = any, P = any> = (...args: P[]) => R;
6382
-
6383
- type ObjectConstructor = { new (...args: any[]): Object };
6384
-
6385
- export function registerClass<
6386
- T extends ObjectConstructor,
6387
- Props extends { [key: string]: ParamSpec },
6388
- Interfaces extends { $gtype: GType }[],
6389
- Sigs extends {
6390
- [key: string]: {
6391
- param_types?: readonly GType[];
6392
- [key: string]: any;
6393
- };
6394
- },
6395
- >(options: MetaInfo<Props, Interfaces, Sigs>, cls: T): T;
6396
-
6397
- export function registerClass<T extends ObjectConstructor>(cls: T): T;
6398
-
6399
6525
  /**
6400
6526
  * Name of the imported GIR library
6401
6527
  * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
@@ -6409,4 +6535,5 @@ export namespace GObject {
6409
6535
  }
6410
6536
 
6411
6537
  export default GObject;
6538
+
6412
6539
  // END
package/gobject-2.0.js CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
- // @ts-expect-error
3
- import GObject from 'gi://GObject?version=2.0';
4
- export { GObject };
5
- export default GObject;
2
+ // @ts-expect-error
3
+ import GObject from 'gi://GObject?version=2.0';
4
+ export default GObject;
6
5
 
package/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Type Definitions for Gjs (https://gjs.guide/)
3
+ *
4
+ * These type definitions are automatically generated, do not edit them by hand.
5
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
6
+ *
7
+ * This template is used to generate the index.d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
8
+ */
9
+
10
+ import './gobject-2.0-ambient.d.ts';
11
+
12
+ import './gobject-2.0-import.d.ts';
13
+
14
+ import GObject from './gobject-2.0.js';
15
+ export default GObject;
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // @ts-expect-error
3
+ import GObject from './gobject-2.0.js';
4
+ export default GObject;
5
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@girs/gobject-2.0",
3
- "version": "2.80.0-4.0.0-beta.4",
4
- "description": "GJS TypeScript type definitions for GObject-2.0, generated from library version 2.80.0",
3
+ "version": "2.80.2-4.0.0-beta.7",
4
+ "description": "GJS TypeScript type definitions for GObject-2.0, generated from library version 2.80.2",
5
5
  "type": "module",
6
6
  "module": "gobject-2.0.js",
7
7
  "main": "gobject-2.0.js",
@@ -16,18 +16,23 @@
16
16
  "import": "./gobject-2.0-import.js",
17
17
  "default": "./gobject-2.0-import.js"
18
18
  },
19
- ".": {
19
+ "./gobject-2.0": {
20
20
  "types": "./gobject-2.0.d.ts",
21
21
  "import": "./gobject-2.0.js",
22
22
  "default": "./gobject-2.0.js"
23
+ },
24
+ ".": {
25
+ "types": "./index.d.ts",
26
+ "import": "./index.js",
27
+ "default": "./index.js"
23
28
  }
24
29
  },
25
30
  "scripts": {
26
- "test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gobject-2.0.d.ts"
31
+ "test": "tsc --project tsconfig.json"
27
32
  },
28
33
  "dependencies": {
29
- "@girs/gjs": "^4.0.0-beta.4",
30
- "@girs/glib-2.0": "^2.80.0-4.0.0-beta.4"
34
+ "@girs/gjs": "^4.0.0-beta.7",
35
+ "@girs/glib-2.0": "^2.80.2-4.0.0-beta.7"
31
36
  },
32
37
  "devDependencies": {
33
38
  "typescript": "*"
package/tsconfig.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "compilerOptions": {
3
3
  // General settings for code interpretation
4
4
  "target": "ESNext",
5
- "module": "ESNext",
5
+ "module": "NodeNext",
6
6
  "lib": ["ESNext"],
7
7
  "types": [],
8
8
  "experimentalDecorators": true,
9
- "moduleResolution": "node",
9
+ "moduleResolution": "NodeNext",
10
10
  "noEmit": true,
11
11
  "noEmitOnError": false,
12
12
  "baseUrl": "./",