@girs/gcalc-2 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-2.d.ts +104 -48
  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.5.0.
7
8
 
8
- GJS TypeScript type definitions for GCalc-2 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-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
 
@@ -1107,6 +1110,7 @@ export namespace GCalc {
1107
1110
  * The item type of a {@link Gio.ListModel} can not change during the life of the
1108
1111
  * model.
1109
1112
  * @returns the {@link GObject.GType} of the items contained in `list`.
1113
+ * @since 2.44
1110
1114
  */
1111
1115
  get_item_type(): GObject.GType;
1112
1116
 
@@ -1117,6 +1121,7 @@ export namespace GCalc {
1117
1121
  * less efficient than iterating the list with increasing values for
1118
1122
  * `position` until `g_list_model_get_item()` returns `null`.
1119
1123
  * @returns the number of items in `list`.
1124
+ * @since 2.44
1120
1125
  */
1121
1126
  get_n_items(): number;
1122
1127
 
@@ -1135,6 +1140,7 @@ export namespace GCalc {
1135
1140
  * See also: `g_list_model_get_n_items()`
1136
1141
  * @param position the position of the item to fetch
1137
1142
  * @returns the object at `position`.
1143
+ * @since 2.44
1138
1144
  */
1139
1145
  get_item(position: number): A | null;
1140
1146
 
@@ -1162,6 +1168,7 @@ export namespace GCalc {
1162
1168
  * @param position the position at which `list` changed
1163
1169
  * @param removed the number of items removed
1164
1170
  * @param added the number of items added
1171
+ * @since 2.44
1165
1172
  */
1166
1173
  items_changed(position: number, removed: number, added: number): void;
1167
1174
 
@@ -1174,6 +1181,7 @@ export namespace GCalc {
1174
1181
  *
1175
1182
  * The same {@link GObject.Object} instance may not appear more than once in a {@link Gio.ListModel}.
1176
1183
  * @param position the position of the item to fetch
1184
+ * @since 2.44
1177
1185
  * @virtual
1178
1186
  */
1179
1187
  vfunc_get_item(position: number): A | null;
@@ -1187,6 +1195,7 @@ export namespace GCalc {
1187
1195
  *
1188
1196
  * The item type of a {@link Gio.ListModel} can not change during the life of the
1189
1197
  * model.
1198
+ * @since 2.44
1190
1199
  * @virtual
1191
1200
  */
1192
1201
  vfunc_get_item_type(): GObject.GType;
@@ -1197,6 +1206,7 @@ export namespace GCalc {
1197
1206
  * Depending on the model implementation, calling this function may be
1198
1207
  * less efficient than iterating the list with increasing values for
1199
1208
  * `position` until `g_list_model_get_item()` returns `null`.
1209
+ * @since 2.44
1200
1210
  * @virtual
1201
1211
  */
1202
1212
  vfunc_get_n_items(): number;
@@ -1366,6 +1376,9 @@ export namespace GCalc {
1366
1376
  vfunc_evaluate(): MathExpression;
1367
1377
 
1368
1378
  // Methods
1379
+ /**
1380
+ * @throws GLib.Error
1381
+ */
1369
1382
  evaluate(): MathExpression;
1370
1383
 
1371
1384
  /**
@@ -1396,6 +1409,9 @@ export namespace GCalc {
1396
1409
  get closed(): boolean;
1397
1410
  set closed(val: boolean);
1398
1411
 
1412
+ /**
1413
+ * @throws GLib.Error
1414
+ */
1399
1415
  verify_params(): boolean;
1400
1416
 
1401
1417
  get_param_types(): ExpressionContainer;
@@ -2202,6 +2218,9 @@ export namespace GCalc {
2202
2218
  get closed(): boolean;
2203
2219
  set closed(val: boolean);
2204
2220
 
2221
+ /**
2222
+ * @throws GLib.Error
2223
+ */
2205
2224
  evaluate(): MathExpression;
2206
2225
 
2207
2226
  get_level(): MathGroupLevel;
@@ -2385,6 +2404,7 @@ export namespace GCalc {
2385
2404
 
2386
2405
  /**
2387
2406
  * @param val
2407
+ * @throws GLib.Error
2388
2408
  */
2389
2409
  set_value(val: GObject.Value | any | null): void;
2390
2410
 
@@ -2476,6 +2496,7 @@ export namespace GCalc {
2476
2496
  /**
2477
2497
  * @param str
2478
2498
  * @param eqman
2499
+ * @throws GLib.Error
2479
2500
  */
2480
2501
  parse(str: string, eqman: MathEquationManager): void;
2481
2502
 
@@ -2573,6 +2594,9 @@ export namespace GCalc {
2573
2594
  emit<K extends keyof Polynomial.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<Polynomial.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
2574
2595
  emit(signal: string, ...args: any[]): void;
2575
2596
 
2597
+ /**
2598
+ * @throws GLib.Error
2599
+ */
2576
2600
  evaluate(): MathExpression;
2577
2601
 
2578
2602
  /**
@@ -2752,11 +2776,13 @@ export namespace GCalc {
2752
2776
  // Methods
2753
2777
  /**
2754
2778
  * @param exp
2779
+ * @throws GLib.Error
2755
2780
  */
2756
2781
  add_expression(exp: string): void;
2757
2782
 
2758
2783
  /**
2759
2784
  * @param str
2785
+ * @throws GLib.Error
2760
2786
  */
2761
2787
  solve(str: string): MathResult;
2762
2788
 
@@ -2814,9 +2840,13 @@ export namespace GCalc {
2814
2840
 
2815
2841
  /**
2816
2842
  * @param t
2843
+ * @throws GLib.Error
2817
2844
  */
2818
2845
  add(t: MathTerm): MathExpression;
2819
2846
 
2847
+ /**
2848
+ * @throws GLib.Error
2849
+ */
2820
2850
  evaluate(): MathExpression;
2821
2851
 
2822
2852
  /**
@@ -2942,6 +2972,9 @@ export namespace GCalc {
2942
2972
  get bind(): MathVariable;
2943
2973
  set bind(val: MathVariable);
2944
2974
 
2975
+ /**
2976
+ * @throws GLib.Error
2977
+ */
2945
2978
  evaluate(): MathExpression;
2946
2979
 
2947
2980
  get_name(): string;
@@ -3712,6 +3745,9 @@ export namespace GCalc {
3712
3745
  interface MathAssign extends GObject.Object {
3713
3746
 
3714
3747
  // Methods
3748
+ /**
3749
+ * @throws GLib.Error
3750
+ */
3715
3751
  evaluate(): MathExpression;
3716
3752
  }
3717
3753
 
@@ -4342,8 +4378,14 @@ export namespace GCalc {
4342
4378
  set closed(val: boolean);
4343
4379
 
4344
4380
  // Methods
4381
+ /**
4382
+ * @throws GLib.Error
4383
+ */
4345
4384
  evaluate(): MathExpression;
4346
4385
 
4386
+ /**
4387
+ * @throws GLib.Error
4388
+ */
4347
4389
  verify_params(): boolean;
4348
4390
 
4349
4391
  get_param_types(): ExpressionContainer;
@@ -4436,6 +4478,9 @@ export namespace GCalc {
4436
4478
  set closed(val: boolean);
4437
4479
 
4438
4480
  // Methods
4481
+ /**
4482
+ * @throws GLib.Error
4483
+ */
4439
4484
  evaluate(): MathExpression;
4440
4485
 
4441
4486
  get_level(): MathGroupLevel;
@@ -4558,6 +4603,7 @@ export namespace GCalc {
4558
4603
  // Methods
4559
4604
  /**
4560
4605
  * @param val
4606
+ * @throws GLib.Error
4561
4607
  */
4562
4608
  set_value(val: GObject.Value | any | null): void;
4563
4609
 
@@ -4619,6 +4665,9 @@ export namespace GCalc {
4619
4665
  interface MathPolynomial extends GObject.Object, MathPolynomial.Interface {
4620
4666
 
4621
4667
  // Methods
4668
+ /**
4669
+ * @throws GLib.Error
4670
+ */
4622
4671
  evaluate(): MathExpression;
4623
4672
  }
4624
4673
 
@@ -4743,9 +4792,13 @@ export namespace GCalc {
4743
4792
  // Methods
4744
4793
  /**
4745
4794
  * @param t
4795
+ * @throws GLib.Error
4746
4796
  */
4747
4797
  add(t: MathTerm): MathExpression;
4748
4798
 
4799
+ /**
4800
+ * @throws GLib.Error
4801
+ */
4749
4802
  evaluate(): MathExpression;
4750
4803
  }
4751
4804
 
@@ -4835,6 +4888,9 @@ export namespace GCalc {
4835
4888
  set bind(val: MathVariable);
4836
4889
 
4837
4890
  // Methods
4891
+ /**
4892
+ * @throws GLib.Error
4893
+ */
4838
4894
  evaluate(): MathExpression;
4839
4895
 
4840
4896
  get_name(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gcalc-2",
3
- "version": "4.3.0",
3
+ "version": "4.5.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.3.0",
35
- "@girs/gio-2.0": "^4.3.0",
36
- "@girs/gobject-2.0": "^4.3.0",
37
- "@girs/glib-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/gio-2.0": "^4.5.0",
36
+ "@girs/gobject-2.0": "^4.5.0",
37
+ "@girs/glib-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
  },