@girs/mtk-14 14.0.0-3.3.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/mtk-14-ambient.d.ts +12 -0
- package/mtk-14-ambient.js +2 -0
- package/mtk-14-import.d.ts +12 -0
- package/mtk-14-import.js +3 -0
- package/mtk-14.cjs +11 -0
- package/mtk-14.d.cts +271 -0
- package/mtk-14.d.ts +276 -0
- package/mtk-14.js +10 -0
- package/package.json +60 -0
- package/tsconfig.json +23 -0
- package/typedoc.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
|
|
2
|
+
# Mtk-14
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
GJS TypeScript type definitions for Mtk-14, generated from library version 14.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.3.0.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
To use this type definitions, install them with NPM:
|
|
14
|
+
```bash
|
|
15
|
+
npm install @girs/mtk-14
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
You can import this package into your project like this:
|
|
21
|
+
```ts
|
|
22
|
+
import Mtk from '@girs/mtk-14';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or if you prefer CommonJS, you can also use this:
|
|
26
|
+
```ts
|
|
27
|
+
const Mtk = require('@girs/mtk-14');
|
|
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/mtk-14` or `@girs/mtk-14/ambient` in your `tsconfig` or entry point Typescript file:
|
|
34
|
+
|
|
35
|
+
`index.ts`:
|
|
36
|
+
```ts
|
|
37
|
+
import '@girs/mtk-14'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`tsconfig.json`:
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"compilerOptions": {
|
|
44
|
+
...
|
|
45
|
+
},
|
|
46
|
+
"include": ["@girs/mtk-14"],
|
|
47
|
+
...
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Now you can import the ambient module with TypeScript support:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import Mtk from 'gi://Mtk?version=14';
|
|
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/mtk-14` or `@girs/mtk-14/import` in your `tsconfig` or entry point Typescript file:
|
|
61
|
+
|
|
62
|
+
`index.ts`:
|
|
63
|
+
```ts
|
|
64
|
+
import '@girs/mtk-14'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`tsconfig.json`:
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"compilerOptions": {
|
|
71
|
+
...
|
|
72
|
+
},
|
|
73
|
+
"include": ["@girs/mtk-14"],
|
|
74
|
+
...
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Now you have also type support for this, too:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const Mtk = imports.gi.Mtk;
|
|
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/mtk-14-import.js
ADDED
package/mtk-14.cjs
ADDED
package/mtk-14.d.cts
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* Type Definitions for Gjs (https://gjs.guide/)
|
|
4
|
+
*
|
|
5
|
+
* These type definitions are automatically generated, do not edit them by hand.
|
|
6
|
+
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import './mtk-14-ambient.d.ts';
|
|
10
|
+
import './mtk-14-import.d.ts';
|
|
11
|
+
/**
|
|
12
|
+
* Mtk-14
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type Graphene from '@girs/graphene-1.0';
|
|
16
|
+
import type GObject from '@girs/gobject-2.0';
|
|
17
|
+
import type GLib from '@girs/glib-2.0';
|
|
18
|
+
|
|
19
|
+
export enum RegionOverlap {
|
|
20
|
+
OUT,
|
|
21
|
+
IN,
|
|
22
|
+
PART,
|
|
23
|
+
}
|
|
24
|
+
export enum RoundingStrategy {
|
|
25
|
+
SHRINK,
|
|
26
|
+
GROW,
|
|
27
|
+
ROUND,
|
|
28
|
+
}
|
|
29
|
+
export const RECTANGLE_MAX_STACK_RECTS: number
|
|
30
|
+
export const REGION_BUILDER_MAX_LEVELS: number
|
|
31
|
+
export function rectangle_from_graphene_rect(rect: Graphene.Rect, rounding_strategy: RoundingStrategy): /* dest */ Rectangle
|
|
32
|
+
export function region_create(): Region
|
|
33
|
+
export function region_create_rectangle(rect: Rectangle): Region
|
|
34
|
+
export function region_create_rectangles(rects: Rectangle, n_rects: number): Region
|
|
35
|
+
export function x11_errors_deinit(): void
|
|
36
|
+
export interface Rectangle {
|
|
37
|
+
|
|
38
|
+
// Own fields of Mtk-14.Mtk.Rectangle
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* X coordinate of the top-left corner
|
|
42
|
+
* @field
|
|
43
|
+
*/
|
|
44
|
+
x: number
|
|
45
|
+
/**
|
|
46
|
+
* Y coordinate of the top-left corner
|
|
47
|
+
* @field
|
|
48
|
+
*/
|
|
49
|
+
y: number
|
|
50
|
+
/**
|
|
51
|
+
* Width of the rectangle
|
|
52
|
+
* @field
|
|
53
|
+
*/
|
|
54
|
+
width: number
|
|
55
|
+
/**
|
|
56
|
+
* Height of the rectangle
|
|
57
|
+
* @field
|
|
58
|
+
*/
|
|
59
|
+
height: number
|
|
60
|
+
|
|
61
|
+
// Owm methods of Mtk-14.Mtk.Rectangle
|
|
62
|
+
|
|
63
|
+
area(): number
|
|
64
|
+
contains_rect(inner_rect: Rectangle): boolean
|
|
65
|
+
copy(): Rectangle
|
|
66
|
+
could_fit_rect(inner_rect: Rectangle): boolean
|
|
67
|
+
crop_and_scale(src_rect: Graphene.Rect, dst_width: number, dst_height: number, dest: Rectangle): void
|
|
68
|
+
/**
|
|
69
|
+
* Compares the two rectangles
|
|
70
|
+
* @param src2 The second rectangle
|
|
71
|
+
* @returns Whether the two rectangles are equal
|
|
72
|
+
*/
|
|
73
|
+
equal(src2: Rectangle): boolean
|
|
74
|
+
free(): void
|
|
75
|
+
/**
|
|
76
|
+
* Similar to [method`Rectangle`.overlap] but ignores the vertical location.
|
|
77
|
+
* @param rect2 The second rectangle
|
|
78
|
+
* @returns Whether the two rectangles overlap horizontally
|
|
79
|
+
*/
|
|
80
|
+
horiz_overlap(rect2: Rectangle): boolean
|
|
81
|
+
/**
|
|
82
|
+
* Find the intersection between the two rectangles
|
|
83
|
+
* @param src2 another #MtkRectangle
|
|
84
|
+
* @returns TRUE is some intersection exists and is not degenerate, FALSE otherwise.
|
|
85
|
+
*/
|
|
86
|
+
intersect(src2: Rectangle): [ /* returnType */ boolean, /* dest */ Rectangle ]
|
|
87
|
+
is_adjacent_to(other: Rectangle): boolean
|
|
88
|
+
/**
|
|
89
|
+
* Similar to [method`Rectangle`.intersect] but doesn't provide
|
|
90
|
+
* the location of the intersection.
|
|
91
|
+
* @param rect2 The second rectangle
|
|
92
|
+
* @returns Whether the two rectangles overlap
|
|
93
|
+
*/
|
|
94
|
+
overlap(rect2: Rectangle): boolean
|
|
95
|
+
scale_double(scale: number, rounding_strategy: RoundingStrategy, dest: Rectangle): void
|
|
96
|
+
to_graphene_rect(): Graphene.Rect
|
|
97
|
+
/**
|
|
98
|
+
* Computes the union of the two rectangles
|
|
99
|
+
* @param rect2 another #MtkRectangle
|
|
100
|
+
*/
|
|
101
|
+
union(rect2: Rectangle): /* dest */ Rectangle
|
|
102
|
+
/**
|
|
103
|
+
* Similar to [method`Rectangle`.overlap] but ignores the horizontal location.
|
|
104
|
+
* @param rect2 The second rectangle
|
|
105
|
+
* @returns Whether the two rectangles overlap vertically
|
|
106
|
+
*/
|
|
107
|
+
vert_overlap(rect2: Rectangle): boolean
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export class Rectangle {
|
|
111
|
+
|
|
112
|
+
// Own properties of Mtk-14.Mtk.Rectangle
|
|
113
|
+
|
|
114
|
+
static name: string
|
|
115
|
+
|
|
116
|
+
// Constructors of Mtk-14.Mtk.Rectangle
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new rectangle
|
|
120
|
+
* @constructor
|
|
121
|
+
* @param x X coordinate of the top left corner
|
|
122
|
+
* @param y Y coordinate of the top left corner
|
|
123
|
+
* @param width Width of the rectangle
|
|
124
|
+
* @param height Height of the rectangle
|
|
125
|
+
*/
|
|
126
|
+
constructor(x: number, y: number, width: number, height: number)
|
|
127
|
+
/**
|
|
128
|
+
* Creates a new rectangle
|
|
129
|
+
* @constructor
|
|
130
|
+
* @param x X coordinate of the top left corner
|
|
131
|
+
* @param y Y coordinate of the top left corner
|
|
132
|
+
* @param width Width of the rectangle
|
|
133
|
+
* @param height Height of the rectangle
|
|
134
|
+
*/
|
|
135
|
+
static new(x: number, y: number, width: number, height: number): Rectangle
|
|
136
|
+
static from_graphene_rect(rect: Graphene.Rect, rounding_strategy: RoundingStrategy): /* dest */ Rectangle
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface Region {
|
|
140
|
+
|
|
141
|
+
// Owm methods of Mtk-14.Mtk.Region
|
|
142
|
+
|
|
143
|
+
apply_matrix_transform_expand(transform: Graphene.Matrix): Region
|
|
144
|
+
contains_point(x: number, y: number): boolean
|
|
145
|
+
contains_rectangle(rect: Rectangle): RegionOverlap
|
|
146
|
+
copy(): Region
|
|
147
|
+
crop_and_scale(src_rect: Graphene.Rect, dst_width: number, dst_height: number): Region
|
|
148
|
+
equal(other: Region): boolean
|
|
149
|
+
get_extents(): Rectangle
|
|
150
|
+
get_rectangle(nth: number): Rectangle
|
|
151
|
+
intersect(other: Region): void
|
|
152
|
+
intersect_rectangle(rect: Rectangle): void
|
|
153
|
+
is_empty(): boolean
|
|
154
|
+
num_rectangles(): number
|
|
155
|
+
/**
|
|
156
|
+
* Increases the reference count
|
|
157
|
+
* @returns The region
|
|
158
|
+
*/
|
|
159
|
+
ref(): Region
|
|
160
|
+
scale(scale: number): Region
|
|
161
|
+
subtract(other: Region): void
|
|
162
|
+
subtract_rectangle(rect: Rectangle): void
|
|
163
|
+
translate(dx: number, dy: number): void
|
|
164
|
+
union(other: Region): void
|
|
165
|
+
union_rectangle(rect: Rectangle): void
|
|
166
|
+
unref(): void
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export class Region {
|
|
170
|
+
|
|
171
|
+
// Own properties of Mtk-14.Mtk.Region
|
|
172
|
+
|
|
173
|
+
static name: string
|
|
174
|
+
|
|
175
|
+
// Constructors of Mtk-14.Mtk.Region
|
|
176
|
+
|
|
177
|
+
static create(): Region
|
|
178
|
+
static create_rectangle(rect: Rectangle): Region
|
|
179
|
+
static create_rectangles(rects: Rectangle, n_rects: number): Region
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface RegionBuilder {
|
|
183
|
+
|
|
184
|
+
// Own fields of Mtk-14.Mtk.RegionBuilder
|
|
185
|
+
|
|
186
|
+
levels: Region[]
|
|
187
|
+
n_levels: number
|
|
188
|
+
|
|
189
|
+
// Owm methods of Mtk-14.Mtk.RegionBuilder
|
|
190
|
+
|
|
191
|
+
add_rectangle(x: number, y: number, width: number, height: number): void
|
|
192
|
+
finish(): Region
|
|
193
|
+
init(): void
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export class RegionBuilder {
|
|
197
|
+
|
|
198
|
+
// Own properties of Mtk-14.Mtk.RegionBuilder
|
|
199
|
+
|
|
200
|
+
static name: string
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface RegionIterator {
|
|
204
|
+
|
|
205
|
+
// Own fields of Mtk-14.Mtk.RegionIterator
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* region being iterated
|
|
209
|
+
* @field
|
|
210
|
+
*/
|
|
211
|
+
region: Region
|
|
212
|
+
/**
|
|
213
|
+
* current rectangle
|
|
214
|
+
* @field
|
|
215
|
+
*/
|
|
216
|
+
rectangle: Rectangle
|
|
217
|
+
/**
|
|
218
|
+
* whether the current rectangle starts a horizontal band
|
|
219
|
+
* @field
|
|
220
|
+
*/
|
|
221
|
+
line_start: boolean
|
|
222
|
+
/**
|
|
223
|
+
* whether the current rectangle ends a horizontal band
|
|
224
|
+
* @field
|
|
225
|
+
*/
|
|
226
|
+
line_end: boolean
|
|
227
|
+
i: number
|
|
228
|
+
|
|
229
|
+
// Owm methods of Mtk-14.Mtk.RegionIterator
|
|
230
|
+
|
|
231
|
+
at_end(): boolean
|
|
232
|
+
init(region: Region): void
|
|
233
|
+
next(): void
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* MtkRegion is a yx banded region; sometimes its useful to iterate through
|
|
238
|
+
* such a region treating the start and end of each horizontal band in a distinct
|
|
239
|
+
* fashion.
|
|
240
|
+
*
|
|
241
|
+
* Usage:
|
|
242
|
+
*
|
|
243
|
+
* ```c
|
|
244
|
+
* MtkRegionIterator iter;
|
|
245
|
+
* for (mtk_region_iterator_init (&iter, region);
|
|
246
|
+
* !mtk_region_iterator_at_end (&iter);
|
|
247
|
+
* mtk_region_iterator_next (&iter))
|
|
248
|
+
* {
|
|
249
|
+
* [ Use iter.rectangle, iter.line_start, iter.line_end ]
|
|
250
|
+
* }
|
|
251
|
+
* ```
|
|
252
|
+
* @record
|
|
253
|
+
*/
|
|
254
|
+
export class RegionIterator {
|
|
255
|
+
|
|
256
|
+
// Own properties of Mtk-14.Mtk.RegionIterator
|
|
257
|
+
|
|
258
|
+
static name: string
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Name of the imported GIR library
|
|
263
|
+
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
264
|
+
*/
|
|
265
|
+
export const __name__: string
|
|
266
|
+
/**
|
|
267
|
+
* Version of the imported GIR library
|
|
268
|
+
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
269
|
+
*/
|
|
270
|
+
export const __version__: string
|
|
271
|
+
// END
|
package/mtk-14.d.ts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* Type Definitions for Gjs (https://gjs.guide/)
|
|
4
|
+
*
|
|
5
|
+
* These type definitions are automatically generated, do not edit them by hand.
|
|
6
|
+
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import './mtk-14-ambient.d.ts';
|
|
10
|
+
import './mtk-14-import.d.ts';
|
|
11
|
+
/**
|
|
12
|
+
* Mtk-14
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type Graphene from '@girs/graphene-1.0';
|
|
16
|
+
import type GObject from '@girs/gobject-2.0';
|
|
17
|
+
import type GLib from '@girs/glib-2.0';
|
|
18
|
+
|
|
19
|
+
export namespace Mtk {
|
|
20
|
+
|
|
21
|
+
enum RegionOverlap {
|
|
22
|
+
OUT,
|
|
23
|
+
IN,
|
|
24
|
+
PART,
|
|
25
|
+
}
|
|
26
|
+
enum RoundingStrategy {
|
|
27
|
+
SHRINK,
|
|
28
|
+
GROW,
|
|
29
|
+
ROUND,
|
|
30
|
+
}
|
|
31
|
+
const RECTANGLE_MAX_STACK_RECTS: number
|
|
32
|
+
const REGION_BUILDER_MAX_LEVELS: number
|
|
33
|
+
function rectangle_from_graphene_rect(rect: Graphene.Rect, rounding_strategy: RoundingStrategy): /* dest */ Rectangle
|
|
34
|
+
function region_create(): Region
|
|
35
|
+
function region_create_rectangle(rect: Rectangle): Region
|
|
36
|
+
function region_create_rectangles(rects: Rectangle, n_rects: number): Region
|
|
37
|
+
function x11_errors_deinit(): void
|
|
38
|
+
interface Rectangle {
|
|
39
|
+
|
|
40
|
+
// Own fields of Mtk-14.Mtk.Rectangle
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* X coordinate of the top-left corner
|
|
44
|
+
* @field
|
|
45
|
+
*/
|
|
46
|
+
x: number
|
|
47
|
+
/**
|
|
48
|
+
* Y coordinate of the top-left corner
|
|
49
|
+
* @field
|
|
50
|
+
*/
|
|
51
|
+
y: number
|
|
52
|
+
/**
|
|
53
|
+
* Width of the rectangle
|
|
54
|
+
* @field
|
|
55
|
+
*/
|
|
56
|
+
width: number
|
|
57
|
+
/**
|
|
58
|
+
* Height of the rectangle
|
|
59
|
+
* @field
|
|
60
|
+
*/
|
|
61
|
+
height: number
|
|
62
|
+
|
|
63
|
+
// Owm methods of Mtk-14.Mtk.Rectangle
|
|
64
|
+
|
|
65
|
+
area(): number
|
|
66
|
+
contains_rect(inner_rect: Rectangle): boolean
|
|
67
|
+
copy(): Rectangle
|
|
68
|
+
could_fit_rect(inner_rect: Rectangle): boolean
|
|
69
|
+
crop_and_scale(src_rect: Graphene.Rect, dst_width: number, dst_height: number, dest: Rectangle): void
|
|
70
|
+
/**
|
|
71
|
+
* Compares the two rectangles
|
|
72
|
+
* @param src2 The second rectangle
|
|
73
|
+
* @returns Whether the two rectangles are equal
|
|
74
|
+
*/
|
|
75
|
+
equal(src2: Rectangle): boolean
|
|
76
|
+
free(): void
|
|
77
|
+
/**
|
|
78
|
+
* Similar to [method`Rectangle`.overlap] but ignores the vertical location.
|
|
79
|
+
* @param rect2 The second rectangle
|
|
80
|
+
* @returns Whether the two rectangles overlap horizontally
|
|
81
|
+
*/
|
|
82
|
+
horiz_overlap(rect2: Rectangle): boolean
|
|
83
|
+
/**
|
|
84
|
+
* Find the intersection between the two rectangles
|
|
85
|
+
* @param src2 another #MtkRectangle
|
|
86
|
+
* @returns TRUE is some intersection exists and is not degenerate, FALSE otherwise.
|
|
87
|
+
*/
|
|
88
|
+
intersect(src2: Rectangle): [ /* returnType */ boolean, /* dest */ Rectangle ]
|
|
89
|
+
is_adjacent_to(other: Rectangle): boolean
|
|
90
|
+
/**
|
|
91
|
+
* Similar to [method`Rectangle`.intersect] but doesn't provide
|
|
92
|
+
* the location of the intersection.
|
|
93
|
+
* @param rect2 The second rectangle
|
|
94
|
+
* @returns Whether the two rectangles overlap
|
|
95
|
+
*/
|
|
96
|
+
overlap(rect2: Rectangle): boolean
|
|
97
|
+
scale_double(scale: number, rounding_strategy: RoundingStrategy, dest: Rectangle): void
|
|
98
|
+
to_graphene_rect(): Graphene.Rect
|
|
99
|
+
/**
|
|
100
|
+
* Computes the union of the two rectangles
|
|
101
|
+
* @param rect2 another #MtkRectangle
|
|
102
|
+
*/
|
|
103
|
+
union(rect2: Rectangle): /* dest */ Rectangle
|
|
104
|
+
/**
|
|
105
|
+
* Similar to [method`Rectangle`.overlap] but ignores the horizontal location.
|
|
106
|
+
* @param rect2 The second rectangle
|
|
107
|
+
* @returns Whether the two rectangles overlap vertically
|
|
108
|
+
*/
|
|
109
|
+
vert_overlap(rect2: Rectangle): boolean
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
class Rectangle {
|
|
113
|
+
|
|
114
|
+
// Own properties of Mtk-14.Mtk.Rectangle
|
|
115
|
+
|
|
116
|
+
static name: string
|
|
117
|
+
|
|
118
|
+
// Constructors of Mtk-14.Mtk.Rectangle
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Creates a new rectangle
|
|
122
|
+
* @constructor
|
|
123
|
+
* @param x X coordinate of the top left corner
|
|
124
|
+
* @param y Y coordinate of the top left corner
|
|
125
|
+
* @param width Width of the rectangle
|
|
126
|
+
* @param height Height of the rectangle
|
|
127
|
+
*/
|
|
128
|
+
constructor(x: number, y: number, width: number, height: number)
|
|
129
|
+
/**
|
|
130
|
+
* Creates a new rectangle
|
|
131
|
+
* @constructor
|
|
132
|
+
* @param x X coordinate of the top left corner
|
|
133
|
+
* @param y Y coordinate of the top left corner
|
|
134
|
+
* @param width Width of the rectangle
|
|
135
|
+
* @param height Height of the rectangle
|
|
136
|
+
*/
|
|
137
|
+
static new(x: number, y: number, width: number, height: number): Rectangle
|
|
138
|
+
static from_graphene_rect(rect: Graphene.Rect, rounding_strategy: RoundingStrategy): /* dest */ Rectangle
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface Region {
|
|
142
|
+
|
|
143
|
+
// Owm methods of Mtk-14.Mtk.Region
|
|
144
|
+
|
|
145
|
+
apply_matrix_transform_expand(transform: Graphene.Matrix): Region
|
|
146
|
+
contains_point(x: number, y: number): boolean
|
|
147
|
+
contains_rectangle(rect: Rectangle): RegionOverlap
|
|
148
|
+
copy(): Region
|
|
149
|
+
crop_and_scale(src_rect: Graphene.Rect, dst_width: number, dst_height: number): Region
|
|
150
|
+
equal(other: Region): boolean
|
|
151
|
+
get_extents(): Rectangle
|
|
152
|
+
get_rectangle(nth: number): Rectangle
|
|
153
|
+
intersect(other: Region): void
|
|
154
|
+
intersect_rectangle(rect: Rectangle): void
|
|
155
|
+
is_empty(): boolean
|
|
156
|
+
num_rectangles(): number
|
|
157
|
+
/**
|
|
158
|
+
* Increases the reference count
|
|
159
|
+
* @returns The region
|
|
160
|
+
*/
|
|
161
|
+
ref(): Region
|
|
162
|
+
scale(scale: number): Region
|
|
163
|
+
subtract(other: Region): void
|
|
164
|
+
subtract_rectangle(rect: Rectangle): void
|
|
165
|
+
translate(dx: number, dy: number): void
|
|
166
|
+
union(other: Region): void
|
|
167
|
+
union_rectangle(rect: Rectangle): void
|
|
168
|
+
unref(): void
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
class Region {
|
|
172
|
+
|
|
173
|
+
// Own properties of Mtk-14.Mtk.Region
|
|
174
|
+
|
|
175
|
+
static name: string
|
|
176
|
+
|
|
177
|
+
// Constructors of Mtk-14.Mtk.Region
|
|
178
|
+
|
|
179
|
+
static create(): Region
|
|
180
|
+
static create_rectangle(rect: Rectangle): Region
|
|
181
|
+
static create_rectangles(rects: Rectangle, n_rects: number): Region
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
interface RegionBuilder {
|
|
185
|
+
|
|
186
|
+
// Own fields of Mtk-14.Mtk.RegionBuilder
|
|
187
|
+
|
|
188
|
+
levels: Region[]
|
|
189
|
+
n_levels: number
|
|
190
|
+
|
|
191
|
+
// Owm methods of Mtk-14.Mtk.RegionBuilder
|
|
192
|
+
|
|
193
|
+
add_rectangle(x: number, y: number, width: number, height: number): void
|
|
194
|
+
finish(): Region
|
|
195
|
+
init(): void
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
class RegionBuilder {
|
|
199
|
+
|
|
200
|
+
// Own properties of Mtk-14.Mtk.RegionBuilder
|
|
201
|
+
|
|
202
|
+
static name: string
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
interface RegionIterator {
|
|
206
|
+
|
|
207
|
+
// Own fields of Mtk-14.Mtk.RegionIterator
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* region being iterated
|
|
211
|
+
* @field
|
|
212
|
+
*/
|
|
213
|
+
region: Region
|
|
214
|
+
/**
|
|
215
|
+
* current rectangle
|
|
216
|
+
* @field
|
|
217
|
+
*/
|
|
218
|
+
rectangle: Rectangle
|
|
219
|
+
/**
|
|
220
|
+
* whether the current rectangle starts a horizontal band
|
|
221
|
+
* @field
|
|
222
|
+
*/
|
|
223
|
+
line_start: boolean
|
|
224
|
+
/**
|
|
225
|
+
* whether the current rectangle ends a horizontal band
|
|
226
|
+
* @field
|
|
227
|
+
*/
|
|
228
|
+
line_end: boolean
|
|
229
|
+
i: number
|
|
230
|
+
|
|
231
|
+
// Owm methods of Mtk-14.Mtk.RegionIterator
|
|
232
|
+
|
|
233
|
+
at_end(): boolean
|
|
234
|
+
init(region: Region): void
|
|
235
|
+
next(): void
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* MtkRegion is a yx banded region; sometimes its useful to iterate through
|
|
240
|
+
* such a region treating the start and end of each horizontal band in a distinct
|
|
241
|
+
* fashion.
|
|
242
|
+
*
|
|
243
|
+
* Usage:
|
|
244
|
+
*
|
|
245
|
+
* ```c
|
|
246
|
+
* MtkRegionIterator iter;
|
|
247
|
+
* for (mtk_region_iterator_init (&iter, region);
|
|
248
|
+
* !mtk_region_iterator_at_end (&iter);
|
|
249
|
+
* mtk_region_iterator_next (&iter))
|
|
250
|
+
* {
|
|
251
|
+
* [ Use iter.rectangle, iter.line_start, iter.line_end ]
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
* @record
|
|
255
|
+
*/
|
|
256
|
+
class RegionIterator {
|
|
257
|
+
|
|
258
|
+
// Own properties of Mtk-14.Mtk.RegionIterator
|
|
259
|
+
|
|
260
|
+
static name: string
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Name of the imported GIR library
|
|
265
|
+
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
266
|
+
*/
|
|
267
|
+
const __name__: string
|
|
268
|
+
/**
|
|
269
|
+
* Version of the imported GIR library
|
|
270
|
+
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
271
|
+
*/
|
|
272
|
+
const __version__: string
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export default Mtk;
|
|
276
|
+
// END
|
package/mtk-14.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@girs/mtk-14",
|
|
3
|
+
"version": "14.0.0-3.3.0",
|
|
4
|
+
"description": "GJS TypeScript type definitions for Mtk-14, generated from library version 14.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "mtk-14.js",
|
|
7
|
+
"main": "mtk-14.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./ambient": {
|
|
10
|
+
"types": "./mtk-14-ambient.d.ts",
|
|
11
|
+
"default": "./mtk-14-ambient.js"
|
|
12
|
+
},
|
|
13
|
+
"./import": {
|
|
14
|
+
"types": "./mtk-14-import.d.ts",
|
|
15
|
+
"default": "./mtk-14-import.js"
|
|
16
|
+
},
|
|
17
|
+
".": {
|
|
18
|
+
"import": {
|
|
19
|
+
"types": "./mtk-14.d.ts",
|
|
20
|
+
"default": "./mtk-14.js"
|
|
21
|
+
},
|
|
22
|
+
"require": {
|
|
23
|
+
"types": "./mtk-14.d.cts",
|
|
24
|
+
"default": "./mtk-14.cjs"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "yarn test:esm && yarn test:cjs",
|
|
30
|
+
"test:esm": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit mtk-14.d.ts",
|
|
31
|
+
"test:cjs": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit mtk-14.d.cts"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@girs/gjs": "^3.3.0",
|
|
35
|
+
"@girs/glib-2.0": "^2.78.0-3.3.0",
|
|
36
|
+
"@girs/gobject-2.0": "^2.78.0-3.3.0",
|
|
37
|
+
"@girs/graphene-1.0": "^1.0.0-3.3.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "*"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"Gir",
|
|
44
|
+
"TypeScript",
|
|
45
|
+
"types",
|
|
46
|
+
"GObject-Introspection",
|
|
47
|
+
"GJS",
|
|
48
|
+
"Mtk-14"
|
|
49
|
+
],
|
|
50
|
+
"author": "ts-for-gir",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/gjsify/ts-for-gir.git"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/gjsify/types/tree/main/mtk-14#readme"
|
|
60
|
+
}
|
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": ["./mtk-14.d.ts"]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|