@girs/gtkspell-3.0 3.0.0-4.0.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 ADDED
@@ -0,0 +1,104 @@
1
+
2
+ # GtkSpell-3.0
3
+
4
+ ![version](https://img.shields.io/npm/v/@girs/gtkspell-3.0)
5
+ ![downloads/week](https://img.shields.io/npm/dw/@girs/gtkspell-3.0)
6
+
7
+
8
+ GJS TypeScript type definitions for GtkSpell-3.0, generated from library version 3.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0.
9
+
10
+
11
+ ## Install
12
+
13
+ To use this type definitions, install them with NPM:
14
+ ```bash
15
+ npm install @girs/gtkspell-3.0
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ You can import this package into your project like this:
21
+ ```ts
22
+ import GtkSpell from '@girs/gtkspell-3.0';
23
+ ```
24
+
25
+ Or if you prefer CommonJS, you can also use this:
26
+ ```ts
27
+ const GtkSpell = require('@girs/gtkspell-3.0');
28
+ ```
29
+
30
+ ### Ambient Modules
31
+
32
+ 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.
33
+ For this you need to include `@girs/gtkspell-3.0` or `@girs/gtkspell-3.0/ambient` in your `tsconfig` or entry point Typescript file:
34
+
35
+ `index.ts`:
36
+ ```ts
37
+ import '@girs/gtkspell-3.0'
38
+ ```
39
+
40
+ `tsconfig.json`:
41
+ ```json
42
+ {
43
+ "compilerOptions": {
44
+ ...
45
+ },
46
+ "include": ["@girs/gtkspell-3.0"],
47
+ ...
48
+ }
49
+ ```
50
+
51
+ Now you can import the ambient module with TypeScript support:
52
+
53
+ ```ts
54
+ import GtkSpell from 'gi://GtkSpell?version=3.0';
55
+ ```
56
+
57
+ ### Global import
58
+
59
+ You can also import the module with Typescript support using the global `imports.gi` object of GJS.
60
+ For this you need to include `@girs/gtkspell-3.0` or `@girs/gtkspell-3.0/import` in your `tsconfig` or entry point Typescript file:
61
+
62
+ `index.ts`:
63
+ ```ts
64
+ import '@girs/gtkspell-3.0'
65
+ ```
66
+
67
+ `tsconfig.json`:
68
+ ```json
69
+ {
70
+ "compilerOptions": {
71
+ ...
72
+ },
73
+ "include": ["@girs/gtkspell-3.0"],
74
+ ...
75
+ }
76
+ ```
77
+
78
+ Now you have also type support for this, too:
79
+
80
+ ```ts
81
+ const GtkSpell = imports.gi.GtkSpell;
82
+ ```
83
+
84
+
85
+ ### ESM vs. CommonJS
86
+
87
+ GJS supports two different import syntaxes. The new modern ESM syntax and the old global imports syntax.
88
+
89
+ In TypeScript projects for GJS and GNOME Shell extensions, you have the flexibility to use `ESM` syntax and then decide the import syntax for your bundled file. If your bundler is configured to use `CommonJS`, it will convert to the GJS-specific global imports syntax, like `const moduleName = imports.gi[moduleName]`. This is different from the traditional `require` syntax seen in Node.js. The global imports syntax is chosen because it aligns with the CommonJS format supported by NPM, which is used for the generated type definitions and this package.
90
+
91
+ On the other hand, if you configure your bundler to use ESM, it will retain the ESM import syntax. It's crucial to ensure that your bundler is set up to correctly translate and bundle these imports into either CommonJS or ESM format, depending on your project's requirements.
92
+
93
+ This approach is particularly important due to the `@girs` types, which include both `*.cjs `files, using the GJS global imports syntax, and `*.js` files, which utilize the ESM syntax. By appropriately setting up your bundler, you can control which syntax—CommonJS or ESM—is used in your project. The choice of CommonJS in this context is also due to the similarity between the GJS-specific global imports and CommonJS syntax, allowing for easier management and bundling in these specific types of projects.
94
+
95
+ Since GNOME Shell 45, you should only use ESM, even for GNOME Shell extensions. Before that, extensions had to use the global import syntax, unlike normal GJS applications, where ESM has been available for some time.
96
+
97
+ ### Bundle
98
+
99
+ 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).
100
+
101
+ ## Other packages
102
+
103
+ All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
104
+
@@ -0,0 +1,12 @@
1
+
2
+ declare module 'gi://GtkSpell?version=3.0' {
3
+ import GtkSpell from '@girs/gtkspell-3.0';
4
+ export default GtkSpell;
5
+ }
6
+
7
+ declare module 'gi://GtkSpell' {
8
+ import GtkSpell30 from 'gi://GtkSpell?version=3.0';
9
+ export default GtkSpell30;
10
+ }
11
+
12
+
@@ -0,0 +1,2 @@
1
+ export {}
2
+
@@ -0,0 +1,12 @@
1
+
2
+ import GtkSpell30 from '@girs/gtkspell-3.0';
3
+
4
+ declare global {
5
+ export interface GjsGiImports {
6
+ GtkSpell: typeof GtkSpell30;
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,213 @@
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 './gtkspell-3.0-ambient.d.ts';
9
+
10
+ /**
11
+ * GtkSpell-3.0
12
+ */
13
+
14
+ import type Gtk from '@girs/gtk-3.0';
15
+ import type xlib from '@girs/xlib-2.0';
16
+ import type Gdk from '@girs/gdk-3.0';
17
+ import type cairo from '@girs/cairo-1.0';
18
+ import type GObject from '@girs/gobject-2.0';
19
+ import type GLib from '@girs/glib-2.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 Gio from '@girs/gio-2.0';
24
+ import type GdkPixbuf from '@girs/gdkpixbuf-2.0';
25
+ import type GModule from '@girs/gmodule-2.0';
26
+ import type Atk from '@girs/atk-1.0';
27
+
28
+ export namespace GtkSpell {
29
+ /**
30
+ * Error codes used for GtkSpell errors.
31
+ */
32
+ class Error extends GLib.Error {
33
+ static $gtype: GObject.GType<Error>;
34
+
35
+ // Static fields of GtkSpell.Error
36
+
37
+ /**
38
+ * Error code for backend errors
39
+ */
40
+ static BACKEND: number;
41
+
42
+ // Constructors of GtkSpell.Error
43
+
44
+ constructor(options: { message: string; code: number });
45
+ _init(...args: any[]): void;
46
+
47
+ // Own static methods of GtkSpell.Error
48
+
49
+ static quark(): GLib.Quark;
50
+ }
51
+
52
+ function error_quark(): GLib.Quark;
53
+ module Checker {
54
+ // Signal callback interfaces
55
+
56
+ interface LanguageChanged {
57
+ (lang: string): void;
58
+ }
59
+
60
+ // Constructor properties interface
61
+
62
+ interface ConstructorProps extends GObject.InitiallyUnowned.ConstructorProps {
63
+ decode_language_codes: boolean;
64
+ decodeLanguageCodes: boolean;
65
+ }
66
+ }
67
+
68
+ /**
69
+ * The #GtkSpellChecker struct contains only private fields.
70
+ */
71
+ class Checker extends GObject.InitiallyUnowned {
72
+ static $gtype: GObject.GType<Checker>;
73
+
74
+ // Own properties of GtkSpell.Checker
75
+
76
+ get decode_language_codes(): boolean;
77
+ set decode_language_codes(val: boolean);
78
+ get decodeLanguageCodes(): boolean;
79
+ set decodeLanguageCodes(val: boolean);
80
+
81
+ // Constructors of GtkSpell.Checker
82
+
83
+ constructor(properties?: Partial<Checker.ConstructorProps>, ...args: any[]);
84
+
85
+ _init(...args: any[]): void;
86
+
87
+ static ['new'](): Checker;
88
+
89
+ // Own signals of GtkSpell.Checker
90
+
91
+ connect(id: string, callback: (...args: any[]) => any): number;
92
+ connect_after(id: string, callback: (...args: any[]) => any): number;
93
+ emit(id: string, ...args: any[]): void;
94
+ connect(signal: 'language-changed', callback: (_source: this, lang: string) => void): number;
95
+ connect_after(signal: 'language-changed', callback: (_source: this, lang: string) => void): number;
96
+ emit(signal: 'language-changed', lang: string): void;
97
+
98
+ // Own static methods of GtkSpell.Checker
99
+
100
+ /**
101
+ * Translates the language code to a human readable format
102
+ * (i.e. "en_US" -> "English (United States)").
103
+ * Note: If the iso-codes package is not available, the unchanged code is
104
+ * returned.
105
+ * @param lang The language locale specifier (i.e. "en_US").
106
+ */
107
+ static decode_language_code(lang: string): string;
108
+ /**
109
+ * Retrieves the #GtkSpellChecker object attached to a text view.
110
+ * @param view A #GtkTextView.
111
+ */
112
+ static get_from_text_view(view: Gtk.TextView): Checker;
113
+ /**
114
+ * Requests the list of available languages from the enchant broker.
115
+ */
116
+ static get_language_list(): string[];
117
+
118
+ // Own virtual methods of GtkSpell.Checker
119
+
120
+ vfunc_language_changed(new_lang: string): void;
121
+
122
+ // Own methods of GtkSpell.Checker
123
+
124
+ /**
125
+ * Add the specified word to the user dictionary.
126
+ * @param word The word to add to the user dictionary.
127
+ */
128
+ add_to_dictionary(word: string): void;
129
+ /**
130
+ * Attach #GtkSpellChecker object to `view`.
131
+ *
132
+ * Note: Please read the tutorial section of the documentation to make sure
133
+ * you don't leak references!
134
+ * @param view The #GtkTextView to attach to.
135
+ * @returns TRUE on success, FALSE on failure.
136
+ */
137
+ attach(view: Gtk.TextView): boolean;
138
+ /**
139
+ * Check the specified word.
140
+ * @param word The word to check.
141
+ * @returns TRUE if the word is correctly spelled, FALSE otherwise.
142
+ */
143
+ check_word(word: string): boolean;
144
+ /**
145
+ * Detaches this #GtkSpellChecker from its #GtkTextView. Use
146
+ * gtk_spell_checker_get_from_text_view () to retrieve a #GtkSpellChecker from
147
+ * a #GtkTextView. If the #GtkSpellChecker is not attached to any #GtkTextView,
148
+ * the function silently exits.
149
+ *
150
+ * Note: if the #GtkSpellChecker is owned by the #GtkTextView, you must
151
+ * take a reference to it to prevent it from being automatically destroyed.
152
+ * Please read the tutorial section of the documentation!
153
+ */
154
+ detach(): void;
155
+ /**
156
+ * Fetches the current language.
157
+ * @returns the current language. This string is owned by the spell object and must not be modified or freed.
158
+ */
159
+ get_language(): string;
160
+ /**
161
+ * Retreives a list of spelling suggestions for the specified word.
162
+ * @param word The word for which to fetch suggestions
163
+ * @returns the list of spelling suggestions for the specified word, or NULL if there are no suggestions.
164
+ */
165
+ get_suggestions(word: string): string[];
166
+ /**
167
+ * Retrieves a submenu of replacement spellings, or NULL if the word at `iter` is
168
+ * not misspelt.
169
+ * @param iter Textiter of position in buffer to be corrected if necessary.
170
+ * @returns the #GtkMenu widget, or %NULL if there is no need for a menu
171
+ */
172
+ get_suggestions_menu(iter: Gtk.TextIter): Gtk.Widget;
173
+ /**
174
+ * Add the specified word to the user ignore list.
175
+ * @param word The word to add to the user ignore list.
176
+ */
177
+ ignore_word(word: string): void;
178
+ /**
179
+ * Recheck the spelling in the entire buffer.
180
+ */
181
+ recheck_all(): void;
182
+ /**
183
+ * Set the language on `spell` to `lang,` possibily returning an error in
184
+ * `error`.
185
+ * @param lang The language to use, as a locale specifier (i.e. "en_US"). If #NULL, attempt to use the default system locale (LANG).
186
+ * @returns FALSE if there was an error.
187
+ */
188
+ set_language(lang?: string | null): boolean;
189
+ }
190
+
191
+ type CheckerClass = typeof Checker;
192
+ abstract class CheckerPrivate {
193
+ static $gtype: GObject.GType<CheckerPrivate>;
194
+
195
+ // Constructors of GtkSpell.CheckerPrivate
196
+
197
+ _init(...args: any[]): void;
198
+ }
199
+
200
+ /**
201
+ * Name of the imported GIR library
202
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
203
+ */
204
+ const __name__: string;
205
+ /**
206
+ * Version of the imported GIR library
207
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
208
+ */
209
+ const __version__: string;
210
+ }
211
+
212
+ export default GtkSpell;
213
+ // END
@@ -0,0 +1,6 @@
1
+
2
+ // @ts-expect-error
3
+ import GtkSpell from 'gi://GtkSpell?version=3.0';
4
+ export { GtkSpell };
5
+ export default GtkSpell;
6
+
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@girs/gtkspell-3.0",
3
+ "version": "3.0.0-4.0.0",
4
+ "description": "GJS TypeScript type definitions for GtkSpell-3.0, generated from library version 3.0.0",
5
+ "type": "module",
6
+ "module": "gtkspell-3.0.js",
7
+ "main": "gtkspell-3.0.js",
8
+ "exports": {
9
+ "./ambient": {
10
+ "types": "./gtkspell-3.0-ambient.d.ts",
11
+ "import": "./gtkspell-3.0-ambient.js",
12
+ "default": "./gtkspell-3.0-ambient.js"
13
+ },
14
+ "./import": {
15
+ "types": "./gtkspell-3.0-import.d.ts",
16
+ "import": "./gtkspell-3.0-import.js",
17
+ "default": "./gtkspell-3.0-import.js"
18
+ },
19
+ ".": {
20
+ "types": "./gtkspell-3.0.d.ts",
21
+ "import": "./gtkspell-3.0.js",
22
+ "default": "./gtkspell-3.0.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gtkspell-3.0.d.ts"
27
+ },
28
+ "dependencies": {
29
+ "@girs/atk-1.0": "^2.45.1-4.0.0-beta.1",
30
+ "@girs/cairo-1.0": "^1.0.0-4.0.0-beta.1",
31
+ "@girs/freetype2-2.0": "^2.0.0-4.0.0-beta.1",
32
+ "@girs/gdk-3.0": "^3.24.39-4.0.0-beta.1",
33
+ "@girs/gdkpixbuf-2.0": "^2.0.0-4.0.0-beta.1",
34
+ "@girs/gio-2.0": "^2.77.0-4.0.0-beta.1",
35
+ "@girs/gjs": "^4.0.0-beta.1",
36
+ "@girs/glib-2.0": "^2.77.0-4.0.0-beta.1",
37
+ "@girs/gmodule-2.0": "^2.0.0-4.0.0-beta.1",
38
+ "@girs/gobject-2.0": "^2.77.0-4.0.0-beta.1",
39
+ "@girs/gtk-3.0": "^3.24.39-4.0.0-beta.1",
40
+ "@girs/harfbuzz-0.0": "^8.1.1-4.0.0-beta.1",
41
+ "@girs/pango-1.0": "^1.51.0-4.0.0-beta.1",
42
+ "@girs/xlib-2.0": "^2.0.0-4.0.0-beta.1"
43
+ },
44
+ "devDependencies": {
45
+ "typescript": "*"
46
+ },
47
+ "keywords": [
48
+ "Gir",
49
+ "TypeScript",
50
+ "types",
51
+ "GObject-Introspection",
52
+ "GJS",
53
+ "GtkSpell-3.0"
54
+ ],
55
+ "author": "ts-for-gir",
56
+ "license": "MIT",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/gjsify/ts-for-gir.git"
60
+ },
61
+ "bugs": {
62
+ "url": "https://github.com/gjsify/ts-for-gir/issues"
63
+ },
64
+ "homepage": "https://github.com/gjsify/types/tree/main/gtkspell-3.0#readme"
65
+ }
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": ["./gtkspell-3.0.d.ts"]
21
+ }
22
+
23
+
package/typedoc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "entryPoints": ["./gtkspell-3.0.d.ts"],
3
+ "readme": "./README.md",
4
+ "name": "GtkSpell-3.0",
5
+ "tsconfig": "./tsconfig.json"
6
+ }
7
+