@girs/keybinder-3.0 3.0.0-4.0.0-beta.3

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
+ # Keybinder-3.0
3
+
4
+ ![version](https://img.shields.io/npm/v/@girs/keybinder-3.0)
5
+ ![downloads/week](https://img.shields.io/npm/dw/@girs/keybinder-3.0)
6
+
7
+
8
+ GJS TypeScript type definitions for Keybinder-3.0, generated from library version 3.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.3.
9
+
10
+
11
+ ## Install
12
+
13
+ To use this type definitions, install them with NPM:
14
+ ```bash
15
+ npm install @girs/keybinder-3.0
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ You can import this package into your project like this:
21
+ ```ts
22
+ import Keybinder from '@girs/keybinder-3.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/keybinder-3.0` or `@girs/keybinder-3.0/ambient` in your `tsconfig` or entry point Typescript file:
29
+
30
+ `index.ts`:
31
+ ```ts
32
+ import '@girs/keybinder-3.0'
33
+ ```
34
+
35
+ `tsconfig.json`:
36
+ ```json
37
+ {
38
+ "compilerOptions": {
39
+ ...
40
+ },
41
+ "include": ["@girs/keybinder-3.0"],
42
+ ...
43
+ }
44
+ ```
45
+
46
+ Now you can import the ambient module with TypeScript support:
47
+
48
+ ```ts
49
+ import Keybinder from 'gi://Keybinder?version=3.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/keybinder-3.0` or `@girs/keybinder-3.0/import` in your `tsconfig` or entry point Typescript file:
56
+
57
+ `index.ts`:
58
+ ```ts
59
+ import '@girs/keybinder-3.0'
60
+ ```
61
+
62
+ `tsconfig.json`:
63
+ ```json
64
+ {
65
+ "compilerOptions": {
66
+ ...
67
+ },
68
+ "include": ["@girs/keybinder-3.0"],
69
+ ...
70
+ }
71
+ ```
72
+
73
+ Now you have also type support for this, too:
74
+
75
+ ```ts
76
+ const Keybinder = imports.gi.Keybinder;
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,12 @@
1
+
2
+ declare module 'gi://Keybinder?version=3.0' {
3
+ import Keybinder from '@girs/keybinder-3.0';
4
+ export default Keybinder;
5
+ }
6
+
7
+ declare module 'gi://Keybinder' {
8
+ import Keybinder30 from 'gi://Keybinder?version=3.0';
9
+ export default Keybinder30;
10
+ }
11
+
12
+
@@ -0,0 +1,2 @@
1
+ export {}
2
+
@@ -0,0 +1,12 @@
1
+
2
+ import Keybinder30 from '@girs/keybinder-3.0';
3
+
4
+ declare global {
5
+ export interface GjsGiImports {
6
+ Keybinder: typeof Keybinder30;
7
+ }
8
+ }
9
+
10
+ export default GjsGiImports;
11
+
12
+
@@ -0,0 +1,3 @@
1
+ const gi = globalThis.imports?.gi || {};
2
+ export default gi;
3
+
@@ -0,0 +1,76 @@
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
+
8
+ import './keybinder-3.0-ambient.d.ts';
9
+
10
+ /**
11
+ * Keybinder-3.0
12
+ */
13
+
14
+ import type GObject from '@girs/gobject-2.0';
15
+ import type GLib from '@girs/glib-2.0';
16
+
17
+ export namespace Keybinder {
18
+ /**
19
+ * Grab a key combination globally and register a callback to be called each
20
+ * time the key combination is pressed.
21
+ * @param keystring an accelerator description (gtk_accelerator_parse() format)
22
+ * @param handler callback function
23
+ * @param notify called when @handler is unregistered
24
+ * @returns %TRUE if the accelerator could be grabbed
25
+ */
26
+ function bind(keystring: string, handler: Handler, notify?: GLib.DestroyNotify | null): boolean;
27
+ function get_current_event_time(): number;
28
+ /**
29
+ * Initialize the keybinder library.
30
+ *
31
+ * This function must be called after initializing GTK, before calling any
32
+ * other function in the library. Can only be called once.
33
+ */
34
+ function init(): void;
35
+ /**
36
+ * "Cooked" accelerators use symbols produced by using modifiers such
37
+ * as shift or altgr, for example if "!" is produced by "Shift+1".
38
+ *
39
+ * If cooked accelerators are enabled, use "<Ctrl>exclam" to bind
40
+ * "Ctrl+!" If disabled, use "<Ctrl><Shift>1" to bind
41
+ * "Ctrl+Shift+1". These two examples are not equal on all keymaps.
42
+ *
43
+ * The cooked accelerator keyvalue and modifiers are provided by the
44
+ * function gdk_keymap_translate_keyboard_state()
45
+ *
46
+ * Cooked accelerators are useful if you receive keystrokes from GTK to bind,
47
+ * but raw accelerators can be useful if you or the user inputs accelerators as
48
+ * text.
49
+ *
50
+ * Default: Enabled. Should be set before binding anything.
51
+ * @param use_cooked if %FALSE disable cooked accelerators
52
+ */
53
+ function set_use_cooked_accelerators(use_cooked: boolean): void;
54
+ function supported(): boolean;
55
+ /**
56
+ * Unregister all previously bound callbacks for this keystring.
57
+ * @param keystring an accelerator description (gtk_accelerator_parse() format)
58
+ */
59
+ function unbind(keystring: string): void;
60
+ interface Handler {
61
+ (keystring: string): void;
62
+ }
63
+ /**
64
+ * Name of the imported GIR library
65
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
66
+ */
67
+ const __name__: string;
68
+ /**
69
+ * Version of the imported GIR library
70
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
71
+ */
72
+ const __version__: string;
73
+ }
74
+
75
+ export default Keybinder;
76
+ // END
@@ -0,0 +1,6 @@
1
+
2
+ // @ts-expect-error
3
+ import Keybinder from 'gi://Keybinder?version=3.0';
4
+ export { Keybinder };
5
+ export default Keybinder;
6
+
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@girs/keybinder-3.0",
3
+ "version": "3.0.0-4.0.0-beta.3",
4
+ "description": "GJS TypeScript type definitions for Keybinder-3.0, generated from library version 3.0.0",
5
+ "type": "module",
6
+ "module": "keybinder-3.0.js",
7
+ "main": "keybinder-3.0.js",
8
+ "exports": {
9
+ "./ambient": {
10
+ "types": "./keybinder-3.0-ambient.d.ts",
11
+ "import": "./keybinder-3.0-ambient.js",
12
+ "default": "./keybinder-3.0-ambient.js"
13
+ },
14
+ "./import": {
15
+ "types": "./keybinder-3.0-import.d.ts",
16
+ "import": "./keybinder-3.0-import.js",
17
+ "default": "./keybinder-3.0-import.js"
18
+ },
19
+ ".": {
20
+ "types": "./keybinder-3.0.d.ts",
21
+ "import": "./keybinder-3.0.js",
22
+ "default": "./keybinder-3.0.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit keybinder-3.0.d.ts"
27
+ },
28
+ "dependencies": {
29
+ "@girs/gjs": "^4.0.0-beta.3",
30
+ "@girs/glib-2.0": "^2.80.0-4.0.0-beta.3",
31
+ "@girs/gobject-2.0": "^2.80.0-4.0.0-beta.3"
32
+ },
33
+ "devDependencies": {
34
+ "typescript": "*"
35
+ },
36
+ "keywords": [
37
+ "Gir",
38
+ "TypeScript",
39
+ "types",
40
+ "GObject-Introspection",
41
+ "GJS",
42
+ "Keybinder-3.0"
43
+ ],
44
+ "author": "ts-for-gir",
45
+ "license": "MIT",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/gjsify/ts-for-gir.git"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/gjsify/ts-for-gir/issues"
52
+ },
53
+ "homepage": "https://github.com/gjsify/types/tree/main/keybinder-3.0#readme"
54
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ // General settings for code interpretation
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "lib": ["ESNext"],
7
+ "types": [],
8
+ "experimentalDecorators": true,
9
+ "moduleResolution": "node",
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": ["./keybinder-3.0.d.ts"]
21
+ }
22
+
23
+
package/typedoc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "entryPoints": ["./keybinder-3.0.d.ts"],
3
+ "readme": "./README.md",
4
+ "name": "Keybinder-3.0",
5
+ "tsconfig": "./tsconfig.json"
6
+ }
7
+