@gjsify/adwaita-nativescript 0.36.0 → 0.38.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 (37) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/lib/esm/widgets/accent-theme.js +2 -0
  3. package/lib/esm/widgets/adw-accent.js +1 -0
  4. package/lib/esm/widgets/adw-shortcut-label.js +1 -0
  5. package/lib/esm/widgets/index.js +1 -1
  6. package/lib/esm/widgets/shortcut-label.js +1 -0
  7. package/lib/types/accent-theme.spec.d.ts +2 -0
  8. package/lib/types/index.d.ts +2 -2
  9. package/lib/types/shortcut-label.spec.d.ts +2 -0
  10. package/lib/types/widgets/accent-theme.d.ts +30 -0
  11. package/lib/types/widgets/adw-accent.d.ts +12 -0
  12. package/lib/types/widgets/adw-action-row.d.ts +27 -43
  13. package/lib/types/widgets/adw-data-grid.d.ts +4 -10
  14. package/lib/types/widgets/adw-entry-row.d.ts +20 -29
  15. package/lib/types/widgets/adw-shortcut-label.d.ts +13 -0
  16. package/lib/types/widgets/button-content.d.ts +12 -21
  17. package/lib/types/widgets/carousel-state.d.ts +15 -18
  18. package/lib/types/widgets/chrome.d.ts +22 -47
  19. package/lib/types/widgets/data-grid-model.d.ts +25 -36
  20. package/lib/types/widgets/index.d.ts +6 -0
  21. package/lib/types/widgets/navigation-stack.d.ts +2 -13
  22. package/lib/types/widgets/preferences-group-state.d.ts +7 -13
  23. package/lib/types/widgets/preferences-search.d.ts +5 -5
  24. package/lib/types/widgets/row-state.d.ts +17 -33
  25. package/lib/types/widgets/shortcut-label.d.ts +54 -0
  26. package/lib/types/widgets/sidebar-model.d.ts +5 -7
  27. package/lib/types/widgets/split-button.d.ts +17 -34
  28. package/lib/types/widgets/split-view-base.d.ts +17 -24
  29. package/lib/types/widgets/split-view-state.d.ts +48 -76
  30. package/lib/types/widgets/split-view-width.d.ts +21 -32
  31. package/lib/types/widgets/status-page-content.d.ts +9 -14
  32. package/lib/types/widgets/tab-view-state.d.ts +18 -34
  33. package/lib/types/widgets/view-switcher-base.d.ts +11 -30
  34. package/lib/types/widgets/view-switcher-model.d.ts +17 -34
  35. package/lib/types/widgets/wrap-box-layout.d.ts +22 -37
  36. package/package.json +7 -7
  37. package/src/theme/adwaita.css +77 -0
@@ -17,10 +17,8 @@ export declare function defaultClampProps(): ClampProps;
17
17
  /**
18
18
  * Normalise one clamp property, keeping a nonsense value out of the layout.
19
19
  *
20
- * Delegates to core so the NativeScript widget and the browser element agree on
21
- * the three inputs they used to answer differently — `0` (valid, and NOT the
22
- * default), a non-numeric value (never reaches the layout, so the DEFAULT
23
- * applies), and a negative (clamped to the range floor).
20
+ * The three inputs worth knowing: `0` is valid and NOT the default, a non-numeric
21
+ * value falls back to the DEFAULT, a negative is clamped to the range floor.
24
22
  */
25
23
  export declare function normalizeClampProp(value: number | string | null | undefined, fallback: number): number;
26
24
  /** What one clamp layout pass tells the widget to do with its child. */
@@ -37,55 +35,41 @@ export interface ClampAllocationForWidth {
37
35
  /**
38
36
  * The child width and size class for a clamp `availableWidth` DIPs wide.
39
37
  *
40
- * `availableWidth <= 0` means NativeScript has not laid the view out yet — it
41
- * reports a zero size before the first pass — and the honest answer there is
42
- * "do not constrain", the same shape `sidebarWidthFor` uses for the same reason.
43
- * Anything else runs libadwaita's curve, so a narrow container yields a narrow
44
- * child rather than the maximum.
38
+ * `availableWidth <= 0` means NativeScript has not laid the view out yet (it
39
+ * reports a zero size before the first pass), and the honest answer there is "do
40
+ * not constrain" — the same shape `sidebarWidthFor` uses for the same reason.
45
41
  *
46
42
  * `childMin`/`childNat` are 0: NativeScript does not expose a child's measured
47
43
  * minimum before layout, and `lower = MAX (…, child_min)` only ever RAISES the
48
- * child's width — an NS child whose own content is wider than the clamp already
49
- * overflows rather than being cut, so nothing is lost by leaving it out.
44
+ * child's width — an NS child wider than the clamp already overflows rather than
45
+ * being cut, so nothing is lost by leaving it out.
50
46
  */
51
47
  export declare function clampAllocationFor(availableWidth: number, props: ClampProps): ClampAllocationForWidth;
52
- /**
53
- * Default spinner diameter in DIPs — `Adw.Spinner`'s measured natural size,
54
- * which equals its minimum (adw-spinner.c:78-81).
55
- *
56
- * Replaces an invented 32: nothing in libadwaita produces that number.
57
- */
48
+ /** Default spinner diameter in DIPs — `Adw.Spinner`'s natural size, which equals its minimum. */
58
49
  export declare const DEFAULT_SPINNER_SIZE = 16;
59
50
  /**
60
51
  * The RING diameter for a requested BOX size — floored at the measured minimum
61
52
  * 16 and capped at Adwaita's 64, with the odd-size flooring (`31` draws a 30 DIP
62
53
  * ring) coming from the paintable rather than from here.
63
54
  *
64
- * The two are different numbers, which is the whole point: `AdwSpinner` sizes
65
- * its BOX to the request and its `ActivityIndicator` to this. They used to be
66
- * one, so `size = 200` occupied 64 DIPs of layout where GTK occupies 200.
55
+ * Box and ring are deliberately different numbers: `AdwSpinner` sizes its BOX to
56
+ * the request and its `ActivityIndicator` to this, so `size = 200` occupies 200
57
+ * DIPs of layout around a 64 DIP ring.
67
58
  */
68
59
  export declare function spinnerDiameter(value: number | string | null | undefined): number;
69
60
  /** The four toolbar-view properties the style classes are derived from. */
70
61
  export interface ToolbarViewProps {
71
- /** `top-bar-style`. */
72
62
  topBarStyle: AdwToolbarStyle;
73
- /** `bottom-bar-style`. */
74
63
  bottomBarStyle: AdwToolbarStyle;
75
- /** `extend-content-to-top-edge`. */
76
64
  extendContentToTopEdge: boolean;
77
- /** `extend-content-to-bottom-edge`. */
78
65
  extendContentToBottomEdge: boolean;
79
66
  }
80
67
  /** The property defaults a fresh toolbar view starts with. */
81
68
  export declare function defaultToolbarViewProps(): ToolbarViewProps;
82
69
  /** The three `className` strings a toolbar view distributes over its own node and its two bar boxes. */
83
70
  export interface ToolbarViewClassNames {
84
- /** `className` for the view. */
85
71
  view: string;
86
- /** `className` for the top-bar box. */
87
72
  topBar: string;
88
- /** `className` for the bottom-bar box. */
89
73
  bottomBar: string;
90
74
  }
91
75
  /**
@@ -105,42 +89,33 @@ export declare function clampChildClassName(current: string, sizeClass: AdwClamp
105
89
  export type BannerProps = AdwBannerProps;
106
90
  /**
107
91
  * The property defaults a fresh banner starts with — libadwaita's, not this
108
- * port's.
109
- *
110
- * This is the whole reason the banner is here. `AdwBanner` used to initialise
111
- * `_revealed = true` AND never write `visibility` in its constructor, so a
112
- * banner put itself on screen on a device while the same markup stayed hidden in
113
- * the browser. `Adw.Banner:revealed` defaults to FALSE (adw-banner.c:456-459) —
114
- * "Banners are hidden by default" (:47) — and `use-markup` to TRUE (:422-425),
115
- * which the port had backwards as well.
92
+ * port's. The two easy ones to get backwards: `Adw.Banner:revealed` defaults to
93
+ * FALSE (banners are hidden until revealed) and `use-markup` to TRUE.
116
94
  */
117
95
  export declare function defaultBannerProps(): BannerProps;
118
96
  /**
119
97
  * The text the NS title `Label` is given.
120
98
  *
121
- * `Adw.Banner`'s title is Pango markup by default (:422-425) and the NS CSS
122
- * subset has no inline-markup layer at all, so the honest reduction is the
123
- * markup's PLAIN TEXT: `<b>Metered</b>` reads `Metered`, which is what GTK
124
- * paints minus the weight, where writing the raw string would paint the tags.
125
- * Unparseable markup keeps the raw string, reproducing the C fallback that
126
- * {@link stripMarkup} already models.
99
+ * `Adw.Banner`'s title is Pango markup by default and the NS CSS subset has no
100
+ * inline-markup layer, so the honest reduction is the markup's PLAIN TEXT:
101
+ * `<b>Metered</b>` reads `Metered`, where the raw string would paint the tags.
102
+ * Unparseable markup keeps the raw string, reproducing the C fallback.
127
103
  */
128
104
  export declare function bannerTitleText(title: string, useMarkup: boolean): string;
129
105
  /**
130
106
  * The NS `visibility` for a `revealed` value.
131
107
  *
132
- * `Adw.Banner` reveals through a `GtkRevealer` (:817); the NS subset has no
133
- * revealer, so `collapse` — which takes the view out of layout entirely — is the
134
- * closest thing to a fully retracted one.
108
+ * `Adw.Banner` reveals through a `GtkRevealer`; the NS subset has none, so
109
+ * `collapse` — which takes the view out of layout entirely — is the closest thing
110
+ * to a fully retracted one.
135
111
  */
136
112
  export declare function bannerVisibility(revealed: boolean): 'visible' | 'collapse';
137
113
  /**
138
114
  * The `className` for the banner button — the managed `button-style` class
139
115
  * swapped in, every other token left alone.
140
116
  *
141
- * `adw_banner_set_button_style` only ever adds or removes `suggested-action`
142
- * (:766, :769); it never rewrites the button's class list, and neither does
143
- * this.
117
+ * `adw_banner_set_button_style` only ever adds or removes `suggested-action`; it
118
+ * never rewrites the button's class list, and neither does this.
144
119
  */
145
120
  export declare function bannerButtonClassName(current: string, style: AdwBannerButtonStyle): string;
146
121
  /**
@@ -2,9 +2,8 @@ import type { AdwDataGridRowVariant, DataGridTrack } from '@gjsify/adwaita-core'
2
2
  import type { GridUnitType } from '@nativescript/core';
3
3
  /** The two numbers a NativeScript `ItemSpec` is constructed from. */
4
4
  export interface DataGridItemSpec {
5
- /** The `ItemSpec` value: a star weight, a pixel length, or 1 for `auto`. */
5
+ /** A star weight, a pixel length, or 1 for `auto`. */
6
6
  value: number;
7
- /** The `GridUnitType` — `'star'`, `'pixel'` or `'auto'`. */
8
7
  type: GridUnitType;
9
8
  }
10
9
  /** The class the header row's background carries. */
@@ -20,18 +19,15 @@ export declare const DATA_GRID_HEADER_CELL_CLASS = "header-cell";
20
19
  * `DataGridTrack`'s `fixed` kind carries the author's `width` string verbatim,
21
20
  * because only a CSS engine can resolve every unit CSS has. NativeScript has
22
21
  * exactly one length unit — the DIP — and its own stylesheet subset writes it as
23
- * a bare number (`min-height: 34`, `padding: 5 10 5 10`), so BOTH `'80px'` and
24
- * `'80'` are read as 80 here and everything else (`6rem`, `50%`, `calc(...)`)
25
- * is unresolvable and falls back to a content-sized track.
22
+ * a bare number (`min-height: 34`), so BOTH `'80px'` and `'80'` are read as 80
23
+ * here and everything else (`6rem`, `50%`, `calc(...)`) falls back to a
24
+ * content-sized track.
26
25
  *
27
- * That bare-number acceptance is a deliberate divergence from the browser, where
28
- * `width: '80'` is not a valid CSS length and takes the WHOLE
29
- * `grid-template-columns` declaration down with it. Falling back to `auto` for
30
- * one column is the smaller failure, and refusing a spelling that is valid in
31
- * this renderer's own stylesheet would be the surprising half.
32
- *
33
- * A negative or non-finite length is rejected rather than clamped: `ItemSpec`
34
- * refuses one, and a column silently pinned to 0 reads as a missing column.
26
+ * Accepting a bare number diverges from the browser deliberately, where `width:
27
+ * '80'` is not a valid CSS length and takes the whole `grid-template-columns`
28
+ * declaration down with it; falling back to `auto` for one column is the smaller
29
+ * failure. A negative or non-finite length is rejected rather than clamped:
30
+ * `ItemSpec` refuses one, and a column silently pinned to 0 reads as missing.
35
31
  */
36
32
  export declare function parseDataGridWidth(css: string): number | null;
37
33
  /**
@@ -54,14 +50,11 @@ export declare function dataGridItemSpec(track: DataGridTrack): DataGridItemSpec
54
50
  /**
55
51
  * A stable key for a track list — what the widget re-declares its columns on.
56
52
  *
57
- * The precedent is `AdwViewSwitcherBar`, which rebuilds its buttons only when the
58
- * page COUNT moves so that a selection change cannot replace the button under
59
- * the user's finger. The same discipline applies here, with one difference the
60
- * grid forces: a column list can change WITHOUT changing length — pinning a
61
- * column's `width` on a narrow screen is exactly that — and a count guard would
62
- * keep painting against the old tracks. So the guard is the tracks themselves,
63
- * which is a strict superset: whenever the count moves the key moves too, and a
64
- * repaint (new rows, a toggled `interactive`) never touches the columns.
53
+ * The guard is the tracks themselves, not their COUNT: a column list can change
54
+ * without changing length (pinning a column's `width` on a narrow screen does
55
+ * exactly that) and a count guard would keep painting against the old tracks.
56
+ * Whenever the count moves the key moves too, and a repaint (new rows, a toggled
57
+ * `interactive`) never touches the columns.
65
58
  */
66
59
  export declare function dataGridTracksKey(tracks: ReadonlyArray<DataGridTrack>): string;
67
60
  /**
@@ -76,12 +69,12 @@ export declare function dataGridShapeKey(columnCount: number, rowCount: number):
76
69
  /**
77
70
  * The classes a data row's background carries.
78
71
  *
79
- * The row background is a NativeScript-only node and this is why it exists: the
80
- * browser paints the fill, the hairline rules and the hover affordance on the
81
- * row ELEMENT, which is a real element there because it is a subgrid. Here the
82
- * cells are direct children of the one grid, so a full-width `StackLayout`
83
- * placed first at the same row — below the cells, spanning every column — is
84
- * what carries them, plus the tap target and the press feedback.
72
+ * The row background is a NativeScript-only node: the browser paints the fill, the
73
+ * hairline rules and the hover affordance on the row ELEMENT, which is a real
74
+ * element there because it is a subgrid. Here the cells are direct children of the
75
+ * one grid, so a full-width `StackLayout` placed first at the same row — below the
76
+ * cells, spanning every column — carries them plus the tap target and press
77
+ * feedback.
85
78
  *
86
79
  * `interactive` is a class rather than a widget flag so the press-darken keys off
87
80
  * it: `attachRowPressFeedback` is wired on EVERY data row, and a non-interactive
@@ -91,14 +84,10 @@ export declare function dataGridRowClass(variant: AdwDataGridRowVariant, interac
91
84
  /**
92
85
  * The classes a body cell carries: its column's own, plus the row's variant.
93
86
  *
94
- * The variant is repeated onto the CELL because of the same structural
95
- * difference: the browser bolds a subtotal's figures with
96
- * `.variant-subtotal .adw-data-grid-cell`, a DESCENDANT selector, and here the
97
- * cell is not inside the row background — the two are siblings in one grid. So
98
- * the row class cannot reach the cells and the cell has to say it itself.
99
- *
100
- * `normal` adds nothing: it is every row in a statement but the handful that
101
- * carry emphasis, and a class the stylesheet has no rule for is only noise in
102
- * the one place a reader looks when the emphasis is wrong.
87
+ * The variant is repeated onto the CELL because the browser bolds a subtotal's
88
+ * figures with a DESCENDANT selector (`.variant-subtotal .adw-data-grid-cell`)
89
+ * while here cell and row background are SIBLINGS in one grid — the row class
90
+ * cannot reach the cells. `normal` adds nothing, since the stylesheet has no rule
91
+ * for it.
103
92
  */
104
93
  export declare function dataGridCellClass(columnClasses: ReadonlyArray<string>, variant: AdwDataGridRowVariant): string;
@@ -43,6 +43,12 @@ export { AdwSplitButton, CLICKED, MENU_TAPPED } from './adw-split-button.js';
43
43
  export type { MenuTappedEventData } from './adw-split-button.js';
44
44
  export { AdwToggleGroup, NOTIFY_SELECTED as NOTIFY_TOGGLE_SELECTED, ToggleGroupState } from './adw-toggle-group.js';
45
45
  export type { NotifyToggleSelectedEventData, ToggleGroupStateChange, ToggleGroupStateListener, } from './adw-toggle-group.js';
46
+ export { applyAdwaitaNsAccent, clearAdwaitaNsAccent } from './adw-accent.js';
47
+ export { ADWAITA_NS_ACCENT_RULES, adwaitaNsAccentColor, adwaitaNsAccentCss } from './accent-theme.js';
48
+ export type { AccentRole, AccentRule } from './accent-theme.js';
49
+ export { AdwShortcutLabel } from './adw-shortcut-label.js';
50
+ export { SHORTCUT_LABEL_CAP_TEXT_CLASS, SHORTCUT_LABEL_CLASS, SHORTCUT_LABEL_DIMMED_CLASS, SHORTCUT_LABEL_DISABLED_CLASS, SHORTCUT_LABEL_KEYCAP_CLASS, SHORTCUT_LABEL_KEYS_CLASS, SHORTCUT_LABEL_SIDE_CLASS, SHORTCUT_LABEL_SPACED_CLASS, shortcutLabelDirection, shortcutLabelPlatform, shortcutLabelRenderPlan, } from './shortcut-label.js';
51
+ export type { ShortcutLabelRenderPlan, ShortcutLabelViewSpec } from './shortcut-label.js';
46
52
  export { AdwViewStack, NOTIFY_VISIBLE_CHILD } from './adw-view-stack.js';
47
53
  export type { AdwViewStackPage, NotifyVisibleChildEventData } from './adw-view-stack.js';
48
54
  export { AdwViewSwitcherBase, NOTIFY_SELECTED as NOTIFY_VIEW_SELECTED } from './view-switcher-base.js';
@@ -61,11 +61,8 @@ export declare class NsNavigationStack {
61
61
  private readonly _onDiagnostic;
62
62
  private _pending;
63
63
  constructor(host: NsNavigationHost, options?: NsNavigationStackOptions);
64
- /** The currently-visible page view, or `null`. */
65
64
  get visiblePage(): View | null;
66
- /** The currently-visible page tag, or `null`. */
67
65
  get visiblePageTag(): string | null;
68
- /** The current navigation stack depth. */
69
66
  get depth(): number;
70
67
  /** The navigation stack, bottom-first. */
71
68
  get stack(): readonly View[];
@@ -79,7 +76,6 @@ export declare class NsNavigationStack {
79
76
  get animateTransitions(): boolean;
80
77
  /** `Adw.NavigationView:pop-on-escape` — consulted by {@link popFromEscape}. */
81
78
  get popOnEscape(): boolean;
82
- /** Whether `view` is known to this navigation view. */
83
79
  isRegistered(view: View): boolean;
84
80
  /** `view`'s tag, or `null`. */
85
81
  tagOf(view: View): string | null;
@@ -87,7 +83,6 @@ export declare class NsNavigationStack {
87
83
  titleOf(view: View): string;
88
84
  /** Whether `view` may be popped by a shortcut or a back button. */
89
85
  canPopOf(view: View): boolean;
90
- /** The page with this tag, or `null`. */
91
86
  findPage(tag: string): View | null;
92
87
  /** The page popping `view` would reveal, or `null`. */
93
88
  getPreviousPage(view: View): View | null;
@@ -104,21 +99,17 @@ export declare class NsNavigationStack {
104
99
  remove(view: View): boolean;
105
100
  /** Push a page (a previously-registered tag, or a fresh view) onto the stack. */
106
101
  push(viewOrTag: View | string, options?: AdwNavigationPageProps): boolean;
107
- /** Push the page carrying `tag`. */
108
102
  pushByTag(tag: string): boolean;
109
103
  /** Pop the top page. `can-pop` does NOT gate this — it gates the shortcuts. */
110
104
  pop(): boolean;
111
105
  /** Pop until `view` is visible, in ONE transition. */
112
106
  popToPage(view: View): boolean;
113
- /** Pop until the page carrying `tag` is visible. */
114
107
  popToTag(tag: string): boolean;
115
108
  /**
116
- * Replace the whole stack. String entries are resolved BEFORE anything is
117
- * mutated, so replacing the stack with the tag of a dynamically-pushed page
118
- * keeps that page (replace_with_tags:3136-3147).
109
+ * Replace the whole stack. String entries are resolved BEFORE anything is mutated,
110
+ * so replacing the stack with the tag of a dynamically-pushed page keeps that page.
119
111
  */
120
112
  replace(entries: ReadonlyArray<View | string | null>, props?: (view: View) => AdwNavigationPageProps | undefined): void;
121
- /** Replace the stack with the pages carrying `tags`. */
122
113
  replaceWithTags(tags: readonly string[]): void;
123
114
  /** Set a page's tag. Rejected when another page already owns it. */
124
115
  setTag(view: View, tag: string | null): boolean;
@@ -126,9 +117,7 @@ export declare class NsNavigationStack {
126
117
  setTitle(view: View, title: string): boolean;
127
118
  /** Set a page's `can-pop`: gates the shortcuts and a back button, not `pop()`. */
128
119
  setCanPop(view: View, canPop: boolean): boolean;
129
- /** Set `animate-transitions`. */
130
120
  setAnimateTransitions(value: boolean): boolean;
131
- /** Set `pop-on-escape`. */
132
121
  setPopOnEscape(value: boolean): boolean;
133
122
  /** The `can-pop`-aware pop behind a hardware back button or Alt+Left. */
134
123
  popFromShortcut(): NavigationShortcutResult;
@@ -11,9 +11,7 @@ export declare const PREFERENCES_GROUP_HEADER_CLASS = "adw-preferences-group-hea
11
11
  export declare const PREFERENCES_GROUP_SINGLE_LINE_CLASS = "single-line";
12
12
  /** What a group knows about itself when it re-derives its visuals. */
13
13
  export interface NsPreferencesGroupInput {
14
- /** `AdwPreferencesGroup:title`. */
15
14
  title?: string | null;
16
- /** `AdwPreferencesGroup:description`. */
17
15
  description?: string | null;
18
16
  /** Whether a `header-suffix` view is set. */
19
17
  hasHeaderSuffix?: boolean;
@@ -22,9 +20,7 @@ export interface NsPreferencesGroupInput {
22
20
  }
23
21
  /** The NativeScript form of {@link PreferencesGroupHeaderState}. */
24
22
  export interface NsPreferencesGroupVisuals {
25
- /** `visibility` for the title label. */
26
23
  titleVisibility: NsVisibility;
27
- /** `visibility` for the description label. */
28
24
  descriptionVisibility: NsVisibility;
29
25
  /** `visibility` for the whole header box. */
30
26
  headerVisibility: NsVisibility;
@@ -36,17 +32,15 @@ export interface NsPreferencesGroupVisuals {
36
32
  /**
37
33
  * The five derived states for a group.
38
34
  *
39
- * `useMarkup: false` is deliberate and is the same choice the browser renderer
40
- * makes: an NS `Label` shows the string verbatim (it has no Pango markup), so
41
- * visibility must be judged on the string that is actually painted. Rendering
42
- * markup is a separate, still-open gap; closing it flips this one flag.
35
+ * `useMarkup: false` is deliberate and matches the browser renderer: an NS `Label`
36
+ * shows the string verbatim (no Pango markup), so visibility must be judged on the
37
+ * string that is actually painted. Rendering markup is a still-open gap; closing it
38
+ * flips this one flag.
43
39
  */
44
40
  export declare function preferencesGroupHeaderState(input: NsPreferencesGroupInput): PreferencesGroupHeaderState;
45
41
  /**
46
- * `visibility` / `className` a group must apply for the given inputs.
47
- *
48
- * `'collapse'` rather than `'hidden'`: a hidden NS view still occupies its
49
- * space, which would leave the header's padding behind on a group that has no
50
- * header — the very thing `update_header_visibility` exists to avoid.
42
+ * `visibility` / `className` a group must apply for the given inputs. `'collapse'`
43
+ * rather than `'hidden'`: a hidden NS view still occupies its space, which would leave
44
+ * the header's padding behind on a group that has no header.
51
45
  */
52
46
  export declare function preferencesGroupVisuals(input: NsPreferencesGroupInput): NsPreferencesGroupVisuals;
@@ -2,11 +2,11 @@ import type { PreferencesSearchPage, PreferencesSearchResult, SearchPreferencesO
2
2
  /**
3
3
  * What the search reads off a row widget.
4
4
  *
5
- * `isActionRow` is a declared property rather than an `instanceof` test,
6
- * because the NativeScript hierarchy does NOT match the GObject one:
7
- * `AdwEntryRow extends AdwActionRow` here so it can reuse the row chrome, while
8
- * in C it derives from `AdwPreferencesRow` (adw-entry-row.c:90) and its text is
9
- * therefore deliberately NOT searchable. The row classes carry the C answer.
5
+ * `isActionRow` is a declared property rather than an `instanceof` test, because the
6
+ * NativeScript hierarchy does NOT match the GObject one: `AdwEntryRow extends
7
+ * AdwActionRow` here to reuse the row chrome, while in C it derives from
8
+ * `AdwPreferencesRow` and its text is therefore deliberately NOT searchable. The row
9
+ * classes carry the C answer.
10
10
  */
11
11
  export interface NsSearchableRow {
12
12
  /** `AdwPreferencesRow:title`. */
@@ -6,22 +6,16 @@ export type { AdwRowLabels, ButtonRowRenderState };
6
6
  /** The two `View.visibility` values an Adwaita row ever assigns. */
7
7
  export type NsVisibility = 'visible' | 'collapse';
8
8
  /**
9
- * `visibility` for a shown/hidden view.
10
- *
11
- * `'collapse'` rather than `'hidden'`: a hidden NS view still occupies its
12
- * space, so an empty subtitle would leave its whole line behind — which is the
13
- * one thing the binding exists to prevent.
9
+ * `visibility` for a shown/hidden view. `'collapse'` rather than `'hidden'`: a hidden
10
+ * NS view still occupies its space, so an empty subtitle would leave its whole line
11
+ * behind — the one thing the binding exists to prevent.
14
12
  */
15
13
  export declare function nsVisibility(shown: boolean): NsVisibility;
16
14
  /** The NativeScript form of a title/subtitle label pair. */
17
15
  export interface NsRowLabelVisuals {
18
- /** Text for the title `Label`. */
19
16
  title: string;
20
- /** `visibility` for the title `Label`. */
21
17
  titleVisibility: NsVisibility;
22
- /** Text for the subtitle `Label`. */
23
18
  subtitle: string;
24
- /** `visibility` for the subtitle `Label`. */
25
19
  subtitleVisibility: NsVisibility;
26
20
  }
27
21
  /** What a row must apply to its two labels for the given title/subtitle. */
@@ -30,42 +24,32 @@ export declare function rowLabelVisuals(input: AdwRowLabelInput): NsRowLabelVisu
30
24
  export declare function toLabelVisuals(labels: AdwRowLabels): NsRowLabelVisuals;
31
25
  /** The NativeScript form of an `Adw.ButtonRow`'s two icons. */
32
26
  export interface NsButtonRowIconVisuals {
33
- /** Payload for the leading icon. */
34
27
  startIcon: string;
35
- /** `visibility` for the leading icon. */
36
28
  startIconVisibility: NsVisibility;
37
- /** Payload for the trailing icon. */
38
29
  endIcon: string;
39
- /** `visibility` for the trailing icon. */
40
30
  endIconVisibility: NsVisibility;
41
31
  }
42
32
  /**
43
33
  * What a button row must apply to its two icons.
44
34
  *
45
- * The TITLE half of `ButtonRowRenderState` is deliberately not mapped here: the
46
- * NativeScript button row reuses the action row's title `Label` and therefore
47
- * its title state, so routing the title through a second state object would give
48
- * one label two sources of truth — the exact shape this package exists to
49
- * remove. {@link rowLabelVisuals} paints it.
35
+ * The TITLE half of `ButtonRowRenderState` is deliberately not mapped here: the NS
36
+ * button row reuses the action row's title `Label` and its title state, so routing the
37
+ * title through a second state object would give one label two sources of truth.
38
+ * {@link rowLabelVisuals} paints it.
50
39
  *
51
- * NOTE ON THE ICON PAYLOAD: GTK stores an icon NAME and resolves it through the
52
- * icon theme; this port stores the symbolic SVG source itself, because `AdwIcon`
53
- * renders SVG rather than looking a name up. `ButtonRowState` is indifferent —
54
- * the rule it applies is `string_is_not_empty`, which reads the first byte and
55
- * does not care what the string means.
40
+ * The icon payload is the symbolic SVG SOURCE, not GTK's icon name, because `AdwIcon`
41
+ * renders SVG rather than resolving a name. `ButtonRowState` is indifferent: its rule
42
+ * is `string_is_not_empty`, which reads the first byte.
56
43
  */
57
44
  export declare function buttonRowIconVisuals(state: ButtonRowRenderState): NsButtonRowIconVisuals;
58
45
  /**
59
- * Whether a view is "sensitive" in the sense the `activatable-widget` binding
60
- * reads (`GtkWidget:sensitive` → `GtkListBoxRow:activatable`,
61
- * adw-action-row.c:729-732).
46
+ * Whether a view is "sensitive" in the sense the `activatable-widget` binding reads
47
+ * (`GtkWidget:sensitive` → `GtkListBoxRow:activatable`).
62
48
  *
63
- * NativeScript has no `sensitive`; `isUserInteractionEnabled` is the nearest
64
- * flag it surfaces (its own docs map it to `gtk_widget_set_can_target`). The two
65
- * are not identical in GTK — an insensitive widget is also greyed out, a
66
- * can't-target one is not — but `isUserInteractionEnabled` is the only property
67
- * a NativeScript view has for "the user cannot operate this", so it is what the
68
- * binding reads here. A view that has never been touched reports `true`, which
69
- * is also GTK's default.
49
+ * NativeScript has no `sensitive`; `isUserInteractionEnabled` is the nearest flag it
50
+ * surfaces (its own docs map it to `gtk_widget_set_can_target`). The two differ in GTK
51
+ * — an insensitive widget is also greyed out, a can't-target one is not — but it is the
52
+ * only property NS has for "the user cannot operate this". An untouched view reports
53
+ * `true`, which is also GTK's default.
70
54
  */
71
55
  export declare function isViewSensitive(view: Pick<View, 'isUserInteractionEnabled'> | null | undefined): boolean;
@@ -0,0 +1,54 @@
1
+ import type { ShortcutLabelOptions } from '@gjsify/adwaita-core';
2
+ /** The host `StackLayout`'s own class. */
3
+ export declare const SHORTCUT_LABEL_CLASS = "adw-shortcut-label";
4
+ /** One combination — the keycaps of a single accelerator, drawn side by side. */
5
+ export declare const SHORTCUT_LABEL_KEYS_CLASS = "adw-shortcut-label-keys";
6
+ /** One keycap. libadwaita's own name, so the theme rule reads like the SCSS. */
7
+ export declare const SHORTCUT_LABEL_KEYCAP_CLASS = "keycap";
8
+ /** The text inside a keycap — the Label a `<span>`'s text node stands in for. */
9
+ export declare const SHORTCUT_LABEL_CAP_TEXT_CLASS = "adw-shortcut-label-cap-text";
10
+ /** The `L`/`R` marker of a sided modifier key, inside the cap it belongs to. */
11
+ export declare const SHORTCUT_LABEL_SIDE_CLASS = "adw-shortcut-label-side";
12
+ /** `dim_label` — the separators, and the half the placeholder shares with them. */
13
+ export declare const SHORTCUT_LABEL_DIMMED_CLASS = "dimmed";
14
+ /** The disabled placeholder, so a consumer can style it without counting children. */
15
+ export declare const SHORTCUT_LABEL_DISABLED_CLASS = "adw-shortcut-label-disabled";
16
+ /** Carries the 6px GTK gets from `border-spacing` — every child but the first. */
17
+ export declare const SHORTCUT_LABEL_SPACED_CLASS = "adw-shortcut-label-spaced";
18
+ /** A node of the view tree: `box` is a horizontal `StackLayout`, `label` a `Label`. */
19
+ export interface ShortcutLabelViewSpec {
20
+ readonly kind: 'box' | 'label';
21
+ /** The view's `className`, space-separated as NS holds it. */
22
+ readonly className: string;
23
+ /** A label's text; `''` for a box. */
24
+ readonly text: string;
25
+ /** A box's children; empty for a label. */
26
+ readonly children: readonly ShortcutLabelViewSpec[];
27
+ /** `style.direction` to pin, or `null` to inherit it. */
28
+ readonly direction: 'ltr' | null;
29
+ }
30
+ /** What the widget rebuilds itself from. */
31
+ export interface ShortcutLabelRenderPlan {
32
+ /** The host's children, in visual order. */
33
+ readonly children: readonly ShortcutLabelViewSpec[];
34
+ /** The name a screen reader announces for the whole label. */
35
+ readonly accessibleLabel: string;
36
+ /** The fragment that failed to parse, or `null` — `children` is the partial result. */
37
+ readonly error: string | null;
38
+ }
39
+ /**
40
+ * Which modifier glyph set to draw — `#ifdef __APPLE__` upstream, and on
41
+ * NativeScript that is iOS. Split out so the choice is a value the suite can
42
+ * drive both sides of, rather than a branch reachable only on a device.
43
+ */
44
+ export declare function shortcutLabelPlatform(isIos: boolean): 'default' | 'apple';
45
+ /**
46
+ * The direction the sequence arrow follows.
47
+ *
48
+ * NS's `direction` is an INHERITED CSS property that resolves to `null` until
49
+ * the view is attached, which is exactly when a widget built in its constructor
50
+ * would read it — so the null case is LTR and the widget re-reads on load.
51
+ */
52
+ export declare function shortcutLabelDirection(direction: 'ltr' | 'rtl' | null | undefined): 'ltr' | 'rtl';
53
+ /** The view tree for one accelerator, with the accessible name and any parse error. */
54
+ export declare function shortcutLabelRenderPlan(accelerator: string, options?: ShortcutLabelOptions): ShortcutLabelRenderPlan;
@@ -4,15 +4,13 @@ export { SidebarState };
4
4
  export type { AdwSidebarItemSpec, AdwSidebarSectionSpec, SidebarItemFilter };
5
5
  /**
6
6
  * The section list a flat `AdwSidebar.setItems(labels)` call means: one untitled
7
- * section, which renders no header at all (a first + untitled section's header is
8
- * bound to a non-empty title, adw-sidebar.c:1521-1527).
7
+ * section, which renders no header at all (a section header's `visible` is bound to a
8
+ * non-empty title).
9
9
  */
10
10
  export declare function sidebarSectionsFromLabels(labels: readonly string[]): AdwSidebarSectionSpec[];
11
11
  /**
12
- * The class string one navigation row carries.
13
- *
14
- * `selectionVisible` is false in page mode, where libadwaita tracks the
15
- * selection but never paints it (adw-sidebar.c:2948-2951) — its rows are plain
16
- * boxed-list `AdwActionRow`s with no selected state.
12
+ * The class string one navigation row carries. `selectionVisible` is false in page
13
+ * mode, where libadwaita tracks the selection but never paints it — those rows are
14
+ * plain boxed-list `AdwActionRow`s with no selected state.
17
15
  */
18
16
  export declare function sidebarRowClassName(selected: boolean, selectionVisible: boolean): string;
@@ -3,53 +3,36 @@ export type { AdwMenuEntry, SplitButtonDirection };
3
3
  /** Text of the sheet's dismiss button. */
4
4
  export declare const MENU_CANCEL_LABEL = "Cancel";
5
5
  /**
6
- * The libadwaita arrow glyph names mapped to real Adwaita symbolic SVGs.
7
- *
8
- * Keyed by {@link AdwArrowIcon} and therefore TOTAL: which glyph a direction gets
9
- * is decided in core, and a glyph this table has no SVG for is a compile error
10
- * rather than a fallback arrow.
6
+ * The libadwaita arrow glyph names mapped to real Adwaita symbolic SVGs. Keyed by
7
+ * {@link AdwArrowIcon} and therefore TOTAL: which glyph a direction gets is decided in
8
+ * core, and a glyph with no SVG here is a compile error rather than a fallback arrow.
11
9
  */
12
10
  export declare const ARROW_SVGS: Readonly<Record<AdwArrowIcon, string>>;
13
11
  /**
14
- * Normalise a menu assigned from XML or app code into entries.
15
- *
16
- * A bare `string[]` is accepted because that is what `AdwSplitButton.menu` used
17
- * to be and what the storybook still passes; it widens to the shared
18
- * {@link AdwMenuEntry} without breaking a caller.
12
+ * Normalise a menu assigned from XML or app code into entries. A bare `string[]` is
13
+ * accepted (the storybook passes one) and widens to the shared {@link AdwMenuEntry}.
19
14
  */
20
15
  export declare function toMenuEntries(value: readonly (string | AdwMenuEntry)[] | null | undefined): AdwMenuEntry[];
21
16
  /**
22
- * The strings handed to `Dialogs.action()`, one per entry and each unique.
23
- *
24
- * A label that collides with another entry — or with the dismiss button — gets
25
- * zero-width spaces appended until it is distinct. Nothing changes on screen;
26
- * what changes is that {@link resolveMenuChoice} can now tell the entries apart.
17
+ * The strings handed to `Dialogs.action()`, one per entry and each unique: a label
18
+ * that collides with another entry — or with the dismiss button — gets zero-width
19
+ * spaces appended until it is distinct, so {@link resolveMenuChoice} can tell them
20
+ * apart.
27
21
  */
28
22
  export declare function menuSheetActions(entries: readonly AdwMenuEntry[], cancelLabel?: string): string[];
29
23
  /**
30
- * The position the user chose, or `-1` when the sheet was dismissed.
31
- *
32
- * Feed it the SAME array {@link menuSheetActions} produced: the strings are
33
- * unique there, so the lookup is a position and not a guess.
24
+ * The position the user chose, or `-1` when the sheet was dismissed. Feed it the SAME
25
+ * array {@link menuSheetActions} produced, or the lookup is a guess.
34
26
  */
35
27
  export declare function resolveMenuChoice(sheetActions: readonly string[], chosen: string | null | undefined): number;
36
- /**
37
- * The arrow SVG for a direction, keyed off the SPLIT BUTTON's glyph map — so
38
- * `none` is the down caret (_buttons.scss:621-623), not the hamburger this widget
39
- * used to render for it.
40
- */
28
+ /** The arrow SVG for a direction; the split button's `none` is the down caret, not a hamburger. */
41
29
  export declare function splitButtonArrowSvg(direction: SplitButtonDirection): string;
42
30
  /**
43
- * Apply `AdwSplitButton.actionIcon = svg` to the content machine.
44
- *
45
- * The SVG string IS the icon identity on NativeScript (no icon theme is
46
- * resolved), so it goes in where GTK puts the icon NAME. Clearing it is the
47
- * mapping worth having in one place: C offers no "unset the icon", only the
48
- * side effect of filling another slot (adw-split-button.c:749-771), so an empty
49
- * SVG clears the content and lets the label half take over again — which is what
50
- * every caller assigning `actionIcon` from a nullable lookup expects.
31
+ * Apply `AdwSplitButton.actionIcon = svg` to the content machine. The SVG string IS
32
+ * the icon identity on NativeScript, so it goes where GTK puts the icon NAME.
51
33
  *
52
- * Lives here rather than in the widget so it is unit-testable off-device: the
53
- * widget module `extends GridLayout` and cannot be imported on GJS/Node.
34
+ * C offers no "unset the icon", only the side effect of filling another slot, so an
35
+ * empty SVG clears the content and lets the label half take over again — what a
36
+ * caller assigning `actionIcon` from a nullable lookup expects.
54
37
  */
55
38
  export declare function setActionIcon(state: SplitButtonState, svg: string | null | undefined): void;