@girs/gcalc-1 4.3.0 → 4.5.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.
Files changed (3) hide show
  1. package/README.md +36 -41
  2. package/gcalc-1.d.ts +98 -44
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -4,82 +4,77 @@
4
4
  ![version](https://img.shields.io/npm/v/@girs/gcalc-1)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gcalc-1)
6
6
 
7
+ GJS TypeScript type definitions for GCalc-1 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.5.0.
7
8
 
8
- GJS TypeScript type definitions for GCalc-1 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.3.0.
9
+ This package contains type declarations only. It ships no runtime code, so it adds
10
+ nothing to your program and works with any bundler or none at all.
9
11
 
10
12
  ## Install
11
13
 
12
- Install the type definitions with npm:
13
14
  ```bash
14
15
  npm install @girs/gcalc-1
15
16
  ```
16
17
 
17
- ## Usage
18
+ Any package manager works. The package has no dependencies beyond other `@girs/*`
19
+ type packages.
20
+
21
+ ## What it exports
22
+
23
+ | Import | What you get |
24
+ |---|---|
25
+ | `@girs/gcalc-1` | the namespace as a default export, plus the ambient and global declarations |
26
+ | `@girs/gcalc-1/ambient` | only the `gi://` module declarations |
27
+ | `@girs/gcalc-1/import` | only the `imports.gi` declarations |
28
+ | `@girs/gcalc-1/gcalc-1` | the namespace, without the side-effecting declarations |
29
+
30
+ ## Three ways to import
31
+
32
+ Which one you use depends on how you write imports elsewhere, not on your toolchain.
33
+
34
+ ### As a module
18
35
 
19
- Import it like any other module:
20
36
  ```ts
21
37
  import GCalc from '@girs/gcalc-1';
22
38
  ```
23
39
 
24
- ### Ambient Modules
40
+ ### As `gi://`
25
41
 
26
- [Ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) let you write the same import you would in plain JavaScript.
27
- For this you need to include `@girs/gcalc-1` or `@girs/gcalc-1/ambient` in your `tsconfig` or entry point Typescript file:
42
+ GJS resolves `gi://` at runtime. To give it types, reference the package once, either
43
+ from your entry point or from `tsconfig.json`:
28
44
 
29
- `index.ts`:
30
45
  ```ts
31
- import '@girs/gcalc-1'
46
+ import '@girs/gcalc-1';
32
47
  ```
33
48
 
34
- `tsconfig.json`:
35
49
  ```json
36
- {
37
- "compilerOptions": {
38
- ...
39
- },
40
- "include": ["@girs/gcalc-1"],
41
- ...
42
- }
50
+ { "include": ["@girs/gcalc-1"] }
43
51
  ```
44
52
 
45
- The ambient module now resolves with types:
53
+ Then the runtime spelling type-checks:
46
54
 
47
55
  ```ts
48
56
  import GCalc from 'gi://GCalc?version=1';
49
57
  ```
50
58
 
51
- ### Global import
52
-
53
- GJS's global `imports.gi` works too, with types.
54
- For this you need to include `@girs/gcalc-1` or `@girs/gcalc-1/import` in your `tsconfig` or entry point Typescript file:
59
+ Referencing `@girs/gcalc-1/ambient` instead pulls in these declarations
60
+ alone. See [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules).
55
61
 
56
- `index.ts`:
57
- ```ts
58
- import '@girs/gcalc-1'
59
- ```
60
-
61
- `tsconfig.json`:
62
- ```json
63
- {
64
- "compilerOptions": {
65
- ...
66
- },
67
- "include": ["@girs/gcalc-1"],
68
- ...
69
- }
70
- ```
62
+ ### As `imports.gi`
71
63
 
72
- That form carries types as well:
64
+ GJS's global object works the same way, via `@girs/gcalc-1/import`:
73
65
 
74
66
  ```ts
75
67
  const GCalc = imports.gi.GCalc;
76
68
  ```
77
69
 
78
- ### Bundle
70
+ ## Building
79
71
 
80
- Most projects want a bundler. [esbuild](https://esbuild.github.io/) is the smallest thing that works; the [examples directory](https://github.com/gjsify/ts-for-gir/tree/main/examples) has setups for several others.
72
+ The declarations need no build step. If you bundle, every bundler works, since there is
73
+ no runtime code to resolve. The [examples](https://github.com/gjsify/ts-for-gir/tree/main/examples)
74
+ show working setups for several.
81
75
 
82
76
  ## Other packages
83
77
 
84
- All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
78
+ Every pre-generated package is at [gjsify/types](https://github.com/gjsify/types).
79
+
85
80
 
package/gcalc-1.d.ts CHANGED
@@ -145,47 +145,47 @@ export namespace GCalc {
145
145
  * @gir-type Enum
146
146
  */
147
147
  enum GParserTokenType {
148
- NONE,
149
- EOF,
150
- IDENTIFIER,
151
- INTEGER_LITERAL,
152
- REAL_LITERAL,
153
- STAR,
154
- PLUS,
155
- DIV,
156
- MINUS,
157
- ASSIGN,
158
- OPEN_PARENS,
159
- CLOSE_PARENS,
160
- CARRET,
161
- CLOSE_BRACE,
162
- CLOSE_BRACKET,
163
- OPEN_BRACE,
164
- OPEN_BRACKET,
165
- STRING_LITERAL,
166
- OP_AND,
167
- OP_COALESCING,
168
- OP_DEC,
169
- OP_EQ,
170
- OP_GE,
171
- OP_GT,
172
- OP_INC,
173
- OP_LE,
174
- OP_LT,
175
- OP_NE,
176
- OP_NEG,
177
- OP_OR,
178
- OP_PTR,
179
- OP_SHIFT_LEFT,
180
- SEMICOLON,
181
- TILDE,
182
- COLON,
183
- COMMA,
184
- DOUBLE_COLON,
185
- DOT,
186
- ELLIPSIS,
187
- INTERR,
188
- HASH,
148
+ NONE = 0,
149
+ EOF = 1,
150
+ IDENTIFIER = 2,
151
+ INTEGER_LITERAL = 3,
152
+ REAL_LITERAL = 4,
153
+ STAR = 5,
154
+ PLUS = 6,
155
+ DIV = 7,
156
+ MINUS = 8,
157
+ ASSIGN = 9,
158
+ OPEN_PARENS = 10,
159
+ CLOSE_PARENS = 11,
160
+ CARRET = 12,
161
+ CLOSE_BRACE = 13,
162
+ CLOSE_BRACKET = 14,
163
+ OPEN_BRACE = 15,
164
+ OPEN_BRACKET = 16,
165
+ STRING_LITERAL = 17,
166
+ OP_AND = 18,
167
+ OP_COALESCING = 19,
168
+ OP_DEC = 20,
169
+ OP_EQ = 21,
170
+ OP_GE = 22,
171
+ OP_GT = 23,
172
+ OP_INC = 24,
173
+ OP_LE = 25,
174
+ OP_LT = 26,
175
+ OP_NE = 27,
176
+ OP_NEG = 28,
177
+ OP_OR = 29,
178
+ OP_PTR = 30,
179
+ OP_SHIFT_LEFT = 31,
180
+ SEMICOLON = 32,
181
+ TILDE = 33,
182
+ COLON = 34,
183
+ COMMA = 35,
184
+ DOUBLE_COLON = 36,
185
+ DOT = 37,
186
+ ELLIPSIS = 38,
187
+ INTERR = 39,
188
+ HASH = 40,
189
189
  }
190
190
 
191
191
 
@@ -200,9 +200,9 @@ export namespace GCalc {
200
200
  * @gir-type Enum
201
201
  */
202
202
  enum GroupLevel {
203
- ONE,
204
- TWO,
205
- THREE,
203
+ ONE = 0,
204
+ TWO = 1,
205
+ THREE = 2,
206
206
  }
207
207
 
208
208
 
@@ -329,6 +329,7 @@ export namespace GCalc {
329
329
  * The item type of a {@link Gio.ListModel} can not change during the life of the
330
330
  * model.
331
331
  * @returns the {@link GObject.GType} of the items contained in `list`.
332
+ * @since 2.44
332
333
  */
333
334
  get_item_type(): GObject.GType;
334
335
 
@@ -339,6 +340,7 @@ export namespace GCalc {
339
340
  * less efficient than iterating the list with increasing values for
340
341
  * `position` until `g_list_model_get_item()` returns `null`.
341
342
  * @returns the number of items in `list`.
343
+ * @since 2.44
342
344
  */
343
345
  get_n_items(): number;
344
346
 
@@ -357,6 +359,7 @@ export namespace GCalc {
357
359
  * See also: `g_list_model_get_n_items()`
358
360
  * @param position the position of the item to fetch
359
361
  * @returns the object at `position`.
362
+ * @since 2.44
360
363
  */
361
364
  get_item(position: number): A | null;
362
365
 
@@ -384,6 +387,7 @@ export namespace GCalc {
384
387
  * @param position the position at which `list` changed
385
388
  * @param removed the number of items removed
386
389
  * @param added the number of items added
390
+ * @since 2.44
387
391
  */
388
392
  items_changed(position: number, removed: number, added: number): void;
389
393
 
@@ -396,6 +400,7 @@ export namespace GCalc {
396
400
  *
397
401
  * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}.
398
402
  * @param position the position of the item to fetch
403
+ * @since 2.44
399
404
  * @virtual
400
405
  */
401
406
  vfunc_get_item(position: number): A | null;
@@ -409,6 +414,7 @@ export namespace GCalc {
409
414
  *
410
415
  * The item type of a {@link Gio.ListModel} can not change during the life of the
411
416
  * model.
417
+ * @since 2.44
412
418
  * @virtual
413
419
  */
414
420
  vfunc_get_item_type(): GObject.GType;
@@ -419,6 +425,7 @@ export namespace GCalc {
419
425
  * Depending on the model implementation, calling this function may be
420
426
  * less efficient than iterating the list with increasing values for
421
427
  * `position` until `g_list_model_get_item()` returns `null`.
428
+ * @since 2.44
422
429
  * @virtual
423
430
  */
424
431
  vfunc_get_n_items(): number;
@@ -1393,6 +1400,9 @@ export namespace GCalc {
1393
1400
  emit<K extends keyof GAssign.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<GAssign.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
1394
1401
  emit(signal: string, ...args: any[]): void;
1395
1402
 
1403
+ /**
1404
+ * @throws GLib.Error
1405
+ */
1396
1406
  evaluate(): Expression;
1397
1407
  }
1398
1408
 
@@ -1711,6 +1721,9 @@ export namespace GCalc {
1711
1721
  vfunc_evaluate(): Expression;
1712
1722
 
1713
1723
  // Methods
1724
+ /**
1725
+ * @throws GLib.Error
1726
+ */
1714
1727
  evaluate(): Expression;
1715
1728
 
1716
1729
  /**
@@ -1741,6 +1754,9 @@ export namespace GCalc {
1741
1754
  get closed(): boolean;
1742
1755
  set closed(val: boolean);
1743
1756
 
1757
+ /**
1758
+ * @throws GLib.Error
1759
+ */
1744
1760
  verify_params(): boolean;
1745
1761
 
1746
1762
  get_param_types(): ExpressionContainer;
@@ -2100,6 +2116,7 @@ export namespace GCalc {
2100
2116
  /**
2101
2117
  * @param str
2102
2118
  * @param eqman
2119
+ * @throws GLib.Error
2103
2120
  */
2104
2121
  parse(str: string, eqman: MathEquationManager): void;
2105
2122
 
@@ -2197,6 +2214,9 @@ export namespace GCalc {
2197
2214
  emit<K extends keyof GPolynomial.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<GPolynomial.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
2198
2215
  emit(signal: string, ...args: any[]): void;
2199
2216
 
2217
+ /**
2218
+ * @throws GLib.Error
2219
+ */
2200
2220
  evaluate(): Expression;
2201
2221
 
2202
2222
  /**
@@ -2372,6 +2392,9 @@ export namespace GCalc {
2372
2392
  get closed(): boolean;
2373
2393
  set closed(val: boolean);
2374
2394
 
2395
+ /**
2396
+ * @throws GLib.Error
2397
+ */
2375
2398
  evaluate(): Expression;
2376
2399
 
2377
2400
  get_level(): GroupLevel;
@@ -2472,6 +2495,7 @@ export namespace GCalc {
2472
2495
 
2473
2496
  /**
2474
2497
  * @param str
2498
+ * @throws GLib.Error
2475
2499
  */
2476
2500
  solve(str: string): Result;
2477
2501
 
@@ -2546,9 +2570,13 @@ export namespace GCalc {
2546
2570
 
2547
2571
  /**
2548
2572
  * @param t
2573
+ * @throws GLib.Error
2549
2574
  */
2550
2575
  add(t: Term): Expression;
2551
2576
 
2577
+ /**
2578
+ * @throws GLib.Error
2579
+ */
2552
2580
  evaluate(): Expression;
2553
2581
 
2554
2582
  /**
@@ -2626,6 +2654,9 @@ export namespace GCalc {
2626
2654
  get bind(): Variable;
2627
2655
  set bind(val: Variable);
2628
2656
 
2657
+ /**
2658
+ * @throws GLib.Error
2659
+ */
2629
2660
  evaluate(): Expression;
2630
2661
 
2631
2662
  get_name(): string;
@@ -3310,6 +3341,9 @@ export namespace GCalc {
3310
3341
  interface Assign extends GObject.Object {
3311
3342
 
3312
3343
  // Methods
3344
+ /**
3345
+ * @throws GLib.Error
3346
+ */
3313
3347
  evaluate(): Expression;
3314
3348
  }
3315
3349
 
@@ -3666,8 +3700,14 @@ export namespace GCalc {
3666
3700
  set closed(val: boolean);
3667
3701
 
3668
3702
  // Methods
3703
+ /**
3704
+ * @throws GLib.Error
3705
+ */
3669
3706
  evaluate(): Expression;
3670
3707
 
3708
+ /**
3709
+ * @throws GLib.Error
3710
+ */
3671
3711
  verify_params(): boolean;
3672
3712
 
3673
3713
  get_param_types(): ExpressionContainer;
@@ -3805,6 +3845,9 @@ export namespace GCalc {
3805
3845
  set closed(val: boolean);
3806
3846
 
3807
3847
  // Methods
3848
+ /**
3849
+ * @throws GLib.Error
3850
+ */
3808
3851
  evaluate(): Expression;
3809
3852
 
3810
3853
  get_level(): GroupLevel;
@@ -4091,6 +4134,9 @@ export namespace GCalc {
4091
4134
  interface Polynomial extends GObject.Object, Polynomial.Interface {
4092
4135
 
4093
4136
  // Methods
4137
+ /**
4138
+ * @throws GLib.Error
4139
+ */
4094
4140
  evaluate(): Expression;
4095
4141
  }
4096
4142
 
@@ -4225,6 +4271,7 @@ export namespace GCalc {
4225
4271
  // Methods
4226
4272
  /**
4227
4273
  * @param str
4274
+ * @throws GLib.Error
4228
4275
  */
4229
4276
  solve(str: string): Result;
4230
4277
 
@@ -4284,9 +4331,13 @@ export namespace GCalc {
4284
4331
  // Methods
4285
4332
  /**
4286
4333
  * @param t
4334
+ * @throws GLib.Error
4287
4335
  */
4288
4336
  add(t: Term): Expression;
4289
4337
 
4338
+ /**
4339
+ * @throws GLib.Error
4340
+ */
4290
4341
  evaluate(): Expression;
4291
4342
  }
4292
4343
 
@@ -4376,6 +4427,9 @@ export namespace GCalc {
4376
4427
  set bind(val: Variable);
4377
4428
 
4378
4429
  // Methods
4430
+ /**
4431
+ * @throws GLib.Error
4432
+ */
4379
4433
  evaluate(): Expression;
4380
4434
 
4381
4435
  get_name(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gcalc-1",
3
- "version": "4.3.0",
3
+ "version": "4.5.0",
4
4
  "description": "GJS TypeScript type definitions for GCalc-1",
5
5
  "type": "module",
6
6
  "module": "gcalc-1.js",
@@ -31,12 +31,12 @@
31
31
  "test": "tsc --project tsconfig.json"
32
32
  },
33
33
  "dependencies": {
34
- "@girs/gjs": "^4.3.0",
35
- "@girs/gobject-2.0": "^4.3.0",
36
- "@girs/glib-2.0": "^4.3.0",
37
- "@girs/gio-2.0": "^4.3.0",
38
- "@girs/gmodule-2.0": "^4.3.0",
39
- "@girs/gee-0.8": "^4.3.0" },
34
+ "@girs/gjs": "^4.5.0",
35
+ "@girs/gobject-2.0": "^4.5.0",
36
+ "@girs/glib-2.0": "^4.5.0",
37
+ "@girs/gio-2.0": "^4.5.0",
38
+ "@girs/gmodule-2.0": "^4.5.0",
39
+ "@girs/gee-0.8": "^4.5.0" },
40
40
  "devDependencies": {
41
41
  "typescript": "*"
42
42
  },