@gjsify/adwaita-web 0.54.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/adwaita-web.css +8146 -3011
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/adw-application-window.spec.d.ts +1 -0
- package/lib/types/adw-bin.spec.d.ts +1 -0
- package/lib/types/adw-breakpoint-bin.spec.d.ts +1 -0
- package/lib/types/adw-clamp-scrollable.spec.d.ts +1 -0
- package/lib/types/adw-multi-layout-view.spec.d.ts +1 -0
- package/lib/types/adw-preferences-row.spec.d.ts +1 -0
- package/lib/types/adw-shortcuts.spec.d.ts +1 -0
- package/lib/types/adw-status-page.spec.d.ts +1 -0
- package/lib/types/adw-tab-bar.spec.d.ts +1 -0
- package/lib/types/adw-tab-button.spec.d.ts +1 -0
- package/lib/types/adw-tab-overview.spec.d.ts +1 -0
- package/lib/types/adw-view-switcher-sidebar.spec.d.ts +1 -0
- package/lib/types/adw-window.spec.d.ts +1 -0
- package/lib/types/attributes.d.ts +19 -0
- package/lib/types/breakpoints.d.ts +14 -3
- package/lib/types/construct-vectors.spec.d.ts +1 -0
- package/lib/types/elements/adw-action-row.d.ts +4 -0
- package/lib/types/elements/adw-application-window.d.ts +27 -0
- package/lib/types/elements/adw-bin.d.ts +17 -0
- package/lib/types/elements/adw-breakpoint-bin.d.ts +67 -0
- package/lib/types/elements/adw-clamp-scrollable.d.ts +38 -0
- package/lib/types/elements/adw-combo-row.d.ts +4 -0
- package/lib/types/elements/adw-dialog.d.ts +10 -0
- package/lib/types/elements/adw-entry-row.d.ts +6 -0
- package/lib/types/elements/adw-expander-row.d.ts +2 -0
- package/lib/types/elements/adw-header-bar.d.ts +6 -0
- package/lib/types/elements/adw-layout-slot.d.ts +19 -0
- package/lib/types/elements/adw-multi-layout-view.d.ts +101 -0
- package/lib/types/elements/adw-overlay-split-view.d.ts +13 -0
- package/lib/types/elements/adw-preferences-row.d.ts +31 -0
- package/lib/types/elements/adw-shortcuts-dialog.d.ts +13 -0
- package/lib/types/elements/adw-shortcuts-item.d.ts +36 -0
- package/lib/types/elements/adw-shortcuts-section.d.ts +14 -0
- package/lib/types/elements/adw-sidebar.d.ts +8 -2
- package/lib/types/elements/adw-spin-row.d.ts +6 -0
- package/lib/types/elements/adw-switch-row.d.ts +7 -0
- package/lib/types/elements/adw-tab-bar.d.ts +108 -0
- package/lib/types/elements/adw-tab-button.d.ts +32 -0
- package/lib/types/elements/adw-tab-overview.d.ts +199 -0
- package/lib/types/elements/adw-tab-view.d.ts +19 -23
- package/lib/types/elements/adw-toggle-group.d.ts +17 -0
- package/lib/types/elements/adw-view-switcher-sidebar.d.ts +84 -0
- package/lib/types/elements/adw-window.d.ts +40 -0
- package/lib/types/elements/gtk-about-dialog.d.ts +146 -0
- package/lib/types/elements/gtk-application-window.d.ts +34 -0
- package/lib/types/elements/gtk-aspect-frame.d.ts +27 -0
- package/lib/types/elements/gtk-button.d.ts +9 -0
- package/lib/types/elements/gtk-calendar.d.ts +159 -0
- package/lib/types/elements/gtk-center-box.d.ts +39 -0
- package/lib/types/elements/gtk-color-dialog-button.d.ts +69 -0
- package/lib/types/elements/gtk-column-view.d.ts +50 -0
- package/lib/types/elements/gtk-drag-icon.d.ts +78 -0
- package/lib/types/elements/gtk-drawing-area.d.ts +95 -0
- package/lib/types/elements/gtk-editable-label.d.ts +33 -0
- package/lib/types/elements/gtk-emoji-chooser.d.ts +84 -0
- package/lib/types/elements/gtk-entry.d.ts +20 -1
- package/lib/types/elements/gtk-expander.d.ts +49 -0
- package/lib/types/elements/gtk-fixed.d.ts +13 -0
- package/lib/types/elements/gtk-flow-box-child.d.ts +14 -0
- package/lib/types/elements/gtk-flow-box.d.ts +87 -0
- package/lib/types/elements/gtk-font-dialog-button.d.ts +83 -0
- package/lib/types/elements/gtk-frame.d.ts +24 -0
- package/lib/types/elements/gtk-gl-area.d.ts +136 -0
- package/lib/types/elements/gtk-graphics-offload.d.ts +24 -0
- package/lib/types/elements/gtk-grid-view.d.ts +39 -0
- package/lib/types/elements/gtk-grid.d.ts +27 -0
- package/lib/types/elements/gtk-header-bar.d.ts +60 -0
- package/lib/types/elements/gtk-inscription.d.ts +64 -0
- package/lib/types/elements/gtk-label.d.ts +3 -0
- package/lib/types/elements/gtk-level-bar.d.ts +59 -0
- package/lib/types/elements/gtk-link-button.d.ts +29 -0
- package/lib/types/elements/gtk-list-box-row.d.ts +54 -0
- package/lib/types/elements/gtk-list-box.d.ts +100 -0
- package/lib/types/elements/gtk-list-view.d.ts +73 -0
- package/lib/types/elements/gtk-media-controls.d.ts +142 -0
- package/lib/types/elements/gtk-notebook.d.ts +148 -0
- package/lib/types/elements/gtk-overlay.d.ts +22 -0
- package/lib/types/elements/gtk-page-setup-unix-dialog.d.ts +87 -0
- package/lib/types/elements/gtk-paned.d.ts +121 -0
- package/lib/types/elements/gtk-password-entry.d.ts +27 -0
- package/lib/types/elements/gtk-picture.d.ts +66 -0
- package/lib/types/elements/gtk-popover-bin.d.ts +82 -0
- package/lib/types/elements/gtk-popover-menu-bar.d.ts +66 -0
- package/lib/types/elements/gtk-popover-menu.d.ts +83 -0
- package/lib/types/elements/gtk-popover.d.ts +28 -3
- package/lib/types/elements/gtk-print-unix-dialog.d.ts +167 -0
- package/lib/types/elements/gtk-revealer.d.ts +55 -0
- package/lib/types/elements/gtk-scale-button.d.ts +59 -0
- package/lib/types/elements/gtk-scale.d.ts +98 -0
- package/lib/types/elements/gtk-scrollbar.d.ts +124 -0
- package/lib/types/elements/gtk-scrolled-window.d.ts +129 -0
- package/lib/types/elements/gtk-search-bar.d.ts +39 -0
- package/lib/types/elements/gtk-search-entry.d.ts +27 -0
- package/lib/types/elements/gtk-separator.d.ts +10 -0
- package/lib/types/elements/gtk-spin-button.d.ts +94 -0
- package/lib/types/elements/gtk-spinner.d.ts +14 -0
- package/lib/types/elements/gtk-stack-sidebar.d.ts +43 -0
- package/lib/types/elements/gtk-stack-switcher.d.ts +58 -0
- package/lib/types/elements/gtk-stack.d.ts +154 -0
- package/lib/types/elements/gtk-switch.d.ts +4 -1
- package/lib/types/elements/gtk-text-view.d.ts +62 -0
- package/lib/types/elements/gtk-text.d.ts +45 -0
- package/lib/types/elements/gtk-toggle-button.d.ts +45 -0
- package/lib/types/elements/gtk-tree-expander.d.ts +38 -0
- package/lib/types/elements/gtk-video.d.ts +97 -0
- package/lib/types/elements/gtk-viewport.d.ts +84 -0
- package/lib/types/elements/gtk-window-controls.d.ts +80 -0
- package/lib/types/elements/gtk-window-handle.d.ts +39 -0
- package/lib/types/elements/gtk-window.d.ts +103 -0
- package/lib/types/elements/justification.d.ts +2 -0
- package/lib/types/elements/popover-menu.d.ts +18 -0
- package/lib/types/elements/roving-focus.d.ts +29 -1
- package/lib/types/emoji-data.d.ts +38 -0
- package/lib/types/font-description.d.ts +96 -0
- package/lib/types/gtk-about-dialog.spec.d.ts +1 -0
- package/lib/types/gtk-action-bar.spec.d.ts +1 -0
- package/lib/types/gtk-application-window.spec.d.ts +1 -0
- package/lib/types/gtk-aspect-frame.spec.d.ts +1 -0
- package/lib/types/gtk-calendar.spec.d.ts +1 -0
- package/lib/types/gtk-center-box.spec.d.ts +1 -0
- package/lib/types/gtk-color-dialog-button.spec.d.ts +1 -0
- package/lib/types/gtk-column-view.spec.d.ts +1 -0
- package/lib/types/gtk-drag-icon.spec.d.ts +1 -0
- package/lib/types/gtk-drawing-area.spec.d.ts +1 -0
- package/lib/types/gtk-editable-label.spec.d.ts +1 -0
- package/lib/types/gtk-emoji-chooser.spec.d.ts +1 -0
- package/lib/types/gtk-expander.spec.d.ts +1 -0
- package/lib/types/gtk-fixed.spec.d.ts +1 -0
- package/lib/types/gtk-flow-box.spec.d.ts +1 -0
- package/lib/types/gtk-font-dialog-button.spec.d.ts +1 -0
- package/lib/types/gtk-frame.spec.d.ts +1 -0
- package/lib/types/gtk-gl-area.spec.d.ts +1 -0
- package/lib/types/gtk-graphics-offload.spec.d.ts +1 -0
- package/lib/types/gtk-grid-view.spec.d.ts +1 -0
- package/lib/types/gtk-grid.spec.d.ts +1 -0
- package/lib/types/gtk-header-bar.spec.d.ts +1 -0
- package/lib/types/gtk-inscription.spec.d.ts +1 -0
- package/lib/types/gtk-level-bar.spec.d.ts +1 -0
- package/lib/types/gtk-link-button.spec.d.ts +1 -0
- package/lib/types/gtk-list-box.spec.d.ts +1 -0
- package/lib/types/gtk-list-view.spec.d.ts +1 -0
- package/lib/types/gtk-media-controls.spec.d.ts +1 -0
- package/lib/types/gtk-notebook.spec.d.ts +1 -0
- package/lib/types/gtk-overlay.spec.d.ts +1 -0
- package/lib/types/gtk-paned.spec.d.ts +1 -0
- package/lib/types/gtk-password-entry.spec.d.ts +1 -0
- package/lib/types/gtk-picture.spec.d.ts +1 -0
- package/lib/types/gtk-popover-bin.spec.d.ts +1 -0
- package/lib/types/gtk-popover-menu-bar.spec.d.ts +1 -0
- package/lib/types/gtk-popover-menu.spec.d.ts +1 -0
- package/lib/types/gtk-popover-role.spec.d.ts +1 -0
- package/lib/types/gtk-popover.spec.d.ts +1 -0
- package/lib/types/gtk-print-dialogs.spec.d.ts +1 -0
- package/lib/types/gtk-revealer.spec.d.ts +1 -0
- package/lib/types/gtk-scale-button.spec.d.ts +1 -0
- package/lib/types/gtk-scale.spec.d.ts +1 -0
- package/lib/types/gtk-scrollbar.spec.d.ts +1 -0
- package/lib/types/gtk-scrolled-window.spec.d.ts +1 -0
- package/lib/types/gtk-search-bar.spec.d.ts +1 -0
- package/lib/types/gtk-search-entry.spec.d.ts +1 -0
- package/lib/types/gtk-separator.spec.d.ts +1 -0
- package/lib/types/gtk-spin-button.spec.d.ts +1 -0
- package/lib/types/gtk-spinner.spec.d.ts +1 -0
- package/lib/types/gtk-stack-sidebar.spec.d.ts +1 -0
- package/lib/types/gtk-stack-switcher.spec.d.ts +1 -0
- package/lib/types/gtk-stack.spec.d.ts +1 -0
- package/lib/types/gtk-text-view.spec.d.ts +1 -0
- package/lib/types/gtk-text.spec.d.ts +1 -0
- package/lib/types/gtk-toggle-button.spec.d.ts +1 -0
- package/lib/types/gtk-tree-expander.spec.d.ts +1 -0
- package/lib/types/gtk-video.spec.d.ts +1 -0
- package/lib/types/gtk-viewport.spec.d.ts +1 -0
- package/lib/types/gtk-window-controls.spec.d.ts +1 -0
- package/lib/types/gtk-window-handle.spec.d.ts +1 -0
- package/lib/types/gtk-window.spec.d.ts +1 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/list-view-dom.d.ts +44 -0
- package/lib/types/namespace/adw.d.ts +12 -0
- package/lib/types/namespace/gtk.d.ts +61 -0
- package/lib/types/page-setup.d.ts +100 -0
- package/lib/types/row-line-clamp.d.ts +20 -0
- package/lib/types/row-tooltip.d.ts +8 -0
- package/lib/types/row-tooltip.spec.d.ts +1 -0
- package/lib/types/scroll-shading.d.ts +15 -1
- package/lib/types/shared-tree-builder.d.ts +75 -17
- package/lib/types/shared-tree-mount.spec.d.ts +1 -0
- package/lib/types/signals.d.ts +4 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/lib/types/tab-chip.d.ts +73 -0
- package/lib/types/template-classes.d.ts +11 -0
- package/lib/types/widget-size.spec.d.ts +1 -0
- package/package.json +12 -8
- package/scss/_action_row.scss +41 -17
- package/scss/_application_window.scss +26 -0
- package/scss/_aspect_frame.scss +25 -0
- package/scss/_bin.scss +26 -0
- package/scss/_button.scss +45 -0
- package/scss/_button_row.scss +5 -0
- package/scss/_calendar.scss +176 -0
- package/scss/_center_box.scss +25 -0
- package/scss/_checks.scss +6 -1
- package/scss/_clamp_scrollable.scss +28 -0
- package/scss/_color_button.scss +67 -0
- package/scss/_column_view.scss +126 -0
- package/scss/_drag_icon.scss +55 -0
- package/scss/_drawing.scss +85 -0
- package/scss/_emoji_chooser.scss +213 -0
- package/scss/_entry.scss +13 -5
- package/scss/_entry_row.scss +1 -1
- package/scss/_expander.scss +113 -0
- package/scss/_expander_row.scss +36 -3
- package/scss/_fixed.scss +29 -0
- package/scss/_flow_box.scss +94 -0
- package/scss/_font_button.scss +63 -0
- package/scss/_frame.scss +41 -0
- package/scss/_grid.scss +19 -0
- package/scss/_grid_view.scss +46 -0
- package/scss/_gtk_about_dialog.scss +186 -0
- package/scss/_headerbar.scss +134 -1
- package/scss/_icons.generated.scss +186 -0
- package/scss/_inscription.scss +125 -0
- package/scss/_level_bar.scss +190 -0
- package/scss/_link.scss +82 -0
- package/scss/_list_box.scss +88 -0
- package/scss/_list_view.scss +96 -0
- package/scss/_media_controls.scss +139 -0
- package/scss/_overlay.scss +68 -0
- package/scss/_paned.scss +130 -0
- package/scss/_password_entry.scss +83 -0
- package/scss/_picture.scss +80 -0
- package/scss/_popover_bin.scss +53 -0
- package/scss/_popover_menu_bar.scss +104 -0
- package/scss/_preferences_row.scss +60 -0
- package/scss/_print_dialogs.scss +328 -0
- package/scss/_reset.scss +21 -19
- package/scss/_revealer.scss +37 -0
- package/scss/_row.scss +36 -5
- package/scss/_scale.scss +298 -0
- package/scss/_scale_button.scss +167 -0
- package/scss/_scrollbar.scss +230 -0
- package/scss/_scrolled_window.scss +131 -0
- package/scss/_search_bar.scss +118 -0
- package/scss/_search_entry.scss +86 -0
- package/scss/_separator.scss +44 -0
- package/scss/_shortcuts_dialog.scss +100 -0
- package/scss/_spin_button.scss +172 -0
- package/scss/_spin_row.scss +56 -8
- package/scss/_spinner.scss +85 -4
- package/scss/_stack.scss +729 -0
- package/scss/_status_page.scss +1 -1
- package/scss/_switch.scss +13 -5
- package/scss/_switch_row.scss +10 -0
- package/scss/_tab_bar.scss +317 -0
- package/scss/_tab_button.scss +98 -0
- package/scss/_tab_overview.scss +483 -0
- package/scss/_text.scss +182 -0
- package/scss/_theme.scss +1 -1
- package/scss/_toggle_group.scss +28 -0
- package/scss/_tree_expander.scss +62 -0
- package/scss/_variables.scss +1 -1
- package/scss/_video.scss +146 -0
- package/scss/_view_switcher_sidebar.scss +112 -0
- package/scss/_viewport.scss +50 -0
- package/scss/_widget.scss +14 -3
- package/scss/_window.scss +131 -2
- package/scss/_window_handle.scss +20 -0
- package/scss/adwaita-skin.scss +109 -0
- package/src/adw-action-rows.spec.ts +331 -0
- package/src/adw-application-window.spec.ts +118 -0
- package/src/adw-bin.spec.ts +75 -0
- package/src/adw-breakpoint-bin.spec.ts +324 -0
- package/src/adw-clamp-scrollable.spec.ts +189 -0
- package/src/adw-header-bar.spec.ts +18 -0
- package/src/adw-multi-layout-view.spec.ts +243 -0
- package/src/adw-preferences-row.spec.ts +164 -0
- package/src/adw-row-state.spec.ts +142 -0
- package/src/adw-shortcuts.spec.ts +155 -0
- package/src/adw-status-page.spec.ts +124 -0
- package/src/adw-tab-bar.spec.ts +287 -0
- package/src/adw-tab-button.spec.ts +101 -0
- package/src/adw-tab-overview.spec.ts +443 -0
- package/src/adw-view-switcher-sidebar.spec.ts +281 -0
- package/src/adw-window.spec.ts +129 -0
- package/src/attributes.ts +52 -0
- package/src/breakpoints.ts +25 -8
- package/src/capabilities.d.mts +3 -0
- package/src/capabilities.mjs +21 -0
- package/src/connect-lifecycle.spec.ts +12 -0
- package/src/construct-vectors.spec.ts +175 -0
- package/src/elements/adw-action-row.ts +31 -2
- package/src/elements/adw-alert-dialog.ts +4 -1
- package/src/elements/adw-application-window.ts +154 -0
- package/src/elements/adw-bin.ts +101 -0
- package/src/elements/adw-breakpoint-bin.ts +287 -0
- package/src/elements/adw-button-row.ts +7 -1
- package/src/elements/adw-clamp-scrollable.ts +207 -0
- package/src/elements/adw-combo-row.ts +26 -1
- package/src/elements/adw-dialog.ts +19 -0
- package/src/elements/adw-entry-row.ts +22 -12
- package/src/elements/adw-expander-row.ts +34 -1
- package/src/elements/adw-header-bar.ts +18 -4
- package/src/elements/adw-layout-slot.ts +95 -0
- package/src/elements/adw-multi-layout-view.ts +326 -0
- package/src/elements/adw-overlay-split-view.ts +29 -6
- package/src/elements/adw-preferences-row.ts +153 -0
- package/src/elements/adw-shortcuts-dialog.ts +52 -0
- package/src/elements/adw-shortcuts-item.ts +171 -0
- package/src/elements/adw-shortcuts-section.ts +86 -0
- package/src/elements/adw-sidebar.ts +74 -7
- package/src/elements/adw-spin-row.ts +37 -2
- package/src/elements/adw-status-page.ts +10 -2
- package/src/elements/adw-switch-row.ts +53 -2
- package/src/elements/adw-tab-bar.ts +529 -0
- package/src/elements/adw-tab-button.ts +194 -0
- package/src/elements/adw-tab-overview.ts +1011 -0
- package/src/elements/adw-tab-view.ts +66 -145
- package/src/elements/adw-toggle-group.ts +138 -14
- package/src/elements/adw-view-stack.ts +18 -0
- package/src/elements/adw-view-switcher-sidebar.ts +332 -0
- package/src/elements/adw-window.ts +190 -11
- package/src/elements/checks.ts +35 -8
- package/src/elements/gtk-about-dialog.ts +811 -0
- package/src/elements/gtk-application-window.ts +108 -0
- package/src/elements/gtk-aspect-frame.ts +160 -0
- package/src/elements/gtk-button.ts +12 -0
- package/src/elements/gtk-calendar.ts +757 -0
- package/src/elements/gtk-center-box.ts +184 -0
- package/src/elements/gtk-color-dialog-button.ts +278 -0
- package/src/elements/gtk-column-view.ts +320 -0
- package/src/elements/gtk-drag-icon.ts +257 -0
- package/src/elements/gtk-drawing-area.ts +303 -0
- package/src/elements/gtk-editable-label.ts +204 -0
- package/src/elements/gtk-emoji-chooser.ts +542 -0
- package/src/elements/gtk-entry.ts +39 -5
- package/src/elements/gtk-expander.ts +301 -0
- package/src/elements/gtk-fixed.ts +99 -0
- package/src/elements/gtk-flow-box-child.ts +68 -0
- package/src/elements/gtk-flow-box.ts +480 -0
- package/src/elements/gtk-font-dialog-button.ts +432 -0
- package/src/elements/gtk-frame.ts +174 -0
- package/src/elements/gtk-gl-area.ts +476 -0
- package/src/elements/gtk-graphics-offload.ts +130 -0
- package/src/elements/gtk-grid-view.ts +168 -0
- package/src/elements/gtk-grid.ts +127 -0
- package/src/elements/gtk-header-bar.ts +273 -0
- package/src/elements/gtk-inscription.ts +387 -0
- package/src/elements/gtk-label.ts +19 -11
- package/src/elements/gtk-level-bar.ts +323 -0
- package/src/elements/gtk-link-button.ts +138 -0
- package/src/elements/gtk-list-box-row.ts +195 -0
- package/src/elements/gtk-list-box.ts +413 -0
- package/src/elements/gtk-list-view.ts +370 -0
- package/src/elements/gtk-media-controls.ts +509 -0
- package/src/elements/gtk-notebook.ts +664 -0
- package/src/elements/gtk-overlay.ts +149 -0
- package/src/elements/gtk-page-setup-unix-dialog.ts +420 -0
- package/src/elements/gtk-paned.ts +597 -0
- package/src/elements/gtk-password-entry.ts +170 -0
- package/src/elements/gtk-picture.ts +254 -0
- package/src/elements/gtk-popover-bin.ts +332 -0
- package/src/elements/gtk-popover-menu-bar.ts +355 -0
- package/src/elements/gtk-popover-menu.ts +339 -0
- package/src/elements/gtk-popover.ts +92 -10
- package/src/elements/gtk-print-unix-dialog.ts +989 -0
- package/src/elements/gtk-progress-bar.ts +24 -11
- package/src/elements/gtk-revealer.ts +406 -0
- package/src/elements/gtk-scale-button.ts +358 -0
- package/src/elements/gtk-scale.ts +492 -0
- package/src/elements/gtk-scrollbar.ts +528 -0
- package/src/elements/gtk-scrolled-window.ts +653 -0
- package/src/elements/gtk-search-bar.ts +200 -0
- package/src/elements/gtk-search-entry.ts +172 -0
- package/src/elements/gtk-separator.ts +52 -0
- package/src/elements/gtk-spin-button.ts +475 -0
- package/src/elements/gtk-spinner.ts +126 -0
- package/src/elements/gtk-stack-sidebar.ts +212 -0
- package/src/elements/gtk-stack-switcher.ts +279 -0
- package/src/elements/gtk-stack.ts +748 -0
- package/src/elements/gtk-switch.ts +52 -19
- package/src/elements/gtk-text-view.ts +290 -0
- package/src/elements/gtk-text.ts +219 -0
- package/src/elements/gtk-toggle-button.ts +239 -0
- package/src/elements/gtk-tree-expander.ts +243 -0
- package/src/elements/gtk-video.ts +423 -0
- package/src/elements/gtk-viewport.ts +277 -0
- package/src/elements/gtk-window-controls.ts +341 -0
- package/src/elements/gtk-window-handle.ts +221 -0
- package/src/elements/gtk-window.ts +372 -0
- package/src/elements/justification.ts +24 -0
- package/src/elements/popover-menu.ts +24 -0
- package/src/elements/roving-focus.ts +53 -21
- package/src/emoji-data.ts +577 -0
- package/src/entry-rows.spec.ts +31 -0
- package/src/font-description.ts +238 -0
- package/src/gtk-about-dialog.spec.ts +250 -0
- package/src/gtk-action-bar.spec.ts +89 -0
- package/src/gtk-application-window.spec.ts +107 -0
- package/src/gtk-aspect-frame.spec.ts +114 -0
- package/src/gtk-calendar.spec.ts +589 -0
- package/src/gtk-center-box.spec.ts +125 -0
- package/src/gtk-color-dialog-button.spec.ts +141 -0
- package/src/gtk-column-view.spec.ts +154 -0
- package/src/gtk-drag-icon.spec.ts +190 -0
- package/src/gtk-drawing-area.spec.ts +211 -0
- package/src/gtk-editable-label.spec.ts +190 -0
- package/src/gtk-emoji-chooser.spec.ts +173 -0
- package/src/gtk-entry.spec.ts +23 -0
- package/src/gtk-expander.spec.ts +170 -0
- package/src/gtk-fixed.spec.ts +97 -0
- package/src/gtk-flow-box.spec.ts +289 -0
- package/src/gtk-font-dialog-button.spec.ts +166 -0
- package/src/gtk-frame.spec.ts +119 -0
- package/src/gtk-gl-area.spec.ts +361 -0
- package/src/gtk-graphics-offload.spec.ts +119 -0
- package/src/gtk-grid-view.spec.ts +106 -0
- package/src/gtk-grid.spec.ts +122 -0
- package/src/gtk-header-bar.spec.ts +202 -0
- package/src/gtk-inscription.spec.ts +235 -0
- package/src/gtk-level-bar.spec.ts +199 -0
- package/src/gtk-link-button.spec.ts +117 -0
- package/src/gtk-list-box.spec.ts +422 -0
- package/src/gtk-list-view.spec.ts +203 -0
- package/src/gtk-media-controls.spec.ts +295 -0
- package/src/gtk-notebook.spec.ts +546 -0
- package/src/gtk-overlay.spec.ts +141 -0
- package/src/gtk-paned.spec.ts +267 -0
- package/src/gtk-password-entry.spec.ts +150 -0
- package/src/gtk-picture.spec.ts +172 -0
- package/src/gtk-popover-bin.spec.ts +229 -0
- package/src/gtk-popover-menu-bar.spec.ts +296 -0
- package/src/gtk-popover-menu.spec.ts +261 -0
- package/src/gtk-popover-role.spec.ts +138 -0
- package/src/gtk-popover.spec.ts +264 -0
- package/src/gtk-print-dialogs.spec.ts +251 -0
- package/src/gtk-revealer.spec.ts +164 -0
- package/src/gtk-scale-button.spec.ts +218 -0
- package/src/gtk-scale.spec.ts +213 -0
- package/src/gtk-scrollbar.spec.ts +244 -0
- package/src/gtk-scrolled-window.spec.ts +262 -0
- package/src/gtk-search-bar.spec.ts +179 -0
- package/src/gtk-search-entry.spec.ts +142 -0
- package/src/gtk-separator.spec.ts +74 -0
- package/src/gtk-spin-button.spec.ts +186 -0
- package/src/gtk-spinner.spec.ts +130 -0
- package/src/gtk-stack-sidebar.spec.ts +217 -0
- package/src/gtk-stack-switcher.spec.ts +249 -0
- package/src/gtk-stack.spec.ts +432 -0
- package/src/gtk-text-view.spec.ts +189 -0
- package/src/gtk-text.spec.ts +163 -0
- package/src/gtk-toggle-button.spec.ts +186 -0
- package/src/gtk-tree-expander.spec.ts +201 -0
- package/src/gtk-video.spec.ts +240 -0
- package/src/gtk-viewport.spec.ts +140 -0
- package/src/gtk-window-controls.spec.ts +232 -0
- package/src/gtk-window-handle.spec.ts +158 -0
- package/src/gtk-window.spec.ts +202 -0
- package/src/index.ts +9 -1
- package/src/keyboard-operable.spec.ts +77 -9
- package/src/list-view-dom.ts +121 -0
- package/src/namespace/adw.ts +12 -0
- package/src/namespace/gtk.ts +61 -0
- package/src/page-setup.ts +222 -0
- package/src/row-line-clamp.ts +74 -0
- package/src/row-tooltip.spec.ts +313 -0
- package/src/row-tooltip.ts +52 -0
- package/src/scroll-shading.ts +18 -1
- package/src/shared-tree-builder.ts +336 -41
- package/src/shared-tree-mount.spec.ts +130 -0
- package/src/shared-trees.spec.ts +15 -0
- package/src/signals.ts +15 -0
- package/src/style-classes.spec.ts +9 -8
- package/src/styles.generated.ts +1 -1
- package/src/tab-chip.ts +200 -0
- package/src/template-classes.ts +45 -0
- package/src/test.browser.mts +160 -0
- package/src/widget-size.spec.ts +117 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// <gtk-expander> — a title the user clicks to reveal or hide the child below it.
|
|
2
|
+
//
|
|
3
|
+
// The CSS node tree is the specification, and it is a five-node one (gtkexpander.c:95-109):
|
|
4
|
+
//
|
|
5
|
+
// expander-widget
|
|
6
|
+
// ╰── box
|
|
7
|
+
// ├── title
|
|
8
|
+
// │ ├── expander the disclosure arrow
|
|
9
|
+
// │ ╰── <label widget>
|
|
10
|
+
// ╰── <child>
|
|
11
|
+
//
|
|
12
|
+
// so the element builds a box with a title row above a content row, exactly as
|
|
13
|
+
// `gtk_expander_init` does (gtkexpander.c:413-423), and the arrow is its OWN node carrying
|
|
14
|
+
// `:checked` when the child is showing — "The arrow of an expander that is showing its child
|
|
15
|
+
// gets the `:checked` pseudoclass set on it", which `gtk_expander_set_expanded` does in both
|
|
16
|
+
// directions (gtkexpander.c:897-900). Here the pseudoclass is the `.checked` class the rest
|
|
17
|
+
// of this stylesheet already stands in for it with, and `_expander.scss` swaps the glyph.
|
|
18
|
+
//
|
|
19
|
+
// FIVE attributes:
|
|
20
|
+
//
|
|
21
|
+
// expanded the disclosure itself. `toggleAttribute` is idempotent, so "notify only
|
|
22
|
+
// on a real change" needs no guard — and `gtk_expander_set_expanded`
|
|
23
|
+
// returns early when nothing changed (gtkexpander.c:892-894), which is the
|
|
24
|
+
// same statement.
|
|
25
|
+
// label TEXT, and GTK makes a real `GtkLabel` out of it
|
|
26
|
+
// (gtkexpander.c:974-979), with `use-underline` and `use-markup` forwarded
|
|
27
|
+
// to it. So `label` becomes a `<gtk-label>` carrying the same two, and
|
|
28
|
+
// `labelDisplayText` — the one derivation this package already shares with
|
|
29
|
+
// the NativeScript port — is what reduces markup and mnemonic markers, as
|
|
30
|
+
// `<gtk-label>` does for itself.
|
|
31
|
+
// use-markup forwarded to the label.
|
|
32
|
+
// use-underline forwarded to the label, AND it is what makes `Alt`+the marked character
|
|
33
|
+
// activate the expander — `gtk_expander_new_with_mnemonic`'s documented
|
|
34
|
+
// contract (gtkexpander.c:856-860) and `update_accessible_mnemonic`
|
|
35
|
+
// (:811-831), which also publishes `Alt+X` as the widget's KEY_SHORTCUTS.
|
|
36
|
+
// resize-toplevel whether to ask the window to grow with the disclosure. Observed and
|
|
37
|
+
// reflected to a `.resize-toplevel` class, because
|
|
38
|
+
// `gtk_expander_resize_toplevel` (gtkexpander.c:737-750) can only call
|
|
39
|
+
// `gtk_widget_queue_resize` on a `GtkWindow` — a browser document already
|
|
40
|
+
// reflows itself around a box that changed height, so the flag is the whole
|
|
41
|
+
// of what this side can act on.
|
|
42
|
+
//
|
|
43
|
+
// `label-widget` is a SLOT rather than an attribute: it is `GTK_TYPE_WIDGET`
|
|
44
|
+
// (gtkexpander.c:351-353), and a string cannot carry one. `label` and a `slot="label"` child
|
|
45
|
+
// are mutually exclusive — `gtk_expander_set_label` NULLS the label widget
|
|
46
|
+
// (gtkexpander.c:969-970) and `set_label_widget` takes it (:1099-1142) — and GTK's precedence
|
|
47
|
+
// is the one kept here: the widget wins.
|
|
48
|
+
//
|
|
49
|
+
// The 500ms `expand_timer` drag-hover auto-expansion (gtkexpander.c:136, :240-257) is NOT
|
|
50
|
+
// ported, and it is a gesture rather than a property, so there is no KNOWN_GAPS entry for
|
|
51
|
+
// it: it hangs off a `GtkDropControllerMotion` reacting to a drag passing over the expander,
|
|
52
|
+
// and a browser has no drag-over-a-widget event to put a timer on. `pointerenter` is not
|
|
53
|
+
// that gesture, and pretending it is would expand on a hover the C never honours.
|
|
54
|
+
//
|
|
55
|
+
// A11Y: GTK gives the widget `GTK_ACCESSIBLE_ROLE_BUTTON` (gtkexpander.c:393) and keeps
|
|
56
|
+
// `GTK_ACCESSIBLE_STATE_EXPANDED` on it in step with the flag (:927-929). The role, the
|
|
57
|
+
// `aria-expanded` state and the Tab stop go on the TITLE rather than on the host, because
|
|
58
|
+
// the title is what the pointer presses and what `gtk_expander_focus` cycles through as its
|
|
59
|
+
// own site; `<adw-expander-row>` took the same decision for its header. `aria-controls`
|
|
60
|
+
// names the content row, which is GTK's `GTK_ACCESSIBLE_RELATION_CONTROLS` set when the
|
|
61
|
+
// child is parented and reset when it is unparented (gtkexpander.c:913-921, :1236-1244).
|
|
62
|
+
//
|
|
63
|
+
// Reference: refs/gtk/gtk/gtkexpander.c (every property, the node tree, activate, focus)
|
|
64
|
+
// Reference: refs/libadwaita/src/stylesheet/widgets/_expanders.scss
|
|
65
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
66
|
+
// Copyright (c) GNOME contributors (libadwaita). LGPLv2.1+.
|
|
67
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
68
|
+
|
|
69
|
+
import { labelDisplayText } from '@gjsify/adwaita-core';
|
|
70
|
+
|
|
71
|
+
import { bindEmptySections } from '../empty-sections.js';
|
|
72
|
+
import { bindSlottedChildren } from '../slotted-children.js';
|
|
73
|
+
import { createGtkImage } from './gtk-image.js';
|
|
74
|
+
import { attachRowActivation } from './row-activation.js';
|
|
75
|
+
|
|
76
|
+
// SIDE-EFFECT import, deliberately separate from the type import below — see the same note
|
|
77
|
+
// in `adw-expander-row.ts`: `import { GtkLabel }` used only in type position would be
|
|
78
|
+
// elided by TypeScript and take the `customElements.define` with it.
|
|
79
|
+
import './gtk-label.js';
|
|
80
|
+
import type { GtkLabel } from './gtk-label.js';
|
|
81
|
+
|
|
82
|
+
/** `expander { -gtk-icon-source: -gtk-icontheme('pan-end-symbolic') }` (_expanders.scss). */
|
|
83
|
+
const ARROW_ICON = 'pan-end';
|
|
84
|
+
|
|
85
|
+
/** Stable ids for the `aria-controls` relation, which GTK sets on the child itself. */
|
|
86
|
+
let labelChildCounter = 0;
|
|
87
|
+
|
|
88
|
+
export class GtkExpander extends HTMLElement {
|
|
89
|
+
private _box!: HTMLDivElement;
|
|
90
|
+
private _titleEl!: HTMLDivElement;
|
|
91
|
+
private _arrowEl!: HTMLElement;
|
|
92
|
+
private _labelEl!: GtkLabel;
|
|
93
|
+
private _labelSection!: HTMLDivElement;
|
|
94
|
+
private _contentEl!: HTMLDivElement;
|
|
95
|
+
private _initialized = false;
|
|
96
|
+
|
|
97
|
+
static get observedAttributes() {
|
|
98
|
+
return ['expanded', 'label', 'use-markup', 'use-underline', 'resize-toplevel'];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** `Gtk.Expander:expanded` — whether the child is revealed. */
|
|
102
|
+
get expanded(): boolean {
|
|
103
|
+
return this.hasAttribute('expanded');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
set expanded(value: boolean) {
|
|
107
|
+
this.toggleAttribute('expanded', !!value);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** `Gtk.Expander:label` — the title TEXT, or `null` when a label widget is in its place. */
|
|
111
|
+
get label(): string | null {
|
|
112
|
+
return this.labelWidget === null ? this.getAttribute('label') : null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
set label(value: string | null) {
|
|
116
|
+
if (value === null) this.removeAttribute('label');
|
|
117
|
+
else this.setAttribute('label', value);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** `Gtk.Expander:use-markup` — whether the label is Pango markup. */
|
|
121
|
+
get useMarkup(): boolean {
|
|
122
|
+
return this.hasAttribute('use-markup');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
set useMarkup(value: boolean) {
|
|
126
|
+
this.toggleAttribute('use-markup', !!value);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** `Gtk.Expander:use-underline` — whether `_` in the label marks a mnemonic. */
|
|
130
|
+
get useUnderline(): boolean {
|
|
131
|
+
return this.hasAttribute('use-underline');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
set useUnderline(value: boolean) {
|
|
135
|
+
this.toggleAttribute('use-underline', !!value);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** `Gtk.Expander:resize-toplevel` — reflected, because a document reflows itself. */
|
|
139
|
+
get resizeToplevel(): boolean {
|
|
140
|
+
return this.hasAttribute('resize-toplevel');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
set resizeToplevel(value: boolean) {
|
|
144
|
+
this.toggleAttribute('resize-toplevel', !!value);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** `Gtk.Expander:child` — the light-DOM node in the content row. */
|
|
148
|
+
get child(): Element | null {
|
|
149
|
+
return this._contentEl?.firstElementChild ?? null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** `Gtk.Expander:label-widget` — the light-DOM node standing in for the label text. */
|
|
153
|
+
get labelWidget(): Element | null {
|
|
154
|
+
return this._labelSection?.firstElementChild ?? null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
connectedCallback() {
|
|
158
|
+
if (this._initialized) return;
|
|
159
|
+
this._initialized = true;
|
|
160
|
+
|
|
161
|
+
this._arrowEl = createGtkImage(ARROW_ICON, 'adw-expander-arrow');
|
|
162
|
+
this._labelEl = document.createElement('gtk-label') as GtkLabel;
|
|
163
|
+
this._labelSection = document.createElement('div');
|
|
164
|
+
this._labelSection.className = 'adw-expander-label';
|
|
165
|
+
|
|
166
|
+
this._titleEl = document.createElement('div');
|
|
167
|
+
this._titleEl.className = 'adw-expander-title';
|
|
168
|
+
// The title is the button: GTK gives the widget the button role, and the title is
|
|
169
|
+
// what its gesture (gtkexpander.c:430-439) and its focus sites act on.
|
|
170
|
+
this._titleEl.setAttribute('role', 'button');
|
|
171
|
+
this._titleEl.append(this._arrowEl, this._labelEl, this._labelSection);
|
|
172
|
+
|
|
173
|
+
this._contentEl = document.createElement('div');
|
|
174
|
+
this._contentEl.className = 'adw-expander-content';
|
|
175
|
+
|
|
176
|
+
this._box = document.createElement('div');
|
|
177
|
+
this._box.className = 'adw-expander-box';
|
|
178
|
+
this._box.append(this._titleEl, this._contentEl);
|
|
179
|
+
|
|
180
|
+
// `label-widget` is the GIR name of the slot and `label` is GtkBuildable's legacy
|
|
181
|
+
// spelling for it (`gtk_expander_buildable_add_child`, gtkexpander.c:454-457), so
|
|
182
|
+
// both are accepted; the bare child is the disclosed `child`.
|
|
183
|
+
bindSlottedChildren(this, [
|
|
184
|
+
{ name: 'label-widget', into: this._labelSection },
|
|
185
|
+
{ name: 'label', into: this._labelSection },
|
|
186
|
+
{ name: 'child', into: this._contentEl },
|
|
187
|
+
{ into: this._contentEl },
|
|
188
|
+
]).install(this._box);
|
|
189
|
+
|
|
190
|
+
// AFTER the routing, for the reason `adw-expander-row` gives: this derives once
|
|
191
|
+
// synchronously, so a section the routing has not filled yet would be hidden by a
|
|
192
|
+
// declared label that had already earned its place.
|
|
193
|
+
bindEmptySections(this._labelSection);
|
|
194
|
+
|
|
195
|
+
this._titleEl.addEventListener('click', () => this._activate());
|
|
196
|
+
attachRowActivation({ row: this._titleEl, activatable: () => true });
|
|
197
|
+
// `update_accessible_mnemonic` binds the FIRST marked character only
|
|
198
|
+
// (gtk_label_get_mnemonic_keyval), and `Alt`+it activates the widget.
|
|
199
|
+
this._titleEl.addEventListener('keydown', this._onKeyDown);
|
|
200
|
+
|
|
201
|
+
this._render();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
attributeChangedCallback(name: string) {
|
|
205
|
+
if (!this._initialized) return;
|
|
206
|
+
this._render();
|
|
207
|
+
this.dispatchEvent(
|
|
208
|
+
new CustomEvent(`notify::${name}`, { bubbles: true, detail: { [name]: this._detail(name) } }),
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
private _detail(name: string): unknown {
|
|
213
|
+
switch (name) {
|
|
214
|
+
case 'expanded':
|
|
215
|
+
return this.expanded;
|
|
216
|
+
case 'label':
|
|
217
|
+
return this.label;
|
|
218
|
+
case 'use-markup':
|
|
219
|
+
return this.useMarkup;
|
|
220
|
+
case 'use-underline':
|
|
221
|
+
return this.useUnderline;
|
|
222
|
+
default:
|
|
223
|
+
return this.resizeToplevel;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** `gtk_expander_activate` (gtkexpander.c:786-792) — the one thing the widget does. */
|
|
228
|
+
private _activate(): void {
|
|
229
|
+
this.expanded = !this.expanded;
|
|
230
|
+
this.dispatchEvent(new CustomEvent('activate', { bubbles: true, detail: { expanded: this.expanded } }));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* `Alt`+the marked character, as `gtk_expander_new_with_mnemonic` documents
|
|
235
|
+
* (gtkexpander.c:856-860): "Pressing Alt and that key activates the button."
|
|
236
|
+
*/
|
|
237
|
+
private readonly _onKeyDown = (event: KeyboardEvent): void => {
|
|
238
|
+
if (!this.useUnderline || !event.altKey || event.ctrlKey || event.metaKey) return;
|
|
239
|
+
const mnemonic = this._mnemonic();
|
|
240
|
+
// `gdk_keyval_name (gdk_keyval_to_upper (keyval))` — the marked character, so the
|
|
241
|
+
// binding is the letter and not the keycode.
|
|
242
|
+
if (mnemonic === null || (event.key.length === 1 ? event.key.toUpperCase() : '') !== mnemonic) return;
|
|
243
|
+
event.preventDefault();
|
|
244
|
+
this._activate();
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* The single character `use-underline` marks, or `null` when none does.
|
|
249
|
+
*
|
|
250
|
+
* The walk is `stripMnemonic`'s, for the reason that function gives: a `_` takes the
|
|
251
|
+
* character after it and is itself removed, `__` is an escaped literal underscore and
|
|
252
|
+
* marks nothing, and a trailing marker has no character to take.
|
|
253
|
+
*/
|
|
254
|
+
private _mnemonic(): string | null {
|
|
255
|
+
const characters = [...(this.getAttribute('label') ?? '')];
|
|
256
|
+
for (let index = 0; index < characters.length; index += 1) {
|
|
257
|
+
if (characters[index] !== '_') continue;
|
|
258
|
+
const next = characters[index + 1];
|
|
259
|
+
if (next === undefined) return null;
|
|
260
|
+
index += 1;
|
|
261
|
+
if (next === '_') continue;
|
|
262
|
+
return next.toUpperCase();
|
|
263
|
+
}
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private _render(): void {
|
|
268
|
+
// `gtk_expander_set_expanded` puts the state on the ARROW node, not on the widget.
|
|
269
|
+
this._arrowEl.classList.toggle('checked', this.expanded);
|
|
270
|
+
this.classList.toggle('expanded', this.expanded);
|
|
271
|
+
this._titleEl.setAttribute('aria-expanded', String(this.expanded));
|
|
272
|
+
// The C parents the child into the box only while expanded and unparents it when
|
|
273
|
+
// not (gtkexpander.c:909-923), so a collapsed expander neither lays out nor
|
|
274
|
+
// allocates it.
|
|
275
|
+
this._contentEl.hidden = !this.expanded;
|
|
276
|
+
|
|
277
|
+
// GTK's precedence: `set_label` NULLS the label widget (gtkexpander.c:969-970) and
|
|
278
|
+
// `set_label_widget` takes it, so the two are mutually exclusive.
|
|
279
|
+
const widget = this.labelWidget;
|
|
280
|
+
this._labelEl.hidden = widget !== null || this.label === null;
|
|
281
|
+
if (widget === null) {
|
|
282
|
+
// The very reduction `<gtk-label>` applies to its own `label`, so the two agree on
|
|
283
|
+
// what the same string displays.
|
|
284
|
+
this._labelEl.setAttribute('label', labelDisplayText(this.label ?? '', this.useMarkup, this.useUnderline));
|
|
285
|
+
this._labelEl.toggleAttribute('use-markup', this.useMarkup);
|
|
286
|
+
this._labelEl.toggleAttribute('use-underline', this.useUnderline);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const child = this.child;
|
|
290
|
+
if (child === null) {
|
|
291
|
+
this._titleEl.removeAttribute('aria-controls');
|
|
292
|
+
} else if (this._titleEl.getAttribute('aria-controls') === null) {
|
|
293
|
+
if (child.id === '') child.id = `gtk-expander-content-${labelChildCounter++}`;
|
|
294
|
+
this._titleEl.setAttribute('aria-controls', child.id);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
this.classList.toggle('resize-toplevel', this.resizeToplevel);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
customElements.define('gtk-expander', GtkExpander);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// <gtk-fixed> — Gtk.Fixed: children at pixel positions, and nothing else.
|
|
2
|
+
//
|
|
3
|
+
// NO PROPERTIES AT ALL, which is the shape of the widget: `Gtk.Fixed` declares none in the
|
|
4
|
+
// GIR because every child carries its own, and `gtk_fixed_put(child, x, y)` is the whole
|
|
5
|
+
// API (gtkfixed.c:213-240). So the markup form of a position is the CHILD's own CSS
|
|
6
|
+
// offset — `style="left:20px;top:10px"`, which is what `put()` writes and what it reads
|
|
7
|
+
// back — and `put()` / `move()` are here as the imperative route, so a caller that has the
|
|
8
|
+
// child in hand does not have to spell a string.
|
|
9
|
+
//
|
|
10
|
+
// `gtk_fixed_buildable_add_child` puts a child written without a position at 0, 0
|
|
11
|
+
// (gtkfixed.c:171-177), so an unpositioned child lands there too: `left`/`top` start at
|
|
12
|
+
// `0` rather than CSS's `auto`, which for an absolutely positioned box resolves to its
|
|
13
|
+
// STATIC position instead — a different answer, and the one that would silently stack
|
|
14
|
+
// every child where the markup happens to read.
|
|
15
|
+
//
|
|
16
|
+
// THE ONE MEASUREMENT. A child that is out of flow contributes nothing to its parent's
|
|
17
|
+
// size, so a fixed whose children are absolutely positioned would collapse to zero without
|
|
18
|
+
// this. `gtk_fixed_layout_measure` returns the union of the children's rectangles
|
|
19
|
+
// (gtkfixedlayout.c:224-300): the fixed's minimum and natural size are
|
|
20
|
+
// `MAX (x + width)` and `MAX (y + height)` over the children it should lay out. A CSS box
|
|
21
|
+
// cannot hold a minimum and a natural size, so the union is written as the box's own
|
|
22
|
+
// `min-width` / `min-height`, which is the measurement GTK keeps and the one that decides
|
|
23
|
+
// how much space the fixed asks its parent for.
|
|
24
|
+
//
|
|
25
|
+
// `gtk_fixed_init` sets `GTK_OVERFLOW_HIDDEN` (gtkfixed.c:189-195), so the fixed clips a
|
|
26
|
+
// child that reaches past the union — here the union is exactly the children, so nothing
|
|
27
|
+
// is clipped and the rule is there for a child positioned negatively.
|
|
28
|
+
//
|
|
29
|
+
// A11Y: GtkFixed declares no accessible role, so none is set.
|
|
30
|
+
//
|
|
31
|
+
// Reference: refs/gtk/gtk/gtkfixed.c:171-177, :189-195, :213-240
|
|
32
|
+
// Reference: refs/gtk/gtk/gtkfixedlayout.c:224-300
|
|
33
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
34
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
35
|
+
|
|
36
|
+
export class GtkFixed extends HTMLElement {
|
|
37
|
+
private _resize: ResizeObserver | null = null;
|
|
38
|
+
private _mutations: MutationObserver | null = null;
|
|
39
|
+
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
// Neither observer is guarded by a build flag, and that is the shape
|
|
42
|
+
// `check-adwaita-connect-rebind.mjs` asks for: a re-parent runs this whole body
|
|
43
|
+
// again, so the element comes back listening rather than deaf.
|
|
44
|
+
this._resize = new ResizeObserver(() => this._size());
|
|
45
|
+
this._resize.observe(this);
|
|
46
|
+
this._mutations = new MutationObserver(() => {
|
|
47
|
+
this._observeChildren();
|
|
48
|
+
this._size();
|
|
49
|
+
});
|
|
50
|
+
this._mutations.observe(this, { childList: true });
|
|
51
|
+
this._observeChildren();
|
|
52
|
+
this._size();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
disconnectedCallback() {
|
|
56
|
+
this._resize?.disconnect();
|
|
57
|
+
this._resize = null;
|
|
58
|
+
this._mutations?.disconnect();
|
|
59
|
+
this._mutations = null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** `gtk_fixed_put()` — a child and the position it sits at, both relative to the fixed. */
|
|
63
|
+
put(child: HTMLElement, x: number, y: number): void {
|
|
64
|
+
if (child.parentNode !== this) this.append(child);
|
|
65
|
+
this.move(child, x, y);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** `gtk_fixed_move()` — the same position for a child already in this fixed. */
|
|
69
|
+
move(child: HTMLElement, x: number, y: number): void {
|
|
70
|
+
child.style.left = `${x}px`;
|
|
71
|
+
child.style.top = `${y}px`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private _observeChildren(): void {
|
|
75
|
+
if (this._resize === null) return;
|
|
76
|
+
for (const child of this.children) {
|
|
77
|
+
if (child instanceof HTMLElement) this._resize.observe(child);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** `gtk_fixed_layout_measure`: the union of the children's rectangles, as one box. */
|
|
82
|
+
private _size(): void {
|
|
83
|
+
let width = 0;
|
|
84
|
+
let height = 0;
|
|
85
|
+
for (const child of this.children) {
|
|
86
|
+
if (!(child instanceof HTMLElement)) continue;
|
|
87
|
+
width = Math.max(width, child.offsetLeft + child.offsetWidth);
|
|
88
|
+
height = Math.max(height, child.offsetTop + child.offsetHeight);
|
|
89
|
+
}
|
|
90
|
+
// Written only on a real change, so a resize that finds the same union cannot feed
|
|
91
|
+
// its own observer.
|
|
92
|
+
const nextWidth = `${width}px`;
|
|
93
|
+
const nextHeight = `${height}px`;
|
|
94
|
+
if (this.style.minWidth !== nextWidth) this.style.minWidth = nextWidth;
|
|
95
|
+
if (this.style.minHeight !== nextHeight) this.style.minHeight = nextHeight;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
customElements.define('gtk-fixed', GtkFixed);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// <gtk-flow-box-child> — one cell of a `Gtk.FlowBox`: the child that fills it, the web
|
|
2
|
+
// counterpart of `Gtk.FlowBoxChild`.
|
|
3
|
+
//
|
|
4
|
+
// ONE PROPERTY, ONE SIGNAL. `GtkFlowBoxChild` declares `child` (:542-543) and `activate`
|
|
5
|
+
// (:563-571) and nothing else — no `activatable`, no `selectable`, unlike its sibling
|
|
6
|
+
// `GtkListBoxRow`. The box asks each child whether it is selected through the child itself
|
|
7
|
+
// (`gtk_flow_box_child_set_selected`, gtkflowbox.c:943-962), which raises the
|
|
8
|
+
// `GTK_STATE_FLAG_SELECTED` widget state and the `GTK_ACCESSIBLE_STATE_SELECTED` accessible
|
|
9
|
+
// state, and there is no property a caller writes to ask for either. So this element has no
|
|
10
|
+
// observed attribute of its own: the parent writes the `selected` CLASS and the
|
|
11
|
+
// `aria-selected` attribute, and the CHILD publishes a `selected` getter over the class.
|
|
12
|
+
//
|
|
13
|
+
// `child` is a WIDGET property, so it is a slot here (gtkflowbox.c:610-628): the authored
|
|
14
|
+
// child lands in the node `gtk_flow_box_child_set_child` would put it in, and a child appended
|
|
15
|
+
// after connect lands there too.
|
|
16
|
+
//
|
|
17
|
+
// A11Y: `gridcell`, which is what GTK declares unconditionally (:573). The box is a
|
|
18
|
+
// `GTK_ACCESSIBLE_ROLE_GRID` (:3973) — a `grid` whose cells are `gridcell`s, not the
|
|
19
|
+
// `list`/`option` pairing a list box uses, because a flow box wraps in more than one
|
|
20
|
+
// direction.
|
|
21
|
+
//
|
|
22
|
+
// Reference: refs/gtk/gtk/gtkflowbox.c:277-282 (child property), :542-582 (class init, the
|
|
23
|
+
// activate signal, the css name and role), :610-628 (set_child), :943-962 (set_selected)
|
|
24
|
+
// Reference: refs/libadwaita/src/stylesheet/widgets/_views.scss:52-91 (flowbox > flowboxchild)
|
|
25
|
+
// Copyright (c) GNOME contributors (GTK/libadwaita). LGPLv2.1+.
|
|
26
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
27
|
+
|
|
28
|
+
import { bindSlottedChildren } from '../slotted-children.js';
|
|
29
|
+
|
|
30
|
+
export class GtkFlowBoxChild extends HTMLElement {
|
|
31
|
+
private _contentsEl!: HTMLDivElement;
|
|
32
|
+
private _initialized = false;
|
|
33
|
+
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
if (this._initialized) return;
|
|
36
|
+
this._initialized = true;
|
|
37
|
+
|
|
38
|
+
this._contentsEl = document.createElement('div');
|
|
39
|
+
this._contentsEl.className = 'adw-flow-box-child-contents';
|
|
40
|
+
|
|
41
|
+
bindSlottedChildren(this, [{ into: this._contentsEl }]).install(this._contentsEl);
|
|
42
|
+
|
|
43
|
+
this.setAttribute('role', 'gridcell');
|
|
44
|
+
// `gtk_flow_box_child_init` makes the cell focusable (:578-580) — the box's cursor
|
|
45
|
+
// lives here, and Enter/Space is the box's `activate-cursor-child`.
|
|
46
|
+
this.tabIndex = 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** `GtkFlowBoxChild:child`, as the light-DOM child it already is. */
|
|
50
|
+
get child(): Element | null {
|
|
51
|
+
return this._contentsEl.firstElementChild;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Where this child sits in its box, or -1 while it has no box. */
|
|
55
|
+
get index(): number {
|
|
56
|
+
return this.parentElement ? [...this.parentElement.children].indexOf(this) : -1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* `gtk_flow_box_child_is_selected` — read over the class the box writes, so a cell moved
|
|
61
|
+
* between boxes never carries a stale answer.
|
|
62
|
+
*/
|
|
63
|
+
get selected(): boolean {
|
|
64
|
+
return this.classList.contains('selected');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
customElements.define('gtk-flow-box-child', GtkFlowBoxChild);
|