@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.
- package/dist/adwaita-web.css +504 -34
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/accent.d.ts +28 -0
- package/lib/types/adw-accent.spec.d.ts +2 -0
- package/lib/types/adw-shortcut-label.spec.d.ts +2 -0
- package/lib/types/breakpoints.d.ts +10 -12
- package/lib/types/elements/adw-about-dialog.d.ts +19 -36
- package/lib/types/elements/adw-action-row.d.ts +9 -12
- package/lib/types/elements/adw-alert-dialog.d.ts +0 -12
- package/lib/types/elements/adw-avatar.d.ts +1 -0
- package/lib/types/elements/adw-bottom-sheet.d.ts +7 -12
- package/lib/types/elements/adw-button-content.d.ts +3 -4
- package/lib/types/elements/adw-button-row.d.ts +1 -1
- package/lib/types/elements/adw-carousel.d.ts +28 -49
- package/lib/types/elements/adw-checks.d.ts +2 -8
- package/lib/types/elements/adw-combo-row.d.ts +6 -6
- package/lib/types/elements/adw-data-grid.d.ts +5 -10
- package/lib/types/elements/adw-drop-down.d.ts +3 -11
- package/lib/types/elements/adw-entry-row.d.ts +20 -23
- package/lib/types/elements/adw-icon.d.ts +2 -4
- package/lib/types/elements/adw-inline-view-switcher.d.ts +18 -31
- package/lib/types/elements/adw-navigation-split-view.d.ts +7 -12
- package/lib/types/elements/adw-navigation-view.d.ts +2 -10
- package/lib/types/elements/adw-overlay-split-view.d.ts +28 -52
- package/lib/types/elements/adw-password-entry-row.d.ts +4 -5
- package/lib/types/elements/adw-popover.d.ts +2 -7
- package/lib/types/elements/adw-preferences-dialog.d.ts +21 -34
- package/lib/types/elements/adw-preferences-group.d.ts +12 -14
- package/lib/types/elements/adw-progress-bar.d.ts +3 -4
- package/lib/types/elements/adw-shortcut-label.d.ts +20 -0
- package/lib/types/elements/adw-sidebar.d.ts +5 -10
- package/lib/types/elements/adw-spinner.d.ts +3 -5
- package/lib/types/elements/adw-split-button.d.ts +6 -16
- package/lib/types/elements/adw-switch-row.d.ts +3 -3
- package/lib/types/elements/adw-tab-view.d.ts +16 -26
- package/lib/types/elements/adw-toast-overlay.d.ts +8 -13
- package/lib/types/elements/adw-view-stack.d.ts +7 -17
- package/lib/types/elements/adw-view-switcher-bar.d.ts +4 -8
- package/lib/types/elements/adw-view-switcher.d.ts +18 -38
- package/lib/types/elements/adw-wrap-box.d.ts +7 -17
- package/lib/types/elements/view-switcher-dom.d.ts +10 -13
- package/lib/types/index.d.ts +3 -0
- package/lib/types/source-view/hex.d.ts +7 -13
- package/lib/types/style-classes.spec.d.ts +11 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +18 -7
- package/scss/_about_dialog.scss +3 -2
- package/scss/_action_row.scss +33 -0
- package/scss/_avatar.scss +12 -0
- package/scss/_button.scss +44 -22
- package/scss/_card.scss +11 -8
- package/scss/_checks.scss +2 -4
- package/scss/_dialog.scss +3 -2
- package/scss/_headerbar.scss +23 -0
- package/scss/_popover.scss +8 -4
- package/scss/_preferences.scss +7 -7
- package/scss/_progress_bar.scss +9 -6
- package/scss/_reset.scss +1 -1
- package/scss/_shortcut_label.scss +80 -0
- package/scss/_sidebar.scss +57 -0
- package/scss/_status_page.scss +20 -0
- package/scss/_style_classes.scss +407 -0
- package/scss/_switch.scss +4 -3
- package/scss/_theme.scss +20 -2
- package/scss/_variables.scss +34 -1
- package/scss/adwaita-skin.scss +12 -0
- package/src/accent.ts +74 -0
- package/src/adw-about-dialog.spec.ts +34 -49
- package/src/adw-accent.spec.ts +105 -0
- package/src/adw-action-rows.spec.ts +25 -33
- package/src/adw-avatar.spec.ts +51 -20
- package/src/adw-banner.spec.ts +5 -8
- package/src/adw-button-content.spec.ts +9 -12
- package/src/adw-button-row.spec.ts +2 -4
- package/src/adw-carousel.spec.ts +40 -53
- package/src/adw-checks.spec.ts +36 -47
- package/src/adw-drop-down.spec.ts +25 -32
- package/src/adw-header-bar.spec.ts +5 -7
- package/src/adw-icon.spec.ts +23 -32
- package/src/adw-progress-bar.spec.ts +10 -12
- package/src/adw-row-state.spec.ts +9 -10
- package/src/adw-shortcut-label.spec.ts +112 -0
- package/src/adw-sidebar.spec.ts +17 -24
- package/src/adw-switch.spec.ts +11 -17
- package/src/adw-tab-view.spec.ts +7 -10
- package/src/adw-toast-overlay.spec.ts +7 -11
- package/src/adw-view-switcher-bar.spec.ts +10 -14
- package/src/adw-wrap-box.spec.ts +25 -36
- package/src/bottom-sheet.spec.ts +30 -36
- package/src/breakpoints.ts +15 -18
- package/src/chrome.spec.ts +13 -21
- package/src/elements/adw-about-dialog.ts +71 -114
- package/src/elements/adw-action-row.ts +22 -37
- package/src/elements/adw-alert-dialog.ts +25 -50
- package/src/elements/adw-avatar.ts +40 -15
- package/src/elements/adw-banner.ts +14 -18
- package/src/elements/adw-bottom-sheet.ts +31 -52
- package/src/elements/adw-button-content.ts +30 -37
- package/src/elements/adw-button-row.ts +14 -24
- package/src/elements/adw-carousel.ts +87 -148
- package/src/elements/adw-checks.ts +43 -56
- package/src/elements/adw-clamp.ts +8 -9
- package/src/elements/adw-combo-row.ts +17 -25
- package/src/elements/adw-data-grid.ts +26 -38
- package/src/elements/adw-dialog.ts +25 -56
- package/src/elements/adw-drop-down.ts +31 -51
- package/src/elements/adw-entry-row.ts +39 -46
- package/src/elements/adw-expander-row.ts +30 -53
- package/src/elements/adw-icon.ts +30 -53
- package/src/elements/adw-inline-view-switcher.ts +38 -67
- package/src/elements/adw-menu-button.ts +28 -58
- package/src/elements/adw-navigation-split-view.ts +35 -47
- package/src/elements/adw-navigation-view.ts +12 -28
- package/src/elements/adw-overlay-split-view.ts +100 -175
- package/src/elements/adw-password-entry-row.ts +18 -28
- package/src/elements/adw-popover.ts +28 -44
- package/src/elements/adw-preferences-dialog.ts +41 -66
- package/src/elements/adw-preferences-group.ts +33 -46
- package/src/elements/adw-progress-bar.ts +27 -47
- package/src/elements/adw-shortcut-label.ts +138 -0
- package/src/elements/adw-sidebar.ts +31 -39
- package/src/elements/adw-spin-row.ts +7 -14
- package/src/elements/adw-spinner.ts +31 -43
- package/src/elements/adw-split-button.ts +45 -75
- package/src/elements/adw-switch-row.ts +29 -46
- package/src/elements/adw-switch.ts +28 -47
- package/src/elements/adw-tab-view.ts +62 -103
- package/src/elements/adw-toast-overlay.ts +28 -35
- package/src/elements/adw-toggle-group.ts +9 -16
- package/src/elements/adw-view-stack.ts +32 -51
- package/src/elements/adw-view-switcher-bar.ts +26 -50
- package/src/elements/adw-view-switcher.ts +60 -110
- package/src/elements/adw-window-title.ts +4 -4
- package/src/elements/adw-wrap-box.ts +33 -59
- package/src/elements/view-switcher-dom.ts +15 -22
- package/src/entry-rows.spec.ts +18 -24
- package/src/index.ts +24 -15
- package/src/navigation-view.spec.ts +7 -10
- package/src/preferences-search.ts +11 -15
- package/src/preferences.spec.ts +13 -15
- package/src/source-view/adw-source-view.ts +6 -19
- package/src/source-view/hex.ts +7 -13
- package/src/split-button.spec.ts +32 -44
- package/src/split-views.spec.ts +83 -149
- package/src/style-classes.spec.ts +181 -0
- package/src/style-isolation.spec.ts +3 -6
- package/src/styles.generated.ts +1 -1
- package/src/tab-view.spec.ts +26 -35
- package/src/test.browser.mts +6 -0
- package/src/view-stack.spec.ts +23 -34
- 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
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
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
|
|
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)`
|
|
34
|
-
*
|
|
35
|
-
*
|
|
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
|
|
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
|
-
//
|
|
65
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
|
94
|
-
*
|
|
95
|
-
*
|
|
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
|
|
110
|
-
//
|
|
111
|
-
//
|
|
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
|
|
119
|
-
//
|
|
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
|
-
//
|
|
127
|
-
//
|
|
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])
|
|
135
|
-
//
|
|
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
|
|
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> —
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
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
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
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
|
|
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.
|