@gjsify/adwaita-core 0.56.0 → 0.58.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/lib/esm/application.js +1 -0
- package/lib/esm/conformance/application.js +1 -0
- package/lib/esm/conformance/glib-paths.js +1 -0
- package/lib/esm/conformance/glib-timers.js +1 -0
- package/lib/esm/conformance/gobject.js +1 -0
- package/lib/esm/conformance/index.js +1 -1
- package/lib/esm/conformance/menu-actions.js +1 -0
- package/lib/esm/conformance/menu-tree.js +1 -0
- package/lib/esm/conformance/popup-menu-plan.js +1 -0
- package/lib/esm/conformance/simple-action-group.js +1 -0
- package/lib/esm/conformance/style-manager.js +1 -0
- package/lib/esm/gio-actions.js +1 -0
- package/lib/esm/glib-paths.js +1 -0
- package/lib/esm/glib-timers.js +1 -0
- package/lib/esm/gobject.js +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/menu-actions.js +1 -0
- package/lib/esm/menu-tree.js +1 -0
- package/lib/esm/popup-menu-plan.js +2 -0
- package/lib/esm/style-manager.js +1 -0
- package/lib/types/application.d.ts +80 -0
- package/lib/types/application.gjs.spec.d.ts +2 -0
- package/lib/types/application.spec.d.ts +2 -0
- package/lib/types/conformance/application.d.ts +91 -0
- package/lib/types/conformance/glib-paths.d.ts +23 -0
- package/lib/types/conformance/glib-timers.d.ts +35 -0
- package/lib/types/conformance/gobject.d.ts +35 -0
- package/lib/types/conformance/index.d.ts +18 -0
- package/lib/types/conformance/menu-actions.d.ts +36 -0
- package/lib/types/conformance/menu-tree.d.ts +18 -0
- package/lib/types/conformance/popup-menu-plan.d.ts +30 -0
- package/lib/types/conformance/shared-trees.d.ts +13 -0
- package/lib/types/conformance/simple-action-group.d.ts +35 -0
- package/lib/types/conformance/style-manager.d.ts +33 -0
- package/lib/types/gio-actions.d.ts +85 -0
- package/lib/types/glib-paths.d.ts +16 -0
- package/lib/types/glib-paths.gjs.spec.d.ts +2 -0
- package/lib/types/glib-paths.spec.d.ts +2 -0
- package/lib/types/glib-timers.d.ts +21 -0
- package/lib/types/glib-timers.gjs.spec.d.ts +2 -0
- package/lib/types/glib-timers.spec.d.ts +2 -0
- package/lib/types/gobject.d.ts +209 -0
- package/lib/types/gobject.gjs.spec.d.ts +2 -0
- package/lib/types/gobject.spec.d.ts +2 -0
- package/lib/types/index.d.ts +16 -0
- package/lib/types/menu-actions.d.ts +16 -0
- package/lib/types/menu-actions.gjs.spec.d.ts +2 -0
- package/lib/types/menu-actions.spec.d.ts +2 -0
- package/lib/types/menu-tree.d.ts +12 -0
- package/lib/types/menu-tree.spec.d.ts +2 -0
- package/lib/types/popup-menu-plan.d.ts +47 -0
- package/lib/types/popup-menu-plan.spec.d.ts +2 -0
- package/lib/types/simple-action-group.gjs.spec.d.ts +2 -0
- package/lib/types/simple-action-group.spec.d.ts +2 -0
- package/lib/types/style-manager.d.ts +14 -0
- package/lib/types/style-manager.gjs.spec.d.ts +2 -0
- package/lib/types/style-manager.spec.d.ts +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type GObjectNamespace } from '../gobject.js';
|
|
2
|
+
import type { ConstructHarness } from './constructs.js';
|
|
3
|
+
/** The rows of ADR 0098 § 1 that carry a claim; every one needs a vector. */
|
|
4
|
+
export declare const APPLICATION_ROWS: readonly ["lifecycle", "order", "unlock", "actions", "windows", "resolution", "refusal"];
|
|
5
|
+
export type ApplicationRow = (typeof APPLICATION_ROWS)[number];
|
|
6
|
+
type Handler = (...args: unknown[]) => unknown;
|
|
7
|
+
/** The part of `Gtk.Application` the vectors read. */
|
|
8
|
+
export interface ApplicationLike {
|
|
9
|
+
connect(signal: string, handler: Handler): number;
|
|
10
|
+
runAsync(argv: string[]): Promise<number>;
|
|
11
|
+
quit(): void;
|
|
12
|
+
vfunc_startup(): void;
|
|
13
|
+
vfunc_activate(): void;
|
|
14
|
+
add_action(action: object): void;
|
|
15
|
+
lookup_action(name: string): object | null;
|
|
16
|
+
remove_action(name: string): void;
|
|
17
|
+
has_action(name: string): boolean;
|
|
18
|
+
list_actions(): string[];
|
|
19
|
+
activate_action(name: string, parameter: null): void;
|
|
20
|
+
add_window(window: object): void;
|
|
21
|
+
remove_window(window: object): void;
|
|
22
|
+
get_windows(): object[];
|
|
23
|
+
get_active_window(): object | null;
|
|
24
|
+
get_application_id(): string | null;
|
|
25
|
+
[member: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface SimpleActionLike {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
connect(signal: 'activate', handler: Handler): number;
|
|
30
|
+
[member: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
/** Widgets a window scene needs; absent on a subject that cannot build a window (GJS without a display). */
|
|
33
|
+
export interface ApplicationScene {
|
|
34
|
+
/** `new Gtk.ApplicationWindow({ application })`. */
|
|
35
|
+
window(app: ApplicationLike): object;
|
|
36
|
+
/** A button placed in the window. */
|
|
37
|
+
buttonIn(window: object): object;
|
|
38
|
+
/** A button inside a popover owned by a menu button placed in the window. */
|
|
39
|
+
popoverButtonIn(window: object): object;
|
|
40
|
+
/** A button with no window above it. */
|
|
41
|
+
loose(): object;
|
|
42
|
+
/** `activate_action(name)` of the widget: whether an enabled action ran. */
|
|
43
|
+
activate(widget: object, name: string): boolean;
|
|
44
|
+
/** `Gtk.ApplicationWindow.add_action`. */
|
|
45
|
+
addWindowAction(window: object, action: object): void;
|
|
46
|
+
}
|
|
47
|
+
/** What a driver hands the vectors. */
|
|
48
|
+
export interface ApplicationSubject {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
/** True for real GJS: refusal vectors are the subset's own and are not run there. */
|
|
51
|
+
readonly isOracle: boolean;
|
|
52
|
+
readonly GObject: GObjectNamespace;
|
|
53
|
+
/** `Gtk.Application`, or `Gio.Application` where GJS has no display. */
|
|
54
|
+
readonly Application: new (params?: Record<string, unknown>) => ApplicationLike;
|
|
55
|
+
readonly SimpleAction: new (params: {
|
|
56
|
+
name: string;
|
|
57
|
+
enabled?: boolean;
|
|
58
|
+
}) => SimpleActionLike;
|
|
59
|
+
/** `Gio.ApplicationFlags.HANDLES_OPEN`: a flag other than the default. */
|
|
60
|
+
readonly handlesOpen: number;
|
|
61
|
+
readonly scene?: ApplicationScene;
|
|
62
|
+
/**
|
|
63
|
+
* Runs the application to its end. Ports: `runAsync`. GJS inside a test runner cannot (its own
|
|
64
|
+
* main loop is running, and `runAsync` refuses), so the oracle registers and activates instead.
|
|
65
|
+
*/
|
|
66
|
+
run?(app: ApplicationLike): Promise<number>;
|
|
67
|
+
/** Makes the action API usable before a run (`g_application_register` on GJS); a port needs nothing. */
|
|
68
|
+
ready?(app: ApplicationLike): void;
|
|
69
|
+
}
|
|
70
|
+
export interface ApplicationVector {
|
|
71
|
+
readonly row: ApplicationRow;
|
|
72
|
+
readonly rule: string;
|
|
73
|
+
readonly holds: 'oracle' | 'subset';
|
|
74
|
+
/** Needs `subject.scene`. */
|
|
75
|
+
readonly windowed?: true;
|
|
76
|
+
/** `Class.vfunc_name` entries of `UNLOCKED_VFUNCS` this vector proves against GJS. */
|
|
77
|
+
readonly unlocks?: readonly string[];
|
|
78
|
+
readonly observe: (subject: ApplicationSubject) => unknown;
|
|
79
|
+
readonly shows: unknown;
|
|
80
|
+
}
|
|
81
|
+
export declare const APPLICATION_VECTORS: readonly ApplicationVector[];
|
|
82
|
+
/** Every `Class.vfunc_name` of `UNLOCKED_VFUNCS`, for the gate that an entry without a vector fails. */
|
|
83
|
+
export declare function unlockedVfuncNames(): string[];
|
|
84
|
+
/**
|
|
85
|
+
* The entries of `UNLOCKED_VFUNCS` no vector proves. `prefix` narrows the check to the GIR namespace
|
|
86
|
+
* a vector family owns (`Gio.` here, `GtkSource.` in `@gjsify/gtksource-core`).
|
|
87
|
+
*/
|
|
88
|
+
export declare function unprovenVfuncs(vectors?: readonly Pick<ApplicationVector, 'unlocks'>[], prefix?: string): string[];
|
|
89
|
+
/** Holds a subject to the vectors. Windowed vectors need `subject.scene`. */
|
|
90
|
+
export declare function driveApplicationVectors(subject: ApplicationSubject, harness: ConstructHarness, vectors?: readonly ApplicationVector[]): Promise<void>;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ConstructHarness } from './constructs.js';
|
|
2
|
+
/** The part of `GLib` the vectors read. */
|
|
3
|
+
export interface GLibPathsLike {
|
|
4
|
+
readonly MAXUINT32: number;
|
|
5
|
+
build_filenamev(elements: string[]): string;
|
|
6
|
+
get_current_dir(): string;
|
|
7
|
+
get_system_data_dirs(): string[];
|
|
8
|
+
}
|
|
9
|
+
export interface GLibPathsSubject {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly isOracle: boolean;
|
|
12
|
+
readonly GLib: GLibPathsLike;
|
|
13
|
+
}
|
|
14
|
+
export declare const GLIB_PATH_ROWS: readonly ["constant", "join", "separators", "empty", "shape"];
|
|
15
|
+
export type GLibPathRow = (typeof GLIB_PATH_ROWS)[number];
|
|
16
|
+
export interface GLibPathVector {
|
|
17
|
+
readonly row: GLibPathRow;
|
|
18
|
+
readonly rule: string;
|
|
19
|
+
readonly observe: (subject: GLibPathsSubject) => unknown;
|
|
20
|
+
readonly shows: unknown;
|
|
21
|
+
}
|
|
22
|
+
export declare const GLIB_PATH_VECTORS: readonly GLibPathVector[];
|
|
23
|
+
export declare function driveGLibPathVectors(subject: GLibPathsSubject, harness: ConstructHarness, vectors?: readonly GLibPathVector[]): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ConstructHarness } from './constructs.js';
|
|
2
|
+
/** The part of `GLib` the vectors read. */
|
|
3
|
+
export interface GLibTimersLike {
|
|
4
|
+
readonly PRIORITY_HIGH: number;
|
|
5
|
+
readonly PRIORITY_DEFAULT: number;
|
|
6
|
+
readonly PRIORITY_HIGH_IDLE: number;
|
|
7
|
+
readonly PRIORITY_DEFAULT_IDLE: number;
|
|
8
|
+
readonly PRIORITY_LOW: number;
|
|
9
|
+
readonly SOURCE_REMOVE: boolean;
|
|
10
|
+
readonly SOURCE_CONTINUE: boolean;
|
|
11
|
+
idle_add(priority: number, run: () => boolean | void): number;
|
|
12
|
+
timeout_add(priority: number, milliseconds: number, run: () => boolean | void): number;
|
|
13
|
+
source_remove(sourceId: number): boolean;
|
|
14
|
+
}
|
|
15
|
+
/** What a driver hands the vectors. */
|
|
16
|
+
export interface GLibTimersSubject {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly isOracle: boolean;
|
|
19
|
+
readonly GLib: GLibTimersLike;
|
|
20
|
+
/** Resolves after `milliseconds` of the subject's own loop; the loop must keep running meanwhile. */
|
|
21
|
+
settle(milliseconds: number): Promise<void>;
|
|
22
|
+
/** Runs `body` with the subject's error log silenced (a throwing callback logs by design). */
|
|
23
|
+
quiet(body: () => Promise<void>): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare const GLIB_TIMER_ROWS: readonly ["constants", "timeout", "idle", "remove", "throw", "arguments"];
|
|
26
|
+
export type GLibTimerRow = (typeof GLIB_TIMER_ROWS)[number];
|
|
27
|
+
export interface GLibTimerVector {
|
|
28
|
+
readonly row: GLibTimerRow;
|
|
29
|
+
readonly rule: string;
|
|
30
|
+
readonly observe: (subject: GLibTimersSubject) => unknown;
|
|
31
|
+
readonly shows: unknown;
|
|
32
|
+
}
|
|
33
|
+
export declare const GLIB_TIMER_VECTORS: readonly GLibTimerVector[];
|
|
34
|
+
/** Holds a subject to the vectors. */
|
|
35
|
+
export declare function driveGLibTimerVectors(subject: GLibTimersSubject, harness: ConstructHarness, vectors?: readonly GLibTimerVector[]): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BindingFlag, BlueprintTemplate, GObjectConstructor, GObjectInstance, GObjectNamespace } from '../gobject.js';
|
|
2
|
+
import type { ConstructHarness } from './constructs.js';
|
|
3
|
+
/** The rows of ADR 0096 § 2 that carry a claim; every one needs a vector. */
|
|
4
|
+
export declare const GOBJECT_ROWS: readonly ["registerClass", "field-form", "ParamSpec", "Signals", "instance API", "type_ensure", "vfunc", "binding engine", "template"];
|
|
5
|
+
export type GObjectRow = (typeof GOBJECT_ROWS)[number];
|
|
6
|
+
/** A template, in both spellings: GtkBuilder XML for GJS, the projected tree for a port. */
|
|
7
|
+
export interface GObjectTemplateSource {
|
|
8
|
+
readonly className: string;
|
|
9
|
+
readonly tree: BlueprintTemplate;
|
|
10
|
+
readonly xml: string;
|
|
11
|
+
}
|
|
12
|
+
/** What a driver hands the vectors. */
|
|
13
|
+
export interface GObjectSubject {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/** True for real GJS: refusal vectors are the subset's own and are not run there. */
|
|
16
|
+
readonly isOracle: boolean;
|
|
17
|
+
readonly GObject: GObjectNamespace;
|
|
18
|
+
/** The widget base a templated class extends (`Gtk.Box` on GJS); absent when there is no display. */
|
|
19
|
+
readonly Widget?: GObjectConstructor;
|
|
20
|
+
/** The value to put in `Template`. */
|
|
21
|
+
template(source: GObjectTemplateSource): unknown;
|
|
22
|
+
/** The binding engine; `bind_property` on GJS, which is not exported by the ports. */
|
|
23
|
+
bind(source: GObjectInstance, sourceProperty: string, target: GObjectInstance, targetProperty: string, flags: readonly BindingFlag[]): void;
|
|
24
|
+
}
|
|
25
|
+
export interface GObjectVector {
|
|
26
|
+
readonly row: GObjectRow;
|
|
27
|
+
readonly rule: string;
|
|
28
|
+
readonly holds: 'oracle' | 'subset';
|
|
29
|
+
readonly widget?: true;
|
|
30
|
+
readonly observe: (subject: GObjectSubject) => unknown;
|
|
31
|
+
readonly shows: unknown;
|
|
32
|
+
}
|
|
33
|
+
export declare const GOBJECT_VECTORS: readonly GObjectVector[];
|
|
34
|
+
/** Holds a subject to the vectors. Widget vectors need `subject.Widget`; the caller reports their absence. */
|
|
35
|
+
export declare function driveGObjectVectors(subject: GObjectSubject, harness: ConstructHarness, vectors?: readonly GObjectVector[]): Promise<void>;
|
|
@@ -84,3 +84,21 @@ export { SHARED_TREE_BLOCKS_WITHOUT_EXPECTATIONS, SHARED_TREE_TABLES, authoredNo
|
|
|
84
84
|
export type { SharedTreeExpectation, SharedTreeNode, SharedTreeObservable, SharedTreePlacement, } from './shared-trees.js';
|
|
85
85
|
export { CONSTRUCT_KINDS, BREAKPOINT_VECTOR_SIZES, EXTERN_VECTOR_CLASS, CONSTRUCT_VECTORS, UnsupportedConstructError, assertTreeConstructs, constructUsesOf, driveConstructVectors, } from './constructs.js';
|
|
86
86
|
export type { ConstructCapabilities, ConstructCapability, ConstructHarness, ConstructKind, ConstructRenderer, ConstructUse, ConstructVector, } from './constructs.js';
|
|
87
|
+
export { GOBJECT_ROWS, GOBJECT_VECTORS, driveGObjectVectors } from './gobject.js';
|
|
88
|
+
export { APPLICATION_ROWS, APPLICATION_VECTORS, driveApplicationVectors, unprovenVfuncs, unlockedVfuncNames, } from './application.js';
|
|
89
|
+
export type { ApplicationLike, ApplicationRow, ApplicationScene, ApplicationSubject, ApplicationVector, SimpleActionLike, } from './application.js';
|
|
90
|
+
export { GLIB_TIMER_ROWS, GLIB_TIMER_VECTORS, driveGLibTimerVectors } from './glib-timers.js';
|
|
91
|
+
export type { GLibTimerRow, GLibTimersLike, GLibTimersSubject, GLibTimerVector } from './glib-timers.js';
|
|
92
|
+
export type { GObjectRow, GObjectSubject, GObjectTemplateSource, GObjectVector } from './gobject.js';
|
|
93
|
+
export { POPUP_MENU_PLAN_VECTORS, popupMenuOutline } from './popup-menu-plan.js';
|
|
94
|
+
export type { PopupMenuPlanVector } from './popup-menu-plan.js';
|
|
95
|
+
export { MENU_ACTION_VECTORS, driveMenuActionVectors, registryMenuActionScene } from './menu-actions.js';
|
|
96
|
+
export type { MenuActionGroupSpec, MenuActionScene, MenuActionVector } from './menu-actions.js';
|
|
97
|
+
export { MENU_TREE_VECTORS } from './menu-tree.js';
|
|
98
|
+
export type { MenuTreeVector } from './menu-tree.js';
|
|
99
|
+
export { GLIB_PATH_ROWS, GLIB_PATH_VECTORS, driveGLibPathVectors } from './glib-paths.js';
|
|
100
|
+
export type { GLibPathRow, GLibPathsLike, GLibPathsSubject, GLibPathVector } from './glib-paths.js';
|
|
101
|
+
export { STYLE_MANAGER_ROWS, STYLE_MANAGER_VECTORS, driveStyleManagerVectors } from './style-manager.js';
|
|
102
|
+
export type { AdwStyleLike, StyleManagerLike, StyleManagerRow, StyleManagerSubject, StyleManagerVector, } from './style-manager.js';
|
|
103
|
+
export { SIMPLE_ACTION_GROUP_ROWS, SIMPLE_ACTION_GROUP_VECTORS, driveSimpleActionGroupVectors, } from './simple-action-group.js';
|
|
104
|
+
export type { GioActionsLike, SimpleActionGroupLike, SimpleActionGroupRow, SimpleActionGroupSubject, SimpleActionGroupVector, GioSimpleActionLike, } from './simple-action-group.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ConstructHarness } from './constructs.js';
|
|
2
|
+
export interface MenuActionGroupSpec {
|
|
3
|
+
readonly at: 'outer' | 'button';
|
|
4
|
+
readonly prefix: string;
|
|
5
|
+
/** `enabled` of each action by name; the name is also what its handler logs, with `at`. */
|
|
6
|
+
readonly actions: Readonly<Record<string, boolean>>;
|
|
7
|
+
}
|
|
8
|
+
export interface MenuActionVector {
|
|
9
|
+
readonly rule: string;
|
|
10
|
+
readonly groups: readonly MenuActionGroupSpec[];
|
|
11
|
+
/** The detailed action the one item names. */
|
|
12
|
+
readonly action: string;
|
|
13
|
+
readonly sensitive: boolean;
|
|
14
|
+
readonly fired: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export declare const MENU_ACTION_VECTORS: ReadonlyArray<MenuActionVector>;
|
|
17
|
+
export interface MenuActionScene {
|
|
18
|
+
/** A fresh chain: `outer` is the ROOT (the window) and `button` a descendant of it, and is where resolution starts. */
|
|
19
|
+
chain(): {
|
|
20
|
+
outer: object;
|
|
21
|
+
button: object;
|
|
22
|
+
};
|
|
23
|
+
/** Insert a group of `actions` (name → enabled) at `widget`; `onActivate` hears each activation by name. */
|
|
24
|
+
insertGroup(widget: object, prefix: string, actions: Readonly<Record<string, boolean>>, onActivate: (action: string) => void): void;
|
|
25
|
+
/** Whether an item naming `detailed` reads as sensitive from `button`. */
|
|
26
|
+
sensitive(button: object, detailed: string): boolean;
|
|
27
|
+
/** What choosing an item that names `detailed` does from `button`. */
|
|
28
|
+
activate(button: object, detailed: string): void;
|
|
29
|
+
}
|
|
30
|
+
/** The registry of ADR 0098 over a port's parent link: what the browser and NativeScript drive. */
|
|
31
|
+
export declare function registryMenuActionScene(chain: () => {
|
|
32
|
+
outer: object;
|
|
33
|
+
button: object;
|
|
34
|
+
}, parent: (node: object) => object | null | undefined): MenuActionScene;
|
|
35
|
+
/** Runs {@link MENU_ACTION_VECTORS} on a port's tree walk, or on GTK itself (the oracle). */
|
|
36
|
+
export declare function driveMenuActionVectors(name: string, scene: MenuActionScene, { describe, it, expect }: ConstructHarness): Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AdwMenuNode } from '../menu.js';
|
|
2
|
+
export interface MenuTreeVector {
|
|
3
|
+
readonly rule: string;
|
|
4
|
+
/** A `GtkMenuButton` tree. */
|
|
5
|
+
readonly tree: {
|
|
6
|
+
readonly tag: 'GtkMenuButton';
|
|
7
|
+
readonly props?: Record<string, string>;
|
|
8
|
+
readonly menus?: Record<string, readonly AdwMenuNode[]>;
|
|
9
|
+
readonly menuModels?: Record<string, readonly AdwMenuNode[]>;
|
|
10
|
+
};
|
|
11
|
+
/** The `kind` of each top-level node `menuModel` holds, or a fragment of the refusal. */
|
|
12
|
+
readonly result: {
|
|
13
|
+
readonly kinds: readonly string[];
|
|
14
|
+
} | {
|
|
15
|
+
readonly refused: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const MENU_TREE_VECTORS: ReadonlyArray<MenuTreeVector>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AdwMenuActions, AdwMenuInput } from '../menu.js';
|
|
2
|
+
export interface PopupMenuPlanVector {
|
|
3
|
+
readonly rule: string;
|
|
4
|
+
readonly input: AdwMenuInput;
|
|
5
|
+
readonly actions?: AdwMenuActions;
|
|
6
|
+
/** The groups, in order, as {@link popupMenuOutline} writes them. */
|
|
7
|
+
readonly outline: readonly string[];
|
|
8
|
+
/** The refusals by name; empty when the menu is renderable. */
|
|
9
|
+
readonly refused: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export declare const POPUP_MENU_PLAN_VECTORS: ReadonlyArray<PopupMenuPlanVector>;
|
|
12
|
+
interface OutlineLevel {
|
|
13
|
+
groups: ReadonlyArray<{
|
|
14
|
+
checkable: string;
|
|
15
|
+
entries: ReadonlyArray<{
|
|
16
|
+
kind: 'item';
|
|
17
|
+
title: string;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
checked: boolean;
|
|
20
|
+
role: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'submenu';
|
|
23
|
+
title: string;
|
|
24
|
+
level: OutlineLevel;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
/** The plan as the one-line-per-group text the vectors state. */
|
|
29
|
+
export declare function popupMenuOutline(level: OutlineLevel): string[];
|
|
30
|
+
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { AdwMenuNode } from '../menu.js';
|
|
2
|
+
/** One node of an authored menu: the normalised model of ADR 0042 (ADR 0097 § 1). */
|
|
3
|
+
export type MenuNodeShape = AdwMenuNode;
|
|
1
4
|
/**
|
|
2
5
|
* One node of an authored tree — the shape `ADWAITA_GALLERY_SHARED_TREES` is written in.
|
|
3
6
|
*
|
|
@@ -196,6 +199,16 @@ export interface SharedTreeNode {
|
|
|
196
199
|
* object back to the code beside the file; none of them is a child of the root.
|
|
197
200
|
*/
|
|
198
201
|
siblings?: readonly SharedTreeNode[];
|
|
202
|
+
/**
|
|
203
|
+
* Root only: the root `menu id { }` of the file, by id (ADR 0097 § 1). A `menu-model: id`
|
|
204
|
+
* property stays the scalar id; the builder resolves it here.
|
|
205
|
+
*/
|
|
206
|
+
menus?: Readonly<Record<string, readonly MenuNodeShape[]>>;
|
|
207
|
+
/**
|
|
208
|
+
* The menu written AT a property (`menu-model: menu { }`), by property name: the model itself,
|
|
209
|
+
* not an id into `menus` (ADR 0097 § 1).
|
|
210
|
+
*/
|
|
211
|
+
menuModels?: Readonly<Record<string, readonly MenuNodeShape[]>>;
|
|
199
212
|
children?: readonly SharedTreeNode[];
|
|
200
213
|
}
|
|
201
214
|
/**
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ConstructHarness } from './constructs.js';
|
|
2
|
+
export interface GioSimpleActionLike {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
connect(signal: 'activate', handler: () => void): number;
|
|
5
|
+
}
|
|
6
|
+
export interface SimpleActionGroupLike {
|
|
7
|
+
add_action(action: GioSimpleActionLike): void;
|
|
8
|
+
remove_action(name: string): void;
|
|
9
|
+
lookup_action(name: string): unknown;
|
|
10
|
+
has_action(name: string): boolean;
|
|
11
|
+
list_actions(): string[];
|
|
12
|
+
activate_action(name: string, parameter: null): unknown;
|
|
13
|
+
}
|
|
14
|
+
/** The part of `Gio` the vectors read. */
|
|
15
|
+
export interface GioActionsLike {
|
|
16
|
+
SimpleAction: new (props: {
|
|
17
|
+
name: string;
|
|
18
|
+
}) => GioSimpleActionLike;
|
|
19
|
+
SimpleActionGroup: new () => SimpleActionGroupLike;
|
|
20
|
+
}
|
|
21
|
+
export interface SimpleActionGroupSubject {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly isOracle: boolean;
|
|
24
|
+
readonly Gio: GioActionsLike;
|
|
25
|
+
}
|
|
26
|
+
export declare const SIMPLE_ACTION_GROUP_ROWS: readonly ["lookup", "replace", "list", "remove", "activate", "disabled", "unknown"];
|
|
27
|
+
export type SimpleActionGroupRow = (typeof SIMPLE_ACTION_GROUP_ROWS)[number];
|
|
28
|
+
export interface SimpleActionGroupVector {
|
|
29
|
+
readonly row: SimpleActionGroupRow;
|
|
30
|
+
readonly rule: string;
|
|
31
|
+
readonly observe: (subject: SimpleActionGroupSubject) => unknown;
|
|
32
|
+
readonly shows: unknown;
|
|
33
|
+
}
|
|
34
|
+
export declare const SIMPLE_ACTION_GROUP_VECTORS: readonly SimpleActionGroupVector[];
|
|
35
|
+
export declare function driveSimpleActionGroupVectors(subject: SimpleActionGroupSubject, harness: ConstructHarness, vectors?: readonly SimpleActionGroupVector[]): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ConstructHarness } from './constructs.js';
|
|
2
|
+
export interface StyleManagerLike {
|
|
3
|
+
readonly dark: boolean;
|
|
4
|
+
get_dark(): boolean;
|
|
5
|
+
connect(signal: string, handler: (manager: StyleManagerLike, pspec: {
|
|
6
|
+
name: string;
|
|
7
|
+
}) => void): number;
|
|
8
|
+
disconnect(id: number): void;
|
|
9
|
+
}
|
|
10
|
+
/** The part of `Adw` the vectors read. */
|
|
11
|
+
export interface AdwStyleLike {
|
|
12
|
+
StyleManager: {
|
|
13
|
+
get_default(): StyleManagerLike;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface StyleManagerSubject {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly isOracle: boolean;
|
|
19
|
+
readonly Adw: AdwStyleLike;
|
|
20
|
+
/** Makes the interface dark or light the way the subject's platform does. */
|
|
21
|
+
setDark(dark: boolean): void;
|
|
22
|
+
settle(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export declare const STYLE_MANAGER_ROWS: readonly ["default", "dark", "notify", "unchanged", "disconnect", "readonly"];
|
|
25
|
+
export type StyleManagerRow = (typeof STYLE_MANAGER_ROWS)[number];
|
|
26
|
+
export interface StyleManagerVector {
|
|
27
|
+
readonly row: StyleManagerRow;
|
|
28
|
+
readonly rule: string;
|
|
29
|
+
readonly observe: (subject: StyleManagerSubject) => unknown;
|
|
30
|
+
readonly shows: unknown;
|
|
31
|
+
}
|
|
32
|
+
export declare const STYLE_MANAGER_VECTORS: readonly StyleManagerVector[];
|
|
33
|
+
export declare function driveStyleManagerVectors(subject: StyleManagerSubject, harness: ConstructHarness, vectors?: readonly StyleManagerVector[]): Promise<void>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** `activate` handler: the action that fired and the caller's parameter (`null` when none). */
|
|
2
|
+
export type ActionActivateHandler = (action: SimpleAction, parameter: unknown) => void;
|
|
3
|
+
/** What a registry holds and a widget walk activates. */
|
|
4
|
+
export interface ActionLike {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
activate(parameter?: unknown): void;
|
|
8
|
+
}
|
|
9
|
+
/** What a group answers; `Gio.ActionMap` and the groups of `insertActionGroup` both do. */
|
|
10
|
+
export interface ActionGroupLike {
|
|
11
|
+
lookup_action(name: string): ActionLike | null;
|
|
12
|
+
}
|
|
13
|
+
export interface SimpleActionProps {
|
|
14
|
+
name: string;
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
/** Held, never checked: an action activates with whatever the caller passes. */
|
|
17
|
+
parameter_type?: unknown;
|
|
18
|
+
}
|
|
19
|
+
/** `Gio.SimpleAction`: `name`, `enabled`, the `activate` signal and `activate()`. */
|
|
20
|
+
export declare class SimpleAction implements ActionLike {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
readonly parameter_type: unknown;
|
|
24
|
+
private readonly _handlers;
|
|
25
|
+
private _nextId;
|
|
26
|
+
constructor(props: SimpleActionProps);
|
|
27
|
+
/** `g_signal_connect`. Only `activate` exists; any other name is refused rather than ignored. */
|
|
28
|
+
connect(signal: 'activate', handler: ActionActivateHandler): number;
|
|
29
|
+
disconnect(id: number): void;
|
|
30
|
+
/** `g_action_activate`. A disabled action swallows it, as GIO does. */
|
|
31
|
+
activate(parameter?: unknown): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `Gio.SimpleActionGroup`: `add_action` (an existing name is replaced), `lookup_action`, `has_action`,
|
|
35
|
+
* `list_actions`, `remove_action` and `activate_action`. `list_actions()` is in insertion order where
|
|
36
|
+
* GIO's hash order is unspecified, so a caller must not depend on either. `activate_action` takes the
|
|
37
|
+
* caller's parameter as is and answers whether an action of that name exists (GIO answers nothing);
|
|
38
|
+
* a disabled action swallows it. Not here: `change_action_state`, `query_action`, `add_action_entries`
|
|
39
|
+
* and the `action-added` / `action-removed` signals.
|
|
40
|
+
*/
|
|
41
|
+
export declare class SimpleActionGroup implements ActionGroupLike {
|
|
42
|
+
private readonly _actions;
|
|
43
|
+
add_action(action: SimpleAction): void;
|
|
44
|
+
remove_action(name: string): void;
|
|
45
|
+
lookup_action(name: string): SimpleAction | null;
|
|
46
|
+
has_action(name: string): boolean;
|
|
47
|
+
list_actions(): string[];
|
|
48
|
+
/** `g_action_group_activate_action`. False when no such action exists. */
|
|
49
|
+
activate_action(name: string, parameter?: unknown): boolean;
|
|
50
|
+
}
|
|
51
|
+
/** The registry behind `Gio.ActionMap` and `Gio.ActionGroup`. */
|
|
52
|
+
export declare class ActionRegistry implements ActionGroupLike {
|
|
53
|
+
private readonly _actions;
|
|
54
|
+
/** `g_action_map_add_action`: an existing name is replaced. */
|
|
55
|
+
add(action: ActionLike): void;
|
|
56
|
+
remove(name: string): void;
|
|
57
|
+
lookup_action(name: string): ActionLike | null;
|
|
58
|
+
has(name: string): boolean;
|
|
59
|
+
list(): string[];
|
|
60
|
+
}
|
|
61
|
+
/** The registry an owner (an application, a window) carries; made on first use. */
|
|
62
|
+
export declare function actionRegistryOf(owner: object, create?: boolean): ActionRegistry | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Gives a prototype `Gio.ActionMap` (`add_action`, `lookup_action`, `remove_action`) and, with
|
|
65
|
+
* `group`, `Gio.ActionGroup`. A window is an ActionMap only: its `activate_action` is the WIDGET's,
|
|
66
|
+
* which takes `win.x`, so the group half stays off it.
|
|
67
|
+
*/
|
|
68
|
+
export declare function installActionMap(proto: object, group?: boolean): void;
|
|
69
|
+
/** `gtk_widget_insert_action_group`: `group`'s actions resolve as `prefix.name` below `widget`. `null` removes it. */
|
|
70
|
+
export declare function insertActionGroup(widget: object, prefix: string, group: ActionGroupLike | null): void;
|
|
71
|
+
/** The application a window belongs to (`Gtk.Window:application`), or `null`. */
|
|
72
|
+
export declare function applicationOfWindow(window: object): ActionGroupLike | null;
|
|
73
|
+
/** Records or clears the application of a window. `Application.add_window` / `remove_window` call it. */
|
|
74
|
+
export declare function linkWindow(window: object, application: ActionGroupLike | null): void;
|
|
75
|
+
/**
|
|
76
|
+
* The group a widget finds for `prefix`: the nearest explicit group up the chain, the `win` actions
|
|
77
|
+
* of the first node that carries an ActionMap, and the application of the first node that is a window
|
|
78
|
+
* of one (`app`). A widget with no window above it finds none, which is not an empty group (ADR 0042 § 2).
|
|
79
|
+
*/
|
|
80
|
+
export declare function findActionGroup(widget: object, prefix: string, parent: (node: object) => object | null | undefined): ActionGroupLike | null;
|
|
81
|
+
/**
|
|
82
|
+
* What a `Gtk.Actionable` does when it fires: split `prefix.name`, find the group, activate. Returns
|
|
83
|
+
* whether an enabled action ran, so a caller can tell a wired button from a dangling name.
|
|
84
|
+
*/
|
|
85
|
+
export declare function activateWidgetAction(widget: object, fullName: string, parent: (node: object) => object | null | undefined, parameter?: unknown): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** `G_MAXUINT32`. */
|
|
2
|
+
export declare const MAXUINT32 = 4294967295;
|
|
3
|
+
/**
|
|
4
|
+
* `g_build_filenamev` on a POSIX host (separator `/`), ported line for line from `g_build_path_va`.
|
|
5
|
+
*
|
|
6
|
+
* At each boundary between two elements the trailing separators of the first and the leading ones of
|
|
7
|
+
* the second are dropped and exactly one is inserted. Empty elements are ignored. The result keeps as
|
|
8
|
+
* many leading separators as the first non-empty element had and as many trailing ones as the last had;
|
|
9
|
+
* separators INSIDE an element are left alone (`a//b` stays). Not `path.join`: that normalises `.`,
|
|
10
|
+
* `..` and inner runs, which GLib never does.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildFilenamev(elements: readonly string[]): string;
|
|
13
|
+
/** `g_get_current_dir` where the host has no working directory: the root. */
|
|
14
|
+
export declare function getCurrentDir(): string;
|
|
15
|
+
/** `g_get_system_data_dirs` where the host has no system data directories: none. */
|
|
16
|
+
export declare function getSystemDataDirs(): string[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** The slice of a host event loop the timers need. */
|
|
2
|
+
export interface TimerHost {
|
|
3
|
+
setTimeout(run: () => void, milliseconds: number): unknown;
|
|
4
|
+
clearTimeout(handle: unknown): void;
|
|
5
|
+
}
|
|
6
|
+
export type SourceFunc = () => boolean | void;
|
|
7
|
+
/** `GLib` as far as this subset goes. */
|
|
8
|
+
export interface GLibTimers {
|
|
9
|
+
readonly PRIORITY_HIGH: number;
|
|
10
|
+
readonly PRIORITY_DEFAULT: number;
|
|
11
|
+
readonly PRIORITY_HIGH_IDLE: number;
|
|
12
|
+
readonly PRIORITY_DEFAULT_IDLE: number;
|
|
13
|
+
readonly PRIORITY_LOW: number;
|
|
14
|
+
readonly SOURCE_REMOVE: boolean;
|
|
15
|
+
readonly SOURCE_CONTINUE: boolean;
|
|
16
|
+
idle_add(priority: number, run: SourceFunc): number;
|
|
17
|
+
timeout_add(priority: number, milliseconds: number, run: SourceFunc): number;
|
|
18
|
+
source_remove(sourceId: number): boolean;
|
|
19
|
+
}
|
|
20
|
+
/** One main context's worth of sources; the namespace object of a port is one of these. */
|
|
21
|
+
export declare function createGLibTimers(host?: TimerHost): GLibTimers;
|