@gjsify/adwaita-core 0.36.0 → 0.37.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/conformance/index.js +1 -1
- package/lib/esm/conformance/shortcut-label.js +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/shortcut-label.js +1 -0
- package/lib/types/about-dialog.d.ts +92 -98
- package/lib/types/action-row.d.ts +95 -125
- package/lib/types/avatar.d.ts +30 -37
- package/lib/types/banner.d.ts +25 -53
- package/lib/types/breakpoint.d.ts +6 -7
- package/lib/types/button-content.d.ts +41 -80
- package/lib/types/carousel.d.ts +175 -252
- package/lib/types/checks.d.ts +13 -30
- package/lib/types/chrome.d.ts +90 -136
- package/lib/types/color-scheme.d.ts +5 -6
- package/lib/types/conformance/about-dialog.d.ts +64 -91
- package/lib/types/conformance/action-row.d.ts +26 -46
- package/lib/types/conformance/avatar.d.ts +8 -10
- package/lib/types/conformance/banner.d.ts +17 -37
- package/lib/types/conformance/button-content.d.ts +24 -46
- package/lib/types/conformance/carousel.d.ts +35 -75
- package/lib/types/conformance/checks.d.ts +0 -4
- package/lib/types/conformance/chrome.d.ts +28 -36
- package/lib/types/conformance/data-grid.d.ts +28 -47
- package/lib/types/conformance/dialog.d.ts +4 -9
- package/lib/types/conformance/entry-row.d.ts +20 -39
- package/lib/types/conformance/index.d.ts +2 -0
- package/lib/types/conformance/navigation-view.d.ts +0 -4
- package/lib/types/conformance/popover.d.ts +4 -9
- package/lib/types/conformance/preferences.d.ts +15 -28
- package/lib/types/conformance/rows.d.ts +5 -12
- package/lib/types/conformance/shortcut-label.d.ts +34 -0
- package/lib/types/conformance/sidebar.d.ts +28 -49
- package/lib/types/conformance/spinner.d.ts +21 -27
- package/lib/types/conformance/split-button.d.ts +21 -43
- package/lib/types/conformance/split-view.d.ts +29 -36
- package/lib/types/conformance/tab-view.d.ts +32 -73
- package/lib/types/conformance/view-stack.d.ts +0 -12
- package/lib/types/conformance/view-switcher.d.ts +46 -114
- package/lib/types/conformance/wrap-box.d.ts +40 -63
- package/lib/types/data-grid.d.ts +38 -48
- package/lib/types/dialog.d.ts +39 -51
- package/lib/types/easing.d.ts +6 -12
- package/lib/types/entry-row.d.ts +94 -123
- package/lib/types/glib.d.ts +17 -25
- package/lib/types/index.d.ts +2 -0
- package/lib/types/length-unit.d.ts +7 -12
- package/lib/types/navigation-view.d.ts +62 -68
- package/lib/types/popover.d.ts +39 -66
- package/lib/types/preferences.d.ts +83 -100
- package/lib/types/rows.d.ts +45 -63
- package/lib/types/shortcut-label.d.ts +79 -0
- package/lib/types/shortcut-label.spec.d.ts +2 -0
- package/lib/types/sidebar.d.ts +95 -121
- package/lib/types/spinner.d.ts +39 -61
- package/lib/types/split-button.d.ts +78 -134
- package/lib/types/split-view.d.ts +74 -89
- package/lib/types/tab-view.d.ts +174 -256
- package/lib/types/view-stack.d.ts +87 -129
- package/lib/types/view-switcher.d.ts +126 -211
- package/lib/types/wrap-box.d.ts +62 -123
- package/package.json +3 -3
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
export interface AdwRowLabels {
|
|
3
3
|
/** The title label's text — `''` for an unset title, never `null`. */
|
|
4
4
|
title: string;
|
|
5
|
-
/** `string_is_not_empty(title)
|
|
5
|
+
/** `string_is_not_empty(title)`, bound from `adw-action-row.ui`. */
|
|
6
6
|
titleVisible: boolean;
|
|
7
7
|
/** The subtitle label's text — `''` for an unset subtitle. */
|
|
8
8
|
subtitle: string;
|
|
9
|
-
/** `string_is_not_empty(subtitle)
|
|
9
|
+
/** `string_is_not_empty(subtitle)`, bound from `adw-action-row.ui`. */
|
|
10
10
|
subtitleVisible: boolean;
|
|
11
11
|
}
|
|
12
12
|
/** What a row knows about its two labels. */
|
|
@@ -18,43 +18,38 @@ export interface AdwRowLabelInput {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* The title/subtitle labels of any Adwaita row, with the `visible` each binding
|
|
21
|
-
* computes.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* rows that already have a core state machine of their OWN (`Adw.ComboRow`,
|
|
25
|
-
* `Adw.ExpanderRow`, `Adw.SpinRow` via `rows.ts`) still render this pair, and
|
|
26
|
-
* every one of them had hand-rolled it.
|
|
21
|
+
* computes. Exported on its own — not just as part of {@link ActionRowState} — because
|
|
22
|
+
* the rows that have a core state machine of their OWN (`Adw.ComboRow`,
|
|
23
|
+
* `Adw.ExpanderRow`, `Adw.SpinRow` via `rows.ts`) still render this pair.
|
|
27
24
|
*/
|
|
28
25
|
export declare function deriveRowLabels(input: AdwRowLabelInput): AdwRowLabels;
|
|
29
26
|
/** Everything a renderer needs to paint an `Adw.ActionRow`. */
|
|
30
27
|
export interface ActionRowRenderState extends AdwRowLabels {
|
|
31
28
|
/**
|
|
32
|
-
* `GtkListBoxRow:activatable` — whether a click activates the row at all.
|
|
33
|
-
*
|
|
34
|
-
* widget rather than by the row itself.
|
|
29
|
+
* `GtkListBoxRow:activatable` — whether a click activates the row at all. `False`
|
|
30
|
+
* in the template and raised by an activatable widget, not by the row itself.
|
|
35
31
|
*/
|
|
36
32
|
activatable: boolean;
|
|
37
33
|
}
|
|
38
34
|
/**
|
|
39
|
-
* `Adw.ActionRow`: two labels plus the `activatable-widget` coupling
|
|
40
|
-
*
|
|
41
|
-
* The coupling is the part no port had, and it is counter-intuitive twice over.
|
|
35
|
+
* `Adw.ActionRow`: two labels plus the `activatable-widget` coupling, which is
|
|
36
|
+
* counter-intuitive twice over.
|
|
42
37
|
*
|
|
43
|
-
* (1) Setting an activatable widget does not set `activatable = TRUE`; it binds
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
38
|
+
* (1) Setting an activatable widget does not set `activatable = TRUE`; it binds the
|
|
39
|
+
* WIDGET's `sensitive` onto the row's `activatable` with `G_BINDING_SYNC_CREATE`. So
|
|
40
|
+
* handing the row an INSENSITIVE widget leaves the row unactivatable, and later
|
|
41
|
+
* flipping that widget's `sensitive` flips the row with it, as long as the binding
|
|
42
|
+
* lives.
|
|
48
43
|
*
|
|
49
|
-
* (2) Clearing the widget only UNBINDS
|
|
50
|
-
* activatable_binding, g_binding_unbind)
|
|
51
|
-
* back
|
|
52
|
-
* which the class documentation states outright ("unsetting it won't change the
|
|
53
|
-
*
|
|
54
|
-
*
|
|
44
|
+
* (2) Clearing the widget only UNBINDS
|
|
45
|
+
* (`g_clear_pointer (&priv->activatable_binding, g_binding_unbind)`); it never writes
|
|
46
|
+
* `activatable` back, so the row STAYS activatable after its widget is taken away —
|
|
47
|
+
* which the class documentation states outright ("unsetting it won't change the row's
|
|
48
|
+
* activatability"). Modelling this as `activatable = hasActivatableWidget` gets the
|
|
49
|
+
* sticky case exactly backwards.
|
|
55
50
|
*
|
|
56
|
-
* `TWidget` is whatever the renderer calls a widget — a DOM element, an NS
|
|
57
|
-
*
|
|
51
|
+
* `TWidget` is whatever the renderer calls a widget — a DOM element, an NS `View`. Core
|
|
52
|
+
* only ever compares it by identity and hands it back.
|
|
58
53
|
*/
|
|
59
54
|
export declare class ActionRowState<TWidget = unknown> {
|
|
60
55
|
private _title;
|
|
@@ -75,29 +70,27 @@ export declare class ActionRowState<TWidget = unknown> {
|
|
|
75
70
|
/** `AdwActionRow:activatable-widget` — `null` when unset. */
|
|
76
71
|
get activatableWidget(): TWidget | null;
|
|
77
72
|
/**
|
|
78
|
-
* `adw_action_row_set_activatable_widget
|
|
73
|
+
* `adw_action_row_set_activatable_widget`.
|
|
79
74
|
*
|
|
80
|
-
* `sensitive` is the widget's own `GtkWidget:sensitive` at the moment of the
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
75
|
+
* `sensitive` is the widget's own `GtkWidget:sensitive` at the moment of the set,
|
|
76
|
+
* which `G_BINDING_SYNC_CREATE` copies straight into `activatable`; it defaults to
|
|
77
|
+
* `true` because a freshly built widget is sensitive. Passing `null` unbinds and
|
|
78
|
+
* LEAVES `activatable` alone.
|
|
84
79
|
*
|
|
85
|
-
* Returns whether the widget changed — the `notify::activatable-widget` gate
|
|
86
|
-
*
|
|
80
|
+
* Returns whether the widget changed — the `notify::activatable-widget` gate, which
|
|
81
|
+
* the C guards with an identity early-return.
|
|
87
82
|
*/
|
|
88
83
|
setActivatableWidget(widget: TWidget | null, sensitive?: boolean): boolean;
|
|
89
84
|
/**
|
|
90
85
|
* The live half of the binding: the activatable widget's `sensitive` is now
|
|
91
|
-
* `sensitive`. Safe to call unconditionally
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* -
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* fired. Without this half, a re-assertion of the value the widget
|
|
100
|
-
* already had would silently undo a direct write to `activatable`.
|
|
86
|
+
* `sensitive`. Safe to call unconditionally. Two things make it a no-op, both the
|
|
87
|
+
* C's:
|
|
88
|
+
* - no widget is set, so `g_clear_pointer (…, g_binding_unbind)` already took the
|
|
89
|
+
* binding away;
|
|
90
|
+
* - the value is unchanged, so `gtk_widget_set_sensitive` early-returned and
|
|
91
|
+
* `notify::sensitive` — the only thing a GBinding listens to — never fired.
|
|
92
|
+
* Without this half, re-asserting the value the widget already had would
|
|
93
|
+
* silently undo a direct write to `activatable`.
|
|
101
94
|
*
|
|
102
95
|
* Returns whether `activatable` changed.
|
|
103
96
|
*/
|
|
@@ -105,97 +98,84 @@ export declare class ActionRowState<TWidget = unknown> {
|
|
|
105
98
|
/** `GtkListBoxRow:activatable`. */
|
|
106
99
|
get activatable(): boolean;
|
|
107
100
|
/**
|
|
108
|
-
* Set `activatable` directly.
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* next `sensitive` change overwrites it. Kept faithful rather than guarded —
|
|
113
|
-
* a port that refused the write would diverge from every application that
|
|
114
|
-
* sets `activatable` in a `.ui` file.
|
|
101
|
+
* Set `activatable` directly. Legal even while a binding is live:
|
|
102
|
+
* `g_object_bind_property` without `G_BINDING_BIDIRECTIONAL` is one-way, so GTK lets
|
|
103
|
+
* the write land and the next `sensitive` change overwrites it. Refusing the write
|
|
104
|
+
* would diverge from every application that sets `activatable` in a `.ui` file.
|
|
115
105
|
*
|
|
116
106
|
* Returns whether it changed.
|
|
117
107
|
*/
|
|
118
108
|
setActivatable(activatable: boolean): boolean;
|
|
119
109
|
/**
|
|
120
|
-
* `adw_action_row_activate_real
|
|
121
|
-
*
|
|
110
|
+
* `adw_action_row_activate_real`: forward the activation to the activatable widget,
|
|
111
|
+
* then emit `activated`.
|
|
122
112
|
*
|
|
123
113
|
* Returns the widget to forward to, or `null`. The caller emits `activated`
|
|
124
|
-
* UNCONDITIONALLY afterwards — C
|
|
125
|
-
* `adw_action_row_activate` is public API
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
114
|
+
* UNCONDITIONALLY afterwards — the C's `g_signal_emit` sits outside the `if`, and
|
|
115
|
+
* `adw_action_row_activate` is public API with no `activatable` check of its own.
|
|
116
|
+
* The `activatable` gate lives one level up, in GtkListBox, which does not emit
|
|
117
|
+
* `row-activated` for an unactivatable row; a renderer's CLICK handler is where that
|
|
118
|
+
* check belongs.
|
|
129
119
|
*/
|
|
130
120
|
activate(): TWidget | null;
|
|
131
121
|
}
|
|
132
122
|
/**
|
|
133
|
-
* `Adw.SwitchRow`: one boolean
|
|
123
|
+
* `Adw.SwitchRow`: one boolean and its notify rule.
|
|
134
124
|
*
|
|
135
|
-
* `adw_switch_row_set_active`
|
|
136
|
-
*
|
|
137
|
-
* `
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
125
|
+
* `adw_switch_row_set_active` early-returns when the value is unchanged and otherwise
|
|
126
|
+
* writes the slider, whose `notify::active` runs `slider_notify_active_cb` — which
|
|
127
|
+
* updates the a11y `checked` state and emits `notify::active` on the ROW. That callback
|
|
128
|
+
* is the ONLY notify path and it cannot see where the change came from, so a
|
|
129
|
+
* programmatic set notifies exactly like a drag on the handle. That is also why there is
|
|
130
|
+
* deliberately NO `interactive` flag here (the `SpinState`/`ComboState` shape): it would
|
|
131
|
+
* be an abstraction the C contradicts.
|
|
141
132
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* re-emitted from `checkedChange`, which NS DOES fire on a programmatic write,
|
|
146
|
-
* so it notified. One widget, one C source, two opposite answers.
|
|
147
|
-
*
|
|
148
|
-
* There is deliberately NO `interactive` flag (the `SpinState`/`ComboState`
|
|
149
|
-
* shape): adding one would be an abstraction that actively contradicts C:66-77.
|
|
133
|
+
* The DOM makes this easy to get wrong: `<input>`'s `change` event does not fire for a
|
|
134
|
+
* programmatic `.checked =`, so a renderer that only re-emits `change` is silent for
|
|
135
|
+
* `row.active = true`.
|
|
150
136
|
*/
|
|
151
137
|
export declare class SwitchRowState {
|
|
152
138
|
private _active;
|
|
153
139
|
/** `Adw.SwitchRow:active`. */
|
|
154
140
|
get active(): boolean;
|
|
155
141
|
/**
|
|
156
|
-
* `adw_switch_row_set_active
|
|
157
|
-
*
|
|
158
|
-
* normalisation is C:222.
|
|
142
|
+
* `adw_switch_row_set_active`. Returns whether it changed — i.e. whether the renderer
|
|
143
|
+
* must emit `notify::active`. The `!!is_active` normalisation is the C's.
|
|
159
144
|
*/
|
|
160
145
|
setActive(active: boolean): boolean;
|
|
161
146
|
/**
|
|
162
147
|
* The row was activated (clicked, or <kbd>Enter</kbd>) — invert the state.
|
|
163
148
|
*
|
|
164
|
-
* `adw_switch_row_init` makes the row activatable and points the
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* the switch handle", C:23-27). Neither port did this — the row's text was
|
|
170
|
-
* dead and only the handle worked.
|
|
149
|
+
* `adw_switch_row_init` makes the row activatable and points the activatable-widget
|
|
150
|
+
* at the slider, so an activation is forwarded to the `GtkSwitch` and toggles it; the
|
|
151
|
+
* class docs state the outcome directly ("When activated, the row will invert its
|
|
152
|
+
* active state. The user can control the switch by activating the row or by dragging
|
|
153
|
+
* on the switch handle") — the whole row is the target, not just the handle.
|
|
171
154
|
*
|
|
172
155
|
* Always returns `true`: inverting a boolean always changes it.
|
|
173
156
|
*/
|
|
174
157
|
activate(): boolean;
|
|
175
158
|
}
|
|
176
159
|
/**
|
|
177
|
-
* `Adw.ButtonRow` is ALWAYS activatable — `<property name="activatable">True
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* Exported as data because the browser renderer had INVENTED an
|
|
183
|
-
* `activatable="false"` opt-out, and a passing test pinned it.
|
|
160
|
+
* `Adw.ButtonRow` is ALWAYS activatable — `<property name="activatable">True</property>`
|
|
161
|
+
* in the template, with no setter and no property, and the class documentation saying so
|
|
162
|
+
* in one line ("`AdwButtonRow` is always activatable."). Exported as data so a renderer
|
|
163
|
+
* cannot invent an `activatable="false"` opt-out.
|
|
184
164
|
*/
|
|
185
165
|
export declare const BUTTON_ROW_ACTIVATABLE = true;
|
|
186
166
|
/** Everything a renderer needs to paint an `Adw.ButtonRow`. */
|
|
187
167
|
export interface ButtonRowRenderState {
|
|
188
168
|
/** `AdwPreferencesRow:title` — `''` when unset. */
|
|
189
169
|
title: string;
|
|
190
|
-
/** `string_is_not_empty(title)
|
|
170
|
+
/** `string_is_not_empty(title)`. */
|
|
191
171
|
titleVisible: boolean;
|
|
192
|
-
/** `AdwButtonRow:start-icon-name` — `''` when unset
|
|
172
|
+
/** `AdwButtonRow:start-icon-name` — `''` when unset. */
|
|
193
173
|
startIconName: string;
|
|
194
|
-
/** `string_is_not_empty(start_image.icon-name)
|
|
174
|
+
/** `string_is_not_empty(start_image.icon-name)`. */
|
|
195
175
|
startIconVisible: boolean;
|
|
196
|
-
/** `AdwButtonRow:end-icon-name` — `''` when unset
|
|
176
|
+
/** `AdwButtonRow:end-icon-name` — `''` when unset. */
|
|
197
177
|
endIconName: string;
|
|
198
|
-
/** `string_is_not_empty(end_image.icon-name)
|
|
178
|
+
/** `string_is_not_empty(end_image.icon-name)`. */
|
|
199
179
|
endIconVisible: boolean;
|
|
200
180
|
/** Always {@link BUTTON_ROW_ACTIVATABLE}. */
|
|
201
181
|
activatable: true;
|
|
@@ -203,16 +183,11 @@ export interface ButtonRowRenderState {
|
|
|
203
183
|
/**
|
|
204
184
|
* `Adw.ButtonRow`: a centered title between two optional symbolic icons.
|
|
205
185
|
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* Both icon setters go through `g_set_str`, which returns FALSE for an unchanged
|
|
213
|
-
* value and thereby gates the notify (C:309-312, C:348-351). `g_set_str (&s,
|
|
214
|
-
* NULL)` stores NULL, but every read is `string_is_not_empty`-guarded and the
|
|
215
|
-
* pspec default is `""`, so `''` is the faithful TS spelling of both.
|
|
186
|
+
* `AdwButtonRow:end-icon-name` has existed since libadwaita 1.6 and is what the
|
|
187
|
+
* "Open in Files ›" shape needs. Both icon setters go through `g_set_str`, which returns
|
|
188
|
+
* FALSE for an unchanged value and thereby gates the notify; `g_set_str (&s, NULL)`
|
|
189
|
+
* stores NULL, but every read is `string_is_not_empty`-guarded and the pspec default is
|
|
190
|
+
* `""`, so `''` is the faithful TS spelling of both.
|
|
216
191
|
*/
|
|
217
192
|
export declare class ButtonRowState {
|
|
218
193
|
private _title;
|
|
@@ -226,33 +201,28 @@ export declare class ButtonRowState {
|
|
|
226
201
|
setTitle(title: string | null | undefined): boolean;
|
|
227
202
|
/** `AdwButtonRow:start-icon-name`. */
|
|
228
203
|
get startIconName(): string;
|
|
229
|
-
/** `adw_button_row_set_start_icon_name
|
|
204
|
+
/** `adw_button_row_set_start_icon_name`. Returns whether it changed. */
|
|
230
205
|
setStartIconName(iconName: string | null | undefined): boolean;
|
|
231
206
|
/** `AdwButtonRow:end-icon-name`. */
|
|
232
207
|
get endIconName(): string;
|
|
233
|
-
/** `adw_button_row_set_end_icon_name
|
|
208
|
+
/** `adw_button_row_set_end_icon_name`. Returns whether it changed. */
|
|
234
209
|
setEndIconName(iconName: string | null | undefined): boolean;
|
|
235
210
|
}
|
|
236
211
|
/** Everything a renderer needs to paint an `Adw.WindowTitle`. */
|
|
237
212
|
export type WindowTitleRenderState = AdwRowLabels;
|
|
238
213
|
/**
|
|
239
|
-
* `Adw.WindowTitle`: the same two labels, one level out of the boxed list.
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* label is hidden when the title is empty (C:207-208 — the `.ui` even starts it
|
|
243
|
-
* `visible=False`, adw-window-title.ui:15), a set to the CURRENT value returns
|
|
244
|
-
* early (C:203-204, C:244-245), and a real change notifies (C:210, C:251).
|
|
214
|
+
* `Adw.WindowTitle`: the same two labels, one level out of the boxed list. Three rules —
|
|
215
|
+
* the TITLE label is hidden when the title is empty (the `.ui` even starts it
|
|
216
|
+
* `visible=False`), a set to the CURRENT value returns early, and a real change notifies.
|
|
245
217
|
*
|
|
246
|
-
* DIVERGENCE, deliberate: setting `null` over an already-empty value does NOT
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* normalisation happens BEFORE the comparison, and `WINDOW_TITLE_VECTORS` pins
|
|
255
|
-
* the divergence rather than hiding it.
|
|
218
|
+
* DIVERGENCE, deliberate: setting `null` over an already-empty value does NOT notify
|
|
219
|
+
* here, where libadwaita does. Its guard is `g_strcmp0 (gtk_label_get_label (…), title)`
|
|
220
|
+
* and `gtk_label_get_label` never returns NULL, so `g_strcmp0 ("", NULL)` is 1 — the
|
|
221
|
+
* early return is skipped, the label is re-set to the same `""`, and `notify::title` fires
|
|
222
|
+
* for a no-op. That is an artefact of a NULL-vs-`""` pointer comparison, not a designed
|
|
223
|
+
* behaviour; both renderers carry `null` for "attribute absent" and `''` for `title=""`.
|
|
224
|
+
* The normalisation happens BEFORE the comparison, and `WINDOW_TITLE_VECTORS` pins the
|
|
225
|
+
* divergence rather than hiding it.
|
|
256
226
|
*/
|
|
257
227
|
export declare class WindowTitleState {
|
|
258
228
|
private _title;
|
|
@@ -261,10 +231,10 @@ export declare class WindowTitleState {
|
|
|
261
231
|
get state(): WindowTitleRenderState;
|
|
262
232
|
/** `Adw.WindowTitle:title`. */
|
|
263
233
|
get title(): string;
|
|
264
|
-
/** `adw_window_title_set_title
|
|
234
|
+
/** `adw_window_title_set_title`. Returns whether it changed. */
|
|
265
235
|
setTitle(title: string | null | undefined): boolean;
|
|
266
236
|
/** `Adw.WindowTitle:subtitle`. */
|
|
267
237
|
get subtitle(): string;
|
|
268
|
-
/** `adw_window_title_set_subtitle
|
|
238
|
+
/** `adw_window_title_set_subtitle`. Returns whether it changed. */
|
|
269
239
|
setSubtitle(subtitle: string | null | undefined): boolean;
|
|
270
240
|
}
|
package/lib/types/avatar.d.ts
CHANGED
|
@@ -17,35 +17,31 @@ export declare const AVATAR_COLORS: ReadonlyArray<AdwAvatarColor>;
|
|
|
17
17
|
/**
|
|
18
18
|
* GLib's `g_str_hash` — the DJB2 variant `h = h * 33 + c`, as `guint32`.
|
|
19
19
|
*
|
|
20
|
-
* Two details decide whether the avatar colour matches GTK
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* first NUL byte, so an embedded `\0` truncates the input.
|
|
20
|
+
* Two details decide whether the avatar colour matches GTK: `c` is a **`signed char` of
|
|
21
|
+
* the UTF-8 encoding**, not a UTF-16 code unit, so bytes ≥ 0x80 contribute NEGATIVE
|
|
22
|
+
* values; and the C loop stops at the first NUL byte, so an embedded `\0` truncates the
|
|
23
|
+
* input.
|
|
25
24
|
*/
|
|
26
25
|
export declare function gStrHash(text: string): number;
|
|
27
26
|
/**
|
|
28
|
-
* The initials `Adw.Avatar` shows for `text`: the first character, plus the
|
|
29
|
-
*
|
|
27
|
+
* The initials `Adw.Avatar` shows for `text`: the first character, plus the character
|
|
28
|
+
* following the LAST space if there is one.
|
|
30
29
|
*
|
|
31
|
-
* Mirrors `extract_initials_from_text` step for step — upcase,
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* `"Ada\tLovelace"` yields `"A"`, exactly as GTK does.
|
|
30
|
+
* Mirrors `extract_initials_from_text` step for step — upcase, strip, NFC-normalise,
|
|
31
|
+
* then take code points (never UTF-16 units, so an astral first letter survives). Only a
|
|
32
|
+
* literal ASCII space separates the two initials, so `"Ada\tLovelace"` yields `"A"`.
|
|
35
33
|
*
|
|
36
|
-
* Returns `''` for a blank name
|
|
37
|
-
*
|
|
38
|
-
* empty string is the sane rendering of the same "no initials" state.
|
|
34
|
+
* Returns `''` for a blank name, where libadwaita emits a one-NUL-byte label because its
|
|
35
|
+
* caller only guards the RAW text against being empty.
|
|
39
36
|
*/
|
|
40
37
|
export declare function avatarInitials(text: string): string;
|
|
41
38
|
/**
|
|
42
39
|
* The 1-based colour class (`color1`…`color14`) `Adw.Avatar` assigns to `text`,
|
|
43
40
|
* i.e. `set_class_color`'s `(g_str_hash (text) % NUMBER_OF_COLORS) + 1`.
|
|
44
41
|
*
|
|
45
|
-
* `null` for a blank name: libadwaita picks a RANDOM class there, so no value is
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* both current renderers do — can ignore the `null`.
|
|
42
|
+
* `null` for a blank name: libadwaita picks a RANDOM class there, so no value is derivable
|
|
43
|
+
* from the name. {@link randomAvatarColorClass} is that behaviour; a renderer that paints
|
|
44
|
+
* nothing without initials can ignore the `null`.
|
|
49
45
|
*/
|
|
50
46
|
export declare function avatarColorClass(text: string): number | null;
|
|
51
47
|
/**
|
|
@@ -64,13 +60,12 @@ export declare function avatarColor(text: string): AdwAvatarColor;
|
|
|
64
60
|
/** Which of the three mutually exclusive things an avatar shows. */
|
|
65
61
|
export type AdwAvatarMode = 'image' | 'initials' | 'icon';
|
|
66
62
|
/**
|
|
67
|
-
* `update_visibility
|
|
68
|
-
*
|
|
69
|
-
* otherwise the fallback icon.
|
|
63
|
+
* `update_visibility`: a custom image wins outright, otherwise initials show when they
|
|
64
|
+
* were asked for and the name is non-empty, otherwise the fallback icon.
|
|
70
65
|
*
|
|
71
|
-
* The gate is the length of the TEXT, not of the derived initials — a
|
|
72
|
-
*
|
|
73
|
-
*
|
|
66
|
+
* The gate is the length of the TEXT, not of the derived initials — a whitespace-only name
|
|
67
|
+
* is in `'initials'` mode with a blank label, where a renderer keying on the initials
|
|
68
|
+
* would fall back to the icon instead.
|
|
74
69
|
*/
|
|
75
70
|
export declare function avatarMode(input: {
|
|
76
71
|
hasCustomImage: boolean;
|
|
@@ -79,26 +74,24 @@ export declare function avatarMode(input: {
|
|
|
79
74
|
}): AdwAvatarMode;
|
|
80
75
|
/**
|
|
81
76
|
* The largest font size that still fits the initials inside the circle
|
|
82
|
-
* (`update_font_size
|
|
83
|
-
*
|
|
84
|
-
* `max(size * 0.4 - 5, 0)`.
|
|
77
|
+
* (`update_font_size`): the biggest square inscribed in the circle, `size / 1.4142`, less
|
|
78
|
+
* a size-proportional padding `max(size * 0.4 - 5, 0)`.
|
|
85
79
|
*
|
|
86
|
-
* Monotonically increasing in `size
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
80
|
+
* Monotonically increasing in `size`, which a breakpoint-style approximation
|
|
81
|
+
* (`size * (size < 32 ? 0.5 : 0.4)`) is not — that one both exceeds the cap and DROPS as
|
|
82
|
+
* the avatar grows. A renderer that cannot measure text can use this alone and stay
|
|
83
|
+
* inside libadwaita's bound.
|
|
90
84
|
*/
|
|
91
85
|
export declare function avatarMaxFontSize(size: number): number;
|
|
92
86
|
/**
|
|
93
87
|
* The font size `Adw.Avatar` gives the initials label, given the label's
|
|
94
88
|
* measured box: `height * (max / width)`, clamped to `[0, max]`.
|
|
95
89
|
*
|
|
96
|
-
* Text measurement is the one genuinely renderer-specific input, so it is
|
|
97
|
-
*
|
|
98
|
-
* the
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* defensible answer.
|
|
90
|
+
* Text measurement is the one genuinely renderer-specific input, so it is injected (the
|
|
91
|
+
* `ToastScheduler` seam style). Only the ASPECT RATIO matters — the formula scales it
|
|
92
|
+
* against the cap — so a renderer may measure at any font size it likes, as Pango's
|
|
93
|
+
* reset-then-measure does. A non-positive width means "not laid out yet", and the cap is
|
|
94
|
+
* then the only defensible answer.
|
|
102
95
|
*/
|
|
103
96
|
export declare function avatarFontSize(size: number, measured: {
|
|
104
97
|
width: number;
|
package/lib/types/banner.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `AdwBannerButtonStyle` as a string union — the two enum nicks
|
|
3
|
-
* (adw-banner.c:23-35, Since 1.7).
|
|
4
|
-
*/
|
|
1
|
+
/** `AdwBannerButtonStyle` as a string union — the two enum nicks (since libadwaita 1.7). */
|
|
5
2
|
export type AdwBannerButtonStyle = 'default' | 'suggested';
|
|
6
3
|
/** Both `AdwBannerButtonStyle` members, in enum order. */
|
|
7
4
|
export declare const ADW_BANNER_BUTTON_STYLES: readonly AdwBannerButtonStyle[];
|
|
8
5
|
/**
|
|
9
|
-
* Every style class `button-style` MANAGES on the banner button.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* only ever adds or removes `suggested-action` (:766, :769), it never rewrites
|
|
13
|
-
* the button's class list.
|
|
6
|
+
* Every style class `button-style` MANAGES on the banner button. A renderer swaps
|
|
7
|
+
* within this set and leaves every other class alone — the C only ever adds or
|
|
8
|
+
* removes `suggested-action`, it never rewrites the class list.
|
|
14
9
|
*/
|
|
15
10
|
export declare const ADW_BANNER_BUTTON_STYLE_CLASSES: readonly string[];
|
|
16
11
|
/** The five `Adw.Banner` properties, as a renderer holds them. */
|
|
@@ -26,79 +21,56 @@ export interface AdwBannerProps {
|
|
|
26
21
|
/** `button-style` — grey (`'default'`) or `.suggested-action`. */
|
|
27
22
|
buttonStyle: AdwBannerButtonStyle;
|
|
28
23
|
}
|
|
29
|
-
/**
|
|
30
|
-
* The property defaults a freshly constructed `Adw.Banner` has, straight from
|
|
31
|
-
* the `GParamSpec`s.
|
|
32
|
-
*
|
|
33
|
-
* Two of these are the whole reason this module exists, and both are easy to get
|
|
34
|
-
* backwards from the rendered widget rather than from the source: `revealed` is
|
|
35
|
-
* FALSE (:456-459) and `use-markup` is TRUE (:422-425).
|
|
36
|
-
*/
|
|
24
|
+
/** The property defaults of a freshly constructed `Adw.Banner`, from the `GParamSpec`s. */
|
|
37
25
|
export declare const ADW_BANNER_DEFAULTS: Readonly<AdwBannerProps>;
|
|
38
26
|
/** Whether `value` is one of the two `AdwBannerButtonStyle` nicks. */
|
|
39
27
|
export declare function isBannerButtonStyle(value: unknown): value is AdwBannerButtonStyle;
|
|
40
28
|
/**
|
|
41
|
-
* The button style for a renderer-supplied string — an HTML attribute, an XML
|
|
42
|
-
*
|
|
29
|
+
* The button style for a renderer-supplied string — an HTML attribute, an XML property,
|
|
30
|
+
* a JSON config.
|
|
43
31
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* GObject itself does when an invalid nick reaches `g_object_set`.
|
|
32
|
+
* MODIFICATION: anything that is not a nick becomes `'default'`, where
|
|
33
|
+
* `adw_banner_set_button_style` guards the ENUM range and keeps the old value. It can
|
|
34
|
+
* afford to, because by then the value already IS an `AdwBannerButtonStyle`; a string
|
|
35
|
+
* never becomes one, so there is nothing to keep. Falling back to the property default
|
|
36
|
+
* is what `g_object_set` does with an invalid nick.
|
|
50
37
|
*/
|
|
51
38
|
export declare function parseBannerButtonStyle(value: string | null | undefined): AdwBannerButtonStyle;
|
|
52
39
|
/**
|
|
53
40
|
* The style classes the banner button carries for `style` —
|
|
54
|
-
* `adw_banner_set_button_style`'s switch
|
|
41
|
+
* `adw_banner_set_button_style`'s switch.
|
|
55
42
|
*/
|
|
56
43
|
export declare function bannerButtonStyleClasses(style: AdwBannerButtonStyle): readonly string[];
|
|
57
44
|
/**
|
|
58
45
|
* Whether the action button is shown: `gtk_widget_set_visible (button, label &&
|
|
59
|
-
* label[0])`
|
|
60
|
-
*
|
|
61
|
-
* The test is on the FIRST CHARACTER, so it is not a trim and not a truthiness
|
|
62
|
-
* check on the trimmed value — `" "` is a one-character label and its button is
|
|
63
|
-
* shown, blank-looking though it is. A renderer that trimmed here would silently
|
|
64
|
-
* drop a button GTK draws.
|
|
46
|
+
* label[0])` — FIRST CHARACTER, not a trim, so `" "` is a label and its button is
|
|
47
|
+
* shown. A renderer that trimmed would drop a button GTK draws.
|
|
65
48
|
*/
|
|
66
49
|
export declare function bannerButtonVisible(label: string | null | undefined): boolean;
|
|
67
50
|
/**
|
|
68
|
-
* The text painted on the action button.
|
|
69
|
-
*
|
|
70
|
-
* The
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* renderer with no accelerator layer wants the marker gone, which is what
|
|
74
|
-
* {@link stripMnemonic} returns.
|
|
75
|
-
*
|
|
76
|
-
* The TITLE deliberately has no counterpart here: the same template pins the
|
|
77
|
-
* title label to `use-underline=False` (adw-banner.ui:20), so a title keeps
|
|
78
|
-
* every underscore it was given. Passing a title through this function would be
|
|
79
|
-
* a bug, not a symmetry.
|
|
51
|
+
* The text painted on the action button. The template pins the button to
|
|
52
|
+
* `use-underline=True` with no property to turn it off, so `_` in `button-label` is
|
|
53
|
+
* ALWAYS an accelerator marker. The TITLE has no counterpart on purpose: the same
|
|
54
|
+
* template pins it to `use-underline=False`, so a title keeps its underscores and
|
|
55
|
+
* passing one through this function is a bug, not a symmetry.
|
|
80
56
|
*/
|
|
81
57
|
export declare function bannerButtonText(label: string): string;
|
|
82
58
|
/** What one banner derivation tells a renderer to draw. */
|
|
83
59
|
export interface AdwBannerRenderState {
|
|
84
|
-
/** Whether the strip is on screen (`GtkRevealer:reveal-child
|
|
60
|
+
/** Whether the strip is on screen (`GtkRevealer:reveal-child`). */
|
|
85
61
|
revealed: boolean;
|
|
86
62
|
/** Whether {@link AdwBannerProps.title} is to be read as Pango markup. */
|
|
87
63
|
useMarkup: boolean;
|
|
88
|
-
/** Whether the action button is in the tree (:663). */
|
|
89
64
|
buttonVisible: boolean;
|
|
90
65
|
/** The button's label with mnemonic markers removed. */
|
|
91
66
|
buttonText: string;
|
|
92
|
-
/** The style classes `button-style` puts on the button
|
|
67
|
+
/** The style classes `button-style` puts on the button. */
|
|
93
68
|
buttonClasses: readonly string[];
|
|
94
69
|
}
|
|
95
70
|
/**
|
|
96
71
|
* The full render state for a banner, filling every unset property from
|
|
97
|
-
* {@link ADW_BANNER_DEFAULTS}.
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* real state, and the whole point of this module is that "not set" resolves to
|
|
101
|
-
* the libadwaita default rather than to whatever the renderer's field
|
|
102
|
-
* initialiser happened to be.
|
|
72
|
+
* {@link ADW_BANNER_DEFAULTS}. `Partial` on purpose: a renderer reading attributes
|
|
73
|
+
* has "not set" as a real state, and it must resolve to the libadwaita default
|
|
74
|
+
* rather than to a field initialiser.
|
|
103
75
|
*/
|
|
104
76
|
export declare function bannerRenderState(props?: Partial<AdwBannerProps>): AdwBannerRenderState;
|
|
@@ -39,10 +39,9 @@ export interface AdwBreakpointHandlers {
|
|
|
39
39
|
onUnapply?: () => void;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* A single responsive breakpoint: a condition plus apply/unapply callbacks
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* `ResizeObserver` in a browser renderer).
|
|
42
|
+
* A single responsive breakpoint: a condition plus apply/unapply callbacks, mirroring
|
|
43
|
+
* `Adw.Breakpoint`. Drive {@link evaluate} from the renderer's size source (`addBreakpoints`
|
|
44
|
+
* in `@gjsify/adwaita-nativescript`, a `ResizeObserver` in a browser renderer).
|
|
46
45
|
*/
|
|
47
46
|
export declare class AdwBreakpoint {
|
|
48
47
|
/** The parsed condition (null when an invalid string was passed). */
|
|
@@ -53,9 +52,9 @@ export declare class AdwBreakpoint {
|
|
|
53
52
|
/** Whether the condition is currently satisfied (apply has fired, not unapply). */
|
|
54
53
|
get applied(): boolean;
|
|
55
54
|
/**
|
|
56
|
-
* Re-evaluate against `size`, firing apply / unapply ONLY on a state change
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* Re-evaluate against `size`, firing apply / unapply ONLY on a state change, so a steady
|
|
56
|
+
* stream of layout passes does not re-run the callbacks. Returns the post-evaluation
|
|
57
|
+
* applied state; a null condition never applies.
|
|
59
58
|
*/
|
|
60
59
|
evaluate(size: BreakpointSize): boolean;
|
|
61
60
|
}
|