@gjsify/adwaita-web 0.31.0 → 0.33.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 (183) hide show
  1. package/dist/adwaita-web.css +835 -299
  2. package/dist/adwaita-web.css.map +1 -1
  3. package/lib/types/adw-about-dialog.spec.d.ts +1 -0
  4. package/lib/types/adw-action-rows.spec.d.ts +1 -0
  5. package/lib/types/adw-avatar.spec.d.ts +1 -0
  6. package/lib/types/adw-banner.spec.d.ts +1 -0
  7. package/lib/types/adw-button-content.spec.d.ts +1 -0
  8. package/lib/types/adw-carousel.spec.d.ts +1 -0
  9. package/lib/types/adw-checks.spec.d.ts +1 -0
  10. package/lib/types/adw-header-bar.spec.d.ts +1 -0
  11. package/lib/types/adw-icon.spec.d.ts +1 -0
  12. package/lib/types/adw-progress-bar.spec.d.ts +1 -0
  13. package/lib/types/adw-sidebar.spec.d.ts +1 -0
  14. package/lib/types/adw-switch.spec.d.ts +1 -0
  15. package/lib/types/adw-wrap-box.spec.d.ts +1 -0
  16. package/lib/types/bottom-sheet.spec.d.ts +1 -0
  17. package/lib/types/breakpoints.d.ts +22 -0
  18. package/lib/types/breakpoints.spec.d.ts +1 -0
  19. package/lib/types/chrome.spec.d.ts +1 -0
  20. package/lib/types/elements/adw-about-dialog.d.ts +47 -8
  21. package/lib/types/elements/adw-action-row.d.ts +35 -0
  22. package/lib/types/elements/adw-avatar.d.ts +11 -0
  23. package/lib/types/elements/adw-bottom-sheet.d.ts +33 -4
  24. package/lib/types/elements/adw-button-content.d.ts +12 -0
  25. package/lib/types/elements/adw-button-row.d.ts +10 -1
  26. package/lib/types/elements/adw-carousel.d.ts +111 -8
  27. package/lib/types/elements/adw-checks.d.ts +57 -0
  28. package/lib/types/elements/adw-clamp.d.ts +4 -1
  29. package/lib/types/elements/adw-combo-row.d.ts +10 -0
  30. package/lib/types/elements/adw-data-grid.d.ts +11 -31
  31. package/lib/types/elements/adw-drop-down.d.ts +17 -20
  32. package/lib/types/elements/adw-entry-row.d.ts +93 -3
  33. package/lib/types/elements/adw-expander-row.d.ts +7 -1
  34. package/lib/types/elements/adw-header-bar.d.ts +15 -0
  35. package/lib/types/elements/adw-icon.d.ts +25 -0
  36. package/lib/types/elements/adw-inline-view-switcher.d.ts +73 -11
  37. package/lib/types/elements/adw-menu-button.d.ts +6 -6
  38. package/lib/types/elements/adw-navigation-split-view.d.ts +48 -0
  39. package/lib/types/elements/adw-navigation-view.d.ts +63 -20
  40. package/lib/types/elements/adw-overlay-split-view.d.ts +94 -0
  41. package/lib/types/elements/adw-password-entry-row.d.ts +19 -10
  42. package/lib/types/elements/adw-popover.d.ts +58 -0
  43. package/lib/types/elements/adw-preferences-dialog.d.ts +57 -2
  44. package/lib/types/elements/adw-preferences-group.d.ts +31 -0
  45. package/lib/types/elements/adw-progress-bar.d.ts +38 -0
  46. package/lib/types/elements/adw-sidebar.d.ts +37 -5
  47. package/lib/types/elements/adw-spinner.d.ts +23 -0
  48. package/lib/types/elements/adw-split-button.d.ts +53 -7
  49. package/lib/types/elements/adw-switch-row.d.ts +11 -2
  50. package/lib/types/elements/adw-switch.d.ts +15 -0
  51. package/lib/types/elements/adw-tab-view.d.ts +129 -12
  52. package/lib/types/elements/adw-toolbar-view.d.ts +5 -0
  53. package/lib/types/elements/adw-view-stack.d.ts +39 -19
  54. package/lib/types/elements/adw-view-switcher-bar.d.ts +25 -7
  55. package/lib/types/elements/adw-view-switcher.d.ts +76 -13
  56. package/lib/types/elements/adw-window-title.d.ts +3 -1
  57. package/lib/types/elements/adw-wrap-box.d.ts +58 -3
  58. package/lib/types/elements/view-switcher-dom.d.ts +44 -0
  59. package/lib/types/entry-rows.spec.d.ts +1 -0
  60. package/lib/types/index.d.ts +7 -0
  61. package/lib/types/navigation-view.spec.d.ts +1 -0
  62. package/lib/types/preferences-search.d.ts +20 -0
  63. package/lib/types/preferences.spec.d.ts +1 -0
  64. package/lib/types/split-button.spec.d.ts +1 -0
  65. package/lib/types/split-views.spec.d.ts +1 -0
  66. package/lib/types/styles.generated.d.ts +1 -1
  67. package/lib/types/tab-view.spec.d.ts +1 -0
  68. package/lib/types/view-stack.spec.d.ts +1 -0
  69. package/lib/types/view-switcher.spec.d.ts +1 -0
  70. package/package.json +6 -6
  71. package/scss/_banner.scss +13 -0
  72. package/scss/_bottom_sheet.scss +5 -6
  73. package/scss/_button.scss +3 -26
  74. package/scss/_button_content.scss +28 -0
  75. package/scss/_checks.scss +228 -0
  76. package/scss/_clamp.scss +9 -3
  77. package/scss/_combo_row.scss +19 -0
  78. package/scss/_data_grid.scss +15 -7
  79. package/scss/_drop_down.scss +12 -55
  80. package/scss/_expander_row.scss +5 -50
  81. package/scss/_icon.scss +51 -0
  82. package/scss/_icons.generated.scss +6 -0
  83. package/scss/_inline_view_switcher.scss +34 -0
  84. package/scss/_labels.scss +135 -0
  85. package/scss/_menu_button.scss +10 -70
  86. package/scss/_navigation_split_view.scss +47 -8
  87. package/scss/_overlay_split_view.scss +117 -32
  88. package/scss/_popover.scss +186 -0
  89. package/scss/_preferences.scss +29 -0
  90. package/scss/_preferences_dialog.scss +17 -0
  91. package/scss/_progress_bar.scss +161 -0
  92. package/scss/_reset.scss +18 -7
  93. package/scss/_spinner.scss +37 -19
  94. package/scss/_split_button.scss +6 -50
  95. package/scss/_switch.scss +90 -0
  96. package/scss/_switch_row.scss +6 -52
  97. package/scss/_tab_view.scss +63 -0
  98. package/scss/_theme.scss +10 -0
  99. package/scss/_toolbar_view.scss +74 -0
  100. package/scss/_variables.scss +34 -0
  101. package/scss/_view_switcher.scss +40 -0
  102. package/scss/_view_switcher_bar.scss +37 -0
  103. package/scss/_wrap_box.scss +65 -6
  104. package/scss/adwaita-skin.scss +23 -0
  105. package/src/adw-about-dialog.spec.ts +350 -0
  106. package/src/adw-action-rows.spec.ts +342 -0
  107. package/src/adw-avatar.spec.ts +176 -0
  108. package/src/adw-banner.spec.ts +152 -0
  109. package/src/adw-button-content.spec.ts +207 -0
  110. package/src/adw-button-row.spec.ts +12 -6
  111. package/src/adw-carousel.spec.ts +389 -0
  112. package/src/adw-checks.spec.ts +368 -0
  113. package/src/adw-drop-down.spec.ts +123 -0
  114. package/src/adw-header-bar.spec.ts +83 -0
  115. package/src/adw-icon.spec.ts +167 -0
  116. package/src/adw-progress-bar.spec.ts +173 -0
  117. package/src/adw-row-state.spec.ts +49 -0
  118. package/src/adw-sidebar.spec.ts +332 -0
  119. package/src/adw-switch.spec.ts +242 -0
  120. package/src/adw-tab-view.spec.ts +12 -3
  121. package/src/adw-view-switcher-bar.spec.ts +61 -13
  122. package/src/adw-wrap-box.spec.ts +341 -0
  123. package/src/bottom-sheet.spec.ts +325 -0
  124. package/src/breakpoints.spec.ts +147 -0
  125. package/src/breakpoints.ts +67 -0
  126. package/src/chrome.spec.ts +400 -0
  127. package/src/elements/adw-about-dialog.ts +223 -163
  128. package/src/elements/adw-action-row.ts +131 -11
  129. package/src/elements/adw-avatar.ts +48 -54
  130. package/src/elements/adw-banner.ts +46 -10
  131. package/src/elements/adw-bottom-sheet.ts +145 -60
  132. package/src/elements/adw-button-content.ts +107 -33
  133. package/src/elements/adw-button-row.ts +61 -37
  134. package/src/elements/adw-button.ts +5 -7
  135. package/src/elements/adw-carousel.ts +467 -105
  136. package/src/elements/adw-checks.ts +299 -0
  137. package/src/elements/adw-clamp.ts +80 -10
  138. package/src/elements/adw-combo-row.ts +32 -7
  139. package/src/elements/adw-data-grid.ts +43 -91
  140. package/src/elements/adw-drop-down.ts +117 -128
  141. package/src/elements/adw-entry-row.ts +404 -36
  142. package/src/elements/adw-expander-row.ts +61 -29
  143. package/src/elements/adw-header-bar.ts +31 -6
  144. package/src/elements/adw-icon.ts +148 -0
  145. package/src/elements/adw-inline-view-switcher.ts +325 -131
  146. package/src/elements/adw-menu-button.ts +93 -70
  147. package/src/elements/adw-navigation-split-view.ts +220 -14
  148. package/src/elements/adw-navigation-view.ts +286 -148
  149. package/src/elements/adw-overlay-split-view.ts +536 -28
  150. package/src/elements/adw-password-entry-row.ts +111 -89
  151. package/src/elements/adw-popover.ts +283 -0
  152. package/src/elements/adw-preferences-dialog.ts +120 -21
  153. package/src/elements/adw-preferences-group.ts +128 -22
  154. package/src/elements/adw-progress-bar.ts +189 -0
  155. package/src/elements/adw-sidebar.ts +301 -142
  156. package/src/elements/adw-spin-row.ts +11 -5
  157. package/src/elements/adw-spinner.ts +168 -9
  158. package/src/elements/adw-split-button.ts +371 -92
  159. package/src/elements/adw-status-page.ts +9 -9
  160. package/src/elements/adw-switch-row.ts +100 -30
  161. package/src/elements/adw-switch.ts +129 -0
  162. package/src/elements/adw-tab-view.ts +700 -129
  163. package/src/elements/adw-toggle-group.ts +5 -7
  164. package/src/elements/adw-toolbar-view.ts +84 -21
  165. package/src/elements/adw-view-stack.ts +183 -85
  166. package/src/elements/adw-view-switcher-bar.ts +171 -81
  167. package/src/elements/adw-view-switcher.ts +328 -117
  168. package/src/elements/adw-window-title.ts +44 -11
  169. package/src/elements/adw-wrap-box.ts +329 -78
  170. package/src/elements/view-switcher-dom.ts +108 -0
  171. package/src/entry-rows.spec.ts +391 -0
  172. package/src/index.ts +23 -0
  173. package/src/navigation-view.spec.ts +435 -0
  174. package/src/preferences-search.ts +135 -0
  175. package/src/preferences.spec.ts +250 -0
  176. package/src/source-view/adw-source-view.ts +2 -5
  177. package/src/split-button.spec.ts +470 -0
  178. package/src/split-views.spec.ts +893 -0
  179. package/src/styles.generated.ts +1 -1
  180. package/src/tab-view.spec.ts +451 -0
  181. package/src/test.browser.mts +49 -0
  182. package/src/view-stack.spec.ts +272 -0
  183. package/src/view-switcher.spec.ts +665 -0
@@ -1,19 +1,41 @@
1
- /** A single page. Children of <adw-tab-view>; consumed at connect time. */
1
+ import type { AdwTabPageSpec, AdwTabPageState } from '@gjsify/adwaita-core';
2
+ /** A page descriptor as `pages` exposes it. */
3
+ export type AdwTabViewPage = AdwTabPageState<HTMLElement>;
4
+ /** The page spec the imperative insertion methods take. */
5
+ export type AdwTabViewPageSpec = AdwTabPageSpec<HTMLElement>;
6
+ /**
7
+ * A single page. Declared as a child of <adw-tab-view>; the element itself
8
+ * becomes the page panel, so its attributes keep driving the tab after connect —
9
+ * the old implementation moved the children out and discarded the element, which
10
+ * is why its `observedAttributes` declaration had nothing to act on.
11
+ */
2
12
  export declare class AdwTabPage extends HTMLElement {
3
13
  static get observedAttributes(): string[];
14
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
4
15
  }
5
16
  export declare class AdwTabView extends HTMLElement {
6
- private _barEl;
7
- private _pagesEl;
8
- private _tabs;
9
- private _pages;
10
- private _selected;
17
+ private readonly _state;
18
+ private readonly _barEl;
19
+ private readonly _tabBoxEl;
20
+ private readonly _pagesEl;
21
+ /** Tab chips keyed by page id — the bar is edited in place, never rebuilt. */
22
+ private readonly _tabs;
23
+ /** Page panels keyed by page id; kept so a DETACHED page's node is still reachable. */
24
+ private readonly _panels;
25
+ private readonly _hovered;
11
26
  private _initialized;
27
+ private _generatedIds;
28
+ /** Guards the `selected` attribute reflection against re-entering the model. */
29
+ private _reflecting;
12
30
  static get observedAttributes(): string[];
13
- /** Zero-based index of the visible page. */
31
+ constructor();
32
+ /** Zero-based index of the visible page, `-1` when the view is empty. */
14
33
  get selected(): number;
15
34
  set selected(value: number);
16
- /** Whether the tab bar hides itself when only one page remains. */
35
+ /**
36
+ * Whether the tab bar hides itself when it has nothing to show —
37
+ * `tabsRevealed`, which keeps the bar up for a single PINNED tab.
38
+ */
17
39
  get autohide(): boolean;
18
40
  set autohide(value: boolean);
19
41
  /** Whether tabs stretch to fill the bar evenly (Adw.TabBar `expand-tabs`). */
@@ -23,8 +45,103 @@ export declare class AdwTabView extends HTMLElement {
23
45
  get noClose(): boolean;
24
46
  set noClose(value: boolean);
25
47
  connectedCallback(): void;
26
- attributeChangedCallback(name: string): void;
27
- private _readSelectedAttr;
28
- private _selectIndex;
29
- private _render;
48
+ attributeChangedCallback(name: string, _old: string | null, _value: string | null): void;
49
+ /**
50
+ * Push a live `<adw-tab-page>` attribute change into the model. Called by
51
+ * {@link AdwTabPage.attributeChangedCallback}; not part of the public API.
52
+ */
53
+ syncDeclaredPage(pageEl: AdwTabPage, name: string, value: string | null): void;
54
+ /** All pages in order. */
55
+ get pages(): readonly AdwTabViewPage[];
56
+ /** Number of pages. */
57
+ get nPages(): number;
58
+ /** Length of the pinned prefix. */
59
+ get nPinnedPages(): number;
60
+ /** Id of the selected page, `null` when the view is empty. */
61
+ get selectedId(): string | null;
62
+ /** Index of the selected page, `-1` when the view is empty. */
63
+ get selectedIndex(): number;
64
+ /** The selected page's panel element, or `null`. */
65
+ get selectedContent(): HTMLElement | null;
66
+ isClosing(id: string): boolean;
67
+ setSelectedPage(id: string | null): boolean;
68
+ selectNthPage(n: number): boolean;
69
+ selectPreviousPage(): boolean;
70
+ selectNextPage(): boolean;
71
+ selectFirstPage(): boolean;
72
+ selectLastPage(): boolean;
73
+ /** Ctrl+Tab — the next page, wrapping to the first. */
74
+ cycleNextPage(): boolean;
75
+ /** Ctrl+Shift+Tab — the previous page, wrapping to the last. */
76
+ cyclePreviousPage(): boolean;
77
+ /** Add a page opened FROM `parentId`, deriving its position (Adw.TabView.add_page). */
78
+ addPage(spec: AdwTabViewPageSpec, parentId?: string | null): number;
79
+ insertPage(spec: AdwTabViewPageSpec, position: number): number;
80
+ prependPage(spec: AdwTabViewPageSpec): number;
81
+ appendPage(spec: AdwTabViewPageSpec): number;
82
+ insertPinnedPage(spec: AdwTabViewPageSpec, position: number): number;
83
+ prependPinnedPage(spec: AdwTabViewPageSpec): number;
84
+ appendPinnedPage(spec: AdwTabViewPageSpec): number;
85
+ /** Pin or unpin a page, re-ordering it in the same step. Returns its new position. */
86
+ setPagePinned(id: string, pinned: boolean): number;
87
+ /**
88
+ * Request a close. Dispatches a CANCELABLE `close-page`; calling
89
+ * `preventDefault()` on it holds the page open until {@link closePageFinish}.
90
+ */
91
+ closePage(id: string): boolean;
92
+ closePageFinish(id: string, confirm: boolean): boolean;
93
+ closeOtherPages(id: string): void;
94
+ closePagesBefore(id: string): void;
95
+ closePagesAfter(id: string): void;
96
+ /** Remove a page unconditionally, running the successor rule first. */
97
+ detachPage(id: string): AdwTabViewPage | null;
98
+ reorderPage(id: string, position: number): boolean;
99
+ reorderBackward(id: string): boolean;
100
+ reorderForward(id: string): boolean;
101
+ reorderFirst(id: string): boolean;
102
+ reorderLast(id: string): boolean;
103
+ setPageTitle(id: string, title: string | null): boolean;
104
+ setPageTooltip(id: string, tooltip: string | null): boolean;
105
+ setPageIcon(id: string, icon: string | null): boolean;
106
+ setPageLoading(id: string, loading: boolean): boolean;
107
+ setPageNeedsAttention(id: string, needsAttention: boolean): boolean;
108
+ /** Every precondition the model refused, as C would have warned about it. */
109
+ get diagnostics(): readonly string[];
110
+ private _adoptDeclaredPage;
111
+ /** Give a spec its panel, so `append({ id })` with no content is legal. */
112
+ private _withPanel;
113
+ private _nextId;
114
+ private _onPagesChange;
115
+ private _insertTab;
116
+ /** Remove-then-insert, the same shape the model's own reorder has. */
117
+ private _moveTab;
118
+ private _refreshTab;
119
+ /**
120
+ * `tabCloseVisible` (adw-tab.c:124 + the pinned gate at :645-650). `dragging`
121
+ * is constantly false — tab drag-and-drop is compositor work and is not
122
+ * modelled — and `fullyVisible` is measured against the bar's scroll window,
123
+ * which is exactly what the C term means for a horizontally scrolled bar.
124
+ */
125
+ private _refreshCloseVisibility;
126
+ private _onSelectionChange;
127
+ private _applyActiveState;
128
+ private _applyBarVisibility;
129
+ private _reflectSelected;
130
+ private _applySelectedAttribute;
131
+ /**
132
+ * The `Adw.TabView` shortcut table (`init_shortcuts`, adw-tab-view.c:2192+),
133
+ * plus the ArrowLeft/ArrowRight movement `role=tablist` promises.
134
+ *
135
+ * Ctrl+Tab WRAPS and Ctrl+Page-Up/Down does not — the same `last` flag that
136
+ * separates them in `select_page_cb` (:2017-2041). Alt+0 is page index 9,
137
+ * because pages count from 0 (:2149-2150).
138
+ */
139
+ private _onKeyDown;
140
+ /**
141
+ * The `close-page` seam. A CANCELABLE DOM event is the idiomatic spelling of
142
+ * the C signal's return value: letting it through takes libadwaita's default
143
+ * (`!pinned`, adw-tab-view.c:1990-1991), and `preventDefault()` defers the
144
+ * close until the app calls {@link closePageFinish}.
145
+ */
146
+ private _requestClose;
30
147
  }
@@ -3,6 +3,8 @@ export declare class AdwToolbarView extends HTMLElement {
3
3
  private _contentEl;
4
4
  private _bottomEl;
5
5
  private _initialized;
6
+ private _resize;
7
+ static get observedAttributes(): string[];
6
8
  /** The top-bar container — append header bars here imperatively. */
7
9
  get topBar(): HTMLDivElement;
8
10
  /** The scrollable content container. */
@@ -10,4 +12,7 @@ export declare class AdwToolbarView extends HTMLElement {
10
12
  /** The bottom-bar container. */
11
13
  get bottomBar(): HTMLDivElement;
12
14
  connectedCallback(): void;
15
+ disconnectedCallback(): void;
16
+ attributeChangedCallback(): void;
17
+ private _syncClasses;
13
18
  }
@@ -1,37 +1,57 @@
1
+ import type { AdwViewStackPageInfo as CorePageInfo } from '@gjsify/adwaita-core';
1
2
  /** A page descriptor exposed via `pages` (consumed by a bound switcher bar). */
2
- export interface AdwViewStackPageInfo {
3
- /** Stable id used by visibleChildName + switcher binding. */
4
- name: string;
5
- /** Human-facing title shown by a bound switcher. */
6
- title: string;
7
- /** Symbolic icon name (no `-symbolic` suffix), or '' for none. */
8
- icon: string;
9
- /** The page's content container (the visibility-toggled node). */
10
- element: HTMLElement;
11
- }
3
+ export type AdwViewStackPageInfo = CorePageInfo<HTMLElement>;
12
4
  export declare class AdwViewStack extends HTMLElement {
13
- private _pages;
14
- private _visibleIndex;
5
+ private readonly _state;
15
6
  private _initialized;
16
7
  static get observedAttributes(): string[];
8
+ constructor();
17
9
  /** All pages in declaration/add order. A bound switcher reads this. */
18
10
  get pages(): readonly AdwViewStackPageInfo[];
19
- /** Zero-based index of the visible page. Out-of-range/same values no-op. */
11
+ /** Zero-based index of the visible page, `-1` when nothing is selected. */
20
12
  get visibleChildIndex(): number;
21
13
  set visibleChildIndex(value: number);
22
- /** Name of the visible page, or '' when the stack is empty. */
14
+ /** Name of the visible page, or '' when nothing is selected. */
23
15
  get visibleChildName(): string;
24
- set visibleChildName(name: string);
25
- /** The visible page's content element, or null when empty. */
16
+ set visibleChildName(name: string | null | undefined);
17
+ /** The visible page's content element, or null when nothing is selected. */
26
18
  get visibleChild(): HTMLElement | null;
27
19
  connectedCallback(): void;
28
20
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
29
21
  /**
30
- * Append a page. The FIRST page added becomes visible automatically; later
31
- * pages are added hidden. Mirrors Adw.ViewStack.add()/the NS twin's add().
22
+ * Append a page. It becomes visible when nothing is selected yet, matching
23
+ * `Adw.ViewStack.add()` — and, unlike before, that auto-pick NOTIFIES.
32
24
  */
33
25
  add(content: HTMLElement, name: string, title?: string, icon?: string): AdwViewStackPageInfo;
34
26
  /** Convenience alias mirroring Adw.ViewStack.add_titled() (no icon). */
35
27
  addTitled(content: HTMLElement, name: string, title: string): AdwViewStackPageInfo;
36
- private _apply;
28
+ /**
29
+ * Remove the first page named `name` and detach its content. Returns whether
30
+ * anything was removed. When the removed page was the visible one the stack
31
+ * ends up showing NOTHING and emits no event — `stack_remove` clears
32
+ * `visible_child` without re-picking (adw-view-stack.c:1202-1203).
33
+ */
34
+ removePage(name: string): boolean;
35
+ /**
36
+ * Show or hide a page (`AdwViewStackPage:visible`). Returns whether the
37
+ * SELECTION moved: hiding the visible page falls back to the next visible
38
+ * one, and making a page visible while nothing is selected selects it
39
+ * (`update_child_visible`, adw-view-stack.c:1061-1082).
40
+ */
41
+ setPageVisible(name: string, visible: boolean): boolean;
42
+ /**
43
+ * The pages model's `items-changed`, which the DOM stack had no counterpart
44
+ * for at all.
45
+ *
46
+ * `AdwViewSwitcherBar` re-runs `update_bar_revealed` on it
47
+ * (adw-view-switcher-bar.c:340) and `AdwViewSwitcher` rebinds its buttons
48
+ * (adw-view-switcher.c:258-263). Both ports listened only on
49
+ * `notify::visible-child`, so adding a page or hiding a non-selected one
50
+ * left `revealed` — and the button row — stale, with a manual `refresh()`
51
+ * as the documented workaround.
52
+ */
53
+ private _emitItemsChanged;
54
+ private _onStateChange;
55
+ private _applyVisibility;
56
+ private _reflectName;
37
57
  }
@@ -1,27 +1,45 @@
1
1
  import type { AdwViewStack } from './adw-view-stack.js';
2
2
  export declare class AdwViewSwitcherBar extends HTMLElement {
3
+ private readonly _barState;
3
4
  private _barEl;
4
- private _buttons;
5
+ private _nodes;
5
6
  private _stack;
6
- private _revealed;
7
7
  private _initialized;
8
- private _onStackNotify;
8
+ private readonly _onStackNotify;
9
9
  static get observedAttributes(): string[];
10
+ constructor();
10
11
  /** The bound stack element, or null when unbound. */
11
12
  get stack(): AdwViewStack | null;
12
13
  set stack(value: AdwViewStack | string | null);
13
- /** Whether the bar is revealed (shown). Hidden when false. */
14
+ /** Whether the layout asked for the bar — `Adw.ViewSwitcherBar:reveal`. */
15
+ get reveal(): boolean;
16
+ set reveal(value: boolean);
17
+ /**
18
+ * Whether the bar is actually shown. READ-ONLY: a one-page stack keeps it
19
+ * collapsed however loudly the layout asks (adw-view-switcher-bar.c:125).
20
+ * Write {@link reveal} to make the request.
21
+ */
14
22
  get revealed(): boolean;
15
- set revealed(value: boolean);
16
23
  connectedCallback(): void;
17
24
  disconnectedCallback(): void;
18
25
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
19
26
  /** Bind to a stack element (or null). Unbinds the previous one and rebuilds. */
20
27
  setStack(stack: AdwViewStack | null): void;
21
- /** Rebuild the buttons — call after adding pages to the bound stack. */
28
+ /**
29
+ * Rebuild the buttons by hand.
30
+ *
31
+ * Kept as public API — a consumer that mutates a page in place still has a
32
+ * way to say so — but no longer the ONLY way: the stack emits
33
+ * `items-changed` now and this bar binds it, which is the mechanism
34
+ * libadwaita uses (adw-view-switcher-bar.c:340,
35
+ * adw-view-switcher.c:258-263).
36
+ */
22
37
  refresh(): void;
38
+ private _readReveal;
39
+ private _bindStack;
40
+ private _unbindStack;
23
41
  private _resolveStack;
24
42
  private _rebuild;
25
- private _syncActive;
43
+ private _buildButton;
26
44
  private _applyRevealed;
27
45
  }
@@ -1,29 +1,92 @@
1
- type Policy = 'wide' | 'narrow';
2
- /** A single page. Children of <adw-view-switcher>; consumed at connect time. */
1
+ import type { ViewSwitcherScheduler } from '@gjsify/adwaita-core';
2
+ import type { AdwViewSwitcherPage as AdwViewSwitcherPageInfo, AdwViewSwitcherPolicy } from '@gjsify/adwaita-core';
3
+ /**
4
+ * A single page. Children of `<adw-view-switcher>`; consumed at connect time.
5
+ *
6
+ * Deliberately carries NO `observedAttributes`. It used to declare six of them
7
+ * and no `attributeChangedCallback`, which is a dead declaration — the browser
8
+ * computes the list and has nowhere to deliver to — so changing `badge-number`,
9
+ * `title`, `icon-name` or `needs-attention` after connect did nothing at all,
10
+ * where C rebinds on every page `notify` (adw-view-switcher.c:184-193, :223).
11
+ *
12
+ * A callback could not fix it either: the switcher consumes these elements at
13
+ * connect and `replaceChildren`s them away, so a detached page has no `closest`
14
+ * to reach its owner through. The switcher watches them with a `MutationObserver`
15
+ * instead, which keeps working after the detach and needs nothing from this class.
16
+ */
3
17
  export declare class AdwViewSwitcherPage extends HTMLElement {
4
- static get observedAttributes(): string[];
5
18
  }
6
19
  export declare class AdwViewSwitcher extends HTMLElement {
20
+ /**
21
+ * The dwell timer, injectable.
22
+ *
23
+ * It used to be `new ViewSwitcherState({ scheduler: domViewSwitcherScheduler })`
24
+ * inline, which left NOWHERE to hand a clock in — so
25
+ * `VIEW_SWITCHER_DRAG_VECTORS` was driven by the core suite alone, and the
26
+ * conformance header claimed all three suites drove it. `scheduler` is a
27
+ * property so a test can replace it before the element connects; the DOM one
28
+ * is the default, exactly as before.
29
+ */
30
+ scheduler: ViewSwitcherScheduler;
31
+ private _stateInstance;
32
+ /** Built on first access, so a `scheduler` set before connect is the one used. */
33
+ private get _state();
7
34
  private _barEl;
8
35
  private _contentEl;
9
- private _pages;
10
- private _active;
36
+ private _nodes;
37
+ /** The page ELEMENTS, kept because the switcher detaches them from the tree. */
38
+ private _declared;
39
+ private _pageObserver;
11
40
  private _policy;
12
41
  private _initialized;
13
42
  static get observedAttributes(): string[];
43
+ constructor();
14
44
  /** The policy controlling the button layout ('wide' | 'narrow'). */
15
- get policy(): Policy;
16
- set policy(value: Policy);
17
- /** Zero-based index of the active page. */
45
+ get policy(): AdwViewSwitcherPolicy;
46
+ set policy(value: AdwViewSwitcherPolicy);
47
+ /** Zero-based index of the selected page, `-1` when nothing is selected. */
18
48
  get active(): number;
19
49
  set active(value: number);
20
- /** The name of the currently visible page, or null when there are none. */
21
- get visibleChildName(): string | null;
50
+ /** Name of the selected page, `''` when nothing is selected. */
51
+ get visibleChildName(): string;
52
+ set visibleChildName(name: string | null | undefined);
53
+ /** The resolved page records a bound layout can read. */
54
+ get pages(): readonly AdwViewSwitcherPageInfo[];
55
+ /**
56
+ * Show or hide a page (`AdwViewStackPage:visible`). Returns whether the
57
+ * SELECTION moved — hiding the selected page falls back to the first still
58
+ * visible one (adw-view-stack.c:1061-1082).
59
+ */
60
+ setPageVisible(name: string, visible: boolean): boolean;
22
61
  connectedCallback(): void;
62
+ disconnectedCallback(): void;
63
+ /**
64
+ * Re-read every declared page and push it into the state.
65
+ *
66
+ * Called by `AdwViewSwitcherPage.attributeChangedCallback`, which is what
67
+ * makes a runtime `badge-number` change reach the button. `setPages` keeps
68
+ * the selection where it can, so this is a repaint and not a reset.
69
+ */
70
+ refreshPages(): void;
71
+ /**
72
+ * Watch the declared pages for attribute changes.
73
+ *
74
+ * A `MutationObserver` rather than an `attributeChangedCallback` on the page:
75
+ * the switcher consumes those elements at connect and `replaceChildren`s them
76
+ * out of the tree, so a detached page cannot find its owner — but an observer
77
+ * bound to it keeps firing. This is the DOM's `notify::` on
78
+ * `AdwViewStackPage`, which the C's `update_button` handler binds per page
79
+ * (adw-view-switcher.c:184-193).
80
+ *
81
+ * It delivers on a MICROTASK where GTK's notify is synchronous. That is the
82
+ * DOM's contract for watching a node, it is invisible to a user, and nothing
83
+ * in this element reads the button back inside the setter.
84
+ */
85
+ private _watchPages;
23
86
  attributeChangedCallback(name: string): void;
87
+ private _buildPage;
24
88
  private _readPolicyAttr;
25
- private _readActiveAttr;
26
- private _selectIndex;
89
+ private _onStateChange;
27
90
  private _render;
91
+ private _reflectActive;
28
92
  }
29
- export {};
@@ -1,9 +1,11 @@
1
1
  export declare class AdwWindowTitle extends HTMLElement {
2
2
  private _titleEl;
3
3
  private _subtitleEl;
4
+ /** The headless title/subtitle pair + change detection (ADR 0004). */
5
+ private readonly _state;
4
6
  private _initialized;
5
7
  static get observedAttributes(): string[];
6
8
  connectedCallback(): void;
7
- attributeChangedCallback(): void;
9
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
8
10
  private _render;
9
11
  }
@@ -1,13 +1,68 @@
1
+ import { type AdwLengthUnit } from '@gjsify/adwaita-core';
1
2
  export declare class AdwWrapBox extends HTMLElement {
2
3
  private _initialized;
3
- static get observedAttributes(): string[];
4
- /** Spacing between children on the same line, in px (CSS column-gap). */
4
+ static get observedAttributes(): ("align" | "justify" | "justify-last-line" | "child-spacing" | "line-spacing" | "orientation" | "wrap-policy" | "child-spacing-unit" | "natural-line-length" | "pack-direction" | "wrap-reverse" | "line-spacing-unit" | "line-homogeneous" | "natural-line-length-unit")[];
5
+ /** Spacing between children on the same line, in `child-spacing-unit`. */
5
6
  get childSpacing(): number;
6
7
  set childSpacing(value: number);
7
- /** Spacing between lines, in px (CSS row-gap). */
8
+ /** The unit `child-spacing` is written in. Defaults to `px`, as in C. */
9
+ get childSpacingUnit(): AdwLengthUnit;
10
+ set childSpacingUnit(value: AdwLengthUnit);
11
+ /** Spacing between lines, in `line-spacing-unit`. */
8
12
  get lineSpacing(): number;
9
13
  set lineSpacing(value: number);
14
+ /** The unit `line-spacing` is written in. Defaults to `px`, as in C. */
15
+ get lineSpacingUnit(): AdwLengthUnit;
16
+ set lineSpacingUnit(value: AdwLengthUnit);
17
+ /** Where the children sit ALONG the line (main axis): 0 start, 0.5 middle, 1 end. */
18
+ get align(): number;
19
+ set align(value: number);
20
+ /** Whether and how each line is stretched to fill the widget. */
21
+ get justify(): 'none' | 'fill' | 'spread';
22
+ set justify(value: 'none' | 'fill' | 'spread');
23
+ /** Whether the FINAL line is justified too. Default false, as in C. */
24
+ get justifyLastLine(): boolean;
25
+ set justifyLastLine(value: boolean);
26
+ /** Whether an overflowing line squeezes its children or lets them spill. */
27
+ get wrapPolicy(): 'minimum' | 'natural';
28
+ set wrapPolicy(value: 'minimum' | 'natural');
29
+ /** The direction children are packed in each line. */
30
+ get packDirection(): 'start-to-end' | 'end-to-start';
31
+ set packDirection(value: 'start-to-end' | 'end-to-start');
32
+ /** Whether lines wrap upwards (horizontal) / towards the start (vertical). */
33
+ get wrapReverse(): boolean;
34
+ set wrapReverse(value: boolean);
35
+ /** Whether every line takes the same amount of space. */
36
+ get lineHomogeneous(): boolean;
37
+ set lineHomogeneous(value: boolean);
38
+ /** The natural line length in `natural-line-length-unit`, or `-1` when unset. */
39
+ get naturalLineLength(): number;
40
+ set naturalLineLength(value: number);
41
+ /** The unit `natural-line-length` is written in. Defaults to `px`, as in C. */
42
+ get naturalLineLengthUnit(): AdwLengthUnit;
43
+ set naturalLineLengthUnit(value: AdwLengthUnit);
44
+ /** The axis children are packed along. */
45
+ get orientation(): 'horizontal' | 'vertical';
46
+ set orientation(value: 'horizontal' | 'vertical');
47
+ /** The element children, which are what the layout actually lays out. */
48
+ private get _children();
49
+ /**
50
+ * `adw_wrap_box_insert_child_after` (adw-wrap-box.c:1283-1300).
51
+ *
52
+ * A NULL/absent `sibling` inserts at the FIRST position, not the last —
53
+ * `gtk_widget_insert_after`'s documented rule, pinned by
54
+ * `WRAP_BOX_CHILD_ORDER_VECTORS`. Returns whether the insert happened; a
55
+ * refusal is where C would have hit a `g_return_if_fail`.
56
+ */
57
+ insertChildAfter(child: Element, sibling?: Element | null): boolean;
58
+ /** `adw_wrap_box_reorder_child_after` (adw-wrap-box.c:1315-1332). Same NULL rule. */
59
+ reorderChildAfter(child: Element, sibling?: Element | null): boolean;
60
+ /** `adw_wrap_box_remove_all` (adw-wrap-box.c:1406-1414). */
61
+ removeAll(): void;
62
+ private _applyOrder;
10
63
  connectedCallback(): void;
11
64
  attributeChangedCallback(name: string, old: string | null, value: string | null): void;
65
+ /** One attribute's value as the widget stores it — the notify comparison key. */
66
+ private _normalized;
12
67
  private _sync;
13
68
  }
@@ -0,0 +1,44 @@
1
+ import type { AdwViewSwitcherPageInit, ViewSwitcherScheduler } from '@gjsify/adwaita-core';
2
+ import { type AdwIcon } from './adw-icon.js';
3
+ /**
4
+ * The browser's timer behind the core's scheduler seam.
5
+ *
6
+ * One shared instance rather than one per element: it holds no state, and the
7
+ * seam exists so the CORE stays free of a global timer, not so each element
8
+ * invents its own.
9
+ */
10
+ export declare const domViewSwitcherScheduler: ViewSwitcherScheduler;
11
+ /**
12
+ * Build a switcher button's icon node, carrying its own position class.
13
+ *
14
+ * The core resolves NULL/empty to `image-missing` (which the stylesheet carries
15
+ * a real glyph for); the `-symbolic` strip and the CSS-token guard are
16
+ * `normalizeIconName`'s, applied by `<adw-icon>` — that strip is this package's
17
+ * own mask-class convention and has no counterpart in C, where the name reaches
18
+ * `GtkImage` untouched.
19
+ */
20
+ export declare function createSwitcherIcon(iconName: string, extra: string): AdwIcon;
21
+ /** Repaint an existing switcher icon from a page's declared name. */
22
+ export declare function applySwitcherIcon(icon: AdwIcon, iconName: string): void;
23
+ /**
24
+ * Read a declared page element into the core's page init.
25
+ *
26
+ * `getAttribute` returns `null` for an absent attribute, which is EXACTLY C's
27
+ * NULL — so the values are passed through unchanged rather than defaulted to
28
+ * `''`. That `?? ''` is what made the button-visibility rule unimplementable in
29
+ * the old code: once an absent title has become the empty string, "the page has
30
+ * no title" is no longer expressible.
31
+ */
32
+ export declare function readSwitcherPage(element: Element): AdwViewSwitcherPageInit;
33
+ /**
34
+ * Paint `AdwIndicatorBin`'s badge/dot onto a span: the badge text when there is
35
+ * one, a bare dot when only `needs-attention` is set, nothing otherwise
36
+ * (adw-indicator-bin.c:58-68 + the `.needs-attention` style class).
37
+ */
38
+ export declare function applyIndicator(indicator: HTMLElement, badgeLabel: string, needsAttention: boolean): void;
39
+ /**
40
+ * Mirror the derived screen-reader description onto the element, REMOVING the
41
+ * attribute when there is none — `update_description_cb` resets the accessible
42
+ * property rather than setting it to `""` (adw-view-switcher-button.c:104-113).
43
+ */
44
+ export declare function applyDescription(element: HTMLElement, description: string): void;
@@ -0,0 +1 @@
1
+ export declare const AdwEntryRowsTest: () => Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import '@gjsify/adwaita-fonts';
2
+ export { addBreakpoints, bindBreakpointSetter } from './breakpoints.js';
2
3
  export { AdwAvatar } from './elements/adw-avatar.js';
3
4
  export { AdwBanner } from './elements/adw-banner.js';
4
5
  export { AdwCard } from './elements/adw-card.js';
@@ -12,6 +13,12 @@ export { AdwHeaderBar } from './elements/adw-header-bar.js';
12
13
  export { AdwWindowTitle } from './elements/adw-window-title.js';
13
14
  export { AdwButton } from './elements/adw-button.js';
14
15
  export { AdwButtonContent } from './elements/adw-button-content.js';
16
+ export { AdwIcon, createAdwIcon } from './elements/adw-icon.js';
17
+ export { AdwSwitch } from './elements/adw-switch.js';
18
+ export { AdwCheckbox, AdwRadio } from './elements/adw-checks.js';
19
+ export { AdwProgressBar } from './elements/adw-progress-bar.js';
20
+ export { AdwPopover } from './elements/adw-popover.js';
21
+ export type { AdwPopoverAlign, AdwPopoverPosition, AdwPopoverRole } from './elements/adw-popover.js';
15
22
  export { AdwSplitButton } from './elements/adw-split-button.js';
16
23
  export { AdwToggle, AdwToggleGroup } from './elements/adw-toggle-group.js';
17
24
  export { AdwEntry } from './elements/adw-entry.js';
@@ -0,0 +1 @@
1
+ export declare const AdwNavigationViewTest: () => Promise<void>;
@@ -0,0 +1,20 @@
1
+ import { type PreferencesSearchPage, type PreferencesSearchResult, type SearchPreferencesOptions } from '@gjsify/adwaita-core';
2
+ /**
3
+ * Describe every `<adw-preferences-page>` under `root` as the tree
4
+ * `searchPreferences` indexes.
5
+ *
6
+ * Page identity is read off the element itself — which is why the dialog keeps
7
+ * the page elements in its subtree instead of hoisting their children out. A
8
+ * flattened dialog has no page titles, and `create_search_row_subtitle` needs
9
+ * them the moment a second page exists.
10
+ */
11
+ export declare function describePreferencesPages(root: ParentNode): PreferencesSearchPage<Element>[];
12
+ /**
13
+ * Search the preferences pages under `root`, returning the result rows a
14
+ * `search_results` list box would be bound to.
15
+ *
16
+ * Each result carries the `<adw-preferences-page>` and the row element, so a
17
+ * caller can reproduce `search_result_activated_cb`: reveal the page, focus
18
+ * the row.
19
+ */
20
+ export declare function searchPreferencesDom(root: ParentNode, query: string, options?: SearchPreferencesOptions): PreferencesSearchResult<Element>[];
@@ -0,0 +1 @@
1
+ export declare const AdwPreferencesTest: () => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const AdwSplitButtonTest: () => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const AdwSplitViewsTest: () => Promise<void>;