@gjsify/adwaita-web 0.64.2-next.255 → 0.64.2
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 +57 -0
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +12 -13
- package/scss/_variables.scss +62 -0
- package/src/adw-accent.spec.ts +14 -0
- package/src/elements/gtk-popover-menu-bar.ts +2 -1
- package/src/elements/popover-menu.ts +4 -4
- package/src/gtk-popover-menu-bar.spec.ts +12 -0
- package/src/gtk-popover-menu.spec.ts +14 -1
- package/src/styles.generated.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-web",
|
|
3
|
-
"version": "0.64.2
|
|
3
|
+
"version": "0.64.2",
|
|
4
4
|
"description": "Adwaita/Libadwaita web components for browser targets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"@codemirror/language": "^6.12.4",
|
|
59
59
|
"@codemirror/state": "^6.7.0",
|
|
60
60
|
"@codemirror/view": "^6.43.4",
|
|
61
|
-
"@gjsify/adwaita-core": "0.64.2
|
|
62
|
-
"@gjsify/adwaita-fonts": "0.64.2
|
|
63
|
-
"@gjsify/adwaita-icons": "0.64.2
|
|
64
|
-
"@gjsify/gtksource-core": "0.64.2
|
|
61
|
+
"@gjsify/adwaita-core": "^0.64.2",
|
|
62
|
+
"@gjsify/adwaita-fonts": "^0.64.2",
|
|
63
|
+
"@gjsify/adwaita-icons": "^0.64.2",
|
|
64
|
+
"@gjsify/gtksource-core": "^0.64.2",
|
|
65
65
|
"@lezer/highlight": "^1.2.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@gjsify/app-settings": "0.64.2
|
|
68
|
+
"@gjsify/app-settings": "^0.64.2"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"@gjsify/app-settings": {
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@gjsify/app-settings": "0.64.2
|
|
77
|
-
"@gjsify/blueprint": "0.64.2
|
|
78
|
-
"@gjsify/cli": "0.64.2
|
|
79
|
-
"@gjsify/unit": "0.64.2
|
|
80
|
-
"@gjsify/vite-plugin-blueprint": "0.64.2
|
|
76
|
+
"@gjsify/app-settings": "^0.64.2",
|
|
77
|
+
"@gjsify/blueprint": "^0.64.2",
|
|
78
|
+
"@gjsify/cli": "^0.64.2",
|
|
79
|
+
"@gjsify/unit": "^0.64.2",
|
|
80
|
+
"@gjsify/vite-plugin-blueprint": "^0.64.2",
|
|
81
81
|
"sass": "^1.101.0",
|
|
82
82
|
"typescript": "^6.0.3"
|
|
83
83
|
},
|
|
@@ -114,6 +114,5 @@
|
|
|
114
114
|
"bugs": {
|
|
115
115
|
"url": "https://github.com/gjsify/gjsify/issues"
|
|
116
116
|
},
|
|
117
|
-
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/web/adwaita-web#readme"
|
|
118
|
-
"gitHead": "6c88ac780b9742fce781e9b35aa2f45c125d8064"
|
|
117
|
+
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/web/adwaita-web#readme"
|
|
119
118
|
}
|
package/scss/_variables.scss
CHANGED
|
@@ -227,6 +227,68 @@
|
|
|
227
227
|
@include light-theme;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
// The named palette, outside the mixin because it does not follow the scheme:
|
|
231
|
+
// libadwaita declares both blocks once on `:root` (`_palette.scss`, `_colors.scss`),
|
|
232
|
+
// and an app's own stylesheet names them (`background-color: var(--accent-teal)`).
|
|
233
|
+
// Values read from libadwaita 1.9's compiled `gtk.css`.
|
|
234
|
+
:root {
|
|
235
|
+
--accent-blue: #3584e4;
|
|
236
|
+
--accent-teal: #2190a4;
|
|
237
|
+
--accent-green: #3a944a;
|
|
238
|
+
--accent-yellow: #c88800;
|
|
239
|
+
--accent-orange: #ed5b00;
|
|
240
|
+
--accent-red: #e62d42;
|
|
241
|
+
--accent-pink: #d56199;
|
|
242
|
+
--accent-purple: #9141ac;
|
|
243
|
+
--accent-slate: #6f8396;
|
|
244
|
+
|
|
245
|
+
--blue-1: #99c1f1;
|
|
246
|
+
--blue-2: #62a0ea;
|
|
247
|
+
--blue-3: #3584e4;
|
|
248
|
+
--blue-4: #1c71d8;
|
|
249
|
+
--blue-5: #1a5fb4;
|
|
250
|
+
--green-1: #8ff0a4;
|
|
251
|
+
--green-2: #57e389;
|
|
252
|
+
--green-3: #33d17a;
|
|
253
|
+
--green-4: #2ec27e;
|
|
254
|
+
--green-5: #26a269;
|
|
255
|
+
--yellow-1: #f9f06b;
|
|
256
|
+
--yellow-2: #f8e45c;
|
|
257
|
+
--yellow-3: #f6d32d;
|
|
258
|
+
--yellow-4: #f5c211;
|
|
259
|
+
--yellow-5: #e5a50a;
|
|
260
|
+
--orange-1: #ffbe6f;
|
|
261
|
+
--orange-2: #ffa348;
|
|
262
|
+
--orange-3: #ff7800;
|
|
263
|
+
--orange-4: #e66100;
|
|
264
|
+
--orange-5: #c64600;
|
|
265
|
+
--red-1: #f66151;
|
|
266
|
+
--red-2: #ed333b;
|
|
267
|
+
--red-3: #e01b24;
|
|
268
|
+
--red-4: #c01c28;
|
|
269
|
+
--red-5: #a51d2d;
|
|
270
|
+
--purple-1: #dc8add;
|
|
271
|
+
--purple-2: #c061cb;
|
|
272
|
+
--purple-3: #9141ac;
|
|
273
|
+
--purple-4: #813d9c;
|
|
274
|
+
--purple-5: #613583;
|
|
275
|
+
--brown-1: #cdab8f;
|
|
276
|
+
--brown-2: #b5835a;
|
|
277
|
+
--brown-3: #986a44;
|
|
278
|
+
--brown-4: #865e3c;
|
|
279
|
+
--brown-5: #63452c;
|
|
280
|
+
--light-1: #ffffff;
|
|
281
|
+
--light-2: #f6f5f4;
|
|
282
|
+
--light-3: #deddda;
|
|
283
|
+
--light-4: #c0bfbc;
|
|
284
|
+
--light-5: #9a9996;
|
|
285
|
+
--dark-1: #77767b;
|
|
286
|
+
--dark-2: #5e5c64;
|
|
287
|
+
--dark-3: #3d3846;
|
|
288
|
+
--dark-4: #241f31;
|
|
289
|
+
--dark-5: #000000;
|
|
290
|
+
}
|
|
291
|
+
|
|
230
292
|
// High contrast moves the three opacity tokens, and only those — every colour
|
|
231
293
|
// that reads them follows without its own query (_colors.scss:325-329).
|
|
232
294
|
@media (prefers-contrast: more) {
|
package/src/adw-accent.spec.ts
CHANGED
|
@@ -54,6 +54,20 @@ export const AdwAccentTest = async () => {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
await describe('the named accent palette (`--accent-<name>` on :root)', async () => {
|
|
58
|
+
for (const vector of ACCENT_COLOR_VECTORS) {
|
|
59
|
+
await it(`--accent-${vector.name} is the accent's background, in both schemes`, async () => {
|
|
60
|
+
for (const scheme of ['theme-light', 'theme-dark']) {
|
|
61
|
+
const host = document.createElement('div');
|
|
62
|
+
host.className = scheme;
|
|
63
|
+
document.body.append(host);
|
|
64
|
+
expect(property(host, `--accent-${vector.name}`)).toBe(vector.background);
|
|
65
|
+
host.remove();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
57
71
|
await describe('accent application', async () => {
|
|
58
72
|
await it('reads the resolved scheme from the element rather than assuming light', async () => {
|
|
59
73
|
const dark = document.createElement('div');
|
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
ADW_MENU_SURFACE_WEB,
|
|
62
62
|
assertMenuRenderable,
|
|
63
63
|
menuItemAt,
|
|
64
|
+
menuLabelText,
|
|
64
65
|
menuRefusals,
|
|
65
66
|
normalizeMenuModel,
|
|
66
67
|
parseMenuModel,
|
|
@@ -260,7 +261,7 @@ export class GtkPopoverMenuBar extends WidgetElement {
|
|
|
260
261
|
button.setAttribute('aria-expanded', 'false');
|
|
261
262
|
const label = document.createElement('span');
|
|
262
263
|
label.className = 'adw-popover-menu-bar-label';
|
|
263
|
-
label.textContent = node.label;
|
|
264
|
+
label.textContent = menuLabelText(node.label);
|
|
264
265
|
button.appendChild(label);
|
|
265
266
|
|
|
266
267
|
const popover = document.createElement('gtk-popover-menu') as GtkPopoverMenu;
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
// Reference: refs/libadwaita/src/stylesheet/widgets/_menus.scss:68-90 (separator, accelerator, check/radio)
|
|
47
47
|
// Copyright (c) GNOME contributors (GTK, libadwaita). LGPLv2.1+.
|
|
48
48
|
|
|
49
|
-
import { flattenMenu, menuNodeAt, resolveMenuItemState } from '@gjsify/adwaita-core';
|
|
49
|
+
import { flattenMenu, menuLabelText, menuNodeAt, resolveMenuItemState } from '@gjsify/adwaita-core';
|
|
50
50
|
import type { AdwMenuActions, AdwMenuItem, AdwMenuModel, AdwMenuPath } from '@gjsify/adwaita-core';
|
|
51
51
|
|
|
52
52
|
import { createGtkImage } from './gtk-image.js';
|
|
@@ -301,7 +301,7 @@ export class PopoverMenuView {
|
|
|
301
301
|
text.className = `${this.prefix}-item-label`;
|
|
302
302
|
// The parent's own label names where Back goes; `Back` alone is the fallback for
|
|
303
303
|
// a submenu that has none.
|
|
304
|
-
text.textContent = label.length > 0 ? label : BACK_LABEL;
|
|
304
|
+
text.textContent = label.length > 0 ? menuLabelText(label) : BACK_LABEL;
|
|
305
305
|
button.appendChild(text);
|
|
306
306
|
button.addEventListener('click', () => {
|
|
307
307
|
this._page = this._page.slice(0, -1);
|
|
@@ -322,7 +322,7 @@ export class PopoverMenuView {
|
|
|
322
322
|
}
|
|
323
323
|
const text = document.createElement('span');
|
|
324
324
|
text.className = `${this.prefix}-item-label`;
|
|
325
|
-
text.textContent = label;
|
|
325
|
+
text.textContent = menuLabelText(label);
|
|
326
326
|
button.appendChild(text);
|
|
327
327
|
button.appendChild(createGtkImage('go-next', 'adw-popover-item-arrow'));
|
|
328
328
|
button.addEventListener('click', () => {
|
|
@@ -371,7 +371,7 @@ export class PopoverMenuView {
|
|
|
371
371
|
// handing author markup to `innerHTML` would be an injection door in a renderer
|
|
372
372
|
// that has no other one, so the text is shown verbatim and the flag is carried
|
|
373
373
|
// for the GTK path. Stated rather than silently honoured.
|
|
374
|
-
label.textContent = item.label;
|
|
374
|
+
label.textContent = menuLabelText(item.label);
|
|
375
375
|
button.appendChild(label);
|
|
376
376
|
|
|
377
377
|
if (item.accel !== undefined && item.accel.length > 0) {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// menus on HOVER — the one thing that distinguishes it from a row of menu buttons.
|
|
5
5
|
|
|
6
6
|
import { describe, expect, it } from '@gjsify/unit';
|
|
7
|
+
import { MENU_LABEL_TEXT_VECTORS } from '@gjsify/adwaita-core/conformance';
|
|
7
8
|
import type { AdwMenuInput } from '@gjsify/adwaita-core';
|
|
8
9
|
|
|
9
10
|
interface MenuBarElement extends HTMLElement {
|
|
@@ -293,4 +294,15 @@ export const GtkPopoverMenuBarTest = async () => {
|
|
|
293
294
|
unmountAll();
|
|
294
295
|
});
|
|
295
296
|
});
|
|
297
|
+
|
|
298
|
+
await describe('<gtk-popover-menu-bar> the item text (a GtkLabel with use-underline)', async () => {
|
|
299
|
+
for (const { label, text, rule } of MENU_LABEL_TEXT_VECTORS) {
|
|
300
|
+
await it(rule, () => {
|
|
301
|
+
const el = mount();
|
|
302
|
+
el.menuModel = [{ label, submenu: [{ label: 'Inner' }] }];
|
|
303
|
+
expect(buttons(el).map((b) => b.textContent)).toStrictEqual([text]);
|
|
304
|
+
unmountAll();
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
});
|
|
296
308
|
};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// would be a third place to forget.
|
|
9
9
|
|
|
10
10
|
import { describe, expect, it } from '@gjsify/unit';
|
|
11
|
-
import { MENU_REFUSAL_VECTORS } from '@gjsify/adwaita-core/conformance';
|
|
11
|
+
import { MENU_LABEL_TEXT_VECTORS, MENU_REFUSAL_VECTORS } from '@gjsify/adwaita-core/conformance';
|
|
12
12
|
import { flattenMenu } from '@gjsify/adwaita-core';
|
|
13
13
|
import type { AdwMenuInput, AdwMenuModel } from '@gjsify/adwaita-core';
|
|
14
14
|
|
|
@@ -258,4 +258,17 @@ export const GtkPopoverMenuTest = async () => {
|
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
});
|
|
261
|
+
|
|
262
|
+
await describe('<gtk-popover-menu> the row text (a GtkLabel with use-underline)', async () => {
|
|
263
|
+
for (const { label, text, rule } of MENU_LABEL_TEXT_VECTORS) {
|
|
264
|
+
await it(`item, submenu and back row: ${rule}`, () => {
|
|
265
|
+
const el = mount();
|
|
266
|
+
el.menuModel = [{ label }, { label, submenu: [{ label }] }];
|
|
267
|
+
expect(labels(el)).toStrictEqual([text, text]);
|
|
268
|
+
el.openSubmenu(label);
|
|
269
|
+
expect(labels(el)).toStrictEqual([text, text]);
|
|
270
|
+
unmountAll();
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
});
|
|
261
274
|
};
|