@girs/gdl-3 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.
package/README.md CHANGED
@@ -4,82 +4,96 @@
4
4
  ![version](https://img.shields.io/npm/v/@girs/gdl-3)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/gdl-3)
6
6
 
7
+ GJS TypeScript type definitions for Gdl-3 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.5.0.
7
8
 
8
- GJS TypeScript type definitions for Gdl-3 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/gdl-3
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/gdl-3` | the namespace as a default export, plus the ambient and global declarations |
26
+ | `@girs/gdl-3/ambient` | only the `gi://` module declarations |
27
+ | `@girs/gdl-3/import` | only the `imports.gi` declarations |
28
+ | `@girs/gdl-3/gdl-3` | the namespace, without the side-effecting declarations |
29
+ | `@girs/gdl-3/vocabulary` | GIR-derived widget data: settable properties, enum nicks, slot candidates |
30
+
31
+ ## Three ways to import
32
+
33
+ Which one you use depends on how you write imports elsewhere, not on your toolchain.
34
+
35
+ ### As a module
18
36
 
19
- Import it like any other module:
20
37
  ```ts
21
38
  import Gdl from '@girs/gdl-3';
22
39
  ```
23
40
 
24
- ### Ambient Modules
41
+ ### As `gi://`
25
42
 
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/gdl-3` or `@girs/gdl-3/ambient` in your `tsconfig` or entry point Typescript file:
43
+ GJS resolves `gi://` at runtime. To give it types, reference the package once, either
44
+ from your entry point or from `tsconfig.json`:
28
45
 
29
- `index.ts`:
30
46
  ```ts
31
- import '@girs/gdl-3'
47
+ import '@girs/gdl-3';
32
48
  ```
33
49
 
34
- `tsconfig.json`:
35
50
  ```json
36
- {
37
- "compilerOptions": {
38
- ...
39
- },
40
- "include": ["@girs/gdl-3"],
41
- ...
42
- }
51
+ { "include": ["@girs/gdl-3"] }
43
52
  ```
44
53
 
45
- The ambient module now resolves with types:
54
+ Then the runtime spelling type-checks:
46
55
 
47
56
  ```ts
48
57
  import Gdl from 'gi://Gdl?version=3';
49
58
  ```
50
59
 
51
- ### Global import
60
+ Referencing `@girs/gdl-3/ambient` instead pulls in these declarations
61
+ alone. See [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules).
62
+
63
+ ### As `imports.gi`
52
64
 
53
- GJS's global `imports.gi` works too, with types.
54
- For this you need to include `@girs/gdl-3` or `@girs/gdl-3/import` in your `tsconfig` or entry point Typescript file:
65
+ GJS's global object works the same way, via `@girs/gdl-3/import`:
55
66
 
56
- `index.ts`:
57
67
  ```ts
58
- import '@girs/gdl-3'
68
+ const Gdl = imports.gi.Gdl;
59
69
  ```
60
70
 
61
- `tsconfig.json`:
62
- ```json
63
- {
64
- "compilerOptions": {
65
- ...
66
- },
67
- "include": ["@girs/gdl-3"],
68
- ...
69
- }
70
- ```
71
+ ## Widget vocabulary
71
72
 
72
- That form carries types as well:
73
+ `gdl-3` declares widgets, so it also carries what the GIR says about them, as
74
+ types and as values a test can read:
73
75
 
74
76
  ```ts
75
- const Gdl = imports.gi.Gdl;
77
+ import type { Widgets, PropsOf } from '@girs/gdl-3/vocabulary';
78
+ import { OWN_PROPS, ENUM_NICKS, PROVENANCE } from '@girs/gdl-3/vocabulary';
76
79
  ```
77
80
 
78
- ### Bundle
81
+ Properties are keyed the way GObject registered them, writable-only and optional, so they
82
+ match `g_object_set`, GtkBuilder XML and Blueprint. `PROVENANCE.libraryVersion` names the
83
+ library release this was generated from, which lets a check tell "newer than what is
84
+ installed" from "wrong".
79
85
 
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.
86
+ This subpath answers what the GIR says, not what the installed library has. For the
87
+ second question, ask the library.
88
+
89
+ ## Building
90
+
91
+ The declarations need no build step. If you bundle, every bundler works, since there is
92
+ no runtime code to resolve. The [examples](https://github.com/gjsify/ts-for-gir/tree/main/examples)
93
+ show working setups for several.
81
94
 
82
95
  ## Other packages
83
96
 
84
- All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
97
+ Every pre-generated package is at [gjsify/types](https://github.com/gjsify/types).
98
+
85
99
 
@@ -0,0 +1,418 @@
1
+ /**
2
+ * The GIR-derived widget VOCABULARY for Gdl-3.
3
+ *
4
+ * GENERATED — do not edit. Provenance: Gdl-3 — dropped empty base(s): GObject.InitiallyUnowned GObject.Object Atk.ImplementorIface — prop(s) no TypeScript value satisfies: Gdl.DockObject.pixbuf-icon
5
+ *
6
+ * 12 concrete widgets, 12 declarations, 3 enum nick unions, 4 slot candidates.
7
+ *
8
+ * Module-scoped exports only. There is no `JSX` namespace here, no tag spelling and
9
+ * no `on<Signal>` prop name: those are DIALECT, and every framework answers them
10
+ * differently. The shape to avoid is the GLOBAL AUGMENT — a `declare global` on
11
+ * `React.JSX` collides with every other library on a shared tag — while a
12
+ * module-scoped `JSX` behind a `jsxImportSource` does not. This package is used by
13
+ * projects that want nothing to do with JSX, so it emits neither; a consumer declaring
14
+ * a module-scoped namespace over these names is doing it right.
15
+ *
16
+ * Three things this is and `ConstructorProps` is not: WRITABLE-only (measured on
17
+ * Gtk-4.0, `ConstructorProps` offers 150 read-only properties across 68 classes as
18
+ * settable, and GTK's failure mode for writing one is exit 0), OPTIONAL, and keyed
19
+ * by the name GObject actually REGISTERED — the dashed spelling `g_object_set`,
20
+ * GtkBuilder XML and Blueprint all use.
21
+ *
22
+ * Signal handler types are not re-derived: `X.SignalSignatures`, which this package
23
+ * already emits for every class with the parent chain, every implemented interface
24
+ * and the `notify::` keys folded in, is what `Widgets[G]['signals']` points at.
25
+ */
26
+
27
+ import type GObject from '@girs/gobject-2.0';
28
+ import type Gdl from './gdl-3.js';
29
+ import type Gtk from '@girs/gtk-3.0';
30
+ import type { GtkBinConstructOnly, GtkBinProps, GtkBoxConstructOnly, GtkBoxProps, GtkBuildableConstructOnly, GtkBuildableProps, GtkContainerConstructOnly, GtkContainerProps, GtkNotebookConstructOnly, GtkNotebookProps, GtkOrientableConstructOnly, GtkOrientableProps, GtkOrientationNick, GtkPositionTypeNick, GtkWidgetConstructOnly, GtkWidgetProps, GtkWindowConstructOnly, GtkWindowProps } from '@girs/gtk-3.0/vocabulary';
31
+
32
+ // ---------------------------------------------------------------------------
33
+ // Enum nicks — the string vocabulary GObject registered, from GIR's `glib:nick`.
34
+ //
35
+ // Not derived from the member name. Substituting underscores for dashes is not a law:
36
+ // some nicks keep an underscore the substitution would have replaced, and only the
37
+ // attribute knows which. Gtk-4.0 and Adw-1 contradict no derivation at all, which is
38
+ // how a derived nick passes review and breaks elsewhere.
39
+ // Re-measure with `scripts/check-nick-derivation.mjs` in ts-for-gir.
40
+ // ---------------------------------------------------------------------------
41
+
42
+ export type GdlDockBarStyleNick = 'icons' | 'text' | 'both' | 'auto';
43
+ export type GdlDockPlacementNick = 'none' | 'top' | 'bottom' | 'right' | 'left' | 'center' | 'floating';
44
+ export type GdlSwitcherStyleNick = 'text' | 'icon' | 'both' | 'toolbar' | 'tabs' | 'none';
45
+
46
+ // ---------------------------------------------------------------------------
47
+ // Property surfaces — one interface per GIR DECLARATION, mirroring GIR's own
48
+ // inheritance rather than flattening per widget.
49
+ //
50
+ // The interfaces are load-bearing, not tidiness: `GtkBox` declares four properties
51
+ // of its own and `orientation` is not among them — it lives on `Gtk.Orientable`,
52
+ // because GObject installs interface properties on the implementor at runtime while
53
+ // GIR keeps them once, on the interface.
54
+ // ---------------------------------------------------------------------------
55
+
56
+ export interface GdlDockProps extends GdlDockObjectProps, GtkBuildableProps {
57
+ /** @default NULL */
58
+ 'default-title'?: string;
59
+ /** @default FALSE */
60
+ floating?: boolean;
61
+ /** @default 0 */
62
+ floatx?: number;
63
+ /** @default 0 */
64
+ floaty?: number;
65
+ /** @default -1 */
66
+ height?: number;
67
+ /**
68
+ * Whether or not to prevent a floating dock window from appearing in the taskbar.
69
+ * @since 3.6
70
+ * @default TRUE
71
+ */
72
+ 'skip-taskbar'?: boolean;
73
+ /** @default -1 */
74
+ width?: number;
75
+ }
76
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
77
+ export type GdlDockConstructOnly = GdlDockObjectConstructOnly | GtkBuildableConstructOnly | 'floating';
78
+
79
+ export interface GdlDockBarProps extends GtkBoxProps, GtkBuildableProps, GtkOrientableProps {
80
+ /** @default GDL_DOCK_BAR_BOTH */
81
+ 'dockbar-style'?: GdlDockBarStyleNick | Gdl.DockBarStyle;
82
+ /** The #GdlDockMaster object attached to the dockbar. */
83
+ master?: GObject.Object;
84
+ }
85
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
86
+ export type GdlDockBarConstructOnly = GtkBoxConstructOnly | GtkBuildableConstructOnly | GtkOrientableConstructOnly;
87
+
88
+ export interface GdlDockItemProps extends GdlDockObjectProps, GtkBuildableProps {
89
+ /** @default GDL_DOCK_ITEM_BEH_NORMAL */
90
+ behavior?: number;
91
+ /**
92
+ * If set, the dock item is closed.
93
+ * @since 3.6
94
+ * @default FALSE
95
+ */
96
+ closed?: boolean;
97
+ /**
98
+ * If set, the dock item is hidden but it has a corresponding icon in the dock bar allowing to show it again.
99
+ * @since 3.6
100
+ * @default FALSE
101
+ */
102
+ iconified?: boolean;
103
+ /** @default FALSE */
104
+ locked?: boolean;
105
+ /**
106
+ * The orientation of the docking item.
107
+ * @default GTK_ORIENTATION_VERTICAL
108
+ */
109
+ orientation?: GtkOrientationNick | Gtk.Orientation;
110
+ /** @default -1 */
111
+ 'preferred-height'?: number;
112
+ /** @default -1 */
113
+ 'preferred-width'?: number;
114
+ /** @default TRUE */
115
+ resize?: boolean;
116
+ }
117
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
118
+ export type GdlDockItemConstructOnly = GdlDockObjectConstructOnly | GtkBuildableConstructOnly;
119
+
120
+ export interface GdlDockItemButtonImageProps extends GtkWidgetProps, GtkBuildableProps {
121
+ }
122
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
123
+ export type GdlDockItemButtonImageConstructOnly = GtkWidgetConstructOnly | GtkBuildableConstructOnly;
124
+
125
+ export interface GdlDockItemGripProps extends GtkContainerProps, GtkBuildableProps {
126
+ item?: Gdl.DockItem;
127
+ }
128
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
129
+ export type GdlDockItemGripConstructOnly = GtkContainerConstructOnly | GtkBuildableConstructOnly | 'item';
130
+
131
+ export interface GdlDockNotebookProps extends GdlDockItemProps, GtkBuildableProps {
132
+ /** @default -1 */
133
+ page?: number;
134
+ }
135
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
136
+ export type GdlDockNotebookConstructOnly = GdlDockItemConstructOnly | GtkBuildableConstructOnly;
137
+
138
+ export interface GdlDockObjectProps extends GtkContainerProps, GtkBuildableProps {
139
+ /**
140
+ * A long descriptive name.
141
+ * @default NULL
142
+ */
143
+ 'long-name'?: string;
144
+ /** The master which manages all the objects in a dock ring */
145
+ master?: Gdl.DockMaster;
146
+ /**
147
+ * The object name.
148
+ * @default NULL
149
+ */
150
+ name?: string;
151
+ /**
152
+ * A GdkPixbuf to use for the icon of the dock object.
153
+ * @since 3.3.2
154
+ */
155
+ 'pixbuf-icon'?: never;
156
+ /**
157
+ * A stock id to use for the icon of the dock object.
158
+ * @default NULL
159
+ */
160
+ 'stock-id'?: string;
161
+ }
162
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
163
+ export type GdlDockObjectConstructOnly = GtkContainerConstructOnly | GtkBuildableConstructOnly | 'name';
164
+
165
+ export interface GdlDockPanedProps extends GdlDockItemProps, GtkBuildableProps {
166
+ /** @default 0 */
167
+ position?: number;
168
+ }
169
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
170
+ export type GdlDockPanedConstructOnly = GdlDockItemConstructOnly | GtkBuildableConstructOnly;
171
+
172
+ export interface GdlDockPlaceholderProps extends GdlDockObjectProps, GtkBuildableProps {
173
+ /** @default FALSE */
174
+ floating?: boolean;
175
+ /** @default -1 */
176
+ floatx?: number;
177
+ /** @default -1 */
178
+ floaty?: number;
179
+ /** @default -1 */
180
+ height?: number;
181
+ host?: Gdl.DockObject;
182
+ /** @default GDL_DOCK_CENTER */
183
+ 'next-placement'?: GdlDockPlacementNick | Gdl.DockPlacement;
184
+ /** @default FALSE */
185
+ sticky?: boolean;
186
+ /** @default -1 */
187
+ width?: number;
188
+ }
189
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
190
+ export type GdlDockPlaceholderConstructOnly = GdlDockObjectConstructOnly | GtkBuildableConstructOnly | 'floating' | 'floatx' | 'floaty' | 'sticky';
191
+
192
+ export interface GdlDockTablabelProps extends GtkBinProps, GtkBuildableProps {
193
+ item?: Gdl.DockItem;
194
+ }
195
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
196
+ export type GdlDockTablabelConstructOnly = GtkBinConstructOnly | GtkBuildableConstructOnly;
197
+
198
+ /** The GdlDockLayout struct contains only private fields and should not be directly accessed. */
199
+ export interface GdlPreviewWindowProps extends GtkWindowProps, GtkBuildableProps {
200
+ }
201
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
202
+ export type GdlPreviewWindowConstructOnly = GtkWindowConstructOnly | GtkBuildableConstructOnly;
203
+
204
+ export interface GdlSwitcherProps extends GtkNotebookProps, GtkBuildableProps {
205
+ /** @default GDL_SWITCHER_STYLE_BOTH */
206
+ 'switcher-style'?: GdlSwitcherStyleNick | Gdl.SwitcherStyle;
207
+ /** @default GTK_POS_BOTTOM */
208
+ 'tab-pos'?: GtkPositionTypeNick | Gtk.PositionType;
209
+ /** @default FALSE */
210
+ 'tab-reorderable'?: boolean;
211
+ }
212
+ /** Settable only at construction — a renderer must REBUILD, not patch. */
213
+ export type GdlSwitcherConstructOnly = GtkNotebookConstructOnly | GtkBuildableConstructOnly;
214
+
215
+ // ---------------------------------------------------------------------------
216
+ // The GType-keyed widget map.
217
+ //
218
+ // Keyed by GType because that is also the GtkBuilder XML key and the typelib key. A
219
+ // consumer maps GTypes to tags in ITS convention — kebab for JSX intrinsics, Pascal
220
+ // for a Vue `GlobalComponents`, the class itself for a renderer whose element type
221
+ // is the class. None of those is baked in here.
222
+ //
223
+ // `slotCandidates` is a candidate list and never an answer: derived from methods
224
+ // taking exactly one widget argument. The GIR cannot tell adoption from reference —
225
+ // `set_title_widget` parents its argument and `set_activatable_widget` does not, and
226
+ // both are `void f(GtkWidget*)` at `transfer-ownership="none"`. Curation decides;
227
+ // this is what notices when a release adds a candidate.
228
+ // ---------------------------------------------------------------------------
229
+
230
+ export interface Widgets {
231
+ GdlDock: {
232
+ class: Gdl.Dock;
233
+ props: GdlDockProps;
234
+ signals: Gdl.Dock.SignalSignatures;
235
+ constructOnly: GdlDockConstructOnly;
236
+ slotCandidates: {};
237
+ };
238
+ GdlDockBar: {
239
+ class: Gdl.DockBar;
240
+ props: GdlDockBarProps;
241
+ signals: Gdl.DockBar.SignalSignatures;
242
+ constructOnly: GdlDockBarConstructOnly;
243
+ slotCandidates: {};
244
+ };
245
+ GdlDockItem: {
246
+ class: Gdl.DockItem;
247
+ props: GdlDockItemProps;
248
+ signals: Gdl.DockItem.SignalSignatures;
249
+ constructOnly: GdlDockItemConstructOnly;
250
+ slotCandidates: {
251
+ 'child': 'set_child';
252
+ 'default-position': 'set_default_position';
253
+ 'tablabel': 'set_tablabel';
254
+ };
255
+ };
256
+ GdlDockItemButtonImage: {
257
+ class: Gdl.DockItemButtonImage;
258
+ props: GdlDockItemButtonImageProps;
259
+ signals: Gdl.DockItemButtonImage.SignalSignatures;
260
+ constructOnly: GdlDockItemButtonImageConstructOnly;
261
+ slotCandidates: {};
262
+ };
263
+ GdlDockItemGrip: {
264
+ class: Gdl.DockItemGrip;
265
+ props: GdlDockItemGripProps;
266
+ signals: Gdl.DockItemGrip.SignalSignatures;
267
+ constructOnly: GdlDockItemGripConstructOnly;
268
+ slotCandidates: {
269
+ 'label': 'set_label';
270
+ };
271
+ };
272
+ GdlDockNotebook: {
273
+ class: Gdl.DockNotebook;
274
+ props: GdlDockNotebookProps;
275
+ signals: Gdl.DockNotebook.SignalSignatures;
276
+ constructOnly: GdlDockNotebookConstructOnly;
277
+ slotCandidates: {};
278
+ };
279
+ GdlDockObject: {
280
+ class: Gdl.DockObject;
281
+ props: GdlDockObjectProps;
282
+ signals: Gdl.DockObject.SignalSignatures;
283
+ constructOnly: GdlDockObjectConstructOnly;
284
+ slotCandidates: {};
285
+ };
286
+ GdlDockPaned: {
287
+ class: Gdl.DockPaned;
288
+ props: GdlDockPanedProps;
289
+ signals: Gdl.DockPaned.SignalSignatures;
290
+ constructOnly: GdlDockPanedConstructOnly;
291
+ slotCandidates: {};
292
+ };
293
+ GdlDockPlaceholder: {
294
+ class: Gdl.DockPlaceholder;
295
+ props: GdlDockPlaceholderProps;
296
+ signals: Gdl.DockPlaceholder.SignalSignatures;
297
+ constructOnly: GdlDockPlaceholderConstructOnly;
298
+ slotCandidates: {};
299
+ };
300
+ GdlDockTablabel: {
301
+ class: Gdl.DockTablabel;
302
+ props: GdlDockTablabelProps;
303
+ signals: Gdl.DockTablabel.SignalSignatures;
304
+ constructOnly: GdlDockTablabelConstructOnly;
305
+ slotCandidates: {};
306
+ };
307
+ GdlPreviewWindow: {
308
+ class: Gdl.PreviewWindow;
309
+ props: GdlPreviewWindowProps;
310
+ signals: Gdl.PreviewWindow.SignalSignatures;
311
+ constructOnly: GdlPreviewWindowConstructOnly;
312
+ slotCandidates: {};
313
+ };
314
+ GdlSwitcher: {
315
+ class: Gdl.Switcher;
316
+ props: GdlSwitcherProps;
317
+ signals: Gdl.Switcher.SignalSignatures;
318
+ constructOnly: GdlSwitcherConstructOnly;
319
+ slotCandidates: {};
320
+ };
321
+ }
322
+
323
+ /** Every GType this namespace can create. A consumer derives its own tag map. */
324
+ export type WidgetGType = keyof Widgets;
325
+
326
+ // ---------------------------------------------------------------------------
327
+ // Child holders — the same shape, for objects that CARRY a widget without being one.
328
+ //
329
+ // `GtkListItem`, `GtkListHeader`, `GtkColumnViewCell` and `AdwToggle` descend from
330
+ // `GObject.Object` and hold a widget through `set_child`/`get_child`. A renderer places
331
+ // them exactly like a container, so they belong in the vocabulary; a check asking "is
332
+ // this a widget" must still be able to say no. Hence a sibling table rather than four
333
+ // more rows in `Widgets`: concatenate them when you mean both.
334
+ // ---------------------------------------------------------------------------
335
+
336
+ export interface ChildHolders {
337
+
338
+ }
339
+
340
+ /** Every GType this namespace holds a child in without it being a widget. */
341
+ export type ChildHolderGType = keyof ChildHolders;
342
+
343
+ /** The writable, optional, GObject-keyed property surface of one GType. */
344
+ export type PropsOf<G extends WidgetGType> = Widgets[G]['props'];
345
+
346
+ /** The signal table this package already emits, reached by GType. */
347
+ export type SignalsOf<G extends WidgetGType> = Widgets[G]['signals'];
348
+
349
+ /** The instance type — what a `ref`-shaped prop should infer. */
350
+ export type InstanceOf<G extends WidgetGType> = Widgets[G]['class'];
351
+
352
+ /** Property names that can only be set at construction. */
353
+ export type ConstructOnlyOf<G extends WidgetGType> = Widgets[G]['constructOnly'];
354
+
355
+ /** Candidate child slots — see the note above; curation decides. */
356
+ export type SlotCandidatesOf<G extends WidgetGType> = keyof Widgets[G]['slotCandidates'];
357
+
358
+ /**
359
+ * The same facts as runtime data, for a consumer that CHECKS them.
360
+ *
361
+ * Types are erased, so a spec that asks the installed GTK whether every property
362
+ * here is a writable ParamSpec, every signal resolvable by `GObject.signal_lookup`
363
+ * and every nick resolvable through an enum lookup cannot read the interfaces
364
+ * above. Emitted headlessly with no GTK present, which is exactly why the checking
365
+ * belongs to the consumer and the DATA belongs here.
366
+ */
367
+ export const PROVENANCE: {
368
+ readonly namespace: string;
369
+ readonly version: string;
370
+ /** The version the LIBRARY states, or null where it states none. Never the namespace's. */
371
+ readonly libraryVersion: string | null;
372
+ readonly childHolders: number;
373
+ readonly droppedBases: readonly string[];
374
+ readonly inlinedBases: readonly string[];
375
+ readonly unsettableProps: readonly string[];
376
+ };
377
+
378
+ /** Declaration GType -> its own settable properties, as GObject registered them. */
379
+ export const OWN_PROPS: Readonly<Record<string, readonly string[]>>;
380
+
381
+ /**
382
+ * Declaration GType -> the signals it registers itself, never its parents'.
383
+ *
384
+ * Keyed like `OWN_PROPS`, so both are read at every link of a `DECLS` chain. An
385
+ * abstract base has no `Widgets` row and still owns signals — `GtkWidget` owns 13.
386
+ */
387
+ export const OWN_SIGNALS: Readonly<Record<string, readonly string[]>>;
388
+
389
+ /** Widget GType -> every declaration its members come from, self first. */
390
+ export const DECLS: Readonly<Record<string, readonly string[]>>;
391
+
392
+ /** The GTypes in `DECLS` that hold a widget without being one — see `ChildHolders`. */
393
+ export const CHILD_HOLDERS: readonly string[];
394
+
395
+ /** Enum GType -> the nicks this surface offers. */
396
+ export const ENUM_NICKS: Readonly<Record<string, readonly string[]>>;
397
+
398
+ /** Widget GType -> slot name -> the method that may adopt a child there. */
399
+ export const SLOT_CANDIDATES: Readonly<Record<string, Readonly<Record<string, string>>>>;
400
+
401
+ /**
402
+ * `Type`, `Type.property` and `Type::signal` -> the release that introduced it.
403
+ *
404
+ * What keeps a runtime cross-check honest across a version gap without an
405
+ * allowlist: a name the installed library lacks is a defect UNLESS the version
406
+ * here is newer than the one running.
407
+ *
408
+ * ALL THREE key shapes, because that test only works for the names it covers. A
409
+ * property-only map leaves a consumer no way to explain a missing SIGNAL, which is
410
+ * a correct vocabulary reported as 18 defects; a member-only map leaves it no way to
411
+ * explain a missing CLASS, and that one fails as a bare
412
+ * `TypeError: can't access property "$gtype", ctor() is undefined` that does not
413
+ * even name the GType.
414
+ *
415
+ * A key is present only where the GIR states a version — sparse by nature (`version`
416
+ * sits on 29 of the 301 classes and interfaces in Gtk-4.0), never inferred.
417
+ */
418
+ export const SINCE: Readonly<Record<string, string>>;
@@ -0,0 +1,83 @@
1
+ // The widget vocabulary of Gdl-3 as runtime data.
2
+ //
3
+ // GENERATED — do not edit. Provenance: Gdl-3 — dropped empty base(s): GObject.InitiallyUnowned GObject.Object Atk.ImplementorIface — prop(s) no TypeScript value satisfies: Gdl.DockObject.pixbuf-icon
4
+ //
5
+ // The type half of this subpath is the sibling `.d.ts`. This file exists because
6
+ // types are erased: a consumer that wants to ask the installed library whether every
7
+ // name here is real needs values, not declarations.
8
+
9
+ export const PROVENANCE = {
10
+ namespace: 'Gdl',
11
+ version: '3',
12
+ libraryVersion: null,
13
+ childHolders: 0,
14
+ droppedBases: ['GObject.InitiallyUnowned', 'GObject.Object', 'Atk.ImplementorIface'],
15
+ inlinedBases: [],
16
+ unsettableProps: ['Gdl.DockObject.pixbuf-icon'],
17
+ };
18
+
19
+ export const OWN_PROPS = {
20
+ GdlDock: ['default-title', 'floating', 'floatx', 'floaty', 'height', 'skip-taskbar', 'width'],
21
+ GdlDockBar: ['dockbar-style', 'master'],
22
+ GdlDockItem: ['behavior', 'closed', 'iconified', 'locked', 'orientation', 'preferred-height', 'preferred-width', 'resize'],
23
+ GdlDockItemGrip: ['item'],
24
+ GdlDockNotebook: ['page'],
25
+ GdlDockObject: ['long-name', 'master', 'name', 'pixbuf-icon', 'stock-id'],
26
+ GdlDockPaned: ['position'],
27
+ GdlDockPlaceholder: ['floating', 'floatx', 'floaty', 'height', 'host', 'next-placement', 'sticky', 'width'],
28
+ GdlDockTablabel: ['item'],
29
+ GdlSwitcher: ['switcher-style', 'tab-pos', 'tab-reorderable'],
30
+ };
31
+
32
+ export const OWN_SIGNALS = {
33
+ GdlDock: ['layout-changed'],
34
+ GdlDockItem: ['deselected', 'dock-drag-begin', 'dock-drag-end', 'dock-drag-motion', 'move-focus-child', 'selected'],
35
+ GdlDockObject: ['detach', 'dock'],
36
+ GdlDockTablabel: ['button-pressed-handle'],
37
+ };
38
+
39
+ export const DECLS = {
40
+ GdlDock: ['GdlDock', 'GdlDockObject', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
41
+ GdlDockBar: ['GdlDockBar', 'GtkBox', 'GtkContainer', 'GtkWidget', 'GtkBuildable', 'GtkOrientable'],
42
+ GdlDockItem: ['GdlDockItem', 'GdlDockObject', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
43
+ GdlDockItemButtonImage: ['GdlDockItemButtonImage', 'GtkWidget', 'GtkBuildable'],
44
+ GdlDockItemGrip: ['GdlDockItemGrip', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
45
+ GdlDockNotebook: ['GdlDockNotebook', 'GdlDockItem', 'GdlDockObject', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
46
+ GdlDockObject: ['GdlDockObject', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
47
+ GdlDockPaned: ['GdlDockPaned', 'GdlDockItem', 'GdlDockObject', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
48
+ GdlDockPlaceholder: ['GdlDockPlaceholder', 'GdlDockObject', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
49
+ GdlDockTablabel: ['GdlDockTablabel', 'GtkBin', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
50
+ GdlPreviewWindow: ['GdlPreviewWindow', 'GtkWindow', 'GtkBin', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
51
+ GdlSwitcher: ['GdlSwitcher', 'GtkNotebook', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
52
+ };
53
+
54
+ // The GTypes above that are NOT widgets: they hold one through `set_child`/`get_child`
55
+ // and descend from `GObject.Object`. A renderer places them like a container; a check
56
+ // asking "is this a widget" must not count them. Derived from the accessor pair, never
57
+ // from a list — the count is in the provenance line above.
58
+ export const CHILD_HOLDERS = [];
59
+
60
+ export const ENUM_NICKS = {
61
+ GdlDockBarStyle: ['icons', 'text', 'both', 'auto'],
62
+ GdlDockPlacement: ['none', 'top', 'bottom', 'right', 'left', 'center', 'floating'],
63
+ GdlSwitcherStyle: ['text', 'icon', 'both', 'toolbar', 'tabs', 'none'],
64
+ };
65
+
66
+ export const SLOT_CANDIDATES = {
67
+ GdlDockItem: {
68
+ 'child': 'set_child',
69
+ 'default-position': 'set_default_position',
70
+ 'tablabel': 'set_tablabel',
71
+ },
72
+ GdlDockItemGrip: {
73
+ 'label': 'set_label',
74
+ },
75
+ };
76
+
77
+ export const SINCE = {
78
+ 'GdlDock.skip-taskbar': '3.6',
79
+ 'GdlDockItem.closed': '3.6',
80
+ 'GdlDockItem.iconified': '3.6',
81
+ 'GdlDockItem::move-focus-child': '3.3.2',
82
+ 'GdlDockObject.pixbuf-icon': '3.3.2',
83
+ };
package/gdl-3.d.ts CHANGED
@@ -47,19 +47,19 @@ export namespace Gdl {
47
47
  /**
48
48
  * Buttons display only icons in the dockbar.
49
49
  */
50
- ICONS,
50
+ ICONS = 0,
51
51
  /**
52
52
  * Buttons display only text labels in the dockbar.
53
53
  */
54
- TEXT,
54
+ TEXT = 1,
55
55
  /**
56
56
  * Buttons display text and icons in the dockbar.
57
57
  */
58
- BOTH,
58
+ BOTH = 2,
59
59
  /**
60
60
  * identical to `GDL_DOCK_BAR_BOTH`.
61
61
  */
62
- AUTO,
62
+ AUTO = 3,
63
63
  }
64
64
 
65
65
 
@@ -71,11 +71,11 @@ export namespace Gdl {
71
71
  /**
72
72
  * Display a small cross
73
73
  */
74
- CLOSE,
74
+ CLOSE = 0,
75
75
  /**
76
76
  * Display a small triangle
77
77
  */
78
- ICONIFY,
78
+ ICONIFY = 1,
79
79
  }
80
80
 
81
81
 
@@ -94,31 +94,31 @@ export namespace Gdl {
94
94
  /**
95
95
  * No position defined
96
96
  */
97
- NONE,
97
+ NONE = 0,
98
98
  /**
99
99
  * Dock object on the top
100
100
  */
101
- TOP,
101
+ TOP = 1,
102
102
  /**
103
103
  * Dock object on the bottom
104
104
  */
105
- BOTTOM,
105
+ BOTTOM = 2,
106
106
  /**
107
107
  * Dock object on the right
108
108
  */
109
- RIGHT,
109
+ RIGHT = 3,
110
110
  /**
111
111
  * Dock object on the left
112
112
  */
113
- LEFT,
113
+ LEFT = 4,
114
114
  /**
115
115
  * Dock object on top of the other
116
116
  */
117
- CENTER,
117
+ CENTER = 5,
118
118
  /**
119
119
  * Dock object in its own window
120
120
  */
121
- FLOATING,
121
+ FLOATING = 6,
122
122
  }
123
123
 
124
124
 
@@ -137,38 +137,45 @@ export namespace Gdl {
137
137
  /**
138
138
  * Tabs display only text labels.
139
139
  */
140
- TEXT,
140
+ TEXT = 0,
141
141
  /**
142
142
  * Tabs display only icons.
143
143
  */
144
- ICON,
144
+ ICON = 1,
145
145
  /**
146
146
  * Tabs display text and icons.
147
147
  */
148
- BOTH,
148
+ BOTH = 2,
149
149
  /**
150
150
  * Same as `GDL_SWITCHER_STYLE_BOTH`.
151
151
  */
152
- TOOLBAR,
152
+ TOOLBAR = 3,
153
153
  /**
154
154
  * Tabs display like notebook tabs.
155
155
  */
156
- TABS,
156
+ TABS = 4,
157
157
  /**
158
158
  * Do not display tabs.
159
159
  */
160
- NONE,
160
+ NONE = 5,
161
161
  }
162
162
 
163
163
 
164
+ /**
165
+ * @default master
166
+ */
164
167
  const DOCK_MASTER_PROPERTY: string;
165
168
 
169
+ /**
170
+ * @default name
171
+ */
166
172
  const DOCK_NAME_PROPERTY: string;
167
173
 
168
174
  /**
169
175
  * Minimum shift count to be used for user defined flags, to be stored in
170
176
  * {@link Gdl.DockObject}.flags.
171
177
  * @deprecated since 3.6: Use a private flag instead
178
+ * @default 8
172
179
  */
173
180
  const DOCK_OBJECT_FLAGS_SHIFT: number;
174
181
 
@@ -217,55 +224,55 @@ export namespace Gdl {
217
224
  /**
218
225
  * Normal dock item
219
226
  */
220
- NORMAL,
227
+ NORMAL = 0,
221
228
  /**
222
229
  * item cannot be undocked
223
230
  */
224
- NEVER_FLOATING,
231
+ NEVER_FLOATING = 1,
225
232
  /**
226
233
  * item cannot be docked vertically
227
234
  */
228
- NEVER_VERTICAL,
235
+ NEVER_VERTICAL = 2,
229
236
  /**
230
237
  * item cannot be docked horizontally
231
238
  */
232
- NEVER_HORIZONTAL,
239
+ NEVER_HORIZONTAL = 4,
233
240
  /**
234
241
  * item is locked, it cannot be moved around
235
242
  */
236
- LOCKED,
243
+ LOCKED = 8,
237
244
  /**
238
245
  * item cannot be docked at top
239
246
  */
240
- CANT_DOCK_TOP,
247
+ CANT_DOCK_TOP = 16,
241
248
  /**
242
249
  * item cannot be docked at bottom
243
250
  */
244
- CANT_DOCK_BOTTOM,
251
+ CANT_DOCK_BOTTOM = 32,
245
252
  /**
246
253
  * item cannot be docked left
247
254
  */
248
- CANT_DOCK_LEFT,
255
+ CANT_DOCK_LEFT = 64,
249
256
  /**
250
257
  * item cannot be docked right
251
258
  */
252
- CANT_DOCK_RIGHT,
259
+ CANT_DOCK_RIGHT = 128,
253
260
  /**
254
261
  * item cannot be docked at center
255
262
  */
256
- CANT_DOCK_CENTER,
263
+ CANT_DOCK_CENTER = 256,
257
264
  /**
258
265
  * item cannot be closed
259
266
  */
260
- CANT_CLOSE,
267
+ CANT_CLOSE = 512,
261
268
  /**
262
269
  * item cannot be iconified
263
270
  */
264
- CANT_ICONIFY,
271
+ CANT_ICONIFY = 1024,
265
272
  /**
266
273
  * item doesn't have a grip
267
274
  */
268
- NO_GRIP,
275
+ NO_GRIP = 2048,
269
276
  }
270
277
 
271
278
 
@@ -285,19 +292,19 @@ export namespace Gdl {
285
292
  /**
286
293
  * item is in a drag operation
287
294
  */
288
- IN_DRAG,
295
+ IN_DRAG = 256,
289
296
  /**
290
297
  * item is in a predrag operation
291
298
  */
292
- IN_PREDRAG,
299
+ IN_PREDRAG = 512,
293
300
  /**
294
301
  * item is iconified
295
302
  */
296
- ICONIFIED,
303
+ ICONIFIED = 1024,
297
304
  /**
298
305
  * indicates the user has started an action on the dock item
299
306
  */
300
- USER_ACTION,
307
+ USER_ACTION = 2048,
301
308
  }
302
309
 
303
310
 
@@ -319,19 +326,19 @@ export namespace Gdl {
319
326
  /**
320
327
  * Object is created and destroyed by the master, not the user
321
328
  */
322
- AUTOMATIC,
329
+ AUTOMATIC = 1,
323
330
  /**
324
331
  * Object has a parent
325
332
  */
326
- ATTACHED,
333
+ ATTACHED = 2,
327
334
  /**
328
335
  * Object is currently part of a rearrangement
329
336
  */
330
- IN_REFLOW,
337
+ IN_REFLOW = 4,
331
338
  /**
332
339
  * Object will be removed
333
340
  */
334
- IN_DETACH,
341
+ IN_DETACH = 8,
335
342
  }
336
343
 
337
344
 
@@ -351,11 +358,11 @@ export namespace Gdl {
351
358
  /**
352
359
  * The parameter is to be exported for later layout rebuilding
353
360
  */
354
- EXPORT,
361
+ EXPORT = 256,
355
362
  /**
356
363
  * The parameter must be set after adding the children objects
357
364
  */
358
- AFTER,
365
+ AFTER = 512,
359
366
  }
360
367
 
361
368
 
@@ -827,13 +834,13 @@ export namespace Gdl {
827
834
  * @signal
828
835
  * @run-first
829
836
  */
830
- "dock-drag-end": (arg0: boolean) => void;
837
+ "dock-drag-end": (cancel: boolean) => void;
831
838
  /**
832
839
  * Signals that a dock item dragging motion event has occured.
833
840
  * @signal
834
841
  * @run-first
835
842
  */
836
- "dock-drag-motion": (arg0: Gdk.Device, arg1: number, arg2: number) => void;
843
+ "dock-drag-motion": (device: Gdk.Device, x: number, y: number) => void;
837
844
  /**
838
845
  * The ::move-focus-child signal is emitted when a change of focus is
839
846
  * requested for the child widget of a dock item. The `dir` parameter
@@ -843,7 +850,7 @@ export namespace Gdl {
843
850
  * @action
844
851
  * @run-last
845
852
  */
846
- "move-focus-child": (arg0: Gtk.DirectionType) => void;
853
+ "move-focus-child": (dir: Gtk.DirectionType) => void;
847
854
  /**
848
855
  * Signals that this dock has been selected from a switcher.
849
856
  * @signal
@@ -2160,13 +2167,13 @@ export namespace Gdl {
2160
2167
  * @signal
2161
2168
  * @run-last
2162
2169
  */
2163
- detach: (arg0: boolean) => void;
2170
+ detach: (recursive: boolean) => void;
2164
2171
  /**
2165
2172
  * Signals that the {@link Gdl.DockObject} has been docked.
2166
2173
  * @signal
2167
2174
  * @run-first
2168
2175
  */
2169
- dock: (arg0: DockObject, arg1: DockPlacement, arg2: unknown | null) => void;
2176
+ dock: (requestor: DockObject, position: DockPlacement, other_data: unknown | null) => void;
2170
2177
  "notify::long-name": (pspec: GObject.ParamSpec) => void;
2171
2178
  "notify::master": (pspec: GObject.ParamSpec) => void;
2172
2179
  "notify::name": (pspec: GObject.ParamSpec) => void;
@@ -2972,7 +2979,7 @@ export namespace Gdl {
2972
2979
  * @signal
2973
2980
  * @run-last
2974
2981
  */
2975
- "button-pressed-handle": (arg0: Gdk.Event) => void;
2982
+ "button-pressed-handle": (event: Gdk.Event) => void;
2976
2983
  "notify::item": (pspec: GObject.ParamSpec) => void;
2977
2984
  "notify::border-width": (pspec: GObject.ParamSpec) => void;
2978
2985
  "notify::child": (pspec: GObject.ParamSpec) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/gdl-3",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "GJS TypeScript type definitions for Gdl-3",
5
5
  "type": "module",
6
6
  "module": "gdl-3.js",
@@ -16,10 +16,10 @@
16
16
  "import": "./gdl-3-import.js",
17
17
  "default": "./gdl-3-import.js"
18
18
  },
19
- "./surface": {
20
- "types": "./gdl-3-surface.d.ts",
21
- "import": "./gdl-3-surface.js",
22
- "default": "./gdl-3-surface.js"
19
+ "./vocabulary": {
20
+ "types": "./gdl-3-vocabulary.d.ts",
21
+ "import": "./gdl-3-vocabulary.js",
22
+ "default": "./gdl-3-vocabulary.js"
23
23
  },
24
24
  "./gdl-3": {
25
25
  "types": "./gdl-3.d.ts",
@@ -36,20 +36,20 @@
36
36
  "test": "tsc --project tsconfig.json"
37
37
  },
38
38
  "dependencies": {
39
- "@girs/gjs": "^4.4.0",
40
- "@girs/gtk-3.0": "^4.4.0",
41
- "@girs/xlib-2.0": "^4.4.0",
42
- "@girs/gdk-3.0": "^4.4.0",
43
- "@girs/cairo-1.0": "^4.4.0",
44
- "@girs/gobject-2.0": "^4.4.0",
45
- "@girs/glib-2.0": "^4.4.0",
46
- "@girs/pango-1.0": "^4.4.0",
47
- "@girs/harfbuzz-0.0": "^4.4.0",
48
- "@girs/freetype2-2.0": "^4.4.0",
49
- "@girs/gio-2.0": "^4.4.0",
50
- "@girs/gmodule-2.0": "^4.4.0",
51
- "@girs/gdkpixbuf-2.0": "^4.4.0",
52
- "@girs/atk-1.0": "^4.4.0" },
39
+ "@girs/gjs": "^4.5.0",
40
+ "@girs/gtk-3.0": "^4.5.0",
41
+ "@girs/xlib-2.0": "^4.5.0",
42
+ "@girs/gdk-3.0": "^4.5.0",
43
+ "@girs/cairo-1.0": "^4.5.0",
44
+ "@girs/gobject-2.0": "^4.5.0",
45
+ "@girs/glib-2.0": "^4.5.0",
46
+ "@girs/pango-1.0": "^4.5.0",
47
+ "@girs/harfbuzz-0.0": "^4.5.0",
48
+ "@girs/freetype2-2.0": "^4.5.0",
49
+ "@girs/gio-2.0": "^4.5.0",
50
+ "@girs/gmodule-2.0": "^4.5.0",
51
+ "@girs/gdkpixbuf-2.0": "^4.5.0",
52
+ "@girs/atk-1.0": "^4.5.0" },
53
53
  "devDependencies": {
54
54
  "typescript": "*"
55
55
  },
package/tsconfig.json CHANGED
@@ -62,7 +62,7 @@
62
62
  ]
63
63
  }
64
64
  },
65
- "include": ["./gdl-3.d.ts","./gdl-3-surface.d.ts"]
65
+ "include": ["./gdl-3.d.ts","./gdl-3-vocabulary.d.ts"]
66
66
  }
67
67
 
68
68