@gjsify/adwaita-web 0.64.1 → 0.64.2-next.254

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 (335) hide show
  1. package/README.md +22 -88
  2. package/dist/adwaita-web.css +91 -12
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/accessible.d.ts +8 -0
  5. package/lib/types/application.d.ts +1 -1
  6. package/lib/types/child-slot.spec.d.ts +1 -0
  7. package/lib/types/compute-expand.d.ts +5 -0
  8. package/lib/types/compute-expand.spec.d.ts +1 -0
  9. package/lib/types/container-fill.spec.d.ts +1 -0
  10. package/lib/types/elements/adw-about-dialog.d.ts +28 -1
  11. package/lib/types/elements/adw-action-row.d.ts +2 -1
  12. package/lib/types/elements/adw-alert-dialog.d.ts +80 -19
  13. package/lib/types/elements/adw-avatar.d.ts +2 -1
  14. package/lib/types/elements/adw-banner.d.ts +2 -1
  15. package/lib/types/elements/adw-bin.d.ts +2 -1
  16. package/lib/types/elements/adw-bottom-sheet.d.ts +5 -4
  17. package/lib/types/elements/adw-breakpoint-bin.d.ts +2 -1
  18. package/lib/types/elements/adw-button-content.d.ts +2 -1
  19. package/lib/types/elements/adw-button-row.d.ts +2 -1
  20. package/lib/types/elements/adw-card.d.ts +2 -1
  21. package/lib/types/elements/adw-carousel.d.ts +20 -3
  22. package/lib/types/elements/adw-clamp-scrollable.d.ts +2 -1
  23. package/lib/types/elements/adw-clamp.d.ts +2 -1
  24. package/lib/types/elements/adw-combo-row.d.ts +6 -1
  25. package/lib/types/elements/adw-data-grid.d.ts +2 -1
  26. package/lib/types/elements/adw-dialog.d.ts +2 -1
  27. package/lib/types/elements/adw-entry-row.d.ts +2 -1
  28. package/lib/types/elements/adw-expander-row.d.ts +2 -1
  29. package/lib/types/elements/adw-header-bar.d.ts +2 -1
  30. package/lib/types/elements/adw-inline-view-switcher.d.ts +3 -2
  31. package/lib/types/elements/adw-layout-slot.d.ts +2 -1
  32. package/lib/types/elements/adw-multi-layout-view.d.ts +2 -1
  33. package/lib/types/elements/adw-navigation-split-view.d.ts +2 -1
  34. package/lib/types/elements/adw-navigation-view.d.ts +3 -2
  35. package/lib/types/elements/adw-overlay-split-view.d.ts +2 -1
  36. package/lib/types/elements/adw-preferences-dialog.d.ts +5 -4
  37. package/lib/types/elements/adw-preferences-group.d.ts +2 -1
  38. package/lib/types/elements/adw-preferences-row.d.ts +2 -1
  39. package/lib/types/elements/adw-shortcut-label.d.ts +2 -1
  40. package/lib/types/elements/adw-shortcuts-item.d.ts +2 -1
  41. package/lib/types/elements/adw-shortcuts-section.d.ts +2 -1
  42. package/lib/types/elements/adw-sidebar.d.ts +4 -3
  43. package/lib/types/elements/adw-spin-row.d.ts +2 -1
  44. package/lib/types/elements/adw-spinner.d.ts +2 -1
  45. package/lib/types/elements/adw-split-button.d.ts +2 -1
  46. package/lib/types/elements/adw-status-page.d.ts +2 -1
  47. package/lib/types/elements/adw-switch-row.d.ts +4 -1
  48. package/lib/types/elements/adw-tab-bar.d.ts +2 -1
  49. package/lib/types/elements/adw-tab-button.d.ts +2 -1
  50. package/lib/types/elements/adw-tab-overview.d.ts +2 -1
  51. package/lib/types/elements/adw-tab-view.d.ts +3 -2
  52. package/lib/types/elements/adw-toast-overlay.d.ts +10 -30
  53. package/lib/types/elements/adw-toggle-group.d.ts +3 -2
  54. package/lib/types/elements/adw-toolbar-view.d.ts +2 -1
  55. package/lib/types/elements/adw-view-stack.d.ts +3 -1
  56. package/lib/types/elements/adw-view-switcher-bar.d.ts +2 -1
  57. package/lib/types/elements/adw-view-switcher-sidebar.d.ts +2 -1
  58. package/lib/types/elements/adw-view-switcher.d.ts +3 -2
  59. package/lib/types/elements/adw-window-features.d.ts +8 -0
  60. package/lib/types/elements/adw-window-title.d.ts +2 -1
  61. package/lib/types/elements/adw-wrap-box.d.ts +2 -1
  62. package/lib/types/elements/checks.d.ts +16 -1
  63. package/lib/types/elements/gtk-action-bar.d.ts +2 -1
  64. package/lib/types/elements/gtk-application-window.d.ts +1 -4
  65. package/lib/types/elements/gtk-aspect-frame.d.ts +2 -1
  66. package/lib/types/elements/gtk-box.d.ts +5 -1
  67. package/lib/types/elements/gtk-button.d.ts +5 -7
  68. package/lib/types/elements/gtk-calendar.d.ts +2 -1
  69. package/lib/types/elements/gtk-center-box.d.ts +2 -1
  70. package/lib/types/elements/gtk-color-dialog-button.d.ts +2 -1
  71. package/lib/types/elements/gtk-drag-icon.d.ts +2 -1
  72. package/lib/types/elements/gtk-drawing-area.d.ts +2 -1
  73. package/lib/types/elements/gtk-drop-down.d.ts +2 -1
  74. package/lib/types/elements/gtk-editable-label.d.ts +2 -1
  75. package/lib/types/elements/gtk-emoji-chooser.d.ts +2 -0
  76. package/lib/types/elements/gtk-entry.d.ts +2 -1
  77. package/lib/types/elements/gtk-expander.d.ts +2 -1
  78. package/lib/types/elements/gtk-fixed.d.ts +2 -1
  79. package/lib/types/elements/gtk-flow-box-child.d.ts +2 -1
  80. package/lib/types/elements/gtk-flow-box.d.ts +2 -1
  81. package/lib/types/elements/gtk-font-dialog-button.d.ts +2 -1
  82. package/lib/types/elements/gtk-frame.d.ts +2 -1
  83. package/lib/types/elements/gtk-gl-area.d.ts +2 -1
  84. package/lib/types/elements/gtk-graphics-offload.d.ts +2 -1
  85. package/lib/types/elements/gtk-grid.d.ts +2 -1
  86. package/lib/types/elements/gtk-header-bar.d.ts +2 -1
  87. package/lib/types/elements/gtk-image.d.ts +5 -6
  88. package/lib/types/elements/gtk-inscription.d.ts +2 -1
  89. package/lib/types/elements/gtk-label.d.ts +10 -3
  90. package/lib/types/elements/gtk-level-bar.d.ts +2 -1
  91. package/lib/types/elements/gtk-list-box-row.d.ts +2 -1
  92. package/lib/types/elements/gtk-list-box.d.ts +2 -1
  93. package/lib/types/elements/gtk-list-view.d.ts +2 -1
  94. package/lib/types/elements/gtk-media-controls.d.ts +2 -1
  95. package/lib/types/elements/gtk-menu-button.d.ts +2 -1
  96. package/lib/types/elements/gtk-notebook.d.ts +2 -1
  97. package/lib/types/elements/gtk-overlay.d.ts +2 -1
  98. package/lib/types/elements/gtk-paned.d.ts +2 -1
  99. package/lib/types/elements/gtk-picture.d.ts +2 -1
  100. package/lib/types/elements/gtk-popover-bin.d.ts +2 -1
  101. package/lib/types/elements/gtk-popover-menu-bar.d.ts +2 -1
  102. package/lib/types/elements/gtk-popover-menu.d.ts +2 -0
  103. package/lib/types/elements/gtk-popover.d.ts +7 -1
  104. package/lib/types/elements/gtk-progress-bar.d.ts +2 -1
  105. package/lib/types/elements/gtk-revealer.d.ts +2 -1
  106. package/lib/types/elements/gtk-scale-button.d.ts +2 -1
  107. package/lib/types/elements/gtk-scale.d.ts +2 -1
  108. package/lib/types/elements/gtk-scrollbar.d.ts +2 -1
  109. package/lib/types/elements/gtk-scrolled-window.d.ts +2 -1
  110. package/lib/types/elements/gtk-search-bar.d.ts +2 -1
  111. package/lib/types/elements/gtk-separator.d.ts +2 -1
  112. package/lib/types/elements/gtk-spin-button.d.ts +2 -1
  113. package/lib/types/elements/gtk-spinner.d.ts +2 -1
  114. package/lib/types/elements/gtk-stack-page.d.ts +29 -0
  115. package/lib/types/elements/gtk-stack-sidebar.d.ts +2 -1
  116. package/lib/types/elements/gtk-stack-switcher.d.ts +2 -1
  117. package/lib/types/elements/gtk-stack.d.ts +13 -1
  118. package/lib/types/elements/gtk-switch.d.ts +2 -1
  119. package/lib/types/elements/gtk-text-view.d.ts +2 -1
  120. package/lib/types/elements/gtk-text.d.ts +2 -1
  121. package/lib/types/elements/gtk-tree-expander.d.ts +2 -1
  122. package/lib/types/elements/gtk-video.d.ts +2 -1
  123. package/lib/types/elements/gtk-viewport.d.ts +2 -1
  124. package/lib/types/elements/gtk-window-controls.d.ts +2 -1
  125. package/lib/types/elements/gtk-window-handle.d.ts +2 -1
  126. package/lib/types/elements/gtk-window.d.ts +18 -2
  127. package/lib/types/gobject-elements.d.ts +15 -0
  128. package/lib/types/gtksource/gtk-source-view.d.ts +2 -1
  129. package/lib/types/{icon-registry.spec.d.ts → icon-masks.spec.d.ts} +1 -1
  130. package/lib/types/icon-theme.d.ts +15 -35
  131. package/lib/types/index.d.ts +3 -4
  132. package/lib/types/learn6502-window.spec.d.ts +1 -0
  133. package/lib/types/namespace/adw.d.ts +1 -1
  134. package/lib/types/namespace/gdk.d.ts +1 -0
  135. package/lib/types/namespace/gio.d.ts +1 -0
  136. package/lib/types/namespace/glib.d.ts +2 -1
  137. package/lib/types/namespace/gtk.d.ts +2 -0
  138. package/lib/types/shared-tree-builder.d.ts +31 -0
  139. package/lib/types/signals.d.ts +5 -1
  140. package/lib/types/source-view/adw-source-view.d.ts +2 -1
  141. package/lib/types/styles.generated.d.ts +1 -1
  142. package/lib/types/widget-element.d.ts +25 -0
  143. package/lib/types/widget-map.spec.d.ts +1 -0
  144. package/lib/types/widget-mapping.d.ts +7 -0
  145. package/lib/types/widget-visible.spec.d.ts +1 -0
  146. package/lib/types/window-maximize.spec.d.ts +1 -0
  147. package/package.json +13 -12
  148. package/scss/_about_dialog.scss +46 -1
  149. package/scss/_bin.scss +6 -3
  150. package/scss/_checks.scss +5 -2
  151. package/scss/_icon.scss +3 -4
  152. package/scss/_labels.scss +2 -2
  153. package/scss/_overlay.scss +11 -1
  154. package/scss/_overlay_split_view.scss +10 -0
  155. package/scss/_reset.scss +1 -1
  156. package/scss/_scrolled_window.scss +15 -0
  157. package/scss/_stack.scss +8 -2
  158. package/scss/_toast.scss +13 -3
  159. package/scss/_widget.scss +5 -1
  160. package/scss/_window.scss +16 -0
  161. package/src/accessible.ts +29 -0
  162. package/src/adw-about-dialog.spec.ts +81 -12
  163. package/src/adw-action-rows.spec.ts +2 -2
  164. package/src/adw-alert-dialog.spec.ts +71 -5
  165. package/src/adw-bin.spec.ts +4 -3
  166. package/src/adw-button-content.spec.ts +1 -1
  167. package/src/adw-carousel.spec.ts +49 -1
  168. package/src/adw-header-bar.spec.ts +18 -0
  169. package/src/adw-toast-overlay.spec.ts +68 -24
  170. package/src/application.spec.ts +44 -0
  171. package/src/application.ts +13 -18
  172. package/src/capabilities.mjs +2 -3
  173. package/src/checks.spec.ts +51 -1
  174. package/src/child-slot.spec.ts +71 -0
  175. package/src/compute-expand.spec.ts +186 -0
  176. package/src/compute-expand.ts +134 -0
  177. package/src/construct-vectors.spec.ts +97 -7
  178. package/src/container-fill.spec.ts +70 -0
  179. package/src/elements/adw-about-dialog.ts +152 -9
  180. package/src/elements/adw-action-row.ts +2 -1
  181. package/src/elements/adw-alert-dialog.ts +177 -46
  182. package/src/elements/adw-application-window.ts +0 -3
  183. package/src/elements/adw-avatar.ts +2 -1
  184. package/src/elements/adw-banner.ts +2 -1
  185. package/src/elements/adw-bin.ts +2 -1
  186. package/src/elements/adw-bottom-sheet.ts +5 -4
  187. package/src/elements/adw-breakpoint-bin.ts +5 -1
  188. package/src/elements/adw-button-content.ts +2 -1
  189. package/src/elements/adw-button-row.ts +2 -1
  190. package/src/elements/adw-card.ts +2 -1
  191. package/src/elements/adw-carousel.ts +62 -3
  192. package/src/elements/adw-clamp-scrollable.ts +2 -1
  193. package/src/elements/adw-clamp.ts +2 -1
  194. package/src/elements/adw-combo-row.ts +15 -1
  195. package/src/elements/adw-data-grid.ts +2 -1
  196. package/src/elements/adw-dialog.ts +5 -2
  197. package/src/elements/adw-entry-row.ts +2 -1
  198. package/src/elements/adw-expander-row.ts +2 -1
  199. package/src/elements/adw-header-bar.ts +6 -1
  200. package/src/elements/adw-inline-view-switcher.ts +3 -2
  201. package/src/elements/adw-layout-slot.ts +2 -1
  202. package/src/elements/adw-multi-layout-view.ts +2 -1
  203. package/src/elements/adw-navigation-split-view.ts +2 -1
  204. package/src/elements/adw-navigation-view.ts +3 -2
  205. package/src/elements/adw-overlay-split-view.ts +2 -1
  206. package/src/elements/adw-preferences-dialog.ts +6 -4
  207. package/src/elements/adw-preferences-group.ts +2 -1
  208. package/src/elements/adw-preferences-row.ts +2 -1
  209. package/src/elements/adw-shortcut-label.ts +2 -1
  210. package/src/elements/adw-shortcuts-item.ts +2 -1
  211. package/src/elements/adw-shortcuts-section.ts +2 -1
  212. package/src/elements/adw-sidebar.ts +4 -3
  213. package/src/elements/adw-spin-row.ts +2 -1
  214. package/src/elements/adw-spinner.ts +2 -1
  215. package/src/elements/adw-split-button.ts +2 -1
  216. package/src/elements/adw-status-page.ts +2 -1
  217. package/src/elements/adw-switch-row.ts +10 -1
  218. package/src/elements/adw-tab-bar.ts +2 -1
  219. package/src/elements/adw-tab-button.ts +2 -1
  220. package/src/elements/adw-tab-overview.ts +2 -1
  221. package/src/elements/adw-tab-view.ts +3 -2
  222. package/src/elements/adw-toast-overlay.ts +37 -70
  223. package/src/elements/adw-toggle-group.ts +3 -2
  224. package/src/elements/adw-toolbar-view.ts +2 -1
  225. package/src/elements/adw-view-stack.ts +39 -1
  226. package/src/elements/adw-view-switcher-bar.ts +2 -1
  227. package/src/elements/adw-view-switcher-sidebar.ts +2 -1
  228. package/src/elements/adw-view-switcher.ts +3 -2
  229. package/src/elements/adw-window-features.ts +14 -2
  230. package/src/elements/adw-window-title.ts +2 -1
  231. package/src/elements/adw-wrap-box.ts +2 -1
  232. package/src/elements/checks.ts +85 -6
  233. package/src/elements/gtk-action-bar.ts +2 -1
  234. package/src/elements/gtk-application-window.ts +3 -8
  235. package/src/elements/gtk-aspect-frame.ts +2 -1
  236. package/src/elements/gtk-box.ts +56 -1
  237. package/src/elements/gtk-button.ts +10 -22
  238. package/src/elements/gtk-calendar.ts +2 -1
  239. package/src/elements/gtk-center-box.ts +2 -1
  240. package/src/elements/gtk-color-dialog-button.ts +2 -1
  241. package/src/elements/gtk-drag-icon.ts +6 -1
  242. package/src/elements/gtk-drawing-area.ts +2 -1
  243. package/src/elements/gtk-drop-down.ts +2 -1
  244. package/src/elements/gtk-editable-label.ts +2 -1
  245. package/src/elements/gtk-emoji-chooser.ts +5 -0
  246. package/src/elements/gtk-entry.ts +2 -1
  247. package/src/elements/gtk-expander.ts +2 -1
  248. package/src/elements/gtk-fixed.ts +2 -1
  249. package/src/elements/gtk-flow-box-child.ts +5 -2
  250. package/src/elements/gtk-flow-box.ts +2 -1
  251. package/src/elements/gtk-font-dialog-button.ts +2 -1
  252. package/src/elements/gtk-frame.ts +2 -1
  253. package/src/elements/gtk-gl-area.ts +2 -1
  254. package/src/elements/gtk-graphics-offload.ts +5 -2
  255. package/src/elements/gtk-grid.ts +2 -1
  256. package/src/elements/gtk-header-bar.ts +2 -1
  257. package/src/elements/gtk-image.ts +14 -15
  258. package/src/elements/gtk-inscription.ts +2 -1
  259. package/src/elements/gtk-label.ts +12 -5
  260. package/src/elements/gtk-level-bar.ts +2 -1
  261. package/src/elements/gtk-list-box-row.ts +5 -2
  262. package/src/elements/gtk-list-box.ts +2 -1
  263. package/src/elements/gtk-list-view.ts +2 -1
  264. package/src/elements/gtk-media-controls.ts +2 -1
  265. package/src/elements/gtk-menu-button.ts +2 -1
  266. package/src/elements/gtk-notebook.ts +2 -1
  267. package/src/elements/gtk-overlay.ts +7 -5
  268. package/src/elements/gtk-paned.ts +9 -2
  269. package/src/elements/gtk-picture.ts +2 -1
  270. package/src/elements/gtk-popover-bin.ts +5 -1
  271. package/src/elements/gtk-popover-menu-bar.ts +2 -1
  272. package/src/elements/gtk-popover-menu.ts +5 -0
  273. package/src/elements/gtk-popover.ts +14 -1
  274. package/src/elements/gtk-progress-bar.ts +2 -1
  275. package/src/elements/gtk-revealer.ts +2 -1
  276. package/src/elements/gtk-scale-button.ts +2 -1
  277. package/src/elements/gtk-scale.ts +2 -1
  278. package/src/elements/gtk-scrollbar.ts +2 -1
  279. package/src/elements/gtk-scrolled-window.ts +8 -5
  280. package/src/elements/gtk-search-bar.ts +7 -6
  281. package/src/elements/gtk-separator.ts +2 -1
  282. package/src/elements/gtk-spin-button.ts +2 -1
  283. package/src/elements/gtk-spinner.ts +2 -1
  284. package/src/elements/gtk-stack-page.ts +112 -0
  285. package/src/elements/gtk-stack-sidebar.ts +2 -1
  286. package/src/elements/gtk-stack-switcher.ts +2 -1
  287. package/src/elements/gtk-stack.ts +52 -6
  288. package/src/elements/gtk-switch.ts +2 -1
  289. package/src/elements/gtk-text-view.ts +2 -1
  290. package/src/elements/gtk-text.ts +2 -1
  291. package/src/elements/gtk-tree-expander.ts +5 -1
  292. package/src/elements/gtk-video.ts +2 -1
  293. package/src/elements/gtk-viewport.ts +6 -1
  294. package/src/elements/gtk-window-controls.ts +2 -1
  295. package/src/elements/gtk-window-handle.ts +6 -1
  296. package/src/elements/gtk-window.ts +57 -7
  297. package/src/gio.spec.ts +13 -3
  298. package/src/glib.spec.ts +9 -0
  299. package/src/gobject-elements.ts +44 -2
  300. package/src/gtk-label.spec.ts +39 -0
  301. package/src/gtk-scrolled-window.spec.ts +6 -6
  302. package/src/gtk-stack.spec.ts +170 -0
  303. package/src/gtk-value-doors.spec.ts +19 -0
  304. package/src/gtk-window.spec.ts +2 -2
  305. package/src/gtksource/gtk-source-view.ts +2 -1
  306. package/src/{icon-registry.spec.ts → icon-masks.spec.ts} +4 -100
  307. package/src/icon-theme.spec.ts +69 -124
  308. package/src/icon-theme.ts +29 -119
  309. package/src/index.ts +5 -9
  310. package/src/keyboard-operable.spec.ts +3 -3
  311. package/src/learn6502-window.spec.ts +113 -0
  312. package/src/namespace/adw.ts +1 -1
  313. package/src/namespace/gdk.ts +1 -0
  314. package/src/namespace/gio.ts +8 -0
  315. package/src/namespace/glib.ts +4 -0
  316. package/src/namespace/gtk.ts +2 -0
  317. package/src/shared-tree-builder.ts +131 -13
  318. package/src/shared-trees.spec.ts +15 -1
  319. package/src/signals.ts +11 -2
  320. package/src/slotted-children.spec.ts +24 -0
  321. package/src/slotted-children.ts +18 -2
  322. package/src/source-view/adw-source-view.ts +2 -1
  323. package/src/split-button.spec.ts +1 -1
  324. package/src/style-manager.spec.ts +13 -0
  325. package/src/style-manager.ts +6 -0
  326. package/src/styles.generated.ts +1 -1
  327. package/src/test.browser.mts +16 -2
  328. package/src/value-lists.spec.ts +3 -3
  329. package/src/widget-element.ts +75 -0
  330. package/src/widget-map.spec.ts +116 -0
  331. package/src/widget-mapping.ts +100 -0
  332. package/src/widget-visible.spec.ts +148 -0
  333. package/src/window-maximize.spec.ts +93 -0
  334. package/lib/types/icon-registry.d.ts +0 -37
  335. package/src/icon-registry.ts +0 -163
package/src/icon-theme.ts CHANGED
@@ -13,25 +13,18 @@
13
13
  // and `gtk_icon_theme_lookup_icon` returns the first candidate the theme has, else
14
14
  // `image-missing` — it never returns NULL (refs/gtk/gtk/gtkicontheme.c, `choose_icon`).
15
15
  //
16
- // This package compiles and registers symbolic glyphs only (`icon-registry.ts`, the
17
- // stylesheet's `.adw-icon--<name>` masks). The colour half lives here: a map from an EXACT
18
- // name to an image URL, filled by {@link registerColorIcon}. With the map empty every lookup
19
- // ends where it ended before this module existed, so nothing that only uses symbolic icons
20
- // changes.
21
- //
22
- // The colour map is keyed by the raw name, not by `normalizeIconName`: an application icon
23
- // is named after its application ID (`org.gnome.Builder`, adw-about-dialog.c:1215), which is
24
- // not a CSS token and never could be a mask class, but is a perfectly good Map key.
16
+ // The stylesheet compiles a SUBSET of Adwaita's symbolic glyphs (the `.adw-icon--<name>`
17
+ // masks); that subset is the port's current theme. Everything else — an application's own
18
+ // symbolic glyphs and its full-colour icons alike — comes from GResource files.
25
19
  //
26
20
  // RESOURCE PATHS (ADR 0116 § 4). The names go through the `Gtk.IconTheme` resource paths an
27
21
  // application added (`GtkApplication` adds `<resource-base-path>/icons/` at startup);
28
22
  // `@gjsify/adwaita-core`'s `lookupResourceIcon` decides which file answers, as gtkicontheme.c
29
- // does, and asks this module only whether the stylesheet holds a symbolic glyph. A colour
30
- // registration stands in hicolor there, as the file an app ships in `hicolor/scalable/apps/`
31
- // would: the stylesheet's `X-symbolic` answers `X` before it, as Adwaita's does on GNOME. A file
32
- // answers as a blob URL of its bytes: a symbolic one is drawn as a mask in `currentColor`, the
33
- // rest as-is. A browser draws SVG and PNG; an XPM or a compressed entry draws `image-missing`
34
- // with a warning.
23
+ // does, and asks this module only whether the stylesheet holds a symbolic glyph: the
24
+ // stylesheet's `X-symbolic` answers `X` before a resource's colour `X`, as Adwaita's does on
25
+ // GNOME. A file answers as a blob URL of its bytes: a symbolic one is drawn as a mask in
26
+ // `currentColor`, the rest as-is. A browser draws SVG and PNG; an XPM or a compressed entry
27
+ // draws `image-missing` with a warning.
35
28
  //
36
29
  // Original implementation.
37
30
 
@@ -42,14 +35,11 @@ import {
42
35
  resources_lookup_data,
43
36
  type IconDirection,
44
37
  } from '@gjsify/adwaita-core';
45
- import { toDataUri } from '@gjsify/adwaita-icons/utils';
46
38
 
47
39
  import { IconTheme } from './namespace/gtk-platform.js';
48
40
 
49
41
  /** What one icon name resolves to, in the order GTK's theme would try it. */
50
42
  export type IconLookup =
51
- /** A registered full-colour image, drawn as-is. `url` is ready for `url("…")`. */
52
- | { kind: 'color'; name: string; url: string }
53
43
  /**
54
44
  * A file under a `Gtk.IconTheme` resource path; `symbolic` files are masks in `currentColor`.
55
45
  * `url` is `null` when the browser cannot draw the file (XPM, compressed): draw `image-missing`.
@@ -61,21 +51,9 @@ export type IconLookup =
61
51
  | { kind: 'missing' };
62
52
 
63
53
  /**
64
- * Every name GTK's theme treats as a symbolic FILE (gtkicontheme.c `icon_name_is_symbolic`):
65
- * the directional variants are symbolic too, so none of them is a colour icon.
66
- */
67
- const SYMBOLIC_FILE_NAME = /-symbolic(?:-ltr|-rtl)?$/;
68
-
69
- /** Schemes a colour icon may be fetched from. Anything else can run script or is unknown. */
70
- const ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'blob:', 'file:']);
71
-
72
- const colorIcons = new Map<string, string>();
73
-
74
- /**
75
- * Elements that drew a lookup result and have to redraw when the theme changes. A symbolic
76
- * registration is live through CSS and needs no redraw, but a colour one is an inline
77
- * `background-image`, and GTK's own images re-run their lookup on the theme's `changed`
78
- * signal for the same reason.
54
+ * Elements that drew a lookup result and have to redraw when the theme changes. A resource
55
+ * file is an inline `background-image` or mask, and GTK's own images re-run their lookup on
56
+ * the theme's `changed` signal for the same reason.
79
57
  */
80
58
  const listeners = new Set<() => void>();
81
59
 
@@ -87,11 +65,6 @@ export function onIconThemeChanged(listener: () => void): () => void {
87
65
  };
88
66
  }
89
67
 
90
- /** Run every subscriber — after any registration that can change a lookup's answer. */
91
- export function notifyIconThemeChanged(): void {
92
- for (const listener of listeners) listener();
93
- }
94
-
95
68
  /** Whether a symbolic glyph for an already-normalized name is in the cascade. */
96
69
  function hasSymbolic(normalized: string): boolean {
97
70
  if (normalized === '') return false;
@@ -102,11 +75,9 @@ function hasSymbolic(normalized: string): boolean {
102
75
  * Resolve `iconName` as `gtk_icon_theme_lookup_by_gicon` would for a `GtkImage`. `null` when
103
76
  * no name was given — the state where GTK draws nothing, not `image-missing`.
104
77
  *
105
- * When neither a colour registration nor a resource holds a name, the request is returned as a
106
- * symbolic one WITHOUT checking the cascade: the mask class falls back to `image-missing`
107
- * through CSS by itself and corrects itself when a later `registerIcon` lands, which is how
108
- * `<gtk-image>` behaved before this module. The cascade is read only to choose between a
109
- * symbolic glyph and a colour entry or file.
78
+ * When no resource holds a name, the request is returned as a symbolic one WITHOUT checking
79
+ * the cascade: the mask class falls back to `image-missing` through CSS by itself. The cascade
80
+ * is read only to choose between a symbolic glyph and a resource file.
110
81
  */
111
82
  export function lookupIcon(iconName: string | null | undefined, request: IconRequest = {}): IconLookup | null {
112
83
  if (iconName === null || iconName === undefined || iconName === '') return null;
@@ -133,7 +104,7 @@ const resourceUrls = new Map<string, string | null>();
133
104
  theme.connect('changed', () => {
134
105
  for (const url of resourceUrls.values()) if (url !== null) URL.revokeObjectURL(url);
135
106
  resourceUrls.clear();
136
- notifyIconThemeChanged();
107
+ for (const listener of listeners) listener();
137
108
  });
138
109
 
139
110
  const RESOURCE_TYPES: Record<string, string> = { '.svg': 'image/svg+xml', '.png': 'image/png' };
@@ -159,8 +130,8 @@ function resourceUrl(path: string): string | null {
159
130
  }
160
131
 
161
132
  /**
162
- * The lookup over the colour registrations and the theme's resource paths; `null` when neither
163
- * answers any name, a `symbolic` entry when the current theme's glyph comes first.
133
+ * The lookup over the theme's resource paths; `null` when no resource answers any name, a
134
+ * `symbolic` entry when the current theme's glyph comes first.
164
135
  */
165
136
  export function resourceIcon(iconName: string, request: IconRequest): IconLookup | null {
166
137
  const match = lookupResourceIcon(theme, {
@@ -170,11 +141,9 @@ export function resourceIcon(iconName: string, request: IconRequest): IconLookup
170
141
  },
171
142
  scale: request.scale ?? 1,
172
143
  themeHas: (name) => hasSymbolic(normalizeIconName(name)),
173
- hicolorHas: (name) => colorIcons.has(name),
174
144
  });
175
145
  if (match === null) return null;
176
146
  if (match.kind === 'theme') return { kind: 'symbolic', name: normalizeIconName(match.name) };
177
- if (match.kind === 'hicolor') return { kind: 'color', name: match.name, url: colorIcons.get(match.name)! };
178
147
  return {
179
148
  kind: 'resource',
180
149
  name: match.name,
@@ -185,78 +154,19 @@ export function resourceIcon(iconName: string, request: IconRequest): IconLookup
185
154
  }
186
155
 
187
156
  /**
188
- * Whether `iconName` resolves to something other than `image-missing` — a registered colour
189
- * icon, a file under a resource path, or a symbolic glyph compiled into the stylesheet or
190
- * registered at runtime.
157
+ * Whether `name` draws something other than `image-missing` — a file under a `Gtk.IconTheme`
158
+ * resource path, or a symbolic glyph compiled into the stylesheet. The name is looked up
159
+ * exactly as `<gtk-image icon-name>` looks it up.
160
+ *
161
+ * Reads the live cascade rather than a generated list, so it answers for a glyph that arrived
162
+ * by any route, including a consumer's own `--icon-<name>` declaration. It is deliberately the
163
+ * CUSTOM PROPERTY that is read and not the rendered `mask-image` of a probe element: since
164
+ * `_icon.scss` gives every icon box the `image-missing` fallback, a rendered mask is never
165
+ * `none`, and comparing against the fallback would answer `false` for `image-missing` itself.
191
166
  */
192
- export function iconResolves(iconName: string): boolean {
193
- const found = lookupIcon(iconName);
167
+ export function isIconAvailable(name: string): boolean {
168
+ const found = lookupIcon(name);
194
169
  if (found === null || found.kind === 'missing') return false;
195
170
  if (found.kind === 'resource') return found.url !== null;
196
- return found.kind === 'color' || hasSymbolic(found.name);
197
- }
198
-
199
- /** `source` as a URL `background-image` can load, or a thrown reason why not. */
200
- function colorIconUrl(name: string, source: string): string {
201
- if (source.trimStart().startsWith('<')) {
202
- const root = new DOMParser().parseFromString(source, 'image/svg+xml').documentElement;
203
- if (root.tagName !== 'svg') {
204
- throw new TypeError(
205
- `registerColorIcon(${JSON.stringify(name)}): the source starts with '<' but parsed ` +
206
- `to <${root.tagName}>, not an <svg> root.`,
207
- );
208
- }
209
- return toDataUri(source);
210
- }
211
-
212
- let url: URL;
213
- try {
214
- url = new URL(source, document.baseURI);
215
- } catch {
216
- throw new TypeError(`registerColorIcon(${JSON.stringify(name)}): the source is neither SVG source nor a URL.`);
217
- }
218
- const isImageData = url.protocol === 'data:' && /^data:image\//i.test(url.href);
219
- if (!isImageData && !ALLOWED_PROTOCOLS.has(url.protocol)) {
220
- throw new TypeError(
221
- `registerColorIcon(${JSON.stringify(name)}): ${JSON.stringify(url.protocol)} URLs are not ` +
222
- 'accepted — use http(s):, blob:, file: or a data:image/ URI.',
223
- );
224
- }
225
- return url.href;
226
- }
227
-
228
- /**
229
- * Register a FULL-COLOUR icon under `name` — what an application ships in
230
- * `hicolor/scalable/apps/<app-id>.svg` and GTK finds through its icon theme. Every
231
- * `<gtk-image>` asking for the name draws the image unrecoloured, the way `AdwAboutDialog`'s
232
- * `application-icon` does on GNOME.
233
- *
234
- * `name` is the EXACT icon name, reverse-DNS application IDs included. A name with a
235
- * `-symbolic` suffix THROWS: that is the other half of the theme, and {@link registerIcon}
236
- * is its door. `source` is SVG source, or a URL (resolved against the document) to any
237
- * image the browser can draw.
238
- *
239
- * Re-registering a name replaces the image, and every mounted `<gtk-image>` redraws.
240
- *
241
- * CLIENT-SIDE ONLY, like `registerIcon`: it reads `document`.
242
- */
243
- export function registerColorIcon(name: string, source: string): void {
244
- if (typeof name !== 'string' || name === '' || /\s/.test(name)) {
245
- throw new TypeError(
246
- `registerColorIcon: ${JSON.stringify(name)} is not an icon name — it must be non-empty ` +
247
- 'and contain no whitespace.',
248
- );
249
- }
250
- if (SYMBOLIC_FILE_NAME.test(name)) {
251
- throw new TypeError(
252
- `registerColorIcon: ${JSON.stringify(name)} names a SYMBOLIC icon, which is recoloured ` +
253
- 'rather than drawn as-is — register it with registerIcon() instead.',
254
- );
255
- }
256
- if (typeof source !== 'string' || source.trim() === '') {
257
- throw new TypeError(`registerColorIcon(${JSON.stringify(name)}): the source is empty.`);
258
- }
259
-
260
- colorIcons.set(name, colorIconUrl(name, source));
261
- notifyIconThemeChanged();
171
+ return hasSymbolic(found.name);
262
172
  }
package/src/index.ts CHANGED
@@ -80,18 +80,14 @@ export type { AdwUndershootEdges } from './scroll-shading.js';
80
80
  // replaying an authored tree — a storybook fixture, a devtools probe, the shared-trees
81
81
  // spec itself — has a route to it that is not a `.spec.ts` import; see that file's header
82
82
  // for why `mountSharedTree` and not `buildSharedTree` alone is the instantiation half.
83
- export { buildSharedTree, mountSharedTree } from './shared-tree-builder.js';
84
- export type { MountOptions, MountedSharedTree, SizeSource } from './shared-tree-builder.js';
83
+ export { buildSharedTree, buildWithSiblings, mountSharedTree } from './shared-tree-builder.js';
84
+ export type { BuildOptions, BuiltTree, MountOptions, MountedSharedTree, SizeSource } from './shared-tree-builder.js';
85
85
  export { registerTemplateClass } from './template-classes.js';
86
86
 
87
87
  // The stylesheet compiles a chosen SUBSET of `@gjsify/adwaita-icons` (the whole set is
88
- // ~1.07 MB of data-URI), so a name outside it draws the `image-missing` fallback. This is
89
- // the way in for an app that needs a glyph this package does not ship — see
90
- // `icon-registry.ts` for the full recipe.
91
- export { isIconAvailable, registerIcon } from './icon-registry.js';
92
- // The full-colour half of the icon theme — an application icon drawn as-is, the web stand-in
93
- // for an app's `hicolor/…/apps/<app-id>.svg`. See `icon-theme.ts` for the lookup order.
94
- export { registerColorIcon } from './icon-theme.js';
88
+ // ~1.07 MB of data-URI). An app's own icons, symbolic and full-colour, come from its
89
+ // GResource through `Gtk.IconTheme`'s resource paths (ADR 0116); see `icon-theme.ts`.
90
+ export { isIconAvailable } from './icon-theme.js';
95
91
 
96
92
  // THE WIDGET CLASSES ARE REACHABLE ONLY AS `Adw.<Name>` / `Gtk.<Name>` (ADR 0034
97
93
  // clause 2 + § Amendment 6). The namespace used to be the LAST line in the file, under a
@@ -314,8 +314,8 @@ export const AdwKeyboardOperableTest = async () => {
314
314
  '<adw-alert-response id="ok">OK</adw-alert-response>' +
315
315
  '<adw-alert-response id="cancel">Cancel</adw-alert-response>',
316
316
  );
317
- el.setDefaultResponse('ok');
318
- el.setResponseEnabled('ok', false);
317
+ el.set_default_response('ok');
318
+ el.set_response_enabled('ok', false);
319
319
  opener.focus();
320
320
  el.setAttribute('open', '');
321
321
 
@@ -344,7 +344,7 @@ export const AdwKeyboardOperableTest = async () => {
344
344
  '<adw-alert-response id="ok">OK</adw-alert-response>' +
345
345
  '<adw-alert-response id="cancel">Cancel</adw-alert-response>',
346
346
  );
347
- el.setDefaultResponse('ok');
347
+ el.set_default_response('ok');
348
348
  el.setAttribute('open', '');
349
349
 
350
350
  // `adw_alert_dialog_grab_focus` tries the CONTENT first (adw-alert-dialog.c:397)
@@ -0,0 +1,113 @@
1
+ // Learn6502's `main.window.blp`, reduced to the shapes that rendered short through
2
+ // `buildWithSiblings`: header-bar buttons after a single `[start]` (GtkBuilder packs an untyped
3
+ // child at start too), and `Overlay { child: Adw.ToastOverlay { Stack } }`. Every
4
+ // widget the file authors has to be in the document once the built window is attached — the
5
+ // failure was widgets that were built and then silently dropped on the way.
6
+ import { describe, expect, it } from '@gjsify/unit';
7
+ import { parseBlueprint, projectToSharedNode } from '@gjsify/blueprint';
8
+
9
+ import { buildWithSiblings } from './shared-tree-builder.js';
10
+
11
+ const BLUEPRINT = `using Gtk 4.0;
12
+ using Adw 1;
13
+
14
+ Adw.ApplicationWindow mainWindow {
15
+ content: Adw.ToolbarView toolbarView {
16
+ [top]
17
+ Adw.HeaderBar headerBar {
18
+ title-widget: Label titleLabel {
19
+ label: "Learn 6502";
20
+ };
21
+
22
+ [start]
23
+ ToggleButton sidebarToggleButton {
24
+ icon-name: "sidebar-show-symbolic";
25
+ }
26
+
27
+ Button learnBackButton {
28
+ icon-name: "go-previous-symbolic";
29
+ }
30
+
31
+ Button unsavedChangesIndicator {
32
+ icon-name: "dot-symbolic";
33
+ }
34
+
35
+ [end]
36
+ MenuButton menuButton {
37
+ icon-name: "open-menu-symbolic";
38
+ }
39
+ }
40
+
41
+ content: Overlay mainOverlay {
42
+ child: Adw.ToastOverlay toastOverlay {
43
+ Stack layoutHost {
44
+ StackPage singlePage {
45
+ name: "single";
46
+ child: Adw.Bin singleContainer {
47
+ child: Label singleLabel {
48
+ label: "single";
49
+ };
50
+ };
51
+ }
52
+
53
+ StackPage threePage {
54
+ name: "three";
55
+ child: Adw.Bin threeColumnContainer {
56
+ child: Box threeColumns {
57
+ Label threeLabel {
58
+ label: "three";
59
+ }
60
+ };
61
+ };
62
+ }
63
+ }
64
+ };
65
+ };
66
+ };
67
+ }
68
+ `;
69
+
70
+ const AUTHORED = [
71
+ 'toolbarView',
72
+ 'headerBar',
73
+ 'titleLabel',
74
+ 'sidebarToggleButton',
75
+ 'learnBackButton',
76
+ 'unsavedChangesIndicator',
77
+ 'menuButton',
78
+ 'mainOverlay',
79
+ 'toastOverlay',
80
+ 'layoutHost',
81
+ 'singleContainer',
82
+ 'singleLabel',
83
+ 'threeColumnContainer',
84
+ 'threeColumns',
85
+ 'threeLabel',
86
+ ];
87
+
88
+ export const AdwLearn6502WindowTest = async () => {
89
+ await describe("Learn6502's main window through buildWithSiblings", async () => {
90
+ const { node, lost } = projectToSharedNode(parseBlueprint(BLUEPRINT, 'main.window.blp'));
91
+
92
+ await it('projects without losing anything', () => {
93
+ expect(lost.map((loss) => `${loss.kind}@${loss.line}`).join()).toBe('');
94
+ });
95
+
96
+ await it('puts every authored widget in the document, the start buttons at start', () => {
97
+ const { root } = buildWithSiblings(node);
98
+ document.body.append(root);
99
+ const missing = AUTHORED.filter((id) => !root.querySelector(`#${id}`)?.isConnected);
100
+ const start = ['sidebarToggleButton', 'learnBackButton', 'unsavedChangesIndicator'].filter(
101
+ (id) => root.querySelector(`#${id}`)?.parentElement?.className !== 'adw-header-bar-start',
102
+ );
103
+ const toast = root.querySelector('#toastOverlay');
104
+ const overlaid =
105
+ toast?.closest('.adw-overlay-child') === root.querySelector('#mainOverlay > .adw-overlay-child');
106
+ root.remove();
107
+
108
+ expect(missing.join()).toBe('');
109
+ expect(start.join()).toBe('');
110
+ expect(overlaid).toBe(true);
111
+ });
112
+ });
113
+ };
@@ -111,4 +111,4 @@ export { AdwWindowTitle as WindowTitle } from '../elements/adw-window-title.js';
111
111
  export { AdwWrapBox as WrapBox } from '../elements/adw-wrap-box.js';
112
112
  export { AdwApplication as Application } from '../application.js';
113
113
  export { AdwStyleManager as StyleManager } from '../style-manager.js';
114
- export { ColorScheme } from '@gjsify/adwaita-core';
114
+ export { ColorScheme, Toast, ToastPriority } from '@gjsify/adwaita-core';
@@ -15,6 +15,7 @@ export const Display = gdk.Display;
15
15
  export const Clipboard = gdk.Clipboard;
16
16
  export const ContentProvider = gdk.ContentProvider;
17
17
  export const ContentFormats = gdk.ContentFormats;
18
+ export const AppLaunchContext = gdk.AppLaunchContext;
18
19
 
19
20
  export const CURRENT_TIME = GDK_PLATFORM_CURRENT_TIME;
20
21
  export const {
@@ -24,6 +24,10 @@
24
24
 
25
25
  import '../file-chooser-host.js';
26
26
 
27
+ import { createAppInfo } from '@gjsify/adwaita-core';
28
+
29
+ import { webPlatformHost } from '../platform-host.js';
30
+
27
31
  export { GioMenu as Menu, GioMenuItem as MenuItem } from '@gjsify/adwaita-core';
28
32
  export {
29
33
  GioFile as File,
@@ -47,3 +51,7 @@ export {
47
51
  } from '@gjsify/adwaita-core';
48
52
  export { GioApplication as Application } from '../application.js';
49
53
  export { Settings } from '@gjsify/app-settings/browser';
54
+
55
+ // `Gio.AppInfo.launch_default_for_uri` over the host `Gtk.show_uri` uses (ADR 0101): the core's
56
+ // `gio-app-info.ts`.
57
+ export const AppInfo = createAppInfo(webPlatformHost);
@@ -7,6 +7,8 @@
7
7
  // in `glib-paths.ts` of the core; the host has no filesystem, so `get_current_dir()` is `"/"` and
8
8
  // `get_system_data_dirs()` is `[]`. A port that knows better replaces the member in its own file.
9
9
  //
10
+ // `uri_escape_string` is the core's `glib-uri.ts`, a pure function over UTF-8 bytes.
11
+ //
10
12
  // `Bytes` and `Error` are the ADR 0100 subset a `Gio.File` reads and fails with (`get_data`,
11
13
  // `matches`, `code`, `message`), re-exported from the core's `glib-bytes.ts` / `glib-error.ts`.
12
14
  //
@@ -21,6 +23,7 @@ import {
21
23
  getCurrentDir,
22
24
  getSystemDataDirs,
23
25
  MAXUINT32 as GLIB_MAXUINT32,
26
+ uriEscapeString,
24
27
  } from '@gjsify/adwaita-core';
25
28
 
26
29
  const glib = createGLibTimers();
@@ -40,3 +43,4 @@ export const MAXUINT32 = GLIB_MAXUINT32;
40
43
  export const build_filenamev = buildFilenamev;
41
44
  export const get_current_dir = getCurrentDir;
42
45
  export const get_system_data_dirs = getSystemDataDirs;
46
+ export const uri_escape_string = uriEscapeString;
@@ -86,6 +86,7 @@ export { GtkSeparator as Separator } from '../elements/gtk-separator.js';
86
86
  export { GtkSpinButton as SpinButton } from '../elements/gtk-spin-button.js';
87
87
  export { GtkSpinner as Spinner } from '../elements/gtk-spinner.js';
88
88
  export { GtkStack as Stack } from '../elements/gtk-stack.js';
89
+ export { GtkStackPage as StackPage } from '../elements/gtk-stack-page.js';
89
90
  export { GtkStackSidebar as StackSidebar } from '../elements/gtk-stack-sidebar.js';
90
91
  export { GtkStackSwitcher as StackSwitcher } from '../elements/gtk-stack-switcher.js';
91
92
  export { GtkStringList as StringList } from '@gjsify/adwaita-core';
@@ -101,6 +102,7 @@ export type { WindowCommon } from '@gjsify/adwaita-core';
101
102
  export { GtkWindowControls as WindowControls } from '../elements/gtk-window-controls.js';
102
103
  export { GtkViewport as Viewport } from '../elements/gtk-viewport.js';
103
104
  export { GtkWindowHandle as WindowHandle } from '../elements/gtk-window-handle.js';
105
+ export { ApplicationInhibitFlags } from '@gjsify/adwaita-core';
104
106
  export { GtkApplication as Application } from '../application.js';
105
107
  export {
106
108
  STYLE_PROVIDER_PRIORITY_APPLICATION,