@girs/gci-1 1.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 +104 -0
- package/gci-1-ambient.d.ts +12 -0
- package/gci-1-ambient.js +2 -0
- package/gci-1-import.d.ts +12 -0
- package/gci-1-import.js +3 -0
- package/gci-1.d.ts +84 -0
- package/gci-1.js +6 -0
- package/package.json +66 -0
- package/tsconfig.json +23 -0
- package/typedoc.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
|
|
2
|
+
# GCi-1
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
GJS TypeScript type definitions for GCi-1, generated from library version 1.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/gci-1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
You can import this package into your project like this:
|
|
21
|
+
```ts
|
|
22
|
+
import GCi from '@girs/gci-1';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or if you prefer CommonJS, you can also use this:
|
|
26
|
+
```ts
|
|
27
|
+
const GCi = require('@girs/gci-1');
|
|
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/gci-1` or `@girs/gci-1/ambient` in your `tsconfig` or entry point Typescript file:
|
|
34
|
+
|
|
35
|
+
`index.ts`:
|
|
36
|
+
```ts
|
|
37
|
+
import '@girs/gci-1'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`tsconfig.json`:
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"compilerOptions": {
|
|
44
|
+
...
|
|
45
|
+
},
|
|
46
|
+
"include": ["@girs/gci-1"],
|
|
47
|
+
...
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Now you can import the ambient module with TypeScript support:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import GCi from 'gi://GCi?version=1';
|
|
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/gci-1` or `@girs/gci-1/import` in your `tsconfig` or entry point Typescript file:
|
|
61
|
+
|
|
62
|
+
`index.ts`:
|
|
63
|
+
```ts
|
|
64
|
+
import '@girs/gci-1'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`tsconfig.json`:
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"compilerOptions": {
|
|
71
|
+
...
|
|
72
|
+
},
|
|
73
|
+
"include": ["@girs/gci-1"],
|
|
74
|
+
...
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Now you have also type support for this, too:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const GCi = imports.gi.GCi;
|
|
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
|
+
|
package/gci-1-ambient.js
ADDED
package/gci-1-import.js
ADDED
package/gci-1.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
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 './gci-1-ambient.d.ts';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* GCi-1
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type Gtk from '@girs/gtk-4.0';
|
|
15
|
+
import type Gsk from '@girs/gsk-4.0';
|
|
16
|
+
import type Graphene from '@girs/graphene-1.0';
|
|
17
|
+
import type GObject from '@girs/gobject-2.0';
|
|
18
|
+
import type GLib from '@girs/glib-2.0';
|
|
19
|
+
import type Gdk from '@girs/gdk-4.0';
|
|
20
|
+
import type cairo from '@girs/cairo-1.0';
|
|
21
|
+
import type PangoCairo from '@girs/pangocairo-1.0';
|
|
22
|
+
import type Pango from '@girs/pango-1.0';
|
|
23
|
+
import type HarfBuzz from '@girs/harfbuzz-0.0';
|
|
24
|
+
import type freetype2 from '@girs/freetype2-2.0';
|
|
25
|
+
import type Gio from '@girs/gio-2.0';
|
|
26
|
+
import type GdkPixbuf from '@girs/gdkpixbuf-2.0';
|
|
27
|
+
import type GModule from '@girs/gmodule-2.0';
|
|
28
|
+
|
|
29
|
+
export namespace GCi {
|
|
30
|
+
module EntryController {
|
|
31
|
+
// Constructor properties interface
|
|
32
|
+
|
|
33
|
+
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
34
|
+
entry: Gtk.Entry;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
class EntryController extends GObject.Object {
|
|
39
|
+
static $gtype: GObject.GType<EntryController>;
|
|
40
|
+
|
|
41
|
+
// Own properties of GCi.EntryController
|
|
42
|
+
|
|
43
|
+
get entry(): Gtk.Entry;
|
|
44
|
+
set entry(val: Gtk.Entry);
|
|
45
|
+
|
|
46
|
+
// Constructors of GCi.EntryController
|
|
47
|
+
|
|
48
|
+
constructor(properties?: Partial<EntryController.ConstructorProps>, ...args: any[]);
|
|
49
|
+
|
|
50
|
+
_init(...args: any[]): void;
|
|
51
|
+
|
|
52
|
+
static for_entry(entry: Gtk.Entry): EntryController;
|
|
53
|
+
|
|
54
|
+
static ['new'](): EntryController;
|
|
55
|
+
|
|
56
|
+
// Own methods of GCi.EntryController
|
|
57
|
+
|
|
58
|
+
get_entry(): Gtk.Entry;
|
|
59
|
+
set_entry(value: Gtk.Entry): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
type EntryControllerClass = typeof EntryController;
|
|
63
|
+
abstract class EntryControllerPrivate {
|
|
64
|
+
static $gtype: GObject.GType<EntryControllerPrivate>;
|
|
65
|
+
|
|
66
|
+
// Constructors of GCi.EntryControllerPrivate
|
|
67
|
+
|
|
68
|
+
_init(...args: any[]): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Name of the imported GIR library
|
|
73
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
74
|
+
*/
|
|
75
|
+
const __name__: string;
|
|
76
|
+
/**
|
|
77
|
+
* Version of the imported GIR library
|
|
78
|
+
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
79
|
+
*/
|
|
80
|
+
const __version__: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default GCi;
|
|
84
|
+
// END
|
package/gci-1.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@girs/gci-1",
|
|
3
|
+
"version": "1.0.0-4.0.0",
|
|
4
|
+
"description": "GJS TypeScript type definitions for GCi-1, generated from library version 1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "gci-1.js",
|
|
7
|
+
"main": "gci-1.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./ambient": {
|
|
10
|
+
"types": "./gci-1-ambient.d.ts",
|
|
11
|
+
"import": "./gci-1-ambient.js",
|
|
12
|
+
"default": "./gci-1-ambient.js"
|
|
13
|
+
},
|
|
14
|
+
"./import": {
|
|
15
|
+
"types": "./gci-1-import.d.ts",
|
|
16
|
+
"import": "./gci-1-import.js",
|
|
17
|
+
"default": "./gci-1-import.js"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./gci-1.d.ts",
|
|
21
|
+
"import": "./gci-1.js",
|
|
22
|
+
"default": "./gci-1.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gci-1.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@girs/cairo-1.0": "^1.0.0-4.0.0-beta.1",
|
|
30
|
+
"@girs/freetype2-2.0": "^2.0.0-4.0.0-beta.1",
|
|
31
|
+
"@girs/gdk-4.0": "^4.0.0-4.0.0-beta.1",
|
|
32
|
+
"@girs/gdkpixbuf-2.0": "^2.0.0-4.0.0-beta.1",
|
|
33
|
+
"@girs/gio-2.0": "^2.77.0-4.0.0-beta.1",
|
|
34
|
+
"@girs/gjs": "^4.0.0-beta.1",
|
|
35
|
+
"@girs/glib-2.0": "^2.77.0-4.0.0-beta.1",
|
|
36
|
+
"@girs/gmodule-2.0": "^2.0.0-4.0.0-beta.1",
|
|
37
|
+
"@girs/gobject-2.0": "^2.77.0-4.0.0-beta.1",
|
|
38
|
+
"@girs/graphene-1.0": "^1.0.0-4.0.0-beta.1",
|
|
39
|
+
"@girs/gsk-4.0": "^4.0.0-4.0.0-beta.1",
|
|
40
|
+
"@girs/gtk-4.0": "^4.12.0-4.0.0-beta.1",
|
|
41
|
+
"@girs/harfbuzz-0.0": "^8.1.1-4.0.0-beta.1",
|
|
42
|
+
"@girs/pango-1.0": "^1.51.0-4.0.0-beta.1",
|
|
43
|
+
"@girs/pangocairo-1.0": "^1.0.0-4.0.0-beta.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"typescript": "*"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"Gir",
|
|
50
|
+
"TypeScript",
|
|
51
|
+
"types",
|
|
52
|
+
"GObject-Introspection",
|
|
53
|
+
"GJS",
|
|
54
|
+
"GCi-1"
|
|
55
|
+
],
|
|
56
|
+
"author": "ts-for-gir",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "git+https://github.com/gjsify/ts-for-gir.git"
|
|
61
|
+
},
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://github.com/gjsify/types/tree/main/gci-1#readme"
|
|
66
|
+
}
|
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": ["./gci-1.d.ts"]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|