@gjsify/adwaita-web 0.35.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/adwaita-web.css +433 -33
  2. package/dist/adwaita-web.css.map +1 -1
  3. package/lib/types/adw-shortcut-label.spec.d.ts +2 -0
  4. package/lib/types/breakpoints.d.ts +10 -12
  5. package/lib/types/elements/adw-about-dialog.d.ts +19 -36
  6. package/lib/types/elements/adw-action-row.d.ts +9 -12
  7. package/lib/types/elements/adw-alert-dialog.d.ts +0 -12
  8. package/lib/types/elements/adw-avatar.d.ts +1 -0
  9. package/lib/types/elements/adw-bottom-sheet.d.ts +7 -12
  10. package/lib/types/elements/adw-button-content.d.ts +3 -4
  11. package/lib/types/elements/adw-button-row.d.ts +1 -1
  12. package/lib/types/elements/adw-carousel.d.ts +28 -49
  13. package/lib/types/elements/adw-checks.d.ts +2 -8
  14. package/lib/types/elements/adw-combo-row.d.ts +6 -6
  15. package/lib/types/elements/adw-data-grid.d.ts +5 -10
  16. package/lib/types/elements/adw-drop-down.d.ts +3 -11
  17. package/lib/types/elements/adw-entry-row.d.ts +20 -23
  18. package/lib/types/elements/adw-icon.d.ts +2 -4
  19. package/lib/types/elements/adw-inline-view-switcher.d.ts +18 -31
  20. package/lib/types/elements/adw-navigation-split-view.d.ts +7 -12
  21. package/lib/types/elements/adw-navigation-view.d.ts +2 -10
  22. package/lib/types/elements/adw-overlay-split-view.d.ts +28 -52
  23. package/lib/types/elements/adw-password-entry-row.d.ts +4 -5
  24. package/lib/types/elements/adw-popover.d.ts +2 -7
  25. package/lib/types/elements/adw-preferences-dialog.d.ts +21 -34
  26. package/lib/types/elements/adw-preferences-group.d.ts +12 -14
  27. package/lib/types/elements/adw-progress-bar.d.ts +3 -4
  28. package/lib/types/elements/adw-shortcut-label.d.ts +20 -0
  29. package/lib/types/elements/adw-sidebar.d.ts +5 -10
  30. package/lib/types/elements/adw-spinner.d.ts +3 -5
  31. package/lib/types/elements/adw-split-button.d.ts +6 -16
  32. package/lib/types/elements/adw-switch-row.d.ts +3 -3
  33. package/lib/types/elements/adw-tab-view.d.ts +16 -26
  34. package/lib/types/elements/adw-toast-overlay.d.ts +8 -13
  35. package/lib/types/elements/adw-view-stack.d.ts +7 -17
  36. package/lib/types/elements/adw-view-switcher-bar.d.ts +4 -8
  37. package/lib/types/elements/adw-view-switcher.d.ts +18 -38
  38. package/lib/types/elements/adw-wrap-box.d.ts +7 -17
  39. package/lib/types/elements/view-switcher-dom.d.ts +10 -13
  40. package/lib/types/index.d.ts +1 -0
  41. package/lib/types/source-view/hex.d.ts +7 -13
  42. package/lib/types/style-classes.spec.d.ts +11 -0
  43. package/lib/types/styles.generated.d.ts +1 -1
  44. package/package.json +6 -6
  45. package/scss/_about_dialog.scss +3 -2
  46. package/scss/_action_row.scss +33 -0
  47. package/scss/_avatar.scss +12 -0
  48. package/scss/_button.scss +44 -22
  49. package/scss/_card.scss +11 -8
  50. package/scss/_checks.scss +2 -4
  51. package/scss/_dialog.scss +3 -2
  52. package/scss/_headerbar.scss +23 -0
  53. package/scss/_popover.scss +8 -4
  54. package/scss/_preferences.scss +7 -7
  55. package/scss/_progress_bar.scss +9 -6
  56. package/scss/_reset.scss +1 -1
  57. package/scss/_shortcut_label.scss +80 -0
  58. package/scss/_sidebar.scss +57 -0
  59. package/scss/_status_page.scss +20 -0
  60. package/scss/_style_classes.scss +407 -0
  61. package/scss/_switch.scss +4 -3
  62. package/scss/_variables.scss +25 -0
  63. package/scss/adwaita-skin.scss +12 -0
  64. package/src/adw-about-dialog.spec.ts +34 -49
  65. package/src/adw-action-rows.spec.ts +25 -33
  66. package/src/adw-avatar.spec.ts +51 -20
  67. package/src/adw-banner.spec.ts +5 -8
  68. package/src/adw-button-content.spec.ts +9 -12
  69. package/src/adw-button-row.spec.ts +2 -4
  70. package/src/adw-carousel.spec.ts +40 -53
  71. package/src/adw-checks.spec.ts +36 -47
  72. package/src/adw-drop-down.spec.ts +25 -32
  73. package/src/adw-header-bar.spec.ts +5 -7
  74. package/src/adw-icon.spec.ts +23 -32
  75. package/src/adw-progress-bar.spec.ts +10 -12
  76. package/src/adw-row-state.spec.ts +9 -10
  77. package/src/adw-shortcut-label.spec.ts +112 -0
  78. package/src/adw-sidebar.spec.ts +17 -24
  79. package/src/adw-switch.spec.ts +11 -17
  80. package/src/adw-tab-view.spec.ts +7 -10
  81. package/src/adw-toast-overlay.spec.ts +7 -11
  82. package/src/adw-view-switcher-bar.spec.ts +10 -14
  83. package/src/adw-wrap-box.spec.ts +25 -36
  84. package/src/bottom-sheet.spec.ts +30 -36
  85. package/src/breakpoints.ts +15 -18
  86. package/src/chrome.spec.ts +13 -21
  87. package/src/elements/adw-about-dialog.ts +71 -114
  88. package/src/elements/adw-action-row.ts +22 -37
  89. package/src/elements/adw-alert-dialog.ts +25 -50
  90. package/src/elements/adw-avatar.ts +40 -15
  91. package/src/elements/adw-banner.ts +14 -18
  92. package/src/elements/adw-bottom-sheet.ts +31 -52
  93. package/src/elements/adw-button-content.ts +30 -37
  94. package/src/elements/adw-button-row.ts +14 -24
  95. package/src/elements/adw-carousel.ts +87 -148
  96. package/src/elements/adw-checks.ts +43 -56
  97. package/src/elements/adw-clamp.ts +8 -9
  98. package/src/elements/adw-combo-row.ts +17 -25
  99. package/src/elements/adw-data-grid.ts +26 -38
  100. package/src/elements/adw-dialog.ts +25 -56
  101. package/src/elements/adw-drop-down.ts +31 -51
  102. package/src/elements/adw-entry-row.ts +39 -46
  103. package/src/elements/adw-expander-row.ts +30 -53
  104. package/src/elements/adw-icon.ts +30 -53
  105. package/src/elements/adw-inline-view-switcher.ts +38 -67
  106. package/src/elements/adw-menu-button.ts +28 -58
  107. package/src/elements/adw-navigation-split-view.ts +35 -47
  108. package/src/elements/adw-navigation-view.ts +12 -28
  109. package/src/elements/adw-overlay-split-view.ts +100 -175
  110. package/src/elements/adw-password-entry-row.ts +18 -28
  111. package/src/elements/adw-popover.ts +28 -44
  112. package/src/elements/adw-preferences-dialog.ts +41 -66
  113. package/src/elements/adw-preferences-group.ts +33 -46
  114. package/src/elements/adw-progress-bar.ts +27 -47
  115. package/src/elements/adw-shortcut-label.ts +138 -0
  116. package/src/elements/adw-sidebar.ts +31 -39
  117. package/src/elements/adw-spin-row.ts +7 -14
  118. package/src/elements/adw-spinner.ts +31 -43
  119. package/src/elements/adw-split-button.ts +45 -75
  120. package/src/elements/adw-switch-row.ts +29 -46
  121. package/src/elements/adw-switch.ts +28 -47
  122. package/src/elements/adw-tab-view.ts +62 -103
  123. package/src/elements/adw-toast-overlay.ts +28 -35
  124. package/src/elements/adw-toggle-group.ts +9 -16
  125. package/src/elements/adw-view-stack.ts +32 -51
  126. package/src/elements/adw-view-switcher-bar.ts +26 -50
  127. package/src/elements/adw-view-switcher.ts +60 -110
  128. package/src/elements/adw-window-title.ts +4 -4
  129. package/src/elements/adw-wrap-box.ts +33 -59
  130. package/src/elements/view-switcher-dom.ts +15 -22
  131. package/src/entry-rows.spec.ts +18 -24
  132. package/src/index.ts +13 -15
  133. package/src/navigation-view.spec.ts +7 -10
  134. package/src/preferences-search.ts +11 -15
  135. package/src/preferences.spec.ts +13 -15
  136. package/src/source-view/adw-source-view.ts +6 -19
  137. package/src/source-view/hex.ts +7 -13
  138. package/src/split-button.spec.ts +32 -44
  139. package/src/split-views.spec.ts +83 -149
  140. package/src/style-classes.spec.ts +181 -0
  141. package/src/style-isolation.spec.ts +3 -6
  142. package/src/styles.generated.ts +1 -1
  143. package/src/tab-view.spec.ts +26 -35
  144. package/src/test.browser.mts +4 -0
  145. package/src/view-stack.spec.ts +23 -34
  146. package/src/view-switcher.spec.ts +56 -84
@@ -9,18 +9,15 @@
9
9
  // `notify::can-shrink` (CustomEvent, bubbles) mirroring the AdwButtonContent
10
10
  // GObject notify signals the native story observes.
11
11
  //
12
- // The derivations come from `@gjsify/adwaita-core` (ADR 0004). THE STYLE CLASS IS
13
- // WHY THIS WAS TOUCHED: `AdwButtonContent` puts `image-text-button` on the button
14
- // hosting it (adw-button-content.c:115) and removes it on unroot (:126), and the
15
- // stylesheet gives that class `padding-left/right: 9px` where a plain text button
16
- // has 17px (_buttons.scss:77-80 against :72-75). `grep -rn "image-text-button"`
17
- // over this package used to return NOTHING, so every icon+label button here was
18
- // drawn with a plain button's padding.
12
+ // The derivations come from `@gjsify/adwaita-core` (ADR 0004). THE STYLE CLASS IS THE
13
+ // POINT: `AdwButtonContent` puts `image-text-button` on the button hosting it and removes
14
+ // it on unroot, and the stylesheet gives that class `padding-left/right: 9px` where a
15
+ // plain text button has 17px. Without the class, an icon+label button is drawn with a
16
+ // plain button's padding.
19
17
  //
20
18
  // Reference: refs/libadwaita/src/adw-button-content.c (AdwButtonContent)
21
19
  // Reference: refs/libadwaita/src/stylesheet/widgets/_buttons.scss
22
- // (image-text-button :77-91 · splitbutton override :499-507 ·
23
- // buttoncontent :626-645)
20
+ // (image-text-button · the splitbutton override · buttoncontent)
24
21
  // Copyright (c) GNOME contributors (libadwaita). LGPLv2.1+.
25
22
  // Modifications: Implemented as a Web Component for @gjsify/adwaita-web; the
26
23
  // icon node is <adw-icon>.
@@ -30,14 +27,13 @@ import { BUTTON_CONTENT_STYLE_CLASS, buttonContentIconName, buttonContentLabelTe
30
27
  import { type AdwIcon, createAdwIcon } from './adw-icon.js';
31
28
 
32
29
  /**
33
- * What `gtk_widget_get_ancestor (…, GTK_TYPE_BUTTON)` (:95) looks like in the
34
- * DOM: a native `<button>`, or anything wearing the Adwaita button class (the
35
- * `<adw-button>` element renders an inner `<button class="adw-button">`, and the
36
- * stories style a plain one with the same class set).
30
+ * What `gtk_widget_get_ancestor (…, GTK_TYPE_BUTTON)` looks like in the DOM: a native
31
+ * `<button>`, or anything wearing the Adwaita button class — `<adw-button>` renders an
32
+ * inner button with it, and the stories put it on plain ones.
37
33
  */
38
34
  const BUTTON_SELECTOR = 'button, .adw-button';
39
35
 
40
- /** The split-button node the class is RETARGETED to (:112-113). */
36
+ /** The split-button node the class is RETARGETED to. */
41
37
  const SPLIT_BUTTON_SELECTOR = 'adw-split-button, .adw-split-button';
42
38
 
43
39
  export class AdwButtonContent extends HTMLElement {
@@ -60,9 +56,9 @@ export class AdwButtonContent extends HTMLElement {
60
56
  this._boxEl = document.createElement('div');
61
57
  this._boxEl.className = 'adw-button-content-box';
62
58
 
63
- // The image node is GTK_ACCESSIBLE_ROLE_PRESENTATION in libadwaita —
64
- // it is decorative, the label carries the accessible name, which is
65
- // what <adw-icon>'s own `aria-hidden` says.
59
+ // The image node is GTK_ACCESSIBLE_ROLE_PRESENTATION in libadwaita: decorative,
60
+ // with the label carrying the accessible name — what `<adw-icon>`'s own
61
+ // `aria-hidden` already says.
66
62
  this._iconEl = createAdwIcon(null);
67
63
 
68
64
  this._labelEl = document.createElement('span');
@@ -72,8 +68,8 @@ export class AdwButtonContent extends HTMLElement {
72
68
  this.replaceChildren(this._boxEl);
73
69
  this._render();
74
70
  }
75
- // `adw_button_content_root` runs on every rooting, not just the first
76
- // (:99-116), so a re-parented content re-stamps its new host.
71
+ // `adw_button_content_root` runs on every rooting, not just the first, so a
72
+ // re-parented content re-stamps its new host.
77
73
  this._root();
78
74
  }
79
75
 
@@ -84,16 +80,14 @@ export class AdwButtonContent extends HTMLElement {
84
80
  attributeChangedCallback(name: string) {
85
81
  if (!this._initialized) return;
86
82
  this._render();
87
- // Mirror the AdwButtonContent notify::<prop> signals the native story
88
- // listens to.
83
+ // Mirrors the AdwButtonContent notify::<prop> signals the native story listens to.
89
84
  this.dispatchEvent(new CustomEvent(`notify::${name}`, { bubbles: true }));
90
85
  }
91
86
 
92
87
  /**
93
- * `adw_button_content_root` (:108-116): the nearest button ancestor, unless
94
- * that button's DIRECT parent is a split button — then the split button
95
- * takes the class, because `splitbutton.image-text-button > button` is the
96
- * rule that styles it (_buttons.scss:499-507).
88
+ * `adw_button_content_root`: the nearest button ancestor, unless that button's DIRECT
89
+ * parent is a split button — then the split button takes the class, because
90
+ * `splitbutton.image-text-button > button` is the rule that styles it.
97
91
  */
98
92
  private _hostButton(): HTMLElement | null {
99
93
  const button = this.parentElement?.closest<HTMLElement>(BUTTON_SELECTOR) ?? null;
@@ -106,36 +100,35 @@ export class AdwButtonContent extends HTMLElement {
106
100
  const host = this._hostButton();
107
101
  if (host === this._styledHost) return;
108
102
  this._unroot();
109
- // A content with no button ancestor styles nothing. The C would pass
110
- // NULL to `gtk_widget_get_parent`/`add_css_class` here (:112-115) — two
111
- // CRITICALs — so there is nothing to reproduce.
103
+ // A content with no button ancestor styles nothing: the C would pass NULL to
104
+ // `gtk_widget_get_parent`/`add_css_class`, i.e. two CRITICALs, so there is nothing
105
+ // to reproduce.
112
106
  if (!host) return;
113
107
  host.classList.add(BUTTON_CONTENT_STYLE_CLASS);
114
108
  this._styledHost = host;
115
109
  }
116
110
 
117
111
  private _unroot(): void {
118
- // `adw_button_content_unroot` (:126) — a button that loses its content
119
- // goes back to plain-button padding.
112
+ // `adw_button_content_unroot`: a button that loses its content goes back to
113
+ // plain-button padding.
120
114
  this._styledHost?.classList.remove(BUTTON_CONTENT_STYLE_CLASS);
121
115
  this._styledHost = null;
122
116
  }
123
117
 
124
118
  private _render() {
125
- // An empty `icon-name` resolves to `image-missing` and the image node
126
- // stays visible (:355-356). The docs at :228/:343 say the icon is not
127
- // shown; the code never hides it, and this follows the code — see the
128
- // `BUTTON_CONTENT_ICON_VECTORS` rule string.
119
+ // An empty `icon-name` resolves to `image-missing` and the image node stays
120
+ // VISIBLE. libadwaita's own docs say the icon is not shown, but its code never
121
+ // hides it; this follows the code — see `BUTTON_CONTENT_ICON_VECTORS`.
129
122
  this._iconEl.iconName = buttonContentIconName(this.getAttribute('icon-name') ?? '');
130
123
  this._iconEl.hidden = false;
131
124
 
132
125
  const label = this.getAttribute('label') ?? '';
133
126
  this._labelEl.textContent = buttonContentLabelText(label, this.hasAttribute('use-underline'));
134
- // `gtk_widget_set_visible (self->label, label[0])` (:398) — the RAW
135
- // label decides, not the mnemonic-resolved text.
127
+ // `gtk_widget_set_visible (self->label, label[0])`: the RAW label decides, not the
128
+ // mnemonic-resolved text.
136
129
  this._labelEl.hidden = label.length === 0;
137
130
 
138
- // can-shrink → ellipsize the label (Gtk.Label PANGO_ELLIPSIZE_END, :490).
131
+ // can-shrink → ellipsize the label (Gtk.Label PANGO_ELLIPSIZE_END).
139
132
  this.classList.toggle('can-shrink', this.hasAttribute('can-shrink'));
140
133
  }
141
134
  }
@@ -1,27 +1,17 @@
1
- // <adw-button-row> — A boxed-list row that behaves like a button: a centered
2
- // title between an optional start icon and an optional end icon, spanning the
3
- // full width of the list. The `suggested-action` / `destructive-action` style
4
- // classes recolor it like the matching Adwaita button variants.
5
- // Attributes: title, start-icon-name, end-icon-name (symbolic names, e.g.
6
- // "list-add" / "go-next").
7
- // Events: `activated` (CustomEvent, bubbles) when the row is clicked — mirrors
8
- // the Adw.ButtonRow `activated` GObject signal.
1
+ // <adw-button-row> — a boxed-list row that behaves like a button: a centred title between
2
+ // an optional start and end icon, spanning the full width of the list. The
3
+ // `suggested-action` / `destructive-action` style classes recolour it like the matching
4
+ // Adwaita button variants, and `activated` (CustomEvent, bubbles) mirrors the
5
+ // Adw.ButtonRow GObject signal.
9
6
  //
10
- // The label/icon visibility rules are HEADLESS and live in
11
- // `@gjsify/adwaita-core` (ADR 0004) as {@link ButtonRowState}; this element
12
- // composes it and keeps only the DOM render half.
13
- // `@gjsify/adwaita-nativescript` composes the same state, so both ports share one
14
- // behaviour. Two things this fixes, both from adw-button-row.c:
15
- // - `end-icon-name` (C:213-223, bound at adw-button-row.ui:52-65) exists since
16
- // libadwaita 1.6 and neither renderer had it, so the trailing-chevron shape
17
- // the property exists for could not be expressed.
18
- // - THERE IS NO `activatable` OPT-OUT. `<property name="activatable">True
19
- // </property>` is in the template (adw-button-row.ui:5), the class docs say
20
- // "AdwButtonRow is always activatable." (C:31), and the whole public surface
21
- // (C:270-352) is `new` plus the two icon-name pairs. This element used to
22
- // honour an invented `activatable="false"`, which also gave the same markup
23
- // two opposite meanings inside one package — `<adw-action-row>` reads
24
- // `activatable` by PRESENCE, so `activatable="false"` there meant TRUE.
7
+ // The label/icon visibility rules are HEADLESS and live in `@gjsify/adwaita-core`
8
+ // (ADR 0004) as {@link ButtonRowState}; this element keeps only the DOM render half.
9
+ //
10
+ // THERE IS NO `activatable` OPT-OUT, and inventing one would be wrong twice over: the
11
+ // upstream template hardcodes `activatable=True` and the class docs say "AdwButtonRow is
12
+ // always activatable", while `<adw-action-row>` in this same package reads `activatable`
13
+ // by PRESENCE — so `activatable="false"` means TRUE there, and one spelling would carry
14
+ // two opposite meanings.
25
15
  //
26
16
  // Reference: refs/libadwaita/src/adw-button-row.c, adw-button-row.ui
27
17
  // Reference: refs/libadwaita/src/stylesheet/widgets/_lists.scss (row.button)
@@ -91,7 +81,7 @@ export class AdwButtonRow extends HTMLElement {
91
81
  }
92
82
 
93
83
  /**
94
- * Paint one of the two `image.icon.{start,end}` nodes (adw-button-row.c:39-40).
84
+ * Paint one of the two `image.icon.{start,end}` nodes.
95
85
  *
96
86
  * The `start` / `end` position class is set once at construction — it is
97
87
  * where the node sits, not what it draws — so only the name changes here.