@gjsify/adwaita-web 0.64.1 → 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 +22 -88
- package/dist/adwaita-web.css +91 -12
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/accessible.d.ts +8 -0
- package/lib/types/application.d.ts +1 -1
- package/lib/types/child-slot.spec.d.ts +1 -0
- package/lib/types/compute-expand.d.ts +5 -0
- package/lib/types/compute-expand.spec.d.ts +1 -0
- package/lib/types/container-fill.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 +80 -19
- 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 +10 -30
- 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-features.d.ts +8 -0
- 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-application-window.d.ts +1 -4
- 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-emoji-chooser.d.ts +2 -0
- 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-menu.d.ts +2 -0
- package/lib/types/elements/gtk-popover.d.ts +7 -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 +29 -0
- 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 +13 -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 +18 -2
- package/lib/types/gobject-elements.d.ts +15 -0
- 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 +3 -4
- package/lib/types/learn6502-window.spec.d.ts +1 -0
- package/lib/types/namespace/adw.d.ts +1 -1
- 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/namespace/gtk.d.ts +2 -0
- package/lib/types/shared-tree-builder.d.ts +31 -0
- 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/lib/types/widget-visible.spec.d.ts +1 -0
- package/lib/types/window-maximize.spec.d.ts +1 -0
- package/package.json +13 -12
- package/scss/_about_dialog.scss +46 -1
- package/scss/_bin.scss +6 -3
- package/scss/_checks.scss +5 -2
- package/scss/_icon.scss +3 -4
- package/scss/_labels.scss +2 -2
- package/scss/_overlay.scss +11 -1
- package/scss/_overlay_split_view.scss +10 -0
- package/scss/_reset.scss +1 -1
- package/scss/_scrolled_window.scss +15 -0
- package/scss/_stack.scss +8 -2
- package/scss/_toast.scss +13 -3
- package/scss/_widget.scss +5 -1
- package/scss/_window.scss +16 -0
- 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-alert-dialog.spec.ts +71 -5
- package/src/adw-bin.spec.ts +4 -3
- package/src/adw-button-content.spec.ts +1 -1
- package/src/adw-carousel.spec.ts +49 -1
- package/src/adw-header-bar.spec.ts +18 -0
- package/src/adw-toast-overlay.spec.ts +68 -24
- package/src/application.spec.ts +44 -0
- package/src/application.ts +13 -18
- package/src/capabilities.mjs +2 -3
- package/src/checks.spec.ts +51 -1
- package/src/child-slot.spec.ts +71 -0
- package/src/compute-expand.spec.ts +186 -0
- package/src/compute-expand.ts +134 -0
- package/src/construct-vectors.spec.ts +97 -7
- package/src/container-fill.spec.ts +70 -0
- 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 +177 -46
- package/src/elements/adw-application-window.ts +0 -3
- 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 +5 -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 +5 -2
- 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 +6 -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 +37 -70
- 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-features.ts +14 -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-application-window.ts +3 -8
- 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 +6 -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-emoji-chooser.ts +5 -0
- 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 +5 -2
- 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 +5 -2
- 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 +5 -2
- 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 +7 -5
- package/src/elements/gtk-paned.ts +9 -2
- package/src/elements/gtk-picture.ts +2 -1
- package/src/elements/gtk-popover-bin.ts +5 -1
- package/src/elements/gtk-popover-menu-bar.ts +2 -1
- package/src/elements/gtk-popover-menu.ts +5 -0
- package/src/elements/gtk-popover.ts +14 -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 +7 -6
- 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 +112 -0
- package/src/elements/gtk-stack-sidebar.ts +2 -1
- package/src/elements/gtk-stack-switcher.ts +2 -1
- package/src/elements/gtk-stack.ts +52 -6
- 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 +5 -1
- package/src/elements/gtk-video.ts +2 -1
- package/src/elements/gtk-viewport.ts +6 -1
- package/src/elements/gtk-window-controls.ts +2 -1
- package/src/elements/gtk-window-handle.ts +6 -1
- package/src/elements/gtk-window.ts +57 -7
- package/src/gio.spec.ts +13 -3
- package/src/glib.spec.ts +9 -0
- package/src/gobject-elements.ts +44 -2
- package/src/gtk-label.spec.ts +39 -0
- package/src/gtk-scrolled-window.spec.ts +6 -6
- package/src/gtk-stack.spec.ts +170 -0
- 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 +5 -9
- package/src/keyboard-operable.spec.ts +3 -3
- package/src/learn6502-window.spec.ts +113 -0
- package/src/namespace/adw.ts +1 -1
- package/src/namespace/gdk.ts +1 -0
- package/src/namespace/gio.ts +8 -0
- package/src/namespace/glib.ts +4 -0
- package/src/namespace/gtk.ts +2 -0
- package/src/shared-tree-builder.ts +131 -13
- package/src/shared-trees.spec.ts +15 -1
- package/src/signals.ts +11 -2
- package/src/slotted-children.spec.ts +24 -0
- package/src/slotted-children.ts +18 -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 +16 -2
- package/src/value-lists.spec.ts +3 -3
- 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 +148 -0
- package/src/window-maximize.spec.ts +93 -0
- package/lib/types/icon-registry.d.ts +0 -37
- package/src/icon-registry.ts +0 -163
|
@@ -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;
|
|
@@ -110,7 +111,9 @@ export class GtkListBoxRow extends HTMLElement {
|
|
|
110
111
|
// `child` is a WIDGET property, so it is a slot here (gtklistbox.c:3307-3331): the
|
|
111
112
|
// authored child lands in the same node `gtk_list_box_row_set_child` would put it in,
|
|
112
113
|
// and a child appended after connect lands there too.
|
|
113
|
-
bindSlottedChildren(this, [{ into: this._contentsEl }]).install(
|
|
114
|
+
bindSlottedChildren(this, [{ name: 'child', into: this._contentsEl }, { into: this._contentsEl }]).install(
|
|
115
|
+
this._contentsEl,
|
|
116
|
+
);
|
|
114
117
|
|
|
115
118
|
// GTK declares the accessible role unconditionally (gtklistbox.c:3955), so there is
|
|
116
119
|
// no `selection-mode` to condition it on here.
|
|
@@ -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;
|
|
@@ -98,10 +99,11 @@ export class GtkOverlay extends HTMLElement {
|
|
|
98
99
|
// bare `<child>` — the default — is the main child, which is the pairing
|
|
99
100
|
// `packages/framework/gtk-host/src/descriptors/gtk.ts` curates for `GtkOverlay`
|
|
100
101
|
// (`slots: { child, overlay }`, `defaultSlot: 'child'`).
|
|
101
|
-
bindSlottedChildren(this, [
|
|
102
|
-
this._childEl,
|
|
103
|
-
this.
|
|
104
|
-
|
|
102
|
+
bindSlottedChildren(this, [
|
|
103
|
+
{ name: 'child', into: this._childEl },
|
|
104
|
+
{ into: this._childEl },
|
|
105
|
+
{ name: 'overlay', into: this._layerEl },
|
|
106
|
+
]).install(this._childEl, this._layerEl);
|
|
105
107
|
|
|
106
108
|
this._observe();
|
|
107
109
|
}
|
|
@@ -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;
|
|
@@ -278,7 +279,13 @@ export class GtkPaned extends HTMLElement {
|
|
|
278
279
|
// (gtkpaned.c:816-826).
|
|
279
280
|
bindSlottedChildren(
|
|
280
281
|
this,
|
|
281
|
-
[
|
|
282
|
+
[
|
|
283
|
+
{ into: this._startEl },
|
|
284
|
+
{ name: 'start', into: this._startEl },
|
|
285
|
+
{ name: 'end', into: this._endEl },
|
|
286
|
+
{ name: 'start-child', into: this._startEl },
|
|
287
|
+
{ name: 'end-child', into: this._endEl },
|
|
288
|
+
],
|
|
282
289
|
() => this._observe(),
|
|
283
290
|
).install(this._startEl, this._handleEl, this._endEl);
|
|
284
291
|
|
|
@@ -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() {
|
|
@@ -75,11 +75,13 @@ import type { AdwMenuActions, AdwMenuInput, AdwMenuModel } from '@gjsify/adwaita
|
|
|
75
75
|
import './gtk-popover-menu.js';
|
|
76
76
|
|
|
77
77
|
import type { GtkPopoverMenu } from './gtk-popover-menu.js';
|
|
78
|
+
import { bindSlottedChildren } from '../slotted-children.js';
|
|
79
|
+
import { WidgetElement } from '../widget-element.js';
|
|
78
80
|
|
|
79
81
|
/** How long a press must last to count as a long press — GTK's own default. */
|
|
80
82
|
const LONG_PRESS_MS = 500;
|
|
81
83
|
|
|
82
|
-
export class GtkPopoverBin extends
|
|
84
|
+
export class GtkPopoverBin extends WidgetElement {
|
|
83
85
|
private _model: AdwMenuModel = [];
|
|
84
86
|
private _popover: GtkPopoverMenu | null = null;
|
|
85
87
|
private _actions: AdwMenuActions | null = null;
|
|
@@ -150,6 +152,8 @@ export class GtkPopoverBin extends HTMLElement {
|
|
|
150
152
|
this._initialized = true;
|
|
151
153
|
// `gtk_widget_class_set_css_name (widget_class, "popoverbin")` (gtkpopoverbin.c:382).
|
|
152
154
|
this.classList.add('adw-popover-bin');
|
|
155
|
+
// The NAME only, for the reason `adw-bin.ts` gives: the child already IS the content.
|
|
156
|
+
bindSlottedChildren(this, [{ name: 'child', into: this }]);
|
|
153
157
|
this.addEventListener('contextmenu', (event) => this._onContextMenu(event));
|
|
154
158
|
this.addEventListener('keydown', (event) => this._onKeyDown(event));
|
|
155
159
|
this._wireGestures();
|
|
@@ -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[] = [];
|
|
@@ -161,6 +161,11 @@ export class GtkPopoverMenu extends GtkPopover {
|
|
|
161
161
|
this.openSubmenu(value);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
/** The menu's own stack is the child (gtkpopovermenu.c `gtk_popover_menu_init`). */
|
|
165
|
+
protected override takesChild(): boolean {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
|
|
164
169
|
connectedCallback() {
|
|
165
170
|
super.connectedCallback();
|
|
166
171
|
if (this._menuInitialized) return;
|
|
@@ -82,6 +82,9 @@
|
|
|
82
82
|
|
|
83
83
|
import { PopoverState, resolvePopoverKey } from '@gjsify/adwaita-core';
|
|
84
84
|
|
|
85
|
+
import { bindSlottedChildren } from '../slotted-children.js';
|
|
86
|
+
import { WidgetElement } from '../widget-element.js';
|
|
87
|
+
|
|
85
88
|
/** Which side of the anchor the surface sits on. */
|
|
86
89
|
export type GtkPopoverPosition = 'bottom' | 'top' | 'start' | 'end';
|
|
87
90
|
|
|
@@ -107,7 +110,7 @@ const ROLES: readonly GtkPopoverRole[] = [...LIST_ROLES, 'dialog'];
|
|
|
107
110
|
/** The row selector keyboard navigation walks. */
|
|
108
111
|
const ITEM_SELECTOR = '.adw-popover-item';
|
|
109
112
|
|
|
110
|
-
export class GtkPopover extends
|
|
113
|
+
export class GtkPopover extends WidgetElement {
|
|
111
114
|
private readonly _state = new PopoverState();
|
|
112
115
|
private _anchor: HTMLElement | null = null;
|
|
113
116
|
private _initialized = false;
|
|
@@ -257,10 +260,20 @@ export class GtkPopover extends HTMLElement {
|
|
|
257
260
|
if (this._state.open) this._bindDocument();
|
|
258
261
|
}
|
|
259
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Whether `Gtk.Popover:child` is the author's to set. A subclass that builds its own
|
|
265
|
+
* content (GtkPopoverMenu, GtkEmojiChooser) sets the child itself, as their C does.
|
|
266
|
+
*/
|
|
267
|
+
protected takesChild(): boolean {
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
|
|
260
271
|
private _buildOnce() {
|
|
261
272
|
if (this._initialized) return;
|
|
262
273
|
this._initialized = true;
|
|
263
274
|
|
|
275
|
+
// The NAME only, for the reason `adw-bin.ts` gives: the child already IS the content.
|
|
276
|
+
if (this.takesChild()) bindSlottedChildren(this, [{ name: 'child', into: this }]);
|
|
264
277
|
this.classList.add('adw-popover');
|
|
265
278
|
if (!this.hasAttribute('role')) this.setAttribute('role', 'menu');
|
|
266
279
|
// The `menu` variant is NOT defaulted or inferred here — it is GTK's `.menu`
|
|
@@ -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'
|
|
@@ -37,7 +37,10 @@
|
|
|
37
37
|
// Copyright (c) The GTK Team, GNOME contributors. LGPLv2.1+.
|
|
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';
|
|
42
|
+
|
|
43
|
+
export class GtkSearchBar extends WidgetElement {
|
|
41
44
|
private _box!: HTMLDivElement;
|
|
42
45
|
private _center!: HTMLDivElement;
|
|
43
46
|
private _close!: HTMLButtonElement;
|
|
@@ -93,10 +96,6 @@ export class GtkSearchBar extends HTMLElement {
|
|
|
93
96
|
|
|
94
97
|
this._center = document.createElement('div');
|
|
95
98
|
this._center.className = 'adw-search-bar-center';
|
|
96
|
-
// Whatever the author put inside the bar is the child, moved into the box's centre —
|
|
97
|
-
// the `GtkCenterBox` the C builds around it (gtksearchbar.c:378-386).
|
|
98
|
-
this._center.append(...this.childNodes);
|
|
99
|
-
|
|
100
99
|
this._close = document.createElement('button');
|
|
101
100
|
this._close.className = 'adw-search-bar-close';
|
|
102
101
|
this._close.type = 'button';
|
|
@@ -106,7 +105,9 @@ export class GtkSearchBar extends HTMLElement {
|
|
|
106
105
|
this._box = document.createElement('div');
|
|
107
106
|
this._box.className = 'adw-search-bar-box';
|
|
108
107
|
this._box.append(this._center, this._close);
|
|
109
|
-
|
|
108
|
+
// Whatever the author put inside the bar is the child, moved into the box's centre —
|
|
109
|
+
// the `GtkCenterBox` the C builds around it (gtksearchbar.c:378-386).
|
|
110
|
+
bindSlottedChildren(this, [{ name: 'child', into: this._center }, { into: this._center }]).install(this._box);
|
|
110
111
|
|
|
111
112
|
// `input-intercepted`: typing into the connected editable reveals the bar
|
|
112
113
|
// (gtksearchbar.c:210-218). Captured, because the editable may be nested two
|
|
@@ -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() {
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// <gtk-stack-page> — the page record a `<gtk-stack>` is AUTHORED with.
|
|
2
|
+
//
|
|
3
|
+
// NOT A WIDGET, AS UPSTREAM. `GtkStackPage` descends from `GObject.Object` (gtkstack.c:212-233):
|
|
4
|
+
// it carries a page's `name`, `title`, `icon-name` and attention state beside the `child` that IS
|
|
5
|
+
// the page. A Blueprint spells it `Stack { StackPage { name: "debugger"; child: … } }`, and
|
|
6
|
+
// without an element for it the shared-tree builder refused every such `.blp`.
|
|
7
|
+
//
|
|
8
|
+
// THE STACK ADOPTS IT AND KEEPS NO RECORD, the shape `<adw-view-stack>` gives
|
|
9
|
+
// `<adw-view-stack-page>`: `<gtk-stack>` already reads a page's six properties as attributes on
|
|
10
|
+
// its CHILD (see `gtk-stack.ts`), so adopting a record copies them onto the child and puts the
|
|
11
|
+
// child where the record was. The record leaves the tree, which is the browser half of what
|
|
12
|
+
// `@gjsify/adwaita-nativescript`'s `stack-page.ts` refuses after adoption: a write to a record
|
|
13
|
+
// the stack no longer reads would be a silent no-op.
|
|
14
|
+
// name / title / icon-name / needs-attention / use-underline — the same attributes
|
|
15
|
+
// visible — the DOM's own `hidden`, as on the child (`GtkStackPage:visible`, gtkstack.c:567)
|
|
16
|
+
// child — the slot `child`, or the record's one element child (a bare child IS the page)
|
|
17
|
+
//
|
|
18
|
+
// Reference: refs/gtk/gtk/gtkstack.c (GtkStackPage)
|
|
19
|
+
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
20
|
+
// Modifications: Implemented as a Web Component for @gjsify/adwaita-web.
|
|
21
|
+
|
|
22
|
+
import { bindSlottedChildren } from '../slotted-children.js';
|
|
23
|
+
import { WidgetElement } from '../widget-element.js';
|
|
24
|
+
|
|
25
|
+
/** The attributes a record hands to its child on adoption — `GtkStackPage`'s string/boolean properties. */
|
|
26
|
+
export const STACK_PAGE_ATTRIBUTES = ['name', 'title', 'icon-name', 'needs-attention', 'use-underline'] as const;
|
|
27
|
+
|
|
28
|
+
export class GtkStackPage extends WidgetElement {
|
|
29
|
+
static get observedAttributes() {
|
|
30
|
+
return [...STACK_PAGE_ATTRIBUTES];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** `GtkStackPage:name` — what `visible-child-name` selects by. */
|
|
34
|
+
get name(): string {
|
|
35
|
+
return this.getAttribute('name') ?? '';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
set name(value: string | null) {
|
|
39
|
+
if (value === null) this.removeAttribute('name');
|
|
40
|
+
else this.setAttribute('name', value);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// `GtkStackPage:title` is `HTMLElement.title`, which already reflects the `title` attribute.
|
|
44
|
+
|
|
45
|
+
/** `GtkStackPage:icon-name`. */
|
|
46
|
+
get iconName(): string | null {
|
|
47
|
+
return this.getAttribute('icon-name');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
set iconName(value: string | null) {
|
|
51
|
+
if (value === null) this.removeAttribute('icon-name');
|
|
52
|
+
else this.setAttribute('icon-name', value);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** `GtkStackPage:needs-attention`. */
|
|
56
|
+
get needsAttention(): boolean {
|
|
57
|
+
return this.hasAttribute('needs-attention');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
set needsAttention(value: boolean) {
|
|
61
|
+
this.toggleAttribute('needs-attention', !!value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** `GtkStackPage:use-underline`. */
|
|
65
|
+
get useUnderline(): boolean {
|
|
66
|
+
return this.hasAttribute('use-underline');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
set useUnderline(value: boolean) {
|
|
70
|
+
this.toggleAttribute('use-underline', !!value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** `GtkStackPage:visible` — `hidden`, as on the child the stack reads it from. */
|
|
74
|
+
get visible(): boolean {
|
|
75
|
+
return !this.hasAttribute('hidden');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
set visible(value: boolean) {
|
|
79
|
+
this.toggleAttribute('hidden', !value);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** `GtkStackPage:child` — the element the stack shows for this page, while not yet adopted. */
|
|
83
|
+
get child(): HTMLElement | null {
|
|
84
|
+
return pageChildOf(this);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
connectedCallback(): void {
|
|
88
|
+
// `child:` in a `.blp` authors `slot="child"`, and the mount refuses a name this element
|
|
89
|
+
// never declared. The stack adopts on ITS connect, which runs first, so by now this
|
|
90
|
+
// record is usually detached; enrolling the name is all that is left to do.
|
|
91
|
+
bindSlottedChildren(this, [{ name: 'child', into: this }]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The one element a record holds: its `slot="child"` child or its only element child. A record
|
|
97
|
+
* with none, or with more than one, is refused by name — GtkStackPage has exactly one `child`.
|
|
98
|
+
*/
|
|
99
|
+
export function pageChildOf(page: HTMLElement): HTMLElement | null {
|
|
100
|
+
const elements = Array.from(page.children) as HTMLElement[];
|
|
101
|
+
const slotted = elements.filter((child) => child.getAttribute('slot') === 'child');
|
|
102
|
+
const candidates = slotted.length > 0 ? slotted : elements;
|
|
103
|
+
if (candidates.length > 1) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
`<gtk-stack-page name="${page.getAttribute('name') ?? ''}"> holds ${candidates.length} children, ` +
|
|
106
|
+
'and a GtkStackPage has one `child`.',
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return candidates[0] ?? null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
customElements.define('gtk-stack-page', GtkStackPage);
|
|
@@ -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;
|