@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,387 @@
|
|
|
1
|
+
// <gtk-inscription> — text laid out to a SIZE in CHARACTERS AND LINES, not to a size in
|
|
2
|
+
// pixels. It is the widget for the text whose extent you want to be the same everywhere:
|
|
3
|
+
// a caption under an icon that must not reflow when the string changes, a placeholder that
|
|
4
|
+
// reserves four lines so the page does not jump, a truncated title whose window is measured
|
|
5
|
+
// rather than guessed.
|
|
6
|
+
//
|
|
7
|
+
// WHAT IT IS NOT. It is not a `<gtk-label>`. GtkInscription has no label string, no child
|
|
8
|
+
// widget, no selectable text, no ellipsize family, no justify — its `text` is the string
|
|
9
|
+
// itself and its `min`/`nat` CHAR and LINE counts ARE its size request. GtkLabel measures
|
|
10
|
+
// its own content; GtkInscription never looks at the text when it is measured at all
|
|
11
|
+
// (`gtk_inscription_measure_width`, gtkinscription.c:338-349, multiplies `min_chars` by a
|
|
12
|
+
// per-font char width and stops). So this element does NOT reach for a label's content
|
|
13
|
+
// measurement: it reaches for CSS `ch` and `lh`, which are the same two units Pango's
|
|
14
|
+
// average-char-width and line-height are, and it lays the string out once.
|
|
15
|
+
//
|
|
16
|
+
// THE FOUR COUNTS ARE THE SIZE REQUEST, AND `MAX` IS NOT A DETAIL. `measure_width`
|
|
17
|
+
// returns `min_chars * char_pixels` as the MINIMUM and `MAX (min_chars, nat_chars) *
|
|
18
|
+
// char_pixels` as the NATURAL (gtkinscription.c:347-348); `measure_height` does the same
|
|
19
|
+
// with `min_lines`/`nat_lines` and a line pixel (gtkinscription.c:383-384). `labelWidth-
|
|
20
|
+
// CharsExtent` (`@gjsify/adwaita-core`) already encodes the char half of that `MAX`, which
|
|
21
|
+
// is why it is reused rather than re-derived — a second copy of a formula is the one that
|
|
22
|
+
// drifts. The zero case matters too: both measures return NOTHING — minimum and natural
|
|
23
|
+
// stay at whatever the widget already had — when the two counts are both 0
|
|
24
|
+
// (gtkinscription.c:344-345, :378-379), which is the "this inscription does not
|
|
25
|
+
// participate in sizing" state, so `min-width`/`width` are cleared rather than set to `0`.
|
|
26
|
+
//
|
|
27
|
+
// THE DEFAULTS ARE NOT GtkLabel's. An inscription installs `min-chars 3`, `nat-chars 0`,
|
|
28
|
+
// `min-lines 1`, `nat-lines 0` (gtkinscription.c:59-65, :787-790) — so out of the box it
|
|
29
|
+
// reserves three characters on the inline axis and one line on the block axis and lets its
|
|
30
|
+
// text be as long as it likes. `xalign` defaults to 0.0 and `yalign` to 0.5
|
|
31
|
+
// (gtkinscription.c:67-69, :791-792), the opposite pairing to GtkLabel's centred default,
|
|
32
|
+
// which is what makes a caption left-aligned under a centred icon without a line of CSS.
|
|
33
|
+
// Both are the numbers this element carries, and `nat` beating `min` is why the default
|
|
34
|
+
// three is a MINIMUM and never a width.
|
|
35
|
+
//
|
|
36
|
+
// `WRAP-MODE` DEFAULTS DIFFERENTLY, AND THAT IS THE POINT. The pspec spells it out in its
|
|
37
|
+
// own doc comment — "unlike `GtkLabel`, the default here is `%PANGO_WRAP_WORD_CHAR`"
|
|
38
|
+
// (gtkinscription.c:738-740) — because an inscription is a box of a known extent, and a
|
|
39
|
+
// box of a known extent has to break a word that does not fit it or overflow. `word-char`
|
|
40
|
+
// is therefore the DEFAULT here and `word` is the opt-in, the reverse of
|
|
41
|
+
// `DEFAULT_LABEL_WRAP_MODE`; the three nicks are shared with GtkLabel
|
|
42
|
+
// (`LABEL_WRAP_MODES`) so the mapping table has one home.
|
|
43
|
+
//
|
|
44
|
+
// THE NICK SPELLING IS THE WIDGET'S, NOT THE LABEL'S. `GtkInscriptionOverflow` has four
|
|
45
|
+
// members and its nicks are `clip`, `ellipsize-start`, `ellipsize-middle`,
|
|
46
|
+
// `ellipsize-end` (`packages/framework/gtk-host/src/generated/props.ts:331`), where
|
|
47
|
+
// `Gtk.Label:ellipsize` spells the same four cases `none`, `start`, `middle`, `end`. They
|
|
48
|
+
// are kept apart deliberately: an attribute-driven tree reaches the enum through its GIR
|
|
49
|
+
// name, and a reader who writes `ellipsize-end` here and `end` on a `<gtk-label>` is
|
|
50
|
+
// writing two different correct things. The DRAWING is the same single CSS value for all
|
|
51
|
+
// three truncating members — `labelEllipsizeOverflowValue` (`@gjsify/adwaita-core`) draws
|
|
52
|
+
// any non-clipping mode as an end ellipsis, the truncating value both CSS
|
|
53
|
+
// `text-overflow` and NativeScript's `textOverflow` have — and `start`/`middle` remain a
|
|
54
|
+
// DECLARED divergence documented there, not re-litigated per renderer.
|
|
55
|
+
//
|
|
56
|
+
// A11Y: no role. GtkInscription sets `GTK_ACCESSIBLE_ROLE_LABEL` (gtkinscription.c:781),
|
|
57
|
+
// which is the same role `GtkLabel` sets and which ARIA has no keyword for: a static run of
|
|
58
|
+
// text takes no role at all, and adding one would make it a group in some screen readers.
|
|
59
|
+
// `role="label"` is not in the ARIA role list, so none is set — the same answer
|
|
60
|
+
// `<gtk-label>` gives, for the same reason.
|
|
61
|
+
//
|
|
62
|
+
// `xalign` IS WHERE THE TEXT SITS IN THE BOX, `yalign` VERTICALLY — the same two
|
|
63
|
+
// properties `GtkLabel` has, mapped the same way (`_labels.scss`'s spacer pair, and
|
|
64
|
+
// `labelYalignAlignItems` for the cross axis, which CSS gives three keywords rather than
|
|
65
|
+
// the continuum `flex-grow` gives `xalign`). The default of 0 makes the `::before` spacer
|
|
66
|
+
// zero-growth and the whole of the free space land before the text, which is what a caption
|
|
67
|
+
// wants, without the author writing a flex rule.
|
|
68
|
+
//
|
|
69
|
+
// `markup` IS REDUCED TO TEXT, NEVER PARSED. `GtkInscription:markup` is a Pango-markup
|
|
70
|
+
// string (gtkinscription.c:617-622) and `text` is a plain one; setting `markup` clears
|
|
71
|
+
// `text` and the other way round (`gtk_inscription_set_markup` invalidates the label, which
|
|
72
|
+
// is the `text` property's own job). `labelDisplayText` (`@gjsify/adwaita-core`) reduces
|
|
73
|
+
// markup to its plain text — the same reduction `<gtk-label>` and the NativeScript port
|
|
74
|
+
// use — and never hands the string to `innerHTML`, so a `markup` attribute cannot run
|
|
75
|
+
// anything. `text` wins when both are set, because that is the order the C's invalidation
|
|
76
|
+
// leaves them in: `gtk_inscription_set_markup` writes the label directly, and a later
|
|
77
|
+
// `set_text` overwrites it.
|
|
78
|
+
//
|
|
79
|
+
// Events: `notify::<prop>` (CustomEvent, bubbles, detail `{ <prop>: value }`) on every
|
|
80
|
+
// real change.
|
|
81
|
+
//
|
|
82
|
+
// Reference: refs/gtk/gtk/gtkinscription.c (the defaults :59-69, :787-792, the measure
|
|
83
|
+
// :338-412, the property table :599-777, `gtk_inscription_set_markup`
|
|
84
|
+
// invalidating `text`)
|
|
85
|
+
// Reference: refs/gtk/gtk/gtkinscription.h:34-49 (the four overflow members)
|
|
86
|
+
// Reference: packages/framework/gtk-host/src/generated/props.ts:331 (the overflow nicks)
|
|
87
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
88
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
89
|
+
|
|
90
|
+
import {
|
|
91
|
+
LABEL_WRAP_MODES,
|
|
92
|
+
labelDisplayText,
|
|
93
|
+
labelEllipsizeOverflowValue,
|
|
94
|
+
labelWidthCharsExtent,
|
|
95
|
+
labelYalignAlignItems,
|
|
96
|
+
type LabelWrapMode,
|
|
97
|
+
} from '@gjsify/adwaita-core';
|
|
98
|
+
|
|
99
|
+
/** `GtkInscriptionOverflow`, in enum order (gtkinscription.h:44-48). */
|
|
100
|
+
export const INSCRIPTION_OVERFLOW_MODES = ['clip', 'ellipsize-start', 'ellipsize-middle', 'ellipsize-end'] as const;
|
|
101
|
+
|
|
102
|
+
export type InscriptionOverflow = (typeof INSCRIPTION_OVERFLOW_MODES)[number];
|
|
103
|
+
|
|
104
|
+
/** `GTK_INSCRIPTION_OVERFLOW_CLIP`, the pspec default (gtkinscription.c:728-733). */
|
|
105
|
+
export const DEFAULT_INSCRIPTION_OVERFLOW: InscriptionOverflow = 'clip';
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* `PANGO_WRAP_WORD_CHAR`, the pspec's default — which is NOT GtkLabel's
|
|
109
|
+
* (gtkinscription.c:738-740). The nick set is shared; only the fallback differs, and it
|
|
110
|
+
* differs because this widget sizes itself in characters and lines and therefore has to be
|
|
111
|
+
* able to break a word inside the box it just reserved.
|
|
112
|
+
*/
|
|
113
|
+
export const DEFAULT_INSCRIPTION_WRAP_MODE: LabelWrapMode = 'word-char';
|
|
114
|
+
|
|
115
|
+
/** `GtkInscription:text-overflow` from its nick, leaving an unknown nick at the default. */
|
|
116
|
+
export function normalizeInscriptionOverflow(value: unknown): InscriptionOverflow {
|
|
117
|
+
return (INSCRIPTION_OVERFLOW_MODES as readonly unknown[]).includes(value)
|
|
118
|
+
? (value as InscriptionOverflow)
|
|
119
|
+
: DEFAULT_INSCRIPTION_OVERFLOW;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** `GtkInscription:wrap-mode` from its nick, with {@link DEFAULT_INSCRIPTION_WRAP_MODE}. */
|
|
123
|
+
export function normalizeInscriptionWrapMode(value: unknown): LabelWrapMode {
|
|
124
|
+
return (LABEL_WRAP_MODES as readonly unknown[]).includes(value)
|
|
125
|
+
? (value as LabelWrapMode)
|
|
126
|
+
: DEFAULT_INSCRIPTION_WRAP_MODE;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* `GtkInscription:xalign` / `yalign` from a FLOAT with a range of 0…1
|
|
131
|
+
* (gtkinscription.c:757-760, :773-776). The clamping is `normalizeLabelXalign`'s — a
|
|
132
|
+
* value outside the pspec's range never reaches an attribute-driven tree, and one that does
|
|
133
|
+
* is held to the interval rather than trusted.
|
|
134
|
+
*/
|
|
135
|
+
function normalizeAlignment(value: unknown, fallback: number): number {
|
|
136
|
+
const parsed = typeof value === 'number' ? value : Number.parseFloat(String(value ?? ''));
|
|
137
|
+
if (!Number.isFinite(parsed)) return fallback;
|
|
138
|
+
return Math.min(1, Math.max(0, parsed));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The four counts are `guint` with a floor of ZERO (gtkinscription.c:638-644, :660-666,
|
|
143
|
+
* :680-686, :700-706) — no `-1` "auto" exists here, unlike `GtkLabel:width-chars`. A
|
|
144
|
+
* negative attribute value clamps to 0, which is the "does not participate in sizing"
|
|
145
|
+
* state the C expresses by both counts being zero at once.
|
|
146
|
+
*/
|
|
147
|
+
function normalizeCount(value: unknown): number {
|
|
148
|
+
const parsed = typeof value === 'number' ? value : Number.parseInt(String(value ?? ''), 10);
|
|
149
|
+
if (!Number.isFinite(parsed)) return 0;
|
|
150
|
+
return Math.max(0, Math.trunc(parsed));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export class GtkInscription extends HTMLElement {
|
|
154
|
+
private _initialized = false;
|
|
155
|
+
|
|
156
|
+
static get observedAttributes() {
|
|
157
|
+
return [
|
|
158
|
+
'markup',
|
|
159
|
+
'min-chars',
|
|
160
|
+
'min-lines',
|
|
161
|
+
'nat-chars',
|
|
162
|
+
'nat-lines',
|
|
163
|
+
'text',
|
|
164
|
+
'text-overflow',
|
|
165
|
+
'wrap-mode',
|
|
166
|
+
'xalign',
|
|
167
|
+
'yalign',
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** `GtkInscription:text` — the plain string to draw (gtkinscription.c:713-717). */
|
|
172
|
+
get text(): string {
|
|
173
|
+
return this.getAttribute('text') ?? '';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
set text(value: string) {
|
|
177
|
+
this._write('text', value);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* `GtkInscription:markup` — a Pango-markup string (gtkinscription.c:617-622), reduced
|
|
182
|
+
* to its plain text by `labelDisplayText` rather than parsed. See the header for why
|
|
183
|
+
* that is the XSS answer and why {@link text} wins when both are present.
|
|
184
|
+
*/
|
|
185
|
+
get markup(): string {
|
|
186
|
+
return this.getAttribute('markup') ?? '';
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
set markup(value: string) {
|
|
190
|
+
this._write('markup', value);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** `GtkInscription:min-chars` (gtkinscription.c:638-644). Defaults to 3. */
|
|
194
|
+
get minChars(): number {
|
|
195
|
+
const raw = this.getAttribute('min-chars');
|
|
196
|
+
return raw === null ? 3 : normalizeCount(raw);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
set minChars(value: number) {
|
|
200
|
+
this._write('min-chars', String(value));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** `GtkInscription:nat-chars` (gtkinscription.c:680-686). Defaults to 0. */
|
|
204
|
+
get natChars(): number {
|
|
205
|
+
return normalizeCount(this.getAttribute('nat-chars'));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
set natChars(value: number) {
|
|
209
|
+
this._write('nat-chars', String(value));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** `GtkInscription:min-lines` (gtkinscription.c:660-666). Defaults to 1. */
|
|
213
|
+
get minLines(): number {
|
|
214
|
+
const raw = this.getAttribute('min-lines');
|
|
215
|
+
return raw === null ? 1 : normalizeCount(raw);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
set minLines(value: number) {
|
|
219
|
+
this._write('min-lines', String(value));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** `GtkInscription:nat-lines` (gtkinscription.c:700-706). Defaults to 0. */
|
|
223
|
+
get natLines(): number {
|
|
224
|
+
return normalizeCount(this.getAttribute('nat-lines'));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
set natLines(value: number) {
|
|
228
|
+
this._write('nat-lines', String(value));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** `GtkInscription:text-overflow` (gtkinscription.c:726-732). Defaults to CLIP. */
|
|
232
|
+
get textOverflow(): InscriptionOverflow {
|
|
233
|
+
return normalizeInscriptionOverflow(this.getAttribute('text-overflow'));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
set textOverflow(value: InscriptionOverflow) {
|
|
237
|
+
this._write('text-overflow', value);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** `GtkInscription:wrap-mode` (gtkinscription.c:741-746). Defaults to WORD_CHAR. */
|
|
241
|
+
get wrapMode(): LabelWrapMode {
|
|
242
|
+
return normalizeInscriptionWrapMode(this.getAttribute('wrap-mode'));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
set wrapMode(value: LabelWrapMode) {
|
|
246
|
+
this._write('wrap-mode', value);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* `GtkInscription:xalign` (gtkinscription.c:757-760). Defaults to 0.0
|
|
251
|
+
* (gtkinscription.c:67, :791) — start-aligned, unlike GtkLabel's 0.5.
|
|
252
|
+
*/
|
|
253
|
+
get xalign(): number {
|
|
254
|
+
return normalizeAlignment(this.getAttribute('xalign'), 0);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
set xalign(value: number) {
|
|
258
|
+
this._write('xalign', String(value));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** `GtkInscription:yalign` (gtkinscription.c:773-776). Defaults to 0.5. */
|
|
262
|
+
get yalign(): number {
|
|
263
|
+
return normalizeAlignment(this.getAttribute('yalign'), 0.5);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
set yalign(value: number) {
|
|
267
|
+
this._write('yalign', String(value));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private _write(name: string, value: string): void {
|
|
271
|
+
if (this.getAttribute(name) !== value) this.setAttribute(name, value);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
connectedCallback() {
|
|
275
|
+
if (this._initialized) {
|
|
276
|
+
this._render();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
this._initialized = true;
|
|
280
|
+
this._render();
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
attributeChangedCallback(name: string) {
|
|
284
|
+
if (!this._initialized) return;
|
|
285
|
+
this._render();
|
|
286
|
+
this.dispatchEvent(
|
|
287
|
+
new CustomEvent(`notify::${name}`, { bubbles: true, detail: { [name]: this._property(name) } }),
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** The `notify::` detail for `name`: the PROPERTY, parsed, not the raw attribute. */
|
|
292
|
+
private _property(name: string): string | number {
|
|
293
|
+
switch (name) {
|
|
294
|
+
case 'text':
|
|
295
|
+
return this.text;
|
|
296
|
+
case 'markup':
|
|
297
|
+
return this.markup;
|
|
298
|
+
case 'min-chars':
|
|
299
|
+
return this.minChars;
|
|
300
|
+
case 'nat-chars':
|
|
301
|
+
return this.natChars;
|
|
302
|
+
case 'min-lines':
|
|
303
|
+
return this.minLines;
|
|
304
|
+
case 'nat-lines':
|
|
305
|
+
return this.natLines;
|
|
306
|
+
case 'text-overflow':
|
|
307
|
+
return this.textOverflow;
|
|
308
|
+
case 'wrap-mode':
|
|
309
|
+
return this.wrapMode;
|
|
310
|
+
case 'xalign':
|
|
311
|
+
return this.xalign;
|
|
312
|
+
default:
|
|
313
|
+
return this.yalign;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
private _render(): void {
|
|
318
|
+
// `text` over `markup` (see the header): a `set_text` after a `set_markup` is the
|
|
319
|
+
// state the C's invalidation leaves behind.
|
|
320
|
+
const plain = this.text;
|
|
321
|
+
const markup = this.markup;
|
|
322
|
+
this.textContent = plain || !markup ? plain : labelDisplayText(markup, true, false);
|
|
323
|
+
|
|
324
|
+
// The MEASURE, transcribed. `labelWidthCharsExtent` is the `MAX (min_chars,
|
|
325
|
+
// nat_chars)` of gtkinscription.c:348 over the CSS `ch` unit, which is the same
|
|
326
|
+
// average-char-width Pango measures in `get_char_pixels`.
|
|
327
|
+
//
|
|
328
|
+
// BUT THE ZERO CASE IS THIS WIDGET'S, NOT THE LABEL'S, and the helper cannot carry
|
|
329
|
+
// it. `labelWidthCharsExtent` reads `widthChars >= 0` as "there is a request" because
|
|
330
|
+
// that is GtkLabel's convention, where -1 is the no-request value
|
|
331
|
+
// (`GtkLabel:width-chars`, gtkinscription.c's own contrast at :638-644). GtkInscription's
|
|
332
|
+
// counts are `guint` with a floor of ZERO, so it has no -1 to mean "no request" with
|
|
333
|
+
// and spells the case as an early return instead:
|
|
334
|
+
//
|
|
335
|
+
// if (self->min_chars == 0 && self->nat_chars == 0)
|
|
336
|
+
// return; (gtkinscription.c:344-345)
|
|
337
|
+
//
|
|
338
|
+
// which leaves both requests at GTK's "none" marker. Handing (0, 0) to the label's
|
|
339
|
+
// helper therefore answered `0ch` — a real zero-width request, the very much smaller
|
|
340
|
+
// widget the C explicitly declines to be — so the zero test is taken HERE, and the
|
|
341
|
+
// helper is asked only about a pair that has already been found to size the widget.
|
|
342
|
+
const minChars = this.minChars;
|
|
343
|
+
const natChars = this.natChars;
|
|
344
|
+
if (minChars === 0 && natChars === 0) {
|
|
345
|
+
this.style.setProperty('--gtk-inscription-min-ch', 'auto');
|
|
346
|
+
this.style.setProperty('--gtk-inscription-width', 'auto');
|
|
347
|
+
} else {
|
|
348
|
+
const { minCh, maxCh } = labelWidthCharsExtent(minChars, natChars);
|
|
349
|
+
this.style.setProperty('--gtk-inscription-min-ch', `${minCh}ch`);
|
|
350
|
+
this.style.setProperty('--gtk-inscription-width', `${maxCh}ch`);
|
|
351
|
+
}
|
|
352
|
+
// The line half is the same `MAX` over a line height, and `lh` is that unit in CSS:
|
|
353
|
+
// it resolves to the element's own line box, which is what Pango's `line_pixels` is
|
|
354
|
+
// (gtkinscription.c:383-384). The counts repeat the zero case, which is a separate
|
|
355
|
+
// test in the C (`min_lines == 0 && nat_lines == 0`, :378-379).
|
|
356
|
+
const minLines = this.minLines;
|
|
357
|
+
const natLines = this.natLines;
|
|
358
|
+
this.style.setProperty('--gtk-inscription-min-lh', minLines === 0 && natLines === 0 ? 'auto' : `${minLines}lh`);
|
|
359
|
+
this.style.setProperty(
|
|
360
|
+
'--gtk-inscription-height',
|
|
361
|
+
minLines === 0 && natLines === 0 ? 'auto' : `${Math.max(minLines, natLines)}lh`,
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
// `xalign`'s spacer ratio — `_inscription.scss` splits the free space between
|
|
365
|
+
// `::before` and `::after` in exactly this ratio, which is the C's
|
|
366
|
+
// `xalign * (width − text width)` (see `_labels.scss` for the GtkLabel statement of
|
|
367
|
+
// the same formula and why it mirrors in RTL).
|
|
368
|
+
this.style.setProperty('--gtk-inscription-xalign', String(this.xalign));
|
|
369
|
+
this.style.setProperty('--gtk-inscription-align-items', labelYalignAlignItems(this.yalign));
|
|
370
|
+
|
|
371
|
+
// `labelEllipsizeOverflowValue` draws every non-clipping overflow as an END
|
|
372
|
+
// ellipsis; `clip` stays `clip`, which is what the pspec default means and the only
|
|
373
|
+
// value that drops the overflow with no indication at all.
|
|
374
|
+
const overflow = this.textOverflow;
|
|
375
|
+
this.style.setProperty(
|
|
376
|
+
'--gtk-inscription-text-overflow',
|
|
377
|
+
labelEllipsizeOverflowValue(overflow === 'clip' ? 'none' : 'end'),
|
|
378
|
+
);
|
|
379
|
+
// The class form as well: a consumer's own rule needs something to select on, and a
|
|
380
|
+
// class set from the NORMALIZED value cannot be left half-applied by a raw
|
|
381
|
+
// unrecognised attribute the way an `[text-overflow=…]` selector could.
|
|
382
|
+
this.classList.toggle('clip', overflow === 'clip');
|
|
383
|
+
this.classList.toggle('ellipsized', overflow !== 'clip');
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
customElements.define('gtk-inscription', GtkInscription);
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
// `xalign : 1 − xalign` (`_labels.scss`), which is the C's `xalign * (width − text width)`
|
|
21
21
|
// to the pixel, and mirrors in RTL as `gtk_label` does. `justify` maps through Pango's own
|
|
22
22
|
// switch: LEFT and RIGHT are START and END of the text direction, FILL is start-aligned
|
|
23
|
-
// lines with inter-word justification.
|
|
23
|
+
// lines with inter-word justification. That switch is `JUSTIFY_TEXT_ALIGN`, in
|
|
24
|
+
// `./justification.js`, because `Gtk.TextView:justification` is the same Pango enum through a
|
|
25
|
+
// second widget.
|
|
24
26
|
//
|
|
25
27
|
// `ELLIPSIZE`, `WRAP-MODE`, `LINES`, `WIDTH-CHARS`, `MAX-WIDTH-CHARS` AND `YALIGN` are
|
|
26
28
|
// Pango's text-layout knobs, and each reaches a REAL CSS mechanism rather than being
|
|
@@ -75,6 +77,8 @@ import {
|
|
|
75
77
|
type LabelWrapMode,
|
|
76
78
|
} from '@gjsify/adwaita-core';
|
|
77
79
|
|
|
80
|
+
import { JUSTIFY_TEXT_ALIGN } from './justification.js';
|
|
81
|
+
|
|
78
82
|
/** The attributes that carry a property — also the `notify::` roster. */
|
|
79
83
|
const PROPERTY_ATTRIBUTES = [
|
|
80
84
|
'label',
|
|
@@ -92,14 +96,6 @@ const PROPERTY_ATTRIBUTES = [
|
|
|
92
96
|
'selectable',
|
|
93
97
|
] as const;
|
|
94
98
|
|
|
95
|
-
/** `Gtk.Justification` as a CSS `text-align`, through Pango's switch in `gtklabel.c`. */
|
|
96
|
-
const JUSTIFY_TEXT_ALIGN: Record<LabelJustification, string> = {
|
|
97
|
-
left: 'start',
|
|
98
|
-
right: 'end',
|
|
99
|
-
center: 'center',
|
|
100
|
-
fill: 'justify',
|
|
101
|
-
};
|
|
102
|
-
|
|
103
99
|
export class GtkLabel extends HTMLElement {
|
|
104
100
|
/**
|
|
105
101
|
* The rendered text's own box — present while {@link wrap} is set (so it can be pinned
|
|
@@ -113,6 +109,10 @@ export class GtkLabel extends HTMLElement {
|
|
|
113
109
|
private _wrapSpan: HTMLSpanElement | null = null;
|
|
114
110
|
private _resizes: ResizeObserver | null = null;
|
|
115
111
|
|
|
112
|
+
/** Whether `_sync` last wrote `min-width` / `max-width` itself, and so may clear them. */
|
|
113
|
+
private _wroteMinWidth = false;
|
|
114
|
+
private _wroteMaxWidth = false;
|
|
115
|
+
|
|
116
116
|
static get observedAttributes() {
|
|
117
117
|
return [...PROPERTY_ATTRIBUTES];
|
|
118
118
|
}
|
|
@@ -347,11 +347,19 @@ export class GtkLabel extends HTMLElement {
|
|
|
347
347
|
// `width-chars` / `max-width-chars`, in `ch` — GTK's MINIMUM and NATURAL widths
|
|
348
348
|
// (`get_default_widths`, gtklabel.c) — on the flex item itself, so wrap/ellipsize
|
|
349
349
|
// resolve against that box rather than the ambient container.
|
|
350
|
+
//
|
|
351
|
+
// A REMOVAL is guarded by what this method last WROTE, because these two are the
|
|
352
|
+
// label's alone only while it holds an extent: `<gtk-aspect-frame>` writes
|
|
353
|
+
// `max-width: 100%` on the child it shapes, and an unconditional
|
|
354
|
+
// `removeProperty('max-width')` on the label's own next sync deleted the frame's
|
|
355
|
+
// constraint. The label clears what IT put there and nothing else.
|
|
350
356
|
const extent = labelWidthCharsExtent(this.widthChars, this.maxWidthChars);
|
|
351
357
|
if (extent.minCh !== null) this.style.minWidth = `${extent.minCh}ch`;
|
|
352
|
-
else this.style.removeProperty('min-width');
|
|
358
|
+
else if (this._wroteMinWidth) this.style.removeProperty('min-width');
|
|
353
359
|
if (extent.maxCh !== null) this.style.maxWidth = `${extent.maxCh}ch`;
|
|
354
|
-
else this.style.removeProperty('max-width');
|
|
360
|
+
else if (this._wroteMaxWidth) this.style.removeProperty('max-width');
|
|
361
|
+
this._wroteMinWidth = extent.minCh !== null;
|
|
362
|
+
this._wroteMaxWidth = extent.maxCh !== null;
|
|
355
363
|
}
|
|
356
364
|
|
|
357
365
|
private _renderSingleLine(text: string): void {
|