@girs/gdl-3 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.
- package/README.md +52 -38
- package/gdl-3-surface.d.ts +20 -0
- package/gdl-3-surface.js +6 -0
- package/gdl-3-vocabulary.d.ts +418 -0
- package/gdl-3-vocabulary.js +83 -0
- package/gdl-3.d.ts +113 -48
- package/package.json +19 -19
- package/tsconfig.json +1 -1
package/README.md
CHANGED
|
@@ -4,82 +4,96 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
41
|
+
### As `gi://`
|
|
25
42
|
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
68
|
+
const Gdl = imports.gi.Gdl;
|
|
59
69
|
```
|
|
60
70
|
|
|
61
|
-
|
|
62
|
-
```json
|
|
63
|
-
{
|
|
64
|
-
"compilerOptions": {
|
|
65
|
-
...
|
|
66
|
-
},
|
|
67
|
-
"include": ["@girs/gdl-3"],
|
|
68
|
-
...
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
+
## Widget vocabulary
|
|
71
72
|
|
|
72
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
97
|
+
Every pre-generated package is at [gjsify/types](https://github.com/gjsify/types).
|
|
98
|
+
|
|
85
99
|
|
package/gdl-3-surface.d.ts
CHANGED
|
@@ -284,6 +284,23 @@ export interface Widgets {
|
|
|
284
284
|
/** Every GType this namespace can create. A consumer derives its own tag map. */
|
|
285
285
|
export type WidgetGType = keyof Widgets;
|
|
286
286
|
|
|
287
|
+
// ---------------------------------------------------------------------------
|
|
288
|
+
// Child holders — the same shape, for objects that CARRY a widget without being one.
|
|
289
|
+
//
|
|
290
|
+
// `GtkListItem`, `GtkListHeader`, `GtkColumnViewCell` and `AdwToggle` descend from
|
|
291
|
+
// `GObject.Object` and hold a widget through `set_child`/`get_child`. A renderer places
|
|
292
|
+
// them exactly like a container, so they belong in the vocabulary; a check asking "is
|
|
293
|
+
// this a widget" must still be able to say no. Hence a sibling table rather than four
|
|
294
|
+
// more rows in `Widgets`: concatenate them when you mean both.
|
|
295
|
+
// ---------------------------------------------------------------------------
|
|
296
|
+
|
|
297
|
+
export interface ChildHolders {
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Every GType this namespace holds a child in without it being a widget. */
|
|
302
|
+
export type ChildHolderGType = keyof ChildHolders;
|
|
303
|
+
|
|
287
304
|
/** The writable, optional, GObject-keyed property surface of one GType. */
|
|
288
305
|
export type PropsOf<G extends WidgetGType> = Widgets[G]['props'];
|
|
289
306
|
|
|
@@ -319,6 +336,9 @@ export const OWN_SIGNALS: Readonly<Record<string, readonly string[]>>;
|
|
|
319
336
|
/** Widget GType -> every declaration its members come from, self first. */
|
|
320
337
|
export const DECLS: Readonly<Record<string, readonly string[]>>;
|
|
321
338
|
|
|
339
|
+
/** The GTypes in `DECLS` that hold a widget without being one — see `ChildHolders`. */
|
|
340
|
+
export const CHILD_HOLDERS: readonly string[];
|
|
341
|
+
|
|
322
342
|
/** Enum GType -> the nicks this surface offers. */
|
|
323
343
|
export const ENUM_NICKS: Readonly<Record<string, readonly string[]>>;
|
|
324
344
|
|
package/gdl-3-surface.js
CHANGED
|
@@ -43,6 +43,12 @@ export const DECLS = {
|
|
|
43
43
|
GdlSwitcher: ['GdlSwitcher', 'GtkNotebook', 'GtkContainer', 'GtkWidget', 'GtkBuildable'],
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
// The GTypes above that are NOT widgets: they hold one through `set_child`/`get_child`
|
|
47
|
+
// and descend from `GObject.Object`. A renderer places them like a container; a check
|
|
48
|
+
// asking "is this a widget" must not count them. Derived from the accessor pair, never
|
|
49
|
+
// from a list — the count is in the provenance line above.
|
|
50
|
+
export const CHILD_HOLDERS = [];
|
|
51
|
+
|
|
46
52
|
export const ENUM_NICKS = {
|
|
47
53
|
GdlDockBarStyle: ['icons', 'text', 'both', 'auto'],
|
|
48
54
|
GdlDockPlacement: ['none', 'top', 'bottom', 'right', 'left', 'center', 'floating'],
|
|
@@ -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>>;
|