@girs/gly-1 1.0.0-4.0.0-beta.37
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 +85 -0
- package/gly-1-ambient.d.ts +9 -0
- package/gly-1-ambient.js +2 -0
- package/gly-1-import.d.ts +1 -0
- package/gly-1-import.js +3 -0
- package/gly-1.d.ts +562 -0
- package/gly-1.js +5 -0
- package/index.d.ts +13 -0
- package/index.js +5 -0
- package/package.json +62 -0
- package/tsconfig.json +25 -0
- package/typedoc.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
# Gly-1
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
GJS TypeScript type definitions for Gly-1, generated from library version 1.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.37.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
To use this type definitions, install them with NPM:
|
|
13
|
+
```bash
|
|
14
|
+
npm install @girs/gly-1
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
You can import this package into your project like this:
|
|
20
|
+
```ts
|
|
21
|
+
import Gly from '@girs/gly-1';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Ambient Modules
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
For this you need to include `@girs/gly-1` or `@girs/gly-1/ambient` in your `tsconfig` or entry point Typescript file:
|
|
28
|
+
|
|
29
|
+
`index.ts`:
|
|
30
|
+
```ts
|
|
31
|
+
import '@girs/gly-1'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`tsconfig.json`:
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"compilerOptions": {
|
|
38
|
+
...
|
|
39
|
+
},
|
|
40
|
+
"include": ["@girs/gly-1"],
|
|
41
|
+
...
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Now you can import the ambient module with TypeScript support:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import Gly from 'gi://Gly?version=1';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Global import
|
|
52
|
+
|
|
53
|
+
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
54
|
+
For this you need to include `@girs/gly-1` or `@girs/gly-1/import` in your `tsconfig` or entry point Typescript file:
|
|
55
|
+
|
|
56
|
+
`index.ts`:
|
|
57
|
+
```ts
|
|
58
|
+
import '@girs/gly-1'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`tsconfig.json`:
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"compilerOptions": {
|
|
65
|
+
...
|
|
66
|
+
},
|
|
67
|
+
"include": ["@girs/gly-1"],
|
|
68
|
+
...
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Now you have also type support for this, too:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const Gly = imports.gi.Gly;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Bundle
|
|
79
|
+
|
|
80
|
+
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).
|
|
81
|
+
|
|
82
|
+
## Other packages
|
|
83
|
+
|
|
84
|
+
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
85
|
+
|
package/gly-1-ambient.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Module import type definition not generated, otherwise this would cause a type conflict, this is because several GIR modules were generated with the same namespace: "Gly"
|
package/gly-1-import.js
ADDED
package/gly-1.d.ts
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
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
|
+
import '@girs/gjs';
|
|
11
|
+
|
|
12
|
+
// Module dependencies
|
|
13
|
+
import type Gio from '@girs/gio-2.0';
|
|
14
|
+
import type GObject from '@girs/gobject-2.0';
|
|
15
|
+
import type GLib from '@girs/glib-2.0';
|
|
16
|
+
import type GModule from '@girs/gmodule-2.0';
|
|
17
|
+
import type Gdk from '@girs/gdk-4.0';
|
|
18
|
+
import type cairo from 'cairo';
|
|
19
|
+
import type PangoCairo from '@girs/pangocairo-1.0';
|
|
20
|
+
import type Pango from '@girs/pango-1.0';
|
|
21
|
+
import type HarfBuzz from '@girs/harfbuzz-0.0';
|
|
22
|
+
import type freetype2 from '@girs/freetype2-2.0';
|
|
23
|
+
import type GdkPixbuf from '@girs/gdkpixbuf-2.0';
|
|
24
|
+
|
|
25
|
+
export namespace Gly {
|
|
26
|
+
/**
|
|
27
|
+
* Gly-1
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Errors that can appear while loading images.
|
|
32
|
+
*/
|
|
33
|
+
class LoaderError extends GLib.Error {
|
|
34
|
+
static $gtype: GObject.GType<LoaderError>;
|
|
35
|
+
|
|
36
|
+
// Static fields
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Generic type for all other errors.
|
|
40
|
+
*/
|
|
41
|
+
static FAILED: number;
|
|
42
|
+
/**
|
|
43
|
+
* Unknown image format.
|
|
44
|
+
*/
|
|
45
|
+
static UNKNOWN_IMAGE_FORMAT: number;
|
|
46
|
+
|
|
47
|
+
// Constructors
|
|
48
|
+
|
|
49
|
+
constructor(options: { message: string; code: number });
|
|
50
|
+
_init(...args: any[]): void;
|
|
51
|
+
|
|
52
|
+
// Static methods
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Error quark for [error`GlyLoaderError]`
|
|
56
|
+
*/
|
|
57
|
+
static quark(): GLib.Quark;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Memory format
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Memory format
|
|
66
|
+
*/
|
|
67
|
+
export namespace MemoryFormat {
|
|
68
|
+
export const $gtype: GObject.GType<MemoryFormat>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
enum MemoryFormat {
|
|
72
|
+
/**
|
|
73
|
+
* 8-bit RGRA premultiplied
|
|
74
|
+
*/
|
|
75
|
+
B8G8R8A8_PREMULTIPLIED,
|
|
76
|
+
/**
|
|
77
|
+
* 8-bit ARGB premultiplied
|
|
78
|
+
*/
|
|
79
|
+
A8R8G8B8_PREMULTIPLIED,
|
|
80
|
+
/**
|
|
81
|
+
* 8-bit RGBA premultiplied
|
|
82
|
+
*/
|
|
83
|
+
R8G8B8A8_PREMULTIPLIED,
|
|
84
|
+
/**
|
|
85
|
+
* 8-bit RGBA
|
|
86
|
+
*/
|
|
87
|
+
B8G8R8A8,
|
|
88
|
+
/**
|
|
89
|
+
* 8-bit AGBR
|
|
90
|
+
*/
|
|
91
|
+
A8R8G8B8,
|
|
92
|
+
/**
|
|
93
|
+
* 8-bit RGBA
|
|
94
|
+
*/
|
|
95
|
+
R8G8B8A8,
|
|
96
|
+
/**
|
|
97
|
+
* 8-bit ABGR
|
|
98
|
+
*/
|
|
99
|
+
A8B8G8R8,
|
|
100
|
+
/**
|
|
101
|
+
* 8-bit RGB
|
|
102
|
+
*/
|
|
103
|
+
R8G8B8,
|
|
104
|
+
/**
|
|
105
|
+
* 8-bit BGR
|
|
106
|
+
*/
|
|
107
|
+
B8G8R8,
|
|
108
|
+
/**
|
|
109
|
+
* 16-bit RGB
|
|
110
|
+
*/
|
|
111
|
+
R16G16B16,
|
|
112
|
+
/**
|
|
113
|
+
* 16-bit RGBA premultiplied
|
|
114
|
+
*/
|
|
115
|
+
R16G16B16A16_PREMULTIPLIED,
|
|
116
|
+
/**
|
|
117
|
+
* 16-bit RGBA
|
|
118
|
+
*/
|
|
119
|
+
R16G16B16A16,
|
|
120
|
+
/**
|
|
121
|
+
* 16-bit float RGB
|
|
122
|
+
*/
|
|
123
|
+
R16G16B16_FLOAT,
|
|
124
|
+
/**
|
|
125
|
+
* 16-bit float RGBA
|
|
126
|
+
*/
|
|
127
|
+
R16G16B16A16_FLOAT,
|
|
128
|
+
/**
|
|
129
|
+
* 32-bit float RGB
|
|
130
|
+
*/
|
|
131
|
+
R32G32B32_FLOAT,
|
|
132
|
+
/**
|
|
133
|
+
* 32-bit float RGBA premultiplied
|
|
134
|
+
*/
|
|
135
|
+
R32G32B32A32_FLOAT_PREMULTIPLIED,
|
|
136
|
+
/**
|
|
137
|
+
* 16-bit float RGBA
|
|
138
|
+
*/
|
|
139
|
+
R32G32B32A32_FLOAT,
|
|
140
|
+
/**
|
|
141
|
+
* 8-bit gray with alpha premultiplied
|
|
142
|
+
*/
|
|
143
|
+
G8A8_PREMULTIPLIED,
|
|
144
|
+
/**
|
|
145
|
+
* 8-bit gray with alpha
|
|
146
|
+
*/
|
|
147
|
+
G8A8,
|
|
148
|
+
/**
|
|
149
|
+
* 8-bit gray
|
|
150
|
+
*/
|
|
151
|
+
G8,
|
|
152
|
+
/**
|
|
153
|
+
* 16-bit gray with alpha premultiplied
|
|
154
|
+
*/
|
|
155
|
+
G16A16_PREMULTIPLIED,
|
|
156
|
+
/**
|
|
157
|
+
* 16-bit gray with alpha
|
|
158
|
+
*/
|
|
159
|
+
G16A16,
|
|
160
|
+
/**
|
|
161
|
+
* 16-bit gray
|
|
162
|
+
*/
|
|
163
|
+
G16,
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Sandbox mechanisms
|
|
167
|
+
*
|
|
168
|
+
* ::: warning
|
|
169
|
+
* Using `GLY_SANDBOX_SELECTOR_NOT_SANDBOXED` will disable an important security layer that sandboxes loaders. It is only intended for testing and development purposes.
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Sandbox mechanisms
|
|
174
|
+
*
|
|
175
|
+
* ::: warning
|
|
176
|
+
* Using `GLY_SANDBOX_SELECTOR_NOT_SANDBOXED` will disable an important security layer that sandboxes loaders. It is only intended for testing and development purposes.
|
|
177
|
+
*/
|
|
178
|
+
export namespace SandboxSelector {
|
|
179
|
+
export const $gtype: GObject.GType<SandboxSelector>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
enum SandboxSelector {
|
|
183
|
+
/**
|
|
184
|
+
* This mode selects `bwrap` outside of Flatpaks and usually
|
|
185
|
+
* `flatpak-spawn` inside of Flatpaks. The sandbox is disabled
|
|
186
|
+
* automatically inside of Flatpak development environments.
|
|
187
|
+
* Inside of Flatpaks, `flatpak-spawn` is used to create the sandbox. This
|
|
188
|
+
* mechanism starts an installed Flatpak with the same app id. For
|
|
189
|
+
* development, Flatpak are usually not installed and the sandbox can
|
|
190
|
+
* therefore not be used. If the sandbox has been started via
|
|
191
|
+
* `flatpak-builder --run` (i.e. without installed Flatpak) and the app id
|
|
192
|
+
* ends with `.Devel`, the sandbox is disabled.
|
|
193
|
+
*/
|
|
194
|
+
AUTO,
|
|
195
|
+
/**
|
|
196
|
+
* bwrap
|
|
197
|
+
*/
|
|
198
|
+
BWRAP,
|
|
199
|
+
/**
|
|
200
|
+
* flatpak-spawn
|
|
201
|
+
*/
|
|
202
|
+
FLATPAK_SPAWN,
|
|
203
|
+
/**
|
|
204
|
+
* Disable sandbox. Unsafe, only use for testing and development.
|
|
205
|
+
*/
|
|
206
|
+
NOT_SANDBOXED,
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Error quark for [error`GlyLoaderError]`
|
|
210
|
+
* @returns The error domain
|
|
211
|
+
*/
|
|
212
|
+
function loader_error_quark(): GLib.Quark;
|
|
213
|
+
/**
|
|
214
|
+
* Whether a memory format has an alpha channel
|
|
215
|
+
* @param memory_format
|
|
216
|
+
* @returns Returns `TRUE` if the memory format has an alpha channel
|
|
217
|
+
*/
|
|
218
|
+
function memory_format_has_alpha(memory_format: MemoryFormat | null): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Whether a memory format as an alpha channel an the color values are
|
|
221
|
+
* premultiplied with the alpha value
|
|
222
|
+
* @param memory_format
|
|
223
|
+
* @returns Returns `TRUE` if color channels are premultiplied
|
|
224
|
+
*/
|
|
225
|
+
function memory_format_is_premultiplied(memory_format: MemoryFormat | null): boolean;
|
|
226
|
+
namespace Frame {
|
|
227
|
+
// Signal signatures
|
|
228
|
+
interface SignalSignatures extends GObject.Object.SignalSignatures {}
|
|
229
|
+
|
|
230
|
+
// Constructor properties interface
|
|
231
|
+
|
|
232
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* A frame of an image often being the complete image.
|
|
237
|
+
*/
|
|
238
|
+
class Frame extends GObject.Object {
|
|
239
|
+
static $gtype: GObject.GType<Frame>;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Compile-time signal type information.
|
|
243
|
+
*
|
|
244
|
+
* This instance property is generated only for TypeScript type checking.
|
|
245
|
+
* It is not defined at runtime and should not be accessed in JS code.
|
|
246
|
+
* @internal
|
|
247
|
+
*/
|
|
248
|
+
$signals: Frame.SignalSignatures;
|
|
249
|
+
|
|
250
|
+
// Constructors
|
|
251
|
+
|
|
252
|
+
constructor(properties?: Partial<Frame.ConstructorProps>, ...args: any[]);
|
|
253
|
+
|
|
254
|
+
_init(...args: any[]): void;
|
|
255
|
+
|
|
256
|
+
// Signals
|
|
257
|
+
|
|
258
|
+
connect<K extends keyof Frame.SignalSignatures>(
|
|
259
|
+
signal: K,
|
|
260
|
+
callback: GObject.SignalCallback<this, Frame.SignalSignatures[K]>,
|
|
261
|
+
): number;
|
|
262
|
+
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
263
|
+
connect_after<K extends keyof Frame.SignalSignatures>(
|
|
264
|
+
signal: K,
|
|
265
|
+
callback: GObject.SignalCallback<this, Frame.SignalSignatures[K]>,
|
|
266
|
+
): number;
|
|
267
|
+
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
268
|
+
emit<K extends keyof Frame.SignalSignatures>(
|
|
269
|
+
signal: K,
|
|
270
|
+
...args: GObject.GjsParameters<Frame.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
|
|
271
|
+
): void;
|
|
272
|
+
emit(signal: string, ...args: any[]): void;
|
|
273
|
+
|
|
274
|
+
// Methods
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Image data arranged according to [method`Frame`.get_memory_format]
|
|
278
|
+
* @returns Image data
|
|
279
|
+
*/
|
|
280
|
+
get_buf_bytes(): GLib.Bytes;
|
|
281
|
+
/**
|
|
282
|
+
* Duration to show frame for animations.
|
|
283
|
+
*
|
|
284
|
+
* If the value is zero, the image is not animated.
|
|
285
|
+
* @returns Duration in microseconds.
|
|
286
|
+
*/
|
|
287
|
+
get_delay(): number;
|
|
288
|
+
/**
|
|
289
|
+
* Height for image data in pixels
|
|
290
|
+
* @returns Height in pixels
|
|
291
|
+
*/
|
|
292
|
+
get_height(): number;
|
|
293
|
+
/**
|
|
294
|
+
* Format of the image data in [method`Gly`.Frame.get_buf_bytes]
|
|
295
|
+
* @returns Format of image data
|
|
296
|
+
*/
|
|
297
|
+
get_memory_format(): MemoryFormat;
|
|
298
|
+
/**
|
|
299
|
+
* Width of a row for image data in bytes
|
|
300
|
+
* @returns Row stride in bytes
|
|
301
|
+
*/
|
|
302
|
+
get_stride(): number;
|
|
303
|
+
/**
|
|
304
|
+
* Width for image data in pixels
|
|
305
|
+
* @returns Width in pixels
|
|
306
|
+
*/
|
|
307
|
+
get_width(): number;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
namespace Image {
|
|
311
|
+
// Signal signatures
|
|
312
|
+
interface SignalSignatures extends GObject.Object.SignalSignatures {}
|
|
313
|
+
|
|
314
|
+
// Constructor properties interface
|
|
315
|
+
|
|
316
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Image handle containing metadata and allowing frame requests.
|
|
321
|
+
*/
|
|
322
|
+
class Image extends GObject.Object {
|
|
323
|
+
static $gtype: GObject.GType<Image>;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Compile-time signal type information.
|
|
327
|
+
*
|
|
328
|
+
* This instance property is generated only for TypeScript type checking.
|
|
329
|
+
* It is not defined at runtime and should not be accessed in JS code.
|
|
330
|
+
* @internal
|
|
331
|
+
*/
|
|
332
|
+
$signals: Image.SignalSignatures;
|
|
333
|
+
|
|
334
|
+
// Constructors
|
|
335
|
+
|
|
336
|
+
constructor(properties?: Partial<Image.ConstructorProps>, ...args: any[]);
|
|
337
|
+
|
|
338
|
+
_init(...args: any[]): void;
|
|
339
|
+
|
|
340
|
+
// Signals
|
|
341
|
+
|
|
342
|
+
connect<K extends keyof Image.SignalSignatures>(
|
|
343
|
+
signal: K,
|
|
344
|
+
callback: GObject.SignalCallback<this, Image.SignalSignatures[K]>,
|
|
345
|
+
): number;
|
|
346
|
+
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
347
|
+
connect_after<K extends keyof Image.SignalSignatures>(
|
|
348
|
+
signal: K,
|
|
349
|
+
callback: GObject.SignalCallback<this, Image.SignalSignatures[K]>,
|
|
350
|
+
): number;
|
|
351
|
+
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
352
|
+
emit<K extends keyof Image.SignalSignatures>(
|
|
353
|
+
signal: K,
|
|
354
|
+
...args: GObject.GjsParameters<Image.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
|
|
355
|
+
): void;
|
|
356
|
+
emit(signal: string, ...args: any[]): void;
|
|
357
|
+
|
|
358
|
+
// Methods
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* See [method`Image`.get_width]
|
|
362
|
+
* @returns height
|
|
363
|
+
*/
|
|
364
|
+
get_height(): number;
|
|
365
|
+
/**
|
|
366
|
+
* Returns detected MIME type of the file
|
|
367
|
+
* @returns MIME type
|
|
368
|
+
*/
|
|
369
|
+
get_mime_type(): string;
|
|
370
|
+
/**
|
|
371
|
+
* Early width information.
|
|
372
|
+
*
|
|
373
|
+
* This information is often correct. However, it should only be used for
|
|
374
|
+
* an early rendering estimates. For everything else, the specific frame
|
|
375
|
+
* information should be used. See [method`Frame`.get_width].
|
|
376
|
+
* @returns Width
|
|
377
|
+
*/
|
|
378
|
+
get_width(): number;
|
|
379
|
+
/**
|
|
380
|
+
* Synchronously loads texture and information of the next frame.
|
|
381
|
+
*
|
|
382
|
+
* For single still images, this can only be called once.
|
|
383
|
+
* For animated images, this function will loop to the first frame, when the last frame is reached.
|
|
384
|
+
* @returns a new [class@Frame] on success, or `NULL` with @error filled in
|
|
385
|
+
*/
|
|
386
|
+
next_frame(): Frame;
|
|
387
|
+
/**
|
|
388
|
+
* Asynchronous version of [method`Image`.next_frame].
|
|
389
|
+
* @param cancellable A [class@Gio.Cancellable] to cancel the operation
|
|
390
|
+
*/
|
|
391
|
+
next_frame_async(cancellable?: Gio.Cancellable | null): globalThis.Promise<Frame>;
|
|
392
|
+
/**
|
|
393
|
+
* Asynchronous version of [method`Image`.next_frame].
|
|
394
|
+
* @param cancellable A [class@Gio.Cancellable] to cancel the operation
|
|
395
|
+
* @param callback A callback to call when the operation is complete
|
|
396
|
+
*/
|
|
397
|
+
next_frame_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void;
|
|
398
|
+
/**
|
|
399
|
+
* Asynchronous version of [method`Image`.next_frame].
|
|
400
|
+
* @param cancellable A [class@Gio.Cancellable] to cancel the operation
|
|
401
|
+
* @param callback A callback to call when the operation is complete
|
|
402
|
+
*/
|
|
403
|
+
next_frame_async(
|
|
404
|
+
cancellable?: Gio.Cancellable | null,
|
|
405
|
+
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
406
|
+
): globalThis.Promise<Frame> | void;
|
|
407
|
+
/**
|
|
408
|
+
* Finishes the [method`Image`.next_frame_async] call.
|
|
409
|
+
* @param result a `GAsyncResult`
|
|
410
|
+
* @returns Loaded frame.
|
|
411
|
+
*/
|
|
412
|
+
next_frame_finish(result: Gio.AsyncResult): Frame;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
namespace Loader {
|
|
416
|
+
// Signal signatures
|
|
417
|
+
interface SignalSignatures extends GObject.Object.SignalSignatures {
|
|
418
|
+
'notify::cancellable': (pspec: GObject.ParamSpec) => void;
|
|
419
|
+
'notify::file': (pspec: GObject.ParamSpec) => void;
|
|
420
|
+
'notify::sandbox-selector': (pspec: GObject.ParamSpec) => void;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Constructor properties interface
|
|
424
|
+
|
|
425
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
426
|
+
cancellable: Gio.Cancellable;
|
|
427
|
+
file: Gio.File;
|
|
428
|
+
sandbox_selector: SandboxSelector;
|
|
429
|
+
sandboxSelector: SandboxSelector;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* [class`Loader]` prepares loading an image.
|
|
435
|
+
*
|
|
436
|
+
* The following example shows how to obtain a [class`Gdk`.Texture]. It uses
|
|
437
|
+
* [GlyGtk4](https://gnome.pages.gitlab.gnome.org/glycin/libglycin-gtk4)
|
|
438
|
+
* for this.
|
|
439
|
+
*
|
|
440
|
+
* ```c
|
|
441
|
+
* #include <glycin-gtk4.h>
|
|
442
|
+
*
|
|
443
|
+
* file = g_file_new_for_path ("test.png");
|
|
444
|
+
* loader = gly_loader_new (file);
|
|
445
|
+
* image = gly_loader_load (loader, NULL);
|
|
446
|
+
* if (image)
|
|
447
|
+
* {
|
|
448
|
+
* frame = gly_image_next_frame (image, NULL);
|
|
449
|
+
* if (frame) {
|
|
450
|
+
* texture = gly_gtk_frame_get_texture (frame);
|
|
451
|
+
* printf ("Image height: %d\n", gdk_texture_get_height (texture));
|
|
452
|
+
* image_widget = gtk_image_new_from_paintable (GDK_PAINTABLE (texture));
|
|
453
|
+
* }
|
|
454
|
+
* }
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
class Loader extends GObject.Object {
|
|
458
|
+
static $gtype: GObject.GType<Loader>;
|
|
459
|
+
|
|
460
|
+
// Properties
|
|
461
|
+
|
|
462
|
+
get cancellable(): Gio.Cancellable;
|
|
463
|
+
set cancellable(val: Gio.Cancellable);
|
|
464
|
+
get file(): Gio.File;
|
|
465
|
+
get sandbox_selector(): SandboxSelector;
|
|
466
|
+
set sandbox_selector(val: SandboxSelector);
|
|
467
|
+
get sandboxSelector(): SandboxSelector;
|
|
468
|
+
set sandboxSelector(val: SandboxSelector);
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Compile-time signal type information.
|
|
472
|
+
*
|
|
473
|
+
* This instance property is generated only for TypeScript type checking.
|
|
474
|
+
* It is not defined at runtime and should not be accessed in JS code.
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
477
|
+
$signals: Loader.SignalSignatures;
|
|
478
|
+
|
|
479
|
+
// Constructors
|
|
480
|
+
|
|
481
|
+
constructor(properties?: Partial<Loader.ConstructorProps>, ...args: any[]);
|
|
482
|
+
|
|
483
|
+
_init(...args: any[]): void;
|
|
484
|
+
|
|
485
|
+
static ['new'](file: Gio.File): Loader;
|
|
486
|
+
|
|
487
|
+
// Signals
|
|
488
|
+
|
|
489
|
+
connect<K extends keyof Loader.SignalSignatures>(
|
|
490
|
+
signal: K,
|
|
491
|
+
callback: GObject.SignalCallback<this, Loader.SignalSignatures[K]>,
|
|
492
|
+
): number;
|
|
493
|
+
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
494
|
+
connect_after<K extends keyof Loader.SignalSignatures>(
|
|
495
|
+
signal: K,
|
|
496
|
+
callback: GObject.SignalCallback<this, Loader.SignalSignatures[K]>,
|
|
497
|
+
): number;
|
|
498
|
+
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
499
|
+
emit<K extends keyof Loader.SignalSignatures>(
|
|
500
|
+
signal: K,
|
|
501
|
+
...args: GObject.GjsParameters<Loader.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
|
|
502
|
+
): void;
|
|
503
|
+
emit(signal: string, ...args: any[]): void;
|
|
504
|
+
|
|
505
|
+
// Methods
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Synchronously loads an image and returns an [class`Image]` when successful.
|
|
509
|
+
* @returns a new [class@Image] on success, or `NULL` with @error filled in
|
|
510
|
+
*/
|
|
511
|
+
load(): Image;
|
|
512
|
+
/**
|
|
513
|
+
* Asynchronous version of [method`Loader`.load].
|
|
514
|
+
* @param cancellable A [class@Gio.Cancellable] to cancel the operation
|
|
515
|
+
*/
|
|
516
|
+
load_async(cancellable?: Gio.Cancellable | null): globalThis.Promise<Image>;
|
|
517
|
+
/**
|
|
518
|
+
* Asynchronous version of [method`Loader`.load].
|
|
519
|
+
* @param cancellable A [class@Gio.Cancellable] to cancel the operation
|
|
520
|
+
* @param callback A callback to call when the operation is complete
|
|
521
|
+
*/
|
|
522
|
+
load_async(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void;
|
|
523
|
+
/**
|
|
524
|
+
* Asynchronous version of [method`Loader`.load].
|
|
525
|
+
* @param cancellable A [class@Gio.Cancellable] to cancel the operation
|
|
526
|
+
* @param callback A callback to call when the operation is complete
|
|
527
|
+
*/
|
|
528
|
+
load_async(
|
|
529
|
+
cancellable?: Gio.Cancellable | null,
|
|
530
|
+
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
531
|
+
): globalThis.Promise<Image> | void;
|
|
532
|
+
/**
|
|
533
|
+
* Finishes the [method`Image`.next_frame_async] call.
|
|
534
|
+
* @param result A `GAsyncResult`
|
|
535
|
+
* @returns Loaded frame.
|
|
536
|
+
*/
|
|
537
|
+
load_finish(result: Gio.AsyncResult): Image;
|
|
538
|
+
/**
|
|
539
|
+
* Selects which sandbox mechanism should be used. The default without calling this function is [enum`SandboxSelector]``.AUTO`.
|
|
540
|
+
* @param sandbox_selector Method by which the sandbox mechanism is selected
|
|
541
|
+
*/
|
|
542
|
+
set_sandbox_selector(sandbox_selector: SandboxSelector | null): void;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
type FrameClass = typeof Frame;
|
|
546
|
+
type ImageClass = typeof Image;
|
|
547
|
+
type LoaderClass = typeof Loader;
|
|
548
|
+
/**
|
|
549
|
+
* Name of the imported GIR library
|
|
550
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
551
|
+
*/
|
|
552
|
+
const __name__: string;
|
|
553
|
+
/**
|
|
554
|
+
* Version of the imported GIR library
|
|
555
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
556
|
+
*/
|
|
557
|
+
const __version__: string;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export default Gly;
|
|
561
|
+
|
|
562
|
+
// END
|
package/gly-1.js
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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 './gly-1-ambient.d.ts';
|
|
11
|
+
|
|
12
|
+
import Gly from './gly-1.js';
|
|
13
|
+
export default Gly;
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@girs/gly-1",
|
|
3
|
+
"version": "1.0.0-4.0.0-beta.37",
|
|
4
|
+
"description": "GJS TypeScript type definitions for Gly-1, generated from library version 1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "gly-1.js",
|
|
7
|
+
"main": "gly-1.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./ambient": {
|
|
10
|
+
"types": "./gly-1-ambient.d.ts",
|
|
11
|
+
"import": "./gly-1-ambient.js",
|
|
12
|
+
"default": "./gly-1-ambient.js"
|
|
13
|
+
},
|
|
14
|
+
"./import": {
|
|
15
|
+
"types": "./gly-1-import.d.ts",
|
|
16
|
+
"import": "./gly-1-import.js",
|
|
17
|
+
"default": "./gly-1-import.js"
|
|
18
|
+
},
|
|
19
|
+
"./gly-1": {
|
|
20
|
+
"types": "./gly-1.d.ts",
|
|
21
|
+
"import": "./gly-1.js",
|
|
22
|
+
"default": "./gly-1.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/gjs": "4.0.0-beta.37",
|
|
35
|
+
"@girs/gio-2.0": "2.86.0-4.0.0-beta.37",
|
|
36
|
+
"@girs/gobject-2.0": "2.86.0-4.0.0-beta.37",
|
|
37
|
+
"@girs/glib-2.0": "2.86.0-4.0.0-beta.37",
|
|
38
|
+
"@girs/gmodule-2.0": "2.0.0-4.0.0-beta.37",
|
|
39
|
+
"@girs/gdk-4.0": "4.0.0-4.0.0-beta.37",
|
|
40
|
+
"@girs/cairo-1.0": "1.0.0-4.0.0-beta.37",
|
|
41
|
+
"@girs/pangocairo-1.0": "1.0.0-4.0.0-beta.37",
|
|
42
|
+
"@girs/pango-1.0": "1.57.0-4.0.0-beta.37",
|
|
43
|
+
"@girs/harfbuzz-0.0": "11.5.0-4.0.0-beta.37",
|
|
44
|
+
"@girs/freetype2-2.0": "2.0.0-4.0.0-beta.37",
|
|
45
|
+
"@girs/gdkpixbuf-2.0": "2.0.0-4.0.0-beta.37" },
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"typescript": "*"
|
|
48
|
+
},
|
|
49
|
+
"keywords": ["Gir", "TypeScript", "types", "GObject-Introspection", "GJS", "Gly-1"],
|
|
50
|
+
"author": "ts-for-gir",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/gjsify/types.git"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/gjsify/types/tree/main/gly-1#readme"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
// Show diagnostics
|
|
20
|
+
"diagnostics": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["./gly-1.d.ts"]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|