@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,168 @@
|
|
|
1
|
+
// <gtk-grid-view> — the same model and factory as `<gtk-list-view>`, reflowed into
|
|
2
|
+
// columns: the web counterpart of `Gtk.GridView`.
|
|
3
|
+
//
|
|
4
|
+
// `GtkGridView` IS a `GtkListBase`, exactly as `GtkListView` is — same model, same
|
|
5
|
+
// factory, same selection function, same rubberband — and the only thing it adds is HOW
|
|
6
|
+
// MANY COLUMNS fit. So this element extends `<gtk-list-view>` and adds that one
|
|
7
|
+
// derivation, rather than restating a second copy of the item machinery. GTK's own CSS
|
|
8
|
+
// node names say the same thing from the other side: a list view's children are `row`,
|
|
9
|
+
// a grid view's are `child`, and nothing else in the node tree differs.
|
|
10
|
+
//
|
|
11
|
+
// THE COLUMN COUNT IS MEASURED, NOT GUESSED. `gridViewColumns` in `@gjsify/adwaita-core`
|
|
12
|
+
// is `gtk_grid_view_compute_n_columns` (gtkgridview.c:619-641) — integer division of the
|
|
13
|
+
// available size by the item size, both sides carrying the spacing, then
|
|
14
|
+
// `CLAMP (n, min-columns, max-columns)`. A `ResizeObserver` feeds it the view's own width
|
|
15
|
+
// and the first child's, which is the browser's equivalent of the size negotiation GTK
|
|
16
|
+
// runs; the result is written as `repeat(n, 1fr)` so the tracks stay equal, as GTK's do.
|
|
17
|
+
//
|
|
18
|
+
// A pure CSS `repeat(auto-fill, minmax(…))` was the alternative and was rejected: it
|
|
19
|
+
// cannot express `max-columns` at all (the cap is on the COUNT, not on a width), and
|
|
20
|
+
// `min-columns` only by a container width an author would have to compute — so the
|
|
21
|
+
// property pair GTK documents would have become two properties the port silently drops.
|
|
22
|
+
//
|
|
23
|
+
// Attributes: model, selection-mode, single-click-activate, enable-rubberband,
|
|
24
|
+
// tab-behavior, orientation (all `<gtk-list-view>`'s), plus `min-columns` and
|
|
25
|
+
// `max-columns`, which are `GtkGridView`'s own.
|
|
26
|
+
// Properties: everything `<gtk-list-view>` publishes, plus minColumns / maxColumns.
|
|
27
|
+
// Events: `activate`, `notify::selected` — the base element's.
|
|
28
|
+
// A11Y: `listbox` / `option`, inherited. GTK declares `GRID`/`GRID_CELL`
|
|
29
|
+
// (gtkgridview.c:88-91), and the ARIA `grid` pattern needs a `row` layer between the
|
|
30
|
+
// two that this widget has no concept of — its items are addressed by POSITION, never
|
|
31
|
+
// by row and column — so announcing a grid would promise a navigation that is not there.
|
|
32
|
+
//
|
|
33
|
+
// Reference: refs/gtk/gtk/gtkgridview.c:44-92 (the widget, its CSS nodes and its role)
|
|
34
|
+
// Reference: refs/gtk/gtk/gtkgridview.c:619-641, 1147-1167 (the count and its two bounds)
|
|
35
|
+
// Reference: refs/libadwaita/src/stylesheet/widgets/_views.scss:52-91 (gridview > child)
|
|
36
|
+
// Copyright (c) GNOME contributors (GTK/libadwaita). LGPLv2.1+.
|
|
37
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
38
|
+
|
|
39
|
+
import { ADW_GRID_VIEW_MAX_COLUMNS, ADW_GRID_VIEW_MIN_COLUMNS, gridViewColumns } from '@gjsify/adwaita-core';
|
|
40
|
+
|
|
41
|
+
import { GtkListView } from './gtk-list-view.js';
|
|
42
|
+
|
|
43
|
+
/** The gap between cells — what `_grid_view.scss` sets, and the answer with no stylesheet. */
|
|
44
|
+
const GRID_SPACING = 6;
|
|
45
|
+
|
|
46
|
+
/** What `_grid_view.scss` floors a cell at, and the answer with no stylesheet. */
|
|
47
|
+
const GRID_ITEM_MIN_WIDTH = 120;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A computed length in px, or `fallback` where CSS answered a keyword.
|
|
51
|
+
*
|
|
52
|
+
* Both lengths this element reads have a keyword for "unset" — `min-width: auto` on a grid
|
|
53
|
+
* item, `column-gap: normal` — and both are numbers the stylesheet owns, so the fallback is
|
|
54
|
+
* only reached when no stylesheet is loaded at all. A declared `0px` is NOT a fallback: the
|
|
55
|
+
* column arithmetic has its own answer for a zero-sized item and must get to give it.
|
|
56
|
+
*/
|
|
57
|
+
function cssPixels(value: string, fallback: number): number {
|
|
58
|
+
const parsed = Number.parseFloat(value);
|
|
59
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class GtkGridView extends GtkListView {
|
|
63
|
+
private _observer: ResizeObserver | null = null;
|
|
64
|
+
|
|
65
|
+
static get observedAttributes() {
|
|
66
|
+
return [
|
|
67
|
+
'model',
|
|
68
|
+
'selection-mode',
|
|
69
|
+
'single-click-activate',
|
|
70
|
+
'enable-rubberband',
|
|
71
|
+
'tab-behavior',
|
|
72
|
+
'orientation',
|
|
73
|
+
'min-columns',
|
|
74
|
+
'max-columns',
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** `GtkGridView:min-columns` — at least one, as the ParamSpec's range says. */
|
|
79
|
+
get minColumns(): number {
|
|
80
|
+
return this._columnBound('min-columns', ADW_GRID_VIEW_MIN_COLUMNS);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
set minColumns(value: number) {
|
|
84
|
+
this.setAttribute('min-columns', String(value));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** `GtkGridView:max-columns` — `DEFAULT_MAX_COLUMNS` is 7 (gtkgridview.c:42). */
|
|
88
|
+
get maxColumns(): number {
|
|
89
|
+
return this._columnBound('max-columns', ADW_GRID_VIEW_MAX_COLUMNS);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
set maxColumns(value: number) {
|
|
93
|
+
this.setAttribute('max-columns', String(value));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
connectedCallback() {
|
|
97
|
+
super.connectedCallback();
|
|
98
|
+
if (this._observer !== null) return;
|
|
99
|
+
// The view's width AND the first cell's: the count is a ratio of the two, and a
|
|
100
|
+
// factory that lays out late changes the second without changing the first.
|
|
101
|
+
this._observer = new ResizeObserver(() => this._applyColumns());
|
|
102
|
+
this._observer.observe(this);
|
|
103
|
+
this._applyColumns();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
disconnectedCallback() {
|
|
107
|
+
// Cleanup beside creation: an observer outliving its element keeps the whole
|
|
108
|
+
// subtree alive and keeps measuring a box nothing draws.
|
|
109
|
+
this._observer?.disconnect();
|
|
110
|
+
this._observer = null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
attributeChangedCallback(name?: string) {
|
|
114
|
+
super.attributeChangedCallback(name);
|
|
115
|
+
this._applyColumns();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
protected override get _viewClass(): string {
|
|
119
|
+
return 'adw-grid-view';
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
protected override get _rowClass(): string {
|
|
123
|
+
// `gridview > child`, where a list view has `listview > row`.
|
|
124
|
+
return 'adw-grid-view-child';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
protected override _renderRows(): void {
|
|
128
|
+
super._renderRows();
|
|
129
|
+
this._applyColumns();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** An attribute that is not a positive integer is the property's default, not NaN. */
|
|
133
|
+
private _columnBound(attribute: string, fallback: number): number {
|
|
134
|
+
const parsed = Number.parseInt(this.getAttribute(attribute) ?? '', 10);
|
|
135
|
+
return Number.isFinite(parsed) && parsed >= 1 ? parsed : fallback;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Measure, count, and write the tracks.
|
|
140
|
+
*
|
|
141
|
+
* THE ITEM SIZE IS THE CELL'S `min-width`, NOT ITS RENDERED WIDTH, and the difference
|
|
142
|
+
* is the whole reason this is three lines rather than one. The tracks are written as
|
|
143
|
+
* `1fr`, so a rendered cell is as wide as the count made it: feeding that back in
|
|
144
|
+
* would measure the answer and converge on whatever the first frame happened to do.
|
|
145
|
+
* `min-width` is a fact about the CONTENT instead, declared by the stylesheet and
|
|
146
|
+
* overridable per cell — and it is the branch GTK itself takes under
|
|
147
|
+
* `GTK_SCROLL_MINIMUM` (gtkgridview.c:628-630). The natural-size branch needs a
|
|
148
|
+
* measurement a browser can only take by first undoing the layout the answer feeds.
|
|
149
|
+
*
|
|
150
|
+
* The gap is read the same way, off the container's own `column-gap`, so the two
|
|
151
|
+
* numbers the arithmetic takes come from ONE place — the stylesheet — and an author
|
|
152
|
+
* who widens the gap does not get a column count computed against the old one.
|
|
153
|
+
*
|
|
154
|
+
* An empty view keeps the tracks it had: there is nothing to measure, and no cell for
|
|
155
|
+
* the answer to be wrong about.
|
|
156
|
+
*/
|
|
157
|
+
private _applyColumns(): void {
|
|
158
|
+
const first = this._rows[0];
|
|
159
|
+
if (first === undefined) return;
|
|
160
|
+
const itemSize = cssPixels(globalThis.getComputedStyle(first).minWidth, GRID_ITEM_MIN_WIDTH);
|
|
161
|
+
const spacing = cssPixels(globalThis.getComputedStyle(this._listEl).columnGap, GRID_SPACING);
|
|
162
|
+
const forSize = Math.round(this.getBoundingClientRect().width);
|
|
163
|
+
const columns = gridViewColumns(forSize, itemSize, spacing, this.minColumns, this.maxColumns);
|
|
164
|
+
this._listEl.style.gridTemplateColumns = `repeat(${columns}, 1fr)`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
customElements.define('gtk-grid-view', GtkGridView);
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// <gtk-grid> — Gtk.Grid: a table of cells, each the size of its own content unless the
|
|
2
|
+
// grid is asked to make them equal.
|
|
3
|
+
//
|
|
4
|
+
// FOUR SCALAR PROPERTIES, and CSS Grid already has every one of them.
|
|
5
|
+
//
|
|
6
|
+
// `row-spacing` / `column-spacing` the gap between two consecutive rows / columns
|
|
7
|
+
// (gtkgrid.c:429-447: an int, minimum 0, default 0 — the same pspec as `Gtk.Box`'s
|
|
8
|
+
// `spacing`, so `normalizeBoxSpacing` is the same reader for both).
|
|
9
|
+
// `row-homogeneous` / `column-homogeneous` every row the same height / every column the
|
|
10
|
+
// same width (gtkgrid.c:449-470, both default FALSE).
|
|
11
|
+
// `orientation` (GtkOrientable, gtkgrid.c:198-211, :481-484) which way a child with no
|
|
12
|
+
// position of its own is attached: along the columns, or down the rows.
|
|
13
|
+
//
|
|
14
|
+
// PLACEMENT IS SOURCE ORDER, which is what GtkBuilder itself does: a child written without
|
|
15
|
+
// a position is attached at the first free cell ALONG THE ORIENTATION (gtkgrid.c:493-507,
|
|
16
|
+
// `find_attach_position`), which searches the CROSS range that starts at 0 and takes the
|
|
17
|
+
// maximum position along the orientation one — so the child lands at row 0, column N for a
|
|
18
|
+
// horizontal grid, and never wraps. That is `grid-auto-flow: column` here (the implicit
|
|
19
|
+
// grid has no rows, so every item takes the single row and opens a new column), and the
|
|
20
|
+
// vertical case is the mirror. `gtk_grid_attach()` for a named cell is the imperative route
|
|
21
|
+
// and has no markup form here — the gallery trees carry no layout data either, because
|
|
22
|
+
// `SharedTreeNode` has no field for it.
|
|
23
|
+
//
|
|
24
|
+
// WHAT `1fr` IS NOT. GTK sets every line's minimum AND natural to the maximum over all
|
|
25
|
+
// lines (gtkgridlayout.c:703-732), so a homogeneous column is as wide as the WIDEST cell
|
|
26
|
+
// whatever it holds. A `1fr` track instead takes an equal share of the space the grid is
|
|
27
|
+
// given, which is the same answer whenever the grid fills its parent — the shape every
|
|
28
|
+
// block here has, and the shape a `Gtk.Grid` in a window has — and a different one for a
|
|
29
|
+
// shrink-wrapped grid. For ROWS the two only meet when the grid is given a definite height,
|
|
30
|
+
// because an auto-height grid has no free space to share; that is the whole of the
|
|
31
|
+
// divergence and it is declared rather than measured away.
|
|
32
|
+
//
|
|
33
|
+
// A11Y: `role="generic"`, GtkGrid's own accessible role (gtkgrid.c:488).
|
|
34
|
+
//
|
|
35
|
+
// Reference: refs/gtk/gtk/gtkgrid.c:198-211, :429-488, :493-507
|
|
36
|
+
// Reference: refs/gtk/gtk/gtkgridlayout.c:703-732
|
|
37
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
38
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
39
|
+
|
|
40
|
+
import { normalizeBoxOrientation, normalizeBoxSpacing, type BoxOrientation } from '@gjsify/adwaita-core';
|
|
41
|
+
|
|
42
|
+
export class GtkGrid extends HTMLElement {
|
|
43
|
+
static get observedAttributes() {
|
|
44
|
+
return ['column-spacing', 'row-spacing', 'column-homogeneous', 'row-homogeneous', 'orientation'];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** `Gtk.Grid:column-spacing` — the gap between two consecutive columns. Defaults to 0. */
|
|
48
|
+
get columnSpacing(): number {
|
|
49
|
+
return normalizeBoxSpacing(this.getAttribute('column-spacing'));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
set columnSpacing(value: number) {
|
|
53
|
+
this.setAttribute('column-spacing', String(value));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** `Gtk.Grid:row-spacing` — the gap between two consecutive rows. Defaults to 0. */
|
|
57
|
+
get rowSpacing(): number {
|
|
58
|
+
return normalizeBoxSpacing(this.getAttribute('row-spacing'));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
set rowSpacing(value: number) {
|
|
62
|
+
this.setAttribute('row-spacing', String(value));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** `Gtk.Grid:column-homogeneous` — whether every column gets the same width. */
|
|
66
|
+
get columnHomogeneous(): boolean {
|
|
67
|
+
return this.hasAttribute('column-homogeneous');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
set columnHomogeneous(value: boolean) {
|
|
71
|
+
this.toggleAttribute('column-homogeneous', !!value);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** `Gtk.Grid:row-homogeneous` — whether every row gets the same height. */
|
|
75
|
+
get rowHomogeneous(): boolean {
|
|
76
|
+
return this.hasAttribute('row-homogeneous');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
set rowHomogeneous(value: boolean) {
|
|
80
|
+
this.toggleAttribute('row-homogeneous', !!value);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* `GtkOrientable:orientation` — the axis a child with no position of its own is
|
|
85
|
+
* attached along. `horizontal` (the default) appends each one to ROW 0 at the next
|
|
86
|
+
* free column, `vertical` to COLUMN 0 at the next free row.
|
|
87
|
+
*/
|
|
88
|
+
get orientation(): BoxOrientation {
|
|
89
|
+
return normalizeBoxOrientation(this.getAttribute('orientation'));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
set orientation(value: BoxOrientation) {
|
|
93
|
+
this.setAttribute('orientation', value);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
connectedCallback() {
|
|
97
|
+
this.setAttribute('role', 'generic');
|
|
98
|
+
this._sync();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
attributeChangedCallback(name: string, old: string | null, value: string | null) {
|
|
102
|
+
this._sync();
|
|
103
|
+
if (!this.isConnected) return;
|
|
104
|
+
const next = this._normalized(name, value);
|
|
105
|
+
if (next === this._normalized(name, old)) return;
|
|
106
|
+
this.dispatchEvent(new CustomEvent(`notify::${name}`, { bubbles: true, detail: { [name]: next } }));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private _normalized(name: string, raw: string | null): number | boolean | string {
|
|
110
|
+
if (name === 'column-spacing' || name === 'row-spacing') return normalizeBoxSpacing(raw);
|
|
111
|
+
if (name === 'orientation') return normalizeBoxOrientation(raw);
|
|
112
|
+
return raw !== null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private _sync(): void {
|
|
116
|
+
// `gap` takes the ROW axis first, which is the reverse of the pair's alphabetical
|
|
117
|
+
// order here; writing the two longhands keeps the mapping to the two properties
|
|
118
|
+
// visible instead of hiding it in one shorthand.
|
|
119
|
+
this.style.rowGap = `${this.rowSpacing}px`;
|
|
120
|
+
this.style.columnGap = `${this.columnSpacing}px`;
|
|
121
|
+
this.style.gridAutoRows = this.rowHomogeneous ? '1fr' : '';
|
|
122
|
+
this.style.gridAutoColumns = this.columnHomogeneous ? '1fr' : '';
|
|
123
|
+
this.style.gridAutoFlow = this.orientation === 'vertical' ? 'row' : 'column';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
customElements.define('gtk-grid', GtkGrid);
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// <gtk-header-bar> — GTK's titlebar widget: a horizontal bar that packs children at the
|
|
2
|
+
// start and at the end and shows the window's title in the middle, with the window-frame
|
|
3
|
+
// buttons GTK would otherwise ask the window manager for.
|
|
4
|
+
//
|
|
5
|
+
// THE CSS TREE, PORTED VERBATIM (gtkheaderbar.c:99-116, `gtk_header_bar_init` :649-675):
|
|
6
|
+
//
|
|
7
|
+
// headerbar
|
|
8
|
+
// ╰── windowhandle
|
|
9
|
+
// ╰── box
|
|
10
|
+
// ├── box.start ── [windowcontrols.start] ── [other children]
|
|
11
|
+
// ├── [Title Widget]
|
|
12
|
+
// ╰── box.end ──── [other children] ──────── [windowcontrols.end]
|
|
13
|
+
//
|
|
14
|
+
// The centre is the `GtkCenterBox`'s centre child, so the title is centred on the WHOLE bar
|
|
15
|
+
// rather than on the space the two ends leave — which is why `_box` lays out as a flex row
|
|
16
|
+
// with `order` on the three children and the title's own box is `flex: 1`.
|
|
17
|
+
//
|
|
18
|
+
// THE THREE WAYS A CHILD GETS THERE (gtkheaderbar.c:678-701, `gtk_header_bar_pack` :843-861):
|
|
19
|
+
// `start` packs from the start — an APPEND; `end` packs from the end — a PREPEND, so the
|
|
20
|
+
// first `[end]` child sits nearest the edge and each later one lands in front of it; a
|
|
21
|
+
// child with NO type packs from the start. There is no `center` slot: the centre is
|
|
22
|
+
// `title-widget`, and the buildable's `"title"` is the DEPRECATED spelling of it
|
|
23
|
+
// (gtkheaderbar.c:683-686), so both spellings are accepted here as well.
|
|
24
|
+
//
|
|
25
|
+
// THE DERIVED TITLE IS A LABEL, NOT A WINDOW TITLE. `construct_title_label` (gtkheaderbar.c:274-290)
|
|
26
|
+
// builds a plain `GtkLabel` — `title` style class, `valign=center`, no wrap,
|
|
27
|
+
// `single-line-mode`, `ellipsize=END`, `width-chars=5` (MIN_TITLE_CHARS, :117) — and
|
|
28
|
+
// `Gtk.HeaderBar` has no `title` property at all. `update_title` (:250-271) fills it from
|
|
29
|
+
// the ROOT window's title, and failing that from `g_get_application_name()`, and failing
|
|
30
|
+
// THAT from `g_get_prgname()`. This element reproduces the first step against the nearest
|
|
31
|
+
// `<gtk-window>`/`<adw-window>` ancestor; for the two GLib fallbacks — a PROCESS name, which
|
|
32
|
+
// is what those two are — the page's own `<title>` is the only thing a browser has, and it is
|
|
33
|
+
// the same fact one level up. An app that wants something richer sets a `slot="title"`
|
|
34
|
+
// child, which is the whole of `Gtk.HeaderBar:title-widget`.
|
|
35
|
+
//
|
|
36
|
+
// THE EITHER/OR, IN BOTH DIRECTIONS. `gtk_header_bar_set_title_widget` empties the centre
|
|
37
|
+
// bin before installing (:319-341) and rebuilds the derived label when the widget goes back
|
|
38
|
+
// to NULL (:332-336) — so a centre widget takes the title away and GIVING IT BACK restores
|
|
39
|
+
// it, which is the asymmetry `<adw-header-bar>` documents as its own missing half.
|
|
40
|
+
//
|
|
41
|
+
// `show-title-buttons` (default TRUE, :657) is what CREATES the two controls and what
|
|
42
|
+
// REMOVES them again (:798-826): `create_window_controls` builds a `GTK_PACK_START` one,
|
|
43
|
+
// PREPENDS it into the start box and binds `decoration-layout` and `use-native-controls` to
|
|
44
|
+
// it, then builds a `GTK_PACK_END` one, APPENDS it into the end box and binds the same two
|
|
45
|
+
// properties. The `empty`↔`visible` binding beside them (:238, :247) is why a bar with no
|
|
46
|
+
// buttons for its side shows nothing at all. `Gtk.WindowControls` draws those buttons from
|
|
47
|
+
// the FRAME it sits in, so a bar outside a window shows none either way.
|
|
48
|
+
//
|
|
49
|
+
// `default-decoration` — the 37px variant libadwaita draws at `_header-bar.scss:53-75` — is
|
|
50
|
+
// NOT derived here. It is set by `update_default_decoration` (:205-236), and only a
|
|
51
|
+
// `GtkWindow` that installs an EMPTY header bar for itself ever asks for it, through the
|
|
52
|
+
// internal `_gtk_header_bar_track_default_decoration` (:242-248). A bar that has children is
|
|
53
|
+
// never in that mode, and one the page wrote is never empty.
|
|
54
|
+
//
|
|
55
|
+
// A11Y: `role="group"`, GtkHeaderBar's own accessible role (:644).
|
|
56
|
+
//
|
|
57
|
+
// Reference: refs/gtk/gtk/gtkheaderbar.c
|
|
58
|
+
// Reference: refs/libadwaita/src/stylesheet/widgets/_header-bar.scss (GtkHeaderBar)
|
|
59
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
60
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
61
|
+
|
|
62
|
+
import { bindSlottedChildren } from '../slotted-children.js';
|
|
63
|
+
|
|
64
|
+
// Registers <gtk-window-controls>: `show-title-buttons` builds two of them, so importing
|
|
65
|
+
// the bar alone must still define them.
|
|
66
|
+
import './gtk-window-controls.js';
|
|
67
|
+
|
|
68
|
+
export class GtkHeaderBar extends HTMLElement {
|
|
69
|
+
private _initialized = false;
|
|
70
|
+
private _handle!: HTMLDivElement;
|
|
71
|
+
private _box!: HTMLDivElement;
|
|
72
|
+
private _startBox!: HTMLDivElement;
|
|
73
|
+
private _endBox!: HTMLDivElement;
|
|
74
|
+
/** The two `GtkWindowControls`, present only while `show-title-buttons` is true (:798-826). */
|
|
75
|
+
private _startControls: HTMLElement | null = null;
|
|
76
|
+
private _endControls: HTMLElement | null = null;
|
|
77
|
+
/** The derived `GtkLabel`, or `null` while a `title-widget` holds the centre. */
|
|
78
|
+
private _titleLabel: HTMLElement | null = null;
|
|
79
|
+
/** The child that took the centre — read back out of `_box`, never stored as truth. */
|
|
80
|
+
private _centre: HTMLElement | null = null;
|
|
81
|
+
private _centreObserver: MutationObserver | null = null;
|
|
82
|
+
|
|
83
|
+
static get observedAttributes() {
|
|
84
|
+
return ['decoration-layout', 'show-title-buttons'];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** `Gtk.HeaderBar:decoration-layout` — bound to both controls (:231-236, :240-245). */
|
|
88
|
+
get decorationLayout(): string | null {
|
|
89
|
+
return this.getAttribute('decoration-layout');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
set decorationLayout(value: string | null) {
|
|
93
|
+
if (value === null) this.removeAttribute('decoration-layout');
|
|
94
|
+
else this._write('decoration-layout', value);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** `Gtk.HeaderBar:show-title-buttons` — whether the standard frame controls are built. */
|
|
98
|
+
get showTitleButtons(): boolean {
|
|
99
|
+
return this.getAttribute('show-title-buttons') !== 'false';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
set showTitleButtons(value: boolean) {
|
|
103
|
+
this._write('show-title-buttons', String(value));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** `Gtk.HeaderBar:title-widget`, read as the element that holds the centre — or `null`. */
|
|
107
|
+
get titleWidget(): HTMLElement | null {
|
|
108
|
+
return this._centre;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** `setAttribute` for a write that changes nothing; every GObject setter here returns early. */
|
|
112
|
+
private _write(name: string, value: string): void {
|
|
113
|
+
if (this.getAttribute(name) !== value) this.setAttribute(name, value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
connectedCallback() {
|
|
117
|
+
if (this._initialized) {
|
|
118
|
+
this._followCentre();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this._initialized = true;
|
|
122
|
+
|
|
123
|
+
this.setAttribute('role', 'group');
|
|
124
|
+
|
|
125
|
+
this._startBox = document.createElement('div');
|
|
126
|
+
this._startBox.className = 'adw-gtk-header-bar-start';
|
|
127
|
+
this._endBox = document.createElement('div');
|
|
128
|
+
this._endBox.className = 'adw-gtk-header-bar-end';
|
|
129
|
+
this._box = document.createElement('div');
|
|
130
|
+
this._box.className = 'adw-gtk-header-bar-box';
|
|
131
|
+
this._box.append(this._startBox, this._endBox);
|
|
132
|
+
this._handle = document.createElement('div');
|
|
133
|
+
this._handle.className = 'adw-gtk-header-bar-handle';
|
|
134
|
+
this._handle.appendChild(this._box);
|
|
135
|
+
|
|
136
|
+
this._renderTitleButtons();
|
|
137
|
+
|
|
138
|
+
bindSlottedChildren(this, [
|
|
139
|
+
{ name: 'start', into: this._startBox },
|
|
140
|
+
{ name: 'title', into: this._box },
|
|
141
|
+
// The DEPRECATED buildable spelling of the same slot (:683-686), kept because a
|
|
142
|
+
// tree authored at the property position writes it.
|
|
143
|
+
{ name: 'title-widget', into: this._box },
|
|
144
|
+
// `end` is a CONSUME, not an `into` slot: `gtk_header_bar_pack_end` is a PREPEND
|
|
145
|
+
// (gtkheaderbar.c:847-858) and a slot with an `into` is routed with `appendChild`
|
|
146
|
+
// whichever `consume` it also carries, so the two together quietly packed the end
|
|
147
|
+
// in the wrong order.
|
|
148
|
+
{ name: 'end', consume: (node) => this._endBox.prepend(node) },
|
|
149
|
+
// An untyped `<child>` packs from the start (:698).
|
|
150
|
+
{ into: this._startBox },
|
|
151
|
+
]).install(this._handle);
|
|
152
|
+
|
|
153
|
+
this._followCentre();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
disconnectedCallback() {
|
|
157
|
+
this._centreObserver?.disconnect();
|
|
158
|
+
this._centreObserver = null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
attributeChangedCallback(name: string) {
|
|
162
|
+
if (!this._initialized) return;
|
|
163
|
+
if (name === 'show-title-buttons') this._renderTitleButtons();
|
|
164
|
+
else this._bindDecorationLayout();
|
|
165
|
+
this.dispatchEvent(
|
|
166
|
+
new CustomEvent(`notify::${name}`, { bubbles: true, detail: { [name]: this._property(name) } }),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
private _property(name: string): boolean | string | null {
|
|
171
|
+
return name === 'show-title-buttons' ? this.showTitleButtons : this.decorationLayout;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* `create_window_controls` and its inverse, `gtk_header_bar_set_show_title_buttons`
|
|
176
|
+
* (gtkheaderbar.c:198-249, :798-826): the start controls are PREPENDED into the start
|
|
177
|
+
* box, the end controls APPENDED into the end box, and setting the property false
|
|
178
|
+
* REMOVES both — which is why a bar with the property off has no controls at all rather
|
|
179
|
+
* than hidden ones.
|
|
180
|
+
*/
|
|
181
|
+
private _renderTitleButtons(): void {
|
|
182
|
+
if (!this.showTitleButtons) {
|
|
183
|
+
this._startControls?.remove();
|
|
184
|
+
this._endControls?.remove();
|
|
185
|
+
this._startControls = null;
|
|
186
|
+
this._endControls = null;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (this._startControls === null) {
|
|
190
|
+
this._startControls = document.createElement('gtk-window-controls');
|
|
191
|
+
this._startControls.setAttribute('side', 'start');
|
|
192
|
+
this._startBox.prepend(this._startControls);
|
|
193
|
+
this._endControls = document.createElement('gtk-window-controls');
|
|
194
|
+
this._endControls.setAttribute('side', 'end');
|
|
195
|
+
this._endBox.appendChild(this._endControls);
|
|
196
|
+
}
|
|
197
|
+
this._bindDecorationLayout();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** The two `G_BINDING_SYNC_CREATE` bindings onto the controls (:229-247). */
|
|
201
|
+
private _bindDecorationLayout(): void {
|
|
202
|
+
for (const controls of [this._startControls, this._endControls]) {
|
|
203
|
+
if (controls === null) continue;
|
|
204
|
+
const layout = this.decorationLayout;
|
|
205
|
+
if (layout === null) controls.removeAttribute('decoration-layout');
|
|
206
|
+
else controls.setAttribute('decoration-layout', layout);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* The two things `gtk_header_bar_root` connects to (gtkheaderbar.c:362-376): the centre
|
|
212
|
+
* either/or, which changes what belongs in the middle in BOTH directions — `set_title_widget`
|
|
213
|
+
* empties the bin before installing and rebuilds the derived label when it is handed back
|
|
214
|
+
* to NULL (:319-341) — and `notify::title` on the ROOT, which re-runs `update_title`.
|
|
215
|
+
*/
|
|
216
|
+
private _followCentre(): void {
|
|
217
|
+
this._centreObserver?.disconnect();
|
|
218
|
+
this._centreObserver = new MutationObserver(() => this._syncCentre());
|
|
219
|
+
// `_box`'s only other children are the two side boxes and the derived label itself.
|
|
220
|
+
this._centreObserver.observe(this._box, { childList: true });
|
|
221
|
+
const root = this.closest('gtk-window, adw-window');
|
|
222
|
+
if (root !== null) {
|
|
223
|
+
this._centreObserver.observe(root, { attributes: true, attributeFilter: ['title'] });
|
|
224
|
+
}
|
|
225
|
+
this._syncCentre();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** The child of `_box` that is neither a side box nor the derived label. */
|
|
229
|
+
private _centreChild(): HTMLElement | null {
|
|
230
|
+
for (const child of this._box.children) {
|
|
231
|
+
if (child === this._startBox || child === this._endBox || child === this._titleLabel) continue;
|
|
232
|
+
if (child instanceof HTMLElement) return child;
|
|
233
|
+
}
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private _syncCentre(): void {
|
|
238
|
+
this._centre = this._centreChild();
|
|
239
|
+
if (this._centre !== null) this._dropTitleLabel();
|
|
240
|
+
else if (this._titleLabel === null) this._constructTitleLabel();
|
|
241
|
+
else this._updateTitle();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** `construct_title_label` (gtkheaderbar.c:274-290), with `width-chars=5` as CSS. */
|
|
245
|
+
private _constructTitleLabel(): void {
|
|
246
|
+
const label = document.createElement('gtk-label');
|
|
247
|
+
label.className = 'title adw-gtk-header-bar-title';
|
|
248
|
+
this._titleLabel = label;
|
|
249
|
+
this._box.appendChild(label);
|
|
250
|
+
this._updateTitle();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** `gtk_header_bar_set_title_widget`'s first act: the centre bin goes empty (:323). */
|
|
254
|
+
private _dropTitleLabel(): void {
|
|
255
|
+
this._titleLabel?.remove();
|
|
256
|
+
this._titleLabel = null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* `update_title` (gtkheaderbar.c:250-271): the root window's title, then the two GLib
|
|
261
|
+
* process-name fallbacks — which is what the page's own `<title>` stands in for here.
|
|
262
|
+
*/
|
|
263
|
+
private _updateTitle(): void {
|
|
264
|
+
const label = this._titleLabel;
|
|
265
|
+
if (label === null) return;
|
|
266
|
+
const root = this.closest('gtk-window, adw-window');
|
|
267
|
+
const title = root?.getAttribute('title') ?? document.title;
|
|
268
|
+
if (title === '') label.removeAttribute('label');
|
|
269
|
+
else label.setAttribute('label', title);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
customElements.define('gtk-header-bar', GtkHeaderBar);
|