@gjsify/adwaita-core 0.36.0 → 0.38.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/accent.js +1 -0
- package/lib/esm/conformance/accent.js +1 -0
- 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/accent.d.ts +36 -0
- package/lib/types/accent.spec.d.ts +2 -0
- 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/accent.d.ts +20 -0
- 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 +4 -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 +4 -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
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { stripMnemonic } from './glib.js';
|
|
2
2
|
import type { AdwViewStackPageInfo } from './view-stack.js';
|
|
3
3
|
/**
|
|
4
|
-
* The "nothing is selected" sentinel, standing in for
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* two index spaces have no counterpart for each other — a hidden page has no
|
|
9
|
-
* toggle at all, which is a state `ToggleGroupState`'s always-non-negative
|
|
10
|
-
* `selected` cannot express.
|
|
4
|
+
* The "nothing is selected" sentinel, standing in for `GTK_INVALID_LIST_POSITION`.
|
|
5
|
+
* Returned by {@link toggleIndexForPage} / {@link pageIndexForToggle} when the two index
|
|
6
|
+
* spaces have no counterpart for each other — a hidden page has no toggle at all, a state
|
|
7
|
+
* `ToggleGroupState`'s always-non-negative `selected` cannot express.
|
|
11
8
|
*/
|
|
12
9
|
export declare const VIEW_SWITCHER_NO_SELECTION = -1;
|
|
13
|
-
/**
|
|
14
|
-
* The icon substituted for a NULL or empty icon name
|
|
15
|
-
* (adw-view-switcher-button.c:347, :399-405; adw-inline-view-switcher.c:131-145).
|
|
16
|
-
*/
|
|
10
|
+
/** The icon substituted for a NULL or empty icon name. */
|
|
17
11
|
export declare const VIEW_SWITCHER_FALLBACK_ICON = "image-missing";
|
|
18
12
|
/**
|
|
19
|
-
* `TIMEOUT_EXPAND` — how long a drag
|
|
20
|
-
*
|
|
21
|
-
* adw-inline-view-switcher.c:80). Defined identically in both C files.
|
|
13
|
+
* `TIMEOUT_EXPAND` — how long a drag must dwell over a non-active button before it
|
|
14
|
+
* switches to it. Defined identically in both C files.
|
|
22
15
|
*/
|
|
23
16
|
export declare const VIEW_SWITCHER_DRAG_SWITCH_DELAY = 500;
|
|
24
17
|
/** The largest badge `AdwIndicatorBin` prints; anything above collapses to `999+`. */
|
|
@@ -26,49 +19,41 @@ export declare const VIEW_SWITCHER_BADGE_LIMIT = 999;
|
|
|
26
19
|
/** `AdwViewSwitcherPolicy` — which button layout the switcher forces. */
|
|
27
20
|
export type AdwViewSwitcherPolicy = 'narrow' | 'wide';
|
|
28
21
|
/**
|
|
29
|
-
* Every policy, in enum order. Doubles as the style-class list: libadwaita adds
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* hard-coding an add/remove pair.
|
|
22
|
+
* Every policy, in enum order. Doubles as the style-class list: libadwaita adds the
|
|
23
|
+
* current policy's class and removes the other, so a renderer toggles each entry against
|
|
24
|
+
* the current value rather than hard-coding an add/remove pair.
|
|
33
25
|
*/
|
|
34
26
|
export declare const VIEW_SWITCHER_POLICIES: readonly AdwViewSwitcherPolicy[];
|
|
35
27
|
/** `AdwInlineViewSwitcherDisplayMode` — what the inline switcher's toggles show. */
|
|
36
28
|
export type AdwInlineViewSwitcherDisplayMode = 'labels' | 'icons' | 'both';
|
|
37
29
|
/**
|
|
38
|
-
* Every display mode, in enum order — and the toggle-group style classes
|
|
39
|
-
*
|
|
40
|
-
* {@link VIEW_SWITCHER_POLICIES}.
|
|
30
|
+
* Every display mode, in enum order — and the toggle-group style classes, same
|
|
31
|
+
* toggle-against-current pattern as {@link VIEW_SWITCHER_POLICIES}.
|
|
41
32
|
*/
|
|
42
33
|
export declare const INLINE_VIEW_SWITCHER_DISPLAY_MODES: readonly AdwInlineViewSwitcherDisplayMode[];
|
|
43
34
|
/**
|
|
44
|
-
* Whether `value` is a policy libadwaita would accept.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* browser port instead coerced anything unrecognised to a default — see
|
|
48
|
-
* {@link isInlineViewSwitcherDisplayMode} for why that is not the same thing.
|
|
35
|
+
* Whether `value` is a policy libadwaita would accept. The C setter is guarded by the
|
|
36
|
+
* enum's own type (`g_value_get_enum`); coercing an unrecognised value to a default is
|
|
37
|
+
* NOT the same thing — see {@link isInlineViewSwitcherDisplayMode}.
|
|
49
38
|
*/
|
|
50
39
|
export declare function isViewSwitcherPolicy(value: unknown): value is AdwViewSwitcherPolicy;
|
|
51
40
|
/**
|
|
52
41
|
* Whether `value` is a display mode libadwaita would accept.
|
|
53
|
-
*
|
|
54
42
|
* `adw_inline_view_switcher_set_display_mode` opens with
|
|
55
|
-
* `g_return_if_fail (mode <= ADW_INLINE_VIEW_SWITCHER_BOTH)
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* the current mode with `'both'` instead, so a typo in one attribute silently
|
|
59
|
-
* changed what every toggle displayed.
|
|
43
|
+
* `g_return_if_fail (mode <= ADW_INLINE_VIEW_SWITCHER_BOTH)`, which REJECTS the call and
|
|
44
|
+
* leaves the current mode alone — substituting a default instead would let a typo in one
|
|
45
|
+
* attribute silently change what every toggle displays.
|
|
60
46
|
*/
|
|
61
47
|
export declare function isInlineViewSwitcherDisplayMode(value: unknown): value is AdwInlineViewSwitcherDisplayMode;
|
|
62
48
|
/**
|
|
63
|
-
* The page record every switcher flavour reads — `AdwViewStackPage`'s properties
|
|
64
|
-
*
|
|
49
|
+
* The page record every switcher flavour reads — `AdwViewStackPage`'s properties with
|
|
50
|
+
* their C defaults.
|
|
65
51
|
*
|
|
66
52
|
* `null` vs `''` is LOAD-BEARING and is why this record exists next to
|
|
67
|
-
* {@link AdwViewStackPageInfo} rather than being replaced by it: the
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* only survives where the switcher owns its own pages.
|
|
53
|
+
* {@link AdwViewStackPageInfo} rather than being replaced by it: the button-visibility
|
|
54
|
+
* rule tests `title != NULL` and an empty title is not NULL, while the stack page model
|
|
55
|
+
* resolves an absent title to the page NAME. So "had no title at all" only survives where
|
|
56
|
+
* the switcher owns its own pages.
|
|
72
57
|
*/
|
|
73
58
|
export interface AdwViewSwitcherPage {
|
|
74
59
|
/** Stable id, matching `AdwViewStackPage`'s name. */
|
|
@@ -92,76 +77,52 @@ export interface AdwViewSwitcherPageInit extends Partial<AdwViewSwitcherPage> {
|
|
|
92
77
|
name: string;
|
|
93
78
|
}
|
|
94
79
|
/**
|
|
95
|
-
* Normalize a partial page into the full record with the C defaults applied, so
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `undefined` collapses to the C default; an explicit `null` title or icon name
|
|
100
|
-
* stays `null`. The badge is normalized to a non-negative integer because
|
|
101
|
-
* `badge-number` is a `guint` (adw-view-stack.c:420-423) and every derivation
|
|
102
|
-
* below assumes it.
|
|
80
|
+
* Normalize a partial page into the full record with the C defaults applied, so a renderer
|
|
81
|
+
* that only knows `{ name, title }` gets the same derivations as one that knows badges.
|
|
82
|
+
* `undefined` collapses to the C default, an explicit `null` title or icon name stays
|
|
83
|
+
* `null`, and the badge becomes a non-negative integer because `badge-number` is a `guint`.
|
|
103
84
|
*/
|
|
104
85
|
export declare function createViewSwitcherPage(init: AdwViewSwitcherPageInit): AdwViewSwitcherPage;
|
|
105
86
|
/**
|
|
106
|
-
* Project a
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* against the page name, so it is never `null` and the button-visibility rule
|
|
111
|
-
* reduces to the `visible` flag.
|
|
112
|
-
*
|
|
113
|
-
* The second one is gone. This used to say the stack page carried none of
|
|
114
|
-
* `badge-number`, `needs-attention` or `use-underline`, "so a bound switcher
|
|
115
|
-
* derives an empty badge and no description" — which made a switcher bound to a
|
|
116
|
-
* stack STRUCTURALLY unable to show a badge, and both `ViewSwitcherBar`s go
|
|
117
|
-
* through here. The stack page carries all three now.
|
|
87
|
+
* Project a stack page descriptor onto a switcher page, for a switcher BOUND to an
|
|
88
|
+
* `Adw.ViewStack` rather than owning its own pages. Fidelity note:
|
|
89
|
+
* `AdwViewStackPageInfo.title` is already resolved against the page name, so it is never
|
|
90
|
+
* `null` and the button-visibility rule reduces to the `visible` flag.
|
|
118
91
|
*/
|
|
119
92
|
export declare function viewSwitcherPageFromStackPage(page: AdwViewStackPageInfo): AdwViewSwitcherPage;
|
|
120
93
|
/** {@link viewSwitcherPageFromStackPage} over a whole page list. */
|
|
121
94
|
export declare function viewSwitcherPagesFromStack(pages: readonly AdwViewStackPageInfo[]): AdwViewSwitcherPage[];
|
|
122
95
|
/**
|
|
123
|
-
* `update_button`'s visibility rule (
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* The empty string is NOT NULL, so `title: ''` still yields a button — the
|
|
127
|
-
* opposite of what both ports did, which was to keep the button and hide only
|
|
128
|
-
* its label. `undefined` is read as absent, i.e. as C's NULL.
|
|
96
|
+
* `update_button`'s visibility rule: `visible && (title != NULL || icon_name != NULL)`.
|
|
97
|
+
* The empty string is NOT NULL, so `title: ''` still yields a button; `undefined` is read
|
|
98
|
+
* as absent, i.e. as C's NULL.
|
|
129
99
|
*/
|
|
130
100
|
export declare function isViewSwitcherButtonVisible(page: Pick<AdwViewSwitcherPage, 'visible' | 'title' | 'iconName'>): boolean;
|
|
131
101
|
/**
|
|
132
|
-
* The icon a switcher actually renders: a NULL or EMPTY name becomes
|
|
133
|
-
* `
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* Never returns `''`, so a renderer has an icon to paint in every mode where the
|
|
137
|
-
* C widget creates a `GtkImage` at all. Both ports instead omitted the icon
|
|
138
|
-
* node, which is why an icon-only toggle for a page without an icon rendered as
|
|
139
|
-
* a blank box.
|
|
102
|
+
* The icon a switcher actually renders: a NULL or EMPTY name becomes `image-missing` (C's
|
|
103
|
+
* `icon_name && *icon_name` fails on `''`). Never returns `''`, so a renderer has an icon
|
|
104
|
+
* to paint in every mode where the C widget creates a `GtkImage` at all — otherwise an
|
|
105
|
+
* icon-only toggle for a page without an icon renders as a blank box.
|
|
140
106
|
*/
|
|
141
107
|
export declare function viewSwitcherIconName(iconName: string | null | undefined): string;
|
|
142
108
|
/**
|
|
143
|
-
* The text a switcher paints for a page: `''` for a NULL title, otherwise the
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* `use-underline` too (adw-view-switcher-button.ui) — so GTK DISPLAYS `_Files`
|
|
149
|
-
* as `Files` with an underlined F. A renderer with no accelerator layer displays
|
|
150
|
-
* the same text; keeping the underscore would render a literal one, which is
|
|
151
|
-
* what the browser port did in the inline switcher's tooltip.
|
|
109
|
+
* The text a switcher paints for a page: `''` for a NULL title, otherwise the title with
|
|
110
|
+
* its mnemonic stripped when `use-underline` is set. GTK DISPLAYS `_Files` as `Files` with
|
|
111
|
+
* an underlined F (the template label carries `use-underline` too), so a renderer with no
|
|
112
|
+
* accelerator layer must display the same text — keeping the underscore renders a literal
|
|
113
|
+
* one.
|
|
152
114
|
*/
|
|
153
115
|
export declare function viewSwitcherLabel(page: Pick<AdwViewSwitcherPage, 'title' | 'useUnderline'>): string;
|
|
154
116
|
/**
|
|
155
|
-
* `get_badge_label
|
|
156
|
-
*
|
|
117
|
+
* `get_badge_label`: `''` for 0, `999+` above 999, the decimal otherwise. 999 itself
|
|
118
|
+
* prints, because the test is `> 999`.
|
|
157
119
|
*/
|
|
158
120
|
export declare function viewSwitcherBadgeLabel(badgeNumber: number): string;
|
|
159
121
|
/**
|
|
160
|
-
* The message catalogue {@link viewSwitcherIndicatorDescription} composes, so the
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* translation layer passes its own catalogue.
|
|
122
|
+
* The message catalogue {@link viewSwitcherIndicatorDescription} composes, so the core
|
|
123
|
+
* needs no gettext dependency while the composition ORDER stays pinned. C reads these
|
|
124
|
+
* through `C_("view switcher button badge", …)`; a renderer with a translation layer
|
|
125
|
+
* passes its own catalogue.
|
|
165
126
|
*/
|
|
166
127
|
export interface IndicatorDescriptionStrings {
|
|
167
128
|
/** `needs-attention` clause — C's "Attention requested." */
|
|
@@ -171,49 +132,36 @@ export interface IndicatorDescriptionStrings {
|
|
|
171
132
|
/** Badge clause for a printable count — C's "Has a badge: %u." */
|
|
172
133
|
badge: (badgeNumber: number) => string;
|
|
173
134
|
}
|
|
174
|
-
/** The English source strings from adw-indicator-bin.c
|
|
135
|
+
/** The English source strings from `adw-indicator-bin.c`. */
|
|
175
136
|
export declare const DEFAULT_INDICATOR_DESCRIPTION_STRINGS: IndicatorDescriptionStrings;
|
|
176
137
|
/**
|
|
177
|
-
* `update_description`
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* `"%s %s", badge_description, needs_attention_description` (:96). `''` when
|
|
183
|
-
* neither applies — C stores the empty string there, not NULL, and the button
|
|
184
|
-
* then RESETS the accessible property rather than setting it.
|
|
138
|
+
* `update_description` — the screen-reader description bound onto the switcher button or
|
|
139
|
+
* the inline toggle. The BADGE clause comes first when both apply (`"%s %s",
|
|
140
|
+
* badge_description, needs_attention_description`), and `''` when neither applies: C
|
|
141
|
+
* stores the empty string there, not NULL, and the button then RESETS the accessible
|
|
142
|
+
* property rather than setting it.
|
|
185
143
|
*/
|
|
186
144
|
export declare function viewSwitcherIndicatorDescription(needsAttention: boolean, badgeNumber: number, strings?: IndicatorDescriptionStrings): string;
|
|
187
145
|
/**
|
|
188
|
-
* `update_tooltip
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* Returns PLAIN text — see {@link stripMnemonic} on why the C markup escape does
|
|
193
|
-
* not belong in a port. A NULL title yields `''`: C would hand NULL to
|
|
194
|
-
* `g_markup_escape_text`, which every page libadwaita renders avoids by always
|
|
195
|
-
* having a title.
|
|
146
|
+
* `update_tooltip`: the empty string in every display mode except `icons`, where it is
|
|
147
|
+
* the title with the mnemonic stripped when `use-underline` is set. Returns PLAIN text —
|
|
148
|
+
* see {@link stripMnemonic} on why the C markup escape does not belong in a port. A NULL
|
|
149
|
+
* title yields `''`, a case C avoids by every rendered page having a title.
|
|
196
150
|
*/
|
|
197
151
|
export declare function inlineToggleTooltip(page: Pick<AdwViewSwitcherPage, 'title' | 'useUnderline'>, displayMode: AdwInlineViewSwitcherDisplayMode): string;
|
|
198
152
|
/**
|
|
199
|
-
* `update_bar_revealed
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* `visibleCount > 1 || reveal`. Absent from both ports, which is why a bar bound
|
|
205
|
-
* to a one-page stack showed an empty strip libadwaita keeps collapsed.
|
|
206
|
-
*
|
|
207
|
-
* Takes the minimal shape so a caller can pass either
|
|
208
|
-
* {@link AdwViewSwitcherPage}s or wave-1 {@link AdwViewStackPageInfo}s.
|
|
153
|
+
* `update_bar_revealed`: the bar is revealed only when `reveal` is set AND more than one
|
|
154
|
+
* page is VISIBLE. When `reveal` is false the C loop never runs, so the count stays 0 —
|
|
155
|
+
* the clauses are not independent and must not be reordered into `visibleCount > 1 ||
|
|
156
|
+
* reveal`. Takes the minimal shape so a caller can pass either
|
|
157
|
+
* {@link AdwViewSwitcherPage}s or {@link AdwViewStackPageInfo}s.
|
|
209
158
|
*/
|
|
210
159
|
export declare function shouldRevealViewSwitcherBar(reveal: boolean, pages: readonly {
|
|
211
160
|
readonly visible: boolean;
|
|
212
161
|
}[]): boolean;
|
|
213
162
|
/**
|
|
214
|
-
* The button orientation the policy implies — `WIDE` is horizontal, anything
|
|
215
|
-
*
|
|
216
|
-
* used when a button is created and when the policy changes.
|
|
163
|
+
* The button orientation the policy implies — `WIDE` is horizontal, anything else
|
|
164
|
+
* vertical. C uses the same ternary at button creation and on a policy change.
|
|
217
165
|
*/
|
|
218
166
|
export declare function viewSwitcherButtonOrientation(policy: AdwViewSwitcherPolicy): 'horizontal' | 'vertical';
|
|
219
167
|
/** The fully-derived per-button view model an `AdwViewSwitcher` renderer paints. */
|
|
@@ -240,20 +188,17 @@ export interface ViewSwitcherButtonModel {
|
|
|
240
188
|
description: string;
|
|
241
189
|
}
|
|
242
190
|
/**
|
|
243
|
-
* One model per page for `AdwViewSwitcher`, in PAGE index space
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
* :178), so the index space is preserved — unlike the inline switcher, which
|
|
248
|
-
* drops hidden pages entirely. `selected` is the page index; `-1` selects
|
|
249
|
-
* nothing.
|
|
191
|
+
* One model per page for `AdwViewSwitcher`, in PAGE index space: `populate_switcher` adds
|
|
192
|
+
* a button for EVERY page and `update_button` merely hides the ones that fail the
|
|
193
|
+
* visibility rule, so the index space is preserved — unlike the inline switcher, which
|
|
194
|
+
* drops hidden pages entirely. `selected` is the page index; `-1` selects nothing.
|
|
250
195
|
*/
|
|
251
196
|
export declare function buildViewSwitcherButtons(pages: readonly AdwViewSwitcherPage[], selected: number, policy: AdwViewSwitcherPolicy, strings?: IndicatorDescriptionStrings): ViewSwitcherButtonModel[];
|
|
252
197
|
/** The fully-derived per-toggle view model an `AdwInlineViewSwitcher` renderer paints. */
|
|
253
198
|
export interface InlineToggleModel {
|
|
254
199
|
/** Position among the TOGGLES — compacted, hidden pages skipped. */
|
|
255
200
|
toggleIndex: number;
|
|
256
|
-
/** Position in the PAGE list — libadwaita's `child-index
|
|
201
|
+
/** Position in the PAGE list — libadwaita's `child-index`. */
|
|
257
202
|
pageIndex: number;
|
|
258
203
|
/** The page name. */
|
|
259
204
|
name: string;
|
|
@@ -275,46 +220,36 @@ export interface InlineToggleModel {
|
|
|
275
220
|
description: string;
|
|
276
221
|
}
|
|
277
222
|
/**
|
|
278
|
-
* `populate_group`'s filter + order
|
|
279
|
-
*
|
|
223
|
+
* `populate_group`'s filter + order: a page with `visible == FALSE` produces NO toggle,
|
|
224
|
+
* which is why every model carries BOTH indices — `toggleIndex` is the compacted `0..k-1`
|
|
225
|
+
* position the toggle group knows, `pageIndex` the position the selection model knows, and
|
|
226
|
+
* libadwaita reconciles them through the `child-index` it stashes on each toggle.
|
|
280
227
|
*
|
|
281
|
-
*
|
|
282
|
-
* `
|
|
283
|
-
*
|
|
284
|
-
* `child-index` it stashes on each toggle (:346, :114-129). Neither port
|
|
285
|
-
* filtered, so the two spaces coincided and the reconciliation looked
|
|
286
|
-
* unnecessary.
|
|
287
|
-
*
|
|
288
|
-
* Note this uses the page's `visible` flag ALONE — the title-or-icon rule
|
|
289
|
-
* belongs to `AdwViewSwitcher.update_button` and has no counterpart here, so a
|
|
290
|
-
* page with neither title nor icon still gets an (empty) toggle.
|
|
228
|
+
* Uses the page's `visible` flag ALONE — the title-or-icon rule belongs to
|
|
229
|
+
* `AdwViewSwitcher.update_button` and has no counterpart here, so a page with neither
|
|
230
|
+
* title nor icon still gets an (empty) toggle.
|
|
291
231
|
*/
|
|
292
232
|
export declare function buildInlineToggles(pages: readonly AdwViewSwitcherPage[], displayMode: AdwInlineViewSwitcherDisplayMode, strings?: IndicatorDescriptionStrings): InlineToggleModel[];
|
|
293
233
|
/**
|
|
294
|
-
* Page index → toggle index, or {@link VIEW_SWITCHER_NO_SELECTION} when the page
|
|
295
|
-
*
|
|
296
|
-
* (adw-inline-view-switcher.c:434-453), where `index` stays
|
|
234
|
+
* Page index → toggle index, or {@link VIEW_SWITCHER_NO_SELECTION} when the page is
|
|
235
|
+
* hidden or out of range — `selection_changed_cb`, where `index` stays
|
|
297
236
|
* `GTK_INVALID_LIST_POSITION` unless the visible child's page is itself visible.
|
|
298
|
-
*
|
|
299
|
-
* Non-integers are refused for the same reason `ViewStackState` refuses them:
|
|
300
|
-
* the C position is a `guint`.
|
|
237
|
+
* Non-integers are refused because the C position is a `guint`.
|
|
301
238
|
*/
|
|
302
239
|
export declare function toggleIndexForPage(pages: readonly AdwViewSwitcherPage[], pageIndex: number): number;
|
|
303
240
|
/**
|
|
304
|
-
* Toggle index → page index, or {@link VIEW_SWITCHER_NO_SELECTION} when there is
|
|
305
|
-
*
|
|
306
|
-
*
|
|
241
|
+
* Toggle index → page index, or {@link VIEW_SWITCHER_NO_SELECTION} when there is no such
|
|
242
|
+
* toggle — `notify_active_cb` reads the active toggle's `child-index` and selects THAT
|
|
243
|
+
* page position.
|
|
307
244
|
*/
|
|
308
245
|
export declare function pageIndexForToggle(pages: readonly AdwViewSwitcherPage[], toggleIndex: number): number;
|
|
309
246
|
/** Opaque handle a {@link ViewSwitcherScheduler} returns for a pending dwell. */
|
|
310
247
|
export type ViewSwitcherTimerHandle = unknown;
|
|
311
248
|
/**
|
|
312
|
-
* The injected timing seam for the drag-hover auto-switch.
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* never reaches for a global `setTimeout` — that is what `gjsify.headless: true`
|
|
317
|
-
* machine-checks.
|
|
249
|
+
* The injected timing seam for the drag-hover auto-switch. Same SHAPE as `ToastScheduler`
|
|
250
|
+
* in `toast.ts`, so a renderer writes ONE adapter over its platform timer and passes it to
|
|
251
|
+
* both. The core never reaches for a global `setTimeout` — `gjsify.headless: true`
|
|
252
|
+
* machine-checks that.
|
|
318
253
|
*/
|
|
319
254
|
export interface ViewSwitcherScheduler {
|
|
320
255
|
/** Run `callback` after `ms`; return a handle {@link cancel} understands. */
|
|
@@ -332,14 +267,10 @@ export interface ViewSwitcherDragSwitchOptions {
|
|
|
332
267
|
delay?: number;
|
|
333
268
|
}
|
|
334
269
|
/**
|
|
335
|
-
* The 500 ms drag-hover auto-switch: hovering a non-active button while dragging
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
* (adw-view-switcher-button.c:14, :58-63, :79-96; adw-inline-view-switcher.c:80,
|
|
340
|
-
* :194-236). Each button/toggle owns its OWN timer there, so this keeps one
|
|
341
|
-
* pending handle per index rather than a single global one — an enter on a
|
|
342
|
-
* second index does not silently disarm the first.
|
|
270
|
+
* The 500 ms drag-hover auto-switch: hovering a non-active button while dragging switches
|
|
271
|
+
* to it, and leaving before the dwell elapses cancels. Each button/toggle owns its OWN
|
|
272
|
+
* timer in C, so this keeps one pending handle per index rather than a single global one —
|
|
273
|
+
* an enter on a second index does not silently disarm the first.
|
|
343
274
|
*/
|
|
344
275
|
export declare class ViewSwitcherDragSwitch {
|
|
345
276
|
private readonly _scheduler;
|
|
@@ -351,10 +282,8 @@ export declare class ViewSwitcherDragSwitch {
|
|
|
351
282
|
* A drag entered the button at `index` while `activeIndex` is selected.
|
|
352
283
|
* Returns whether a dwell was armed.
|
|
353
284
|
*
|
|
354
|
-
* `drag_enter_cb` early-returns when the hovered button is already active
|
|
355
|
-
*
|
|
356
|
-
* adw-inline-view-switcher.c:219), so hovering the current tab never
|
|
357
|
-
* schedules anything.
|
|
285
|
+
* `drag_enter_cb` early-returns when the hovered button is already active (the inline
|
|
286
|
+
* twin compares indices instead), so hovering the current tab schedules nothing.
|
|
358
287
|
*/
|
|
359
288
|
enter(index: number, activeIndex: number): boolean;
|
|
360
289
|
/** The drag left the button at `index` — `drag_leave_cb` removes its source. */
|
|
@@ -373,11 +302,10 @@ export interface ViewSwitcherStateChange {
|
|
|
373
302
|
/** Its rendered label ({@link viewSwitcherLabel}), `''` when nothing is selected. */
|
|
374
303
|
title: string;
|
|
375
304
|
/**
|
|
376
|
-
* `true` for a user activation or an explicit select, `false` for a model-
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* dropping the notification.
|
|
305
|
+
* `true` for a user activation or an explicit select, `false` for a model-driven
|
|
306
|
+
* auto-pick (page list rebuild, visibility flip). Same convention as
|
|
307
|
+
* `ComboState`/`SpinState`/`ViewStackState`; libadwaita notifies on both paths, so this
|
|
308
|
+
* is for suppressing feedback loops, not for dropping the notification.
|
|
381
309
|
*/
|
|
382
310
|
interactive: boolean;
|
|
383
311
|
}
|
|
@@ -392,22 +320,18 @@ export interface ViewSwitcherStateOptions {
|
|
|
392
320
|
}
|
|
393
321
|
/**
|
|
394
322
|
* The page model + selection of a switcher that OWNS its pages — the browser and
|
|
395
|
-
* NativeScript switchers, which bundle the `AdwViewStack` libadwaita keeps
|
|
396
|
-
* separate.
|
|
323
|
+
* NativeScript switchers, which bundle the `AdwViewStack` libadwaita keeps separate.
|
|
397
324
|
*
|
|
398
|
-
* Selection is DELEGATED to {@link ViewStackState}
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* their page list wholesale and libadwaita's selection follows the page OBJECT
|
|
405
|
-
* across such a rebuild (adw-view-stack.c:660-672) rather than the index.
|
|
325
|
+
* Selection is DELEGATED to {@link ViewStackState}: the integer/range/already-selected/
|
|
326
|
+
* hidden guards, the by-name lookup, the first-VISIBLE-page auto-pick and the
|
|
327
|
+
* hide-fallback all come from there, where their conformance vectors already live. This
|
|
328
|
+
* class adds the C-faithful page record and a name-preserving {@link setPages}, because
|
|
329
|
+
* renderers rebuild their page list wholesale and libadwaita's selection follows the page
|
|
330
|
+
* OBJECT across such a rebuild rather than the index.
|
|
406
331
|
*
|
|
407
|
-
* Policy and display mode are deliberately NOT here: each is one enum value plus
|
|
408
|
-
*
|
|
409
|
-
* {@link isInlineViewSwitcherDisplayMode}
|
|
410
|
-
* {@link VIEW_SWITCHER_POLICIES} / {@link INLINE_VIEW_SWITCHER_DISPLAY_MODES}.
|
|
332
|
+
* Policy and display mode are deliberately NOT here: each is one enum value plus one style
|
|
333
|
+
* class, validated by {@link isViewSwitcherPolicy} /
|
|
334
|
+
* {@link isInlineViewSwitcherDisplayMode}.
|
|
411
335
|
*/
|
|
412
336
|
export declare class ViewSwitcherState {
|
|
413
337
|
private _pages;
|
|
@@ -425,10 +349,9 @@ export declare class ViewSwitcherState {
|
|
|
425
349
|
* rebuild whenever a page of the same name survives.
|
|
426
350
|
*
|
|
427
351
|
* libadwaita's selection is a page pointer compared by identity
|
|
428
|
-
* (`adw_view_stack_pages_is_selected
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
* first-visible auto-pick. Emits at most ONE change, tagged
|
|
352
|
+
* (`adw_view_stack_pages_is_selected`), so an insert before the selected page shifts its
|
|
353
|
+
* index without changing what is shown; a rebuild that dropped the selected page falls
|
|
354
|
+
* through to the first-visible auto-pick. Emits at most ONE change, tagged
|
|
432
355
|
* `interactive: false` — the page set changed, the user did not click.
|
|
433
356
|
*/
|
|
434
357
|
setPages(specs: readonly AdwViewSwitcherPageInit[]): void;
|
|
@@ -443,12 +366,9 @@ export declare class ViewSwitcherState {
|
|
|
443
366
|
/**
|
|
444
367
|
* Select by page index. Returns whether the selection changed.
|
|
445
368
|
*
|
|
446
|
-
* Every guard is {@link ViewStackState.setVisibleIndex}'s: a non-integer, a
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
* jumped to the first page, `active="99"` to the last) where
|
|
450
|
-
* `adw_view_stack_pages_select_item` simply returns FALSE
|
|
451
|
-
* (adw-view-stack.c:682-684).
|
|
369
|
+
* Every guard is {@link ViewStackState.setVisibleIndex}'s: a non-integer, a negative, an
|
|
370
|
+
* out-of-range and a hidden page are all silent no-ops, NOT clamped into range —
|
|
371
|
+
* `adw_view_stack_pages_select_item` simply returns FALSE.
|
|
452
372
|
*/
|
|
453
373
|
setSelected(index: number, interactive?: boolean): boolean;
|
|
454
374
|
/** Select by page name. Returns whether the selection changed. */
|
|
@@ -456,9 +376,9 @@ export declare class ViewSwitcherState {
|
|
|
456
376
|
/**
|
|
457
377
|
* Flip a page's `visible` flag. Returns whether the SELECTION moved.
|
|
458
378
|
*
|
|
459
|
-
* Both the switcher's page record and the delegated stack are updated, so the
|
|
460
|
-
*
|
|
461
|
-
*
|
|
379
|
+
* Both the switcher's page record and the delegated stack are updated, so the derived
|
|
380
|
+
* buttons and toggles rebuild against the same truth the selection fallback used
|
|
381
|
+
* (`update_child_visible`).
|
|
462
382
|
*/
|
|
463
383
|
setPageVisible(name: string, visible: boolean): boolean;
|
|
464
384
|
/** A drag entered the button/toggle for page `pageIndex`; arms the dwell. */
|
|
@@ -484,16 +404,12 @@ export interface ViewSwitcherBarChange {
|
|
|
484
404
|
/** Subscriber for {@link ViewSwitcherBarState} changes. */
|
|
485
405
|
export type ViewSwitcherBarListener = (change: ViewSwitcherBarChange) => void;
|
|
486
406
|
/**
|
|
487
|
-
* `AdwViewSwitcherBar`'s reveal state machine: `reveal` is what the layout ASKS
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
* the
|
|
492
|
-
*
|
|
493
|
-
* — which is why {@link setPages} exists rather than the count being passed to
|
|
494
|
-
* {@link setReveal}. `reveal` defaults to FALSE (:256-259); the NativeScript bar
|
|
495
|
-
* started life VISIBLE, so a freshly constructed bar covered the screen bottom
|
|
496
|
-
* until someone set `revealed = false`.
|
|
407
|
+
* `AdwViewSwitcherBar`'s reveal state machine: `reveal` is what the layout ASKS for,
|
|
408
|
+
* `revealed` is what the bar actually does. `update_bar_revealed` is re-run from
|
|
409
|
+
* `set_reveal`, from `set_stack` and from the pages' `items-changed`, so the derived value
|
|
410
|
+
* flips both when the flag changes and when the page set does — which is why
|
|
411
|
+
* {@link setPages} exists rather than the count being passed to {@link setReveal}.
|
|
412
|
+
* `reveal` defaults to FALSE, so a freshly constructed bar is collapsed.
|
|
497
413
|
*/
|
|
498
414
|
export declare class ViewSwitcherBarState {
|
|
499
415
|
private _reveal;
|
|
@@ -507,9 +423,8 @@ export declare class ViewSwitcherBarState {
|
|
|
507
423
|
/** Whether the bar is actually shown — the derived truth. */
|
|
508
424
|
get revealed(): boolean;
|
|
509
425
|
/**
|
|
510
|
-
* Set the request. Returns whether `reveal` itself changed (C returns early
|
|
511
|
-
*
|
|
512
|
-
* subscriber only fires when the DERIVED value moves.
|
|
426
|
+
* Set the request. Returns whether `reveal` itself changed (C returns early before its
|
|
427
|
+
* notify when it did not); the subscriber only fires when the DERIVED value moves.
|
|
513
428
|
*/
|
|
514
429
|
setReveal(value: boolean): boolean;
|
|
515
430
|
/**
|