@girs/gcalc-2 4.4.0 → 4.6.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-2.d.ts +98 -49
  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-2)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gcalc-2)
6
6
 
7
+ GJS TypeScript type definitions for GCalc-2 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.6.0.
7
8
 
8
- GJS TypeScript type definitions for GCalc-2 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.4.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-2
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-2` | the namespace as a default export, plus the ambient and global declarations |
26
+ | `@girs/gcalc-2/ambient` | only the `gi://` module declarations |
27
+ | `@girs/gcalc-2/import` | only the `imports.gi` declarations |
28
+ | `@girs/gcalc-2/gcalc-2` | 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-2';
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-2` or `@girs/gcalc-2/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-2'
46
+ import '@girs/gcalc-2';
32
47
  ```
33
48
 
34
- `tsconfig.json`:
35
49
  ```json
36
- {
37
- "compilerOptions": {
38
- ...
39
- },
40
- "include": ["@girs/gcalc-2"],
41
- ...
42
- }
50
+ { "include": ["@girs/gcalc-2"] }
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=2';
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-2` or `@girs/gcalc-2/import` in your `tsconfig` or entry point Typescript file:
59
+ Referencing `@girs/gcalc-2/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-2'
59
- ```
60
-
61
- `tsconfig.json`:
62
- ```json
63
- {
64
- "compilerOptions": {
65
- ...
66
- },
67
- "include": ["@girs/gcalc-2"],
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-2/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-2.d.ts CHANGED
@@ -35,9 +35,9 @@ export namespace GCalc {
35
35
  * @gir-type Enum
36
36
  */
37
37
  enum AngleUnit {
38
- RADIANS,
39
- DEGREES,
40
- GRADIANS,
38
+ RADIANS = 0,
39
+ DEGREES = 1,
40
+ GRADIANS = 2,
41
41
  }
42
42
 
43
43
 
@@ -162,48 +162,48 @@ export namespace GCalc {
162
162
  * @gir-type Enum
163
163
  */
164
164
  enum ParserTokenType {
165
- NONE,
166
- EOF,
167
- IDENTIFIER,
168
- INTEGER_LITERAL,
169
- REAL_LITERAL,
170
- STAR,
171
- PLUS,
172
- DIV,
173
- MINUS,
174
- ASSIGN,
175
- OPEN_PARENS,
176
- CLOSE_PARENS,
177
- CARRET,
178
- CLOSE_BRACE,
179
- CLOSE_BRACKET,
180
- OPEN_BRACE,
181
- OPEN_BRACKET,
182
- STRING_LITERAL,
183
- OP_AND,
184
- OP_COALESCING,
185
- OP_DEC,
186
- OP_EQ,
187
- OP_GE,
188
- OP_GT,
189
- OP_INC,
190
- OP_LE,
191
- OP_LT,
192
- OP_NE,
193
- OP_NEG,
194
- OP_OR,
195
- OP_PTR,
196
- OP_SHIFT_LEFT,
197
- SEMICOLON,
198
- TILDE,
199
- COLON,
200
- COMMA,
201
- DOUBLE_COLON,
202
- DOT,
203
- ELLIPSIS,
204
- INTERR,
205
- HASH,
206
- CURRENCY_SYMBOL,
165
+ NONE = 0,
166
+ EOF = 1,
167
+ IDENTIFIER = 2,
168
+ INTEGER_LITERAL = 3,
169
+ REAL_LITERAL = 4,
170
+ STAR = 5,
171
+ PLUS = 6,
172
+ DIV = 7,
173
+ MINUS = 8,
174
+ ASSIGN = 9,
175
+ OPEN_PARENS = 10,
176
+ CLOSE_PARENS = 11,
177
+ CARRET = 12,
178
+ CLOSE_BRACE = 13,
179
+ CLOSE_BRACKET = 14,
180
+ OPEN_BRACE = 15,
181
+ OPEN_BRACKET = 16,
182
+ STRING_LITERAL = 17,
183
+ OP_AND = 18,
184
+ OP_COALESCING = 19,
185
+ OP_DEC = 20,
186
+ OP_EQ = 21,
187
+ OP_GE = 22,
188
+ OP_GT = 23,
189
+ OP_INC = 24,
190
+ OP_LE = 25,
191
+ OP_LT = 26,
192
+ OP_NE = 27,
193
+ OP_NEG = 28,
194
+ OP_OR = 29,
195
+ OP_PTR = 30,
196
+ OP_SHIFT_LEFT = 31,
197
+ SEMICOLON = 32,
198
+ TILDE = 33,
199
+ COLON = 34,
200
+ COMMA = 35,
201
+ DOUBLE_COLON = 36,
202
+ DOT = 37,
203
+ ELLIPSIS = 38,
204
+ INTERR = 39,
205
+ HASH = 40,
206
+ CURRENCY_SYMBOL = 41,
207
207
  }
208
208
 
209
209
 
@@ -218,9 +218,9 @@ export namespace GCalc {
218
218
  * @gir-type Enum
219
219
  */
220
220
  enum MathGroupLevel {
221
- ONE,
222
- TWO,
223
- THREE,
221
+ ONE = 0,
222
+ TWO = 1,
223
+ THREE = 2,
224
224
  }
225
225
 
226
226
 
@@ -267,6 +267,9 @@ export namespace GCalc {
267
267
  emit<K extends keyof Assign.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<Assign.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
268
268
  emit(signal: string, ...args: any[]): void;
269
269
 
270
+ /**
271
+ * @throws GLib.Error
272
+ */
270
273
  evaluate(): MathExpression;
271
274
  }
272
275
 
@@ -1019,7 +1022,7 @@ export namespace GCalc {
1019
1022
 
1020
1023
  namespace ExpressionContainer {
1021
1024
  // Signal signatures
1022
- interface SignalSignatures extends Gee.ArrayList.SignalSignatures {
1025
+ interface SignalSignatures extends Gee.ArrayList.SignalSignatures, Gio.ListModel.SignalSignatures {
1023
1026
  "notify::parent": (pspec: GObject.ParamSpec) => void;
1024
1027
  "notify::g-type": (pspec: GObject.ParamSpec) => void;
1025
1028
  "notify::g-dup-func": (pspec: GObject.ParamSpec) => void;
@@ -1373,6 +1376,9 @@ export namespace GCalc {
1373
1376
  vfunc_evaluate(): MathExpression;
1374
1377
 
1375
1378
  // Methods
1379
+ /**
1380
+ * @throws GLib.Error
1381
+ */
1376
1382
  evaluate(): MathExpression;
1377
1383
 
1378
1384
  /**
@@ -1403,6 +1409,9 @@ export namespace GCalc {
1403
1409
  get closed(): boolean;
1404
1410
  set closed(val: boolean);
1405
1411
 
1412
+ /**
1413
+ * @throws GLib.Error
1414
+ */
1406
1415
  verify_params(): boolean;
1407
1416
 
1408
1417
  get_param_types(): ExpressionContainer;
@@ -2209,6 +2218,9 @@ export namespace GCalc {
2209
2218
  get closed(): boolean;
2210
2219
  set closed(val: boolean);
2211
2220
 
2221
+ /**
2222
+ * @throws GLib.Error
2223
+ */
2212
2224
  evaluate(): MathExpression;
2213
2225
 
2214
2226
  get_level(): MathGroupLevel;
@@ -2392,6 +2404,7 @@ export namespace GCalc {
2392
2404
 
2393
2405
  /**
2394
2406
  * @param val
2407
+ * @throws GLib.Error
2395
2408
  */
2396
2409
  set_value(val: GObject.Value | any | null): void;
2397
2410
 
@@ -2483,6 +2496,7 @@ export namespace GCalc {
2483
2496
  /**
2484
2497
  * @param str
2485
2498
  * @param eqman
2499
+ * @throws GLib.Error
2486
2500
  */
2487
2501
  parse(str: string, eqman: MathEquationManager): void;
2488
2502
 
@@ -2580,6 +2594,9 @@ export namespace GCalc {
2580
2594
  emit<K extends keyof Polynomial.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<Polynomial.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
2581
2595
  emit(signal: string, ...args: any[]): void;
2582
2596
 
2597
+ /**
2598
+ * @throws GLib.Error
2599
+ */
2583
2600
  evaluate(): MathExpression;
2584
2601
 
2585
2602
  /**
@@ -2759,11 +2776,13 @@ export namespace GCalc {
2759
2776
  // Methods
2760
2777
  /**
2761
2778
  * @param exp
2779
+ * @throws GLib.Error
2762
2780
  */
2763
2781
  add_expression(exp: string): void;
2764
2782
 
2765
2783
  /**
2766
2784
  * @param str
2785
+ * @throws GLib.Error
2767
2786
  */
2768
2787
  solve(str: string): MathResult;
2769
2788
 
@@ -2821,9 +2840,13 @@ export namespace GCalc {
2821
2840
 
2822
2841
  /**
2823
2842
  * @param t
2843
+ * @throws GLib.Error
2824
2844
  */
2825
2845
  add(t: MathTerm): MathExpression;
2826
2846
 
2847
+ /**
2848
+ * @throws GLib.Error
2849
+ */
2827
2850
  evaluate(): MathExpression;
2828
2851
 
2829
2852
  /**
@@ -2949,6 +2972,9 @@ export namespace GCalc {
2949
2972
  get bind(): MathVariable;
2950
2973
  set bind(val: MathVariable);
2951
2974
 
2975
+ /**
2976
+ * @throws GLib.Error
2977
+ */
2952
2978
  evaluate(): MathExpression;
2953
2979
 
2954
2980
  get_name(): string;
@@ -3719,6 +3745,9 @@ export namespace GCalc {
3719
3745
  interface MathAssign extends GObject.Object {
3720
3746
 
3721
3747
  // Methods
3748
+ /**
3749
+ * @throws GLib.Error
3750
+ */
3722
3751
  evaluate(): MathExpression;
3723
3752
  }
3724
3753
 
@@ -4349,8 +4378,14 @@ export namespace GCalc {
4349
4378
  set closed(val: boolean);
4350
4379
 
4351
4380
  // Methods
4381
+ /**
4382
+ * @throws GLib.Error
4383
+ */
4352
4384
  evaluate(): MathExpression;
4353
4385
 
4386
+ /**
4387
+ * @throws GLib.Error
4388
+ */
4354
4389
  verify_params(): boolean;
4355
4390
 
4356
4391
  get_param_types(): ExpressionContainer;
@@ -4443,6 +4478,9 @@ export namespace GCalc {
4443
4478
  set closed(val: boolean);
4444
4479
 
4445
4480
  // Methods
4481
+ /**
4482
+ * @throws GLib.Error
4483
+ */
4446
4484
  evaluate(): MathExpression;
4447
4485
 
4448
4486
  get_level(): MathGroupLevel;
@@ -4565,6 +4603,7 @@ export namespace GCalc {
4565
4603
  // Methods
4566
4604
  /**
4567
4605
  * @param val
4606
+ * @throws GLib.Error
4568
4607
  */
4569
4608
  set_value(val: GObject.Value | any | null): void;
4570
4609
 
@@ -4626,6 +4665,9 @@ export namespace GCalc {
4626
4665
  interface MathPolynomial extends GObject.Object, MathPolynomial.Interface {
4627
4666
 
4628
4667
  // Methods
4668
+ /**
4669
+ * @throws GLib.Error
4670
+ */
4629
4671
  evaluate(): MathExpression;
4630
4672
  }
4631
4673
 
@@ -4750,9 +4792,13 @@ export namespace GCalc {
4750
4792
  // Methods
4751
4793
  /**
4752
4794
  * @param t
4795
+ * @throws GLib.Error
4753
4796
  */
4754
4797
  add(t: MathTerm): MathExpression;
4755
4798
 
4799
+ /**
4800
+ * @throws GLib.Error
4801
+ */
4756
4802
  evaluate(): MathExpression;
4757
4803
  }
4758
4804
 
@@ -4842,6 +4888,9 @@ export namespace GCalc {
4842
4888
  set bind(val: MathVariable);
4843
4889
 
4844
4890
  // Methods
4891
+ /**
4892
+ * @throws GLib.Error
4893
+ */
4845
4894
  evaluate(): MathExpression;
4846
4895
 
4847
4896
  get_name(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gcalc-2",
3
- "version": "4.4.0",
3
+ "version": "4.6.0",
4
4
  "description": "GJS TypeScript type definitions for GCalc-2",
5
5
  "type": "module",
6
6
  "module": "gcalc-2.js",
@@ -31,12 +31,12 @@
31
31
  "test": "tsc --project tsconfig.json"
32
32
  },
33
33
  "dependencies": {
34
- "@girs/gjs": "^4.4.0",
35
- "@girs/gio-2.0": "^4.4.0",
36
- "@girs/gobject-2.0": "^4.4.0",
37
- "@girs/glib-2.0": "^4.4.0",
38
- "@girs/gmodule-2.0": "^4.4.0",
39
- "@girs/gee-0.8": "^4.4.0" },
34
+ "@girs/gjs": "^4.6.0",
35
+ "@girs/gio-2.0": "^4.6.0",
36
+ "@girs/gobject-2.0": "^4.6.0",
37
+ "@girs/glib-2.0": "^4.6.0",
38
+ "@girs/gmodule-2.0": "^4.6.0",
39
+ "@girs/gee-0.8": "^4.6.0" },
40
40
  "devDependencies": {
41
41
  "typescript": "*"
42
42
  },