@gjsify/adwaita-web 0.64.2-next.252 → 0.64.2-next.254
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -80
- package/dist/adwaita-web.css +52 -3
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/accessible.d.ts +8 -0
- package/lib/types/compute-expand.d.ts +5 -0
- package/lib/types/compute-expand.spec.d.ts +1 -0
- package/lib/types/elements/adw-about-dialog.d.ts +28 -1
- package/lib/types/elements/adw-action-row.d.ts +2 -1
- package/lib/types/elements/adw-alert-dialog.d.ts +3 -2
- package/lib/types/elements/adw-avatar.d.ts +2 -1
- package/lib/types/elements/adw-banner.d.ts +2 -1
- package/lib/types/elements/adw-bin.d.ts +2 -1
- package/lib/types/elements/adw-bottom-sheet.d.ts +5 -4
- package/lib/types/elements/adw-breakpoint-bin.d.ts +2 -1
- package/lib/types/elements/adw-button-content.d.ts +2 -1
- package/lib/types/elements/adw-button-row.d.ts +2 -1
- package/lib/types/elements/adw-card.d.ts +2 -1
- package/lib/types/elements/adw-carousel.d.ts +20 -3
- package/lib/types/elements/adw-clamp-scrollable.d.ts +2 -1
- package/lib/types/elements/adw-clamp.d.ts +2 -1
- package/lib/types/elements/adw-combo-row.d.ts +6 -1
- package/lib/types/elements/adw-data-grid.d.ts +2 -1
- package/lib/types/elements/adw-dialog.d.ts +2 -1
- package/lib/types/elements/adw-entry-row.d.ts +2 -1
- package/lib/types/elements/adw-expander-row.d.ts +2 -1
- package/lib/types/elements/adw-header-bar.d.ts +2 -1
- package/lib/types/elements/adw-inline-view-switcher.d.ts +3 -2
- package/lib/types/elements/adw-layout-slot.d.ts +2 -1
- package/lib/types/elements/adw-multi-layout-view.d.ts +2 -1
- package/lib/types/elements/adw-navigation-split-view.d.ts +2 -1
- package/lib/types/elements/adw-navigation-view.d.ts +3 -2
- package/lib/types/elements/adw-overlay-split-view.d.ts +2 -1
- package/lib/types/elements/adw-preferences-dialog.d.ts +5 -4
- package/lib/types/elements/adw-preferences-group.d.ts +2 -1
- package/lib/types/elements/adw-preferences-row.d.ts +2 -1
- package/lib/types/elements/adw-shortcut-label.d.ts +2 -1
- package/lib/types/elements/adw-shortcuts-item.d.ts +2 -1
- package/lib/types/elements/adw-shortcuts-section.d.ts +2 -1
- package/lib/types/elements/adw-sidebar.d.ts +4 -3
- package/lib/types/elements/adw-spin-row.d.ts +2 -1
- package/lib/types/elements/adw-spinner.d.ts +2 -1
- package/lib/types/elements/adw-split-button.d.ts +2 -1
- package/lib/types/elements/adw-status-page.d.ts +2 -1
- package/lib/types/elements/adw-switch-row.d.ts +4 -1
- package/lib/types/elements/adw-tab-bar.d.ts +2 -1
- package/lib/types/elements/adw-tab-button.d.ts +2 -1
- package/lib/types/elements/adw-tab-overview.d.ts +2 -1
- package/lib/types/elements/adw-tab-view.d.ts +3 -2
- package/lib/types/elements/adw-toast-overlay.d.ts +2 -1
- package/lib/types/elements/adw-toggle-group.d.ts +3 -2
- package/lib/types/elements/adw-toolbar-view.d.ts +2 -1
- package/lib/types/elements/adw-view-stack.d.ts +3 -1
- package/lib/types/elements/adw-view-switcher-bar.d.ts +2 -1
- package/lib/types/elements/adw-view-switcher-sidebar.d.ts +2 -1
- package/lib/types/elements/adw-view-switcher.d.ts +3 -2
- package/lib/types/elements/adw-window-title.d.ts +2 -1
- package/lib/types/elements/adw-wrap-box.d.ts +2 -1
- package/lib/types/elements/checks.d.ts +16 -1
- package/lib/types/elements/gtk-action-bar.d.ts +2 -1
- package/lib/types/elements/gtk-aspect-frame.d.ts +2 -1
- package/lib/types/elements/gtk-box.d.ts +5 -1
- package/lib/types/elements/gtk-button.d.ts +5 -7
- package/lib/types/elements/gtk-calendar.d.ts +2 -1
- package/lib/types/elements/gtk-center-box.d.ts +2 -1
- package/lib/types/elements/gtk-color-dialog-button.d.ts +2 -1
- package/lib/types/elements/gtk-drag-icon.d.ts +2 -1
- package/lib/types/elements/gtk-drawing-area.d.ts +2 -1
- package/lib/types/elements/gtk-drop-down.d.ts +2 -1
- package/lib/types/elements/gtk-editable-label.d.ts +2 -1
- package/lib/types/elements/gtk-entry.d.ts +2 -1
- package/lib/types/elements/gtk-expander.d.ts +2 -1
- package/lib/types/elements/gtk-fixed.d.ts +2 -1
- package/lib/types/elements/gtk-flow-box-child.d.ts +2 -1
- package/lib/types/elements/gtk-flow-box.d.ts +2 -1
- package/lib/types/elements/gtk-font-dialog-button.d.ts +2 -1
- package/lib/types/elements/gtk-frame.d.ts +2 -1
- package/lib/types/elements/gtk-gl-area.d.ts +2 -1
- package/lib/types/elements/gtk-graphics-offload.d.ts +2 -1
- package/lib/types/elements/gtk-grid.d.ts +2 -1
- package/lib/types/elements/gtk-header-bar.d.ts +2 -1
- package/lib/types/elements/gtk-image.d.ts +5 -6
- package/lib/types/elements/gtk-inscription.d.ts +2 -1
- package/lib/types/elements/gtk-label.d.ts +10 -3
- package/lib/types/elements/gtk-level-bar.d.ts +2 -1
- package/lib/types/elements/gtk-list-box-row.d.ts +2 -1
- package/lib/types/elements/gtk-list-box.d.ts +2 -1
- package/lib/types/elements/gtk-list-view.d.ts +2 -1
- package/lib/types/elements/gtk-media-controls.d.ts +2 -1
- package/lib/types/elements/gtk-menu-button.d.ts +2 -1
- package/lib/types/elements/gtk-notebook.d.ts +2 -1
- package/lib/types/elements/gtk-overlay.d.ts +2 -1
- package/lib/types/elements/gtk-paned.d.ts +2 -1
- package/lib/types/elements/gtk-picture.d.ts +2 -1
- package/lib/types/elements/gtk-popover-bin.d.ts +2 -1
- package/lib/types/elements/gtk-popover-menu-bar.d.ts +2 -1
- package/lib/types/elements/gtk-popover.d.ts +2 -1
- package/lib/types/elements/gtk-progress-bar.d.ts +2 -1
- package/lib/types/elements/gtk-revealer.d.ts +2 -1
- package/lib/types/elements/gtk-scale-button.d.ts +2 -1
- package/lib/types/elements/gtk-scale.d.ts +2 -1
- package/lib/types/elements/gtk-scrollbar.d.ts +2 -1
- package/lib/types/elements/gtk-scrolled-window.d.ts +2 -1
- package/lib/types/elements/gtk-search-bar.d.ts +2 -1
- package/lib/types/elements/gtk-separator.d.ts +2 -1
- package/lib/types/elements/gtk-spin-button.d.ts +2 -1
- package/lib/types/elements/gtk-spinner.d.ts +2 -1
- package/lib/types/elements/gtk-stack-page.d.ts +2 -1
- package/lib/types/elements/gtk-stack-sidebar.d.ts +2 -1
- package/lib/types/elements/gtk-stack-switcher.d.ts +2 -1
- package/lib/types/elements/gtk-stack.d.ts +2 -1
- package/lib/types/elements/gtk-switch.d.ts +2 -1
- package/lib/types/elements/gtk-text-view.d.ts +2 -1
- package/lib/types/elements/gtk-text.d.ts +2 -1
- package/lib/types/elements/gtk-tree-expander.d.ts +2 -1
- package/lib/types/elements/gtk-video.d.ts +2 -1
- package/lib/types/elements/gtk-viewport.d.ts +2 -1
- package/lib/types/elements/gtk-window-controls.d.ts +2 -1
- package/lib/types/elements/gtk-window-handle.d.ts +2 -1
- package/lib/types/elements/gtk-window.d.ts +2 -1
- package/lib/types/gobject-elements.d.ts +7 -1
- package/lib/types/gtksource/gtk-source-view.d.ts +2 -1
- package/lib/types/{icon-registry.spec.d.ts → icon-masks.spec.d.ts} +1 -1
- package/lib/types/icon-theme.d.ts +15 -35
- package/lib/types/index.d.ts +1 -2
- package/lib/types/namespace/gdk.d.ts +1 -0
- package/lib/types/namespace/gio.d.ts +1 -0
- package/lib/types/namespace/glib.d.ts +2 -1
- package/lib/types/signals.d.ts +5 -1
- package/lib/types/source-view/adw-source-view.d.ts +2 -1
- package/lib/types/styles.generated.d.ts +1 -1
- package/lib/types/widget-element.d.ts +25 -0
- package/lib/types/widget-map.spec.d.ts +1 -0
- package/lib/types/widget-mapping.d.ts +7 -0
- package/package.json +12 -12
- package/scss/_about_dialog.scss +46 -1
- package/scss/_checks.scss +5 -2
- package/scss/_icon.scss +3 -4
- package/scss/_labels.scss +2 -2
- package/scss/_overlay_split_view.scss +10 -0
- package/scss/_scrolled_window.scss +15 -0
- package/scss/_widget.scss +5 -1
- package/src/accessible.ts +29 -0
- package/src/adw-about-dialog.spec.ts +81 -12
- package/src/adw-action-rows.spec.ts +2 -2
- package/src/adw-button-content.spec.ts +1 -1
- package/src/adw-carousel.spec.ts +49 -1
- package/src/capabilities.mjs +1 -0
- package/src/checks.spec.ts +51 -1
- package/src/compute-expand.spec.ts +186 -0
- package/src/compute-expand.ts +134 -0
- package/src/construct-vectors.spec.ts +46 -1
- package/src/elements/adw-about-dialog.ts +152 -9
- package/src/elements/adw-action-row.ts +2 -1
- package/src/elements/adw-alert-dialog.ts +3 -2
- package/src/elements/adw-avatar.ts +2 -1
- package/src/elements/adw-banner.ts +2 -1
- package/src/elements/adw-bin.ts +2 -1
- package/src/elements/adw-bottom-sheet.ts +5 -4
- package/src/elements/adw-breakpoint-bin.ts +2 -1
- package/src/elements/adw-button-content.ts +2 -1
- package/src/elements/adw-button-row.ts +2 -1
- package/src/elements/adw-card.ts +2 -1
- package/src/elements/adw-carousel.ts +62 -3
- package/src/elements/adw-clamp-scrollable.ts +2 -1
- package/src/elements/adw-clamp.ts +2 -1
- package/src/elements/adw-combo-row.ts +15 -1
- package/src/elements/adw-data-grid.ts +2 -1
- package/src/elements/adw-dialog.ts +2 -1
- package/src/elements/adw-entry-row.ts +2 -1
- package/src/elements/adw-expander-row.ts +2 -1
- package/src/elements/adw-header-bar.ts +2 -1
- package/src/elements/adw-inline-view-switcher.ts +3 -2
- package/src/elements/adw-layout-slot.ts +2 -1
- package/src/elements/adw-multi-layout-view.ts +2 -1
- package/src/elements/adw-navigation-split-view.ts +2 -1
- package/src/elements/adw-navigation-view.ts +3 -2
- package/src/elements/adw-overlay-split-view.ts +2 -1
- package/src/elements/adw-preferences-dialog.ts +6 -4
- package/src/elements/adw-preferences-group.ts +2 -1
- package/src/elements/adw-preferences-row.ts +2 -1
- package/src/elements/adw-shortcut-label.ts +2 -1
- package/src/elements/adw-shortcuts-item.ts +2 -1
- package/src/elements/adw-shortcuts-section.ts +2 -1
- package/src/elements/adw-sidebar.ts +4 -3
- package/src/elements/adw-spin-row.ts +2 -1
- package/src/elements/adw-spinner.ts +2 -1
- package/src/elements/adw-split-button.ts +2 -1
- package/src/elements/adw-status-page.ts +2 -1
- package/src/elements/adw-switch-row.ts +10 -1
- package/src/elements/adw-tab-bar.ts +2 -1
- package/src/elements/adw-tab-button.ts +2 -1
- package/src/elements/adw-tab-overview.ts +2 -1
- package/src/elements/adw-tab-view.ts +3 -2
- package/src/elements/adw-toast-overlay.ts +2 -1
- package/src/elements/adw-toggle-group.ts +3 -2
- package/src/elements/adw-toolbar-view.ts +2 -1
- package/src/elements/adw-view-stack.ts +39 -1
- package/src/elements/adw-view-switcher-bar.ts +2 -1
- package/src/elements/adw-view-switcher-sidebar.ts +2 -1
- package/src/elements/adw-view-switcher.ts +3 -2
- package/src/elements/adw-window-title.ts +2 -1
- package/src/elements/adw-wrap-box.ts +2 -1
- package/src/elements/checks.ts +85 -6
- package/src/elements/gtk-action-bar.ts +2 -1
- package/src/elements/gtk-aspect-frame.ts +2 -1
- package/src/elements/gtk-box.ts +56 -1
- package/src/elements/gtk-button.ts +10 -22
- package/src/elements/gtk-calendar.ts +2 -1
- package/src/elements/gtk-center-box.ts +2 -1
- package/src/elements/gtk-color-dialog-button.ts +2 -1
- package/src/elements/gtk-drag-icon.ts +2 -1
- package/src/elements/gtk-drawing-area.ts +2 -1
- package/src/elements/gtk-drop-down.ts +2 -1
- package/src/elements/gtk-editable-label.ts +2 -1
- package/src/elements/gtk-entry.ts +2 -1
- package/src/elements/gtk-expander.ts +2 -1
- package/src/elements/gtk-fixed.ts +2 -1
- package/src/elements/gtk-flow-box-child.ts +2 -1
- package/src/elements/gtk-flow-box.ts +2 -1
- package/src/elements/gtk-font-dialog-button.ts +2 -1
- package/src/elements/gtk-frame.ts +2 -1
- package/src/elements/gtk-gl-area.ts +2 -1
- package/src/elements/gtk-graphics-offload.ts +2 -1
- package/src/elements/gtk-grid.ts +2 -1
- package/src/elements/gtk-header-bar.ts +2 -1
- package/src/elements/gtk-image.ts +14 -15
- package/src/elements/gtk-inscription.ts +2 -1
- package/src/elements/gtk-label.ts +12 -5
- package/src/elements/gtk-level-bar.ts +2 -1
- package/src/elements/gtk-list-box-row.ts +2 -1
- package/src/elements/gtk-list-box.ts +2 -1
- package/src/elements/gtk-list-view.ts +2 -1
- package/src/elements/gtk-media-controls.ts +2 -1
- package/src/elements/gtk-menu-button.ts +2 -1
- package/src/elements/gtk-notebook.ts +2 -1
- package/src/elements/gtk-overlay.ts +2 -1
- package/src/elements/gtk-paned.ts +2 -1
- package/src/elements/gtk-picture.ts +2 -1
- package/src/elements/gtk-popover-bin.ts +2 -1
- package/src/elements/gtk-popover-menu-bar.ts +2 -1
- package/src/elements/gtk-popover.ts +2 -1
- package/src/elements/gtk-progress-bar.ts +2 -1
- package/src/elements/gtk-revealer.ts +2 -1
- package/src/elements/gtk-scale-button.ts +2 -1
- package/src/elements/gtk-scale.ts +2 -1
- package/src/elements/gtk-scrollbar.ts +2 -1
- package/src/elements/gtk-scrolled-window.ts +8 -5
- package/src/elements/gtk-search-bar.ts +2 -1
- package/src/elements/gtk-separator.ts +2 -1
- package/src/elements/gtk-spin-button.ts +2 -1
- package/src/elements/gtk-spinner.ts +2 -1
- package/src/elements/gtk-stack-page.ts +2 -1
- package/src/elements/gtk-stack-sidebar.ts +2 -1
- package/src/elements/gtk-stack-switcher.ts +2 -1
- package/src/elements/gtk-stack.ts +2 -1
- package/src/elements/gtk-switch.ts +2 -1
- package/src/elements/gtk-text-view.ts +2 -1
- package/src/elements/gtk-text.ts +2 -1
- package/src/elements/gtk-tree-expander.ts +2 -1
- package/src/elements/gtk-video.ts +2 -1
- package/src/elements/gtk-viewport.ts +2 -1
- package/src/elements/gtk-window-controls.ts +2 -1
- package/src/elements/gtk-window-handle.ts +2 -1
- package/src/elements/gtk-window.ts +2 -1
- package/src/gio.spec.ts +13 -3
- package/src/glib.spec.ts +9 -0
- package/src/gobject-elements.ts +18 -4
- package/src/gtk-label.spec.ts +39 -0
- package/src/gtk-scrolled-window.spec.ts +6 -6
- package/src/gtk-value-doors.spec.ts +19 -0
- package/src/gtk-window.spec.ts +2 -2
- package/src/gtksource/gtk-source-view.ts +2 -1
- package/src/{icon-registry.spec.ts → icon-masks.spec.ts} +4 -100
- package/src/icon-theme.spec.ts +69 -124
- package/src/icon-theme.ts +29 -119
- package/src/index.ts +3 -7
- package/src/namespace/gdk.ts +1 -0
- package/src/namespace/gio.ts +8 -0
- package/src/namespace/glib.ts +4 -0
- package/src/shared-tree-builder.ts +26 -3
- package/src/signals.ts +11 -2
- package/src/source-view/adw-source-view.ts +2 -1
- package/src/split-button.spec.ts +1 -1
- package/src/style-manager.spec.ts +13 -0
- package/src/style-manager.ts +6 -0
- package/src/styles.generated.ts +1 -1
- package/src/test.browser.mts +6 -2
- package/src/widget-element.ts +75 -0
- package/src/widget-map.spec.ts +116 -0
- package/src/widget-mapping.ts +100 -0
- package/src/widget-visible.spec.ts +44 -0
- package/lib/types/icon-registry.d.ts +0 -37
- package/src/icon-registry.ts +0 -163
package/src/elements/gtk-grid.ts
CHANGED
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
39
39
|
|
|
40
40
|
import { normalizeBoxOrientation, normalizeBoxSpacing, type BoxOrientation } from '@gjsify/adwaita-core';
|
|
41
|
+
import { WidgetElement } from '../widget-element.js';
|
|
41
42
|
|
|
42
|
-
export class GtkGrid extends
|
|
43
|
+
export class GtkGrid extends WidgetElement {
|
|
43
44
|
static get observedAttributes() {
|
|
44
45
|
return ['column-spacing', 'row-spacing', 'column-homogeneous', 'row-homogeneous', 'orientation'];
|
|
45
46
|
}
|
|
@@ -64,8 +64,9 @@ import { bindSlottedChildren } from '../slotted-children.js';
|
|
|
64
64
|
// Registers <gtk-window-controls>: `show-title-buttons` builds two of them, so importing
|
|
65
65
|
// the bar alone must still define them.
|
|
66
66
|
import './gtk-window-controls.js';
|
|
67
|
+
import { WidgetElement } from '../widget-element.js';
|
|
67
68
|
|
|
68
|
-
export class GtkHeaderBar extends
|
|
69
|
+
export class GtkHeaderBar extends WidgetElement {
|
|
69
70
|
private _initialized = false;
|
|
70
71
|
private _handle!: HTMLDivElement;
|
|
71
72
|
private _box!: HTMLDivElement;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// <gtk-image> — the icon node as an element. A symbolic icon is a CSS-masked box whose
|
|
2
2
|
// glyph comes from a generated `.adw-icon--<name>` class and whose colour is
|
|
3
|
-
// `currentColor`, so it themes with whatever contains it. A full-colour icon
|
|
4
|
-
//
|
|
3
|
+
// `currentColor`, so it themes with whatever contains it. A full-colour icon from a
|
|
4
|
+
// `Gtk.IconTheme` resource path is the same box with the image as its background and no
|
|
5
5
|
// mask. Which of the two a name reaches is decided once, in `../icon-theme.ts`, in the
|
|
6
6
|
// order GTK's own theme tries them; the symbolic name derivation and its guard live once
|
|
7
7
|
// in `@gjsify/adwaita-core`'s {@link normalizeIconName}, the markup once here.
|
|
8
8
|
//
|
|
9
9
|
// Attributes:
|
|
10
10
|
// icon-name — icon name, `-symbolic` suffix optional. A name that is neither a
|
|
11
|
-
//
|
|
12
|
-
//
|
|
11
|
+
// resource file nor a single CSS token (a space, a quote, a reverse-DNS
|
|
12
|
+
// application id no resource ships) never reaches a class — it
|
|
13
13
|
// draws {@link MISSING_ICON_NAME}, which is what GTK draws for it, rather
|
|
14
14
|
// than injecting markup.
|
|
15
15
|
// size — rendered edge length in px. Absent leaves the stylesheet's 16px in
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
import { normalizeIconName } from '@gjsify/adwaita-core';
|
|
37
37
|
|
|
38
38
|
import { lookupIcon, onIconThemeChanged, type IconRequest } from '../icon-theme.js';
|
|
39
|
+
import { WidgetElement } from '../widget-element.js';
|
|
39
40
|
|
|
40
41
|
/** `url` as one CSS string token, whatever quotes or backslashes it holds. */
|
|
41
42
|
function cssUrl(url: string): string {
|
|
@@ -43,9 +44,7 @@ function cssUrl(url: string): string {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
|
-
* The generated mask-class prefix — the one place the `--` spelling appears.
|
|
47
|
-
* builds the same class for a runtime registration and imports it from here rather than
|
|
48
|
-
* spelling it twice.
|
|
47
|
+
* The generated mask-class prefix — the one place the `--` spelling appears.
|
|
49
48
|
*/
|
|
50
49
|
export const MASK_CLASS_PREFIX = 'adw-icon--';
|
|
51
50
|
|
|
@@ -63,7 +62,7 @@ export const MISSING_ICON_NAME = 'image-missing';
|
|
|
63
62
|
*/
|
|
64
63
|
export const COLOR_ICON_CLASS = 'adw-icon-color';
|
|
65
64
|
|
|
66
|
-
export class GtkImage extends
|
|
65
|
+
export class GtkImage extends WidgetElement {
|
|
67
66
|
static get observedAttributes() {
|
|
68
67
|
return ['icon-name', 'size'];
|
|
69
68
|
}
|
|
@@ -80,8 +79,8 @@ export class GtkImage extends HTMLElement {
|
|
|
80
79
|
|
|
81
80
|
/**
|
|
82
81
|
* The name the SYMBOLIC lookup works with — `''` when the icon-name is absent, empty,
|
|
83
|
-
* or not usable as one CSS token. A
|
|
84
|
-
*
|
|
82
|
+
* or not usable as one CSS token. A resource file can still draw for a name that
|
|
83
|
+
* answers `''` here (`org.gnome.Builder`); whether a name draws anything but
|
|
85
84
|
* `image-missing` is `isIconAvailable`'s question.
|
|
86
85
|
*
|
|
87
86
|
* `''` does NOT mean the box draws nothing: an unusable name that was given still
|
|
@@ -152,13 +151,13 @@ export class GtkImage extends HTMLElement {
|
|
|
152
151
|
const looked = lookupIcon(this.getAttribute('icon-name'), this._request());
|
|
153
152
|
// A resource file the browser cannot draw (XPM, compressed) is GTK's `image-missing`.
|
|
154
153
|
const found = looked?.kind === 'resource' && looked.url === null ? ({ kind: 'missing' } as const) : looked;
|
|
155
|
-
const asIs = found?.kind === '
|
|
154
|
+
const asIs = found?.kind === 'resource' && !found.symbolic ? found.url : null;
|
|
156
155
|
const mask = found?.kind === 'resource' && found.symbolic ? found.url : null;
|
|
157
156
|
this.classList.toggle(COLOR_ICON_CLASS, asIs !== null);
|
|
158
157
|
if (asIs !== null) {
|
|
159
158
|
// Drawn as-is: `_icon.scss` drops the mask and the `currentColor` fill for this
|
|
160
|
-
// modifier, so only the image paints. `url` is a
|
|
161
|
-
//
|
|
159
|
+
// modifier, so only the image paints. `url` is a blob URL; the quote and backslash
|
|
160
|
+
// escapes keep it one CSS string.
|
|
162
161
|
this.style.backgroundImage = cssUrl(asIs);
|
|
163
162
|
} else {
|
|
164
163
|
this.style.removeProperty('background-image');
|
|
@@ -177,8 +176,8 @@ export class GtkImage extends HTMLElement {
|
|
|
177
176
|
if (found?.kind === 'symbolic') {
|
|
178
177
|
this.classList.add(`${MASK_CLASS_PREFIX}${found.name}`);
|
|
179
178
|
} else if (found?.kind === 'missing') {
|
|
180
|
-
// A name was GIVEN and nothing answers it —
|
|
181
|
-
// token (a space, a quote,
|
|
179
|
+
// A name was GIVEN and nothing answers it — no resource file, and not one CSS
|
|
180
|
+
// token (a space, a quote, a reverse-DNS application id no resource ships). GTK has
|
|
182
181
|
// no such state: `gtk_icon_theme_lookup_icon` never returns NULL, it returns the
|
|
183
182
|
// always-available `image-missing` (refs/gtk/gtk/gtkicontheme.c —
|
|
184
183
|
// `gtk_icon_paintable_get_icon_name`'s own docs say so). So the same glyph is
|
|
@@ -95,6 +95,7 @@ import {
|
|
|
95
95
|
labelYalignAlignItems,
|
|
96
96
|
type LabelWrapMode,
|
|
97
97
|
} from '@gjsify/adwaita-core';
|
|
98
|
+
import { WidgetElement } from '../widget-element.js';
|
|
98
99
|
|
|
99
100
|
/** `GtkInscriptionOverflow`, in enum order (gtkinscription.h:44-48). */
|
|
100
101
|
export const INSCRIPTION_OVERFLOW_MODES = ['clip', 'ellipsize-start', 'ellipsize-middle', 'ellipsize-end'] as const;
|
|
@@ -150,7 +151,7 @@ function normalizeCount(value: unknown): number {
|
|
|
150
151
|
return Math.max(0, Math.trunc(parsed));
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
export class GtkInscription extends
|
|
154
|
+
export class GtkInscription extends WidgetElement {
|
|
154
155
|
private _initialized = false;
|
|
155
156
|
|
|
156
157
|
static get observedAttributes() {
|
|
@@ -78,6 +78,7 @@ import {
|
|
|
78
78
|
} from '@gjsify/adwaita-core';
|
|
79
79
|
|
|
80
80
|
import { JUSTIFY_TEXT_ALIGN } from './justification.js';
|
|
81
|
+
import { WidgetElement } from '../widget-element.js';
|
|
81
82
|
|
|
82
83
|
/** The attributes that carry a property — also the `notify::` roster. */
|
|
83
84
|
const PROPERTY_ATTRIBUTES = [
|
|
@@ -96,7 +97,7 @@ const PROPERTY_ATTRIBUTES = [
|
|
|
96
97
|
'selectable',
|
|
97
98
|
] as const;
|
|
98
99
|
|
|
99
|
-
export class GtkLabel extends
|
|
100
|
+
export class GtkLabel extends WidgetElement {
|
|
100
101
|
/**
|
|
101
102
|
* The rendered text's own box — present while {@link wrap} is set (so it can be pinned
|
|
102
103
|
* to its measured wrap width, see `_remeasure`) OR while {@link ellipsize} is not
|
|
@@ -291,9 +292,9 @@ export class GtkLabel extends HTMLElement {
|
|
|
291
292
|
|
|
292
293
|
private _remeasure(): void {
|
|
293
294
|
if (!this._wrapSpan || !this.isConnected) return;
|
|
294
|
-
this._wrapSpan.style.
|
|
295
|
+
this._wrapSpan.style.maxWidth = '';
|
|
295
296
|
const width = measuredWrapWidth(this._wrapSpan);
|
|
296
|
-
this._wrapSpan.style.
|
|
297
|
+
this._wrapSpan.style.maxWidth = width !== null ? `min(100%, ${width}px)` : '';
|
|
297
298
|
}
|
|
298
299
|
|
|
299
300
|
attributeChangedCallback(name: string, old: string | null, value: string | null) {
|
|
@@ -393,9 +394,15 @@ export class GtkLabel extends HTMLElement {
|
|
|
393
394
|
* here, not the narrower width GTK's Pango layout actually wrapped to. So this measures
|
|
394
395
|
* instead, in two passes: first let {@link _wrapSpan} wrap at the FULL container width
|
|
395
396
|
* (`width: ''`, the same collapse above, which is exactly the width GTK's own
|
|
396
|
-
* allocation wraps against), then
|
|
397
|
+
* allocation wraps against), then cap the span at its widest resulting line via
|
|
397
398
|
* `Range.getClientRects()`, which gives the pseudo spacers real free space to split.
|
|
398
|
-
*
|
|
399
|
+
* A CAP, `max-width`, and never `width`: a pinned `width` is also the span's
|
|
400
|
+
* min-content, so the label could no longer shrink below the width it first wrapped
|
|
401
|
+
* at, and a card holding it in a narrower pane grew past the pane and was clipped.
|
|
402
|
+
* GtkLabel's wrapping minimum is its widest word (`gtk_label_measure`), which a capped
|
|
403
|
+
* flex item keeps as its min-content; the cap itself only resolves against a definite
|
|
404
|
+
* container, so the label's max-content stays its text on one line, GTK's natural.
|
|
405
|
+
* Approximate on purpose, and cheap: one synchronous reflow per render. The measured
|
|
399
406
|
* width goes stale whenever the available width or the font changes, and a page does
|
|
400
407
|
* both (a rotated phone, an opened sidebar, a web font arriving late), so
|
|
401
408
|
* {@link connectedCallback} re-measures on each resize and once the fonts have loaded.
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
48
48
|
|
|
49
49
|
import { normalizeBoxOrientation, type BoxOrientation } from '@gjsify/adwaita-core';
|
|
50
|
+
import { WidgetElement } from '../widget-element.js';
|
|
50
51
|
|
|
51
52
|
/** `GtkLevelBarMode`, spelled as the GIR's enum nicks (:1004-1008). */
|
|
52
53
|
type LevelBarMode = 'continuous' | 'discrete';
|
|
@@ -81,7 +82,7 @@ function numberAttribute(element: HTMLElement, name: string, fallback: number):
|
|
|
81
82
|
return Number.isFinite(raw) ? raw : fallback;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
export class GtkLevelBar extends
|
|
85
|
+
export class GtkLevelBar extends WidgetElement {
|
|
85
86
|
private _trough!: HTMLSpanElement;
|
|
86
87
|
private _initialized = false;
|
|
87
88
|
/** Offset name → value, kept sorted ascending exactly as the C's `GList` is. */
|
|
@@ -44,8 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
46
46
|
import { type AdwRowActivation, attachRowActivation } from './row-activation.js';
|
|
47
|
+
import { WidgetElement } from '../widget-element.js';
|
|
47
48
|
|
|
48
|
-
export class GtkListBoxRow extends
|
|
49
|
+
export class GtkListBoxRow extends WidgetElement {
|
|
49
50
|
private _contentsEl!: HTMLDivElement;
|
|
50
51
|
private _activation?: AdwRowActivation;
|
|
51
52
|
private _initialized = false;
|
|
@@ -67,6 +67,7 @@ import { attachRovingFocus } from './roving-focus.js';
|
|
|
67
67
|
// server-rendered box and collect its rows. See `adw-expander-row.ts` for why a combined
|
|
68
68
|
// `import { GtkListBoxRow }` would not do it.
|
|
69
69
|
import './gtk-list-box-row.js';
|
|
70
|
+
import { WidgetElement } from '../widget-element.js';
|
|
70
71
|
|
|
71
72
|
/** `GtkListTabBehavior`'s nicks — `cell` behaves as `item` outside a cell-based box. */
|
|
72
73
|
export type GtkListTabBehavior = 'all' | 'item' | 'cell';
|
|
@@ -78,7 +79,7 @@ export function normalizeListTabBehavior(raw: string | null | undefined): GtkLis
|
|
|
78
79
|
return raw !== null && raw !== undefined && TAB_BEHAVIORS.has(raw) ? (raw as GtkListTabBehavior) : 'all';
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
export class GtkListBox extends
|
|
82
|
+
export class GtkListBox extends WidgetElement {
|
|
82
83
|
private _rows: GtkListBoxRow[] = [];
|
|
83
84
|
private _selection: number[] = [];
|
|
84
85
|
/** `box->selected_row`, `-1` for the C's NULL. */
|
|
@@ -68,6 +68,7 @@ import { bindSlottedChildren } from '../slotted-children.js';
|
|
|
68
68
|
import { stringListSlot } from '../string-list-slot.js';
|
|
69
69
|
|
|
70
70
|
import { attachRovingFocus } from './roving-focus.js';
|
|
71
|
+
import { WidgetElement } from '../widget-element.js';
|
|
71
72
|
|
|
72
73
|
/** `GtkListTabBehavior`'s nicks — `cell` behaves as `item` outside a cell-based view. */
|
|
73
74
|
export type GtkListTabBehavior = 'all' | 'item' | 'cell';
|
|
@@ -79,7 +80,7 @@ export function normalizeListTabBehavior(raw: string | null | undefined): GtkLis
|
|
|
79
80
|
return raw !== null && raw !== undefined && TAB_BEHAVIORS.has(raw) ? (raw as GtkListTabBehavior) : 'all';
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
export class GtkListView extends
|
|
83
|
+
export class GtkListView extends WidgetElement {
|
|
83
84
|
protected _listEl!: HTMLDivElement;
|
|
84
85
|
protected _rows: HTMLElement[] = [];
|
|
85
86
|
/** The model + selection machine all three views share (ADR 0004, ADR 0089). */
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
// :296-306, `play_button_clicked`)
|
|
86
86
|
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
87
87
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
88
|
+
import { WidgetElement } from '../widget-element.js';
|
|
88
89
|
|
|
89
90
|
// The play/pause pair `ui/gtkvideo.ui`'s `play_button` carries, as constants for the same
|
|
90
91
|
// reason the video's four overlay glyphs are constants — `check-adwaita-icon-masks.mjs` finds
|
|
@@ -185,7 +186,7 @@ export function mediaTimeToString(seconds: number, remaining = false, forceHour
|
|
|
185
186
|
return `${min}:${String(sec).padStart(2, '0')}`;
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
export class GtkMediaControls extends
|
|
189
|
+
export class GtkMediaControls extends WidgetElement {
|
|
189
190
|
private _initialized = false;
|
|
190
191
|
private _playButton!: HTMLButtonElement;
|
|
191
192
|
private _timeLabel!: HTMLSpanElement;
|
|
@@ -49,6 +49,7 @@ import './gtk-popover.js';
|
|
|
49
49
|
import type { GtkPopover } from './gtk-popover.js';
|
|
50
50
|
|
|
51
51
|
import { createGtkImage } from './gtk-image.js';
|
|
52
|
+
import { WidgetElement } from '../widget-element.js';
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
55
|
* Where the popover sits, per `GtkArrowType`. `menuButtonPopupDirection` folds `none`
|
|
@@ -65,7 +66,7 @@ const POPOVER_POSITIONS = {
|
|
|
65
66
|
right: 'end',
|
|
66
67
|
} as const;
|
|
67
68
|
|
|
68
|
-
export class GtkMenuButton extends
|
|
69
|
+
export class GtkMenuButton extends WidgetElement {
|
|
69
70
|
private _buttonEl!: HTMLButtonElement;
|
|
70
71
|
private _popoverEl!: GtkPopover;
|
|
71
72
|
private _model: AdwMenuModel = [];
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
// Reference: refs/gtk/gtk/gtknotebook.c
|
|
71
71
|
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
72
72
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
73
|
+
import { WidgetElement } from '../widget-element.js';
|
|
73
74
|
|
|
74
75
|
/** `GtkPositionType`, spelled as the GIR's enum nicks. `top` is the property default. */
|
|
75
76
|
export type NotebookTabPos = 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -99,7 +100,7 @@ export interface NotebookPageInfo {
|
|
|
99
100
|
child: HTMLElement;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
export class GtkNotebook extends
|
|
103
|
+
export class GtkNotebook extends WidgetElement {
|
|
103
104
|
private _current: HTMLElement | null = null;
|
|
104
105
|
private _initialized = false;
|
|
105
106
|
private _initializedChildren = new WeakSet<HTMLElement>();
|
|
@@ -48,11 +48,12 @@
|
|
|
48
48
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
49
49
|
|
|
50
50
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
51
|
+
import { WidgetElement } from '../widget-element.js';
|
|
51
52
|
|
|
52
53
|
/** The edges `gtk_overlay_child_update_style_classes` can pin a child to. */
|
|
53
54
|
const EDGES = ['left', 'right', 'top', 'bottom'] as const;
|
|
54
55
|
|
|
55
|
-
export class GtkOverlay extends
|
|
56
|
+
export class GtkOverlay extends WidgetElement {
|
|
56
57
|
private _childEl!: HTMLDivElement;
|
|
57
58
|
private _layerEl!: HTMLDivElement;
|
|
58
59
|
private _initialized = false;
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
import { glibClamp, normalizeBoxOrientation, type BoxOrientation } from '@gjsify/adwaita-core';
|
|
70
70
|
|
|
71
71
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
72
|
+
import { WidgetElement } from '../widget-element.js';
|
|
72
73
|
|
|
73
74
|
/** `gtkpaned.c:131` — `HANDLE_EXTRA_SIZE`, how far the hit area reaches past the node. */
|
|
74
75
|
const HANDLE_EXTRA_SIZE = 6;
|
|
@@ -162,7 +163,7 @@ export function computePanedPosition(input: PanedPositionInput): PanedPosition {
|
|
|
162
163
|
return { min, max, position: glibClamp(position, min, max) };
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
export class GtkPaned extends
|
|
166
|
+
export class GtkPaned extends WidgetElement {
|
|
166
167
|
private _startEl!: HTMLDivElement;
|
|
167
168
|
private _handleEl!: HTMLDivElement;
|
|
168
169
|
private _endEl!: HTMLDivElement;
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
// `gtk_picture_set_content_fit` :1092-1131)
|
|
63
63
|
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
64
64
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
65
|
+
import { WidgetElement } from '../widget-element.js';
|
|
65
66
|
|
|
66
67
|
/** `GtkContentFit`, in enum order — the four nicks the GIR and CSS share. */
|
|
67
68
|
export const PICTURE_CONTENT_FIT_MODES = ['fill', 'contain', 'cover', 'scale-down'] as const;
|
|
@@ -82,7 +83,7 @@ export function normalizePictureContentFit(value: unknown): PictureContentFit {
|
|
|
82
83
|
: DEFAULT_PICTURE_CONTENT_FIT;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
export class GtkPicture extends
|
|
86
|
+
export class GtkPicture extends WidgetElement {
|
|
86
87
|
private _initialized = false;
|
|
87
88
|
|
|
88
89
|
static get observedAttributes() {
|
|
@@ -76,11 +76,12 @@ import './gtk-popover-menu.js';
|
|
|
76
76
|
|
|
77
77
|
import type { GtkPopoverMenu } from './gtk-popover-menu.js';
|
|
78
78
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
79
|
+
import { WidgetElement } from '../widget-element.js';
|
|
79
80
|
|
|
80
81
|
/** How long a press must last to count as a long press — GTK's own default. */
|
|
81
82
|
const LONG_PRESS_MS = 500;
|
|
82
83
|
|
|
83
|
-
export class GtkPopoverBin extends
|
|
84
|
+
export class GtkPopoverBin extends WidgetElement {
|
|
84
85
|
private _model: AdwMenuModel = [];
|
|
85
86
|
private _popover: GtkPopoverMenu | null = null;
|
|
86
87
|
private _actions: AdwMenuActions | null = null;
|
|
@@ -73,6 +73,7 @@ import type { AdwMenuActions, AdwMenuInput, AdwMenuModel, AdwMenuPath, AdwMenuSu
|
|
|
73
73
|
import './gtk-popover-menu.js';
|
|
74
74
|
|
|
75
75
|
import type { GtkPopoverMenu } from './gtk-popover-menu.js';
|
|
76
|
+
import { WidgetElement } from '../widget-element.js';
|
|
76
77
|
|
|
77
78
|
/** One bar item: its submenu node, the popover below it, and the DOM that draws both. */
|
|
78
79
|
interface MenuBarItem {
|
|
@@ -85,7 +86,7 @@ interface MenuBarItem {
|
|
|
85
86
|
popover: GtkPopoverMenu;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
export class GtkPopoverMenuBar extends
|
|
89
|
+
export class GtkPopoverMenuBar extends WidgetElement {
|
|
89
90
|
private _model: AdwMenuModel = [];
|
|
90
91
|
private _actions: AdwMenuActions | null = null;
|
|
91
92
|
private _items: MenuBarItem[] = [];
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
import { PopoverState, resolvePopoverKey } from '@gjsify/adwaita-core';
|
|
84
84
|
|
|
85
85
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
86
|
+
import { WidgetElement } from '../widget-element.js';
|
|
86
87
|
|
|
87
88
|
/** Which side of the anchor the surface sits on. */
|
|
88
89
|
export type GtkPopoverPosition = 'bottom' | 'top' | 'start' | 'end';
|
|
@@ -109,7 +110,7 @@ const ROLES: readonly GtkPopoverRole[] = [...LIST_ROLES, 'dialog'];
|
|
|
109
110
|
/** The row selector keyboard navigation walks. */
|
|
110
111
|
const ITEM_SELECTOR = '.adw-popover-item';
|
|
111
112
|
|
|
112
|
-
export class GtkPopover extends
|
|
113
|
+
export class GtkPopover extends WidgetElement {
|
|
113
114
|
private readonly _state = new PopoverState();
|
|
114
115
|
private _anchor: HTMLElement | null = null;
|
|
115
116
|
private _initialized = false;
|
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
42
42
|
|
|
43
43
|
import { glibClamp } from '@gjsify/adwaita-core';
|
|
44
|
+
import { WidgetElement } from '../widget-element.js';
|
|
44
45
|
|
|
45
|
-
export class GtkProgressBar extends
|
|
46
|
+
export class GtkProgressBar extends WidgetElement {
|
|
46
47
|
private _trough!: HTMLSpanElement;
|
|
47
48
|
private _progress!: HTMLSpanElement;
|
|
48
49
|
private _text!: HTMLSpanElement;
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
import { easeOutCubic } from '@gjsify/adwaita-core';
|
|
61
61
|
|
|
62
62
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
63
|
+
import { WidgetElement } from '../widget-element.js';
|
|
63
64
|
|
|
64
65
|
/** Every `GtkRevealerTransitionType` nick, in GIR order. */
|
|
65
66
|
const TRANSITION_TYPES = [
|
|
@@ -116,7 +117,7 @@ const RTL_FLIP: Partial<Record<RevealerTransitionType, RevealerTransitionType>>
|
|
|
116
117
|
'fade-slide-right': 'fade-slide-left',
|
|
117
118
|
};
|
|
118
119
|
|
|
119
|
-
export class GtkRevealer extends
|
|
120
|
+
export class GtkRevealer extends WidgetElement {
|
|
120
121
|
private _clipEl!: HTMLDivElement;
|
|
121
122
|
private _initialized = false;
|
|
122
123
|
/** `current_pos` — 0 hidden, 1 shown. */
|
|
@@ -53,6 +53,7 @@ import { createGtkImage } from './gtk-image.js';
|
|
|
53
53
|
// TypeScript and take the registration with it.
|
|
54
54
|
import './gtk-popover.js';
|
|
55
55
|
import type { GtkPopover } from './gtk-popover.js';
|
|
56
|
+
import { WidgetElement } from '../widget-element.js';
|
|
56
57
|
|
|
57
58
|
/** `gtk_adjustment_new (0, 0, 100, 2, 20, 0)` — the adjustment a bare scale button has. */
|
|
58
59
|
const GTK_ADJUSTMENT: AdwAdjustmentInput = {
|
|
@@ -63,7 +64,7 @@ const GTK_ADJUSTMENT: AdwAdjustmentInput = {
|
|
|
63
64
|
pageSize: 0,
|
|
64
65
|
};
|
|
65
66
|
|
|
66
|
-
export class GtkScaleButton extends
|
|
67
|
+
export class GtkScaleButton extends WidgetElement {
|
|
67
68
|
private readonly _state = new SpinState();
|
|
68
69
|
private _buttonEl!: HTMLButtonElement;
|
|
69
70
|
private _glyph!: HTMLElement;
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
parseAdjustment,
|
|
44
44
|
} from '@gjsify/adwaita-core';
|
|
45
45
|
import type { AdwAdjustment, AdwAdjustmentInput, BoxOrientation } from '@gjsify/adwaita-core';
|
|
46
|
+
import { WidgetElement } from '../widget-element.js';
|
|
46
47
|
|
|
47
48
|
/** `Gtk.PositionType` nicks, as `GtkScale:value-pos` spells them. */
|
|
48
49
|
const VALUE_POSITIONS = ['left', 'right', 'top', 'bottom'] as const;
|
|
@@ -90,7 +91,7 @@ export function formatScaleValue(value: number, digits: number): string {
|
|
|
90
91
|
return text;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
export class GtkScale extends
|
|
94
|
+
export class GtkScale extends WidgetElement {
|
|
94
95
|
/** The headless `Gtk.Adjustment`: the range, the clamp and the two signals (ADR 0004, ADR 0047). */
|
|
95
96
|
private readonly _range = new SpinState();
|
|
96
97
|
private _trough!: HTMLElement;
|
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
type AdwAdjustmentInput,
|
|
67
67
|
type BoxOrientation,
|
|
68
68
|
} from '@gjsify/adwaita-core';
|
|
69
|
+
import { WidgetElement } from '../widget-element.js';
|
|
69
70
|
|
|
70
71
|
/** The two nodes below GTK's `range` level, spelled as GTK spells them. */
|
|
71
72
|
const TROUGH_CLASS = 'adw-scrollbar-trough';
|
|
@@ -112,7 +113,7 @@ const ZERO_ADJUSTMENT: AdwAdjustment = Object.freeze({
|
|
|
112
113
|
pageSize: 0,
|
|
113
114
|
});
|
|
114
115
|
|
|
115
|
-
export class GtkScrollbar extends
|
|
116
|
+
export class GtkScrollbar extends WidgetElement {
|
|
116
117
|
private _trough!: HTMLElement;
|
|
117
118
|
private _slider!: HTMLElement;
|
|
118
119
|
private _observer: ResizeObserver | null = null;
|
|
@@ -93,6 +93,7 @@ import { AdwScrollShading } from '../scroll-shading.js';
|
|
|
93
93
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
94
94
|
import type { GtkScrollType } from './gtk-scrollbar.js';
|
|
95
95
|
import type { GtkViewport } from './gtk-viewport.js';
|
|
96
|
+
import { WidgetElement } from '../widget-element.js';
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
99
|
* `INDICATOR_FADE_OUT_DELAY` — how long an indicator waits, after the last scroll, before
|
|
@@ -148,7 +149,7 @@ const AXES = [
|
|
|
148
149
|
bar: 'horizontal',
|
|
149
150
|
policy: 'hscrollbar-policy',
|
|
150
151
|
natural: 'propagate-natural-width',
|
|
151
|
-
|
|
152
|
+
cssSize: 'width',
|
|
152
153
|
end: 'left',
|
|
153
154
|
farEnd: 'right',
|
|
154
155
|
},
|
|
@@ -157,7 +158,7 @@ const AXES = [
|
|
|
157
158
|
bar: 'vertical',
|
|
158
159
|
policy: 'vscrollbar-policy',
|
|
159
160
|
natural: 'propagate-natural-height',
|
|
160
|
-
|
|
161
|
+
cssSize: 'height',
|
|
161
162
|
end: 'top',
|
|
162
163
|
farEnd: 'bottom',
|
|
163
164
|
},
|
|
@@ -198,7 +199,7 @@ function resolveScrollKey(event: KeyboardEvent): { scroll: GtkScrollType; horizo
|
|
|
198
199
|
}
|
|
199
200
|
}
|
|
200
201
|
|
|
201
|
-
export class GtkScrolledWindow extends
|
|
202
|
+
export class GtkScrolledWindow extends WidgetElement {
|
|
202
203
|
private _viewport!: GtkViewport;
|
|
203
204
|
private _bars: Record<'horizontal' | 'vertical', HTMLElement> | null = null;
|
|
204
205
|
/** The size clamps `_writeSize` last wrote, which are the only ones it may clear. */
|
|
@@ -567,8 +568,10 @@ export class GtkScrolledWindow extends HTMLElement {
|
|
|
567
568
|
// `gtk_scrolled_window_measure`'s request for the CHILD'S size, written on the
|
|
568
569
|
// scrollport that has to ask its parent for it: `propagate-natural-*` is the
|
|
569
570
|
// child's NATURAL size (`max-content`), a NEVER policy is its MINIMUM one
|
|
570
|
-
// (`min-content`), and the natural is the larger of the two.
|
|
571
|
-
|
|
571
|
+
// (`min-content`), and the natural is the larger of the two. It is the SIZE, not
|
|
572
|
+
// the minimum: `_scrolled_window.scss` holds the scrollport at 0 by default and
|
|
573
|
+
// fills the cell through `min-*: 100%`, which a minimum here would overwrite.
|
|
574
|
+
this._viewport.style[axis.cssSize] = this.hasAttribute(axis.natural)
|
|
572
575
|
? 'max-content'
|
|
573
576
|
: policy === 'never'
|
|
574
577
|
? 'min-content'
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
39
39
|
|
|
40
40
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
41
|
+
import { WidgetElement } from '../widget-element.js';
|
|
41
42
|
|
|
42
|
-
export class GtkSearchBar extends
|
|
43
|
+
export class GtkSearchBar extends WidgetElement {
|
|
43
44
|
private _box!: HTMLDivElement;
|
|
44
45
|
private _center!: HTMLDivElement;
|
|
45
46
|
private _close!: HTMLButtonElement;
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
18
18
|
|
|
19
19
|
import { normalizeBoxOrientation, type BoxOrientation } from '@gjsify/adwaita-core';
|
|
20
|
+
import { WidgetElement } from '../widget-element.js';
|
|
20
21
|
|
|
21
|
-
export class GtkSeparator extends
|
|
22
|
+
export class GtkSeparator extends WidgetElement {
|
|
22
23
|
static get observedAttributes() {
|
|
23
24
|
return ['orientation'];
|
|
24
25
|
}
|
|
@@ -34,6 +34,7 @@ import type { AdwAdjustment, AdwAdjustmentInput } from '@gjsify/adwaita-core';
|
|
|
34
34
|
import { createGtkImage } from './gtk-image.js';
|
|
35
35
|
|
|
36
36
|
import { formatScaleValue } from './gtk-scale.js';
|
|
37
|
+
import { WidgetElement } from '../widget-element.js';
|
|
37
38
|
|
|
38
39
|
/** `EPSILON` in gtkspinbutton.c:64 — the "is the value already at the bound" test. */
|
|
39
40
|
const EPSILON = 1e-10;
|
|
@@ -46,7 +47,7 @@ const MAX_TIMER_CALLS = 5;
|
|
|
46
47
|
/** `Gtk.SpinButtonUpdatePolicy` nicks; `always` is the pspec default (gtkspinbutton.c:472-475). */
|
|
47
48
|
const UPDATE_POLICIES = ['always', 'if-valid'] as const;
|
|
48
49
|
|
|
49
|
-
export class GtkSpinButton extends
|
|
50
|
+
export class GtkSpinButton extends WidgetElement {
|
|
50
51
|
private readonly _range = new SpinState();
|
|
51
52
|
private _input!: HTMLInputElement;
|
|
52
53
|
private _down!: HTMLButtonElement;
|
|
@@ -43,13 +43,14 @@
|
|
|
43
43
|
// Reference: refs/libadwaita/src/stylesheet/widgets/_spinner.scss:1-3 (the disabled rule)
|
|
44
44
|
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
45
45
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
46
|
+
import { WidgetElement } from '../widget-element.js';
|
|
46
47
|
|
|
47
48
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
48
49
|
|
|
49
50
|
/** The radius-7 ring `process-working-symbolic.svg` traces through (1,8)…(15,8). */
|
|
50
51
|
const RADIUS = 7;
|
|
51
52
|
|
|
52
|
-
export class GtkSpinner extends
|
|
53
|
+
export class GtkSpinner extends WidgetElement {
|
|
53
54
|
private _initialized = false;
|
|
54
55
|
|
|
55
56
|
static get observedAttributes() {
|
|
@@ -20,11 +20,12 @@
|
|
|
20
20
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
21
21
|
|
|
22
22
|
import { bindSlottedChildren } from '../slotted-children.js';
|
|
23
|
+
import { WidgetElement } from '../widget-element.js';
|
|
23
24
|
|
|
24
25
|
/** The attributes a record hands to its child on adoption — `GtkStackPage`'s string/boolean properties. */
|
|
25
26
|
export const STACK_PAGE_ATTRIBUTES = ['name', 'title', 'icon-name', 'needs-attention', 'use-underline'] as const;
|
|
26
27
|
|
|
27
|
-
export class GtkStackPage extends
|
|
28
|
+
export class GtkStackPage extends WidgetElement {
|
|
28
29
|
static get observedAttributes() {
|
|
29
30
|
return [...STACK_PAGE_ATTRIBUTES];
|
|
30
31
|
}
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
40
40
|
|
|
41
41
|
import type { GtkStack } from './gtk-stack.js';
|
|
42
|
+
import { WidgetElement } from '../widget-element.js';
|
|
42
43
|
|
|
43
44
|
/** The `GtkStackPageInfo` half this element reads — it never looks inside `child`. */
|
|
44
45
|
interface SidebarPage {
|
|
@@ -49,7 +50,7 @@ interface SidebarPage {
|
|
|
49
50
|
child: HTMLElement;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
export class GtkStackSidebar extends
|
|
53
|
+
export class GtkStackSidebar extends WidgetElement {
|
|
53
54
|
private _stack: GtkStack | null = null;
|
|
54
55
|
private _list!: HTMLDivElement;
|
|
55
56
|
private _initialized = false;
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
import { normalizeBoxOrientation, type BoxOrientation } from '@gjsify/adwaita-core';
|
|
48
48
|
|
|
49
49
|
import type { GtkStack } from './gtk-stack.js';
|
|
50
|
+
import { WidgetElement } from '../widget-element.js';
|
|
50
51
|
|
|
51
52
|
/** The `GtkStackPageInfo` half this element reads — it never looks inside `child`. */
|
|
52
53
|
interface SwitcherPage {
|
|
@@ -65,7 +66,7 @@ interface SwitcherButton {
|
|
|
65
66
|
icon: HTMLElement;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
export class GtkStackSwitcher extends
|
|
69
|
+
export class GtkStackSwitcher extends WidgetElement {
|
|
69
70
|
private _stack: GtkStack | null = null;
|
|
70
71
|
private _initialized = false;
|
|
71
72
|
private _nodes: SwitcherButton[] = [];
|