@gjsify/adwaita-web 0.53.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adwaita-web.css +8070 -3037
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/adw-application-window.spec.d.ts +1 -0
- package/lib/types/adw-bin.spec.d.ts +1 -0
- package/lib/types/adw-breakpoint-bin.spec.d.ts +1 -0
- package/lib/types/adw-clamp-scrollable.spec.d.ts +1 -0
- package/lib/types/adw-multi-layout-view.spec.d.ts +1 -0
- package/lib/types/adw-preferences-row.spec.d.ts +1 -0
- package/lib/types/adw-shortcuts.spec.d.ts +1 -0
- package/lib/types/adw-tab-bar.spec.d.ts +1 -0
- package/lib/types/adw-tab-button.spec.d.ts +1 -0
- package/lib/types/adw-tab-overview.spec.d.ts +1 -0
- package/lib/types/adw-view-switcher-sidebar.spec.d.ts +1 -0
- package/lib/types/adw-window.spec.d.ts +1 -0
- package/lib/types/breakpoints.d.ts +14 -3
- package/lib/types/construct-vectors.spec.d.ts +1 -0
- package/lib/types/elements/adw-application-window.d.ts +27 -0
- package/lib/types/elements/adw-bin.d.ts +17 -0
- package/lib/types/elements/adw-breakpoint-bin.d.ts +67 -0
- package/lib/types/elements/adw-clamp-scrollable.d.ts +38 -0
- package/lib/types/elements/adw-dialog.d.ts +10 -0
- package/lib/types/elements/adw-layout-slot.d.ts +19 -0
- package/lib/types/elements/adw-multi-layout-view.d.ts +101 -0
- package/lib/types/elements/adw-preferences-row.d.ts +31 -0
- package/lib/types/elements/adw-shortcuts-dialog.d.ts +13 -0
- package/lib/types/elements/adw-shortcuts-item.d.ts +36 -0
- package/lib/types/elements/adw-shortcuts-section.d.ts +14 -0
- package/lib/types/elements/adw-sidebar.d.ts +5 -0
- package/lib/types/elements/adw-switch-row.d.ts +3 -0
- package/lib/types/elements/adw-tab-bar.d.ts +108 -0
- package/lib/types/elements/adw-tab-button.d.ts +32 -0
- package/lib/types/elements/adw-tab-overview.d.ts +199 -0
- package/lib/types/elements/adw-tab-view.d.ts +19 -23
- package/lib/types/elements/adw-view-switcher-sidebar.d.ts +84 -0
- package/lib/types/elements/adw-window.d.ts +40 -0
- package/lib/types/elements/gtk-about-dialog.d.ts +146 -0
- package/lib/types/elements/gtk-application-window.d.ts +34 -0
- package/lib/types/elements/gtk-aspect-frame.d.ts +27 -0
- package/lib/types/elements/gtk-button.d.ts +9 -0
- package/lib/types/elements/gtk-calendar.d.ts +159 -0
- package/lib/types/elements/gtk-center-box.d.ts +39 -0
- package/lib/types/elements/gtk-color-dialog-button.d.ts +69 -0
- package/lib/types/elements/gtk-column-view.d.ts +50 -0
- package/lib/types/elements/gtk-drag-icon.d.ts +78 -0
- package/lib/types/elements/gtk-drawing-area.d.ts +95 -0
- package/lib/types/elements/gtk-editable-label.d.ts +33 -0
- package/lib/types/elements/gtk-emoji-chooser.d.ts +84 -0
- package/lib/types/elements/gtk-entry.d.ts +20 -1
- package/lib/types/elements/gtk-expander.d.ts +49 -0
- package/lib/types/elements/gtk-fixed.d.ts +13 -0
- package/lib/types/elements/gtk-flow-box-child.d.ts +14 -0
- package/lib/types/elements/gtk-flow-box.d.ts +87 -0
- package/lib/types/elements/gtk-font-dialog-button.d.ts +83 -0
- package/lib/types/elements/gtk-frame.d.ts +24 -0
- package/lib/types/elements/gtk-gl-area.d.ts +136 -0
- package/lib/types/elements/gtk-graphics-offload.d.ts +24 -0
- package/lib/types/elements/gtk-grid-view.d.ts +39 -0
- package/lib/types/elements/gtk-grid.d.ts +27 -0
- package/lib/types/elements/gtk-header-bar.d.ts +60 -0
- package/lib/types/elements/gtk-inscription.d.ts +64 -0
- package/lib/types/elements/gtk-label.d.ts +3 -0
- package/lib/types/elements/gtk-level-bar.d.ts +59 -0
- package/lib/types/elements/gtk-link-button.d.ts +29 -0
- package/lib/types/elements/gtk-list-box-row.d.ts +54 -0
- package/lib/types/elements/gtk-list-box.d.ts +100 -0
- package/lib/types/elements/gtk-list-view.d.ts +73 -0
- package/lib/types/elements/gtk-media-controls.d.ts +142 -0
- package/lib/types/elements/gtk-notebook.d.ts +148 -0
- package/lib/types/elements/gtk-overlay.d.ts +22 -0
- package/lib/types/elements/gtk-page-setup-unix-dialog.d.ts +87 -0
- package/lib/types/elements/gtk-paned.d.ts +121 -0
- package/lib/types/elements/gtk-password-entry.d.ts +27 -0
- package/lib/types/elements/gtk-picture.d.ts +66 -0
- package/lib/types/elements/gtk-popover-bin.d.ts +82 -0
- package/lib/types/elements/gtk-popover-menu-bar.d.ts +66 -0
- package/lib/types/elements/gtk-popover-menu.d.ts +83 -0
- package/lib/types/elements/gtk-popover.d.ts +28 -3
- package/lib/types/elements/gtk-print-unix-dialog.d.ts +167 -0
- package/lib/types/elements/gtk-revealer.d.ts +55 -0
- package/lib/types/elements/gtk-scale-button.d.ts +59 -0
- package/lib/types/elements/gtk-scale.d.ts +98 -0
- package/lib/types/elements/gtk-scrollbar.d.ts +124 -0
- package/lib/types/elements/gtk-scrolled-window.d.ts +121 -0
- package/lib/types/elements/gtk-search-bar.d.ts +39 -0
- package/lib/types/elements/gtk-search-entry.d.ts +27 -0
- package/lib/types/elements/gtk-separator.d.ts +10 -0
- package/lib/types/elements/gtk-spin-button.d.ts +94 -0
- package/lib/types/elements/gtk-spinner.d.ts +14 -0
- package/lib/types/elements/gtk-stack-sidebar.d.ts +43 -0
- package/lib/types/elements/gtk-stack-switcher.d.ts +58 -0
- package/lib/types/elements/gtk-stack.d.ts +154 -0
- package/lib/types/elements/gtk-switch.d.ts +4 -1
- package/lib/types/elements/gtk-text-view.d.ts +62 -0
- package/lib/types/elements/gtk-text.d.ts +45 -0
- package/lib/types/elements/gtk-toggle-button.d.ts +45 -0
- package/lib/types/elements/gtk-tree-expander.d.ts +38 -0
- package/lib/types/elements/gtk-video.d.ts +97 -0
- package/lib/types/elements/gtk-viewport.d.ts +84 -0
- package/lib/types/elements/gtk-window-controls.d.ts +80 -0
- package/lib/types/elements/gtk-window-handle.d.ts +39 -0
- package/lib/types/elements/gtk-window.d.ts +97 -0
- package/lib/types/elements/justification.d.ts +2 -0
- package/lib/types/elements/popover-menu.d.ts +18 -0
- package/lib/types/elements/roving-focus.d.ts +29 -1
- package/lib/types/emoji-data.d.ts +38 -0
- package/lib/types/font-description.d.ts +96 -0
- package/lib/types/gtk-about-dialog.spec.d.ts +1 -0
- package/lib/types/gtk-action-bar.spec.d.ts +1 -0
- package/lib/types/gtk-application-window.spec.d.ts +1 -0
- package/lib/types/gtk-aspect-frame.spec.d.ts +1 -0
- package/lib/types/gtk-calendar.spec.d.ts +1 -0
- package/lib/types/gtk-center-box.spec.d.ts +1 -0
- package/lib/types/gtk-color-dialog-button.spec.d.ts +1 -0
- package/lib/types/gtk-column-view.spec.d.ts +1 -0
- package/lib/types/gtk-drag-icon.spec.d.ts +1 -0
- package/lib/types/gtk-drawing-area.spec.d.ts +1 -0
- package/lib/types/gtk-editable-label.spec.d.ts +1 -0
- package/lib/types/gtk-emoji-chooser.spec.d.ts +1 -0
- package/lib/types/gtk-expander.spec.d.ts +1 -0
- package/lib/types/gtk-fixed.spec.d.ts +1 -0
- package/lib/types/gtk-flow-box.spec.d.ts +1 -0
- package/lib/types/gtk-font-dialog-button.spec.d.ts +1 -0
- package/lib/types/gtk-frame.spec.d.ts +1 -0
- package/lib/types/gtk-gl-area.spec.d.ts +1 -0
- package/lib/types/gtk-graphics-offload.spec.d.ts +1 -0
- package/lib/types/gtk-grid-view.spec.d.ts +1 -0
- package/lib/types/gtk-grid.spec.d.ts +1 -0
- package/lib/types/gtk-header-bar.spec.d.ts +1 -0
- package/lib/types/gtk-inscription.spec.d.ts +1 -0
- package/lib/types/gtk-level-bar.spec.d.ts +1 -0
- package/lib/types/gtk-link-button.spec.d.ts +1 -0
- package/lib/types/gtk-list-box.spec.d.ts +1 -0
- package/lib/types/gtk-list-view.spec.d.ts +1 -0
- package/lib/types/gtk-media-controls.spec.d.ts +1 -0
- package/lib/types/gtk-notebook.spec.d.ts +1 -0
- package/lib/types/gtk-overlay.spec.d.ts +1 -0
- package/lib/types/gtk-paned.spec.d.ts +1 -0
- package/lib/types/gtk-password-entry.spec.d.ts +1 -0
- package/lib/types/gtk-picture.spec.d.ts +1 -0
- package/lib/types/gtk-popover-bin.spec.d.ts +1 -0
- package/lib/types/gtk-popover-menu-bar.spec.d.ts +1 -0
- package/lib/types/gtk-popover-menu.spec.d.ts +1 -0
- package/lib/types/gtk-popover-role.spec.d.ts +1 -0
- package/lib/types/gtk-popover.spec.d.ts +1 -0
- package/lib/types/gtk-print-dialogs.spec.d.ts +1 -0
- package/lib/types/gtk-revealer.spec.d.ts +1 -0
- package/lib/types/gtk-scale-button.spec.d.ts +1 -0
- package/lib/types/gtk-scale.spec.d.ts +1 -0
- package/lib/types/gtk-scrollbar.spec.d.ts +1 -0
- package/lib/types/gtk-scrolled-window.spec.d.ts +1 -0
- package/lib/types/gtk-search-bar.spec.d.ts +1 -0
- package/lib/types/gtk-search-entry.spec.d.ts +1 -0
- package/lib/types/gtk-separator.spec.d.ts +1 -0
- package/lib/types/gtk-spin-button.spec.d.ts +1 -0
- package/lib/types/gtk-spinner.spec.d.ts +1 -0
- package/lib/types/gtk-stack-sidebar.spec.d.ts +1 -0
- package/lib/types/gtk-stack-switcher.spec.d.ts +1 -0
- package/lib/types/gtk-stack.spec.d.ts +1 -0
- package/lib/types/gtk-text-view.spec.d.ts +1 -0
- package/lib/types/gtk-text.spec.d.ts +1 -0
- package/lib/types/gtk-toggle-button.spec.d.ts +1 -0
- package/lib/types/gtk-tree-expander.spec.d.ts +1 -0
- package/lib/types/gtk-video.spec.d.ts +1 -0
- package/lib/types/gtk-viewport.spec.d.ts +1 -0
- package/lib/types/gtk-window-controls.spec.d.ts +1 -0
- package/lib/types/gtk-window-handle.spec.d.ts +1 -0
- package/lib/types/gtk-window.spec.d.ts +1 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/list-view-dom.d.ts +44 -0
- package/lib/types/namespace/adw.d.ts +12 -0
- package/lib/types/namespace/gtk.d.ts +61 -0
- package/lib/types/page-setup.d.ts +100 -0
- package/lib/types/scroll-shading.d.ts +15 -1
- package/lib/types/shared-tree-builder.d.ts +30 -2
- package/lib/types/signals.d.ts +4 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/lib/types/tab-chip.d.ts +73 -0
- package/lib/types/template-classes.d.ts +11 -0
- package/package.json +12 -8
- package/scss/_action_row.scss +2 -2
- package/scss/_application_window.scss +26 -0
- package/scss/_aspect_frame.scss +25 -0
- package/scss/_bin.scss +26 -0
- package/scss/_button.scss +45 -0
- package/scss/_calendar.scss +176 -0
- package/scss/_center_box.scss +25 -0
- package/scss/_checks.scss +6 -1
- package/scss/_clamp_scrollable.scss +28 -0
- package/scss/_color_button.scss +67 -0
- package/scss/_column_view.scss +126 -0
- package/scss/_drag_icon.scss +55 -0
- package/scss/_drawing.scss +85 -0
- package/scss/_emoji_chooser.scss +213 -0
- package/scss/_entry.scss +13 -5
- package/scss/_entry_row.scss +1 -1
- package/scss/_expander.scss +113 -0
- package/scss/_fixed.scss +29 -0
- package/scss/_flow_box.scss +94 -0
- package/scss/_font_button.scss +63 -0
- package/scss/_frame.scss +41 -0
- package/scss/_grid.scss +19 -0
- package/scss/_grid_view.scss +46 -0
- package/scss/_gtk_about_dialog.scss +186 -0
- package/scss/_headerbar.scss +132 -0
- package/scss/_icons.generated.scss +186 -0
- package/scss/_inscription.scss +125 -0
- package/scss/_level_bar.scss +190 -0
- package/scss/_link.scss +82 -0
- package/scss/_list_box.scss +88 -0
- package/scss/_list_view.scss +96 -0
- package/scss/_media_controls.scss +139 -0
- package/scss/_overlay.scss +68 -0
- package/scss/_paned.scss +130 -0
- package/scss/_password_entry.scss +83 -0
- package/scss/_picture.scss +80 -0
- package/scss/_popover_bin.scss +53 -0
- package/scss/_popover_menu_bar.scss +104 -0
- package/scss/_preferences_row.scss +51 -0
- package/scss/_print_dialogs.scss +328 -0
- package/scss/_reset.scss +21 -19
- package/scss/_revealer.scss +37 -0
- package/scss/_row.scss +20 -5
- package/scss/_scale.scss +298 -0
- package/scss/_scale_button.scss +167 -0
- package/scss/_scrollbar.scss +230 -0
- package/scss/_scrolled_window.scss +131 -0
- package/scss/_search_bar.scss +118 -0
- package/scss/_search_entry.scss +86 -0
- package/scss/_separator.scss +44 -0
- package/scss/_shortcuts_dialog.scss +100 -0
- package/scss/_spin_button.scss +172 -0
- package/scss/_spin_row.scss +56 -8
- package/scss/_spinner.scss +85 -4
- package/scss/_stack.scss +729 -0
- package/scss/_switch.scss +13 -5
- package/scss/_switch_row.scss +10 -0
- package/scss/_tab_bar.scss +317 -0
- package/scss/_tab_button.scss +98 -0
- package/scss/_tab_overview.scss +483 -0
- package/scss/_text.scss +182 -0
- package/scss/_theme.scss +1 -1
- package/scss/_tree_expander.scss +62 -0
- package/scss/_variables.scss +43 -21
- package/scss/_video.scss +146 -0
- package/scss/_view_switcher_sidebar.scss +112 -0
- package/scss/_viewport.scss +50 -0
- package/scss/_window.scss +118 -1
- package/scss/_window_handle.scss +20 -0
- package/scss/adwaita-skin.scss +109 -0
- package/src/adw-action-rows.spec.ts +76 -0
- package/src/adw-application-window.spec.ts +118 -0
- package/src/adw-bin.spec.ts +75 -0
- package/src/adw-breakpoint-bin.spec.ts +324 -0
- package/src/adw-clamp-scrollable.spec.ts +189 -0
- package/src/adw-multi-layout-view.spec.ts +243 -0
- package/src/adw-preferences-row.spec.ts +164 -0
- package/src/adw-row-state.spec.ts +142 -0
- package/src/adw-shortcuts.spec.ts +155 -0
- package/src/adw-tab-bar.spec.ts +287 -0
- package/src/adw-tab-button.spec.ts +101 -0
- package/src/adw-tab-overview.spec.ts +443 -0
- package/src/adw-view-switcher-sidebar.spec.ts +281 -0
- package/src/adw-window.spec.ts +129 -0
- package/src/breakpoints.ts +25 -8
- package/src/capabilities.d.mts +3 -0
- package/src/capabilities.mjs +18 -0
- package/src/connect-lifecycle.spec.ts +12 -0
- package/src/construct-vectors.spec.ts +175 -0
- package/src/elements/adw-application-window.ts +154 -0
- package/src/elements/adw-bin.ts +101 -0
- package/src/elements/adw-breakpoint-bin.ts +287 -0
- package/src/elements/adw-clamp-scrollable.ts +207 -0
- package/src/elements/adw-dialog.ts +19 -0
- package/src/elements/adw-layout-slot.ts +95 -0
- package/src/elements/adw-multi-layout-view.ts +326 -0
- package/src/elements/adw-preferences-row.ts +150 -0
- package/src/elements/adw-shortcuts-dialog.ts +52 -0
- package/src/elements/adw-shortcuts-item.ts +171 -0
- package/src/elements/adw-shortcuts-section.ts +86 -0
- package/src/elements/adw-sidebar.ts +42 -3
- package/src/elements/adw-switch-row.ts +28 -1
- package/src/elements/adw-tab-bar.ts +529 -0
- package/src/elements/adw-tab-button.ts +194 -0
- package/src/elements/adw-tab-overview.ts +1011 -0
- package/src/elements/adw-tab-view.ts +66 -145
- package/src/elements/adw-toggle-group.ts +20 -5
- package/src/elements/adw-view-stack.ts +18 -0
- package/src/elements/adw-view-switcher-sidebar.ts +332 -0
- package/src/elements/adw-window.ts +185 -11
- package/src/elements/checks.ts +35 -8
- package/src/elements/gtk-about-dialog.ts +811 -0
- package/src/elements/gtk-application-window.ts +108 -0
- package/src/elements/gtk-aspect-frame.ts +160 -0
- package/src/elements/gtk-button.ts +12 -0
- package/src/elements/gtk-calendar.ts +757 -0
- package/src/elements/gtk-center-box.ts +184 -0
- package/src/elements/gtk-color-dialog-button.ts +278 -0
- package/src/elements/gtk-column-view.ts +320 -0
- package/src/elements/gtk-drag-icon.ts +257 -0
- package/src/elements/gtk-drawing-area.ts +303 -0
- package/src/elements/gtk-editable-label.ts +204 -0
- package/src/elements/gtk-emoji-chooser.ts +542 -0
- package/src/elements/gtk-entry.ts +39 -5
- package/src/elements/gtk-expander.ts +301 -0
- package/src/elements/gtk-fixed.ts +99 -0
- package/src/elements/gtk-flow-box-child.ts +68 -0
- package/src/elements/gtk-flow-box.ts +480 -0
- package/src/elements/gtk-font-dialog-button.ts +432 -0
- package/src/elements/gtk-frame.ts +174 -0
- package/src/elements/gtk-gl-area.ts +476 -0
- package/src/elements/gtk-graphics-offload.ts +130 -0
- package/src/elements/gtk-grid-view.ts +168 -0
- package/src/elements/gtk-grid.ts +127 -0
- package/src/elements/gtk-header-bar.ts +273 -0
- package/src/elements/gtk-inscription.ts +387 -0
- package/src/elements/gtk-label.ts +19 -11
- package/src/elements/gtk-level-bar.ts +323 -0
- package/src/elements/gtk-link-button.ts +138 -0
- package/src/elements/gtk-list-box-row.ts +195 -0
- package/src/elements/gtk-list-box.ts +413 -0
- package/src/elements/gtk-list-view.ts +370 -0
- package/src/elements/gtk-media-controls.ts +509 -0
- package/src/elements/gtk-notebook.ts +664 -0
- package/src/elements/gtk-overlay.ts +149 -0
- package/src/elements/gtk-page-setup-unix-dialog.ts +420 -0
- package/src/elements/gtk-paned.ts +597 -0
- package/src/elements/gtk-password-entry.ts +170 -0
- package/src/elements/gtk-picture.ts +254 -0
- package/src/elements/gtk-popover-bin.ts +332 -0
- package/src/elements/gtk-popover-menu-bar.ts +355 -0
- package/src/elements/gtk-popover-menu.ts +339 -0
- package/src/elements/gtk-popover.ts +92 -10
- package/src/elements/gtk-print-unix-dialog.ts +989 -0
- package/src/elements/gtk-progress-bar.ts +24 -11
- package/src/elements/gtk-revealer.ts +406 -0
- package/src/elements/gtk-scale-button.ts +358 -0
- package/src/elements/gtk-scale.ts +492 -0
- package/src/elements/gtk-scrollbar.ts +528 -0
- package/src/elements/gtk-scrolled-window.ts +642 -0
- package/src/elements/gtk-search-bar.ts +200 -0
- package/src/elements/gtk-search-entry.ts +172 -0
- package/src/elements/gtk-separator.ts +52 -0
- package/src/elements/gtk-spin-button.ts +475 -0
- package/src/elements/gtk-spinner.ts +126 -0
- package/src/elements/gtk-stack-sidebar.ts +212 -0
- package/src/elements/gtk-stack-switcher.ts +279 -0
- package/src/elements/gtk-stack.ts +748 -0
- package/src/elements/gtk-switch.ts +52 -19
- package/src/elements/gtk-text-view.ts +290 -0
- package/src/elements/gtk-text.ts +219 -0
- package/src/elements/gtk-toggle-button.ts +239 -0
- package/src/elements/gtk-tree-expander.ts +243 -0
- package/src/elements/gtk-video.ts +423 -0
- package/src/elements/gtk-viewport.ts +277 -0
- package/src/elements/gtk-window-controls.ts +341 -0
- package/src/elements/gtk-window-handle.ts +221 -0
- package/src/elements/gtk-window.ts +366 -0
- package/src/elements/justification.ts +24 -0
- package/src/elements/popover-menu.ts +24 -0
- package/src/elements/roving-focus.ts +53 -21
- package/src/emoji-data.ts +577 -0
- package/src/entry-rows.spec.ts +31 -0
- package/src/font-description.ts +238 -0
- package/src/gtk-about-dialog.spec.ts +250 -0
- package/src/gtk-action-bar.spec.ts +89 -0
- package/src/gtk-application-window.spec.ts +107 -0
- package/src/gtk-aspect-frame.spec.ts +114 -0
- package/src/gtk-calendar.spec.ts +589 -0
- package/src/gtk-center-box.spec.ts +125 -0
- package/src/gtk-color-dialog-button.spec.ts +141 -0
- package/src/gtk-column-view.spec.ts +154 -0
- package/src/gtk-drag-icon.spec.ts +190 -0
- package/src/gtk-drawing-area.spec.ts +211 -0
- package/src/gtk-editable-label.spec.ts +190 -0
- package/src/gtk-emoji-chooser.spec.ts +173 -0
- package/src/gtk-entry.spec.ts +23 -0
- package/src/gtk-expander.spec.ts +170 -0
- package/src/gtk-fixed.spec.ts +97 -0
- package/src/gtk-flow-box.spec.ts +289 -0
- package/src/gtk-font-dialog-button.spec.ts +166 -0
- package/src/gtk-frame.spec.ts +119 -0
- package/src/gtk-gl-area.spec.ts +361 -0
- package/src/gtk-graphics-offload.spec.ts +119 -0
- package/src/gtk-grid-view.spec.ts +106 -0
- package/src/gtk-grid.spec.ts +122 -0
- package/src/gtk-header-bar.spec.ts +202 -0
- package/src/gtk-inscription.spec.ts +235 -0
- package/src/gtk-level-bar.spec.ts +199 -0
- package/src/gtk-link-button.spec.ts +117 -0
- package/src/gtk-list-box.spec.ts +422 -0
- package/src/gtk-list-view.spec.ts +203 -0
- package/src/gtk-media-controls.spec.ts +295 -0
- package/src/gtk-notebook.spec.ts +546 -0
- package/src/gtk-overlay.spec.ts +141 -0
- package/src/gtk-paned.spec.ts +267 -0
- package/src/gtk-password-entry.spec.ts +150 -0
- package/src/gtk-picture.spec.ts +172 -0
- package/src/gtk-popover-bin.spec.ts +229 -0
- package/src/gtk-popover-menu-bar.spec.ts +296 -0
- package/src/gtk-popover-menu.spec.ts +261 -0
- package/src/gtk-popover-role.spec.ts +138 -0
- package/src/gtk-popover.spec.ts +264 -0
- package/src/gtk-print-dialogs.spec.ts +251 -0
- package/src/gtk-revealer.spec.ts +164 -0
- package/src/gtk-scale-button.spec.ts +218 -0
- package/src/gtk-scale.spec.ts +213 -0
- package/src/gtk-scrollbar.spec.ts +244 -0
- package/src/gtk-scrolled-window.spec.ts +262 -0
- package/src/gtk-search-bar.spec.ts +179 -0
- package/src/gtk-search-entry.spec.ts +142 -0
- package/src/gtk-separator.spec.ts +74 -0
- package/src/gtk-spin-button.spec.ts +186 -0
- package/src/gtk-spinner.spec.ts +130 -0
- package/src/gtk-stack-sidebar.spec.ts +217 -0
- package/src/gtk-stack-switcher.spec.ts +249 -0
- package/src/gtk-stack.spec.ts +432 -0
- package/src/gtk-text-view.spec.ts +189 -0
- package/src/gtk-text.spec.ts +163 -0
- package/src/gtk-toggle-button.spec.ts +186 -0
- package/src/gtk-tree-expander.spec.ts +201 -0
- package/src/gtk-video.spec.ts +240 -0
- package/src/gtk-viewport.spec.ts +140 -0
- package/src/gtk-window-controls.spec.ts +232 -0
- package/src/gtk-window-handle.spec.ts +158 -0
- package/src/gtk-window.spec.ts +190 -0
- package/src/index.ts +9 -1
- package/src/keyboard-operable.spec.ts +33 -1
- package/src/list-view-dom.ts +121 -0
- package/src/namespace/adw.ts +12 -0
- package/src/namespace/gtk.ts +61 -0
- package/src/page-setup.ts +222 -0
- package/src/scroll-shading.ts +18 -1
- package/src/shared-tree-builder.ts +263 -21
- package/src/signals.ts +15 -0
- package/src/source-view/theme.ts +11 -5
- package/src/style-classes.spec.ts +9 -8
- package/src/styles.generated.ts +1 -1
- package/src/tab-chip.ts +200 -0
- package/src/template-classes.ts +45 -0
- package/src/test.browser.mts +152 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// ADR 0093: this renderer's `./capabilities` table held to `CONSTRUCT_VECTORS` through the real
|
|
2
|
+
// tree builder and the elements it mounts.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
BREAKPOINT_VECTOR_SIZES,
|
|
6
|
+
CONSTRUCT_VECTORS,
|
|
7
|
+
EXTERN_VECTOR_CLASS,
|
|
8
|
+
driveConstructVectors,
|
|
9
|
+
type ConstructVector,
|
|
10
|
+
type SharedTreeNode,
|
|
11
|
+
} from '@gjsify/adwaita-core/conformance';
|
|
12
|
+
import { describe, expect, it } from '@gjsify/unit';
|
|
13
|
+
|
|
14
|
+
import type { AdwAlertDialog } from './elements/adw-alert-dialog.js';
|
|
15
|
+
import { capabilities } from './capabilities.mjs';
|
|
16
|
+
import { buildSharedTree, mountSharedTree } from './shared-tree-builder.js';
|
|
17
|
+
import { registerTemplateClass } from './template-classes.js';
|
|
18
|
+
|
|
19
|
+
const vector = (kind: string) => CONSTRUCT_VECTORS.find((each) => each.kind === kind)!.tree;
|
|
20
|
+
|
|
21
|
+
class CorpusExtern extends HTMLElement {}
|
|
22
|
+
customElements.define('corpus-extern', CorpusExtern);
|
|
23
|
+
registerTemplateClass(EXTERN_VECTOR_CLASS, 'corpus-extern');
|
|
24
|
+
|
|
25
|
+
function observe(vector: ConstructVector): unknown {
|
|
26
|
+
if (vector.kind === 'layout') {
|
|
27
|
+
buildSharedTree(vector.tree);
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (vector.kind === 'page') {
|
|
31
|
+
const stack = buildSharedTree(vector.tree);
|
|
32
|
+
return [{ name: stack.children[0]!.getAttribute('name'), title: stack.children[0]!.getAttribute('title') }];
|
|
33
|
+
}
|
|
34
|
+
if (vector.kind === 'signal') {
|
|
35
|
+
let calls = 0;
|
|
36
|
+
const { root, unmount } = mountSharedTree(vector.tree, {
|
|
37
|
+
scope: {
|
|
38
|
+
onClicked: () => {
|
|
39
|
+
calls++;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
try {
|
|
44
|
+
root.querySelector('#pressed')!.dispatchEvent(new Event('click'));
|
|
45
|
+
return [{ handler: 'onClicked', calls }];
|
|
46
|
+
} finally {
|
|
47
|
+
unmount();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (vector.kind === 'bind') {
|
|
51
|
+
const { root, unmount } = mountSharedTree(vector.tree);
|
|
52
|
+
try {
|
|
53
|
+
const source = root.querySelector('#source') as unknown as { active: boolean };
|
|
54
|
+
const target = root.querySelector('#target') as unknown as { active: boolean };
|
|
55
|
+
const afterBuild = target.active;
|
|
56
|
+
source.active = true;
|
|
57
|
+
return { afterBuild, afterSourceOn: target.active };
|
|
58
|
+
} finally {
|
|
59
|
+
unmount();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (vector.kind === 'breakpoint') {
|
|
63
|
+
let feed: ((size: { width: number; height: number }) => void) | undefined;
|
|
64
|
+
const { root, unmount } = mountSharedTree(vector.tree, {
|
|
65
|
+
observeSize: (_element, onSize) => {
|
|
66
|
+
feed = onSize;
|
|
67
|
+
return () => {};
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
try {
|
|
71
|
+
return BREAKPOINT_VECTOR_SIZES.map((size) => {
|
|
72
|
+
feed!(size);
|
|
73
|
+
return root.querySelector('#caption')!.getAttribute('label');
|
|
74
|
+
});
|
|
75
|
+
} finally {
|
|
76
|
+
unmount();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (vector.kind === 'extern') {
|
|
80
|
+
return [...buildSharedTree(vector.tree).children].map((child) => ({
|
|
81
|
+
id: child.id,
|
|
82
|
+
builtByRegisteredClass: child instanceof CorpusExtern,
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
const { root, unmount } = mountSharedTree(vector.tree);
|
|
86
|
+
try {
|
|
87
|
+
if (vector.kind === 'strings') {
|
|
88
|
+
return [...root.querySelectorAll('option, .adw-drop-down-item-label')].map((node) => node.textContent);
|
|
89
|
+
}
|
|
90
|
+
const dialog = root as unknown as AdwAlertDialog;
|
|
91
|
+
return (vector.tree.extensions?.responses ?? []).map(({ id }) => ({
|
|
92
|
+
id,
|
|
93
|
+
label: dialog.getResponseLabel(id),
|
|
94
|
+
appearance: dialog.getResponseAppearance(id),
|
|
95
|
+
enabled: dialog.getResponseEnabled(id),
|
|
96
|
+
}));
|
|
97
|
+
} finally {
|
|
98
|
+
unmount();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const AdwConstructVectorsTest = async () => {
|
|
103
|
+
await driveConstructVectors(
|
|
104
|
+
{ name: 'adwaita-web', capabilities, vectors: CONSTRUCT_VECTORS, observe },
|
|
105
|
+
{ describe, it, expect },
|
|
106
|
+
);
|
|
107
|
+
await describe('adwaita-web: template classes and handlers (ADR 0093)', async () => {
|
|
108
|
+
await it('refuses an extern name nothing registered, naming it', () => {
|
|
109
|
+
expect(() =>
|
|
110
|
+
buildSharedTree({ tag: 'GtkBox', children: [{ tag: 'NobodyRegisteredThis', extern: true }] }),
|
|
111
|
+
).toThrow("'$NobodyRegisteredThis'");
|
|
112
|
+
});
|
|
113
|
+
await it('refuses a second tag under a registered name', () => {
|
|
114
|
+
expect(() => registerTemplateClass(EXTERN_VECTOR_CLASS, 'corpus-extern-two')).toThrow('already registered');
|
|
115
|
+
});
|
|
116
|
+
await it('refuses a registered tag nothing defined, naming it', () => {
|
|
117
|
+
registerTemplateClass('CorpusUndefinedTag', 'corpus-undefined-tag');
|
|
118
|
+
expect(() =>
|
|
119
|
+
buildSharedTree({ tag: 'GtkBox', children: [{ tag: 'CorpusUndefinedTag', extern: true }] }),
|
|
120
|
+
).toThrow('nothing has defined');
|
|
121
|
+
});
|
|
122
|
+
await it('refuses a signal handler the scope lacks, naming it', () => {
|
|
123
|
+
const tree = vector('signal');
|
|
124
|
+
expect(() => mountSharedTree(tree)).toThrow("'onClicked'");
|
|
125
|
+
expect(() => mountSharedTree(tree, { scope: {} })).toThrow('has no such function');
|
|
126
|
+
});
|
|
127
|
+
await it('refuses a signal the element does not declare, and the forms it has not verified', () => {
|
|
128
|
+
const on = (signal: NonNullable<SharedTreeNode['signals']>[number]): SharedTreeNode => ({
|
|
129
|
+
tag: 'GtkBox',
|
|
130
|
+
children: [{ tag: 'GtkButton', signals: [signal] }],
|
|
131
|
+
});
|
|
132
|
+
const scope = { onX: () => {} };
|
|
133
|
+
expect(() => mountSharedTree(on({ name: 'map', handler: 'onX' }), { scope })).toThrow("no signal 'map'");
|
|
134
|
+
expect(() => mountSharedTree(on({ name: 'clicked', handler: 'onX', flags: ['after'] }), { scope })).toThrow(
|
|
135
|
+
'plain handlers only',
|
|
136
|
+
);
|
|
137
|
+
expect(() => mountSharedTree(on({ name: 'clicked', handler: 'onX', object: 'a' }), { scope })).toThrow(
|
|
138
|
+
'plain handlers only',
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
await it('refuses a bind to an id nothing has, to a source that dispatches no notify, and the flags', () => {
|
|
142
|
+
const bound = (binding: NonNullable<SharedTreeNode['bindings']>[string], sourceTag = 'GtkToggleButton') =>
|
|
143
|
+
({
|
|
144
|
+
tag: 'GtkBox',
|
|
145
|
+
children: [
|
|
146
|
+
{ tag: sourceTag, id: 'source' },
|
|
147
|
+
{ tag: 'GtkToggleButton', bindings: { active: binding } },
|
|
148
|
+
],
|
|
149
|
+
}) as SharedTreeNode;
|
|
150
|
+
expect(() => mountSharedTree(bound({ source: 'nobody', property: 'active' }))).toThrow("id 'nobody'");
|
|
151
|
+
expect(() => mountSharedTree(bound({ source: 'template', property: 'active' }))).toThrow("id 'template'");
|
|
152
|
+
expect(() => mountSharedTree(bound({ source: 'source', property: 'active' }, 'GtkLabel'))).toThrow(
|
|
153
|
+
"dispatches no 'notify::active'",
|
|
154
|
+
);
|
|
155
|
+
expect(() => mountSharedTree(bound({ source: 'source', property: 'active', flags: ['inverted'] }))).toThrow(
|
|
156
|
+
'plain form only',
|
|
157
|
+
);
|
|
158
|
+
});
|
|
159
|
+
await it('refuses a breakpoint setter that names no object, and a condition nobody can read', () => {
|
|
160
|
+
const withBreakpoint = (object: string, condition = 'max-width: 400px') =>
|
|
161
|
+
({
|
|
162
|
+
tag: 'GtkBox',
|
|
163
|
+
children: [{ tag: 'GtkLabel', id: 'caption' }],
|
|
164
|
+
breakpoints: [{ condition, setters: [{ object, property: 'label', value: 'x' }] }],
|
|
165
|
+
}) as SharedTreeNode;
|
|
166
|
+
expect(() => mountSharedTree(withBreakpoint('nobody'))).toThrow("id 'nobody'");
|
|
167
|
+
expect(() => mountSharedTree(withBreakpoint('template'))).toThrow("id 'template'");
|
|
168
|
+
expect(() => mountSharedTree(withBreakpoint('caption', 'wide please'))).toThrow('breakpoint condition');
|
|
169
|
+
});
|
|
170
|
+
await it('does not read a registered name for a node that is not extern', () => {
|
|
171
|
+
const el = buildSharedTree({ tag: 'GtkBox', children: [{ tag: 'GtkLabel' }] });
|
|
172
|
+
expect(el.children[0]!.localName).toBe('gtk-label');
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// <adw-application-window> — the web counterpart of Adw.ApplicationWindow: an
|
|
2
|
+
// AdwWindow that belongs to a GtkApplication, plus that application's menubar.
|
|
3
|
+
//
|
|
4
|
+
// WHAT ADDS UPSTREAM, measured: `Adw.ApplicationWindow` extends `GtkApplicationWindow`
|
|
5
|
+
// and adds nothing but its own `content` / `adaptive-preview` pair, which are
|
|
6
|
+
// AdwWindow's (Adw-1.gir, `parent="ApplicationWindow"`). The whole difference from
|
|
7
|
+
// <adw-window> is `Gtk.ApplicationWindow:show-menubar` — one boolean, and the window
|
|
8
|
+
// draws the menubar the GtkApplication installed in `Gtk.Application:menubar` when it
|
|
9
|
+
// is on, and no menubar at all when it is off.
|
|
10
|
+
//
|
|
11
|
+
// A BROWSER HAS NO GtkApplication, so the model is handed to the window instead of to
|
|
12
|
+
// an application that does not exist here. `menu-model` is the same portable menu value
|
|
13
|
+
// ADR 0042 gave `<gtk-menu-button>` and `<adw-split-button>` (a JSON array), and it is
|
|
14
|
+
// read through the same core parser, so one menu is written once. A menubar is a row of
|
|
15
|
+
// MENU LINKS, which is what `Adw.Application`'s menubar is documented to be, so a
|
|
16
|
+
// section is inlined and a bare item becomes a plain button — `flattenMenu` is the
|
|
17
|
+
// walk that decides both.
|
|
18
|
+
//
|
|
19
|
+
// Attributes:
|
|
20
|
+
// show-menubar (boolean — Gtk.ApplicationWindow:show-menubar; the bar is drawn only
|
|
21
|
+
// while this is set AND the model has something in it, exactly as GTK draws no bar
|
|
22
|
+
// for an application that installed none)
|
|
23
|
+
// menu-model (the portable menu model, JSON — the stand-in for the model a
|
|
24
|
+
// GtkApplication would own; the same value `<gtk-menu-button menu-model>` takes)
|
|
25
|
+
//
|
|
26
|
+
// Extends <adw-window> and adds nothing else: the content property, the size request,
|
|
27
|
+
// the breakpoints and the dialog bookkeeping are all inherited.
|
|
28
|
+
//
|
|
29
|
+
// Reference: refs/libadwaita/src/adw-application-window.c (the class adds no behaviour)
|
|
30
|
+
// Reference: Gtk-4.0.gir `Gtk.ApplicationWindow:show-menubar` ("If this property is true,
|
|
31
|
+
// the window will display a menubar unless it is shown by the desktop shell")
|
|
32
|
+
// Copyright (c) 2021-2023 Alice Mikhaylenko / Purism SPC (libadwaita). LGPLv2.1+
|
|
33
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
34
|
+
|
|
35
|
+
import {
|
|
36
|
+
flattenMenu,
|
|
37
|
+
normalizeMenuModel,
|
|
38
|
+
parseMenuModel,
|
|
39
|
+
type AdwMenuInput,
|
|
40
|
+
type AdwMenuModel,
|
|
41
|
+
} from '@gjsify/adwaita-core';
|
|
42
|
+
|
|
43
|
+
import { AdwWindow } from './adw-window.js';
|
|
44
|
+
|
|
45
|
+
export class AdwApplicationWindow extends AdwWindow {
|
|
46
|
+
private _menubarEl: HTMLDivElement | null = null;
|
|
47
|
+
private _model: AdwMenuModel = [];
|
|
48
|
+
|
|
49
|
+
// The base's list BY NAME, not `super.observedAttributes`: `AdwPasswordEntryRow`
|
|
50
|
+
// spells its spread this way and the attribute readers follow (`adwaita-elements.mjs`
|
|
51
|
+
// resolves a `[...Base.observedAttributes]` spread across files, and reports a
|
|
52
|
+
// `super` one as unreadable rather than as empty).
|
|
53
|
+
static get observedAttributes(): string[] {
|
|
54
|
+
return [...AdwWindow.observedAttributes, 'show-menubar', 'menu-model'];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Whether this window shows the application's menubar (Gtk.ApplicationWindow:show-menubar). */
|
|
58
|
+
get showMenubar(): boolean {
|
|
59
|
+
return this.hasAttribute('show-menubar');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
set showMenubar(value: boolean) {
|
|
63
|
+
if (value) this.setAttribute('show-menubar', '');
|
|
64
|
+
else this.removeAttribute('show-menubar');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The menubar's model — what a GtkApplication would own here. */
|
|
68
|
+
get menuModel(): AdwMenuModel {
|
|
69
|
+
return this._model;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
set menuModel(value: AdwMenuInput) {
|
|
73
|
+
this._model = normalizeMenuModel(value);
|
|
74
|
+
this._renderMenubar();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The menubar strip, or null before the window is connected. */
|
|
78
|
+
get menubar(): HTMLDivElement | null {
|
|
79
|
+
return this._menubarEl;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
connectedCallback() {
|
|
83
|
+
super.connectedCallback();
|
|
84
|
+
this._buildMenubar();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
attributeChangedCallback(name: string) {
|
|
88
|
+
super.attributeChangedCallback(name);
|
|
89
|
+
// The attribute is the declarative form and it wins when it changes — the same
|
|
90
|
+
// precedence `<gtk-menu-button>` gives `menu-model`, through the same parser.
|
|
91
|
+
if (name === 'menu-model') this._model = parseMenuModel(this.getAttribute('menu-model'));
|
|
92
|
+
// Before the first connect the menubar does not exist yet, and `_buildMenubar`
|
|
93
|
+
// renders from the model this has just read — so nothing is built twice.
|
|
94
|
+
if (name === 'show-menubar' || name === 'menu-model') this._renderMenubar();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The menubar, INSIDE the content area rather than beside it.
|
|
99
|
+
*
|
|
100
|
+
* `bindSlottedChildren` watches the host and moves every child it does not claim
|
|
101
|
+
* into the content area, so a sibling would be re-homed into it one tick later. The
|
|
102
|
+
* content area's own children are not watched, so prepending here is stable — and
|
|
103
|
+
* it is also where the bar belongs: above the toolbar view, inside the window box.
|
|
104
|
+
*/
|
|
105
|
+
private _buildMenubar() {
|
|
106
|
+
if (this._menubarEl) return;
|
|
107
|
+
this._menubarEl = document.createElement('div');
|
|
108
|
+
this._menubarEl.className = 'adw-application-window-menubar';
|
|
109
|
+
this.contentArea.prepend(this._menubarEl);
|
|
110
|
+
|
|
111
|
+
this._renderMenubar();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private _renderMenubar(): void {
|
|
115
|
+
const bar = this._menubarEl;
|
|
116
|
+
if (bar === null) return;
|
|
117
|
+
|
|
118
|
+
bar.replaceChildren();
|
|
119
|
+
// GTK draws no menubar for an application that installed none, so neither does
|
|
120
|
+
// this: both the flag and a model with rows in it are required.
|
|
121
|
+
bar.hidden = !this.showMenubar || this._model.length === 0;
|
|
122
|
+
|
|
123
|
+
for (const row of flattenMenu(this._model)) {
|
|
124
|
+
const node = row.node;
|
|
125
|
+
if (node.kind === 'submenu') {
|
|
126
|
+
// A link is a menu the user OPENS — a button with that menu on it,
|
|
127
|
+
// which is the whole of what a Gtk.PopoverMenuBar row is.
|
|
128
|
+
const button = document.createElement('gtk-menu-button');
|
|
129
|
+
button.setAttribute('menu-title', node.label);
|
|
130
|
+
(button as unknown as { menuModel: AdwMenuInput }).menuModel = node.items;
|
|
131
|
+
bar.appendChild(button);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// A bare item has no menu to open, so it is a button that activates it — and
|
|
135
|
+
// it reports the activation the way every other menu surface here does
|
|
136
|
+
// (`<gtk-menu-button>`, `<adw-split-button>`): the item's id, its label and
|
|
137
|
+
// its PATH in the model.
|
|
138
|
+
const button = document.createElement('gtk-button');
|
|
139
|
+
button.setAttribute('label', node.label ?? '');
|
|
140
|
+
button.setAttribute('flat', '');
|
|
141
|
+
button.addEventListener('click', () => {
|
|
142
|
+
this.dispatchEvent(
|
|
143
|
+
new CustomEvent('menu-item-activated', {
|
|
144
|
+
bubbles: true,
|
|
145
|
+
detail: { id: node.id ?? node.label, label: node.label, path: [...row.path] },
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
bar.appendChild(button);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
customElements.define('adw-application-window', AdwApplicationWindow);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// <adw-bin> — a widget with ONE child.
|
|
2
|
+
//
|
|
3
|
+
// The smallest container libadwaita ships and the base every other one-child widget
|
|
4
|
+
// derives from: `adw_bin_set_child` replaces what was there, `GtkBinLayout` gives the
|
|
5
|
+
// child the whole allocation, `compute_expand` follows the child and `focus` goes to
|
|
6
|
+
// it (adw-bin.c:108-123). There is no `bin` node in the stylesheet — the widget draws
|
|
7
|
+
// nothing of its own, which is why the whole element is the slot and nothing else.
|
|
8
|
+
//
|
|
9
|
+
// ONE CHILD, and the replacement is C's, not the DOM's: a second child REPLACES the
|
|
10
|
+
// first rather than stacking beside it. Two doors lead there — `child`/`setChild`, which
|
|
11
|
+
// libadwaita offers, and a plain `append`, which markup and a `.blp`'s `child: …` use —
|
|
12
|
+
// and an observer on the host makes the second one end where the first does: the LAST
|
|
13
|
+
// child stays. The slot routing below only enrols the NAME `child` so a `.blp`'s child is
|
|
14
|
+
// not refused sight unseen (`src/slotted-children.ts`, and the reason `adw-clamp.ts`
|
|
15
|
+
// gives for not calling `.install()`).
|
|
16
|
+
//
|
|
17
|
+
// `set_child` REFUSES a child that already has a parent (`g_return_if_fail (gtk_widget
|
|
18
|
+
// _get_parent (child) == NULL)`, adw-bin.c:208). A DOM append MOVES such a node rather
|
|
19
|
+
// than rejecting it, so `setChild` refuses a child whose parent is another element and
|
|
20
|
+
// says so — the same contract `adw_preferences_group_remove` keeps in
|
|
21
|
+
// `<adw-preferences-group>`.
|
|
22
|
+
//
|
|
23
|
+
// A11Y: no role. `adw_bin_class_init` sets none, so the widget keeps `GtkWidget`'s
|
|
24
|
+
// default `GENERIC` and a bin contributes nothing to the accessibility tree of its own.
|
|
25
|
+
//
|
|
26
|
+
// KNOWN_GAPS: none — `AdwBin`'s only property is `child`, a widget, which is a SLOT on
|
|
27
|
+
// every renderer.
|
|
28
|
+
//
|
|
29
|
+
// Reference: refs/libadwaita/src/adw-bin.c (adw_bin_set_child, class_init)
|
|
30
|
+
// Copyright (c) 2021 Purism SPC / GNOME contributors (libadwaita). LGPLv2.1+.
|
|
31
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
32
|
+
|
|
33
|
+
import { bindSlottedChildren } from '../slotted-children.js';
|
|
34
|
+
|
|
35
|
+
export class AdwBin extends HTMLElement {
|
|
36
|
+
private _observer: MutationObserver | null = null;
|
|
37
|
+
|
|
38
|
+
/** `Adw.Bin:child` — the one child, or `null`. The last one appended is the one that stays. */
|
|
39
|
+
get child(): Element | null {
|
|
40
|
+
return this.lastElementChild;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** `adw_bin_set_child`: replace the current child, unparenting it. */
|
|
44
|
+
set child(value: Element | null) {
|
|
45
|
+
this.setChild(value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
// The NAME only. Every child of a bin already IS its content — there is no
|
|
50
|
+
// internal structure to route into — so `.install()` is deliberately not called
|
|
51
|
+
// for the reason `adw-clamp.ts` gives: it would `replaceChildren` a subtree the
|
|
52
|
+
// author wrote and arm an observer that then re-routes what the element itself
|
|
53
|
+
// puts there.
|
|
54
|
+
bindSlottedChildren(this, [{ name: 'child', into: this }]);
|
|
55
|
+
this._enforceSingleChild();
|
|
56
|
+
// After the enforcement above, so its own removals are not reported back to it.
|
|
57
|
+
this._observer ??= new MutationObserver(() => this._enforceSingleChild());
|
|
58
|
+
this._observer.observe(this, { childList: true });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
disconnectedCallback() {
|
|
62
|
+
// A bin parked with two children (both appended while detached, where no
|
|
63
|
+
// observer is watching) comes back to one on re-entry, in connectedCallback.
|
|
64
|
+
this._observer?.disconnect();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* `adw_bin_set_child` — the LAST child wins, and the one it replaces leaves.
|
|
69
|
+
*
|
|
70
|
+
* A removal, not a move: C unparents the child it replaces.
|
|
71
|
+
*/
|
|
72
|
+
private _enforceSingleChild(): void {
|
|
73
|
+
const last = this.lastElementChild;
|
|
74
|
+
if (last === null) return;
|
|
75
|
+
for (const child of Array.from(this.children)) {
|
|
76
|
+
if (child === last) break;
|
|
77
|
+
child.remove();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** `adw_bin_set_child`, including its refusal of a child that already has a parent. */
|
|
82
|
+
setChild(value: Element | null): void {
|
|
83
|
+
if (value !== null && value.parentElement !== null && value.parentElement !== this) {
|
|
84
|
+
// C's `g_return_if_fail` is a no-op with a message on stderr; returning
|
|
85
|
+
// `false` is the same contract without the write, and `child`'s setter
|
|
86
|
+
// drops the answer the way the other elements' do.
|
|
87
|
+
throw new Error('AdwBin.setChild: the child already has a parent.');
|
|
88
|
+
}
|
|
89
|
+
if (value === this.child) return;
|
|
90
|
+
|
|
91
|
+
const previous = this.child;
|
|
92
|
+
if (value === null) {
|
|
93
|
+
previous?.remove();
|
|
94
|
+
} else {
|
|
95
|
+
this.replaceChildren(value);
|
|
96
|
+
}
|
|
97
|
+
this.dispatchEvent(new CustomEvent('notify::child', { bubbles: true, detail: { child: value } }));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
customElements.define('adw-bin', AdwBin);
|