@gjsify/adwaita-web 0.64.1-next.240 → 0.64.1-next.243

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.
Files changed (56) hide show
  1. package/README.md +42 -4
  2. package/dist/adwaita-web.css +12 -1
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/canvas2d/canvas2d-bridge.d.ts +18 -0
  5. package/lib/types/canvas2d-bridge.spec.d.ts +1 -0
  6. package/lib/types/elements/adw-action-row.d.ts +3 -0
  7. package/lib/types/elements/adw-bottom-sheet.d.ts +3 -0
  8. package/lib/types/elements/adw-navigation-view.d.ts +7 -0
  9. package/lib/types/elements/adw-switch-row.d.ts +3 -0
  10. package/lib/types/elements/adw-window-features.d.ts +6 -1
  11. package/lib/types/elements/gtk-application-window.d.ts +2 -0
  12. package/lib/types/elements/gtk-image.d.ts +12 -3
  13. package/lib/types/elements/gtk-scrolled-window.d.ts +10 -0
  14. package/lib/types/elements/gtk-window.d.ts +29 -3
  15. package/lib/types/gobject-elements.d.ts +7 -0
  16. package/lib/types/icon-registry.d.ts +3 -1
  17. package/lib/types/icon-theme.d.ts +53 -0
  18. package/lib/types/icon-theme.spec.d.ts +1 -0
  19. package/lib/types/index.d.ts +1 -0
  20. package/lib/types/styles.generated.d.ts +1 -1
  21. package/package.json +12 -12
  22. package/scss/_about_dialog.scss +2 -2
  23. package/scss/_icon.scss +18 -0
  24. package/scss/_window.scss +7 -0
  25. package/src/adw-action-rows.spec.ts +20 -0
  26. package/src/adw-alert-dialog.spec.ts +15 -0
  27. package/src/adw-application-window.spec.ts +2 -1
  28. package/src/adw-window.spec.ts +22 -3
  29. package/src/bottom-sheet.spec.ts +11 -0
  30. package/src/canvas2d/canvas2d-bridge.ts +51 -1
  31. package/src/canvas2d-bridge.spec.ts +47 -0
  32. package/src/elements/adw-about-dialog.ts +4 -2
  33. package/src/elements/adw-action-row.ts +4 -0
  34. package/src/elements/adw-alert-dialog.ts +6 -0
  35. package/src/elements/adw-application-window.ts +9 -2
  36. package/src/elements/adw-bottom-sheet.ts +4 -0
  37. package/src/elements/adw-navigation-view.ts +19 -0
  38. package/src/elements/adw-switch-row.ts +4 -0
  39. package/src/elements/adw-window-features.ts +19 -4
  40. package/src/elements/adw-window.ts +2 -2
  41. package/src/elements/gtk-application-window.ts +6 -0
  42. package/src/elements/gtk-image.ts +55 -24
  43. package/src/elements/gtk-scrolled-window.ts +37 -1
  44. package/src/elements/gtk-window.ts +82 -3
  45. package/src/gobject-door.spec.ts +44 -0
  46. package/src/gobject-elements.ts +43 -2
  47. package/src/gtk-scrolled-window.spec.ts +74 -0
  48. package/src/gtk-window.spec.ts +97 -1
  49. package/src/icon-registry.ts +13 -7
  50. package/src/icon-theme.spec.ts +182 -0
  51. package/src/icon-theme.ts +178 -0
  52. package/src/index.ts +3 -0
  53. package/src/navigation-view.spec.ts +26 -0
  54. package/src/shared-tree-builder.ts +2 -1
  55. package/src/styles.generated.ts +1 -1
  56. package/src/test.browser.mts +5 -0
@@ -37,6 +37,24 @@ export declare class Canvas2DBridgeElement extends HostElement {
37
37
  private _height;
38
38
  private _drawFrame;
39
39
  static get observedAttributes(): string[];
40
+ /**
41
+ * `Gtk.Widget:focusable`, whether the widget can hold the keyboard focus. `Gtk.DrawingArea`
42
+ * leaves it FALSE, so it is read by PRESENCE; a blueprint's `focusable: true` writes it.
43
+ */
44
+ get focusable(): boolean;
45
+ set focusable(v: boolean);
46
+ /** `Gtk.Widget:can-focus`, TRUE by default, so it is read by VALUE. */
47
+ get canFocus(): boolean;
48
+ set canFocus(v: boolean);
49
+ get can_focus(): boolean;
50
+ set can_focus(v: boolean);
51
+ /**
52
+ * `gtk_widget_grab_focus`: moves the keyboard focus here and says whether it landed.
53
+ * FALSE when the widget is not focusable or cannot focus, as in GTK.
54
+ */
55
+ grab_focus(): boolean;
56
+ grabFocus(): boolean;
57
+ private _syncFocus;
40
58
  /** `Gtk.DrawingArea:content-width`, the minimum and natural width. Defaults to 0. */
41
59
  get contentWidth(): number;
42
60
  set contentWidth(v: number);
@@ -0,0 +1 @@
1
+ export declare const Canvas2DBridgeTest: () => Promise<void>;
@@ -1,4 +1,7 @@
1
+ import type { DispatchedSignals } from '../signals.js';
1
2
  export declare class AdwActionRow extends HTMLElement {
3
+ /** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
4
+ static readonly signals: DispatchedSignals;
2
5
  private _titleEl;
3
6
  private _subtitleEl;
4
7
  private _suffixEl;
@@ -1,4 +1,5 @@
1
1
  import type { BottomSheetCloseOutcome, BottomSheetCloseSource, BottomSheetOpenOutcome, BottomSheetOpenSource } from '@gjsify/adwaita-core';
2
+ import type { DispatchedSignals } from '../signals.js';
2
3
  /** The persistent content. Child of <adw-bottom-sheet>; consumed at connect time. */
3
4
  export declare class AdwBottomSheetContent extends HTMLElement {
4
5
  }
@@ -9,6 +10,8 @@ export declare class AdwBottomSheetSheet extends HTMLElement {
9
10
  export declare class AdwBottomSheetBottomBar extends HTMLElement {
10
11
  }
11
12
  export declare class AdwBottomSheet extends HTMLElement {
13
+ /** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
14
+ static readonly signals: DispatchedSignals;
12
15
  private _initialized;
13
16
  private _contentEl;
14
17
  private _dimmingEl;
@@ -1,3 +1,4 @@
1
+ import type { DispatchedSignals } from '../signals.js';
1
2
  /** A single navigation page. Children of <adw-navigation-view>. */
2
3
  export declare class AdwNavigationPage extends HTMLElement {
3
4
  /** Set while the owning view writes an attribute back, so the sync cannot recurse. */
@@ -15,6 +16,8 @@ export declare class AdwNavigationPage extends HTMLElement {
15
16
  revertAttribute(name: string, value: string | null): void;
16
17
  }
17
18
  export declare class AdwNavigationView extends HTMLElement {
19
+ /** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
20
+ static readonly signals: DispatchedSignals;
18
21
  private _pagesEl;
19
22
  private readonly _backButtons;
20
23
  private _initialized;
@@ -28,6 +31,8 @@ export declare class AdwNavigationView extends HTMLElement {
28
31
  set popOnEscape(value: boolean);
29
32
  get visiblePage(): AdwNavigationPage | null;
30
33
  get visiblePageTag(): string | null;
34
+ /** `adw_navigation_view_get_visible_page_tag`. */
35
+ get_visible_page_tag(): string | null;
31
36
  get depth(): number;
32
37
  /** The navigation stack, bottom-first (Adw.NavigationView:navigation-stack). */
33
38
  get navigationStack(): readonly AdwNavigationPage[];
@@ -64,6 +69,8 @@ export declare class AdwNavigationView extends HTMLElement {
64
69
  * destroyed when it is popped.
65
70
  */
66
71
  push(pageOrTag: AdwNavigationPage | string): boolean;
72
+ /** `adw_navigation_view_push_by_tag`, under the name a GJS caller uses. */
73
+ push_by_tag(tag: string): boolean;
67
74
  /** Push the page carrying `tag` (mirrors AdwNavigationView.push_by_tag). */
68
75
  pushByTag(tag: string): boolean;
69
76
  /**
@@ -1,5 +1,8 @@
1
+ import type { DispatchedSignals } from '../signals.js';
1
2
  import './gtk-switch.js';
2
3
  export declare class AdwSwitchRow extends HTMLElement {
4
+ /** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
5
+ static readonly signals: DispatchedSignals;
3
6
  private _switchEl;
4
7
  private _prefixEl;
5
8
  /** The label column — kept for `tooltip-text`, which the browser reads off a PART. */
@@ -34,6 +34,11 @@ export declare class AdwWindowFeatures {
34
34
  */
35
35
  bind(): void;
36
36
  release(): void;
37
- /** The window's size request — GTK's, not CSS's, so an absent attribute means the default. */
37
+ /**
38
+ * The window's size. `Adw.Window` defaults to a 360×200 MINIMUM (a size request, not the
39
+ * size; `width-request`/`height-request` override it). `default-width/height` is only
40
+ * a default: an authored size is the box, and an absent one leaves the box to the
41
+ * stylesheet, which fills the viewport — a page has no window manager to pick a size.
42
+ */
38
43
  applySizeRequest(): void;
39
44
  }
@@ -1,5 +1,6 @@
1
1
  import type { ActionLike } from '@gjsify/adwaita-core';
2
2
  import type { GtkApplication } from '../application.js';
3
+ import type { DispatchedSignals } from '../signals.js';
3
4
  import type { AdwSlot } from '../slotted-children.js';
4
5
  import { GtkWindow } from './gtk-window.js';
5
6
  export declare class GtkApplicationWindow extends GtkWindow {
@@ -13,6 +14,7 @@ export declare class GtkApplicationWindow extends GtkWindow {
13
14
  remove_action: (name: string) => void;
14
15
  private _menubar;
15
16
  private _menubarObserver;
17
+ static readonly signals: DispatchedSignals;
16
18
  static get observedAttributes(): string[];
17
19
  /** `Gtk.ApplicationWindow:show-menubar` — whether the window shows a menubar of its own. */
18
20
  get showMenubar(): boolean;
@@ -10,15 +10,22 @@ export declare const MASK_CLASS_PREFIX = "adw-icon--";
10
10
  * returns for a name it cannot find.
11
11
  */
12
12
  export declare const MISSING_ICON_NAME = "image-missing";
13
+ /**
14
+ * The modifier a colour icon carries. Deliberately NOT under {@link MASK_CLASS_PREFIX}: the
15
+ * stale-class sweep below and `.adw-icon:not([class*='adw-icon--'])` both read that prefix
16
+ * as "a mask is applied", and a colour icon has none.
17
+ */
18
+ export declare const COLOR_ICON_CLASS = "adw-icon-color";
13
19
  export declare class GtkImage extends HTMLElement {
14
20
  static get observedAttributes(): string[];
15
21
  /** The declared symbolic name, `-symbolic` suffix optional. */
16
22
  get iconName(): string;
17
23
  set iconName(value: string | null);
18
24
  /**
19
- * The name that actually reached the mask class — `''` when the icon-name is
20
- * absent, empty, or not usable as one CSS token. Consumers that need to know
21
- * whether the DECLARED name is drawable ask this, not the raw attribute.
25
+ * The name the SYMBOLIC lookup works with — `''` when the icon-name is absent, empty,
26
+ * or not usable as one CSS token. A registered colour icon can still draw for a name
27
+ * that answers `''` here (`org.gnome.Builder`); whether a name draws anything but
28
+ * `image-missing` is `isIconAvailable`'s question.
22
29
  *
23
30
  * `''` does NOT mean the box draws nothing: an unusable name that was given still
24
31
  * draws {@link MISSING_ICON_NAME}. Whether an icon was ASKED FOR is the raw
@@ -28,7 +35,9 @@ export declare class GtkImage extends HTMLElement {
28
35
  /** The rendered edge length in px, or `null` when the stylesheet decides. */
29
36
  get size(): number | null;
30
37
  set size(value: number | null);
38
+ private _unsubscribe;
31
39
  connectedCallback(): void;
40
+ disconnectedCallback(): void;
32
41
  attributeChangedCallback(): void;
33
42
  private _render;
34
43
  }
@@ -76,6 +76,16 @@ export declare class GtkScrolledWindow extends HTMLElement {
76
76
  */
77
77
  hscrollbar(): HTMLElement | null;
78
78
  vscrollbar(): HTMLElement | null;
79
+ /** `Gtk.ScrolledWindow:child` — the widget inside the viewport, or the one waiting to be adopted. */
80
+ get child(): Element | null;
81
+ set child(value: Element | null);
82
+ get_child(): Element | null;
83
+ /**
84
+ * `gtk_scrolled_window_set_child`: replace the child, which sits in the viewport. Before the
85
+ * first connect there is no viewport yet, so the child waits in the light DOM where
86
+ * `connectedCallback` adopts it the way it adopts a declared one.
87
+ */
88
+ set_child(child: Element | null): void;
79
89
  /** The `<gtk-viewport>` the child sits in — the one GTK's `set_child` builds for itself. */
80
90
  get viewport(): GtkViewport;
81
91
  connectedCallback(): void;
@@ -1,3 +1,4 @@
1
+ import type { DispatchedSignals } from '../signals.js';
1
2
  import { type AdwSlot } from '../slotted-children.js';
2
3
  import './gtk-window-controls.js';
3
4
  export declare class GtkWindow extends HTMLElement {
@@ -19,6 +20,25 @@ export declare class GtkWindow extends HTMLElement {
19
20
  private readonly _syncActive;
20
21
  private readonly _onFocusIn;
21
22
  private readonly _onFocusOut;
23
+ /**
24
+ * The GObject door (ADR 0096 § 3): `connect` / `disconnect` / `emit` / `notify` / `get_property` /
25
+ * `set_property` over these events, the same ones every element declares in `static signals`.
26
+ * A `close-request` handler that returns true is `preventDefault()`.
27
+ */
28
+ static readonly signals: DispatchedSignals;
29
+ /** `GObject.Object.connect`: installed per instance by `installElementApi`; refuses an undeclared signal. */
30
+ connect: (signal: string, handler: (emitter: this, ...args: any[]) => unknown) => number;
31
+ /** `GObject.Object.disconnect`: throws for an id that is not connected. */
32
+ disconnect: (id: number) => void;
33
+ /** `GObject.Object.emit`; `close-request` is refused, call `close()`. */
34
+ emit: (signal: string, ...args: unknown[]) => void;
35
+ /** `GObject.Object.notify`. */
36
+ notify: (name: string) => void;
37
+ /** `GObject.Object.get_property`, by GTK's dashed name. */
38
+ get_property: (name: string) => unknown;
39
+ /** `GObject.Object.set_property`; a read-only property throws. */
40
+ set_property: (name: string, value: unknown) => void;
41
+ constructor();
22
42
  static get observedAttributes(): string[];
23
43
  /**
24
44
  * `Gtk.Window:title` — the window's title.
@@ -121,12 +141,18 @@ export declare class GtkWindow extends HTMLElement {
121
141
  * the window manager's to grant; a page owns no such surface, so this is only the first half.
122
142
  */
123
143
  present(): void;
124
- /** `Gtk.Window:is-active` — see the header: the document's focus, while this frame is shown. */
144
+ /**
145
+ * `Gtk.Window:is-active` — see the header: the document's focus, while this frame is shown.
146
+ * A PROPERTY, as in GJS and `@girs/gtk-4.0`: GTK 4 has no `gtk_window_is_active`, so
147
+ * `window.is_active` is the value and `window.is_active()` does not exist.
148
+ */
125
149
  get isActive(): boolean;
126
- /** `gtk_window_is_active`. */
127
- is_active(): boolean;
150
+ get is_active(): boolean;
128
151
  /** `Gtk.Window:focus-widget`, read live from the document. */
129
152
  get focusWidget(): Element | null;
153
+ /** `Gtk.Window:focus-widget` under its GJS spelling; writing it is `set_focus`. */
154
+ get focus_widget(): Element | null;
155
+ set focus_widget(widget: Element | null);
130
156
  /** `gtk_window_get_focus`: the element inside the frame that has focus, or `null`. */
131
157
  get_focus(): Element | null;
132
158
  /**
@@ -6,6 +6,13 @@ export declare function ensureNotifying(el: HTMLElement, property: string): void
6
6
  /** Calls `handler(el, ...args)` for `signal`; returns the disconnect. */
7
7
  export declare function listenElement(el: HTMLElement, signal: string, handler: Handler): () => void;
8
8
  export declare function dispatchElement(el: HTMLElement, signal: string, args: readonly unknown[]): void;
9
+ /**
10
+ * `Gtk.Widget:sensitive` for an element that has no member of that name. The DOM spells it
11
+ * `disabled` on a form control and `aria-disabled` on anything else (`adw-action-row.ts` reads
12
+ * both), so the accessor writes the spelling the element understands. An element that already
13
+ * declares `sensitive` (`<adw-toggle-group>`) keeps its own.
14
+ */
15
+ export declare function installSensitive(el: HTMLElement): void;
9
16
  /** Gives `el` the instance API of a registered class, over the events it declares. */
10
17
  export declare function installElementApi(el: HTMLElement): void;
11
18
  /**
@@ -18,7 +18,9 @@
18
18
  */
19
19
  export declare function registerIcon(name: string, svg: string): void;
20
20
  /**
21
- * Whether `name` has a glyph — compiled into the stylesheet, or registered at runtime.
21
+ * Whether `name` draws something other than `image-missing` — a symbolic glyph compiled into
22
+ * the stylesheet or registered at runtime, or a colour icon from `registerColorIcon`. The
23
+ * name is looked up exactly as `<gtk-image icon-name>` looks it up (`icon-theme.ts`).
22
24
  *
23
25
  * Reads the live cascade rather than a generated list, so it answers for a glyph that
24
26
  * arrived by any route, including a consumer's own `--icon-<name>` declaration. It is
@@ -0,0 +1,53 @@
1
+ /** What one icon name resolves to, in the order GTK's theme would try it. */
2
+ export type IconLookup =
3
+ /** A registered full-colour image, drawn as-is. `url` is ready for `url("…")`. */
4
+ {
5
+ kind: 'color';
6
+ name: string;
7
+ url: string;
8
+ }
9
+ /** A symbolic glyph, drawn through the `.adw-icon--<name>` mask. `name` is normalized. */
10
+ | {
11
+ kind: 'symbolic';
12
+ name: string;
13
+ }
14
+ /** Nothing in the theme answers this name — draw `image-missing`. */
15
+ | {
16
+ kind: 'missing';
17
+ };
18
+ /** Subscribe to theme changes. Returns the unsubscribe function. */
19
+ export declare function onIconThemeChanged(listener: () => void): () => void;
20
+ /** Run every subscriber — after any registration that can change a lookup's answer. */
21
+ export declare function notifyIconThemeChanged(): void;
22
+ /**
23
+ * Resolve `iconName` as `gtk_icon_theme_lookup_by_gicon` would for a `GtkImage`. `null` when
24
+ * no name was given — the state where GTK draws nothing, not `image-missing`.
25
+ *
26
+ * When no colour icon is registered for the name, a symbolic request is returned WITHOUT
27
+ * checking the cascade: the mask class falls back to `image-missing` through CSS by itself
28
+ * and corrects itself when a later `registerIcon` lands, which is how `<gtk-image>` behaved
29
+ * before this module. The cascade is read only to choose between a colour entry and a
30
+ * symbolic glyph.
31
+ */
32
+ export declare function lookupIcon(iconName: string | null | undefined): IconLookup | null;
33
+ /**
34
+ * Whether `iconName` resolves to something other than `image-missing` — a registered colour
35
+ * icon, or a symbolic glyph compiled into the stylesheet or registered at runtime.
36
+ */
37
+ export declare function iconResolves(iconName: string): boolean;
38
+ /**
39
+ * Register a FULL-COLOUR icon under `name` — what an application ships in
40
+ * `hicolor/scalable/apps/<app-id>.svg` and GTK finds through its icon theme. Every
41
+ * `<gtk-image>` asking for the name draws the image unrecoloured, the way `AdwAboutDialog`'s
42
+ * `application-icon` does on GNOME.
43
+ *
44
+ * `name` is the EXACT icon name, reverse-DNS application IDs included. A name with a
45
+ * `-symbolic` suffix THROWS: that is the other half of the theme, and {@link registerIcon}
46
+ * is its door. `source` is SVG source, or a URL (resolved against the document) to any
47
+ * image the browser can draw.
48
+ *
49
+ * Re-registering a name replaces the image, and every mounted `<gtk-image>` redraws.
50
+ *
51
+ * CLIENT-SIDE ONLY, like `registerIcon`: it reads `document`.
52
+ */
53
+ export declare function registerColorIcon(name: string, source: string): void;
@@ -0,0 +1 @@
1
+ export declare const AdwIconThemeTest: () => Promise<void>;
@@ -9,6 +9,7 @@ export { buildSharedTree, mountSharedTree } from './shared-tree-builder.js';
9
9
  export type { MountOptions, MountedSharedTree, SizeSource } from './shared-tree-builder.js';
10
10
  export { registerTemplateClass } from './template-classes.js';
11
11
  export { isIconAvailable, registerIcon } from './icon-registry.js';
12
+ export { registerColorIcon } from './icon-theme.js';
12
13
  export * as Adw from './namespace/adw.js';
13
14
  export * as Gtk from './namespace/gtk.js';
14
15
  export * as Gio from './namespace/gio.js';