@gjsify/adwaita-web 0.64.1-next.241 → 0.64.1-next.244

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 (49) hide show
  1. package/README.md +42 -4
  2. package/dist/adwaita-web.css +9 -1
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/canvas2d/canvas2d-bridge.d.ts +18 -0
  5. package/lib/types/canvas2d-bridge.spec.d.ts +1 -0
  6. package/lib/types/elements/adw-action-row.d.ts +1 -0
  7. package/lib/types/elements/adw-bottom-sheet.d.ts +1 -0
  8. package/lib/types/elements/adw-navigation-view.d.ts +1 -0
  9. package/lib/types/elements/adw-switch-row.d.ts +1 -0
  10. package/lib/types/elements/gtk-image.d.ts +12 -3
  11. package/lib/types/elements/gtk-scrolled-window.d.ts +10 -0
  12. package/lib/types/gobject-elements.d.ts +7 -0
  13. package/lib/types/icon-registry.d.ts +3 -1
  14. package/lib/types/icon-theme.d.ts +53 -0
  15. package/lib/types/icon-theme.spec.d.ts +1 -0
  16. package/lib/types/index.d.ts +1 -0
  17. package/lib/types/namespace/gtk.d.ts +1 -0
  18. package/lib/types/styles.generated.d.ts +1 -1
  19. package/package.json +12 -12
  20. package/scss/_about_dialog.scss +2 -2
  21. package/scss/_icon.scss +18 -0
  22. package/src/adw-window.spec.ts +7 -0
  23. package/src/application.spec.ts +3 -3
  24. package/src/canvas2d/canvas2d-bridge.ts +51 -1
  25. package/src/canvas2d-bridge.spec.ts +47 -0
  26. package/src/elements/adw-about-dialog.ts +4 -2
  27. package/src/elements/adw-action-row.ts +6 -0
  28. package/src/elements/adw-bottom-sheet.ts +6 -0
  29. package/src/elements/adw-navigation-view.ts +6 -0
  30. package/src/elements/adw-switch-row.ts +6 -0
  31. package/src/elements/gtk-image.ts +55 -24
  32. package/src/elements/gtk-scrolled-window.ts +37 -1
  33. package/src/elements/gtk-window-controls.ts +1 -1
  34. package/src/elements/gtk-window.ts +1 -1
  35. package/src/file-chooser-host.ts +2 -0
  36. package/src/file-chooser.spec.ts +3 -5
  37. package/src/gobject-door.spec.ts +44 -0
  38. package/src/gobject-elements.ts +22 -0
  39. package/src/gtk-font-dialog-button.spec.ts +3 -1
  40. package/src/gtk-scrolled-window.spec.ts +77 -0
  41. package/src/icon-registry.ts +13 -7
  42. package/src/icon-theme.spec.ts +182 -0
  43. package/src/icon-theme.ts +178 -0
  44. package/src/index.ts +3 -0
  45. package/src/namespace/gtk.ts +2 -0
  46. package/src/navigation-view.spec.ts +4 -4
  47. package/src/shared-tree-builder.ts +2 -1
  48. package/src/styles.generated.ts +1 -1
  49. 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, a reverse-DNS application id — because
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` — and a dotted name has no registration path, so that second route is
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
@@ -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;