@gjsify/adwaita-core 0.51.1 → 0.52.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/box.js +1 -0
- package/lib/esm/conformance/box.js +1 -0
- package/lib/esm/conformance/dialog.js +1 -1
- package/lib/esm/conformance/index.js +1 -1
- package/lib/esm/conformance/label.js +1 -0
- package/lib/esm/conformance/rows.js +1 -1
- package/lib/esm/conformance/shared-trees.js +1 -1
- package/lib/esm/conformance/tags.js +1 -0
- package/lib/esm/conformance/value-lists.js +1 -0
- package/lib/esm/dialog.js +1 -1
- package/lib/esm/gio-menu.js +1 -0
- package/lib/esm/gtk-adjustment.js +1 -0
- package/lib/esm/gtk-string-list.js +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/label.js +1 -0
- package/lib/esm/markup.js +4 -0
- package/lib/esm/rows.js +1 -1
- package/lib/esm/source.js +1 -0
- package/lib/esm/tags.js +1 -0
- package/lib/esm/tokens.generated.js +1 -1
- package/lib/types/box.d.ts +18 -0
- package/lib/types/box.spec.d.ts +2 -0
- package/lib/types/conformance/box.d.ts +21 -0
- package/lib/types/conformance/dialog.d.ts +123 -1
- package/lib/types/conformance/index.d.ts +14 -6
- package/lib/types/conformance/label.d.ts +115 -0
- package/lib/types/conformance/rows.d.ts +29 -0
- package/lib/types/conformance/shared-trees.d.ts +155 -5
- package/lib/types/conformance/tags.d.ts +46 -0
- package/lib/types/conformance/value-lists.d.ts +19 -0
- package/lib/types/dialog.d.ts +163 -0
- package/lib/types/gio-menu.d.ts +46 -0
- package/lib/types/gtk-adjustment.d.ts +73 -0
- package/lib/types/gtk-adjustment.spec.d.ts +2 -0
- package/lib/types/gtk-string-list.d.ts +70 -0
- package/lib/types/gtk-string-list.spec.d.ts +2 -0
- package/lib/types/index.d.ts +14 -3
- package/lib/types/label.d.ts +135 -0
- package/lib/types/label.spec.d.ts +2 -0
- package/lib/types/markup.d.ts +14 -0
- package/lib/types/markup.spec.d.ts +2 -0
- package/lib/types/rows.d.ts +20 -0
- package/lib/types/source.d.ts +94 -0
- package/lib/types/source.spec.d.ts +2 -0
- package/lib/types/tags.d.ts +48 -0
- package/lib/types/tags.spec.d.ts +2 -0
- package/lib/types/tokens.generated.d.ts +1 -1
- package/package.json +12 -4
package/lib/types/dialog.d.ts
CHANGED
|
@@ -152,6 +152,127 @@ export interface BottomSheetCloseState {
|
|
|
152
152
|
* Neither can fire on a closed sheet, so neither signals anything.
|
|
153
153
|
*/
|
|
154
154
|
export declare function resolveBottomSheetClose(source: BottomSheetCloseSource, state: BottomSheetCloseState): BottomSheetCloseOutcome;
|
|
155
|
+
/**
|
|
156
|
+
* Which affordance asked a bottom sheet to OPEN.
|
|
157
|
+
*
|
|
158
|
+
* libadwaita gives a user exactly ONE surface to open a sheet from — the bottom bar. Both
|
|
159
|
+
* doors into it are gated by `can-open`, and both are unreachable without a bar:
|
|
160
|
+
*
|
|
161
|
+
* - `'bottom-bar'` — a click on the bar. The bin IS a `GtkButton`
|
|
162
|
+
* (adw-bottom-sheet.c:1203) whose own click gesture is put in
|
|
163
|
+
* `GTK_PHASE_NONE` by `disable_button_click` (:1209), so a pointer press
|
|
164
|
+
* runs `bottom_bar_released_cb` (:263-284) and a keyboard activation
|
|
165
|
+
* runs `bottom_bar_clicked_cb` (:402-407). Same verdict from both.
|
|
166
|
+
* - `'swipe'` — an upward swipe off the bar (`prepare_cb`, :1052-1053).
|
|
167
|
+
* - `'drag-handle'` — the pill, decorative exactly as in the dismissal gate.
|
|
168
|
+
*/
|
|
169
|
+
export type BottomSheetOpenSource = 'bottom-bar' | 'swipe' | 'drag-handle';
|
|
170
|
+
/**
|
|
171
|
+
* What a renderer must do about an open request. There is no `'open-attempt'`: libadwaita
|
|
172
|
+
* has no signal for a refused open, so a sheet that will not open is silent.
|
|
173
|
+
*/
|
|
174
|
+
export type BottomSheetOpenOutcome = 'open' | 'ignored';
|
|
175
|
+
/**
|
|
176
|
+
* What {@link resolveBottomSheetOpen} decides from — the SAME four properties the chrome is
|
|
177
|
+
* derived from, which is the finding rather than a convenience: whether a user can open the
|
|
178
|
+
* sheet is exactly the question of whether the bar is on screen and not inert.
|
|
179
|
+
*/
|
|
180
|
+
export type BottomSheetOpenState = BottomSheetChromeState;
|
|
181
|
+
/**
|
|
182
|
+
* The open decision table.
|
|
183
|
+
*
|
|
184
|
+
* Only ONE of the four inputs is a branch inside a callback — `can_open`. The other three
|
|
185
|
+
* are REACHABILITY, which is why a port that reads only the callbacks gets them wrong:
|
|
186
|
+
*
|
|
187
|
+
* - no bottom bar: the stack never switches to the bin (`show_bottom_bar` returns before the
|
|
188
|
+
* switch, adw-bottom-sheet.c:294-295; `set_bottom_bar` puts `sheet_page` back, :1615-1616),
|
|
189
|
+
* and the swipe area is a ZERO-HEIGHT rectangle at progress 0 because `bottom_bar_height`
|
|
190
|
+
* is 0 (`get_swipe_area`, :1412-1433). Upstream states the consequence outright — `can-open`
|
|
191
|
+
* "does nothing if [property@BottomSheet:bottom-bar] is not set" (:2013).
|
|
192
|
+
* - already open: `set_open (TRUE)` switches the stack away from the bin (:1701-1702), so
|
|
193
|
+
* there is nothing to click, and `prepare_cb` reads an open sheet's gesture as a CLOSE
|
|
194
|
+
* (:1050-1051) rather than a second open.
|
|
195
|
+
* - bar not revealed: at progress 0 `reveal_animation_done_cb` makes the whole sheet bin
|
|
196
|
+
* child-invisible (:362-364, and the same expression at :341-343), so the bar is off screen.
|
|
197
|
+
*
|
|
198
|
+
* `can_open` itself is NOT reachability: the bin stays focusable and merely gains the `inert`
|
|
199
|
+
* style class (:2033-2036), which is why {@link BottomSheetChrome.bottomBarInert} is a class
|
|
200
|
+
* to paint rather than a widget to disable.
|
|
201
|
+
*/
|
|
202
|
+
export declare function resolveBottomSheetOpen(source: BottomSheetOpenSource, state: BottomSheetOpenState): BottomSheetOpenOutcome;
|
|
203
|
+
/** Which of the sheet bin's two stack children is showing (`sheet_stack`). */
|
|
204
|
+
export type BottomSheetLayer = 'sheet' | 'bottom-bar';
|
|
205
|
+
/** What {@link resolveBottomSheetChrome} decides from. */
|
|
206
|
+
export interface BottomSheetChromeState {
|
|
207
|
+
/** `AdwBottomSheet:open`. */
|
|
208
|
+
open: boolean;
|
|
209
|
+
/** `AdwBottomSheet:can-open`. */
|
|
210
|
+
canOpen: boolean;
|
|
211
|
+
/** Whether `AdwBottomSheet:bottom-bar` is set. */
|
|
212
|
+
hasBottomBar: boolean;
|
|
213
|
+
/** `AdwBottomSheet:reveal-bottom-bar`; absent means revealed. */
|
|
214
|
+
revealBottomBar?: boolean;
|
|
215
|
+
/** `AdwBottomSheet:modal`; absent means modal, the pspec default (adw-bottom-sheet.c:1128). */
|
|
216
|
+
modal?: boolean;
|
|
217
|
+
}
|
|
218
|
+
/** What a renderer has to put on screen for a given state. */
|
|
219
|
+
export interface BottomSheetChrome {
|
|
220
|
+
/** Which stack child the sheet bin shows. */
|
|
221
|
+
layer: BottomSheetLayer;
|
|
222
|
+
/** Whether the sheet bin is on screen at all (`gtk_widget_set_child_visible`). */
|
|
223
|
+
surfaceVisible: boolean;
|
|
224
|
+
/** Whether the bar carries the `inert` style class — still clickable, just refusing. */
|
|
225
|
+
bottomBarInert: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Whether the dimming layer covers the content — the scrim a click on dismisses through
|
|
228
|
+
* the `'dimming'` source. Only a MODAL sheet has one on screen.
|
|
229
|
+
*/
|
|
230
|
+
dimmed: boolean;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The bin's resting appearance: which child shows, whether the bin is on screen, and whether
|
|
234
|
+
* the bar looks inert.
|
|
235
|
+
*
|
|
236
|
+
* RESTING is the whole simplification. In C these follow `progress` across
|
|
237
|
+
* `CHILD_SWITCH_THRESHOLD` mid-animation (`open_animation_cb`, adw-bottom-sheet.c:322-330);
|
|
238
|
+
* with no spring animation the settled progress IS `open`, so `showing_bottom_bar` reduces to
|
|
239
|
+
* `!open` — which is also its init value (:1131) for a sheet that starts closed.
|
|
240
|
+
*
|
|
241
|
+
* The dimming reduces the same way. `set_open (TRUE)` makes it child-visible exactly when the
|
|
242
|
+
* sheet is modal (:1686-1687), `set_modal` re-applies that while the sheet is not settled closed
|
|
243
|
+
* (:1981-1982), and the close animation hides it once it settles (:338-339). At rest that is
|
|
244
|
+
* `open && modal`; the opacity ramp between is the animation this model does not run.
|
|
245
|
+
*/
|
|
246
|
+
export declare function resolveBottomSheetChrome(state: BottomSheetChromeState): BottomSheetChrome;
|
|
247
|
+
/** What {@link resolveBottomSheetSwipeTracker} decides from. */
|
|
248
|
+
export interface BottomSheetSwipeTrackerState {
|
|
249
|
+
/** `AdwBottomSheet:can-open`. */
|
|
250
|
+
canOpen: boolean;
|
|
251
|
+
/** `AdwBottomSheet:can-close`. */
|
|
252
|
+
canClose: boolean;
|
|
253
|
+
/** Whether `AdwBottomSheet:bottom-bar` is set. */
|
|
254
|
+
hasBottomBar: boolean;
|
|
255
|
+
/** `AdwBottomSheet:show-drag-handle`. */
|
|
256
|
+
showDragHandle: boolean;
|
|
257
|
+
}
|
|
258
|
+
/** The three `AdwSwipeTracker` settings `update_swipe_tracker` writes. */
|
|
259
|
+
export interface BottomSheetSwipeTrackerConfig {
|
|
260
|
+
/** Whether the tracker recognises a gesture at all. */
|
|
261
|
+
enabled: boolean;
|
|
262
|
+
/** Whether a mouse drag counts, not only touch. */
|
|
263
|
+
allowMouseDrag: boolean;
|
|
264
|
+
/** Whether the gesture may overshoot below the closed position. */
|
|
265
|
+
lowerOvershoot: boolean;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* `update_swipe_tracker` (adw-bottom-sheet.c:450-460) as a pure function.
|
|
269
|
+
*
|
|
270
|
+
* `enabled` is the line that decides whether a bottom sheet can be opened by gesture at all:
|
|
271
|
+
* `(can_open && bottom_bar != NULL) || can_close`. The `&& bottom_bar` conjunct is why
|
|
272
|
+
* `can-open` alone buys nothing — with no bar the only live arm is `can_close`, i.e. the
|
|
273
|
+
* tracker exists solely to CLOSE.
|
|
274
|
+
*/
|
|
275
|
+
export declare function resolveBottomSheetSwipeTracker(state: BottomSheetSwipeTrackerState): BottomSheetSwipeTrackerConfig;
|
|
155
276
|
/** One entry in a {@link BottomSheetPresentation}'s teardown callback pair. */
|
|
156
277
|
export type BottomSheetTeardownCallback = 'closing' | 'closed';
|
|
157
278
|
/** Subscriber for {@link BottomSheetPresentation} `open` changes. */
|
|
@@ -180,10 +301,18 @@ export interface BottomSheetPresentationOptions {
|
|
|
180
301
|
* still be closed using [property@BottomSheet:open]"); {@link requestClose} is the INTERACTIVE
|
|
181
302
|
* path that runs the gate. Keeping them apart is what lets a locked sheet still be closed by
|
|
182
303
|
* its owner.
|
|
304
|
+
*
|
|
305
|
+
* The same split holds the other way round: {@link requestOpen} is the user's path and runs
|
|
306
|
+
* {@link resolveBottomSheetOpen}, so a sheet with no bottom bar cannot be opened by a user at
|
|
307
|
+
* all, while its owner's `setOpen(true)` still works.
|
|
183
308
|
*/
|
|
184
309
|
export declare class BottomSheetPresentation {
|
|
185
310
|
private _open;
|
|
186
311
|
private _canClose;
|
|
312
|
+
private _canOpen;
|
|
313
|
+
private _hasBottomBar;
|
|
314
|
+
private _revealBottomBar;
|
|
315
|
+
private _modal;
|
|
187
316
|
private _hasBeenOpen;
|
|
188
317
|
private readonly _listeners;
|
|
189
318
|
private readonly _onClosing;
|
|
@@ -201,8 +330,36 @@ export declare class BottomSheetPresentation {
|
|
|
201
330
|
* {@link setOpen}; `has_been_open` in the C source.
|
|
202
331
|
*/
|
|
203
332
|
get hasBeenOpen(): boolean;
|
|
333
|
+
/** Whether the user may open the sheet from its bottom bar (`AdwBottomSheet:can-open`). */
|
|
334
|
+
get canOpen(): boolean;
|
|
335
|
+
/** Whether a bottom bar is set (`AdwBottomSheet:bottom-bar` is non-NULL). */
|
|
336
|
+
get hasBottomBar(): boolean;
|
|
337
|
+
/** Whether the bottom bar is revealed (`AdwBottomSheet:reveal-bottom-bar`). */
|
|
338
|
+
get revealBottomBar(): boolean;
|
|
339
|
+
/** Whether the sheet dims and blocks the content while open (`AdwBottomSheet:modal`). */
|
|
340
|
+
get modal(): boolean;
|
|
341
|
+
/** What the renderer has to show for the current state — {@link resolveBottomSheetChrome}. */
|
|
342
|
+
get chrome(): BottomSheetChrome;
|
|
204
343
|
/** Set `can-close`. Returns whether it changed. */
|
|
205
344
|
setCanClose(canClose: boolean): boolean;
|
|
345
|
+
/** Set `can-open`. Returns whether it changed. */
|
|
346
|
+
setCanOpen(canOpen: boolean): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Record whether a bottom bar is present. Returns whether it changed.
|
|
349
|
+
*
|
|
350
|
+
* A renderer calls this from wherever it adopts the bar widget — the C setter is where
|
|
351
|
+
* `update_swipe_tracker` is re-run (adw-bottom-sheet.c:1629), i.e. presence is an INPUT to
|
|
352
|
+
* the gates, not a rendering detail.
|
|
353
|
+
*/
|
|
354
|
+
setHasBottomBar(hasBottomBar: boolean): boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Set `modal`. Returns whether it changed. A sheet that is open changes its dimming at
|
|
357
|
+
* once, as `adw_bottom_sheet_set_modal` does (adw-bottom-sheet.c:1981-1982); `open` and
|
|
358
|
+
* the gates do not move, so nothing is notified here — the renderer repaints.
|
|
359
|
+
*/
|
|
360
|
+
setModal(modal: boolean): boolean;
|
|
361
|
+
/** Set `reveal-bottom-bar`. Returns whether it changed. */
|
|
362
|
+
setRevealBottomBar(reveal: boolean): boolean;
|
|
206
363
|
/**
|
|
207
364
|
* The programmatic open/close — `adw_bottom_sheet_set_open`. Returns whether `open`
|
|
208
365
|
* changed, i.e. whether a `notify::open` was emitted.
|
|
@@ -218,6 +375,12 @@ export declare class BottomSheetPresentation {
|
|
|
218
375
|
* forwarded to the parent, or nothing at all.
|
|
219
376
|
*/
|
|
220
377
|
requestClose(source: BottomSheetCloseSource): BottomSheetCloseOutcome;
|
|
378
|
+
/**
|
|
379
|
+
* Route an open affordance through {@link resolveBottomSheetOpen} and APPLY the outcome.
|
|
380
|
+
* `'ignored'` is the only other answer, and it is silent: libadwaita has no
|
|
381
|
+
* `open-attempt` counterpart to `close-attempt`, so a renderer emits nothing for it.
|
|
382
|
+
*/
|
|
383
|
+
requestOpen(source: BottomSheetOpenSource): BottomSheetOpenOutcome;
|
|
221
384
|
/**
|
|
222
385
|
* The sheet has finished hiding — `open_animation_done_cb`'s teardown reduced to what a
|
|
223
386
|
* renderer without a spring animation can observe. Fires `onClosed` and returns whether it
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AdwMenuEntryInput, AdwMenuItemInput } from './menu.js';
|
|
2
|
+
/**
|
|
3
|
+
* One menu item, built the way `g_menu_item_new` builds one.
|
|
4
|
+
*
|
|
5
|
+
* IT IS ITSELF A PORTABLE ENTRY — `implements AdwMenuItemInput` — so `append_item` pushes
|
|
6
|
+
* the instance and `normalizeMenuModel` reads its fields like any authored object. A
|
|
7
|
+
* separate internal shape would need a conversion the model does not ask for.
|
|
8
|
+
*
|
|
9
|
+
* Both halves are nullable, as they are in C: `g_menu_item_new(NULL, NULL)` is legal and
|
|
10
|
+
* produces an item carrying neither, which {@link normalizeMenuModel} drops rather than
|
|
11
|
+
* drawing an empty, unactionable row.
|
|
12
|
+
*/
|
|
13
|
+
export declare class GioMenuItem implements AdwMenuItemInput {
|
|
14
|
+
/** The user-visible string; ABSENT rather than `undefined` when the item has none. */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** The DETAILED action name — `app.save-as`, `app.view::list` (ADR 0042 § divergence 2). */
|
|
17
|
+
action?: string;
|
|
18
|
+
constructor(label?: string | null, detailedAction?: string | null);
|
|
19
|
+
/** `g_menu_item_set_label`. `null` REMOVES the attribute, which is what C does. */
|
|
20
|
+
set_label(label: string | null): void;
|
|
21
|
+
/** `g_menu_item_set_detailed_action`, and `null` is `g_menu_item_set_action_and_target(…, NULL)`. */
|
|
22
|
+
set_detailed_action(detailedAction: string | null): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A menu under construction — `Gio.Menu`'s four append entry points over the portable model.
|
|
26
|
+
*
|
|
27
|
+
* `new GioMenu()` is empty, as `g_menu_new()` is. Every `append*` puts one entry on the end,
|
|
28
|
+
* and the instance IS the value a `menuModel` property takes.
|
|
29
|
+
*/
|
|
30
|
+
export declare class GioMenu extends Array<AdwMenuEntryInput> {
|
|
31
|
+
/** `g_menu_append` — the convenience C implements as `menu_item_new` + `append_item`. */
|
|
32
|
+
append(label: string | null, detailedAction?: string | null): void;
|
|
33
|
+
/** `g_menu_append_item`. */
|
|
34
|
+
append_item(item: GioMenuItem): void;
|
|
35
|
+
/**
|
|
36
|
+
* `g_menu_append_section` — the `section` LINK, whose items are drawn inline with a
|
|
37
|
+
* separator rather than behind a further click.
|
|
38
|
+
*
|
|
39
|
+
* The label is optional in C and stays optional here: a section with none is a plain
|
|
40
|
+
* group, and writing `label: null` onto the entry would be an attribute the model
|
|
41
|
+
* then has to ignore.
|
|
42
|
+
*/
|
|
43
|
+
append_section(label: string | null, section: readonly AdwMenuEntryInput[]): void;
|
|
44
|
+
/** `g_menu_append_submenu` — the `submenu` LINK: a nested menu the user opens. */
|
|
45
|
+
append_submenu(label: string | null, submenu: readonly AdwMenuEntryInput[]): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AdwAdjustment, AdwAdjustmentInput } from './adjustment.js';
|
|
2
|
+
/**
|
|
3
|
+
* What `new Gtk.Adjustment({ … })` takes: the GJS construct bag, which is exactly
|
|
4
|
+
* {@link AdwAdjustmentInput}.
|
|
5
|
+
*
|
|
6
|
+
* An ALIAS and not a second interface — the two would be one declaration copied, and the
|
|
7
|
+
* copy is the one that drifts when a seventh field arrives.
|
|
8
|
+
*/
|
|
9
|
+
export type GtkAdjustmentProps = AdwAdjustmentInput;
|
|
10
|
+
/**
|
|
11
|
+
* A numeric range — `Gtk.Adjustment`'s six properties as a value an `adjustment` property
|
|
12
|
+
* takes.
|
|
13
|
+
*
|
|
14
|
+
* `new GtkAdjustment()` is `ADW_ADJUSTMENT_DEFAULTS` (0…100 step 1), which is the
|
|
15
|
+
* package's own default and NOT GTK's 0…0 step 0 — `adjustment.ts` says why in its header.
|
|
16
|
+
*/
|
|
17
|
+
export declare class GtkAdjustment implements AdwAdjustment {
|
|
18
|
+
/** The current value, within {@link adjustmentRange}. */
|
|
19
|
+
value: number;
|
|
20
|
+
/** The minimum value. */
|
|
21
|
+
lower: number;
|
|
22
|
+
/** The maximum value. */
|
|
23
|
+
upper: number;
|
|
24
|
+
/** How far one stepper press moves the value. */
|
|
25
|
+
stepIncrement: number;
|
|
26
|
+
/** How far one page press (Page Up/Down) moves the value. */
|
|
27
|
+
pageIncrement: number;
|
|
28
|
+
/** The size of the visible page; zero for a scalar value such as a spin row's. */
|
|
29
|
+
pageSize: number;
|
|
30
|
+
constructor(props?: GtkAdjustmentProps | null);
|
|
31
|
+
/**
|
|
32
|
+
* Re-establish the invariants around one authored change.
|
|
33
|
+
*
|
|
34
|
+
* The current six are the BASE, so a field nobody wrote keeps what it held instead of
|
|
35
|
+
* falling back to the package default — the same contract `SpinState.configure` has.
|
|
36
|
+
*/
|
|
37
|
+
private _write;
|
|
38
|
+
/** `gtk_adjustment_configure` — all six at once, which is what C compresses into one. */
|
|
39
|
+
configure(value: number, lower: number, upper: number, step_increment: number, page_increment: number, page_size: number): void;
|
|
40
|
+
/** `gtk_adjustment_get_value`. */
|
|
41
|
+
get_value(): number;
|
|
42
|
+
/** `gtk_adjustment_set_value` — "clamped to lie between lower and upper". */
|
|
43
|
+
set_value(value: number): void;
|
|
44
|
+
/** `gtk_adjustment_get_lower`. */
|
|
45
|
+
get_lower(): number;
|
|
46
|
+
/** `gtk_adjustment_set_lower`. */
|
|
47
|
+
set_lower(lower: number): void;
|
|
48
|
+
/** `gtk_adjustment_get_upper`. */
|
|
49
|
+
get_upper(): number;
|
|
50
|
+
/** `gtk_adjustment_set_upper`. */
|
|
51
|
+
set_upper(upper: number): void;
|
|
52
|
+
/** `gtk_adjustment_get_step_increment`. */
|
|
53
|
+
get_step_increment(): number;
|
|
54
|
+
/** `gtk_adjustment_set_step_increment`. */
|
|
55
|
+
set_step_increment(step_increment: number): void;
|
|
56
|
+
/** `gtk_adjustment_get_page_increment`. */
|
|
57
|
+
get_page_increment(): number;
|
|
58
|
+
/** `gtk_adjustment_set_page_increment`. */
|
|
59
|
+
set_page_increment(page_increment: number): void;
|
|
60
|
+
/** `gtk_adjustment_get_page_size`. */
|
|
61
|
+
get_page_size(): number;
|
|
62
|
+
/** `gtk_adjustment_set_page_size`. */
|
|
63
|
+
set_page_size(page_size: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* `gtk_adjustment_get_minimum_increment` — "the smaller of step increment and page
|
|
66
|
+
* increment", which is the GIR's own sentence.
|
|
67
|
+
*
|
|
68
|
+
* Total, with no zero case: `normalizeAdjustment` refuses a step of zero and carries
|
|
69
|
+
* the page increment with it, so both are positive here. C has to answer for the
|
|
70
|
+
* adjustment its own defaults produce, where either can be 0.
|
|
71
|
+
*/
|
|
72
|
+
get_minimum_increment(): number;
|
|
73
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `new Gtk.StringList({ … })` takes — the GJS spelling of the type's own
|
|
3
|
+
* construct-time properties.
|
|
4
|
+
*
|
|
5
|
+
* `strings` only. The other two `StringList` declares — `item-type` and `n-items` — are
|
|
6
|
+
* `GListModel`'s read-only pair, and a construct bag that accepted them would be offering
|
|
7
|
+
* a write the type does not have.
|
|
8
|
+
*/
|
|
9
|
+
export interface GtkStringListProps {
|
|
10
|
+
/** The strings the list starts with. */
|
|
11
|
+
strings?: readonly string[] | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A list of strings under construction — `Gtk.StringList`'s building half over a plain
|
|
15
|
+
* JS array.
|
|
16
|
+
*
|
|
17
|
+
* `new GtkStringList()` is empty, as `gtk_string_list_new(NULL)` is, and the instance IS
|
|
18
|
+
* the value a `model` property takes.
|
|
19
|
+
*/
|
|
20
|
+
export declare class GtkStringList extends Array<string> {
|
|
21
|
+
/** See the file header: `map`/`filter`/`slice` must not call this constructor. */
|
|
22
|
+
static get [Symbol.species](): ArrayConstructor;
|
|
23
|
+
constructor(props?: GtkStringListProps | null);
|
|
24
|
+
/**
|
|
25
|
+
* `Gtk.StringList:strings`, as the door an attribute reaches. GTK's property is
|
|
26
|
+
* construct-only, and a NativeScript XML template has no constructor call to pass it
|
|
27
|
+
* through: `<gtk:StringList strings='["Blue","Teal"]'>` assigns the JSON text to this
|
|
28
|
+
* member instead, on a list that is still empty. So it REPLACES the contents, as
|
|
29
|
+
* constructing with `{ strings }` would have filled them.
|
|
30
|
+
*/
|
|
31
|
+
get strings(): string[];
|
|
32
|
+
set strings(value: readonly string[] | string);
|
|
33
|
+
/** `gtk_string_list_append`. */
|
|
34
|
+
append(string: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* `gtk_string_list_take` — `append` without the copy.
|
|
37
|
+
*
|
|
38
|
+
* The copy is what the two differ by in C ("this variant … is convenient for
|
|
39
|
+
* formatting strings"), and JS strings are immutable, so here the two are one
|
|
40
|
+
* function. It exists so code ported from GJS keeps working rather than to say
|
|
41
|
+
* something `append` does not.
|
|
42
|
+
*/
|
|
43
|
+
take(string: string): void;
|
|
44
|
+
/** `gtk_string_list_remove` — the string at `position`, which must be in range. */
|
|
45
|
+
remove(position: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* `gtk_string_list_splice` AND `Array.prototype.splice`, which is the point.
|
|
48
|
+
*
|
|
49
|
+
* The two say the same thing and pass the additions differently: C takes ONE array of
|
|
50
|
+
* them, JS takes them as rest arguments. A list whose elements are strings can tell
|
|
51
|
+
* the two apart with no ambiguity — an element is never an array — so both spellings
|
|
52
|
+
* work and a `list.splice(1, 2, ['a', 'b'])` ported straight from GJS inserts two
|
|
53
|
+
* strings instead of silently inserting one array as an element.
|
|
54
|
+
*
|
|
55
|
+
* `nRemovals` omitted is `Array.prototype.splice`'s "to the end", which is a different
|
|
56
|
+
* thing from passing `undefined` — so it is spelled as the count that reaches the end,
|
|
57
|
+
* which `splice` clamps the same way for a negative `position` as the one-argument form
|
|
58
|
+
* does.
|
|
59
|
+
*
|
|
60
|
+
* Flattened by hand, not `Array.prototype.flatMap` (ES2019): this source is also
|
|
61
|
+
* type-checked through `@gjsify/gtk-host`'s type-surface gate, whose `tsconfig`s
|
|
62
|
+
* pin `lib` to ES2017 for reasons of their own (`type-tests/{jsx,react}/tsconfig.json`)
|
|
63
|
+
* — a method this file alone would happily target ES2020 for is invisible there.
|
|
64
|
+
*/
|
|
65
|
+
splice(position: number, nRemovals?: number, ...additions: readonly (string | readonly string[])[]): string[];
|
|
66
|
+
/** `gtk_string_list_get_string` — `null` past the end, as C returns `NULL`. */
|
|
67
|
+
get_string(position: number): string | null;
|
|
68
|
+
/** `g_list_model_get_n_items`, which a `GtkStringList` answers with its length. */
|
|
69
|
+
get_n_items(): number;
|
|
70
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -22,14 +22,22 @@ export { ADW_DATA_GRID_ROW_VARIANTS, DATA_GRID_CELL_CLASS, DATA_GRID_ROW_CLASS,
|
|
|
22
22
|
export type { AdwDataGridAlign, AdwDataGridCellValue, AdwDataGridColumn, AdwDataGridRow, AdwDataGridRowVariant, DataGridTrack, } from './data-grid.js';
|
|
23
23
|
export { AdwToast, AdwToastQueue, DEFAULT_TOAST_TIMEOUT } from './toast.js';
|
|
24
24
|
export type { AdwToastOptions, AdwToastQueueHandlers, AdwToastQueueOptions, ToastScheduler, ToastTimerHandle, } from './toast.js';
|
|
25
|
-
export { AdwAlertResponses, BottomSheetPresentation, resolveBottomSheetClose } from './dialog.js';
|
|
26
|
-
export type { AdwAlertResponse, AdwResponseAppearance, AdwResponseOptions, BottomSheetCloseOutcome, BottomSheetCloseSource, BottomSheetCloseState, BottomSheetPresentationListener, BottomSheetPresentationOptions, BottomSheetTeardownCallback, OrderedConfirmResponses, } from './dialog.js';
|
|
25
|
+
export { AdwAlertResponses, BottomSheetPresentation, resolveBottomSheetChrome, resolveBottomSheetClose, resolveBottomSheetOpen, resolveBottomSheetSwipeTracker, } from './dialog.js';
|
|
26
|
+
export type { AdwAlertResponse, AdwResponseAppearance, AdwResponseOptions, BottomSheetChrome, BottomSheetChromeState, BottomSheetCloseOutcome, BottomSheetCloseSource, BottomSheetCloseState, BottomSheetLayer, BottomSheetOpenOutcome, BottomSheetOpenSource, BottomSheetOpenState, BottomSheetPresentationListener, BottomSheetPresentationOptions, BottomSheetSwipeTrackerConfig, BottomSheetSwipeTrackerState, BottomSheetTeardownCallback, OrderedConfirmResponses, } from './dialog.js';
|
|
27
27
|
export { ADW_COMBO_NO_SELECTION, clampListSelection, listItemsChanged, normalizeComboOptions, parseListModel, } from './list.js';
|
|
28
28
|
export type { AdwComboOption, AdwComboOptionInput, AdwListItemsChanged, AdwListModel, AdwListModelInput, } from './list.js';
|
|
29
29
|
export { ADW_ADJUSTMENT_DEFAULTS, adjustmentRange, clampAdjustmentValue, normalizeAdjustment, parseAdjustment, snapAdjustmentValue, SpinState, } from './adjustment.js';
|
|
30
30
|
export type { AdwAdjustment, AdwAdjustmentInput, SpinStateChange, SpinStateListener, SpinStateRangeListener, } from './adjustment.js';
|
|
31
|
-
export {
|
|
31
|
+
export { GtkAdjustment } from './gtk-adjustment.js';
|
|
32
|
+
export type { GtkAdjustmentProps } from './gtk-adjustment.js';
|
|
33
|
+
export { GtkStringList } from './gtk-string-list.js';
|
|
34
|
+
export type { GtkStringListProps } from './gtk-string-list.js';
|
|
35
|
+
export { ComboState, ExpanderState, ToggleGroupState, keptToggles, toggleIndexOfName } from './rows.js';
|
|
32
36
|
export type { ComboItemsListener, ComboStateChange, ComboStateListener, ExpanderStateListener, ToggleGroupStateChange, ToggleGroupStateListener, } from './rows.js';
|
|
37
|
+
export { DEFAULT_BOX_SPACING, normalizeBoxOrientation, normalizeBoxSpacing } from './box.js';
|
|
38
|
+
export type { BoxOrientation } from './box.js';
|
|
39
|
+
export { DEFAULT_LABEL_ELLIPSIZE, DEFAULT_LABEL_LINES, DEFAULT_LABEL_MAX_WIDTH_CHARS, DEFAULT_LABEL_WIDTH_CHARS, DEFAULT_LABEL_WRAP_MODE, DEFAULT_LABEL_XALIGN, DEFAULT_LABEL_YALIGN, LABEL_ELLIPSIZE_MODES, LABEL_JUSTIFICATIONS, LABEL_WRAP_MODES, labelDisplayText, labelEffectiveLines, labelEllipsizeOverflowValue, labelMarkupIsUnparseable, labelWidthCharsExtent, labelYalignAlignItems, normalizeLabelEllipsize, normalizeLabelJustify, normalizeLabelLines, normalizeLabelMaxWidthChars, normalizeLabelWidthChars, normalizeLabelWrapMode, normalizeLabelXalign, normalizeLabelYalign, } from './label.js';
|
|
40
|
+
export type { LabelAlignItems, LabelEllipsizeMode, LabelJustification, LabelWidthCharsExtent, LabelWrapMode, } from './label.js';
|
|
33
41
|
export { glibClamp, gStrStrip, stringIsNotEmpty } from './glib.js';
|
|
34
42
|
export { ViewStackState, normalizeIconName, resolvePageTitle } from './view-stack.js';
|
|
35
43
|
export type { AdwViewStackPageInfo, AdwViewStackPageSpec, ViewStackStateChange, ViewStackStateListener, } from './view-stack.js';
|
|
@@ -50,6 +58,7 @@ export { ADW_SWIPE_BORDER, DEFAULT_MAX_SIDEBAR_WIDTH, DEFAULT_MIN_SIDEBAR_WIDTH,
|
|
|
50
58
|
export type { AdwPackType, AdwTextDirection, NavigationActionInput, NavigationActionResult, NavigationPageRef, NavigationSplitViewChange, NavigationSplitViewHandlers, NavigationSplitViewLayout, NavigationSplitViewListener, NavigationSplitViewOptions, NavigationSplitViewProperty, NavigationStackPlan, OverlaySplitViewChange, OverlaySplitViewLayout, OverlaySplitViewListener, OverlaySplitViewOptions, OverlaySplitViewProperty, SidebarBounds, SidebarWidthInput, SidebarWidthSpec, SplitViewAnimation, SplitViewAnimationRequest, SplitViewAnimator, SplitViewMeasureInput, SplitViewPane, SplitViewPaneRect, SwipeReleasePlan, } from './split-view.js';
|
|
51
59
|
export { DEFAULT_DROPDOWN_TOOLTIP, SPLIT_BUTTON_DISABLED_OPACITY, SplitButtonState, isSplitButtonDirection, menuButtonArrowIcon, menuButtonPopupDirection, resolveDropdownTooltip, splitButtonArrowIcon, splitButtonPopupDirection, splitButtonRootState, splitButtonStyleClasses, } from './split-button.js';
|
|
52
60
|
export type { AdwArrowIcon, SplitButtonChange, SplitButtonContentMode, SplitButtonDirection, SplitButtonHalfState, SplitButtonListener, SplitButtonProperty, SplitButtonStyleClass, } from './split-button.js';
|
|
61
|
+
export { GioMenu, GioMenuItem } from './gio-menu.js';
|
|
53
62
|
export { ADW_MENU_SURFACE_NATIVESCRIPT, ADW_MENU_SURFACE_WEB, assertMenuRenderable, flattenMenu, menuItemAt, menuNodeAt, menuRefusals, normalizeMenuModel, parseDetailedAction, parseMenuModel, resolveMenuItemState, } from './menu.js';
|
|
54
63
|
export type { AdwDetailedAction, AdwMenuAction, AdwMenuActions, AdwMenuDisplayHint, AdwMenuEntryInput, AdwMenuFlatRow, AdwMenuHiddenWhen, AdwMenuInput, AdwMenuItem, AdwMenuItemInput, AdwMenuItemRole, AdwMenuItemState, AdwMenuModel, AdwMenuNode, AdwMenuPath, AdwMenuRefusal, AdwMenuSection, AdwMenuSectionInput, AdwMenuSubmenu, AdwMenuSubmenuInput, AdwMenuSurface, AdwMenuTextDirection, } from './menu.js';
|
|
55
64
|
export { DEFAULT_INDICATOR_DESCRIPTION_STRINGS, INLINE_VIEW_SWITCHER_DISPLAY_MODES, VIEW_SWITCHER_BADGE_LIMIT, VIEW_SWITCHER_DRAG_SWITCH_DELAY, VIEW_SWITCHER_FALLBACK_ICON, VIEW_SWITCHER_NO_SELECTION, VIEW_SWITCHER_POLICIES, ViewSwitcherBarState, ViewSwitcherDragSwitch, ViewSwitcherState, buildInlineToggles, buildViewSwitcherButtons, createViewSwitcherPage, inlineToggleTooltip, isInlineViewSwitcherDisplayMode, isViewSwitcherButtonVisible, isViewSwitcherPolicy, pageIndexForToggle, shouldRevealViewSwitcherBar, stripMnemonic, toggleIndexForPage, viewSwitcherBadgeLabel, viewSwitcherButtonOrientation, viewSwitcherIconName, viewSwitcherIndicatorDescription, viewSwitcherLabel, viewSwitcherPageFromStackPage, viewSwitcherPagesFromStack, } from './view-switcher.js';
|
|
@@ -74,3 +83,5 @@ export { POPOVER_ITEM_RADIUS, POPOVER_MENU_PADDING, POPOVER_PADDING, POPOVER_RAD
|
|
|
74
83
|
export type { PopoverKeyAction, PopoverKeyContext, PopoverKeyResolution, PopoverStateChange, PopoverStateListener, } from './popover.js';
|
|
75
84
|
export { ADW_WRAP_BOX_DEFAULT_ALIGN, ADW_WRAP_BOX_DEFAULT_JUSTIFY, ADW_WRAP_BOX_DEFAULT_JUSTIFY_LAST_LINE, ADW_WRAP_BOX_DEFAULT_LENGTH_UNIT, ADW_WRAP_BOX_DEFAULT_PACK_DIRECTION, ADW_WRAP_BOX_DEFAULT_SPACING, ADW_WRAP_BOX_DEFAULT_WRAP_POLICY, ADW_WRAP_BOX_JUSTIFY_MODES, ADW_WRAP_BOX_NATURAL_LINE_LENGTH_UNSET, ADW_WRAP_BOX_PACK_DIRECTIONS, ADW_WRAP_POLICIES, normalizeNaturalLineLength, normalizeWrapBoxAlign, normalizeWrapBoxJustify, normalizeWrapBoxLengthUnit, normalizeWrapBoxPackDirection, normalizeWrapBoxSpacing, normalizeWrapPolicy, resolveWrapBoxChildOrder, resolveWrapBoxLine, wrapBoxChildFlex, wrapBoxFlexStyle, wrapBoxLengthToPx, wrapPolicyFlexShrink, } from './wrap-box.js';
|
|
76
85
|
export type { AdwWrapBoxJustify, AdwWrapBoxOrientation, AdwWrapBoxPackDirection, AdwWrapPolicy, WrapBoxChildFlex, WrapBoxChildOrderOp, WrapBoxFlexInput, WrapBoxFlexStyle, WrapBoxLineLayout, } from './wrap-box.js';
|
|
86
|
+
export { ADW_SOURCE_6502_DIRECTIVES, ADW_SOURCE_6502_LINE_COMMENT, ADW_SOURCE_6502_OPCODES, ADW_SOURCE_6502_REGISTERS, ADW_SOURCE_6502_TOKEN_ROLES, ADW_SOURCE_HEX_STRIDE, ADW_SOURCE_PALETTE_DARK, ADW_SOURCE_PALETTE_LIGHT, ADW_SOURCE_SYNTAX_ROLES, classifyAsm6502Word, formatHexAddress, formatLineNumber, stripSourceWhitespace, tokenizeAsm6502, } from './source.js';
|
|
87
|
+
export type { AdwSourcePalette, AdwSourceSyntaxRole, AdwSourceTokenClass, AdwSourceTokenStream } from './source.js';
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/** `Gtk.Label:xalign`'s default — `0.5` in the pspec: a label centres its text. */
|
|
2
|
+
export declare const DEFAULT_LABEL_XALIGN = 0.5;
|
|
3
|
+
/** `Gtk.Justification`'s four nicks, in enum order. */
|
|
4
|
+
export declare const LABEL_JUSTIFICATIONS: readonly ["left", "right", "center", "fill"];
|
|
5
|
+
export type LabelJustification = (typeof LABEL_JUSTIFICATIONS)[number];
|
|
6
|
+
/**
|
|
7
|
+
* The string a label shows for a given `label` and the two flags that transform it.
|
|
8
|
+
*
|
|
9
|
+
* ORDER FOLLOWS THE C: markup is reduced first, the mnemonic marker second.
|
|
10
|
+
* `gtk_label_set_markup_with_mnemonic` parses the markup and then takes the underscore out
|
|
11
|
+
* of the resulting TEXT, so an `_` inside a tag's attributes is not a mnemonic. Doing it
|
|
12
|
+
* the other way round would let `<span font_desc="Sans">` lose its underscore and stop
|
|
13
|
+
* parsing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function labelDisplayText(label: string, useMarkup: boolean, useUnderline: boolean): string;
|
|
16
|
+
/** Whether `label` carries markup that could not be reduced, so the raw string is shown. */
|
|
17
|
+
export declare function labelMarkupIsUnparseable(label: string, useMarkup: boolean): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* `Gtk.Label:xalign` as the label holds it. `gtk_label_set_xalign` CLAMPs to 0…1 itself,
|
|
20
|
+
* so an out-of-range value lands on the nearer end; only an unparseable one is the default.
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeLabelXalign(value: unknown): number;
|
|
23
|
+
/** `Gtk.Label:justify` from its nick. An unknown nick leaves the default, `left`. */
|
|
24
|
+
export declare function normalizeLabelJustify(value: unknown): LabelJustification;
|
|
25
|
+
/** `Gtk.Label:yalign`'s default — `0.5`, the same pspec shape as `xalign`. */
|
|
26
|
+
export declare const DEFAULT_LABEL_YALIGN = 0.5;
|
|
27
|
+
/**
|
|
28
|
+
* `Gtk.Label:yalign` as the label holds it. `gtk_label_set_yalign` CLAMPs to 0…1 itself,
|
|
29
|
+
* the same shape `normalizeLabelXalign` already carries for `xalign`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function normalizeLabelYalign(value: unknown): number;
|
|
32
|
+
/** The one CSS `align-items` keyword a `yalign` zone maps to. */
|
|
33
|
+
export type LabelAlignItems = 'flex-start' | 'center' | 'flex-end';
|
|
34
|
+
/**
|
|
35
|
+
* `yalign`'s three-zone CSS mapping — the DECLARED divergence past `yalign`'s three exact
|
|
36
|
+
* values (0, 0.5, 1): CSS `align-items` has three keywords and no ratio the way `xalign`'s
|
|
37
|
+
* `flex-grow` gives the main axis one (`_labels.scss`'s header has the full reasoning for
|
|
38
|
+
* why a second spacer pair is not the fix). This is the NEAREST of the three — the
|
|
39
|
+
* boundary between "nearest 0" and "nearest 0.5" is their midpoint, `0.25`, and
|
|
40
|
+
* symmetrically `0.75` between "nearest 0.5" and "nearest 1"; a value sitting exactly on a
|
|
41
|
+
* boundary is equidistant and reads as the CENTRE zone (`<`/`>`, not `<=`/`>=`), the same
|
|
42
|
+
* "high bound first" tie a strict inequality gives {@link glibClamp} at its own edges.
|
|
43
|
+
*/
|
|
44
|
+
export declare function labelYalignAlignItems(yalign: number): LabelAlignItems;
|
|
45
|
+
/** `Pango.EllipsizeMode`'s four nicks, in enum order. */
|
|
46
|
+
export declare const LABEL_ELLIPSIZE_MODES: readonly ["none", "start", "middle", "end"];
|
|
47
|
+
export type LabelEllipsizeMode = (typeof LABEL_ELLIPSIZE_MODES)[number];
|
|
48
|
+
/** `Gtk.Label:ellipsize`'s default — `none`, no ellipsization. */
|
|
49
|
+
export declare const DEFAULT_LABEL_ELLIPSIZE: LabelEllipsizeMode;
|
|
50
|
+
/** `Gtk.Label:ellipsize` from its nick. An unknown nick leaves the default, `none`. */
|
|
51
|
+
export declare function normalizeLabelEllipsize(value: unknown): LabelEllipsizeMode;
|
|
52
|
+
/**
|
|
53
|
+
* `Gtk.Label:ellipsize` as the ONE truncating value CSS `text-overflow` and
|
|
54
|
+
* NativeScript's `textOverflow` can both hold — each accepts only `clip` or `ellipsis`,
|
|
55
|
+
* neither has a start- or middle-truncating mode of its own.
|
|
56
|
+
*
|
|
57
|
+
* `start` and `middle` are held on the PROPERTY faithfully: `normalizeLabelEllipsize`
|
|
58
|
+
* never lies about what was asked for, and a consumer reading `label.ellipsize` back gets
|
|
59
|
+
* exactly that nick. What a renderer can DRAW is a different question, answered here once
|
|
60
|
+
* for both renderers so neither invents its own fallback: every non-`none` mode draws an
|
|
61
|
+
* END ellipsis, the nearer of the two values a platform actually has — never a silent
|
|
62
|
+
* `clip`, which would drop the same characters with no indication at all that anything is
|
|
63
|
+
* missing. A DECLARED divergence, not a guessed one: `LABEL_ELLIPSIZE_OVERFLOW_VECTORS`
|
|
64
|
+
* pins this fallback, the same way `LABEL_DISPLAY_TEXT_VECTORS` pins use-markup's.
|
|
65
|
+
*/
|
|
66
|
+
export declare function labelEllipsizeOverflowValue(ellipsize: LabelEllipsizeMode): 'clip' | 'ellipsis';
|
|
67
|
+
/** `Pango.WrapMode`'s three nicks, in enum order. */
|
|
68
|
+
export declare const LABEL_WRAP_MODES: readonly ["word", "char", "word-char"];
|
|
69
|
+
export type LabelWrapMode = (typeof LABEL_WRAP_MODES)[number];
|
|
70
|
+
/** `Gtk.Label:wrap-mode`'s default — `word`, wrap on word boundaries. */
|
|
71
|
+
export declare const DEFAULT_LABEL_WRAP_MODE: LabelWrapMode;
|
|
72
|
+
/** `Gtk.Label:wrap-mode` from its nick. An unknown nick leaves the default, `word`. */
|
|
73
|
+
export declare function normalizeLabelWrapMode(value: unknown): LabelWrapMode;
|
|
74
|
+
/** `Gtk.Label:width-chars`'s default — `-1`, the width is calculated automatically. */
|
|
75
|
+
export declare const DEFAULT_LABEL_WIDTH_CHARS = -1;
|
|
76
|
+
/** `Gtk.Label:width-chars` as the label holds it. See {@link normalizeLabelCharCount}. */
|
|
77
|
+
export declare function normalizeLabelWidthChars(value: unknown): number;
|
|
78
|
+
/** `Gtk.Label:max-width-chars`'s default — `-1`, the width is calculated automatically. */
|
|
79
|
+
export declare const DEFAULT_LABEL_MAX_WIDTH_CHARS = -1;
|
|
80
|
+
/** `Gtk.Label:max-width-chars` as the label holds it. See {@link normalizeLabelCharCount}. */
|
|
81
|
+
export declare function normalizeLabelMaxWidthChars(value: unknown): number;
|
|
82
|
+
/** `Gtk.Label:lines`'s default — `-1`, no line limit. */
|
|
83
|
+
export declare const DEFAULT_LABEL_LINES = -1;
|
|
84
|
+
/** `Gtk.Label:lines` as the label holds it. See {@link normalizeLabelCharCount}. */
|
|
85
|
+
export declare function normalizeLabelLines(value: unknown): number;
|
|
86
|
+
/**
|
|
87
|
+
* `Gtk.Label:lines` — the line count Pango will actually show before it ellipsizes, or
|
|
88
|
+
* `null` when nothing caps it at all.
|
|
89
|
+
*
|
|
90
|
+
* THE PSPEC'S OWN WORDS ARE IMPRECISE, MEASURED AGAINST WHAT GTK DOES. "Has no effect if
|
|
91
|
+
* the label is not wrapping or ellipsized" reads as `wrap || ellipsize !== 'none'` — this
|
|
92
|
+
* function's first, WRONG implementation — but `gtk_label_ensure_layout` (gtklabel.c) only
|
|
93
|
+
* ever calls `pango_layout_set_height(layout, -self->lines)`, and `wrap` plays NO PART in
|
|
94
|
+
* whether Pango HONOURS that call: measured on gjs 1.88.1 / gtk 4.22.5, a real
|
|
95
|
+
* `Gtk.Label` with `wrap=TRUE, ellipsize=NONE, lines=2`, allocated 100px wide, laid out
|
|
96
|
+
* **15 lines** — the `lines` hint sits there unused, because Pango only consults a
|
|
97
|
+
* layout's height/line-count when ELLIPSIZATION is active; wrapping alone never asks
|
|
98
|
+
* Pango to stop. The same label with `wrap=FALSE, ellipsize=END, lines=2` (the case the
|
|
99
|
+
* old implementation returned `null`, "no effect", for) laid out exactly **2 lines**,
|
|
100
|
+
* ellipsized — `wrap` is `false` there and it changed nothing: `ellipsize || wrap` in the
|
|
101
|
+
* C is the gate on whether the layout gets a WIDTH at all (a `Gtk.Label:ellipsize`
|
|
102
|
+
* request supplies its own width, exactly like `wrap` does), not on whether `lines` has
|
|
103
|
+
* an effect. So `wrap` is not a parameter here — passing it would invite exactly the
|
|
104
|
+
* misreading the pspec's prose does.
|
|
105
|
+
*
|
|
106
|
+
* WHAT AN UNSET `lines` (`≤ 0`) MEANS ONCE ELLIPSIZE IS ACTIVE IS NOT "UNLIMITED" — it is
|
|
107
|
+
* Pango's OWN default: `gtk_label_set_lines` only calls `pango_layout_set_height` when
|
|
108
|
+
* `lines > 0`, so an unset `lines` leaves Pango's height at ITS default, which
|
|
109
|
+
* `PangoLayout` documents as "the first line will be shown" — measured: `lines` absent
|
|
110
|
+
* (or `0`) with `ellipsize=END` laid out to exactly **1 line**, same as `lines=1`
|
|
111
|
+
* explicitly. `lines < 0` (GTK's own "unlimited" spelling once `lines` IS being read,
|
|
112
|
+
* i.e. while ellipsize is active) was never reachable through this function in the first
|
|
113
|
+
* place, since {@link normalizeLabelLines} floors at `-1` and this reads it before any
|
|
114
|
+
* positive check — folded into the `lines > 0 ? lines : 1` branch below.
|
|
115
|
+
*/
|
|
116
|
+
export declare function labelEffectiveLines(lines: number, ellipsize: LabelEllipsizeMode): number | null;
|
|
117
|
+
/** One `width-chars` + `max-width-chars` pair and the `ch`-unit extent a renderer draws. */
|
|
118
|
+
export interface LabelWidthCharsExtent {
|
|
119
|
+
/** `width-chars`, in `ch` — the MINIMUM width — or `null` while it is unset (`-1`). */
|
|
120
|
+
minCh: number | null;
|
|
121
|
+
/**
|
|
122
|
+
* `MAX(width-chars, max-width-chars)`, in `ch` — the NATURAL/maximum width — or `null`
|
|
123
|
+
* while `max-width-chars` is unset. `width-chars` alone sets no maximum: GTK reads it
|
|
124
|
+
* only as a floor under `max-width-chars`, never as a ceiling by itself.
|
|
125
|
+
*/
|
|
126
|
+
maxCh: number | null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* `get_default_widths` (gtklabel.c): the label's MINIMUM width is `width-chars` alone; its
|
|
130
|
+
* NATURAL width is `MAX(width-chars, max-width-chars)`, and that MAX is read only while
|
|
131
|
+
* `max-width-chars` is set — `width-chars` without a maximum has nothing to be a floor
|
|
132
|
+
* under. Either property at its default (`-1`) drops out of the pair it belongs to, the
|
|
133
|
+
* same "negative means auto" rule both share.
|
|
134
|
+
*/
|
|
135
|
+
export declare function labelWidthCharsExtent(widthChars: number, maxWidthChars: number): LabelWidthCharsExtent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SharedTreeNode } from './conformance/shared-trees.js';
|
|
2
|
+
/**
|
|
3
|
+
* The tree as `<adw-*>`/`<gtk-*>` markup: what `buildSharedTree` would build, spelled as the
|
|
4
|
+
* HTML a page could hold instead. Parsed into a document, it yields the same elements with
|
|
5
|
+
* the same attributes, classes and `slot=` as `mountSharedTree(node)` does.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sharedTreeHtml(node: SharedTreeNode): string;
|
|
8
|
+
/**
|
|
9
|
+
* The tree as a NativeScript XML template: what the port's `build` would build, spelled as
|
|
10
|
+
* markup NativeScript's `Builder` loads. The root declares NativeScript's default namespace
|
|
11
|
+
* and one `xmlns` barrel per library the tree uses — no more, since each is a module the app
|
|
12
|
+
* then has to provide.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sharedTreeNativeScriptXml(node: SharedTreeNode): string;
|
package/lib/types/rows.d.ts
CHANGED
|
@@ -222,3 +222,23 @@ export declare class ToggleGroupState {
|
|
|
222
222
|
/** Number of segments. */
|
|
223
223
|
get count(): number;
|
|
224
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* The toggles a group keeps, in add order.
|
|
227
|
+
*
|
|
228
|
+
* A NAME IS UNIQUE, AND THE SECOND CLAIM IS REFUSED WHOLE. `add_toggle` looks the name up
|
|
229
|
+
* before adding and, when another toggle already carries it, prints a `g_critical` and
|
|
230
|
+
* drops the toggle — it is never added, so it draws no button and takes no index
|
|
231
|
+
* (adw-toggle-group.c:849). An unnamed toggle is always kept.
|
|
232
|
+
*/
|
|
233
|
+
export declare function keptToggles<T extends {
|
|
234
|
+
readonly name?: string | null;
|
|
235
|
+
}>(toggles: readonly T[]): T[];
|
|
236
|
+
/**
|
|
237
|
+
* The toggle `adw_toggle_group_set_active_name` selects: its index among the names of the
|
|
238
|
+
* KEPT toggles ({@link keptToggles}), or `-1` when none carries `name`.
|
|
239
|
+
*
|
|
240
|
+
* `-1` is not a selection. The C answers a name nothing carries with a `g_critical` and
|
|
241
|
+
* returns (:2001) — the active toggle stays where it was — so a renderer leaves its
|
|
242
|
+
* selection alone on `-1` rather than clearing it.
|
|
243
|
+
*/
|
|
244
|
+
export declare function toggleIndexOfName(names: readonly (string | null | undefined)[], name: string): number;
|