@gjsify/adwaita-web 0.40.0 → 0.42.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/README.md +98 -3
- package/dist/adwaita-web.css +142 -63
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/adw-fonts.spec.d.ts +2 -0
- package/lib/types/breakpoints.d.ts +10 -1
- package/lib/types/connect-lifecycle.spec.d.ts +1 -0
- package/lib/types/elements/adw-about-dialog.d.ts +1 -0
- package/lib/types/elements/adw-action-row.d.ts +2 -0
- package/lib/types/elements/adw-alert-dialog.d.ts +14 -2
- package/lib/types/elements/adw-carousel.d.ts +48 -0
- package/lib/types/elements/adw-dialog.d.ts +2 -7
- package/lib/types/elements/adw-icon.d.ts +17 -1
- package/lib/types/elements/adw-navigation-split-view.d.ts +7 -0
- package/lib/types/elements/adw-overlay-split-view.d.ts +6 -0
- package/lib/types/elements/adw-popover.d.ts +1 -0
- package/lib/types/elements/adw-preferences-dialog.d.ts +1 -0
- package/lib/types/elements/adw-switch.d.ts +10 -0
- package/lib/types/elements/adw-tab-view.d.ts +23 -0
- package/lib/types/elements/adw-toggle-group.d.ts +2 -0
- package/lib/types/elements/adw-toolbar-view.d.ts +8 -0
- package/lib/types/elements/modal-surface.d.ts +59 -0
- package/lib/types/elements/roving-focus.d.ts +26 -0
- package/lib/types/elements/row-activation.d.ts +26 -0
- package/lib/types/empty-sections.d.ts +15 -0
- package/lib/types/empty-sections.spec.d.ts +1 -0
- package/lib/types/fonts.d.ts +1 -0
- package/lib/types/icon-registry.d.ts +35 -0
- package/lib/types/icon-registry.spec.d.ts +18 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/keyboard-operable.spec.d.ts +1 -0
- package/lib/types/scroll-shading.d.ts +56 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +10 -6
- package/scss/_banner.scss +1 -1
- package/scss/_carousel.scss +15 -1
- package/scss/_checks.scss +8 -8
- package/scss/_combo_row.scss +1 -1
- package/scss/_drop_down.scss +1 -1
- package/scss/_expander_row.scss +1 -1
- package/scss/_headerbar.scss +35 -6
- package/scss/_icon.scss +47 -0
- package/scss/_icons.generated.scss +36 -6
- package/scss/_password_entry_row.scss +1 -1
- package/scss/_preferences_dialog.scss +3 -2
- package/scss/_progress_bar.scss +1 -1
- package/scss/_row.scss +1 -1
- package/scss/_scrolling.scss +107 -0
- package/scss/_status_page.scss +1 -1
- package/scss/_style_classes.scss +21 -8
- package/scss/_tab_view.scss +1 -1
- package/scss/_theme.scss +1 -0
- package/scss/_toast.scss +6 -24
- package/scss/_toolbar_view.scss +52 -22
- package/scss/_variables.scss +30 -3
- package/scss/_view_switcher.scss +80 -20
- package/scss/adwaita-skin.scss +1 -0
- package/src/adw-action-rows.spec.ts +21 -9
- package/src/adw-button-content.spec.ts +11 -6
- package/src/adw-carousel.spec.ts +141 -1
- package/src/adw-fonts.spec.ts +188 -0
- package/src/adw-header-bar.spec.ts +92 -0
- package/src/adw-icon.spec.ts +17 -8
- package/src/adw-row-state.spec.ts +11 -1
- package/src/adw-tab-view.spec.ts +151 -0
- package/src/bottom-sheet.spec.ts +87 -0
- package/src/breakpoints.ts +18 -4
- package/src/chrome.spec.ts +233 -0
- package/src/connect-lifecycle.spec.ts +351 -0
- package/src/elements/adw-about-dialog.ts +24 -18
- package/src/elements/adw-action-row.ts +14 -2
- package/src/elements/adw-alert-dialog.ts +39 -20
- package/src/elements/adw-button-row.ts +3 -0
- package/src/elements/adw-carousel.ts +121 -4
- package/src/elements/adw-clamp.ts +3 -2
- package/src/elements/adw-data-grid.ts +5 -2
- package/src/elements/adw-dialog.ts +16 -63
- package/src/elements/adw-expander-row.ts +18 -4
- package/src/elements/adw-header-bar.ts +2 -0
- package/src/elements/adw-icon.ts +32 -6
- package/src/elements/adw-inline-view-switcher.ts +12 -0
- package/src/elements/adw-menu-button.ts +17 -10
- package/src/elements/adw-navigation-split-view.ts +30 -7
- package/src/elements/adw-overlay-split-view.ts +15 -3
- package/src/elements/adw-popover.ts +11 -0
- package/src/elements/adw-preferences-dialog.ts +18 -16
- package/src/elements/adw-preferences-group.ts +7 -0
- package/src/elements/adw-sidebar.ts +15 -0
- package/src/elements/adw-status-page.ts +12 -4
- package/src/elements/adw-switch-row.ts +7 -0
- package/src/elements/adw-switch.ts +19 -1
- package/src/elements/adw-tab-view.ts +70 -7
- package/src/elements/adw-toast-overlay.ts +8 -1
- package/src/elements/adw-toggle-group.ts +94 -2
- package/src/elements/adw-toolbar-view.ts +28 -2
- package/src/elements/adw-view-switcher-bar.ts +18 -0
- package/src/elements/adw-view-switcher.ts +14 -0
- package/src/elements/modal-surface.ts +180 -0
- package/src/elements/roving-focus.ts +154 -0
- package/src/elements/row-activation.ts +92 -0
- package/src/empty-sections.spec.ts +81 -0
- package/src/empty-sections.ts +54 -0
- package/src/fonts.ts +25 -0
- package/src/icon-registry.spec.ts +240 -0
- package/src/icon-registry.ts +157 -0
- package/src/index.ts +30 -1
- package/src/keyboard-operable.spec.ts +755 -0
- package/src/scroll-shading.ts +255 -0
- package/src/source-view/theme.ts +15 -3
- package/src/split-button.spec.ts +6 -2
- package/src/style-classes.spec.ts +6 -0
- package/src/styles.generated.ts +1 -1
- package/src/test.browser.mts +14 -0
- package/src/view-switcher.spec.ts +149 -0
package/src/test.browser.mts
CHANGED
|
@@ -39,6 +39,7 @@ import { AdwButtonTest } from './adw-button.spec.js';
|
|
|
39
39
|
import { AdwBannerTest } from './adw-banner.spec.js';
|
|
40
40
|
import { AdwButtonContentTest } from './adw-button-content.spec.js';
|
|
41
41
|
import { AdwIconTest } from './adw-icon.spec.js';
|
|
42
|
+
import { AdwIconRegistryTest } from './icon-registry.spec.js';
|
|
42
43
|
import { AdwSwitchTest } from './adw-switch.spec.js';
|
|
43
44
|
import { AdwChecksTest } from './adw-checks.spec.js';
|
|
44
45
|
import { AdwProgressBarTest } from './adw-progress-bar.spec.js';
|
|
@@ -46,8 +47,15 @@ import { AdwAboutDialogTest } from './adw-about-dialog.spec.js';
|
|
|
46
47
|
import { AdwStyleClassesTest } from './style-classes.spec.js';
|
|
47
48
|
import { AdwAccentTest } from './adw-accent.spec.js';
|
|
48
49
|
import { AdwShortcutLabelTest } from './adw-shortcut-label.spec.js';
|
|
50
|
+
import { AdwConnectLifecycleTest } from './connect-lifecycle.spec.js';
|
|
51
|
+
import { AdwEmptySectionsTest } from './empty-sections.spec.js';
|
|
52
|
+
import { AdwKeyboardOperableTest } from './keyboard-operable.spec.js';
|
|
53
|
+
import { AdwFontsTest } from './adw-fonts.spec.js';
|
|
49
54
|
|
|
50
55
|
run({
|
|
56
|
+
AdwKeyboardOperableTest,
|
|
57
|
+
AdwConnectLifecycleTest,
|
|
58
|
+
AdwEmptySectionsTest,
|
|
51
59
|
AdwStyleClassesTest,
|
|
52
60
|
AdwAccentTest,
|
|
53
61
|
AdwShortcutLabelTest,
|
|
@@ -55,6 +63,7 @@ run({
|
|
|
55
63
|
AdwBannerTest,
|
|
56
64
|
AdwButtonContentTest,
|
|
57
65
|
AdwIconTest,
|
|
66
|
+
AdwIconRegistryTest,
|
|
58
67
|
AdwSwitchTest,
|
|
59
68
|
AdwChecksTest,
|
|
60
69
|
AdwProgressBarTest,
|
|
@@ -88,4 +97,9 @@ run({
|
|
|
88
97
|
AdwSidebarTest,
|
|
89
98
|
AdwEntryRowsTest,
|
|
90
99
|
AdwSplitButtonTest,
|
|
100
|
+
// Last, because it registers real webfaces in `document.fonts` and that
|
|
101
|
+
// changes text metrics for the whole document. Defence in depth only: the
|
|
102
|
+
// suite removes them in a `finally`, so appending a suite after this line
|
|
103
|
+
// cannot break it — see `adw-fonts.spec.ts`.
|
|
104
|
+
AdwFontsTest,
|
|
91
105
|
});
|
|
@@ -634,4 +634,153 @@ export const AdwViewSwitcherTest = async () => {
|
|
|
634
634
|
to.remove();
|
|
635
635
|
});
|
|
636
636
|
});
|
|
637
|
+
|
|
638
|
+
// The chrome around the row, which had drifted from the C source in four places
|
|
639
|
+
// at once. Computed-style assertions, because every one of them is invisible to
|
|
640
|
+
// the DOM conformance vectors above: those check WHAT is rendered, this checks
|
|
641
|
+
// what it looks like.
|
|
642
|
+
await describe('adw-view-switcher chrome (libadwaita _view-switcher.scss)', async () => {
|
|
643
|
+
const CHROME_PAGES = [
|
|
644
|
+
{ name: 'inbox', title: 'Inbox', iconName: 'mail-unread-symbolic', visible: true },
|
|
645
|
+
{ name: 'starred', title: 'Starred', iconName: 'starred-symbolic', visible: true },
|
|
646
|
+
{ name: 'archive', title: 'Archive of everything ever kept', iconName: 'folder-symbolic', visible: true },
|
|
647
|
+
] as ViewSwitcherVectorPage[];
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* The computed value of `expr` evaluated with `color` as currentColor.
|
|
651
|
+
* Comparing two COMPUTED strings keeps the assertion independent of how the
|
|
652
|
+
* engine serialises a `color-mix`, so it checks the ratio and not a spelling.
|
|
653
|
+
*/
|
|
654
|
+
function resolveAgainst(expr: string, color: string): string {
|
|
655
|
+
const probe = document.createElement('div');
|
|
656
|
+
probe.style.color = color;
|
|
657
|
+
probe.style.backgroundColor = expr;
|
|
658
|
+
document.body.appendChild(probe);
|
|
659
|
+
const value = getComputedStyle(probe).backgroundColor;
|
|
660
|
+
probe.remove();
|
|
661
|
+
return value;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
await it('draws no card around the content: libadwaita frames the stack with nothing', () => {
|
|
665
|
+
const { element, host } = mountSwitcher(CHROME_PAGES, 'wide');
|
|
666
|
+
const content = element.querySelector('.adw-view-switcher-content') as HTMLElement;
|
|
667
|
+
const style = getComputedStyle(content);
|
|
668
|
+
|
|
669
|
+
// adw-view-switcher.c:41-73 puts the bare AdwViewStack in
|
|
670
|
+
// AdwToolbarView:content, and nothing in _view-switcher.scss,
|
|
671
|
+
// _toolbars.scss or _views.scss gives that stack a border, a radius, a
|
|
672
|
+
// margin or padding.
|
|
673
|
+
const borders = [
|
|
674
|
+
style.borderTopWidth,
|
|
675
|
+
style.borderRightWidth,
|
|
676
|
+
style.borderBottomWidth,
|
|
677
|
+
style.borderLeftWidth,
|
|
678
|
+
];
|
|
679
|
+
for (const width of borders) expect(width).toBe('0px');
|
|
680
|
+
expect(style.borderTopLeftRadius).toBe('0px');
|
|
681
|
+
expect(style.borderTopRightRadius).toBe('0px');
|
|
682
|
+
expect(style.marginTop).toBe('0px');
|
|
683
|
+
expect(style.paddingTop).toBe('0px');
|
|
684
|
+
expect(style.paddingLeft).toBe('0px');
|
|
685
|
+
// Transparent rather than `--view-bg-color`: the surface belongs to
|
|
686
|
+
// whatever holds the switcher, exactly as `adw-view-stack` leaves it.
|
|
687
|
+
expect(style.backgroundColor).toBe('rgba(0, 0, 0, 0)');
|
|
688
|
+
|
|
689
|
+
host.remove();
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
await it('hands the visible page the whole content rect, not just its own text height', () => {
|
|
693
|
+
// The other half of the card removal, and the half nothing else pins: with
|
|
694
|
+
// the frame gone the page still has to FILL what AdwViewStack allocates to
|
|
695
|
+
// its visible child, or a status page inside it top-aligns in a tall pane
|
|
696
|
+
// instead of centring. `.adw-view-stack-child` in `_view_stack.scss` is the
|
|
697
|
+
// same four declarations for the standalone element.
|
|
698
|
+
const { element, host } = mountSwitcher(CHROME_PAGES, 'wide');
|
|
699
|
+
host.style.height = '400px';
|
|
700
|
+
element.style.height = '100%';
|
|
701
|
+
|
|
702
|
+
const content = element.querySelector('.adw-view-switcher-content') as HTMLElement;
|
|
703
|
+
const page = element.querySelector('.adw-view-switcher-page.active-view') as HTMLElement;
|
|
704
|
+
expect(getComputedStyle(page).display).toBe('flex');
|
|
705
|
+
expect(Math.round(page.getBoundingClientRect().height)).toBe(
|
|
706
|
+
Math.round(content.getBoundingClientRect().height),
|
|
707
|
+
);
|
|
708
|
+
|
|
709
|
+
host.remove();
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
await it('fills the selected tab with the flat :checked shade, not the pressed one', () => {
|
|
713
|
+
const { element, host } = mountSwitcher(CHROME_PAGES, 'wide');
|
|
714
|
+
const buttons = buttonsOf(element, '.adw-view-switcher-button');
|
|
715
|
+
const selected = buttons[0];
|
|
716
|
+
const unselected = buttons[1];
|
|
717
|
+
|
|
718
|
+
expect(selected.classList.contains('active')).toBe(true);
|
|
719
|
+
|
|
720
|
+
// %button_basic_flat:checked is `$selected_color`, currentColor at 10%
|
|
721
|
+
// (_buttons.scss:259 over _colors.scss:270). 19% is
|
|
722
|
+
// `$selected_active_color`, which belongs to the selected tab while it
|
|
723
|
+
// is HELD DOWN, and is what this used to paint at rest.
|
|
724
|
+
const foreground = getComputedStyle(selected).color;
|
|
725
|
+
expect(getComputedStyle(selected).backgroundColor).toBe(
|
|
726
|
+
resolveAgainst('color-mix(in srgb, currentColor 10%, transparent)', foreground),
|
|
727
|
+
);
|
|
728
|
+
expect(getComputedStyle(selected).backgroundColor).not.toBe(
|
|
729
|
+
resolveAgainst('color-mix(in srgb, currentColor 19%, transparent)', foreground),
|
|
730
|
+
);
|
|
731
|
+
// An unselected tab stays transparent until it is hovered.
|
|
732
|
+
expect(getComputedStyle(unselected).backgroundColor).toBe('rgba(0, 0, 0, 0)');
|
|
733
|
+
|
|
734
|
+
host.remove();
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
await it('keeps every tab the same width however long one title is', () => {
|
|
738
|
+
const { element, host } = mountSwitcher(CHROME_PAGES, 'wide');
|
|
739
|
+
// Narrow enough that the long title cannot fit. GTK's homogeneous box
|
|
740
|
+
// (adw-view-switcher.c:475) still hands out equal widths there and lets
|
|
741
|
+
// the label ellipsize (adw-view-switcher-button.ui:42).
|
|
742
|
+
host.style.width = '240px';
|
|
743
|
+
const widths = buttonsOf(element, '.adw-view-switcher-button').map((button) =>
|
|
744
|
+
Math.round(button.getBoundingClientRect().width),
|
|
745
|
+
);
|
|
746
|
+
|
|
747
|
+
expect(widths.length).toBe(3);
|
|
748
|
+
for (const width of widths) expect(width).toBe(widths[0]);
|
|
749
|
+
// And the row must not have burst its container to manage it.
|
|
750
|
+
const bar = element.querySelector('.adw-view-switcher-bar') as HTMLElement;
|
|
751
|
+
expect(Math.round(bar.getBoundingClientRect().width) <= 240).toBe(true);
|
|
752
|
+
|
|
753
|
+
host.remove();
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
await it('gives a narrow tab the upstream padding, not the wide policy leftovers', () => {
|
|
757
|
+
const { element, host } = mountSwitcher(CHROME_PAGES, 'narrow');
|
|
758
|
+
const button = buttonsOf(element, '.adw-view-switcher-button')[0];
|
|
759
|
+
const style = getComputedStyle(button);
|
|
760
|
+
|
|
761
|
+
// _view-switcher.scss:15-24: 4px above on the box, 3px per side and 2px
|
|
762
|
+
// below on the label. Never the wide policy's 12px sides.
|
|
763
|
+
expect(style.paddingTop).toBe('4px');
|
|
764
|
+
expect(style.paddingBottom).toBe('2px');
|
|
765
|
+
expect(style.paddingLeft).toBe('3px');
|
|
766
|
+
expect(style.paddingRight).toBe('3px');
|
|
767
|
+
|
|
768
|
+
host.remove();
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
await it('spaces the row and the wide tab the way border-spacing does', () => {
|
|
772
|
+
// The two values that were already right, locked so the fixes above
|
|
773
|
+
// cannot drift them: `border-spacing: 3px` plus `min-height: 34px` on the
|
|
774
|
+
// switcher node (_view-switcher.scss:2-3) and 6px inside a wide tab
|
|
775
|
+
// (line 29).
|
|
776
|
+
const { element, host } = mountSwitcher(CHROME_PAGES, 'wide');
|
|
777
|
+
const bar = element.querySelector('.adw-view-switcher-bar') as HTMLElement;
|
|
778
|
+
expect(getComputedStyle(bar).columnGap).toBe('3px');
|
|
779
|
+
expect(getComputedStyle(bar).minHeight).toBe('34px');
|
|
780
|
+
const button = buttonsOf(element, '.adw-view-switcher-button')[0];
|
|
781
|
+
expect(getComputedStyle(button).columnGap).toBe('6px');
|
|
782
|
+
|
|
783
|
+
host.remove();
|
|
784
|
+
});
|
|
785
|
+
});
|
|
637
786
|
};
|