@girs/gm-0 0.0.0-4.0.0-beta.16

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 ADDED
@@ -0,0 +1,86 @@
1
+
2
+ # Gm-0
3
+
4
+ ![version](https://img.shields.io/npm/v/@girs/gm-0)
5
+ ![downloads/week](https://img.shields.io/npm/dw/@girs/gm-0)
6
+
7
+
8
+ GJS TypeScript type definitions for Gm-0, generated from library version 0.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.16.
9
+
10
+
11
+ ## Install
12
+
13
+ To use this type definitions, install them with NPM:
14
+ ```bash
15
+ npm install @girs/gm-0
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ You can import this package into your project like this:
21
+ ```ts
22
+ import Gm from '@girs/gm-0';
23
+ ```
24
+
25
+ ### Ambient Modules
26
+
27
+ You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
28
+ For this you need to include `@girs/gm-0` or `@girs/gm-0/ambient` in your `tsconfig` or entry point Typescript file:
29
+
30
+ `index.ts`:
31
+ ```ts
32
+ import '@girs/gm-0'
33
+ ```
34
+
35
+ `tsconfig.json`:
36
+ ```json
37
+ {
38
+ "compilerOptions": {
39
+ ...
40
+ },
41
+ "include": ["@girs/gm-0"],
42
+ ...
43
+ }
44
+ ```
45
+
46
+ Now you can import the ambient module with TypeScript support:
47
+
48
+ ```ts
49
+ import Gm from 'gi://Gm?version=0';
50
+ ```
51
+
52
+ ### Global import
53
+
54
+ You can also import the module with Typescript support using the global `imports.gi` object of GJS.
55
+ For this you need to include `@girs/gm-0` or `@girs/gm-0/import` in your `tsconfig` or entry point Typescript file:
56
+
57
+ `index.ts`:
58
+ ```ts
59
+ import '@girs/gm-0'
60
+ ```
61
+
62
+ `tsconfig.json`:
63
+ ```json
64
+ {
65
+ "compilerOptions": {
66
+ ...
67
+ },
68
+ "include": ["@girs/gm-0"],
69
+ ...
70
+ }
71
+ ```
72
+
73
+ Now you have also type support for this, too:
74
+
75
+ ```ts
76
+ const Gm = imports.gi.Gm;
77
+ ```
78
+
79
+ ### Bundle
80
+
81
+ Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
82
+
83
+ ## Other packages
84
+
85
+ All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
86
+
@@ -0,0 +1,9 @@
1
+ declare module 'gi://Gm?version=0' {
2
+ import Gm0 from '@girs/gm-0';
3
+ export default Gm0;
4
+ }
5
+
6
+ declare module 'gi://Gm' {
7
+ import Gm0 from 'gi://Gm?version=0';
8
+ export default Gm0;
9
+ }
@@ -0,0 +1,2 @@
1
+ export {}
2
+
@@ -0,0 +1,9 @@
1
+ import Gm0 from '@girs/gm-0';
2
+
3
+ declare global {
4
+ export interface GjsGiImports {
5
+ Gm: typeof Gm0;
6
+ }
7
+ }
8
+
9
+ export default GjsGiImports;
package/gm-0-import.js ADDED
@@ -0,0 +1,3 @@
1
+ const gi = globalThis.imports?.gi || {};
2
+ export default gi;
3
+
package/gm-0.d.ts ADDED
@@ -0,0 +1,388 @@
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
+ * The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
8
+ */
9
+
10
+ // Module dependencies
11
+ import type Gio from '@girs/gio-2.0';
12
+ import type GObject from '@girs/gobject-2.0';
13
+ import type GLib from '@girs/glib-2.0';
14
+ import type GModule from '@girs/gmodule-2.0';
15
+
16
+ export namespace Gm {
17
+ /**
18
+ * Gm-0
19
+ */
20
+
21
+ /**
22
+ * Error codes returned by gmobile functions.
23
+ */
24
+ class Error extends GLib.Error {
25
+ static $gtype: GObject.GType<Error>;
26
+
27
+ // Static fields
28
+
29
+ /**
30
+ * Parsing of the given data failed.
31
+ */
32
+ static ERROR_PARSING_FAILED: number;
33
+
34
+ // Constructors
35
+
36
+ constructor(options: { message: string; code: number });
37
+ _init(...args: any[]): void;
38
+ }
39
+
40
+ /**
41
+ * Read compatible machine types from
42
+ * `sysfs_root/firmware/devicetree/base/compatible` on Linux.
43
+ * If the path doesn't exist or host is not Linux return %NULL.
44
+ *
45
+ * For debugging purposes `GMOBILE_DT_COMPATIBLES` can be set to a `:`
46
+ * separated list of compatibles which will be returned instead.
47
+ * @param sysfs_root Path where /sys is mounted. Defaults to `/sys` if %NULL is passed.
48
+ * @returns compatible machine types or %NULL
49
+ */
50
+ function device_tree_get_compatibles(sysfs_root: string): string[];
51
+ /**
52
+ * Gets the GM Error Quark.
53
+ * @returns a #GQuark.
54
+ */
55
+ function error_quark(): GLib.Quark;
56
+ /**
57
+ * Call this function to initialize the library explicitly. This makes
58
+ * the embedded device information available.
59
+ */
60
+ function init(): void;
61
+ /**
62
+ * Returns the bounding box of an SVG path. As this is meant for
63
+ * display cutouts we operate on integer (whole pixel) values. When
64
+ * parsing fails, `FALSE` is returned and `error` contains the error
65
+ * information.
66
+ * @param path An SVG path
67
+ * @param x1 The lower x coordinate
68
+ * @param x2 The upper x coordinate
69
+ * @param y1 The lower y coordinate
70
+ * @param y2 The upper x coordinate
71
+ * @returns `TRUE` when parsing was successful, `FALSE` otherwise. See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths for path syntax introduction.
72
+ */
73
+ function svg_path_get_bounding_box(path: string, x1: number, x2: number, y1: number, y2: number): boolean;
74
+ /**
75
+ * Sets a function to be called after a timeout with priority `priority`.
76
+ * Correctly calculates the timeout even when the system is suspended in between.
77
+ *
78
+ * This internally creates a main loop source using
79
+ * g_timeout_source_new_seconds() and attaches it to the main loop context
80
+ * using g_source_attach().
81
+ *
82
+ * The timeout given is in terms of `CLOCK_BOOTTIME` time, it hence is also
83
+ * correct across suspend and resume. If that doesn't matter use
84
+ * `g_timeout_add_seconds_full` instead.
85
+ *
86
+ * Note that glib's `g_timeout_add_seconds()` doesn't take system
87
+ * suspend/resume into account: https://gitlab.gnome.org/GNOME/glib/-/issues/2739
88
+ * @param priority the priority of the timeout source. Typically this will be in the range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
89
+ * @param seconds the timeout in seconds
90
+ * @param _function function to call
91
+ * @param notify function to call when the timeout is removed, or %NULL
92
+ * @returns the ID (greater than 0) of the event source.
93
+ */
94
+ function timeout_add_seconds_once(
95
+ priority: number,
96
+ seconds: number,
97
+ _function: GLib.SourceOnceFunc,
98
+ notify?: GLib.DestroyNotify | null,
99
+ ): number;
100
+ module Cutout {
101
+ // Constructor properties interface
102
+
103
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
104
+ bounds: Rect;
105
+ name: string;
106
+ path: string;
107
+ }
108
+ }
109
+
110
+ /**
111
+ * A display cutout or notch.
112
+ *
113
+ * A display cutout is an area of a display that is not usable for
114
+ * rendering e.g. because a camera or speaker is placed there. This
115
+ * includes so called "notches". The are needs to be avoided when
116
+ * rendering. It is described by a SVG path. Each cutouts coordinate
117
+ * systems is located at the top left display corner in the displays
118
+ * natural orientation. Applications can query the area to avoid
119
+ * for rendering via the `bounds` property so they don't need to
120
+ * deal with the SVG path themselves.
121
+ */
122
+ class Cutout extends GObject.Object {
123
+ static $gtype: GObject.GType<Cutout>;
124
+
125
+ // Properties
126
+
127
+ /**
128
+ * Rectangular bounds of the cutout
129
+ */
130
+ get bounds(): Rect;
131
+ /**
132
+ * A name identifying the cutout.
133
+ */
134
+ get name(): string;
135
+ /**
136
+ * The SVG path that describes the display cutout or notch.
137
+ */
138
+ get path(): string;
139
+
140
+ // Constructors
141
+
142
+ constructor(properties?: Partial<Cutout.ConstructorProps>, ...args: any[]);
143
+
144
+ _init(...args: any[]): void;
145
+
146
+ static ['new'](path: string): Cutout;
147
+
148
+ // Methods
149
+
150
+ /**
151
+ * Gets the bounding box of the cutout.
152
+ * @returns The bounding box.
153
+ */
154
+ get_bounds(): Rect;
155
+ /**
156
+ * The name of the cutout.
157
+ * @returns The cutout's name.
158
+ */
159
+ get_name(): string;
160
+ /**
161
+ * Gets the SVG path describing the shape of the cutout.
162
+ * @returns The cutout's shape as SVG path
163
+ */
164
+ get_path(): string;
165
+ }
166
+
167
+ module DeviceInfo {
168
+ // Constructor properties interface
169
+
170
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
171
+ compatibles: string[];
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Get device dependent information.
177
+ *
178
+ * Allows to query device dependent information from different
179
+ * sources (currently we only look a the built-in gresources).
180
+ *
181
+ * The lookups are currently based on device tree compatibles.
182
+ * See [func`device_tree_get_compatibles]`.
183
+ */
184
+ class DeviceInfo extends GObject.Object {
185
+ static $gtype: GObject.GType<DeviceInfo>;
186
+
187
+ // Properties
188
+
189
+ /**
190
+ * The compatibles to look up device information for.
191
+ */
192
+ get compatibles(): string[];
193
+
194
+ // Constructors
195
+
196
+ constructor(properties?: Partial<DeviceInfo.ConstructorProps>, ...args: any[]);
197
+
198
+ _init(...args: any[]): void;
199
+
200
+ static ['new'](compatibles: string): DeviceInfo;
201
+
202
+ // Methods
203
+
204
+ /**
205
+ * Gets display panel information. Queries the database for the best
206
+ * matching panel based on the device's compatibles.
207
+ * @returns The display panel information
208
+ */
209
+ get_display_panel(): DisplayPanel;
210
+ }
211
+
212
+ module DisplayPanel {
213
+ // Constructor properties interface
214
+
215
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
216
+ border_radius: number;
217
+ borderRadius: number;
218
+ cutouts: Gio.ListStore;
219
+ height: number;
220
+ name: string;
221
+ width: number;
222
+ x_res: number;
223
+ xRes: number;
224
+ y_res: number;
225
+ yRes: number;
226
+ }
227
+ }
228
+
229
+ /**
230
+ * Physical properties of a display panel like size, cutouts and
231
+ * rounded corners.
232
+ */
233
+ class DisplayPanel extends GObject.Object {
234
+ static $gtype: GObject.GType<DisplayPanel>;
235
+
236
+ // Properties
237
+
238
+ /**
239
+ * The border radius of the panel edges in device pixels
240
+ * If a single border radius isn't enough use multiple [type`Cutout]`.
241
+ */
242
+ get border_radius(): number;
243
+ set border_radius(val: number);
244
+ /**
245
+ * The border radius of the panel edges in device pixels
246
+ * If a single border radius isn't enough use multiple [type`Cutout]`.
247
+ */
248
+ get borderRadius(): number;
249
+ set borderRadius(val: number);
250
+ /**
251
+ * The display cutouts as `GListModel` of [class`Cutout]`.
252
+ */
253
+ get cutouts(): Gio.ListStore;
254
+ set cutouts(val: Gio.ListStore);
255
+ /**
256
+ * The display height in millimeters
257
+ */
258
+ get height(): number;
259
+ set height(val: number);
260
+ /**
261
+ * The name of the display
262
+ */
263
+ get name(): string;
264
+ set name(val: string);
265
+ /**
266
+ * The display width in millimeters
267
+ */
268
+ get width(): number;
269
+ set width(val: number);
270
+ /**
271
+ * The panel resolution in pixels in the x direction
272
+ */
273
+ get x_res(): number;
274
+ set x_res(val: number);
275
+ /**
276
+ * The panel resolution in pixels in the x direction
277
+ */
278
+ get xRes(): number;
279
+ set xRes(val: number);
280
+ /**
281
+ * The panel resolution in pixels in the y direction
282
+ */
283
+ get y_res(): number;
284
+ set y_res(val: number);
285
+ /**
286
+ * The panel resolution in pixels in the y direction
287
+ */
288
+ get yRes(): number;
289
+ set yRes(val: number);
290
+
291
+ // Constructors
292
+
293
+ constructor(properties?: Partial<DisplayPanel.ConstructorProps>, ...args: any[]);
294
+
295
+ _init(...args: any[]): void;
296
+
297
+ static ['new'](): DisplayPanel;
298
+
299
+ static new_from_data(data: string): DisplayPanel;
300
+
301
+ static new_from_resource(resource_name: string): DisplayPanel;
302
+
303
+ // Methods
304
+
305
+ /**
306
+ * Gets the panels border radius. 0 indicates rectangular corners. If
307
+ * given applies to all corners of the panel.
308
+ * @returns The panel's border radius.
309
+ */
310
+ get_border_radius(): number;
311
+ /**
312
+ * Get the display cutouts.
313
+ * @returns The display cutouts
314
+ */
315
+ get_cutouts(): Gio.ListModel;
316
+ /**
317
+ * Gets the panels height in mm.
318
+ * @returns The panel's height.
319
+ */
320
+ get_height(): number;
321
+ /**
322
+ * Gets the panel's name.
323
+ * @returns The panel's name
324
+ */
325
+ get_name(): string;
326
+ /**
327
+ * Gets the panels width in mm.
328
+ * @returns The panel's width.
329
+ */
330
+ get_width(): number;
331
+ /**
332
+ * Gets the panels resolution (in pixels) in the x direction
333
+ * @returns The x resolution.
334
+ */
335
+ get_x_res(): number;
336
+ /**
337
+ * Gets the panels resolution (in pixels) in the y direction.
338
+ * @returns The y resolution.
339
+ */
340
+ get_y_res(): number;
341
+ }
342
+
343
+ type CutoutClass = typeof Cutout;
344
+ type DeviceInfoClass = typeof DeviceInfo;
345
+ type DisplayPanelClass = typeof DisplayPanel;
346
+ /**
347
+ * A rectangle.
348
+ *
349
+ * Similar to GdkRectangle but we don't want to pull in gtk/gdk.
350
+ */
351
+ class Rect {
352
+ static $gtype: GObject.GType<Rect>;
353
+
354
+ // Fields
355
+
356
+ x: number;
357
+ y: number;
358
+ width: number;
359
+ height: number;
360
+
361
+ // Constructors
362
+
363
+ constructor(
364
+ properties?: Partial<{
365
+ x: number;
366
+ y: number;
367
+ width: number;
368
+ height: number;
369
+ }>,
370
+ );
371
+ _init(...args: any[]): void;
372
+ }
373
+
374
+ /**
375
+ * Name of the imported GIR library
376
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
377
+ */
378
+ const __name__: string;
379
+ /**
380
+ * Version of the imported GIR library
381
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
382
+ */
383
+ const __version__: string;
384
+ }
385
+
386
+ export default Gm;
387
+
388
+ // END
package/gm-0.js ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // @ts-expect-error
3
+ import Gm from 'gi://Gm?version=0';
4
+ export default Gm;
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 './gm-0-ambient.d.ts';
11
+
12
+ import './gm-0-import.d.ts';
13
+
14
+ import Gm from './gm-0.js';
15
+ export default Gm;
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // @ts-expect-error
3
+ import Gm from './gm-0.js';
4
+ export default Gm;
5
+
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@girs/gm-0",
3
+ "version": "0.0.0-4.0.0-beta.16",
4
+ "description": "GJS TypeScript type definitions for Gm-0, generated from library version 0.0.0",
5
+ "type": "module",
6
+ "module": "gm-0.js",
7
+ "main": "gm-0.js",
8
+ "exports": {
9
+ "./ambient": {
10
+ "types": "./gm-0-ambient.d.ts",
11
+ "import": "./gm-0-ambient.js",
12
+ "default": "./gm-0-ambient.js"
13
+ },
14
+ "./import": {
15
+ "types": "./gm-0-import.d.ts",
16
+ "import": "./gm-0-import.js",
17
+ "default": "./gm-0-import.js"
18
+ },
19
+ "./gm-0": {
20
+ "types": "./gm-0.d.ts",
21
+ "import": "./gm-0.js",
22
+ "default": "./gm-0.js"
23
+ },
24
+ ".": {
25
+ "types": "./index.d.ts",
26
+ "import": "./index.js",
27
+ "default": "./index.js"
28
+ }
29
+ },
30
+ "scripts": {
31
+ "test": "tsc --project tsconfig.json"
32
+ },
33
+ "dependencies": {
34
+ "@girs/gio-2.0": "^2.82.0-4.0.0-beta.16",
35
+ "@girs/gjs": "^4.0.0-beta.16",
36
+ "@girs/glib-2.0": "^2.82.0-4.0.0-beta.16",
37
+ "@girs/gmodule-2.0": "^2.0.0-4.0.0-beta.16",
38
+ "@girs/gobject-2.0": "^2.82.0-4.0.0-beta.16"
39
+ },
40
+ "devDependencies": {
41
+ "typescript": "*"
42
+ },
43
+ "keywords": [
44
+ "Gir",
45
+ "TypeScript",
46
+ "types",
47
+ "GObject-Introspection",
48
+ "GJS",
49
+ "Gm-0"
50
+ ],
51
+ "author": "ts-for-gir",
52
+ "license": "MIT",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/gjsify/ts-for-gir.git"
56
+ },
57
+ "bugs": {
58
+ "url": "https://github.com/gjsify/ts-for-gir/issues"
59
+ },
60
+ "homepage": "https://github.com/gjsify/types/tree/main/gm-0#readme"
61
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ // General settings for code interpretation
4
+ "target": "ESNext",
5
+ "module": "NodeNext",
6
+ "lib": ["ESNext"],
7
+ "types": [],
8
+ "experimentalDecorators": true,
9
+ "moduleResolution": "NodeNext",
10
+ "noEmit": true,
11
+ "noEmitOnError": false,
12
+ "baseUrl": "./",
13
+ "rootDir": ".",
14
+ // General settings for code generation
15
+ "removeComments": false,
16
+ "inlineSourceMap": false,
17
+ "inlineSources": false,
18
+ "newLine": "LF"
19
+ },
20
+ "include": ["./gm-0.d.ts"]
21
+ }
22
+
23
+
package/typedoc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "entryPoints": ["./gm-0.d.ts"],
3
+ "readme": "./README.md",
4
+ "name": "Gm-0",
5
+ "tsconfig": "./tsconfig.json"
6
+ }
7
+