@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,34 +1,32 @@
1
- /** A dropdown option — `value` is the stable id, `label` the shown text. */
2
- export interface AdwDropDownOption {
3
- value: string;
4
- label: string;
5
- }
6
- type RawOption = string | {
7
- value?: unknown;
8
- label?: unknown;
9
- };
1
+ import './adw-popover.js';
2
+ import type { AdwComboOption, AdwComboOptionInput } from '@gjsify/adwaita-core';
3
+ /**
4
+ * A dropdown option — `value` is the stable id, `label` the shown text.
5
+ *
6
+ * An alias of core's {@link AdwComboOption}: the drop-down and the combo row are
7
+ * the same selection model behind two chromes, and they had two names for one
8
+ * descriptor. Kept exported so the published type name does not break.
9
+ */
10
+ export type AdwDropDownOption = AdwComboOption;
10
11
  export declare class AdwDropDown extends HTMLElement {
11
12
  private _buttonEl;
12
13
  private _labelEl;
13
14
  private _popoverEl;
14
15
  private _listEl;
15
16
  private _searchEl;
16
- private _options;
17
17
  private _itemButtons;
18
- private _selected;
19
- private _active;
18
+ /** The headless options list + selectedIndex↔selectedValue machine (ADR 0004). */
19
+ private readonly _state;
20
20
  private _initialized;
21
21
  private _typeAheadBuffer;
22
22
  private _typeAheadTimer;
23
- private _onDocumentPointerDown;
24
- private _onDocumentKeyDown;
25
23
  static get observedAttributes(): string[];
26
24
  /** The options list. Setting it rebuilds the popover and clamps the selection. */
27
25
  get options(): AdwDropDownOption[];
28
- set options(value: ReadonlyArray<RawOption>);
26
+ set options(value: ReadonlyArray<AdwComboOptionInput>);
29
27
  /** Alias of `options` (Gtk.DropDown's model is often called "items"). */
30
28
  get items(): AdwDropDownOption[];
31
- set items(value: ReadonlyArray<RawOption>);
29
+ set items(value: ReadonlyArray<AdwComboOptionInput>);
32
30
  /** The selected index. Out-of-range values are ignored (Gtk.DropDown:selected). */
33
31
  get selected(): number;
34
32
  set selected(value: number);
@@ -43,13 +41,13 @@ export declare class AdwDropDown extends HTMLElement {
43
41
  /** Whether the popover is currently open. */
44
42
  get active(): boolean;
45
43
  connectedCallback(): void;
46
- disconnectedCallback(): void;
47
44
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
48
45
  private _parseOptionsAttr;
49
46
  private _selectIndex;
50
- private _setActive;
47
+ private _onPopoverToggled;
51
48
  private _onButtonKeyDown;
52
- private _onPopoverKeyDown;
49
+ /** Printable keys inside an OPEN popover, when there is no search entry to type into. */
50
+ private _onPopoverTypeAhead;
53
51
  /** Type-ahead: accumulate keys, focus/select the next matching option. */
54
52
  private _typeAhead;
55
53
  /** Filter the visible items by a search query (case-insensitive substring). */
@@ -60,4 +58,3 @@ export declare class AdwDropDown extends HTMLElement {
60
58
  private _updateSelectedStates;
61
59
  private _renderPopover;
62
60
  }
63
- export {};
@@ -1,10 +1,100 @@
1
+ import { EntryRowState, type EntryRowRenderState } from '@gjsify/adwaita-core';
2
+ import { type AdwIcon } from './adw-icon.js';
1
3
  export declare class AdwEntryRow extends HTMLElement {
2
- private _input;
3
- private _titleEl;
4
- private _initialized;
4
+ /** The headless `update_empty` derivation + apply latch (ADR 0004). */
5
+ protected readonly _state: EntryRowState;
6
+ protected _input: HTMLInputElement;
7
+ /** The large placeholder title (`empty_title` in adw-entry-row.ui). */
8
+ protected _emptyTitle: HTMLSpanElement;
9
+ /** The small label above the value (`title` in adw-entry-row.ui). */
10
+ protected _title: HTMLSpanElement;
11
+ /** The `editable-area` gizmo: both titles plus the input. */
12
+ protected _area: HTMLDivElement;
13
+ protected _editIcon: AdwIcon;
14
+ protected _indicator: HTMLSpanElement;
15
+ protected _applyButton: HTMLButtonElement;
16
+ protected _prefixes: HTMLDivElement;
17
+ protected _suffixes: HTMLDivElement;
18
+ protected _initialized: boolean;
19
+ /** Light-DOM children captured at build time, adopted after `_onConnected`. */
20
+ private _authored;
21
+ private _lastText;
22
+ private _lastLength;
5
23
  static get observedAttributes(): string[];
24
+ /**
25
+ * Class-name prefix for this row's parts. `<adw-password-entry-row>`
26
+ * overrides it so `_password_entry_row.scss` keeps matching its own parts —
27
+ * the two SCSS partials are near-identical but each scopes to its own tag.
28
+ */
29
+ protected get _classPrefix(): string;
30
+ /** The editable text. */
6
31
  get text(): string;
7
32
  set text(value: string);
33
+ /** `Adw.EntryRow:text-length` — the number of CHARACTERS, not UTF-16 units. */
34
+ get textLength(): number;
35
+ /** `Adw.EntryRow:max-length` — maximum number of characters, `0` = unlimited. */
36
+ get maxLength(): number;
37
+ set maxLength(value: number);
38
+ /** Whether the entry accepts edits (`GtkEditable:editable`). */
39
+ get editable(): boolean;
40
+ set editable(value: boolean);
41
+ /** `Adw.EntryRow:show-apply-button` — typing reveals an apply button. */
42
+ get showApplyButton(): boolean;
43
+ set showApplyButton(value: boolean);
44
+ /** `Adw.EntryRow:activates-default` — Enter may submit the surrounding form. */
45
+ get activatesDefault(): boolean;
46
+ set activatesDefault(value: boolean);
47
+ /** Whether the embedded entry currently has focus. */
48
+ get editing(): boolean;
8
49
  connectedCallback(): void;
9
50
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
51
+ /**
52
+ * Add a widget after the editable area — `adw_entry_row_add_suffix`
53
+ * (adw-entry-row.c:885-899), which APPENDS into a box, so several suffixes
54
+ * coexist and the password row's own peek toggle survives a consumer's.
55
+ */
56
+ addSuffix(node: Node): void;
57
+ /**
58
+ * Add a widget before the editable area — `adw_entry_row_add_prefix`
59
+ * (C:864-880). PREPENDS, like the `gtk_box_prepend` it mirrors, so several
60
+ * prefixes stack in reverse call order exactly as they do in GTK.
61
+ */
62
+ addPrefix(node: Node): void;
63
+ /**
64
+ * Drive the trailing indicator — `adw_entry_row_set_show_indicator`
65
+ * (adw-entry-row-private.h, C:1281-1296). Private-to-the-library upstream,
66
+ * public here because `<adw-password-entry-row>` is a separate custom element
67
+ * rather than a C subclass with access to the private header.
68
+ */
69
+ setShowIndicator(show: boolean): void;
70
+ /** `adw_entry_row_set_indicator_icon_name` (C:1263-1273). */
71
+ setIndicatorIconName(iconName: string): void;
72
+ /** `adw_entry_row_set_indicator_tooltip` (C:1275-1279). */
73
+ setIndicatorTooltip(tooltip: string): void;
74
+ /** Apply the pending edit — the apply button click (C:229-241). */
75
+ apply(): void;
76
+ /** Focus the entry without selecting — `adw_entry_row_grab_focus_without_selecting` (C:1379-1389). */
77
+ grabFocusWithoutSelecting(): boolean;
78
+ /** Subclass hook: runs after the DOM exists and the state is seeded, before the first render. */
79
+ protected _onConnected(): void;
80
+ private _build;
81
+ /**
82
+ * Re-home the children the author wrote. libadwaita's buildable maps an
83
+ * untyped `<child>` to a suffix (C:796-812); `slot="prefix"` is the web
84
+ * spelling of its `type="prefix"`.
85
+ */
86
+ private _adoptAuthored;
87
+ /**
88
+ * `pressed_cb` (C:201-227): a click landing on the row, the editable area,
89
+ * the indicator or either affordance box grabs focus; anything else (a suffix
90
+ * control, the apply button) is left alone. The pencil is `can-target=False`
91
+ * in the .ui, so a click on it picks the editable area — hence it focuses too.
92
+ */
93
+ private _maybeFocus;
94
+ /** `text_activated_cb` (C:243-266) — exactly one of the two signals. */
95
+ private _activate;
96
+ private _renderTitle;
97
+ /** Paint one render snapshot. Overridden (via `super`) by the password row. */
98
+ protected _render(state: EntryRowRenderState): void;
99
+ private _onStateChanged;
10
100
  }
@@ -1,9 +1,9 @@
1
+ import './adw-switch.js';
1
2
  export declare class AdwExpanderRow extends HTMLElement {
2
3
  private _headerEl;
3
4
  private _titleEl;
4
5
  private _subtitleEl;
5
6
  private _enableSwitch;
6
- private _enableLabel;
7
7
  private _chevronEl;
8
8
  private _contentEl;
9
9
  private _prefixEl;
@@ -11,6 +11,12 @@ export declare class AdwExpanderRow extends HTMLElement {
11
11
  /** The headless expanded/collapsed disclosure state machine (ADR 0004). */
12
12
  private readonly _state;
13
13
  private _initialized;
14
+ /**
15
+ * Guards the enable switch's `notify::active` while WE are the ones writing
16
+ * it. Only a user toggle publishes `notify::enable-expansion`; a programmatic
17
+ * `enableExpansion = …` re-syncs the control silently, as it always has.
18
+ */
19
+ private _reflectingEnable;
14
20
  constructor();
15
21
  static get observedAttributes(): string[];
16
22
  get expanded(): boolean;
@@ -3,6 +3,13 @@ export declare class AdwHeaderBar extends HTMLElement {
3
3
  private _startEl;
4
4
  private _centerEl;
5
5
  private _endEl;
6
+ /**
7
+ * The generated title span, or `null` when a `slot="center"` title-widget
8
+ * took the centre. `Adw.HeaderBar` has the same either/or: setting
9
+ * `title-widget` replaces the derived `AdwWindowTitle` outright.
10
+ */
11
+ private _titleEl;
12
+ static get observedAttributes(): string[];
6
13
  /** The start (left) section container — append buttons/widgets here. */
7
14
  get startSection(): HTMLDivElement | null;
8
15
  /** The center (title) section — holds the `title` text or any `slot="center"`
@@ -11,4 +18,12 @@ export declare class AdwHeaderBar extends HTMLElement {
11
18
  /** The end (right) section container — append buttons/widgets here. */
12
19
  get endSection(): HTMLDivElement | null;
13
20
  connectedCallback(): void;
21
+ /**
22
+ * `title` used to be read ONCE, in `connectedCallback`, so every later write
23
+ * was a silent no-op — a header bar whose title tracked the open document
24
+ * kept whatever it was created with. `Adw.HeaderBar`'s derived title widget
25
+ * is bound to the property and re-renders on every change.
26
+ */
27
+ attributeChangedCallback(name: string): void;
28
+ private _renderTitle;
14
29
  }
@@ -0,0 +1,25 @@
1
+ export declare class AdwIcon extends HTMLElement {
2
+ static get observedAttributes(): string[];
3
+ /** The declared symbolic name, `-symbolic` suffix optional. */
4
+ get iconName(): string;
5
+ set iconName(value: string | null);
6
+ /**
7
+ * The name that actually reached the mask class — `''` when the icon-name is
8
+ * absent, empty, or not usable as one CSS token. Consumers that need to know
9
+ * whether an icon is being drawn ask this, not the raw attribute.
10
+ */
11
+ get resolvedIconName(): string;
12
+ /** The rendered edge length in px, or `null` when the stylesheet decides. */
13
+ get size(): number | null;
14
+ set size(value: number | null);
15
+ connectedCallback(): void;
16
+ attributeChangedCallback(): void;
17
+ private _render;
18
+ }
19
+ /**
20
+ * Build one icon node: the three lines every caller would otherwise write.
21
+ *
22
+ * `extraClasses` are the caller's own positioning/context classes, added
23
+ * alongside the managed `.adw-icon` + mask class rather than replacing them.
24
+ */
25
+ export declare function createAdwIcon(iconName: string | null, ...extraClasses: string[]): AdwIcon;
@@ -1,30 +1,92 @@
1
- /** The three display modes, mirroring AdwInlineViewSwitcherDisplayMode. */
2
- declare const DISPLAY_MODES: readonly ["labels", "icons", "both"];
3
- type DisplayMode = (typeof DISPLAY_MODES)[number];
1
+ import type { ViewSwitcherScheduler } from '@gjsify/adwaita-core';
2
+ import type { AdwInlineViewSwitcherDisplayMode, AdwViewSwitcherPage } from '@gjsify/adwaita-core';
4
3
  /** A single page. Children of <adw-inline-view-switcher>; consumed at connect time. */
5
4
  export declare class AdwViewStackPage extends HTMLElement {
6
5
  static get observedAttributes(): string[];
7
6
  }
8
7
  export declare class AdwInlineViewSwitcher extends HTMLElement {
8
+ /**
9
+ * The dwell timer, injectable.
10
+ *
11
+ * It used to be `new ViewSwitcherState({ scheduler: domViewSwitcherScheduler })`
12
+ * inline, which left NOWHERE to hand a clock in — so
13
+ * `VIEW_SWITCHER_DRAG_VECTORS` was driven by the core suite alone, and the
14
+ * conformance header claimed all three suites drove it. `scheduler` is a
15
+ * property so a test can replace it before the element connects; the DOM one
16
+ * is the default, exactly as before.
17
+ */
18
+ scheduler: ViewSwitcherScheduler;
19
+ private _stateInstance;
20
+ /** Built on first access, so a `scheduler` set before connect is the one used. */
21
+ private get _state();
9
22
  private _groupEl;
10
23
  private _pagesEl;
24
+ private _panels;
11
25
  private _toggles;
12
- private _pages;
13
- private _active;
14
26
  private _displayMode;
15
27
  private _initialized;
28
+ /** The page ELEMENTS, kept because this element detaches them from the tree. */
29
+ private _declared;
30
+ private _pageObserver;
16
31
  static get observedAttributes(): string[];
17
- /** Zero-based index of the visible page. */
32
+ constructor();
33
+ /** Zero-based index of the visible PAGE, `-1` when nothing is selected. */
18
34
  get active(): number;
19
35
  set active(value: number);
36
+ /**
37
+ * Index of the ACTIVE TOGGLE, `-1` when the visible page has none because it
38
+ * is hidden — the port-safe `GTK_INVALID_LIST_POSITION`
39
+ * (adw-inline-view-switcher.c:441-446).
40
+ */
41
+ get activeToggle(): number;
20
42
  /** What the toggles display: 'labels', 'icons' or 'both'. */
21
- get displayMode(): DisplayMode;
22
- set displayMode(value: DisplayMode);
43
+ get displayMode(): AdwInlineViewSwitcherDisplayMode;
44
+ set displayMode(value: AdwInlineViewSwitcherDisplayMode);
45
+ /** Name of the visible page, `''` when nothing is selected. */
46
+ get visibleChildName(): string;
47
+ set visibleChildName(name: string | null | undefined);
48
+ /** The resolved page records. */
49
+ get pages(): readonly AdwViewSwitcherPage[];
50
+ /**
51
+ * Show or hide a page. Returns whether the SELECTION moved. Rebuilds the
52
+ * toggle row, because a hidden page has no toggle at all — C reacts to a
53
+ * page's `notify::visible` with `recreate_toggles`
54
+ * (adw-inline-view-switcher.c:425, :471-477).
55
+ */
56
+ setPageVisible(name: string, visible: boolean): boolean;
23
57
  connectedCallback(): void;
58
+ disconnectedCallback(): void;
59
+ /**
60
+ * Re-read every declared page and push it into the state.
61
+ *
62
+ * Driven by {@link _watchPages}, which is what makes a runtime
63
+ * `badge-number` or `icon-name` change reach the toggle — C rebinds on every
64
+ * page `notify` (adw-view-switcher.c:184-193) and this element did not.
65
+ */
66
+ refreshPages(): void;
67
+ /**
68
+ * Watch the declared pages for attribute changes — the DOM's `notify::` on
69
+ * `AdwViewStackPage`, which C binds per page (adw-view-switcher.c:184-193).
70
+ *
71
+ * A `MutationObserver` rather than an `attributeChangedCallback`: this
72
+ * element consumes the page elements at connect and `replaceChildren`s them
73
+ * out of the tree, so a detached page cannot find its owner. It delivers on
74
+ * a MICROTASK where GTK's notify is synchronous — invisible to a user, and
75
+ * nothing here reads the toggle back inside the setter.
76
+ */
77
+ private _watchPages;
24
78
  attributeChangedCallback(name: string): void;
25
- private _readActiveAttr;
26
79
  private _readDisplayModeAttr;
27
- private _selectIndex;
80
+ /**
81
+ * Rebuild the toggle row from the derived models. One node per VISIBLE page,
82
+ * in compacted order — the structural half of `recreate_toggles`. Selection
83
+ * alone never lands here: `selection_changed_cb` only sets the active toggle
84
+ * (adw-inline-view-switcher.c:434-453), and rebuilding mid-drag would drop
85
+ * the dwell the drag has already armed.
86
+ */
87
+ private _rebuildToggles;
88
+ private _onStateChange;
28
89
  private _render;
90
+ private _applyStyleClasses;
91
+ private _reflectActive;
29
92
  }
30
- export {};
@@ -1,3 +1,5 @@
1
+ import type { SplitButtonDirection } from '@gjsify/adwaita-core';
2
+ import './adw-popover.js';
1
3
  /** A menu entry. `id` defaults to `label` on activation; `icon` is optional. */
2
4
  export interface AdwMenuItem {
3
5
  id?: string;
@@ -9,11 +11,8 @@ export declare class AdwMenuButton extends HTMLElement {
9
11
  private _popoverEl;
10
12
  private _items;
11
13
  private _menuTitle;
12
- private _active;
13
14
  private _initialized;
14
15
  private _itemButtons;
15
- private _onDocumentPointerDown;
16
- private _onDocumentKeyDown;
17
16
  static get observedAttributes(): string[];
18
17
  /** Whether the popover menu is currently open. */
19
18
  get active(): boolean;
@@ -23,12 +22,13 @@ export declare class AdwMenuButton extends HTMLElement {
23
22
  /** The optional popover heading. */
24
23
  get menuTitle(): string;
25
24
  set menuTitle(value: string);
25
+ /** Where the popover opens, and (via core) which way `none` folds. */
26
+ get direction(): SplitButtonDirection;
27
+ set direction(value: SplitButtonDirection);
26
28
  connectedCallback(): void;
27
- disconnectedCallback(): void;
28
29
  attributeChangedCallback(name: string): void;
29
30
  private _parseMenuAttr;
30
- private _setActive;
31
- private _onMenuKeyDown;
31
+ private _onPopoverToggled;
32
32
  private _render;
33
33
  private _renderMenu;
34
34
  }
@@ -1,15 +1,63 @@
1
+ import { type AdwPackType, type NavigationActionResult } from '@gjsify/adwaita-core';
2
+ /** Detail of the `navigation-push` / `navigation-pop` delegation event. */
3
+ export interface NavigationDelegateDetail {
4
+ /** The tag a `push` names; absent for a `pop`. */
5
+ tag?: string;
6
+ /** Set by an ancestor that handled it — the `return TRUE` of the C's routing. */
7
+ handled: boolean;
8
+ }
1
9
  export declare class AdwNavigationSplitView extends HTMLElement {
2
10
  private _sidebarEl;
3
11
  private _contentEl;
4
12
  private _initialized;
13
+ private _disposeBreakpoint;
14
+ /** The ordering table, the tag guard and the action routing (ADR 0004). */
15
+ private _state;
16
+ /** Re-entrancy guard for the `show-content` reflection. */
17
+ private _reflecting;
5
18
  static get observedAttributes(): string[];
6
19
  get collapsed(): boolean;
7
20
  set collapsed(v: boolean);
8
21
  /** When collapsed, whether the content pane (true) or sidebar (false) shows. */
9
22
  get showContent(): boolean;
10
23
  set showContent(v: boolean);
24
+ /** Which side the sidebar is packed on — `start` (default) or `end`. */
25
+ get sidebarPosition(): AdwPackType;
26
+ set sidebarPosition(value: AdwPackType);
27
+ /** The sidebar page's tag of record, or `null`. */
28
+ get sidebarTag(): string | null;
29
+ /** The content page's tag of record, or `null`. */
30
+ get contentTag(): string | null;
31
+ /**
32
+ * `navigation.push` with `tag` — `navigation_push_cb` (:644-685).
33
+ *
34
+ * An unmatched tag DELEGATES to the parent before it may become a critical,
35
+ * which is how nested split views forward a push outwards; on this port that
36
+ * is a bubbling `navigation-push` event whose `detail.handled` an ancestor
37
+ * sets. Returns what the routing decided.
38
+ */
39
+ push(tag: string): NavigationActionResult;
40
+ /** `navigation.pop` — `navigation_pop_cb` (:687-702). */
41
+ pop(): NavigationActionResult;
11
42
  connectedCallback(): void;
43
+ /** `Adw.NavigationPage:tag` off the slotted pane, or `null` when untagged. */
44
+ private _tagOf;
45
+ /**
46
+ * Mirror the state's `showContent` onto the attribute, so the DOM keeps
47
+ * telling the truth after a `navigation.push` moved it.
48
+ *
49
+ * Guarded the way the overlay view's reflection is: writing the attribute
50
+ * re-enters `attributeChangedCallback`, which without the flag is a loop.
51
+ */
52
+ private _reflectShowContent;
53
+ disconnectedCallback(): void;
12
54
  attributeChangedCallback(name: string): void;
13
55
  private _syncWidth;
56
+ /** A pixel attribute, falling back to the widget's own default. */
57
+ private _widthAttr;
58
+ /** The reading direction `start` / `end` resolve against (`get_start_or_end`, :220-227). */
59
+ private get _direction();
14
60
  private _syncClasses;
61
+ /** (Re)bind the `breakpoint` condition to `collapsed`. */
62
+ private _syncBreakpoint;
15
63
  }
@@ -1,65 +1,108 @@
1
1
  /** A single navigation page. Children of <adw-navigation-view>. */
2
2
  export declare class AdwNavigationPage extends HTMLElement {
3
+ /** Set while the owning view writes an attribute back, so the sync cannot recurse. */
4
+ private _syncing;
3
5
  static get observedAttributes(): string[];
4
6
  get title(): string;
5
7
  set title(value: string);
6
8
  get tag(): string | null;
7
9
  set tag(value: string | null);
8
- /** Whether the page can be popped (and thus shows a back button). */
10
+ /** Whether the page can be popped by a shortcut or the back button. */
9
11
  get canPop(): boolean;
10
12
  set canPop(value: boolean);
13
+ attributeChangedCallback(name: string, previous: string | null): void;
14
+ /** Put an attribute back the way it was, without re-entering the sync. */
15
+ revertAttribute(name: string, value: string | null): void;
11
16
  }
12
17
  export declare class AdwNavigationView extends HTMLElement {
13
18
  private _pagesEl;
14
- private _pages;
15
- private _stack;
16
- private _dynamic;
17
- private _backButtons;
19
+ private readonly _backButtons;
18
20
  private _initialized;
21
+ private readonly _diagnose;
22
+ private readonly _state;
19
23
  static get observedAttributes(): string[];
20
24
  /** Whether push/pop transitions are animated. */
21
25
  get animateTransitions(): boolean;
22
26
  set animateTransitions(value: boolean);
27
+ /** Whether pressing Escape pops the visible page (Adw.NavigationView:pop-on-escape). */
28
+ get popOnEscape(): boolean;
29
+ set popOnEscape(value: boolean);
23
30
  /** The currently-visible page (top of the stack), or null when empty. */
24
31
  get visiblePage(): AdwNavigationPage | null;
25
32
  /** The tag of the visible page, or null. */
26
33
  get visiblePageTag(): string | null;
34
+ /** The number of pages on the navigation stack. */
35
+ get depth(): number;
36
+ /** The navigation stack, bottom-first (Adw.NavigationView:navigation-stack). */
37
+ get navigationStack(): readonly AdwNavigationPage[];
38
+ /** Every page this view knows — static and dynamically pushed. */
39
+ get pages(): readonly AdwNavigationPage[];
40
+ /** Whether the automatic back button is shown (AdwBackButton's visibility rule). */
41
+ get canGoBack(): boolean;
42
+ /** The back button's tooltip — the previous page's title, or null when there is no button. */
43
+ get backButtonTooltip(): string | null;
27
44
  connectedCallback(): void;
28
- attributeChangedCallback(): void;
45
+ attributeChangedCallback(name: string): void;
46
+ /**
47
+ * Push a page property change into the core. Called by
48
+ * {@link AdwNavigationPage.attributeChangedCallback}; a rename the core rejects
49
+ * (the tag is taken) is rolled back, because the attribute must not disagree
50
+ * with the tag index `push-by-tag` resolves against.
51
+ */
52
+ syncPageProperty(page: AdwNavigationPage, name: string, previous: string | null): void;
29
53
  /**
30
54
  * Add a static page without pushing it (mirrors AdwNavigationView.add). The
31
55
  * view keeps a reference; the page becomes reachable via push-by-tag. Named
32
56
  * `addPage` rather than `add` to avoid clashing with any DOM method.
33
57
  */
34
- addPage(page: AdwNavigationPage): void;
58
+ addPage(page: AdwNavigationPage): boolean;
35
59
  /**
36
- * Remove a static page (mirrors AdwNavigationView.remove). Named `removePage`
37
- * to avoid overriding HTMLElement.remove() (which takes no arguments).
60
+ * Remove a page (mirrors AdwNavigationView.remove). A page that is on the
61
+ * stack is removed once it is POPPED, not now. Named `removePage` to avoid
62
+ * overriding HTMLElement.remove() (which takes no arguments).
38
63
  */
39
- removePage(page: AdwNavigationPage): void;
64
+ removePage(page: AdwNavigationPage): boolean;
40
65
  /**
41
66
  * Push a page onto the navigation stack (mirrors AdwNavigationView.push).
42
67
  * Accepts a page element or, when given a string, the tag of a known page
43
- * (push-by-tag, mirrors AdwNavigationView.push_by_tag). A page that is not
44
- * already known is added dynamically and destroyed when it is popped.
68
+ * (push-by-tag). A page that is not already known is added dynamically and
69
+ * destroyed when it is popped.
45
70
  */
46
- push(pageOrTag: AdwNavigationPage | string): void;
71
+ push(pageOrTag: AdwNavigationPage | string): boolean;
72
+ /** Push the page carrying `tag` (mirrors AdwNavigationView.push_by_tag). */
73
+ pushByTag(tag: string): boolean;
47
74
  /**
48
75
  * Pop the visible page off the stack (mirrors AdwNavigationView.pop).
49
- * Returns true when a page was popped. A dynamically-pushed page is removed
50
- * from the DOM. The root page cannot be popped.
76
+ * Returns true when a page was popped. The root page cannot be popped.
77
+ * `can-pop` does NOT gate this — it gates the shortcuts and the back button.
51
78
  */
52
79
  pop(): boolean;
53
- /** Pop every page down to (and including pushing) the given tag's page. */
80
+ /** Pop until `page` is visible, in ONE transition (mirrors AdwNavigationView.pop_to_page). */
81
+ popToPage(page: AdwNavigationPage): boolean;
82
+ /** Pop until the page carrying `tag` is visible (mirrors AdwNavigationView.pop_to_tag). */
54
83
  popToTag(tag: string): boolean;
55
84
  /**
56
- * Replace the whole navigation stack with the given pages (mirrors
57
- * AdwNavigationView.replace). The last page becomes visible.
85
+ * Replace the whole navigation stack (mirrors AdwNavigationView.replace). The
86
+ * last page becomes visible; the transition is never animated.
87
+ *
88
+ * String entries are resolved BEFORE anything is mutated — the C does the same
89
+ * in replace_with_tags:3136-3147, and resolving late is what used to lose a
90
+ * dynamically-pushed page and blank the view.
58
91
  */
59
- replace(pages: Array<AdwNavigationPage | string>): void;
60
- private _resolvePage;
92
+ replace(pages: ReadonlyArray<AdwNavigationPage | string | null>): void;
93
+ /** Replace the stack with the pages carrying `tags` (mirrors AdwNavigationView.replace_with_tags). */
94
+ replaceWithTags(tags: readonly string[]): void;
95
+ /** The page with this tag, or null (mirrors AdwNavigationView.find_page). */
96
+ findPage(tag: string): AdwNavigationPage | null;
97
+ /** The page popping `page` would reveal (mirrors AdwNavigationView.get_previous_page). */
98
+ getPreviousPage(page: AdwNavigationPage): AdwNavigationPage | null;
99
+ private _onChange;
100
+ private _dispatch;
101
+ private readonly _onKeyDown;
61
102
  private _syncClasses;
62
103
  private _render;
104
+ private _attach;
105
+ private _detach;
63
106
  /** Inject (or remove) the automatic back button on the visible page. */
64
107
  private _syncBackButton;
65
108
  private _removeBackButton;