@girs/gjs 4.0.0-beta.11 → 4.0.0-beta.12

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 +1 -1
  2. package/cairo.d.ts +485 -3
  3. package/package.json +5 -4
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  ![version](https://img.shields.io/npm/v/@girs/gjs)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gjs)
6
6
 
7
- GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.11.
7
+ GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.12.
8
8
 
9
9
  [GJS](https://gitlab.gnome.org/GNOME/gjs) is a JavaScript runtime for the GNOME ecosystem. Using GJS and the type definitions in this NPM package, you can build GTK applications in JavaScript or TypeScript with type checking, better autocompletion and inline documentations.
10
10
 
package/cairo.d.ts CHANGED
@@ -1,4 +1,486 @@
1
- // TODO: See ./cairo-1.0.d.ts
2
- declare const Cairo: any;
1
+ // Cairo 1.0
2
+ import type Cairo from '@girs/cairo-1.0';
3
+ import type GObject from '@girs/gobject-2.0';
3
4
 
4
- export default Cairo;
5
+ declare namespace giCairo {
6
+ // Add overrides here
7
+ // See
8
+ // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/cairo.md
9
+ // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairoModule.js
10
+ // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/installed-tests/js/testCairo.js
11
+ // - https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/cairo-context.cpp
12
+
13
+ // Re-exported enums
14
+ export namespace Status {
15
+ export const $gtype: GObject.GType<Status>;
16
+ }
17
+
18
+ enum Status {
19
+ SUCCESS,
20
+ NO_MEMORY,
21
+ INVALID_RESTORE,
22
+ INVALID_POP_GROUP,
23
+ NO_CURRENT_POINT,
24
+ INVALID_MATRIX,
25
+ INVALID_STATUS,
26
+ NULL_POINTER,
27
+ INVALID_STRING,
28
+ INVALID_PATH_DATA,
29
+ READ_ERROR,
30
+ WRITE_ERROR,
31
+ SURFACE_FINISHED,
32
+ SURFACE_TYPE_MISMATCH,
33
+ PATTERN_TYPE_MISMATCH,
34
+ INVALID_CONTENT,
35
+ INVALID_FORMAT,
36
+ INVALID_VISUAL,
37
+ FILE_NOT_FOUND,
38
+ INVALID_DASH,
39
+ INVALID_DSC_COMMENT,
40
+ INVALID_INDEX,
41
+ CLIP_NOT_REPRESENTABLE,
42
+ TEMP_FILE_ERROR,
43
+ INVALID_STRIDE,
44
+ FONT_TYPE_MISMATCH,
45
+ USER_FONT_IMMUTABLE,
46
+ USER_FONT_ERROR,
47
+ NEGATIVE_COUNT,
48
+ INVALID_CLUSTERS,
49
+ INVALID_SLANT,
50
+ INVALID_WEIGHT,
51
+ INVALID_SIZE,
52
+ USER_FONT_NOT_IMPLEMENTED,
53
+ DEVICE_TYPE_MISMATCH,
54
+ DEVICE_ERROR,
55
+ INVALID_MESH_CONSTRUCTION,
56
+ DEVICE_FINISHED,
57
+ JBIG2_GLOBAL_MISSING,
58
+ }
59
+
60
+ export namespace Content {
61
+ export const $gtype: GObject.GType<Content>;
62
+ }
63
+
64
+ enum Content {
65
+ COLOR,
66
+ ALPHA,
67
+ COLOR_ALPHA,
68
+ }
69
+
70
+ export namespace Operator {
71
+ export const $gtype: GObject.GType<Operator>;
72
+ }
73
+
74
+ enum Operator {
75
+ CLEAR,
76
+ SOURCE,
77
+ OVER,
78
+ IN,
79
+ OUT,
80
+ ATOP,
81
+ DEST,
82
+ DEST_OVER,
83
+ DEST_IN,
84
+ DEST_OUT,
85
+ DEST_ATOP,
86
+ XOR,
87
+ ADD,
88
+ SATURATE,
89
+ MULTIPLY,
90
+ SCREEN,
91
+ OVERLAY,
92
+ DARKEN,
93
+ LIGHTEN,
94
+ COLOR_DODGE,
95
+ COLOR_BURN,
96
+ HARD_LIGHT,
97
+ SOFT_LIGHT,
98
+ DIFFERENCE,
99
+ EXCLUSION,
100
+ HSL_HUE,
101
+ HSL_SATURATION,
102
+ HSL_COLOR,
103
+ HSL_LUMINOSITY,
104
+ }
105
+
106
+ export namespace Antialias {
107
+ export const $gtype: GObject.GType<Antialias>;
108
+ }
109
+
110
+ enum Antialias {
111
+ DEFAULT,
112
+ NONE,
113
+ GRAY,
114
+ SUBPIXEL,
115
+ FAST,
116
+ GOOD,
117
+ BEST,
118
+ }
119
+
120
+ export namespace FillRule {
121
+ export const $gtype: GObject.GType<FillRule>;
122
+ }
123
+
124
+ enum FillRule {
125
+ WINDING,
126
+ EVEN_ODD,
127
+ }
128
+
129
+ export namespace LineCap {
130
+ export const $gtype: GObject.GType<LineCap>;
131
+ }
132
+
133
+ enum LineCap {
134
+ BUTT,
135
+ ROUND,
136
+ SQUARE,
137
+ }
138
+
139
+ export namespace LineJoin {
140
+ export const $gtype: GObject.GType<LineJoin>;
141
+ }
142
+
143
+ enum LineJoin {
144
+ MITER,
145
+ ROUND,
146
+ BEVEL,
147
+ }
148
+
149
+ export namespace TextClusterFlags {
150
+ export const $gtype: GObject.GType<TextClusterFlags>;
151
+ }
152
+
153
+ enum TextClusterFlags {
154
+ BACKWARD,
155
+ }
156
+
157
+ export namespace FontSlant {
158
+ export const $gtype: GObject.GType<FontSlant>;
159
+ }
160
+
161
+ enum FontSlant {
162
+ NORMAL,
163
+ ITALIC,
164
+ OBLIQUE,
165
+ }
166
+
167
+ export namespace FontWeight {
168
+ export const $gtype: GObject.GType<FontWeight>;
169
+ }
170
+
171
+ enum FontWeight {
172
+ NORMAL,
173
+ BOLD,
174
+ }
175
+
176
+ export namespace SubpixelOrder {
177
+ export const $gtype: GObject.GType<SubpixelOrder>;
178
+ }
179
+
180
+ enum SubpixelOrder {
181
+ DEFAULT,
182
+ RGB,
183
+ BGR,
184
+ VRGB,
185
+ VBGR,
186
+ }
187
+
188
+ export namespace HintStyle {
189
+ export const $gtype: GObject.GType<HintStyle>;
190
+ }
191
+
192
+ enum HintStyle {
193
+ DEFAULT,
194
+ NONE,
195
+ SLIGHT,
196
+ MEDIUM,
197
+ FULL,
198
+ }
199
+
200
+ export namespace HintMetrics {
201
+ export const $gtype: GObject.GType<HintMetrics>;
202
+ }
203
+
204
+ enum HintMetrics {
205
+ DEFAULT,
206
+ OFF,
207
+ ON,
208
+ }
209
+
210
+ export namespace FontType {
211
+ export const $gtype: GObject.GType<FontType>;
212
+ }
213
+
214
+ enum FontType {
215
+ TOY,
216
+ FT,
217
+ WIN32,
218
+ QUARTZ,
219
+ USER,
220
+ }
221
+
222
+ export namespace PathDataType {
223
+ export const $gtype: GObject.GType<PathDataType>;
224
+ }
225
+
226
+ enum PathDataType {
227
+ MOVE_TO,
228
+ LINE_TO,
229
+ CURVE_TO,
230
+ CLOSE_PATH,
231
+ }
232
+
233
+ export namespace DeviceType {
234
+ export const $gtype: GObject.GType<DeviceType>;
235
+ }
236
+
237
+ enum DeviceType {
238
+ DRM,
239
+ GL,
240
+ SCRIPT,
241
+ XCB,
242
+ XLIB,
243
+ XML,
244
+ COGL,
245
+ WIN32,
246
+ INVALID,
247
+ }
248
+
249
+ export namespace SurfaceType {
250
+ export const $gtype: GObject.GType<SurfaceType>;
251
+ }
252
+
253
+ enum SurfaceType {
254
+ IMAGE,
255
+ PDF,
256
+ PS,
257
+ XLIB,
258
+ XCB,
259
+ GLITZ,
260
+ QUARTZ,
261
+ WIN32,
262
+ BEOS,
263
+ DIRECTFB,
264
+ SVG,
265
+ OS2,
266
+ WIN32_PRINTING,
267
+ QUARTZ_IMAGE,
268
+ SCRIPT,
269
+ QT,
270
+ RECORDING,
271
+ VG,
272
+ GL,
273
+ DRM,
274
+ TEE,
275
+ XML,
276
+ SKIA,
277
+ SUBSURFACE,
278
+ COGL,
279
+ }
280
+
281
+ export namespace Format {
282
+ export const $gtype: GObject.GType<Format>;
283
+ }
284
+
285
+ enum Format {
286
+ INVALID,
287
+ ARGB32,
288
+ RGB24,
289
+ A8,
290
+ A1,
291
+ RGB16_565,
292
+ RGB30,
293
+ }
294
+
295
+ export namespace PatternType {
296
+ export const $gtype: GObject.GType<PatternType>;
297
+ }
298
+
299
+ enum PatternType {
300
+ SOLID,
301
+ SURFACE,
302
+ LINEAR,
303
+ RADIAL,
304
+ MESH,
305
+ RASTER_SOURCE,
306
+ }
307
+
308
+ export namespace Extend {
309
+ export const $gtype: GObject.GType<Extend>;
310
+ }
311
+
312
+ enum Extend {
313
+ NONE,
314
+ REPEAT,
315
+ REFLECT,
316
+ PAD,
317
+ }
318
+
319
+ export namespace Filter {
320
+ export const $gtype: GObject.GType<Filter>;
321
+ }
322
+
323
+ enum Filter {
324
+ FAST,
325
+ GOOD,
326
+ BEST,
327
+ NEAREST,
328
+ BILINEAR,
329
+ GAUSSIAN,
330
+ }
331
+
332
+ export namespace RegionOverlap {
333
+ export const $gtype: GObject.GType<RegionOverlap>;
334
+ }
335
+
336
+ enum RegionOverlap {
337
+ IN,
338
+ OUT,
339
+ PART,
340
+ }
341
+
342
+ export class Context extends Cairo.Context {
343
+ constructor(surface: Surface);
344
+
345
+ arc(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
346
+ arcNegative(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
347
+ curveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void;
348
+ clip(): void;
349
+ clipPreserve(): void;
350
+ clipExtents(): [number, number, number, number];
351
+ closePath(): void;
352
+ copyPage(): void;
353
+ deviceToUser(x: number, y: number): [number, number];
354
+ deviceToUserDistance(x: number, y: number): [number, number];
355
+ fill(): void;
356
+ fillPreserve(): void;
357
+ fillExtents(): [number, number, number, number];
358
+ getAntialias(): Antialias;
359
+ getCurrentPoint(): [number, number];
360
+ getDashCount(): number;
361
+ getFillRule(): FillRule;
362
+ getLineCap(): LineCap;
363
+ getLineJoin(): LineJoin;
364
+ getLineWidth(): number;
365
+ getMiterLimit(): number;
366
+ getOperator(): Operator;
367
+ getTolerance(): number;
368
+ hasCurrentPoint(): boolean;
369
+ identityMatrix(): void;
370
+ inFill(x: number, y: number): boolean;
371
+ inStroke(x: number, y: number): boolean;
372
+ lineTo(x: number, y: number): void;
373
+ moveTo(x: number, y: number): void;
374
+ newPath(): void;
375
+ newSubPath(): void;
376
+ paint(): void;
377
+ paintWithAlpha(alpha: number): void;
378
+ pathExtents(): [number, number, number, number];
379
+ popGroup(): Pattern;
380
+ popGroupToSource(): void;
381
+ pushGroup(): void;
382
+ pushGroupWithContent(content: Content): void;
383
+ rectangle(x: number, y: number, width: number, height: number): void;
384
+ relCurveTo(dx1: number, dy1: number, dx2: number, dy2: number, dx3: number, dy3: number): void;
385
+ relLineTo(dx: number, dy: number): void;
386
+ relMoveTo(dx: number, dy: number): void;
387
+ resetClip(): void;
388
+ restore(): void;
389
+ rotate(angle: number): void;
390
+ save(): void;
391
+ scale(sx: number, sy: number): void;
392
+ selectFontFace(family: string, slant: number, weight: number): void;
393
+ setAntialias(antialias: Antialias): void;
394
+ setDash(dashes: number[], offset: number): void;
395
+ setFontSize(size: number): void;
396
+ setFillRule(fillRule: FillRule): void;
397
+ setLineCap(lineCap: LineCap): void;
398
+ setLineJoin(lineJoin: LineJoin): void;
399
+ setLineWidth(width: number): void;
400
+ setMiterLimit(limit: number): void;
401
+ setOperator(op: Operator): void;
402
+ setSource(pattern: Pattern): void;
403
+ setSourceRGB(red: number, green: number, blue: number): void;
404
+ setSourceRGBA(red: number, green: number, blue: number, alpha: number): void;
405
+ setSourceSurface(surface: Surface, x: number, y: number): void;
406
+ setTolerance(tolerance: number): void;
407
+ showPage(): void;
408
+ showText(utf8: string): void;
409
+ stroke(): void;
410
+ strokePreserve(): void;
411
+ strokeExtents(): [number, number, number, number];
412
+ textExtents(utf8: string): TextExtents;
413
+ translate(tx: number, ty: number): void;
414
+ userToDevice(x: number, y: number): [number, number];
415
+ userToDeviceDistance(x: number, y: number): [number, number];
416
+ }
417
+
418
+ export abstract class Surface extends Cairo.Surface {
419
+ // TODO
420
+ }
421
+
422
+ export class ImageSurface extends Surface {
423
+ constructor(format: Format, width: number, height: number);
424
+
425
+ static createFromPNG(filename: string): ImageSurface;
426
+
427
+ // TODO
428
+ }
429
+
430
+ export class PDFSurface extends Surface {
431
+ constructor(filename: string, width: number, height: number);
432
+
433
+ // TODO
434
+ }
435
+
436
+ export class PSSurface extends Surface {
437
+ constructor(filename: string, width: number, height: number);
438
+
439
+ // TODO
440
+ }
441
+
442
+ export class SVGSurface extends Surface {
443
+ constructor(filename: string, width: number, height: number);
444
+
445
+ // TODO
446
+ }
447
+
448
+ export class Pattern extends Cairo.Pattern {
449
+ // TODO
450
+ }
451
+
452
+ export class Gradient extends Pattern {
453
+ // TODO
454
+ }
455
+
456
+ export class LinearGradient extends Gradient {
457
+ // TODO
458
+ }
459
+
460
+ export class RadialGradient extends Gradient {
461
+ // TODO
462
+ }
463
+
464
+ export class SurfacePattern extends Pattern {
465
+ // TODO
466
+ }
467
+
468
+ export class SolidPattern extends Pattern {
469
+ // TODO
470
+ }
471
+
472
+ export class Path extends Cairo.Path {
473
+ // TODO
474
+ }
475
+
476
+ export interface TextExtents {
477
+ xBearing: number;
478
+ yBearing: number;
479
+ width: number;
480
+ height: number;
481
+ xAdvance: number;
482
+ yAdvance: number;
483
+ }
484
+ }
485
+
486
+ export default giCairo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gjs",
3
- "version": "4.0.0-beta.11",
3
+ "version": "4.0.0-beta.12",
4
4
  "description": "GJS TypeScript type definitions for Gjs",
5
5
  "type": "module",
6
6
  "module": "gjs.js",
@@ -46,9 +46,10 @@
46
46
  "test": "tsc --project tsconfig.json"
47
47
  },
48
48
  "dependencies": {
49
- "@girs/gio-2.0": "^2.80.3-4.0.0-beta.11",
50
- "@girs/glib-2.0": "^2.80.3-4.0.0-beta.11",
51
- "@girs/gobject-2.0": "^2.80.3-4.0.0-beta.11"
49
+ "@girs/cairo-1.0": "^1.0.0-4.0.0-beta.12",
50
+ "@girs/gio-2.0": "^2.80.3-4.0.0-beta.12",
51
+ "@girs/glib-2.0": "^2.80.3-4.0.0-beta.12",
52
+ "@girs/gobject-2.0": "^2.80.3-4.0.0-beta.12"
52
53
  },
53
54
  "devDependencies": {
54
55
  "typescript": "*"