@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,339 @@
1
+ // <gtk-popover-menu> — `GtkPopoverMenu`, a `GtkPopover` whose contents are a MENU MODEL
2
+ // instead of a child widget, and which switches between the pages of a submenu stack
3
+ // rather than nesting a second surface.
4
+ //
5
+ // It EXTENDS `<gtk-popover>` and nothing is re-implemented: the dismissal state machine,
6
+ // the document-level grab, the arrow/Home/End arithmetic and the `popup`/`popdown`
7
+ // vocabulary are the ones the menu button, the drop down and the split button already
8
+ // share (ADR 0004). What is new here is only what `gtkpopovermenu.c` adds on top of
9
+ // `GtkPopover`:
10
+ //
11
+ // · the MODEL, read through the portable value ADR 0042 gave it — the same
12
+ // `menu-model` JSON `<gtk-menu-button>` takes, parsed by the same core function;
13
+ // · the PAGE STACK. `gtk_popover_menu_rebuild_contents` (gtkpopovermenu.c:707-717)
14
+ // empties a `GtkStack` and rebuilds it from the model, and
15
+ // `gtk_popover_menu_open_submenu` is `gtk_stack_set_visible_child_name` (:755-757).
16
+ // So the submenu a reader is inside is a NAMED PAGE of one surface, not a second
17
+ // popup beside it — which is why `visible-submenu` is a real property here and why a
18
+ // back row is drawn at the top of an open page;
19
+ // · the two ARIA facts GTK sets on the surface: `menu` for the popover and the
20
+ // `menuitem` / `menuitemcheckbox` / `menuitemradio` roles the rows carry
21
+ // (gtkpopovermenu.c:160-164).
22
+ //
23
+ // The ROWS are not new either: they are `PopoverMenuView`, the one implementation
24
+ // `<gtk-menu-button>` and `<adw-split-button>` already share, including Left/Right
25
+ // changing the page and the accelerator/check/submenu decoration. What this element adds
26
+ // is where the activation goes, and that is `GtkPopoverMenu`'s own rule: activating an
27
+ // item closes the popover and hands focus back to the anchor, so a menu cannot be left
28
+ // open by choosing from it.
29
+ //
30
+ // `menu-title` is a PORT-ONLY attribute. `GMenuModel` has no title; GTK spells a heading
31
+ // as a labelled SECTION, which `menu-model` already carries. The title exists because a
32
+ // popover menu with a heading is the commonest shape an application writes by hand, and
33
+ // both existing surfaces take it.
34
+ //
35
+ // Attributes (in addition to every `<gtk-popover>` one):
36
+ // menu-model — the portable menu model as JSON (ADR 0042): items, sections and
37
+ // submenus, with the attribute names GTK reads.
38
+ // menu-title — optional heading above the menu.
39
+ // visible-submenu — the name of the open page; `'main'` is the root, a submenu's label
40
+ // is its name. `gtk_popover_menu_open_submenu(popover, "main")` is
41
+ // the way back, so this is writeable and readable.
42
+ // Properties:
43
+ // menuModel — the model, normalised (get/set; a `custom` item throws here). Takes
44
+ // an already-normalised `AdwMenuModel` too, which is what a menu bar
45
+ // hands over for one of its submenus.
46
+ // actions — what the action group publishes about the actions the model names
47
+ // (ADR 0042), the source of every row's enabled/checked state.
48
+ // visibleSubmenu — the open page's name (get/set).
49
+ // Methods:
50
+ // openSubmenu(name) — `gtk_popover_menu_open_submenu`.
51
+ // closeSubmenus() — `gtk_popover_menu_close_submenus`, one level (gtkpopovermenu.c:223-233).
52
+ // Events:
53
+ // `notify::visible-submenu` (CustomEvent, bubbles, detail = { visibleSubmenu }) —
54
+ // mirrors the GObject notify; the page changed.
55
+ // `menu-item-activated` (CustomEvent, bubbles, detail = { id, label, path }) — the
56
+ // item at `path` was chosen. Same payload and the same `id` fallback as
57
+ // `<gtk-menu-button>`, so one listener serves both.
58
+ //
59
+ // KNOWN_GAPS — the one `GtkPopoverMenu` scalar property this element does not observe:
60
+ //
61
+ // `flags` GTK's `GTK_POPOVER_MENU_NESTED` opens a submenu as a NESTED POPOVER beside
62
+ // the row (`gtk_popover_menu_new_from_model_full`, gtkpopovermenu.c:817-825)
63
+ // and `GTK_POPOVER_MENU_SLIDING` — the DEFAULT — swaps the page of the one
64
+ // surface, which is what `PopoverMenuView` has always drawn. Only the sliding
65
+ // half is modelled: a nested popover would need the arrow this package does not
66
+ // draw and a second anchor the CSS placement cannot point at.
67
+ //
68
+ // Reference: refs/gtk/gtk/gtkpopovermenu.c (the page stack :707-757, the flags :638-648,
69
+ // the roles :160-164, `close_submenus` :223-233)
70
+ // Reference: refs/gtk/gtk/gtkmodelbutton.c:1174-1210 (Left/Right change the page)
71
+ // Reference: refs/libadwaita/src/stylesheet/widgets/_menus.scss (popover.menu, modelbutton)
72
+ // Copyright (c) GNOME contributors (GTK, libadwaita). LGPLv2.1+
73
+ // Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
74
+
75
+ import {
76
+ ADW_MENU_SURFACE_WEB,
77
+ assertMenuRenderable,
78
+ menuItemAt,
79
+ menuNodeAt,
80
+ menuRefusals,
81
+ normalizeMenuModel,
82
+ parseMenuModel,
83
+ } from '@gjsify/adwaita-core';
84
+ import type { AdwMenuActions, AdwMenuInput, AdwMenuModel, AdwMenuPath } from '@gjsify/adwaita-core';
85
+
86
+ import { GtkPopover } from './gtk-popover.js';
87
+ import { PopoverMenuView } from './popover-menu.js';
88
+
89
+ /** The name the ROOT page carries — `gtk_popover_menu_open_submenu`'s own "main". */
90
+ const MAIN_PAGE = 'main';
91
+
92
+ export class GtkPopoverMenu extends GtkPopover {
93
+ private _model: AdwMenuModel = [];
94
+ private _actions: AdwMenuActions | null = null;
95
+ private _menuView!: PopoverMenuView;
96
+ /** Named apart from `GtkPopover`'s own: two `private` fields of one name are two fields. */
97
+ private _menuInitialized = false;
98
+
99
+ static get observedAttributes() {
100
+ return [...GtkPopover.observedAttributes, 'menu-model', 'menu-title', 'visible-submenu'];
101
+ }
102
+
103
+ /** The menu, normalised (ADR 0042). */
104
+ get menuModel(): AdwMenuModel {
105
+ return this._model;
106
+ }
107
+
108
+ /**
109
+ * Set the menu from anything the portable model accepts, refusing a `custom` item
110
+ * HERE — at the assignment, where it is a call the caller can catch. An ATTRIBUTE is
111
+ * markup the browser parses, so the attribute path refuses the whole menu instead and
112
+ * says why on `console.error`, exactly as `<gtk-menu-button>` does.
113
+ *
114
+ * `AdwMenuModel` is in the union because a menu bar hands over a submenu's own `items`
115
+ * untouched, and `normalizeMenuModel` is documented to be IDEMPOTENT over an
116
+ * already-normalised node — that is what lets a renderer hand a model it is holding
117
+ * straight back. The one cast is where the core's parameter type (`AdwMenuInput`, whose
118
+ * entries are the AUTHORED shapes) is narrower than the behaviour it documents.
119
+ */
120
+ set menuModel(value: AdwMenuInput | AdwMenuModel) {
121
+ this._model = normalizeMenuModel(value as AdwMenuInput);
122
+ assertMenuRenderable(this._model, ADW_MENU_SURFACE_WEB);
123
+ if (this._menuInitialized) this._renderMenu();
124
+ }
125
+
126
+ /** What the action group publishes about the actions this menu names (ADR 0042). */
127
+ get actions(): AdwMenuActions | null {
128
+ return this._actions;
129
+ }
130
+
131
+ set actions(value: AdwMenuActions | null) {
132
+ this._actions = value ?? null;
133
+ this._menuView?.setActions(this._actions);
134
+ if (this._menuInitialized) this._renderMenu();
135
+ }
136
+
137
+ /** The optional heading. GTK spells one as a labelled SECTION; this is the shorthand. */
138
+ get menuTitle(): string {
139
+ return this.getAttribute('menu-title') ?? '';
140
+ }
141
+
142
+ set menuTitle(value: string) {
143
+ this.setAttribute('menu-title', value ?? '');
144
+ }
145
+
146
+ /**
147
+ * The name of the open page — `'main'` for the root, a submenu's label for a submenu.
148
+ *
149
+ * GTK's value is the stack child's NAME, which `GtkMenuTracker` gives a submenu page
150
+ * from the node it links; with no name given that is the submenu's label, so the label
151
+ * is what this element answers with. `gtk_popover_menu_open_submenu` (gtkpopovermenu.c
152
+ * :755-757) is the only way in, so setting it navigates rather than describing.
153
+ */
154
+ get visibleSubmenu(): string {
155
+ const open = this._openPageLabel();
156
+ return open === null ? MAIN_PAGE : open;
157
+ }
158
+
159
+ set visibleSubmenu(value: string) {
160
+ this.openSubmenu(value);
161
+ }
162
+
163
+ connectedCallback() {
164
+ super.connectedCallback();
165
+ if (this._menuInitialized) return;
166
+ this._menuInitialized = true;
167
+
168
+ // `gtk_popover_menu_new` creates the popover with `autohide = TRUE`
169
+ // (gtkpopovermenu.c:729-731), which is also the plain `<gtk-popover>` default.
170
+ this.classList.add('adw-popover-menu');
171
+ this.setAttribute('role', 'menu');
172
+ // `GtkPopoverMenu` "is one of the cases that add a `.menu` style class to the main
173
+ // `popover` node" (gtkpopovermenu.c:152-154), so the 6px menu inset and the
174
+ // `min-width: 120px` are not a choice here — they are what the node IS.
175
+ this.setAttribute('menu', '');
176
+
177
+ this._menuView = new PopoverMenuView(this, 'adw-popover-menu', (path) => this._activate(path));
178
+ this._menuView.setActions(this._actions);
179
+
180
+ if (this._model.length === 0) this._model = this._parseMenuAttr();
181
+ // The VIEW is what draws, and it holds the model it walks — seeding `_model`
182
+ // directly and rendering without handing the view the same value would leave it
183
+ // drawing an EMPTY page over a model the element believes it has.
184
+ this._renderMenu();
185
+
186
+ // The visible page RESETS when the popover closes, as `gtk_popover_menu_show` does
187
+ // with `gtk_popover_menu_set_open_submenu (widget, NULL)` (gtkpopovermenu.c:573-579):
188
+ // a menu that reopens three levels deep is one the reader cannot get out of.
189
+ this.subscribe((open) => {
190
+ if (open) this._menuView.focusableRows[0]?.focus();
191
+ else this._menuView.reset();
192
+ });
193
+ }
194
+
195
+ attributeChangedCallback(name?: string, previous?: string | null, value?: string | null) {
196
+ super.attributeChangedCallback(name, previous, value);
197
+ if (!this._menuInitialized) return;
198
+ if (name === 'menu-model') {
199
+ this._model = this._parseMenuAttr();
200
+ this._renderMenu();
201
+ return;
202
+ }
203
+ if (name === 'menu-title') {
204
+ this._menuView.setTitle(this.menuTitle);
205
+ this._menuView.render();
206
+ return;
207
+ }
208
+ if (name === 'visible-submenu') {
209
+ // The ATTRIBUTE is navigation, because the PROPERTY is: `visibleSubmenu` is a
210
+ // thin setter over `openSubmenu`, so a markup change and a code change reach the
211
+ // same page. `_reflectSubmenu` writes the attribute back only when it DIFFERS,
212
+ // which is what stops this from looping.
213
+ this._navigate(value ?? MAIN_PAGE);
214
+ }
215
+ }
216
+
217
+ /** `gtk_popover_menu_open_submenu` — switch to the named page. */
218
+ openSubmenu(name: string): void {
219
+ this._navigate(name);
220
+ }
221
+
222
+ /**
223
+ * The ONE way the open page changes, from the property and from the attribute alike.
224
+ *
225
+ * The notify belongs HERE rather than beside the attribute write: a page can change
226
+ * without the attribute's text changing (`openSubmenu('More')` when it is already
227
+ * `More` after a dismissal, or an attribute set to the page already showing), and
228
+ * `GObject` notifies on the state, not on the spelling.
229
+ */
230
+ private _navigate(name: string): void {
231
+ const before = this.visibleSubmenu;
232
+ if (!this._showPage(name)) return;
233
+ const after = this.visibleSubmenu;
234
+ this._reflectSubmenu();
235
+ if (after === before) return;
236
+ this.dispatchEvent(
237
+ new CustomEvent('notify::visible-submenu', { bubbles: true, detail: { visibleSubmenu: after } }),
238
+ );
239
+ }
240
+
241
+ /**
242
+ * Point the page stack at the named page and rebuild it. `false` when the name is not
243
+ * one of the stack's children, which is what `gtk_stack_set_visible_child_name` leaves
244
+ * alone — the current page keeps showing rather than the surface blanking.
245
+ */
246
+ private _showPage(name: string): boolean {
247
+ if (name === MAIN_PAGE || name.length === 0) {
248
+ this._menuView.reset();
249
+ } else {
250
+ const path = this._findSubmenu(name);
251
+ if (path === null) return false;
252
+ this._menuView.setMenuModel(this._model);
253
+ this._menuView.showPage(path);
254
+ }
255
+ this._menuView.render();
256
+ return true;
257
+ }
258
+
259
+ /**
260
+ * `gtk_popover_menu_close_submenus` — leave the open submenu, ONE level
261
+ * (gtkpopovermenu.c:223-233), which is what the back row does.
262
+ */
263
+ closeSubmenus(): void {
264
+ this.openSubmenu(MAIN_PAGE);
265
+ }
266
+
267
+ private _openPageLabel(): string | null {
268
+ const path = this._menuView.page;
269
+ if (path.length === 0) return null;
270
+ const node = menuNodeAt(this._model, path);
271
+ return node !== null && node.kind !== 'item' ? node.label : null;
272
+ }
273
+
274
+ private _findSubmenu(label: string): AdwMenuPath | null {
275
+ const walk = (nodes: AdwMenuModel, path: AdwMenuPath): AdwMenuPath | null => {
276
+ for (const [index, node] of nodes.entries()) {
277
+ if (node.kind === 'item') continue;
278
+ const here = [...path, index];
279
+ if (node.label === label) return here;
280
+ const found = walk(node.items, here);
281
+ if (found !== null) return found;
282
+ }
283
+ return null;
284
+ };
285
+ return walk(this._model, []);
286
+ }
287
+
288
+ /**
289
+ * Write the open page back to the attribute, ONCE, and only when the spelling differs.
290
+ *
291
+ * Reading the attribute instead of the state is the whole loop guard: navigating sets
292
+ * this, the attribute change calls back into `_navigate`, and a comparison against the
293
+ * current value stops the second turn.
294
+ */
295
+ private _reflectSubmenu(): void {
296
+ const name = this.visibleSubmenu;
297
+ if (this.getAttribute('visible-submenu') === name) return;
298
+ this.setAttribute('visible-submenu', name);
299
+ }
300
+
301
+ /**
302
+ * Activating an item closes the popover and returns focus to the anchor — the
303
+ * behaviour every menu-bearing surface here has, and the reason a menu cannot be left
304
+ * open by choosing from it.
305
+ */
306
+ private _activate(path: AdwMenuPath): void {
307
+ const target = menuItemAt(this._model, path);
308
+ this.popdown();
309
+ this.anchor?.focus();
310
+ if (target === null) return;
311
+ this.dispatchEvent(
312
+ new CustomEvent('menu-item-activated', {
313
+ bubbles: true,
314
+ detail: { id: target.id ?? target.label, label: target.label, path: [...path] },
315
+ }),
316
+ );
317
+ }
318
+
319
+ private _renderMenu(): void {
320
+ this._menuView.setMenuModel(this._model);
321
+ this._menuView.setTitle(this.menuTitle);
322
+ this._menuView.render();
323
+ if (this._model.length === 0) this.popdown();
324
+ }
325
+
326
+ private _parseMenuAttr(): AdwMenuModel {
327
+ const model = normalizeMenuModel(parseMenuModel(this.getAttribute('menu-model')));
328
+ const refusals = menuRefusals(model, ADW_MENU_SURFACE_WEB);
329
+ if (refusals.length === 0) return model;
330
+ // A throw from `connectedCallback` is reported as an uncaught PAGE error and
331
+ // reaches nobody, so markup refuses the menu and says why. See
332
+ // `<gtk-menu-button>`'s `_acceptMenu` for the same two doors.
333
+ console.error(`${ADW_MENU_SURFACE_WEB.name} cannot render this menu, so it has none:`);
334
+ for (const refusal of refusals) console.error(` [${refusal.path.join('.')}] ${refusal.message}`);
335
+ return [];
336
+ }
337
+ }
338
+
339
+ customElements.define('gtk-popover-menu', GtkPopoverMenu);
@@ -17,13 +17,25 @@
17
17
  // Attributes:
18
18
  // open — boolean; reflects (and drives) the visible state.
19
19
  // position — bottom | top | start | end (default bottom) — which side of the anchor
20
- // the surface sits on. Only the placement axis is modelled:
21
- // `GtkPopover:position`'s autohide/has-arrow semantics belong to GTK,
22
- // which libadwaita does not vendor, so they are not guessed at.
20
+ // the surface sits on. Only the placement AXIS is modelled: GTK's
21
+ // `GtkPopover:position` is a `GtkPositionType` whose four values pick a
22
+ // side and then, in GTK, negotiate with the surface for room
23
+ // (`present_popover`); here placement is CSS and nothing measures a rect.
24
+ // autohide — boolean, default TRUE — GTK's grab. `gtk_popover_map` takes the grab
25
+ // only when it holds (gtkpopover.c:1245-1247) and `gtk_popover_show`
26
+ // focuses the first child only then (gtkpopover.c:1188-1192), so with it
27
+ // off an outside click and an Escape do not dismiss and focus stays where
28
+ // the caller left it. That is entry completion's own shape, which is the
29
+ // usecase the property documents (gtkpopover.c:1978-1988).
23
30
  // align — start | end (default start) — which edge it lines up with.
24
- // role — menu | listbox (default menu) — the ARIA role of the surface.
31
+ // role — menu | listbox | dialog (default menu) — the ARIA role of the surface.
25
32
  // An a11y fact ONLY; it does not pick the surface variant, see
26
- // `menu` below.
33
+ // `menu` below. `menu` and `listbox` are the LIST roles: their
34
+ // `.adw-popover-item` rows are what the arrow keys walk. `dialog` is for a
35
+ // surface holding CONTENT — an info button's explanatory text — read as
36
+ // content instead of as a menu of commands; it takes an accessible name
37
+ // (`aria-label`) and must not claim `aria-modal`, which is
38
+ // `modal-surface.ts`'s alone.
27
39
  // menu — boolean; libadwaita's `.menu` STYLE CLASS on the popover node (0
28
40
  // padding on the contents, `$menu_margin` on the item box), opt-in
29
41
  // exactly as it is in GTK. DO NOT infer it from `role`: `GtkDropDown`'s
@@ -32,6 +44,7 @@
32
44
  // the role pads the drop-down like a bare content popover.
33
45
  // Properties:
34
46
  // open — whether the popover is showing (get/set).
47
+ // autohide — whether an outside click dismisses (get/set).
35
48
  // anchor — the element the surface is positioned against and returns focus
36
49
  // to. Defaults to `parentElement` (get/set).
37
50
  // items — the navigable rows, in DOM order (get). Used for keyboard moves.
@@ -43,6 +56,25 @@
43
56
  // `popover-item-activated` (CustomEvent, bubbles, detail = { index }) — a row
44
57
  // was chosen by keyboard. Click activation stays the row's own listener.
45
58
  //
59
+ // KNOWN_GAPS — the `GtkPopover` scalar properties this element does not observe:
60
+ //
61
+ // `cascade-popdown` GTK closes the ANCESTOR popovers when a child popover takes the
62
+ // focus (`cascade_popdown`, gtkpopover.c:2455-2478), walking
63
+ // `gtk_widget_get_parent` upward while each ancestor opts in. A
64
+ // DOM popup has no focus owner to walk FROM — focus moves without
65
+ // the element learning of it — so there is no event to hang this on.
66
+ // `has-arrow` GTK draws the `arrow` node, and `popover > arrow` is a real rule
67
+ // (_popovers.scss:44-56). Placement here is the `position`/`align`
68
+ // pair alone, with nothing for an arrow to point at.
69
+ // `mnemonics-visible` GTK underlines the `_` mnemonic of a Pango label
70
+ // (gtkpopover.c:2034-2041). The labels here are plain text with no
71
+ // keyval, so there is nothing for the property to reveal.
72
+ //
73
+ // `child` and `default-widget` are widget-typed, and on this renderer they are SLOTS —
74
+ // the exclusion `check-adwaita-element-properties.mjs` already applies to every
75
+ // widget-valued property.
76
+ //
77
+ // Reference: refs/gtk/gtk/gtkpopover.c (autohide :1046, :1188, :1245; the property list)
46
78
  // Reference: refs/libadwaita/src/stylesheet/widgets/_popovers.scss (popover > contents)
47
79
  // Reference: refs/libadwaita/src/stylesheet/widgets/_menus.scss (popover.menu, modelbutton)
48
80
  // Copyright (c) GNOME contributors (libadwaita). LGPLv2.1+.
@@ -56,12 +88,21 @@ export type GtkPopoverPosition = 'bottom' | 'top' | 'start' | 'end';
56
88
  /** Which edge of the anchor the surface lines up with. */
57
89
  export type GtkPopoverAlign = 'start' | 'end';
58
90
 
59
- /** The ARIA role of the surface — it decides the row role consumers give their items. */
60
- export type GtkPopoverRole = 'menu' | 'listbox';
91
+ /**
92
+ * The ARIA role of the surface — it decides the row role consumers give their items.
93
+ *
94
+ * `dialog` is the one role that is not a container of ROWS: it is for a surface holding
95
+ * content, so nothing derives an item role from it. Upstream splits the same way —
96
+ * `GtkPopoverMenu` declares itself a menu (`refs/gtk/gtk/gtkpopovermenu.c:676`), a bare
97
+ * `GtkPopover` declares nothing.
98
+ */
99
+ export type GtkPopoverRole = 'menu' | 'listbox' | 'dialog';
61
100
 
62
101
  const POSITIONS: readonly GtkPopoverPosition[] = ['bottom', 'top', 'start', 'end'];
63
102
  const ALIGNS: readonly GtkPopoverAlign[] = ['start', 'end'];
64
- const ROLES: readonly GtkPopoverRole[] = ['menu', 'listbox'];
103
+ /** The roles whose `.adw-popover-item` rows the LIST keys walk. */
104
+ const LIST_ROLES: readonly GtkPopoverRole[] = ['menu', 'listbox'];
105
+ const ROLES: readonly GtkPopoverRole[] = [...LIST_ROLES, 'dialog'];
65
106
 
66
107
  /** The row selector keyboard navigation walks. */
67
108
  const ITEM_SELECTOR = '.adw-popover-item';
@@ -74,6 +115,12 @@ export class GtkPopover extends HTMLElement {
74
115
  private _reflecting = false;
75
116
 
76
117
  private _onDocumentPointerDown = (event: Event): void => {
118
+ // GTK's grab is the whole mechanism: `gtk_popover_map` adds it only when
119
+ // `autohide` holds (gtkpopover.c:1245-1247), and without a grab nothing routes an
120
+ // outside click to the popover. So the property is honoured HERE rather than in the
121
+ // markup, and the listener is still bound either way — unbinding it would make the
122
+ // attribute change rebuild the document bindings for a boolean.
123
+ if (!this.autohide) return;
77
124
  const target = event.target as Node;
78
125
  if (this.contains(target)) return;
79
126
  // A click on the anchor is the anchor's own toggle — closing here too would close
@@ -84,6 +131,10 @@ export class GtkPopover extends HTMLElement {
84
131
 
85
132
  private _onDocumentKeyDown = (event: KeyboardEvent): void => {
86
133
  if (event.key !== 'Escape') return;
134
+ // Same grab, same gate: with `autohide` off the caret belongs to whatever is
135
+ // behind the surface, and an Escape that closed it would be a keypress with no
136
+ // handler at all.
137
+ if (!this.autohide) return;
87
138
  // Captured at the document, so a nested popover's Escape does not also close its
88
139
  // parent.
89
140
  event.stopPropagation();
@@ -92,7 +143,7 @@ export class GtkPopover extends HTMLElement {
92
143
  };
93
144
 
94
145
  static get observedAttributes() {
95
- return ['open', 'position', 'align', 'role', 'menu'];
146
+ return ['open', 'position', 'align', 'role', 'menu', 'autohide'];
96
147
  }
97
148
 
98
149
  get open(): boolean {
@@ -104,6 +155,26 @@ export class GtkPopover extends HTMLElement {
104
155
  else this._state.popdown();
105
156
  }
106
157
 
158
+ /**
159
+ * Whether an outside click (or an Escape) dismisses the popover — GTK's grab.
160
+ *
161
+ * `autohide` defaults to TRUE in C (`priv->autohide = TRUE`, gtkpopover.c:1046) and
162
+ * that default is what every existing consumer in this package relies on, so it is
163
+ * the ABSENCE of the attribute rather than its presence, exactly as GTK spells it.
164
+ * Turning it off is entry completion's shape, which is the usecase the property
165
+ * documents: the entry keeps the caret and the list follows the typing.
166
+ */
167
+ get autohide(): boolean {
168
+ return this.getAttribute('autohide') !== 'false';
169
+ }
170
+
171
+ set autohide(value: boolean) {
172
+ // `autohide` is a DEFAULT-TRUE boolean, so its attribute form has to be able to
173
+ // say BOTH values: `<gtk-popover autohide="false">` is the only markup spelling
174
+ // of "no grab", and a bare `autohide` cannot be told apart from the default.
175
+ this.setAttribute('autohide', String(value));
176
+ }
177
+
107
178
  /**
108
179
  * The element the surface is positioned against and hands focus back to. Defaults to
109
180
  * `parentElement`: the popover is normally the last child of the widget that owns it.
@@ -134,6 +205,7 @@ export class GtkPopover extends HTMLElement {
134
205
  this.setAttribute('align', value);
135
206
  }
136
207
 
208
+ /** The ARIA role of the surface; an unknown value reads as the `menu` default. */
137
209
  get popoverRole(): GtkPopoverRole {
138
210
  const value = this.getAttribute('role');
139
211
  return ROLES.includes(value as GtkPopoverRole) ? (value as GtkPopoverRole) : 'menu';
@@ -206,7 +278,13 @@ export class GtkPopover extends HTMLElement {
206
278
  this._unbindDocument();
207
279
  }
208
280
 
209
- attributeChangedCallback(name: string, _previous: string | null, value: string | null) {
281
+ /**
282
+ * Every parameter is optional, and that is FOR `<gtk-popover-menu>`, which subclasses
283
+ * this element: an override may not demand a parameter the base signature does not pass,
284
+ * and the platform always passes all three — the `?` is a typescript-visible fact about
285
+ * the CALLER, not about what arrives.
286
+ */
287
+ attributeChangedCallback(name?: string, _previous?: string | null, value?: string | null) {
210
288
  if (!this._initialized) return;
211
289
  if (name === 'open') {
212
290
  if (this._reflecting) return;
@@ -263,6 +341,10 @@ export class GtkPopover extends HTMLElement {
263
341
  */
264
342
  private _onKeyDown(event: KeyboardEvent): void {
265
343
  if (!this._state.open) return;
344
+ // The LIST keys belong to a `menu` / `listbox`. A `dialog` holds CONTENT, and a key
345
+ // there is the content's — the arrows scroll it, and taking them for a row walk
346
+ // would leave an explanatory popover on keys that move nothing.
347
+ if (!LIST_ROLES.includes(this.popoverRole)) return;
266
348
  const items = this.items;
267
349
  const active = document.activeElement as HTMLElement | null;
268
350
  const currentIndex = active === null ? -1 : items.indexOf(active);