@gjsify/adwaita-web 0.56.0 → 0.57.0
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/dist/adwaita-web.css +8 -2
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/application.d.ts +24 -0
- package/lib/types/application.spec.d.ts +1 -0
- package/lib/types/elements/adw-application-window.d.ts +2 -0
- package/lib/types/elements/adw-view-stack.d.ts +3 -0
- package/lib/types/elements/checks.d.ts +6 -0
- package/lib/types/elements/gtk-application-window.d.ts +2 -0
- package/lib/types/elements/gtk-drop-down.d.ts +3 -0
- package/lib/types/elements/gtk-entry.d.ts +10 -0
- package/lib/types/elements/gtk-menu-button.d.ts +2 -0
- package/lib/types/elements/gtk-scrolled-window.d.ts +16 -0
- package/lib/types/elements/gtk-stack.d.ts +3 -0
- package/lib/types/elements/gtk-switch.d.ts +3 -0
- package/lib/types/glib.spec.d.ts +1 -0
- package/lib/types/gobject-door.d.ts +4 -0
- package/lib/types/gobject-door.spec.d.ts +1 -0
- package/lib/types/gobject-elements.d.ts +17 -0
- package/lib/types/gtksource/gtk-source-view.d.ts +77 -0
- package/lib/types/gtksource/gtk-source-view.spec.d.ts +2 -0
- package/lib/types/gtksource/web-editor-driver.d.ts +44 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/menu-actions.spec.d.ts +1 -0
- package/lib/types/namespace/adw.d.ts +1 -0
- package/lib/types/namespace/gio.d.ts +2 -0
- package/lib/types/namespace/glib.d.ts +10 -0
- package/lib/types/namespace/gobject.d.ts +27 -0
- package/lib/types/namespace/gtk-enums.d.ts +22 -0
- package/lib/types/namespace/gtk.d.ts +2 -0
- package/lib/types/namespace/gtksource.d.ts +2 -0
- package/lib/types/shared-tree-builder.d.ts +20 -1
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +11 -9
- package/scss/_reset.scss +1 -1
- package/src/application.spec.ts +75 -0
- package/src/application.ts +92 -0
- package/src/construct-vectors.spec.ts +155 -0
- package/src/elements/adw-application-window.ts +5 -0
- package/src/elements/adw-split-button.ts +5 -1
- package/src/elements/adw-view-stack.ts +14 -0
- package/src/elements/checks.ts +25 -1
- package/src/elements/gtk-application-window.ts +5 -0
- package/src/elements/gtk-drop-down.ts +16 -0
- package/src/elements/gtk-entry.ts +45 -7
- package/src/elements/gtk-menu-button.ts +12 -1
- package/src/elements/gtk-popover-menu.ts +7 -2
- package/src/elements/gtk-scrolled-window.ts +58 -0
- package/src/elements/gtk-stack.ts +8 -0
- package/src/elements/gtk-switch.ts +8 -0
- package/src/glib.spec.ts +34 -0
- package/src/gobject-door.spec.ts +119 -0
- package/src/gobject-door.ts +137 -0
- package/src/gobject-elements.ts +172 -0
- package/src/gtksource/gtk-source-view.spec.ts +69 -0
- package/src/gtksource/gtk-source-view.ts +379 -0
- package/src/gtksource/web-editor-driver.ts +260 -0
- package/src/index.ts +10 -0
- package/src/menu-actions.spec.ts +47 -0
- package/src/namespace/adw.ts +1 -0
- package/src/namespace/gio.ts +2 -0
- package/src/namespace/glib.ts +22 -0
- package/src/namespace/gobject.ts +37 -0
- package/src/namespace/gtk-enums.ts +15 -0
- package/src/namespace/gtk.ts +2 -0
- package/src/namespace/gtksource.ts +9 -0
- package/src/shared-tree-builder.ts +142 -7
- package/src/split-button.spec.ts +2 -0
- package/src/styles.generated.ts +1 -1
- package/src/test.browser.mts +10 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GioApplicationBase, type AdwMenuItem, type AdwMenuActions, type AdwMenuModel, type ApplicationHost } from '@gjsify/adwaita-core';
|
|
2
|
+
export declare const webHost: ApplicationHost;
|
|
3
|
+
/** An element's parent for action resolution; a popover is rooted at the widget that owns it. */
|
|
4
|
+
export declare function parentOfElement(node: object): object | null;
|
|
5
|
+
/** What a `Gtk.Actionable` does on activation: the action `prefix.name` found from `widget`. */
|
|
6
|
+
export declare function activateWidgetAction(widget: Element, fullName: string, parameter?: unknown): boolean;
|
|
7
|
+
/** What the items of `model` read from the actions registered above `el` (ADR 0097 § 3). */
|
|
8
|
+
export declare function menuActionsOfElement(el: Element, model: AdwMenuModel): AdwMenuActions;
|
|
9
|
+
/** What choosing `item` in a menu owned by `el` does: the action it names fires. */
|
|
10
|
+
export declare function activateElementMenuItem(el: Element, item: AdwMenuItem): boolean;
|
|
11
|
+
export declare class GioApplication extends GioApplicationBase {
|
|
12
|
+
static host: ApplicationHost;
|
|
13
|
+
}
|
|
14
|
+
declare const GtkApplication_base: typeof GioApplication & import("@gjsify/adwaita-core").GtkApplicationConstructor;
|
|
15
|
+
export declare class GtkApplication extends GtkApplication_base {
|
|
16
|
+
}
|
|
17
|
+
export declare class AdwApplication extends GtkApplication {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `Gtk.Window:application` and the window's `Gio.ActionMap` (`win.` actions) on an element class.
|
|
21
|
+
* Setting the property is `add_window`, as on GTK; setting it to `null` is `remove_window`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function defineWindowApplication(proto: object): void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ApplicationTest: () => Promise<void>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type AdwMenuInput, type AdwMenuModel } from '@gjsify/adwaita-core';
|
|
2
2
|
import { AdwWindow } from './adw-window.js';
|
|
3
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;
|
|
4
6
|
private _menubarEl;
|
|
5
7
|
private _model;
|
|
6
8
|
static get observedAttributes(): string[];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { AdwViewStackPageInfo as CorePageInfo } from '@gjsify/adwaita-core';
|
|
2
|
+
import type { DispatchedSignals } from '../signals.js';
|
|
2
3
|
export type AdwViewStackPageInfo = CorePageInfo<HTMLElement>;
|
|
3
4
|
export declare class AdwViewStack extends HTMLElement {
|
|
5
|
+
/** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
|
|
6
|
+
static readonly signals: DispatchedSignals;
|
|
4
7
|
private readonly _state;
|
|
5
8
|
private _initialized;
|
|
6
9
|
static get observedAttributes(): string[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatchedSignals } from '../signals.js';
|
|
1
2
|
/**
|
|
2
3
|
* The markup + state shared by `<gtk-check-button>` and `<adw-radio>`.
|
|
3
4
|
*
|
|
@@ -17,6 +18,9 @@ declare abstract class AdwCheckBase extends HTMLElement {
|
|
|
17
18
|
protected abstract activate(): void;
|
|
18
19
|
get checked(): boolean;
|
|
19
20
|
set checked(value: boolean);
|
|
21
|
+
/** `Gtk.CheckButton:active`, the GObject name for {@link checked}. */
|
|
22
|
+
get active(): boolean;
|
|
23
|
+
set active(value: boolean);
|
|
20
24
|
/** Whether the control is in the third, inconsistent state. */
|
|
21
25
|
get indeterminate(): boolean;
|
|
22
26
|
set indeterminate(value: boolean);
|
|
@@ -33,6 +37,8 @@ declare abstract class AdwCheckBase extends HTMLElement {
|
|
|
33
37
|
}
|
|
34
38
|
/** The Adwaita checkbox — `checkbutton > check` as a custom element. */
|
|
35
39
|
export declare class GtkCheckButton extends AdwCheckBase {
|
|
40
|
+
/** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
|
|
41
|
+
static readonly signals: DispatchedSignals;
|
|
36
42
|
static get observedAttributes(): string[];
|
|
37
43
|
protected get inputType(): 'checkbox';
|
|
38
44
|
protected activate(): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AdwSlot } from '../slotted-children.js';
|
|
2
2
|
import { GtkWindow } from './gtk-window.js';
|
|
3
3
|
export declare class GtkApplicationWindow extends GtkWindow {
|
|
4
|
+
/** `Gtk.Window:application`: setting it is `add_window` (ADR 0098), set by `defineWindowApplication`. */
|
|
5
|
+
application: object | null;
|
|
4
6
|
private _menubar;
|
|
5
7
|
private _menubarObserver;
|
|
6
8
|
static get observedAttributes(): string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './gtk-popover.js';
|
|
2
2
|
import type { AdwComboOption, AdwListModelInput } from '@gjsify/adwaita-core';
|
|
3
|
+
import type { DispatchedSignals } from '../signals.js';
|
|
3
4
|
/**
|
|
4
5
|
* A dropdown option — `value` is the stable id, `label` the shown text. An alias of
|
|
5
6
|
* core's {@link AdwComboOption}, since the drop-down and the combo row are the same
|
|
@@ -7,6 +8,8 @@ import type { AdwComboOption, AdwListModelInput } from '@gjsify/adwaita-core';
|
|
|
7
8
|
*/
|
|
8
9
|
export type GtkDropDownOption = AdwComboOption;
|
|
9
10
|
export declare class GtkDropDown extends HTMLElement {
|
|
11
|
+
/** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
|
|
12
|
+
static readonly signals: DispatchedSignals;
|
|
10
13
|
private _buttonEl;
|
|
11
14
|
private _labelEl;
|
|
12
15
|
private _popoverEl;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatchedSignals } from '../signals.js';
|
|
1
2
|
export declare class GtkEntry extends HTMLElement {
|
|
2
3
|
/**
|
|
3
4
|
* `protected`, not `private`: `GtkPasswordEntry` and `GtkSearchEntry` subclass this
|
|
@@ -8,9 +9,18 @@ export declare class GtkEntry extends HTMLElement {
|
|
|
8
9
|
protected _input: HTMLInputElement;
|
|
9
10
|
private _initialized;
|
|
10
11
|
private _maxLength;
|
|
12
|
+
/** The text last announced, so `changed` fires on a real change only — as `gtk_editable_changed` does. */
|
|
13
|
+
private _announced;
|
|
14
|
+
/** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
|
|
15
|
+
static readonly signals: DispatchedSignals;
|
|
11
16
|
static get observedAttributes(): string[];
|
|
12
17
|
get value(): string;
|
|
13
18
|
set value(v: string);
|
|
19
|
+
/** `Gtk.Editable:text`, the GObject name for {@link value}. */
|
|
20
|
+
get text(): string;
|
|
21
|
+
set text(v: string);
|
|
22
|
+
/** `changed` then `notify::text`, once per real change of the text, typed or set from code. */
|
|
23
|
+
private _announceText;
|
|
14
24
|
/** `Gtk.Entry:max-length` — 0 means unlimited. Counted in CODE POINTS. */
|
|
15
25
|
get maxLength(): number;
|
|
16
26
|
set maxLength(value: number);
|
|
@@ -67,5 +67,7 @@ export declare class GtkMenuButton extends HTMLElement {
|
|
|
67
67
|
private _parseMenuAttr;
|
|
68
68
|
private _onPopoverToggled;
|
|
69
69
|
private _render;
|
|
70
|
+
/** The registry's answer, unless the application wrote `actions` itself (ADR 0097 § 2). */
|
|
71
|
+
private _refreshActions;
|
|
70
72
|
private _renderMenu;
|
|
71
73
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AdwAdjustment } from '@gjsify/adwaita-core';
|
|
1
2
|
import type { GtkViewport } from './gtk-viewport.js';
|
|
2
3
|
/** `GtkPolicyType`'s four nicks; `automatic` is the pspec's default for both bars. */
|
|
3
4
|
export type GtkPolicyType = 'always' | 'never' | 'automatic' | 'external';
|
|
@@ -17,6 +18,9 @@ export declare class GtkScrolledWindow extends HTMLElement {
|
|
|
17
18
|
private _hoverable;
|
|
18
19
|
private _fadeTimer;
|
|
19
20
|
private _built;
|
|
21
|
+
/** What an unbuilt window answers before it has a viewport to read. */
|
|
22
|
+
private readonly _standIn;
|
|
23
|
+
private readonly _adopted;
|
|
20
24
|
static get observedAttributes(): string[];
|
|
21
25
|
/** `GtkScrolledWindow:hscrollbar-policy` — `automatic` in the pspec. */
|
|
22
26
|
get hscrollbarPolicy(): GtkPolicyType;
|
|
@@ -24,6 +28,18 @@ export declare class GtkScrolledWindow extends HTMLElement {
|
|
|
24
28
|
/** `GtkScrolledWindow:vscrollbar-policy` — `automatic` in the pspec. */
|
|
25
29
|
get vscrollbarPolicy(): GtkPolicyType;
|
|
26
30
|
set vscrollbarPolicy(value: GtkPolicyType);
|
|
31
|
+
/** `gtk_scrolled_window_get_policy`: `[hscrollbar, vscrollbar]` as `Gtk.PolicyType` constants. */
|
|
32
|
+
get_policy(): [number, number];
|
|
33
|
+
/** `gtk_scrolled_window_set_policy`; a value that is not a `Gtk.PolicyType` throws, as GJS's enum marshalling does. */
|
|
34
|
+
set_policy(hscrollbar_policy: number, vscrollbar_policy: number): void;
|
|
35
|
+
/** `GtkScrollable:hadjustment` as the window reports it: the one it was given, else the viewport's. */
|
|
36
|
+
get hadjustment(): AdwAdjustment;
|
|
37
|
+
get vadjustment(): AdwAdjustment;
|
|
38
|
+
get_hadjustment(): AdwAdjustment;
|
|
39
|
+
get_vadjustment(): AdwAdjustment;
|
|
40
|
+
/** Adopts `adjustment` as what `get_hadjustment` answers; the scroll position keeps following the viewport. */
|
|
41
|
+
set_hadjustment(adjustment: AdwAdjustment): void;
|
|
42
|
+
set_vadjustment(adjustment: AdwAdjustment): void;
|
|
27
43
|
/** `GtkScrolledWindow:window-placement` — where the contents sit against the bars. */
|
|
28
44
|
get windowPlacement(): GtkCornerType;
|
|
29
45
|
set windowPlacement(value: GtkCornerType);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatchedSignals } from '../signals.js';
|
|
1
2
|
/** `GtkStackTransitionType`, spelled as the GIR's enum nicks (gtkstack.c:95-121). */
|
|
2
3
|
export type StackTransitionType = 'none' | 'crossfade' | 'slide-right' | 'slide-left' | 'slide-up' | 'slide-down' | 'slide-left-right' | 'slide-up-down' | 'over-up' | 'over-down' | 'over-left' | 'over-right' | 'under-up' | 'under-down' | 'under-left' | 'under-right' | 'over-up-down' | 'over-down-up' | 'over-left-right' | 'over-right-left' | 'rotate-left' | 'rotate-right' | 'rotate-left-right';
|
|
3
4
|
/** The browser's page descriptor — the stand-in for the `GtkStackPage` GObject. */
|
|
@@ -18,6 +19,8 @@ export interface GtkStackPageInfo {
|
|
|
18
19
|
child: HTMLElement;
|
|
19
20
|
}
|
|
20
21
|
export declare class GtkStack extends HTMLElement {
|
|
22
|
+
/** The GTK signals this element dispatches, each with the DOM event it arrives as (ADR 0093). */
|
|
23
|
+
static readonly signals: DispatchedSignals;
|
|
21
24
|
/** The child that is visible, or `null` — C's `priv->visible_child`. */
|
|
22
25
|
private _visible;
|
|
23
26
|
/** C's `priv->last_visible_child`: the page being animated away. */
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { DispatchedSignals } from '../signals.js';
|
|
1
2
|
export declare class GtkSwitch 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 _input;
|
|
3
6
|
private _slider;
|
|
4
7
|
private _initialized;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GLibTest: () => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GObjectDoorTest: () => Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Handler = (emitter: HTMLElement, ...args: unknown[]) => unknown;
|
|
2
|
+
/** Whether `el` got its four methods from {@link installElementApi} (a registered class has the core's). */
|
|
3
|
+
export declare function hasElementApi(el: object): boolean;
|
|
4
|
+
/** Makes every change of `property` on `el` reach a `notify::<property>` listener, connected or not. */
|
|
5
|
+
export declare function ensureNotifying(el: HTMLElement, property: string): void;
|
|
6
|
+
/** Calls `handler(el, ...args)` for `signal`; returns the disconnect. */
|
|
7
|
+
export declare function listenElement(el: HTMLElement, signal: string, handler: Handler): () => void;
|
|
8
|
+
export declare function dispatchElement(el: HTMLElement, signal: string, args: readonly unknown[]): void;
|
|
9
|
+
/** Gives `el` the instance API of a registered class, over the events it declares. */
|
|
10
|
+
export declare function installElementApi(el: HTMLElement): void;
|
|
11
|
+
/**
|
|
12
|
+
* The end of a bind the core's engine drives. An element speaks camelCase members where a `.blp`
|
|
13
|
+
* says `dash-name`, so a built element is wrapped to translate the name; a registered class
|
|
14
|
+
* already has the core's accessors and aliases and is returned as it is.
|
|
15
|
+
*/
|
|
16
|
+
export declare function endpointOf(el: HTMLElement): HTMLElement;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { GtkAdjustment } from '@gjsify/adwaita-core';
|
|
2
|
+
import type { Buffer } from '@gjsify/gtksource-core';
|
|
3
|
+
export declare class GtkSourceView extends HTMLElement {
|
|
4
|
+
static get observedAttributes(): string[];
|
|
5
|
+
private readonly session;
|
|
6
|
+
private readonly driver;
|
|
7
|
+
private unsubscribe;
|
|
8
|
+
private built;
|
|
9
|
+
private readonly gutter;
|
|
10
|
+
private readonly backdrop;
|
|
11
|
+
private readonly area;
|
|
12
|
+
private readonly vadj;
|
|
13
|
+
private readonly hadj;
|
|
14
|
+
private direction;
|
|
15
|
+
constructor();
|
|
16
|
+
private syncAdjustments;
|
|
17
|
+
private readonly onAreaScroll;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
21
|
+
/** `GtkSource.View:buffer`. */
|
|
22
|
+
get buffer(): Buffer;
|
|
23
|
+
set buffer(value: Buffer);
|
|
24
|
+
get autoIndent(): boolean;
|
|
25
|
+
set autoIndent(value: boolean | string);
|
|
26
|
+
/** Held and read back; a textarea has no indent step to apply it to (ADR 0094). */
|
|
27
|
+
get indentWidth(): number;
|
|
28
|
+
set indentWidth(value: number | string);
|
|
29
|
+
get showLineNumbers(): boolean;
|
|
30
|
+
set showLineNumbers(value: boolean | string);
|
|
31
|
+
get highlightCurrentLine(): boolean;
|
|
32
|
+
set highlightCurrentLine(value: boolean | string);
|
|
33
|
+
get monospace(): boolean;
|
|
34
|
+
set monospace(value: boolean | string);
|
|
35
|
+
get editable(): boolean;
|
|
36
|
+
set editable(value: boolean | string);
|
|
37
|
+
/** `GtkTextView:cursor-visible` — whether the insertion cursor is drawn; TRUE by default. */
|
|
38
|
+
get cursorVisible(): boolean;
|
|
39
|
+
set cursorVisible(value: boolean | string);
|
|
40
|
+
get cursor_visible(): boolean;
|
|
41
|
+
set cursor_visible(value: boolean);
|
|
42
|
+
get_cursor_visible(): boolean;
|
|
43
|
+
set_cursor_visible(value: boolean): void;
|
|
44
|
+
get_editable(): boolean;
|
|
45
|
+
set_editable(value: boolean): void;
|
|
46
|
+
get highlight_current_line(): boolean;
|
|
47
|
+
set highlight_current_line(value: boolean);
|
|
48
|
+
get show_line_numbers(): boolean;
|
|
49
|
+
set show_line_numbers(value: boolean);
|
|
50
|
+
/** `GtkScrollable:vadjustment` — one stable adjustment that follows the textarea's scroll. */
|
|
51
|
+
get vadjustment(): GtkAdjustment;
|
|
52
|
+
get hadjustment(): GtkAdjustment;
|
|
53
|
+
get_vadjustment(): GtkAdjustment;
|
|
54
|
+
get_hadjustment(): GtkAdjustment;
|
|
55
|
+
/** `gtk_widget_set_direction`: held, and mirrored onto `dir` for LTR and RTL. */
|
|
56
|
+
set_direction(direction: number): void;
|
|
57
|
+
get_direction(): number;
|
|
58
|
+
/** A view has no widget children of its own here: its parts are the browser's. */
|
|
59
|
+
get_first_child(): null;
|
|
60
|
+
get_next_sibling(): Element | null;
|
|
61
|
+
get_parent(): Element | null;
|
|
62
|
+
/** Gutters are slice 6 (ADR 0094). */
|
|
63
|
+
get_gutter(_window_type: number): never;
|
|
64
|
+
get leftMargin(): number;
|
|
65
|
+
set leftMargin(value: number | string);
|
|
66
|
+
get rightMargin(): number;
|
|
67
|
+
set rightMargin(value: number | string);
|
|
68
|
+
get topMargin(): number;
|
|
69
|
+
set topMargin(value: number | string);
|
|
70
|
+
get bottomMargin(): number;
|
|
71
|
+
set bottomMargin(value: number | string);
|
|
72
|
+
/** GJS `connect(name, cb) → id`; the handler's first argument is this view. */
|
|
73
|
+
connect(name: string, callback: (self: GtkSourceView, ...args: never[]) => void): number;
|
|
74
|
+
disconnect(id: number): void;
|
|
75
|
+
/** The inner textarea, for focus and tests. */
|
|
76
|
+
get textarea(): HTMLTextAreaElement;
|
|
77
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { EditorDriver, EditorHost, EditorLayout, EditorPalette, StyledRun } from '@gjsify/gtksource-core';
|
|
2
|
+
export interface EditorParts {
|
|
3
|
+
readonly root: HTMLElement;
|
|
4
|
+
readonly area: HTMLTextAreaElement;
|
|
5
|
+
readonly backdrop: HTMLElement;
|
|
6
|
+
readonly gutter: HTMLElement;
|
|
7
|
+
}
|
|
8
|
+
export declare class WebEditorDriver implements EditorDriver {
|
|
9
|
+
private readonly parts;
|
|
10
|
+
private host;
|
|
11
|
+
private text;
|
|
12
|
+
private caret;
|
|
13
|
+
private reported;
|
|
14
|
+
private layout;
|
|
15
|
+
private readonly runs;
|
|
16
|
+
private scheduled;
|
|
17
|
+
private listening;
|
|
18
|
+
private palette;
|
|
19
|
+
private attached;
|
|
20
|
+
constructor(parts: EditorParts);
|
|
21
|
+
bind(host: EditorHost): void;
|
|
22
|
+
/** Starts listening to the textarea; the counterpart of the Android `attach()`. */
|
|
23
|
+
attach(): void;
|
|
24
|
+
detach(): void;
|
|
25
|
+
private onInput;
|
|
26
|
+
private onSelection;
|
|
27
|
+
/** `accepts-tab` is GTK's default; a textarea would move focus, so Tab inserts a tab. */
|
|
28
|
+
private onKey;
|
|
29
|
+
setText(text: string): void;
|
|
30
|
+
replaceRange(start: number, end: number, text: string): void;
|
|
31
|
+
setSelection(start: number, end: number): void;
|
|
32
|
+
setLineCount(): void;
|
|
33
|
+
setLayout(layout: EditorLayout): void;
|
|
34
|
+
/** Attributes and styles on the host wait for `attach()`: a custom element's constructor may not write them. */
|
|
35
|
+
private applyLayout;
|
|
36
|
+
setPalette(palette: EditorPalette): void;
|
|
37
|
+
private applyPalette;
|
|
38
|
+
spliceLines(first: number, removed: number, inserted: number): void;
|
|
39
|
+
paintLine(line: number, _lineStart: number, runs: readonly StyledRun[]): void;
|
|
40
|
+
clearAll(): void;
|
|
41
|
+
/** One repaint per task: a burst of `paintLine` calls from one edit costs one DOM rebuild. */
|
|
42
|
+
private scheduleRender;
|
|
43
|
+
private render;
|
|
44
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export { isIconAvailable, registerIcon } from './icon-registry.js';
|
|
|
12
12
|
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
|
+
export * as GLib from './namespace/glib.js';
|
|
16
|
+
export * as GObject from './namespace/gobject.js';
|
|
17
|
+
export * as GtkSource from './namespace/gtksource.js';
|
|
15
18
|
export { AdwCard } from './elements/adw-card.js';
|
|
16
19
|
export { AdwDataGrid } from './elements/adw-data-grid.js';
|
|
17
20
|
export type { AdwDataGridAlign, AdwDataGridColumn, AdwDataGridRow, AdwDataGridRowVariant, } from './elements/adw-data-grid.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MenuActionsTest: () => Promise<void>;
|
|
@@ -54,3 +54,4 @@ export { AdwViewSwitcherBar as ViewSwitcherBar } from '../elements/adw-view-swit
|
|
|
54
54
|
export { AdwWindow as Window } from '../elements/adw-window.js';
|
|
55
55
|
export { AdwWindowTitle as WindowTitle } from '../elements/adw-window-title.js';
|
|
56
56
|
export { AdwWrapBox as WrapBox } from '../elements/adw-wrap-box.js';
|
|
57
|
+
export { AdwApplication as Application } from '../application.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const PRIORITY_HIGH: number;
|
|
2
|
+
export declare const PRIORITY_DEFAULT: number;
|
|
3
|
+
export declare const PRIORITY_HIGH_IDLE: number;
|
|
4
|
+
export declare const PRIORITY_DEFAULT_IDLE: number;
|
|
5
|
+
export declare const PRIORITY_LOW: number;
|
|
6
|
+
export declare const SOURCE_REMOVE: boolean;
|
|
7
|
+
export declare const SOURCE_CONTINUE: boolean;
|
|
8
|
+
export declare const idle_add: (priority: number, run: import("@gjsify/adwaita-core").SourceFunc) => number;
|
|
9
|
+
export declare const timeout_add: (priority: number, milliseconds: number, run: import("@gjsify/adwaita-core").SourceFunc) => number;
|
|
10
|
+
export declare const source_remove: (sourceId: number) => boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const GObjectObject: import("@gjsify/adwaita-core").GObjectConstructor;
|
|
2
|
+
export { GObjectObject as Object };
|
|
3
|
+
export declare const registerClass: import("@gjsify/adwaita-core").RegisterClass;
|
|
4
|
+
export declare const type_ensure: (gtype: import("@gjsify/adwaita-core").GType) => void;
|
|
5
|
+
export declare const ParamSpec: typeof import("@gjsify/adwaita-core").ParamSpec;
|
|
6
|
+
export declare const ParamFlags: {
|
|
7
|
+
readonly READABLE: 1;
|
|
8
|
+
readonly WRITABLE: 2;
|
|
9
|
+
readonly READWRITE: 3;
|
|
10
|
+
readonly CONSTRUCT: 4;
|
|
11
|
+
readonly CONSTRUCT_ONLY: 8;
|
|
12
|
+
};
|
|
13
|
+
export declare const TYPE_STRING: import("@gjsify/adwaita-core").GType;
|
|
14
|
+
export declare const TYPE_BOOLEAN: import("@gjsify/adwaita-core").GType;
|
|
15
|
+
export declare const TYPE_INT: import("@gjsify/adwaita-core").GType;
|
|
16
|
+
export declare const TYPE_UINT: import("@gjsify/adwaita-core").GType;
|
|
17
|
+
export declare const TYPE_DOUBLE: import("@gjsify/adwaita-core").GType;
|
|
18
|
+
export declare const GTypeName: symbol;
|
|
19
|
+
export declare const GTypeFlags: symbol;
|
|
20
|
+
export declare const interfaces: symbol;
|
|
21
|
+
export declare const properties: symbol;
|
|
22
|
+
export declare const signals: symbol;
|
|
23
|
+
export declare const requires: symbol;
|
|
24
|
+
export declare const __gtkTemplate__: symbol;
|
|
25
|
+
export declare const __gtkCssName__: symbol;
|
|
26
|
+
export declare const __gtkChildren__: symbol;
|
|
27
|
+
export declare const __gtkInternalChildren__: symbol;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** `Gtk.PolicyType`: `ALWAYS` 0, `AUTOMATIC` 1, `NEVER` 2, `EXTERNAL` 3. */
|
|
2
|
+
export declare const PolicyType: Readonly<{
|
|
3
|
+
readonly ALWAYS: 0;
|
|
4
|
+
readonly AUTOMATIC: 1;
|
|
5
|
+
readonly NEVER: 2;
|
|
6
|
+
readonly EXTERNAL: 3;
|
|
7
|
+
}>;
|
|
8
|
+
/** `Gtk.TextDirection`: `NONE` 0, `LTR` 1, `RTL` 2. */
|
|
9
|
+
export declare const TextDirection: Readonly<{
|
|
10
|
+
readonly NONE: 0;
|
|
11
|
+
readonly LTR: 1;
|
|
12
|
+
readonly RTL: 2;
|
|
13
|
+
}>;
|
|
14
|
+
/** `Gtk.TextWindowType`: `WIDGET` 1, `TEXT` 2, `LEFT` 3, `RIGHT` 4, `TOP` 5, `BOTTOM` 6. */
|
|
15
|
+
export declare const TextWindowType: Readonly<{
|
|
16
|
+
readonly WIDGET: 1;
|
|
17
|
+
readonly TEXT: 2;
|
|
18
|
+
readonly LEFT: 3;
|
|
19
|
+
readonly RIGHT: 4;
|
|
20
|
+
readonly TOP: 5;
|
|
21
|
+
readonly BOTTOM: 6;
|
|
22
|
+
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { GtkAdjustment as Adjustment } from '@gjsify/adwaita-core';
|
|
2
|
+
export { PolicyType, TextDirection, TextWindowType } from './gtk-enums.js';
|
|
2
3
|
export { GtkAboutDialog as AboutDialog } from '../elements/gtk-about-dialog.js';
|
|
3
4
|
export { GtkActionBar as ActionBar } from '../elements/gtk-action-bar.js';
|
|
4
5
|
export { GtkApplicationWindow as ApplicationWindow } from '../elements/gtk-application-window.js';
|
|
@@ -73,3 +74,4 @@ export { GtkWindow as Window } from '../elements/gtk-window.js';
|
|
|
73
74
|
export { GtkWindowControls as WindowControls } from '../elements/gtk-window-controls.js';
|
|
74
75
|
export { GtkViewport as Viewport } from '../elements/gtk-viewport.js';
|
|
75
76
|
export { GtkWindowHandle as WindowHandle } from '../elements/gtk-window-handle.js';
|
|
77
|
+
export { GtkApplication as Application } from '../application.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BreakpointSize } from '@gjsify/adwaita-core';
|
|
1
|
+
import { type BreakpointSize, type TemplateScope } from '@gjsify/adwaita-core';
|
|
2
2
|
import { type SharedTreeNode } from '@gjsify/adwaita-core/conformance';
|
|
3
3
|
/** One authored placement, kept so {@link mountSharedTree} can hold the renderer to it. */
|
|
4
4
|
interface PlacedChild {
|
|
@@ -30,6 +30,10 @@ interface BuildRecord {
|
|
|
30
30
|
observeSize?: SizeSource;
|
|
31
31
|
/** The object a signal handler's NAME is resolved against (ADR 0093 § 3), as `Gtk.BuilderScope` does. */
|
|
32
32
|
scope?: Readonly<Record<string, unknown>>;
|
|
33
|
+
/** The root menus of the tree (ADR 0097), which a `menu-model: id` anywhere below resolves against. */
|
|
34
|
+
menus?: SharedTreeNode['menus'];
|
|
35
|
+
/** Present when the tree is the template of a registered class (ADR 0096): handlers and binds go through it. */
|
|
36
|
+
template?: TemplateScope;
|
|
33
37
|
}
|
|
34
38
|
/** Calls `onSize` with the host's measured size, now and on every change; returns its disposer. */
|
|
35
39
|
export type SizeSource = (element: Element, onSize: (size: BreakpointSize) => void) => () => void;
|
|
@@ -93,6 +97,21 @@ export declare function buildSharedTree(node: SharedTreeNode, record?: BuildReco
|
|
|
93
97
|
* as the attribute `"false"` and a later `true` rewrites it — `GTK_WIDGET_EXPAND` says why.
|
|
94
98
|
*/
|
|
95
99
|
export declare function writeProp(el: HTMLElement, prop: string, value: string | number | boolean): void;
|
|
100
|
+
/** A template tree built for a registered class: its children are not attached, its look is not written. */
|
|
101
|
+
export interface BuiltTemplateTree {
|
|
102
|
+
readonly children: HTMLElement[];
|
|
103
|
+
/** Every object the template names with an `id`. */
|
|
104
|
+
readonly objects: Record<string, HTMLElement>;
|
|
105
|
+
/** Writes the root's own properties, classes and extensions onto the host — at its first connect. */
|
|
106
|
+
finish(): void;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The template of a registered class (ADR 0096 § 3), built into `host`: children created and wired
|
|
110
|
+
* to their handlers and binds through `scope`, none appended and nothing written to `host`'s
|
|
111
|
+
* attributes, because `host` is still inside its constructor. `finish` and the caller's own append
|
|
112
|
+
* belong to the first `connectedCallback`.
|
|
113
|
+
*/
|
|
114
|
+
export declare function buildTemplateTree(tree: SharedTreeNode, scope: TemplateScope, host: HTMLElement): BuiltTemplateTree;
|
|
96
115
|
/** A tree {@link mountSharedTree} built and connected. */
|
|
97
116
|
export interface MountedSharedTree {
|
|
98
117
|
/** The authored root — connected, so every custom element under it has upgraded and run. */
|