@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.
- package/README.md +8 -0
- package/dist/adwaita-web.css +8146 -3011
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/adw-application-window.spec.d.ts +1 -0
- package/lib/types/adw-bin.spec.d.ts +1 -0
- package/lib/types/adw-breakpoint-bin.spec.d.ts +1 -0
- package/lib/types/adw-clamp-scrollable.spec.d.ts +1 -0
- package/lib/types/adw-multi-layout-view.spec.d.ts +1 -0
- package/lib/types/adw-preferences-row.spec.d.ts +1 -0
- package/lib/types/adw-shortcuts.spec.d.ts +1 -0
- package/lib/types/adw-status-page.spec.d.ts +1 -0
- package/lib/types/adw-tab-bar.spec.d.ts +1 -0
- package/lib/types/adw-tab-button.spec.d.ts +1 -0
- package/lib/types/adw-tab-overview.spec.d.ts +1 -0
- package/lib/types/adw-view-switcher-sidebar.spec.d.ts +1 -0
- package/lib/types/adw-window.spec.d.ts +1 -0
- package/lib/types/attributes.d.ts +19 -0
- package/lib/types/breakpoints.d.ts +14 -3
- package/lib/types/construct-vectors.spec.d.ts +1 -0
- package/lib/types/elements/adw-action-row.d.ts +4 -0
- package/lib/types/elements/adw-application-window.d.ts +27 -0
- package/lib/types/elements/adw-bin.d.ts +17 -0
- package/lib/types/elements/adw-breakpoint-bin.d.ts +67 -0
- package/lib/types/elements/adw-clamp-scrollable.d.ts +38 -0
- package/lib/types/elements/adw-combo-row.d.ts +4 -0
- package/lib/types/elements/adw-dialog.d.ts +10 -0
- package/lib/types/elements/adw-entry-row.d.ts +6 -0
- package/lib/types/elements/adw-expander-row.d.ts +2 -0
- package/lib/types/elements/adw-header-bar.d.ts +6 -0
- package/lib/types/elements/adw-layout-slot.d.ts +19 -0
- package/lib/types/elements/adw-multi-layout-view.d.ts +101 -0
- package/lib/types/elements/adw-overlay-split-view.d.ts +13 -0
- package/lib/types/elements/adw-preferences-row.d.ts +31 -0
- package/lib/types/elements/adw-shortcuts-dialog.d.ts +13 -0
- package/lib/types/elements/adw-shortcuts-item.d.ts +36 -0
- package/lib/types/elements/adw-shortcuts-section.d.ts +14 -0
- package/lib/types/elements/adw-sidebar.d.ts +8 -2
- package/lib/types/elements/adw-spin-row.d.ts +6 -0
- package/lib/types/elements/adw-switch-row.d.ts +7 -0
- package/lib/types/elements/adw-tab-bar.d.ts +108 -0
- package/lib/types/elements/adw-tab-button.d.ts +32 -0
- package/lib/types/elements/adw-tab-overview.d.ts +199 -0
- package/lib/types/elements/adw-tab-view.d.ts +19 -23
- package/lib/types/elements/adw-toggle-group.d.ts +17 -0
- package/lib/types/elements/adw-view-switcher-sidebar.d.ts +84 -0
- package/lib/types/elements/adw-window.d.ts +40 -0
- package/lib/types/elements/gtk-about-dialog.d.ts +146 -0
- package/lib/types/elements/gtk-application-window.d.ts +34 -0
- package/lib/types/elements/gtk-aspect-frame.d.ts +27 -0
- package/lib/types/elements/gtk-button.d.ts +9 -0
- package/lib/types/elements/gtk-calendar.d.ts +159 -0
- package/lib/types/elements/gtk-center-box.d.ts +39 -0
- package/lib/types/elements/gtk-color-dialog-button.d.ts +69 -0
- package/lib/types/elements/gtk-column-view.d.ts +50 -0
- package/lib/types/elements/gtk-drag-icon.d.ts +78 -0
- package/lib/types/elements/gtk-drawing-area.d.ts +95 -0
- package/lib/types/elements/gtk-editable-label.d.ts +33 -0
- package/lib/types/elements/gtk-emoji-chooser.d.ts +84 -0
- package/lib/types/elements/gtk-entry.d.ts +20 -1
- package/lib/types/elements/gtk-expander.d.ts +49 -0
- package/lib/types/elements/gtk-fixed.d.ts +13 -0
- package/lib/types/elements/gtk-flow-box-child.d.ts +14 -0
- package/lib/types/elements/gtk-flow-box.d.ts +87 -0
- package/lib/types/elements/gtk-font-dialog-button.d.ts +83 -0
- package/lib/types/elements/gtk-frame.d.ts +24 -0
- package/lib/types/elements/gtk-gl-area.d.ts +136 -0
- package/lib/types/elements/gtk-graphics-offload.d.ts +24 -0
- package/lib/types/elements/gtk-grid-view.d.ts +39 -0
- package/lib/types/elements/gtk-grid.d.ts +27 -0
- package/lib/types/elements/gtk-header-bar.d.ts +60 -0
- package/lib/types/elements/gtk-inscription.d.ts +64 -0
- package/lib/types/elements/gtk-label.d.ts +3 -0
- package/lib/types/elements/gtk-level-bar.d.ts +59 -0
- package/lib/types/elements/gtk-link-button.d.ts +29 -0
- package/lib/types/elements/gtk-list-box-row.d.ts +54 -0
- package/lib/types/elements/gtk-list-box.d.ts +100 -0
- package/lib/types/elements/gtk-list-view.d.ts +73 -0
- package/lib/types/elements/gtk-media-controls.d.ts +142 -0
- package/lib/types/elements/gtk-notebook.d.ts +148 -0
- package/lib/types/elements/gtk-overlay.d.ts +22 -0
- package/lib/types/elements/gtk-page-setup-unix-dialog.d.ts +87 -0
- package/lib/types/elements/gtk-paned.d.ts +121 -0
- package/lib/types/elements/gtk-password-entry.d.ts +27 -0
- package/lib/types/elements/gtk-picture.d.ts +66 -0
- package/lib/types/elements/gtk-popover-bin.d.ts +82 -0
- package/lib/types/elements/gtk-popover-menu-bar.d.ts +66 -0
- package/lib/types/elements/gtk-popover-menu.d.ts +83 -0
- package/lib/types/elements/gtk-popover.d.ts +28 -3
- package/lib/types/elements/gtk-print-unix-dialog.d.ts +167 -0
- package/lib/types/elements/gtk-revealer.d.ts +55 -0
- package/lib/types/elements/gtk-scale-button.d.ts +59 -0
- package/lib/types/elements/gtk-scale.d.ts +98 -0
- package/lib/types/elements/gtk-scrollbar.d.ts +124 -0
- package/lib/types/elements/gtk-scrolled-window.d.ts +129 -0
- package/lib/types/elements/gtk-search-bar.d.ts +39 -0
- package/lib/types/elements/gtk-search-entry.d.ts +27 -0
- package/lib/types/elements/gtk-separator.d.ts +10 -0
- package/lib/types/elements/gtk-spin-button.d.ts +94 -0
- package/lib/types/elements/gtk-spinner.d.ts +14 -0
- package/lib/types/elements/gtk-stack-sidebar.d.ts +43 -0
- package/lib/types/elements/gtk-stack-switcher.d.ts +58 -0
- package/lib/types/elements/gtk-stack.d.ts +154 -0
- package/lib/types/elements/gtk-switch.d.ts +4 -1
- package/lib/types/elements/gtk-text-view.d.ts +62 -0
- package/lib/types/elements/gtk-text.d.ts +45 -0
- package/lib/types/elements/gtk-toggle-button.d.ts +45 -0
- package/lib/types/elements/gtk-tree-expander.d.ts +38 -0
- package/lib/types/elements/gtk-video.d.ts +97 -0
- package/lib/types/elements/gtk-viewport.d.ts +84 -0
- package/lib/types/elements/gtk-window-controls.d.ts +80 -0
- package/lib/types/elements/gtk-window-handle.d.ts +39 -0
- package/lib/types/elements/gtk-window.d.ts +103 -0
- package/lib/types/elements/justification.d.ts +2 -0
- package/lib/types/elements/popover-menu.d.ts +18 -0
- package/lib/types/elements/roving-focus.d.ts +29 -1
- package/lib/types/emoji-data.d.ts +38 -0
- package/lib/types/font-description.d.ts +96 -0
- package/lib/types/gtk-about-dialog.spec.d.ts +1 -0
- package/lib/types/gtk-action-bar.spec.d.ts +1 -0
- package/lib/types/gtk-application-window.spec.d.ts +1 -0
- package/lib/types/gtk-aspect-frame.spec.d.ts +1 -0
- package/lib/types/gtk-calendar.spec.d.ts +1 -0
- package/lib/types/gtk-center-box.spec.d.ts +1 -0
- package/lib/types/gtk-color-dialog-button.spec.d.ts +1 -0
- package/lib/types/gtk-column-view.spec.d.ts +1 -0
- package/lib/types/gtk-drag-icon.spec.d.ts +1 -0
- package/lib/types/gtk-drawing-area.spec.d.ts +1 -0
- package/lib/types/gtk-editable-label.spec.d.ts +1 -0
- package/lib/types/gtk-emoji-chooser.spec.d.ts +1 -0
- package/lib/types/gtk-expander.spec.d.ts +1 -0
- package/lib/types/gtk-fixed.spec.d.ts +1 -0
- package/lib/types/gtk-flow-box.spec.d.ts +1 -0
- package/lib/types/gtk-font-dialog-button.spec.d.ts +1 -0
- package/lib/types/gtk-frame.spec.d.ts +1 -0
- package/lib/types/gtk-gl-area.spec.d.ts +1 -0
- package/lib/types/gtk-graphics-offload.spec.d.ts +1 -0
- package/lib/types/gtk-grid-view.spec.d.ts +1 -0
- package/lib/types/gtk-grid.spec.d.ts +1 -0
- package/lib/types/gtk-header-bar.spec.d.ts +1 -0
- package/lib/types/gtk-inscription.spec.d.ts +1 -0
- package/lib/types/gtk-level-bar.spec.d.ts +1 -0
- package/lib/types/gtk-link-button.spec.d.ts +1 -0
- package/lib/types/gtk-list-box.spec.d.ts +1 -0
- package/lib/types/gtk-list-view.spec.d.ts +1 -0
- package/lib/types/gtk-media-controls.spec.d.ts +1 -0
- package/lib/types/gtk-notebook.spec.d.ts +1 -0
- package/lib/types/gtk-overlay.spec.d.ts +1 -0
- package/lib/types/gtk-paned.spec.d.ts +1 -0
- package/lib/types/gtk-password-entry.spec.d.ts +1 -0
- package/lib/types/gtk-picture.spec.d.ts +1 -0
- package/lib/types/gtk-popover-bin.spec.d.ts +1 -0
- package/lib/types/gtk-popover-menu-bar.spec.d.ts +1 -0
- package/lib/types/gtk-popover-menu.spec.d.ts +1 -0
- package/lib/types/gtk-popover-role.spec.d.ts +1 -0
- package/lib/types/gtk-popover.spec.d.ts +1 -0
- package/lib/types/gtk-print-dialogs.spec.d.ts +1 -0
- package/lib/types/gtk-revealer.spec.d.ts +1 -0
- package/lib/types/gtk-scale-button.spec.d.ts +1 -0
- package/lib/types/gtk-scale.spec.d.ts +1 -0
- package/lib/types/gtk-scrollbar.spec.d.ts +1 -0
- package/lib/types/gtk-scrolled-window.spec.d.ts +1 -0
- package/lib/types/gtk-search-bar.spec.d.ts +1 -0
- package/lib/types/gtk-search-entry.spec.d.ts +1 -0
- package/lib/types/gtk-separator.spec.d.ts +1 -0
- package/lib/types/gtk-spin-button.spec.d.ts +1 -0
- package/lib/types/gtk-spinner.spec.d.ts +1 -0
- package/lib/types/gtk-stack-sidebar.spec.d.ts +1 -0
- package/lib/types/gtk-stack-switcher.spec.d.ts +1 -0
- package/lib/types/gtk-stack.spec.d.ts +1 -0
- package/lib/types/gtk-text-view.spec.d.ts +1 -0
- package/lib/types/gtk-text.spec.d.ts +1 -0
- package/lib/types/gtk-toggle-button.spec.d.ts +1 -0
- package/lib/types/gtk-tree-expander.spec.d.ts +1 -0
- package/lib/types/gtk-video.spec.d.ts +1 -0
- package/lib/types/gtk-viewport.spec.d.ts +1 -0
- package/lib/types/gtk-window-controls.spec.d.ts +1 -0
- package/lib/types/gtk-window-handle.spec.d.ts +1 -0
- package/lib/types/gtk-window.spec.d.ts +1 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/list-view-dom.d.ts +44 -0
- package/lib/types/namespace/adw.d.ts +12 -0
- package/lib/types/namespace/gtk.d.ts +61 -0
- package/lib/types/page-setup.d.ts +100 -0
- package/lib/types/row-line-clamp.d.ts +20 -0
- package/lib/types/row-tooltip.d.ts +8 -0
- package/lib/types/row-tooltip.spec.d.ts +1 -0
- package/lib/types/scroll-shading.d.ts +15 -1
- package/lib/types/shared-tree-builder.d.ts +75 -17
- package/lib/types/shared-tree-mount.spec.d.ts +1 -0
- package/lib/types/signals.d.ts +4 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/lib/types/tab-chip.d.ts +73 -0
- package/lib/types/template-classes.d.ts +11 -0
- package/lib/types/widget-size.spec.d.ts +1 -0
- package/package.json +12 -8
- package/scss/_action_row.scss +41 -17
- package/scss/_application_window.scss +26 -0
- package/scss/_aspect_frame.scss +25 -0
- package/scss/_bin.scss +26 -0
- package/scss/_button.scss +45 -0
- package/scss/_button_row.scss +5 -0
- package/scss/_calendar.scss +176 -0
- package/scss/_center_box.scss +25 -0
- package/scss/_checks.scss +6 -1
- package/scss/_clamp_scrollable.scss +28 -0
- package/scss/_color_button.scss +67 -0
- package/scss/_column_view.scss +126 -0
- package/scss/_drag_icon.scss +55 -0
- package/scss/_drawing.scss +85 -0
- package/scss/_emoji_chooser.scss +213 -0
- package/scss/_entry.scss +13 -5
- package/scss/_entry_row.scss +1 -1
- package/scss/_expander.scss +113 -0
- package/scss/_expander_row.scss +36 -3
- package/scss/_fixed.scss +29 -0
- package/scss/_flow_box.scss +94 -0
- package/scss/_font_button.scss +63 -0
- package/scss/_frame.scss +41 -0
- package/scss/_grid.scss +19 -0
- package/scss/_grid_view.scss +46 -0
- package/scss/_gtk_about_dialog.scss +186 -0
- package/scss/_headerbar.scss +134 -1
- package/scss/_icons.generated.scss +186 -0
- package/scss/_inscription.scss +125 -0
- package/scss/_level_bar.scss +190 -0
- package/scss/_link.scss +82 -0
- package/scss/_list_box.scss +88 -0
- package/scss/_list_view.scss +96 -0
- package/scss/_media_controls.scss +139 -0
- package/scss/_overlay.scss +68 -0
- package/scss/_paned.scss +130 -0
- package/scss/_password_entry.scss +83 -0
- package/scss/_picture.scss +80 -0
- package/scss/_popover_bin.scss +53 -0
- package/scss/_popover_menu_bar.scss +104 -0
- package/scss/_preferences_row.scss +60 -0
- package/scss/_print_dialogs.scss +328 -0
- package/scss/_reset.scss +21 -19
- package/scss/_revealer.scss +37 -0
- package/scss/_row.scss +36 -5
- package/scss/_scale.scss +298 -0
- package/scss/_scale_button.scss +167 -0
- package/scss/_scrollbar.scss +230 -0
- package/scss/_scrolled_window.scss +131 -0
- package/scss/_search_bar.scss +118 -0
- package/scss/_search_entry.scss +86 -0
- package/scss/_separator.scss +44 -0
- package/scss/_shortcuts_dialog.scss +100 -0
- package/scss/_spin_button.scss +172 -0
- package/scss/_spin_row.scss +56 -8
- package/scss/_spinner.scss +85 -4
- package/scss/_stack.scss +729 -0
- package/scss/_status_page.scss +1 -1
- package/scss/_switch.scss +13 -5
- package/scss/_switch_row.scss +10 -0
- package/scss/_tab_bar.scss +317 -0
- package/scss/_tab_button.scss +98 -0
- package/scss/_tab_overview.scss +483 -0
- package/scss/_text.scss +182 -0
- package/scss/_theme.scss +1 -1
- package/scss/_toggle_group.scss +28 -0
- package/scss/_tree_expander.scss +62 -0
- package/scss/_variables.scss +1 -1
- package/scss/_video.scss +146 -0
- package/scss/_view_switcher_sidebar.scss +112 -0
- package/scss/_viewport.scss +50 -0
- package/scss/_widget.scss +14 -3
- package/scss/_window.scss +131 -2
- package/scss/_window_handle.scss +20 -0
- package/scss/adwaita-skin.scss +109 -0
- package/src/adw-action-rows.spec.ts +331 -0
- package/src/adw-application-window.spec.ts +118 -0
- package/src/adw-bin.spec.ts +75 -0
- package/src/adw-breakpoint-bin.spec.ts +324 -0
- package/src/adw-clamp-scrollable.spec.ts +189 -0
- package/src/adw-header-bar.spec.ts +18 -0
- package/src/adw-multi-layout-view.spec.ts +243 -0
- package/src/adw-preferences-row.spec.ts +164 -0
- package/src/adw-row-state.spec.ts +142 -0
- package/src/adw-shortcuts.spec.ts +155 -0
- package/src/adw-status-page.spec.ts +124 -0
- package/src/adw-tab-bar.spec.ts +287 -0
- package/src/adw-tab-button.spec.ts +101 -0
- package/src/adw-tab-overview.spec.ts +443 -0
- package/src/adw-view-switcher-sidebar.spec.ts +281 -0
- package/src/adw-window.spec.ts +129 -0
- package/src/attributes.ts +52 -0
- package/src/breakpoints.ts +25 -8
- package/src/capabilities.d.mts +3 -0
- package/src/capabilities.mjs +21 -0
- package/src/connect-lifecycle.spec.ts +12 -0
- package/src/construct-vectors.spec.ts +175 -0
- package/src/elements/adw-action-row.ts +31 -2
- package/src/elements/adw-alert-dialog.ts +4 -1
- package/src/elements/adw-application-window.ts +154 -0
- package/src/elements/adw-bin.ts +101 -0
- package/src/elements/adw-breakpoint-bin.ts +287 -0
- package/src/elements/adw-button-row.ts +7 -1
- package/src/elements/adw-clamp-scrollable.ts +207 -0
- package/src/elements/adw-combo-row.ts +26 -1
- package/src/elements/adw-dialog.ts +19 -0
- package/src/elements/adw-entry-row.ts +22 -12
- package/src/elements/adw-expander-row.ts +34 -1
- package/src/elements/adw-header-bar.ts +18 -4
- package/src/elements/adw-layout-slot.ts +95 -0
- package/src/elements/adw-multi-layout-view.ts +326 -0
- package/src/elements/adw-overlay-split-view.ts +29 -6
- package/src/elements/adw-preferences-row.ts +153 -0
- package/src/elements/adw-shortcuts-dialog.ts +52 -0
- package/src/elements/adw-shortcuts-item.ts +171 -0
- package/src/elements/adw-shortcuts-section.ts +86 -0
- package/src/elements/adw-sidebar.ts +74 -7
- package/src/elements/adw-spin-row.ts +37 -2
- package/src/elements/adw-status-page.ts +10 -2
- package/src/elements/adw-switch-row.ts +53 -2
- package/src/elements/adw-tab-bar.ts +529 -0
- package/src/elements/adw-tab-button.ts +194 -0
- package/src/elements/adw-tab-overview.ts +1011 -0
- package/src/elements/adw-tab-view.ts +66 -145
- package/src/elements/adw-toggle-group.ts +138 -14
- package/src/elements/adw-view-stack.ts +18 -0
- package/src/elements/adw-view-switcher-sidebar.ts +332 -0
- package/src/elements/adw-window.ts +190 -11
- package/src/elements/checks.ts +35 -8
- package/src/elements/gtk-about-dialog.ts +811 -0
- package/src/elements/gtk-application-window.ts +108 -0
- package/src/elements/gtk-aspect-frame.ts +160 -0
- package/src/elements/gtk-button.ts +12 -0
- package/src/elements/gtk-calendar.ts +757 -0
- package/src/elements/gtk-center-box.ts +184 -0
- package/src/elements/gtk-color-dialog-button.ts +278 -0
- package/src/elements/gtk-column-view.ts +320 -0
- package/src/elements/gtk-drag-icon.ts +257 -0
- package/src/elements/gtk-drawing-area.ts +303 -0
- package/src/elements/gtk-editable-label.ts +204 -0
- package/src/elements/gtk-emoji-chooser.ts +542 -0
- package/src/elements/gtk-entry.ts +39 -5
- package/src/elements/gtk-expander.ts +301 -0
- package/src/elements/gtk-fixed.ts +99 -0
- package/src/elements/gtk-flow-box-child.ts +68 -0
- package/src/elements/gtk-flow-box.ts +480 -0
- package/src/elements/gtk-font-dialog-button.ts +432 -0
- package/src/elements/gtk-frame.ts +174 -0
- package/src/elements/gtk-gl-area.ts +476 -0
- package/src/elements/gtk-graphics-offload.ts +130 -0
- package/src/elements/gtk-grid-view.ts +168 -0
- package/src/elements/gtk-grid.ts +127 -0
- package/src/elements/gtk-header-bar.ts +273 -0
- package/src/elements/gtk-inscription.ts +387 -0
- package/src/elements/gtk-label.ts +19 -11
- package/src/elements/gtk-level-bar.ts +323 -0
- package/src/elements/gtk-link-button.ts +138 -0
- package/src/elements/gtk-list-box-row.ts +195 -0
- package/src/elements/gtk-list-box.ts +413 -0
- package/src/elements/gtk-list-view.ts +370 -0
- package/src/elements/gtk-media-controls.ts +509 -0
- package/src/elements/gtk-notebook.ts +664 -0
- package/src/elements/gtk-overlay.ts +149 -0
- package/src/elements/gtk-page-setup-unix-dialog.ts +420 -0
- package/src/elements/gtk-paned.ts +597 -0
- package/src/elements/gtk-password-entry.ts +170 -0
- package/src/elements/gtk-picture.ts +254 -0
- package/src/elements/gtk-popover-bin.ts +332 -0
- package/src/elements/gtk-popover-menu-bar.ts +355 -0
- package/src/elements/gtk-popover-menu.ts +339 -0
- package/src/elements/gtk-popover.ts +92 -10
- package/src/elements/gtk-print-unix-dialog.ts +989 -0
- package/src/elements/gtk-progress-bar.ts +24 -11
- package/src/elements/gtk-revealer.ts +406 -0
- package/src/elements/gtk-scale-button.ts +358 -0
- package/src/elements/gtk-scale.ts +492 -0
- package/src/elements/gtk-scrollbar.ts +528 -0
- package/src/elements/gtk-scrolled-window.ts +653 -0
- package/src/elements/gtk-search-bar.ts +200 -0
- package/src/elements/gtk-search-entry.ts +172 -0
- package/src/elements/gtk-separator.ts +52 -0
- package/src/elements/gtk-spin-button.ts +475 -0
- package/src/elements/gtk-spinner.ts +126 -0
- package/src/elements/gtk-stack-sidebar.ts +212 -0
- package/src/elements/gtk-stack-switcher.ts +279 -0
- package/src/elements/gtk-stack.ts +748 -0
- package/src/elements/gtk-switch.ts +52 -19
- package/src/elements/gtk-text-view.ts +290 -0
- package/src/elements/gtk-text.ts +219 -0
- package/src/elements/gtk-toggle-button.ts +239 -0
- package/src/elements/gtk-tree-expander.ts +243 -0
- package/src/elements/gtk-video.ts +423 -0
- package/src/elements/gtk-viewport.ts +277 -0
- package/src/elements/gtk-window-controls.ts +341 -0
- package/src/elements/gtk-window-handle.ts +221 -0
- package/src/elements/gtk-window.ts +372 -0
- package/src/elements/justification.ts +24 -0
- package/src/elements/popover-menu.ts +24 -0
- package/src/elements/roving-focus.ts +53 -21
- package/src/emoji-data.ts +577 -0
- package/src/entry-rows.spec.ts +31 -0
- package/src/font-description.ts +238 -0
- package/src/gtk-about-dialog.spec.ts +250 -0
- package/src/gtk-action-bar.spec.ts +89 -0
- package/src/gtk-application-window.spec.ts +107 -0
- package/src/gtk-aspect-frame.spec.ts +114 -0
- package/src/gtk-calendar.spec.ts +589 -0
- package/src/gtk-center-box.spec.ts +125 -0
- package/src/gtk-color-dialog-button.spec.ts +141 -0
- package/src/gtk-column-view.spec.ts +154 -0
- package/src/gtk-drag-icon.spec.ts +190 -0
- package/src/gtk-drawing-area.spec.ts +211 -0
- package/src/gtk-editable-label.spec.ts +190 -0
- package/src/gtk-emoji-chooser.spec.ts +173 -0
- package/src/gtk-entry.spec.ts +23 -0
- package/src/gtk-expander.spec.ts +170 -0
- package/src/gtk-fixed.spec.ts +97 -0
- package/src/gtk-flow-box.spec.ts +289 -0
- package/src/gtk-font-dialog-button.spec.ts +166 -0
- package/src/gtk-frame.spec.ts +119 -0
- package/src/gtk-gl-area.spec.ts +361 -0
- package/src/gtk-graphics-offload.spec.ts +119 -0
- package/src/gtk-grid-view.spec.ts +106 -0
- package/src/gtk-grid.spec.ts +122 -0
- package/src/gtk-header-bar.spec.ts +202 -0
- package/src/gtk-inscription.spec.ts +235 -0
- package/src/gtk-level-bar.spec.ts +199 -0
- package/src/gtk-link-button.spec.ts +117 -0
- package/src/gtk-list-box.spec.ts +422 -0
- package/src/gtk-list-view.spec.ts +203 -0
- package/src/gtk-media-controls.spec.ts +295 -0
- package/src/gtk-notebook.spec.ts +546 -0
- package/src/gtk-overlay.spec.ts +141 -0
- package/src/gtk-paned.spec.ts +267 -0
- package/src/gtk-password-entry.spec.ts +150 -0
- package/src/gtk-picture.spec.ts +172 -0
- package/src/gtk-popover-bin.spec.ts +229 -0
- package/src/gtk-popover-menu-bar.spec.ts +296 -0
- package/src/gtk-popover-menu.spec.ts +261 -0
- package/src/gtk-popover-role.spec.ts +138 -0
- package/src/gtk-popover.spec.ts +264 -0
- package/src/gtk-print-dialogs.spec.ts +251 -0
- package/src/gtk-revealer.spec.ts +164 -0
- package/src/gtk-scale-button.spec.ts +218 -0
- package/src/gtk-scale.spec.ts +213 -0
- package/src/gtk-scrollbar.spec.ts +244 -0
- package/src/gtk-scrolled-window.spec.ts +262 -0
- package/src/gtk-search-bar.spec.ts +179 -0
- package/src/gtk-search-entry.spec.ts +142 -0
- package/src/gtk-separator.spec.ts +74 -0
- package/src/gtk-spin-button.spec.ts +186 -0
- package/src/gtk-spinner.spec.ts +130 -0
- package/src/gtk-stack-sidebar.spec.ts +217 -0
- package/src/gtk-stack-switcher.spec.ts +249 -0
- package/src/gtk-stack.spec.ts +432 -0
- package/src/gtk-text-view.spec.ts +189 -0
- package/src/gtk-text.spec.ts +163 -0
- package/src/gtk-toggle-button.spec.ts +186 -0
- package/src/gtk-tree-expander.spec.ts +201 -0
- package/src/gtk-video.spec.ts +240 -0
- package/src/gtk-viewport.spec.ts +140 -0
- package/src/gtk-window-controls.spec.ts +232 -0
- package/src/gtk-window-handle.spec.ts +158 -0
- package/src/gtk-window.spec.ts +202 -0
- package/src/index.ts +9 -1
- package/src/keyboard-operable.spec.ts +77 -9
- package/src/list-view-dom.ts +121 -0
- package/src/namespace/adw.ts +12 -0
- package/src/namespace/gtk.ts +61 -0
- package/src/page-setup.ts +222 -0
- package/src/row-line-clamp.ts +74 -0
- package/src/row-tooltip.spec.ts +313 -0
- package/src/row-tooltip.ts +52 -0
- package/src/scroll-shading.ts +18 -1
- package/src/shared-tree-builder.ts +336 -41
- package/src/shared-tree-mount.spec.ts +130 -0
- package/src/shared-trees.spec.ts +15 -0
- package/src/signals.ts +15 -0
- package/src/style-classes.spec.ts +9 -8
- package/src/styles.generated.ts +1 -1
- package/src/tab-chip.ts +200 -0
- package/src/template-classes.ts +45 -0
- package/src/test.browser.mts +160 -0
- 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
|
|
21
|
-
// `GtkPopover:position`
|
|
22
|
-
//
|
|
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
|
-
/**
|
|
60
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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);
|