@gjsify/adwaita-nativescript 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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;
@@ -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;
@@ -6,7 +6,6 @@ import type { AdwTextDirection } from '@gjsify/adwaita-core';
6
6
  export declare const NOTIFY_SHOW_SIDEBAR = "notify::show-sidebar";
7
7
  /** Payload of the `notify::show-sidebar` event. */
8
8
  export interface NotifyShowSidebarEventData extends EventData {
9
- /** Whether the sidebar is currently shown. */
10
9
  showSidebar: boolean;
11
10
  /** Whether the view is in its collapsed (narrow) mode. */
12
11
  collapsed: boolean;
@@ -30,22 +29,20 @@ export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState =
30
29
  /** The headless state machine this widget renders (`split-view-state.ts`). */
31
30
  _state: TState);
32
31
  /**
33
- * (Re)declare the two columns so the sidebar's column is fixed-width ('auto')
34
- * and the content's is expanding ('star'), ordered by {@link sidebarPosition}:
35
- * `start` → [sidebar auto, content star]; `end` → [content star, sidebar auto].
36
- * Without this an `end` sidebar would land in the expanding column and float
37
- * away from the right edge (leaving a gap), with the content squeezed.
32
+ * (Re)declare the two columns so the sidebar's is fixed-width (`'auto'`, sized to
33
+ * the pane) and the content's expands (`'star'`), ordered by the side the sidebar
34
+ * is DRAWN on. Without this an `end` sidebar lands in the expanding column and
35
+ * floats away from the edge, with the content squeezed.
38
36
  *
39
37
  * `splitViewColumns()` is the other half of the same rule — which column each
40
- * PANE is written into. The two must agree, or an `end` sidebar ends up in the
41
- * expanding column with the content squeezed into the fixed one.
38
+ * PANE is written into — and both must agree.
42
39
  */
43
40
  protected _syncColumns(): void;
44
41
  /**
45
42
  * Publish which visual side the pane is on, so the theme can put the divider
46
- * there — the CSS counterpart to `_sidebars.scss`'s `:dir()` x `.end`
47
- * product. A fixed `border-right` drew it on the wrong edge for an `end`
48
- * sidebar and for every RTL layout.
43
+ * there — the CSS counterpart to `_sidebars.scss`'s `:dir()` × `.end` product. A
44
+ * fixed `border-right` draws it on the wrong edge for an `end` sidebar and for
45
+ * every RTL layout.
49
46
  */
50
47
  protected _syncSidebarSide(view?: View | null): void;
51
48
  /**
@@ -61,17 +58,15 @@ export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState =
61
58
  protected _emitShowSidebar(event: NsShowSidebarNotification): void;
62
59
  /** Subclass-specific layout application for the current collapsed/show state. */
63
60
  protected abstract _applyLayout(): void;
64
- /** Apply a user-initiated show/hide toggle. The default is an instant re-layout;
65
- * the subclasses override this to slide the panes (and, for the overlay, fade a
66
- * scrim) when collapsed. Kept separate from {@link _applyLayout} so structural
67
- * re-layouts (setSidebar/collapsed/position changes) stay instant — only an
68
- * on-screen `showSidebar` toggle animates. */
61
+ /** Apply a user-initiated show/hide toggle. Separate from {@link _applyLayout} so
62
+ * structural re-layouts stay instant — only an on-screen `showSidebar` toggle
63
+ * animates; the subclasses override this to slide the panes. */
69
64
  protected _transitionSidebar(): void;
70
65
  /** In-flight animations, cancelled when a new transition supersedes them. */
71
66
  protected _pending: Cancelable[];
72
67
  /** Whether to run a real animation now: native `animate()` present AND on-screen.
73
- * Off-device (the mock view tree in specs) or pre-load it returns false, so the
74
- * caller falls back to an instant `visibility` swap. */
68
+ * False off-device or pre-load, so the caller falls back to an instant
69
+ * `visibility` swap. */
75
70
  protected _shouldAnimate(): boolean;
76
71
  /** Register an animation so a later transition can cancel it; returns a plain promise. */
77
72
  protected _track(anim: Promise<void> & Cancelable): Promise<void>;
@@ -100,9 +95,9 @@ export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState =
100
95
  get showSidebar(): boolean;
101
96
  set showSidebar(value: boolean);
102
97
  /**
103
- * The sidebar pane width in DIPs, DERIVED from the container size unless a
104
- * caller assigned one. `Adw.OverlaySplitView` has no stored width — see
105
- * `split-view-width.ts` for why the old fixed 240 could not be right.
98
+ * The sidebar pane width in DIPs, DERIVED from the container size unless a caller
99
+ * assigned one — `Adw.OverlaySplitView` stores no width; see
100
+ * `split-view-width.ts` for the rule.
106
101
  */
107
102
  get sidebarWidth(): number;
108
103
  set sidebarWidth(value: number);
@@ -123,9 +118,7 @@ export declare abstract class AdwSplitViewBase<TState extends NsSplitViewState =
123
118
  * the closest thing to the window size Adwaita evaluates against.
124
119
  */
125
120
  protected _applySidebarWidth(): void;
126
- /** Which side the sidebar sits on — `'start'` (leading / left) or `'end'`
127
- * (trailing / right). Mirrors `Adw.OverlaySplitView`'s `sidebar-position`
128
- * (the storybook controls overlay uses `'end'`). */
121
+ /** `Adw.OverlaySplitView:sidebar-position` — `'start'` (leading) or `'end'`. */
129
122
  get sidebarPosition(): AdwPackType;
130
123
  set sidebarPosition(value: AdwPackType);
131
124
  /** The sidebar pane, or `null`. */