@gjsify/adwaita-core 0.35.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.
Files changed (61) hide show
  1. package/lib/esm/conformance/index.js +1 -1
  2. package/lib/esm/conformance/shortcut-label.js +1 -0
  3. package/lib/esm/index.js +1 -1
  4. package/lib/esm/shortcut-label.js +1 -0
  5. package/lib/types/about-dialog.d.ts +92 -98
  6. package/lib/types/action-row.d.ts +95 -125
  7. package/lib/types/avatar.d.ts +30 -37
  8. package/lib/types/banner.d.ts +25 -53
  9. package/lib/types/breakpoint.d.ts +6 -7
  10. package/lib/types/button-content.d.ts +41 -80
  11. package/lib/types/carousel.d.ts +175 -252
  12. package/lib/types/checks.d.ts +13 -30
  13. package/lib/types/chrome.d.ts +90 -136
  14. package/lib/types/color-scheme.d.ts +5 -6
  15. package/lib/types/conformance/about-dialog.d.ts +64 -91
  16. package/lib/types/conformance/action-row.d.ts +26 -46
  17. package/lib/types/conformance/avatar.d.ts +8 -10
  18. package/lib/types/conformance/banner.d.ts +17 -37
  19. package/lib/types/conformance/button-content.d.ts +24 -46
  20. package/lib/types/conformance/carousel.d.ts +35 -75
  21. package/lib/types/conformance/checks.d.ts +0 -4
  22. package/lib/types/conformance/chrome.d.ts +28 -36
  23. package/lib/types/conformance/data-grid.d.ts +28 -47
  24. package/lib/types/conformance/dialog.d.ts +4 -9
  25. package/lib/types/conformance/entry-row.d.ts +20 -39
  26. package/lib/types/conformance/index.d.ts +2 -0
  27. package/lib/types/conformance/navigation-view.d.ts +0 -4
  28. package/lib/types/conformance/popover.d.ts +4 -9
  29. package/lib/types/conformance/preferences.d.ts +15 -28
  30. package/lib/types/conformance/rows.d.ts +5 -12
  31. package/lib/types/conformance/shortcut-label.d.ts +34 -0
  32. package/lib/types/conformance/sidebar.d.ts +28 -49
  33. package/lib/types/conformance/spinner.d.ts +21 -27
  34. package/lib/types/conformance/split-button.d.ts +21 -43
  35. package/lib/types/conformance/split-view.d.ts +29 -36
  36. package/lib/types/conformance/tab-view.d.ts +32 -73
  37. package/lib/types/conformance/view-stack.d.ts +0 -12
  38. package/lib/types/conformance/view-switcher.d.ts +46 -114
  39. package/lib/types/conformance/wrap-box.d.ts +40 -63
  40. package/lib/types/data-grid.d.ts +38 -48
  41. package/lib/types/dialog.d.ts +39 -51
  42. package/lib/types/easing.d.ts +6 -12
  43. package/lib/types/entry-row.d.ts +94 -123
  44. package/lib/types/glib.d.ts +17 -25
  45. package/lib/types/index.d.ts +2 -0
  46. package/lib/types/length-unit.d.ts +7 -12
  47. package/lib/types/navigation-view.d.ts +62 -68
  48. package/lib/types/popover.d.ts +39 -66
  49. package/lib/types/preferences.d.ts +83 -100
  50. package/lib/types/rows.d.ts +45 -63
  51. package/lib/types/shortcut-label.d.ts +79 -0
  52. package/lib/types/shortcut-label.spec.d.ts +2 -0
  53. package/lib/types/sidebar.d.ts +95 -121
  54. package/lib/types/spinner.d.ts +39 -61
  55. package/lib/types/split-button.d.ts +78 -134
  56. package/lib/types/split-view.d.ts +74 -89
  57. package/lib/types/tab-view.d.ts +174 -256
  58. package/lib/types/view-stack.d.ts +87 -129
  59. package/lib/types/view-switcher.d.ts +126 -211
  60. package/lib/types/wrap-box.d.ts +62 -123
  61. package/package.json +3 -3
@@ -1,67 +1,54 @@
1
1
  import { stripMnemonic } from './glib.js';
2
2
  /**
3
- * A caseless-compare normaliser, i.e. what `g_utf8_casefold` does for the C.
4
- *
5
- * Injected rather than hard-wired — the same seam style as `ToastScheduler` and
6
- * the avatar's measurement callback — because full Unicode case folding is a
7
- * DATA TABLE, not a language builtin, and a size-sensitive renderer may
8
- * legitimately want to trade the table away. Making it a parameter keeps that a
9
- * documented choice instead of an accident.
3
+ * A caseless-compare normaliser, i.e. what `g_utf8_casefold` does for the C. Injected
4
+ * rather than hard-wired because full Unicode case folding is a DATA TABLE, not a
5
+ * language builtin, and a size-sensitive renderer may legitimately trade the table away.
10
6
  */
11
7
  export type CaseFolder = (text: string) => string;
12
8
  /**
13
- * `g_utf8_casefold` (adw-preferences-dialog.c:101, :133) — Unicode FULL case
14
- * folding, i.e. `toLowerCase()` plus the mappings where a case fold and a
15
- * lowercase mapping disagree.
16
- *
17
- * This is the one place in the family where the obvious implementation ships
18
- * wrong behaviour in languages people actually use, invisibly to an ASCII test
19
- * suite. The three canaries, all verified against a real full-folding
20
- * implementation:
9
+ * `g_utf8_casefold` — Unicode FULL case folding, i.e. `toLowerCase()` plus the mappings
10
+ * where a case fold and a lowercase mapping disagree. The obvious implementation ships
11
+ * wrong behaviour in languages people actually use, invisibly to an ASCII test suite;
12
+ * the three canaries, verified against a real full-folding implementation:
21
13
  *
22
- * | input | `toLowerCase()` | case fold |
14
+ * | input | `toLowerCase()` | case fold |
23
15
  * |----------|-----------------|------------|
24
- * | `Straße` | `straße` | `strasse` |
25
- * | `ΟΔΟΣ` | `οδος` | `οδοσ` |
26
- * | `file` | `file` | `file` |
16
+ * | `Straße` | `straße` | `strasse` |
17
+ * | `ΟΔΟΣ` | `οδος` | `οδοσ` |
18
+ * | `file` | `file` | `file` |
27
19
  *
28
- * `normalize('NFKC').toLowerCase()` is NOT a substitute: it repairs the
20
+ * `normalize('NFKC').toLowerCase` is NOT a substitute: it repairs the
29
21
  * ligature, still misses `ß` and final sigma, and OVER-normalises `DŽ` (U+01C4)
30
22
  * to the two-character `dž` where a case fold gives the single character `dž`.
31
23
  */
32
24
  export declare const defaultCaseFolder: CaseFolder;
33
25
  /**
34
- * `g_markup_escape_text` — the escape `create_search_row_subtitle` puts a page
35
- * title through before it becomes a markup subtitle
36
- * (adw-preferences-dialog.c:201-207).
37
- *
38
- * GLib emits NUMERIC references for the quote characters (`'`, `"`),
39
- * not `'`/`"`; a port that "tidies" those up produces a different
40
- * string for the same input. Control characters become `&#xN;` — GLib's own C1
26
+ * `g_markup_escape_text` — the escape `create_search_row_subtitle` puts a page title
27
+ * through before it becomes a markup subtitle. GLib emits NUMERIC references for the
28
+ * quote characters (`'`, `"`), not `'`/`"`, so a port that "tidies"
29
+ * those up produces a different string. Control characters become `&#xN;`; GLib's own C1
41
30
  * branch is unreachable for valid UTF-8 (it compares a signed `char` against
42
31
  * `0x7f`-`0x9f`), so only the ASCII controls are escaped here.
43
32
  */
44
33
  export declare function escapeMarkup(text: string): string;
45
34
  /**
46
- * `pango_parse_markup (text, -1, 0, NULL, &parsed, NULL, &error)` reduced to the
47
- * part `make_comparable` uses: the plain text, with tags dropped and entities
48
- * resolved.
35
+ * `pango_parse_markup (text, -1, 0, NULL, &parsed, NULL, &error)` reduced to the part
36
+ * `make_comparable` uses: the plain text, tags dropped and entities resolved.
49
37
  *
50
- * Returns `null` — NEVER throws — when the markup does not parse, so callers
51
- * reproduce the C fallback exactly: `g_critical` and keep the UNPARSED string
52
- * (adw-preferences-dialog.c:110-113). A row whose title contains a bare `&` must
53
- * stay in the search index under its literal text, not vanish from it.
38
+ * Returns `null` — NEVER throws — when the markup does not parse, so callers reproduce
39
+ * the C fallback exactly (`g_critical`, keep the UNPARSED string): a row whose title
40
+ * contains a bare `&` must stay in the search index under its literal text.
54
41
  *
55
- * Pango wraps the input in an implicit `<markup>` element, so several top-level
56
- * tags are legal. Unknown tag names are a parse error, which is why this keeps
57
- * pango's tag list rather than stripping anything that looks like a tag: `<3`
58
- * and `<div>` are TEXT to libadwaita, and a search for them must find them.
42
+ * Pango wraps the input in an implicit `<markup>` element, so several top-level tags are
43
+ * legal, and unknown tag names are a parse error — which is why this keeps pango's tag
44
+ * list rather than stripping anything tag-shaped: `<3` and `<div>` are TEXT to
45
+ * libadwaita and a search for them must find them.
59
46
  *
60
- * Deviations, both in the fail-closed direction (unparsed → caller keeps the raw
61
- * string, never a wrongly-stripped one): pango additionally validates `<span>`'s
62
- * attribute NAMES, and this does not; GMarkup's DOCTYPE/PI/CDATA handling is
63
- * modelled as plain passthrough, which is what pango's parser does with it
64
- * (its `passthrough` handler is NULL, so the content is discarded).
47
+ * Deviations, both fail-closed (unparsed → the caller keeps the raw string, never a
48
+ * wrongly-stripped one): pango additionally validates `<span>`'s attribute NAMES, and
49
+ * this does not; GMarkup's DOCTYPE/PI/CDATA handling is modelled as plain passthrough,
50
+ * which is what pango's parser does with it (its `passthrough` handler is NULL, so the
51
+ * content is discarded).
65
52
  */
66
53
  export declare function stripMarkup(text: string): string | null;
67
54
  /** Per-row flags `make_comparable` reads off the row it is comparing. */
@@ -72,37 +59,33 @@ export interface MakeComparableOptions {
72
59
  useUnderline?: boolean;
73
60
  /**
74
61
  * `make_comparable`'s third argument. The TITLE path passes `true`, the
75
- * SUBTITLE path passes `false` (adw-preferences-dialog.c:133, :141) — so a
62
+ * SUBTITLE path passes `false` — so a
76
63
  * subtitle keeps its underscores even on a row that uses mnemonics.
77
64
  */
78
65
  allowUnderline?: boolean;
79
66
  }
80
67
  /**
81
- * `make_comparable` (adw-preferences-dialog.c:96-123): the form of a string the
82
- * search compares against, i.e. case-folded, markup-stripped and (for titles on
83
- * mnemonic rows) mnemonic-stripped.
68
+ * `make_comparable`: the form of a string the search compares against — case-folded,
69
+ * markup-stripped and (for titles on mnemonic rows) mnemonic-stripped.
84
70
  *
85
- * THE ORDER IS THE POINT AND IT IS NOT THE OBVIOUS ONE: fold FIRST, parse the
86
- * FOLDED string second. Parsing first would work too — but folding first is what
87
- * the C does, and the two differ for any markup whose tag name is case-sensitive
88
- * to the parser. Folding a lowercase-only tag set leaves it parseable, which is
89
- * why `<b>Dark</b> Style` still reduces to `dark style` rather than keeping its
90
- * tags.
71
+ * THE ORDER IS NOT THE OBVIOUS ONE: fold FIRST, parse the FOLDED string second, as the C
72
+ * does. The two differ for any markup whose tag name is case-sensitive to the parser;
73
+ * folding a lowercase-only tag set leaves it parseable, which is why `<b>Dark</b> Style`
74
+ * still reduces to `dark style` rather than keeping its tags.
91
75
  */
92
76
  export declare function makeComparable(source: string | null | undefined, options?: MakeComparableOptions, fold?: CaseFolder): string;
93
77
  /** What {@link derivePreferencesGroupHeader} is asked about. */
94
78
  export interface PreferencesGroupHeaderInput {
95
79
  /**
96
80
  * `AdwPreferencesGroup:title`. `null`/`undefined` is the empty string —
97
- * `adw_preferences_group_set_title` normalises NULL to `""`
98
- * (adw-preferences-group.c:508).
81
+ * `adw_preferences_group_set_title` normalises NULL to `""`.
99
82
  */
100
83
  title?: string | null;
101
84
  /**
102
85
  * `AdwPreferencesGroup:description`. Normalised here as well, although
103
86
  * `adw_preferences_group_set_description` passes NULL straight through
104
- * (:555) where its own `set_title` and `adw_preferences_page_set_title`
105
- * (adw-preferences-page.c:538) both normalise — an inconsistency in the C
87
+ * where its own `set_title` and `adw_preferences_page_set_title`
88
+ * both normalise — an inconsistency in the C
106
89
  * with no behavioural consequence, since the visibility test treats NULL and
107
90
  * `""` alike.
108
91
  */
@@ -111,8 +94,8 @@ export interface PreferencesGroupHeaderInput {
111
94
  hasHeaderSuffix?: boolean;
112
95
  /**
113
96
  * How many children the listbox holds. This is the RAW child count —
114
- * `update_listbox_visibility` reads `gtk_widget_observe_children (listbox)`
115
- * (adw-preferences-group.c:111-123), NOT the title-filtered model that
97
+ * `update_listbox_visibility` reads `gtk_widget_observe_children (listbox)`,
98
+ * NOT the title-filtered model that
116
99
  * `get_rows` builds, so a row with an empty title still keeps the card
117
100
  * painted.
118
101
  */
@@ -127,20 +110,20 @@ export interface PreferencesGroupHeaderInput {
127
110
  }
128
111
  /** The five derived visual states of a preferences group. */
129
112
  export interface PreferencesGroupHeaderState {
130
- /** `update_title_visibility` (adw-preferences-group.c:91-99). */
113
+ /** `update_title_visibility`. */
131
114
  titleVisible: boolean;
132
- /** `update_description_visibility` (:101-109). */
115
+ /** `update_description_visibility`. */
133
116
  descriptionVisible: boolean;
134
- /** `update_header_visibility` (:142-156) — the header box takes no space otherwise. */
117
+ /** `update_header_visibility` — the header box takes no space otherwise. */
135
118
  headerVisible: boolean;
136
119
  /**
137
- * `is_single_line` (:125-140), carried as the `single-line` style class.
120
+ * `is_single_line`, carried as the `single-line` style class.
138
121
  * Load-bearing: the stylesheet gives a single-line header `min-height: 34px`
139
122
  * and a multi-line one `margin-bottom: 6px`
140
- * (stylesheet/widgets/_preferences.scss:6-13).
123
+ * (stylesheet/widgets/_preferences.scss).
141
124
  */
142
125
  singleLine: boolean;
143
- /** `update_listbox_visibility` (:111-123) — the `.boxed-list` card is hidden at zero rows. */
126
+ /** `update_listbox_visibility` — the `.boxed-list` card is hidden at zero rows. */
144
127
  listboxVisible: boolean;
145
128
  }
146
129
  /**
@@ -162,9 +145,9 @@ export declare function derivePreferencesGroupHeader(input: PreferencesGroupHead
162
145
  * One indexable row, as the search reasons about it.
163
146
  *
164
147
  * `isActionRow` is load-bearing and is NOT "has a subtitle": only
165
- * `ADW_IS_ACTION_ROW` rows have their subtitle searched
166
- * (adw-preferences-dialog.c:140-146), and `AdwEntryRow` derives from
167
- * `AdwPreferencesRow`, not from `AdwActionRow` (adw-entry-row.c:90) — so the
148
+ * `ADW_IS_ACTION_ROW` rows have their subtitle searched,
149
+ * and `AdwEntryRow` derives from
150
+ * `AdwPreferencesRow`, not from `AdwActionRow` — so the
168
151
  * text typed into an entry row is deliberately not searchable. Same for
169
152
  * `AdwExpanderRow` and `AdwButtonRow`.
170
153
  */
@@ -188,7 +171,7 @@ export interface PreferencesSearchRow<T = unknown> {
188
171
  export interface PreferencesSearchGroup<T = unknown> {
189
172
  /** `AdwPreferencesGroup:title`; an empty one drops out of the result subtitle. */
190
173
  title?: string | null;
191
- /** `is_visible_group` (adw-preferences-page.c:76-82), default `true`. */
174
+ /** `is_visible_group`, default `true`. */
192
175
  visible?: boolean;
193
176
  /** The group's preferences rows, in listbox order. */
194
177
  rows: readonly PreferencesSearchRow<T>[];
@@ -199,7 +182,7 @@ export interface PreferencesSearchGroup<T = unknown> {
199
182
  * One page, as the search reasons about it.
200
183
  *
201
184
  * `visible` is the same flag `ViewStackState.setPageVisible` maintains —
202
- * the dialog's pages ARE an `AdwViewStack` (adw-preferences-dialog.c:707-711),
185
+ * the dialog's pages ARE an `AdwViewStack`,
203
186
  * so a renderer holds the page ORDER and SELECTION there and describes the
204
187
  * same pages here for indexing.
205
188
  */
@@ -228,7 +211,7 @@ export interface PreferencesSearchEntry<T = unknown> {
228
211
  row: PreferencesSearchRow<T>;
229
212
  }
230
213
  /**
231
- * `get_n_pages` (adw-preferences-dialog.c:150-166) — how many pages are visible,
214
+ * `get_n_pages` — how many pages are visible,
232
215
  * which is what decides whether a result subtitle names its page.
233
216
  */
234
217
  export declare function countVisiblePages<T>(pages: readonly PreferencesSearchPage<T>[]): number;
@@ -236,14 +219,14 @@ export declare function countVisiblePages<T>(pages: readonly PreferencesSearchPa
236
219
  * The search corpus: every row the dialog will ever match against.
237
220
  *
238
221
  * This is the filter → map → flatten chain of `adw_preferences_dialog_init`
239
- * (:632-641) composed with `adw_preferences_page_get_rows` (:821-841) and
240
- * `adw_preferences_group_get_rows` (:726-741), i.e. THREE filters written in
222
+ * composed with `adw_preferences_page_get_rows` and
223
+ * `adw_preferences_group_get_rows`, i.e. THREE filters written in
241
224
  * three different C files:
242
225
  *
243
- * 1. visible PAGES only — a `GtkBoolFilter` over `AdwViewStackPage:visible`;
244
- * 2. visible GROUPS only — `is_visible_group`;
245
- * 3. rows that are preferences rows AND visible AND have a NON-EMPTY title —
246
- * `row_has_title`.
226
+ * 1. visible PAGES only — a `GtkBoolFilter` over `AdwViewStackPage:visible`;
227
+ * 2. visible GROUPS only — `is_visible_group`;
228
+ * 3. rows that are preferences rows AND visible AND have a NON-EMPTY title —
229
+ * `row_has_title`.
247
230
  *
248
231
  * Filter 3 is the one a port drops, and dropping it is invisible: nothing
249
232
  * errors, the search just silently indexes rows a user cannot recognise (an
@@ -253,23 +236,23 @@ export declare function countVisiblePages<T>(pages: readonly PreferencesSearchPa
253
236
  */
254
237
  export declare function collectSearchRows<T>(pages: readonly PreferencesSearchPage<T>[]): PreferencesSearchEntry<T>[];
255
238
  /**
256
- * `filter_search_results` (adw-preferences-dialog.c:125-153): whether a row
239
+ * `filter_search_results`: whether a row
257
240
  * matches the current search terms.
258
241
  *
259
242
  * Three properties a port tends to get wrong, all of them user-visible:
260
243
  *
261
- * - it is a SUBSTRING test (`strstr`), not a prefix and not word-boundary —
262
- * `ARK` matches `Dark Style`;
263
- * - the EMPTY query matches everything (`strstr (title, "")` returns `title`),
264
- * which is why the dialog shows "results" and not "no results" before the
265
- * user has typed anything;
266
- * - the query is only case-FOLDED. It is not markup-parsed and not
267
- * mnemonic-stripped, so typing `_` searches for a literal underscore.
244
+ * - it is a SUBSTRING test (`strstr`), not a prefix and not word-boundary —
245
+ * `ARK` matches `Dark Style`;
246
+ * - the EMPTY query matches everything (`strstr (title, "")` returns `title`),
247
+ * which is why the dialog shows "results" and not "no results" before the
248
+ * user has typed anything;
249
+ * - the query is only case-FOLDED. It is not markup-parsed and not
250
+ * mnemonic-stripped, so typing `_` searches for a literal underscore.
268
251
  */
269
252
  export declare function rowMatchesQuery<T>(row: PreferencesSearchRow<T>, query: string, fold?: CaseFolder): boolean;
270
253
  /**
271
- * The translated fallback for a page with no title
272
- * (adw-preferences-dialog.c:218). Exported so a renderer with a translation
254
+ * The translated fallback for a page with no title.
255
+ * Exported so a renderer with a translation
273
256
  * catalogue can pass its own through `untitledPageLabel`.
274
257
  */
275
258
  export declare const UNTITLED_PAGE_LABEL = "Untitled page";
@@ -292,21 +275,21 @@ export interface SearchRowSubtitleInput {
292
275
  untitledPageLabel?: string;
293
276
  }
294
277
  /**
295
- * `create_search_row_subtitle` (adw-preferences-dialog.c:168-234) — the second
278
+ * `create_search_row_subtitle` — the second
296
279
  * line of a search result, e.g. `General → Appearance`.
297
280
  *
298
281
  * The rules, in the order the C applies them, none of them symmetric:
299
282
  *
300
- * - an empty GROUP title becomes "absent", and the whole `page → group` join
301
- * is then skipped — the result falls through to the bare page title;
302
- * - the PAGE title is mnemonic-stripped when the PAGE uses underline, then
303
- * markup-escaped when the ROW uses markup (a page-level property and a
304
- * row-level property deciding two steps on the same string), and only then
305
- * tested for emptiness;
306
- * - the join happens only when more than one page is VISIBLE; with a single
307
- * page the subtitle is the group title alone;
308
- * - the group title is NOT escaped, so the two halves of `page → group` are
309
- * escaped differently on purpose.
283
+ * - an empty GROUP title becomes "absent", and the whole `page → group` join
284
+ * is then skipped — the result falls through to the bare page title;
285
+ * - the PAGE title is mnemonic-stripped when the PAGE uses underline, then
286
+ * markup-escaped when the ROW uses markup (a page-level property and a
287
+ * row-level property deciding two steps on the same string), and only then
288
+ * tested for emptiness;
289
+ * - the join happens only when more than one page is VISIBLE; with a single
290
+ * page the subtitle is the group title alone;
291
+ * - the group title is NOT escaped, so the two halves of `page → group` are
292
+ * escaped differently on purpose.
310
293
  *
311
294
  * `null` means "no subtitle at all", which is what a renderer should render as
312
295
  * an absent line rather than as an empty one.
@@ -314,7 +297,7 @@ export interface SearchRowSubtitleInput {
314
297
  export declare function createSearchRowSubtitle(input: SearchRowSubtitleInput): string | null;
315
298
  /** One row of the search results list. */
316
299
  export interface PreferencesSearchResult<T = unknown> {
317
- /** Copied verbatim from the matched row (`new_search_row_for_preference`, :245-256). */
300
+ /** Copied verbatim from the matched row (`new_search_row_for_preference`). */
318
301
  title: string;
319
302
  /** {@link createSearchRowSubtitle}; `null` when there is nothing to show. */
320
303
  subtitle: string | null;
@@ -342,7 +325,7 @@ export interface SearchPreferencesOptions {
342
325
  * `GtkFlattenListModel` produces).
343
326
  *
344
327
  * Each result carries the source `page`/`group`/`row` so a renderer can
345
- * implement `search_result_activated_cb` (adw-preferences-dialog.c:267-290) —
328
+ * implement `search_result_activated_cb` —
346
329
  * switch the visible page, focus the row — without re-deriving anything.
347
330
  */
348
331
  export declare function searchPreferences<T>(pages: readonly PreferencesSearchPage<T>[], query: string, options?: SearchPreferencesOptions): PreferencesSearchResult<T>[];
@@ -40,34 +40,25 @@ export type AdwComboOptionInput = string | {
40
40
  label?: unknown;
41
41
  };
42
42
  /**
43
- * Raw authored options → the stable `{ value, label }` descriptors every combo
44
- * surface works with.
43
+ * Raw authored options → the stable `{ value, label }` descriptors every combo surface
44
+ * works with.
45
45
  *
46
46
  * A bare string is both value and label (`Gtk.StringList`'s model, which is what
47
- * `Adw.ComboRow` is fed in the common case). In a descriptor either half stands
48
- * in for the missing other, so `{ label: 'Apple' }` is addressable by the value
49
- * `'Apple'` rather than by `undefined`.
50
- *
51
- * ONE home, because there were two: `<adw-combo-row>` mapped `string[]` inline
52
- * from its JSON attribute while `<adw-drop-down>` carried a private
53
- * `normalizeOptions` that also handled descriptors — so the same widget family
54
- * accepted two different option vocabularies depending on which element you
55
- * reached for.
47
+ * `Adw.ComboRow` is fed in the common case). In a descriptor either half stands in for the
48
+ * missing other, so `{ label: 'Apple' }` is addressable by the value `'Apple'` rather than
49
+ * by `undefined`. ONE home for the rule, so `<adw-combo-row>` and `<adw-drop-down>` cannot
50
+ * accept two different option vocabularies.
56
51
  */
57
52
  export declare function normalizeComboOptions(raw: ReadonlyArray<AdwComboOptionInput> | null | undefined): AdwComboOption[];
58
53
  /**
59
54
  * The "no item is selected" index — the TS mirror of `GTK_INVALID_LIST_POSITION`
60
- * (`AdwComboRow:selected`'s default and empty value, adw-combo-row.c:593-596,
61
- * :809-810).
62
- *
63
- * libadwaita spells it `G_MAXUINT` because the property is a `guint`; `-1` is the
64
- * idiomatic TS sentinel and the spelling {@link ADW_SIDEBAR_NO_SELECTION} already
65
- * uses for the same GTK constant.
55
+ * (`AdwComboRow:selected`'s default and empty value).
66
56
  *
67
- * It exists because an EMPTY model and a model whose first item happens to have
68
- * an empty label were previously indistinguishable: both reported index 0 with
69
- * `selectedValue === ''`. A renderer that wants to draw a placeholder had nothing
70
- * to test.
57
+ * libadwaita spells it `G_MAXUINT` because the property is a `guint`; `-1` is the idiomatic
58
+ * TS sentinel and the spelling {@link ADW_SIDEBAR_NO_SELECTION} uses for the same GTK
59
+ * constant. Without it, an EMPTY model and a model whose first item has an empty label are
60
+ * indistinguishable — both report index 0 with `selectedValue === ''` — so a renderer that
61
+ * wants to draw a placeholder has nothing to test.
71
62
  */
72
63
  export declare const ADW_COMBO_NO_SELECTION = -1;
73
64
  /** Payload of a {@link ComboState} change. */
@@ -102,38 +93,33 @@ export declare class ComboState {
102
93
  /** The selectable options. */
103
94
  get options(): AdwComboOption[];
104
95
  /**
105
- * Replace the options, then notify (`interactive: false`) so the renderer
106
- * re-syncs the inline value label — which may change even at an unchanged
107
- * index, because the label is read out of the MODEL.
96
+ * Replace the options, then notify (`interactive: false`) so the renderer re-syncs the
97
+ * inline value label — which may change even at an unchanged index, because the label is
98
+ * read out of the MODEL.
108
99
  *
109
- * Replacing the model re-runs autoselect, so an index the new one does not
110
- * have falls back to 0 — including the sentinel, which is how a row recovers
111
- * a selection when its model grows. An EMPTY model has no 0 to fall back to
112
- * and lands on {@link ADW_COMBO_NO_SELECTION}; that case is the one both
113
- * ports used to spell as index 0.
100
+ * Replacing the model re-runs autoselect, so an index the new one does not have falls
101
+ * back to 0 — including the sentinel, which is how a row recovers a selection when its
102
+ * model grows. An EMPTY model has no 0 to fall back to and lands on
103
+ * {@link ADW_COMBO_NO_SELECTION}.
114
104
  *
115
- * The check is `hasIndex`, not `selected >= length`: the sentinel is BELOW
116
- * the range, so the one-sided comparison left a `-1` in place and a model
117
- * that had been emptied and refilled came back with nothing selected.
105
+ * The check is `hasIndex`, not `selected >= length`: the sentinel is BELOW the range, so
106
+ * a one-sided comparison leaves a `-1` in place and a model that was emptied and
107
+ * refilled comes back with nothing selected.
118
108
  */
119
109
  setOptions(options: AdwComboOption[]): void;
120
110
  /**
121
- * The selected option index, or {@link ADW_COMBO_NO_SELECTION}.
122
- *
123
- * May also sit PAST the options length: {@link setSelectedIndex} is
124
- * deliberately permissive, mirroring a `guint` property that takes any
125
- * position. {@link selectedValue} reads `''` in both cases, which is why the
126
- * sentinel is what distinguishes "nothing selected" from "an empty label".
111
+ * The selected option index, or {@link ADW_COMBO_NO_SELECTION}. May also sit PAST the
112
+ * options length: {@link setSelectedIndex} is deliberately permissive, mirroring a
113
+ * `guint` property that takes any position. {@link selectedValue} reads `''` in both
114
+ * cases, which is why the sentinel is what distinguishes "nothing selected" from "an
115
+ * empty label".
127
116
  */
128
117
  get selectedIndex(): number;
129
118
  /**
130
- * Whether the row presents itself as a CHOOSER — `model_changed`
131
- * (adw-combo-row.c:187-195) makes the arrow visible and the row activatable
132
- * on `n_items > 1` and hides both otherwise.
133
- *
134
- * One item or none is not a choice, so `Adw.ComboRow` stops looking like one:
135
- * no chevron, and tapping does nothing. Neither port did this, so a
136
- * single-option row showed its arrow and opened a chooser with one entry.
119
+ * Whether the row presents itself as a CHOOSER — `model_changed` makes the arrow visible
120
+ * and the row activatable on `n_items > 1`, and hides both otherwise. One item or none is
121
+ * not a choice, so `Adw.ComboRow` stops looking like one: no chevron, and tapping does
122
+ * nothing.
137
123
  */
138
124
  get presentsChooser(): boolean;
139
125
  /** Programmatic index set — notifies `interactive: false`. Returns whether it changed. */
@@ -147,29 +133,25 @@ export declare class ComboState {
147
133
  /**
148
134
  * Whether `index` addresses an option that exists.
149
135
  *
150
- * The bounds arithmetic lives here; the POLICY for a programmatic
151
- * out-of-range set does not, because this tree cannot settle it:
152
- * `adw_combo_row_set_selected` forwards the position straight to
153
- * `gtk_single_selection_set_selected` (adw-combo-row.c:788) and documents
154
- * `GTK_INVALID_LIST_POSITION` as a legal argument, but `refs/gtk` is EMPTY
155
- * so what GtkSingleSelection does with it is not verifiable here. So each
156
- * renderer states its own answer against this one predicate:
157
- * {@link setSelectedIndex} keeps the permissive model (an index past the end
158
- * is how "nothing selected" is spelled — {@link selectedValue} then reads
159
- * `''`), while `<adw-drop-down>` rejects the set, as its published `selected`
160
- * docs promise. Neither re-derives `index >= 0 && index < count`.
136
+ * The bounds arithmetic lives here; the POLICY for a programmatic out-of-range set does
137
+ * not, because this tree cannot settle it: `adw_combo_row_set_selected` forwards the
138
+ * position straight to `gtk_single_selection_set_selected` and documents
139
+ * `GTK_INVALID_LIST_POSITION` as a legal argument, but `refs/gtk` is EMPTY so what
140
+ * GtkSingleSelection does with it is not verifiable here. Each renderer therefore states
141
+ * its own answer against this one predicate: {@link setSelectedIndex} keeps the permissive
142
+ * model (an index past the end is how "nothing selected" is spelled and
143
+ * {@link selectedValue} reads `''`), while `<adw-drop-down>` rejects the set, as its
144
+ * published `selected` docs promise.
161
145
  */
162
146
  hasIndex(index: number): boolean;
163
147
  /**
164
148
  * Select an option by index as a USER pick (the chooser result) — notifies
165
- * `interactive: true`. A no-op (returns false) for the already-selected index
166
- * or one that addresses no option, matching the renderer's chooser guard.
149
+ * `interactive: true`. A no-op for the already-selected index or one that addresses no
150
+ * option.
167
151
  *
168
- * The upper bound is part of that guard: a pick is a pick OF something, so
169
- * `select(99)` on a three-option model is not "select nothing", it is a
170
- * chooser reporting an index the model does not have. Only the negative half
171
- * used to be checked, which left the interactive path able to move the index
172
- * somewhere {@link setSelectedIndex} would have called "no selection".
152
+ * The UPPER bound is part of that guard: a pick is a pick OF something, so `select(99)` on
153
+ * a three-option model is not "select nothing", it is a chooser reporting an index the
154
+ * model does not have.
173
155
  */
174
156
  select(index: number): boolean;
175
157
  /** Number of options. */
@@ -0,0 +1,79 @@
1
+ /** One keycap. `sideMarker` is the `L`/`R` subscript of a sided modifier key. */
2
+ export interface ShortcutKeycap {
3
+ /** The untranslated label — a `GTK_KEY_LABEL` msgid, a character, or a glyph. */
4
+ label: string;
5
+ /** `L` or `R` for `Control_L` / `Control_R` and friends (:115-196). */
6
+ sideMarker?: 'L' | 'R';
7
+ }
8
+ /** One node of the rendered label, in order. */
9
+ export type ShortcutLabelNode =
10
+ /** A combination: keycaps drawn side by side, no separator (:370-395). */
11
+ {
12
+ readonly kind: 'keys';
13
+ readonly keys: readonly ShortcutKeycap[];
14
+ }
15
+ /** A dimmed separator between groups (:359-368). */
16
+ | {
17
+ readonly kind: 'separator';
18
+ readonly text: string;
19
+ }
20
+ /** The `disabled-text` placeholder, shown for an empty accelerator (:513-520). */
21
+ | {
22
+ readonly kind: 'disabled';
23
+ readonly text: string;
24
+ };
25
+ /** What a renderer needs to draw one `AdwShortcutLabel`. */
26
+ export interface ShortcutLabelParse {
27
+ /** The nodes, in visual order. */
28
+ readonly nodes: readonly ShortcutLabelNode[];
29
+ /** The `aria-label` GTK builds alongside the widgets (:423-424, :538-540). */
30
+ readonly accessibleLabel: string;
31
+ /**
32
+ * The fragment that failed to parse, or `null`.
33
+ *
34
+ * GTK warns and stops mid-build (:531-534), keeping whatever it had already
35
+ * placed — so `nodes` is the partial result, not an empty one.
36
+ */
37
+ readonly error: string | null;
38
+ }
39
+ /** Options a renderer supplies from its own environment. */
40
+ export interface ShortcutLabelOptions {
41
+ /** Shown when the accelerator is empty (:513-520). Defaults to `''`. */
42
+ readonly disabledText?: string;
43
+ /** Text direction — picks the sequence arrow (:439, :447). */
44
+ readonly direction?: 'ltr' | 'rtl';
45
+ /**
46
+ * Which modifier glyphs to use.
47
+ *
48
+ * The C picks this at COMPILE time with `#ifdef __APPLE__` (:153-182,
49
+ * :216-245, :318-331), so it is a build constant there and a runtime option
50
+ * here — a renderer knows its platform, and a browser one can be running on
51
+ * either.
52
+ */
53
+ readonly platform?: 'default' | 'apple';
54
+ }
55
+ /** The modifier bits `gtk_accelerator_parse` understands, in GTK's spelling. */
56
+ type Modifier = 'shift' | 'control' | 'alt' | 'meta' | 'super' | 'hyper';
57
+ /** An accelerator split into its modifiers and its key name. */
58
+ interface ParsedAccelerator {
59
+ readonly modifiers: ReadonlySet<Modifier>;
60
+ readonly key: string;
61
+ }
62
+ /**
63
+ * `gtk_accelerator_parse`, over names instead of keyvals.
64
+ *
65
+ * Returns `null` for a malformed accelerator — an unterminated `<`, an unknown
66
+ * modifier name, or no key at all. Every one of those is decidable without the
67
+ * keysym table; an unknown KEY name is not, and is accepted (see the header).
68
+ */
69
+ export declare function parseAccelerator(accelerator: string, platform?: 'default' | 'apple'): ParsedAccelerator | null;
70
+ /** Every keycap of one accelerator: modifiers in GTK's order, then the key (:198-357). */
71
+ export declare function shortcutKeycaps(accelerator: string, platform?: 'default' | 'apple'): readonly ShortcutKeycap[] | null;
72
+ /**
73
+ * Parse an accelerator into the nodes a renderer draws.
74
+ *
75
+ * The four grammar levels of the widget's own `rebuild` → `parse_range` →
76
+ * `parse_sequence` → `parse_combination` chain (:398-544), in that nesting.
77
+ */
78
+ export declare function parseShortcutLabel(accelerator: string, options?: ShortcutLabelOptions): ShortcutLabelParse;
79
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;