@girs/amtk-4 4.3.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.
Files changed (3) hide show
  1. package/README.md +36 -41
  2. package/amtk-4.d.ts +54 -10
  3. package/package.json +15 -15
package/README.md CHANGED
@@ -4,82 +4,77 @@
4
4
  ![version](https://img.shields.io/npm/v/@girs/amtk-4)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/amtk-4)
6
6
 
7
+ GJS TypeScript type definitions for Amtk-4 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.5.0.
7
8
 
8
- GJS TypeScript type definitions for Amtk-4 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.3.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/amtk-4
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/amtk-4` | the namespace as a default export, plus the ambient and global declarations |
26
+ | `@girs/amtk-4/ambient` | only the `gi://` module declarations |
27
+ | `@girs/amtk-4/import` | only the `imports.gi` declarations |
28
+ | `@girs/amtk-4/amtk-4` | 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 Amtk from '@girs/amtk-4';
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/amtk-4` or `@girs/amtk-4/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/amtk-4'
46
+ import '@girs/amtk-4';
32
47
  ```
33
48
 
34
- `tsconfig.json`:
35
49
  ```json
36
- {
37
- "compilerOptions": {
38
- ...
39
- },
40
- "include": ["@girs/amtk-4"],
41
- ...
42
- }
50
+ { "include": ["@girs/amtk-4"] }
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 Amtk from 'gi://Amtk?version=4';
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/amtk-4` or `@girs/amtk-4/import` in your `tsconfig` or entry point Typescript file:
59
+ Referencing `@girs/amtk-4/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/amtk-4'
59
- ```
60
-
61
- `tsconfig.json`:
62
- ```json
63
- {
64
- "compilerOptions": {
65
- ...
66
- },
67
- "include": ["@girs/amtk-4"],
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/amtk-4/import`:
73
65
 
74
66
  ```ts
75
67
  const Amtk = imports.gi.Amtk;
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
 
package/amtk-4.d.ts CHANGED
@@ -198,38 +198,38 @@ export namespace Amtk {
198
198
  /**
199
199
  * No flags.
200
200
  */
201
- FLAGS_NONE,
201
+ FLAGS_NONE = 0,
202
202
  /**
203
203
  * Do not call `gtk_actionable_set_action_name()`.
204
204
  */
205
- IGNORE_GACTION,
205
+ IGNORE_GACTION = 1,
206
206
  /**
207
207
  * Do not set an icon.
208
208
  */
209
- IGNORE_ICON,
209
+ IGNORE_ICON = 2,
210
210
  /**
211
211
  * Do not set a label/short description.
212
212
  */
213
- IGNORE_LABEL,
213
+ IGNORE_LABEL = 4,
214
214
  /**
215
215
  * Do not set a tooltip/long description.
216
216
  */
217
- IGNORE_TOOLTIP,
217
+ IGNORE_TOOLTIP = 8,
218
218
  /**
219
219
  * Ignore completely the accelerators.
220
220
  */
221
- IGNORE_ACCELS,
221
+ IGNORE_ACCELS = 16,
222
222
  /**
223
223
  * Ignore the accelerators for
224
224
  * documentation purposes only. For example do not add/configure a
225
225
  * {@link Gtk.AccelLabel}.
226
226
  */
227
- IGNORE_ACCELS_FOR_DOC,
227
+ IGNORE_ACCELS_FOR_DOC = 32,
228
228
  /**
229
229
  * Do not call
230
230
  * `gtk_application_set_accels_for_action()`.
231
231
  */
232
- IGNORE_ACCELS_FOR_APP,
232
+ IGNORE_ACCELS_FOR_APP = 64,
233
233
  }
234
234
 
235
235
 
@@ -275,12 +275,16 @@ export namespace Amtk {
275
275
  emit(signal: string, ...args: any[]): void;
276
276
 
277
277
  // Static methods
278
+ /**
279
+ * @since 3.0
280
+ */
278
281
  static get_singleton(): ActionInfoCentralStore;
279
282
 
280
283
  // Methods
281
284
  /**
282
285
  * @param action_name an action name.
283
286
  * @returns the found {@link Amtk.ActionInfo}, or `null`.
287
+ * @since 2.0
284
288
  */
285
289
  lookup(action_name: string): ActionInfo;
286
290
  }
@@ -336,6 +340,7 @@ export namespace Amtk {
336
340
  * {@link Amtk.ActionInfo} with the same action name. The stores take their own
337
341
  * reference on `info`.
338
342
  * @param info an {@link Amtk.ActionInfo}.
343
+ * @since 2.0
339
344
  */
340
345
  add(info: ActionInfo): void;
341
346
 
@@ -348,6 +353,7 @@ export namespace Amtk {
348
353
  * An API similar to `g_action_map_add_action_entries()`.
349
354
  * @param entries a pointer to the first item in an array of {@link Amtk.ActionInfoEntry} structs.
350
355
  * @param translation_domain a gettext domain, or `null`.
356
+ * @since 2.0
351
357
  */
352
358
  add_entries(entries: ActionInfoEntry[], translation_domain: string | null): void;
353
359
 
@@ -359,12 +365,14 @@ export namespace Amtk {
359
365
  * You probably want to call this function on the application store after
360
366
  * creating the menu and toolbar. But it can also be useful for a store provided
361
367
  * by a library, to easily see which actions are not used by the application.
368
+ * @since 2.0
362
369
  */
363
370
  check_all_used(): void;
364
371
 
365
372
  /**
366
373
  * @param action_name an action name.
367
374
  * @returns the found {@link Amtk.ActionInfo}, or `null`.
375
+ * @since 2.0
368
376
  */
369
377
  lookup(action_name: string): ActionInfo;
370
378
  }
@@ -445,6 +453,7 @@ export namespace Amtk {
445
453
  * Returns the {@link Amtk.ApplicationWindow} of `gtk_window`. The returned object is
446
454
  * guaranteed to be the same for the lifetime of `gtk_window`.
447
455
  * @param gtk_window a {@link Gtk.ApplicationWindow}.
456
+ * @since 2.0
448
457
  */
449
458
  static get_from_gtk_application_window(gtk_window: Gtk.ApplicationWindow): ApplicationWindow;
450
459
 
@@ -458,6 +467,7 @@ export namespace Amtk {
458
467
  * So `amtk_menu_item_set_long_description()` must have been called, which is the
459
468
  * case if the {@link Gtk.MenuItem} has been created with {@link Amtk.Factory}.
460
469
  * @param menu_shell a {@link Gtk.MenuShell}.
470
+ * @since 2.0
461
471
  */
462
472
  connect_menu_to_statusbar(menu_shell: Gtk.MenuShell): void;
463
473
 
@@ -469,6 +479,7 @@ export namespace Amtk {
469
479
  * The full path is retrieved with
470
480
  * `amtk_utils_recent_chooser_menu_get_item_uri()`.
471
481
  * @param menu a {@link Gtk.RecentChooserMenu}.
482
+ * @since 2.0
472
483
  */
473
484
  connect_recent_chooser_menu_to_statusbar(menu: Gtk.RecentChooserMenu): void;
474
485
 
@@ -488,6 +499,7 @@ export namespace Amtk {
488
499
  * `g_application_open()` is called (with an empty hint), so the {@link Gio.Application}
489
500
  * must have the {@link Gio.ApplicationFlags.HANDLES_OPEN} flag set.
490
501
  * @returns a new {@link Gtk.RecentChooserMenu}.
502
+ * @since 3.0
491
503
  */
492
504
  create_open_recent_menu(): Gtk.Widget;
493
505
 
@@ -496,22 +508,26 @@ export namespace Amtk {
496
508
  * submenu. The {@link Gtk.RecentChooserMenu} is created with
497
509
  * `amtk_application_window_create_open_recent_menu()`.
498
510
  * @returns a new {@link Gtk.MenuItem}.
511
+ * @since 2.0
499
512
  */
500
513
  create_open_recent_menu_item(): Gtk.Widget;
501
514
 
502
515
  /**
503
516
  * @returns the {@link Gtk.ApplicationWindow} of `amtk_window`.
517
+ * @since 2.0
504
518
  */
505
519
  get_application_window(): Gtk.ApplicationWindow;
506
520
 
507
521
  /**
508
522
  * @returns the {@link Amtk.ApplicationWindow.statusbar}.
523
+ * @since 2.0
509
524
  */
510
525
  get_statusbar(): Gtk.Statusbar | null;
511
526
 
512
527
  /**
513
528
  * Sets the {@link Amtk.ApplicationWindow.statusbar} property.
514
529
  * @param statusbar a {@link Gtk.Statusbar}, or `null`.
530
+ * @since 2.0
515
531
  */
516
532
  set_statusbar(statusbar: Gtk.Statusbar | null): void;
517
533
  }
@@ -601,6 +617,7 @@ export namespace Amtk {
601
617
  * information.
602
618
  * @param action_name an action name.
603
619
  * @returns a new {@link Gtk.CheckMenuItem} for `action_name`.
620
+ * @since 3.0
604
621
  */
605
622
  create_check_menu_item(action_name: string): Gtk.Widget;
606
623
 
@@ -616,6 +633,7 @@ export namespace Amtk {
616
633
  * @param action_name an action name.
617
634
  * @param flags {@link Amtk.FactoryFlags}.
618
635
  * @returns a new {@link Gtk.CheckMenuItem} for `action_name`.
636
+ * @since 3.0
619
637
  */
620
638
  create_check_menu_item_full(action_name: string, flags: FactoryFlags): Gtk.Widget;
621
639
 
@@ -624,6 +642,7 @@ export namespace Amtk {
624
642
  * {@link Amtk.Factory.default_flags}.
625
643
  * @param action_name an action name.
626
644
  * @returns a new {@link Gtk.MenuItem} for `action_name`.
645
+ * @since 3.0
627
646
  */
628
647
  create_menu_item(action_name: string): Gtk.Widget;
629
648
 
@@ -633,6 +652,7 @@ export namespace Amtk {
633
652
  * @param action_name an action name.
634
653
  * @param flags {@link Amtk.FactoryFlags}.
635
654
  * @returns a new {@link Gtk.MenuItem} for `action_name`.
655
+ * @since 3.0
636
656
  */
637
657
  create_menu_item_full(action_name: string, flags: FactoryFlags): Gtk.Widget;
638
658
 
@@ -644,6 +664,7 @@ export namespace Amtk {
644
664
  * information.
645
665
  * @param action_name an action name.
646
666
  * @returns a new {@link Gtk.MenuToolButton} for `action_name`.
667
+ * @since 3.0
647
668
  */
648
669
  create_menu_tool_button(action_name: string): Gtk.MenuToolButton;
649
670
 
@@ -656,6 +677,7 @@ export namespace Amtk {
656
677
  * @param action_name an action name.
657
678
  * @param flags {@link Amtk.FactoryFlags}.
658
679
  * @returns a new {@link Gtk.MenuToolButton} for `action_name`.
680
+ * @since 3.0
659
681
  */
660
682
  create_menu_tool_button_full(action_name: string, flags: FactoryFlags): Gtk.MenuToolButton;
661
683
 
@@ -664,6 +686,7 @@ export namespace Amtk {
664
686
  * {@link Amtk.Factory.default_flags}.
665
687
  * @param action_name an action name.
666
688
  * @returns a new {@link Gtk.ToolButton} for `action_name`.
689
+ * @since 3.0
667
690
  */
668
691
  create_tool_button(action_name: string): Gtk.ToolItem;
669
692
 
@@ -673,22 +696,26 @@ export namespace Amtk {
673
696
  * @param action_name an action name.
674
697
  * @param flags {@link Amtk.FactoryFlags}.
675
698
  * @returns a new {@link Gtk.ToolButton} for `action_name`.
699
+ * @since 3.0
676
700
  */
677
701
  create_tool_button_full(action_name: string, flags: FactoryFlags): Gtk.ToolItem;
678
702
 
679
703
  /**
680
704
  * @returns the {@link Amtk.Factory.application}.
705
+ * @since 3.0
681
706
  */
682
707
  get_application(): Gtk.Application | null;
683
708
 
684
709
  /**
685
710
  * @returns the {@link Amtk.Factory.default_flags}.
711
+ * @since 3.0
686
712
  */
687
713
  get_default_flags(): FactoryFlags;
688
714
 
689
715
  /**
690
716
  * Sets the {@link Amtk.Factory.default_flags} property.
691
717
  * @param default_flags the new value.
718
+ * @since 3.0
692
719
  */
693
720
  set_default_flags(default_flags: FactoryFlags): void;
694
721
  }
@@ -705,7 +732,7 @@ export namespace Amtk {
705
732
  * @since 2.0
706
733
  * @run-first
707
734
  */
708
- "menu-item-deselected": (arg0: Gtk.MenuItem) => void;
735
+ "menu-item-deselected": (menu_item: Gtk.MenuItem) => void;
709
736
  /**
710
737
  * The ::menu-item-selected signal is emitted when the
711
738
  * {@link Gtk.MenuItem.SignalSignatures.select | Gtk.MenuItem::select} signal is emitted on a {@link Gtk.MenuItem} belonging
@@ -714,7 +741,7 @@ export namespace Amtk {
714
741
  * @since 2.0
715
742
  * @run-first
716
743
  */
717
- "menu-item-selected": (arg0: Gtk.MenuItem) => void;
744
+ "menu-item-selected": (menu_item: Gtk.MenuItem) => void;
718
745
  "notify::menu-shell": (pspec: GObject.ParamSpec) => void;
719
746
  }
720
747
 
@@ -778,6 +805,7 @@ export namespace Amtk {
778
805
  * Returns the {@link Amtk.MenuShell} of `gtk_menu_shell`. The returned object is
779
806
  * guaranteed to be the same for the lifetime of `gtk_menu_shell`.
780
807
  * @param gtk_menu_shell a {@link Gtk.MenuShell}.
808
+ * @since 2.0
781
809
  */
782
810
  static get_from_gtk_menu_shell(gtk_menu_shell: Gtk.MenuShell): MenuShell;
783
811
 
@@ -797,6 +825,7 @@ export namespace Amtk {
797
825
  // Methods
798
826
  /**
799
827
  * @returns the {@link Gtk.MenuShell} of `amtk_menu_shell`.
828
+ * @since 2.0
800
829
  */
801
830
  get_menu_shell(): Gtk.MenuShell;
802
831
  }
@@ -818,6 +847,7 @@ export namespace Amtk {
818
847
  // Methods
819
848
  /**
820
849
  * @returns a copy of `info`. The copy will have a reference count of one.
850
+ * @since 2.0
821
851
  */
822
852
  copy(): ActionInfo;
823
853
 
@@ -826,27 +856,32 @@ export namespace Amtk {
826
856
  * returns a `null`-terminated array, to be suitable for
827
857
  * `gtk_application_set_accels_for_action()`.
828
858
  * @returns a `null`-terminated array of accelerators in the format understood by `gtk_accelerator_parse()`.
859
+ * @since 2.0
829
860
  */
830
861
  get_accels(): string[];
831
862
 
832
863
  /**
833
864
  * @returns the action name, or `null`. Example: `"win.save"`.
865
+ * @since 2.0
834
866
  */
835
867
  get_action_name(): string | null;
836
868
 
837
869
  /**
838
870
  * @returns the icon name, or `null`.
871
+ * @since 2.0
839
872
  */
840
873
  get_icon_name(): string | null;
841
874
 
842
875
  /**
843
876
  * Gets the label. The label has normally a mnemonic.
844
877
  * @returns the label (i.e. a short description), or `null`.
878
+ * @since 2.0
845
879
  */
846
880
  get_label(): string | null;
847
881
 
848
882
  /**
849
883
  * @returns the tooltip (i.e. a long description), or `null`.
884
+ * @since 2.0
850
885
  */
851
886
  get_tooltip(): string | null;
852
887
 
@@ -854,18 +889,21 @@ export namespace Amtk {
854
889
  * Returns whether `info` has been used (for example by an {@link Amtk.Factory}
855
890
  * function). See also `amtk_action_info_store_check_all_used()`.
856
891
  * @returns whether `info` has been used.
892
+ * @since 3.0
857
893
  */
858
894
  has_been_used(): boolean;
859
895
 
860
896
  /**
861
897
  * Mark `info` as used. An {@link Amtk.Factory} function that uses an {@link Amtk.ActionInfo}
862
898
  * should call this function. See `amtk_action_info_store_check_all_used()`.
899
+ * @since 3.0
863
900
  */
864
901
  mark_as_used(): void;
865
902
 
866
903
  /**
867
904
  * Increments the reference count of `info` by one.
868
905
  * @returns the passed in `info`.
906
+ * @since 2.0
869
907
  */
870
908
  ref(): ActionInfo;
871
909
 
@@ -875,34 +913,40 @@ export namespace Amtk {
875
913
  * `accels` must not be `null`, it must be a `null`-terminated array, to be
876
914
  * consistent with `gtk_application_set_accels_for_action()`.
877
915
  * @param accels a `null`-terminated array of accelerators in the format understood by `gtk_accelerator_parse()`.
916
+ * @since 2.0
878
917
  */
879
918
  set_accels(accels: string[]): void;
880
919
 
881
920
  /**
882
921
  * Sets the action name, for example `"win.save"`.
883
922
  * @param action_name the action name.
923
+ * @since 2.0
884
924
  */
885
925
  set_action_name(action_name: string): void;
886
926
 
887
927
  /**
888
928
  * @param icon_name the icon name, or `null`.
929
+ * @since 2.0
889
930
  */
890
931
  set_icon_name(icon_name: string | null): void;
891
932
 
892
933
  /**
893
934
  * Sets the label with a mnemonic.
894
935
  * @param label the label (i.e. a short description), or `null`.
936
+ * @since 2.0
895
937
  */
896
938
  set_label(label: string | null): void;
897
939
 
898
940
  /**
899
941
  * @param tooltip the tooltip (i.e. a long description), or `null`.
942
+ * @since 2.0
900
943
  */
901
944
  set_tooltip(tooltip: string | null): void;
902
945
 
903
946
  /**
904
947
  * Decrements the reference count of `info` by one. If the reference count drops
905
948
  * to 0, `info` is freed.
949
+ * @since 2.0
906
950
  */
907
951
  unref(): void;
908
952
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/amtk-4",
3
- "version": "4.3.0",
3
+ "version": "4.5.0",
4
4
  "description": "GJS TypeScript type definitions for Amtk-4",
5
5
  "type": "module",
6
6
  "module": "amtk-4.js",
@@ -31,20 +31,20 @@
31
31
  "test": "tsc --project tsconfig.json"
32
32
  },
33
33
  "dependencies": {
34
- "@girs/gjs": "^4.3.0",
35
- "@girs/gtk-3.0": "^4.3.0",
36
- "@girs/xlib-2.0": "^4.3.0",
37
- "@girs/gdk-3.0": "^4.3.0",
38
- "@girs/cairo-1.0": "^4.3.0",
39
- "@girs/gobject-2.0": "^4.3.0",
40
- "@girs/glib-2.0": "^4.3.0",
41
- "@girs/pango-1.0": "^4.3.0",
42
- "@girs/harfbuzz-0.0": "^4.3.0",
43
- "@girs/freetype2-2.0": "^4.3.0",
44
- "@girs/gio-2.0": "^4.3.0",
45
- "@girs/gmodule-2.0": "^4.3.0",
46
- "@girs/gdkpixbuf-2.0": "^4.3.0",
47
- "@girs/atk-1.0": "^4.3.0" },
34
+ "@girs/gjs": "^4.5.0",
35
+ "@girs/gtk-3.0": "^4.5.0",
36
+ "@girs/xlib-2.0": "^4.5.0",
37
+ "@girs/gdk-3.0": "^4.5.0",
38
+ "@girs/cairo-1.0": "^4.5.0",
39
+ "@girs/gobject-2.0": "^4.5.0",
40
+ "@girs/glib-2.0": "^4.5.0",
41
+ "@girs/pango-1.0": "^4.5.0",
42
+ "@girs/harfbuzz-0.0": "^4.5.0",
43
+ "@girs/freetype2-2.0": "^4.5.0",
44
+ "@girs/gio-2.0": "^4.5.0",
45
+ "@girs/gmodule-2.0": "^4.5.0",
46
+ "@girs/gdkpixbuf-2.0": "^4.5.0",
47
+ "@girs/atk-1.0": "^4.5.0" },
48
48
  "devDependencies": {
49
49
  "typescript": "*"
50
50
  },