@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.
- package/dist/adwaita-web.css +8070 -3037
- 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-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/breakpoints.d.ts +14 -3
- package/lib/types/construct-vectors.spec.d.ts +1 -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-dialog.d.ts +10 -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-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 +5 -0
- package/lib/types/elements/adw-switch-row.d.ts +3 -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-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 +121 -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 +97 -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/scroll-shading.d.ts +15 -1
- package/lib/types/shared-tree-builder.d.ts +30 -2
- 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/package.json +12 -8
- package/scss/_action_row.scss +2 -2
- 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/_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/_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 +132 -0
- 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 +51 -0
- package/scss/_print_dialogs.scss +328 -0
- package/scss/_reset.scss +21 -19
- package/scss/_revealer.scss +37 -0
- package/scss/_row.scss +20 -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/_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/_tree_expander.scss +62 -0
- package/scss/_variables.scss +43 -21
- package/scss/_video.scss +146 -0
- package/scss/_view_switcher_sidebar.scss +112 -0
- package/scss/_viewport.scss +50 -0
- package/scss/_window.scss +118 -1
- package/scss/_window_handle.scss +20 -0
- package/scss/adwaita-skin.scss +109 -0
- package/src/adw-action-rows.spec.ts +76 -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-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-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/breakpoints.ts +25 -8
- package/src/capabilities.d.mts +3 -0
- package/src/capabilities.mjs +18 -0
- package/src/connect-lifecycle.spec.ts +12 -0
- package/src/construct-vectors.spec.ts +175 -0
- 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-clamp-scrollable.ts +207 -0
- package/src/elements/adw-dialog.ts +19 -0
- package/src/elements/adw-layout-slot.ts +95 -0
- package/src/elements/adw-multi-layout-view.ts +326 -0
- package/src/elements/adw-preferences-row.ts +150 -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 +42 -3
- package/src/elements/adw-switch-row.ts +28 -1
- 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 +20 -5
- 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 +185 -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 +642 -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 +366 -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 +190 -0
- package/src/index.ts +9 -1
- package/src/keyboard-operable.spec.ts +33 -1
- 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/scroll-shading.ts +18 -1
- package/src/shared-tree-builder.ts +263 -21
- package/src/signals.ts +15 -0
- package/src/source-view/theme.ts +11 -5
- 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 +152 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
// <gtk-list-box> — a vertical list of `<gtk-list-box-row>` children with GTK's four selection
|
|
2
|
+
// modes, the web counterpart of `Gtk.ListBox`.
|
|
3
|
+
//
|
|
4
|
+
// THE SELECTION IS `listBoxSelect` AND FRIENDS, in `@gjsify/adwaita-core` (ADR 0004), NOT the
|
|
5
|
+
// `listViewSelect` beside it that `<gtk-list-view>` uses. The two are different C functions and
|
|
6
|
+
// they disagree in four places, each of which a reader would get wrong from the other: this
|
|
7
|
+
// box has a `browse` mode the list base has no word for; Ctrl+click on the selected row
|
|
8
|
+
// CLEARS the selection here where `GtkSingleSelection` refuses (`autoselect`); Shift+click
|
|
9
|
+
// keeps the ANCHOR where the list base moves it; and `select_row`/`unselect_row` are a
|
|
10
|
+
// separate, idempotent door that is NOT the click. `box-selection.ts` carries the reasoning
|
|
11
|
+
// and the vectors; this element holds the rows and the anchor.
|
|
12
|
+
//
|
|
13
|
+
// `activate-on-single-click` DEFAULTS TRUE (gtklistbox.c:541-544), as does
|
|
14
|
+
// `<gtk-flow-box>`'s — unlike `Gtk.ListView:single-click-activate`, which defaults FALSE and
|
|
15
|
+
// reads its flag the other way round. The port keeps each widget's own spelling rather than
|
|
16
|
+
// normalising three properties into one, because the fence rules key on GIR defaults: a bare
|
|
17
|
+
// attribute here means the default, and `activate-on-single-click="false"` is how you ask for
|
|
18
|
+
// a double click.
|
|
19
|
+
//
|
|
20
|
+
// ARIA. GTK declares `GTK_ACCESSIBLE_ROLE_LIST` unconditionally (gtklistbox.c:778) and the row
|
|
21
|
+
// `LIST_ITEM` (:3955). That pairing carries no selection at all in ARIA — `aria-selected` is
|
|
22
|
+
// not valid on a `listitem` — so a box that can select anything is announced as a `listbox`
|
|
23
|
+
// with `option` rows, and only a `none` box keeps GTK's own `list`/`listitem`. It is the same
|
|
24
|
+
// divergence `<gtk-list-view>` records and for the same reason.
|
|
25
|
+
//
|
|
26
|
+
// `tab-behavior` (4.18) is `tabIndex` on the rows: `all` gives every activatable row its own
|
|
27
|
+
// tab stop, `item` and `cell` hand out a roving tabindex — the split `gtk_list_box_focus`
|
|
28
|
+
// draws by walking between rows for Tab only under `GTK_LIST_TAB_ALL` (gtklistbox.c:2037,
|
|
29
|
+
// :2067), which is what makes the list one stop from outside under the other two. A roving
|
|
30
|
+
// tabindex that does not move leaves every unselected row unreachable by any key, which is
|
|
31
|
+
// what `attachRovingFocus` is for (the incident `roving-focus.ts` records in full). The rows
|
|
32
|
+
// are `claim`ed here, so they stop deriving their own: a row's `connectedCallback` runs after
|
|
33
|
+
// this one's and would otherwise put every row back in the Tab order.
|
|
34
|
+
//
|
|
35
|
+
// WHAT IS NOT HERE, and why nothing was lost. `bind_model` is ADR 0046's `Gio.ListModel` — the
|
|
36
|
+
// family the four model views' refusals name. `set_filter_func`, `set_sort_func` and
|
|
37
|
+
// `set_header_func` are three FUNCTION properties with no markup form. `get_row_at_y` is a hit
|
|
38
|
+
// test over a GTK allocation. `drag_highlight_row` / `drag_unhighlight_row` drive a drop target
|
|
39
|
+
// this port has no DND layer for. `set_placeholder` is a widget property and so a slot, which
|
|
40
|
+
// this element does not take one for. `set_adjustment` is the scrolled-window relationship ADR
|
|
41
|
+
// 0047 gave a portable value for, and the host wires it with its scrolled-window wrapper rather
|
|
42
|
+
// than as a property here.
|
|
43
|
+
//
|
|
44
|
+
// Reference: refs/gtk/gtk/gtklistbox.c:524-778 (properties, signals, the keys, css name, role),
|
|
45
|
+
// :915-996 (select/unselect/all), :1901-1935 (the click gesture), :1799-1871 (the selection
|
|
46
|
+
// rules), :3600-3624 (the per-row class and accessible state), :4127-4134 (`.separators`)
|
|
47
|
+
// Reference: refs/libadwaita/src/stylesheet/widgets/_lists.scss:5-38, :47-95 (list, row)
|
|
48
|
+
// Copyright (c) GNOME contributors (GTK/libadwaita). LGPLv2.1+.
|
|
49
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web; the selection rules
|
|
50
|
+
// composed from @gjsify/adwaita-core.
|
|
51
|
+
|
|
52
|
+
import {
|
|
53
|
+
listBoxSelect,
|
|
54
|
+
listBoxSelectAll,
|
|
55
|
+
listBoxSelectRow,
|
|
56
|
+
listBoxUnselectAll,
|
|
57
|
+
listBoxUnselectRow,
|
|
58
|
+
normalizeBoxSelectionMode,
|
|
59
|
+
type AdwBoxSelectionMode,
|
|
60
|
+
} from '@gjsify/adwaita-core';
|
|
61
|
+
|
|
62
|
+
import type { GtkListBoxRow } from './gtk-list-box-row.js';
|
|
63
|
+
import { attachRovingFocus } from './roving-focus.js';
|
|
64
|
+
|
|
65
|
+
// SIDE-EFFECT import, deliberately separate from the type import above: it guarantees
|
|
66
|
+
// `gtk-list-box-row` is defined before this module's `customElements.define` can upgrade a
|
|
67
|
+
// server-rendered box and collect its rows. See `adw-expander-row.ts` for why a combined
|
|
68
|
+
// `import { GtkListBoxRow }` would not do it.
|
|
69
|
+
import './gtk-list-box-row.js';
|
|
70
|
+
|
|
71
|
+
/** `GtkListTabBehavior`'s nicks — `cell` behaves as `item` outside a cell-based box. */
|
|
72
|
+
export type GtkListTabBehavior = 'all' | 'item' | 'cell';
|
|
73
|
+
|
|
74
|
+
const TAB_BEHAVIORS: ReadonlySet<string> = new Set(['all', 'item', 'cell']);
|
|
75
|
+
|
|
76
|
+
/** An unknown nick is `all`, the ParamSpec's default (gtklistbox.c:574-578). */
|
|
77
|
+
export function normalizeListTabBehavior(raw: string | null | undefined): GtkListTabBehavior {
|
|
78
|
+
return raw !== null && raw !== undefined && TAB_BEHAVIORS.has(raw) ? (raw as GtkListTabBehavior) : 'all';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export class GtkListBox extends HTMLElement {
|
|
82
|
+
private _rows: GtkListBoxRow[] = [];
|
|
83
|
+
private _selection: number[] = [];
|
|
84
|
+
/** `box->selected_row`, `-1` for the C's NULL. */
|
|
85
|
+
private _anchor = -1;
|
|
86
|
+
private _initialized = false;
|
|
87
|
+
|
|
88
|
+
static get observedAttributes() {
|
|
89
|
+
return [
|
|
90
|
+
'selection-mode',
|
|
91
|
+
'activate-on-single-click',
|
|
92
|
+
'accept-unpaired-release',
|
|
93
|
+
'show-separators',
|
|
94
|
+
'tab-behavior',
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** `GtkListBox:selection-mode` — the four `Gtk.SelectionMode` values. */
|
|
99
|
+
get selectionMode(): AdwBoxSelectionMode {
|
|
100
|
+
return normalizeBoxSelectionMode(this.getAttribute('selection-mode'));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
set selectionMode(value: AdwBoxSelectionMode) {
|
|
104
|
+
this.setAttribute('selection-mode', value);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Default TRUE (gtklistbox.c:543), so the attribute is the OFF switch. */
|
|
108
|
+
get activateOnSingleClick(): boolean {
|
|
109
|
+
return this.getAttribute('activate-on-single-click') !== 'false';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
set activateOnSingleClick(value: boolean) {
|
|
113
|
+
this.setAttribute('activate-on-single-click', String(!!value));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* `GtkListBox:accept-unpaired-release` — FALSE by default (gtklistbox.c:552-553).
|
|
118
|
+
*
|
|
119
|
+
* Upstream this decides whether a press followed by a release somewhere else still
|
|
120
|
+
* activates the row under the press (:1922-1935). A browser delivers `click` on the
|
|
121
|
+
* NEAREST COMMON ANCESTOR of the press and the release, so a release outside the row
|
|
122
|
+
* reaches this box rather than the row — and this attribute says whether that box-level
|
|
123
|
+
* click selects the row the press started on or is dropped.
|
|
124
|
+
*/
|
|
125
|
+
get acceptUnpairedRelease(): boolean {
|
|
126
|
+
return this.hasAttribute('accept-unpaired-release');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
set acceptUnpairedRelease(value: boolean) {
|
|
130
|
+
this.toggleAttribute('accept-unpaired-release', !!value);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
get showSeparators(): boolean {
|
|
134
|
+
return this.hasAttribute('show-separators');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
set showSeparators(value: boolean) {
|
|
138
|
+
this.toggleAttribute('show-separators', !!value);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** `GtkListBox:tab-behavior` (4.18) — `all` | `item` | `cell`. */
|
|
142
|
+
get tabBehavior(): GtkListTabBehavior {
|
|
143
|
+
return normalizeListTabBehavior(this.getAttribute('tab-behavior'));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
set tabBehavior(value: GtkListTabBehavior) {
|
|
147
|
+
this.setAttribute('tab-behavior', value);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The rows, in order. */
|
|
151
|
+
get rows(): readonly GtkListBoxRow[] {
|
|
152
|
+
return this._rows;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The selected positions, ascending.
|
|
157
|
+
*
|
|
158
|
+
* NOT a GIR property: `GtkListBox` exposes its selection through the `row-selected` /
|
|
159
|
+
* `selected-rows-changed` SIGNALS and the `get_selected_rows()` METHOD, and this element
|
|
160
|
+
* spells the signal as `notify::selected-rows` so a `notify::` listener finds the shape it
|
|
161
|
+
* expects everywhere else in the package.
|
|
162
|
+
*/
|
|
163
|
+
get selectedRows(): number[] {
|
|
164
|
+
return [...this._selection];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
set selectedRows(value: Iterable<number> | number | null) {
|
|
168
|
+
for (const position of typeof value === 'number' ? [value] : (value ?? [])) {
|
|
169
|
+
this.selectRow(this._rows[position] ?? null);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** `gtk_list_box_selected_foreach`, as the rows themselves. */
|
|
174
|
+
get selectedRowElements(): GtkListBoxRow[] {
|
|
175
|
+
return this._selection.map((position) => this._rows[position]).filter((row) => row !== undefined);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
connectedCallback() {
|
|
179
|
+
if (this._initialized) return;
|
|
180
|
+
this._initialized = true;
|
|
181
|
+
|
|
182
|
+
this.addEventListener('click', (event) => this._onClick(event));
|
|
183
|
+
this.addEventListener('dblclick', (event) => this._onDoubleClick(event));
|
|
184
|
+
this.addEventListener('keydown', (event) => this._onKeyDown(event));
|
|
185
|
+
|
|
186
|
+
attachRovingFocus({
|
|
187
|
+
host: this,
|
|
188
|
+
// Always vertical: `GtkListBox` is NOT a `GtkOrientable` — it has no `orientation`
|
|
189
|
+
// property, unlike `Gtk.FlowBox` — so this is a VALUE rather than the FUNCTION
|
|
190
|
+
// `<gtk-list-view>` needs for a property that can change after connect.
|
|
191
|
+
orientation: 'vertical',
|
|
192
|
+
items: () => this._rows,
|
|
193
|
+
select: (row) => this._updateSelection(row as GtkListBoxRow, {}),
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// A row appended AFTER connect has to join the selection from its first frame. The
|
|
197
|
+
// observer watches THIS element, so it dies with the element and there is nothing for
|
|
198
|
+
// `check-adwaita-connect-rebind` to hold — `slotted-children.ts` states why.
|
|
199
|
+
new MutationObserver(() => this._collectRows()).observe(this, { childList: true });
|
|
200
|
+
|
|
201
|
+
this._applyAttributes();
|
|
202
|
+
this._collectRows();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
attributeChangedCallback(name?: string) {
|
|
206
|
+
if (!this._initialized) return;
|
|
207
|
+
this._applyAttributes();
|
|
208
|
+
// `can_select` feeds every row's `.activatable` class, so a mode change reaches them.
|
|
209
|
+
if (name === 'selection-mode') this._syncRows();
|
|
210
|
+
if (name === 'tab-behavior') this._syncTabIndexes();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** `gtk_list_box_select_row` (gtklistbox.c:915-933). `null` is the C's unselect-all (:926). */
|
|
214
|
+
selectRow(row: GtkListBoxRow | null): void {
|
|
215
|
+
const position = row === null ? null : this._rows.indexOf(row);
|
|
216
|
+
const result = listBoxSelectRow(
|
|
217
|
+
this._selection,
|
|
218
|
+
this._anchor,
|
|
219
|
+
position,
|
|
220
|
+
this._rows.length,
|
|
221
|
+
this.selectionMode,
|
|
222
|
+
row === null || row.selectable,
|
|
223
|
+
);
|
|
224
|
+
if (same(result.selection, this._selection) && result.anchor === this._anchor) return;
|
|
225
|
+
this._selection = result.selection;
|
|
226
|
+
this._anchor = result.anchor;
|
|
227
|
+
this._emitSelection(row);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** `gtk_list_box_unselect_row` (gtklistbox.c:943-950). */
|
|
231
|
+
unselectRow(row: GtkListBoxRow): void {
|
|
232
|
+
const result = listBoxUnselectRow(
|
|
233
|
+
this._selection,
|
|
234
|
+
this._anchor,
|
|
235
|
+
this._rows.indexOf(row),
|
|
236
|
+
this._rows.length,
|
|
237
|
+
this.selectionMode,
|
|
238
|
+
);
|
|
239
|
+
if (same(result.selection, this._selection)) return;
|
|
240
|
+
this._selection = result.selection;
|
|
241
|
+
this._emitSelection(null);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** `gtk_list_box_select_all` — refused unless the mode is `multiple` (:963-964). */
|
|
245
|
+
selectAll(): void {
|
|
246
|
+
const next = listBoxSelectAll(this._rows.length, this.selectionMode);
|
|
247
|
+
if (next === null) return;
|
|
248
|
+
this._selection = next;
|
|
249
|
+
this._anchor = next.length > 0 ? next[0]! : -1;
|
|
250
|
+
this._emitSelection(this.selectedRowElements[0] ?? null);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** `gtk_list_box_unselect_all` — refused in `browse`, a no-op on an empty selection. */
|
|
254
|
+
unselectAll(): void {
|
|
255
|
+
if (listBoxUnselectAll(this._selection, this.selectionMode) === null) return;
|
|
256
|
+
this._selection = [];
|
|
257
|
+
this._anchor = -1;
|
|
258
|
+
this._emitSelection(null);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** The classes and ARIA that follow directly from the attributes. */
|
|
262
|
+
private _applyAttributes(): void {
|
|
263
|
+
this.classList.toggle('separators', this.showSeparators);
|
|
264
|
+
const selectable = this.selectionMode !== 'none';
|
|
265
|
+
this.setAttribute('role', selectable ? 'listbox' : 'list');
|
|
266
|
+
if (this.selectionMode === 'multiple') this.setAttribute('aria-multiselectable', 'true');
|
|
267
|
+
else this.removeAttribute('aria-multiselectable');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** Re-read the children and re-derive everything that follows from them. */
|
|
271
|
+
private _collectRows(): void {
|
|
272
|
+
const next = [...this.querySelectorAll(':scope > gtk-list-box-row')] as GtkListBoxRow[];
|
|
273
|
+
if (next.length === this._rows.length && next.every((row, position) => row === this._rows[position])) return;
|
|
274
|
+
// The box owns each row's `.activatable` class and tab stop while it manages it, and
|
|
275
|
+
// a row's own `connectedCallback` runs AFTER this one — see `GtkListBoxRow.claim`.
|
|
276
|
+
for (const row of this._rows) if (!next.includes(row)) row.release();
|
|
277
|
+
for (const row of next) row.claim();
|
|
278
|
+
this._rows = next;
|
|
279
|
+
this._selection = this._selection.filter((position) => position < this._rows.length);
|
|
280
|
+
if (this._anchor >= this._rows.length) this._anchor = -1;
|
|
281
|
+
this._syncRows();
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Re-derive every row's `.activatable` class, its `aria-selected` and the roving tabindex.
|
|
286
|
+
*
|
|
287
|
+
* Called on connect, on `selection-mode`, and from the childList observer, so a row
|
|
288
|
+
* appended after connect is in the selection from its first frame.
|
|
289
|
+
*/
|
|
290
|
+
private _syncRows(): void {
|
|
291
|
+
const canSelect = this.selectionMode !== 'none';
|
|
292
|
+
const selection = new Set(this._selection);
|
|
293
|
+
this._rows.forEach((row, position) => {
|
|
294
|
+
row.syncClasses(canSelect);
|
|
295
|
+
// `gtk_list_box_update_row` :3617-3623 — the accessible state is published only
|
|
296
|
+
// while the row is selectable AND the box can select, and RESET otherwise, so a
|
|
297
|
+
// row in a `none` box must not announce itself as merely unselected.
|
|
298
|
+
if (row.selectable && canSelect) row.setAttribute('aria-selected', String(selection.has(position)));
|
|
299
|
+
else row.removeAttribute('aria-selected');
|
|
300
|
+
});
|
|
301
|
+
this._syncTabIndexes();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** The tab stops `tab-behavior` hands out: one per row, or one for the whole box. */
|
|
305
|
+
private _syncTabIndexes(): void {
|
|
306
|
+
const roving = this.tabBehavior !== 'all';
|
|
307
|
+
// Where Tab ENTERS the box is `gtk_list_box_focus` with no focus child yet: the
|
|
308
|
+
// selected row, and the first focusable row when there is none (gtklistbox.c:2108-2111).
|
|
309
|
+
// Leaving is the mirror image, `get_last_focusable` (:2099-2101), and the two stops
|
|
310
|
+
// are what `item`/`cell` mean — `all` walks rows in between (gtklistbox.c:2037, :2067).
|
|
311
|
+
const cursor = this._selection.length > 0 ? this._selection[0]! : 0;
|
|
312
|
+
this._rows.forEach((row, position) => {
|
|
313
|
+
row.tabIndex = roving ? (position === cursor ? 0 : -1) : row.classList.contains('activatable') ? 0 : -1;
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* One click. Selection always follows; activation depends on the click COUNT, which a
|
|
319
|
+
* plain `click` cannot say — so the count comes from `detail` and a second click arrives
|
|
320
|
+
* here too.
|
|
321
|
+
*/
|
|
322
|
+
private _onClick(event: MouseEvent): void {
|
|
323
|
+
const row = this._rowAt(event.target);
|
|
324
|
+
// An unpaired release — the press landed in a row, the release outside it — arrives as
|
|
325
|
+
// a box-level click with no row under the pointer. That is what the attribute decides.
|
|
326
|
+
if (row === null && !this.acceptUnpairedRelease) return;
|
|
327
|
+
if (row !== null) {
|
|
328
|
+
this._updateSelection(row, { modify: event.ctrlKey || event.metaKey, extend: event.shiftKey });
|
|
329
|
+
}
|
|
330
|
+
// One press activates when `activate-on-single-click` is TRUE — the ParamSpec default
|
|
331
|
+
// (gtklistbox.c:543) — and a SECOND one when it is off (gtklistbox.c:1917-1918). A
|
|
332
|
+
// browser reports the press count as `detail`, so the threshold is the property and not
|
|
333
|
+
// a constant.
|
|
334
|
+
if (event.detail < (this.activateOnSingleClick ? 1 : 2)) return;
|
|
335
|
+
if (row !== null) this._activate(row);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** The double-click arm, for the browser that reports the second click as `detail === 2`. */
|
|
339
|
+
private _onDoubleClick(event: MouseEvent): void {
|
|
340
|
+
if (this.activateOnSingleClick) return;
|
|
341
|
+
const row = this._rowAt(event.target);
|
|
342
|
+
if (row === null) return;
|
|
343
|
+
this._activate(row);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* `Ctrl`+Space is `toggle-cursor-row` (gtklistbox.c:753-755) and nothing else is: Enter and
|
|
348
|
+
* Space reach the ROW, which `attachRowActivation` owns, and this box must not answer the
|
|
349
|
+
* same key twice.
|
|
350
|
+
*/
|
|
351
|
+
private _onKeyDown(event: KeyboardEvent): void {
|
|
352
|
+
if (!event.ctrlKey || event.altKey || event.metaKey || event.key !== ' ') return;
|
|
353
|
+
const row = this._rowAt(event.target);
|
|
354
|
+
if (row === null) return;
|
|
355
|
+
event.preventDefault();
|
|
356
|
+
this._updateSelection(row, { modify: true });
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/** The row a click or key landed in, or null. */
|
|
360
|
+
private _rowAt(target: EventTarget | null): GtkListBoxRow | null {
|
|
361
|
+
if (!(target instanceof Element)) return null;
|
|
362
|
+
const row = target.closest('gtk-list-box-row');
|
|
363
|
+
return this.contains(row) ? (row as GtkListBoxRow) : null;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** One click or `Ctrl`+Space — `gtk_list_box_update_selection_full` (:1799-1871). */
|
|
367
|
+
private _updateSelection(row: GtkListBoxRow, step: { modify?: boolean; extend?: boolean }): void {
|
|
368
|
+
const result = listBoxSelect(
|
|
369
|
+
this._selection,
|
|
370
|
+
this._anchor,
|
|
371
|
+
this._rows.indexOf(row),
|
|
372
|
+
this._rows.length,
|
|
373
|
+
this.selectionMode,
|
|
374
|
+
step,
|
|
375
|
+
row.selectable,
|
|
376
|
+
);
|
|
377
|
+
if (same(result.selection, this._selection)) return;
|
|
378
|
+
this._selection = result.selection;
|
|
379
|
+
this._anchor = result.anchor;
|
|
380
|
+
// `row-selected` names the row the click LANDED ON, or NULL when that row ended
|
|
381
|
+
// unselected (gtklistbox.c:1826-1828, :1856-1858) — which is why it is the click's row
|
|
382
|
+
// and not the first selected one.
|
|
383
|
+
this._emitSelection(result.selection.includes(this._rows.indexOf(row)) ? row : null);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** `gtk_list_box_activate` (:1873-1884) — an unactivatable row emits nothing. */
|
|
387
|
+
private _activate(row: GtkListBoxRow): void {
|
|
388
|
+
if (!row.activatable) return;
|
|
389
|
+
this.dispatchEvent(new CustomEvent('row-activated', { bubbles: true, detail: { row } }));
|
|
390
|
+
row.dispatchEvent(new CustomEvent('activate', { bubbles: true }));
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* The two signals GObject emits for every selection change (:594-616) plus the notify a
|
|
395
|
+
* declarative port owes. `selected-rows-changed` is `RUN_FIRST` upstream and carries
|
|
396
|
+
* nothing, so its `detail` stays empty.
|
|
397
|
+
*/
|
|
398
|
+
private _emitSelection(row: GtkListBoxRow | null): void {
|
|
399
|
+
this._syncRows();
|
|
400
|
+
this.dispatchEvent(new CustomEvent('selected-rows-changed', { bubbles: true }));
|
|
401
|
+
this.dispatchEvent(new CustomEvent('row-selected', { bubbles: true, detail: { row } }));
|
|
402
|
+
this.dispatchEvent(
|
|
403
|
+
new CustomEvent('notify::selected-rows', { bubbles: true, detail: { selectedRows: [...this._selection] } }),
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/** Selection equality without an allocation — the arrays are sorted, so lengths decide. */
|
|
409
|
+
function same(next: readonly number[], current: readonly number[]): boolean {
|
|
410
|
+
return next.length === current.length && next.every((position, index) => position === current[index]);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
customElements.define('gtk-list-box', GtkListBox);
|