@girs/appstreamcompose-1.0 4.4.0 → 4.5.0

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
@@ -4,82 +4,77 @@
4
4
  ![version](https://img.shields.io/npm/v/@girs/appstreamcompose-1.0)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/appstreamcompose-1.0)
6
6
 
7
+ GJS TypeScript type definitions for AppStreamCompose-1.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.5.0.
7
8
 
8
- GJS TypeScript type definitions for AppStreamCompose-1.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.4.0.
9
+ This package contains type declarations only. It ships no runtime code, so it adds
10
+ nothing to your program and works with any bundler or none at all.
9
11
 
10
12
  ## Install
11
13
 
12
- Install the type definitions with npm:
13
14
  ```bash
14
15
  npm install @girs/appstreamcompose-1.0
15
16
  ```
16
17
 
17
- ## Usage
18
+ Any package manager works. The package has no dependencies beyond other `@girs/*`
19
+ type packages.
20
+
21
+ ## What it exports
22
+
23
+ | Import | What you get |
24
+ |---|---|
25
+ | `@girs/appstreamcompose-1.0` | the namespace as a default export, plus the ambient and global declarations |
26
+ | `@girs/appstreamcompose-1.0/ambient` | only the `gi://` module declarations |
27
+ | `@girs/appstreamcompose-1.0/import` | only the `imports.gi` declarations |
28
+ | `@girs/appstreamcompose-1.0/appstreamcompose-1.0` | the namespace, without the side-effecting declarations |
29
+
30
+ ## Three ways to import
31
+
32
+ Which one you use depends on how you write imports elsewhere, not on your toolchain.
33
+
34
+ ### As a module
18
35
 
19
- Import it like any other module:
20
36
  ```ts
21
37
  import AppStreamCompose from '@girs/appstreamcompose-1.0';
22
38
  ```
23
39
 
24
- ### Ambient Modules
40
+ ### As `gi://`
25
41
 
26
- [Ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) let you write the same import you would in plain JavaScript.
27
- For this you need to include `@girs/appstreamcompose-1.0` or `@girs/appstreamcompose-1.0/ambient` in your `tsconfig` or entry point Typescript file:
42
+ GJS resolves `gi://` at runtime. To give it types, reference the package once, either
43
+ from your entry point or from `tsconfig.json`:
28
44
 
29
- `index.ts`:
30
45
  ```ts
31
- import '@girs/appstreamcompose-1.0'
46
+ import '@girs/appstreamcompose-1.0';
32
47
  ```
33
48
 
34
- `tsconfig.json`:
35
49
  ```json
36
- {
37
- "compilerOptions": {
38
- ...
39
- },
40
- "include": ["@girs/appstreamcompose-1.0"],
41
- ...
42
- }
50
+ { "include": ["@girs/appstreamcompose-1.0"] }
43
51
  ```
44
52
 
45
- The ambient module now resolves with types:
53
+ Then the runtime spelling type-checks:
46
54
 
47
55
  ```ts
48
56
  import AppStreamCompose from 'gi://AppStreamCompose?version=1.0';
49
57
  ```
50
58
 
51
- ### Global import
52
-
53
- GJS's global `imports.gi` works too, with types.
54
- For this you need to include `@girs/appstreamcompose-1.0` or `@girs/appstreamcompose-1.0/import` in your `tsconfig` or entry point Typescript file:
59
+ Referencing `@girs/appstreamcompose-1.0/ambient` instead pulls in these declarations
60
+ alone. See [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules).
55
61
 
56
- `index.ts`:
57
- ```ts
58
- import '@girs/appstreamcompose-1.0'
59
- ```
60
-
61
- `tsconfig.json`:
62
- ```json
63
- {
64
- "compilerOptions": {
65
- ...
66
- },
67
- "include": ["@girs/appstreamcompose-1.0"],
68
- ...
69
- }
70
- ```
62
+ ### As `imports.gi`
71
63
 
72
- That form carries types as well:
64
+ GJS's global object works the same way, via `@girs/appstreamcompose-1.0/import`:
73
65
 
74
66
  ```ts
75
67
  const AppStreamCompose = imports.gi.AppStreamCompose;
76
68
  ```
77
69
 
78
- ### Bundle
70
+ ## Building
79
71
 
80
- Most projects want a bundler. [esbuild](https://esbuild.github.io/) is the smallest thing that works; the [examples directory](https://github.com/gjsify/ts-for-gir/tree/main/examples) has setups for several others.
72
+ The declarations need no build step. If you bundle, every bundler works, since there is
73
+ no runtime code to resolve. The [examples](https://github.com/gjsify/ts-for-gir/tree/main/examples)
74
+ show working setups for several.
81
75
 
82
76
  ## Other packages
83
77
 
84
- All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
78
+ Every pre-generated package is at [gjsify/types](https://github.com/gjsify/types).
79
+
85
80
 
@@ -60,19 +60,19 @@ export namespace AppStreamCompose {
60
60
  /**
61
61
  * Ignore icons of this size.
62
62
  */
63
- IGNORED,
63
+ IGNORED = 0,
64
64
  /**
65
65
  * Create cache for the icon, and provide remote link as well.
66
66
  */
67
- CACHED_REMOTE,
67
+ CACHED_REMOTE = 1,
68
68
  /**
69
69
  * Set if the icon should be stored in an icon tarball and be cached locally.
70
70
  */
71
- CACHED_ONLY,
71
+ CACHED_ONLY = 2,
72
72
  /**
73
73
  * Set if this icon should be stored remotely and fetched on demand.
74
74
  */
75
- REMOTE_ONLY,
75
+ REMOTE_ONLY = 3,
76
76
  }
77
77
 
78
78
 
@@ -117,43 +117,43 @@ export namespace AppStreamCompose {
117
117
  /**
118
118
  * Unknown image format.
119
119
  */
120
- UNKNOWN,
120
+ UNKNOWN = 0,
121
121
  /**
122
122
  * PNG format
123
123
  */
124
- PNG,
124
+ PNG = 1,
125
125
  /**
126
126
  * JPEG-XL format
127
127
  */
128
- JXL,
128
+ JXL = 2,
129
129
  /**
130
130
  * AVIF format
131
131
  */
132
- AVIF,
132
+ AVIF = 3,
133
133
  /**
134
134
  * WebP format
135
135
  */
136
- WEBP,
136
+ WEBP = 4,
137
137
  /**
138
138
  * SVG format
139
139
  */
140
- SVG,
140
+ SVG = 5,
141
141
  /**
142
142
  * Compressed SVG format
143
143
  */
144
- SVGZ,
144
+ SVGZ = 6,
145
145
  /**
146
146
  * JPEG format
147
147
  */
148
- JPEG,
148
+ JPEG = 7,
149
149
  /**
150
150
  * GIF format
151
151
  */
152
- GIF,
152
+ GIF = 8,
153
153
  /**
154
154
  * XPM format
155
155
  */
156
- XPM,
156
+ XPM = 9,
157
157
  }
158
158
 
159
159
 
@@ -332,6 +332,7 @@ export namespace AppStreamCompose {
332
332
  * @param format Target image format, e.g. {@link AppStreamCompose.ImageFormat.PNG}
333
333
  * @param filename Filename to write to.
334
334
  * @returns `true` for success
335
+ * @throws GLib.Error
335
336
  */
336
337
  function render_svg_to_file(stream: Gio.InputStream, width: number, height: number, format: ImageFormat, filename: string): boolean;
337
338
 
@@ -353,20 +354,20 @@ export namespace AppStreamCompose {
353
354
  * @gir-type Flags
354
355
  */
355
356
  enum ComposeFlags {
356
- NONE,
357
- USE_THREADS,
358
- ALLOW_NET,
359
- VALIDATE,
360
- STORE_SCREENSHOTS,
361
- ALLOW_SCREENCASTS,
362
- PROCESS_FONTS,
363
- PROCESS_TRANSLATIONS,
364
- IGNORE_ICONS,
365
- PROCESS_UNPAIRED_DESKTOP,
366
- PROPAGATE_CUSTOM,
367
- PROPAGATE_ARTIFACTS,
368
- NO_FINAL_CHECK,
369
- NO_PARTIAL_URLS,
357
+ NONE = 0,
358
+ USE_THREADS = 1,
359
+ ALLOW_NET = 2,
360
+ VALIDATE = 4,
361
+ STORE_SCREENSHOTS = 8,
362
+ ALLOW_SCREENCASTS = 16,
363
+ PROCESS_FONTS = 32,
364
+ PROCESS_TRANSLATIONS = 64,
365
+ IGNORE_ICONS = 128,
366
+ PROCESS_UNPAIRED_DESKTOP = 256,
367
+ PROPAGATE_CUSTOM = 512,
368
+ PROPAGATE_ARTIFACTS = 1024,
369
+ NO_FINAL_CHECK = 2048,
370
+ NO_PARTIAL_URLS = 4096,
370
371
  }
371
372
 
372
373
 
@@ -385,19 +386,19 @@ export namespace AppStreamCompose {
385
386
  /**
386
387
  * No special flags set
387
388
  */
388
- NONE,
389
+ NONE = 0,
389
390
  /**
390
391
  * Sharpen the resulting image
391
392
  */
392
- SHARPEN,
393
+ SHARPEN = 1,
393
394
  /**
394
395
  * Allow loading of unsupported image types.
395
396
  */
396
- ALLOW_UNSUPPORTED,
397
+ ALLOW_UNSUPPORTED = 2,
397
398
  /**
398
399
  * Always resize the source image to the perfect size
399
400
  */
400
- ALWAYS_RESIZE,
401
+ ALWAYS_RESIZE = 4,
401
402
  }
402
403
 
403
404
 
@@ -416,23 +417,23 @@ export namespace AppStreamCompose {
416
417
  /**
417
418
  * No special flags set
418
419
  */
419
- NONE,
420
+ NONE = 0,
420
421
  /**
421
422
  * Optimize generated PNG for size
422
423
  */
423
- OPTIMIZE,
424
+ OPTIMIZE = 1,
424
425
  /**
425
426
  * Pad with alpha to 16:9 aspect
426
427
  */
427
- PAD_16_9,
428
+ PAD_16_9 = 2,
428
429
  /**
429
430
  * Sharpen the image to clarify detail
430
431
  */
431
- SHARPEN,
432
+ SHARPEN = 4,
432
433
  /**
433
434
  * Blur the image to clear detail
434
435
  */
435
- BLUR,
436
+ BLUR = 8,
436
437
  }
437
438
 
438
439
 
@@ -631,6 +632,7 @@ export namespace AppStreamCompose {
631
632
  * found components.
632
633
  * @param cancellable a {@link Gio.Cancellable}.
633
634
  * @returns The results, or `null` on error
635
+ * @throws GLib.Error
634
636
  */
635
637
  run(cancellable: Gio.Cancellable | null): Result[];
636
638
 
@@ -960,6 +962,7 @@ export namespace AppStreamCompose {
960
962
  /**
961
963
  * Loads the icon policy from a textual representation.
962
964
  * @param serialized_policy A policy string as returned by %asc_icon_policy_to_string
965
+ * @throws GLib.Error
963
966
  */
964
967
  from_string(serialized_policy: string): boolean;
965
968
 
@@ -1052,6 +1055,7 @@ export namespace AppStreamCompose {
1052
1055
  * @param src_size_min The smallest source size (width or height) allowed, or 0 for no limit
1053
1056
  * @param flags a {@link AppStreamCompose.ImageLoadFlags}, e.g. {@link AppStreamCompose.ImageLoadFlags.NONE}
1054
1057
  * @returns `true` for success
1058
+ * @throws GLib.Error
1055
1059
  */
1056
1060
  load_filename(filename: string, dest_width: number, dest_height: number, src_size_min: number, flags: ImageLoadFlags): boolean;
1057
1061
 
@@ -1062,6 +1066,7 @@ export namespace AppStreamCompose {
1062
1066
  * @param height target height, or 0 for default
1063
1067
  * @param flags some {@link AppStreamCompose.ImageSaveFlags} values, e.g. {@link AppStreamCompose.ImageSaveFlags.PAD_16_9}
1064
1068
  * @returns `true` for success
1069
+ * @throws GLib.Error
1065
1070
  */
1066
1071
  save_filename(filename: string, width: number, height: number, flags: ImageSaveFlags): boolean;
1067
1072
 
@@ -1144,6 +1149,7 @@ export namespace AppStreamCompose {
1144
1149
  * @param cpt The {@link AppStream.Component} to add.
1145
1150
  * @param bytes Source data used to generate the GCID hash, or `null` if nonexistent.
1146
1151
  * @returns `true` on success.
1152
+ * @throws GLib.Error
1147
1153
  */
1148
1154
  add_component(cpt: AppStream.Component, bytes: GLib.Bytes | Uint8Array): boolean;
1149
1155
 
@@ -1152,6 +1158,7 @@ export namespace AppStreamCompose {
1152
1158
  * @param cpt The {@link AppStream.Component} to add.
1153
1159
  * @param data Source data used to generate the GCID hash, or `null` if nonexistent.
1154
1160
  * @returns `true` on success.
1161
+ * @throws GLib.Error
1155
1162
  */
1156
1163
  add_component_with_string(cpt: AppStream.Component, data: string): boolean;
1157
1164
 
@@ -1467,12 +1474,14 @@ export namespace AppStreamCompose {
1467
1474
 
1468
1475
  /**
1469
1476
  * Open this unit, populating its content listing.
1477
+ * @throws GLib.Error
1470
1478
  */
1471
1479
  open(): boolean;
1472
1480
 
1473
1481
  /**
1474
1482
  * Read the contents of the selected file into memory and return them.
1475
1483
  * @param filename The file to read data for.
1484
+ * @throws GLib.Error
1476
1485
  */
1477
1486
  read_data(filename: string): GLib.Bytes;
1478
1487
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/appstreamcompose-1.0",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "GJS TypeScript type definitions for AppStreamCompose-1.0",
5
5
  "type": "module",
6
6
  "module": "appstreamcompose-1.0.js",
@@ -31,12 +31,12 @@
31
31
  "test": "tsc --project tsconfig.json"
32
32
  },
33
33
  "dependencies": {
34
- "@girs/gjs": "^4.4.0",
35
- "@girs/gio-2.0": "^4.4.0",
36
- "@girs/gobject-2.0": "^4.4.0",
37
- "@girs/glib-2.0": "^4.4.0",
38
- "@girs/gmodule-2.0": "^4.4.0",
39
- "@girs/appstream-1.0": "^4.4.0" },
34
+ "@girs/gjs": "^4.5.0",
35
+ "@girs/gio-2.0": "^4.5.0",
36
+ "@girs/gobject-2.0": "^4.5.0",
37
+ "@girs/glib-2.0": "^4.5.0",
38
+ "@girs/gmodule-2.0": "^4.5.0",
39
+ "@girs/appstream-1.0": "^4.5.0" },
40
40
  "devDependencies": {
41
41
  "typescript": "*"
42
42
  },