@gjsify/adwaita-nativescript 0.31.0 → 0.32.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 (146) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/lib/esm/widgets/adw-action-row.js +1 -1
  3. package/lib/esm/widgets/adw-avatar.js +1 -1
  4. package/lib/esm/widgets/adw-banner.js +1 -1
  5. package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
  6. package/lib/esm/widgets/adw-button-content.js +1 -1
  7. package/lib/esm/widgets/adw-button-row.js +1 -1
  8. package/lib/esm/widgets/adw-carousel.js +1 -1
  9. package/lib/esm/widgets/adw-clamp.js +1 -1
  10. package/lib/esm/widgets/adw-combo-row.js +1 -1
  11. package/lib/esm/widgets/adw-data-grid.js +1 -0
  12. package/lib/esm/widgets/adw-drop-down.js +1 -0
  13. package/lib/esm/widgets/adw-entry-row.js +1 -1
  14. package/lib/esm/widgets/adw-entry.js +1 -0
  15. package/lib/esm/widgets/adw-expander-row.js +1 -1
  16. package/lib/esm/widgets/adw-header-bar.js +1 -1
  17. package/lib/esm/widgets/adw-inline-view-switcher.js +1 -1
  18. package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
  19. package/lib/esm/widgets/adw-navigation-view.js +1 -1
  20. package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
  21. package/lib/esm/widgets/adw-password-entry-row.js +1 -1
  22. package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
  23. package/lib/esm/widgets/adw-preferences-group.js +1 -1
  24. package/lib/esm/widgets/adw-preferences-page.js +1 -1
  25. package/lib/esm/widgets/adw-sidebar.js +1 -1
  26. package/lib/esm/widgets/adw-spin-row.js +1 -1
  27. package/lib/esm/widgets/adw-spinner.js +1 -1
  28. package/lib/esm/widgets/adw-split-button.js +1 -1
  29. package/lib/esm/widgets/adw-status-page.js +1 -1
  30. package/lib/esm/widgets/adw-switch-row.js +1 -1
  31. package/lib/esm/widgets/adw-tab-view.js +1 -1
  32. package/lib/esm/widgets/adw-toolbar-view.js +1 -1
  33. package/lib/esm/widgets/adw-view-stack.js +1 -1
  34. package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
  35. package/lib/esm/widgets/adw-window-title.js +1 -1
  36. package/lib/esm/widgets/adw-wrap-box.js +1 -1
  37. package/lib/esm/widgets/avatar-color.js +1 -0
  38. package/lib/esm/widgets/bottom-sheet-state.js +1 -0
  39. package/lib/esm/widgets/button-content.js +1 -0
  40. package/lib/esm/widgets/carousel-state.js +1 -0
  41. package/lib/esm/widgets/chrome.js +1 -0
  42. package/lib/esm/widgets/data-grid-model.js +1 -0
  43. package/lib/esm/widgets/entry-row-view.js +1 -0
  44. package/lib/esm/widgets/icon-path.js +2 -2
  45. package/lib/esm/widgets/icons.ios.js +1 -0
  46. package/lib/esm/widgets/index.js +1 -1
  47. package/lib/esm/widgets/navigation-stack.js +1 -0
  48. package/lib/esm/widgets/preferences-group-state.js +1 -0
  49. package/lib/esm/widgets/preferences-search.js +1 -0
  50. package/lib/esm/widgets/row-state.js +1 -0
  51. package/lib/esm/widgets/sidebar-model.js +1 -0
  52. package/lib/esm/widgets/split-button.js +1 -0
  53. package/lib/esm/widgets/split-view-base.js +1 -1
  54. package/lib/esm/widgets/split-view-state.js +1 -0
  55. package/lib/esm/widgets/split-view-width.js +1 -0
  56. package/lib/esm/widgets/status-page-content.js +1 -0
  57. package/lib/esm/widgets/svg-path.js +2 -0
  58. package/lib/esm/widgets/tab-view-state.js +1 -0
  59. package/lib/esm/widgets/view-stack-state.js +1 -0
  60. package/lib/esm/widgets/view-switcher-base.js +1 -1
  61. package/lib/esm/widgets/view-switcher-model.js +1 -0
  62. package/lib/esm/widgets/wrap-box-layout.js +1 -0
  63. package/lib/types/banner.spec.d.ts +2 -0
  64. package/lib/types/bottom-sheet.spec.d.ts +2 -0
  65. package/lib/types/button-content.spec.d.ts +2 -0
  66. package/lib/types/carousel.spec.d.ts +1 -0
  67. package/lib/types/chrome.spec.d.ts +2 -0
  68. package/lib/types/data-grid.spec.d.ts +2 -0
  69. package/lib/types/drop-down.spec.d.ts +2 -0
  70. package/lib/types/entry-rows.spec.d.ts +2 -0
  71. package/lib/types/entry.spec.d.ts +2 -0
  72. package/lib/types/index.d.ts +2 -2
  73. package/lib/types/navigation-view.spec.d.ts +2 -0
  74. package/lib/types/preferences.spec.d.ts +2 -0
  75. package/lib/types/row-state.spec.d.ts +2 -0
  76. package/lib/types/sidebar.spec.d.ts +1 -0
  77. package/lib/types/split-button.spec.d.ts +1 -0
  78. package/lib/types/split-view-state.spec.d.ts +2 -0
  79. package/lib/types/split-view-width.spec.d.ts +2 -0
  80. package/lib/types/status-page.spec.d.ts +2 -0
  81. package/lib/types/svg-path.spec.d.ts +2 -0
  82. package/lib/types/tab-view.spec.d.ts +2 -0
  83. package/lib/types/view-stack.spec.d.ts +2 -0
  84. package/lib/types/view-switcher.spec.d.ts +1 -0
  85. package/lib/types/widgets/adw-action-row.d.ts +63 -7
  86. package/lib/types/widgets/adw-avatar.d.ts +2 -7
  87. package/lib/types/widgets/adw-banner.d.ts +26 -7
  88. package/lib/types/widgets/adw-bottom-sheet.d.ts +29 -11
  89. package/lib/types/widgets/adw-button-content.d.ts +41 -6
  90. package/lib/types/widgets/adw-button-row.d.ts +31 -9
  91. package/lib/types/widgets/adw-carousel.d.ts +70 -15
  92. package/lib/types/widgets/adw-clamp.d.ts +21 -4
  93. package/lib/types/widgets/adw-data-grid.d.ts +73 -0
  94. package/lib/types/widgets/adw-drop-down.d.ts +45 -0
  95. package/lib/types/widgets/adw-entry-row.d.ts +98 -2
  96. package/lib/types/widgets/adw-entry.d.ts +43 -0
  97. package/lib/types/widgets/adw-expander-row.d.ts +3 -0
  98. package/lib/types/widgets/adw-header-bar.d.ts +11 -2
  99. package/lib/types/widgets/adw-inline-view-switcher.d.ts +26 -0
  100. package/lib/types/widgets/adw-navigation-split-view.d.ts +2 -1
  101. package/lib/types/widgets/adw-navigation-view.d.ts +71 -16
  102. package/lib/types/widgets/adw-overlay-split-view.d.ts +29 -2
  103. package/lib/types/widgets/adw-password-entry-row.d.ts +33 -3
  104. package/lib/types/widgets/adw-preferences-dialog.d.ts +18 -0
  105. package/lib/types/widgets/adw-preferences-group.d.ts +56 -8
  106. package/lib/types/widgets/adw-preferences-page.d.ts +32 -1
  107. package/lib/types/widgets/adw-sidebar.d.ts +49 -7
  108. package/lib/types/widgets/adw-spinner.d.ts +8 -3
  109. package/lib/types/widgets/adw-split-button.d.ts +48 -13
  110. package/lib/types/widgets/adw-status-page.d.ts +5 -10
  111. package/lib/types/widgets/adw-switch-row.d.ts +21 -1
  112. package/lib/types/widgets/adw-tab-view.d.ts +129 -15
  113. package/lib/types/widgets/adw-toolbar-view.d.ts +39 -0
  114. package/lib/types/widgets/adw-view-stack.d.ts +30 -27
  115. package/lib/types/widgets/adw-view-switcher-bar.d.ts +22 -10
  116. package/lib/types/widgets/adw-window-title.d.ts +12 -8
  117. package/lib/types/widgets/adw-wrap-box.d.ts +21 -4
  118. package/lib/types/widgets/avatar-color.d.ts +14 -0
  119. package/lib/types/widgets/bottom-sheet-state.d.ts +73 -0
  120. package/lib/types/widgets/button-content.d.ts +43 -0
  121. package/lib/types/widgets/carousel-state.d.ts +85 -0
  122. package/lib/types/widgets/chrome.d.ts +159 -0
  123. package/lib/types/widgets/data-grid-model.d.ts +104 -0
  124. package/lib/types/widgets/entry-row-view.d.ts +88 -0
  125. package/lib/types/widgets/icon-path.d.ts +20 -0
  126. package/lib/types/widgets/icons.ios.d.ts +13 -0
  127. package/lib/types/widgets/index.d.ts +20 -5
  128. package/lib/types/widgets/navigation-stack.d.ts +153 -0
  129. package/lib/types/widgets/preferences-group-state.d.ts +52 -0
  130. package/lib/types/widgets/preferences-search.d.ts +68 -0
  131. package/lib/types/widgets/row-state.d.ts +71 -0
  132. package/lib/types/widgets/sidebar-model.d.ts +18 -0
  133. package/lib/types/widgets/split-button.d.ts +55 -0
  134. package/lib/types/widgets/split-view-base.d.ts +55 -12
  135. package/lib/types/widgets/split-view-state.d.ts +196 -0
  136. package/lib/types/widgets/split-view-width.d.ts +76 -0
  137. package/lib/types/widgets/status-page-content.d.ts +23 -0
  138. package/lib/types/widgets/svg-path.d.ts +28 -0
  139. package/lib/types/widgets/tab-view-state.d.ts +74 -0
  140. package/lib/types/widgets/view-stack-state.d.ts +35 -0
  141. package/lib/types/widgets/view-switcher-base.d.ts +61 -32
  142. package/lib/types/widgets/view-switcher-model.d.ts +114 -0
  143. package/lib/types/widgets/wrap-box-layout.d.ts +43 -0
  144. package/lib/types/wrap-box.spec.d.ts +2 -0
  145. package/package.json +7 -7
  146. package/src/theme/adwaita.css +393 -8
@@ -1,23 +1,58 @@
1
- import { Label, StackLayout } from '@nativescript/core';
1
+ import { Label, StackLayout, type View } from '@nativescript/core';
2
+ import type { ButtonContentEllipsize } from '@gjsify/adwaita-core';
2
3
  import { AdwIcon } from './adw-icon.js';
3
4
  export declare class AdwButtonContent extends StackLayout {
4
- /** The leading symbolic icon (lazily in the tree — only when an icon is set). */
5
+ /** The leading symbolic icon. Always parented — the C never hides the image. */
5
6
  protected readonly _icon: AdwIcon;
6
7
  /** The text label. */
7
8
  protected readonly _label: Label;
8
- private _hasIcon;
9
- private _iconSvg;
9
+ private readonly _props;
10
+ private _hostButton;
10
11
  constructor();
12
+ /**
13
+ * The button view this content styles — NS's stand-in for the `GtkButton`
14
+ * ancestor `adw_button_content_root` finds (:108).
15
+ *
16
+ * Setting it adds `image-text-button` (:115); clearing it, or replacing it,
17
+ * removes the class from the previous host first (:126), so a button that
18
+ * loses its content goes back to plain-button padding.
19
+ */
20
+ get hostButton(): View | null;
21
+ set hostButton(view: View | null);
11
22
  /**
12
23
  * A leading Adwaita symbolic SVG string (e.g. `folderDownloadSymbolic`).
13
- * Setting a non-empty value inserts the icon before the label; empty removes it.
24
+ *
25
+ * An empty value shows the `image-missing` asset rather than hiding the icon:
26
+ * the C sets that fallback (:355-356) and never hides `self->icon`. The doc
27
+ * comments at :228/:343 say otherwise — see `buttonContentIconSvg`.
14
28
  */
15
29
  get icon(): string;
16
30
  set icon(svg: string);
31
+ /** Whether the icon currently shown is the empty-slot fallback. */
32
+ get iconIsFallback(): boolean;
17
33
  /** The icon fill colour (hex). Set to the button's foreground (e.g. white on suggested-action). */
18
34
  get iconColor(): string;
19
35
  set iconColor(value: string);
20
- /** The button content text. */
36
+ /** The button content text. Empty collapses the label view (:398). */
21
37
  get label(): string;
22
38
  set label(value: string);
39
+ /**
40
+ * Whether an underline in {@link label} marks a mnemonic (:431-445).
41
+ * Defaults to FALSE (:253-256), so an underscore is a literal unless asked.
42
+ */
43
+ get useUnderline(): boolean;
44
+ set useUnderline(value: boolean);
45
+ /**
46
+ * Whether the label may be smaller than its natural size (:489-491).
47
+ *
48
+ * FIDELITY GAP: this is `PANGO_ELLIPSIZE_END` in GTK and the NS CSS subset
49
+ * has no ellipsize, so the property is held, reported through
50
+ * {@link ellipsize}, and reflected as a `can-shrink` class for the theme —
51
+ * but the truncation ellipsis is not available on this platform.
52
+ */
53
+ get canShrink(): boolean;
54
+ set canShrink(value: boolean);
55
+ /** The label's `PangoEllipsizeMode` for the current `canShrink` (:462). */
56
+ get ellipsize(): ButtonContentEllipsize;
57
+ private _renderLabel;
23
58
  }
@@ -2,27 +2,49 @@ import { StackLayout } from '@nativescript/core';
2
2
  import { AdwActionRow } from './adw-action-row.js';
3
3
  import { AdwIcon } from './adw-icon.js';
4
4
  /** Event name emitted when the row is tapped. Mirrors `Adw.ButtonRow::activated`. */
5
- export declare const ACTIVATED = "activated";
5
+ export { ACTIVATED } from './adw-action-row.js';
6
6
  export declare class AdwButtonRow extends AdwActionRow {
7
- /** The horizontal content box (leading icon + centered title). */
7
+ /** `AdwButtonRow` derives from `AdwPreferencesRow` in C
8
+ * (adw-button-row.c:74), so the search does not consult a subtitle here. */
9
+ readonly isActionRow: boolean;
10
+ /** The horizontal content box (leading icon + centered title + trailing icon). */
8
11
  protected readonly _contentBox: StackLayout;
9
- /** The leading symbolic icon (lazily added — only when an icon is set). */
12
+ /** The leading symbolic icon. */
10
13
  protected readonly _startIcon: AdwIcon;
11
- private _hasStartIcon;
12
- private _startIconSvg;
14
+ /** The trailing symbolic icon. */
15
+ protected readonly _endIcon: AdwIcon;
16
+ /**
17
+ * The headless start/end icon state (ADR 0004).
18
+ *
19
+ * ICONS ONLY. `ButtonRowState` also carries the title, and the browser
20
+ * renderer uses that half — but here the title is the action row's inherited
21
+ * `Label`, painted from the action row's own state, and feeding it into a
22
+ * second state object would give one label two sources of truth.
23
+ */
24
+ private readonly _buttonState;
13
25
  constructor();
26
+ /** A centered, accent-coloured symbolic icon, collapsed until it has content. */
27
+ private static _makeIcon;
14
28
  /**
15
29
  * A leading Adwaita symbolic SVG string before the centered title (e.g.
16
- * `listAddSymbolic`). Setting a non-empty value inserts it; empty removes it.
30
+ * `listAddSymbolic`). Empty collapses the icon.
17
31
  */
18
32
  get startIcon(): string;
19
33
  set startIcon(value: string);
20
34
  /**
21
- * The start icon's fill colour (hex). Defaults to the Adwaita accent; callers
22
- * set the destructive red when the row carries `destructive-action` so the
23
- * symbolic icon matches the title colour (the icon bitmap is pre-coloured, so
35
+ * A trailing Adwaita symbolic SVG string after the centered title (e.g.
36
+ * `goNextSymbolic`) — `Adw.ButtonRow:end-icon-name`. Empty collapses it.
37
+ */
38
+ get endIcon(): string;
39
+ set endIcon(value: string);
40
+ /**
41
+ * The icons' fill colour (hex). Defaults to the Adwaita accent; callers set
42
+ * the destructive red when the row carries `destructive-action` so the
43
+ * symbolic icons match the title colour (the icon bitmap is pre-coloured, so
24
44
  * CSS cannot recolour it).
25
45
  */
26
46
  get startIconColor(): string;
27
47
  set startIconColor(value: string);
48
+ /** Push the derived icon payload + visibility onto the two `AdwIcon`s. */
49
+ private _applyIcons;
28
50
  }
@@ -1,36 +1,74 @@
1
1
  import { GridLayout, ScrollView, StackLayout, View, type EventData } from '@nativescript/core';
2
+ import { DEFAULT_CAROUSEL_PAGE_WIDTH, type CarouselNotifyPayload } from './carousel-state.js';
3
+ export { DEFAULT_CAROUSEL_PAGE_WIDTH };
2
4
  /** Event name emitted when {@link AdwCarousel.position} changes. Mirrors GObject `notify::position`. */
3
5
  export declare const NOTIFY_POSITION = "notify::position";
4
- /** Payload of the `notify::position` event. */
5
- export interface NotifyPositionEventData extends EventData {
6
- /** The new page index. */
7
- position: number;
6
+ /** Event name emitted when the page count changes. Mirrors GObject `notify::n-pages`. */
7
+ export declare const NOTIFY_N_PAGES = "notify::n-pages";
8
+ /** Event name emitted after a completed scroll. Mirrors the `AdwCarousel::page-changed` signal. */
9
+ export declare const PAGE_CHANGED = "page-changed";
10
+ /** Payload of the {@link NOTIFY_POSITION} and {@link NOTIFY_N_PAGES} events. */
11
+ export interface NotifyPositionEventData extends EventData, CarouselNotifyPayload {
12
+ }
13
+ /** Payload of the {@link PAGE_CHANGED} event. `index` is `-1` for an empty carousel. */
14
+ export interface PageChangedEventData extends EventData {
15
+ /** The page the carousel came to rest on, `-1` when it has none. */
16
+ index: number;
8
17
  }
9
- /** Default page width (DIPs) used for offset math until the consumer sets `pageWidth`. */
10
- export declare const DEFAULT_CAROUSEL_PAGE_WIDTH = 320;
11
18
  export declare class AdwCarousel extends GridLayout {
12
19
  /** The horizontal scroller holding the pages. */
13
20
  protected readonly _scroller: ScrollView;
14
- /** The horizontal track inside the scroller (holds full-width pages). */
21
+ /** The horizontal track inside the scroller (holds fixed-width pages). */
15
22
  protected readonly _track: StackLayout;
16
23
  /** The dot-indicator row. */
17
24
  protected readonly _dots: StackLayout;
18
- private readonly _pages;
19
- private readonly _dotLabels;
20
- private _position;
25
+ private readonly _state;
26
+ private readonly _sync;
27
+ /** Page id → its content view, so a DOM-free model can still be projected. */
28
+ private readonly _views;
29
+ /** Page id → its dot. Keyed by ID, not by index: an insert or a reorder renumbers every page after it. */
30
+ private readonly _dotsById;
31
+ private _nextPageId;
21
32
  private _pageWidth;
22
33
  constructor();
23
- /** Append a page. The page is forced to the current `pageWidth`. */
34
+ /** Append a page — `adw_carousel_append` (adw-carousel.c:1348-1357). */
24
35
  addPage(view: View): void;
25
- /** Scroll to a page by index (clamped) and update the position. */
36
+ /**
37
+ * Insert a page at `position` — `adw_carousel_insert` (adw-carousel.c:1370-1407).
38
+ * `-1` or a position past the end appends. Returns whether it was added.
39
+ */
40
+ insertPage(view: View, position?: number): boolean;
41
+ /** Remove a page — `adw_carousel_remove` (adw-carousel.c:1508-1532). */
42
+ removePage(view: View): boolean;
43
+ /** Move a page — `adw_carousel_reorder` (adw-carousel.c:1419-1499). */
44
+ reorderPage(view: View, position: number): boolean;
45
+ /**
46
+ * Scroll to a page by index. Out-of-range, fractional and NaN indices are
47
+ * refused rather than clamped, matching `adw_carousel_get_nth_page`'s
48
+ * precondition (adw-carousel.c:1616) — `scrollToPage(NaN)` used to set the
49
+ * position to NaN and leave no dot selected.
50
+ */
26
51
  scrollToPage(index: number): void;
27
- private _setPosition;
28
- private _applyDots;
52
+ /** One keynav step — `navigate_to_direction` (adw-carousel.c:475-508). */
53
+ navigate(direction: 'back' | 'forward'): boolean;
29
54
  /** The number of pages. */
30
55
  get nPages(): number;
31
- /** The current page index. Setting it scrolls to that page. */
56
+ /** The fractional scroll position; 1 matches 1 page. */
32
57
  get position(): number;
58
+ /**
59
+ * Scroll to the page this position settles on.
60
+ *
61
+ * `AdwCarousel:position` is READ-ONLY in C (adw-carousel.c:1036-1041) — the
62
+ * setter is a port convenience, and it resolves the value with the same
63
+ * `get_page_at_position` rule used everywhere else, so 0.5 lands on page 0
64
+ * where the old `Math.round` picked page 1.
65
+ */
33
66
  set position(value: number);
67
+ /** The page the current position settles on, `-1` when the carousel is empty. */
68
+ get currentPage(): number;
69
+ /** Whether the carousel can be navigated (`AdwCarousel:interactive`, default TRUE). */
70
+ get interactive(): boolean;
71
+ set interactive(value: boolean);
34
72
  /**
35
73
  * The per-page width in DIPs used for scroll-offset math. Set this to the
36
74
  * carousel's on-screen width so `scrollToPage` lands cleanly. Re-applies to
@@ -38,4 +76,21 @@ export declare class AdwCarousel extends GridLayout {
38
76
  */
39
77
  get pageWidth(): number;
40
78
  set pageWidth(value: number);
79
+ /** The px pitch between two page origins — `self->distance` (adw-carousel.c:767). */
80
+ private _distance;
81
+ /** The state's id for a page view, or `null` when it is not one of ours. */
82
+ private _idOf;
83
+ /** Run the scroll the state asked for. */
84
+ private _performScroll;
85
+ /** The dots in page order — the order `applyCarouselDots` indexes by. */
86
+ private _orderedDots;
87
+ /**
88
+ * Make both native child lists match the model order.
89
+ *
90
+ * Detach-then-reattach rather than a positional patch: NS has no "move
91
+ * child", `insertChild` on an already-parented view double-parents it, and
92
+ * the page counts here are small enough that the simple version is the one
93
+ * that cannot be subtly wrong after a reorder.
94
+ */
95
+ private _syncTrack;
41
96
  }
@@ -1,15 +1,32 @@
1
1
  import { GridLayout, View } from '@nativescript/core';
2
- /** Adwaita's `AdwClamp` default `maximum-size`, in DIPs. */
3
- export declare const DEFAULT_CLAMP_MAX_SIZE = 600;
2
+ import { DEFAULT_CLAMP_MAX_SIZE, DEFAULT_CLAMP_TIGHTENING_THRESHOLD } from './chrome.js';
3
+ export { DEFAULT_CLAMP_MAX_SIZE, DEFAULT_CLAMP_TIGHTENING_THRESHOLD };
4
4
  export declare class AdwClamp extends GridLayout {
5
- private _maximumSize;
5
+ private _props;
6
6
  private _child;
7
+ /** The container width the child was last clamped against, in DIPs. */
8
+ private _measuredWidth;
7
9
  constructor();
8
10
  /** Set (or replace) the clamped, centered child. Pass `null` to clear it. */
9
11
  setChild(view: View | null): void;
10
12
  /** The currently-clamped child, or `null`. */
11
13
  get child(): View | null;
12
- /** The maximum width the child is capped to, in DIPs. */
14
+ /** `Adw.Clamp:maximum-size` — the widest the child may ever get, in DIPs. */
13
15
  get maximumSize(): number;
14
16
  set maximumSize(value: number);
17
+ /**
18
+ * `Adw.Clamp:tightening-threshold` — the width above which the clamp starts
19
+ * tightening its grip, easing the child toward {@link maximumSize} instead of
20
+ * snapping to it. The storybook has exposed this control all along; until now
21
+ * only the GTK pane responded to it.
22
+ */
23
+ get tighteningThreshold(): number;
24
+ set tighteningThreshold(value: number);
25
+ /**
26
+ * Re-run libadwaita's allocation against the container's current width.
27
+ *
28
+ * The class assignment is guarded on a real change: this runs from
29
+ * `layoutChanged`, and re-styling a view can schedule another layout pass.
30
+ */
31
+ private _allocate;
15
32
  }
@@ -0,0 +1,73 @@
1
+ import { GridLayout, type EventData } from '@nativescript/core';
2
+ import type { AdwDataGridColumn, AdwDataGridRow } from '@gjsify/adwaita-core';
3
+ /** Event name emitted when an interactive row is tapped. Mirrors the browser's `row-activated`. */
4
+ export declare const ROW_ACTIVATED = "row-activated";
5
+ /** Payload of the `row-activated` event. */
6
+ export interface RowActivatedEventData extends EventData {
7
+ /** The row's index in the `rows` array. */
8
+ index: number;
9
+ /** The row object that was activated. */
10
+ row: AdwDataGridRow;
11
+ }
12
+ export declare class AdwDataGrid extends GridLayout {
13
+ private _columns;
14
+ private _rows;
15
+ private _interactive;
16
+ /** The header row's nodes, or `null` while there are no columns. */
17
+ private _header;
18
+ /** One entry per data row, index-aligned with {@link _rows}. */
19
+ private _rowNodes;
20
+ /** The tracks the declared columns were built from — the re-declare guard. */
21
+ private _trackKey;
22
+ /** The columns×rows the views were built for — the rebuild guard. */
23
+ private _shapeKey;
24
+ constructor();
25
+ /** The column descriptors. Setting them re-derives the tracks. */
26
+ get columns(): AdwDataGridColumn[];
27
+ set columns(value: ReadonlyArray<AdwDataGridColumn>);
28
+ /** The row objects (copied, like the browser element does). */
29
+ get rows(): AdwDataGridRow[];
30
+ set rows(value: ReadonlyArray<AdwDataGridRow>);
31
+ /**
32
+ * Whether every `normal` row is tappable (a row may still opt out with
33
+ * `interactive: false`). Section / subtotal / total rows never activate.
34
+ *
35
+ * A REPAINT, not a rebuild: the flag changes which rows carry the
36
+ * `interactive` class and answer a tap, and nothing about the layout.
37
+ */
38
+ get interactive(): boolean;
39
+ set interactive(value: boolean);
40
+ private _render;
41
+ /**
42
+ * (Re)declare the column tracks from the descriptors.
43
+ *
44
+ * Guarded on the derived tracks rather than run on every render: re-declaring
45
+ * invalidates the layout, and a data change must not move the columns. The
46
+ * precedent is `AdwViewSwitcherBar`, which rebuilds only when the page count
47
+ * moves; the key generalises that, because a column list can change without
48
+ * changing length (`data-grid-model.ts` says why).
49
+ */
50
+ private _syncColumns;
51
+ /**
52
+ * Rebuild the cell views when the grid's SHAPE moves, and only then.
53
+ *
54
+ * A repaint keeps the views: replacing the row under the user's finger on
55
+ * every data update is what the view-switcher bar's count guard exists to
56
+ * avoid, and here it would also drop the press state mid-touch.
57
+ */
58
+ private _syncNodes;
59
+ /** Build one row: the spanning background first, then a cell per column. */
60
+ private _buildRow;
61
+ /** Repaint text + classes from the current data. Never structural. */
62
+ private _paint;
63
+ /** Un-collapse a cell and set its span — the inverse of the section branch. */
64
+ private _showCell;
65
+ /**
66
+ * Emit `row-activated` for a tapped row — if it activates at all.
67
+ *
68
+ * The gate is re-evaluated here rather than at wiring time, and it reads the
69
+ * CURRENT row object: the listener outlives a `rows` assignment of the same
70
+ * length, so a captured row would be the previous data set's.
71
+ */
72
+ private _activate;
73
+ }
@@ -0,0 +1,45 @@
1
+ import { Label, StackLayout, type EventData } from '@nativescript/core';
2
+ import type { AdwComboOption } from '@gjsify/adwaita-core';
3
+ import { AdwIcon } from './adw-icon.js';
4
+ /** Event name emitted when {@link AdwDropDown.selected} changes through a pick. Mirrors GObject `notify::selected`. */
5
+ export declare const NOTIFY_SELECTED = "notify::selected";
6
+ /** Payload of the `notify::selected` event. */
7
+ export interface NotifyDropDownSelectedEventData extends EventData {
8
+ /** The newly-selected index. */
9
+ selected: number;
10
+ /** The newly-selected option's `value`. */
11
+ value: string;
12
+ /** The newly-selected option's `label` — what the button now shows. */
13
+ label: string;
14
+ }
15
+ export declare class AdwDropDown extends StackLayout {
16
+ /** The button label — the selected option. */
17
+ protected readonly _label: Label;
18
+ /** The down-chevron — a real Adwaita `pan-down-symbolic` icon. */
19
+ protected readonly _chevron: AdwIcon;
20
+ /** The headless options list + selectedIndex↔selectedValue state machine (ADR 0004). */
21
+ private readonly _state;
22
+ /** Title shown atop the substituted `action()` sheet. */
23
+ private _chooserTitle;
24
+ constructor();
25
+ /** Open the native chooser and apply the picked option. */
26
+ private _openChooser;
27
+ /** The selectable options. Updates the button label. */
28
+ get options(): AdwComboOption[];
29
+ set options(value: AdwComboOption[]);
30
+ /** The selected option index (`Gtk.DropDown:selected`). */
31
+ get selected(): number;
32
+ set selected(value: number);
33
+ /** The selected option's `value`, or `''` when out of range. */
34
+ get selectedValue(): string;
35
+ set selectedValue(value: string);
36
+ /** The selected option descriptor, or `null` when out of range (`Gtk.DropDown:selected-item`). */
37
+ get selectedItem(): AdwComboOption | null;
38
+ /**
39
+ * Optional title shown atop the chooser sheet. A SUBSTITUTION affordance:
40
+ * GTK's popover has no title, but a bare native sheet gives no clue what is
41
+ * being chosen — the same reason `AdwMenuButton` carries `menuTitle`.
42
+ */
43
+ get chooserTitle(): string;
44
+ set chooserTitle(value: string);
45
+ }
@@ -1,17 +1,113 @@
1
- import { TextField, type EventData } from '@nativescript/core';
1
+ import { Label, StackLayout, TextField, type EventData, type View } from '@nativescript/core';
2
+ import { EntryRowState, type EntryRowRenderState } from '@gjsify/adwaita-core';
2
3
  import { AdwActionRow } from './adw-action-row.js';
4
+ import { AdwIcon } from './adw-icon.js';
5
+ import { AdwImageButton } from './adw-image-button.js';
6
+ export { EntryRowState } from '@gjsify/adwaita-core';
7
+ export type { EntryRowRenderState, EntryRowActivation } from '@gjsify/adwaita-core';
3
8
  /** Event name emitted when {@link AdwEntryRow.text} changes. Mirrors GObject `notify::text`. */
4
9
  export declare const NOTIFY_TEXT = "notify::text";
10
+ /** Event name emitted when the character count changes — `on_length_changed` (adw-entry-row.c:268-273). */
11
+ export declare const NOTIFY_TEXT_LENGTH = "notify::text-length";
12
+ /** Event name emitted by the apply button, or by the return key while it shows — `AdwEntryRow::apply` (C:240). */
13
+ export declare const SIGNAL_APPLY = "apply";
14
+ /** Event name emitted by the return key when there is nothing to apply — `AdwEntryRow::entry-activated` (C:256). */
15
+ export declare const SIGNAL_ENTRY_ACTIVATED = "entry-activated";
5
16
  /** Payload of the `notify::text` event. */
6
17
  export interface NotifyTextEventData extends EventData {
7
18
  /** The new text value. */
8
19
  text: string;
9
20
  }
21
+ /** Payload of the `notify::text-length` event. */
22
+ export interface NotifyTextLengthEventData extends EventData {
23
+ /** The new number of CHARACTERS (not UTF-16 units). */
24
+ textLength: number;
25
+ }
26
+ /** Payload of the `entry-activated` event. */
27
+ export interface EntryActivatedEventData extends EventData {
28
+ /**
29
+ * Whether the host must activate its default action FIRST — the C calls
30
+ * `gtk_widget_activate_default` on line 254 and emits the signal on line 256,
31
+ * and NS has no default-widget concept, so the ordering becomes the host's.
32
+ */
33
+ activateDefault: boolean;
34
+ }
10
35
  export declare class AdwEntryRow extends AdwActionRow {
36
+ /** `AdwEntryRow` derives from `AdwPreferencesRow` in C (adw-entry-row.c:90), so
37
+ * the preferences search must NOT read the text typed into it. */
38
+ readonly isActionRow: boolean;
39
+ /** The headless `update_empty` derivation + apply latch (ADR 0004). */
40
+ protected readonly _state: EntryRowState;
11
41
  /** The TextField stacked below the title in column 0. */
12
42
  protected readonly _field: TextField;
43
+ /** The large placeholder title (`empty_title` in adw-entry-row.ui). */
44
+ protected readonly _emptyTitle: Label;
45
+ /** The trailing affordance box — `Adw.EntryRow`'s suffixes BOX, not a slot. */
46
+ protected readonly _suffixes: StackLayout;
47
+ /** The pencil (`edit_icon`). Non-interactive, like its `can-target=False` original. */
48
+ protected readonly _editIcon: AdwIcon;
49
+ /** The caps-lock warning slot (`indicator`). */
50
+ protected readonly _indicator: AdwIcon;
51
+ /** The apply button. */
52
+ protected readonly _applyButton: AdwImageButton;
53
+ /** The suffix installed through the inherited single-slot {@link setSuffix}. */
54
+ private _slotSuffix;
55
+ private _lastText;
56
+ private _lastLength;
13
57
  constructor();
14
- /** The editable text. Two-way bound to the suffix `TextField.text`. */
58
+ /** The editable text. */
15
59
  get text(): string;
16
60
  set text(value: string);
61
+ /** `Adw.EntryRow:text-length` — the number of CHARACTERS, not UTF-16 units. */
62
+ get textLength(): number;
63
+ /** `Adw.EntryRow:max-length` — maximum number of characters, `0` = unlimited. */
64
+ get maxLength(): number;
65
+ set maxLength(value: number);
66
+ /** Whether the entry accepts edits (`GtkEditable:editable`). */
67
+ get editable(): boolean;
68
+ set editable(value: boolean);
69
+ /** `Adw.EntryRow:show-apply-button` — typing reveals an apply button. */
70
+ get showApplyButton(): boolean;
71
+ set showApplyButton(value: boolean);
72
+ /** `Adw.EntryRow:activates-default` — reported on `entry-activated`, acted on by the host. */
73
+ get activatesDefault(): boolean;
74
+ set activatesDefault(value: boolean);
75
+ /** Whether the field currently has focus. */
76
+ get editing(): boolean;
77
+ /**
78
+ * Append a suffix — `adw_entry_row_add_suffix` (adw-entry-row.c:885-899),
79
+ * which appends into a BOX so suffixes COEXIST.
80
+ */
81
+ addSuffix(view: View): void;
82
+ /**
83
+ * The inherited single-slot API, kept working for existing consumers: it
84
+ * replaces only the suffix a previous `setSuffix` installed.
85
+ *
86
+ * `AdwActionRow.setSuffix` removes whatever sat in the slot, which detached
87
+ * the password row's own peek toggle the moment a consumer set a suffix —
88
+ * while `_peekButton` kept pointing at the detached view, so the row could
89
+ * never be revealed again. Upstream has no such conflict because there is no
90
+ * single slot: `add_suffix` appends.
91
+ */
92
+ setSuffix(view: View | null): void;
93
+ /** The suffix installed through {@link setSuffix}, or `null`. */
94
+ get suffix(): View | null;
95
+ /**
96
+ * Drive the trailing indicator — `adw_entry_row_set_show_indicator`
97
+ * (adw-entry-row-private.h, C:1281-1296). Private-to-the-library upstream,
98
+ * public here because `AdwPasswordEntryRow` composes rather than reaching
99
+ * into a private header.
100
+ */
101
+ setShowIndicator(show: boolean): void;
102
+ /** `adw_entry_row_set_indicator_icon_name` (C:1263-1273), as an Adwaita symbolic SVG. */
103
+ setIndicatorIcon(svg: string): void;
104
+ /** Apply the pending edit — the apply button tap (C:229-241). */
105
+ apply(): void;
106
+ /** `text_activated_cb` (C:243-266) — exactly one of the two signals. */
107
+ private _activate;
108
+ /** Paint one render snapshot through the shared (spec-driven) painter. */
109
+ protected _render(state: EntryRowRenderState): void;
110
+ /** Base class list this row paints its state classes onto. */
111
+ protected get _baseClassName(): string;
112
+ private _onStateChanged;
17
113
  }
@@ -0,0 +1,43 @@
1
+ import { GridLayout, TextField, type EventData } from '@nativescript/core';
2
+ /** Event name emitted when {@link AdwEntry.text} changes. Mirrors GObject `notify::text`. */
3
+ export declare const NOTIFY_TEXT = "notify::text";
4
+ /** Event name emitted when the return key is pressed — `Gtk.Entry::activate`. */
5
+ export declare const ACTIVATE = "activate";
6
+ /** Payload of the `notify::text` event. */
7
+ export interface NotifyEntryTextEventData extends EventData {
8
+ /** The new text value (already truncated to `maxLength`). */
9
+ text: string;
10
+ /** The new number of CHARACTERS (not UTF-16 units). */
11
+ textLength: number;
12
+ }
13
+ export declare class AdwEntry extends GridLayout {
14
+ /** The real input. Chrome-less: the box around it paints the Adwaita surface. */
15
+ protected readonly _field: TextField;
16
+ private _text;
17
+ private _maxLength;
18
+ constructor();
19
+ /**
20
+ * Truncate, write the field, and notify on a real change.
21
+ *
22
+ * Writing the field re-enters through `textChange`; the nested call finds the
23
+ * text already applied and settles it, and the outer one then sees its own
24
+ * value in `_text` and stops — so a truncated keystroke notifies exactly once.
25
+ */
26
+ private _applyText;
27
+ /** The editable text. */
28
+ get text(): string;
29
+ set text(value: string);
30
+ /** The number of CHARACTERS in {@link text}, not UTF-16 units. */
31
+ get textLength(): number;
32
+ /** Maximum number of characters, `0` = unlimited. */
33
+ get maxLength(): number;
34
+ set maxLength(value: number);
35
+ /** Placeholder shown while the entry is empty (`Gtk.Entry:placeholder-text`). */
36
+ get placeholder(): string;
37
+ set placeholder(value: string);
38
+ /** Whether the entry accepts edits (`GtkEditable:editable`). */
39
+ get editable(): boolean;
40
+ set editable(value: boolean);
41
+ /** The inner `TextField` — for focus, selection and host-specific keyboard options. */
42
+ get field(): TextField;
43
+ }
@@ -11,6 +11,9 @@ export interface NotifyExpandedEventData extends EventData {
11
11
  expanded: boolean;
12
12
  }
13
13
  export declare class AdwExpanderRow extends AdwActionRow {
14
+ /** `AdwExpanderRow` derives from `AdwPreferencesRow` in C
15
+ * (adw-expander-row.c:72), so the search does not consult a subtitle here. */
16
+ readonly isActionRow: boolean;
14
17
  /** The disclosure chevron (suffix) — a plain symbolic icon, like Adw.ExpanderRow. */
15
18
  protected readonly _toggle: AdwIcon;
16
19
  /** The container of revealed child rows (second grid row). */
@@ -20,9 +20,18 @@ export declare class AdwHeaderBar extends GridLayout {
20
20
  */
21
21
  get flat(): boolean;
22
22
  set flat(value: boolean);
23
- /** Append a widget to the start (left) slot. */
23
+ /** Pack a widget at the start (left) of the bar — `gtk_box_append`. */
24
24
  packStart(view: View): void;
25
- /** Append a widget to the end (right) slot. */
25
+ /**
26
+ * Pack a widget at the end (right) of the bar.
27
+ *
28
+ * `adw_header_bar_pack_end` PREPENDS (`gtk_box_prepend`,
29
+ * adw-header-bar.c:1106): "packed with reference to the end" means the FIRST
30
+ * widget packed is the one nearest the end of the bar, and each later one
31
+ * goes in front of it. The port appended instead, so every end slot came out
32
+ * mirrored — `packEnd(menu); packEnd(search)` drew `menu | search` where
33
+ * libadwaita draws `search | menu`, with the menu button in the corner.
34
+ */
26
35
  packEnd(view: View): void;
27
36
  /** Replace the centered title widget with a custom one (e.g. a URL entry). */
28
37
  setTitleWidget(view: View): void;
@@ -1,6 +1,32 @@
1
+ import type { AdwInlineViewSwitcherDisplayMode } from '@gjsify/adwaita-core';
1
2
  import { AdwViewSwitcherBase } from './view-switcher-base.js';
3
+ import type { ViewSwitcherKind } from './view-switcher-model.js';
2
4
  export declare class AdwInlineViewSwitcher extends AdwViewSwitcherBase {
5
+ private _displayMode;
3
6
  constructor();
4
7
  protected get barClass(): string;
5
8
  protected get buttonClass(): string;
9
+ protected get buttonDisplayMode(): AdwInlineViewSwitcherDisplayMode;
10
+ /**
11
+ * `populate_group` gates on the page's `visible` ALONE
12
+ * (adw-inline-view-switcher.c:370-378) — the title-or-icon rule the base
13
+ * follows belongs to `AdwViewSwitcher.update_button`
14
+ * (adw-view-switcher.c:178) and has no counterpart here, so a page with
15
+ * neither title nor icon still gets an (empty) toggle.
16
+ *
17
+ * Inheriting the stricter rule made this switcher drop toggles libadwaita
18
+ * draws. The rule itself lives in {@link switcherButtonVisible}, where a
19
+ * spec can reach it.
20
+ */
21
+ protected get switcherKind(): ViewSwitcherKind;
22
+ /** What the toggles display: `'labels'` (default), `'icons'` or `'both'`. */
23
+ get displayMode(): AdwInlineViewSwitcherDisplayMode;
24
+ /**
25
+ * Set the display mode. An unrecognised value is REJECTED and leaves the
26
+ * current mode alone — `g_return_if_fail (mode <= ADW_INLINE_VIEW_SWITCHER_BOTH)`
27
+ * returns before `self->display_mode` is touched
28
+ * (adw-inline-view-switcher.c:819). The browser port used to replace the
29
+ * current mode with `'both'` there.
30
+ */
31
+ set displayMode(value: AdwInlineViewSwitcherDisplayMode);
6
32
  }
@@ -1,5 +1,6 @@
1
1
  import { AdwSplitViewBase } from './split-view-base.js';
2
- export declare class AdwNavigationSplitView extends AdwSplitViewBase {
2
+ import { NsNavigationSplitViewState } from './split-view-state.js';
3
+ export declare class AdwNavigationSplitView extends AdwSplitViewBase<NsNavigationSplitViewState> {
3
4
  constructor();
4
5
  protected _applyLayout(): void;
5
6
  /** Animate the collapsed master⇄detail swap; instant off-screen/off-device. */