@gjsify/adwaita-core 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/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 +2 -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 +2 -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/carousel.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
/** `SCROLL_TIMEOUT_DURATION`
|
|
1
|
+
/** `SCROLL_TIMEOUT_DURATION` — the lockout after a wheel step. */
|
|
2
2
|
export declare const CAROUSEL_SCROLL_TIMEOUT_MS = 150;
|
|
3
3
|
/**
|
|
4
|
-
* How close to a snap point counts as "
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* animation says so, while a renderer that lets the platform scroll (CSS
|
|
9
|
-
* scroll-snap, a NativeScript `ScrollView`) has only the offset, which lands on
|
|
10
|
-
* a sub-pixel value an exact compare would never match. A hundredth of a page is
|
|
11
|
-
* invisible and far tighter than the 0.02 the web port's old heuristic used.
|
|
4
|
+
* How close to a snap point counts as "arrived", in pages — {@link
|
|
5
|
+
* CarouselState.settleIfArrived}. Not a libadwaita constant: C knows a scroll finished
|
|
6
|
+
* from its own spring animation, while a renderer that lets the platform scroll (CSS
|
|
7
|
+
* scroll-snap, a NativeScript `ScrollView`) has only a sub-pixel offset.
|
|
12
8
|
*/
|
|
13
9
|
export declare const CAROUSEL_SETTLE_EPSILON = 0.01;
|
|
14
10
|
/** Which axis the carousel pages along — `GtkOrientable:orientation`. */
|
|
@@ -16,16 +12,16 @@ export type CarouselOrientation = 'horizontal' | 'vertical';
|
|
|
16
12
|
/** One keynav / wheel step — `AdwNavigationDirection`. */
|
|
17
13
|
export type CarouselDirection = 'back' | 'forward';
|
|
18
14
|
/**
|
|
19
|
-
* The `GdkInputSource` cases `scroll_cb` distinguishes
|
|
15
|
+
* The `GdkInputSource` cases `scroll_cb` distinguishes.
|
|
20
16
|
* Everything that is neither a touchpad nor a mouse behaves the same, so the
|
|
21
17
|
* three-way split is the whole vocabulary the rule needs.
|
|
22
18
|
*/
|
|
23
19
|
export type CarouselScrollSource = 'touchpad' | 'mouse' | 'other';
|
|
24
20
|
/** The scrollable interval a position is clamped into — `get_range`. */
|
|
25
21
|
export interface CarouselRange {
|
|
26
|
-
/** Always 0
|
|
22
|
+
/** Always 0. */
|
|
27
23
|
lower: number;
|
|
28
|
-
/** `MAX (0, position_shift + last snap point)
|
|
24
|
+
/** `MAX (0, position_shift + last snap point)`. */
|
|
29
25
|
upper: number;
|
|
30
26
|
}
|
|
31
27
|
/** Input to {@link carouselWheelStep} — one scroll event, already normalized. */
|
|
@@ -52,115 +48,83 @@ export interface CarouselReorderShiftInput {
|
|
|
52
48
|
}
|
|
53
49
|
/**
|
|
54
50
|
* The snap point of every page, from their reveal sizes:
|
|
55
|
-
* `snapPoint[i] = (Σ_{j≤i} size[j]) − 1` (`adw_carousel_size_allocate
|
|
56
|
-
* adw-carousel.c:777-789).
|
|
51
|
+
* `snapPoint[i] = (Σ_{j≤i} size[j]) − 1` (`adw_carousel_size_allocate`).
|
|
57
52
|
*
|
|
58
|
-
* Sizes are reveal FRACTIONS,
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* the following pages keep their positions while the new one grows in.
|
|
53
|
+
* Sizes are reveal FRACTIONS, so mid-animation snap points are fractional and a
|
|
54
|
+
* just-inserted page (size 0) pushes the first one NEGATIVE — legal, and what keeps the
|
|
55
|
+
* following pages in place while the new one grows in.
|
|
62
56
|
*/
|
|
63
57
|
export declare function carouselSnapPoints(sizes: readonly number[]): number[];
|
|
64
58
|
/**
|
|
65
59
|
* The inverse of {@link carouselSnapPoints}: `sizes[0] = points[0] + 1` and
|
|
66
|
-
* `sizes[i] = points[i] − points[i−1]
|
|
67
|
-
*
|
|
68
|
-
* This is the ONLY channel through which an indicator learns per-page reveal
|
|
69
|
-
* state — `AdwSwipeable` hands out snap points, never sizes — so an indicator
|
|
70
|
-
* that wants to fade a page in has to reconstruct them.
|
|
60
|
+
* `sizes[i] = points[i] − points[i−1]`. The ONLY channel by which an indicator learns
|
|
61
|
+
* per-page reveal state, since `AdwSwipeable` hands out snap points and never sizes.
|
|
71
62
|
*/
|
|
72
63
|
export declare function carouselSizesFromSnapPoints(points: readonly number[]): number[];
|
|
73
64
|
/**
|
|
74
|
-
* The scrollable range — `get_range`
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* it there (:219), so a shift large enough to cancel the last snap point
|
|
79
|
-
* collapses the range to `[0, 0]` rather than going negative.
|
|
65
|
+
* The scrollable range — `get_range`. `positionShift` is the pending compensation an
|
|
66
|
+
* insert/remove/reorder accumulates before the next allocation, and is part of the bound
|
|
67
|
+
* because C adds it there: a shift large enough to cancel the last snap point collapses
|
|
68
|
+
* the range to `[0, 0]` rather than going negative.
|
|
80
69
|
*/
|
|
81
70
|
export declare function carouselRange(snapPoints: readonly number[], positionShift?: number): CarouselRange;
|
|
82
71
|
/**
|
|
83
|
-
* `set_position`'s guard
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* Fractional positions pass through untouched: this bounds the scroll, it does
|
|
87
|
-
* not snap to a page. Uses GLib's `CLAMP`, which tests the HIGH bound first —
|
|
88
|
-
* the range here can never invert, but the primitive is the one C uses.
|
|
72
|
+
* `set_position`'s guard — the single clamp every position write goes through. Fractional
|
|
73
|
+
* positions pass through untouched: this bounds the scroll, it does not snap to a page.
|
|
74
|
+
* Uses GLib's `CLAMP`, which tests the HIGH bound first.
|
|
89
75
|
*/
|
|
90
76
|
export declare function carouselClampPosition(position: number, snapPoints: readonly number[], positionShift?: number): number;
|
|
91
77
|
/**
|
|
92
78
|
* The index of the snap point nearest `position`, `-1` for an empty list —
|
|
93
|
-
* `get_closest_child_at
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* `>`, so at an exact half-way position the EARLIER page wins. Exported rather
|
|
97
|
-
* than inlined because `get_closest_child_at` is called with four different
|
|
98
|
-
* include/exclude combinations of adding and removing children, and each caller
|
|
99
|
-
* must get the same tie-break.
|
|
79
|
+
* `get_closest_child_at`. C replaces its current best only on a strict `>`, so at an
|
|
80
|
+
* exact half-way position the EARLIER page wins. Exported because C calls it with four
|
|
81
|
+
* different adding/removing include combinations and each must get the same tie-break.
|
|
100
82
|
*/
|
|
101
83
|
export declare function carouselClosestSnapPoint(position: number, snapPoints: readonly number[]): number;
|
|
102
84
|
/**
|
|
103
|
-
* The page `position` settles on — `get_page_at_position
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* Returns `-1` for an empty carousel, matching `find_child_index` (:155) and the
|
|
107
|
-
* `page-changed` documentation, which spells that case out (:1150-1151).
|
|
108
|
-
*
|
|
109
|
-
* Rounds an exact `.5` DOWN, via {@link carouselClosestSnapPoint}. Do not
|
|
110
|
-
* "simplify" this to `Math.round`: that is what both ports did, and it disagrees
|
|
85
|
+
* The page `position` settles on — `get_page_at_position`: clamp into the range, then
|
|
86
|
+
* take the nearest snap point. `-1` for an empty carousel. Rounds an exact `.5` DOWN via
|
|
87
|
+
* {@link carouselClosestSnapPoint}; do not "simplify" it to `Math.round`, which disagrees
|
|
111
88
|
* with GTK on every half-way position.
|
|
112
89
|
*/
|
|
113
90
|
export declare function carouselPageAtPosition(position: number, snapPoints: readonly number[]): number;
|
|
114
91
|
/**
|
|
115
92
|
* The page an arrow key moves to, or `null` when the step is refused —
|
|
116
|
-
* `navigate_to_direction
|
|
93
|
+
* `navigate_to_direction`.
|
|
117
94
|
*
|
|
118
|
-
* `null` means C returned `FALSE`: an empty carousel, or already at the bound in
|
|
119
|
-
*
|
|
120
|
-
* `
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* path clamps (:567). With a position inside `[0, nPages − 1]` it is always in
|
|
124
|
-
* range; outside it, `adw_carousel_get_nth_page`'s precondition (:1616) is what
|
|
125
|
-
* rejects it, which is exactly what {@link CarouselState.scrollTo} does.
|
|
95
|
+
* `null` means C returned `FALSE`: an empty carousel, or already at the bound in that
|
|
96
|
+
* direction. Home/End are the same operation with targets `0` and `nPages − 1`
|
|
97
|
+
* (`keynav_bounds_cb`). The returned index is C's raw `index ± 1`, NOT clamped — only the
|
|
98
|
+
* WHEEL path clamps; outside `[0, nPages − 1]` `adw_carousel_get_nth_page`'s precondition
|
|
99
|
+
* rejects it, as {@link CarouselState.scrollTo} does.
|
|
126
100
|
*/
|
|
127
101
|
export declare function carouselNavigateTarget(position: number, nPages: number, direction: CarouselDirection): number | null;
|
|
128
102
|
/**
|
|
129
|
-
* How many pages one scroll event moves — `scroll_cb`'s axis rules
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* mouse — "mice often don't have easily accessible horizontal scrolling"
|
|
138
|
-
* (:540-542, :547-552);
|
|
139
|
-
* - the horizontal delta is a FALLBACK: consulted only for a horizontal
|
|
140
|
-
* carousel, and only when the vertical branch produced nothing (:554-559).
|
|
141
|
-
* The web port dropped it entirely by returning early on `|dy| <= |dx|`.
|
|
103
|
+
* How many pages one scroll event moves — `scroll_cb`'s axis rules. `0` means "propagate
|
|
104
|
+
* the event", the only case where C returns `GDK_EVENT_PROPAGATE` here. Three rules:
|
|
105
|
+
* - a TOUCHPAD source is always ignored, because its kinetic scrolling is already
|
|
106
|
+
* driving the swipe tracker;
|
|
107
|
+
* - the vertical delta counts when the carousel is vertical OR the source is a
|
|
108
|
+
* mouse — "mice often don't have easily accessible horizontal scrolling";
|
|
109
|
+
* - the horizontal delta is a FALLBACK: consulted only for a horizontal carousel,
|
|
110
|
+
* and only when the vertical branch produced nothing.
|
|
142
111
|
*/
|
|
143
112
|
export declare function carouselWheelStep(input: CarouselWheelInput): -1 | 0 | 1;
|
|
144
113
|
/**
|
|
145
|
-
* How far the position must move so the visible page does not jump when a page
|
|
146
|
-
*
|
|
147
|
-
* (
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* oldPoint`); it crossed the current position from after to before (`+size`, the
|
|
151
|
-
* content ahead grew by that page); or from before to after (`−size`). Anything
|
|
152
|
-
* that does not cross the position leaves it alone. Every comparison is
|
|
153
|
-
* epsilon-tolerant, because snap points are accumulated sums.
|
|
114
|
+
* How far the position must move so the visible page does not jump when a page is
|
|
115
|
+
* reordered — the `position_shift` delta of `adw_carousel_reorder`. Three branches: the
|
|
116
|
+
* moved page IS the current one (follow it, `newPoint − oldPoint`); it crossed the
|
|
117
|
+
* position from after to before (`+size`); or from before to after (`−size`). Anything
|
|
118
|
+
* that does not cross the position leaves it alone.
|
|
154
119
|
*/
|
|
155
120
|
export declare function carouselReorderShift(args: CarouselReorderShiftInput): number;
|
|
156
121
|
/**
|
|
157
|
-
* Which of C's three
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* that moved no position (:296, :1498).
|
|
122
|
+
* Which of C's three notification sites a {@link CarouselStateChange} came from;
|
|
123
|
+
* collapsing them into one opaque notification would lose what the GObject API has:
|
|
124
|
+
* - `position` — `set_position` notified `notify::position`;
|
|
125
|
+
* - `n-pages` — an insert or a remove notified `notify::n-pages`;
|
|
126
|
+
* - `geometry` — only `gtk_widget_queue_allocate` ran: a size or order change that
|
|
127
|
+
* moved no position.
|
|
164
128
|
*/
|
|
165
129
|
export type CarouselChangeReason = 'position' | 'n-pages' | 'geometry';
|
|
166
130
|
/** Payload of a {@link CarouselState} notification. */
|
|
@@ -172,10 +136,9 @@ export interface CarouselStateChange {
|
|
|
172
136
|
/** {@link carouselPageAtPosition} for the current position; `-1` when empty. */
|
|
173
137
|
page: number;
|
|
174
138
|
/**
|
|
175
|
-
* `true` for a user navigation (wheel, keynav,
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* two apart, not so a renderer can drop the notification.
|
|
139
|
+
* `true` for a user navigation (wheel, keynav, interactive scroll), `false` for a
|
|
140
|
+
* programmatic one. libadwaita notifies unconditionally — the flag lets a bound
|
|
141
|
+
* indicator tell the two apart, not a renderer drop the notification.
|
|
179
142
|
*/
|
|
180
143
|
interactive: boolean;
|
|
181
144
|
/** Which C notification site this corresponds to. */
|
|
@@ -186,12 +149,10 @@ export type CarouselStateListener = (change: CarouselStateChange) => void;
|
|
|
186
149
|
/** Subscriber for `page-changed` — `index` is `-1` for an empty carousel. */
|
|
187
150
|
export type CarouselPageChangedListener = (index: number) => void;
|
|
188
151
|
/**
|
|
189
|
-
* A scroll the state machine wants performed — the renderer seam, in the shape
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* and no renderer should redo that); the renderer owns HOW, because that is a
|
|
194
|
-
* DOM `scrollTo` on one side and a `scrollToHorizontalOffset` on the other.
|
|
152
|
+
* A scroll the state machine wants performed — the renderer seam, in the shape of
|
|
153
|
+
* `AdwToastQueueHandlers`' `onShow`/`onHide`. The core owns WHICH page is scrolled to
|
|
154
|
+
* and no renderer should redo that; the renderer owns HOW, because that is a DOM
|
|
155
|
+
* `scrollTo` on one side and a `scrollToHorizontalOffset` on the other.
|
|
195
156
|
*/
|
|
196
157
|
export interface CarouselScrollRequest {
|
|
197
158
|
/** Target page index, always a valid index into the non-removing pages. */
|
|
@@ -203,36 +164,30 @@ export interface CarouselScrollRequest {
|
|
|
203
164
|
/** Whether the renderer is expected to animate (and then call `settle()`). */
|
|
204
165
|
animate: boolean;
|
|
205
166
|
}
|
|
206
|
-
/**
|
|
207
|
-
* Construction seams and the libadwaita property DEFAULTS, which both ports got
|
|
208
|
-
* wrong or omitted.
|
|
209
|
-
*/
|
|
167
|
+
/** Construction seams and the libadwaita property DEFAULTS. */
|
|
210
168
|
export interface CarouselStateOptions {
|
|
211
|
-
/** `GtkOrientable:orientation`, default `'horizontal'
|
|
169
|
+
/** `GtkOrientable:orientation`, default `'horizontal'`. */
|
|
212
170
|
orientation?: CarouselOrientation;
|
|
213
|
-
/** `AdwCarousel:interactive`, default TRUE
|
|
171
|
+
/** `AdwCarousel:interactive`, default TRUE. Gates wheel + keynav. */
|
|
214
172
|
interactive?: boolean;
|
|
215
|
-
/** `AdwCarousel:allow-scroll-wheel`, default TRUE
|
|
173
|
+
/** `AdwCarousel:allow-scroll-wheel`, default TRUE. */
|
|
216
174
|
allowScrollWheel?: boolean;
|
|
217
|
-
/** `AdwCarousel:allow-long-swipes`, default FALSE
|
|
175
|
+
/** `AdwCarousel:allow-long-swipes`, default FALSE. */
|
|
218
176
|
allowLongSwipes?: boolean;
|
|
219
|
-
/** `AdwCarousel:spacing` in px, default 0
|
|
177
|
+
/** `AdwCarousel:spacing` in px, default 0. Feeds `distance`. */
|
|
220
178
|
spacing?: number;
|
|
221
|
-
/** `AdwCarousel:reveal-duration` in ms, default 0
|
|
179
|
+
/** `AdwCarousel:reveal-duration` in ms, default 0. */
|
|
222
180
|
revealDuration?: number;
|
|
223
181
|
/** Clock for the wheel lockout. Injected, never a global — default `Date.now`. */
|
|
224
182
|
now?: () => number;
|
|
225
183
|
/** Renderer seam invoked for every accepted {@link CarouselState.scrollTo}. */
|
|
226
184
|
onScrollTo?: (request: CarouselScrollRequest) => void;
|
|
227
185
|
/**
|
|
228
|
-
* Default for `adw_carousel_scroll_to`'s `animate` argument
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* and finish with {@link CarouselState.settle}. `false` (the default) is
|
|
234
|
-
* `do_scroll_to`'s skip path (:1541-1542): the position jumps to the target
|
|
235
|
-
* and `page-changed` fires at once.
|
|
186
|
+
* Default for `adw_carousel_scroll_to`'s `animate` argument. The core has no animator,
|
|
187
|
+
* so `true` means the RENDERER drives the ramp — `scrollTo` issues the
|
|
188
|
+
* {@link CarouselScrollRequest} and waits for positions fed back through
|
|
189
|
+
* {@link CarouselState.setPosition} then {@link CarouselState.settle}. `false` (the
|
|
190
|
+
* default) is `do_scroll_to`'s skip path: the position jumps and `page-changed` fires.
|
|
236
191
|
*/
|
|
237
192
|
animateScroll?: boolean;
|
|
238
193
|
}
|
|
@@ -249,17 +204,15 @@ export interface CarouselScrollOptions {
|
|
|
249
204
|
* lockout and the `page-changed` emission, once, for every renderer.
|
|
250
205
|
*
|
|
251
206
|
* The reveal ANIMATION is not here: a renderer feeds its eased values through
|
|
252
|
-
* {@link setPageSize}, and a carousel with the default `reveal-duration` of 0
|
|
253
|
-
*
|
|
254
|
-
* those sizes MEAN — snap points, the range, which page is current, and how far
|
|
255
|
-
* the position has to move so the visible page stays put.
|
|
207
|
+
* {@link setPageSize}, and a carousel with the default `reveal-duration` of 0 calls
|
|
208
|
+
* {@link skipReveal} instead.
|
|
256
209
|
*
|
|
257
|
-
* Two array shapes appear and they are
|
|
258
|
-
*
|
|
259
|
-
* (`adw_carousel_get_snap_points
|
|
260
|
-
* {@link
|
|
261
|
-
*
|
|
262
|
-
*
|
|
210
|
+
* Two array shapes appear and they are NOT the same length while a removal animates:
|
|
211
|
+
* {@link snapPoints} and {@link sizes} cover every tracked child
|
|
212
|
+
* (`adw_carousel_get_snap_points` walks all of them), while {@link nPages} and
|
|
213
|
+
* {@link indexOf} skip the ones being removed (`adw_carousel_get_n_pages`). That is
|
|
214
|
+
* C; an indicator that conflated them would drop a dot the moment a page started
|
|
215
|
+
* shrinking.
|
|
263
216
|
*/
|
|
264
217
|
export declare class CarouselState {
|
|
265
218
|
private readonly _children;
|
|
@@ -283,10 +236,10 @@ export declare class CarouselState {
|
|
|
283
236
|
constructor(options?: CarouselStateOptions);
|
|
284
237
|
/** Subscribe to state changes. Returns an unsubscribe function. */
|
|
285
238
|
subscribe(listener: CarouselStateListener): () => void;
|
|
286
|
-
/** Subscribe to `page-changed
|
|
239
|
+
/** Subscribe to `page-changed`. Returns an unsubscribe function. */
|
|
287
240
|
onPageChanged(listener: CarouselPageChangedListener): () => void;
|
|
288
241
|
private _emit;
|
|
289
|
-
/** Number of pages, skipping ones whose removal is still animating
|
|
242
|
+
/** Number of pages, skipping ones whose removal is still animating. */
|
|
290
243
|
get nPages(): number;
|
|
291
244
|
/** The ids of the pages that count towards {@link nPages}, in order. */
|
|
292
245
|
get ids(): readonly string[];
|
|
@@ -294,24 +247,22 @@ export declare class CarouselState {
|
|
|
294
247
|
get position(): number;
|
|
295
248
|
/** Every tracked child's reveal size, INCLUDING ones being removed. */
|
|
296
249
|
get sizes(): number[];
|
|
297
|
-
/** Every tracked child's snap point — `adw_carousel_get_snap_points
|
|
250
|
+
/** Every tracked child's snap point — `adw_carousel_get_snap_points`. */
|
|
298
251
|
get snapPoints(): number[];
|
|
299
252
|
/** The scrollable range the position is clamped into. */
|
|
300
253
|
get range(): CarouselRange;
|
|
301
254
|
/**
|
|
302
|
-
* Snap points of the pages that still count — the array every page LOOKUP
|
|
303
|
-
*
|
|
304
|
-
* (`get_closest_child_at (…, TRUE, FALSE)
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
* Their values still come from the full accumulation, so a shrinking page
|
|
255
|
+
* Snap points of the pages that still count — the array every page LOOKUP runs
|
|
256
|
+
* against, because `get_page_at_position` excludes removing children
|
|
257
|
+
* (`get_closest_child_at (…, TRUE, FALSE)`) and `find_child_index` numbers them out
|
|
258
|
+
* too. Their values still come from the full accumulation, so a shrinking page
|
|
308
259
|
* keeps pushing the pages after it until it reaches size 0.
|
|
309
260
|
*/
|
|
310
261
|
private _visibleSnapPoints;
|
|
311
262
|
/**
|
|
312
263
|
* The page `position` settles on, `-1` when the carousel is empty.
|
|
313
264
|
*
|
|
314
|
-
* C clamps against the FULL range here
|
|
265
|
+
* C clamps against the FULL range here while searching only the
|
|
315
266
|
* visible children; clamping against the visible points instead cannot
|
|
316
267
|
* change the answer, because snap points ascend and both clamps land at or
|
|
317
268
|
* beyond the last visible one, where the nearest visible point is the same.
|
|
@@ -320,70 +271,59 @@ export declare class CarouselState {
|
|
|
320
271
|
/**
|
|
321
272
|
* Index of the page with `id` among the pages that count, `-1` when it is
|
|
322
273
|
* unknown OR is being removed — `find_child_index (…, count_removing =
|
|
323
|
-
* FALSE)` skips a removing child before it ever compares
|
|
274
|
+
* FALSE)` skips a removing child before it ever compares.
|
|
324
275
|
*/
|
|
325
276
|
indexOf(id: string): number;
|
|
326
277
|
/**
|
|
327
278
|
* The snap point of the `index`-th page that counts, `undefined` when the
|
|
328
279
|
* index is out of range — `adw_carousel_get_nth_page` followed by reading
|
|
329
|
-
* `info->snap_point`, which is what `scroll_to` animates towards
|
|
330
|
-
* :392-393).
|
|
280
|
+
* `info->snap_point`, which is what `scroll_to` animates towards.
|
|
331
281
|
*
|
|
332
282
|
* A renderer needs this to tell "the scroll has arrived" from "the scroll is
|
|
333
283
|
* still moving", and it must not index {@link snapPoints} by a page index to
|
|
334
284
|
* get it: those two arrays disagree while a removal is animating.
|
|
335
285
|
*/
|
|
336
286
|
snapPointOf(index: number): number | undefined;
|
|
337
|
-
/** Full-list index of the `n`-th page that counts, `-1` when out of range — `get_nth_link
|
|
287
|
+
/** Full-list index of the `n`-th page that counts, `-1` when out of range — `get_nth_link`. */
|
|
338
288
|
private _nthLink;
|
|
339
289
|
/** Full-list index of the child nearest `position`, honouring C's include flags. */
|
|
340
290
|
private _closestChildIndex;
|
|
341
291
|
/**
|
|
342
|
-
* `update_shift_position_flag
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
* ones (:249), so the position still follows a page that is being removed
|
|
348
|
-
* while it is the active one.
|
|
292
|
+
* `update_shift_position_flag`: a page at or BEFORE the currently-shown one must
|
|
293
|
+
* drag the position along as it grows or shrinks, otherwise the visible page slides
|
|
294
|
+
* sideways under the user. The lookup deliberately EXCLUDES adding children and
|
|
295
|
+
* INCLUDES removing ones, so the position still follows a page being removed while
|
|
296
|
+
* it is the active one.
|
|
349
297
|
*/
|
|
350
298
|
private _updateShiftPositionFlag;
|
|
351
|
-
/** `set_position`'s per-child refresh of the shift flags
|
|
299
|
+
/** `set_position`'s per-child refresh of the shift flags. */
|
|
352
300
|
private _updateShiftFlags;
|
|
353
301
|
/**
|
|
354
|
-
* `set_position`
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
* the settle back onto the page it started from.
|
|
302
|
+
* `set_position` — clamp, store, refresh the shift flags, notify. Returns whether
|
|
303
|
+
* the stored value changed; the notification fires either way, because C's
|
|
304
|
+
* `g_object_notify_by_pspec` is unconditional and a bound indicator that only
|
|
305
|
+
* repaints on a CHANGE misses the settle back onto the page it started from.
|
|
359
306
|
*
|
|
360
|
-
* A non-finite position is refused outright and recorded in
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* contract — and letting one through is what left the NativeScript port with
|
|
364
|
-
* a NaN position and no active dot at all.
|
|
307
|
+
* A non-finite position is refused outright and recorded in {@link diagnostics}:
|
|
308
|
+
* `AdwCarousel:position` is a double declared over `[0, G_MAXDOUBLE]`, so NaN is
|
|
309
|
+
* outside the property's own contract.
|
|
365
310
|
*/
|
|
366
311
|
setPosition(position: number, interactive?: boolean): boolean;
|
|
367
312
|
/**
|
|
368
|
-
* Scroll to a page — `adw_carousel_get_nth_page` + `scroll_to
|
|
369
|
-
*
|
|
313
|
+
* Scroll to a page — `adw_carousel_get_nth_page` + `scroll_to`. Returns whether the
|
|
314
|
+
* scroll was accepted.
|
|
370
315
|
*
|
|
371
316
|
* Out-of-range, negative and non-integer indices are REFUSED, not clamped:
|
|
372
|
-
* `get_nth_page` fails its precondition and hands `scroll_to` a NULL widget,
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* in {@link diagnostics}, which is where `scrollToPage(NaN)` now ends up
|
|
376
|
-
* instead of in the position.
|
|
317
|
+
* `get_nth_page` fails its precondition and hands `scroll_to` a NULL widget, which
|
|
318
|
+
* returns before touching anything. Only the wheel path clamps, and it does so
|
|
319
|
+
* before it gets here. The refusal is recorded in {@link diagnostics}.
|
|
377
320
|
*/
|
|
378
321
|
scrollTo(index: number, options?: CarouselScrollOptions): boolean;
|
|
379
322
|
/**
|
|
380
|
-
* `scroll_animation_done_cb`
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* the page it started from, and with index `-1` when the carousel is empty —
|
|
385
|
-
* the case the signal's own documentation calls out (:1150-1151) and that the
|
|
386
|
-
* web port's index-change gate made unreachable.
|
|
323
|
+
* `scroll_animation_done_cb` — the scroll has come to rest, so emit `page-changed`
|
|
324
|
+
* with the page the position landed on. Emitted after EVERY completed scroll,
|
|
325
|
+
* including one that settles back onto the page it started from, and with index
|
|
326
|
+
* `-1` when the carousel is empty (a case the signal's documentation calls out).
|
|
387
327
|
*/
|
|
388
328
|
settle(): void;
|
|
389
329
|
/**
|
|
@@ -391,126 +331,111 @@ export declare class CarouselState {
|
|
|
391
331
|
* emits `page-changed` the first time the position comes to rest on a snap
|
|
392
332
|
* point, and re-arms as soon as it leaves one. Returns whether it emitted.
|
|
393
333
|
*
|
|
394
|
-
* A DEVIATION with a reason: `scroll_animation_done_cb`
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
* one-shot bookkeeping lives here rather than in two renderers, where it
|
|
399
|
-
* would be the third copy of the same idea to drift.
|
|
334
|
+
* A DEVIATION with a reason: `scroll_animation_done_cb` is driven by the spring
|
|
335
|
+
* animation finishing, and neither CSS scroll-snap nor a NativeScript `ScrollView`
|
|
336
|
+
* has an equivalent — both only report offsets. ARRIVAL at a snap point therefore
|
|
337
|
+
* stands in for "the animation finished".
|
|
400
338
|
*/
|
|
401
339
|
settleIfArrived(epsilon?: number): boolean;
|
|
402
340
|
/**
|
|
403
|
-
* One keynav step — `keynav_cb` → `navigate_to_direction
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
* calling `navigate_to_direction` (:588); `adw_carousel_scroll_to` is NOT
|
|
408
|
-
* gated, which is why {@link scrollTo} isn't either.
|
|
341
|
+
* One keynav step — `keynav_cb` → `navigate_to_direction`. Returns whether the
|
|
342
|
+
* carousel moved. The `interactive` gate lives here because `keynav_cb` checks it
|
|
343
|
+
* before calling `navigate_to_direction`; `adw_carousel_scroll_to` is NOT gated,
|
|
344
|
+
* which is why {@link scrollTo} isn't either.
|
|
409
345
|
*/
|
|
410
346
|
navigate(direction: CarouselDirection): boolean;
|
|
411
347
|
/**
|
|
412
|
-
* One scroll-wheel event — `scroll_cb`
|
|
413
|
-
*
|
|
414
|
-
*
|
|
348
|
+
* One scroll-wheel event — `scroll_cb`. Returns the step taken; `0` means the event
|
|
349
|
+
* was NOT consumed and must propagate, the only value for which C returns
|
|
350
|
+
* `GDK_EVENT_PROPAGATE`.
|
|
415
351
|
*
|
|
416
352
|
* The four gates run in C's order — the property, the 150 ms lockout,
|
|
417
|
-
* `interactive`,
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
* and still arms the lockout, exactly as C does.
|
|
353
|
+
* `interactive`, an empty carousel — then the axis rules, then one clamped page step
|
|
354
|
+
* and a fresh lockout. A step refused by the clamp (already on the last page) still
|
|
355
|
+
* consumes the event and still arms the lockout, exactly as C does.
|
|
421
356
|
*/
|
|
422
357
|
handleWheel(input: Omit<CarouselWheelInput, 'orientation'>): -1 | 0 | 1;
|
|
423
358
|
/**
|
|
424
|
-
* `adw_carousel_insert
|
|
425
|
-
* was added.
|
|
359
|
+
* `adw_carousel_insert`. Returns whether the page was added.
|
|
426
360
|
*
|
|
427
|
-
* `position` is `-1` (append, the default) or an index to insert BEFORE; an
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* fails C's precondition (:1381) and is recorded instead.
|
|
361
|
+
* `position` is `-1` (append, the default) or an index to insert BEFORE; an index
|
|
362
|
+
* past the end appends too, because `get_nth_link` returns NULL there. Anything
|
|
363
|
+
* below `-1` fails C's precondition and is recorded instead.
|
|
431
364
|
*
|
|
432
|
-
* The page starts at size 0 and `adding`
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
365
|
+
* The page starts at size 0 and `adding` — it occupies no geometry yet, which is
|
|
366
|
+
* what pushes the first snap point negative. A renderer either ramps it with
|
|
367
|
+
* {@link setPageSize} or, with the default `reveal-duration` of 0, finishes it at
|
|
368
|
+
* once with {@link skipReveal}.
|
|
436
369
|
*/
|
|
437
370
|
insertPage(id: string, position?: number): boolean;
|
|
438
371
|
/**
|
|
439
|
-
* `adw_carousel_remove
|
|
440
|
-
* removed.
|
|
372
|
+
* `adw_carousel_remove`. Returns whether a page was removed.
|
|
441
373
|
*
|
|
442
|
-
* The page leaves {@link nPages} immediately
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
* because the banked shift and the geometry it paid for are freed together.
|
|
374
|
+
* The page leaves {@link nPages} immediately but keeps its geometry until its size
|
|
375
|
+
* reaches 0, so the pages after it slide over instead of jumping. A page still
|
|
376
|
+
* ANIMATING IN disappears at once instead: `animate_child_resize` skips the
|
|
377
|
+
* in-flight reveal, and finishing it runs `resize_animation_done_cb`, which frees a
|
|
378
|
+
* removing child on the spot. C runs that skipped reveal to its target first and
|
|
379
|
+
* banks the shift; dropping the child outright lands in the same state, because the
|
|
380
|
+
* banked shift and the geometry it paid for are freed together.
|
|
450
381
|
*/
|
|
451
382
|
removePage(id: string): boolean;
|
|
452
383
|
/**
|
|
453
|
-
* `adw_carousel_reorder
|
|
454
|
-
* moved.
|
|
384
|
+
* `adw_carousel_reorder`. Returns whether the page moved.
|
|
455
385
|
*
|
|
456
|
-
* `position` is `-1` or past the end for "move to the end". The three
|
|
457
|
-
*
|
|
458
|
-
* the page
|
|
459
|
-
*
|
|
460
|
-
* The position compensation is {@link carouselReorderShift}.
|
|
386
|
+
* `position` is `-1` or past the end for "move to the end". The three early-outs are
|
|
387
|
+
* C's and are not interchangeable: a `position` equal to the page's CURRENT one
|
|
388
|
+
* returns before normalisation, and moving the last page to the end is a no-op
|
|
389
|
+
* checked after it. The position compensation is {@link carouselReorderShift}.
|
|
461
390
|
*/
|
|
462
391
|
reorderPage(id: string, position: number): boolean;
|
|
463
392
|
/**
|
|
464
|
-
* Feed one frame of a page's reveal animation —
|
|
465
|
-
* `
|
|
466
|
-
* Returns whether the size was applied.
|
|
393
|
+
* Feed one frame of a page's reveal animation — `resize_animation_value_cb` +
|
|
394
|
+
* `resize_animation_done_cb`. Returns whether the size was applied.
|
|
467
395
|
*
|
|
468
|
-
* A size change on a page at or before the current one moves the position by
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
396
|
+
* A size change on a page at or before the current one moves the position by the
|
|
397
|
+
* same delta, which keeps the visible page still while a page grows in ahead of it.
|
|
398
|
+
* C banks that delta in `position_shift` and applies it at the next `size_allocate`;
|
|
399
|
+
* with no allocation cycle to wait for it is applied here — the settled state is
|
|
400
|
+
* identical.
|
|
473
401
|
*
|
|
474
|
-
* Reaching the animation's target ENDS it: a page that arrives at 1 stops
|
|
475
|
-
*
|
|
476
|
-
* the geometry (:306-313).
|
|
402
|
+
* Reaching the animation's target ENDS it: a page that arrives at 1 stops being
|
|
403
|
+
* `adding`, one that arrives at 0 while removing is dropped from the geometry.
|
|
477
404
|
*/
|
|
478
405
|
setPageSize(id: string, size: number): boolean;
|
|
479
406
|
/**
|
|
480
|
-
* Finish a page's pending reveal or removal at once — `adw_animation_skip
|
|
481
|
-
*
|
|
407
|
+
* Finish a page's pending reveal or removal at once — `adw_animation_skip`,
|
|
408
|
+
* which jumps a timed animation to its target value.
|
|
482
409
|
*
|
|
483
|
-
* This is the whole reveal for a carousel with the default `reveal-duration`
|
|
484
|
-
*
|
|
485
|
-
* "which value does this page animate TO" rule out of both of them. Returns
|
|
486
|
-
* whether anything was pending.
|
|
410
|
+
* This is the whole reveal for a carousel with the default `reveal-duration` of 0.
|
|
411
|
+
* Returns whether anything was pending.
|
|
487
412
|
*
|
|
488
|
-
* An unknown id is NOT a diagnostic here, unlike everywhere else: removing a
|
|
489
|
-
*
|
|
490
|
-
*
|
|
413
|
+
* An unknown id is NOT a diagnostic here, unlike everywhere else: removing a page
|
|
414
|
+
* that was still revealing frees it on the spot, so a renderer that finishes what it
|
|
415
|
+
* just removed legitimately finds nothing.
|
|
491
416
|
*/
|
|
492
417
|
skipReveal(id: string): boolean;
|
|
493
418
|
/** `GtkOrientable:orientation` — which axis the carousel pages along. */
|
|
494
419
|
get orientation(): CarouselOrientation;
|
|
495
|
-
/** Set the orientation. Returns whether it changed
|
|
420
|
+
/** Set the orientation. Returns whether it changed. */
|
|
496
421
|
setOrientation(orientation: CarouselOrientation): boolean;
|
|
497
422
|
/** `AdwCarousel:interactive` — whether the carousel can be navigated at all. */
|
|
498
423
|
get interactive(): boolean;
|
|
499
|
-
/** Set `interactive`. Returns whether it changed
|
|
424
|
+
/** Set `interactive`. Returns whether it changed. */
|
|
500
425
|
setInteractive(value: boolean): boolean;
|
|
501
|
-
/** `AdwCarousel:allow-scroll-wheel` — default TRUE
|
|
426
|
+
/** `AdwCarousel:allow-scroll-wheel` — default TRUE. */
|
|
502
427
|
get allowScrollWheel(): boolean;
|
|
503
|
-
/** Set `allow-scroll-wheel`. Returns whether it changed
|
|
428
|
+
/** Set `allow-scroll-wheel`. Returns whether it changed. */
|
|
504
429
|
setAllowScrollWheel(value: boolean): boolean;
|
|
505
430
|
/**
|
|
506
431
|
* `AdwCarousel:allow-long-swipes` — whether one flick may cross more than one
|
|
507
|
-
* snap point. Forwarded to the swipe tracker in C
|
|
432
|
+
* snap point. Forwarded to the swipe tracker in C; the state
|
|
508
433
|
* machine only carries it, because the gesture itself is the renderer's.
|
|
509
434
|
*/
|
|
510
435
|
get allowLongSwipes(): boolean;
|
|
511
436
|
/** Set `allow-long-swipes`. Returns whether it changed. */
|
|
512
437
|
setAllowLongSwipes(value: boolean): boolean;
|
|
513
|
-
/** `AdwCarousel:spacing` in px — the gap between pages, part of `distance
|
|
438
|
+
/** `AdwCarousel:spacing` in px — the gap between pages, part of `distance`. */
|
|
514
439
|
get spacing(): number;
|
|
515
440
|
/** Set `spacing`. Returns whether it changed. A `guint` in C, so negatives are refused. */
|
|
516
441
|
setSpacing(spacing: number): boolean;
|
|
@@ -519,17 +444,15 @@ export declare class CarouselState {
|
|
|
519
444
|
/** Set `reveal-duration`. Returns whether it changed. A `guint` in C. */
|
|
520
445
|
setRevealDuration(ms: number): boolean;
|
|
521
446
|
/**
|
|
522
|
-
* The px distance between two page origins — `self->distance
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
* carousel's own axis.
|
|
447
|
+
* The px distance between two page origins — `self->distance`, the unit a renderer
|
|
448
|
+
* converts a position into a scroll offset with. `pageLength` is the measured size of
|
|
449
|
+
* the largest page along the carousel's own axis.
|
|
526
450
|
*/
|
|
527
451
|
pageDistance(pageLength: number): number;
|
|
528
452
|
/**
|
|
529
|
-
* Every warning C would have printed, in order —
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
* of on stderr; both ports swallowed all of them.
|
|
453
|
+
* Every warning C would have printed, in order — refused scroll targets, bad
|
|
454
|
+
* insert/reorder positions, unknown page ids, non-finite values. Data rather than
|
|
455
|
+
* stderr so a test can assert on the CLASS of mistake.
|
|
533
456
|
*/
|
|
534
457
|
get diagnostics(): readonly string[];
|
|
535
458
|
}
|