@gjsify/adwaita-web 0.63.0 → 0.63.1-next.235

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.
@@ -1,7 +1,28 @@
1
- type ReadyCallback = (canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D) => void;
1
+ /**
2
+ * The DOM types this element names, resolved through `globalThis` so the published `.d.ts`
3
+ * never names a `lib.dom` type directly: a consumer that loads `lib.dom` gets the real ones,
4
+ * one that does not still type-checks the declarations with `skipLibCheck: false`.
5
+ */
6
+ export type BridgeCanvas = typeof globalThis extends {
7
+ HTMLCanvasElement: {
8
+ prototype: infer T;
9
+ };
10
+ } ? T : object;
11
+ export type BridgeContext2D = typeof globalThis extends {
12
+ CanvasRenderingContext2D: {
13
+ prototype: infer T;
14
+ };
15
+ } ? T : object;
16
+ /** `FrameRequestCallback` without `lib.dom`. */
17
+ export type FrameCallback = (time: number) => void;
18
+ type ElementConstructor = typeof globalThis extends {
19
+ HTMLElement: infer C;
20
+ } ? C : abstract new () => object;
21
+ declare const HostElement: ElementConstructor;
22
+ type ReadyCallback = (canvas: BridgeCanvas, ctx: BridgeContext2D) => void;
2
23
  type ResizeCallback = (width: number, height: number) => void;
3
24
  type SignalHandler = (emitter: Canvas2DBridgeElement, ...args: unknown[]) => unknown;
4
- export declare class Canvas2DBridgeElement extends HTMLElement {
25
+ export declare class Canvas2DBridgeElement extends HostElement {
5
26
  static readonly GTypeName = "GjsifyCanvas2DBridge";
6
27
  /** The signals `connect()` accepts, as `Gtk.Widget` names them. */
7
28
  static readonly signals: Record<string, string>;
@@ -28,15 +49,15 @@ export declare class Canvas2DBridgeElement extends HTMLElement {
28
49
  set content_height(v: number);
29
50
  private _write;
30
51
  /** The `<canvas>` backing this widget. Available after the first allocation. */
31
- get canvas(): HTMLCanvasElement | null;
52
+ get canvas(): BridgeCanvas | null;
32
53
  /** The browser's own 2D context; available after the first allocation. */
33
- getContext(_id: '2d'): CanvasRenderingContext2D | null;
54
+ getContext(_id: '2d'): BridgeContext2D | null;
34
55
  /** Runs `cb` once the 2D context is ready, synchronously if it already is. */
35
56
  onReady(cb: ReadyCallback): void;
36
57
  /** Runs `cb` on every allocation change, with the canvas dimensions already updated. */
37
58
  onResize(cb: ResizeCallback): void;
38
59
  /** The browser's own, here only so the call reads the same on every target. */
39
- requestAnimationFrame(cb: FrameRequestCallback): number;
60
+ requestAnimationFrame(cb: FrameCallback): number;
40
61
  /** A no-op: the browser already has `requestAnimationFrame` and `performance`. */
41
62
  installGlobals(): void;
42
63
  /** `gtk_widget_queue_draw`: nothing to blit here, the canvas IS the screen. */
@@ -1,11 +1,21 @@
1
1
  import { type AdwMenuInput, type AdwMenuModel } from '@gjsify/adwaita-core';
2
- import { AdwWindow } from './adw-window.js';
3
- export declare class AdwApplicationWindow extends AdwWindow {
4
- /** `Gtk.Window:application`: setting it is `add_window` (ADR 0098), set by `defineWindowApplication`. */
5
- application: object | null;
6
- private _menubarEl;
2
+ import type { AdwBreakpoint } from '@gjsify/adwaita-core';
3
+ import type { AdwSlot } from '../slotted-children.js';
4
+ import { GtkApplicationWindow } from './gtk-application-window.js';
5
+ export declare class AdwApplicationWindow extends GtkApplicationWindow {
6
+ private readonly _features;
7
7
  private _model;
8
+ private _menubarEl;
8
9
  static get observedAttributes(): string[];
10
+ /** The content area — the Adw.Window:content property. */
11
+ get contentArea(): HTMLDivElement;
12
+ get content(): HTMLElement | null;
13
+ set content(value: HTMLElement | null);
14
+ get breakpoints(): readonly AdwBreakpoint[];
15
+ get currentBreakpoint(): AdwBreakpoint | null;
16
+ get dialogs(): readonly HTMLElement[];
17
+ get visibleDialog(): HTMLElement | null;
18
+ addBreakpoint(condition: string): AdwBreakpoint;
9
19
  /** Whether this window shows the application's menubar (Gtk.ApplicationWindow:show-menubar). */
10
20
  get showMenubar(): boolean;
11
21
  set showMenubar(value: boolean);
@@ -15,7 +25,13 @@ export declare class AdwApplicationWindow extends AdwWindow {
15
25
  /** The menubar strip, or null before the window is connected. */
16
26
  get menubar(): HTMLDivElement | null;
17
27
  connectedCallback(): void;
28
+ disconnectedCallback(): void;
18
29
  attributeChangedCallback(name: string): void;
30
+ /** `Adw.ApplicationWindow` has no titlebar of its own, like `Adw.Window`. */
31
+ protected hasTitlebar(): boolean;
32
+ protected strips(): Node[];
33
+ protected extraSlots(): AdwSlot[];
34
+ protected renderFrameSize(): void;
19
35
  /**
20
36
  * The menubar, INSIDE the content area rather than beside it.
21
37
  *
@@ -23,7 +39,10 @@ export declare class AdwApplicationWindow extends AdwWindow {
23
39
  * into the content area, so a sibling would be re-homed into it one tick later. The
24
40
  * content area's own children are not watched, so prepending here is stable — and
25
41
  * it is also where the bar belongs: above the toolbar view, inside the window box.
42
+ * Replaces the base's observer: this bar is filled from the model, not from a slot,
43
+ * and observing it would re-trigger every render.
26
44
  */
27
- private _buildMenubar;
28
- private _renderMenubar;
45
+ protected _followMenubar(): void;
46
+ protected menubarSection(): HTMLDivElement;
47
+ protected _renderMenubar(): void;
29
48
  }
@@ -28,6 +28,9 @@ export declare class AdwBottomSheet extends HTMLElement {
28
28
  /** Whether the content is dimmed and blocked while the sheet is open (`AdwBottomSheet:modal`). */
29
29
  get modal(): boolean;
30
30
  set modal(value: boolean);
31
+ /** `adw_bottom_sheet_get_modal` — the NativeScript port's only door to it (ADR 0112). */
32
+ get_modal(): boolean;
33
+ set_modal(modal: boolean): void;
31
34
  /** Whether the user can dismiss the sheet (dimming / Escape / sheet.close). */
32
35
  get canClose(): boolean;
33
36
  set canClose(value: boolean);
@@ -12,6 +12,10 @@ export declare class AdwDataGrid extends HTMLElement {
12
12
  set columns(value: ReadonlyArray<AdwDataGridColumn>);
13
13
  get rows(): AdwDataGridRow[];
14
14
  set rows(value: ReadonlyArray<AdwDataGridRow>);
15
+ get_columns(): AdwDataGridColumn[];
16
+ set_columns(value: ReadonlyArray<AdwDataGridColumn>): void;
17
+ get_rows(): AdwDataGridRow[];
18
+ set_rows(value: ReadonlyArray<AdwDataGridRow>): void;
15
19
  /** The optional grid caption/title (reflected to the attribute). */
16
20
  get caption(): string;
17
21
  set caption(value: string);
@@ -0,0 +1,39 @@
1
+ import { AdwBreakpoint } from '@gjsify/adwaita-core';
2
+ export declare class AdwWindowFeatures {
3
+ private readonly _host;
4
+ private _contentEl;
5
+ private _breakpoints;
6
+ private _disposeBreakpoints;
7
+ private _openDialogs;
8
+ constructor(_host: HTMLElement);
9
+ /** The content area, or `null` before the window is first connected. */
10
+ get contentArea(): HTMLDivElement | null;
11
+ /** The content widget — the first child of the content area. */
12
+ get content(): HTMLElement | null;
13
+ set content(value: HTMLElement | null);
14
+ get breakpoints(): readonly AdwBreakpoint[];
15
+ get currentBreakpoint(): AdwBreakpoint | null;
16
+ get dialogs(): readonly HTMLElement[];
17
+ get visibleDialog(): HTMLElement | null;
18
+ /**
19
+ * Take the content area the Gtk parent built, once. Tracks open dialogs presented inside
20
+ * the window: an AdwDialog raises `notify::open`, which bubbles to the host.
21
+ */
22
+ adopt(contentEl: HTMLDivElement): void;
23
+ /**
24
+ * Add a breakpoint (adw_window_add_breakpoint). The breakpoint evaluates against the
25
+ * window's own box and sets a `data-breakpoint` attribute when applied.
26
+ */
27
+ addBreakpoint(condition: string): AdwBreakpoint;
28
+ /**
29
+ * Bind the breakpoints to THIS box.
30
+ *
31
+ * NOT once per lifetime: `release` drops the disposer, so a window moved between
32
+ * parents would come back deaf — and a window is exactly the thing a client-side route
33
+ * change re-parents. Re-binding is cheap and idempotent, and it re-measures the new box.
34
+ */
35
+ bind(): void;
36
+ release(): void;
37
+ /** The window's size request — GTK's, not CSS's, so an absent attribute means the default. */
38
+ applySizeRequest(): void;
39
+ }
@@ -1,10 +1,8 @@
1
- import { AdwBreakpoint } from '@gjsify/adwaita-core';
2
- export declare class AdwWindow extends HTMLElement {
3
- private _initialized;
4
- private _contentEl;
5
- private _breakpoints;
6
- private _disposeBreakpoints;
7
- private _openDialogs;
1
+ import type { AdwBreakpoint } from '@gjsify/adwaita-core';
2
+ import type { AdwSlot } from '../slotted-children.js';
3
+ import { GtkWindow } from './gtk-window.js';
4
+ export declare class AdwWindow extends GtkWindow {
5
+ private readonly _features;
8
6
  static get observedAttributes(): string[];
9
7
  /** The content area — the Adw.Window:content property. */
10
8
  get contentArea(): HTMLDivElement;
@@ -19,25 +17,14 @@ export declare class AdwWindow extends HTMLElement {
19
17
  get dialogs(): readonly HTMLElement[];
20
18
  /** The currently visible dialog, or null when none is (Adw.Window:visible-dialog). */
21
19
  get visibleDialog(): HTMLElement | null;
22
- /**
23
- * Add a breakpoint to this window (adw_window_add_breakpoint).
24
- * The breakpoint evaluates against the window's own box and sets a
25
- * `data-breakpoint` attribute when applied.
26
- */
20
+ /** Add a breakpoint to this window (adw_window_add_breakpoint). */
27
21
  addBreakpoint(condition: string): AdwBreakpoint;
28
22
  connectedCallback(): void;
29
23
  disconnectedCallback(): void;
30
24
  attributeChangedCallback(name: string): void;
31
- private _buildOnce;
32
- /**
33
- * Bind the breakpoints to THIS box.
34
- *
35
- * NOT once per lifetime: `disconnectedCallback` releases the disposer, so a
36
- * window moved between parents would come back deaf — and a window is exactly
37
- * the thing a client-side route change re-parents. Re-binding is cheap and
38
- * idempotent, and it re-measures the new box on the way.
39
- */
40
- private _bindBreakpoints;
41
- /** The window's size request — GTK's, not CSS's, so an absent attribute means the default. */
42
- private _applySizeRequest;
25
+ /** `Adw.Window` has no titlebar of its own: you pair it with a header bar. */
26
+ protected hasTitlebar(): boolean;
27
+ protected strips(): Node[];
28
+ protected extraSlots(): AdwSlot[];
29
+ protected renderFrameSize(): void;
43
30
  }
@@ -1,8 +1,16 @@
1
+ import type { ActionLike } from '@gjsify/adwaita-core';
2
+ import type { GtkApplication } from '../application.js';
1
3
  import type { AdwSlot } from '../slotted-children.js';
2
4
  import { GtkWindow } from './gtk-window.js';
3
5
  export declare class GtkApplicationWindow extends GtkWindow {
4
6
  /** `Gtk.Window:application`: setting it is `add_window` (ADR 0098), set by `defineWindowApplication`. */
5
- application: object | null;
7
+ application: GtkApplication | null;
8
+ /** `Gio.ActionMap.add_action`: installed by `installActionMap`; the action is reachable as `win.<name>`. */
9
+ add_action: (action: ActionLike) => void;
10
+ /** `Gio.ActionMap.lookup_action`: the window's own action, or `null`. */
11
+ lookup_action: (name: string) => ActionLike | null;
12
+ /** `Gio.ActionMap.remove_action`: removing an unknown name does nothing. */
13
+ remove_action: (name: string) => void;
6
14
  private _menubar;
7
15
  private _menubarObserver;
8
16
  static get observedAttributes(): string[];
@@ -13,7 +21,7 @@ export declare class GtkApplicationWindow extends GtkWindow {
13
21
  * The menubar strip, created once and reused: `strips()` and `extraSlots()` both ask for
14
22
  * it, so whichever runs first builds it and the other finds it.
15
23
  */
16
- private menubarSection;
24
+ protected menubarSection(): HTMLDivElement;
17
25
  /**
18
26
  * Titlebar, then menubar, then content — the order `update_menubar` parents the bar at
19
27
  * (:418) inside a window whose titlebar sits above its own child.
@@ -31,6 +39,6 @@ export declare class GtkApplicationWindow extends GtkWindow {
31
39
  * The observer is what makes the second half live: `bindSlottedChildren` adopts a
32
40
  * `slot="menubar"` child after connect, and a bar that appeared then must appear.
33
41
  */
34
- private _followMenubar;
35
- private _renderMenubar;
42
+ protected _followMenubar(): void;
43
+ protected _renderMenubar(): void;
36
44
  }
@@ -79,11 +79,22 @@ export declare class GtkWindow extends HTMLElement {
79
79
  * call's invariant (see `slotted-children.ts`).
80
80
  */
81
81
  protected strips(): Node[];
82
+ /**
83
+ * Whether this window has a titlebar strip at all. `Adw.Window` has none (it styles nothing
84
+ * itself, you pair it with a header bar), so a subclass answers `false` and neither the
85
+ * `titlebar` slot nor the server-side decoration is built.
86
+ */
87
+ protected hasTitlebar(): boolean;
82
88
  /** The slots a subclass adds beside `titlebar`; none by default. */
83
89
  protected extraSlots(): AdwSlot[];
84
90
  attributeChangedCallback(name: string): void;
85
91
  private _property;
86
92
  private _render;
93
+ /**
94
+ * The frame's box from `default-width` / `default-height`; an absent one clears it. A subclass
95
+ * with a size request of its own (`Adw.Window`'s 360×200) replaces this.
96
+ */
97
+ protected renderFrameSize(): void;
87
98
  /**
88
99
  * The strip, in the two shapes a window can be in. With a `titlebar` child the strip
89
100
  * holds exactly that — GTK hands the whole titlebar to the bar, decorations and all. With
@@ -1 +1,7 @@
1
+ import { type WindowSubject } from '@gjsify/adwaita-core/conformance';
2
+ /** The `Gtk.Window` conformance subject for any window element (`gtk-window`, `adw-window`, …). */
3
+ export declare function webWindowSubject(tag: string): {
4
+ subject: WindowSubject;
5
+ dispose: () => void;
6
+ };
1
7
  export declare const GtkWindowTest: () => Promise<void>;