@gjsify/adwaita-web 0.53.0 → 0.55.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 (440) hide show
  1. package/dist/adwaita-web.css +8070 -3037
  2. package/dist/adwaita-web.css.map +1 -1
  3. package/lib/types/adw-application-window.spec.d.ts +1 -0
  4. package/lib/types/adw-bin.spec.d.ts +1 -0
  5. package/lib/types/adw-breakpoint-bin.spec.d.ts +1 -0
  6. package/lib/types/adw-clamp-scrollable.spec.d.ts +1 -0
  7. package/lib/types/adw-multi-layout-view.spec.d.ts +1 -0
  8. package/lib/types/adw-preferences-row.spec.d.ts +1 -0
  9. package/lib/types/adw-shortcuts.spec.d.ts +1 -0
  10. package/lib/types/adw-tab-bar.spec.d.ts +1 -0
  11. package/lib/types/adw-tab-button.spec.d.ts +1 -0
  12. package/lib/types/adw-tab-overview.spec.d.ts +1 -0
  13. package/lib/types/adw-view-switcher-sidebar.spec.d.ts +1 -0
  14. package/lib/types/adw-window.spec.d.ts +1 -0
  15. package/lib/types/breakpoints.d.ts +14 -3
  16. package/lib/types/construct-vectors.spec.d.ts +1 -0
  17. package/lib/types/elements/adw-application-window.d.ts +27 -0
  18. package/lib/types/elements/adw-bin.d.ts +17 -0
  19. package/lib/types/elements/adw-breakpoint-bin.d.ts +67 -0
  20. package/lib/types/elements/adw-clamp-scrollable.d.ts +38 -0
  21. package/lib/types/elements/adw-dialog.d.ts +10 -0
  22. package/lib/types/elements/adw-layout-slot.d.ts +19 -0
  23. package/lib/types/elements/adw-multi-layout-view.d.ts +101 -0
  24. package/lib/types/elements/adw-preferences-row.d.ts +31 -0
  25. package/lib/types/elements/adw-shortcuts-dialog.d.ts +13 -0
  26. package/lib/types/elements/adw-shortcuts-item.d.ts +36 -0
  27. package/lib/types/elements/adw-shortcuts-section.d.ts +14 -0
  28. package/lib/types/elements/adw-sidebar.d.ts +5 -0
  29. package/lib/types/elements/adw-switch-row.d.ts +3 -0
  30. package/lib/types/elements/adw-tab-bar.d.ts +108 -0
  31. package/lib/types/elements/adw-tab-button.d.ts +32 -0
  32. package/lib/types/elements/adw-tab-overview.d.ts +199 -0
  33. package/lib/types/elements/adw-tab-view.d.ts +19 -23
  34. package/lib/types/elements/adw-view-switcher-sidebar.d.ts +84 -0
  35. package/lib/types/elements/adw-window.d.ts +40 -0
  36. package/lib/types/elements/gtk-about-dialog.d.ts +146 -0
  37. package/lib/types/elements/gtk-application-window.d.ts +34 -0
  38. package/lib/types/elements/gtk-aspect-frame.d.ts +27 -0
  39. package/lib/types/elements/gtk-button.d.ts +9 -0
  40. package/lib/types/elements/gtk-calendar.d.ts +159 -0
  41. package/lib/types/elements/gtk-center-box.d.ts +39 -0
  42. package/lib/types/elements/gtk-color-dialog-button.d.ts +69 -0
  43. package/lib/types/elements/gtk-column-view.d.ts +50 -0
  44. package/lib/types/elements/gtk-drag-icon.d.ts +78 -0
  45. package/lib/types/elements/gtk-drawing-area.d.ts +95 -0
  46. package/lib/types/elements/gtk-editable-label.d.ts +33 -0
  47. package/lib/types/elements/gtk-emoji-chooser.d.ts +84 -0
  48. package/lib/types/elements/gtk-entry.d.ts +20 -1
  49. package/lib/types/elements/gtk-expander.d.ts +49 -0
  50. package/lib/types/elements/gtk-fixed.d.ts +13 -0
  51. package/lib/types/elements/gtk-flow-box-child.d.ts +14 -0
  52. package/lib/types/elements/gtk-flow-box.d.ts +87 -0
  53. package/lib/types/elements/gtk-font-dialog-button.d.ts +83 -0
  54. package/lib/types/elements/gtk-frame.d.ts +24 -0
  55. package/lib/types/elements/gtk-gl-area.d.ts +136 -0
  56. package/lib/types/elements/gtk-graphics-offload.d.ts +24 -0
  57. package/lib/types/elements/gtk-grid-view.d.ts +39 -0
  58. package/lib/types/elements/gtk-grid.d.ts +27 -0
  59. package/lib/types/elements/gtk-header-bar.d.ts +60 -0
  60. package/lib/types/elements/gtk-inscription.d.ts +64 -0
  61. package/lib/types/elements/gtk-label.d.ts +3 -0
  62. package/lib/types/elements/gtk-level-bar.d.ts +59 -0
  63. package/lib/types/elements/gtk-link-button.d.ts +29 -0
  64. package/lib/types/elements/gtk-list-box-row.d.ts +54 -0
  65. package/lib/types/elements/gtk-list-box.d.ts +100 -0
  66. package/lib/types/elements/gtk-list-view.d.ts +73 -0
  67. package/lib/types/elements/gtk-media-controls.d.ts +142 -0
  68. package/lib/types/elements/gtk-notebook.d.ts +148 -0
  69. package/lib/types/elements/gtk-overlay.d.ts +22 -0
  70. package/lib/types/elements/gtk-page-setup-unix-dialog.d.ts +87 -0
  71. package/lib/types/elements/gtk-paned.d.ts +121 -0
  72. package/lib/types/elements/gtk-password-entry.d.ts +27 -0
  73. package/lib/types/elements/gtk-picture.d.ts +66 -0
  74. package/lib/types/elements/gtk-popover-bin.d.ts +82 -0
  75. package/lib/types/elements/gtk-popover-menu-bar.d.ts +66 -0
  76. package/lib/types/elements/gtk-popover-menu.d.ts +83 -0
  77. package/lib/types/elements/gtk-popover.d.ts +28 -3
  78. package/lib/types/elements/gtk-print-unix-dialog.d.ts +167 -0
  79. package/lib/types/elements/gtk-revealer.d.ts +55 -0
  80. package/lib/types/elements/gtk-scale-button.d.ts +59 -0
  81. package/lib/types/elements/gtk-scale.d.ts +98 -0
  82. package/lib/types/elements/gtk-scrollbar.d.ts +124 -0
  83. package/lib/types/elements/gtk-scrolled-window.d.ts +121 -0
  84. package/lib/types/elements/gtk-search-bar.d.ts +39 -0
  85. package/lib/types/elements/gtk-search-entry.d.ts +27 -0
  86. package/lib/types/elements/gtk-separator.d.ts +10 -0
  87. package/lib/types/elements/gtk-spin-button.d.ts +94 -0
  88. package/lib/types/elements/gtk-spinner.d.ts +14 -0
  89. package/lib/types/elements/gtk-stack-sidebar.d.ts +43 -0
  90. package/lib/types/elements/gtk-stack-switcher.d.ts +58 -0
  91. package/lib/types/elements/gtk-stack.d.ts +154 -0
  92. package/lib/types/elements/gtk-switch.d.ts +4 -1
  93. package/lib/types/elements/gtk-text-view.d.ts +62 -0
  94. package/lib/types/elements/gtk-text.d.ts +45 -0
  95. package/lib/types/elements/gtk-toggle-button.d.ts +45 -0
  96. package/lib/types/elements/gtk-tree-expander.d.ts +38 -0
  97. package/lib/types/elements/gtk-video.d.ts +97 -0
  98. package/lib/types/elements/gtk-viewport.d.ts +84 -0
  99. package/lib/types/elements/gtk-window-controls.d.ts +80 -0
  100. package/lib/types/elements/gtk-window-handle.d.ts +39 -0
  101. package/lib/types/elements/gtk-window.d.ts +97 -0
  102. package/lib/types/elements/justification.d.ts +2 -0
  103. package/lib/types/elements/popover-menu.d.ts +18 -0
  104. package/lib/types/elements/roving-focus.d.ts +29 -1
  105. package/lib/types/emoji-data.d.ts +38 -0
  106. package/lib/types/font-description.d.ts +96 -0
  107. package/lib/types/gtk-about-dialog.spec.d.ts +1 -0
  108. package/lib/types/gtk-action-bar.spec.d.ts +1 -0
  109. package/lib/types/gtk-application-window.spec.d.ts +1 -0
  110. package/lib/types/gtk-aspect-frame.spec.d.ts +1 -0
  111. package/lib/types/gtk-calendar.spec.d.ts +1 -0
  112. package/lib/types/gtk-center-box.spec.d.ts +1 -0
  113. package/lib/types/gtk-color-dialog-button.spec.d.ts +1 -0
  114. package/lib/types/gtk-column-view.spec.d.ts +1 -0
  115. package/lib/types/gtk-drag-icon.spec.d.ts +1 -0
  116. package/lib/types/gtk-drawing-area.spec.d.ts +1 -0
  117. package/lib/types/gtk-editable-label.spec.d.ts +1 -0
  118. package/lib/types/gtk-emoji-chooser.spec.d.ts +1 -0
  119. package/lib/types/gtk-expander.spec.d.ts +1 -0
  120. package/lib/types/gtk-fixed.spec.d.ts +1 -0
  121. package/lib/types/gtk-flow-box.spec.d.ts +1 -0
  122. package/lib/types/gtk-font-dialog-button.spec.d.ts +1 -0
  123. package/lib/types/gtk-frame.spec.d.ts +1 -0
  124. package/lib/types/gtk-gl-area.spec.d.ts +1 -0
  125. package/lib/types/gtk-graphics-offload.spec.d.ts +1 -0
  126. package/lib/types/gtk-grid-view.spec.d.ts +1 -0
  127. package/lib/types/gtk-grid.spec.d.ts +1 -0
  128. package/lib/types/gtk-header-bar.spec.d.ts +1 -0
  129. package/lib/types/gtk-inscription.spec.d.ts +1 -0
  130. package/lib/types/gtk-level-bar.spec.d.ts +1 -0
  131. package/lib/types/gtk-link-button.spec.d.ts +1 -0
  132. package/lib/types/gtk-list-box.spec.d.ts +1 -0
  133. package/lib/types/gtk-list-view.spec.d.ts +1 -0
  134. package/lib/types/gtk-media-controls.spec.d.ts +1 -0
  135. package/lib/types/gtk-notebook.spec.d.ts +1 -0
  136. package/lib/types/gtk-overlay.spec.d.ts +1 -0
  137. package/lib/types/gtk-paned.spec.d.ts +1 -0
  138. package/lib/types/gtk-password-entry.spec.d.ts +1 -0
  139. package/lib/types/gtk-picture.spec.d.ts +1 -0
  140. package/lib/types/gtk-popover-bin.spec.d.ts +1 -0
  141. package/lib/types/gtk-popover-menu-bar.spec.d.ts +1 -0
  142. package/lib/types/gtk-popover-menu.spec.d.ts +1 -0
  143. package/lib/types/gtk-popover-role.spec.d.ts +1 -0
  144. package/lib/types/gtk-popover.spec.d.ts +1 -0
  145. package/lib/types/gtk-print-dialogs.spec.d.ts +1 -0
  146. package/lib/types/gtk-revealer.spec.d.ts +1 -0
  147. package/lib/types/gtk-scale-button.spec.d.ts +1 -0
  148. package/lib/types/gtk-scale.spec.d.ts +1 -0
  149. package/lib/types/gtk-scrollbar.spec.d.ts +1 -0
  150. package/lib/types/gtk-scrolled-window.spec.d.ts +1 -0
  151. package/lib/types/gtk-search-bar.spec.d.ts +1 -0
  152. package/lib/types/gtk-search-entry.spec.d.ts +1 -0
  153. package/lib/types/gtk-separator.spec.d.ts +1 -0
  154. package/lib/types/gtk-spin-button.spec.d.ts +1 -0
  155. package/lib/types/gtk-spinner.spec.d.ts +1 -0
  156. package/lib/types/gtk-stack-sidebar.spec.d.ts +1 -0
  157. package/lib/types/gtk-stack-switcher.spec.d.ts +1 -0
  158. package/lib/types/gtk-stack.spec.d.ts +1 -0
  159. package/lib/types/gtk-text-view.spec.d.ts +1 -0
  160. package/lib/types/gtk-text.spec.d.ts +1 -0
  161. package/lib/types/gtk-toggle-button.spec.d.ts +1 -0
  162. package/lib/types/gtk-tree-expander.spec.d.ts +1 -0
  163. package/lib/types/gtk-video.spec.d.ts +1 -0
  164. package/lib/types/gtk-viewport.spec.d.ts +1 -0
  165. package/lib/types/gtk-window-controls.spec.d.ts +1 -0
  166. package/lib/types/gtk-window-handle.spec.d.ts +1 -0
  167. package/lib/types/gtk-window.spec.d.ts +1 -0
  168. package/lib/types/index.d.ts +4 -1
  169. package/lib/types/list-view-dom.d.ts +44 -0
  170. package/lib/types/namespace/adw.d.ts +12 -0
  171. package/lib/types/namespace/gtk.d.ts +61 -0
  172. package/lib/types/page-setup.d.ts +100 -0
  173. package/lib/types/scroll-shading.d.ts +15 -1
  174. package/lib/types/shared-tree-builder.d.ts +30 -2
  175. package/lib/types/signals.d.ts +4 -0
  176. package/lib/types/styles.generated.d.ts +1 -1
  177. package/lib/types/tab-chip.d.ts +73 -0
  178. package/lib/types/template-classes.d.ts +11 -0
  179. package/package.json +12 -8
  180. package/scss/_action_row.scss +2 -2
  181. package/scss/_application_window.scss +26 -0
  182. package/scss/_aspect_frame.scss +25 -0
  183. package/scss/_bin.scss +26 -0
  184. package/scss/_button.scss +45 -0
  185. package/scss/_calendar.scss +176 -0
  186. package/scss/_center_box.scss +25 -0
  187. package/scss/_checks.scss +6 -1
  188. package/scss/_clamp_scrollable.scss +28 -0
  189. package/scss/_color_button.scss +67 -0
  190. package/scss/_column_view.scss +126 -0
  191. package/scss/_drag_icon.scss +55 -0
  192. package/scss/_drawing.scss +85 -0
  193. package/scss/_emoji_chooser.scss +213 -0
  194. package/scss/_entry.scss +13 -5
  195. package/scss/_entry_row.scss +1 -1
  196. package/scss/_expander.scss +113 -0
  197. package/scss/_fixed.scss +29 -0
  198. package/scss/_flow_box.scss +94 -0
  199. package/scss/_font_button.scss +63 -0
  200. package/scss/_frame.scss +41 -0
  201. package/scss/_grid.scss +19 -0
  202. package/scss/_grid_view.scss +46 -0
  203. package/scss/_gtk_about_dialog.scss +186 -0
  204. package/scss/_headerbar.scss +132 -0
  205. package/scss/_icons.generated.scss +186 -0
  206. package/scss/_inscription.scss +125 -0
  207. package/scss/_level_bar.scss +190 -0
  208. package/scss/_link.scss +82 -0
  209. package/scss/_list_box.scss +88 -0
  210. package/scss/_list_view.scss +96 -0
  211. package/scss/_media_controls.scss +139 -0
  212. package/scss/_overlay.scss +68 -0
  213. package/scss/_paned.scss +130 -0
  214. package/scss/_password_entry.scss +83 -0
  215. package/scss/_picture.scss +80 -0
  216. package/scss/_popover_bin.scss +53 -0
  217. package/scss/_popover_menu_bar.scss +104 -0
  218. package/scss/_preferences_row.scss +51 -0
  219. package/scss/_print_dialogs.scss +328 -0
  220. package/scss/_reset.scss +21 -19
  221. package/scss/_revealer.scss +37 -0
  222. package/scss/_row.scss +20 -5
  223. package/scss/_scale.scss +298 -0
  224. package/scss/_scale_button.scss +167 -0
  225. package/scss/_scrollbar.scss +230 -0
  226. package/scss/_scrolled_window.scss +131 -0
  227. package/scss/_search_bar.scss +118 -0
  228. package/scss/_search_entry.scss +86 -0
  229. package/scss/_separator.scss +44 -0
  230. package/scss/_shortcuts_dialog.scss +100 -0
  231. package/scss/_spin_button.scss +172 -0
  232. package/scss/_spin_row.scss +56 -8
  233. package/scss/_spinner.scss +85 -4
  234. package/scss/_stack.scss +729 -0
  235. package/scss/_switch.scss +13 -5
  236. package/scss/_switch_row.scss +10 -0
  237. package/scss/_tab_bar.scss +317 -0
  238. package/scss/_tab_button.scss +98 -0
  239. package/scss/_tab_overview.scss +483 -0
  240. package/scss/_text.scss +182 -0
  241. package/scss/_theme.scss +1 -1
  242. package/scss/_tree_expander.scss +62 -0
  243. package/scss/_variables.scss +43 -21
  244. package/scss/_video.scss +146 -0
  245. package/scss/_view_switcher_sidebar.scss +112 -0
  246. package/scss/_viewport.scss +50 -0
  247. package/scss/_window.scss +118 -1
  248. package/scss/_window_handle.scss +20 -0
  249. package/scss/adwaita-skin.scss +109 -0
  250. package/src/adw-action-rows.spec.ts +76 -0
  251. package/src/adw-application-window.spec.ts +118 -0
  252. package/src/adw-bin.spec.ts +75 -0
  253. package/src/adw-breakpoint-bin.spec.ts +324 -0
  254. package/src/adw-clamp-scrollable.spec.ts +189 -0
  255. package/src/adw-multi-layout-view.spec.ts +243 -0
  256. package/src/adw-preferences-row.spec.ts +164 -0
  257. package/src/adw-row-state.spec.ts +142 -0
  258. package/src/adw-shortcuts.spec.ts +155 -0
  259. package/src/adw-tab-bar.spec.ts +287 -0
  260. package/src/adw-tab-button.spec.ts +101 -0
  261. package/src/adw-tab-overview.spec.ts +443 -0
  262. package/src/adw-view-switcher-sidebar.spec.ts +281 -0
  263. package/src/adw-window.spec.ts +129 -0
  264. package/src/breakpoints.ts +25 -8
  265. package/src/capabilities.d.mts +3 -0
  266. package/src/capabilities.mjs +18 -0
  267. package/src/connect-lifecycle.spec.ts +12 -0
  268. package/src/construct-vectors.spec.ts +175 -0
  269. package/src/elements/adw-application-window.ts +154 -0
  270. package/src/elements/adw-bin.ts +101 -0
  271. package/src/elements/adw-breakpoint-bin.ts +287 -0
  272. package/src/elements/adw-clamp-scrollable.ts +207 -0
  273. package/src/elements/adw-dialog.ts +19 -0
  274. package/src/elements/adw-layout-slot.ts +95 -0
  275. package/src/elements/adw-multi-layout-view.ts +326 -0
  276. package/src/elements/adw-preferences-row.ts +150 -0
  277. package/src/elements/adw-shortcuts-dialog.ts +52 -0
  278. package/src/elements/adw-shortcuts-item.ts +171 -0
  279. package/src/elements/adw-shortcuts-section.ts +86 -0
  280. package/src/elements/adw-sidebar.ts +42 -3
  281. package/src/elements/adw-switch-row.ts +28 -1
  282. package/src/elements/adw-tab-bar.ts +529 -0
  283. package/src/elements/adw-tab-button.ts +194 -0
  284. package/src/elements/adw-tab-overview.ts +1011 -0
  285. package/src/elements/adw-tab-view.ts +66 -145
  286. package/src/elements/adw-toggle-group.ts +20 -5
  287. package/src/elements/adw-view-stack.ts +18 -0
  288. package/src/elements/adw-view-switcher-sidebar.ts +332 -0
  289. package/src/elements/adw-window.ts +185 -11
  290. package/src/elements/checks.ts +35 -8
  291. package/src/elements/gtk-about-dialog.ts +811 -0
  292. package/src/elements/gtk-application-window.ts +108 -0
  293. package/src/elements/gtk-aspect-frame.ts +160 -0
  294. package/src/elements/gtk-button.ts +12 -0
  295. package/src/elements/gtk-calendar.ts +757 -0
  296. package/src/elements/gtk-center-box.ts +184 -0
  297. package/src/elements/gtk-color-dialog-button.ts +278 -0
  298. package/src/elements/gtk-column-view.ts +320 -0
  299. package/src/elements/gtk-drag-icon.ts +257 -0
  300. package/src/elements/gtk-drawing-area.ts +303 -0
  301. package/src/elements/gtk-editable-label.ts +204 -0
  302. package/src/elements/gtk-emoji-chooser.ts +542 -0
  303. package/src/elements/gtk-entry.ts +39 -5
  304. package/src/elements/gtk-expander.ts +301 -0
  305. package/src/elements/gtk-fixed.ts +99 -0
  306. package/src/elements/gtk-flow-box-child.ts +68 -0
  307. package/src/elements/gtk-flow-box.ts +480 -0
  308. package/src/elements/gtk-font-dialog-button.ts +432 -0
  309. package/src/elements/gtk-frame.ts +174 -0
  310. package/src/elements/gtk-gl-area.ts +476 -0
  311. package/src/elements/gtk-graphics-offload.ts +130 -0
  312. package/src/elements/gtk-grid-view.ts +168 -0
  313. package/src/elements/gtk-grid.ts +127 -0
  314. package/src/elements/gtk-header-bar.ts +273 -0
  315. package/src/elements/gtk-inscription.ts +387 -0
  316. package/src/elements/gtk-label.ts +19 -11
  317. package/src/elements/gtk-level-bar.ts +323 -0
  318. package/src/elements/gtk-link-button.ts +138 -0
  319. package/src/elements/gtk-list-box-row.ts +195 -0
  320. package/src/elements/gtk-list-box.ts +413 -0
  321. package/src/elements/gtk-list-view.ts +370 -0
  322. package/src/elements/gtk-media-controls.ts +509 -0
  323. package/src/elements/gtk-notebook.ts +664 -0
  324. package/src/elements/gtk-overlay.ts +149 -0
  325. package/src/elements/gtk-page-setup-unix-dialog.ts +420 -0
  326. package/src/elements/gtk-paned.ts +597 -0
  327. package/src/elements/gtk-password-entry.ts +170 -0
  328. package/src/elements/gtk-picture.ts +254 -0
  329. package/src/elements/gtk-popover-bin.ts +332 -0
  330. package/src/elements/gtk-popover-menu-bar.ts +355 -0
  331. package/src/elements/gtk-popover-menu.ts +339 -0
  332. package/src/elements/gtk-popover.ts +92 -10
  333. package/src/elements/gtk-print-unix-dialog.ts +989 -0
  334. package/src/elements/gtk-progress-bar.ts +24 -11
  335. package/src/elements/gtk-revealer.ts +406 -0
  336. package/src/elements/gtk-scale-button.ts +358 -0
  337. package/src/elements/gtk-scale.ts +492 -0
  338. package/src/elements/gtk-scrollbar.ts +528 -0
  339. package/src/elements/gtk-scrolled-window.ts +642 -0
  340. package/src/elements/gtk-search-bar.ts +200 -0
  341. package/src/elements/gtk-search-entry.ts +172 -0
  342. package/src/elements/gtk-separator.ts +52 -0
  343. package/src/elements/gtk-spin-button.ts +475 -0
  344. package/src/elements/gtk-spinner.ts +126 -0
  345. package/src/elements/gtk-stack-sidebar.ts +212 -0
  346. package/src/elements/gtk-stack-switcher.ts +279 -0
  347. package/src/elements/gtk-stack.ts +748 -0
  348. package/src/elements/gtk-switch.ts +52 -19
  349. package/src/elements/gtk-text-view.ts +290 -0
  350. package/src/elements/gtk-text.ts +219 -0
  351. package/src/elements/gtk-toggle-button.ts +239 -0
  352. package/src/elements/gtk-tree-expander.ts +243 -0
  353. package/src/elements/gtk-video.ts +423 -0
  354. package/src/elements/gtk-viewport.ts +277 -0
  355. package/src/elements/gtk-window-controls.ts +341 -0
  356. package/src/elements/gtk-window-handle.ts +221 -0
  357. package/src/elements/gtk-window.ts +366 -0
  358. package/src/elements/justification.ts +24 -0
  359. package/src/elements/popover-menu.ts +24 -0
  360. package/src/elements/roving-focus.ts +53 -21
  361. package/src/emoji-data.ts +577 -0
  362. package/src/entry-rows.spec.ts +31 -0
  363. package/src/font-description.ts +238 -0
  364. package/src/gtk-about-dialog.spec.ts +250 -0
  365. package/src/gtk-action-bar.spec.ts +89 -0
  366. package/src/gtk-application-window.spec.ts +107 -0
  367. package/src/gtk-aspect-frame.spec.ts +114 -0
  368. package/src/gtk-calendar.spec.ts +589 -0
  369. package/src/gtk-center-box.spec.ts +125 -0
  370. package/src/gtk-color-dialog-button.spec.ts +141 -0
  371. package/src/gtk-column-view.spec.ts +154 -0
  372. package/src/gtk-drag-icon.spec.ts +190 -0
  373. package/src/gtk-drawing-area.spec.ts +211 -0
  374. package/src/gtk-editable-label.spec.ts +190 -0
  375. package/src/gtk-emoji-chooser.spec.ts +173 -0
  376. package/src/gtk-entry.spec.ts +23 -0
  377. package/src/gtk-expander.spec.ts +170 -0
  378. package/src/gtk-fixed.spec.ts +97 -0
  379. package/src/gtk-flow-box.spec.ts +289 -0
  380. package/src/gtk-font-dialog-button.spec.ts +166 -0
  381. package/src/gtk-frame.spec.ts +119 -0
  382. package/src/gtk-gl-area.spec.ts +361 -0
  383. package/src/gtk-graphics-offload.spec.ts +119 -0
  384. package/src/gtk-grid-view.spec.ts +106 -0
  385. package/src/gtk-grid.spec.ts +122 -0
  386. package/src/gtk-header-bar.spec.ts +202 -0
  387. package/src/gtk-inscription.spec.ts +235 -0
  388. package/src/gtk-level-bar.spec.ts +199 -0
  389. package/src/gtk-link-button.spec.ts +117 -0
  390. package/src/gtk-list-box.spec.ts +422 -0
  391. package/src/gtk-list-view.spec.ts +203 -0
  392. package/src/gtk-media-controls.spec.ts +295 -0
  393. package/src/gtk-notebook.spec.ts +546 -0
  394. package/src/gtk-overlay.spec.ts +141 -0
  395. package/src/gtk-paned.spec.ts +267 -0
  396. package/src/gtk-password-entry.spec.ts +150 -0
  397. package/src/gtk-picture.spec.ts +172 -0
  398. package/src/gtk-popover-bin.spec.ts +229 -0
  399. package/src/gtk-popover-menu-bar.spec.ts +296 -0
  400. package/src/gtk-popover-menu.spec.ts +261 -0
  401. package/src/gtk-popover-role.spec.ts +138 -0
  402. package/src/gtk-popover.spec.ts +264 -0
  403. package/src/gtk-print-dialogs.spec.ts +251 -0
  404. package/src/gtk-revealer.spec.ts +164 -0
  405. package/src/gtk-scale-button.spec.ts +218 -0
  406. package/src/gtk-scale.spec.ts +213 -0
  407. package/src/gtk-scrollbar.spec.ts +244 -0
  408. package/src/gtk-scrolled-window.spec.ts +262 -0
  409. package/src/gtk-search-bar.spec.ts +179 -0
  410. package/src/gtk-search-entry.spec.ts +142 -0
  411. package/src/gtk-separator.spec.ts +74 -0
  412. package/src/gtk-spin-button.spec.ts +186 -0
  413. package/src/gtk-spinner.spec.ts +130 -0
  414. package/src/gtk-stack-sidebar.spec.ts +217 -0
  415. package/src/gtk-stack-switcher.spec.ts +249 -0
  416. package/src/gtk-stack.spec.ts +432 -0
  417. package/src/gtk-text-view.spec.ts +189 -0
  418. package/src/gtk-text.spec.ts +163 -0
  419. package/src/gtk-toggle-button.spec.ts +186 -0
  420. package/src/gtk-tree-expander.spec.ts +201 -0
  421. package/src/gtk-video.spec.ts +240 -0
  422. package/src/gtk-viewport.spec.ts +140 -0
  423. package/src/gtk-window-controls.spec.ts +232 -0
  424. package/src/gtk-window-handle.spec.ts +158 -0
  425. package/src/gtk-window.spec.ts +190 -0
  426. package/src/index.ts +9 -1
  427. package/src/keyboard-operable.spec.ts +33 -1
  428. package/src/list-view-dom.ts +121 -0
  429. package/src/namespace/adw.ts +12 -0
  430. package/src/namespace/gtk.ts +61 -0
  431. package/src/page-setup.ts +222 -0
  432. package/src/scroll-shading.ts +18 -1
  433. package/src/shared-tree-builder.ts +263 -21
  434. package/src/signals.ts +15 -0
  435. package/src/source-view/theme.ts +11 -5
  436. package/src/style-classes.spec.ts +9 -8
  437. package/src/styles.generated.ts +1 -1
  438. package/src/tab-chip.ts +200 -0
  439. package/src/template-classes.ts +45 -0
  440. package/src/test.browser.mts +152 -0
@@ -0,0 +1,597 @@
1
+ // <gtk-paned> — two children either side of a divider the user drags.
2
+ //
3
+ // EIGHT attributes, and the two that matter are a pair rather than a set:
4
+ //
5
+ // position the divider, in pixels from the leading edge. This is
6
+ // `start_child_size`, and it is what `gtk_paned_get_position` returns
7
+ // (gtkpaned.c:1855-1863).
8
+ // position-set GTK's READ-ONLY flag, and it is not the inverse of a missing
9
+ // `position`: `gtk_paned_set_position` raises it on any write of a
10
+ // non-negative value and lowers it on a write of -1, which means "let
11
+ // the size requests decide" (gtkpaned.c:1874-1910). So `position = -1`
12
+ // is how the divider goes back to being derived, and once the element
13
+ // owns the flag an author cannot move it by writing the attribute — they
14
+ // write `position`, which is the only door into it.
15
+ // wide-handle the stronger visual separation, and the only other boolean.
16
+ //
17
+ // `resize-start-child` / `resize-end-child` and `shrink-start-child` / `shrink-end-child`
18
+ // all default to TRUE in the pspec (gtkpaned.c:436-470), which a presence-attribute cannot
19
+ // express — so the house rule for a default-true boolean applies and `"false"` is how one
20
+ // is turned off, exactly as `<adw-navigation-view can-pop>` reads it.
21
+ //
22
+ // `min-position` and `max-position` are NOT observed, and the reason is that they are not
23
+ // authors' values: `GtkPaned` implements `GtkAccessibleRange` and both come OUT of the
24
+ // same computation that places the divider (`gtk_paned_compute_position`,
25
+ // gtkpaned.c:1092-1146, writing them at :1921-1948). So they are read-only getters here
26
+ // and reach assistive technology as the handle's `aria-valuemin` / `aria-valuemax`, the
27
+ // same place GTK puts them (gtkpaned.c:1446-1453). `position` IS observed even though the
28
+ // C's setter would refuse to clamp it: "We don't clamp here", because a position written
29
+ // together with a new total size refers to the new size, and `compute_position` clamps on
30
+ // allocation.
31
+ //
32
+ // WHERE THE DIVIDER GOES IS `gtk_paned_calc_position` (gtkpaned.c:1021-1053, calling
33
+ // `gtk_paned_compute_position` at :1092-1146), PORTED AS A FUNCTION and not delegated to
34
+ // flexbox, because the two disagree on the DEFAULT case. With both children resizable and
35
+ // no position set, the C divides the paned in proportion to the two size REQUESTS
36
+ // (`allocation * start_req / (start_req + end_req)`); flexbox with `flex-grow: 1` on both
37
+ // divides it in HALF. So the element measures each child's size request by pinning it to
38
+ // `flex: none` for one read, runs the C's arithmetic, and writes the result as the start
39
+ // pane's `flex-basis` with no growth — which is then exactly the C's allocation:
40
+ // `start_child_allocation.width = MAX (1, start_child_size)` and
41
+ // `end_child_allocation.width = MAX (1, width - start_child_size - handle_size)`
42
+ // (gtkpaned.c:1350-1355).
43
+ //
44
+ // The panes are visible only when they have room — `gtk_widget_set_child_visible
45
+ // (start_child, start_child_size != 0)`, and the end child against the whole allocation
46
+ // (gtkpaned.c:1940-1941) — and the HANDLE is hidden outright when one of them is missing,
47
+ // which is the C's "No separator is drawn if one of the children is missing"
48
+ // (gtkpaned.c:70). `>= 1` rather than `> 0` is GTK's `MAX (1, …)` on the allocation.
49
+ //
50
+ // THE HANDLE is a `GtkPanedHandle`, which is NOT a `GtkSeparator`: it shares the CSS NAME
51
+ // `separator` (gtkpanedhandle.c:88) and nothing else, which is why libadwaita's
52
+ // `paned > separator` rule can say `background: none` while `<gtk-separator>`'s own partial
53
+ // paints a fill. So the handle is a plain box carrying the `separator` class and libadwaita's
54
+ // `_paned.scss` styles it as upstream does. Its hit area reaches `HANDLE_EXTRA_SIZE` past
55
+ // the node on every side unless the handle is wide (`gtk_paned_handle_contains`,
56
+ // gtkpanedhandle.c:60-73) — see `_paned.scss`.
57
+ //
58
+ // A11Y: the HANDLE is the operable thing, so it is the `role="separator"` window splitter
59
+ // with `aria-valuenow` / `valuemin` / `valuemax` and `tabindex="0"`. GTK gives the paned no
60
+ // role of its own and hangs the value on it; ARIA wants the value on the element carrying
61
+ // the role, so the value sits on the handle and the host is a `group`.
62
+ //
63
+ // Reference: refs/gtk/gtk/gtkpaned.c (every property, calc_position, move_handle, update_drag)
64
+ // Reference: refs/gtk/gtk/gtkpanedhandle.c (the handle node, HANDLE_EXTRA_SIZE)
65
+ // Reference: refs/libadwaita/src/stylesheet/widgets/_paned.scss
66
+ // Copyright (c) The GTK Team. LGPLv2.1+.
67
+ // Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
68
+
69
+ import { glibClamp, normalizeBoxOrientation, type BoxOrientation } from '@gjsify/adwaita-core';
70
+
71
+ import { bindSlottedChildren } from '../slotted-children.js';
72
+
73
+ /** `gtkpaned.c:131` — `HANDLE_EXTRA_SIZE`, how far the hit area reaches past the node. */
74
+ const HANDLE_EXTRA_SIZE = 6;
75
+
76
+ /** `gtkpaned.c:2290-2292` — `SINGLE_STEP_SIZE` and `PAGE_STEP_SIZE` for `move_handle`. */
77
+ const SINGLE_STEP_SIZE = 1;
78
+ const PAGE_STEP_SIZE = 75;
79
+
80
+ /** `Gtk.AccessibleRange`'s `VALUE_MIN`, the one bound GTK writes literally (gtkpaned.c:1447). */
81
+ const DEFAULT_MIN_POSITION = 0;
82
+
83
+ /** The inputs of `gtk_paned_compute_position`, one per field it reads. */
84
+ export interface PanedPositionInput {
85
+ /** The paned's own allocation along the axis, minus the handle — its `allocation`. */
86
+ allocation: number;
87
+ /** The start child's size REQUEST along the axis. */
88
+ startRequest: number;
89
+ /** The end child's size REQUEST along the axis. */
90
+ endRequest: number;
91
+ resizeStart: boolean;
92
+ resizeEnd: boolean;
93
+ shrinkStart: boolean;
94
+ shrinkEnd: boolean;
95
+ /** `position_set` — whether the app or the user has placed the divider. */
96
+ positionSet: boolean;
97
+ /** `start_child_size` — the divider as last allocated or set; `0` when unset. */
98
+ startChildSize: number;
99
+ /** `last_allocation` — what `startChildSize` was measured against. */
100
+ lastAllocation: number;
101
+ }
102
+
103
+ /** What `gtk_paned_compute_position` writes back through its three out-parameters. */
104
+ export interface PanedPosition {
105
+ min: number;
106
+ max: number;
107
+ position: number;
108
+ }
109
+
110
+ /**
111
+ * `gtk_paned_compute_position` (gtkpaned.c:1092-1146), statement for statement.
112
+ *
113
+ * Exported so a spec can pin the arithmetic without a layout. The branch keyed on
114
+ * `lastAllocation` is the one a browser cannot reach on its own — there is no "position was
115
+ * set before the first allocation" moment in a flex layout — so it is the piece only a table
116
+ * of inputs can hold.
117
+ */
118
+ export function computePanedPosition(input: PanedPositionInput): PanedPosition {
119
+ const { allocation, startRequest, endRequest, resizeStart, resizeEnd, shrinkStart, shrinkEnd } = input;
120
+
121
+ // min = paned->shrink_start_child ? 0 : start_child_req;
122
+ const min = shrinkStart ? 0 : startRequest;
123
+
124
+ // max = allocation; if (!shrink_end_child) max = MAX (1, max - end_child_req);
125
+ // max = MAX (min, max);
126
+ let max = allocation;
127
+ if (!shrinkEnd) max = Math.max(1, max - endRequest);
128
+ max = Math.max(min, max);
129
+
130
+ let position: number;
131
+ if (!input.positionSet) {
132
+ if (resizeStart && !resizeEnd) {
133
+ position = Math.max(0, allocation - endRequest);
134
+ } else if (!resizeStart && resizeEnd) {
135
+ position = startRequest;
136
+ } else if (startRequest + endRequest !== 0) {
137
+ // `+ 0.5` is the C's round-to-nearest, kept so an odd remainder lands where GTK
138
+ // lands instead of always rounding down.
139
+ position = allocation * (startRequest / (startRequest + endRequest)) + 0.5;
140
+ } else {
141
+ position = allocation * 0.5 + 0.5;
142
+ }
143
+ } else if (input.lastAllocation > 0) {
144
+ // "If the position was set before the initial allocation … just clamp it and leave
145
+ // it", so the growth branch only runs once there IS an allocation to scale from.
146
+ if (resizeStart && !resizeEnd) {
147
+ position = input.startChildSize + allocation - input.lastAllocation;
148
+ } else if (!(!resizeStart && resizeEnd)) {
149
+ position = allocation * (input.startChildSize / input.lastAllocation) + 0.5;
150
+ } else {
151
+ position = input.startChildSize;
152
+ }
153
+ } else {
154
+ position = input.startChildSize;
155
+ }
156
+
157
+ // The C's `pos` is an `int`, so every assignment truncates — which is what makes the
158
+ // `+ 0.5` a round-to-nearest rather than a bias — and `pos = CLAMP (pos, min, max)` runs
159
+ // on the truncated value. Truncating once here is the same statement, because every
160
+ // branch but the two proportional ones already produces an integer.
161
+ position = Math.trunc(position);
162
+ return { min, max, position: glibClamp(position, min, max) };
163
+ }
164
+
165
+ export class GtkPaned extends HTMLElement {
166
+ private _startEl!: HTMLDivElement;
167
+ private _handleEl!: HTMLDivElement;
168
+ private _endEl!: HTMLDivElement;
169
+ private _initialized = false;
170
+ /** `start_child_size` — the divider. `-1` is GTK's "unset". */
171
+ private _position = -1;
172
+ /** `position_set` — GTK's read-only flag; see the header. */
173
+ private _positionSet = false;
174
+ /** What `gtk_paned_compute_position` last produced for `min_position`. */
175
+ private _minPosition = DEFAULT_MIN_POSITION;
176
+ /** …and for `max_position`. */
177
+ private _maxPosition = Number.MAX_SAFE_INTEGER;
178
+ /** `last_allocation` — the allocation the current position was computed against. */
179
+ private _lastAllocation = 0;
180
+ /** `drag_pos` — where inside the handle the gesture began (gtkpaned.c:930-940). */
181
+ private _dragPos = 0;
182
+ private _dragging = false;
183
+ private _resize: ResizeObserver | null = null;
184
+
185
+ static get observedAttributes() {
186
+ return [
187
+ 'orientation',
188
+ 'position',
189
+ 'position-set',
190
+ 'resize-start-child',
191
+ 'resize-end-child',
192
+ 'shrink-start-child',
193
+ 'shrink-end-child',
194
+ 'wide-handle',
195
+ ];
196
+ }
197
+
198
+ /** `GtkOrientable:orientation` — which way the divider runs. */
199
+ get orientation(): BoxOrientation {
200
+ return normalizeBoxOrientation(this.getAttribute('orientation'));
201
+ }
202
+
203
+ set orientation(value: BoxOrientation) {
204
+ this.setAttribute('orientation', value);
205
+ }
206
+
207
+ /** `Gtk.Paned:position` — the divider in pixels; `-1` puts it back to derived. */
208
+ get position(): number {
209
+ return this._position;
210
+ }
211
+
212
+ set position(value: number) {
213
+ this.setPosition(value);
214
+ }
215
+
216
+ /** `Gtk.Paned:position-set` — read-only in GTK; only `position` moves it. */
217
+ get positionSet(): boolean {
218
+ return this._positionSet;
219
+ }
220
+
221
+ /** `Gtk.AccessibleRange:min-position` as the last computation left it. */
222
+ get minPosition(): number {
223
+ return this._minPosition;
224
+ }
225
+
226
+ /** `Gtk.AccessibleRange:max-position` as the last computation left it. */
227
+ get maxPosition(): number {
228
+ return this._maxPosition;
229
+ }
230
+
231
+ /** `Gtk.Paned:wide-handle` — the stronger visual separation. */
232
+ get wideHandle(): boolean {
233
+ return this.hasAttribute('wide-handle');
234
+ }
235
+
236
+ set wideHandle(value: boolean) {
237
+ this.toggleAttribute('wide-handle', !!value);
238
+ }
239
+
240
+ /** `Gtk.Paned:start-child` — the light-DOM node in the leading pane. */
241
+ get startChild(): Element | null {
242
+ return this._startEl?.firstElementChild ?? null;
243
+ }
244
+
245
+ /** `Gtk.Paned:end-child` — the light-DOM node in the trailing pane. */
246
+ get endChild(): Element | null {
247
+ return this._endEl?.firstElementChild ?? null;
248
+ }
249
+
250
+ connectedCallback() {
251
+ if (this._initialized) {
252
+ // The teardown below dropped the observer, so a re-parent has to re-arm it —
253
+ // see `scripts/check-adwaita-connect-rebind.mjs`.
254
+ this._observe();
255
+ return;
256
+ }
257
+ this._initialized = true;
258
+
259
+ this.setAttribute('role', 'group');
260
+
261
+ this._startEl = document.createElement('div');
262
+ this._startEl.className = 'adw-paned-child';
263
+
264
+ this._handleEl = document.createElement('div');
265
+ this._handleEl.className = 'adw-paned-handle separator';
266
+ // `separator` is the CSS NAME GtkPanedHandle carries (gtkpanedhandle.c:88), and a
267
+ // window splitter is the ARIA reading of that node. The value moves here from the
268
+ // paned — see the header.
269
+ this._handleEl.setAttribute('role', 'separator');
270
+ this._handleEl.tabIndex = 0;
271
+
272
+ this._endEl = document.createElement('div');
273
+ this._endEl.className = 'adw-paned-child';
274
+
275
+ // `<child type="start">` and `<child type="end">` are GtkBuildable's spellings, so
276
+ // the slot names are `start` and `end`; the bare child is the start pane, which is
277
+ // where `gtk_paned_buildable_add_child` puts an untyped one while it is free
278
+ // (gtkpaned.c:816-826).
279
+ bindSlottedChildren(
280
+ this,
281
+ [{ into: this._startEl }, { name: 'start', into: this._startEl }, { name: 'end', into: this._endEl }],
282
+ () => this._observe(),
283
+ ).install(this._startEl, this._handleEl, this._endEl);
284
+
285
+ this._handleEl.addEventListener('pointerdown', this._onPointerDown);
286
+ this._handleEl.addEventListener('keydown', this._onKeyDown);
287
+
288
+ // A GtkBuilder `<property name="position">` reaches `set_position` at construction,
289
+ // so an authored one has to land before the first allocation — and it raises
290
+ // `position-set` exactly as a setter would.
291
+ const authored = Number.parseFloat(this.getAttribute('position') ?? '');
292
+ if (Number.isFinite(authored)) this.setPosition(authored);
293
+
294
+ this._observe();
295
+ this._layout();
296
+ }
297
+
298
+ disconnectedCallback() {
299
+ this._dragging = false;
300
+ this._resize?.disconnect();
301
+ this._resize = null;
302
+ }
303
+
304
+ attributeChangedCallback(name: string) {
305
+ if (!this._initialized) return;
306
+ if (name === 'position') {
307
+ // GTK's pspec is EXPLICIT_NOTIFY, so the attribute write IS a `set_position` and
308
+ // the notifications come from there — never a second time from here.
309
+ const value = Number.parseFloat(this.getAttribute('position') ?? '');
310
+ if (Number.isFinite(value)) this.setPosition(value);
311
+ return;
312
+ }
313
+ // `position-set` is GTK's read-only flag: markup may DECLARE it (the connectedCallback
314
+ // reads it), but moving it from the outside would let an attribute contradict a
315
+ // position the element has computed since.
316
+ if (name === 'position-set') return;
317
+ this._layout();
318
+ this.dispatchEvent(
319
+ new CustomEvent(`notify::${name}`, { bubbles: true, detail: { [name]: this._property(name) } }),
320
+ );
321
+ }
322
+
323
+ private _property(name: string): unknown {
324
+ switch (name) {
325
+ case 'orientation':
326
+ return this.orientation;
327
+ case 'resize-start-child':
328
+ return this.getAttribute('resize-start-child') !== 'false';
329
+ case 'resize-end-child':
330
+ return this.getAttribute('resize-end-child') !== 'false';
331
+ case 'shrink-start-child':
332
+ return this.getAttribute('shrink-start-child') !== 'false';
333
+ case 'shrink-end-child':
334
+ return this.getAttribute('shrink-end-child') !== 'false';
335
+ case 'wide-handle':
336
+ return this.wideHandle;
337
+ default:
338
+ return this.getAttribute(name);
339
+ }
340
+ }
341
+
342
+ private _observe(): void {
343
+ if (!this._resize) {
344
+ this._resize = new ResizeObserver(() => this._layout());
345
+ this._resize.observe(this);
346
+ }
347
+ for (const pane of [this._startEl, this._endEl]) {
348
+ const adopted = pane.firstElementChild;
349
+ if (adopted) this._resize.observe(adopted);
350
+ }
351
+ }
352
+
353
+ /** `gtk_paned_set_position` (gtkpaned.c:1874-1910), with its two notifications. */
354
+ private setPosition(value: number): void {
355
+ if (!Number.isFinite(value)) return;
356
+ if (value < 0) {
357
+ // "a negative value means that the position is unset"
358
+ if (this._positionSet) {
359
+ this._positionSet = false;
360
+ this._notify('position-set', { positionSet: false });
361
+ }
362
+ this._position = -1;
363
+ this._layout();
364
+ return;
365
+ }
366
+ if (!this._positionSet) {
367
+ this._positionSet = true;
368
+ this._notify('position-set', { positionSet: true });
369
+ }
370
+ if (this._position === value) return;
371
+ this._position = value;
372
+ this._notify('position', { position: value });
373
+ this._layout();
374
+ }
375
+
376
+ /** `gtk_paned_calc_position` (gtkpaned.c:1021-1053): compute, place, notify, remember. */
377
+ private _layout(): void {
378
+ if (!this._startEl) return;
379
+ const horizontal = this.orientation === 'horizontal';
380
+ const handleRect = this._handleEl.getBoundingClientRect();
381
+ // The handle is part of the paned's allocation, and the C subtracts it BEFORE
382
+ // computing (gtkpaned.c:1336-1342).
383
+ const handleSize = horizontal ? handleRect.width : handleRect.height;
384
+ const allocation = Math.max(1, (horizontal ? this.clientWidth : this.clientHeight) - handleSize);
385
+
386
+ const computed = computePanedPosition({
387
+ allocation,
388
+ startRequest: this._sizeRequest(this._startEl, horizontal),
389
+ endRequest: this._sizeRequest(this._endEl, horizontal),
390
+ resizeStart: this.getAttribute('resize-start-child') !== 'false',
391
+ resizeEnd: this.getAttribute('resize-end-child') !== 'false',
392
+ shrinkStart: this.getAttribute('shrink-start-child') !== 'false',
393
+ shrinkEnd: this.getAttribute('shrink-end-child') !== 'false',
394
+ positionSet: this._positionSet,
395
+ startChildSize: this._position < 0 ? 0 : this._position,
396
+ lastAllocation: this._lastAllocation,
397
+ });
398
+
399
+ const position = Math.floor(computed.position);
400
+ if (position !== this._position) {
401
+ this._position = position;
402
+ this._notify('position', { position });
403
+ }
404
+ if (computed.min !== this._minPosition) {
405
+ this._minPosition = computed.min;
406
+ this._notify('min-position', { minPosition: computed.min });
407
+ }
408
+ if (computed.max !== this._maxPosition) {
409
+ this._maxPosition = computed.max;
410
+ this._notify('max-position', { maxPosition: computed.max });
411
+ }
412
+ this._lastAllocation = allocation;
413
+
414
+ // `start_child_allocation.width = MAX (1, start_child_size)` — an explicit basis and
415
+ // no growth, which IS the C's allocation rather than a flexbox approximation of it.
416
+ this._startEl.style.flexBasis = `${Math.max(1, position)}px`;
417
+ this._startEl.style.flexGrow = '0';
418
+ this._endEl.style.flexGrow = this.getAttribute('resize-end-child') === 'false' ? '0' : '1';
419
+ this._applyMinimum(this._startEl, 'shrink-start-child', horizontal);
420
+ this._applyMinimum(this._endEl, 'shrink-end-child', horizontal);
421
+
422
+ // `gtk_widget_set_child_visible (start_child, start_child_size != 0)`, and the end
423
+ // child against the whole allocation (gtkpaned.c:1940-1941).
424
+ const startVisible = position !== 0;
425
+ const endVisible = position !== allocation;
426
+ this._startEl.hidden = !startVisible;
427
+ this._endEl.hidden = !endVisible;
428
+ // "No separator is drawn if one of the children is missing."
429
+ this._handleEl.hidden = !startVisible || !endVisible;
430
+
431
+ this.classList.toggle('horizontal', horizontal);
432
+ this.classList.toggle('vertical', !horizontal);
433
+ this._handleEl.classList.toggle('wide', this.wideHandle);
434
+ this._handleEl.setAttribute('aria-orientation', this.orientation);
435
+ this._handleEl.setAttribute('aria-valuemin', String(DEFAULT_MIN_POSITION));
436
+ // GTK's VALUE_MAX is the paned's own width or height, handle included.
437
+ this._handleEl.setAttribute('aria-valuemax', String(horizontal ? this.clientWidth : this.clientHeight));
438
+ this._handleEl.setAttribute('aria-valuenow', String(position));
439
+ }
440
+
441
+ /**
442
+ * A child's SIZE REQUEST — what `gtk_widget_measure` answers with.
443
+ *
444
+ * `flex: none` pins the item to its content size, which is exactly a GTK size request,
445
+ * and the read is one forced reflow. It has to be a separate pass: the laid-out size of a
446
+ * pane that is currently `flex-grow: 1` is its ALLOCATION, and feeding that back as a
447
+ * request is how a paned ends up re-deriving its own divisor.
448
+ */
449
+ private _sizeRequest(pane: HTMLElement, horizontal: boolean): number {
450
+ // The shorthand resets all three longhands, so restoring them is what puts the pane
451
+ // back — `flex = ''` would restore the INITIAL values and drop the basis below.
452
+ const grow = pane.style.flexGrow;
453
+ const shrink = pane.style.flexShrink;
454
+ const basis = pane.style.flexBasis;
455
+ pane.style.flex = 'none';
456
+ const size = horizontal ? pane.offsetWidth : pane.offsetHeight;
457
+ pane.style.flexGrow = grow;
458
+ pane.style.flexShrink = shrink;
459
+ pane.style.flexBasis = basis;
460
+ return size;
461
+ }
462
+
463
+ /**
464
+ * `shrink-*` is "can this child be made smaller than its requisition", which in CSS is
465
+ * whether the AUTOMATIC minimum applies — `min-width: auto` is the flex automatic
466
+ * minimum, so `min-width: 0` is the permission and leaving the longhand alone is the
467
+ * prohibition.
468
+ */
469
+ private _applyMinimum(pane: HTMLElement, attribute: string, horizontal: boolean): void {
470
+ const shrinkable = this.getAttribute(attribute) !== 'false';
471
+ pane.style.minWidth = horizontal ? (shrinkable ? '0' : '') : '';
472
+ pane.style.minHeight = horizontal ? '' : shrinkable ? '0' : '';
473
+ }
474
+
475
+ /**
476
+ * `notify::<property>`, with the DETAIL keyed by the JS property name — the spelling
477
+ * `<adw-expander-row>`, `<adw-entry-row>` and `<gtk-switch>` use, and the one a caller
478
+ * destructures. `notify::position-set` therefore carries `{ positionSet }`.
479
+ */
480
+ private _notify(name: string, detail: Record<string, unknown>): void {
481
+ this.dispatchEvent(new CustomEvent(`notify::${name}`, { bubbles: true, detail }));
482
+ }
483
+
484
+ /** `is_rtl` (gtkpaned.c:1533-1536): only a horizontal paned mirrors. */
485
+ private get _isRtl(): boolean {
486
+ return this.orientation === 'horizontal' && this.matches(':dir(rtl)');
487
+ }
488
+
489
+ /** `gesture_drag_begin_cb` (gtkpaned.c:915-955) — the capture and `drag_pos`. */
490
+ private readonly _onPointerDown = (event: PointerEvent): void => {
491
+ if (event.button !== 0 || this._handleEl.hidden) return;
492
+ this._dragging = true;
493
+ // Pointer CAPTURE rather than a `window` listener pair: the move and the release then
494
+ // arrive at the handle however far the pointer leaves it, and there is nothing to
495
+ // unbind — the binding is inside this element, so `check-adwaita-connect-rebind.mjs`
496
+ // has nothing to police.
497
+ this._handleEl.setPointerCapture(event.pointerId);
498
+ const horizontal = this.orientation === 'horizontal';
499
+ const rect = this._handleEl.getBoundingClientRect();
500
+ const point = horizontal ? event.clientX : event.clientY;
501
+ const origin = horizontal ? rect.left : rect.top;
502
+ this._dragPos = point - origin - (this.wideHandle ? 0 : HANDLE_EXTRA_SIZE);
503
+ this._handleEl.addEventListener('pointermove', this._onPointerMove);
504
+ this._handleEl.addEventListener('pointerup', this._onPointerUp);
505
+ this._handleEl.addEventListener('pointercancel', this._onPointerUp);
506
+ };
507
+
508
+ /** `update_drag` (gtkpaned.c:1538-1573), from the capture phase. */
509
+ private readonly _onPointerMove = (event: PointerEvent): void => {
510
+ if (!this._dragging) return;
511
+ const horizontal = this.orientation === 'horizontal';
512
+ const point = horizontal ? event.clientX : event.clientY;
513
+ const pos = point - this._dragPos;
514
+ // `size = gtk_widget_get_width (paned) - pos - handle_size` under RTL, `pos`
515
+ // otherwise; then CLAMP (size, min_position, max_position).
516
+ const handleSize = horizontal ? this._handleEl.offsetWidth : this._handleEl.offsetHeight;
517
+ const size = this._isRtl ? (horizontal ? this.clientWidth : this.clientHeight) - pos - handleSize : pos;
518
+ this.setPosition(glibClamp(Math.round(size), this._minPosition, this._maxPosition));
519
+ };
520
+
521
+ private readonly _onPointerUp = (event: PointerEvent): void => {
522
+ if (!this._dragging) return;
523
+ this._dragging = false;
524
+ if (this._handleEl.hasPointerCapture(event.pointerId)) {
525
+ this._handleEl.releasePointerCapture(event.pointerId);
526
+ }
527
+ this._handleEl.removeEventListener('pointermove', this._onPointerMove);
528
+ this._handleEl.removeEventListener('pointerup', this._onPointerUp);
529
+ this._handleEl.removeEventListener('pointercancel', this._onPointerUp);
530
+ };
531
+
532
+ /**
533
+ * `gtk_paned_move_handle` (gtkpaned.c:2286-2353) over `add_move_binding`'s key list
534
+ * (gtkpaned.c:768-785). `Escape` and `Return`/Space are `cancel-position` /
535
+ * `accept-position`, which GTK binds to no handler of its own — they are the signals an
536
+ * embedding application listens for — so they are dispatched as events and left to
537
+ * bubble rather than swallowed here.
538
+ */
539
+ private readonly _onKeyDown = (event: KeyboardEvent): void => {
540
+ if (event.altKey || event.metaKey || event.shiftKey) return;
541
+ if (event.key === 'Escape') {
542
+ this.dispatchEvent(new CustomEvent('cancel-position', { bubbles: true, detail: {} }));
543
+ return;
544
+ }
545
+ if (event.key === 'Enter' || event.key === ' ') {
546
+ this.dispatchEvent(new CustomEvent('accept-position', { bubbles: true, detail: {} }));
547
+ return;
548
+ }
549
+
550
+ let increment = 0;
551
+ let jump: 'start' | 'end' | null = null;
552
+ switch (event.key) {
553
+ case 'ArrowLeft':
554
+ increment = event.ctrlKey ? -PAGE_STEP_SIZE : -SINGLE_STEP_SIZE;
555
+ break;
556
+ case 'ArrowRight':
557
+ increment = event.ctrlKey ? PAGE_STEP_SIZE : SINGLE_STEP_SIZE;
558
+ break;
559
+ case 'ArrowUp':
560
+ increment = event.ctrlKey ? -PAGE_STEP_SIZE : -SINGLE_STEP_SIZE;
561
+ break;
562
+ case 'ArrowDown':
563
+ increment = event.ctrlKey ? PAGE_STEP_SIZE : SINGLE_STEP_SIZE;
564
+ break;
565
+ case 'PageUp':
566
+ increment = -PAGE_STEP_SIZE;
567
+ break;
568
+ case 'PageDown':
569
+ increment = PAGE_STEP_SIZE;
570
+ break;
571
+ case 'Home':
572
+ jump = 'start';
573
+ break;
574
+ case 'End':
575
+ jump = 'end';
576
+ break;
577
+ default:
578
+ return;
579
+ }
580
+ event.preventDefault();
581
+
582
+ let next: number;
583
+ if (jump === 'start') {
584
+ next = this._minPosition;
585
+ } else if (jump === 'end') {
586
+ next = this._maxPosition;
587
+ } else {
588
+ // `if (is_rtl (paned)) increment = -increment;` — an RTL horizontal paned's
589
+ // ArrowRight moves the divider towards a SMALLER position.
590
+ if (this._isRtl) increment = -increment;
591
+ next = this._position + increment;
592
+ }
593
+ this.setPosition(glibClamp(next, this._minPosition, this._maxPosition));
594
+ };
595
+ }
596
+
597
+ customElements.define('gtk-paned', GtkPaned);