@gjsify/adwaita-web 0.64.1-next.241 → 0.64.1-next.243
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 +42 -4
- package/dist/adwaita-web.css +9 -1
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/canvas2d/canvas2d-bridge.d.ts +18 -0
- package/lib/types/canvas2d-bridge.spec.d.ts +1 -0
- package/lib/types/elements/gtk-image.d.ts +12 -3
- package/lib/types/elements/gtk-scrolled-window.d.ts +10 -0
- package/lib/types/gobject-elements.d.ts +7 -0
- package/lib/types/icon-registry.d.ts +3 -1
- package/lib/types/icon-theme.d.ts +53 -0
- package/lib/types/icon-theme.spec.d.ts +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +12 -12
- package/scss/_about_dialog.scss +2 -2
- package/scss/_icon.scss +18 -0
- package/src/canvas2d/canvas2d-bridge.ts +51 -1
- package/src/canvas2d-bridge.spec.ts +47 -0
- package/src/elements/adw-about-dialog.ts +4 -2
- package/src/elements/gtk-image.ts +55 -24
- package/src/elements/gtk-scrolled-window.ts +37 -1
- package/src/gobject-door.spec.ts +44 -0
- package/src/gobject-elements.ts +22 -0
- package/src/gtk-scrolled-window.spec.ts +74 -0
- package/src/icon-registry.ts +13 -7
- package/src/icon-theme.spec.ts +182 -0
- package/src/icon-theme.ts +178 -0
- package/src/index.ts +3 -0
- package/src/shared-tree-builder.ts +2 -1
- package/src/styles.generated.ts +1 -1
- package/src/test.browser.mts +5 -0
package/README.md
CHANGED
|
@@ -238,7 +238,7 @@ times the stylesheet it would sit in.
|
|
|
238
238
|
|
|
239
239
|
A name outside that subset draws **`image-missing`**, the broken-image glyph libadwaita
|
|
240
240
|
itself substitutes when it has no icon to draw. So does a name that could never be a mask
|
|
241
|
-
class at all — a space, a quote,
|
|
241
|
+
class at all — a space, a quote, an unregistered reverse-DNS application id — because
|
|
242
242
|
`gtk_icon_theme_lookup_icon` has no "found nothing" answer either. It is deliberately
|
|
243
243
|
visible: the icon has not silently disappeared, and nothing throws — an icon is decorative,
|
|
244
244
|
and neither of the other two Adwaita renderers takes an application down over a glyph. Only
|
|
@@ -297,6 +297,45 @@ Notes worth having:
|
|
|
297
297
|
- `isIconAvailable(name)` reads the live cascade, not a generated list, so it also answers
|
|
298
298
|
`true` for a glyph you supplied through your own stylesheet's `--icon-<name>`.
|
|
299
299
|
|
|
300
|
+
### Full-colour icons — an application icon
|
|
301
|
+
|
|
302
|
+
A symbolic icon is recoloured; an application icon is not. On GNOME,
|
|
303
|
+
`AdwAboutDialog`'s `application-icon` is the application ID, and GTK finds
|
|
304
|
+
`hicolor/scalable/apps/<app-id>.svg` and draws it as it is. The web stand-in for that file is
|
|
305
|
+
`registerColorIcon`:
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
import { registerColorIcon } from '@gjsify/adwaita-web';
|
|
309
|
+
import appIcon from './icons/org.example.App.svg?raw';
|
|
310
|
+
|
|
311
|
+
registerColorIcon('org.example.App', appIcon); // SVG source…
|
|
312
|
+
registerColorIcon('org.example.Other', '/icons/other.png'); // …or an image URL
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
```html
|
|
316
|
+
<adw-about-dialog application-icon="org.example.App" application-name="Example"></adw-about-dialog>
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Every `<gtk-image>` asking for a registered name draws the image unmasked and unrecoloured,
|
|
320
|
+
which covers every widget that draws its icons through it, `<adw-about-dialog>` and
|
|
321
|
+
`<gtk-about-dialog logo-icon-name>` among them. A name is looked up in the order GTK's own
|
|
322
|
+
theme tries it (`g_themed_icon_update_names`):
|
|
323
|
+
|
|
324
|
+
| Asked for | Tried, in order | Neither found |
|
|
325
|
+
| --- | --- | --- |
|
|
326
|
+
| `X` | colour `X`, then symbolic `X-symbolic` | `image-missing` |
|
|
327
|
+
| `X-symbolic` | symbolic `X-symbolic`, then colour `X` | `image-missing` |
|
|
328
|
+
|
|
329
|
+
So nothing changes for a name with no colour registration. `registerColorIcon` keys on the
|
|
330
|
+
**exact** name, reverse-DNS IDs included, and *throws* on an empty or spaced name, on a
|
|
331
|
+
`-symbolic` (`-ltr`/`-rtl`) name — that is `registerIcon`'s half — and on a source that is
|
|
332
|
+
neither SVG source nor an `http(s):`, `blob:`, `file:` or `data:image/` URL. A registration
|
|
333
|
+
redraws every mounted `<gtk-image>`, and `isIconAvailable` answers `true` for the name.
|
|
334
|
+
|
|
335
|
+
`Gtk.IconTheme.add_resource_path` and `add_search_path` stay records only on the web: there
|
|
336
|
+
is no GResource and no file system to search, so a registration is the one way a colour
|
|
337
|
+
icon gets in.
|
|
338
|
+
|
|
300
339
|
### Why this is a web-only concern
|
|
301
340
|
|
|
302
341
|
The three Adwaita renderers resolve an icon name three different ways, and it is worth
|
|
@@ -306,12 +345,11 @@ knowing which one you are on:
|
|
|
306
345
|
| --- | --- | --- |
|
|
307
346
|
| GTK (`@gjsify/adwaita-app`) | `GtkIconTheme` looks it up in the **system** icon theme at runtime | draws the theme's `image-missing` |
|
|
308
347
|
| NativeScript (`@gjsify/adwaita-nativescript`) | `GtkImage` is handed the **SVG source**, not a name | cannot happen — a missing icon is a missing import |
|
|
309
|
-
| Web (this package) | a **compile-time** subset, plus `registerIcon` | draws `image-missing` |
|
|
348
|
+
| Web (this package) | a **compile-time** subset, plus `registerIcon` / `registerColorIcon` | draws `image-missing` |
|
|
310
349
|
|
|
311
350
|
All three therefore end on ONE glyph for a name they cannot draw. The web reaches it by two
|
|
312
351
|
routes — no mask class for a known-shaped name, or no usable class for a name like
|
|
313
|
-
`org.gnome.Builder`
|
|
314
|
-
where it stays.
|
|
352
|
+
`org.gnome.Builder` that no `registerColorIcon` call has answered either.
|
|
315
353
|
|
|
316
354
|
Only the web renderer has a set that can be missing something at runtime, which is why only
|
|
317
355
|
it needs a registration path. `scripts/check-adwaita-icon-masks.mjs` holds the compiled
|
package/dist/adwaita-web.css
CHANGED
|
@@ -1624,6 +1624,15 @@ gtk-window-handle *::after {
|
|
|
1624
1624
|
background-color: transparent;
|
|
1625
1625
|
}
|
|
1626
1626
|
|
|
1627
|
+
.adw-icon.adw-icon-color {
|
|
1628
|
+
mask-image: none;
|
|
1629
|
+
-webkit-mask-image: none;
|
|
1630
|
+
background-color: transparent;
|
|
1631
|
+
background-position: center;
|
|
1632
|
+
background-repeat: no-repeat;
|
|
1633
|
+
background-size: contain;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1627
1636
|
gtk-label {
|
|
1628
1637
|
display: flex;
|
|
1629
1638
|
align-items: var(--gtk-label-align-items, center);
|
|
@@ -9950,7 +9959,6 @@ adw-about-dialog .adw-about-dialog-icon {
|
|
|
9950
9959
|
margin-bottom: var(--spacing-m);
|
|
9951
9960
|
-webkit-mask-size: contain;
|
|
9952
9961
|
mask-size: contain;
|
|
9953
|
-
background-color: currentColor;
|
|
9954
9962
|
}
|
|
9955
9963
|
adw-about-dialog .adw-about-dialog-name {
|
|
9956
9964
|
align-self: center;
|