@girs/gcalc-1 4.4.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 +91 -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.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-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
 
@@ -1400,6 +1400,9 @@ export namespace GCalc {
1400
1400
  emit<K extends keyof GAssign.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<GAssign.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
1401
1401
  emit(signal: string, ...args: any[]): void;
1402
1402
 
1403
+ /**
1404
+ * @throws GLib.Error
1405
+ */
1403
1406
  evaluate(): Expression;
1404
1407
  }
1405
1408
 
@@ -1718,6 +1721,9 @@ export namespace GCalc {
1718
1721
  vfunc_evaluate(): Expression;
1719
1722
 
1720
1723
  // Methods
1724
+ /**
1725
+ * @throws GLib.Error
1726
+ */
1721
1727
  evaluate(): Expression;
1722
1728
 
1723
1729
  /**
@@ -1748,6 +1754,9 @@ export namespace GCalc {
1748
1754
  get closed(): boolean;
1749
1755
  set closed(val: boolean);
1750
1756
 
1757
+ /**
1758
+ * @throws GLib.Error
1759
+ */
1751
1760
  verify_params(): boolean;
1752
1761
 
1753
1762
  get_param_types(): ExpressionContainer;
@@ -2107,6 +2116,7 @@ export namespace GCalc {
2107
2116
  /**
2108
2117
  * @param str
2109
2118
  * @param eqman
2119
+ * @throws GLib.Error
2110
2120
  */
2111
2121
  parse(str: string, eqman: MathEquationManager): void;
2112
2122
 
@@ -2204,6 +2214,9 @@ export namespace GCalc {
2204
2214
  emit<K extends keyof GPolynomial.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<GPolynomial.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
2205
2215
  emit(signal: string, ...args: any[]): void;
2206
2216
 
2217
+ /**
2218
+ * @throws GLib.Error
2219
+ */
2207
2220
  evaluate(): Expression;
2208
2221
 
2209
2222
  /**
@@ -2379,6 +2392,9 @@ export namespace GCalc {
2379
2392
  get closed(): boolean;
2380
2393
  set closed(val: boolean);
2381
2394
 
2395
+ /**
2396
+ * @throws GLib.Error
2397
+ */
2382
2398
  evaluate(): Expression;
2383
2399
 
2384
2400
  get_level(): GroupLevel;
@@ -2479,6 +2495,7 @@ export namespace GCalc {
2479
2495
 
2480
2496
  /**
2481
2497
  * @param str
2498
+ * @throws GLib.Error
2482
2499
  */
2483
2500
  solve(str: string): Result;
2484
2501
 
@@ -2553,9 +2570,13 @@ export namespace GCalc {
2553
2570
 
2554
2571
  /**
2555
2572
  * @param t
2573
+ * @throws GLib.Error
2556
2574
  */
2557
2575
  add(t: Term): Expression;
2558
2576
 
2577
+ /**
2578
+ * @throws GLib.Error
2579
+ */
2559
2580
  evaluate(): Expression;
2560
2581
 
2561
2582
  /**
@@ -2633,6 +2654,9 @@ export namespace GCalc {
2633
2654
  get bind(): Variable;
2634
2655
  set bind(val: Variable);
2635
2656
 
2657
+ /**
2658
+ * @throws GLib.Error
2659
+ */
2636
2660
  evaluate(): Expression;
2637
2661
 
2638
2662
  get_name(): string;
@@ -3317,6 +3341,9 @@ export namespace GCalc {
3317
3341
  interface Assign extends GObject.Object {
3318
3342
 
3319
3343
  // Methods
3344
+ /**
3345
+ * @throws GLib.Error
3346
+ */
3320
3347
  evaluate(): Expression;
3321
3348
  }
3322
3349
 
@@ -3673,8 +3700,14 @@ export namespace GCalc {
3673
3700
  set closed(val: boolean);
3674
3701
 
3675
3702
  // Methods
3703
+ /**
3704
+ * @throws GLib.Error
3705
+ */
3676
3706
  evaluate(): Expression;
3677
3707
 
3708
+ /**
3709
+ * @throws GLib.Error
3710
+ */
3678
3711
  verify_params(): boolean;
3679
3712
 
3680
3713
  get_param_types(): ExpressionContainer;
@@ -3812,6 +3845,9 @@ export namespace GCalc {
3812
3845
  set closed(val: boolean);
3813
3846
 
3814
3847
  // Methods
3848
+ /**
3849
+ * @throws GLib.Error
3850
+ */
3815
3851
  evaluate(): Expression;
3816
3852
 
3817
3853
  get_level(): GroupLevel;
@@ -4098,6 +4134,9 @@ export namespace GCalc {
4098
4134
  interface Polynomial extends GObject.Object, Polynomial.Interface {
4099
4135
 
4100
4136
  // Methods
4137
+ /**
4138
+ * @throws GLib.Error
4139
+ */
4101
4140
  evaluate(): Expression;
4102
4141
  }
4103
4142
 
@@ -4232,6 +4271,7 @@ export namespace GCalc {
4232
4271
  // Methods
4233
4272
  /**
4234
4273
  * @param str
4274
+ * @throws GLib.Error
4235
4275
  */
4236
4276
  solve(str: string): Result;
4237
4277
 
@@ -4291,9 +4331,13 @@ export namespace GCalc {
4291
4331
  // Methods
4292
4332
  /**
4293
4333
  * @param t
4334
+ * @throws GLib.Error
4294
4335
  */
4295
4336
  add(t: Term): Expression;
4296
4337
 
4338
+ /**
4339
+ * @throws GLib.Error
4340
+ */
4297
4341
  evaluate(): Expression;
4298
4342
  }
4299
4343
 
@@ -4383,6 +4427,9 @@ export namespace GCalc {
4383
4427
  set bind(val: Variable);
4384
4428
 
4385
4429
  // Methods
4430
+ /**
4431
+ * @throws GLib.Error
4432
+ */
4386
4433
  evaluate(): Expression;
4387
4434
 
4388
4435
  get_name(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gcalc-1",
3
- "version": "4.4.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.4.0",
35
- "@girs/gobject-2.0": "^4.4.0",
36
- "@girs/glib-2.0": "^4.4.0",
37
- "@girs/gio-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.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
  },