@girs/gjs 4.0.0-beta.2 → 4.0.0-beta.21

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 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.2.
7
+ GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.21.
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,6 +1,488 @@
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
5
12
 
13
+ // START Re-exported enums, copied from cairo-1.0.d.ts
14
+ export namespace Status {
15
+ export const $gtype: GObject.GType<Status>;
16
+ }
6
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
+ // END Re-exported enums, copied from cairo-1.0.d.ts
343
+
344
+ export class Context extends Cairo.Context {
345
+ constructor(surface: Surface);
346
+
347
+ arc(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
348
+ arcNegative(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
349
+ curveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void;
350
+ clip(): void;
351
+ clipPreserve(): void;
352
+ clipExtents(): [number, number, number, number];
353
+ closePath(): void;
354
+ copyPage(): void;
355
+ deviceToUser(x: number, y: number): [number, number];
356
+ deviceToUserDistance(x: number, y: number): [number, number];
357
+ fill(): void;
358
+ fillPreserve(): void;
359
+ fillExtents(): [number, number, number, number];
360
+ getAntialias(): Antialias;
361
+ getCurrentPoint(): [number, number];
362
+ getDashCount(): number;
363
+ getFillRule(): FillRule;
364
+ getLineCap(): LineCap;
365
+ getLineJoin(): LineJoin;
366
+ getLineWidth(): number;
367
+ getMiterLimit(): number;
368
+ getOperator(): Operator;
369
+ getTolerance(): number;
370
+ hasCurrentPoint(): boolean;
371
+ identityMatrix(): void;
372
+ inFill(x: number, y: number): boolean;
373
+ inStroke(x: number, y: number): boolean;
374
+ lineTo(x: number, y: number): void;
375
+ moveTo(x: number, y: number): void;
376
+ newPath(): void;
377
+ newSubPath(): void;
378
+ paint(): void;
379
+ paintWithAlpha(alpha: number): void;
380
+ pathExtents(): [number, number, number, number];
381
+ popGroup(): Pattern;
382
+ popGroupToSource(): void;
383
+ pushGroup(): void;
384
+ pushGroupWithContent(content: Content): void;
385
+ rectangle(x: number, y: number, width: number, height: number): void;
386
+ relCurveTo(dx1: number, dy1: number, dx2: number, dy2: number, dx3: number, dy3: number): void;
387
+ relLineTo(dx: number, dy: number): void;
388
+ relMoveTo(dx: number, dy: number): void;
389
+ resetClip(): void;
390
+ restore(): void;
391
+ rotate(angle: number): void;
392
+ save(): void;
393
+ scale(sx: number, sy: number): void;
394
+ selectFontFace(family: string, slant: number, weight: number): void;
395
+ setAntialias(antialias: Antialias): void;
396
+ setDash(dashes: number[], offset: number): void;
397
+ setFontSize(size: number): void;
398
+ setFillRule(fillRule: FillRule): void;
399
+ setLineCap(lineCap: LineCap): void;
400
+ setLineJoin(lineJoin: LineJoin): void;
401
+ setLineWidth(width: number): void;
402
+ setMiterLimit(limit: number): void;
403
+ setOperator(op: Operator): void;
404
+ setSource(pattern: Pattern): void;
405
+ setSourceRGB(red: number, green: number, blue: number): void;
406
+ setSourceRGBA(red: number, green: number, blue: number, alpha: number): void;
407
+ setSourceSurface(surface: Surface, x: number, y: number): void;
408
+ setTolerance(tolerance: number): void;
409
+ showPage(): void;
410
+ showText(utf8: string): void;
411
+ stroke(): void;
412
+ strokePreserve(): void;
413
+ strokeExtents(): [number, number, number, number];
414
+ textExtents(utf8: string): TextExtents;
415
+ translate(tx: number, ty: number): void;
416
+ userToDevice(x: number, y: number): [number, number];
417
+ userToDeviceDistance(x: number, y: number): [number, number];
418
+ }
419
+
420
+ export abstract class Surface extends Cairo.Surface {
421
+ // TODO
422
+ }
423
+
424
+ export class ImageSurface extends Surface {
425
+ constructor(format: Format, width: number, height: number);
426
+
427
+ static createFromPNG(filename: string): ImageSurface;
428
+
429
+ // TODO
430
+ }
431
+
432
+ export class PDFSurface extends Surface {
433
+ constructor(filename: string, width: number, height: number);
434
+
435
+ // TODO
436
+ }
437
+
438
+ export class PSSurface extends Surface {
439
+ constructor(filename: string, width: number, height: number);
440
+
441
+ // TODO
442
+ }
443
+
444
+ export class SVGSurface extends Surface {
445
+ constructor(filename: string, width: number, height: number);
446
+
447
+ // TODO
448
+ }
449
+
450
+ export class Pattern extends Cairo.Pattern {
451
+ // TODO
452
+ }
453
+
454
+ export class Gradient extends Pattern {
455
+ // TODO
456
+ }
457
+
458
+ export class LinearGradient extends Gradient {
459
+ // TODO
460
+ }
461
+
462
+ export class RadialGradient extends Gradient {
463
+ // TODO
464
+ }
465
+
466
+ export class SurfacePattern extends Pattern {
467
+ // TODO
468
+ }
469
+
470
+ export class SolidPattern extends Pattern {
471
+ // TODO
472
+ }
473
+
474
+ export class Path extends Cairo.Path {
475
+ // TODO
476
+ }
477
+
478
+ export interface TextExtents {
479
+ xBearing: number;
480
+ yBearing: number;
481
+ width: number;
482
+ height: number;
483
+ xAdvance: number;
484
+ yAdvance: number;
485
+ }
486
+ }
487
+
488
+ export default giCairo;
package/console.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @param logDomain the GLib log domain this Console should print
3
+ * with. Defaults to 'Gjs-Console'.
4
+ */
5
+ export function setConsoleLogDomain(logDomain: string): void;
6
+
7
+ /**
8
+ * @param logDomain the GLib log domain this Console should print
9
+ * with. Defaults to 'Gjs-Console'.
10
+ */
11
+ export function getConsoleLogDomain(): string;
12
+
13
+ export declare const DEFAULT_LOG_DOMAIN: string;
14
+
15
+ declare const Console: {
16
+ setConsoleLogDomain: typeof setConsoleLogDomain;
17
+ getConsoleLogDomain: typeof getConsoleLogDomain;
18
+ DEFAULT_LOG_DOMAIN: typeof DEFAULT_LOG_DOMAIN;
19
+ };
20
+
21
+ export default Console;
package/console.js ADDED
@@ -0,0 +1,6 @@
1
+ import Console, { getConsoleLogDomain, setConsoleLogDomain, DEFAULT_LOG_DOMAIN } from 'console';
2
+
3
+ export { getConsoleLogDomain, setConsoleLogDomain, DEFAULT_LOG_DOMAIN }
4
+ export default Console;
5
+
6
+