@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,170 @@
|
|
|
1
|
+
// <gtk-password-entry> — a field for a secret: masked by default, no copy, a Caps Lock
|
|
2
|
+
// warning, and optionally a button that reveals it for one look.
|
|
3
|
+
//
|
|
4
|
+
// `Gtk.PasswordEntry` does NOT derive from `Gtk.Entry` — it is a sibling that implements
|
|
5
|
+
// `GtkEditable` itself, which is why this header cannot say "it IS an entry". It EXTENDS
|
|
6
|
+
// `<gtk-entry>` here all the same, because what a browser has is an `<input>` and
|
|
7
|
+
// `GtkEntry` is the one module that owns one; what this element adds is the masked
|
|
8
|
+
// default, the peek button and the Caps Lock indicator, all of which C builds around its
|
|
9
|
+
// own inner `Gtk.Text` for the same reason.
|
|
10
|
+
//
|
|
11
|
+
// THE REVEAL + CAPS-LOCK DERIVATION IS HEADLESS and already exists:
|
|
12
|
+
// `PasswordEntryRowState` in `@gjsify/adwaita-core` is libadwaita's `notify_visibility_cb`
|
|
13
|
+
// truth table, composed with an `EntryRowState` so `editing && show_indicator` — the
|
|
14
|
+
// warning's own focus condition, which `adw_entry_row_set_show_indicator` reaches through a
|
|
15
|
+
// private hook — is derived in one place (ADR 0004). `Adw.PasswordEntryRow` and
|
|
16
|
+
// `Gtk.PasswordEntry` are those same two rules over the same four inputs, so this element
|
|
17
|
+
// composes that state rather than writing a second copy of it.
|
|
18
|
+
//
|
|
19
|
+
// WHAT THE BROWSER CANNOT DO, and what it does instead:
|
|
20
|
+
// · `caps-lock-symbolic` is in neither the Adwaita icon theme nor `@gjsify/adwaita-icons`,
|
|
21
|
+
// so the indicator is the TEXT glyph `⇪` with the canonical name in `data-icon-name` —
|
|
22
|
+
// the substitution `<adw-password-entry-row>` already makes
|
|
23
|
+
// (status/adwaita-web-icon-masks.json, `caps-lock`).
|
|
24
|
+
// · The `GtkEntryBuffer` C allocates is documented as non-pageable so the secret is not
|
|
25
|
+
// written out to swap; a browser input has no such buffer and a script on the page can
|
|
26
|
+
// read the DOM either way.
|
|
27
|
+
// · `extra-menu` is a `Gio.MenuModel` — a slot, not an attribute, and out of scope for a
|
|
28
|
+
// browser context menu. `activates-default` and `placeholder-text` are in `KNOWN_GAPS`.
|
|
29
|
+
//
|
|
30
|
+
// A11Y: the inner `<input type="password">` IS the text box, which is what
|
|
31
|
+
// `GTK_ACCESSIBLE_ROLE_TEXT_BOX` (gtkpasswordentry.c:536) means; the host does not restate
|
|
32
|
+
// a role the focused node already has.
|
|
33
|
+
//
|
|
34
|
+
// Reference: refs/libadwaita/src/stylesheet/widgets/_entries.scss:1-96 (entry.password)
|
|
35
|
+
// Reference: refs/gtk/gtk/gtkpasswordentry.c (properties, init, visibility_toggled, activate_cb)
|
|
36
|
+
// Reference: refs/libadwaita/src/adw-password-entry-row.c (the derivation this reuses)
|
|
37
|
+
// Copyright (c) GNOME contributors (libadwaita, GTK). LGPLv2.1+.
|
|
38
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web; the peek + caps-lock
|
|
39
|
+
// derivation composed from @gjsify/adwaita-core.
|
|
40
|
+
|
|
41
|
+
import { EntryRowState, PasswordEntryRowState } from '@gjsify/adwaita-core';
|
|
42
|
+
import type { PasswordEntryRowRenderState } from '@gjsify/adwaita-core';
|
|
43
|
+
|
|
44
|
+
import { createGtkImage, type GtkImage } from './gtk-image.js';
|
|
45
|
+
|
|
46
|
+
import { GtkEntry } from './gtk-entry.js';
|
|
47
|
+
|
|
48
|
+
/** The glyph for the one symbolic `@gjsify/adwaita-icons` cannot compile — see the header. */
|
|
49
|
+
const CAPS_LOCK_GLYPH = '⇪';
|
|
50
|
+
|
|
51
|
+
export class GtkPasswordEntry extends GtkEntry {
|
|
52
|
+
/** The headless peek + caps-lock derivation, composing the entry's own state. */
|
|
53
|
+
private readonly _entry = new EntryRowState();
|
|
54
|
+
private readonly _password = new PasswordEntryRowState(this._entry);
|
|
55
|
+
private _toggle!: HTMLButtonElement;
|
|
56
|
+
private _peekIcon!: GtkImage;
|
|
57
|
+
private _capsLock!: HTMLElement;
|
|
58
|
+
|
|
59
|
+
static get observedAttributes(): string[] {
|
|
60
|
+
return [...GtkEntry.observedAttributes, 'show-peek-icon'];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Whether the contents are shown in clear text (`GtkText:visibility`). */
|
|
64
|
+
get revealed(): boolean {
|
|
65
|
+
return this._password.revealed;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
set revealed(value: boolean) {
|
|
69
|
+
this._password.setRevealed(value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Whether Caps Lock is engaged, as last observed from a keyboard event. */
|
|
73
|
+
get capsLockOn(): boolean {
|
|
74
|
+
return this._password.capsLockOn;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Feed the platform's Caps Lock state in — GDK reads it off the keyboard device
|
|
79
|
+
* (`gdk_device_get_caps_lock_state`), which a browser exposes only on keyboard events.
|
|
80
|
+
* Public so a host that knows better (a virtual keyboard, a test) can drive it directly.
|
|
81
|
+
*/
|
|
82
|
+
setCapsLockOn(on: boolean): void {
|
|
83
|
+
this._password.setCapsLockOn(on);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
override connectedCallback(): void {
|
|
87
|
+
super.connectedCallback();
|
|
88
|
+
|
|
89
|
+
// C's `gtk_text_set_visibility (…, FALSE)` + `GTK_INPUT_PURPOSE_PASSWORD`.
|
|
90
|
+
this._input.type = 'password';
|
|
91
|
+
this._input.autocomplete = 'new-password';
|
|
92
|
+
|
|
93
|
+
this._capsLock = document.createElement('span');
|
|
94
|
+
this._capsLock.className = 'adw-password-entry-caps-lock';
|
|
95
|
+
this._capsLock.textContent = CAPS_LOCK_GLYPH;
|
|
96
|
+
this._capsLock.setAttribute('role', 'alert');
|
|
97
|
+
|
|
98
|
+
this._toggle = document.createElement('button');
|
|
99
|
+
this._toggle.type = 'button';
|
|
100
|
+
this._toggle.className = 'adw-button flat circular icon-only adw-password-entry-peek';
|
|
101
|
+
this._peekIcon = createGtkImage(null, 'adw-password-entry-peek-icon');
|
|
102
|
+
this._toggle.append(this._peekIcon);
|
|
103
|
+
this._toggle.addEventListener('click', () => this._password.togglePeek());
|
|
104
|
+
// A click must not take the caret out of the field, which it would by default.
|
|
105
|
+
this._toggle.addEventListener('mousedown', (event) => event.preventDefault());
|
|
106
|
+
|
|
107
|
+
// GDK reads caps lock off the keyboard device; the browser exposes it only on
|
|
108
|
+
// keyboard events, so those are the source here. Focus is the OTHER input the
|
|
109
|
+
// derivation needs — GTK's `caps_lock_state_changed` requires `has_focus` too.
|
|
110
|
+
const readCapsLock = (event: KeyboardEvent) => this._password.setCapsLockOn(event.getModifierState('CapsLock'));
|
|
111
|
+
this._input.addEventListener('keydown', readCapsLock);
|
|
112
|
+
this._input.addEventListener('keyup', readCapsLock);
|
|
113
|
+
this._input.addEventListener('focus', () => {
|
|
114
|
+
this._entry.setEditing(true);
|
|
115
|
+
this._passwordChanged();
|
|
116
|
+
});
|
|
117
|
+
this._input.addEventListener('blur', () => {
|
|
118
|
+
this._entry.setEditing(false);
|
|
119
|
+
this._passwordChanged();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// The indicator leads and the peek button trails, the order libadwaita's
|
|
123
|
+
// `&.password image.caps-lock-indicator` and the C's own sizing put them in.
|
|
124
|
+
this.replaceChildren(this._capsLock, this._input, this._toggle);
|
|
125
|
+
|
|
126
|
+
this._toggle.hidden = !this.hasAttribute('show-peek-icon');
|
|
127
|
+
this._applyPassword(this._password.state);
|
|
128
|
+
this._password.subscribe((state) => {
|
|
129
|
+
this._applyPassword(state);
|
|
130
|
+
this.dispatchEvent(
|
|
131
|
+
new CustomEvent('notify::revealed', { bubbles: true, detail: { revealed: state.revealed } }),
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
override attributeChangedCallback(name: string, oldValue: string | null, value: string | null): void {
|
|
137
|
+
super.attributeChangedCallback(name, oldValue, value);
|
|
138
|
+
// `show-peek-icon` is FALSE by default (gtkpasswordentry.c:500-504), so a bare
|
|
139
|
+
// `<gtk-password-entry>` has no toggle at all — the same answer `Adw.PasswordEntryRow`
|
|
140
|
+
// gives, whose peek button it does show.
|
|
141
|
+
if (name === 'show-peek-icon' && this._toggle) this._toggle.hidden = value === null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** A focus change re-derives, because the warning's visibility is `editing && …`. */
|
|
145
|
+
private _passwordChanged(): void {
|
|
146
|
+
this._applyPassword(this._password.state);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** `notify_visibility_cb`, applied to the DOM. */
|
|
150
|
+
private _applyPassword(state: PasswordEntryRowRenderState): void {
|
|
151
|
+
this._input.type = state.revealed ? 'text' : 'password';
|
|
152
|
+
// The libadwaita name travels in `data-icon-name`; the mask class is the curated
|
|
153
|
+
// `@gjsify/adwaita-icons` spelling of the same symbolic, as `<adw-password-entry-row>`
|
|
154
|
+
// does for its own toggle.
|
|
155
|
+
this._peekIcon.dataset.iconName = state.peekIconName;
|
|
156
|
+
this._peekIcon.iconName = state.peekIconName;
|
|
157
|
+
this._toggle.title = state.peekLabel;
|
|
158
|
+
this._toggle.setAttribute('aria-label', state.peekLabel);
|
|
159
|
+
this._toggle.setAttribute('aria-pressed', String(state.revealed));
|
|
160
|
+
if (state.revealed) this.setAttribute('revealed', '');
|
|
161
|
+
else this.removeAttribute('revealed');
|
|
162
|
+
|
|
163
|
+
this._capsLock.dataset.iconName = state.indicatorIconName;
|
|
164
|
+
this._capsLock.title = state.indicatorTooltip;
|
|
165
|
+
this._capsLock.setAttribute('aria-label', state.indicatorTooltip);
|
|
166
|
+
this._capsLock.hidden = !this._entry.state.indicatorVisible;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
customElements.define('gtk-password-entry', GtkPasswordEntry);
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// <gtk-picture> — a paintable, sized by the box it is given rather than by itself.
|
|
2
|
+
//
|
|
3
|
+
// WHAT IT IS NOT. It is not a second `<gtk-image>` and it has no icon vocabulary at all:
|
|
4
|
+
// `GtkImage` draws a SYMBOLIC ICON at an icon size, `GtkPicture` draws an ARBITRARY
|
|
5
|
+
// `GdkPaintable` (a file, a texture, a video frame) fitted to an ALLOCATION. The two were
|
|
6
|
+
// separate GTK types for two decades and stayed separate in 4.8, when `GtkPicture` was
|
|
7
|
+
// introduced alongside the `content-fit` property that replaced `GtkImage`'s icon-name path
|
|
8
|
+
// for real images. This element therefore takes its content from the LIGHT DOM — the
|
|
9
|
+
// replaced element a page already has — and owns the four properties that decide how it is
|
|
10
|
+
// fitted and how it is announced.
|
|
11
|
+
//
|
|
12
|
+
// CONTENT-FIT IS `object-fit`. This is the rare property whose CSS counterpart is not an
|
|
13
|
+
// approximation but the same four cases, including the one `GtkContentFit` added and CSS
|
|
14
|
+
// already had (`SCALE_DOWN`, gtkpicture.c:162-167): `object-fit` takes `fill`, `contain`,
|
|
15
|
+
// `cover` and `scale-down`, and `GTK_CONTENT_FIT` takes `FILL`, `CONTAIN`, `COVER` and
|
|
16
|
+
// `SCALE_DOWN`. `_picture.scss` applies the value to the child through `object-fit:
|
|
17
|
+
// inherit`, which is why the element writes a custom property rather than the declaration
|
|
18
|
+
// itself — `object-fit` is not an inherited property, so the child needs the explicit
|
|
19
|
+
// keyword to take the parent's computed value.
|
|
20
|
+
//
|
|
21
|
+
// `FILL`, AND A PAINTABLE WITH NO RATIO, ARE THE SAME BRANCH. The snapshot divides on
|
|
22
|
+
// `content_fit == FILL || ratio == 0` (gtkpicture.c:146): a paintable that reports no
|
|
23
|
+
// intrinsic aspect ratio is stretched to the box whatever the mode says, because there is
|
|
24
|
+
// no ratio to preserve. This element keeps the two conditions SEPARATE in `fitMode()` —
|
|
25
|
+
// the property still reads back what was set — and lets `object-fit` be the thing that
|
|
26
|
+
// cannot honour a ratio it was not given.
|
|
27
|
+
//
|
|
28
|
+
// `CAN-SHRINK` IS THE MEASURE. `can-shrink` defaults to TRUE (gtkpicture.c:554), and a
|
|
29
|
+
// shrinking picture reports a minimum of ZERO on both axes whatever the paintable is
|
|
30
|
+
// (gtkpicture.c:245-248): it is a picture that may be smaller than its content, which is
|
|
31
|
+
// what every avatar, thumbnail and hero image in GTK needs. A picture that may not shrink
|
|
32
|
+
// asks the paintable for a CONCRETE minimum instead — the paintable's own minimum at the
|
|
33
|
+
// style's icon size (gtkpicture.c:249-254), which CSS spells `min-content`.
|
|
34
|
+
//
|
|
35
|
+
// `ISOLATE-CONTENTS` IS A RENDER ISOLATION, NOT A BLEND MODE. It defaults to TRUE
|
|
36
|
+
// (gtkpicture.c:555) and brackets the snapshot in `gtk_snapshot_push_isolation` /
|
|
37
|
+
// `pop_isolation` (gtkpicture.c:148-149, :203-204), which stops the paintable's own
|
|
38
|
+
// alpha compositing against whatever is behind the widget. CSS has the same boundary as a
|
|
39
|
+
// stacking context, and `isolation: isolate` is the declaration that creates one WITHOUT
|
|
40
|
+
// changing how the element is positioned or sized — `contain: paint` would also do it and
|
|
41
|
+
// would additionally change the containing block, which `push_isolation` does not.
|
|
42
|
+
//
|
|
43
|
+
// THE DEPRECATED PROPERTY IS STILL HONOURED. `keep-aspect-ratio` was deprecated in 4.8 in
|
|
44
|
+
// favour of `content-fit`, but it was not left inert: the setter maps TRUE to CONTAIN and
|
|
45
|
+
// FALSE to FILL (gtkpicture.c:1017-1021) and the getter inverts the test — it reads
|
|
46
|
+
// `content_fit != FILL`, so it is `TRUE` for CONTAIN, COVER and SCALE_DOWN alike
|
|
47
|
+
// (gtkpicture.c:1040). That inversion is the whole reason the property is implemented
|
|
48
|
+
// rather than listed as a gap: a SCALE_DOWN picture HAS an aspect ratio, and answering
|
|
49
|
+
// `FALSE` there would be a lie about a property the C answers `TRUE` for.
|
|
50
|
+
//
|
|
51
|
+
// A11Y: `role="img"`, GtkPicture's own accessible role (gtkpicture.c:553), with
|
|
52
|
+
// `alternative-text` as the accessible NAME (gtkpicture.c:474-483). The property is
|
|
53
|
+
// spelled `alternative-text` and NOT `alt` here because it is a GIR property and the
|
|
54
|
+
// spelling is what `check-adwaita-element-properties.mjs` measures against.
|
|
55
|
+
//
|
|
56
|
+
// Events: `notify::<prop>` (CustomEvent, bubbles, detail `{ <prop>: value }`) on every
|
|
57
|
+
// real change. `alternative-text` writes `aria-label` and nothing else — there is no
|
|
58
|
+
// accessible DESCRIPTION path in the GIR for this widget.
|
|
59
|
+
//
|
|
60
|
+
// Reference: refs/gtk/gtk/gtkpicture.c (the snapshot geometry :146-205, the measure
|
|
61
|
+
// :213-295, the property table :474-552, `keep-aspect-ratio` :1006-1040,
|
|
62
|
+
// `gtk_picture_set_content_fit` :1092-1131)
|
|
63
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
64
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
65
|
+
|
|
66
|
+
/** `GtkContentFit`, in enum order — the four nicks the GIR and CSS share. */
|
|
67
|
+
export const PICTURE_CONTENT_FIT_MODES = ['fill', 'contain', 'cover', 'scale-down'] as const;
|
|
68
|
+
|
|
69
|
+
export type PictureContentFit = (typeof PICTURE_CONTENT_FIT_MODES)[number];
|
|
70
|
+
|
|
71
|
+
/** `GTK_CONTENT_FIT_CONTAIN`, the default the C installs (gtkpicture.c:530, :555). */
|
|
72
|
+
export const DEFAULT_PICTURE_CONTENT_FIT: PictureContentFit = 'contain';
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* `GtkPicture:content-fit` from its nick, with the C's own guard: an unknown nick is left
|
|
76
|
+
* to the default rather than coerced to `fill`, which is the one value that would silently
|
|
77
|
+
* distort every picture a page writes.
|
|
78
|
+
*/
|
|
79
|
+
export function normalizePictureContentFit(value: unknown): PictureContentFit {
|
|
80
|
+
return (PICTURE_CONTENT_FIT_MODES as readonly unknown[]).includes(value)
|
|
81
|
+
? (value as PictureContentFit)
|
|
82
|
+
: DEFAULT_PICTURE_CONTENT_FIT;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export class GtkPicture extends HTMLElement {
|
|
86
|
+
private _initialized = false;
|
|
87
|
+
|
|
88
|
+
static get observedAttributes() {
|
|
89
|
+
return ['alternative-text', 'can-shrink', 'content-fit', 'isolate-contents', 'keep-aspect-ratio'];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* `GtkPicture:alternative-text` (gtkpicture.c:474-483) — the accessible NAME of the
|
|
94
|
+
* picture. It is NOT `alt`: the GIR property is `alternative-text`, and the element
|
|
95
|
+
* carries that spelling so the attribute and the property are one write.
|
|
96
|
+
*/
|
|
97
|
+
get alternativeText(): string {
|
|
98
|
+
return this.getAttribute('alternative-text') ?? '';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
set alternativeText(value: string) {
|
|
102
|
+
this._write('alternative-text', value);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** `GtkPicture:can-shrink` (gtkpicture.c:486-497). Defaults to TRUE (gtkpicture.c:554). */
|
|
106
|
+
get canShrink(): boolean {
|
|
107
|
+
// The property is a plain `TRUE`-defaulted boolean (gtkpicture.c:489), so an ABSENT
|
|
108
|
+
// attribute is TRUE — the same rule a declarative `<gtk-picture>` has to follow.
|
|
109
|
+
return !this.hasAttribute('can-shrink') || this.getAttribute('can-shrink') !== 'false';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
set canShrink(value: boolean) {
|
|
113
|
+
this._toggle('can-shrink', value, true);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** `GtkPicture:content-fit` (gtkpicture.c:520-531). Defaults to CONTAIN. */
|
|
117
|
+
get contentFit(): PictureContentFit {
|
|
118
|
+
return normalizePictureContentFit(this.getAttribute('content-fit'));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
set contentFit(value: PictureContentFit) {
|
|
122
|
+
this._write('content-fit', value);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* `GtkPicture:isolate-contents` (gtkpicture.c:538-549). Defaults to TRUE
|
|
127
|
+
* (gtkpicture.c:555) — the same absent-is-true rule {@link canShrink} follows, and for
|
|
128
|
+
* the same reason: the C installs the value in `init`, before any attribute is read.
|
|
129
|
+
*/
|
|
130
|
+
get isolateContents(): boolean {
|
|
131
|
+
return !this.hasAttribute('isolate-contents') || this.getAttribute('isolate-contents') !== 'false';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
set isolateContents(value: boolean) {
|
|
135
|
+
this._toggle('isolate-contents', value, true);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* `GtkPicture:keep-aspect-ratio` — DEPRECATED in 4.8, and implemented rather than
|
|
140
|
+
* dropped, because the C did not drop it (gtkpicture.c:1006-1040).
|
|
141
|
+
*
|
|
142
|
+
* The setter is a MAPPING, not a stored boolean (gtkpicture.c:1017-1021): TRUE sets
|
|
143
|
+
* `content-fit` to CONTAIN, FALSE sets it to FILL. The getter is the INVERSE test over
|
|
144
|
+
* the live `content-fit` (gtkpicture.c:1040), so a picture authored as `cover` or
|
|
145
|
+
* `scale-down` reads `true` back — those two preserve the ratio, exactly as CONTAIN
|
|
146
|
+
* does, and returning `false` for them would contradict the property's own definition.
|
|
147
|
+
*/
|
|
148
|
+
get keepAspectRatio(): boolean {
|
|
149
|
+
return this.contentFit !== 'fill';
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
set keepAspectRatio(value: boolean) {
|
|
153
|
+
this.contentFit = value ? 'contain' : 'fill';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* `setAttribute` runs the custom-element reaction for a write that changes nothing,
|
|
158
|
+
* while every GObject setter here returns early when the value is already right
|
|
159
|
+
* (gtkpicture.c:1111-1112). This is the guard that makes "notify only on a real
|
|
160
|
+
* change" true.
|
|
161
|
+
*/
|
|
162
|
+
private _write(name: string, value: string): void {
|
|
163
|
+
if (this.getAttribute(name) !== value) this.setAttribute(name, value);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A boolean whose GIR default is TRUE needs three states, not two: absent means TRUE
|
|
168
|
+
* (the default the C installs in `init`), `=""` means TRUE, and `="false"` means FALSE.
|
|
169
|
+
* `toggleAttribute` alone would make absent and empty the same state, which is right for
|
|
170
|
+
* a FALSE-defaulted property and wrong for every one of these three.
|
|
171
|
+
*/
|
|
172
|
+
private _toggle(name: string, value: boolean, gtypeDefault: boolean): void {
|
|
173
|
+
const target = value ? '' : 'false';
|
|
174
|
+
if (gtypeDefault) {
|
|
175
|
+
// FALSE is the only value that has to be WRITTEN; TRUE is the absence.
|
|
176
|
+
if (value) this.removeAttribute(name);
|
|
177
|
+
else this._write(name, target);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this._write(name, target);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
connectedCallback() {
|
|
184
|
+
if (this._initialized) {
|
|
185
|
+
this._render();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this._initialized = true;
|
|
189
|
+
|
|
190
|
+
// `gtk_widget_class_set_accessible_role (…, GTK_ACCESSIBLE_ROLE_IMG)`
|
|
191
|
+
// (gtkpicture.c:553) — a picture IS an image to a screen reader whether or not it
|
|
192
|
+
// has a name, and the role is what puts it in the image collection.
|
|
193
|
+
this.setAttribute('role', 'img');
|
|
194
|
+
this._render();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null) {
|
|
198
|
+
if (!this._initialized) return;
|
|
199
|
+
this._render();
|
|
200
|
+
// `gtk_picture_set_content_fit` notifies `keep-aspect-ratio` only when the new mode
|
|
201
|
+
// or the old one is FILL (gtkpicture.c:1114-1115) — a write between two non-FILL
|
|
202
|
+
// modes is invisible to the deprecated property, because its value does not change.
|
|
203
|
+
if (name === 'content-fit') {
|
|
204
|
+
const wasFill = _old === 'fill';
|
|
205
|
+
const isFill = value === 'fill';
|
|
206
|
+
if (wasFill || isFill) {
|
|
207
|
+
this.dispatchEvent(
|
|
208
|
+
new CustomEvent('notify::keep-aspect-ratio', {
|
|
209
|
+
bubbles: true,
|
|
210
|
+
detail: { 'keep-aspect-ratio': this.keepAspectRatio },
|
|
211
|
+
}),
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
this.dispatchEvent(
|
|
216
|
+
new CustomEvent(`notify::${name}`, { bubbles: true, detail: { [name]: this._property(name) } }),
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** The `notify::` detail for `name`: the PROPERTY, parsed, not the raw attribute. */
|
|
221
|
+
private _property(name: string): string | boolean {
|
|
222
|
+
switch (name) {
|
|
223
|
+
case 'alternative-text':
|
|
224
|
+
return this.alternativeText;
|
|
225
|
+
case 'can-shrink':
|
|
226
|
+
return this.canShrink;
|
|
227
|
+
case 'isolate-contents':
|
|
228
|
+
return this.isolateContents;
|
|
229
|
+
case 'keep-aspect-ratio':
|
|
230
|
+
return this.keepAspectRatio;
|
|
231
|
+
default:
|
|
232
|
+
return this.contentFit;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
private _render(): void {
|
|
237
|
+
// `object-fit` is not inherited, so the value is handed down through a custom
|
|
238
|
+
// property and `_picture.scss` applies `object-fit: inherit` to the child. Writing
|
|
239
|
+
// the declaration here would style the ELEMENT, which for a `<div>` box is not the
|
|
240
|
+
// node that has a content box to fit into.
|
|
241
|
+
this.style.setProperty('--gtk-picture-content-fit', this.contentFit);
|
|
242
|
+
// The three states of a TRUE-defaulted boolean, kept as class flags as well as
|
|
243
|
+
// custom properties so a page can target either. `can-shrink` reads on the ELEMENT
|
|
244
|
+
// (it is this widget's measure), `isolate-contents` likewise.
|
|
245
|
+
this.classList.toggle('can-shrink', this.canShrink);
|
|
246
|
+
this.classList.toggle('isolated', this.isolateContents);
|
|
247
|
+
// `gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN)` (gtkpicture.c:557) is in
|
|
248
|
+
// `_picture.scss`; here it is only worth knowing the reason the class exists.
|
|
249
|
+
if (this.alternativeText) this.setAttribute('aria-label', this.alternativeText);
|
|
250
|
+
else this.removeAttribute('aria-label');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
customElements.define('gtk-picture', GtkPicture);
|