@gjsify/adwaita-web 0.64.11 → 0.64.12-next.280
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/lib/types/elements/adw-alert-dialog.d.ts +0 -8
- package/lib/types/elements/adw-overlay-split-view.d.ts +5 -0
- package/lib/types/elements/adw-view-stack.d.ts +20 -0
- package/lib/types/elements/adw-view-switcher-bar.d.ts +4 -0
- package/lib/types/elements/gtk-box.d.ts +16 -0
- package/lib/types/elements/gtk-menu-button.d.ts +5 -0
- package/lib/types/elements/gtk-scrolled-window.d.ts +15 -2
- package/lib/types/elements/gtk-stack.d.ts +17 -0
- package/lib/types/elements/gtk-window.d.ts +14 -8
- package/lib/types/gobject-elements.d.ts +2 -0
- package/lib/types/gtksource/gtk-source-view.d.ts +2 -1
- package/lib/types/index.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/graphene.d.ts +8 -0
- package/lib/types/widget-element.d.ts +25 -0
- package/package.json +13 -12
- package/src/adw-view-switcher-bar.spec.ts +12 -0
- package/src/elements/adw-alert-dialog.ts +0 -8
- package/src/elements/adw-overlay-split-view.ts +17 -0
- package/src/elements/adw-view-stack.ts +50 -0
- package/src/elements/adw-view-switcher-bar.ts +10 -0
- package/src/elements/gtk-box.ts +49 -1
- package/src/elements/gtk-menu-button.ts +17 -0
- package/src/elements/gtk-scrolled-window.ts +60 -15
- package/src/elements/gtk-stack.ts +42 -0
- package/src/elements/gtk-window.ts +43 -10
- package/src/gdk.spec.ts +9 -0
- package/src/gobject-door.spec.ts +77 -0
- package/src/gobject-elements.ts +26 -2
- package/src/gtk-box.spec.ts +38 -0
- package/src/gtk-menu-button.spec.ts +15 -0
- package/src/gtk-stack.spec.ts +26 -0
- package/src/gtk-window.spec.ts +35 -1
- package/src/gtksource/gtk-source-view.ts +18 -3
- package/src/index.ts +2 -0
- package/src/namespace/adw.ts +1 -1
- package/src/namespace/gdk.ts +2 -0
- package/src/namespace/graphene.ts +26 -0
- package/src/split-views.spec.ts +11 -0
- package/src/style-manager.spec.ts +14 -0
- package/src/style-manager.ts +5 -0
- package/src/view-stack.spec.ts +41 -0
- package/src/widget-element.ts +53 -1
- package/src/widget-members.spec.ts +95 -0
|
@@ -30,14 +30,6 @@ export interface AdwAlertDialogProps {
|
|
|
30
30
|
export declare class AdwAlertDialog extends WidgetElement {
|
|
31
31
|
/** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
|
|
32
32
|
static readonly signals: DispatchedSignals;
|
|
33
|
-
/** `GObject.Object.connect`: installed per instance by `installElementApi`; refuses an undeclared signal. */
|
|
34
|
-
connect: (signal: string, handler: (emitter: this, ...args: any[]) => unknown) => number;
|
|
35
|
-
/** `GObject.Object.disconnect`: throws for an id that is not connected. */
|
|
36
|
-
disconnect: (id: number) => void;
|
|
37
|
-
/** `GObject.Object.emit`. */
|
|
38
|
-
emit: (signal: string, ...args: unknown[]) => void;
|
|
39
|
-
/** `GObject.Object.notify`. */
|
|
40
|
-
notify: (name: string) => void;
|
|
41
33
|
/** `GObject.Object.get_property`, by GTK's dashed name. */
|
|
42
34
|
get_property: (name: string) => unknown;
|
|
43
35
|
/** `GObject.Object.set_property`. */
|
|
@@ -39,6 +39,11 @@ export declare class AdwOverlaySplitView extends WidgetElement {
|
|
|
39
39
|
static get observedAttributes(): string[];
|
|
40
40
|
get showSidebar(): boolean;
|
|
41
41
|
set showSidebar(v: boolean);
|
|
42
|
+
/** `Adw.OverlaySplitView:show-sidebar` — the GIR spelling of {@link showSidebar}. */
|
|
43
|
+
get show_sidebar(): boolean;
|
|
44
|
+
set show_sidebar(v: boolean);
|
|
45
|
+
get_show_sidebar(): boolean;
|
|
46
|
+
set_show_sidebar(v: boolean): void;
|
|
42
47
|
get collapsed(): boolean;
|
|
43
48
|
set collapsed(v: boolean);
|
|
44
49
|
get minSidebarWidth(): number;
|
|
@@ -39,6 +39,26 @@ export declare class AdwViewStack extends WidgetElement {
|
|
|
39
39
|
*/
|
|
40
40
|
add(content: HTMLElement, name: string, title?: string, icon?: string): AdwViewStackPageInfo;
|
|
41
41
|
addTitled(content: HTMLElement, name: string, title: string): AdwViewStackPageInfo;
|
|
42
|
+
/** `adw_view_stack_add_titled`. */
|
|
43
|
+
add_titled(child: HTMLElement, name: string, title: string): AdwViewStackPageInfo;
|
|
44
|
+
/** `adw_view_stack_add_named`. */
|
|
45
|
+
add_named(child: HTMLElement, name: string | null): AdwViewStackPageInfo;
|
|
46
|
+
/** `adw_view_stack_add_titled_with_icon`: the same four values as {@link add}, in the same order. */
|
|
47
|
+
add_titled_with_icon(child: HTMLElement, name: string, title: string, iconName: string): AdwViewStackPageInfo;
|
|
48
|
+
/**
|
|
49
|
+
* `adw_view_stack_remove` takes the CHILD. With no argument this is still
|
|
50
|
+
* `ChildNode.remove()` — the element leaves its parent — because the GIR name and the
|
|
51
|
+
* DOM name share one spelling here.
|
|
52
|
+
*/
|
|
53
|
+
remove(child?: HTMLElement): void;
|
|
54
|
+
/** `adw_view_stack_get_visible_child_name`. */
|
|
55
|
+
get_visible_child_name(): string | null;
|
|
56
|
+
/** `adw_view_stack_set_visible_child_name`. */
|
|
57
|
+
set_visible_child_name(name: string): void;
|
|
58
|
+
/** `adw_view_stack_get_visible_child`. */
|
|
59
|
+
get_visible_child(): HTMLElement | null;
|
|
60
|
+
/** `adw_view_stack_set_visible_child`; a child that is not a page of this stack selects nothing. */
|
|
61
|
+
set_visible_child(child: HTMLElement): void;
|
|
42
62
|
/**
|
|
43
63
|
* Remove the first page named `name` and detach its content. Returns whether
|
|
44
64
|
* anything was removed. When the removed page was the visible one the stack
|
|
@@ -24,6 +24,10 @@ export declare class AdwViewSwitcherBar extends WidgetElement {
|
|
|
24
24
|
connectedCallback(): void;
|
|
25
25
|
disconnectedCallback(): void;
|
|
26
26
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
27
|
+
/** `adw_view_switcher_bar_set_stack` — the GIR spelling of {@link setStack}. */
|
|
28
|
+
set_stack(stack: AdwViewStack | null): void;
|
|
29
|
+
/** `adw_view_switcher_bar_get_stack`. */
|
|
30
|
+
get_stack(): AdwViewStack | null;
|
|
27
31
|
/** Bind to a stack element (or null). Unbinds the previous one and rebuilds. */
|
|
28
32
|
setStack(stack: AdwViewStack | null): void;
|
|
29
33
|
/**
|
|
@@ -12,6 +12,22 @@ export declare class GtkBox extends WidgetElement {
|
|
|
12
12
|
/** `Gtk.Box:homogeneous` — whether every child gets the same size along the axis. */
|
|
13
13
|
get homogeneous(): boolean;
|
|
14
14
|
set homogeneous(value: boolean);
|
|
15
|
+
/**
|
|
16
|
+
* `gtk_box_remove` under its GIR name. With no argument it stays `ChildNode.remove()`:
|
|
17
|
+
* the box leaves its own parent. A `child` that is not a direct child is where C warns
|
|
18
|
+
* (`g_warning ("Trying to remove a widget that is not a child")`) and does nothing.
|
|
19
|
+
*/
|
|
20
|
+
remove(child?: Element): void;
|
|
21
|
+
/**
|
|
22
|
+
* `gtk_box_insert_child_after`. A NULL/absent `sibling` inserts at the FIRST position,
|
|
23
|
+
* not the last — `gtk_widget_insert_after`'s rule, pinned by
|
|
24
|
+
* `WRAP_BOX_CHILD_ORDER_VECTORS`. Returns whether the insert happened; a refusal is where
|
|
25
|
+
* C would have hit a `g_return_if_fail`.
|
|
26
|
+
*/
|
|
27
|
+
insert_child_after(child: Element, sibling?: Element | null): boolean;
|
|
28
|
+
/** `gtk_box_reorder_child_after`. Same NULL rule. */
|
|
29
|
+
reorder_child_after(child: Element, sibling?: Element | null): boolean;
|
|
30
|
+
private _applyOrder;
|
|
15
31
|
connectedCallback(): void;
|
|
16
32
|
disconnectedCallback(): void;
|
|
17
33
|
attributeChangedCallback(name: string, old: string | null, value: string | null): void;
|
|
@@ -20,6 +20,11 @@ export declare class GtkMenuButton extends WidgetElement {
|
|
|
20
20
|
* note on the same setter.
|
|
21
21
|
*/
|
|
22
22
|
set menuModel(value: AdwMenuInput);
|
|
23
|
+
/** `Gtk.MenuButton:menu-model` — the GIR spelling of {@link menuModel}. */
|
|
24
|
+
get menu_model(): AdwMenuModel;
|
|
25
|
+
set menu_model(value: AdwMenuInput);
|
|
26
|
+
get_menu_model(): AdwMenuModel;
|
|
27
|
+
set_menu_model(value: AdwMenuInput): void;
|
|
23
28
|
/**
|
|
24
29
|
* Normalise, REFUSE, store — the one door every menu comes through.
|
|
25
30
|
*
|
|
@@ -21,6 +21,8 @@ export declare class GtkScrolledWindow extends WidgetElement {
|
|
|
21
21
|
private _built;
|
|
22
22
|
/** What an unbuilt window answers before it has a viewport to read. */
|
|
23
23
|
private readonly _standIn;
|
|
24
|
+
private readonly _heard;
|
|
25
|
+
private _pushing;
|
|
24
26
|
private readonly _adopted;
|
|
25
27
|
static get observedAttributes(): string[];
|
|
26
28
|
/** `GtkScrolledWindow:hscrollbar-policy` — `automatic` in the pspec. */
|
|
@@ -33,14 +35,25 @@ export declare class GtkScrolledWindow extends WidgetElement {
|
|
|
33
35
|
get_policy(): [number, number];
|
|
34
36
|
/** `gtk_scrolled_window_set_policy`; a value that is not a `Gtk.PolicyType` throws, as GJS's enum marshalling does. */
|
|
35
37
|
set_policy(hscrollbar_policy: number, vscrollbar_policy: number): void;
|
|
36
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* `GtkScrollable:hadjustment` as the window reports it: the one it was given, else its own.
|
|
40
|
+
*
|
|
41
|
+
* Either is ONE object for the window's life, observable like GTK's: the viewport's
|
|
42
|
+
* numbers are configured into it, and a write to its value scrolls the content.
|
|
43
|
+
*/
|
|
37
44
|
get hadjustment(): AdwAdjustment;
|
|
38
45
|
get vadjustment(): AdwAdjustment;
|
|
39
46
|
get_hadjustment(): AdwAdjustment;
|
|
40
47
|
get_vadjustment(): AdwAdjustment;
|
|
41
|
-
/** Adopts `adjustment` as what `get_hadjustment` answers;
|
|
48
|
+
/** Adopts `adjustment` as what `get_hadjustment` answers; it is kept in step with the viewport both ways. */
|
|
42
49
|
set_hadjustment(adjustment: AdwAdjustment): void;
|
|
43
50
|
set_vadjustment(adjustment: AdwAdjustment): void;
|
|
51
|
+
private _adjustmentOf;
|
|
52
|
+
private _adopt;
|
|
53
|
+
/** A write to the adjustment's value moves the scrollport; a plain object has no signal to hear. */
|
|
54
|
+
private _listen;
|
|
55
|
+
/** Configures the window's adjustment of one axis from the viewport's numbers. */
|
|
56
|
+
private _push;
|
|
44
57
|
/** `GtkScrolledWindow:window-placement` — where the contents sit against the bars. */
|
|
45
58
|
get windowPlacement(): GtkCornerType;
|
|
46
59
|
set windowPlacement(value: GtkCornerType);
|
|
@@ -86,6 +86,23 @@ export declare class GtkStack extends WidgetElement {
|
|
|
86
86
|
* `Adw.ViewStack.remove` took in `adw-view-stack.ts`.
|
|
87
87
|
*/
|
|
88
88
|
removePage(child: HTMLElement): void;
|
|
89
|
+
/**
|
|
90
|
+
* `gtk_stack_remove` under its GIR name. With no argument it stays `ChildNode.remove()`:
|
|
91
|
+
* the stack leaves its own parent.
|
|
92
|
+
*/
|
|
93
|
+
remove(child?: HTMLElement): void;
|
|
94
|
+
/** `gtk_stack_add_titled` under its GIR name. */
|
|
95
|
+
add_titled(child: HTMLElement, name: string | null, title: string | null): HTMLElement;
|
|
96
|
+
/** `gtk_stack_add_named` under its GIR name. */
|
|
97
|
+
add_named(child: HTMLElement, name: string | null): HTMLElement;
|
|
98
|
+
/** `gtk_stack_get_visible_child_name`. */
|
|
99
|
+
get_visible_child_name(): string | null;
|
|
100
|
+
/** `gtk_stack_set_visible_child_name`. */
|
|
101
|
+
set_visible_child_name(name: string): void;
|
|
102
|
+
/** `gtk_stack_get_visible_child`. */
|
|
103
|
+
get_visible_child(): HTMLElement | null;
|
|
104
|
+
/** `gtk_stack_set_visible_child`. */
|
|
105
|
+
set_visible_child(child: HTMLElement): void;
|
|
89
106
|
/**
|
|
90
107
|
* `gtk_stack_set_visible_child` (gtkstack.c:2244-2281), with `gtk_stack_set_visible_
|
|
91
108
|
* child_full`'s per-call transition (gtkstack.c:2306-2334). A child that is not in
|
|
@@ -32,14 +32,6 @@ export declare class GtkWindow extends WidgetElement {
|
|
|
32
32
|
application: GtkApplication | null;
|
|
33
33
|
get_application: () => GtkApplication | null;
|
|
34
34
|
set_application: (application: GtkApplication | null) => void;
|
|
35
|
-
/** `GObject.Object.connect`: installed per instance by `installElementApi`; refuses an undeclared signal. */
|
|
36
|
-
connect: (signal: string, handler: (emitter: this, ...args: any[]) => unknown) => number;
|
|
37
|
-
/** `GObject.Object.disconnect`: throws for an id that is not connected. */
|
|
38
|
-
disconnect: (id: number) => void;
|
|
39
|
-
/** `GObject.Object.emit`; `close-request` is refused, call `close()`. */
|
|
40
|
-
emit: (signal: string, ...args: unknown[]) => void;
|
|
41
|
-
/** `GObject.Object.notify`. */
|
|
42
|
-
notify: (name: string) => void;
|
|
43
35
|
/** `GObject.Object.get_property`, by GTK's dashed name. */
|
|
44
36
|
get_property: (name: string) => unknown;
|
|
45
37
|
/** `GObject.Object.set_property`; a read-only property throws. */
|
|
@@ -70,6 +62,13 @@ export declare class GtkWindow extends WidgetElement {
|
|
|
70
62
|
/** `Gtk.Window:deletable` — whether the close button may appear. */
|
|
71
63
|
get deletable(): boolean;
|
|
72
64
|
set deletable(value: boolean);
|
|
65
|
+
/** `Gtk.Window:hide-on-close` — `close()` hides the window instead of destroying it. */
|
|
66
|
+
get hide_on_close(): boolean;
|
|
67
|
+
set hide_on_close(value: boolean);
|
|
68
|
+
/** `gtk_window_get_hide_on_close`. */
|
|
69
|
+
get_hide_on_close(): boolean;
|
|
70
|
+
/** `gtk_window_set_hide_on_close`. */
|
|
71
|
+
set_hide_on_close(setting: boolean): void;
|
|
73
72
|
/**
|
|
74
73
|
* `setAttribute` for a write that changes nothing. Every GObject setter here returns
|
|
75
74
|
* early when the value is already right (gtkwindow.c:1015-1017, :1045-1046, :894-895),
|
|
@@ -170,6 +169,13 @@ export declare class GtkWindow extends WidgetElement {
|
|
|
170
169
|
* GTK's window only focuses its own descendants.
|
|
171
170
|
*/
|
|
172
171
|
set_focus(widget: Element | null): void;
|
|
172
|
+
/** `gtk_window_get_default_size`: `[width, height]`, `[0, 0]` while neither attribute is set. */
|
|
173
|
+
get_default_size(): [number, number];
|
|
174
|
+
/**
|
|
175
|
+
* `gtk_window_set_default_size`: a value below -1 is refused (GTK's `g_return_if_fail`), an
|
|
176
|
+
* equal one does not notify, and `default-height` notifies before `default-width`.
|
|
177
|
+
*/
|
|
178
|
+
set_default_size(width: number, height: number): void;
|
|
173
179
|
/** `gtk_window_is_maximized`: the FRAME's state, not the browser window's. */
|
|
174
180
|
is_maximized(): boolean;
|
|
175
181
|
/**
|
|
@@ -30,6 +30,8 @@ export declare function hasInstalledVisible(el: Element): boolean;
|
|
|
30
30
|
export declare function installVisible(el: HTMLElement): void;
|
|
31
31
|
/** Gives `el` the instance API of a registered class, over the events it declares. */
|
|
32
32
|
export declare function installElementApi(el: HTMLElement): void;
|
|
33
|
+
/** Marks the self-installing `connect` / `disconnect` / `emit` / `notify` of `proto` ({@link WidgetElement}). */
|
|
34
|
+
export declare function markLazyElementApi(proto: object): void;
|
|
33
35
|
/**
|
|
34
36
|
* The end of a bind the core's engine drives. An element speaks camelCase members where a `.blp`
|
|
35
37
|
* says `dash-name`, so a built element is wrapped to translate the name; a registered class
|
|
@@ -17,6 +17,7 @@ export declare class GtkSourceView extends WidgetElement {
|
|
|
17
17
|
private direction;
|
|
18
18
|
private readonly gutters;
|
|
19
19
|
constructor();
|
|
20
|
+
private syncing;
|
|
20
21
|
private syncAdjustments;
|
|
21
22
|
private readonly onAreaScroll;
|
|
22
23
|
connectedCallback(): void;
|
|
@@ -74,7 +75,7 @@ export declare class GtkSourceView extends WidgetElement {
|
|
|
74
75
|
get bottomMargin(): number;
|
|
75
76
|
set bottomMargin(value: number | string);
|
|
76
77
|
/** GJS `connect(name, cb) → id`; the handler's first argument is this view. */
|
|
77
|
-
connect(name: string, callback: (self:
|
|
78
|
+
connect(name: string, callback: (self: this, ...args: never[]) => unknown): number;
|
|
78
79
|
/** `g_signal_connect_after`: runs once the plain handlers and the default of the emission have run. */
|
|
79
80
|
connect_after(name: string, callback: (self: GtkSourceView, ...args: never[]) => unknown): number;
|
|
80
81
|
/** `GObject.signal_stop_emission_by_name(view, …)`: the session owns the emissions. */
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * as Adw from './namespace/adw.js';
|
|
|
13
13
|
export * as Gtk from './namespace/gtk.js';
|
|
14
14
|
export * as Gio from './namespace/gio.js';
|
|
15
15
|
export * as Gdk from './namespace/gdk.js';
|
|
16
|
+
export * as Graphene from './namespace/graphene.js';
|
|
16
17
|
export * as GLib from './namespace/glib.js';
|
|
17
18
|
export * as GObject from './namespace/gobject.js';
|
|
18
19
|
export * as GtkSource from './namespace/gtksource.js';
|
|
@@ -56,4 +56,4 @@ export { AdwWindowTitle as WindowTitle } from '../elements/adw-window-title.js';
|
|
|
56
56
|
export { AdwWrapBox as WrapBox } from '../elements/adw-wrap-box.js';
|
|
57
57
|
export { AdwApplication as Application } from '../application.js';
|
|
58
58
|
export { AdwStyleManager as StyleManager } from '../style-manager.js';
|
|
59
|
-
export { ColorScheme, Toast, ToastPriority } from '@gjsify/adwaita-core';
|
|
59
|
+
export { AccentColor, ColorScheme, Toast, ToastPriority } from '@gjsify/adwaita-core';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Point } from '@gjsify/adwaita-core';
|
|
2
|
+
declare module '../widget-element.js' {
|
|
3
|
+
interface WidgetElement {
|
|
4
|
+
/** `gtk_widget_compute_point`: `[false, (0, 0)]` when the two share no tree. */
|
|
5
|
+
compute_point(target: WidgetElement, point: Point): [boolean, Point];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { Point };
|
|
@@ -9,6 +9,31 @@ export declare class WidgetElement extends HTMLElement {
|
|
|
9
9
|
get_visible(): boolean;
|
|
10
10
|
/** `gtk_widget_set_visible`. */
|
|
11
11
|
set_visible(visible: boolean): void;
|
|
12
|
+
/** `gtk_widget_get_first_child`: the first child element, `null` for a leaf. */
|
|
13
|
+
get_first_child(): Element | null;
|
|
14
|
+
/** `gtk_widget_get_last_child`. */
|
|
15
|
+
get_last_child(): Element | null;
|
|
16
|
+
/** `gtk_widget_get_next_sibling`. */
|
|
17
|
+
get_next_sibling(): Element | null;
|
|
18
|
+
/** `gtk_widget_get_prev_sibling`. */
|
|
19
|
+
get_prev_sibling(): Element | null;
|
|
20
|
+
/** `gtk_widget_get_parent`. */
|
|
21
|
+
get_parent(): Element | null;
|
|
22
|
+
/** `gtk_widget_get_width`: the layout box in CSS px; 0 until the widget is rendered. */
|
|
23
|
+
get_width(): number;
|
|
24
|
+
/** `gtk_widget_get_height`: the layout box in CSS px; 0 until the widget is rendered. */
|
|
25
|
+
get_height(): number;
|
|
26
|
+
/**
|
|
27
|
+
* The GObject signal API (ADR 0096 § 3), over the events the element declares in `static signals`:
|
|
28
|
+
* `connect` refuses a signal it does not declare, `disconnect` throws for an id that is not
|
|
29
|
+
* connected. Each of the four installs the real ones on the instance and repeats itself there
|
|
30
|
+
* (`installElementApi`), so a bare `document.createElement()` answers like a template's child
|
|
31
|
+
* and an element nobody connects to pays nothing.
|
|
32
|
+
*/
|
|
33
|
+
connect(signal: string, handler: (emitter: this, ...args: any[]) => unknown): number;
|
|
34
|
+
disconnect(id: number): void;
|
|
35
|
+
emit(signal: string, ...args: unknown[]): void;
|
|
36
|
+
notify(name: string): void;
|
|
12
37
|
/** `gtk_widget_get_mapped`: on screen, which is in the document and rendered. */
|
|
13
38
|
get_mapped(): boolean;
|
|
14
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-web",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.12-next.280",
|
|
4
4
|
"description": "Adwaita/Libadwaita web components for browser targets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"@codemirror/language": "^6.12.4",
|
|
59
59
|
"@codemirror/state": "^6.7.0",
|
|
60
60
|
"@codemirror/view": "^6.43.4",
|
|
61
|
-
"@gjsify/adwaita-core": "
|
|
62
|
-
"@gjsify/adwaita-fonts": "
|
|
63
|
-
"@gjsify/adwaita-icons": "
|
|
64
|
-
"@gjsify/gtksource-core": "
|
|
61
|
+
"@gjsify/adwaita-core": "0.64.12-next.280",
|
|
62
|
+
"@gjsify/adwaita-fonts": "0.64.12-next.280",
|
|
63
|
+
"@gjsify/adwaita-icons": "0.64.12-next.280",
|
|
64
|
+
"@gjsify/gtksource-core": "0.64.12-next.280",
|
|
65
65
|
"@lezer/highlight": "^1.2.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@gjsify/app-settings": "
|
|
68
|
+
"@gjsify/app-settings": "0.64.12-next.280"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"@gjsify/app-settings": {
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@gjsify/app-settings": "
|
|
77
|
-
"@gjsify/blueprint": "
|
|
78
|
-
"@gjsify/cli": "
|
|
79
|
-
"@gjsify/unit": "
|
|
80
|
-
"@gjsify/vite-plugin-blueprint": "
|
|
76
|
+
"@gjsify/app-settings": "0.64.12-next.280",
|
|
77
|
+
"@gjsify/blueprint": "0.64.12-next.280",
|
|
78
|
+
"@gjsify/cli": "0.64.12-next.280",
|
|
79
|
+
"@gjsify/unit": "0.64.12-next.280",
|
|
80
|
+
"@gjsify/vite-plugin-blueprint": "0.64.12-next.280",
|
|
81
81
|
"sass": "^1.101.0",
|
|
82
82
|
"typescript": "^6.0.3"
|
|
83
83
|
},
|
|
@@ -114,5 +114,6 @@
|
|
|
114
114
|
"bugs": {
|
|
115
115
|
"url": "https://github.com/gjsify/gjsify/issues"
|
|
116
116
|
},
|
|
117
|
-
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/web/adwaita-web#readme"
|
|
117
|
+
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/web/adwaita-web#readme",
|
|
118
|
+
"gitHead": "0a9185d91127072fce6aa54dc126e87e6ecd0c3d"
|
|
118
119
|
}
|
|
@@ -53,6 +53,18 @@ export const AdwViewSwitcherBarTest = async () => {
|
|
|
53
53
|
host.remove();
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
await it('set_stack / get_stack are the GIR spelling of setStack', () => {
|
|
57
|
+
const { bar, host } = mountBar(2);
|
|
58
|
+
const stack = bar.get_stack();
|
|
59
|
+
expect(stack).not.toBeNull();
|
|
60
|
+
bar.set_stack(null);
|
|
61
|
+
expect(bar.get_stack()).toBeNull();
|
|
62
|
+
expect(bar.stack).toBeNull();
|
|
63
|
+
bar.set_stack(stack);
|
|
64
|
+
expect(bar.stack).toBe(stack);
|
|
65
|
+
host.remove();
|
|
66
|
+
});
|
|
67
|
+
|
|
56
68
|
await it('still accepts the legacy `revealed` attribute as the request', () => {
|
|
57
69
|
const { bar, host } = mountBar(2);
|
|
58
70
|
bar.setAttribute('revealed', '');
|
|
@@ -125,14 +125,6 @@ export class AdwAlertDialog extends WidgetElement {
|
|
|
125
125
|
),
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
/** `GObject.Object.connect`: installed per instance by `installElementApi`; refuses an undeclared signal. */
|
|
129
|
-
declare connect: (signal: string, handler: (emitter: this, ...args: any[]) => unknown) => number;
|
|
130
|
-
/** `GObject.Object.disconnect`: throws for an id that is not connected. */
|
|
131
|
-
declare disconnect: (id: number) => void;
|
|
132
|
-
/** `GObject.Object.emit`. */
|
|
133
|
-
declare emit: (signal: string, ...args: unknown[]) => void;
|
|
134
|
-
/** `GObject.Object.notify`. */
|
|
135
|
-
declare notify: (name: string) => void;
|
|
136
128
|
/** `GObject.Object.get_property`, by GTK's dashed name. */
|
|
137
129
|
declare get_property: (name: string) => unknown;
|
|
138
130
|
/** `GObject.Object.set_property`. */
|
|
@@ -143,6 +143,23 @@ export class AdwOverlaySplitView extends WidgetElement {
|
|
|
143
143
|
this.setAttribute('show-sidebar', v ? '' : 'false');
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/** `Adw.OverlaySplitView:show-sidebar` — the GIR spelling of {@link showSidebar}. */
|
|
147
|
+
get show_sidebar(): boolean {
|
|
148
|
+
return this.showSidebar;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
set show_sidebar(v: boolean) {
|
|
152
|
+
this.showSidebar = v;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
get_show_sidebar(): boolean {
|
|
156
|
+
return this.showSidebar;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
set_show_sidebar(v: boolean): void {
|
|
160
|
+
this.showSidebar = v;
|
|
161
|
+
}
|
|
162
|
+
|
|
146
163
|
get collapsed(): boolean {
|
|
147
164
|
return this._state.collapsed;
|
|
148
165
|
}
|
|
@@ -213,6 +213,56 @@ export class AdwViewStack extends WidgetElement {
|
|
|
213
213
|
return this.add(content, name, title);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
/** `adw_view_stack_add_titled`. */
|
|
217
|
+
add_titled(child: HTMLElement, name: string, title: string): AdwViewStackPageInfo {
|
|
218
|
+
return this.add(child, name, title);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** `adw_view_stack_add_named`. */
|
|
222
|
+
add_named(child: HTMLElement, name: string | null): AdwViewStackPageInfo {
|
|
223
|
+
return this.add(child, name ?? '');
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** `adw_view_stack_add_titled_with_icon`: the same four values as {@link add}, in the same order. */
|
|
227
|
+
add_titled_with_icon(child: HTMLElement, name: string, title: string, iconName: string): AdwViewStackPageInfo {
|
|
228
|
+
return this.add(child, name, title, iconName);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* `adw_view_stack_remove` takes the CHILD. With no argument this is still
|
|
233
|
+
* `ChildNode.remove()` — the element leaves its parent — because the GIR name and the
|
|
234
|
+
* DOM name share one spelling here.
|
|
235
|
+
*/
|
|
236
|
+
override remove(child?: HTMLElement): void {
|
|
237
|
+
if (child === undefined) {
|
|
238
|
+
super.remove();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const page = this._state.pages.find((held) => held.content === child);
|
|
242
|
+
if (page) this.removePage(page.name);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** `adw_view_stack_get_visible_child_name`. */
|
|
246
|
+
get_visible_child_name(): string | null {
|
|
247
|
+
return this._state.visibleIndex < 0 ? null : this._state.visibleName;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** `adw_view_stack_set_visible_child_name`. */
|
|
251
|
+
set_visible_child_name(name: string): void {
|
|
252
|
+
this._state.setVisibleName(name);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** `adw_view_stack_get_visible_child`. */
|
|
256
|
+
get_visible_child(): HTMLElement | null {
|
|
257
|
+
return this.visibleChild;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** `adw_view_stack_set_visible_child`; a child that is not a page of this stack selects nothing. */
|
|
261
|
+
set_visible_child(child: HTMLElement): void {
|
|
262
|
+
const at = this._state.pages.findIndex((page) => page.content === child);
|
|
263
|
+
if (at !== -1) this._state.setVisibleIndex(at);
|
|
264
|
+
}
|
|
265
|
+
|
|
216
266
|
/**
|
|
217
267
|
* Remove the first page named `name` and detach its content. Returns whether
|
|
218
268
|
* anything was removed. When the removed page was the visible one the stack
|
|
@@ -139,6 +139,16 @@ export class AdwViewSwitcherBar extends WidgetElement {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/** `adw_view_switcher_bar_set_stack` — the GIR spelling of {@link setStack}. */
|
|
143
|
+
set_stack(stack: AdwViewStack | null): void {
|
|
144
|
+
this.setStack(stack);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** `adw_view_switcher_bar_get_stack`. */
|
|
148
|
+
get_stack(): AdwViewStack | null {
|
|
149
|
+
return this._stack;
|
|
150
|
+
}
|
|
151
|
+
|
|
142
152
|
/** Bind to a stack element (or null). Unbinds the previous one and rebuilds. */
|
|
143
153
|
setStack(stack: AdwViewStack | null): void {
|
|
144
154
|
this._unbindStack();
|
package/src/elements/gtk-box.ts
CHANGED
|
@@ -31,7 +31,12 @@
|
|
|
31
31
|
// Reference: refs/gtk/gtk/gtkbox.c (the three properties, the `box` CSS name)
|
|
32
32
|
// Copyright (c) The GTK Team. LGPLv2.1+.
|
|
33
33
|
|
|
34
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
normalizeBoxOrientation,
|
|
36
|
+
normalizeBoxSpacing,
|
|
37
|
+
resolveWrapBoxChildOrder,
|
|
38
|
+
type BoxOrientation,
|
|
39
|
+
} from '@gjsify/adwaita-core';
|
|
35
40
|
import { WidgetElement } from '../widget-element.js';
|
|
36
41
|
|
|
37
42
|
import { computeExpand, explicitExpand, type ExpandOrientation } from '../compute-expand.js';
|
|
@@ -79,6 +84,49 @@ export class GtkBox extends WidgetElement {
|
|
|
79
84
|
this.toggleAttribute('homogeneous', !!value);
|
|
80
85
|
}
|
|
81
86
|
|
|
87
|
+
// `gtk_box_append` and `gtk_box_prepend` are deliberately NOT redeclared:
|
|
88
|
+
// `ParentNode.append` / `.prepend` ARE those two, with the same semantics.
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* `gtk_box_remove` under its GIR name. With no argument it stays `ChildNode.remove()`:
|
|
92
|
+
* the box leaves its own parent. A `child` that is not a direct child is where C warns
|
|
93
|
+
* (`g_warning ("Trying to remove a widget that is not a child")`) and does nothing.
|
|
94
|
+
*/
|
|
95
|
+
override remove(child?: Element): void {
|
|
96
|
+
if (child === undefined) {
|
|
97
|
+
super.remove();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (child.parentNode !== this) {
|
|
101
|
+
console.warn('Gtk.Box: trying to remove a widget that is not a child of this box');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this.removeChild(child);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* `gtk_box_insert_child_after`. A NULL/absent `sibling` inserts at the FIRST position,
|
|
109
|
+
* not the last — `gtk_widget_insert_after`'s rule, pinned by
|
|
110
|
+
* `WRAP_BOX_CHILD_ORDER_VECTORS`. Returns whether the insert happened; a refusal is where
|
|
111
|
+
* C would have hit a `g_return_if_fail`.
|
|
112
|
+
*/
|
|
113
|
+
insert_child_after(child: Element, sibling: Element | null = null): boolean {
|
|
114
|
+
return this._applyOrder('insert-after', child, sibling);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** `gtk_box_reorder_child_after`. Same NULL rule. */
|
|
118
|
+
reorder_child_after(child: Element, sibling: Element | null = null): boolean {
|
|
119
|
+
return this._applyOrder('reorder-after', child, sibling);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private _applyOrder(op: 'insert-after' | 'reorder-after', child: Element, sibling: Element | null): boolean {
|
|
123
|
+
const next = resolveWrapBoxChildOrder({ children: [...this.children], child, sibling, op });
|
|
124
|
+
if (next === null) return false;
|
|
125
|
+
// Move exactly the one node, so no sibling is detached and loses focus.
|
|
126
|
+
this.insertBefore(child, next[next.indexOf(child) + 1] ?? null);
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
|
|
82
130
|
connectedCallback() {
|
|
83
131
|
this._sync();
|
|
84
132
|
this._syncComputedExpand();
|
|
@@ -99,6 +99,23 @@ export class GtkMenuButton extends WidgetElement {
|
|
|
99
99
|
if (this._initialized) this._renderMenu();
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/** `Gtk.MenuButton:menu-model` — the GIR spelling of {@link menuModel}. */
|
|
103
|
+
get menu_model(): AdwMenuModel {
|
|
104
|
+
return this.menuModel;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
set menu_model(value: AdwMenuInput) {
|
|
108
|
+
this.menuModel = value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get_menu_model(): AdwMenuModel {
|
|
112
|
+
return this.menuModel;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
set_menu_model(value: AdwMenuInput): void {
|
|
116
|
+
this.menuModel = value;
|
|
117
|
+
}
|
|
118
|
+
|
|
102
119
|
/**
|
|
103
120
|
* Normalise, REFUSE, store — the one door every menu comes through.
|
|
104
121
|
*
|