@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
|
@@ -4,25 +4,38 @@
|
|
|
4
4
|
// NO CORE STATE MACHINE: the whole behaviour is `CLAMP(fraction, 0, 1)` plus a pulsing
|
|
5
5
|
// flag, and ADR 0004 is explicit that trivial behaviour gets no core class. The clamp
|
|
6
6
|
// is still shared — `glibClamp` (GLib's CLAMP, high bound tested FIRST) comes from
|
|
7
|
-
// `@gjsify/adwaita-core
|
|
7
|
+
// `@gjsify/adwaita-core` — and it is GTK's own: `gtk_progress_bar_set_fraction` stores
|
|
8
|
+
// `CLAMP (fraction, 0.0, 1.0)` (gtkprogressbar.c:783).
|
|
8
9
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
10
|
+
// WHAT THE PULSE ACTUALLY IS, FROM THE C. `gtk_progress_bar_pulse` ENTERS "activity
|
|
11
|
+
// mode", and a frame-clock tick advances the block by `pulse-step` (default 0.1) per
|
|
12
|
+
// call, reversing at 0 and 1 and repeating until three periods pass without a pulse
|
|
13
|
+
// (gtkprogressbar.c:830-847, :655-692, :217-221, :473). Setting `fraction` LEAVES it
|
|
14
|
+
// (:791). That per-call stepping is not what ships: the indeterminate block here is the
|
|
15
|
+
// vendored port's CSS keyframe animation, which runs on a fixed period and is entered by
|
|
16
|
+
// `pulsing` — so {@link GtkProgressBar.pulse} enters that state and is idempotent
|
|
17
|
+
// afterwards, and `pulse-step` is a measured gap rather than a missing widget (see
|
|
18
|
+
// KNOWN_GAPS in `scripts/check-adwaita-element-properties.mjs`). The `:left` / `:right`
|
|
19
|
+
// / `:top` / `:bottom` classes GTK adds as the block touches an end
|
|
20
|
+
// (gtkprogressbar.c:74-89, :307-330) go with it; libadwaita never styles them.
|
|
21
|
+
//
|
|
22
|
+
// THE `NN%` LABEL IS GTK'S OWN FORMAT. `get_current_text` returns the `text` property
|
|
23
|
+
// when there is one and otherwise `C_("progress bar label", "%.0f %%")` of
|
|
24
|
+
// `fraction * 100` (gtkprogressbar.c:628-634) — so an explicit `text` wins and the
|
|
25
|
+
// percentage is the fallback, which is what {@link GtkProgressBar.text} returns.
|
|
16
26
|
//
|
|
17
27
|
// `osd` is libadwaita's `.osd` STYLE CLASS: a 2px troughless bar for under a header bar.
|
|
18
28
|
//
|
|
19
29
|
// A11Y: `role="progressbar"`, `aria-valuemin`/`aria-valuemax` fixed at 0/1,
|
|
20
|
-
// `aria-valuenow` carrying the clamped fraction
|
|
21
|
-
//
|
|
22
|
-
//
|
|
30
|
+
// `aria-valuenow` carrying the clamped fraction — the `GTK_ACCESSIBLE_PROPERTY_VALUE_*`
|
|
31
|
+
// trio `gtk_progress_bar_set_fraction` updates (gtkprogressbar.c:91-95, :795-799).
|
|
32
|
+
// While pulsing `aria-valuenow` is REMOVED — that is how ARIA spells "indeterminate",
|
|
33
|
+
// and a stale value there would be announced as real progress.
|
|
23
34
|
//
|
|
35
|
+
// Reference: refs/gtk/gtk/gtkprogressbar.c:43-96,217-221,628-634,655-692,776-799,830-847
|
|
24
36
|
// Reference: refs/libadwaita/src/stylesheet/widgets/_progress-bar.scss
|
|
25
37
|
// Reference: refs/adwaita-web/adwaita-web/scss/_progressbar.scss (the indeterminate animation only)
|
|
38
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
26
39
|
// Copyright (c) GNOME contributors (libadwaita). LGPLv2.1+.
|
|
27
40
|
// Copyright (c) 2025 csm (adwaita-web). MIT License.
|
|
28
41
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
// <gtk-revealer> — shows and hides its child with an animation.
|
|
2
|
+
//
|
|
3
|
+
// THREE attributes, two of them the animation's own vocabulary:
|
|
4
|
+
//
|
|
5
|
+
// reveal-child the direction flag. `true` animates the position to 1,
|
|
6
|
+
// `false` back to 0 (gtk_revealer_set_reveal_child).
|
|
7
|
+
// transition-type one of fourteen nicks (`slide-down` is the pspec default,
|
|
8
|
+
// gtkrevealer.c:120-128). Unknown leaves the default, the answer
|
|
9
|
+
// GtkBuilder gives an unrecognised enum nick.
|
|
10
|
+
// transition-duration milliseconds; `0` skips the animation altogether
|
|
11
|
+
// (gtk_revealer_start_animation, gtkrevealer.c:227-233).
|
|
12
|
+
//
|
|
13
|
+
// `child-revealed` is READ-ONLY and deliberately NOT the inverse of `reveal-child`:
|
|
14
|
+
// `gtk_revealer_get_child_revealed` (gtkrevealer.c:843-851) inverts it while an animation
|
|
15
|
+
// is RUNNING, so a revealer that is closing reports `true` until the position lands. That
|
|
16
|
+
// is the flag a caller waits on, and the one this element publishes.
|
|
17
|
+
//
|
|
18
|
+
// THE GEOMETRY IS THE C'S, AND NOT A CSS TRANSITION. `gtk_revealer_size_allocate`
|
|
19
|
+
// (gtkrevealer.c:449-598) does two things a `transition: transform` cannot:
|
|
20
|
+
//
|
|
21
|
+
// 1. it MEASURES the revealer at `child × scale` (gtk_revealer_measure,
|
|
22
|
+
// gtkrevealer.c:620-654: `ceil (minimum * scale)`) while ALLOCATING the child at its
|
|
23
|
+
// UNSCALED size, so the child renders at full size instead of ellipsizing — the
|
|
24
|
+
// comment there says why, and a scaled paint would get it exactly wrong. So the clip
|
|
25
|
+
// box below is sized to `ceil(natural × scale)` and the child inside it is never
|
|
26
|
+
// scaled, which is what `_clipEl`'s height/width is for.
|
|
27
|
+
// 2. it translates the child by the OVERFLOW (`width - child_width`), not by a
|
|
28
|
+
// percentage of the clip box. Both agree at the ends, and the pixel form is what the
|
|
29
|
+
// C writes.
|
|
30
|
+
//
|
|
31
|
+
// `get_child_size_scale` (gtkrevealer.c:144-186) is the whole of the axis question: a
|
|
32
|
+
// slide scales one axis by the position, a SWING scales it by `sin (π · pos / 2)` — the
|
|
33
|
+
// fold, which is why a swing's box grows like a square root and not linearly — and `none`
|
|
34
|
+
// / `crossfade` scale neither. Opacity comes from `get_is_fading_type`
|
|
35
|
+
// (gtkrevealer.c:189-210) and only WHILE the animation runs: `gtk_revealer_snapshot`
|
|
36
|
+
// (gtkrevealer.c:657-679) reads `animation_running = target_pos != current_pos` and turns the
|
|
37
|
+
// fade off the moment it stops, so a settled crossfade is opaque rather than left at
|
|
38
|
+
// whatever opacity it landed on.
|
|
39
|
+
//
|
|
40
|
+
// `effective_transition` (gtkrevealer.c:121-141) mirrors every left/right pair in an RTL
|
|
41
|
+
// row, so `slide-right` slides in from the visual right there — `:dir(rtl)` decides it,
|
|
42
|
+
// the same way `_widget.scss` decides which side an alignment's auto margin goes to.
|
|
43
|
+
//
|
|
44
|
+
// The revealer's own allocation is `natural × scale` on each axis, because that is what
|
|
45
|
+
// `gtk_revealer_size_allocate` received and passes straight on to the child
|
|
46
|
+
// (gtkrevealer.c:451-459); the perspective depth below is computed from those numbers
|
|
47
|
+
// rather than measured, which is both cheaper than a per-frame read and closer to the C.
|
|
48
|
+
//
|
|
49
|
+
// A11Y: `role="group"`, GtkRevealer's own role (gtkrevealer.c:58). The child is NEVER
|
|
50
|
+
// marked hidden — the doc section says it "is always available in the accessibility tree,
|
|
51
|
+
// regardless of the state of the revealer widget" (gtkrevealer.c:61-63), which is why the
|
|
52
|
+
// collapse is `overflow` clipping rather than `display: none` or `visibility: hidden`:
|
|
53
|
+
// both of those would take it out of the tree, and clipping does not.
|
|
54
|
+
//
|
|
55
|
+
// Reference: refs/gtk/gtk/gtkrevealer.c (every property, the transition table)
|
|
56
|
+
// Reference: refs/gtk/gtk/gtkprogresstracker.c (ease_out_cubic, the frame clock)
|
|
57
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
58
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
59
|
+
|
|
60
|
+
import { easeOutCubic } from '@gjsify/adwaita-core';
|
|
61
|
+
|
|
62
|
+
import { bindSlottedChildren } from '../slotted-children.js';
|
|
63
|
+
|
|
64
|
+
/** Every `GtkRevealerTransitionType` nick, in GIR order. */
|
|
65
|
+
const TRANSITION_TYPES = [
|
|
66
|
+
'none',
|
|
67
|
+
'crossfade',
|
|
68
|
+
'slide-right',
|
|
69
|
+
'slide-left',
|
|
70
|
+
'slide-up',
|
|
71
|
+
'slide-down',
|
|
72
|
+
'swing-right',
|
|
73
|
+
'swing-left',
|
|
74
|
+
'swing-up',
|
|
75
|
+
'swing-down',
|
|
76
|
+
'fade-slide-right',
|
|
77
|
+
'fade-slide-left',
|
|
78
|
+
'fade-slide-up',
|
|
79
|
+
'fade-slide-down',
|
|
80
|
+
] as const;
|
|
81
|
+
|
|
82
|
+
export type RevealerTransitionType = (typeof TRANSITION_TYPES)[number];
|
|
83
|
+
|
|
84
|
+
/** `Gtk.Revealer:transition-type`'s pspec default — `GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN`. */
|
|
85
|
+
const DEFAULT_TRANSITION: RevealerTransitionType = 'slide-down';
|
|
86
|
+
|
|
87
|
+
/** `Gtk.Revealer:transition-duration`'s pspec default, in milliseconds. */
|
|
88
|
+
const DEFAULT_DURATION = 250;
|
|
89
|
+
|
|
90
|
+
/** `get_child_size_scale`'s two families, by the axis they scale (gtkrevealer.c:149-178). */
|
|
91
|
+
const HORIZONTAL_SLIDES: ReadonlySet<string> = new Set([
|
|
92
|
+
'slide-right',
|
|
93
|
+
'slide-left',
|
|
94
|
+
'fade-slide-right',
|
|
95
|
+
'fade-slide-left',
|
|
96
|
+
]);
|
|
97
|
+
const VERTICAL_SLIDES: ReadonlySet<string> = new Set(['slide-up', 'slide-down', 'fade-slide-up', 'fade-slide-down']);
|
|
98
|
+
const HORIZONTAL_SWINGS: ReadonlySet<string> = new Set(['swing-right', 'swing-left']);
|
|
99
|
+
const VERTICAL_SWINGS: ReadonlySet<string> = new Set(['swing-up', 'swing-down']);
|
|
100
|
+
/** `get_is_fading_type` (gtkrevealer.c:189-210). */
|
|
101
|
+
const FADING: ReadonlySet<string> = new Set([
|
|
102
|
+
'crossfade',
|
|
103
|
+
'fade-slide-right',
|
|
104
|
+
'fade-slide-left',
|
|
105
|
+
'fade-slide-up',
|
|
106
|
+
'fade-slide-down',
|
|
107
|
+
]);
|
|
108
|
+
|
|
109
|
+
/** `effective_transition`'s RTL half (gtkrevealer.c:126-137). */
|
|
110
|
+
const RTL_FLIP: Partial<Record<RevealerTransitionType, RevealerTransitionType>> = {
|
|
111
|
+
'slide-left': 'slide-right',
|
|
112
|
+
'slide-right': 'slide-left',
|
|
113
|
+
'swing-left': 'swing-right',
|
|
114
|
+
'swing-right': 'swing-left',
|
|
115
|
+
'fade-slide-left': 'fade-slide-right',
|
|
116
|
+
'fade-slide-right': 'fade-slide-left',
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export class GtkRevealer extends HTMLElement {
|
|
120
|
+
private _clipEl!: HTMLDivElement;
|
|
121
|
+
private _initialized = false;
|
|
122
|
+
/** `current_pos` — 0 hidden, 1 shown. */
|
|
123
|
+
private _position = 0;
|
|
124
|
+
/** `target_pos` — where the running animation is headed. */
|
|
125
|
+
private _target = 0;
|
|
126
|
+
private _frame = 0;
|
|
127
|
+
private _startedAt = 0;
|
|
128
|
+
/** The child's own size — `child_width` / `child_height` in the C. */
|
|
129
|
+
private _naturalWidth = 0;
|
|
130
|
+
private _naturalHeight = 0;
|
|
131
|
+
private _resize: ResizeObserver | null = null;
|
|
132
|
+
|
|
133
|
+
static get observedAttributes() {
|
|
134
|
+
return ['reveal-child', 'transition-type', 'transition-duration'];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** `Gtk.Revealer:reveal-child` — whether the child should be revealed. */
|
|
138
|
+
get revealChild(): boolean {
|
|
139
|
+
return this.hasAttribute('reveal-child');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
set revealChild(value: boolean) {
|
|
143
|
+
this.toggleAttribute('reveal-child', !!value);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** `Gtk.Revealer:child-revealed` — read-only; the header says why it inverts. */
|
|
147
|
+
get childRevealed(): boolean {
|
|
148
|
+
return this._position === this._target ? this.revealChild : !this.revealChild;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** `Gtk.Revealer:transition-type`. An unknown nick leaves `slide-down` in place. */
|
|
152
|
+
get transitionType(): RevealerTransitionType {
|
|
153
|
+
const raw = this.getAttribute('transition-type');
|
|
154
|
+
return (TRANSITION_TYPES as readonly unknown[]).includes(raw)
|
|
155
|
+
? (raw as RevealerTransitionType)
|
|
156
|
+
: DEFAULT_TRANSITION;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
set transitionType(value: RevealerTransitionType) {
|
|
160
|
+
this.setAttribute('transition-type', value);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** `Gtk.Revealer:transition-duration`, in ms. An unparseable one is the default. */
|
|
164
|
+
get transitionDuration(): number {
|
|
165
|
+
const raw = Number.parseFloat(this.getAttribute('transition-duration') ?? '');
|
|
166
|
+
return Number.isFinite(raw) && raw >= 0 ? raw : DEFAULT_DURATION;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
set transitionDuration(value: number) {
|
|
170
|
+
this.setAttribute('transition-duration', String(value));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** `Gtk.Revealer:child` — the light-DOM node the clip box adopted. */
|
|
174
|
+
get child(): Element | null {
|
|
175
|
+
return this._clipEl?.firstElementChild ?? null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
connectedCallback() {
|
|
179
|
+
if (this._initialized) {
|
|
180
|
+
// The teardown below dropped the frame and the observer, so a re-parent has to
|
|
181
|
+
// re-arm them — see `scripts/check-adwaita-connect-rebind.mjs`.
|
|
182
|
+
this._observeChild();
|
|
183
|
+
this._render();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
this._initialized = true;
|
|
187
|
+
|
|
188
|
+
this.setAttribute('role', 'group');
|
|
189
|
+
|
|
190
|
+
this._clipEl = document.createElement('div');
|
|
191
|
+
this._clipEl.className = 'adw-revealer-clip';
|
|
192
|
+
|
|
193
|
+
// `Gtk.Revealer:child` is a widget PROPERTY, so an authored `child: …` names the
|
|
194
|
+
// slot by that name and the bare child is the default; both land in the clip box.
|
|
195
|
+
bindSlottedChildren(this, [{ name: 'child', into: this._clipEl }, { into: this._clipEl }], () =>
|
|
196
|
+
this._observeChild(),
|
|
197
|
+
).install(this._clipEl);
|
|
198
|
+
|
|
199
|
+
this._observeChild();
|
|
200
|
+
// `reveal-child` is `G_PARAM_CONSTRUCT`, so a GtkBuilder `<property
|
|
201
|
+
// name="reveal-child">` reaches `gtk_revealer_set_reveal_child` at construction and
|
|
202
|
+
// the animation has already started by the time `connectedCallback` returns. A
|
|
203
|
+
// declared attribute therefore has to be applied here: `attributeChangedCallback` is
|
|
204
|
+
// guarded until the element is initialized, because it runs first during an upgrade.
|
|
205
|
+
this._animate(this.revealChild);
|
|
206
|
+
this._render();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
disconnectedCallback() {
|
|
210
|
+
// `gtk_revealer_unmap` (gtkrevealer.c:390-405) finishes the animation and drops the
|
|
211
|
+
// tick callback; a widget taken out of the tree is unmapped, so this is the same
|
|
212
|
+
// event at the same point.
|
|
213
|
+
this._finish();
|
|
214
|
+
this._resize?.disconnect();
|
|
215
|
+
this._resize = null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null) {
|
|
219
|
+
if (!this._initialized) return;
|
|
220
|
+
if (name === 'reveal-child') {
|
|
221
|
+
// `start_animation` returns early when the TARGET is unchanged, so a rewrite of
|
|
222
|
+
// the same value notifies nothing — and neither does it move anything.
|
|
223
|
+
if (!this._animate(value !== null)) return;
|
|
224
|
+
this.dispatchEvent(
|
|
225
|
+
new CustomEvent('notify::reveal-child', {
|
|
226
|
+
bubbles: true,
|
|
227
|
+
detail: { revealChild: this.revealChild },
|
|
228
|
+
}),
|
|
229
|
+
);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// `gtk_revealer_set_transition_type` / `_duration` take effect on the NEXT
|
|
233
|
+
// animation; a running one keeps the curve it started with, so only the geometry
|
|
234
|
+
// already on screen is recomputed.
|
|
235
|
+
this._render();
|
|
236
|
+
const detail =
|
|
237
|
+
name === 'transition-duration'
|
|
238
|
+
? { transitionDuration: this.transitionDuration }
|
|
239
|
+
: { transitionType: this.transitionType };
|
|
240
|
+
this.dispatchEvent(new CustomEvent(`notify::${name}`, { bubbles: true, detail }));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Point the measurement at the CHILD, not at the clip box.
|
|
245
|
+
*
|
|
246
|
+
* The C asks the child for its requisition (gtkrevealer.c:140) and scales the result,
|
|
247
|
+
* so the child is the subject; observing the clip box instead would report the ALREADY
|
|
248
|
+
* SCALED box, and the scale would then be applied twice.
|
|
249
|
+
*/
|
|
250
|
+
private _observeChild(): void {
|
|
251
|
+
this._resize?.disconnect();
|
|
252
|
+
this._resize = new ResizeObserver((entries) => {
|
|
253
|
+
for (const entry of entries) {
|
|
254
|
+
const box = entry.borderBoxSize?.[0];
|
|
255
|
+
this._naturalWidth = box ? box.inlineSize : entry.contentRect.width;
|
|
256
|
+
this._naturalHeight = box ? box.blockSize : entry.contentRect.height;
|
|
257
|
+
}
|
|
258
|
+
this._render();
|
|
259
|
+
});
|
|
260
|
+
this._resize.observe(this._clipEl);
|
|
261
|
+
const child = this._clipEl.firstElementChild;
|
|
262
|
+
if (child) this._resize.observe(child);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** `gtk_revealer_start_animation` (gtkrevealer.c:275-322). `@returns` whether it moved. */
|
|
266
|
+
private _animate(reveal: boolean): boolean {
|
|
267
|
+
const next = reveal ? 1 : 0;
|
|
268
|
+
if (this._target === next) return false;
|
|
269
|
+
this._target = next;
|
|
270
|
+
|
|
271
|
+
const type = this.effectiveTransition;
|
|
272
|
+
// `gtk-interface-reduced-motion` and `gtk-enable-animations` are the two settings
|
|
273
|
+
// `start_animation` consults; a browser has the first as a media query and no
|
|
274
|
+
// second, so the query is read once per animation and no listener is kept.
|
|
275
|
+
const reduced = globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
|
276
|
+
if (this.transitionDuration === 0 || type === 'none' || reduced || !this.isConnected) {
|
|
277
|
+
this._finish();
|
|
278
|
+
this._setPosition(next);
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const source = this._position;
|
|
283
|
+
this._startedAt = performance.now();
|
|
284
|
+
if (this._frame === 0) this._frame = requestAnimationFrame(() => this._tick(source));
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** `gtk_revealer_animate_cb` (gtkrevealer.c:255-272). */
|
|
289
|
+
private _tick(source: number): void {
|
|
290
|
+
this._frame = 0;
|
|
291
|
+
const duration = this.transitionDuration;
|
|
292
|
+
const elapsed = performance.now() - this._startedAt;
|
|
293
|
+
// `gtk_progress_tracker_get_progress` is `iteration - iteration_cycle`, so the
|
|
294
|
+
// fraction runs 0…1 over the whole duration and the ease is applied to THAT.
|
|
295
|
+
const progress = duration <= 0 ? 1 : Math.min(1, elapsed / duration);
|
|
296
|
+
const ease = easeOutCubic(progress);
|
|
297
|
+
this._setPosition(source + ease * (this._target - source));
|
|
298
|
+
if (progress < 1) this._frame = requestAnimationFrame(() => this._tick(source));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
private _finish(): void {
|
|
302
|
+
if (this._frame !== 0) {
|
|
303
|
+
cancelAnimationFrame(this._frame);
|
|
304
|
+
this._frame = 0;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** `effective_transition` (gtkrevealer.c:121-141). */
|
|
309
|
+
private get effectiveTransition(): RevealerTransitionType {
|
|
310
|
+
const type = this.transitionType;
|
|
311
|
+
return this.matches(':dir(rtl)') ? (RTL_FLIP[type] ?? type) : type;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** `get_child_size_scale` (gtkrevealer.c:144-186) for one axis. */
|
|
315
|
+
private _scale(axis: 'horizontal' | 'vertical'): number {
|
|
316
|
+
const type = this.effectiveTransition;
|
|
317
|
+
const slides = axis === 'horizontal' ? HORIZONTAL_SLIDES : VERTICAL_SLIDES;
|
|
318
|
+
const swings = axis === 'horizontal' ? HORIZONTAL_SWINGS : VERTICAL_SWINGS;
|
|
319
|
+
if (slides.has(type)) return this._position;
|
|
320
|
+
if (swings.has(type)) return Math.sin((Math.PI * this._position) / 2);
|
|
321
|
+
return 1;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** `gtk_revealer_set_position` (gtkrevealer.c:212-251). */
|
|
325
|
+
private _setPosition(position: number): void {
|
|
326
|
+
this._position = position;
|
|
327
|
+
this._render();
|
|
328
|
+
if (this._position === this._target) {
|
|
329
|
+
this.dispatchEvent(
|
|
330
|
+
new CustomEvent('notify::child-revealed', {
|
|
331
|
+
bubbles: true,
|
|
332
|
+
detail: { childRevealed: this.childRevealed },
|
|
333
|
+
}),
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
private _render(): void {
|
|
339
|
+
const child = this._clipEl.firstElementChild as HTMLElement | null;
|
|
340
|
+
// The ResizeObserver delivers asynchronously, so a reveal started in the same task
|
|
341
|
+
// that adopted the child would measure zero. One synchronous read, and only while
|
|
342
|
+
// the recorded size is still the initial zero.
|
|
343
|
+
if (child && this._naturalHeight === 0) {
|
|
344
|
+
this._naturalWidth = child.offsetWidth;
|
|
345
|
+
this._naturalHeight = child.offsetHeight;
|
|
346
|
+
}
|
|
347
|
+
const position = this._position;
|
|
348
|
+
const hscale = this._scale('horizontal');
|
|
349
|
+
const vscale = this._scale('vertical');
|
|
350
|
+
const type = this.effectiveTransition;
|
|
351
|
+
|
|
352
|
+
// `gtk_revealer_measure`: `ceil (minimum * scale)`. A scale of 1 leaves the box
|
|
353
|
+
// `auto`, which is what makes a crossfade a pure opacity change with no layout in it.
|
|
354
|
+
this._clipEl.style.width = hscale < 1 ? `${Math.ceil(this._naturalWidth * hscale)}px` : '';
|
|
355
|
+
this._clipEl.style.height = vscale < 1 ? `${Math.ceil(this._naturalHeight * vscale)}px` : '';
|
|
356
|
+
|
|
357
|
+
if (child) {
|
|
358
|
+
// `gtk_widget_allocate (child, child_width, child_height, -1, transform)` — the
|
|
359
|
+
// transform chain of gtkrevealer.c:520-598, in the same order, in CSS, about
|
|
360
|
+
// the child's own origin because `transform-origin: 0 0` drops the reference-box
|
|
361
|
+
// offset a GskTransform chain does not have.
|
|
362
|
+
const childWidth = this._naturalWidth;
|
|
363
|
+
const childHeight = this._naturalHeight;
|
|
364
|
+
const width = childWidth * hscale;
|
|
365
|
+
const height = childHeight * vscale;
|
|
366
|
+
const depth = 2 * Math.max(width, height);
|
|
367
|
+
const turns = 90 * (1 - position);
|
|
368
|
+
let transform = '';
|
|
369
|
+
switch (type) {
|
|
370
|
+
case 'slide-right':
|
|
371
|
+
case 'fade-slide-right':
|
|
372
|
+
transform = `translateX(${width - childWidth}px)`;
|
|
373
|
+
break;
|
|
374
|
+
case 'slide-down':
|
|
375
|
+
case 'fade-slide-down':
|
|
376
|
+
transform = `translateY(${height - childHeight}px)`;
|
|
377
|
+
break;
|
|
378
|
+
case 'swing-right':
|
|
379
|
+
transform = `translate(0, ${height / 2}px) perspective(${depth}px) rotateY(${turns}deg) translate(0, ${-childHeight / 2}px)`;
|
|
380
|
+
break;
|
|
381
|
+
case 'swing-left':
|
|
382
|
+
transform = `translate(${width}px, ${height / 2}px) perspective(${depth}px) rotateY(${-turns}deg) translate(${-childWidth}px, ${-childHeight / 2}px)`;
|
|
383
|
+
break;
|
|
384
|
+
case 'swing-down':
|
|
385
|
+
transform = `translate(${width / 2}px, 0) perspective(${depth}px) rotateX(${-turns}deg) translate(${-childWidth / 2}px, 0)`;
|
|
386
|
+
break;
|
|
387
|
+
case 'swing-up':
|
|
388
|
+
transform = `translate(${width / 2}px, ${height}px) perspective(${depth}px) rotateX(${turns}deg) translate(${-childWidth / 2}px, ${-childHeight}px)`;
|
|
389
|
+
break;
|
|
390
|
+
default:
|
|
391
|
+
// `slide-left`, `slide-up` and everything without a transform of its own
|
|
392
|
+
// fall through the C's switch unchanged.
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
child.style.transform = transform;
|
|
396
|
+
// `transform-origin: 0 0` is the GskTransform composition point, and only a
|
|
397
|
+
// chain that needs it (the swings) has one.
|
|
398
|
+
child.style.transformOrigin = transform === '' ? '' : '0 0';
|
|
399
|
+
child.style.opacity = FADING.has(type) ? String(position) : '';
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
this.classList.toggle('revealed', position > 0);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
customElements.define('gtk-revealer', GtkRevealer);
|