@gjsify/adwaita-web 0.55.0 → 0.57.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 +8 -0
- package/dist/adwaita-web.css +137 -29
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/adw-status-page.spec.d.ts +1 -0
- package/lib/types/application.d.ts +24 -0
- package/lib/types/application.spec.d.ts +1 -0
- package/lib/types/attributes.d.ts +19 -0
- package/lib/types/elements/adw-action-row.d.ts +4 -0
- package/lib/types/elements/adw-application-window.d.ts +2 -0
- package/lib/types/elements/adw-combo-row.d.ts +4 -0
- package/lib/types/elements/adw-entry-row.d.ts +6 -0
- package/lib/types/elements/adw-expander-row.d.ts +2 -0
- package/lib/types/elements/adw-header-bar.d.ts +6 -0
- package/lib/types/elements/adw-overlay-split-view.d.ts +13 -0
- package/lib/types/elements/adw-sidebar.d.ts +3 -2
- package/lib/types/elements/adw-spin-row.d.ts +6 -0
- package/lib/types/elements/adw-switch-row.d.ts +4 -0
- package/lib/types/elements/adw-toggle-group.d.ts +17 -0
- package/lib/types/elements/adw-view-stack.d.ts +3 -0
- package/lib/types/elements/checks.d.ts +6 -0
- package/lib/types/elements/gtk-application-window.d.ts +2 -0
- package/lib/types/elements/gtk-drop-down.d.ts +3 -0
- package/lib/types/elements/gtk-entry.d.ts +10 -0
- package/lib/types/elements/gtk-menu-button.d.ts +2 -0
- package/lib/types/elements/gtk-scrolled-window.d.ts +26 -2
- package/lib/types/elements/gtk-stack.d.ts +3 -0
- package/lib/types/elements/gtk-switch.d.ts +3 -0
- package/lib/types/elements/gtk-window.d.ts +8 -2
- package/lib/types/glib.spec.d.ts +1 -0
- package/lib/types/gobject-door.d.ts +4 -0
- package/lib/types/gobject-door.spec.d.ts +1 -0
- package/lib/types/gobject-elements.d.ts +17 -0
- package/lib/types/gtksource/gtk-source-view.d.ts +77 -0
- package/lib/types/gtksource/gtk-source-view.spec.d.ts +2 -0
- package/lib/types/gtksource/web-editor-driver.d.ts +44 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/menu-actions.spec.d.ts +1 -0
- package/lib/types/namespace/adw.d.ts +1 -0
- package/lib/types/namespace/gio.d.ts +2 -0
- package/lib/types/namespace/glib.d.ts +10 -0
- package/lib/types/namespace/gobject.d.ts +27 -0
- package/lib/types/namespace/gtk-enums.d.ts +22 -0
- package/lib/types/namespace/gtk.d.ts +2 -0
- package/lib/types/namespace/gtksource.d.ts +2 -0
- package/lib/types/row-line-clamp.d.ts +20 -0
- package/lib/types/row-tooltip.d.ts +8 -0
- package/lib/types/row-tooltip.spec.d.ts +1 -0
- package/lib/types/shared-tree-builder.d.ts +69 -20
- package/lib/types/shared-tree-mount.spec.d.ts +1 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/lib/types/widget-size.spec.d.ts +1 -0
- package/package.json +11 -9
- package/scss/_action_row.scss +39 -15
- package/scss/_button_row.scss +5 -0
- package/scss/_expander_row.scss +36 -3
- package/scss/_headerbar.scss +2 -1
- package/scss/_preferences_row.scss +9 -0
- package/scss/_reset.scss +1 -1
- package/scss/_row.scss +16 -0
- package/scss/_status_page.scss +1 -1
- package/scss/_toggle_group.scss +28 -0
- package/scss/_widget.scss +14 -3
- package/scss/_window.scss +13 -1
- package/src/adw-action-rows.spec.ts +255 -0
- package/src/adw-header-bar.spec.ts +18 -0
- package/src/adw-status-page.spec.ts +124 -0
- package/src/application.spec.ts +75 -0
- package/src/application.ts +92 -0
- package/src/attributes.ts +52 -0
- package/src/capabilities.mjs +3 -0
- package/src/construct-vectors.spec.ts +156 -1
- package/src/elements/adw-action-row.ts +31 -2
- package/src/elements/adw-alert-dialog.ts +4 -1
- package/src/elements/adw-application-window.ts +5 -0
- package/src/elements/adw-button-row.ts +7 -1
- package/src/elements/adw-combo-row.ts +26 -1
- package/src/elements/adw-entry-row.ts +22 -12
- package/src/elements/adw-expander-row.ts +34 -1
- package/src/elements/adw-header-bar.ts +18 -4
- package/src/elements/adw-overlay-split-view.ts +29 -6
- package/src/elements/adw-preferences-row.ts +5 -2
- package/src/elements/adw-sidebar.ts +33 -5
- package/src/elements/adw-spin-row.ts +37 -2
- package/src/elements/adw-split-button.ts +5 -1
- package/src/elements/adw-status-page.ts +10 -2
- package/src/elements/adw-switch-row.ts +25 -1
- package/src/elements/adw-toggle-group.ts +119 -10
- package/src/elements/adw-view-stack.ts +14 -0
- package/src/elements/adw-window.ts +9 -4
- package/src/elements/checks.ts +25 -1
- package/src/elements/gtk-application-window.ts +5 -0
- package/src/elements/gtk-drop-down.ts +16 -0
- package/src/elements/gtk-entry.ts +45 -7
- package/src/elements/gtk-menu-button.ts +12 -1
- package/src/elements/gtk-popover-menu.ts +7 -2
- package/src/elements/gtk-scrolled-window.ts +76 -7
- package/src/elements/gtk-stack.ts +8 -0
- package/src/elements/gtk-switch.ts +8 -0
- package/src/elements/gtk-window.ts +9 -3
- package/src/glib.spec.ts +34 -0
- package/src/gobject-door.spec.ts +119 -0
- package/src/gobject-door.ts +137 -0
- package/src/gobject-elements.ts +172 -0
- package/src/gtk-window.spec.ts +12 -0
- package/src/gtksource/gtk-source-view.spec.ts +69 -0
- package/src/gtksource/gtk-source-view.ts +379 -0
- package/src/gtksource/web-editor-driver.ts +260 -0
- package/src/index.ts +11 -1
- package/src/keyboard-operable.spec.ts +47 -11
- package/src/menu-actions.spec.ts +47 -0
- package/src/namespace/adw.ts +1 -0
- package/src/namespace/gio.ts +2 -0
- package/src/namespace/glib.ts +22 -0
- package/src/namespace/gobject.ts +37 -0
- package/src/namespace/gtk-enums.ts +15 -0
- package/src/namespace/gtk.ts +2 -0
- package/src/namespace/gtksource.ts +9 -0
- package/src/row-line-clamp.ts +74 -0
- package/src/row-tooltip.spec.ts +313 -0
- package/src/row-tooltip.ts +52 -0
- package/src/shared-tree-builder.ts +230 -42
- package/src/shared-tree-mount.spec.ts +130 -0
- package/src/shared-trees.spec.ts +15 -0
- package/src/split-button.spec.ts +2 -0
- package/src/styles.generated.ts +1 -1
- package/src/test.browser.mts +18 -0
- package/src/widget-size.spec.ts +117 -0
package/src/test.browser.mts
CHANGED
|
@@ -26,6 +26,7 @@ import { AdwBreakpointsTest } from './breakpoints.spec.js';
|
|
|
26
26
|
import { AdwBreakpointBinTest } from './adw-breakpoint-bin.spec.js';
|
|
27
27
|
import { AdwMultiLayoutViewTest } from './adw-multi-layout-view.spec.js';
|
|
28
28
|
import { AdwDataGridTest } from './adw-data-grid.spec.js';
|
|
29
|
+
import { GtkSourceViewTest } from './gtksource/gtk-source-view.spec.js';
|
|
29
30
|
import { AdwDialogTest } from './adw-dialog.spec.js';
|
|
30
31
|
import { AdwWindowTest } from './adw-window.spec.js';
|
|
31
32
|
import { AdwShortcutsTest } from './adw-shortcuts.spec.js';
|
|
@@ -37,6 +38,7 @@ import { GtkDrawingAreaTest } from './gtk-drawing-area.spec.js';
|
|
|
37
38
|
import { GtkGLAreaTest } from './gtk-gl-area.spec.js';
|
|
38
39
|
import { GtkGraphicsOffloadTest } from './gtk-graphics-offload.spec.js';
|
|
39
40
|
import { AdwRowStateTest } from './adw-row-state.spec.js';
|
|
41
|
+
import { AdwRowTooltipTest } from './row-tooltip.spec.js';
|
|
40
42
|
import { AdwTabViewTest } from './adw-tab-view.spec.js';
|
|
41
43
|
import { AdwToastOverlayTest } from './adw-toast-overlay.spec.js';
|
|
42
44
|
import { AdwViewSwitcherBarTest } from './adw-view-switcher-bar.spec.js';
|
|
@@ -126,6 +128,7 @@ import { GtkInscriptionTest } from './gtk-inscription.spec.js';
|
|
|
126
128
|
import { GtkVideoTest } from './gtk-video.spec.js';
|
|
127
129
|
import { GtkMediaControlsTest } from './gtk-media-controls.spec.js';
|
|
128
130
|
import { AdwAboutDialogTest } from './adw-about-dialog.spec.js';
|
|
131
|
+
import { AdwStatusPageTest } from './adw-status-page.spec.js';
|
|
129
132
|
import { AdwStyleClassesTest } from './style-classes.spec.js';
|
|
130
133
|
import { AdwAccentTest } from './adw-accent.spec.js';
|
|
131
134
|
import { AdwAppearanceTest } from './adw-appearance.spec.js';
|
|
@@ -136,10 +139,16 @@ import { AdwSlottedChildrenTest } from './slotted-children.spec.js';
|
|
|
136
139
|
import { AdwKeyboardOperableTest } from './keyboard-operable.spec.js';
|
|
137
140
|
import { AdwFontsTest } from './adw-fonts.spec.js';
|
|
138
141
|
import { AdwConstructVectorsTest } from './construct-vectors.spec.js';
|
|
142
|
+
import { GObjectDoorTest } from './gobject-door.spec.js';
|
|
143
|
+
import { ApplicationTest } from './application.spec.js';
|
|
144
|
+
import { GLibTest } from './glib.spec.js';
|
|
145
|
+
import { MenuActionsTest } from './menu-actions.spec.js';
|
|
139
146
|
import { AdwSharedTreesTest } from './shared-trees.spec.js';
|
|
140
147
|
import { AdwBlueprintTreeTest } from './blueprint-tree.spec.js';
|
|
141
148
|
import { AdwValueListsTest } from './value-lists.spec.js';
|
|
142
149
|
import { AdwBlueprintLayoutTest } from './blueprint-layout.spec.js';
|
|
150
|
+
import { AdwWidgetSizeTest } from './widget-size.spec.js';
|
|
151
|
+
import { AdwSharedTreeMountTest } from './shared-tree-mount.spec.js';
|
|
143
152
|
import { AdwBlueprintMarkupTest } from './blueprint-markup.spec.js';
|
|
144
153
|
import { AdwTagsTest } from './tags.spec.js';
|
|
145
154
|
import { AdwFontStackTest } from './font-stack.spec.js';
|
|
@@ -147,15 +156,22 @@ import { AdwFontStackTest } from './font-stack.spec.js';
|
|
|
147
156
|
run({
|
|
148
157
|
AdwSharedTreesTest,
|
|
149
158
|
AdwConstructVectorsTest,
|
|
159
|
+
GObjectDoorTest,
|
|
160
|
+
ApplicationTest,
|
|
161
|
+
GLibTest,
|
|
162
|
+
MenuActionsTest,
|
|
150
163
|
AdwBlueprintTreeTest,
|
|
151
164
|
AdwValueListsTest,
|
|
152
165
|
AdwBlueprintLayoutTest,
|
|
166
|
+
AdwWidgetSizeTest,
|
|
167
|
+
AdwSharedTreeMountTest,
|
|
153
168
|
AdwBlueprintMarkupTest,
|
|
154
169
|
AdwTagsTest,
|
|
155
170
|
AdwKeyboardOperableTest,
|
|
156
171
|
AdwConnectLifecycleTest,
|
|
157
172
|
AdwEmptySectionsTest,
|
|
158
173
|
AdwSlottedChildrenTest,
|
|
174
|
+
AdwStatusPageTest,
|
|
159
175
|
AdwStyleClassesTest,
|
|
160
176
|
AdwAccentTest,
|
|
161
177
|
AdwAppearanceTest,
|
|
@@ -246,12 +262,14 @@ run({
|
|
|
246
262
|
AdwBreakpointBinTest,
|
|
247
263
|
AdwMultiLayoutViewTest,
|
|
248
264
|
AdwDataGridTest,
|
|
265
|
+
GtkSourceViewTest,
|
|
249
266
|
AdwDialogTest,
|
|
250
267
|
AdwWindowTest,
|
|
251
268
|
AdwShortcutsTest,
|
|
252
269
|
AdwApplicationWindowTest,
|
|
253
270
|
GtkDropDownTest,
|
|
254
271
|
AdwRowStateTest,
|
|
272
|
+
AdwRowTooltipTest,
|
|
255
273
|
AdwTabViewTest,
|
|
256
274
|
AdwToastOverlayTest,
|
|
257
275
|
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
|
+
};
|