@gjsify/adwaita-nativescript 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/types/widgets/adw-action-row.d.ts +27 -43
- package/lib/types/widgets/adw-data-grid.d.ts +4 -10
- package/lib/types/widgets/adw-entry-row.d.ts +20 -29
- package/lib/types/widgets/button-content.d.ts +12 -21
- package/lib/types/widgets/carousel-state.d.ts +15 -18
- package/lib/types/widgets/chrome.d.ts +22 -47
- package/lib/types/widgets/data-grid-model.d.ts +25 -36
- package/lib/types/widgets/navigation-stack.d.ts +2 -13
- package/lib/types/widgets/preferences-group-state.d.ts +7 -13
- package/lib/types/widgets/preferences-search.d.ts +5 -5
- package/lib/types/widgets/row-state.d.ts +17 -33
- package/lib/types/widgets/sidebar-model.d.ts +5 -7
- package/lib/types/widgets/split-button.d.ts +17 -34
- package/lib/types/widgets/split-view-base.d.ts +17 -24
- package/lib/types/widgets/split-view-state.d.ts +48 -76
- package/lib/types/widgets/split-view-width.d.ts +21 -32
- package/lib/types/widgets/status-page-content.d.ts +9 -14
- package/lib/types/widgets/tab-view-state.d.ts +18 -34
- package/lib/types/widgets/view-switcher-base.d.ts +11 -30
- package/lib/types/widgets/view-switcher-model.d.ts +17 -34
- package/lib/types/widgets/wrap-box-layout.d.ts +22 -37
- package/package.json +7 -7
|
@@ -2,7 +2,6 @@ import type { AdwPackType, AdwTextDirection, NavigationActionResult, NavigationS
|
|
|
2
2
|
export type { AdwPackType, NavigationStackPlan, SplitViewPane };
|
|
3
3
|
/** Payload of the `notify::show-sidebar` a state change asks the widget to emit. */
|
|
4
4
|
export interface NsShowSidebarNotification {
|
|
5
|
-
/** Whether the sidebar is meant to be shown. */
|
|
6
5
|
showSidebar: boolean;
|
|
7
6
|
/** Whether the view is in its collapsed (narrow) mode. */
|
|
8
7
|
collapsed: boolean;
|
|
@@ -10,10 +9,10 @@ export interface NsShowSidebarNotification {
|
|
|
10
9
|
/**
|
|
11
10
|
* The NativeScript side of a split view: what a state change makes it do.
|
|
12
11
|
*
|
|
13
|
-
* Only
|
|
14
|
-
* Structural mutations (mounting a pane, moving the sidebar
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* Only changes with real ordering or animation semantics come through here.
|
|
13
|
+
* Structural mutations (mounting a pane, moving the sidebar) stay the widget's own
|
|
14
|
+
* business, because they also have to re-declare the grid columns — a callback
|
|
15
|
+
* could only run after that anyway.
|
|
17
16
|
*/
|
|
18
17
|
export interface NsSplitViewHost {
|
|
19
18
|
/** Re-run the structural layout for the SETTLED state. Instant. */
|
|
@@ -27,17 +26,16 @@ export interface NsSplitViewHost {
|
|
|
27
26
|
export interface NsSplitViewState {
|
|
28
27
|
/** Whether the panes are stacked (one at a time) rather than side by side. */
|
|
29
28
|
readonly collapsed: boolean;
|
|
30
|
-
/** Whether the sidebar is meant to be shown. */
|
|
31
29
|
readonly showSidebar: boolean;
|
|
32
30
|
/** Which side the sidebar is packed on. */
|
|
33
31
|
readonly sidebarPosition: AdwPackType;
|
|
34
32
|
/** Attach the widget. Called exactly once, from the base constructor. */
|
|
35
33
|
bind(host: NsSplitViewHost): void;
|
|
36
|
-
/**
|
|
34
|
+
/** Returns whether it changed. */
|
|
37
35
|
setCollapsed(value: boolean): boolean;
|
|
38
|
-
/**
|
|
36
|
+
/** Returns whether it changed. */
|
|
39
37
|
setShowSidebar(value: boolean): boolean;
|
|
40
|
-
/**
|
|
38
|
+
/** Returns whether it changed. */
|
|
41
39
|
setSidebarPosition(position: AdwPackType): boolean;
|
|
42
40
|
/** Record that a pane was mounted or unmounted. Returns whether it changed. */
|
|
43
41
|
setPaneMounted(pane: SplitViewPane, mounted: boolean): boolean;
|
|
@@ -47,45 +45,35 @@ export interface NsSplitViewState {
|
|
|
47
45
|
*
|
|
48
46
|
* `AdwSplitViewBase._syncColumns` makes the SIDEBAR's column the fixed (`'auto'`)
|
|
49
47
|
* one and the content's the expanding (`'star'`) one, ordered by
|
|
50
|
-
* `sidebar-position`.
|
|
51
|
-
*
|
|
52
|
-
* `end`-positioned navigation split view fully inverted: it wrote the sidebar
|
|
53
|
-
* into column 0 and the content into column 1 unconditionally, while the base had
|
|
54
|
-
* already made column 0 the star column. libadwaita allocates an `end` sidebar at
|
|
55
|
-
* `width - sidebar_width` (adw-navigation-split-view.c:306-316).
|
|
48
|
+
* `sidebar-position`. A pane in the wrong column is therefore not merely mirrored,
|
|
49
|
+
* it also swaps its sizing mode.
|
|
56
50
|
*/
|
|
57
51
|
export declare function splitViewColumns(sidebarPosition: AdwPackType, direction?: AdwTextDirection): {
|
|
58
52
|
sidebar: number;
|
|
59
53
|
content: number;
|
|
60
54
|
};
|
|
61
55
|
/**
|
|
62
|
-
* `Adw.OverlaySplitView` bound to a NativeScript widget.
|
|
56
|
+
* `Adw.OverlaySplitView` bound to a NativeScript widget. The widget keeps ZERO
|
|
57
|
+
* split-view state.
|
|
63
58
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* The reveal itself is NOT driven from here. NativeScript animates with a native
|
|
69
|
-
* `View.animate()` on `translateX`/`opacity`, not by sampling a progress value,
|
|
70
|
-
* so the core's `SplitViewAnimator` seam stays on its instant default and
|
|
71
|
-
* `show-progress` settles at 0 or 1 — which is also what a renderer without a
|
|
72
|
-
* spring gets from `adw_animation_skip`.
|
|
59
|
+
* The reveal is NOT driven from here: NativeScript animates with a native
|
|
60
|
+
* `View.animate()` on `translateX`/`opacity` rather than by sampling a progress
|
|
61
|
+
* value, so the core's `SplitViewAnimator` seam stays on its instant default and
|
|
62
|
+
* `show-progress` settles at 0 or 1 — what `adw_animation_skip` also yields.
|
|
73
63
|
*/
|
|
74
64
|
export declare class NsOverlaySplitViewState implements NsSplitViewState {
|
|
75
65
|
private readonly _state;
|
|
76
66
|
private _host;
|
|
77
67
|
/**
|
|
78
68
|
* True while {@link setCollapsed} runs. The `show-sidebar` flip it couples is
|
|
79
|
-
* STRUCTURAL, not a user toggle: `set_collapsed` passes `animate = FALSE`
|
|
80
|
-
*
|
|
81
|
-
* behind it re-lays the whole view out anyway.
|
|
69
|
+
* STRUCTURAL, not a user toggle: `set_collapsed` passes `animate = FALSE` and
|
|
70
|
+
* the `collapsed` notification behind it re-lays the whole view out anyway.
|
|
82
71
|
*/
|
|
83
72
|
private _coupling;
|
|
84
73
|
constructor(options?: OverlaySplitViewOptions);
|
|
85
74
|
bind(host: NsSplitViewHost): void;
|
|
86
75
|
/** Whether the sidebar overlays the content instead of sitting beside it. */
|
|
87
76
|
get collapsed(): boolean;
|
|
88
|
-
/** Whether the sidebar is meant to be shown. */
|
|
89
77
|
get showSidebar(): boolean;
|
|
90
78
|
/** Whether collapsing/uncollapsing leaves the sidebar's visibility alone. */
|
|
91
79
|
get pinSidebar(): boolean;
|
|
@@ -93,30 +81,26 @@ export declare class NsOverlaySplitViewState implements NsSplitViewState {
|
|
|
93
81
|
get sidebarPosition(): AdwPackType;
|
|
94
82
|
/** The reveal progress: 0 hidden, 1 shown. */
|
|
95
83
|
get showProgress(): number;
|
|
96
|
-
/** Whether the tap-to-dismiss scrim takes input — `update_shield
|
|
84
|
+
/** Whether the tap-to-dismiss scrim takes input — `update_shield`. */
|
|
97
85
|
get shieldVisible(): boolean;
|
|
98
86
|
/**
|
|
99
|
-
* Whether the SIDEBAR pane may take focus —
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* the decorative bottom-sheet handle, adw-bottom-sheet.c:1198). Without it the
|
|
104
|
-
* pane hidden behind the overlay keeps answering taps and stays in the
|
|
105
|
-
* screen-reader order.
|
|
87
|
+
* Whether the SIDEBAR pane may take focus — GTK's
|
|
88
|
+
* `can_focus = !collapsed || show_sidebar`. NativeScript's equivalent is
|
|
89
|
+
* `isUserInteractionEnabled`; without it the pane hidden behind the overlay
|
|
90
|
+
* keeps answering taps and stays in the screen-reader order.
|
|
106
91
|
*/
|
|
107
92
|
get sidebarFocusable(): boolean;
|
|
108
|
-
/**
|
|
93
|
+
/** The mirror of {@link sidebarFocusable} for the CONTENT pane. */
|
|
109
94
|
get contentFocusable(): boolean;
|
|
110
95
|
/**
|
|
111
96
|
* Collapse or expand. Unless the sidebar is pinned this also flips
|
|
112
97
|
* `show-sidebar` to match, notifying it FIRST — GTK freezes notifications
|
|
113
|
-
* across the whole setter and thaws them in queue order
|
|
114
|
-
* (adw-overlay-split-view.c:1449-1483).
|
|
98
|
+
* across the whole setter and thaws them in queue order.
|
|
115
99
|
*/
|
|
116
100
|
setCollapsed(value: boolean): boolean;
|
|
117
101
|
/** Show or hide the sidebar — the animated, user-driven path. */
|
|
118
102
|
setShowSidebar(value: boolean): boolean;
|
|
119
|
-
/** Pin the sidebar so collapsing no longer hides it (`pin-sidebar
|
|
103
|
+
/** Pin the sidebar so collapsing no longer hides it (`pin-sidebar`). */
|
|
120
104
|
setPinSidebar(value: boolean): boolean;
|
|
121
105
|
/** Move the sidebar to the other side. The widget re-declares its columns. */
|
|
122
106
|
setSidebarPosition(position: AdwPackType): boolean;
|
|
@@ -125,26 +109,24 @@ export declare class NsOverlaySplitViewState implements NsSplitViewState {
|
|
|
125
109
|
* exist changes none of its state. Present so the two adapters share one seam.
|
|
126
110
|
*/
|
|
127
111
|
setPaneMounted(_pane: SplitViewPane, _mounted: boolean): boolean;
|
|
128
|
-
/** Tap on the scrim —
|
|
112
|
+
/** Tap on the scrim — hides the sidebar unconditionally. */
|
|
129
113
|
dismissShield(): boolean;
|
|
130
114
|
private _apply;
|
|
131
115
|
}
|
|
132
116
|
/**
|
|
133
117
|
* `Adw.NavigationSplitView` bound to a NativeScript widget.
|
|
134
118
|
*
|
|
135
|
-
*
|
|
136
|
-
* they are each other's negation and the core owns the meaning
|
|
137
|
-
*
|
|
138
|
-
* `
|
|
139
|
-
* reaching it is a push or a pop.
|
|
119
|
+
* This port spells the visible pane `showSidebar`, GTK spells it `show-content`;
|
|
120
|
+
* they are each other's negation and the core owns the meaning, including the
|
|
121
|
+
* ordering table (which pane is on top for a given `sidebar-position` ×
|
|
122
|
+
* `show-content` × which children exist, and whether reaching it is a push or pop).
|
|
140
123
|
*
|
|
141
|
-
* Tags
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* tag and mutating a caller's view to do that would be a surprise.
|
|
124
|
+
* Tags go through an explicit {@link setTag} rather than by handing the core a
|
|
125
|
+
* `View`: a `View` is not a `NavigationPageRef`, and reading a `tag` property off
|
|
126
|
+
* one would silently adopt whatever NativeScript happens to put there. Panes stay
|
|
127
|
+
* tracked by presence with a marker object and the tag of record lives in the
|
|
128
|
+
* core, because `setTag` CLEARS a colliding tag and mutating a caller's view to do
|
|
129
|
+
* that would be a surprise.
|
|
148
130
|
*/
|
|
149
131
|
export declare class NsNavigationSplitViewState implements NsSplitViewState {
|
|
150
132
|
private readonly _state;
|
|
@@ -163,29 +145,20 @@ export declare class NsNavigationSplitViewState implements NsSplitViewState {
|
|
|
163
145
|
});
|
|
164
146
|
bind(host: NsSplitViewHost): void;
|
|
165
147
|
/**
|
|
166
|
-
* Retag a mounted pane — `check_tags_cb
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* different failure from mounting a colliding page (that one is refused
|
|
170
|
-
* outright). Returns whether the tag stuck.
|
|
148
|
+
* Retag a mounted pane — `check_tags_cb`. On a collision the pane KEEPS its
|
|
149
|
+
* page and loses the tag, which is a different failure from mounting a
|
|
150
|
+
* colliding page (that one is refused outright). Returns whether the tag stuck.
|
|
171
151
|
*/
|
|
172
152
|
setTag(pane: SplitViewPane, tag: string | null): boolean;
|
|
173
153
|
/** The sidebar page's tag of record, or `null`. */
|
|
174
154
|
get sidebarTag(): string | null;
|
|
175
155
|
/** The content page's tag of record, or `null`. */
|
|
176
156
|
get contentTag(): string | null;
|
|
177
|
-
/** `navigation.push` with `tag
|
|
157
|
+
/** `navigation.push` with `tag`. */
|
|
178
158
|
push(tag: string): NavigationActionResult;
|
|
179
|
-
/** `navigation.pop
|
|
159
|
+
/** `navigation.pop`. */
|
|
180
160
|
pop(): NavigationActionResult;
|
|
181
|
-
/**
|
|
182
|
-
* `Adw.NavigationSplitView:show-content` under ITS OWN NAME.
|
|
183
|
-
*
|
|
184
|
-
* This port spells the visible pane `showSidebar`, which is the negation —
|
|
185
|
-
* and that costs every consumer a `!(…)`, including the storybook, which
|
|
186
|
-
* carries one purely to bind a shared story arg. Both spellings are here now
|
|
187
|
-
* and neither is derived from a second copy of the flag.
|
|
188
|
-
*/
|
|
161
|
+
/** `Adw.NavigationSplitView:show-content` — the negation of {@link showSidebar}. */
|
|
189
162
|
get showContent(): boolean;
|
|
190
163
|
set showContent(value: boolean);
|
|
191
164
|
/** Whether the panes are stacked (one at a time) rather than side by side. */
|
|
@@ -199,24 +172,23 @@ export declare class NsNavigationSplitViewState implements NsSplitViewState {
|
|
|
199
172
|
/**
|
|
200
173
|
* The pane on top of the stack — what a COLLAPSED view shows.
|
|
201
174
|
*
|
|
202
|
-
* Keyed on the stack, not on `showSidebar`: a LONE child stays visible
|
|
203
|
-
*
|
|
204
|
-
*
|
|
175
|
+
* Keyed on the stack, not on `showSidebar`: a LONE child stays visible whatever
|
|
176
|
+
* `show-content` says, and keying on the flag alone renders a sidebar-only
|
|
177
|
+
* split view blank.
|
|
205
178
|
*/
|
|
206
179
|
get visiblePane(): SplitViewPane | null;
|
|
207
180
|
/** Whether `pane` is the one a collapsed view shows. */
|
|
208
181
|
isVisible(pane: SplitViewPane): boolean;
|
|
209
182
|
/**
|
|
210
183
|
* How the last `show-content` change reached its stack: `push`, `pop`, or
|
|
211
|
-
* `replace` for a structural rebuild
|
|
184
|
+
* `replace` for a structural rebuild NativeScript paints instantly.
|
|
212
185
|
*
|
|
213
186
|
* This is the animation DIRECTION, and it is not `showSidebar`: with
|
|
214
187
|
* `sidebar-position: end` the content is the ROOT page, so showing it is a POP
|
|
215
|
-
* and hiding it a PUSH — the reverse of `start
|
|
216
|
-
* direction from the flag ran an `end`-positioned swap backwards.
|
|
188
|
+
* and hiding it a PUSH — the reverse of `start`.
|
|
217
189
|
*/
|
|
218
190
|
get transition(): NavigationStackPlan['transition'];
|
|
219
|
-
/** Collapse or expand. `Adw.NavigationSplitView` has no `show-content` coupling
|
|
191
|
+
/** Collapse or expand. `Adw.NavigationSplitView` has no `show-content` coupling. */
|
|
220
192
|
setCollapsed(value: boolean): boolean;
|
|
221
193
|
/** Show the sidebar (`true`) or the content (`false`) while collapsed. */
|
|
222
194
|
setShowSidebar(value: boolean): boolean;
|
|
@@ -20,56 +20,45 @@ export interface SplitViewWidthContext {
|
|
|
20
20
|
/** The sidebar child's own minimum width. */
|
|
21
21
|
sidebarChildMin?: number;
|
|
22
22
|
/**
|
|
23
|
-
* Whether the view is collapsed. Overlay only, and not a detail: COLLAPSED
|
|
24
|
-
* `get_sidebar_width` IGNORES the fraction and clamps the VIEW width instead
|
|
25
|
-
*
|
|
26
|
-
* where a fraction would give 180.
|
|
23
|
+
* Whether the view is collapsed. Overlay only, and not a detail: a COLLAPSED
|
|
24
|
+
* `get_sidebar_width` IGNORES the fraction and clamps the VIEW width instead, so
|
|
25
|
+
* on a 360 DIP phone GTK draws 280 where a fraction would give 180.
|
|
27
26
|
*/
|
|
28
27
|
collapsed?: boolean;
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* The sidebar width for a container of `totalWidth` DIPs.
|
|
32
31
|
*
|
|
33
|
-
* The two widgets genuinely differ
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* answers 180 (its minimum), overlay answers 100 (all there is).
|
|
32
|
+
* The two widgets genuinely differ: OVERLAY takes a final
|
|
33
|
+
* `min(width, totalWidth - contentMin)` and never claims more than the view has left;
|
|
34
|
+
* NAVIGATION folds that limit into the clamp's UPPER bound, where the LOWER bound can
|
|
35
|
+
* still win — so it may exceed the view. A 100 DIP container with no content minimum
|
|
36
|
+
* splits them: navigation answers 180 (its minimum), overlay answers 100.
|
|
39
37
|
*
|
|
40
|
-
* `collapsed` only reaches the overlay rule, because only the overlay has a
|
|
41
|
-
*
|
|
42
|
-
* takes no derived width at all ({@link appliesDerivedSidebarWidth}).
|
|
38
|
+
* `collapsed` only reaches the overlay rule, because only the overlay has a collapsed
|
|
39
|
+
* sidebar to size ({@link appliesDerivedSidebarWidth}).
|
|
43
40
|
*
|
|
44
|
-
* `totalWidth <= 0` means
|
|
45
|
-
*
|
|
46
|
-
* than a fraction of nothing. That is the smallest thing libadwaita would ever
|
|
41
|
+
* `totalWidth <= 0` means NativeScript has not laid the view out yet, so the MINIMUM
|
|
42
|
+
* is returned rather than a fraction of nothing: the smallest thing libadwaita would
|
|
47
43
|
* draw, so the first layout can only widen it, never jump down.
|
|
48
44
|
*/
|
|
49
45
|
export declare function sidebarWidthFor(totalWidth: number, props: SidebarWidthProps, rule?: SplitViewWidthRule, context?: SplitViewWidthContext): number;
|
|
50
46
|
/**
|
|
51
47
|
* Whether the sidebar pane takes a DERIVED width at all, or sizes itself.
|
|
52
48
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* `width = 'auto'` spanning both columns — so writing a number over it, as the
|
|
58
|
-
* post-layout re-measure did, snapped the full-screen pane back to 180-280 DIP
|
|
59
|
-
* one frame after the collapse.
|
|
49
|
+
* Exactly one case says no: a COLLAPSED navigation split view has no sidebar column,
|
|
50
|
+
* its visible page fills the whole view, and NativeScript expresses that as
|
|
51
|
+
* `width = 'auto'` spanning both columns. Writing a number over it snaps the
|
|
52
|
+
* full-screen pane back to 180-280 DIP one frame after the collapse.
|
|
60
53
|
*
|
|
61
|
-
* The overlay is deliberately NOT exempt
|
|
62
|
-
* clamped-width overlay drawn above the content
|
|
63
|
-
* (adw-overlay-split-view.c:462-463), so it still wants a number — a shared
|
|
64
|
-
* "collapsed means auto" rule would have been wrong for half the callers.
|
|
54
|
+
* The overlay is deliberately NOT exempt: its collapsed sidebar really is a
|
|
55
|
+
* clamped-width overlay drawn above the content, so it still wants a number.
|
|
65
56
|
*/
|
|
66
57
|
export declare function appliesDerivedSidebarWidth(collapsed: boolean, rule: SplitViewWidthRule): boolean;
|
|
67
58
|
/**
|
|
68
|
-
* Normalise one width property
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* a zero-width sidebar is indistinguishable from a missing one on screen, which
|
|
72
|
-
* turns a typo into a widget that looks broken instead of one that looks wrong.
|
|
59
|
+
* Normalise one width property. A non-finite or negative input falls back to the
|
|
60
|
+
* DEFAULT rather than to zero, because a zero-width sidebar is indistinguishable from
|
|
61
|
+
* a missing one on screen.
|
|
73
62
|
*/
|
|
74
63
|
export declare function normalizeWidthProp(value: number, fallback: number): number;
|
|
75
64
|
/** Clamp the fraction into the `[0, 1]` range its GTK property is declared with. */
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
/** NativeScript's `visible` / not-in-layout pair, the counterpart of GTK `visible`. */
|
|
2
2
|
export type StatusPageVisibility = 'visible' | 'collapse';
|
|
3
3
|
/**
|
|
4
|
-
* `string_is_not_empty
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* It is `string && string[0]` — one byte, no trim. A title of `" "` is a
|
|
8
|
-
* VISIBLE title in libadwaita, which is why this takes the raw text and never
|
|
9
|
-
* trims it: trimming would hide a widget GTK draws.
|
|
4
|
+
* `string_is_not_empty`, bound to the `visible` of BOTH the title and the description
|
|
5
|
+
* labels. It is `string && string[0]` — one byte, no trim: a title of `" "` is a
|
|
6
|
+
* VISIBLE title in libadwaita, so trimming here would hide a widget GTK draws.
|
|
10
7
|
*/
|
|
11
8
|
export declare function statusPageLabelVisibility(text: string | null | undefined): StatusPageVisibility;
|
|
12
9
|
/**
|
|
13
|
-
* `has_image
|
|
14
|
-
* (adw-status-page.ui:23-28).
|
|
10
|
+
* `has_image`, bound to the image's `visible`.
|
|
15
11
|
*
|
|
16
|
-
* C is `paintable || (icon_name && icon_name[0])
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* closures, and the missing half is a real gap rather than a simplification.
|
|
12
|
+
* C is `paintable || (icon_name && icon_name[0])`; this port has no `paintable`
|
|
13
|
+
* counterpart (the icon is an SVG string handed to `AdwIcon`), so only the second
|
|
14
|
+
* half applies. Kept as its own predicate rather than folded into
|
|
15
|
+
* {@link statusPageLabelVisibility} because upstream really are two closures, and
|
|
16
|
+
* the missing half is a real gap rather than a simplification.
|
|
22
17
|
*/
|
|
23
18
|
export declare function statusPageIconVisibility(icon: string | null | undefined): StatusPageVisibility;
|
|
@@ -8,10 +8,9 @@ export type NsVisibility = 'visible' | 'collapse';
|
|
|
8
8
|
/** The model an `AdwTabView` delegates to, typed on the NS `View`. */
|
|
9
9
|
export declare function createTabViewState(handlers?: TabViewHandlers<View>): TabViewState<View>;
|
|
10
10
|
/**
|
|
11
|
-
* The `visibility` each page's content view must carry for the current
|
|
12
|
-
*
|
|
13
|
-
* is
|
|
14
|
-
* (adw-tab-view.c:1912-1913), where the old port refused the close outright.
|
|
11
|
+
* The `visibility` each page's content view must carry for the current selection, in
|
|
12
|
+
* page order. Exactly one entry is `'visible'` — none when nothing is selected, which
|
|
13
|
+
* is a real state: closing the last tab EMPTIES the view.
|
|
15
14
|
*/
|
|
16
15
|
export declare function tabPageVisibilities(state: TabViewState<View>): NsVisibility[];
|
|
17
16
|
/** Push {@link tabPageVisibilities} onto the real content views. */
|
|
@@ -19,40 +18,26 @@ export declare function applyTabViewVisibility(state: TabViewState<View>): void;
|
|
|
19
18
|
/**
|
|
20
19
|
* The `visibility` each tab's close button must carry, in page order.
|
|
21
20
|
*
|
|
22
|
-
* `tabCloseVisible` is `(hovering && fullyVisible) || selected || dragging`, and
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* old port's rule plus the pinned gate it was missing. Calling the shared
|
|
27
|
-
* predicate rather than writing `active` keeps that a derivation instead of a
|
|
28
|
-
* coincidence, and gives the pinned gate for free.
|
|
21
|
+
* `tabCloseVisible` is `(hovering && fullyVisible) || selected || dragging`, and never
|
|
22
|
+
* on a pinned tab. Touch has no hover and this port has no tab drag-and-drop, so both
|
|
23
|
+
* are constantly false and the predicate REDUCES to "selected, and not pinned" —
|
|
24
|
+
* called rather than written out so it stays a derivation.
|
|
29
25
|
*/
|
|
30
26
|
export declare function tabCloseVisibilities(state: TabViewState<View>): NsVisibility[];
|
|
31
|
-
/**
|
|
32
|
-
* The `visibility` of the whole tab bar — `tabsRevealed` (adw-tab-bar.c:142-164)
|
|
33
|
-
* projected onto NS. The old port had no autohide at all; the bar was added in
|
|
34
|
-
* the constructor and never hidden.
|
|
35
|
-
*/
|
|
27
|
+
/** The `visibility` of the whole tab bar — `tabsRevealed` projected onto NS. */
|
|
36
28
|
export declare function tabBarVisibility(state: TabViewState<View>, autohide: boolean): NsVisibility;
|
|
37
29
|
/**
|
|
38
|
-
* The text a tab's label shows.
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* here either. Everything else shows its title, which is already `''` rather
|
|
43
|
-
* than `undefined` for a page that declared none: the old port assigned
|
|
44
|
-
* `page.title` straight to `Label.text` with no coercion, so an `AdwViewPage`
|
|
45
|
-
* literal without a title rendered the string "undefined".
|
|
30
|
+
* The text a tab's label shows. A pinned tab is a single-glyph chip in libadwaita —
|
|
31
|
+
* `adw_tab_constructed` hides its title outright — so it renders no label here either.
|
|
32
|
+
* Everything else shows its title, which the model has already coerced to `''` for a
|
|
33
|
+
* page that declared none.
|
|
46
34
|
*/
|
|
47
35
|
export declare function tabLabelText(page: AdwTabPage): string;
|
|
48
36
|
/**
|
|
49
|
-
* The tooltip text for a tab —
|
|
50
|
-
* has
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* accessibility label) rather than rendered. It is deliberately the TEXT form:
|
|
54
|
-
* a page-supplied tooltip is Pango markup in C, and NS has no markup sink to
|
|
55
|
-
* push it through.
|
|
37
|
+
* The tooltip text for a tab — the page's own tooltip when it has one, its title
|
|
38
|
+
* otherwise. NS has no tooltip primitive, so this is exposed for a consumer (and the
|
|
39
|
+
* accessibility label) rather than rendered, and in TEXT form: a page-supplied tooltip
|
|
40
|
+
* is Pango markup in C and NS has no markup sink.
|
|
56
41
|
*/
|
|
57
42
|
export declare function tabTooltipText(page: AdwTabPage): string;
|
|
58
43
|
/** The data half of the `notify::selected-page` event (minus NS's `eventName`/`object`). */
|
|
@@ -67,8 +52,7 @@ export interface TabViewNotifyPayload {
|
|
|
67
52
|
interactive: boolean;
|
|
68
53
|
}
|
|
69
54
|
/**
|
|
70
|
-
* Project a core change onto the event payload.
|
|
71
|
-
*
|
|
72
|
-
* model object, it does not silently leak into an event a consumer holds on to.
|
|
55
|
+
* Project a core change onto the event payload. A function rather than a spread so a
|
|
56
|
+
* live model object cannot leak into an event a consumer holds on to.
|
|
73
57
|
*/
|
|
74
58
|
export declare function tabViewNotifyPayload(change: TabViewSelectionChange): TabViewNotifyPayload;
|
|
@@ -18,7 +18,7 @@ export interface NotifyViewSelectedEventData extends EventData, ViewSwitcherNoti
|
|
|
18
18
|
export declare abstract class AdwViewSwitcherBase extends GridLayout {
|
|
19
19
|
/** The horizontal switcher bar holding the buttons. */
|
|
20
20
|
protected readonly _bar: GridLayout;
|
|
21
|
-
/** `Adw.ViewSwitcher:policy`, default NARROW
|
|
21
|
+
/** `Adw.ViewSwitcher:policy`, default NARROW as in C. */
|
|
22
22
|
private _policy;
|
|
23
23
|
/** The content area where the selected page is shown. */
|
|
24
24
|
protected readonly _contentArea: GridLayout;
|
|
@@ -31,30 +31,14 @@ export declare abstract class AdwViewSwitcherBase extends GridLayout {
|
|
|
31
31
|
protected abstract get barClass(): string;
|
|
32
32
|
/** CSS class applied to each switcher button — subclass-specific. */
|
|
33
33
|
protected abstract get buttonClass(): string;
|
|
34
|
-
/**
|
|
35
|
-
* `AdwViewSwitcher:policy`, which decides the button orientation
|
|
36
|
-
* (adw-view-switcher.c:534-537).
|
|
37
|
-
*
|
|
38
|
-
* It used to be a HARD-CODED `'wide'` with a note saying there was no policy
|
|
39
|
-
* property on NS — so a consumer could not follow a breakpoint, and the
|
|
40
|
-
* default was the opposite of C's, which is `ADW_VIEW_SWITCHER_POLICY_NARROW`
|
|
41
|
-
* (adw-view-switcher.c:447-451). It is a real property now, defaulting to
|
|
42
|
-
* `narrow`; a subclass may still pin it.
|
|
43
|
-
*/
|
|
34
|
+
/** `AdwViewSwitcher:policy`, which decides the button orientation. A subclass may pin it. */
|
|
44
35
|
protected get policy(): AdwViewSwitcherPolicy;
|
|
45
|
-
/**
|
|
46
|
-
* `Adw.ViewSwitcher:policy` — settable, defaulting to NARROW as in C
|
|
47
|
-
* (adw-view-switcher.c:447-451).
|
|
48
|
-
*
|
|
49
|
-
* A hard-coded `'wide'` meant an NS consumer could not follow a breakpoint
|
|
50
|
-
* at all, and the value it was pinned to was not even the default.
|
|
51
|
-
*/
|
|
36
|
+
/** `Adw.ViewSwitcher:policy` — settable, so a consumer can drive it from a breakpoint. */
|
|
52
37
|
get switcherPolicy(): AdwViewSwitcherPolicy;
|
|
53
38
|
set switcherPolicy(value: AdwViewSwitcherPolicy);
|
|
54
39
|
/**
|
|
55
|
-
* What the buttons show. `'both'` for the classic switcher, whose buttons
|
|
56
|
-
*
|
|
57
|
-
* `AdwInlineViewSwitcher` overrides it with the real
|
|
40
|
+
* What the buttons show. `'both'` for the classic switcher, whose buttons always
|
|
41
|
+
* have an icon and a label; `AdwInlineViewSwitcher` overrides it with the real
|
|
58
42
|
* `AdwInlineViewSwitcherDisplayMode`.
|
|
59
43
|
*/
|
|
60
44
|
protected get buttonDisplayMode(): AdwInlineViewSwitcherDisplayMode;
|
|
@@ -64,10 +48,9 @@ export declare abstract class AdwViewSwitcherBase extends GridLayout {
|
|
|
64
48
|
/**
|
|
65
49
|
* Register the view pages. Rebuilds the switcher bar + content stack.
|
|
66
50
|
*
|
|
67
|
-
* The SELECTED PAGE survives the rebuild whenever a page of the same name
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* otherwise (:1149-1151).
|
|
51
|
+
* The SELECTED PAGE survives the rebuild whenever a page of the same name does —
|
|
52
|
+
* libadwaita's selection is a page pointer, not an index — and falls back to the
|
|
53
|
+
* first VISIBLE page otherwise.
|
|
71
54
|
*/
|
|
72
55
|
setViews(pages: AdwViewPage[]): void;
|
|
73
56
|
/** Build one button's NS nodes. Painted by {@link _applySelection}. */
|
|
@@ -88,17 +71,15 @@ export declare abstract class AdwViewSwitcherBase extends GridLayout {
|
|
|
88
71
|
* page + emits `notify::selected`.
|
|
89
72
|
*
|
|
90
73
|
* Out-of-range, negative, fractional and hidden-page indices are all silent
|
|
91
|
-
* NO-OPS — refused, never clamped,
|
|
92
|
-
* `adw_view_stack_pages_select_item` refuses (adw-view-stack.c:682-684).
|
|
74
|
+
* NO-OPS — refused, never clamped, as `adw_view_stack_pages_select_item` does.
|
|
93
75
|
*/
|
|
94
76
|
get selected(): number;
|
|
95
77
|
set selected(value: number);
|
|
96
78
|
/** Name of the selected page, `''` when nothing is selected. */
|
|
97
79
|
get selectedName(): string;
|
|
98
80
|
/**
|
|
99
|
-
* Show or hide a page by name. Returns whether the SELECTION moved: hiding
|
|
100
|
-
*
|
|
101
|
-
* (`update_child_visible`, adw-view-stack.c:1061-1082).
|
|
81
|
+
* Show or hide a page by name. Returns whether the SELECTION moved: hiding the
|
|
82
|
+
* selected page falls back to the first still-visible one.
|
|
102
83
|
*/
|
|
103
84
|
setPageVisible(name: string, visible: boolean): boolean;
|
|
104
85
|
}
|
|
@@ -5,10 +5,8 @@ import type { AdwViewSwitcherPageInit, ViewSwitcherStateChange } from '@gjsify/a
|
|
|
5
5
|
* One page registered with a view switcher.
|
|
6
6
|
*
|
|
7
7
|
* Mirrors `AdwViewStackPage`'s properties with their C defaults. `title` and
|
|
8
|
-
* `icon` are NULLABLE on purpose: a page with neither renders no button at all
|
|
9
|
-
*
|
|
10
|
-
* that rule is no longer expressible — which is why the old shape, with a
|
|
11
|
-
* required `title: string`, could not implement it.
|
|
8
|
+
* `icon` are NULLABLE on purpose: a page with neither renders no button at all, and
|
|
9
|
+
* an absent title flattened to `''` makes that rule inexpressible.
|
|
12
10
|
*
|
|
13
11
|
* `icon` is an Adwaita symbolic SVG DOCUMENT here, not a GTK icon name: `AdwIcon`
|
|
14
12
|
* rasterises the path data natively. The core treats the field as an opaque
|
|
@@ -16,12 +14,7 @@ import type { AdwViewSwitcherPageInit, ViewSwitcherStateChange } from '@gjsify/a
|
|
|
16
14
|
* the fallback sentinel it hands back.
|
|
17
15
|
*/
|
|
18
16
|
export interface AdwViewPage {
|
|
19
|
-
/**
|
|
20
|
-
* The switcher button label. ABSENT means the page has none — which is C's
|
|
21
|
-
* NULL, and the state the button-visibility rule turns on. Spelled as an
|
|
22
|
-
* optional `string` rather than `string | null` so the existing consumers
|
|
23
|
-
* that pass a plain `string` keep type-checking unchanged.
|
|
24
|
-
*/
|
|
17
|
+
/** The switcher button label. ABSENT is C's NULL — the state button visibility turns on. */
|
|
25
18
|
title?: string;
|
|
26
19
|
/** The page content view, shown when this page is selected. */
|
|
27
20
|
content: View;
|
|
@@ -47,9 +40,9 @@ export declare function createViewSwitcherBarState(): ViewSwitcherBarState;
|
|
|
47
40
|
/**
|
|
48
41
|
* Project one NS page onto the core's page init.
|
|
49
42
|
*
|
|
50
|
-
* A page without an explicit `name` gets its POSITION as the name
|
|
51
|
-
*
|
|
52
|
-
*
|
|
43
|
+
* A page without an explicit `name` gets its POSITION as the name: the NS API is
|
|
44
|
+
* positional (`setViews` takes an array), and the name-preserving rebuild needs a
|
|
45
|
+
* stable id to keep the selected page selected.
|
|
53
46
|
*/
|
|
54
47
|
export declare function viewSwitcherPageSpec(page: AdwViewPage, index: number): AdwViewSwitcherPageInit;
|
|
55
48
|
/** {@link viewSwitcherPageSpec} over a whole page list. */
|
|
@@ -57,11 +50,10 @@ export declare function viewSwitcherPageSpecs(pages: readonly AdwViewPage[]): Ad
|
|
|
57
50
|
/**
|
|
58
51
|
* Resolve the core's icon slot to something `AdwIcon` can rasterise.
|
|
59
52
|
*
|
|
60
|
-
* The core substitutes the NAME `image-missing` for an absent icon
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* else is already an SVG and passes through.
|
|
53
|
+
* The core substitutes the NAME `image-missing` for an absent icon. On the browser
|
|
54
|
+
* side that name becomes a CSS mask class; here it has to become the actual
|
|
55
|
+
* symbolic document, so the sentinel is swapped for the vendored
|
|
56
|
+
* `image-missing-symbolic` SVG. Anything else is already an SVG and passes through.
|
|
65
57
|
*/
|
|
66
58
|
export declare function nsIconSvg(iconName: string): string;
|
|
67
59
|
/**
|
|
@@ -76,24 +68,15 @@ export declare function applyViewSwitcherVisibility(pages: readonly AdwViewPage[
|
|
|
76
68
|
/** Which switcher is asking — the two apply different visibility rules. */
|
|
77
69
|
export type ViewSwitcherKind = 'switcher' | 'inline';
|
|
78
70
|
/**
|
|
79
|
-
* Whether a page gets a button/toggle at all.
|
|
71
|
+
* Whether a page gets a button/toggle at all. The two switchers genuinely differ:
|
|
80
72
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
73
|
+
* - `AdwViewSwitcher` needs a title or an icon ON TOP OF `visible`
|
|
74
|
+
* (`visible && (title != NULL || icon_name != NULL)`).
|
|
75
|
+
* - `AdwInlineViewSwitcher` gates on `visible` alone, so a page with neither still
|
|
76
|
+
* gets an empty toggle.
|
|
83
77
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* NULL))` (adw-view-switcher.c:178).
|
|
87
|
-
* - `AdwInlineViewSwitcher` does not. `populate_group` gates on `visible` alone
|
|
88
|
-
* (adw-inline-view-switcher.c:370-378), so a page with neither still gets an
|
|
89
|
-
* empty toggle.
|
|
90
|
-
*
|
|
91
|
-
* The inline widget inherited the stricter rule and silently dropped toggles
|
|
92
|
-
* libadwaita draws. `@gjsify/adwaita-core` had spelled this out in
|
|
93
|
-
* `buildInlineToggles`' doc and pinned it in `INLINE_TOGGLE_VECTORS` the whole
|
|
94
|
-
* time — the rule just lived in a class that `extends GridLayout`, which no
|
|
95
|
-
* spec can import, so nothing could reach it to check. That is why it is here
|
|
96
|
-
* and not there.
|
|
78
|
+
* The rule lives here rather than in the widget because a class that `extends
|
|
79
|
+
* GridLayout` cannot be imported by a spec.
|
|
97
80
|
*/
|
|
98
81
|
export declare function switcherButtonVisible(kind: ViewSwitcherKind, modelVisible: boolean, pageVisible: boolean): boolean;
|
|
99
82
|
/** The data half of the `notify::selected` event (minus NS's `eventName`/`object`). */
|