@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.
Files changed (61) hide show
  1. package/lib/esm/conformance/index.js +1 -1
  2. package/lib/esm/conformance/shortcut-label.js +1 -0
  3. package/lib/esm/index.js +1 -1
  4. package/lib/esm/shortcut-label.js +1 -0
  5. package/lib/types/about-dialog.d.ts +92 -98
  6. package/lib/types/action-row.d.ts +95 -125
  7. package/lib/types/avatar.d.ts +30 -37
  8. package/lib/types/banner.d.ts +25 -53
  9. package/lib/types/breakpoint.d.ts +6 -7
  10. package/lib/types/button-content.d.ts +41 -80
  11. package/lib/types/carousel.d.ts +175 -252
  12. package/lib/types/checks.d.ts +13 -30
  13. package/lib/types/chrome.d.ts +90 -136
  14. package/lib/types/color-scheme.d.ts +5 -6
  15. package/lib/types/conformance/about-dialog.d.ts +64 -91
  16. package/lib/types/conformance/action-row.d.ts +26 -46
  17. package/lib/types/conformance/avatar.d.ts +8 -10
  18. package/lib/types/conformance/banner.d.ts +17 -37
  19. package/lib/types/conformance/button-content.d.ts +24 -46
  20. package/lib/types/conformance/carousel.d.ts +35 -75
  21. package/lib/types/conformance/checks.d.ts +0 -4
  22. package/lib/types/conformance/chrome.d.ts +28 -36
  23. package/lib/types/conformance/data-grid.d.ts +28 -47
  24. package/lib/types/conformance/dialog.d.ts +4 -9
  25. package/lib/types/conformance/entry-row.d.ts +20 -39
  26. package/lib/types/conformance/index.d.ts +2 -0
  27. package/lib/types/conformance/navigation-view.d.ts +0 -4
  28. package/lib/types/conformance/popover.d.ts +4 -9
  29. package/lib/types/conformance/preferences.d.ts +15 -28
  30. package/lib/types/conformance/rows.d.ts +5 -12
  31. package/lib/types/conformance/shortcut-label.d.ts +34 -0
  32. package/lib/types/conformance/sidebar.d.ts +28 -49
  33. package/lib/types/conformance/spinner.d.ts +21 -27
  34. package/lib/types/conformance/split-button.d.ts +21 -43
  35. package/lib/types/conformance/split-view.d.ts +29 -36
  36. package/lib/types/conformance/tab-view.d.ts +32 -73
  37. package/lib/types/conformance/view-stack.d.ts +0 -12
  38. package/lib/types/conformance/view-switcher.d.ts +46 -114
  39. package/lib/types/conformance/wrap-box.d.ts +40 -63
  40. package/lib/types/data-grid.d.ts +38 -48
  41. package/lib/types/dialog.d.ts +39 -51
  42. package/lib/types/easing.d.ts +6 -12
  43. package/lib/types/entry-row.d.ts +94 -123
  44. package/lib/types/glib.d.ts +17 -25
  45. package/lib/types/index.d.ts +2 -0
  46. package/lib/types/length-unit.d.ts +7 -12
  47. package/lib/types/navigation-view.d.ts +62 -68
  48. package/lib/types/popover.d.ts +39 -66
  49. package/lib/types/preferences.d.ts +83 -100
  50. package/lib/types/rows.d.ts +45 -63
  51. package/lib/types/shortcut-label.d.ts +79 -0
  52. package/lib/types/shortcut-label.spec.d.ts +2 -0
  53. package/lib/types/sidebar.d.ts +95 -121
  54. package/lib/types/spinner.d.ts +39 -61
  55. package/lib/types/split-button.d.ts +78 -134
  56. package/lib/types/split-view.d.ts +74 -89
  57. package/lib/types/tab-view.d.ts +174 -256
  58. package/lib/types/view-stack.d.ts +87 -129
  59. package/lib/types/view-switcher.d.ts +126 -211
  60. package/lib/types/wrap-box.d.ts +62 -123
  61. package/package.json +3 -3
@@ -2,23 +2,19 @@
2
2
  * Input shape for a tab page.
3
3
  *
4
4
  * Every optional field takes `null` as "absent" because that is what
5
- * `getAttribute` returns. `title` and `tooltip` coerce `null` to `''` exactly as
6
- * `adw_tab_page_set_title`/`set_tooltip` do (`g_set_str (&self->title, title ?
7
- * title : "")`, adw-tab-view.c:3021, :3064); `icon` and `indicatorIcon` stay
8
- * `null`, because "no icon" is a state `tabIconState` branches on.
5
+ * `getAttribute` returns. `title`/`tooltip` coerce `null` to `''` as
6
+ * `adw_tab_page_set_title`/`set_tooltip` do; `icon`/`indicatorIcon` stay `null`,
7
+ * because "no icon" is a state {@link tabIconState} branches on.
9
8
  *
10
- * There is deliberately no `pinned` and no `parentId` here: a page's pinned
11
- * state may only change through {@link TabViewState.setPagePinned}, which has to
12
- * re-order at the same time (adw-tab-view.c:4059-4078), and the parent is an
13
- * argument of {@link TabViewState.addPage}, mirroring
14
- * `adw_tab_view_add_page (self, child, parent)`.
9
+ * No `pinned` and no `parentId`: pinned state may only change through
10
+ * {@link TabViewState.setPagePinned}, which has to re-order at the same time, and
11
+ * the parent is an argument of {@link TabViewState.addPage}.
15
12
  */
16
13
  export interface AdwTabPageSpec<T = unknown> {
17
14
  /**
18
- * Stable identity of the page. libadwaita keys everything by the `AdwTabPage`
19
- * POINTER — never by title — so a string id is the platform-neutral stand-in,
20
- * and two pages sharing an id would be two pages sharing a pointer. Ids are
21
- * therefore unique per view; a duplicate is refused, not silently accepted.
15
+ * Stable identity. libadwaita keys everything by the `AdwTabPage` POINTER, never
16
+ * by title, so a string id is the platform-neutral stand-in: unique per view, and
17
+ * a duplicate is refused rather than silently accepted.
22
18
  */
23
19
  id: string;
24
20
  /** Tab label. `null`/absent is `''`, never `undefined`. */
@@ -37,14 +33,11 @@ export interface AdwTabPageSpec<T = unknown> {
37
33
  content?: T;
38
34
  }
39
35
  /**
40
- * A resolved page, as a renderer reads it.
41
- *
42
- * Fully readonly: the C setters all notify, so a renderer that mutates a record
43
- * in place would repaint nothing. Every field has a
44
- * `TabViewState.setPage<Field>` counterpart which emits an `'updated'` change.
36
+ * A resolved page, as a renderer reads it. Fully readonly: the C setters all
37
+ * notify, so a renderer that mutated a record in place would repaint nothing —
38
+ * every field has a `TabViewState.setPage<Field>` emitting an `'updated'` change.
45
39
  */
46
40
  export interface AdwTabPageState<T = unknown> {
47
- /** Stable identity — the stand-in for the `AdwTabPage` pointer. */
48
41
  readonly id: string;
49
42
  /** Tab label, already coerced from `null` to `''`. */
50
43
  readonly title: string;
@@ -52,11 +45,9 @@ export interface AdwTabPageState<T = unknown> {
52
45
  readonly tooltip: string;
53
46
  /** GTK icon name, or `null` when the page has none. */
54
47
  readonly icon: string | null;
55
- /** Indicator icon name, or `null`. */
56
48
  readonly indicatorIcon: string | null;
57
49
  /** Whether a spinner replaces the icon. */
58
50
  readonly loading: boolean;
59
- /** Whether the attention indicator is drawn. */
60
51
  readonly needsAttention: boolean;
61
52
  /** Whether the page sits in the pinned prefix — see {@link TabViewState.setPagePinned}. */
62
53
  readonly pinned: boolean;
@@ -71,12 +62,10 @@ export interface AdwTabPageState<T = unknown> {
71
62
  * The `close-page` seam — the one place the widget asks the application a
72
63
  * question, in the same shape as `AdwToastQueueHandlers`.
73
64
  *
74
- * Return `true` to confirm the close, `false` to deny it, or `'defer'` to hold
75
- * the page in the closing state until {@link TabViewState.closePageFinish} is
76
- * called — which is how an app shows a "save before closing?" dialog. With no
77
- * handler installed the default is `!page.pinned`, i.e. `close_page_cb`'s
78
- * `adw_tab_view_close_page_finish (self, page, !adw_tab_page_get_pinned (page))`
79
- * (adw-tab-view.c:1987-1993).
65
+ * Return `true` to confirm the close, `false` to deny it, or `'defer'` to hold the
66
+ * page in the closing state until {@link TabViewState.closePageFinish} — which is
67
+ * how an app shows a "save before closing?" dialog. With no handler installed the
68
+ * default is `!page.pinned`, as `close_page_cb` does.
80
69
  */
81
70
  export interface TabViewHandlers<T = unknown> {
82
71
  /** Decide the fate of a close request. */
@@ -92,18 +81,16 @@ export interface TabViewHandlers<T = unknown> {
92
81
  export interface TabViewSelectionChange {
93
82
  /** Id of the newly-selected page, `null` when the view is empty. */
94
83
  selectedId: string | null;
95
- /** Its index, `-1` when the view is empty (`detach_page`, adw-tab-view.c:1912-1913). */
84
+ /** Its index, `-1` when the view is empty. */
96
85
  selectedIndex: number;
97
86
  /** Id of the page that was selected before, `null` when there was none. */
98
87
  previousId: string | null;
99
88
  /**
100
- * `true` for an explicit selection (a tab click, a keyboard shortcut, a
101
- * {@link TabViewState.setSelectedPage} call); `false` for one the model made
102
- * on its own — the auto-select of the first page and the close successor.
103
- *
104
- * libadwaita notifies identically on both (`set_selected_page`,
105
- * adw-tab-view.c:1854); the flag exists so a bound tab bar can tell a user
106
- * pick from a model-driven one, exactly as `ViewStackState` tags its own.
89
+ * `true` for an explicit selection (tab click, keyboard shortcut,
90
+ * {@link TabViewState.setSelectedPage}); `false` for one the model made on its
91
+ * own — the first-page auto-select and the close successor. libadwaita notifies
92
+ * identically on both; the flag exists so a bound tab bar can tell a user pick
93
+ * from a model-driven one.
107
94
  */
108
95
  interactive: boolean;
109
96
  }
@@ -111,23 +98,18 @@ export interface TabViewSelectionChange {
111
98
  export type TabViewSelectionListener = (change: TabViewSelectionChange) => void;
112
99
  /**
113
100
  * What happened to the page LIST — the `page-attached` / `page-detached` /
114
- * `page-reordered` signals (adw-tab-view.c:1778, :1932, :4561) plus the two the
115
- * C expresses as per-page `notify::` instead of a view signal.
116
- *
117
- * `'pinned'` is `adw_tab_view_set_page_pinned`'s combined flip-and-re-order
118
- * (:4059-4078); `'updated'` stands in for `notify::title` / `::tooltip` /
119
- * `::icon` / `::loading` / `::indicator-icon` / `::needs-attention`, which
120
- * `AdwTab` connects to in order to re-render one tab live (adw-tab.c:930-931).
101
+ * `page-reordered` signals plus the two C expresses as per-page `notify::` instead
102
+ * of a view signal: `'pinned'` is `adw_tab_view_set_page_pinned`'s combined
103
+ * flip-and-re-order, `'updated'` stands in for `notify::title` / `::tooltip` /
104
+ * `::icon` / `::loading` / `::indicator-icon` / `::needs-attention`, which `AdwTab`
105
+ * connects to in order to re-render one tab live.
121
106
  */
122
107
  export type TabViewPagesChangeKind = 'attached' | 'detached' | 'reordered' | 'pinned' | 'updated';
123
108
  /**
124
- * One page-list change. A renderer subscribes to this to insert, remove or move
125
- * exactly ONE tab instead of rebuilding the bar — which is what both ports did
126
- * (web built the bar once at connect and never again; NS tore down and rebuilt
127
- * every button on every close).
109
+ * One page-list change: a renderer subscribes to this to insert, remove or move
110
+ * exactly ONE tab instead of rebuilding the bar.
128
111
  */
129
112
  export interface TabViewPagesChange {
130
- /** Which kind of change this is. */
131
113
  kind: TabViewPagesChangeKind;
132
114
  /** The page it happened to. */
133
115
  id: string;
@@ -150,31 +132,24 @@ export interface TabIconState {
150
132
  indicatorVisible: boolean;
151
133
  }
152
134
  /**
153
- * `Adw.TabBar:autohide` defaults to TRUE (adw-tab-bar.c:606-607, and
154
- * `self->autohide = TRUE` in init, :781).
135
+ * `Adw.TabBar:autohide` defaults to TRUE.
155
136
  *
156
- * Named so a renderer whose spelling cannot express it — an HTML boolean
157
- * attribute is absent-means-false, so `<adw-tab-view autohide>` inverts the
158
- * platform default — is making a DELIBERATE, citable decision rather than a
159
- * silent one.
137
+ * Named because an HTML boolean attribute is absent-means-false, so
138
+ * `<adw-tab-view autohide>` inverts the platform default: a renderer that cannot
139
+ * spell the default is then making a deliberate decision rather than a silent one.
160
140
  */
161
141
  export declare const DEFAULT_TAB_AUTOHIDE = true;
162
142
  /**
163
143
  * Whether `Adw.TabBar` shows its tabs: `!autohide || nPages > 1 ||
164
- * nPinnedPages >= 1 || isTransferringPage` (`update_autohide_cb`,
165
- * adw-tab-bar.c:142-164).
144
+ * nPinnedPages >= 1 || isTransferringPage` (`update_autohide_cb`).
166
145
  *
167
- * The `nPinnedPages >= 1` clause is the one that surprises — a single PINNED tab
168
- * keeps the bar up — and it is missing from the web port, which only ever
169
- * compared the page count. The `isTransferringPage` clause keeps the bar up
170
- * while a drag is in flight so there is somewhere to drop.
146
+ * The surprising clause is `nPinnedPages >= 1` — a single PINNED tab keeps the bar
147
+ * up; `isTransferringPage` keeps it up while a drag is in flight so there is
148
+ * somewhere to drop.
171
149
  */
172
150
  export declare function tabsRevealed(state: {
173
- /** `AdwTabBar:autohide`. */
174
151
  autohide: boolean;
175
- /** `adw_tab_view_get_n_pages`. */
176
152
  nPages: number;
177
- /** `adw_tab_view_get_n_pinned_pages`. */
178
153
  nPinnedPages: number;
179
154
  /** `adw_tab_view_get_is_transferring_page` — a drag-n-drop tab transfer is running. */
180
155
  isTransferringPage: boolean;
@@ -183,109 +158,81 @@ export declare function tabsRevealed(state: {
183
158
  * Whether a tab shows its close button: `!pinned && ((hovering && fullyVisible)
184
159
  * || selected || dragging)`.
185
160
  *
186
- * The three-term half is `update_state` (adw-tab.c:124); the `!pinned` gate is
187
- * applied once at construction, where a pinned tab hides both its title and its
188
- * close button outright (adw-tab.c:645-650). Each port shipped a different
189
- * SINGLE term of this: web showed the button unconditionally, NS only on the
190
- * selected tab. The `fullyVisible` conjunct is why a hovered tab that is half
191
- * scrolled out of the bar shows nothing.
161
+ * The three-term half is `update_state`; the `!pinned` gate is applied once at
162
+ * construction, where a pinned tab hides both its title and its close button
163
+ * outright. The `fullyVisible` conjunct is why a hovered tab that is half scrolled
164
+ * out of the bar shows nothing.
192
165
  */
193
166
  export declare function tabCloseVisible(state: {
194
- /** Pointer is over the tab. */
195
167
  hovering: boolean;
196
168
  /** The tab is not clipped by the bar's scroll region. */
197
169
  fullyVisible: boolean;
198
- /** The tab is the selected one. */
199
170
  selected: boolean;
200
- /** The tab is being dragged. */
201
171
  dragging: boolean;
202
- /** The tab is pinned. */
203
172
  pinned: boolean;
204
173
  }): boolean;
205
174
  /**
206
175
  * The tooltip a tab shows: its own `tooltip` when non-empty, otherwise the page
207
- * title (`update_tooltip`, adw-tab.c:137-146; identical in
208
- * adw-tab-thumbnail.c). Neither port had tooltips at all.
176
+ * title (`update_tooltip`; identical in adw-tab-thumbnail.c).
209
177
  */
210
178
  export declare function tabTooltip(page: Pick<AdwTabPageState, 'tooltip' | 'title'>): string;
211
179
  /**
212
- * Whether {@link tabTooltip}'s result is Pango MARKUP rather than plain text.
213
- *
214
- * C branches on exactly this: a non-empty `tooltip` goes through
215
- * `gtk_widget_set_tooltip_markup`, the title fallback through
216
- * `gtk_widget_set_tooltip_text` (adw-tab.c:141-146). The distinction is not
217
- * cosmetic — a renderer that pushed a marked-up tooltip through an HTML sink
218
- * would be executing page-supplied markup, and one that escaped the title would
219
- * show the escapes.
180
+ * Whether {@link tabTooltip}'s result is Pango MARKUP rather than plain text: C
181
+ * sends a non-empty `tooltip` through `gtk_widget_set_tooltip_markup` and the title
182
+ * fallback through `gtk_widget_set_tooltip_text`. Not cosmetic — a renderer that
183
+ * pushed marked-up text into an HTML sink would execute page-supplied markup, and
184
+ * one that escaped the title would show the escapes.
220
185
  */
221
186
  export declare function tabTooltipIsMarkup(page: Pick<AdwTabPageState, 'tooltip'>): boolean;
222
187
  /**
223
- * What a tab paints in its icon + indicator slots (`update_icons`,
224
- * adw-tab.c:171-198).
188
+ * What a tab paints in its icon + indicator slots (`update_icons`).
225
189
  *
226
- * Three rules, in the order C applies them: `loading` wins and installs a
227
- * spinner WITHOUT replacing the icon name (so the icon reappears when loading
228
- * ends); a PINNED page with no icon of its own falls back to the view's
229
- * `default-icon`; and the icon slot is shown iff there is something to show AND
230
- * the page is either not pinned or has no indicator — on a pinned tab the
231
- * indicator REPLACES the icon, because a pinned tab is a single-glyph chip.
232
- *
233
- * Neither port models loading, indicators or a default icon; this is the
234
- * derivation they need before they can.
190
+ * Three rules, in the order C applies them: `loading` wins and installs a spinner
191
+ * WITHOUT replacing the icon name (so the icon reappears when loading ends); a
192
+ * PINNED page with no icon of its own falls back to the view's `default-icon`; and
193
+ * the icon slot is shown iff there is something to show AND the page is either not
194
+ * pinned or has no indicator — on a pinned tab the indicator REPLACES the icon,
195
+ * because a pinned tab is a single-glyph chip.
235
196
  */
236
197
  export declare function tabIconState<T>(page: Pick<AdwTabPageState<T>, 'icon' | 'indicatorIcon' | 'loading' | 'pinned'>, defaultIcon: string | null): TabIconState;
237
198
  /**
238
199
  * Whether `pageId` is `parentId` or a (possibly indirect) descendant of it —
239
- * `is_descendant_of` (adw-tab-view.c:1735-1742).
200
+ * `is_descendant_of`.
240
201
  *
241
- * The loop is `while (page && page != parent) page = parent_of (page);` and it
242
- * therefore returns TRUE for `page == parent` WITHOUT taking a step. That
243
- * non-obvious identity case is what makes "close a tab you opened from another
244
- * tab" land back on the opener: when the previous page IS the parent, the
245
- * descendant branch fires and selects it instead of falling through to the next
246
- * page.
202
+ * Returns TRUE for `page === parent` WITHOUT taking a step, and that identity case
203
+ * is what makes "close a tab you opened from another tab" land back on the opener:
204
+ * when the previous page IS the parent, the descendant branch fires instead of
205
+ * falling through to the next page.
247
206
  */
248
207
  export declare function isDescendantOfPage<T>(pages: readonly AdwTabPageState<T>[], pageId: string | null, parentId: string): boolean;
249
208
  /**
250
209
  * Which page ends up selected once `closingId` is removed — the pure kernel of
251
- * `select_previous_page` (adw-tab-view.c:1857-1897), extracted so the rule is
252
- * testable without a live view.
253
- *
254
- * Ranked, and the ranking is the point:
255
- * 1. the closing page is not the selected one → nothing moves (the C returns at
256
- * :1864-1865, so `set_selected_page` is never called and NOTHING notifies);
257
- * 2. it has a parent and is not first, and the PREVIOUS page is a descendant of
258
- * that parent → the previous page (:1869-1878) — a page is its own
259
- * descendant, so "the previous page IS the opener" hits this branch;
260
- * 3. same, but the previous page and the parent are BOTH pinned → the parent
261
- * (:1885-1890), because a page opened from a pinned parent is placed after
262
- * the LAST pinned page rather than directly after its parent;
263
- * 4. otherwise the next page, else the previous page (:1893-1896);
264
- * 5. neither exists → `null`, i.e. the view empties.
265
- *
266
- * Returns `selectedId` unchanged in case 1, so the caller can compare and skip
267
- * the notification. Takes no `nPinnedPages`: the two pinned tests read
268
- * `page.pinned` off the records, and a parameter nothing reads is worse than a
269
- * signature that does not have it.
210
+ * `select_previous_page`, ranked:
211
+ * 1. the closing page is not the selected one → nothing moves and NOTHING
212
+ * notifies; `selectedId` comes back unchanged so the caller can skip it;
213
+ * 2. it has a parent and is not first, and the PREVIOUS page is a descendant of
214
+ * that parent → the previous page (a page is its own descendant, so "the
215
+ * previous page IS the opener" hits this branch);
216
+ * 3. same, but the previous page and the parent are BOTH pinned → the parent,
217
+ * because a page opened from a pinned parent is placed after the LAST pinned
218
+ * page rather than directly after its parent;
219
+ * 4. otherwise the next page, else the previous page;
220
+ * 5. neither exists → `null`, i.e. the view empties.
270
221
  */
271
222
  export declare function successorAfterClose<T>(pages: readonly AdwTabPageState<T>[], closingId: string, selectedId: string | null): string | null;
272
223
  /**
273
224
  * The `Adw.TabView` model: an ordered page list with a pinned prefix, a selected
274
- * page, and the close protocol — with the C guard, ordering and successor rules
275
- * applied once for every renderer.
276
- *
277
- * `T` is the renderer's page-content type; the machine never looks inside it.
278
- * Nothing here renders, reads a global or holds a timer, so an instance is a
279
- * plain value a test can drive step by step.
225
+ * page and the close protocol, with the C guard, ordering and successor rules
226
+ * applied once for every renderer. `T` is the renderer's page-content type; the
227
+ * machine never looks inside it, renders nothing, reads no global and holds no
228
+ * timer, so an instance is a plain value a test can drive step by step.
280
229
  */
281
230
  export declare class TabViewState<T = unknown> {
282
231
  /**
283
- * The ordered list + the selection, composed rather than restated —
284
- * `ViewStackState` already owns the index guards, the
232
+ * The ordered list + selection: `ViewStackState` owns the index guards, the
285
233
  * selection-follows-the-page bookkeeping and the fan-out. Its `name` is this
286
- * view's page id and its `content` is the tab record; its `title`/`icon` are
287
- * never read here, because a tab's title is mutable and a second copy of it
288
- * would be a second truth.
234
+ * view's page id and its `content` the tab record; its `title`/`icon` are never
235
+ * read here, because a tab's title is mutable and a second copy would drift.
289
236
  */
290
237
  private readonly _stack;
291
238
  private readonly _handlers;
@@ -296,11 +243,9 @@ export declare class TabViewState<T = unknown> {
296
243
  /** Set while an insert runs — see {@link _deferredSelection}. */
297
244
  private _deferSelection;
298
245
  /**
299
- * A selection change parked until the `'attached'` change has gone out.
300
- *
301
- * This is C's `g_object_freeze_notify` / `thaw_notify` around `insert_page`
302
- * (adw-tab-view.c:1947-1961), not a scheduling trick: `attach_page` emits
303
- * `page-attached` as a SIGNAL (immediate) and the auto-select's
246
+ * A selection change parked until the `'attached'` change has gone out — C's
247
+ * `g_object_freeze_notify`/`thaw_notify` around `insert_page`, not a scheduling
248
+ * trick: `page-attached` is an immediate signal and the auto-select's
304
249
  * `notify::selected-page` only lands at thaw, so a renderer is guaranteed to
305
250
  * have built the tab before it is told to mark it selected.
306
251
  */
@@ -311,11 +256,9 @@ export declare class TabViewState<T = unknown> {
311
256
  /** Subscribe to selection changes. Returns an unsubscribe function. */
312
257
  subscribe(listener: TabViewSelectionListener): () => void;
313
258
  /**
314
- * Subscribe to page-list changes. Returns an unsubscribe function.
315
- *
316
- * Kept separate from {@link subscribe} because libadwaita keeps them separate
317
- * too — `props[PROP_SELECTED_PAGE]` versus the `AdwTabPages` list model — and
318
- * a renderer needs them at different granularities.
259
+ * Subscribe to page-list changes. Returns an unsubscribe function. Separate from
260
+ * {@link subscribe} because libadwaita separates them too —
261
+ * `props[PROP_SELECTED_PAGE]` versus the `AdwTabPages` list model.
319
262
  */
320
263
  subscribePages(listener: TabViewPagesListener): () => void;
321
264
  private _emitSelection;
@@ -323,47 +266,42 @@ export declare class TabViewState<T = unknown> {
323
266
  private _flushDeferredSelection;
324
267
  /**
325
268
  * Every page in order — a frozen projection, so a renderer cannot reorder the
326
- * model by writing to the array it was handed.
327
- *
328
- * Cached against the inner list's identity rather than an invalidation flag:
329
- * `ViewStackState` drops its own cached projection on exactly the structural
330
- * changes that matter, so there is no second bookkeeping to forget to update.
269
+ * model by writing to the array it was handed. Cached against the inner list's
270
+ * identity rather than an invalidation flag, so there is no second bookkeeping to
271
+ * forget to update.
331
272
  */
332
273
  get pages(): readonly AdwTabPageState<T>[];
333
- /** Number of pages — `adw_tab_view_get_n_pages` (adw-tab-view.c:3610). */
274
+ /** Number of pages — `adw_tab_view_get_n_pages`. */
334
275
  get nPages(): number;
335
276
  /**
336
- * Number of pinned pages — `adw_tab_view_get_n_pinned_pages`
337
- * (adw-tab-view.c:3628).
277
+ * Number of pinned pages — `adw_tab_view_get_n_pinned_pages`.
338
278
  *
339
- * DERIVED from the prefix invariant instead of bookkept as C's
340
- * `set_n_pinned_pages` counter is (:1696-1706). The invariant "the pinned
341
- * pages are exactly `[0, nPinnedPages)`" is what every insert, reorder and
342
- * first/last hop depends on; deriving the count makes it machine-true rather
343
- * than something four mutators must each remember to keep true.
279
+ * DERIVED from the prefix invariant rather than bookkept as C's
280
+ * `set_n_pinned_pages` counter is. "The pinned pages are exactly
281
+ * `[0, nPinnedPages)`" is what every insert, reorder and first/last hop depends
282
+ * on; deriving the count makes it machine-true instead of something four mutators
283
+ * must each remember to keep true.
344
284
  */
345
285
  get nPinnedPages(): number;
346
286
  /**
347
287
  * The page at `position`, or `null`.
348
288
  *
349
- * Refuses a non-integer, negative or out-of-range position instead of
350
- * clamping: `adw_tab_view_get_nth_page` takes an `int` and asserts
351
- * `position >= 0` / `position < n_pages` (adw-tab-view.c:4126-4134), and no
352
- * clamping path exists anywhere in the file. This single guard is what the
353
- * NativeScript port lacked when a fractional index blanked the widget.
289
+ * Refuses a non-integer, negative or out-of-range position instead of clamping:
290
+ * `adw_tab_view_get_nth_page` takes an `int` and asserts `position >= 0` /
291
+ * `position < n_pages`, and no clamping path exists anywhere in the C file.
354
292
  */
355
293
  getNthPage(position: number): AdwTabPageState<T> | null;
356
- /** Index of the page with `id`, `-1` when absent — `adw_tab_view_get_page_position` (:4152). */
294
+ /** Index of the page with `id`, `-1` when absent — `adw_tab_view_get_page_position`. */
357
295
  getPagePosition(id: string): number;
358
296
  /** The page with `id`, or `null`. */
359
297
  getPage(id: string): AdwTabPageState<T> | null;
360
- /** Whether `id` is waiting for a {@link closePageFinish} (`page->closing`, :4396-4399). */
298
+ /** Whether `id` is waiting for a {@link closePageFinish} (`page->closing`). */
361
299
  isClosing(id: string): boolean;
362
300
  /**
363
- * Every diagnostic C would have printed as a `g_return_if_fail` warning, in
364
- * order — an unknown page id, a duplicate id, an insert or reorder outside
365
- * its partition. Kept as data so a test can assert on the class instead of on
366
- * stderr, exactly as `ViewStackState.diagnostics` does.
301
+ * Every diagnostic C would have printed as a `g_return_if_fail` warning, in order
302
+ * — an unknown page id, a duplicate id, an insert or reorder outside its
303
+ * partition. Data rather than stderr so a test can assert on the class, as
304
+ * `ViewStackState.diagnostics` does.
367
305
  */
368
306
  get diagnostics(): readonly string[];
369
307
  /** Id of the selected page, `null` when the view is empty. */
@@ -375,42 +313,36 @@ export declare class TabViewState<T = unknown> {
375
313
  /**
376
314
  * Select a page by id. Returns whether the selection changed.
377
315
  *
378
- * An unknown id is refused, and `null` is accepted only while the view is
379
- * empty — `adw_tab_view_set_selected_page` asserts `ADW_IS_TAB_PAGE` +
380
- * `page_belongs_to_this_view` when `n_pages > 0` and `selected_page == NULL`
381
- * otherwise (adw-tab-view.c:3686-3693).
382
- *
383
- * `interactive` defaults to `true` because this IS the explicit call, the
384
- * same convention `ViewStackState.setVisibleIndex` uses; the model-driven
385
- * paths (the first-page auto-select and the close successor) pass `false`.
316
+ * An unknown id is refused, and `null` is accepted only while the view is empty —
317
+ * `adw_tab_view_set_selected_page` asserts `ADW_IS_TAB_PAGE` +
318
+ * `page_belongs_to_this_view` when `n_pages > 0`, and `selected_page == NULL`
319
+ * otherwise. `interactive` defaults to `true` because this IS the explicit call;
320
+ * the model-driven paths (first-page auto-select, close successor) pass `false`.
386
321
  */
387
322
  setSelectedPage(id: string | null, interactive?: boolean): boolean;
388
323
  /**
389
- * Select the page at `n` — the Alt+1…Alt+9 / Alt+0 path (`select_nth_page_cb`,
390
- * adw-tab-view.c:2136-2163; Alt+0 is `n = 9`, since pages count from 0).
324
+ * Select the page at `n` — the Alt+1…Alt+9 / Alt+0 path (`select_nth_page_cb`;
325
+ * Alt+0 is `n = 9`, since pages count from 0).
391
326
  *
392
- * Pure delegation to the composed selection primitive, which already refuses
393
- * a non-integer, a negative, an out-of-range and the already-selected index
394
- * and emits nothing for any of them (adw-tab-view.c:2145, :2158-2159). That
395
- * is the whole reason this family builds ON `ViewStackState` instead of
396
- * beside it.
327
+ * Pure delegation to the composed selection primitive, which already refuses a
328
+ * non-integer, a negative, an out-of-range and the already-selected index, and
329
+ * emits nothing for any of them.
397
330
  */
398
331
  selectNthPage(n: number): boolean;
399
332
  /**
400
333
  * Select the page before the selected one; `false` when it is already first
401
- * (`adw_tab_view_select_previous_page`, adw-tab-view.c:3708-3730). Does NOT
334
+ * (`adw_tab_view_select_previous_page`). Does NOT
402
335
  * wrap — {@link cyclePreviousPage} is the wrapping variant.
403
336
  */
404
337
  selectPreviousPage(): boolean;
405
338
  /**
406
339
  * Select the page after the selected one; `false` when it is already last
407
- * (`adw_tab_view_select_next_page`, adw-tab-view.c:3741-3763). Does NOT wrap.
340
+ * (`adw_tab_view_select_next_page`). Does NOT wrap.
408
341
  */
409
342
  selectNextPage(): boolean;
410
343
  /**
411
344
  * Select the first page in the selected page's own partition, hopping the
412
- * partition boundary once (`adw_tab_view_select_first_page`,
413
- * adw-tab-view.c:3764-3789).
345
+ * partition boundary once (`adw_tab_view_select_first_page`).
414
346
  *
415
347
  * From a non-pinned page it goes to index `nPinnedPages` — the first
416
348
  * NON-pinned tab — and only when that is already the selected page does it
@@ -420,22 +352,22 @@ export declare class TabViewState<T = unknown> {
420
352
  selectFirstPage(): boolean;
421
353
  /**
422
354
  * Select the last page in the selected page's own partition, hopping the
423
- * boundary once (`adw_tab_view_select_last_page`, adw-tab-view.c:3793-3818):
355
+ * boundary once (`adw_tab_view_select_last_page`):
424
356
  * from the LAST pinned tab it continues to the last non-pinned one.
425
357
  */
426
358
  selectLastPage(): boolean;
427
359
  /**
428
360
  * Ctrl+Tab: the next page, WRAPPING to the first (`select_page_cb`'s forward
429
- * branch, adw-tab-view.c:2030-2041).
361
+ * branch).
430
362
  *
431
363
  * Returns `false` outright on a view of one page or fewer — the shortcut
432
- * PROPAGATES there rather than ringing the error bell (:2008), which is how
364
+ * PROPAGATES there rather than ringing the error bell, which is how
433
365
  * Ctrl+Tab keeps working for whatever contains the tab view.
434
366
  */
435
367
  cycleNextPage(): boolean;
436
368
  /**
437
369
  * Ctrl+Shift+Tab: the previous page, WRAPPING to the last
438
- * (`select_page_cb`'s backward branch, adw-tab-view.c:2017-2028).
370
+ * (`select_page_cb`'s backward branch).
439
371
  *
440
372
  * Ctrl+Home / Ctrl+End take the `last` branch of the same callback and map to
441
373
  * {@link selectFirstPage} / {@link selectLastPage}, which deliberately do NOT
@@ -444,7 +376,7 @@ export declare class TabViewState<T = unknown> {
444
376
  cyclePreviousPage(): boolean;
445
377
  /**
446
378
  * Add a page opened FROM `parentId`, deriving its position instead of taking
447
- * one (`adw_tab_view_add_page`, adw-tab-view.c:4188-4223). Returns the
379
+ * one (`adw_tab_view_add_page`). Returns the
448
380
  * position used, or `-1` when the page was refused.
449
381
  *
450
382
  * Three rules: a `null` parent appends; a PINNED parent inserts after the last
@@ -454,101 +386,90 @@ export declare class TabViewState<T = unknown> {
454
386
  * order they were opened rather than reversing them.
455
387
  *
456
388
  * The new page is never itself pinned — `create_and_insert_page` is called
457
- * with `pinned = FALSE` even for a pinned parent (:4222).
389
+ * with `pinned = FALSE` even for a pinned parent.
458
390
  */
459
391
  addPage(spec: AdwTabPageSpec<T>, parentId?: string | null): number;
460
392
  /**
461
393
  * Insert a NON-pinned page at `position`, which must be in
462
394
  * `[nPinnedPages, nPages]` — inserting before a pinned page is a programmer
463
- * error C refuses outright (`adw_tab_view_insert`, adw-tab-view.c:4246-4247).
395
+ * error C refuses outright (`adw_tab_view_insert`).
464
396
  * Returns the position, or `-1` when refused.
465
397
  */
466
398
  insertPage(spec: AdwTabPageSpec<T>, position: number): number;
467
- /** Insert as the FIRST non-pinned page (`adw_tab_view_prepend`, adw-tab-view.c:4262). */
399
+ /** Insert as the FIRST non-pinned page (`adw_tab_view_prepend`). */
468
400
  prependPage(spec: AdwTabPageSpec<T>): number;
469
- /** Insert as the LAST non-pinned page (`adw_tab_view_append`, adw-tab-view.c:4284). */
401
+ /** Insert as the LAST non-pinned page (`adw_tab_view_append`). */
470
402
  appendPage(spec: AdwTabPageSpec<T>): number;
471
403
  /**
472
404
  * Insert a PINNED page at `position`, which must be in `[0, nPinnedPages]` —
473
405
  * a pinned page after a non-pinned one is refused
474
- * (`adw_tab_view_insert_pinned`, adw-tab-view.c:4312-4313).
406
+ * (`adw_tab_view_insert_pinned`).
475
407
  * Returns the position, or `-1` when refused.
476
408
  */
477
409
  insertPinnedPage(spec: AdwTabPageSpec<T>, position: number): number;
478
- /** Insert as the FIRST pinned page (`adw_tab_view_prepend_pinned`, adw-tab-view.c:4331). */
410
+ /** Insert as the FIRST pinned page (`adw_tab_view_prepend_pinned`). */
479
411
  prependPinnedPage(spec: AdwTabPageSpec<T>): number;
480
- /** Insert as the LAST pinned page (`adw_tab_view_append_pinned`, adw-tab-view.c:4353). */
412
+ /** Insert as the LAST pinned page (`adw_tab_view_append_pinned`). */
481
413
  appendPinnedPage(spec: AdwTabPageSpec<T>): number;
482
414
  private _insert;
483
415
  /**
484
416
  * Pin or unpin a page AND re-order it in the same step, returning its new
485
417
  * position — or `-1` when it is already in that state
486
- * (`adw_tab_view_set_page_pinned`, adw-tab-view.c:4047-4086).
418
+ * (`adw_tab_view_set_page_pinned`).
487
419
  *
488
420
  * Pinning moves the page to index `nPinnedPages`; unpinning moves it to
489
- * `nPinnedPages - 1`. Both are computed from the count BEFORE the flip, and
490
- * both are indices into the list WITHOUT the moved page — which is why
491
- * unpinning the SECOND of two pinned pages returns 1 and moves nothing while
492
- * still changing the pinned count.
493
- *
494
- * This is the single derivation neither port has and the one most likely to
495
- * be got wrong by hand.
421
+ * `nPinnedPages - 1`. Both are computed from the count BEFORE the flip and both
422
+ * are indices into the list WITHOUT the moved page — which is why unpinning the
423
+ * SECOND of two pinned pages returns 1 and moves nothing while still changing the
424
+ * pinned count.
496
425
  */
497
426
  setPagePinned(id: string, pinned: boolean): number;
498
427
  /**
499
428
  * Request that `id` be closed, opening the two-phase protocol: the page is
500
429
  * marked closing, the handler runs, and the close is then confirmed, denied
501
- * or left deferred (`adw_tab_view_close_page`, adw-tab-view.c:4386-4400).
430
+ * or left deferred (`adw_tab_view_close_page`).
502
431
  *
503
- * Returns whether the request was STARTED — `false` means it was ignored
504
- * because the id is unknown or the page is already awaiting a
505
- * {@link closePageFinish}. That re-entrancy guard (`if (page->closing)
506
- * return;`, :4396-4397) is what stops a second click on the close button from
507
- * running a save dialog twice.
432
+ * Returns whether the request was STARTED — `false` means it was ignored because
433
+ * the id is unknown or the page is already awaiting a {@link closePageFinish}.
434
+ * That re-entrancy guard (`if (page->closing) return;`) is what stops a second
435
+ * click on the close button from running a save dialog twice.
508
436
  *
509
437
  * With no handler installed a non-pinned page is closed and a PINNED page is
510
- * denied and stays — `close_page_cb` (:1986-1993).
438
+ * denied and stays — `close_page_cb`.
511
439
  */
512
440
  closePage(id: string): boolean;
513
441
  /**
514
442
  * Complete a {@link closePage}. Returns whether the page was detached.
515
443
  *
516
- * `confirm: false` clears the closing flag and leaves the page exactly where
517
- * it was, so `closePage` can be called for it again; `confirm: true` detaches
518
- * it (`adw_tab_view_close_page_finish`, adw-tab-view.c:4419-4437). Calling it
519
- * for a page that is not closing is refused, as C's
520
- * `g_return_if_fail (page->closing)` is (:4426).
521
- *
522
- * Neither renderer had this seam, which is why an app could not show a
523
- * "save before closing?" dialog on either.
444
+ * `confirm: false` clears the closing flag and leaves the page exactly where it
445
+ * was, so `closePage` can be called for it again; `confirm: true` detaches it
446
+ * (`adw_tab_view_close_page_finish`). Calling it for a page that is not closing is
447
+ * refused, as C's `g_return_if_fail (page->closing)` is.
524
448
  */
525
449
  closePageFinish(id: string, confirm: boolean): boolean;
526
450
  /**
527
451
  * Remove a page unconditionally, running the successor rule FIRST. Returns
528
452
  * the removed page, or `null` when the id is unknown.
529
453
  *
530
- * The order is load-bearing: `detach_page` calls `select_previous_page` at
531
- * adw-tab-view.c:1906 and only removes at :1915, so the successor is chosen
532
- * while the closing page is still in the list. Choosing it afterwards gives
533
- * different answers for every parent-aware case, because "the previous page"
534
- * is no longer the same page.
454
+ * The order is load-bearing: `detach_page` runs `select_previous_page` before it
455
+ * removes, so the successor is chosen while the closing page is still in the list.
456
+ * Choosing it afterwards gives different answers for every parent-aware case,
457
+ * because "the previous page" is no longer the same page.
535
458
  *
536
- * Closing the LAST page empties the view: the selection becomes `null` at
537
- * index `-1` and that DOES notify (:1912-1913) — both ports reported index 0
538
- * for a page-less view.
459
+ * Closing the LAST page empties the view: the selection becomes `null` at index
460
+ * `-1`, and that DOES notify.
539
461
  *
540
- * DEVIATIONS, both deliberate: the empty-view notification is emitted AFTER
541
- * the removal rather than before it, so a listener reading `pages` and
542
- * `selectedIndex` during the callback sees one consistent state; and pages
543
- * parented to the removed one are re-pointed at its own parent, which C gets
544
- * for free from `page_parent_notify_cb` (:293-303) when the detached page is
545
- * finalized — without it a dangling parent id would quietly disable the
546
- * successor rule for every child.
462
+ * DEVIATIONS from C, both deliberate: the empty-view notification is emitted AFTER
463
+ * the removal, so a listener reading `pages` and `selectedIndex` during the
464
+ * callback sees one consistent state; and pages parented to the removed one are
465
+ * re-pointed at its own parent, which C gets for free from
466
+ * `page_parent_notify_cb` when the detached page is finalized — without it a
467
+ * dangling parent id would quietly disable the successor rule for every child.
547
468
  */
548
469
  detachPage(id: string): AdwTabPageState<T> | null;
549
470
  /**
550
471
  * Request a close for every page except `id`
551
- * (`adw_tab_view_close_other_pages`, adw-tab-view.c:4444-4463).
472
+ * (`adw_tab_view_close_other_pages`).
552
473
  *
553
474
  * The walk is DESCENDING, and that is part of the spec rather than an
554
475
  * implementation detail: each confirmed close shifts every later index, so an
@@ -556,57 +477,54 @@ export declare class TabViewState<T = unknown> {
556
477
  * handler that adds a page mid-batch cannot make the batch visit it.
557
478
  */
558
479
  closeOtherPages(id: string): void;
559
- /** Request a close for every page before `id`, descending (adw-tab-view.c:4485). */
480
+ /** Request a close for every page before `id`, descending. */
560
481
  closePagesBefore(id: string): void;
561
- /** Request a close for every page after `id`, descending (adw-tab-view.c:4511). */
482
+ /** Request a close for every page after `id`, descending. */
562
483
  closePagesAfter(id: string): void;
563
484
  /**
564
485
  * Move a page to `position` WITHIN ITS OWN PARTITION. Returns whether it
565
- * moved (`adw_tab_view_reorder_page`, adw-tab-view.c:4526-4569).
486
+ * moved (`adw_tab_view_reorder_page`).
566
487
  *
567
488
  * A pinned page may only land in `[0, nPinnedPages)` and a non-pinned one in
568
- * `[nPinnedPages, nPages)`; anything else is the programmer error C refuses
569
- * (:4542-4548). An unchanged position returns `false` without emitting
570
- * (:4552-4553) — which is what makes `reorderFirst` on the first non-pinned
571
- * tab a no-op rather than a drag into pinned territory.
489
+ * `[nPinnedPages, nPages)`; anything else is the programmer error C refuses. An
490
+ * unchanged position returns `false` without emitting — which is what makes
491
+ * `reorderFirst` on the first non-pinned tab a no-op rather than a drag into
492
+ * pinned territory.
572
493
  */
573
494
  reorderPage(id: string, position: number): boolean;
574
495
  /**
575
496
  * Move a page one slot earlier, stopping at its partition's first index
576
- * (`adw_tab_view_reorder_backward`, adw-tab-view.c:4586-4604) — so the first
497
+ * (`adw_tab_view_reorder_backward`) — so the first
577
498
  * NON-pinned tab cannot be dragged into pinned territory.
578
499
  */
579
500
  reorderBackward(id: string): boolean;
580
501
  /**
581
502
  * Move a page one slot later, stopping at its partition's last index
582
- * (`adw_tab_view_reorder_forward`, adw-tab-view.c:4617-4635).
503
+ * (`adw_tab_view_reorder_forward`).
583
504
  */
584
505
  reorderForward(id: string): boolean;
585
- /** Move a page to the first slot of its partition (adw-tab-view.c:4646-4661). */
506
+ /** Move a page to the first slot of its partition. */
586
507
  reorderFirst(id: string): boolean;
587
- /** Move a page to the last slot of its partition (adw-tab-view.c:4672-4687). */
508
+ /** Move a page to the last slot of its partition. */
588
509
  reorderLast(id: string): boolean;
589
510
  private _reorderMissing;
590
511
  /**
591
512
  * Set a page's title; `null` becomes `''`, matching
592
- * `g_set_str (&self->title, title ? title : "")` (adw-tab-view.c:3021).
593
- * Returns whether it changed.
513
+ * `g_set_str (&self->title, title ? title: "")`. Returns whether it changed.
594
514
  *
595
- * The whole reason this exists: `AdwTab` connects to `notify::title` and
596
- * re-renders the label live (adw-tab.c:930-931), while both ports snapshotted
597
- * the title once — the web one even declaring `observedAttributes = ['title']`
598
- * with no `attributeChangedCallback` behind it.
515
+ * Needed because `AdwTab` connects to `notify::title` and re-renders the label
516
+ * live: a renderer that snapshots the title once is wrong.
599
517
  */
600
518
  setPageTitle(id: string, title: string | null): boolean;
601
- /** Set a page's tooltip; `null` becomes `''` (adw-tab-view.c:3064). */
519
+ /** Set a page's tooltip; `null` becomes `''`. */
602
520
  setPageTooltip(id: string, tooltip: string | null): boolean;
603
- /** Set a page's icon name, `null` for none (`adw_tab_page_set_icon`, adw-tab-view.c:3101). */
521
+ /** Set a page's icon name, `null` for none (`adw_tab_page_set_icon`). */
604
522
  setPageIcon(id: string, icon: string | null): boolean;
605
- /** Set a page's indicator icon, `null` for none (adw-tab-view.c:3198). */
523
+ /** Set a page's indicator icon, `null` for none. */
606
524
  setPageIndicatorIcon(id: string, icon: string | null): boolean;
607
- /** Set whether the tab draws a spinner (`adw_tab_page_set_loading`, adw-tab-view.c:3143). */
525
+ /** Set whether the tab draws a spinner (`adw_tab_page_set_loading`). */
608
526
  setPageLoading(id: string, loading: boolean): boolean;
609
- /** Set the attention indicator (`adw_tab_page_set_needs_attention`, adw-tab-view.c:3333). */
527
+ /** Set the attention indicator (`adw_tab_page_set_needs_attention`). */
610
528
  setPageNeedsAttention(id: string, needsAttention: boolean): boolean;
611
529
  private _update;
612
530
  /** The mutable records, in order — the same objects {@link pages} exposes readonly. */