@gjsify/adwaita-web 0.54.0 → 0.56.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.
Files changed (479) hide show
  1. package/README.md +8 -0
  2. package/dist/adwaita-web.css +8146 -3011
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/adw-application-window.spec.d.ts +1 -0
  5. package/lib/types/adw-bin.spec.d.ts +1 -0
  6. package/lib/types/adw-breakpoint-bin.spec.d.ts +1 -0
  7. package/lib/types/adw-clamp-scrollable.spec.d.ts +1 -0
  8. package/lib/types/adw-multi-layout-view.spec.d.ts +1 -0
  9. package/lib/types/adw-preferences-row.spec.d.ts +1 -0
  10. package/lib/types/adw-shortcuts.spec.d.ts +1 -0
  11. package/lib/types/adw-status-page.spec.d.ts +1 -0
  12. package/lib/types/adw-tab-bar.spec.d.ts +1 -0
  13. package/lib/types/adw-tab-button.spec.d.ts +1 -0
  14. package/lib/types/adw-tab-overview.spec.d.ts +1 -0
  15. package/lib/types/adw-view-switcher-sidebar.spec.d.ts +1 -0
  16. package/lib/types/adw-window.spec.d.ts +1 -0
  17. package/lib/types/attributes.d.ts +19 -0
  18. package/lib/types/breakpoints.d.ts +14 -3
  19. package/lib/types/construct-vectors.spec.d.ts +1 -0
  20. package/lib/types/elements/adw-action-row.d.ts +4 -0
  21. package/lib/types/elements/adw-application-window.d.ts +27 -0
  22. package/lib/types/elements/adw-bin.d.ts +17 -0
  23. package/lib/types/elements/adw-breakpoint-bin.d.ts +67 -0
  24. package/lib/types/elements/adw-clamp-scrollable.d.ts +38 -0
  25. package/lib/types/elements/adw-combo-row.d.ts +4 -0
  26. package/lib/types/elements/adw-dialog.d.ts +10 -0
  27. package/lib/types/elements/adw-entry-row.d.ts +6 -0
  28. package/lib/types/elements/adw-expander-row.d.ts +2 -0
  29. package/lib/types/elements/adw-header-bar.d.ts +6 -0
  30. package/lib/types/elements/adw-layout-slot.d.ts +19 -0
  31. package/lib/types/elements/adw-multi-layout-view.d.ts +101 -0
  32. package/lib/types/elements/adw-overlay-split-view.d.ts +13 -0
  33. package/lib/types/elements/adw-preferences-row.d.ts +31 -0
  34. package/lib/types/elements/adw-shortcuts-dialog.d.ts +13 -0
  35. package/lib/types/elements/adw-shortcuts-item.d.ts +36 -0
  36. package/lib/types/elements/adw-shortcuts-section.d.ts +14 -0
  37. package/lib/types/elements/adw-sidebar.d.ts +8 -2
  38. package/lib/types/elements/adw-spin-row.d.ts +6 -0
  39. package/lib/types/elements/adw-switch-row.d.ts +7 -0
  40. package/lib/types/elements/adw-tab-bar.d.ts +108 -0
  41. package/lib/types/elements/adw-tab-button.d.ts +32 -0
  42. package/lib/types/elements/adw-tab-overview.d.ts +199 -0
  43. package/lib/types/elements/adw-tab-view.d.ts +19 -23
  44. package/lib/types/elements/adw-toggle-group.d.ts +17 -0
  45. package/lib/types/elements/adw-view-switcher-sidebar.d.ts +84 -0
  46. package/lib/types/elements/adw-window.d.ts +40 -0
  47. package/lib/types/elements/gtk-about-dialog.d.ts +146 -0
  48. package/lib/types/elements/gtk-application-window.d.ts +34 -0
  49. package/lib/types/elements/gtk-aspect-frame.d.ts +27 -0
  50. package/lib/types/elements/gtk-button.d.ts +9 -0
  51. package/lib/types/elements/gtk-calendar.d.ts +159 -0
  52. package/lib/types/elements/gtk-center-box.d.ts +39 -0
  53. package/lib/types/elements/gtk-color-dialog-button.d.ts +69 -0
  54. package/lib/types/elements/gtk-column-view.d.ts +50 -0
  55. package/lib/types/elements/gtk-drag-icon.d.ts +78 -0
  56. package/lib/types/elements/gtk-drawing-area.d.ts +95 -0
  57. package/lib/types/elements/gtk-editable-label.d.ts +33 -0
  58. package/lib/types/elements/gtk-emoji-chooser.d.ts +84 -0
  59. package/lib/types/elements/gtk-entry.d.ts +20 -1
  60. package/lib/types/elements/gtk-expander.d.ts +49 -0
  61. package/lib/types/elements/gtk-fixed.d.ts +13 -0
  62. package/lib/types/elements/gtk-flow-box-child.d.ts +14 -0
  63. package/lib/types/elements/gtk-flow-box.d.ts +87 -0
  64. package/lib/types/elements/gtk-font-dialog-button.d.ts +83 -0
  65. package/lib/types/elements/gtk-frame.d.ts +24 -0
  66. package/lib/types/elements/gtk-gl-area.d.ts +136 -0
  67. package/lib/types/elements/gtk-graphics-offload.d.ts +24 -0
  68. package/lib/types/elements/gtk-grid-view.d.ts +39 -0
  69. package/lib/types/elements/gtk-grid.d.ts +27 -0
  70. package/lib/types/elements/gtk-header-bar.d.ts +60 -0
  71. package/lib/types/elements/gtk-inscription.d.ts +64 -0
  72. package/lib/types/elements/gtk-label.d.ts +3 -0
  73. package/lib/types/elements/gtk-level-bar.d.ts +59 -0
  74. package/lib/types/elements/gtk-link-button.d.ts +29 -0
  75. package/lib/types/elements/gtk-list-box-row.d.ts +54 -0
  76. package/lib/types/elements/gtk-list-box.d.ts +100 -0
  77. package/lib/types/elements/gtk-list-view.d.ts +73 -0
  78. package/lib/types/elements/gtk-media-controls.d.ts +142 -0
  79. package/lib/types/elements/gtk-notebook.d.ts +148 -0
  80. package/lib/types/elements/gtk-overlay.d.ts +22 -0
  81. package/lib/types/elements/gtk-page-setup-unix-dialog.d.ts +87 -0
  82. package/lib/types/elements/gtk-paned.d.ts +121 -0
  83. package/lib/types/elements/gtk-password-entry.d.ts +27 -0
  84. package/lib/types/elements/gtk-picture.d.ts +66 -0
  85. package/lib/types/elements/gtk-popover-bin.d.ts +82 -0
  86. package/lib/types/elements/gtk-popover-menu-bar.d.ts +66 -0
  87. package/lib/types/elements/gtk-popover-menu.d.ts +83 -0
  88. package/lib/types/elements/gtk-popover.d.ts +28 -3
  89. package/lib/types/elements/gtk-print-unix-dialog.d.ts +167 -0
  90. package/lib/types/elements/gtk-revealer.d.ts +55 -0
  91. package/lib/types/elements/gtk-scale-button.d.ts +59 -0
  92. package/lib/types/elements/gtk-scale.d.ts +98 -0
  93. package/lib/types/elements/gtk-scrollbar.d.ts +124 -0
  94. package/lib/types/elements/gtk-scrolled-window.d.ts +129 -0
  95. package/lib/types/elements/gtk-search-bar.d.ts +39 -0
  96. package/lib/types/elements/gtk-search-entry.d.ts +27 -0
  97. package/lib/types/elements/gtk-separator.d.ts +10 -0
  98. package/lib/types/elements/gtk-spin-button.d.ts +94 -0
  99. package/lib/types/elements/gtk-spinner.d.ts +14 -0
  100. package/lib/types/elements/gtk-stack-sidebar.d.ts +43 -0
  101. package/lib/types/elements/gtk-stack-switcher.d.ts +58 -0
  102. package/lib/types/elements/gtk-stack.d.ts +154 -0
  103. package/lib/types/elements/gtk-switch.d.ts +4 -1
  104. package/lib/types/elements/gtk-text-view.d.ts +62 -0
  105. package/lib/types/elements/gtk-text.d.ts +45 -0
  106. package/lib/types/elements/gtk-toggle-button.d.ts +45 -0
  107. package/lib/types/elements/gtk-tree-expander.d.ts +38 -0
  108. package/lib/types/elements/gtk-video.d.ts +97 -0
  109. package/lib/types/elements/gtk-viewport.d.ts +84 -0
  110. package/lib/types/elements/gtk-window-controls.d.ts +80 -0
  111. package/lib/types/elements/gtk-window-handle.d.ts +39 -0
  112. package/lib/types/elements/gtk-window.d.ts +103 -0
  113. package/lib/types/elements/justification.d.ts +2 -0
  114. package/lib/types/elements/popover-menu.d.ts +18 -0
  115. package/lib/types/elements/roving-focus.d.ts +29 -1
  116. package/lib/types/emoji-data.d.ts +38 -0
  117. package/lib/types/font-description.d.ts +96 -0
  118. package/lib/types/gtk-about-dialog.spec.d.ts +1 -0
  119. package/lib/types/gtk-action-bar.spec.d.ts +1 -0
  120. package/lib/types/gtk-application-window.spec.d.ts +1 -0
  121. package/lib/types/gtk-aspect-frame.spec.d.ts +1 -0
  122. package/lib/types/gtk-calendar.spec.d.ts +1 -0
  123. package/lib/types/gtk-center-box.spec.d.ts +1 -0
  124. package/lib/types/gtk-color-dialog-button.spec.d.ts +1 -0
  125. package/lib/types/gtk-column-view.spec.d.ts +1 -0
  126. package/lib/types/gtk-drag-icon.spec.d.ts +1 -0
  127. package/lib/types/gtk-drawing-area.spec.d.ts +1 -0
  128. package/lib/types/gtk-editable-label.spec.d.ts +1 -0
  129. package/lib/types/gtk-emoji-chooser.spec.d.ts +1 -0
  130. package/lib/types/gtk-expander.spec.d.ts +1 -0
  131. package/lib/types/gtk-fixed.spec.d.ts +1 -0
  132. package/lib/types/gtk-flow-box.spec.d.ts +1 -0
  133. package/lib/types/gtk-font-dialog-button.spec.d.ts +1 -0
  134. package/lib/types/gtk-frame.spec.d.ts +1 -0
  135. package/lib/types/gtk-gl-area.spec.d.ts +1 -0
  136. package/lib/types/gtk-graphics-offload.spec.d.ts +1 -0
  137. package/lib/types/gtk-grid-view.spec.d.ts +1 -0
  138. package/lib/types/gtk-grid.spec.d.ts +1 -0
  139. package/lib/types/gtk-header-bar.spec.d.ts +1 -0
  140. package/lib/types/gtk-inscription.spec.d.ts +1 -0
  141. package/lib/types/gtk-level-bar.spec.d.ts +1 -0
  142. package/lib/types/gtk-link-button.spec.d.ts +1 -0
  143. package/lib/types/gtk-list-box.spec.d.ts +1 -0
  144. package/lib/types/gtk-list-view.spec.d.ts +1 -0
  145. package/lib/types/gtk-media-controls.spec.d.ts +1 -0
  146. package/lib/types/gtk-notebook.spec.d.ts +1 -0
  147. package/lib/types/gtk-overlay.spec.d.ts +1 -0
  148. package/lib/types/gtk-paned.spec.d.ts +1 -0
  149. package/lib/types/gtk-password-entry.spec.d.ts +1 -0
  150. package/lib/types/gtk-picture.spec.d.ts +1 -0
  151. package/lib/types/gtk-popover-bin.spec.d.ts +1 -0
  152. package/lib/types/gtk-popover-menu-bar.spec.d.ts +1 -0
  153. package/lib/types/gtk-popover-menu.spec.d.ts +1 -0
  154. package/lib/types/gtk-popover-role.spec.d.ts +1 -0
  155. package/lib/types/gtk-popover.spec.d.ts +1 -0
  156. package/lib/types/gtk-print-dialogs.spec.d.ts +1 -0
  157. package/lib/types/gtk-revealer.spec.d.ts +1 -0
  158. package/lib/types/gtk-scale-button.spec.d.ts +1 -0
  159. package/lib/types/gtk-scale.spec.d.ts +1 -0
  160. package/lib/types/gtk-scrollbar.spec.d.ts +1 -0
  161. package/lib/types/gtk-scrolled-window.spec.d.ts +1 -0
  162. package/lib/types/gtk-search-bar.spec.d.ts +1 -0
  163. package/lib/types/gtk-search-entry.spec.d.ts +1 -0
  164. package/lib/types/gtk-separator.spec.d.ts +1 -0
  165. package/lib/types/gtk-spin-button.spec.d.ts +1 -0
  166. package/lib/types/gtk-spinner.spec.d.ts +1 -0
  167. package/lib/types/gtk-stack-sidebar.spec.d.ts +1 -0
  168. package/lib/types/gtk-stack-switcher.spec.d.ts +1 -0
  169. package/lib/types/gtk-stack.spec.d.ts +1 -0
  170. package/lib/types/gtk-text-view.spec.d.ts +1 -0
  171. package/lib/types/gtk-text.spec.d.ts +1 -0
  172. package/lib/types/gtk-toggle-button.spec.d.ts +1 -0
  173. package/lib/types/gtk-tree-expander.spec.d.ts +1 -0
  174. package/lib/types/gtk-video.spec.d.ts +1 -0
  175. package/lib/types/gtk-viewport.spec.d.ts +1 -0
  176. package/lib/types/gtk-window-controls.spec.d.ts +1 -0
  177. package/lib/types/gtk-window-handle.spec.d.ts +1 -0
  178. package/lib/types/gtk-window.spec.d.ts +1 -0
  179. package/lib/types/index.d.ts +4 -1
  180. package/lib/types/list-view-dom.d.ts +44 -0
  181. package/lib/types/namespace/adw.d.ts +12 -0
  182. package/lib/types/namespace/gtk.d.ts +61 -0
  183. package/lib/types/page-setup.d.ts +100 -0
  184. package/lib/types/row-line-clamp.d.ts +20 -0
  185. package/lib/types/row-tooltip.d.ts +8 -0
  186. package/lib/types/row-tooltip.spec.d.ts +1 -0
  187. package/lib/types/scroll-shading.d.ts +15 -1
  188. package/lib/types/shared-tree-builder.d.ts +75 -17
  189. package/lib/types/shared-tree-mount.spec.d.ts +1 -0
  190. package/lib/types/signals.d.ts +4 -0
  191. package/lib/types/styles.generated.d.ts +1 -1
  192. package/lib/types/tab-chip.d.ts +73 -0
  193. package/lib/types/template-classes.d.ts +11 -0
  194. package/lib/types/widget-size.spec.d.ts +1 -0
  195. package/package.json +12 -8
  196. package/scss/_action_row.scss +41 -17
  197. package/scss/_application_window.scss +26 -0
  198. package/scss/_aspect_frame.scss +25 -0
  199. package/scss/_bin.scss +26 -0
  200. package/scss/_button.scss +45 -0
  201. package/scss/_button_row.scss +5 -0
  202. package/scss/_calendar.scss +176 -0
  203. package/scss/_center_box.scss +25 -0
  204. package/scss/_checks.scss +6 -1
  205. package/scss/_clamp_scrollable.scss +28 -0
  206. package/scss/_color_button.scss +67 -0
  207. package/scss/_column_view.scss +126 -0
  208. package/scss/_drag_icon.scss +55 -0
  209. package/scss/_drawing.scss +85 -0
  210. package/scss/_emoji_chooser.scss +213 -0
  211. package/scss/_entry.scss +13 -5
  212. package/scss/_entry_row.scss +1 -1
  213. package/scss/_expander.scss +113 -0
  214. package/scss/_expander_row.scss +36 -3
  215. package/scss/_fixed.scss +29 -0
  216. package/scss/_flow_box.scss +94 -0
  217. package/scss/_font_button.scss +63 -0
  218. package/scss/_frame.scss +41 -0
  219. package/scss/_grid.scss +19 -0
  220. package/scss/_grid_view.scss +46 -0
  221. package/scss/_gtk_about_dialog.scss +186 -0
  222. package/scss/_headerbar.scss +134 -1
  223. package/scss/_icons.generated.scss +186 -0
  224. package/scss/_inscription.scss +125 -0
  225. package/scss/_level_bar.scss +190 -0
  226. package/scss/_link.scss +82 -0
  227. package/scss/_list_box.scss +88 -0
  228. package/scss/_list_view.scss +96 -0
  229. package/scss/_media_controls.scss +139 -0
  230. package/scss/_overlay.scss +68 -0
  231. package/scss/_paned.scss +130 -0
  232. package/scss/_password_entry.scss +83 -0
  233. package/scss/_picture.scss +80 -0
  234. package/scss/_popover_bin.scss +53 -0
  235. package/scss/_popover_menu_bar.scss +104 -0
  236. package/scss/_preferences_row.scss +60 -0
  237. package/scss/_print_dialogs.scss +328 -0
  238. package/scss/_reset.scss +21 -19
  239. package/scss/_revealer.scss +37 -0
  240. package/scss/_row.scss +36 -5
  241. package/scss/_scale.scss +298 -0
  242. package/scss/_scale_button.scss +167 -0
  243. package/scss/_scrollbar.scss +230 -0
  244. package/scss/_scrolled_window.scss +131 -0
  245. package/scss/_search_bar.scss +118 -0
  246. package/scss/_search_entry.scss +86 -0
  247. package/scss/_separator.scss +44 -0
  248. package/scss/_shortcuts_dialog.scss +100 -0
  249. package/scss/_spin_button.scss +172 -0
  250. package/scss/_spin_row.scss +56 -8
  251. package/scss/_spinner.scss +85 -4
  252. package/scss/_stack.scss +729 -0
  253. package/scss/_status_page.scss +1 -1
  254. package/scss/_switch.scss +13 -5
  255. package/scss/_switch_row.scss +10 -0
  256. package/scss/_tab_bar.scss +317 -0
  257. package/scss/_tab_button.scss +98 -0
  258. package/scss/_tab_overview.scss +483 -0
  259. package/scss/_text.scss +182 -0
  260. package/scss/_theme.scss +1 -1
  261. package/scss/_toggle_group.scss +28 -0
  262. package/scss/_tree_expander.scss +62 -0
  263. package/scss/_variables.scss +1 -1
  264. package/scss/_video.scss +146 -0
  265. package/scss/_view_switcher_sidebar.scss +112 -0
  266. package/scss/_viewport.scss +50 -0
  267. package/scss/_widget.scss +14 -3
  268. package/scss/_window.scss +131 -2
  269. package/scss/_window_handle.scss +20 -0
  270. package/scss/adwaita-skin.scss +109 -0
  271. package/src/adw-action-rows.spec.ts +331 -0
  272. package/src/adw-application-window.spec.ts +118 -0
  273. package/src/adw-bin.spec.ts +75 -0
  274. package/src/adw-breakpoint-bin.spec.ts +324 -0
  275. package/src/adw-clamp-scrollable.spec.ts +189 -0
  276. package/src/adw-header-bar.spec.ts +18 -0
  277. package/src/adw-multi-layout-view.spec.ts +243 -0
  278. package/src/adw-preferences-row.spec.ts +164 -0
  279. package/src/adw-row-state.spec.ts +142 -0
  280. package/src/adw-shortcuts.spec.ts +155 -0
  281. package/src/adw-status-page.spec.ts +124 -0
  282. package/src/adw-tab-bar.spec.ts +287 -0
  283. package/src/adw-tab-button.spec.ts +101 -0
  284. package/src/adw-tab-overview.spec.ts +443 -0
  285. package/src/adw-view-switcher-sidebar.spec.ts +281 -0
  286. package/src/adw-window.spec.ts +129 -0
  287. package/src/attributes.ts +52 -0
  288. package/src/breakpoints.ts +25 -8
  289. package/src/capabilities.d.mts +3 -0
  290. package/src/capabilities.mjs +21 -0
  291. package/src/connect-lifecycle.spec.ts +12 -0
  292. package/src/construct-vectors.spec.ts +175 -0
  293. package/src/elements/adw-action-row.ts +31 -2
  294. package/src/elements/adw-alert-dialog.ts +4 -1
  295. package/src/elements/adw-application-window.ts +154 -0
  296. package/src/elements/adw-bin.ts +101 -0
  297. package/src/elements/adw-breakpoint-bin.ts +287 -0
  298. package/src/elements/adw-button-row.ts +7 -1
  299. package/src/elements/adw-clamp-scrollable.ts +207 -0
  300. package/src/elements/adw-combo-row.ts +26 -1
  301. package/src/elements/adw-dialog.ts +19 -0
  302. package/src/elements/adw-entry-row.ts +22 -12
  303. package/src/elements/adw-expander-row.ts +34 -1
  304. package/src/elements/adw-header-bar.ts +18 -4
  305. package/src/elements/adw-layout-slot.ts +95 -0
  306. package/src/elements/adw-multi-layout-view.ts +326 -0
  307. package/src/elements/adw-overlay-split-view.ts +29 -6
  308. package/src/elements/adw-preferences-row.ts +153 -0
  309. package/src/elements/adw-shortcuts-dialog.ts +52 -0
  310. package/src/elements/adw-shortcuts-item.ts +171 -0
  311. package/src/elements/adw-shortcuts-section.ts +86 -0
  312. package/src/elements/adw-sidebar.ts +74 -7
  313. package/src/elements/adw-spin-row.ts +37 -2
  314. package/src/elements/adw-status-page.ts +10 -2
  315. package/src/elements/adw-switch-row.ts +53 -2
  316. package/src/elements/adw-tab-bar.ts +529 -0
  317. package/src/elements/adw-tab-button.ts +194 -0
  318. package/src/elements/adw-tab-overview.ts +1011 -0
  319. package/src/elements/adw-tab-view.ts +66 -145
  320. package/src/elements/adw-toggle-group.ts +138 -14
  321. package/src/elements/adw-view-stack.ts +18 -0
  322. package/src/elements/adw-view-switcher-sidebar.ts +332 -0
  323. package/src/elements/adw-window.ts +190 -11
  324. package/src/elements/checks.ts +35 -8
  325. package/src/elements/gtk-about-dialog.ts +811 -0
  326. package/src/elements/gtk-application-window.ts +108 -0
  327. package/src/elements/gtk-aspect-frame.ts +160 -0
  328. package/src/elements/gtk-button.ts +12 -0
  329. package/src/elements/gtk-calendar.ts +757 -0
  330. package/src/elements/gtk-center-box.ts +184 -0
  331. package/src/elements/gtk-color-dialog-button.ts +278 -0
  332. package/src/elements/gtk-column-view.ts +320 -0
  333. package/src/elements/gtk-drag-icon.ts +257 -0
  334. package/src/elements/gtk-drawing-area.ts +303 -0
  335. package/src/elements/gtk-editable-label.ts +204 -0
  336. package/src/elements/gtk-emoji-chooser.ts +542 -0
  337. package/src/elements/gtk-entry.ts +39 -5
  338. package/src/elements/gtk-expander.ts +301 -0
  339. package/src/elements/gtk-fixed.ts +99 -0
  340. package/src/elements/gtk-flow-box-child.ts +68 -0
  341. package/src/elements/gtk-flow-box.ts +480 -0
  342. package/src/elements/gtk-font-dialog-button.ts +432 -0
  343. package/src/elements/gtk-frame.ts +174 -0
  344. package/src/elements/gtk-gl-area.ts +476 -0
  345. package/src/elements/gtk-graphics-offload.ts +130 -0
  346. package/src/elements/gtk-grid-view.ts +168 -0
  347. package/src/elements/gtk-grid.ts +127 -0
  348. package/src/elements/gtk-header-bar.ts +273 -0
  349. package/src/elements/gtk-inscription.ts +387 -0
  350. package/src/elements/gtk-label.ts +19 -11
  351. package/src/elements/gtk-level-bar.ts +323 -0
  352. package/src/elements/gtk-link-button.ts +138 -0
  353. package/src/elements/gtk-list-box-row.ts +195 -0
  354. package/src/elements/gtk-list-box.ts +413 -0
  355. package/src/elements/gtk-list-view.ts +370 -0
  356. package/src/elements/gtk-media-controls.ts +509 -0
  357. package/src/elements/gtk-notebook.ts +664 -0
  358. package/src/elements/gtk-overlay.ts +149 -0
  359. package/src/elements/gtk-page-setup-unix-dialog.ts +420 -0
  360. package/src/elements/gtk-paned.ts +597 -0
  361. package/src/elements/gtk-password-entry.ts +170 -0
  362. package/src/elements/gtk-picture.ts +254 -0
  363. package/src/elements/gtk-popover-bin.ts +332 -0
  364. package/src/elements/gtk-popover-menu-bar.ts +355 -0
  365. package/src/elements/gtk-popover-menu.ts +339 -0
  366. package/src/elements/gtk-popover.ts +92 -10
  367. package/src/elements/gtk-print-unix-dialog.ts +989 -0
  368. package/src/elements/gtk-progress-bar.ts +24 -11
  369. package/src/elements/gtk-revealer.ts +406 -0
  370. package/src/elements/gtk-scale-button.ts +358 -0
  371. package/src/elements/gtk-scale.ts +492 -0
  372. package/src/elements/gtk-scrollbar.ts +528 -0
  373. package/src/elements/gtk-scrolled-window.ts +653 -0
  374. package/src/elements/gtk-search-bar.ts +200 -0
  375. package/src/elements/gtk-search-entry.ts +172 -0
  376. package/src/elements/gtk-separator.ts +52 -0
  377. package/src/elements/gtk-spin-button.ts +475 -0
  378. package/src/elements/gtk-spinner.ts +126 -0
  379. package/src/elements/gtk-stack-sidebar.ts +212 -0
  380. package/src/elements/gtk-stack-switcher.ts +279 -0
  381. package/src/elements/gtk-stack.ts +748 -0
  382. package/src/elements/gtk-switch.ts +52 -19
  383. package/src/elements/gtk-text-view.ts +290 -0
  384. package/src/elements/gtk-text.ts +219 -0
  385. package/src/elements/gtk-toggle-button.ts +239 -0
  386. package/src/elements/gtk-tree-expander.ts +243 -0
  387. package/src/elements/gtk-video.ts +423 -0
  388. package/src/elements/gtk-viewport.ts +277 -0
  389. package/src/elements/gtk-window-controls.ts +341 -0
  390. package/src/elements/gtk-window-handle.ts +221 -0
  391. package/src/elements/gtk-window.ts +372 -0
  392. package/src/elements/justification.ts +24 -0
  393. package/src/elements/popover-menu.ts +24 -0
  394. package/src/elements/roving-focus.ts +53 -21
  395. package/src/emoji-data.ts +577 -0
  396. package/src/entry-rows.spec.ts +31 -0
  397. package/src/font-description.ts +238 -0
  398. package/src/gtk-about-dialog.spec.ts +250 -0
  399. package/src/gtk-action-bar.spec.ts +89 -0
  400. package/src/gtk-application-window.spec.ts +107 -0
  401. package/src/gtk-aspect-frame.spec.ts +114 -0
  402. package/src/gtk-calendar.spec.ts +589 -0
  403. package/src/gtk-center-box.spec.ts +125 -0
  404. package/src/gtk-color-dialog-button.spec.ts +141 -0
  405. package/src/gtk-column-view.spec.ts +154 -0
  406. package/src/gtk-drag-icon.spec.ts +190 -0
  407. package/src/gtk-drawing-area.spec.ts +211 -0
  408. package/src/gtk-editable-label.spec.ts +190 -0
  409. package/src/gtk-emoji-chooser.spec.ts +173 -0
  410. package/src/gtk-entry.spec.ts +23 -0
  411. package/src/gtk-expander.spec.ts +170 -0
  412. package/src/gtk-fixed.spec.ts +97 -0
  413. package/src/gtk-flow-box.spec.ts +289 -0
  414. package/src/gtk-font-dialog-button.spec.ts +166 -0
  415. package/src/gtk-frame.spec.ts +119 -0
  416. package/src/gtk-gl-area.spec.ts +361 -0
  417. package/src/gtk-graphics-offload.spec.ts +119 -0
  418. package/src/gtk-grid-view.spec.ts +106 -0
  419. package/src/gtk-grid.spec.ts +122 -0
  420. package/src/gtk-header-bar.spec.ts +202 -0
  421. package/src/gtk-inscription.spec.ts +235 -0
  422. package/src/gtk-level-bar.spec.ts +199 -0
  423. package/src/gtk-link-button.spec.ts +117 -0
  424. package/src/gtk-list-box.spec.ts +422 -0
  425. package/src/gtk-list-view.spec.ts +203 -0
  426. package/src/gtk-media-controls.spec.ts +295 -0
  427. package/src/gtk-notebook.spec.ts +546 -0
  428. package/src/gtk-overlay.spec.ts +141 -0
  429. package/src/gtk-paned.spec.ts +267 -0
  430. package/src/gtk-password-entry.spec.ts +150 -0
  431. package/src/gtk-picture.spec.ts +172 -0
  432. package/src/gtk-popover-bin.spec.ts +229 -0
  433. package/src/gtk-popover-menu-bar.spec.ts +296 -0
  434. package/src/gtk-popover-menu.spec.ts +261 -0
  435. package/src/gtk-popover-role.spec.ts +138 -0
  436. package/src/gtk-popover.spec.ts +264 -0
  437. package/src/gtk-print-dialogs.spec.ts +251 -0
  438. package/src/gtk-revealer.spec.ts +164 -0
  439. package/src/gtk-scale-button.spec.ts +218 -0
  440. package/src/gtk-scale.spec.ts +213 -0
  441. package/src/gtk-scrollbar.spec.ts +244 -0
  442. package/src/gtk-scrolled-window.spec.ts +262 -0
  443. package/src/gtk-search-bar.spec.ts +179 -0
  444. package/src/gtk-search-entry.spec.ts +142 -0
  445. package/src/gtk-separator.spec.ts +74 -0
  446. package/src/gtk-spin-button.spec.ts +186 -0
  447. package/src/gtk-spinner.spec.ts +130 -0
  448. package/src/gtk-stack-sidebar.spec.ts +217 -0
  449. package/src/gtk-stack-switcher.spec.ts +249 -0
  450. package/src/gtk-stack.spec.ts +432 -0
  451. package/src/gtk-text-view.spec.ts +189 -0
  452. package/src/gtk-text.spec.ts +163 -0
  453. package/src/gtk-toggle-button.spec.ts +186 -0
  454. package/src/gtk-tree-expander.spec.ts +201 -0
  455. package/src/gtk-video.spec.ts +240 -0
  456. package/src/gtk-viewport.spec.ts +140 -0
  457. package/src/gtk-window-controls.spec.ts +232 -0
  458. package/src/gtk-window-handle.spec.ts +158 -0
  459. package/src/gtk-window.spec.ts +202 -0
  460. package/src/index.ts +9 -1
  461. package/src/keyboard-operable.spec.ts +77 -9
  462. package/src/list-view-dom.ts +121 -0
  463. package/src/namespace/adw.ts +12 -0
  464. package/src/namespace/gtk.ts +61 -0
  465. package/src/page-setup.ts +222 -0
  466. package/src/row-line-clamp.ts +74 -0
  467. package/src/row-tooltip.spec.ts +313 -0
  468. package/src/row-tooltip.ts +52 -0
  469. package/src/scroll-shading.ts +18 -1
  470. package/src/shared-tree-builder.ts +336 -41
  471. package/src/shared-tree-mount.spec.ts +130 -0
  472. package/src/shared-trees.spec.ts +15 -0
  473. package/src/signals.ts +15 -0
  474. package/src/style-classes.spec.ts +9 -8
  475. package/src/styles.generated.ts +1 -1
  476. package/src/tab-chip.ts +200 -0
  477. package/src/template-classes.ts +45 -0
  478. package/src/test.browser.mts +160 -0
  479. package/src/widget-size.spec.ts +117 -0
@@ -0,0 +1,301 @@
1
+ // <gtk-expander> — a title the user clicks to reveal or hide the child below it.
2
+ //
3
+ // The CSS node tree is the specification, and it is a five-node one (gtkexpander.c:95-109):
4
+ //
5
+ // expander-widget
6
+ // ╰── box
7
+ // ├── title
8
+ // │ ├── expander the disclosure arrow
9
+ // │ ╰── <label widget>
10
+ // ╰── <child>
11
+ //
12
+ // so the element builds a box with a title row above a content row, exactly as
13
+ // `gtk_expander_init` does (gtkexpander.c:413-423), and the arrow is its OWN node carrying
14
+ // `:checked` when the child is showing — "The arrow of an expander that is showing its child
15
+ // gets the `:checked` pseudoclass set on it", which `gtk_expander_set_expanded` does in both
16
+ // directions (gtkexpander.c:897-900). Here the pseudoclass is the `.checked` class the rest
17
+ // of this stylesheet already stands in for it with, and `_expander.scss` swaps the glyph.
18
+ //
19
+ // FIVE attributes:
20
+ //
21
+ // expanded the disclosure itself. `toggleAttribute` is idempotent, so "notify only
22
+ // on a real change" needs no guard — and `gtk_expander_set_expanded`
23
+ // returns early when nothing changed (gtkexpander.c:892-894), which is the
24
+ // same statement.
25
+ // label TEXT, and GTK makes a real `GtkLabel` out of it
26
+ // (gtkexpander.c:974-979), with `use-underline` and `use-markup` forwarded
27
+ // to it. So `label` becomes a `<gtk-label>` carrying the same two, and
28
+ // `labelDisplayText` — the one derivation this package already shares with
29
+ // the NativeScript port — is what reduces markup and mnemonic markers, as
30
+ // `<gtk-label>` does for itself.
31
+ // use-markup forwarded to the label.
32
+ // use-underline forwarded to the label, AND it is what makes `Alt`+the marked character
33
+ // activate the expander — `gtk_expander_new_with_mnemonic`'s documented
34
+ // contract (gtkexpander.c:856-860) and `update_accessible_mnemonic`
35
+ // (:811-831), which also publishes `Alt+X` as the widget's KEY_SHORTCUTS.
36
+ // resize-toplevel whether to ask the window to grow with the disclosure. Observed and
37
+ // reflected to a `.resize-toplevel` class, because
38
+ // `gtk_expander_resize_toplevel` (gtkexpander.c:737-750) can only call
39
+ // `gtk_widget_queue_resize` on a `GtkWindow` — a browser document already
40
+ // reflows itself around a box that changed height, so the flag is the whole
41
+ // of what this side can act on.
42
+ //
43
+ // `label-widget` is a SLOT rather than an attribute: it is `GTK_TYPE_WIDGET`
44
+ // (gtkexpander.c:351-353), and a string cannot carry one. `label` and a `slot="label"` child
45
+ // are mutually exclusive — `gtk_expander_set_label` NULLS the label widget
46
+ // (gtkexpander.c:969-970) and `set_label_widget` takes it (:1099-1142) — and GTK's precedence
47
+ // is the one kept here: the widget wins.
48
+ //
49
+ // The 500ms `expand_timer` drag-hover auto-expansion (gtkexpander.c:136, :240-257) is NOT
50
+ // ported, and it is a gesture rather than a property, so there is no KNOWN_GAPS entry for
51
+ // it: it hangs off a `GtkDropControllerMotion` reacting to a drag passing over the expander,
52
+ // and a browser has no drag-over-a-widget event to put a timer on. `pointerenter` is not
53
+ // that gesture, and pretending it is would expand on a hover the C never honours.
54
+ //
55
+ // A11Y: GTK gives the widget `GTK_ACCESSIBLE_ROLE_BUTTON` (gtkexpander.c:393) and keeps
56
+ // `GTK_ACCESSIBLE_STATE_EXPANDED` on it in step with the flag (:927-929). The role, the
57
+ // `aria-expanded` state and the Tab stop go on the TITLE rather than on the host, because
58
+ // the title is what the pointer presses and what `gtk_expander_focus` cycles through as its
59
+ // own site; `<adw-expander-row>` took the same decision for its header. `aria-controls`
60
+ // names the content row, which is GTK's `GTK_ACCESSIBLE_RELATION_CONTROLS` set when the
61
+ // child is parented and reset when it is unparented (gtkexpander.c:913-921, :1236-1244).
62
+ //
63
+ // Reference: refs/gtk/gtk/gtkexpander.c (every property, the node tree, activate, focus)
64
+ // Reference: refs/libadwaita/src/stylesheet/widgets/_expanders.scss
65
+ // Copyright (c) The GTK Team. LGPLv2.1+.
66
+ // Copyright (c) GNOME contributors (libadwaita). LGPLv2.1+.
67
+ // Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
68
+
69
+ import { labelDisplayText } from '@gjsify/adwaita-core';
70
+
71
+ import { bindEmptySections } from '../empty-sections.js';
72
+ import { bindSlottedChildren } from '../slotted-children.js';
73
+ import { createGtkImage } from './gtk-image.js';
74
+ import { attachRowActivation } from './row-activation.js';
75
+
76
+ // SIDE-EFFECT import, deliberately separate from the type import below — see the same note
77
+ // in `adw-expander-row.ts`: `import { GtkLabel }` used only in type position would be
78
+ // elided by TypeScript and take the `customElements.define` with it.
79
+ import './gtk-label.js';
80
+ import type { GtkLabel } from './gtk-label.js';
81
+
82
+ /** `expander { -gtk-icon-source: -gtk-icontheme('pan-end-symbolic') }` (_expanders.scss). */
83
+ const ARROW_ICON = 'pan-end';
84
+
85
+ /** Stable ids for the `aria-controls` relation, which GTK sets on the child itself. */
86
+ let labelChildCounter = 0;
87
+
88
+ export class GtkExpander extends HTMLElement {
89
+ private _box!: HTMLDivElement;
90
+ private _titleEl!: HTMLDivElement;
91
+ private _arrowEl!: HTMLElement;
92
+ private _labelEl!: GtkLabel;
93
+ private _labelSection!: HTMLDivElement;
94
+ private _contentEl!: HTMLDivElement;
95
+ private _initialized = false;
96
+
97
+ static get observedAttributes() {
98
+ return ['expanded', 'label', 'use-markup', 'use-underline', 'resize-toplevel'];
99
+ }
100
+
101
+ /** `Gtk.Expander:expanded` — whether the child is revealed. */
102
+ get expanded(): boolean {
103
+ return this.hasAttribute('expanded');
104
+ }
105
+
106
+ set expanded(value: boolean) {
107
+ this.toggleAttribute('expanded', !!value);
108
+ }
109
+
110
+ /** `Gtk.Expander:label` — the title TEXT, or `null` when a label widget is in its place. */
111
+ get label(): string | null {
112
+ return this.labelWidget === null ? this.getAttribute('label') : null;
113
+ }
114
+
115
+ set label(value: string | null) {
116
+ if (value === null) this.removeAttribute('label');
117
+ else this.setAttribute('label', value);
118
+ }
119
+
120
+ /** `Gtk.Expander:use-markup` — whether the label is Pango markup. */
121
+ get useMarkup(): boolean {
122
+ return this.hasAttribute('use-markup');
123
+ }
124
+
125
+ set useMarkup(value: boolean) {
126
+ this.toggleAttribute('use-markup', !!value);
127
+ }
128
+
129
+ /** `Gtk.Expander:use-underline` — whether `_` in the label marks a mnemonic. */
130
+ get useUnderline(): boolean {
131
+ return this.hasAttribute('use-underline');
132
+ }
133
+
134
+ set useUnderline(value: boolean) {
135
+ this.toggleAttribute('use-underline', !!value);
136
+ }
137
+
138
+ /** `Gtk.Expander:resize-toplevel` — reflected, because a document reflows itself. */
139
+ get resizeToplevel(): boolean {
140
+ return this.hasAttribute('resize-toplevel');
141
+ }
142
+
143
+ set resizeToplevel(value: boolean) {
144
+ this.toggleAttribute('resize-toplevel', !!value);
145
+ }
146
+
147
+ /** `Gtk.Expander:child` — the light-DOM node in the content row. */
148
+ get child(): Element | null {
149
+ return this._contentEl?.firstElementChild ?? null;
150
+ }
151
+
152
+ /** `Gtk.Expander:label-widget` — the light-DOM node standing in for the label text. */
153
+ get labelWidget(): Element | null {
154
+ return this._labelSection?.firstElementChild ?? null;
155
+ }
156
+
157
+ connectedCallback() {
158
+ if (this._initialized) return;
159
+ this._initialized = true;
160
+
161
+ this._arrowEl = createGtkImage(ARROW_ICON, 'adw-expander-arrow');
162
+ this._labelEl = document.createElement('gtk-label') as GtkLabel;
163
+ this._labelSection = document.createElement('div');
164
+ this._labelSection.className = 'adw-expander-label';
165
+
166
+ this._titleEl = document.createElement('div');
167
+ this._titleEl.className = 'adw-expander-title';
168
+ // The title is the button: GTK gives the widget the button role, and the title is
169
+ // what its gesture (gtkexpander.c:430-439) and its focus sites act on.
170
+ this._titleEl.setAttribute('role', 'button');
171
+ this._titleEl.append(this._arrowEl, this._labelEl, this._labelSection);
172
+
173
+ this._contentEl = document.createElement('div');
174
+ this._contentEl.className = 'adw-expander-content';
175
+
176
+ this._box = document.createElement('div');
177
+ this._box.className = 'adw-expander-box';
178
+ this._box.append(this._titleEl, this._contentEl);
179
+
180
+ // `label-widget` is the GIR name of the slot and `label` is GtkBuildable's legacy
181
+ // spelling for it (`gtk_expander_buildable_add_child`, gtkexpander.c:454-457), so
182
+ // both are accepted; the bare child is the disclosed `child`.
183
+ bindSlottedChildren(this, [
184
+ { name: 'label-widget', into: this._labelSection },
185
+ { name: 'label', into: this._labelSection },
186
+ { name: 'child', into: this._contentEl },
187
+ { into: this._contentEl },
188
+ ]).install(this._box);
189
+
190
+ // AFTER the routing, for the reason `adw-expander-row` gives: this derives once
191
+ // synchronously, so a section the routing has not filled yet would be hidden by a
192
+ // declared label that had already earned its place.
193
+ bindEmptySections(this._labelSection);
194
+
195
+ this._titleEl.addEventListener('click', () => this._activate());
196
+ attachRowActivation({ row: this._titleEl, activatable: () => true });
197
+ // `update_accessible_mnemonic` binds the FIRST marked character only
198
+ // (gtk_label_get_mnemonic_keyval), and `Alt`+it activates the widget.
199
+ this._titleEl.addEventListener('keydown', this._onKeyDown);
200
+
201
+ this._render();
202
+ }
203
+
204
+ attributeChangedCallback(name: string) {
205
+ if (!this._initialized) return;
206
+ this._render();
207
+ this.dispatchEvent(
208
+ new CustomEvent(`notify::${name}`, { bubbles: true, detail: { [name]: this._detail(name) } }),
209
+ );
210
+ }
211
+
212
+ private _detail(name: string): unknown {
213
+ switch (name) {
214
+ case 'expanded':
215
+ return this.expanded;
216
+ case 'label':
217
+ return this.label;
218
+ case 'use-markup':
219
+ return this.useMarkup;
220
+ case 'use-underline':
221
+ return this.useUnderline;
222
+ default:
223
+ return this.resizeToplevel;
224
+ }
225
+ }
226
+
227
+ /** `gtk_expander_activate` (gtkexpander.c:786-792) — the one thing the widget does. */
228
+ private _activate(): void {
229
+ this.expanded = !this.expanded;
230
+ this.dispatchEvent(new CustomEvent('activate', { bubbles: true, detail: { expanded: this.expanded } }));
231
+ }
232
+
233
+ /**
234
+ * `Alt`+the marked character, as `gtk_expander_new_with_mnemonic` documents
235
+ * (gtkexpander.c:856-860): "Pressing Alt and that key activates the button."
236
+ */
237
+ private readonly _onKeyDown = (event: KeyboardEvent): void => {
238
+ if (!this.useUnderline || !event.altKey || event.ctrlKey || event.metaKey) return;
239
+ const mnemonic = this._mnemonic();
240
+ // `gdk_keyval_name (gdk_keyval_to_upper (keyval))` — the marked character, so the
241
+ // binding is the letter and not the keycode.
242
+ if (mnemonic === null || (event.key.length === 1 ? event.key.toUpperCase() : '') !== mnemonic) return;
243
+ event.preventDefault();
244
+ this._activate();
245
+ };
246
+
247
+ /**
248
+ * The single character `use-underline` marks, or `null` when none does.
249
+ *
250
+ * The walk is `stripMnemonic`'s, for the reason that function gives: a `_` takes the
251
+ * character after it and is itself removed, `__` is an escaped literal underscore and
252
+ * marks nothing, and a trailing marker has no character to take.
253
+ */
254
+ private _mnemonic(): string | null {
255
+ const characters = [...(this.getAttribute('label') ?? '')];
256
+ for (let index = 0; index < characters.length; index += 1) {
257
+ if (characters[index] !== '_') continue;
258
+ const next = characters[index + 1];
259
+ if (next === undefined) return null;
260
+ index += 1;
261
+ if (next === '_') continue;
262
+ return next.toUpperCase();
263
+ }
264
+ return null;
265
+ }
266
+
267
+ private _render(): void {
268
+ // `gtk_expander_set_expanded` puts the state on the ARROW node, not on the widget.
269
+ this._arrowEl.classList.toggle('checked', this.expanded);
270
+ this.classList.toggle('expanded', this.expanded);
271
+ this._titleEl.setAttribute('aria-expanded', String(this.expanded));
272
+ // The C parents the child into the box only while expanded and unparents it when
273
+ // not (gtkexpander.c:909-923), so a collapsed expander neither lays out nor
274
+ // allocates it.
275
+ this._contentEl.hidden = !this.expanded;
276
+
277
+ // GTK's precedence: `set_label` NULLS the label widget (gtkexpander.c:969-970) and
278
+ // `set_label_widget` takes it, so the two are mutually exclusive.
279
+ const widget = this.labelWidget;
280
+ this._labelEl.hidden = widget !== null || this.label === null;
281
+ if (widget === null) {
282
+ // The very reduction `<gtk-label>` applies to its own `label`, so the two agree on
283
+ // what the same string displays.
284
+ this._labelEl.setAttribute('label', labelDisplayText(this.label ?? '', this.useMarkup, this.useUnderline));
285
+ this._labelEl.toggleAttribute('use-markup', this.useMarkup);
286
+ this._labelEl.toggleAttribute('use-underline', this.useUnderline);
287
+ }
288
+
289
+ const child = this.child;
290
+ if (child === null) {
291
+ this._titleEl.removeAttribute('aria-controls');
292
+ } else if (this._titleEl.getAttribute('aria-controls') === null) {
293
+ if (child.id === '') child.id = `gtk-expander-content-${labelChildCounter++}`;
294
+ this._titleEl.setAttribute('aria-controls', child.id);
295
+ }
296
+
297
+ this.classList.toggle('resize-toplevel', this.resizeToplevel);
298
+ }
299
+ }
300
+
301
+ customElements.define('gtk-expander', GtkExpander);
@@ -0,0 +1,99 @@
1
+ // <gtk-fixed> — Gtk.Fixed: children at pixel positions, and nothing else.
2
+ //
3
+ // NO PROPERTIES AT ALL, which is the shape of the widget: `Gtk.Fixed` declares none in the
4
+ // GIR because every child carries its own, and `gtk_fixed_put(child, x, y)` is the whole
5
+ // API (gtkfixed.c:213-240). So the markup form of a position is the CHILD's own CSS
6
+ // offset — `style="left:20px;top:10px"`, which is what `put()` writes and what it reads
7
+ // back — and `put()` / `move()` are here as the imperative route, so a caller that has the
8
+ // child in hand does not have to spell a string.
9
+ //
10
+ // `gtk_fixed_buildable_add_child` puts a child written without a position at 0, 0
11
+ // (gtkfixed.c:171-177), so an unpositioned child lands there too: `left`/`top` start at
12
+ // `0` rather than CSS's `auto`, which for an absolutely positioned box resolves to its
13
+ // STATIC position instead — a different answer, and the one that would silently stack
14
+ // every child where the markup happens to read.
15
+ //
16
+ // THE ONE MEASUREMENT. A child that is out of flow contributes nothing to its parent's
17
+ // size, so a fixed whose children are absolutely positioned would collapse to zero without
18
+ // this. `gtk_fixed_layout_measure` returns the union of the children's rectangles
19
+ // (gtkfixedlayout.c:224-300): the fixed's minimum and natural size are
20
+ // `MAX (x + width)` and `MAX (y + height)` over the children it should lay out. A CSS box
21
+ // cannot hold a minimum and a natural size, so the union is written as the box's own
22
+ // `min-width` / `min-height`, which is the measurement GTK keeps and the one that decides
23
+ // how much space the fixed asks its parent for.
24
+ //
25
+ // `gtk_fixed_init` sets `GTK_OVERFLOW_HIDDEN` (gtkfixed.c:189-195), so the fixed clips a
26
+ // child that reaches past the union — here the union is exactly the children, so nothing
27
+ // is clipped and the rule is there for a child positioned negatively.
28
+ //
29
+ // A11Y: GtkFixed declares no accessible role, so none is set.
30
+ //
31
+ // Reference: refs/gtk/gtk/gtkfixed.c:171-177, :189-195, :213-240
32
+ // Reference: refs/gtk/gtk/gtkfixedlayout.c:224-300
33
+ // Copyright (c) The GTK Team. LGPLv2.1+.
34
+ // Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
35
+
36
+ export class GtkFixed extends HTMLElement {
37
+ private _resize: ResizeObserver | null = null;
38
+ private _mutations: MutationObserver | null = null;
39
+
40
+ connectedCallback() {
41
+ // Neither observer is guarded by a build flag, and that is the shape
42
+ // `check-adwaita-connect-rebind.mjs` asks for: a re-parent runs this whole body
43
+ // again, so the element comes back listening rather than deaf.
44
+ this._resize = new ResizeObserver(() => this._size());
45
+ this._resize.observe(this);
46
+ this._mutations = new MutationObserver(() => {
47
+ this._observeChildren();
48
+ this._size();
49
+ });
50
+ this._mutations.observe(this, { childList: true });
51
+ this._observeChildren();
52
+ this._size();
53
+ }
54
+
55
+ disconnectedCallback() {
56
+ this._resize?.disconnect();
57
+ this._resize = null;
58
+ this._mutations?.disconnect();
59
+ this._mutations = null;
60
+ }
61
+
62
+ /** `gtk_fixed_put()` — a child and the position it sits at, both relative to the fixed. */
63
+ put(child: HTMLElement, x: number, y: number): void {
64
+ if (child.parentNode !== this) this.append(child);
65
+ this.move(child, x, y);
66
+ }
67
+
68
+ /** `gtk_fixed_move()` — the same position for a child already in this fixed. */
69
+ move(child: HTMLElement, x: number, y: number): void {
70
+ child.style.left = `${x}px`;
71
+ child.style.top = `${y}px`;
72
+ }
73
+
74
+ private _observeChildren(): void {
75
+ if (this._resize === null) return;
76
+ for (const child of this.children) {
77
+ if (child instanceof HTMLElement) this._resize.observe(child);
78
+ }
79
+ }
80
+
81
+ /** `gtk_fixed_layout_measure`: the union of the children's rectangles, as one box. */
82
+ private _size(): void {
83
+ let width = 0;
84
+ let height = 0;
85
+ for (const child of this.children) {
86
+ if (!(child instanceof HTMLElement)) continue;
87
+ width = Math.max(width, child.offsetLeft + child.offsetWidth);
88
+ height = Math.max(height, child.offsetTop + child.offsetHeight);
89
+ }
90
+ // Written only on a real change, so a resize that finds the same union cannot feed
91
+ // its own observer.
92
+ const nextWidth = `${width}px`;
93
+ const nextHeight = `${height}px`;
94
+ if (this.style.minWidth !== nextWidth) this.style.minWidth = nextWidth;
95
+ if (this.style.minHeight !== nextHeight) this.style.minHeight = nextHeight;
96
+ }
97
+ }
98
+
99
+ customElements.define('gtk-fixed', GtkFixed);
@@ -0,0 +1,68 @@
1
+ // <gtk-flow-box-child> — one cell of a `Gtk.FlowBox`: the child that fills it, the web
2
+ // counterpart of `Gtk.FlowBoxChild`.
3
+ //
4
+ // ONE PROPERTY, ONE SIGNAL. `GtkFlowBoxChild` declares `child` (:542-543) and `activate`
5
+ // (:563-571) and nothing else — no `activatable`, no `selectable`, unlike its sibling
6
+ // `GtkListBoxRow`. The box asks each child whether it is selected through the child itself
7
+ // (`gtk_flow_box_child_set_selected`, gtkflowbox.c:943-962), which raises the
8
+ // `GTK_STATE_FLAG_SELECTED` widget state and the `GTK_ACCESSIBLE_STATE_SELECTED` accessible
9
+ // state, and there is no property a caller writes to ask for either. So this element has no
10
+ // observed attribute of its own: the parent writes the `selected` CLASS and the
11
+ // `aria-selected` attribute, and the CHILD publishes a `selected` getter over the class.
12
+ //
13
+ // `child` is a WIDGET property, so it is a slot here (gtkflowbox.c:610-628): the authored
14
+ // child lands in the node `gtk_flow_box_child_set_child` would put it in, and a child appended
15
+ // after connect lands there too.
16
+ //
17
+ // A11Y: `gridcell`, which is what GTK declares unconditionally (:573). The box is a
18
+ // `GTK_ACCESSIBLE_ROLE_GRID` (:3973) — a `grid` whose cells are `gridcell`s, not the
19
+ // `list`/`option` pairing a list box uses, because a flow box wraps in more than one
20
+ // direction.
21
+ //
22
+ // Reference: refs/gtk/gtk/gtkflowbox.c:277-282 (child property), :542-582 (class init, the
23
+ // activate signal, the css name and role), :610-628 (set_child), :943-962 (set_selected)
24
+ // Reference: refs/libadwaita/src/stylesheet/widgets/_views.scss:52-91 (flowbox > flowboxchild)
25
+ // Copyright (c) GNOME contributors (GTK/libadwaita). LGPLv2.1+.
26
+ // Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
27
+
28
+ import { bindSlottedChildren } from '../slotted-children.js';
29
+
30
+ export class GtkFlowBoxChild extends HTMLElement {
31
+ private _contentsEl!: HTMLDivElement;
32
+ private _initialized = false;
33
+
34
+ connectedCallback() {
35
+ if (this._initialized) return;
36
+ this._initialized = true;
37
+
38
+ this._contentsEl = document.createElement('div');
39
+ this._contentsEl.className = 'adw-flow-box-child-contents';
40
+
41
+ bindSlottedChildren(this, [{ into: this._contentsEl }]).install(this._contentsEl);
42
+
43
+ this.setAttribute('role', 'gridcell');
44
+ // `gtk_flow_box_child_init` makes the cell focusable (:578-580) — the box's cursor
45
+ // lives here, and Enter/Space is the box's `activate-cursor-child`.
46
+ this.tabIndex = 0;
47
+ }
48
+
49
+ /** `GtkFlowBoxChild:child`, as the light-DOM child it already is. */
50
+ get child(): Element | null {
51
+ return this._contentsEl.firstElementChild;
52
+ }
53
+
54
+ /** Where this child sits in its box, or -1 while it has no box. */
55
+ get index(): number {
56
+ return this.parentElement ? [...this.parentElement.children].indexOf(this) : -1;
57
+ }
58
+
59
+ /**
60
+ * `gtk_flow_box_child_is_selected` — read over the class the box writes, so a cell moved
61
+ * between boxes never carries a stale answer.
62
+ */
63
+ get selected(): boolean {
64
+ return this.classList.contains('selected');
65
+ }
66
+ }
67
+
68
+ customElements.define('gtk-flow-box-child', GtkFlowBoxChild);