@gjsify/adwaita-web 0.36.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/adwaita-web.css +504 -34
  2. package/dist/adwaita-web.css.map +1 -1
  3. package/lib/types/accent.d.ts +28 -0
  4. package/lib/types/adw-accent.spec.d.ts +2 -0
  5. package/lib/types/adw-shortcut-label.spec.d.ts +2 -0
  6. package/lib/types/breakpoints.d.ts +10 -12
  7. package/lib/types/elements/adw-about-dialog.d.ts +19 -36
  8. package/lib/types/elements/adw-action-row.d.ts +9 -12
  9. package/lib/types/elements/adw-alert-dialog.d.ts +0 -12
  10. package/lib/types/elements/adw-avatar.d.ts +1 -0
  11. package/lib/types/elements/adw-bottom-sheet.d.ts +7 -12
  12. package/lib/types/elements/adw-button-content.d.ts +3 -4
  13. package/lib/types/elements/adw-button-row.d.ts +1 -1
  14. package/lib/types/elements/adw-carousel.d.ts +28 -49
  15. package/lib/types/elements/adw-checks.d.ts +2 -8
  16. package/lib/types/elements/adw-combo-row.d.ts +6 -6
  17. package/lib/types/elements/adw-data-grid.d.ts +5 -10
  18. package/lib/types/elements/adw-drop-down.d.ts +3 -11
  19. package/lib/types/elements/adw-entry-row.d.ts +20 -23
  20. package/lib/types/elements/adw-icon.d.ts +2 -4
  21. package/lib/types/elements/adw-inline-view-switcher.d.ts +18 -31
  22. package/lib/types/elements/adw-navigation-split-view.d.ts +7 -12
  23. package/lib/types/elements/adw-navigation-view.d.ts +2 -10
  24. package/lib/types/elements/adw-overlay-split-view.d.ts +28 -52
  25. package/lib/types/elements/adw-password-entry-row.d.ts +4 -5
  26. package/lib/types/elements/adw-popover.d.ts +2 -7
  27. package/lib/types/elements/adw-preferences-dialog.d.ts +21 -34
  28. package/lib/types/elements/adw-preferences-group.d.ts +12 -14
  29. package/lib/types/elements/adw-progress-bar.d.ts +3 -4
  30. package/lib/types/elements/adw-shortcut-label.d.ts +20 -0
  31. package/lib/types/elements/adw-sidebar.d.ts +5 -10
  32. package/lib/types/elements/adw-spinner.d.ts +3 -5
  33. package/lib/types/elements/adw-split-button.d.ts +6 -16
  34. package/lib/types/elements/adw-switch-row.d.ts +3 -3
  35. package/lib/types/elements/adw-tab-view.d.ts +16 -26
  36. package/lib/types/elements/adw-toast-overlay.d.ts +8 -13
  37. package/lib/types/elements/adw-view-stack.d.ts +7 -17
  38. package/lib/types/elements/adw-view-switcher-bar.d.ts +4 -8
  39. package/lib/types/elements/adw-view-switcher.d.ts +18 -38
  40. package/lib/types/elements/adw-wrap-box.d.ts +7 -17
  41. package/lib/types/elements/view-switcher-dom.d.ts +10 -13
  42. package/lib/types/index.d.ts +3 -0
  43. package/lib/types/source-view/hex.d.ts +7 -13
  44. package/lib/types/style-classes.spec.d.ts +11 -0
  45. package/lib/types/styles.generated.d.ts +1 -1
  46. package/package.json +18 -7
  47. package/scss/_about_dialog.scss +3 -2
  48. package/scss/_action_row.scss +33 -0
  49. package/scss/_avatar.scss +12 -0
  50. package/scss/_button.scss +44 -22
  51. package/scss/_card.scss +11 -8
  52. package/scss/_checks.scss +2 -4
  53. package/scss/_dialog.scss +3 -2
  54. package/scss/_headerbar.scss +23 -0
  55. package/scss/_popover.scss +8 -4
  56. package/scss/_preferences.scss +7 -7
  57. package/scss/_progress_bar.scss +9 -6
  58. package/scss/_reset.scss +1 -1
  59. package/scss/_shortcut_label.scss +80 -0
  60. package/scss/_sidebar.scss +57 -0
  61. package/scss/_status_page.scss +20 -0
  62. package/scss/_style_classes.scss +407 -0
  63. package/scss/_switch.scss +4 -3
  64. package/scss/_theme.scss +20 -2
  65. package/scss/_variables.scss +34 -1
  66. package/scss/adwaita-skin.scss +12 -0
  67. package/src/accent.ts +74 -0
  68. package/src/adw-about-dialog.spec.ts +34 -49
  69. package/src/adw-accent.spec.ts +105 -0
  70. package/src/adw-action-rows.spec.ts +25 -33
  71. package/src/adw-avatar.spec.ts +51 -20
  72. package/src/adw-banner.spec.ts +5 -8
  73. package/src/adw-button-content.spec.ts +9 -12
  74. package/src/adw-button-row.spec.ts +2 -4
  75. package/src/adw-carousel.spec.ts +40 -53
  76. package/src/adw-checks.spec.ts +36 -47
  77. package/src/adw-drop-down.spec.ts +25 -32
  78. package/src/adw-header-bar.spec.ts +5 -7
  79. package/src/adw-icon.spec.ts +23 -32
  80. package/src/adw-progress-bar.spec.ts +10 -12
  81. package/src/adw-row-state.spec.ts +9 -10
  82. package/src/adw-shortcut-label.spec.ts +112 -0
  83. package/src/adw-sidebar.spec.ts +17 -24
  84. package/src/adw-switch.spec.ts +11 -17
  85. package/src/adw-tab-view.spec.ts +7 -10
  86. package/src/adw-toast-overlay.spec.ts +7 -11
  87. package/src/adw-view-switcher-bar.spec.ts +10 -14
  88. package/src/adw-wrap-box.spec.ts +25 -36
  89. package/src/bottom-sheet.spec.ts +30 -36
  90. package/src/breakpoints.ts +15 -18
  91. package/src/chrome.spec.ts +13 -21
  92. package/src/elements/adw-about-dialog.ts +71 -114
  93. package/src/elements/adw-action-row.ts +22 -37
  94. package/src/elements/adw-alert-dialog.ts +25 -50
  95. package/src/elements/adw-avatar.ts +40 -15
  96. package/src/elements/adw-banner.ts +14 -18
  97. package/src/elements/adw-bottom-sheet.ts +31 -52
  98. package/src/elements/adw-button-content.ts +30 -37
  99. package/src/elements/adw-button-row.ts +14 -24
  100. package/src/elements/adw-carousel.ts +87 -148
  101. package/src/elements/adw-checks.ts +43 -56
  102. package/src/elements/adw-clamp.ts +8 -9
  103. package/src/elements/adw-combo-row.ts +17 -25
  104. package/src/elements/adw-data-grid.ts +26 -38
  105. package/src/elements/adw-dialog.ts +25 -56
  106. package/src/elements/adw-drop-down.ts +31 -51
  107. package/src/elements/adw-entry-row.ts +39 -46
  108. package/src/elements/adw-expander-row.ts +30 -53
  109. package/src/elements/adw-icon.ts +30 -53
  110. package/src/elements/adw-inline-view-switcher.ts +38 -67
  111. package/src/elements/adw-menu-button.ts +28 -58
  112. package/src/elements/adw-navigation-split-view.ts +35 -47
  113. package/src/elements/adw-navigation-view.ts +12 -28
  114. package/src/elements/adw-overlay-split-view.ts +100 -175
  115. package/src/elements/adw-password-entry-row.ts +18 -28
  116. package/src/elements/adw-popover.ts +28 -44
  117. package/src/elements/adw-preferences-dialog.ts +41 -66
  118. package/src/elements/adw-preferences-group.ts +33 -46
  119. package/src/elements/adw-progress-bar.ts +27 -47
  120. package/src/elements/adw-shortcut-label.ts +138 -0
  121. package/src/elements/adw-sidebar.ts +31 -39
  122. package/src/elements/adw-spin-row.ts +7 -14
  123. package/src/elements/adw-spinner.ts +31 -43
  124. package/src/elements/adw-split-button.ts +45 -75
  125. package/src/elements/adw-switch-row.ts +29 -46
  126. package/src/elements/adw-switch.ts +28 -47
  127. package/src/elements/adw-tab-view.ts +62 -103
  128. package/src/elements/adw-toast-overlay.ts +28 -35
  129. package/src/elements/adw-toggle-group.ts +9 -16
  130. package/src/elements/adw-view-stack.ts +32 -51
  131. package/src/elements/adw-view-switcher-bar.ts +26 -50
  132. package/src/elements/adw-view-switcher.ts +60 -110
  133. package/src/elements/adw-window-title.ts +4 -4
  134. package/src/elements/adw-wrap-box.ts +33 -59
  135. package/src/elements/view-switcher-dom.ts +15 -22
  136. package/src/entry-rows.spec.ts +18 -24
  137. package/src/index.ts +24 -15
  138. package/src/navigation-view.spec.ts +7 -10
  139. package/src/preferences-search.ts +11 -15
  140. package/src/preferences.spec.ts +13 -15
  141. package/src/source-view/adw-source-view.ts +6 -19
  142. package/src/source-view/hex.ts +7 -13
  143. package/src/split-button.spec.ts +32 -44
  144. package/src/split-views.spec.ts +83 -149
  145. package/src/style-classes.spec.ts +181 -0
  146. package/src/style-isolation.spec.ts +3 -6
  147. package/src/styles.generated.ts +1 -1
  148. package/src/tab-view.spec.ts +26 -35
  149. package/src/test.browser.mts +6 -0
  150. package/src/view-stack.spec.ts +23 -34
  151. package/src/view-switcher.spec.ts +56 -84
@@ -0,0 +1,28 @@
1
+ import { type AdwAccentColorName } from '@gjsify/adwaita-core';
2
+ /** The custom property carrying the accent fill. */
3
+ export declare const ACCENT_BG_PROPERTY = "--accent-bg-color";
4
+ /** The custom property carrying the standalone accent, for text on the window. */
5
+ export declare const ACCENT_PROPERTY = "--accent-color";
6
+ /** Where and how to apply the accent. */
7
+ export interface ApplyAccentOptions {
8
+ /** The element to set the properties on. Defaults to `document.documentElement`. */
9
+ readonly target?: HTMLElement;
10
+ /**
11
+ * Which standalone variant to use. Defaults to the target's RESOLVED scheme,
12
+ * because the standalone colour is the one thing about an accent that differs
13
+ * between light and dark — reading it beats assuming light.
14
+ */
15
+ readonly dark?: boolean;
16
+ }
17
+ /**
18
+ * Whether `element` is currently rendering dark.
19
+ *
20
+ * `.theme-dark` / `.theme-light` are the stylesheet's manual overrides and win
21
+ * over the media query, so an explicit class is checked first and
22
+ * `prefers-color-scheme` only decides when neither is present.
23
+ */
24
+ export declare function isAdwaitaDark(element: HTMLElement): boolean;
25
+ /** Set the accent custom properties for `name`. */
26
+ export declare function applyAdwaitaAccent(name: AdwAccentColorName, options?: ApplyAccentOptions): void;
27
+ /** Drop the properties, so the stylesheet's own values apply again. */
28
+ export declare function clearAdwaitaAccent(target?: HTMLElement): void;
@@ -0,0 +1,2 @@
1
+ import '@gjsify/adwaita-web';
2
+ export declare const AdwAccentTest: () => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import '@gjsify/adwaita-web';
2
+ export declare const AdwShortcutLabelTest: () => Promise<void>;
@@ -2,21 +2,19 @@ import { AdwBreakpoint } from '@gjsify/adwaita-core';
2
2
  /**
3
3
  * Drive `breakpoints` from `element`'s own box, and return a dispose function.
4
4
  *
5
- * `ResizeObserver` delivers an initial observation on `observe()`, so the
6
- * breakpoints settle on the correct state before first paint — no flash of the
7
- * wrong layout, and no separate seeding pass.
8
- *
9
- * The size read is the BORDER box in CSS pixels, the browser's counterpart to
10
- * the `sp`/DIP units an Adwaita condition is written in.
5
+ * `ResizeObserver` delivers an initial observation on `observe()`, so the breakpoints
6
+ * settle on the correct state before first paint — no flash of the wrong layout, no
7
+ * separate seeding pass. The size read is the BORDER box in CSS pixels, the browser's
8
+ * counterpart to the `sp`/DIP units an Adwaita condition is written in.
11
9
  */
12
10
  export declare function addBreakpoints(element: Element, breakpoints: readonly AdwBreakpoint[]): () => void;
13
11
  /**
14
- * Wire a `breakpoint="<condition>"` attribute to a boolean setter, the browser
15
- * equivalent of an `Adw.Breakpoint` with one `add_setter()` call.
12
+ * Wire a `breakpoint="<condition>"` attribute to a boolean setter, the browser equivalent
13
+ * of an `Adw.Breakpoint` with one `add_setter()` call. Returns a dispose function; call it
14
+ * before re-binding and on disconnect.
16
15
  *
17
- * Returns a dispose function; call it before re-binding and on disconnect.
18
- * A missing or unparsable condition binds nothing and returns a no-op, leaving
19
- * whatever the attribute already says untouched — an element must not silently
20
- * flip state because its condition had a typo.
16
+ * A missing or unparsable condition binds nothing and returns a no-op, leaving whatever
17
+ * the attribute already says untouched — an element must not silently flip state because
18
+ * its condition had a typo.
21
19
  */
22
20
  export declare function bindBreakpointSetter(element: Element, condition: string | null, setValue: (active: boolean) => void): () => void;
@@ -32,7 +32,6 @@ export declare class AdwAboutDialog extends HTMLElement {
32
32
  set license(value: string);
33
33
  get licenseUrl(): string;
34
34
  set licenseUrl(value: string);
35
- /** Whether the dialog is presented. */
36
35
  get open(): boolean;
37
36
  set open(value: boolean);
38
37
  get developers(): string[];
@@ -54,62 +53,46 @@ export declare class AdwAboutDialog extends HTMLElement {
54
53
  /** The credit groups the Credits page shows, straight from `update_credits`. */
55
54
  private _creditsSections;
56
55
  /**
57
- * Whether the Legal page has anything on it.
58
- *
59
- * This element's licence model is the simplified one — a name plus an
60
- * optional URL — so it maps onto `GtkLicense` as "custom text when a licence
61
- * is set, unknown otherwise", which is what `adw_about_dialog_set_license`
62
- * does to the type anyway (:3472).
56
+ * Whether the Legal page has anything on it. This element's licence model is the
57
+ * simplified one — a name plus an optional URL — so it maps onto `GtkLicense` as
58
+ * "custom text when a licence is set, unknown otherwise", which is what
59
+ * `adw_about_dialog_set_license` does to the type anyway.
63
60
  */
64
61
  private _hasLegal;
65
- /** Rebuild the sheet contents from the current attributes / credit lists. */
66
62
  private _render;
67
63
  /**
68
64
  * A navigation page wrapping a header bar (with the close button) + content.
69
- *
70
- * `headerTitle` defaults to the page title; the main page overrides it,
71
- * because its page title is the dialog's ("About", .ui:19) while its header
72
- * shows the application name (.ui:30).
65
+ * `headerTitle` defaults to the page title; the main page overrides it, because its
66
+ * page title is the dialog's ("About") while its header shows the application name.
73
67
  */
74
68
  private _buildPage;
75
- /** The main page: icon, name, developer, version pill, then the three groups. */
76
69
  private _buildMainPage;
77
70
  /**
78
- * One `AdwPreferencesGroup` in its spacing wrapper.
79
- *
80
- * `data-group` carries the template's widget id so a test — and a reader —
81
- * can tell the four named groups apart; nothing styles off it. The credits
82
- * sections pass `null`, because the template has no id for them: they are
83
- * built one per section at runtime (:548-549).
71
+ * One `AdwPreferencesGroup` in its spacing wrapper. `data-group` carries the
72
+ * template's widget id so a test — and a reader — can tell the named groups apart;
73
+ * nothing styles off it. The credits sections pass `null`, because the template has
74
+ * no id for them: they are built one per section at runtime.
84
75
  */
85
76
  private _buildGroup;
86
- /** An activatable row that pushes a subpage, with a trailing go-next chevron. */
87
77
  private _buildNavRow;
88
78
  /**
89
- * Emit `activate-link` and navigate unless a handler took over.
90
- *
91
- * The GObject signal is `BOOLEAN__STRING` with `g_signal_accumulator_true_handled`
92
- * (:2093-2103) and its default handler returns `GDK_EVENT_PROPAGATE`
93
- * (:455-460), i.e. "not handled, do the default". A handler returning TRUE
94
- * suppresses it — which is what `preventDefault()` on a cancelable event
95
- * means, and why `dispatchEvent`'s return value is the gate here.
79
+ * Emit `activate-link` and navigate unless a handler took over. The GObject signal
80
+ * is `BOOLEAN__STRING` with `g_signal_accumulator_true_handled` and its default
81
+ * handler returns `GDK_EVENT_PROPAGATE` ("not handled, do the default"); a handler
82
+ * returning TRUE suppresses it, which is what `preventDefault()` on a cancelable
83
+ * event means — hence the gate on `dispatchEvent`'s return value.
96
84
  */
97
85
  private _activateLink;
98
- /** The Details page: comments + the links group (website + future custom links). */
99
86
  private _buildDetailsPage;
100
- /** A link row that opens a URL in a new tab and emits `activate-link`. */
101
87
  private _buildLinkRow;
102
- /** The Credits page: one group per section the core assembled. */
103
88
  private _buildCreditsPage;
104
89
  /**
105
- * A credit row — a plain title, or a link row when the entry carries a URI.
106
- *
107
- * The gate is `link !== null`, not the URI's truthiness: `"Ada <>"` parses to
108
- * an EMPTY link, which is still a link in the C (`if (link)` tests the
109
- * pointer, :562) and still produces an `AdwLinkRow`, to `mailto:`.
90
+ * A credit row — a plain title, or a link row when the entry carries a URI. The gate
91
+ * is `link !== null`, not the URI's truthiness: `"Ada <>"` parses to an EMPTY link,
92
+ * which is still a link in the C (`if (link)` tests the pointer) and still produces
93
+ * an `AdwLinkRow`, to `mailto:`.
110
94
  */
111
95
  private _buildCreditRow;
112
- /** The Legal page: copyright + license text. */
113
96
  private _buildLegalPage;
114
97
  /** Show the header title only once the main page is scrolled (AdwAboutDialog). */
115
98
  private _updateHeaderTitle;
@@ -16,10 +16,9 @@ export declare class AdwActionRow extends HTMLElement {
16
16
  /** `Adw.ActionRow:activatable-widget` — the widget this row activates. */
17
17
  get activatableWidget(): HTMLElement | null;
18
18
  /**
19
- * Set the activatable widget. Its sensitivity is copied into `activatable`
20
- * right away and then tracked, exactly as libadwaita's `sensitive` →
21
- * `activatable` binding does (adw-action-row.c:729-732) — including the part
22
- * that surprises: clearing the widget LEAVES the row activatable (C:709).
19
+ * Set the activatable widget. Its sensitivity is copied into `activatable` right
20
+ * away and then tracked, as libadwaita's `sensitive` → `activatable` binding does —
21
+ * including the surprising part: clearing the widget LEAVES the row activatable.
23
22
  */
24
23
  set activatableWidget(widget: HTMLElement | null);
25
24
  /** Whether a click activates this row — `GtkListBoxRow:activatable`. */
@@ -30,15 +29,13 @@ export declare class AdwActionRow extends HTMLElement {
30
29
  disconnectedCallback(): void;
31
30
  attributeChangedCallback(): void;
32
31
  /**
33
- * `adw_action_row_activate_real` (adw-action-row.c:297-307): forward the
34
- * activation to the activatable widget, then emit `activated`.
32
+ * `adw_action_row_activate_real`: forward the activation to the activatable widget,
33
+ * then emit `activated`.
35
34
  *
36
- * A click that ORIGINATED inside the activatable widget does not activate the
37
- * row at all — no forwarding, no `activated`. That is GTK's answer too: the
38
- * widget claims the gesture, so `GtkListBox` never emits `row-activated`, and
39
- * `pressed_cb` denies anything picked below the row / header / prefixes /
40
- * suffixes (C:120-137). It is also what keeps the forwarding from looping —
41
- * the synthetic click dispatched below bubbles straight back into this same
35
+ * A click that ORIGINATED inside the activatable widget does not activate the row at
36
+ * all — no forwarding, no `activated`. That is GTK's answer too: the widget claims
37
+ * the gesture, so `GtkListBox` never emits `row-activated`. It is also what keeps the
38
+ * forwarding from looping — the synthetic click below bubbles back into this same
42
39
  * listener, and without the guard one activation emitted `activated` twice.
43
40
  */
44
41
  private _onClick;
@@ -24,13 +24,10 @@ export declare class AdwAlertDialog extends HTMLElement {
24
24
  private readonly _buttons;
25
25
  private _blockCloseResponse;
26
26
  static get observedAttributes(): string[];
27
- /** The heading of the dialog. */
28
27
  get heading(): string;
29
28
  set heading(value: string);
30
- /** The body text of the dialog. */
31
29
  get body(): string;
32
30
  set body(value: string);
33
- /** Whether the dialog is currently shown. */
34
31
  get open(): boolean;
35
32
  set open(value: boolean);
36
33
  /** Whether to prefer horizontal button layout when the buttons fit. */
@@ -46,23 +43,15 @@ export declare class AdwAlertDialog extends HTMLElement {
46
43
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
47
44
  /** Present the dialog. `parent` is accepted for API parity; unused. */
48
45
  present(_parent?: unknown): void;
49
- /** Adds a response button with the given ID and label. */
50
46
  addResponse(id: string, label: string): void;
51
47
  /** Adds multiple responses at once — id/label pairs (Adw.add_responses parity). */
52
48
  addResponses(...idLabelPairs: string[]): void;
53
- /** Removes a response. */
54
49
  removeResponse(id: string): void;
55
- /** Whether a response with the given ID exists. */
56
50
  hasResponse(id: string): boolean;
57
- /** Gets a response's label. */
58
51
  getResponseLabel(id: string): string | null;
59
- /** Sets a response's label. */
60
52
  setResponseLabel(id: string, label: string): void;
61
- /** Gets a response's appearance. */
62
53
  getResponseAppearance(id: string): AdwResponseAppearance | null;
63
- /** Sets a response's appearance (default / suggested / destructive). */
64
54
  setResponseAppearance(id: string, appearance: AdwResponseAppearance): void;
65
- /** Gets whether a response is enabled. */
66
55
  getResponseEnabled(id: string): boolean;
67
56
  /** Sets whether a response is enabled (disabled buttons can't be activated). */
68
57
  setResponseEnabled(id: string, enabled: boolean): void;
@@ -70,7 +59,6 @@ export declare class AdwAlertDialog extends HTMLElement {
70
59
  setDefaultResponse(id: string | null): void;
71
60
  /** Sets the close response — emitted on dismissal (Escape / scrim click). */
72
61
  setCloseResponse(id: string): void;
73
- /** A response button was activated: close, then emit `response`. */
74
62
  private _activateResponse;
75
63
  /** Dismissal (Escape / scrim) — close, then emit the close-response. */
76
64
  private _dismiss;
@@ -1,6 +1,7 @@
1
1
  export declare class AdwAvatar extends HTMLElement {
2
2
  private _textEl;
3
3
  private _iconEl;
4
+ private _imageEl;
4
5
  private _initialized;
5
6
  static get observedAttributes(): string[];
6
7
  connectedCallback(): void;
@@ -16,27 +16,23 @@ export declare class AdwBottomSheet extends HTMLElement {
16
16
  /** Set while the element writes `open` back, so the write does not re-enter. */
17
17
  private _reflecting;
18
18
  static get observedAttributes(): string[];
19
- /** Whether the sheet is revealed. */
20
19
  get open(): boolean;
21
20
  set open(value: boolean);
22
- /** Whether the content is dimmed + blocked while the sheet is open. */
23
21
  get modal(): boolean;
24
22
  set modal(value: boolean);
25
23
  /** Whether the user can dismiss the sheet (dimming / Escape / sheet.close). */
26
24
  get canClose(): boolean;
27
25
  set canClose(value: boolean);
28
- /** Whether the overlaid drag handle is shown. */
29
26
  get showDragHandle(): boolean;
30
27
  set showDragHandle(value: boolean);
31
28
  /**
32
- * Route a dismissal affordance through the shared gate and act on the
33
- * verdict: close, raise `close-attempt`, forward `sheet.close` to an
34
- * ancestor, or do nothing. The element calls this for the dimming layer and
35
- * Escape; a close button inside the sheet calls it with `'close-button'`.
29
+ * Route a dismissal affordance through the shared gate and act on the verdict: close,
30
+ * raise `close-attempt`, forward `sheet.close` to an ancestor, or do nothing. Called
31
+ * for the dimming layer and Escape; a close button inside the sheet passes
32
+ * `'close-button'`.
36
33
  *
37
- * The verdict differs per source — a locked sheet signals a scrim click but
38
- * swallows a swipe, and the drag handle never closes anything. See
39
- * `resolveBottomSheetClose` in `@gjsify/adwaita-core`.
34
+ * The verdict differs PER SOURCE — a locked sheet signals a scrim click but swallows
35
+ * a swipe, and the drag handle never closes anything (`resolveBottomSheetClose`).
40
36
  */
41
37
  requestClose(source: BottomSheetCloseSource): BottomSheetCloseOutcome;
42
38
  connectedCallback(): void;
@@ -44,7 +40,6 @@ export declare class AdwBottomSheet extends HTMLElement {
44
40
  /** The programmatic open/close — `AdwBottomSheet:open`, ungated by `can-close`. */
45
41
  private _setOpen;
46
42
  private _render;
47
- /** Mirror the state onto the `open` attribute (the CSS + markup hook). */
48
43
  private _reflectOpen;
49
44
  /** Read a boolean attribute: absent → `fallback`, explicit `="false"` → off. */
50
45
  private _boolAttr;
@@ -55,7 +50,7 @@ export declare class AdwBottomSheet extends HTMLElement {
55
50
  *
56
51
  * The `<adw-bottom-sheet-sheet>` / `<adw-bottom-sheet-content>` wrappers are
57
52
  * markup, not widgets — GtkBuilder's `<child type="sheet">` leaves nothing in
58
- * the tree (adw-bottom-sheet.c:1278-1293) — so the wrapper itself is claimed
53
+ * the tree — so the wrapper itself is claimed
59
54
  * too. It used to fall through to `unslotted` and be appended to the content
60
55
  * layer, leaving an empty custom element behind after its children were
61
56
  * pulled out.
@@ -10,10 +10,9 @@ export declare class AdwButtonContent extends HTMLElement {
10
10
  disconnectedCallback(): void;
11
11
  attributeChangedCallback(name: string): void;
12
12
  /**
13
- * `adw_button_content_root` (:108-116): the nearest button ancestor, unless
14
- * that button's DIRECT parent is a split button — then the split button
15
- * takes the class, because `splitbutton.image-text-button > button` is the
16
- * rule that styles it (_buttons.scss:499-507).
13
+ * `adw_button_content_root`: the nearest button ancestor, unless that button's DIRECT
14
+ * parent is a split button — then the split button takes the class, because
15
+ * `splitbutton.image-text-button > button` is the rule that styles it.
17
16
  */
18
17
  private _hostButton;
19
18
  private _root;
@@ -11,7 +11,7 @@ export declare class AdwButtonRow extends HTMLElement {
11
11
  attributeChangedCallback(): void;
12
12
  private _render;
13
13
  /**
14
- * Paint one of the two `image.icon.{start,end}` nodes (adw-button-row.c:39-40).
14
+ * Paint one of the two `image.icon.{start,end}` nodes.
15
15
  *
16
16
  * The `start` / `end` position class is set once at construction — it is
17
17
  * where the node sits, not what it draws — so only the name changes here.
@@ -27,25 +27,20 @@ export declare class AdwCarousel extends HTMLElement implements CarouselHost {
27
27
  private _pendingInteractive;
28
28
  static get observedAttributes(): string[];
29
29
  constructor();
30
- /** Number of pages in the carousel. */
31
30
  get nPages(): number;
32
31
  /** Fractional scroll position (0 = first page, 1 = second, …). */
33
32
  get position(): number;
34
33
  /**
35
- * Scroll to the page this position settles on.
36
- *
37
- * `AdwCarousel:position` is READ-ONLY in C (adw-carousel.c:1036-1041) — the
38
- * setter is a port convenience, and it resolves the value with the same
39
- * `get_page_at_position` rule the carousel uses everywhere else, so setting
40
- * 0.5 lands on page 0 exactly as scrolling there would.
34
+ * Scroll to the page this position settles on. MODIFICATION: `AdwCarousel:position`
35
+ * is READ-ONLY in C; this setter is a port convenience that resolves through the
36
+ * same `get_page_at_position` rule, so 0.5 lands on page 0 exactly as scrolling
37
+ * there would.
41
38
  */
42
39
  set position(value: number);
43
- /** The page the current position settles on, `-1` when the carousel is empty. */
44
40
  get currentPage(): number;
45
41
  /** Whether the scroll wheel navigates between pages. Defaults to TRUE, as in libadwaita. */
46
42
  get allowScrollWheel(): boolean;
47
43
  set allowScrollWheel(value: boolean);
48
- /** Whether a single flick may cross more than one page. */
49
44
  get allowLongSwipes(): boolean;
50
45
  set allowLongSwipes(value: boolean);
51
46
  /** Whether the carousel can be navigated at all. Defaults to TRUE. */
@@ -57,87 +52,71 @@ export declare class AdwCarousel extends HTMLElement implements CarouselHost {
57
52
  connectedCallback(): void;
58
53
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
59
54
  disconnectedCallback(): void;
60
- /** One attribute → one state property. Shared by the initial read and later changes. */
61
55
  private _applyAttribute;
62
56
  /**
63
- * Scroll to `value`, waiting for the first layout when the track has no
64
- * width yet.
65
- *
66
- * `connectedCallback` runs DURING insertion, so the track is still 0px wide
67
- * and a scroll offset has nowhere to land — a declared
68
- * `<adw-carousel position="2">` silently stayed on page 0. Deferring to the
69
- * first non-zero measurement is the only point at which the offset means
70
- * anything; a later assignment simply replaces the pending one.
57
+ * Scroll to `value`, waiting for the first layout when the track has no width yet:
58
+ * `connectedCallback` runs DURING insertion, so the track is still 0px wide and a
59
+ * scroll offset has nowhere to land. The first non-zero measurement is the earliest
60
+ * point at which the offset means anything; a later assignment replaces the pending
61
+ * one.
71
62
  */
72
63
  private _positionWhenMeasurable;
73
64
  /**
74
- * Jump to `value` without the reveal animation.
75
- *
76
- * A DECLARED position is where the carousel STARTS, not somewhere it travels
77
- * to — `<adw-carousel position="2">` should render already showing page 2.
78
- * Left smooth, the track is still at offset 0 while the animation runs, and
79
- * the `scroll` event that fires from there recomputes the position back to
80
- * page 0. So the one assignment is made instant and the caller's
81
- * `scroll-behavior` is put back.
65
+ * Jump to `value` without the reveal animation: a DECLARED position is where the
66
+ * carousel STARTS, not somewhere it travels to. Left smooth, the track is still at
67
+ * offset 0 while the animation runs and the `scroll` event fired from there
68
+ * recomputes the position back to page 0 — so this one assignment is made instant
69
+ * and the caller's `scroll-behavior` restored.
82
70
  */
83
71
  private _scrollInstantly;
84
- /** Drop a pending declared position and stop watching for a layout. */
85
72
  private _cancelPendingPosition;
86
- /** Resolve a fractional position to a page and scroll there; a no-op when there is none. */
87
73
  private _scrollToPosition;
88
74
  /**
89
- * Insert `page` at `position` — `adw_carousel_insert` (adw-carousel.c:1370-1407).
75
+ * Insert `page` at `position` — `adw_carousel_insert`.
90
76
  * `-1` or a position past the end appends. Returns whether it was added.
91
77
  */
92
78
  insertPage(page: HTMLElement, position?: number): boolean;
93
- /** `adw_carousel_append` (adw-carousel.c:1348-1357). */
79
+ /** `adw_carousel_append`. */
94
80
  appendPage(page: HTMLElement): boolean;
95
- /** `adw_carousel_prepend` (adw-carousel.c:1330-1339). */
81
+ /** `adw_carousel_prepend`. */
96
82
  prependPage(page: HTMLElement): boolean;
97
- /** Remove `page` — `adw_carousel_remove` (adw-carousel.c:1508-1532). */
83
+ /** Remove `page` — `adw_carousel_remove`. */
98
84
  removePage(page: HTMLElement): boolean;
99
- /** Move `page` — `adw_carousel_reorder` (adw-carousel.c:1419-1499). */
85
+ /** Move `page` — `adw_carousel_reorder`. */
100
86
  reorderPage(page: HTMLElement, position: number): boolean;
101
87
  /**
102
88
  * Scroll to the page at `index`. Out-of-range, fractional and NaN indices are
103
89
  * refused rather than clamped, matching `adw_carousel_get_nth_page`'s
104
- * precondition (adw-carousel.c:1616).
90
+ * precondition.
105
91
  */
106
92
  scrollToPage(index: number): void;
107
- /** One keynav step — `navigate_to_direction` (adw-carousel.c:475-508). */
93
+ /** One keynav step — `navigate_to_direction`. */
108
94
  navigate(direction: 'back' | 'forward'): boolean;
109
95
  private _insert;
110
- /** The state's id for a page element, or `null` when it is not one of ours. */
111
96
  private _idOf;
112
- /** Make the DOM order match the model order, and drop slots whose page is gone. */
113
97
  private _syncTrack;
114
98
  /**
115
- * Put the scroll offset back where the model says it is, instantly.
116
- *
117
- * A page revealed at or before the current one moves the position with it
118
- * (`shift_position`, adw-carousel.c:241-258) precisely so the page on screen
119
- * does not slide sideways — but a scroll container knows nothing about that
120
- * and would keep its old offset, showing the newly-inserted page instead. GTK
121
- * gets this for free because the same allocation that adds the child also
122
- * lays it out; here it takes one write.
99
+ * Put the scroll offset back where the model says it is, instantly. A page revealed
100
+ * at or before the current one moves the position with it (`shift_position`)
101
+ * precisely so the page on screen does not slide sideways — but a scroll container
102
+ * keeps its old offset and would show the newly-inserted page instead. GTK gets this
103
+ * from the allocation that adds the child; here it takes one write.
123
104
  */
124
105
  private _applyScrollFromModel;
125
106
  /**
126
107
  * `allow-long-swipes` in CSS: `scroll-snap-stop: always` forces the scroll to
127
108
  * stop at every page, which is exactly what the property being FALSE means —
128
- * "each swipe can only move to the adjacent pages" (adw-carousel.c:1111-1113).
109
+ * "each swipe can only move to the adjacent pages".
129
110
  */
130
111
  private _applySnapStop;
131
- /** The px pitch between two page origins — `self->distance` (adw-carousel.c:767). */
112
+ /** The px pitch between two page origins — `self->distance`. */
132
113
  private _distance;
133
- /** Run the scroll the state asked for, in the track's own scroll coordinates. */
134
114
  private _performScroll;
135
115
  private _onScroll;
136
116
  private _onWheel;
137
117
  private _updatePositionFromScroll;
138
118
  private _onStateChange;
139
119
  }
140
- /** Shared base for the dot / line indicator elements. */
141
120
  declare abstract class AdwCarouselIndicator extends HTMLElement {
142
121
  protected _carousel: CarouselHost | null;
143
122
  protected _initialized: boolean;
@@ -8,24 +8,19 @@ declare abstract class AdwCheckBase extends HTMLElement {
8
8
  protected abstract get inputType(): 'checkbox' | 'radio';
9
9
  /** What a click / Space / arrow key on the control means for this kind. */
10
10
  protected abstract activate(): void;
11
- /** Whether the control is checked. */
12
11
  get checked(): boolean;
13
12
  set checked(value: boolean);
14
13
  /** Whether the control is in the third, inconsistent state. */
15
14
  get indeterminate(): boolean;
16
15
  set indeterminate(value: boolean);
17
- /** Whether the control is inert. */
18
16
  get disabled(): boolean;
19
17
  set disabled(value: boolean);
20
- /** The label text beside the indicator. */
21
18
  get label(): string;
22
19
  set label(value: string);
23
20
  connectedCallback(): void;
24
21
  disconnectedCallback(): void;
25
22
  attributeChangedCallback(name: string): void;
26
- /** Extra wiring for a subclass on connect. */
27
23
  protected onConnected(): void;
28
- /** Extra teardown for a subclass on disconnect. */
29
24
  protected onDisconnected(): void;
30
25
  protected render(): void;
31
26
  }
@@ -40,12 +35,11 @@ export declare class AdwRadio extends AdwCheckBase {
40
35
  private _unsubscribe;
41
36
  static get observedAttributes(): string[];
42
37
  protected get inputType(): 'radio';
43
- /** The group this member belongs to. */
44
38
  get name(): string;
45
39
  set name(value: string);
46
40
  /**
47
- * This member's value. Falls back to the label text so a group authored
48
- * without values still has members the group state can tell apart.
41
+ * This member's value. Falls back to the label text so a group authored without
42
+ * values still has members the group state can tell apart.
49
43
  */
50
44
  get value(): string;
51
45
  set value(value: string);
@@ -12,13 +12,13 @@ export declare class AdwComboRow extends HTMLElement {
12
12
  connectedCallback(): void;
13
13
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
14
14
  /**
15
- * `model_changed` (adw-combo-row.c:187-195) — one option or none is not a
16
- * choice, so the arrow goes and the row stops being activatable.
15
+ * `model_changed`: one option or none is not a choice, so the arrow goes and the row
16
+ * stops being activatable.
17
17
  *
18
- * Both halves have to be expressed: `data-presents-chooser` gates the
19
- * `.adw-row-value::after` mask in the stylesheet, and DISABLING the overlaid
20
- * `<select>` is what makes the row inert — hiding the arrow alone would leave
21
- * a row that still opens a one-entry popup on click.
18
+ * Both halves have to be expressed — `data-presents-chooser` gates the
19
+ * `.adw-row-value::after` mask in the stylesheet, and DISABLING the overlaid `<select>`
20
+ * is what makes the row inert. Hiding the arrow alone leaves a row that still opens a
21
+ * one-entry popup on click.
22
22
  */
23
23
  private _syncChooser;
24
24
  private _renderText;
@@ -8,16 +8,13 @@ export declare class AdwDataGrid extends HTMLElement {
8
8
  private _rows;
9
9
  private _initialized;
10
10
  static get observedAttributes(): string[];
11
- /** The column descriptors. Setting rebuilds the grid. */
12
11
  get columns(): AdwDataGridColumn[];
13
12
  set columns(value: ReadonlyArray<AdwDataGridColumn>);
14
- /** The row objects. Setting rebuilds the body. */
15
13
  get rows(): AdwDataGridRow[];
16
14
  set rows(value: ReadonlyArray<AdwDataGridRow>);
17
15
  /** The optional grid caption/title (reflected to the attribute). */
18
16
  get caption(): string;
19
17
  set caption(value: string);
20
- /** Whether every `normal` row is clickable (element-level flag). */
21
18
  get interactive(): boolean;
22
19
  set interactive(value: boolean);
23
20
  connectedCallback(): void;
@@ -25,13 +22,11 @@ export declare class AdwDataGrid extends HTMLElement {
25
22
  private _parseJsonAttr;
26
23
  private _renderCaption;
27
24
  /**
28
- * The CSS `grid-template-columns` value derived from the column descriptors.
29
- *
30
- * The DERIVATION is core's (`dataGridTracks`), because NativeScript needs the
31
- * same one for its `ItemSpec`s and can do nothing with a CSS string; the
32
- * mapping onto CSS text — including the `minmax(0px, 1fr)` slack track whose
33
- * `0px` must keep its unit to round-trip through the CSSOM — is
34
- * `dataGridTrackTemplate`.
25
+ * The CSS `grid-template-columns` value derived from the column descriptors. The
26
+ * DERIVATION is core's (`dataGridTracks`), because NativeScript needs the same one for
27
+ * its `ItemSpec`s and can do nothing with a CSS string; the mapping onto CSS text —
28
+ * including the `minmax(0px, 1fr)` slack track whose `0px` must keep its unit to
29
+ * round-trip through the CSSOM — is `dataGridTrackTemplate`.
35
30
  */
36
31
  private _trackTemplate;
37
32
  private _columnClasses;
@@ -1,11 +1,9 @@
1
1
  import './adw-popover.js';
2
2
  import type { AdwComboOption, AdwComboOptionInput } from '@gjsify/adwaita-core';
3
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.
4
+ * A dropdown option — `value` is the stable id, `label` the shown text. An alias of
5
+ * core's {@link AdwComboOption}, since the drop-down and the combo row are the same
6
+ * selection model behind two chromes; still exported so the published name keeps working.
9
7
  */
10
8
  export type AdwDropDownOption = AdwComboOption;
11
9
  export declare class AdwDropDown extends HTMLElement {
@@ -24,7 +22,6 @@ export declare class AdwDropDown extends HTMLElement {
24
22
  /** The options list. Setting it rebuilds the popover and clamps the selection. */
25
23
  get options(): AdwDropDownOption[];
26
24
  set options(value: ReadonlyArray<AdwComboOptionInput>);
27
- /** Alias of `options` (Gtk.DropDown's model is often called "items"). */
28
25
  get items(): AdwDropDownOption[];
29
26
  set items(value: ReadonlyArray<AdwComboOptionInput>);
30
27
  /** The selected index. Out-of-range values are ignored (Gtk.DropDown:selected). */
@@ -33,12 +30,9 @@ export declare class AdwDropDown extends HTMLElement {
33
30
  /** The selected option's value, or '' when empty (Gtk.DropDown:selected-item). */
34
31
  get selectedValue(): string;
35
32
  set selectedValue(value: string);
36
- /** The selected option descriptor, or null when empty. */
37
33
  get selectedItem(): AdwDropDownOption | null;
38
- /** Whether the search entry is shown in the popover. */
39
34
  get enableSearch(): boolean;
40
35
  set enableSearch(value: boolean);
41
- /** Whether the popover is currently open. */
42
36
  get active(): boolean;
43
37
  connectedCallback(): void;
44
38
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
@@ -48,9 +42,7 @@ export declare class AdwDropDown extends HTMLElement {
48
42
  private _onButtonKeyDown;
49
43
  /** Printable keys inside an OPEN popover, when there is no search entry to type into. */
50
44
  private _onPopoverTypeAhead;
51
- /** Type-ahead: accumulate keys, focus/select the next matching option. */
52
45
  private _typeAhead;
53
- /** Filter the visible items by a search query (case-insensitive substring). */
54
46
  private _filter;
55
47
  private _visibleItems;
56
48
  private _renderAll;