@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,209 @@
|
|
|
1
|
+
import type { SharedTreeNode } from './conformance/shared-trees.js';
|
|
2
|
+
/** What `registerClass` accepts as `Template`: the projected tree of a `?template` import (ADR 0096 § 4). */
|
|
3
|
+
export type BlueprintTemplate = SharedTreeNode;
|
|
4
|
+
/** The subset asked for something it does not list. `feature` is the name that was refused. */
|
|
5
|
+
export declare class UnsupportedGObjectError extends Error {
|
|
6
|
+
readonly feature: string;
|
|
7
|
+
constructor(feature: string, message: string);
|
|
8
|
+
}
|
|
9
|
+
/** An opaque GType token: it names a type and proves nothing else. */
|
|
10
|
+
export interface GType {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const TYPE_STRING: GType;
|
|
14
|
+
export declare const TYPE_BOOLEAN: GType;
|
|
15
|
+
export declare const TYPE_INT: GType;
|
|
16
|
+
export declare const TYPE_UINT: GType;
|
|
17
|
+
export declare const TYPE_DOUBLE: GType;
|
|
18
|
+
export declare const ParamFlags: {
|
|
19
|
+
readonly READABLE: 1;
|
|
20
|
+
readonly WRITABLE: 2;
|
|
21
|
+
readonly READWRITE: 3;
|
|
22
|
+
readonly CONSTRUCT: 4;
|
|
23
|
+
readonly CONSTRUCT_ONLY: 8;
|
|
24
|
+
};
|
|
25
|
+
export type ParamKind = 'boolean' | 'string' | 'int' | 'uint' | 'double';
|
|
26
|
+
export declare class ParamSpec {
|
|
27
|
+
readonly kind: ParamKind;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly nick: string;
|
|
30
|
+
readonly blurb: string;
|
|
31
|
+
readonly flags: number;
|
|
32
|
+
readonly minimum?: number;
|
|
33
|
+
readonly maximum?: number;
|
|
34
|
+
private readonly defaultValue;
|
|
35
|
+
private constructor();
|
|
36
|
+
static boolean(name: string, nick: string, blurb: string, flags: number, defaultValue: boolean): ParamSpec;
|
|
37
|
+
static string(name: string, nick: string, blurb: string, flags: number, defaultValue: string | null): ParamSpec;
|
|
38
|
+
static int(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue: number): ParamSpec;
|
|
39
|
+
static uint(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue: number): ParamSpec;
|
|
40
|
+
static double(name: string, nick: string, blurb: string, flags: number, minimum: number, maximum: number, defaultValue: number): ParamSpec;
|
|
41
|
+
get_default_value(): unknown;
|
|
42
|
+
}
|
|
43
|
+
/** GJS's own symbols, so a class written in the field form (`static [GObject.properties] = …`) registers. */
|
|
44
|
+
export declare const META_SYMBOLS: {
|
|
45
|
+
readonly GTypeName: symbol;
|
|
46
|
+
readonly GTypeFlags: symbol;
|
|
47
|
+
readonly interfaces: symbol;
|
|
48
|
+
readonly properties: symbol;
|
|
49
|
+
readonly signals: symbol;
|
|
50
|
+
readonly requires: symbol;
|
|
51
|
+
readonly template: symbol;
|
|
52
|
+
readonly cssName: symbol;
|
|
53
|
+
readonly children: symbol;
|
|
54
|
+
readonly internalChildren: symbol;
|
|
55
|
+
};
|
|
56
|
+
/** What a port's widget tree gives back for one built template. */
|
|
57
|
+
export interface BuiltTemplate {
|
|
58
|
+
/** The children to attach to the host, in order. */
|
|
59
|
+
readonly children: readonly object[];
|
|
60
|
+
/** Every object the template names with an `id`, for `InternalChildren`. */
|
|
61
|
+
readonly objects: Readonly<Record<string, object>>;
|
|
62
|
+
}
|
|
63
|
+
export type BindingFlag = 'bidirectional' | 'sync-create' | 'invert-boolean';
|
|
64
|
+
export interface Binding {
|
|
65
|
+
unbind(): void;
|
|
66
|
+
}
|
|
67
|
+
/** What the builder of a port is handed: the instance, its handlers and the binding engine. */
|
|
68
|
+
export interface TemplateScope {
|
|
69
|
+
/** The template instance — the scope of every handler and the `template` bind source. */
|
|
70
|
+
readonly instance: object;
|
|
71
|
+
/** `_createClosure`: looked up on the instance, bound to `options.object` or the instance. */
|
|
72
|
+
handler(name: string, options?: {
|
|
73
|
+
object?: object;
|
|
74
|
+
flags?: readonly string[];
|
|
75
|
+
}): (...args: unknown[]) => unknown;
|
|
76
|
+
bind(source: GObjectInstance, sourceProperty: string, target: GObjectInstance, targetProperty: string, flags?: readonly BindingFlag[]): Binding;
|
|
77
|
+
}
|
|
78
|
+
/** The one thing a port implements over its widget model (ADR 0096 § 1). */
|
|
79
|
+
export interface GObjectDoor {
|
|
80
|
+
readonly name: string;
|
|
81
|
+
/** Dispatches the named event on a widget that is not the core's to dispatch. */
|
|
82
|
+
dispatch(target: object, event: string, args: readonly unknown[]): void;
|
|
83
|
+
/** Listens for it; the handler is called `(target, ...args)`. Returns the disconnect. */
|
|
84
|
+
listen(target: object, event: string, handler: (...args: unknown[]) => unknown): () => void;
|
|
85
|
+
/** Creates the widgets of a template, wiring signals and binds through `scope`. */
|
|
86
|
+
createFromTree(tree: BlueprintTemplate, scope: TemplateScope, host: object): BuiltTemplate;
|
|
87
|
+
/** Gives the built children to the host. A port may defer the attach to its own lifecycle. */
|
|
88
|
+
attach(host: object, built: BuiltTemplate): void;
|
|
89
|
+
/** A class was registered: the port defines its element and its `$GTypeName` template entry. */
|
|
90
|
+
register(klass: ClassLike, info: RegisteredClass): void;
|
|
91
|
+
}
|
|
92
|
+
export type ClassLike = abstract new (...args: never[]) => object;
|
|
93
|
+
export interface RegisteredClass {
|
|
94
|
+
readonly klass: ClassLike;
|
|
95
|
+
readonly typeName: string;
|
|
96
|
+
readonly gtype: GType;
|
|
97
|
+
readonly properties: readonly ParamSpec[];
|
|
98
|
+
/** Signal name → its parameter types. */
|
|
99
|
+
readonly signals: Readonly<Record<string, readonly GType[]>>;
|
|
100
|
+
readonly template?: BlueprintTemplate;
|
|
101
|
+
readonly internalChildren: readonly string[];
|
|
102
|
+
readonly cssName?: string;
|
|
103
|
+
readonly door: GObjectDoor;
|
|
104
|
+
}
|
|
105
|
+
export declare function registeredClassOf(klass: object): RegisteredClass | undefined;
|
|
106
|
+
export type SignalHandler = (emitter: GObjectInstance, ...args: unknown[]) => unknown;
|
|
107
|
+
/** The instance surface of a registered class (ADR 0096 § 2, "instance API" row). */
|
|
108
|
+
export interface GObjectInstance {
|
|
109
|
+
[key: string]: unknown;
|
|
110
|
+
notify(name: string): void;
|
|
111
|
+
connect(signal: string, handler: SignalHandler): number;
|
|
112
|
+
disconnect(id: number): void;
|
|
113
|
+
emit(signal: string, ...args: unknown[]): void;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* `GObject.signal_stop_emission_by_name`: stops the innermost emission in progress of the signal on the
|
|
117
|
+
* instance, so the handlers after the current one do not run. With none in progress GLib warns and
|
|
118
|
+
* does nothing (`g_signal_stop_emission`: "no emission of signal ... to stop").
|
|
119
|
+
*/
|
|
120
|
+
export declare function stopEmissionByName(instance: GObjectInstance, detailedSignal: string): void;
|
|
121
|
+
export declare function connectInstance(instance: GObjectInstance, signal: string, handler: SignalHandler): number;
|
|
122
|
+
export declare function disconnectInstance(instance: GObjectInstance, id: number): void;
|
|
123
|
+
export declare function emitInstance(instance: GObjectInstance, signal: string, ...args: unknown[]): void;
|
|
124
|
+
export declare function notifyInstance(instance: GObjectInstance, name: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* `g_object_bind_property` for the three flags the template builders need. The target follows the
|
|
127
|
+
* source on every `notify::<source property>`; `bidirectional` makes the source follow the target
|
|
128
|
+
* back, `invert-boolean` negates what crosses, `sync-create` transfers once at bind time.
|
|
129
|
+
*/
|
|
130
|
+
export declare function bindProperties(source: GObjectInstance, sourceProperty: string, target: GObjectInstance, targetProperty: string, flags?: readonly BindingFlag[]): Binding;
|
|
131
|
+
export declare function createClosure(thisArg: object, handlerName: string, swapped: boolean, connectObject?: object): (...args: unknown[]) => unknown;
|
|
132
|
+
/**
|
|
133
|
+
* Runs ADR 0096 § 3 steps 4–5 for a registered instance, in GJS's order: every template of the
|
|
134
|
+
* class chain is built first (base first), then the construct properties are set, and only then
|
|
135
|
+
* is each `InternalChildren` id installed as `this._<id>`. So `this._x` is `undefined` inside a
|
|
136
|
+
* property setter that runs during construction and defined once `super(params)` returns.
|
|
137
|
+
*
|
|
138
|
+
* Returns the params that are not declared properties, for the port's own construct bag.
|
|
139
|
+
*/
|
|
140
|
+
export declare function constructRegistered(instance: object, params?: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
141
|
+
export interface SignalMeta {
|
|
142
|
+
param_types?: readonly GType[];
|
|
143
|
+
[refused: string]: unknown;
|
|
144
|
+
}
|
|
145
|
+
export interface ClassMeta {
|
|
146
|
+
GTypeName?: string;
|
|
147
|
+
Template?: unknown;
|
|
148
|
+
InternalChildren?: readonly string[];
|
|
149
|
+
Properties?: Readonly<Record<string, ParamSpec>>;
|
|
150
|
+
Signals?: Readonly<Record<string, SignalMeta>>;
|
|
151
|
+
CssName?: string;
|
|
152
|
+
[refused: string]: unknown;
|
|
153
|
+
}
|
|
154
|
+
export interface RegisterClass {
|
|
155
|
+
<T extends ClassLike>(meta: ClassMeta, klass: T): T;
|
|
156
|
+
<T extends ClassLike>(klass: T): T;
|
|
157
|
+
}
|
|
158
|
+
/** A core class declares the GIR type its `vfunc_*` are listed under in {@link UNLOCKED_VFUNCS}. */
|
|
159
|
+
export declare const GIR_TYPE: unique symbol;
|
|
160
|
+
/**
|
|
161
|
+
* The `vfunc_*` a registered class may override (ADR 0098 § 1a), keyed by the GIR class that declares
|
|
162
|
+
* them. Every other `vfunc_*` is refused by name. An entry needs a vector of `APPLICATION_VECTORS`
|
|
163
|
+
* (`unlocks`) that holds on real GJS; `application.spec.ts` fails an entry without one.
|
|
164
|
+
*/
|
|
165
|
+
export declare const UNLOCKED_VFUNCS: Readonly<Record<string, readonly string[]>>;
|
|
166
|
+
/**
|
|
167
|
+
* Registers a core class that is no widget and has no template (`Gio.Application`), so its signals
|
|
168
|
+
* resolve through the registry like a registered class's own. The door is one that names the
|
|
169
|
+
* missing widget model: such a class has no event system to fall through to.
|
|
170
|
+
*/
|
|
171
|
+
export declare function registerBaseClass(klass: ClassLike, typeName: string, signals: Readonly<Record<string, readonly GType[]>>, properties?: readonly ParamSpec[]): void;
|
|
172
|
+
export type GObjectConstructor = new (params?: Record<string, unknown>) => GObjectInstance;
|
|
173
|
+
/** `GObject.Object` for a registered class with no widget model beneath it. */
|
|
174
|
+
export declare class GObjectObject {
|
|
175
|
+
[key: string]: unknown;
|
|
176
|
+
constructor(params?: Record<string, unknown>);
|
|
177
|
+
notify(name: string): void;
|
|
178
|
+
connect(signal: string, handler: SignalHandler): number;
|
|
179
|
+
disconnect(id: number): void;
|
|
180
|
+
emit(signal: string, ...args: unknown[]): void;
|
|
181
|
+
}
|
|
182
|
+
export interface GObjectNamespace {
|
|
183
|
+
readonly Object: GObjectConstructor;
|
|
184
|
+
readonly registerClass: RegisterClass;
|
|
185
|
+
readonly ParamSpec: typeof ParamSpec;
|
|
186
|
+
readonly ParamFlags: typeof ParamFlags;
|
|
187
|
+
readonly TYPE_STRING: GType;
|
|
188
|
+
readonly TYPE_BOOLEAN: GType;
|
|
189
|
+
readonly TYPE_INT: GType;
|
|
190
|
+
readonly TYPE_UINT: GType;
|
|
191
|
+
readonly TYPE_DOUBLE: GType;
|
|
192
|
+
readonly GTypeName: symbol;
|
|
193
|
+
readonly GTypeFlags: symbol;
|
|
194
|
+
readonly interfaces: symbol;
|
|
195
|
+
readonly properties: symbol;
|
|
196
|
+
readonly signals: symbol;
|
|
197
|
+
readonly requires: symbol;
|
|
198
|
+
readonly __gtkTemplate__: symbol;
|
|
199
|
+
readonly __gtkCssName__: symbol;
|
|
200
|
+
readonly __gtkChildren__: symbol;
|
|
201
|
+
readonly __gtkInternalChildren__: symbol;
|
|
202
|
+
type_ensure(gtype: GType): void;
|
|
203
|
+
signal_stop_emission_by_name(instance: GObjectInstance, detailedSignal: string): void;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The `GObject` namespace of a port: `registerClass` registers against `door`. There is no
|
|
207
|
+
* `bind_property` here until a consumer calls it (ADR 0096 § 2); the engine is {@link bindProperties}.
|
|
208
|
+
*/
|
|
209
|
+
export declare function createGObject(door: GObjectDoor): GObjectNamespace;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export type { BoxOrientation } from './box.js';
|
|
|
50
50
|
export { DEFAULT_LABEL_ELLIPSIZE, DEFAULT_LABEL_LINES, DEFAULT_LABEL_MAX_WIDTH_CHARS, DEFAULT_LABEL_WIDTH_CHARS, DEFAULT_LABEL_WRAP_MODE, DEFAULT_LABEL_XALIGN, DEFAULT_LABEL_YALIGN, LABEL_ELLIPSIZE_MODES, LABEL_JUSTIFICATIONS, LABEL_WRAP_MODES, labelDisplayText, labelEffectiveLines, labelEllipsizeOverflowValue, labelMarkupIsUnparseable, labelWidthCharsExtent, labelYalignAlignItems, normalizeLabelEllipsize, normalizeLabelJustify, normalizeLabelLines, normalizeLabelMaxWidthChars, normalizeLabelWidthChars, normalizeLabelWrapMode, normalizeLabelXalign, normalizeLabelYalign, } from './label.js';
|
|
51
51
|
export type { LabelAlignItems, LabelEllipsizeMode, LabelJustification, LabelWidthCharsExtent, LabelWrapMode, } from './label.js';
|
|
52
52
|
export { glibClamp, gStrStrip, stringIsNotEmpty } from './glib.js';
|
|
53
|
+
export { createGLibTimers } from './glib-timers.js';
|
|
54
|
+
export type { GLibTimers, SourceFunc, TimerHost } from './glib-timers.js';
|
|
53
55
|
export { ViewStackState, normalizeIconName, resolvePageTitle } from './view-stack.js';
|
|
54
56
|
export type { AdwViewStackPageInfo, AdwViewStackPageSpec, ViewStackStateChange, ViewStackStateListener, } from './view-stack.js';
|
|
55
57
|
export { BACK_BUTTON_FALLBACK_TOOLTIP, NavigationViewState, describeNavigationDiagnostic } from './navigation-view.js';
|
|
@@ -72,6 +74,11 @@ export type { AdwPackType, AdwTextDirection, NavigationActionInput, NavigationAc
|
|
|
72
74
|
export { DEFAULT_DROPDOWN_TOOLTIP, SPLIT_BUTTON_DISABLED_OPACITY, SplitButtonState, isSplitButtonDirection, menuButtonArrowIcon, menuButtonPopupDirection, resolveDropdownTooltip, splitButtonArrowIcon, splitButtonPopupDirection, splitButtonRootState, splitButtonStyleClasses, } from './split-button.js';
|
|
73
75
|
export type { AdwArrowIcon, SplitButtonChange, SplitButtonContentMode, SplitButtonDirection, SplitButtonHalfState, SplitButtonListener, SplitButtonProperty, SplitButtonStyleClass, } from './split-button.js';
|
|
74
76
|
export { GioMenu, GioMenuItem } from './gio-menu.js';
|
|
77
|
+
export { activateMenuItem, menuActionsFor } from './menu-actions.js';
|
|
78
|
+
export { assertPopupMenuPlan, planPopupMenu } from './popup-menu-plan.js';
|
|
79
|
+
export type { PopupMenuEntryPlan, PopupMenuGroupPlan, PopupMenuItemPlan, PopupMenuLevelPlan, PopupMenuPlan, PopupMenuRefusal, PopupMenuSubmenuPlan, } from './popup-menu-plan.js';
|
|
80
|
+
export { menuAssignments } from './menu-tree.js';
|
|
81
|
+
export type { MenuTreeNode } from './menu-tree.js';
|
|
75
82
|
export { ADW_MENU_SURFACE_NATIVESCRIPT, ADW_MENU_SURFACE_WEB, assertMenuRenderable, flattenMenu, menuItemAt, menuNodeAt, menuRefusals, normalizeMenuModel, parseDetailedAction, parseMenuModel, resolveMenuItemState, } from './menu.js';
|
|
76
83
|
export type { AdwDetailedAction, AdwMenuAction, AdwMenuActions, AdwMenuDisplayHint, AdwMenuEntryInput, AdwMenuFlatRow, AdwMenuHiddenWhen, AdwMenuInput, AdwMenuItem, AdwMenuItemInput, AdwMenuItemRole, AdwMenuItemState, AdwMenuModel, AdwMenuNode, AdwMenuPath, AdwMenuRefusal, AdwMenuSection, AdwMenuSectionInput, AdwMenuSubmenu, AdwMenuSubmenuInput, AdwMenuSurface, AdwMenuTextDirection, } from './menu.js';
|
|
77
84
|
export { DEFAULT_INDICATOR_DESCRIPTION_STRINGS, INLINE_VIEW_SWITCHER_DISPLAY_MODES, VIEW_SWITCHER_BADGE_LIMIT, VIEW_SWITCHER_DRAG_SWITCH_DELAY, VIEW_SWITCHER_FALLBACK_ICON, VIEW_SWITCHER_NO_SELECTION, VIEW_SWITCHER_POLICIES, ViewSwitcherBarState, ViewSwitcherDragSwitch, ViewSwitcherState, buildInlineToggles, buildViewSwitcherButtons, createViewSwitcherPage, inlineToggleTooltip, isInlineViewSwitcherDisplayMode, isViewSwitcherButtonVisible, isViewSwitcherPolicy, pageIndexForToggle, shouldRevealViewSwitcherBar, stripMnemonic, toggleIndexForPage, viewSwitcherBadgeLabel, viewSwitcherButtonOrientation, viewSwitcherIconName, viewSwitcherIndicatorDescription, viewSwitcherLabel, viewSwitcherPageFromStackPage, viewSwitcherPagesFromStack, viewSwitcherSidebarSections, } from './view-switcher.js';
|
|
@@ -101,3 +108,12 @@ export { ADW_WRAP_BOX_DEFAULT_ALIGN, ADW_WRAP_BOX_DEFAULT_JUSTIFY, ADW_WRAP_BOX_
|
|
|
101
108
|
export type { AdwWrapBoxJustify, AdwWrapBoxOrientation, AdwWrapBoxPackDirection, AdwWrapPolicy, WrapBoxChildFlex, WrapBoxChildOrderOp, WrapBoxFlexInput, WrapBoxFlexStyle, WrapBoxLineLayout, } from './wrap-box.js';
|
|
102
109
|
export { ADW_SOURCE_6502_DIRECTIVES, ADW_SOURCE_6502_LINE_COMMENT, ADW_SOURCE_6502_OPCODES, ADW_SOURCE_6502_REGISTERS, ADW_SOURCE_6502_TOKEN_ROLES, ADW_SOURCE_HEX_STRIDE, ADW_SOURCE_PALETTE_DARK, ADW_SOURCE_PALETTE_LIGHT, ADW_SOURCE_SYNTAX_ROLES, classifyAsm6502Word, formatHexAddress, formatLineNumber, stripSourceWhitespace, tokenizeAsm6502, } from './source.js';
|
|
103
110
|
export type { AdwSourcePalette, AdwSourceSyntaxRole, AdwSourceTokenClass, AdwSourceTokenStream } from './source.js';
|
|
111
|
+
export { GObjectObject, META_SYMBOLS, ParamFlags, ParamSpec, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_INT, TYPE_STRING, TYPE_UINT, UnsupportedGObjectError, bindProperties, connectInstance, constructRegistered, createClosure, createGObject, disconnectInstance, emitInstance, notifyInstance, registeredClassOf, registerBaseClass, UNLOCKED_VFUNCS, GIR_TYPE, } from './gobject.js';
|
|
112
|
+
export { ApplicationFlags, GioApplicationBase, GtkApplicationBase, withGtkApplication, isValidApplicationId, } from './application.js';
|
|
113
|
+
export type { ApplicationHost, GtkApplicationMembers, GtkApplicationConstructor } from './application.js';
|
|
114
|
+
export { ActionRegistry, SimpleAction, actionRegistryOf, activateWidgetAction, applicationOfWindow, findActionGroup, insertActionGroup, installActionMap, linkWindow, SimpleActionGroup, } from './gio-actions.js';
|
|
115
|
+
export type { ActionActivateHandler, ActionGroupLike, ActionLike, SimpleActionProps } from './gio-actions.js';
|
|
116
|
+
export type { Binding, BindingFlag, BlueprintTemplate, BuiltTemplate, ClassLike, ClassMeta, GObjectConstructor, GObjectDoor, GObjectInstance, GObjectNamespace, GType, ParamKind, RegisterClass, RegisteredClass, SignalHandler, SignalMeta, TemplateScope, } from './gobject.js';
|
|
117
|
+
export { MAXUINT32, buildFilenamev, getCurrentDir, getSystemDataDirs } from './glib-paths.js';
|
|
118
|
+
export { StyleManagerBase } from './style-manager.js';
|
|
119
|
+
export type { StyleSource } from './style-manager.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AdwMenuActions, AdwMenuModel, AdwMenuItem } from './menu.js';
|
|
2
|
+
type Parent = (node: object) => object | null | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* The actions the model's items name, as `widget` resolves them. An action the walk does not find,
|
|
5
|
+
* because no group has its prefix or the group lacks it, is left out, which is "missing" and makes
|
|
6
|
+
* the item insensitive. That is GTK's answer, measured on GJS (`menu-actions.gjs.spec.ts`), and it
|
|
7
|
+
* overrules ADR 0097 § 3's "no group dims nothing": an application that dispatches an action
|
|
8
|
+
* itself declares it, or passes `actions` to say what it knows.
|
|
9
|
+
*/
|
|
10
|
+
export declare function menuActionsFor(model: AdwMenuModel, widget: object, parent: Parent): AdwMenuActions;
|
|
11
|
+
/**
|
|
12
|
+
* Fire the action an item names, the way `GtkMenuTrackerItem` does on activation. A target is
|
|
13
|
+
* passed as its text: `GLib.Variant` is outside the subset until stage 3.
|
|
14
|
+
*/
|
|
15
|
+
export declare function activateMenuItem(item: AdwMenuItem, widget: object, parent: Parent): boolean;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AdwMenuModel } from './menu.js';
|
|
2
|
+
/** The slice of a tree node this reads. */
|
|
3
|
+
export interface MenuTreeNode {
|
|
4
|
+
readonly tag: string;
|
|
5
|
+
readonly props?: Readonly<Record<string, string | number | boolean>>;
|
|
6
|
+
readonly menuModels?: Readonly<Record<string, readonly unknown[]>>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The menus a node assigns, as `[property, model]`: the root menu `menu-model: id` names, and each
|
|
10
|
+
* model written at a property. An id with no root menu is refused by name.
|
|
11
|
+
*/
|
|
12
|
+
export declare function menuAssignments(node: MenuTreeNode, menus: Readonly<Record<string, readonly unknown[]>> | undefined): Array<[string, AdwMenuModel]>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AdwMenuActions, AdwMenuModel, AdwMenuPath } from './menu.js';
|
|
2
|
+
/** An item of the plan; `path` maps a tap back to the model. */
|
|
3
|
+
export interface PopupMenuItemPlan {
|
|
4
|
+
readonly kind: 'item';
|
|
5
|
+
readonly path: AdwMenuPath;
|
|
6
|
+
readonly title: string;
|
|
7
|
+
/** Shown disabled, not omitted: the dimmed row is the platform's own idiom (0097 § 2). */
|
|
8
|
+
readonly enabled: boolean;
|
|
9
|
+
/** CHECK items set it themselves; a RADIO item takes it from its exclusive group. */
|
|
10
|
+
readonly checkable: boolean;
|
|
11
|
+
readonly checked: boolean;
|
|
12
|
+
readonly role: 'normal' | 'check' | 'radio';
|
|
13
|
+
/** The action name without its target: the identity of a radio run. */
|
|
14
|
+
readonly action?: string;
|
|
15
|
+
}
|
|
16
|
+
/** A submenu: `Menu.addSubMenu`, whose items are a level of their own. */
|
|
17
|
+
export interface PopupMenuSubmenuPlan {
|
|
18
|
+
readonly kind: 'submenu';
|
|
19
|
+
readonly path: AdwMenuPath;
|
|
20
|
+
readonly title: string;
|
|
21
|
+
readonly level: PopupMenuLevelPlan;
|
|
22
|
+
}
|
|
23
|
+
export type PopupMenuEntryPlan = PopupMenuItemPlan | PopupMenuSubmenuPlan;
|
|
24
|
+
/** One `groupId`: a section, or the run of items outside any section. */
|
|
25
|
+
export interface PopupMenuGroupPlan {
|
|
26
|
+
/** `exclusive` is `setGroupCheckable(group, true, true)`; the flag is per group on Android. */
|
|
27
|
+
readonly checkable: 'none' | 'exclusive';
|
|
28
|
+
readonly entries: readonly PopupMenuEntryPlan[];
|
|
29
|
+
}
|
|
30
|
+
export interface PopupMenuLevelPlan {
|
|
31
|
+
readonly groups: readonly PopupMenuGroupPlan[];
|
|
32
|
+
}
|
|
33
|
+
/** What `PopupMenu` cannot express, by the name the diagnostic uses. */
|
|
34
|
+
export interface PopupMenuRefusal {
|
|
35
|
+
readonly what: 'custom' | 'section-label' | 'mixed-radio-section';
|
|
36
|
+
/** The item for `custom`, the section (or the submenu / root holding the loose items) otherwise. */
|
|
37
|
+
readonly path: AdwMenuPath;
|
|
38
|
+
readonly message: string;
|
|
39
|
+
}
|
|
40
|
+
export interface PopupMenuPlan {
|
|
41
|
+
readonly level: PopupMenuLevelPlan;
|
|
42
|
+
readonly refusals: readonly PopupMenuRefusal[];
|
|
43
|
+
}
|
|
44
|
+
/** Lower `model` for `PopupMenu`. `actions` is what {@link resolveMenuItemState} reads. */
|
|
45
|
+
export declare function planPopupMenu(model: AdwMenuModel, actions?: AdwMenuActions): PopupMenuPlan;
|
|
46
|
+
/** Throw naming every refusal, as `assertMenuRenderable` does for the sheet. */
|
|
47
|
+
export declare function assertPopupMenuPlan(plan: PopupMenuPlan): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GIR_TYPE, GObjectObject } from './gobject.js';
|
|
2
|
+
/** Where a platform reads "is the interface dark" and hears it change. */
|
|
3
|
+
export interface StyleSource {
|
|
4
|
+
dark(): boolean;
|
|
5
|
+
/** Calls `changed` whenever `dark()` may have changed; returns the unsubscribe. */
|
|
6
|
+
subscribe(changed: () => void): () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare class StyleManagerBase extends GObjectObject {
|
|
9
|
+
static [GIR_TYPE]: string;
|
|
10
|
+
static source: StyleSource | undefined;
|
|
11
|
+
static get_default(): StyleManagerBase;
|
|
12
|
+
get dark(): boolean;
|
|
13
|
+
get_dark(): boolean;
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.0",
|
|
4
4
|
"description": "Headless Adwaita widget behavior (breakpoint condition grammar + apply/unapply state machine, color-scheme observable, avatar derivation) shared by the web and NativeScript Adwaita renderers — pure TS, no platform imports",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"headless"
|
|
59
59
|
],
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@gjsify/cli": "^0.
|
|
62
|
-
"@gjsify/unit": "^0.
|
|
61
|
+
"@gjsify/cli": "^0.58.0",
|
|
62
|
+
"@gjsify/unit": "^0.58.0",
|
|
63
63
|
"@types/node": "^25.9.2",
|
|
64
64
|
"typescript": "^6.0.3"
|
|
65
65
|
},
|