@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
package/lib/types/sidebar.d.ts
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The "no item is selected" index — the TS mirror of `GTK_INVALID_LIST_POSITION`
|
|
3
|
-
* (`adw_sidebar_init
|
|
3
|
+
* (`adw_sidebar_init`).
|
|
4
4
|
*
|
|
5
|
-
* libadwaita spells it `G_MAXUINT` because `AdwSidebar:selected` is a `guint`;
|
|
6
|
-
*
|
|
7
|
-
* {@link adjustSidebarSelection}'s arithmetic agree with the C
|
|
5
|
+
* libadwaita spells it `G_MAXUINT` because `AdwSidebar:selected` is a `guint`; `-1` is the
|
|
6
|
+
* idiomatic TS sentinel and, being `G_MAXUINT` mod 2^32, it makes
|
|
7
|
+
* {@link adjustSidebarSelection}'s arithmetic agree with the C bit for bit.
|
|
8
8
|
*/
|
|
9
9
|
export declare const ADW_SIDEBAR_NO_SELECTION = -1;
|
|
10
10
|
/**
|
|
11
|
-
* How a sidebar looks and behaves — `AdwSidebarMode`
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* tracked to determine the initially selected item once switched back"
|
|
16
|
-
* (adw-sidebar.c:2948-2951). The tracked index is identical in both.
|
|
11
|
+
* How a sidebar looks and behaves — `AdwSidebarMode`. `'sidebar'` is a flat navigation list
|
|
12
|
+
* with a persistent, VISIBLE selection; `'page'` is a page of boxed lists where "the
|
|
13
|
+
* selection is invisible and only tracked to determine the initially selected item once
|
|
14
|
+
* switched back". The tracked index is identical in both.
|
|
17
15
|
*/
|
|
18
16
|
export type AdwSidebarMode = 'sidebar' | 'page';
|
|
19
17
|
/** One selectable row — the value half of `AdwSidebarItem`. */
|
|
20
18
|
export interface AdwSidebarItemSpec {
|
|
21
|
-
/** Row title. Defaults to `''` in libadwaita
|
|
19
|
+
/** Row title. Defaults to `''` in libadwaita. */
|
|
22
20
|
title: string;
|
|
23
21
|
/** Optional second line. Absent and `''` are the same thing. */
|
|
24
22
|
subtitle?: string;
|
|
25
23
|
/** Symbolic icon name, e.g. `'folder-symbolic'`. Absent means no icon. */
|
|
26
24
|
iconName?: string;
|
|
27
|
-
/** Whether the row is rendered at all — bound to `row:visible
|
|
25
|
+
/** Whether the row is rendered at all — bound to `row:visible`. Default true. */
|
|
28
26
|
visible?: boolean;
|
|
29
|
-
/** Whether the row can be activated — bound to `row:sensitive
|
|
27
|
+
/** Whether the row can be activated — bound to `row:sensitive`. Default true. */
|
|
30
28
|
enabled?: boolean;
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
31
|
* A titled group of rows — the value half of `AdwSidebarSection`.
|
|
34
32
|
*
|
|
35
33
|
* An absent or empty title selects the `'separator'` header instead of the
|
|
36
|
-
* `'title'` one (`update_header_page_cb
|
|
34
|
+
* `'title'` one (`update_header_page_cb`).
|
|
37
35
|
*/
|
|
38
36
|
export interface AdwSidebarSectionSpec {
|
|
39
37
|
/** Group heading. Absent/empty renders a separator instead. */
|
|
@@ -44,11 +42,10 @@ export interface AdwSidebarSectionSpec {
|
|
|
44
42
|
/** One entry of the flattened item model. */
|
|
45
43
|
export interface SidebarFlatItem {
|
|
46
44
|
/**
|
|
47
|
-
* The flat index `adw_sidebar_item_get_index` returns — the section's first
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* `filtered_items` (adw-sidebar.c:2866, :2177-2180).
|
|
45
|
+
* The flat index `adw_sidebar_item_get_index` returns — the section's first index plus the
|
|
46
|
+
* local one. It stays in the UNFILTERED space even when the item came out of a filtered
|
|
47
|
+
* walk, because libadwaita keeps the selection on `items_model` and the row list on
|
|
48
|
+
* `filtered_items`.
|
|
52
49
|
*/
|
|
53
50
|
index: number;
|
|
54
51
|
/** Index of the owning section. */
|
|
@@ -57,22 +54,22 @@ export interface SidebarFlatItem {
|
|
|
57
54
|
sectionItemIndex: number;
|
|
58
55
|
/** The item as declared — same object identity, so `selectedItem === spec` holds. */
|
|
59
56
|
item: AdwSidebarItemSpec;
|
|
60
|
-
/** `string_is_not_empty(title)` — the title label's visibility
|
|
57
|
+
/** `string_is_not_empty(title)` — the title label's visibility. */
|
|
61
58
|
titleVisible: boolean;
|
|
62
|
-
/** `string_is_not_empty(subtitle)
|
|
59
|
+
/** `string_is_not_empty(subtitle)`. */
|
|
63
60
|
subtitleVisible: boolean;
|
|
64
|
-
/** `notify_icon_cb`'s `icon_name && *icon_name
|
|
61
|
+
/** `notify_icon_cb`'s `icon_name && *icon_name`. */
|
|
65
62
|
iconVisible: boolean;
|
|
66
63
|
}
|
|
67
64
|
/** The header libadwaita draws above one RENDERED section. */
|
|
68
65
|
export interface SidebarHeaderSpec {
|
|
69
66
|
/** Index of the section this header belongs to. */
|
|
70
67
|
sectionIndex: number;
|
|
71
|
-
/** Which page of the header stack shows — `'title'` or `'separator'
|
|
68
|
+
/** Which page of the header stack shows — `'title'` or `'separator'`. */
|
|
72
69
|
kind: 'title' | 'separator';
|
|
73
70
|
/** The section title (`''` for a separator header). */
|
|
74
71
|
title: string;
|
|
75
|
-
/** True only for the section owning the FIRST rendered row — the `.first` class
|
|
72
|
+
/** True only for the section owning the FIRST rendered row — the `.first` class. */
|
|
76
73
|
first: boolean;
|
|
77
74
|
}
|
|
78
75
|
/** Payload of a `notify::selected` re-emit. */
|
|
@@ -91,67 +88,58 @@ export interface SidebarActivation {
|
|
|
91
88
|
/** The index that was clicked, echoed back unchanged. */
|
|
92
89
|
index: number;
|
|
93
90
|
/**
|
|
94
|
-
* Whether a row was actually activated. False when `index` addresses no
|
|
95
|
-
*
|
|
96
|
-
* sensitive `GtkListBoxRow`, so there is nothing to activate otherwise.
|
|
91
|
+
* Whether a row was actually activated. False when `index` addresses no rendered, enabled
|
|
92
|
+
* row — libadwaita's callbacks run off an existing, sensitive `GtkListBoxRow`.
|
|
97
93
|
*/
|
|
98
94
|
activated: boolean;
|
|
99
95
|
/** Whether the selection moved. `activated && !selectionChanged` is a re-click of the current row. */
|
|
100
96
|
selectionChanged: boolean;
|
|
101
97
|
}
|
|
102
|
-
/** Per-instance subscriber, same shape as `ComboStateListener` (rows.ts
|
|
98
|
+
/** Per-instance subscriber, same shape as `ComboStateListener` (rows.ts). */
|
|
103
99
|
export type SidebarStateListener = (change: SidebarSelectionChange) => void;
|
|
104
100
|
/**
|
|
105
|
-
* The TS stand-in for `GtkFilter` on `AdwSidebar:filter
|
|
101
|
+
* The TS stand-in for `GtkFilter` on `AdwSidebar:filter`.
|
|
106
102
|
*
|
|
107
103
|
* Decides only what is RENDERED and whether the sidebar counts as empty — never
|
|
108
104
|
* the selection index space, which counts the unfiltered model.
|
|
109
105
|
*/
|
|
110
106
|
export type SidebarItemFilter = (item: AdwSidebarItemSpec, index: number) => boolean;
|
|
111
107
|
/**
|
|
112
|
-
* The out-of-range rule
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* `
|
|
117
|
-
* `if (selected >= self->n_items) selected = GTK_INVALID_LIST_POSITION;`. A
|
|
118
|
-
* negative input agrees with that for free: as a `guint`, `-7` is `4294967289`,
|
|
119
|
-
* which is `>= n_items` for any real sidebar.
|
|
108
|
+
* The out-of-range rule: anything that is not a valid position becomes NO SELECTION — never
|
|
109
|
+
* the nearest in-range index. `adw_sidebar_set_selected` is literally
|
|
110
|
+
* `if (selected >= self->n_items) selected = GTK_INVALID_LIST_POSITION;`, and a negative
|
|
111
|
+
* input agrees with that for free: as a `guint`, `-7` is `4294967289`, which is
|
|
112
|
+
* `>= n_items` for any real sidebar.
|
|
120
113
|
*
|
|
121
|
-
* Non-integers and `NaN` are rejected rather than truncated. C cannot express
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* row while reporting a selection.
|
|
114
|
+
* Non-integers and `NaN` are rejected rather than truncated. C cannot express them, so
|
|
115
|
+
* there is no ground truth to copy; rejecting matches "not a valid position is no
|
|
116
|
+
* position", and it stops `sidebar.selected = 1.5` from highlighting no row while still
|
|
117
|
+
* reporting a selection.
|
|
126
118
|
*/
|
|
127
119
|
export declare function clampSidebarSelection(index: number, count: number): number;
|
|
128
120
|
/**
|
|
129
|
-
* Where the selection lands after the item model spliced — `items_changed_cb
|
|
130
|
-
* (adw-sidebar.c:2246-2284), which neither renderer implemented.
|
|
121
|
+
* Where the selection lands after the item model spliced — `items_changed_cb`.
|
|
131
122
|
*
|
|
132
123
|
* Four cases, in the C code's order:
|
|
133
|
-
* 1. `0 → n` auto-selects index 0 and notifies
|
|
134
|
-
* 2. a splice covering the selected index clears it
|
|
135
|
-
* 3. a splice at or before it shifts by `added - removed
|
|
124
|
+
* 1. `0 → n` auto-selects index 0 and notifies;
|
|
125
|
+
* 2. a splice covering the selected index clears it;
|
|
126
|
+
* 3. a splice at or before it shifts by `added - removed`;
|
|
136
127
|
* 4. a splice after it changes nothing.
|
|
137
128
|
*
|
|
138
|
-
* The comparisons run in the UNSIGNED domain (`>>> 0`) because that is where C
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* a renderer that "fixed" it would stop matching the toolkit it mirrors.
|
|
129
|
+
* The comparisons run in the UNSIGNED domain (`>>> 0`) because that is where C runs them:
|
|
130
|
+
* with no selection, `selected` is `G_MAXUINT`, so case 2 can never fire and case 3 wraps.
|
|
131
|
+
* That wraparound is REPRODUCED, not repaired — inserting two items above a selection-less
|
|
132
|
+
* sidebar genuinely selects index 1 in GTK.
|
|
143
133
|
*/
|
|
144
134
|
export declare function adjustSidebarSelection(selected: number, oldCount: number, newCount: number, position: number, removed: number, added: number): number;
|
|
145
135
|
/**
|
|
146
|
-
* Flatten the sections into the item model, the way `items_changed_cb`'s section
|
|
147
|
-
*
|
|
148
|
-
* (adw-sidebar.c:2261-2267).
|
|
149
|
-
*
|
|
150
|
-
* `sectionFirstIndex[i]` is `adw_sidebar_section_get_first_index` for section
|
|
151
|
-
* `i` — a zero-item section advances nothing, so it shares its successor's index.
|
|
136
|
+
* Flatten the sections into the item model, the way `items_changed_cb`'s section walk does:
|
|
137
|
+
* `set_first_index (section, current); current += get_n_items (section)`.
|
|
152
138
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
139
|
+
* `sectionFirstIndex[i]` is `adw_sidebar_section_get_first_index` for section `i` — a
|
|
140
|
+
* zero-item section advances nothing, so it shares its successor's index. With a `filter`,
|
|
141
|
+
* `items` is the RENDERED subset while every `index` (and `sectionFirstIndex`) stays in the
|
|
142
|
+
* unfiltered space.
|
|
155
143
|
*/
|
|
156
144
|
export declare function flattenSidebarItems(sections: readonly AdwSidebarSectionSpec[], filter?: SidebarItemFilter | null): {
|
|
157
145
|
items: SidebarFlatItem[];
|
|
@@ -160,28 +148,25 @@ export declare function flattenSidebarItems(sections: readonly AdwSidebarSection
|
|
|
160
148
|
/**
|
|
161
149
|
* The headers that actually get drawn, in render order.
|
|
162
150
|
*
|
|
163
|
-
* In sidebar mode a header is a property OF A ROW (`gtk_list_box_row_set_header
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* the web port used and why an empty leading section drew a stray separator.
|
|
151
|
+
* In sidebar mode a header is a property OF A ROW (`gtk_list_box_row_set_header`), so a
|
|
152
|
+
* section with no rows contributes none; in page mode the group's `visible` is bound to
|
|
153
|
+
* `filtered n-items > 0`, which comes to the same thing. Either way it is the sections that
|
|
154
|
+
* RENDER something that produce headers, NOT the declared section list — deriving from the
|
|
155
|
+
* declared list draws a stray separator for an empty leading section.
|
|
169
156
|
*
|
|
170
|
-
* The section owning the first rendered row gets `first: true`; when that
|
|
171
|
-
*
|
|
172
|
-
*
|
|
157
|
+
* The section owning the first rendered row gets `first: true`; when that section has no
|
|
158
|
+
* title its header is bound to `string_is_not_empty(title)` and therefore invisible, so it
|
|
159
|
+
* is omitted entirely.
|
|
173
160
|
*/
|
|
174
161
|
export declare function sidebarHeaders(sections: readonly AdwSidebarSectionSpec[], filter?: SidebarItemFilter | null): SidebarHeaderSpec[];
|
|
175
162
|
/**
|
|
176
163
|
* The sidebar state machine both renderers drive.
|
|
177
164
|
*
|
|
178
|
-
* Programmatic changes ({@link setSelected}, {@link setSections},
|
|
179
|
-
* {@link
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* (adw-sidebar.c:2188-2191) and page mode's `set_selected`-then-emit
|
|
184
|
-
* (`boxed_row_activated_cb`, adw-sidebar.c:1672-1673).
|
|
165
|
+
* Programmatic changes ({@link setSelected}, {@link setSections}, {@link insertSection},
|
|
166
|
+
* {@link removeSectionAt}, {@link removeAllSections}) notify with `interactive: false`;
|
|
167
|
+
* {@link activate} — the row click — notifies with `interactive: true` and applies the
|
|
168
|
+
* selection BEFORE reporting the activation, matching GtkListBox's
|
|
169
|
+
* `row-selected`-then-`row-activated` order and page mode's `set_selected`-then-emit.
|
|
185
170
|
*/
|
|
186
171
|
export declare class SidebarState {
|
|
187
172
|
private _mode;
|
|
@@ -196,22 +181,21 @@ export declare class SidebarState {
|
|
|
196
181
|
/** Subscribe to selection changes. Returns an unsubscribe function. */
|
|
197
182
|
subscribe(listener: SidebarStateListener): () => void;
|
|
198
183
|
private _emit;
|
|
199
|
-
/** Store an already-derived index; notify only on a real change
|
|
184
|
+
/** Store an already-derived index; notify only on a real change. */
|
|
200
185
|
private _applySelected;
|
|
201
186
|
/** Recompute everything derived from `sections` + `filter`. */
|
|
202
187
|
private _invalidate;
|
|
203
|
-
/** The current look/behaviour. Defaults to `'sidebar'
|
|
188
|
+
/** The current look/behaviour. Defaults to `'sidebar'`. */
|
|
204
189
|
get mode(): AdwSidebarMode;
|
|
205
190
|
/**
|
|
206
191
|
* Switch mode. Returns whether it changed — `adw_sidebar_set_mode` early-returns
|
|
207
|
-
* on the current value
|
|
192
|
+
* on the current value. Never touches the selection.
|
|
208
193
|
*/
|
|
209
194
|
setMode(mode: AdwSidebarMode): boolean;
|
|
210
195
|
/**
|
|
211
|
-
* Whether the selection is PAINTED. Page mode tracks the selection but shows
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* "the selection is invisible, but still tracked" (adw-sidebar.c:2948-2951).
|
|
196
|
+
* Whether the selection is PAINTED. Page mode tracks the selection but shows no selected
|
|
197
|
+
* row: its rows are plain `AdwActionRow`s in a boxed list (`create_boxed_row`) and the
|
|
198
|
+
* mode is documented as "the selection is invisible, but still tracked".
|
|
215
199
|
*/
|
|
216
200
|
get selectionVisible(): boolean;
|
|
217
201
|
/** The declared sections. */
|
|
@@ -219,59 +203,52 @@ export declare class SidebarState {
|
|
|
219
203
|
/**
|
|
220
204
|
* Replace every section at once — the renderers' "here is my whole tree" call.
|
|
221
205
|
*
|
|
222
|
-
* Equivalent to `adw_sidebar_remove_all()` followed by appending each section,
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* ONE notification, because one property write should produce one change.
|
|
206
|
+
* Equivalent to `adw_sidebar_remove_all()` followed by appending each section, i.e. two
|
|
207
|
+
* splices: everything removed (which clears the selection) and everything added (which
|
|
208
|
+
* re-runs the `0 → n` auto-select of index 0). Coalesced into ONE notification, because
|
|
209
|
+
* one property write should produce one change.
|
|
227
210
|
*/
|
|
228
211
|
setSections(sections: readonly AdwSidebarSectionSpec[]): void;
|
|
229
212
|
/**
|
|
230
|
-
* Insert a section, returning the index it landed at.
|
|
231
|
-
*
|
|
232
|
-
* `adw_sidebar_insert` appends when `position` is negative OR at/past the end
|
|
233
|
-
* (adw-sidebar.c:3358-3364) — so on a two-section sidebar, positions `-1`,
|
|
213
|
+
* Insert a section, returning the index it landed at. `adw_sidebar_insert` appends when
|
|
214
|
+
* `position` is negative OR at/past the end — so on a two-section sidebar, positions `-1`,
|
|
234
215
|
* `2` and `5` all append, and position `2` is NOT an "insert at 2".
|
|
235
216
|
*/
|
|
236
217
|
insertSection(section: AdwSidebarSectionSpec, position: number): number;
|
|
237
218
|
/**
|
|
238
219
|
* Remove the section at `index`. Returns false for an index that addresses no
|
|
239
220
|
* section — `adw_sidebar_remove` warns and returns when the section is not
|
|
240
|
-
* found
|
|
221
|
+
* found, changing nothing.
|
|
241
222
|
*/
|
|
242
223
|
removeSectionAt(index: number): boolean;
|
|
243
|
-
/** `adw_sidebar_remove_all`
|
|
224
|
+
/** `adw_sidebar_remove_all` — one splice removing every item. */
|
|
244
225
|
removeAllSections(): void;
|
|
245
226
|
/**
|
|
246
227
|
* Re-derive the item model after an ITEM's own properties changed in place.
|
|
247
228
|
*
|
|
248
|
-
* libadwaita
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
* contract for renderers that hand `SidebarState` mutable specs: the derived
|
|
254
|
-
* flags are recomputed, the selection is untouched, nothing is emitted.
|
|
255
|
-
* Both ports ignored post-construction item changes entirely.
|
|
229
|
+
* libadwaita needs no such call: title, subtitle and icon are live
|
|
230
|
+
* `g_object_bind_property` bindings straight onto the labels and `notify::icon-name` goes
|
|
231
|
+
* to `notify_icon_cb` — none of them runs through `items_changed_cb`, so the selection
|
|
232
|
+
* cannot move. Same contract here for renderers that hand `SidebarState` mutable specs:
|
|
233
|
+
* the derived flags are recomputed, the selection is untouched, nothing is emitted.
|
|
256
234
|
*/
|
|
257
235
|
refresh(): void;
|
|
258
|
-
/** `adw_sidebar_get_section` — `undefined` past the end
|
|
236
|
+
/** `adw_sidebar_get_section` — `undefined` past the end. */
|
|
259
237
|
sectionAt(index: number): AdwSidebarSectionSpec | undefined;
|
|
260
238
|
/** `adw_sidebar_section_get_first_index` — 0 for a section that is not in this sidebar. */
|
|
261
239
|
sectionFirstIndex(sectionIndex: number): number;
|
|
262
|
-
/** Number of items in the UNFILTERED model — the selection index space
|
|
240
|
+
/** Number of items in the UNFILTERED model — the selection index space. */
|
|
263
241
|
get count(): number;
|
|
264
242
|
/** The full flattened item model, in flat-index order. */
|
|
265
243
|
get items(): readonly SidebarFlatItem[];
|
|
266
|
-
/** `adw_sidebar_get_item` — `undefined` for `index >= n_items
|
|
244
|
+
/** `adw_sidebar_get_item` — `undefined` for `index >= n_items`. */
|
|
267
245
|
itemAt(index: number): AdwSidebarItemSpec | undefined;
|
|
268
246
|
/** The current item filter, or `null`. */
|
|
269
247
|
get filter(): SidebarItemFilter | null;
|
|
270
248
|
/**
|
|
271
|
-
* Set the item filter — `adw_sidebar_set_filter
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
* never re-derived, so a selected item that filters out stays selected.
|
|
249
|
+
* Set the item filter — `adw_sidebar_set_filter`. It only swaps the filter on the
|
|
250
|
+
* `GtkFilterListModel`; the selection is never re-derived, so a selected item that filters
|
|
251
|
+
* out stays selected.
|
|
275
252
|
*/
|
|
276
253
|
setFilter(filter: SidebarItemFilter | null): void;
|
|
277
254
|
/** The items that pass the filter — the rows a renderer actually builds. */
|
|
@@ -279,14 +256,13 @@ export declare class SidebarState {
|
|
|
279
256
|
/** The headers to draw, derived from the sections that render at least one row. */
|
|
280
257
|
get headers(): readonly SidebarHeaderSpec[];
|
|
281
258
|
/**
|
|
282
|
-
* The `.empty` / placeholder state — `update_placeholder` counts the FILTERED
|
|
283
|
-
*
|
|
284
|
-
* empty even though its selection index space is not.
|
|
259
|
+
* The `.empty` / placeholder state — `update_placeholder` counts the FILTERED model, so a
|
|
260
|
+
* fully filtered-out sidebar is empty even though its selection index space is not.
|
|
285
261
|
*/
|
|
286
262
|
get isEmpty(): boolean;
|
|
287
263
|
/** The selected flat index, or {@link ADW_SIDEBAR_NO_SELECTION}. */
|
|
288
264
|
get selected(): number;
|
|
289
|
-
/** `adw_sidebar_get_selected_item
|
|
265
|
+
/** `adw_sidebar_get_selected_item`. */
|
|
290
266
|
get selectedItem(): AdwSidebarItemSpec | undefined;
|
|
291
267
|
/**
|
|
292
268
|
* Programmatic selection — {@link clampSidebarSelection} then notify with
|
|
@@ -294,15 +270,13 @@ export declare class SidebarState {
|
|
|
294
270
|
*/
|
|
295
271
|
setSelected(index: number): boolean;
|
|
296
272
|
/**
|
|
297
|
-
* A row click. Selects (notifying `interactive: true` if that moved) and then
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* pane of a split view (adw-sidebar.c:73-75) — the NativeScript port had no
|
|
302
|
-
* activation path at all, so that gesture did nothing there.
|
|
273
|
+
* A row click. Selects (notifying `interactive: true` if that moved) and then reports the
|
|
274
|
+
* activation, which libadwaita emits on EVERY click including a re-click of the
|
|
275
|
+
* already-selected row (`row_activated_cb`). That unconditional emit is how re-tapping the
|
|
276
|
+
* current row reveals the content pane of a split view.
|
|
303
277
|
*
|
|
304
|
-
* A row that is filtered out, `visible: false`, or `enabled: false` is not
|
|
305
|
-
*
|
|
278
|
+
* A row that is filtered out, `visible: false`, or `enabled: false` is not activatable: it
|
|
279
|
+
* either has no `GtkListBoxRow` or has an insensitive one.
|
|
306
280
|
*/
|
|
307
281
|
activate(index: number): SidebarActivation;
|
|
308
282
|
}
|
package/lib/types/spinner.d.ts
CHANGED
|
@@ -1,84 +1,66 @@
|
|
|
1
|
-
/** `SPIN_DURATION_MS`
|
|
1
|
+
/** `SPIN_DURATION_MS` — one full turn. */
|
|
2
2
|
export declare const ADW_SPINNER_SPIN_DURATION_MS = 1200;
|
|
3
3
|
/**
|
|
4
|
-
* `START_ANGLE`
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Neither port had it, which is a constant rotation error rather than a wrong
|
|
8
|
-
* speed — invisible in a still frame, visible against a GTK spinner beside it.
|
|
4
|
+
* `START_ANGLE` — a fixed phase offset added to both arc ends, so the figure does not
|
|
5
|
+
* start at 3 o'clock. Omitting it is a constant rotation error rather than a wrong
|
|
6
|
+
* speed: invisible in a still frame, visible against a GTK spinner beside it.
|
|
9
7
|
*/
|
|
10
8
|
export declare const ADW_SPINNER_START_ANGLE: number;
|
|
11
9
|
/**
|
|
12
|
-
* `CIRCLE_OPACITY`
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* The browser port used `rgba(127, 127, 127, 0.25)`: too dark, and
|
|
16
|
-
* hue-independent, so a spinner on a coloured background lost its track
|
|
17
|
-
* relationship entirely.
|
|
10
|
+
* `CIRCLE_OPACITY` — the track is the WIDGET's colour at 15%, not a hardcoded grey,
|
|
11
|
+
* so a spinner on a coloured background keeps its track relationship.
|
|
18
12
|
*/
|
|
19
13
|
export declare const ADW_SPINNER_TRACK_OPACITY = 0.15;
|
|
20
|
-
/** `MIN_ARC_LENGTH`
|
|
14
|
+
/** `MIN_ARC_LENGTH` — GSK refuses to draw an arc shorter than this. */
|
|
21
15
|
export declare const ADW_SPINNER_MIN_ARC_LENGTH: number;
|
|
22
|
-
/** `MAX_ARC_LENGTH`
|
|
16
|
+
/** `MAX_ARC_LENGTH` — the LERP TARGET, 162°. The drawn arc peaks at 102.8°. */
|
|
23
17
|
export declare const ADW_SPINNER_MAX_ARC_LENGTH: number;
|
|
24
|
-
/** `IDLE_DISTANCE
|
|
18
|
+
/** `IDLE_DISTANCE`. */
|
|
25
19
|
export declare const ADW_SPINNER_IDLE_DISTANCE: number;
|
|
26
|
-
/** `OVERLAP_DISTANCE
|
|
20
|
+
/** `OVERLAP_DISTANCE`. */
|
|
27
21
|
export declare const ADW_SPINNER_OVERLAP_DISTANCE: number;
|
|
28
|
-
/** `EXTEND_DISTANCE
|
|
22
|
+
/** `EXTEND_DISTANCE`. */
|
|
29
23
|
export declare const ADW_SPINNER_EXTEND_DISTANCE: number;
|
|
30
|
-
/** `CONTRACT_DISTANCE
|
|
24
|
+
/** `CONTRACT_DISTANCE`. */
|
|
31
25
|
export declare const ADW_SPINNER_CONTRACT_DISTANCE: number;
|
|
32
26
|
/**
|
|
33
|
-
* `N_CYCLES`
|
|
27
|
+
* `N_CYCLES` — how many full TURNS the animation runs before repeating.
|
|
34
28
|
*
|
|
35
|
-
* The C states the
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* rather than assumed.
|
|
29
|
+
* The constraint the C states: the cycle length `IDLE + EXTEND + CONTRACT - OVERLAP`
|
|
30
|
+
* must divide `N_CYCLES * 2pi` exactly, or the arc jumps when the animation loops. It
|
|
31
|
+
* does — 53 turns is 40 arc cycles — and {@link ADW_SPINNER_CYCLES_PER_LOOP} is that
|
|
32
|
+
* quotient, asserted rather than assumed.
|
|
40
33
|
*/
|
|
41
34
|
export declare const ADW_SPINNER_N_CYCLES = 53;
|
|
42
35
|
/**
|
|
43
36
|
* One arc cycle, in radians of base angle:
|
|
44
|
-
* `IDLE_DISTANCE + EXTEND_DISTANCE + CONTRACT_DISTANCE - OVERLAP_DISTANCE
|
|
45
|
-
* (adw-spinner-paintable.c:112, :130).
|
|
37
|
+
* `IDLE_DISTANCE + EXTEND_DISTANCE + CONTRACT_DISTANCE - OVERLAP_DISTANCE`.
|
|
46
38
|
*/
|
|
47
39
|
export declare const ADW_SPINNER_CYCLE_LENGTH: number;
|
|
48
40
|
/** Whole arc cycles per animation loop — an integer, which is the C's constraint. */
|
|
49
41
|
export declare const ADW_SPINNER_CYCLES_PER_LOOP: number;
|
|
50
42
|
/**
|
|
51
43
|
* The base angle a NON-animating spinner is drawn at — `EXTEND_DISTANCE -
|
|
52
|
-
* OVERLAP_DISTANCE / 2
|
|
53
|
-
*
|
|
54
|
-
* Reached whenever there is no animation object: before the paintable has a
|
|
55
|
-
* widget, and in a still frame. Both ports left the resting pose undefined, so a
|
|
56
|
-
* spinner that had not started yet drew whatever its keyframe origin happened to
|
|
57
|
-
* be.
|
|
44
|
+
* OVERLAP_DISTANCE / 2`, i.e. `pi * 0.75`. Reached whenever there is no animation
|
|
45
|
+
* object: before the paintable has a widget, and in a still frame.
|
|
58
46
|
*/
|
|
59
47
|
export declare const ADW_SPINNER_STILL_PROGRESS: number;
|
|
60
48
|
/**
|
|
61
|
-
* `normalize_angle`
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* `angle > G_PI * 2`, so exactly `2pi` is left alone where a modulo would give 0.
|
|
49
|
+
* `normalize_angle` — fold into `[0, 2pi]`. The C loops rather than taking a modulo,
|
|
50
|
+
* and the boundary follows: it stops at `angle > G_PI * 2`, so exactly `2pi` is left
|
|
51
|
+
* alone where a modulo would give 0.
|
|
65
52
|
*/
|
|
66
53
|
export declare function normalizeSpinnerAngle(angle: number): number;
|
|
67
54
|
/**
|
|
68
|
-
* `get_arc_start`
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* The `- angle * MAX_ARC_LENGTH / l` term is the drift that makes the arc
|
|
72
|
-
* advance around the circle as it breathes; without it the figure would pulse in
|
|
73
|
-
* place.
|
|
55
|
+
* `get_arc_start` — the trailing end of the arc, relative to the base angle. The
|
|
56
|
+
* `- angle * MAX_ARC_LENGTH / l` term is the drift that makes the arc advance around
|
|
57
|
+
* the circle as it breathes; without it the figure would pulse in place.
|
|
74
58
|
*/
|
|
75
59
|
export declare function spinnerArcStart(angle: number): number;
|
|
76
60
|
/**
|
|
77
|
-
* `get_arc_end`
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* starts moving once the start has extended past the overlap, which is what
|
|
81
|
-
* makes the arc grow before it slides.
|
|
61
|
+
* `get_arc_end` — the leading end. Its phase is offset by
|
|
62
|
+
* `EXTEND_DISTANCE - OVERLAP_DISTANCE`: the end only starts moving once the start has
|
|
63
|
+
* extended past the overlap, which is what makes the arc grow before it slides.
|
|
82
64
|
*/
|
|
83
65
|
export declare function spinnerArcEnd(angle: number): number;
|
|
84
66
|
/** The two ends of the drawn arc, in radians clockwise from 3 o'clock. */
|
|
@@ -88,30 +70,26 @@ export interface SpinnerArc {
|
|
|
88
70
|
/** Leading end, folded into `[0, 2pi]`. */
|
|
89
71
|
end: number;
|
|
90
72
|
/**
|
|
91
|
-
* Arc length along the circle, `start - end` unwrapped into `(0, 2pi]`.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* and it is the opposite way round from what "start" suggests.
|
|
73
|
+
* Arc length along the circle, `start - end` unwrapped into `(0, 2pi]`. The segment
|
|
74
|
+
* runs from `end` to `start` (`gsk_path_builder_add_segment (builder, circle,
|
|
75
|
+
* &end_point, &start_point)`) — the naming is the C's and it is the opposite way
|
|
76
|
+
* round from what "start" suggests.
|
|
96
77
|
*/
|
|
97
78
|
length: number;
|
|
98
79
|
}
|
|
99
80
|
/**
|
|
100
|
-
* The arc for a base angle — `adw_spinner_paintable_snapshot_with_weight
|
|
101
|
-
* (adw-spinner-paintable.c:373-383).
|
|
81
|
+
* The arc for a base angle — `adw_spinner_paintable_snapshot_with_weight`.
|
|
102
82
|
*
|
|
103
|
-
* `progress` is the animation's value: 0 at the start of a loop, rising linearly
|
|
104
|
-
*
|
|
83
|
+
* `progress` is the animation's value: 0 at the start of a loop, rising linearly to
|
|
84
|
+
* `N_CYCLES * 2pi`. A renderer with no animation passes
|
|
105
85
|
* {@link ADW_SPINNER_STILL_PROGRESS}.
|
|
106
86
|
*/
|
|
107
87
|
export declare function spinnerArc(progress: number): SpinnerArc;
|
|
108
88
|
/**
|
|
109
89
|
* The animation's value after `elapsedMs` — `adw_timed_animation_new (widget, 0,
|
|
110
|
-
* N_CYCLES * 2pi, SPIN_DURATION_MS * N_CYCLES, target)` with `ADW_LINEAR` easing
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* A linear ramp over the whole loop reduces to one turn per
|
|
114
|
-
* {@link ADW_SPINNER_SPIN_DURATION_MS}; the loop length only decides where it
|
|
90
|
+
* N_CYCLES * 2pi, SPIN_DURATION_MS * N_CYCLES, target)` with `ADW_LINEAR` easing and
|
|
91
|
+
* `repeat_count = 0`, i.e. forever. A linear ramp over the whole loop reduces to one
|
|
92
|
+
* turn per {@link ADW_SPINNER_SPIN_DURATION_MS}; the loop length only decides where it
|
|
115
93
|
* restarts, and it restarts at a point the arc phase agrees with.
|
|
116
94
|
*/
|
|
117
95
|
export declare function spinnerProgressAt(elapsedMs: number): number;
|