@gjsify/gtk-host 0.53.0 → 0.54.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/lib/esm/fonts.js +1 -1
- package/lib/types/adapters/react.d.ts +24 -39
- package/lib/types/attrs.d.ts +37 -49
- package/lib/types/fonts.d.ts +30 -44
- package/lib/types/host.d.ts +56 -78
- package/lib/types/policies.d.ts +159 -202
- package/lib/types/props.d.ts +23 -36
- package/lib/types/types.d.ts +73 -82
- package/package.json +5 -5
package/lib/types/policies.d.ts
CHANGED
|
@@ -9,10 +9,8 @@ export declare function addressOf(el: HostElement): Gtk.Widget;
|
|
|
9
9
|
* GTK SPELLS ONE PLACEMENT TWICE and both spellings reach the same widget:
|
|
10
10
|
* `adw_header_bar_buildable_add_child`'s `<child type="title">` branch calls
|
|
11
11
|
* `adw_header_bar_set_title_widget`, i.e. writes the `title-widget` property. An authored
|
|
12
|
-
* tree carries whichever spelling its SOURCE had
|
|
13
|
-
*
|
|
14
|
-
* conflates the two by construction (the projection's own header records that, and that it
|
|
15
|
-
* cannot be inverted). A descriptor declaring only the buildable type would therefore refuse
|
|
12
|
+
* tree carries whichever spelling its SOURCE had, and `SharedTreeNode.slot` conflates the
|
|
13
|
+
* two by construction. A descriptor declaring only the buildable type would therefore refuse
|
|
16
14
|
* a placement GTK itself accepts.
|
|
17
15
|
*
|
|
18
16
|
* A CASE RULE OVER THE SETTER'S OWN NAME, never a table: an ADDER (`pack_start`,
|
|
@@ -23,27 +21,24 @@ export declare function slotPropertyOf(method: string): string | null;
|
|
|
23
21
|
/**
|
|
24
22
|
* Every name a policy answers to — what a refusal lists.
|
|
25
23
|
*
|
|
26
|
-
* Each declared key is followed by the property spelling it also answers to, so
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* resolves to, rather than in a second group they have to pair up themselves.
|
|
24
|
+
* Each declared key is followed by the property spelling it also answers to, so a reader
|
|
25
|
+
* matching their own `slot="title-widget"` finds it beside the key it resolves to rather
|
|
26
|
+
* than in a second group they have to pair up themselves.
|
|
30
27
|
*/
|
|
31
28
|
export declare function slotNames(policy: ChildPolicy): string[];
|
|
32
29
|
/**
|
|
33
30
|
* The DECLARED slot key an authored name asks for, or the default when it asks for nothing.
|
|
34
31
|
*
|
|
35
32
|
* EVERY read of `child.slot` in this file goes through here, so the property spelling
|
|
36
|
-
* {@link slotPropertyOf} admits is canonical everywhere at once: a placement resolved
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* THE DEFAULT IS CHECKED LIKE ANY OTHER NAME, and it is the one
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* {@link errors.unknownSlot} exists to replace. Returning only keys that are IN `slots` is
|
|
46
|
-
* what makes the lookup at every call site total.
|
|
33
|
+
* {@link slotPropertyOf} admits is canonical everywhere at once: a placement resolved through
|
|
34
|
+
* `title-widget` and a detach resolved through `title` would otherwise be two different keys
|
|
35
|
+
* to `policy.slots[…]`, and the child would leak at unmount.
|
|
36
|
+
*
|
|
37
|
+
* THE DEFAULT IS CHECKED LIKE ANY OTHER NAME, and it is the one with no author to blame:
|
|
38
|
+
* `defaultSlot` and `slots` are two fields of a descriptor and nothing else in this package
|
|
39
|
+
* holds them together. An unchecked default reaches `policy.slots[slot]` as `undefined` and
|
|
40
|
+
* the caller calls it: `TypeError: host[undefined] is not a function`, exactly the shape
|
|
41
|
+
* {@link errors.unknownSlot} exists to replace.
|
|
47
42
|
*/
|
|
48
43
|
export declare function slottedSlot(policy: Extract<ChildPolicy, {
|
|
49
44
|
kind: 'slotted';
|
|
@@ -51,44 +46,38 @@ export declare function slottedSlot(policy: Extract<ChildPolicy, {
|
|
|
51
46
|
/**
|
|
52
47
|
* A slot the parent cannot honour is refused BY NAME, whatever its policy kind.
|
|
53
48
|
*
|
|
54
|
-
* `slotted` already refused an unknown slot; every OTHER kind read `child.slot` as nothing
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* `
|
|
60
|
-
* destination, so it is left alone.
|
|
49
|
+
* `slotted` already refused an unknown slot; every OTHER kind read `child.slot` as nothing at
|
|
50
|
+
* all, so a name it has no destination for put the widget in the one place it does have and
|
|
51
|
+
* said nothing — measured on a real `.blp`: an authored placement dropped, the widget on
|
|
52
|
+
* screen in the wrong container, exit 0. A `single` parent accepts the property its own
|
|
53
|
+
* setter writes (`AdwApplicationWindow` + `set_content` accepts `content`) and nothing else;
|
|
54
|
+
* `keyed` reads the slot as its page NAME, which is a destination, so it is left alone.
|
|
61
55
|
*/
|
|
62
56
|
export declare function refuseUnknownSlot(parent: HostElement, child: HostElement): void;
|
|
63
57
|
/**
|
|
64
58
|
* `Gtk.ListBox` and `Gtk.FlowBox` wrap arbitrary children; the wrap is the host's job.
|
|
65
59
|
*
|
|
66
|
-
* Unless the author already wrote the row themselves — `<GtkListBox><GtkListBoxRow>`
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
60
|
+
* Unless the author already wrote the row themselves — `<GtkListBox><GtkListBoxRow>` is the
|
|
61
|
+
* spelling anyone reaching for `activatable` or `selectable` uses, and wrapping a row inside
|
|
62
|
+
* a second row nests two selectable widgets and detaches activation from the one the author
|
|
63
|
+
* configured.
|
|
70
64
|
*
|
|
71
|
-
* A `slotted` policy reaches this too, per SLOT: an adder that hands the child to an
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* one `Gtk-WARNING` at unmount.
|
|
65
|
+
* A `slotted` policy reaches this too, per SLOT: an adder that hands the child to an inner
|
|
66
|
+
* `Gtk.ListBox` needs the same wrap, and `Adw.ExpanderRow`'s `add_row` is one.
|
|
67
|
+
* `gtk_list_box_remove` does not unwrap, so without this the child leaks behind one
|
|
68
|
+
* `Gtk-WARNING` at unmount.
|
|
76
69
|
*/
|
|
77
70
|
export declare function makeWrapper(descriptor: WidgetDescriptor, child: Gtk.Widget, slot: string | null): Gtk.Widget | null;
|
|
78
71
|
/**
|
|
79
72
|
* A container the host owns that no window shows — the DOM's detached `<div>`.
|
|
80
73
|
*
|
|
81
|
-
* `<KeepAlive>` and `<Suspense>` ask a renderer for off-screen storage
|
|
82
|
-
*
|
|
83
|
-
* the
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* the only one with a runtime `gi://Gtk` import.
|
|
89
|
-
*
|
|
90
|
-
* A `Gtk.Box` and not an `Adw.Bin`: the deactivated subtree may hold SEVERAL
|
|
91
|
-
* children, and a one-child container would silently keep the last.
|
|
74
|
+
* `<KeepAlive>` and `<Suspense>` ask a renderer for off-screen storage. It lives here because
|
|
75
|
+
* this is already the file that builds widgets the author did not write (see `makeWrapper`),
|
|
76
|
+
* and it is the only one with a runtime `gi://Gtk` import — which is what ADR 0027 § 7 forbids
|
|
77
|
+
* in an adapter.
|
|
78
|
+
*
|
|
79
|
+
* A `Gtk.Box` and not an `Adw.Bin`: the deactivated subtree may hold SEVERAL children, and a
|
|
80
|
+
* one-child container would silently keep the last.
|
|
92
81
|
*/
|
|
93
82
|
export declare const makeDetachedContainer: () => Gtk.Widget;
|
|
94
83
|
/**
|
|
@@ -106,25 +95,21 @@ export declare const makeDetachedContainer: () => Gtk.Widget;
|
|
|
106
95
|
/**
|
|
107
96
|
* Compile-time exhaustiveness, which this package does NOT get for free.
|
|
108
97
|
*
|
|
109
|
-
* `tsconfig.json` sets `strict: false`, so a switch that stops covering its union
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* arm calling this DOES fail the build (measured) and is the only mechanism that
|
|
115
|
-
* makes the next union member impossible to forget.
|
|
98
|
+
* `tsconfig.json` sets `strict: false`, so a switch that stops covering its union simply
|
|
99
|
+
* falls through and returns `undefined` — no error. Adding the `uncurated` policy kind
|
|
100
|
+
* passed `tsc` cleanly while five switches silently ignored it. Assignability to `never` is
|
|
101
|
+
* not a strictness option, so a `default` arm calling this DOES fail the build (measured)
|
|
102
|
+
* and is the only mechanism that makes the next union member impossible to forget.
|
|
116
103
|
*/
|
|
117
104
|
export declare function unhandledPolicy(policy: never): never;
|
|
118
105
|
export declare function setterSlotOf(parent: HostElement, child: HostElement): string | null;
|
|
119
106
|
/**
|
|
120
107
|
* The slots this policy fills with an ADDER, by slot name.
|
|
121
108
|
*
|
|
122
|
-
* `set_`-prefixed or not is the whole distinction, and TWO decisions turn on it
|
|
123
|
-
* which is why the predicate is here once rather than spelled out at each. A
|
|
109
|
+
* `set_`-prefixed or not is the whole distinction, and TWO decisions turn on it: a
|
|
124
110
|
* setter-backed slot is emptied by writing `null` back through itself, so
|
|
125
|
-
* `policyProblems()` lets such a policy name no `remove`; and it holds one child,
|
|
126
|
-
*
|
|
127
|
-
* has no order to pay for, which is what `reorderMode()` reports.
|
|
111
|
+
* `policyProblems()` lets such a policy name no `remove`; and it holds one child, so
|
|
112
|
+
* `rotateTail` returns before touching it.
|
|
128
113
|
*/
|
|
129
114
|
export declare function adderSlots(policy: ChildPolicy): string[];
|
|
130
115
|
/** Every one-child slot this policy has, by setter name — `single` has exactly one. */
|
|
@@ -132,16 +117,13 @@ export declare function setterSlots(policy: ChildPolicy): string[];
|
|
|
132
117
|
/**
|
|
133
118
|
* Who GTK says is in a one-child slot. `undefined` means there is no getter to ask.
|
|
134
119
|
*
|
|
135
|
-
* The slot's own getter is the ONLY honest reader of this, and a child-list walk
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* `
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* child: `Gtk.ScrolledWindow.set_child(label)` reports a `GtkViewport`, not the
|
|
143
|
-
* label, so callers may compare occupants for IDENTITY but never assume the
|
|
144
|
-
* occupant is the widget they handed over.
|
|
120
|
+
* The slot's own getter is the ONLY honest reader of this, and a child-list walk is not a
|
|
121
|
+
* substitute: measured on gtk 4.22.4 / libadwaita 1.9.3, a FRESH widget already has direct
|
|
122
|
+
* children the application never put there, while every one of those widgets answers `null`
|
|
123
|
+
* from its getter. The getter also survives GTK wrapping the child:
|
|
124
|
+
* `Gtk.ScrolledWindow.set_child(label)` reports a `GtkViewport`, not the label — so callers
|
|
125
|
+
* may compare occupants for IDENTITY but never assume the occupant is the widget they handed
|
|
126
|
+
* over.
|
|
145
127
|
*/
|
|
146
128
|
export declare function slotOccupant(widget: Gtk.Widget, setter: string): Gtk.Widget | null | undefined;
|
|
147
129
|
/** A placement that does NOT put the node into its parent's child list. */
|
|
@@ -175,13 +157,11 @@ export declare const isPortal: (el: HostElement) => boolean;
|
|
|
175
157
|
/**
|
|
176
158
|
* Does this node take NO position in its parent's child list?
|
|
177
159
|
*
|
|
178
|
-
* The question four sibling walks ask, and it is the placement AXIS rather than
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* `insert_child_after` a widget that is not in the container (a critical at exit 0),
|
|
184
|
-
* and rotating one calls the parent's adder on a node that must never enter it.
|
|
160
|
+
* The question four sibling walks ask, and it is the placement AXIS rather than the portal
|
|
161
|
+
* arm: a toplevel occupies a parent's child list exactly as little as a portal does. Counting
|
|
162
|
+
* a toplevel as a sibling shifts every later child by one and hands `insert_child_after` a
|
|
163
|
+
* widget that is not in the container (a critical at exit 0), and rotating one calls the
|
|
164
|
+
* parent's adder on a node that must never enter it.
|
|
185
165
|
*/
|
|
186
166
|
export declare const isUnparented: (el: HostElement) => boolean;
|
|
187
167
|
/**
|
|
@@ -189,30 +169,26 @@ export declare const isUnparented: (el: HostElement) => boolean;
|
|
|
189
169
|
*
|
|
190
170
|
* Returns whether GTK has actually taken the node, which is what `attached` means.
|
|
191
171
|
*
|
|
192
|
-
* WHY THE WAIT IS THE FEATURE. Every framework builds bottom-up: React creates the
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* down when the anchor loses its window, so losing a toplevel RETRACTS the node
|
|
213
|
-
* rather than merely failing to present it (see `placeAgainst`). Without that, a
|
|
214
|
-
* subtree that is detached and never re-rooted keeps its sheet on screen in the
|
|
215
|
-
* window it left, and only a re-root — which such a subtree never gets — repairs it.
|
|
172
|
+
* WHY THE WAIT IS THE FEATURE. Every framework builds bottom-up: React creates the whole
|
|
173
|
+
* subtree, appends its children, and inserts the ROOT into the container last, so at the
|
|
174
|
+
* moment a `<Modal>` is inserted its parent is usually not in a window yet. MEASURED on
|
|
175
|
+
* libadwaita 1.9.3 / GTK 4.22.4, presenting against an unrooted box: `adw_dialog_present`
|
|
176
|
+
* finds no `AdwDialogHost` among the parent's ancestors and takes its documented other
|
|
177
|
+
* branch, `present_as_window` — the dialog opens as a SEPARATE `GtkWindow`,
|
|
178
|
+
* `win.visibleDialog` stays false, exit 0, no diagnostic. A modal that floats out of its own
|
|
179
|
+
* application is exactly the green-and-wrong this host exists to refuse.
|
|
180
|
+
*
|
|
181
|
+
* `notify::root` is the instrument. MEASURED: it fires on a GRANDCHILD box when the toplevel
|
|
182
|
+
* takes the subtree (root -> AdwWindow), and again on unroot (root -> null). The
|
|
183
|
+
* subscription STAYS for the life of the attachment rather than being one-shot, because
|
|
184
|
+
* re-rooting is real: measured, unrooting the parent leaves an already-presented dialog in
|
|
185
|
+
* the OLD window's host — `w1.visibleDialog` still true after `w1.set_content(null)` — so a
|
|
186
|
+
* subtree moved to a second window would silently keep showing its modal in the first.
|
|
187
|
+
*
|
|
188
|
+
* SYMMETRIC, and the second direction is not free: GTK does not take the dialog down when
|
|
189
|
+
* the anchor loses its window, so losing a toplevel RETRACTS the node (see
|
|
190
|
+
* `placeAgainst`). Without that, a subtree that is detached and never re-rooted keeps its
|
|
191
|
+
* sheet on screen in the window it left.
|
|
216
192
|
*/
|
|
217
193
|
export declare function presentPortal(parent: HostElement, child: HostElement, portal: Extract<NodePlacement, {
|
|
218
194
|
kind: 'portal';
|
|
@@ -220,14 +196,13 @@ export declare function presentPortal(parent: HostElement, child: HostElement, p
|
|
|
220
196
|
/**
|
|
221
197
|
* Take a portal node back down, with no probe and no `attached` guard.
|
|
222
198
|
*
|
|
223
|
-
* UNCONDITIONALLY, twice over, and both halves are measured. The method the
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* knowing what a dialog is.
|
|
199
|
+
* UNCONDITIONALLY, twice over, and both halves are measured. The method the descriptor names
|
|
200
|
+
* is the FORCED close (`force_close`, not `close`): an unmount is not a user request, and
|
|
201
|
+
* `close()` on a dialog whose `can-close` is FALSE returns FALSE, emits `close-attempt` and
|
|
202
|
+
* leaves it on screen. And `force_close()` on a node that was never presented is silent,
|
|
203
|
+
* where `close()` is `Adwaita-CRITICAL **: Trying to close … that's not presented` at exit
|
|
204
|
+
* 0 — so the host needs no "is it up?" question, which is the one it could not answer
|
|
205
|
+
* without knowing what a dialog is.
|
|
231
206
|
*/
|
|
232
207
|
export declare function retractPortal(child: HostElement, portal: Extract<NodePlacement, {
|
|
233
208
|
kind: 'portal';
|
|
@@ -235,23 +210,22 @@ export declare function retractPortal(child: HostElement, portal: Extract<NodePl
|
|
|
235
210
|
/**
|
|
236
211
|
* Show a toplevel node — and it needs nothing from its parent, which is the point.
|
|
237
212
|
*
|
|
238
|
-
* NO ANCHOR, NO WAIT, NO SUBSCRIPTION. A portal has two positions in the tree and
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* Returns whether GTK has taken the node — always true once there is a widget,
|
|
245
|
-
*
|
|
246
|
-
* `
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* AN AUTHORED `visible: false` IS HONOURED rather than overwritten. `present()`
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* 'visible', true)` shows it through the ordinary property path.
|
|
213
|
+
* NO ANCHOR, NO WAIT, NO SUBSCRIPTION. A portal has two positions in the tree and defers
|
|
214
|
+
* until the parent supplies the second one; a toplevel HAS no second position, so the whole
|
|
215
|
+
* `notify::root` machinery next door has nothing to watch for. Measured: `gtk_window_present`
|
|
216
|
+
* takes 0 arguments where `adw_dialog_present` takes 1, and that arity is exactly the
|
|
217
|
+
* difference.
|
|
218
|
+
*
|
|
219
|
+
* Returns whether GTK has taken the node — always true once there is a widget, because a root
|
|
220
|
+
* is taken by nobody: measured, a presented window answers `get_parent() === null` and
|
|
221
|
+
* `get_root() === itself`. That is not the portal's "claimed but not yet taken" state, it is
|
|
222
|
+
* the finished one.
|
|
223
|
+
*
|
|
224
|
+
* AN AUTHORED `visible: false` IS HONOURED rather than overwritten. `present()` sets the
|
|
225
|
+
* window visible (measured), so presenting unconditionally would make `<gtk-window
|
|
226
|
+
* visible={false}>` a property this host silently reverses. The node is still `attached`:
|
|
227
|
+
* GTK holds it as its own root whether or not it is on screen, and a later
|
|
228
|
+
* `setProp(el, 'visible', true)` shows it through the ordinary property path.
|
|
255
229
|
*/
|
|
256
230
|
export declare function presentToplevel(child: HostElement, placement: Extract<NodePlacement, {
|
|
257
231
|
kind: 'toplevel';
|
|
@@ -260,19 +234,15 @@ export declare function presentToplevel(child: HostElement, placement: Extract<N
|
|
|
260
234
|
* Take a toplevel back down — the FORCED call, and it is TERMINAL.
|
|
261
235
|
*
|
|
262
236
|
* `destroy` and not `close`, measured on GTK 4.22.4: `gtk_window_close()` emits
|
|
263
|
-
* `close-request`, and an application handler returning TRUE leaves the window
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* `Gtk-WARNING **: A window is shown after it has been destroyed`.
|
|
273
|
-
*
|
|
274
|
-
* SO THIS IS `destroy`'s CALL AND NOT `remove`'s, which is the whole reason
|
|
275
|
-
* `detachToplevel` exists next door. `remove` documents itself as reversible.
|
|
237
|
+
* `close-request`, and an application handler returning TRUE leaves the window mapped and
|
|
238
|
+
* visible. That veto is how an application asks the USER to confirm, and an unmount is not a
|
|
239
|
+
* user request — the same reasoning that makes the portal arm name `force_close`.
|
|
240
|
+
*
|
|
241
|
+
* Unconditional for the same reason too: measured, `destroy()` on a window that was never
|
|
242
|
+
* presented is silent, so no "is it up?" probe is needed. What differs from the portal is that
|
|
243
|
+
* there IS no way back — measured, `present()` after a destroy (or after a `close()`, whose
|
|
244
|
+
* default handler destroys) answers `Gtk-WARNING **: A window is shown after it has been
|
|
245
|
+
* destroyed`.
|
|
276
246
|
*/
|
|
277
247
|
export declare function closeToplevel(child: HostElement, placement: Extract<NodePlacement, {
|
|
278
248
|
kind: 'toplevel';
|
|
@@ -280,31 +250,26 @@ export declare function closeToplevel(child: HostElement, placement: Extract<Nod
|
|
|
280
250
|
/**
|
|
281
251
|
* Take a toplevel OFF SCREEN, reversibly — `remove`'s call.
|
|
282
252
|
*
|
|
283
|
-
* `remove` is documented as a detach that a later `insert` undoes ("Frameworks
|
|
284
|
-
*
|
|
285
|
-
* `
|
|
286
|
-
* the
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
* MEASURED on GTK 4.22.4, one window, in order: `set_visible(false)` leaves it
|
|
298
|
-
* `visible` false with one `unmap`, emits NO `close-request`, and keeps it in
|
|
253
|
+
* `remove` is documented as a detach that a later `insert` undoes ("Frameworks move nodes;
|
|
254
|
+
* `remove` must not destroy one"), and Solid takes it literally: its `removeNode` calls
|
|
255
|
+
* `remove(node)` for a move. Running the declared, TERMINAL close there made a move
|
|
256
|
+
* `destroy()` the window and then present the corpse — `Gtk-WARNING **: A window is shown
|
|
257
|
+
* after it has been destroyed`, at exit 0.
|
|
258
|
+
*
|
|
259
|
+
* A PROPERTY WRITE AND NOT A DECLARED METHOD, and that is the honest shape rather than a
|
|
260
|
+
* shortcut: a window's presence on screen IS its `visible` property — which is why
|
|
261
|
+
* `presentToplevel` already reads it. The portal arm needs no counterpart, because its
|
|
262
|
+
* declared close is ALREADY reversible.
|
|
263
|
+
*
|
|
264
|
+
* MEASURED on GTK 4.22.4, one window, in order: `set_visible(false)` leaves it `visible`
|
|
265
|
+
* false with one `unmap`, emits NO `close-request`, and keeps it in
|
|
299
266
|
* `Gtk.Window.list_toplevels()` — so it is a detach and not a teardown; `present()`
|
|
300
|
-
* afterwards maps it again with no diagnostic at all
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
* a libadwaita defect that the consumer's model never mentions — the window really
|
|
307
|
-
* did leave the screen, and a bound `notify::visible` is entitled to hear it.
|
|
267
|
+
* afterwards maps it again with no diagnostic at all. `set_visible` rather than the
|
|
268
|
+
* deprecated `hide()`, which is the same call one rename older.
|
|
269
|
+
*
|
|
270
|
+
* Unbracketed, unlike `writeVisible`'s host writes: this is not bookkeeping around a
|
|
271
|
+
* libadwaita defect the consumer's model never mentions — the window really did leave the
|
|
272
|
+
* screen, and a bound `notify::visible` is entitled to hear it.
|
|
308
273
|
*/
|
|
309
274
|
export declare function detachToplevel(child: HostElement): void;
|
|
310
275
|
/**
|
|
@@ -318,47 +283,41 @@ export declare function placeOutsideParent(parent: HostElement, child: HostEleme
|
|
|
318
283
|
/**
|
|
319
284
|
* The REVERSIBLE take-down — what `remove` means, per arm.
|
|
320
285
|
*
|
|
321
|
-
* THE TWO ARMS DIFFER HERE AND NOWHERE ELSE, which is why one function
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
* The portal arm therefore never showed this defect and the toplevel arm shipped
|
|
326
|
-
* with it: a single `retractOutsideParent` treated a reversible verb and a terminal
|
|
327
|
-
* one as the same thing.
|
|
286
|
+
* THE TWO ARMS DIFFER HERE AND NOWHERE ELSE, which is why one function cannot serve both:
|
|
287
|
+
* measured, `force_close()` followed by `present(parent)` re-hosts a dialog against the SAME
|
|
288
|
+
* parent with no diagnostic, while `destroy()` followed by `present()` is `Gtk-WARNING **: A
|
|
289
|
+
* window is shown after it has been destroyed`.
|
|
328
290
|
*/
|
|
329
291
|
export declare function detachOutsideParent(child: HostElement, placement: OutsideParent): void;
|
|
330
292
|
/**
|
|
331
293
|
* The TERMINAL take-down — what `destroy` means, and what a DISCARD means.
|
|
332
294
|
*
|
|
333
|
-
* Its one caller is `releaseWidget` in `host.ts`, which is every place the host
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
* — per construct-only write, and per half-built element a failed replay rolls back.
|
|
295
|
+
* Its one caller is `releaseWidget` in `host.ts`, which is every place the host drops
|
|
296
|
+
* `el.widget`: a toplevel is held by GTK's own list rather than by a parent, so a discard
|
|
297
|
+
* that merely detached would leak one window each time — per construct-only write, and per
|
|
298
|
+
* half-built element a failed replay rolls back.
|
|
338
299
|
*/
|
|
339
300
|
export declare function closeOutsideParent(child: HostElement, placement: OutsideParent): void;
|
|
340
301
|
/**
|
|
341
302
|
* The placement the installed libraries give this class, or null for an ordinary child.
|
|
342
303
|
*
|
|
343
|
-
* STRUCTURAL, never a name. ADR 0027 rule 1 forbids widget knowledge in the host,
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* a `present` at all has a 0-argument one, and `GtkDragIcon` has none — so the root
|
|
361
|
-
* test has to come first and cannot be replaced by an arity test.
|
|
304
|
+
* STRUCTURAL, never a name. ADR 0027 rule 1 forbids widget knowledge in the host, and a
|
|
305
|
+
* list of gtypes here would be exactly that — so the class is asked two questions it answers
|
|
306
|
+
* itself. Both were measured over the WHOLE shipped table on GTK 4.22.4 / libadwaita 1.9.3,
|
|
307
|
+
* which is what makes the second one a partition and not an observation:
|
|
308
|
+
*
|
|
309
|
+
* - `Gtk.Root` is GTK's OWN word for "this widget is a toplevel", and every class in the
|
|
310
|
+
* table implementing it — `GtkWindow` through `GtkPrintUnixDialog` — is one no parent may
|
|
311
|
+
* legally take.
|
|
312
|
+
* - A `present()` that TAKES AN ARGUMENT is a node presented AGAINST something. In the table
|
|
313
|
+
* that set is EXACTLY the `Adw.Dialog` descendants and nothing else — the ones whose `root`
|
|
314
|
+
* vfunc calls `g_error()`. `Gtk.Popover.present()` is the discriminator that makes the
|
|
315
|
+
* ARITY part of the question rather than the name: it exists, it takes 0 arguments, and a
|
|
316
|
+
* popover is parented with `set_parent()` like any other child.
|
|
317
|
+
*
|
|
318
|
+
* The order matters and is not alphabetical: every `Gtk.Root` in the table that has a
|
|
319
|
+
* `present` at all has a 0-argument one, and `GtkDragIcon` has none — so the root test has
|
|
320
|
+
* to come first and cannot be replaced by an arity test.
|
|
362
321
|
*
|
|
363
322
|
* @param gtype the class's GType — `type_is_a` walks interfaces as well as parents
|
|
364
323
|
* @param present the class's own `present`, or the value found on an instance
|
|
@@ -369,18 +328,16 @@ export declare function nodePlacementKind(node: Gtk.Widget): OutsideParent['kind
|
|
|
369
328
|
/**
|
|
370
329
|
* Refuse a child the installed libraries will not adopt, BEFORE the adder runs.
|
|
371
330
|
*
|
|
372
|
-
* This is the catchable half of the abort class (ADR 0054). `descriptorProblems()`
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
* any handler runs. A refusal is only possible while there is still a process.
|
|
331
|
+
* This is the catchable half of the abort class (ADR 0054). `descriptorProblems()` says the
|
|
332
|
+
* same thing about the whole TABLE up front, but `registerWidget` takes descriptors from
|
|
333
|
+
* applications and nothing checks those — and for one of the two families the consequence is
|
|
334
|
+
* not a wrong window: `adw_dialog_root()` is `g_error()`, so the process is gone before any
|
|
335
|
+
* handler runs. A refusal is only possible while there is still a process.
|
|
378
336
|
*
|
|
379
337
|
* ONLY WHERE THE DESCRIPTOR IS SILENT, and that is the escape hatch rather than an
|
|
380
|
-
* oversight. `placement` present — including an explicit `{ kind: 'parented' }` —
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
* of the oracle while really being a child says so in one line.
|
|
338
|
+
* oversight. `placement` present — including an explicit `{ kind: 'parented' }` — means the
|
|
339
|
+
* author has answered this question, and the host does not overrule an answer with a
|
|
340
|
+
* heuristic.
|
|
384
341
|
*/
|
|
385
342
|
export declare function refuseUnparentable(parent: HostElement, child: HostElement): void;
|
|
386
343
|
export interface Placement {
|
package/lib/types/props.d.ts
CHANGED
|
@@ -5,16 +5,13 @@ export declare function toPropertyName(name: string): string;
|
|
|
5
5
|
/**
|
|
6
6
|
* A props object without the keys a framework reserves for itself.
|
|
7
7
|
*
|
|
8
|
-
* The SET is per-framework and stays with the adapter that owns it
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* copy this repo lifts on: the two would drift, and the drifted one fails in a
|
|
12
|
-
* consumer while the host stays green.
|
|
8
|
+
* The SET is per-framework and stays with the adapter that owns it; the LOOP is here because two
|
|
9
|
+
* adapters each wrote their own, and the drifted one fails in a consumer while the host stays
|
|
10
|
+
* green.
|
|
13
11
|
*
|
|
14
12
|
* `undefined` rather than `{}` for an empty result, and that is load-bearing:
|
|
15
|
-
* `createElement(tag, undefined)` skips the property loop entirely, so a vnode
|
|
16
|
-
*
|
|
17
|
-
* property.
|
|
13
|
+
* `createElement(tag, undefined)` skips the property loop entirely, so a vnode whose props are ALL
|
|
14
|
+
* reserved must not look like a vnode with one unknown property.
|
|
18
15
|
*/
|
|
19
16
|
export declare function withoutKeys(props: Record<string, unknown> | null | undefined, skip: ReadonlySet<string>): Record<string, unknown> | undefined;
|
|
20
17
|
/** All ParamSpecs of a class, by kebab name. Cached per GType — `list_properties()` is not cheap. */
|
|
@@ -26,50 +23,40 @@ export declare function constructOnlyNames(klass: GObject.ObjectClass, gtypeName
|
|
|
26
23
|
/**
|
|
27
24
|
* The GType a name registers on this host, forcing the registration if it has to.
|
|
28
25
|
*
|
|
29
|
-
* `type_from_name` is asked FIRST because it is the answer that needs no table. It
|
|
30
|
-
*
|
|
31
|
-
*
|
|
26
|
+
* `type_from_name` is asked FIRST because it is the answer that needs no table. It answers null
|
|
27
|
+
* until something has touched the type, which is why the table is still reachable at all: reading
|
|
28
|
+
* `Gio.PasswordSave` is what registers `GPasswordSave`.
|
|
32
29
|
*
|
|
33
|
-
* NEITHER BRANCH IS THE FIX ALONE, and the order is what makes the measured case work:
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* THE answer to "does this host have that type" — a consumer gating on a GTK version
|
|
37
|
-
* asks here rather than walking a namespace list of its own.
|
|
30
|
+
* NEITHER BRANCH IS THE FIX ALONE, and the order is what makes the measured case work: a type
|
|
31
|
+
* nobody has read is absent from `type_from_name`, and a name {@link giTypeObject} cannot reach is
|
|
32
|
+
* absent from the table.
|
|
38
33
|
*/
|
|
39
34
|
export declare function gtypeOfName(gtypeName: string): GObject.GType | undefined;
|
|
40
35
|
/**
|
|
41
36
|
* The value a nick names on an enum or bitfield GType, or undefined if it names none.
|
|
42
37
|
*
|
|
43
|
-
* Exported for the generated surface's own check: the type surface offers a union
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* this function, so the GIR-member-to-nick spelling is measured rather than
|
|
47
|
-
* assumed. Also the primitive a renderer needs for a "did you mean" diagnostic.
|
|
38
|
+
* Exported for the generated surface's own check: the type surface offers a union of nicks per
|
|
39
|
+
* enum, and a nick this host cannot resolve would type-check and then be refused at runtime.
|
|
40
|
+
* Also the primitive a renderer needs for a "did you mean" diagnostic.
|
|
48
41
|
*
|
|
49
|
-
* The NAME is kept in the signature although a GType would need no lookup, because
|
|
50
|
-
*
|
|
51
|
-
* table, a renderer off `GObject.type_name(spec.value_type)`.
|
|
42
|
+
* The NAME is kept in the signature although a GType would need no lookup, because every caller
|
|
43
|
+
* has the name and not the type.
|
|
52
44
|
*/
|
|
53
45
|
export declare const lookupEnumNick: (gtypeName: string, nick: string) => number | undefined;
|
|
54
46
|
/**
|
|
55
47
|
* The member names an installed enum or bitfield registers, or `undefined` if this
|
|
56
48
|
* host has none.
|
|
57
49
|
*
|
|
58
|
-
* The INVERSE of {@link lookupEnumNick}, and it exists for the one question that
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* which is the whole remaining reason {@link GI_NAMESPACES} exists.
|
|
50
|
+
* The INVERSE of {@link lookupEnumNick}, and it exists for the one question that function cannot
|
|
51
|
+
* answer: a nick the vocabulary never emitted is absent from every list a check could iterate, so
|
|
52
|
+
* only the host's own members can reveal it. GJS offers no route to a `GEnumClass`, so the members
|
|
53
|
+
* come off the namespace object — the whole remaining reason {@link GI_NAMESPACES} exists.
|
|
63
54
|
*
|
|
64
55
|
* `$gtype` and anything non-numeric are not members; GJS puts both on the same object.
|
|
65
56
|
*
|
|
66
|
-
* AND THE TYPE HAS TO BE ONE, or the widened {@link giTypeObject} turns this into a
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* there) and `[]` is worse (it reads as "an enum that registers nothing", which is the
|
|
70
|
-
* claim every caller is entitled to trust). The GType the lookup already confirmed is
|
|
71
|
-
* what asks, so this is the same predicate the nicks branches above are routed on
|
|
72
|
-
* rather than a new way of spelling it.
|
|
57
|
+
* AND THE TYPE HAS TO BE ONE, or the widened {@link giTypeObject} turns this into a second answer
|
|
58
|
+
* rather than a wider one: a CLASS carries no numeric members, and `[]` would read as "an enum
|
|
59
|
+
* that registers nothing", which is the claim every caller is entitled to trust.
|
|
73
60
|
*/
|
|
74
61
|
export declare function enumMembers(gtypeName: string): string[] | undefined;
|
|
75
62
|
/**
|