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