@gjsify/adwaita-web 0.55.0 → 0.56.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 (71) hide show
  1. package/README.md +8 -0
  2. package/dist/adwaita-web.css +129 -27
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/adw-status-page.spec.d.ts +1 -0
  5. package/lib/types/attributes.d.ts +19 -0
  6. package/lib/types/elements/adw-action-row.d.ts +4 -0
  7. package/lib/types/elements/adw-combo-row.d.ts +4 -0
  8. package/lib/types/elements/adw-entry-row.d.ts +6 -0
  9. package/lib/types/elements/adw-expander-row.d.ts +2 -0
  10. package/lib/types/elements/adw-header-bar.d.ts +6 -0
  11. package/lib/types/elements/adw-overlay-split-view.d.ts +13 -0
  12. package/lib/types/elements/adw-sidebar.d.ts +3 -2
  13. package/lib/types/elements/adw-spin-row.d.ts +6 -0
  14. package/lib/types/elements/adw-switch-row.d.ts +4 -0
  15. package/lib/types/elements/adw-toggle-group.d.ts +17 -0
  16. package/lib/types/elements/gtk-scrolled-window.d.ts +10 -2
  17. package/lib/types/elements/gtk-window.d.ts +8 -2
  18. package/lib/types/index.d.ts +1 -1
  19. package/lib/types/row-line-clamp.d.ts +20 -0
  20. package/lib/types/row-tooltip.d.ts +8 -0
  21. package/lib/types/row-tooltip.spec.d.ts +1 -0
  22. package/lib/types/shared-tree-builder.d.ts +49 -19
  23. package/lib/types/shared-tree-mount.spec.d.ts +1 -0
  24. package/lib/types/styles.generated.d.ts +1 -1
  25. package/lib/types/widget-size.spec.d.ts +1 -0
  26. package/package.json +8 -8
  27. package/scss/_action_row.scss +39 -15
  28. package/scss/_button_row.scss +5 -0
  29. package/scss/_expander_row.scss +36 -3
  30. package/scss/_headerbar.scss +2 -1
  31. package/scss/_preferences_row.scss +9 -0
  32. package/scss/_row.scss +16 -0
  33. package/scss/_status_page.scss +1 -1
  34. package/scss/_toggle_group.scss +28 -0
  35. package/scss/_widget.scss +14 -3
  36. package/scss/_window.scss +13 -1
  37. package/src/adw-action-rows.spec.ts +255 -0
  38. package/src/adw-header-bar.spec.ts +18 -0
  39. package/src/adw-status-page.spec.ts +124 -0
  40. package/src/attributes.ts +52 -0
  41. package/src/capabilities.mjs +3 -0
  42. package/src/construct-vectors.spec.ts +1 -1
  43. package/src/elements/adw-action-row.ts +31 -2
  44. package/src/elements/adw-alert-dialog.ts +4 -1
  45. package/src/elements/adw-button-row.ts +7 -1
  46. package/src/elements/adw-combo-row.ts +26 -1
  47. package/src/elements/adw-entry-row.ts +22 -12
  48. package/src/elements/adw-expander-row.ts +34 -1
  49. package/src/elements/adw-header-bar.ts +18 -4
  50. package/src/elements/adw-overlay-split-view.ts +29 -6
  51. package/src/elements/adw-preferences-row.ts +5 -2
  52. package/src/elements/adw-sidebar.ts +33 -5
  53. package/src/elements/adw-spin-row.ts +37 -2
  54. package/src/elements/adw-status-page.ts +10 -2
  55. package/src/elements/adw-switch-row.ts +25 -1
  56. package/src/elements/adw-toggle-group.ts +119 -10
  57. package/src/elements/adw-window.ts +9 -4
  58. package/src/elements/gtk-scrolled-window.ts +18 -7
  59. package/src/elements/gtk-window.ts +9 -3
  60. package/src/gtk-window.spec.ts +12 -0
  61. package/src/index.ts +1 -1
  62. package/src/keyboard-operable.spec.ts +47 -11
  63. package/src/row-line-clamp.ts +74 -0
  64. package/src/row-tooltip.spec.ts +313 -0
  65. package/src/row-tooltip.ts +52 -0
  66. package/src/shared-tree-builder.ts +88 -35
  67. package/src/shared-tree-mount.spec.ts +130 -0
  68. package/src/shared-trees.spec.ts +15 -0
  69. package/src/styles.generated.ts +1 -1
  70. package/src/test.browser.mts +8 -0
  71. package/src/widget-size.spec.ts +117 -0
@@ -37,6 +37,7 @@ import { GtkDrawingAreaTest } from './gtk-drawing-area.spec.js';
37
37
  import { GtkGLAreaTest } from './gtk-gl-area.spec.js';
38
38
  import { GtkGraphicsOffloadTest } from './gtk-graphics-offload.spec.js';
39
39
  import { AdwRowStateTest } from './adw-row-state.spec.js';
40
+ import { AdwRowTooltipTest } from './row-tooltip.spec.js';
40
41
  import { AdwTabViewTest } from './adw-tab-view.spec.js';
41
42
  import { AdwToastOverlayTest } from './adw-toast-overlay.spec.js';
42
43
  import { AdwViewSwitcherBarTest } from './adw-view-switcher-bar.spec.js';
@@ -126,6 +127,7 @@ import { GtkInscriptionTest } from './gtk-inscription.spec.js';
126
127
  import { GtkVideoTest } from './gtk-video.spec.js';
127
128
  import { GtkMediaControlsTest } from './gtk-media-controls.spec.js';
128
129
  import { AdwAboutDialogTest } from './adw-about-dialog.spec.js';
130
+ import { AdwStatusPageTest } from './adw-status-page.spec.js';
129
131
  import { AdwStyleClassesTest } from './style-classes.spec.js';
130
132
  import { AdwAccentTest } from './adw-accent.spec.js';
131
133
  import { AdwAppearanceTest } from './adw-appearance.spec.js';
@@ -140,6 +142,8 @@ import { AdwSharedTreesTest } from './shared-trees.spec.js';
140
142
  import { AdwBlueprintTreeTest } from './blueprint-tree.spec.js';
141
143
  import { AdwValueListsTest } from './value-lists.spec.js';
142
144
  import { AdwBlueprintLayoutTest } from './blueprint-layout.spec.js';
145
+ import { AdwWidgetSizeTest } from './widget-size.spec.js';
146
+ import { AdwSharedTreeMountTest } from './shared-tree-mount.spec.js';
143
147
  import { AdwBlueprintMarkupTest } from './blueprint-markup.spec.js';
144
148
  import { AdwTagsTest } from './tags.spec.js';
145
149
  import { AdwFontStackTest } from './font-stack.spec.js';
@@ -150,12 +154,15 @@ run({
150
154
  AdwBlueprintTreeTest,
151
155
  AdwValueListsTest,
152
156
  AdwBlueprintLayoutTest,
157
+ AdwWidgetSizeTest,
158
+ AdwSharedTreeMountTest,
153
159
  AdwBlueprintMarkupTest,
154
160
  AdwTagsTest,
155
161
  AdwKeyboardOperableTest,
156
162
  AdwConnectLifecycleTest,
157
163
  AdwEmptySectionsTest,
158
164
  AdwSlottedChildrenTest,
165
+ AdwStatusPageTest,
159
166
  AdwStyleClassesTest,
160
167
  AdwAccentTest,
161
168
  AdwAppearanceTest,
@@ -252,6 +259,7 @@ run({
252
259
  AdwApplicationWindowTest,
253
260
  GtkDropDownTest,
254
261
  AdwRowStateTest,
262
+ AdwRowTooltipTest,
255
263
  AdwTabViewTest,
256
264
  AdwToastOverlayTest,
257
265
  AdwViewSwitcherBarTest,
@@ -0,0 +1,117 @@
1
+ // `width-request`, `height-request` AND AN AUTHORED `hexpand: false`, LAID OUT.
2
+ //
3
+ // The three-loader-ldraw sidebar is `Gtk.ScrolledWindow { width-request: 320; hexpand: false }`
4
+ // beside an expanding canvas. Nothing read either property, so a scrolled window (which is
5
+ // `flex: 1 1 0%`) and its sibling split the row in half and the sidebar came out ~50% wide
6
+ // where GTK gives it 320px. The assertions are the laid-out geometry, never the attribute.
7
+
8
+ import { describe, expect, it } from '@gjsify/unit';
9
+ import type { SharedTreeNode } from '@gjsify/adwaita-core/conformance';
10
+
11
+ import { mountSharedTree, writeProp } from './shared-tree-builder.js';
12
+
13
+ /** A row of 800px: a scrolled window carrying `sidebarProps`, and a box that expands. */
14
+ function mountRow(sidebarProps: NonNullable<SharedTreeNode['props']>) {
15
+ const tree: SharedTreeNode = {
16
+ tag: 'GtkBox',
17
+ props: { orientation: 'horizontal' },
18
+ children: [
19
+ {
20
+ tag: 'GtkScrolledWindow',
21
+ id: 'sidebar',
22
+ props: { 'hscrollbar-policy': 'never', ...sidebarProps },
23
+ children: [{ tag: 'GtkBox', props: { orientation: 'vertical' } }],
24
+ },
25
+ { tag: 'GtkBox', id: 'content', props: { hexpand: true } },
26
+ ],
27
+ };
28
+ const mounted = mountSharedTree(tree);
29
+ mounted.root.style.width = '800px';
30
+ mounted.root.style.height = '300px';
31
+ const byId = (id: string) => mounted.root.querySelector(`#${id}`) as HTMLElement;
32
+ return { ...mounted, byId };
33
+ }
34
+
35
+ export const AdwWidgetSizeTest = async () => {
36
+ await describe('adwaita-web: width-request and an authored hexpand: false', async () => {
37
+ await it('a scrolled window with width-request 320 and hexpand false is 320px wide', async () => {
38
+ const { unmount, byId } = mountRow({ 'width-request': 320, hexpand: false });
39
+ try {
40
+ expect(byId('sidebar').getBoundingClientRect().width).toBe(320);
41
+ expect(byId('content').getBoundingClientRect().width).toBe(480);
42
+ } finally {
43
+ unmount();
44
+ }
45
+ });
46
+
47
+ await it('without the authored false the scrolled window still shares the row', async () => {
48
+ const { unmount, byId } = mountRow({ 'width-request': 320 });
49
+ try {
50
+ expect(byId('sidebar').getBoundingClientRect().width).toBe(400);
51
+ } finally {
52
+ unmount();
53
+ }
54
+ });
55
+
56
+ await it('width-request is a minimum: a wider natural size wins', async () => {
57
+ const tree: SharedTreeNode = {
58
+ tag: 'GtkBox',
59
+ props: { orientation: 'horizontal', 'width-request': 100, 'height-request': 40 },
60
+ children: [{ tag: 'GtkBox', id: 'wide', props: { 'width-request': 600 } }],
61
+ };
62
+ const { root, unmount } = mountSharedTree(tree);
63
+ try {
64
+ const style = getComputedStyle(root);
65
+ expect(`${style.minWidth} ${style.minHeight}`).toBe('100px 40px');
66
+ expect(getComputedStyle(root.querySelector('#wide') as Element).minWidth).toBe('600px');
67
+ } finally {
68
+ unmount();
69
+ }
70
+ });
71
+
72
+ await it('-1 is "not set", and clears a request written earlier', async () => {
73
+ const { root, unmount } = mountSharedTree({ tag: 'GtkBox', props: { 'width-request': -1 } });
74
+ try {
75
+ expect(root.style.minWidth).toBe('');
76
+ writeProp(root, 'width-request', 200);
77
+ expect(root.style.minWidth).toBe('200px');
78
+ writeProp(root, 'width-request', -1);
79
+ expect(root.style.minWidth).toBe('');
80
+ } finally {
81
+ unmount();
82
+ }
83
+ });
84
+
85
+ await it('vexpand false stops a scrolled window growing down a vertical box', async () => {
86
+ const tree: SharedTreeNode = {
87
+ tag: 'GtkBox',
88
+ props: { orientation: 'vertical' },
89
+ children: [
90
+ { tag: 'GtkScrolledWindow', id: 'top', props: { 'height-request': 100, vexpand: false } },
91
+ { tag: 'GtkBox', id: 'rest', props: { vexpand: true } },
92
+ ],
93
+ };
94
+ const { root, unmount } = mountSharedTree(tree);
95
+ try {
96
+ root.style.width = '300px';
97
+ root.style.height = '400px';
98
+ expect((root.querySelector('#top') as HTMLElement).getBoundingClientRect().height).toBe(100);
99
+ } finally {
100
+ unmount();
101
+ }
102
+ });
103
+
104
+ await it('a later hexpand true takes over from an authored false', async () => {
105
+ const { unmount, byId } = mountRow({ 'width-request': 320, hexpand: false });
106
+ try {
107
+ const sidebar = byId('sidebar');
108
+ expect(sidebar.getAttribute('hexpand')).toBe('false');
109
+ writeProp(sidebar, 'hexpand', true);
110
+ expect(sidebar.getAttribute('hexpand')).toBe('');
111
+ expect(sidebar.getBoundingClientRect().width).toBe(400);
112
+ } finally {
113
+ unmount();
114
+ }
115
+ });
116
+ });
117
+ };