@gjsify/adwaita-core 0.55.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/lib/esm/application.js +1 -0
- package/lib/esm/conformance/application.js +1 -0
- package/lib/esm/conformance/constructs.js +2 -2
- 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/shared-trees.js +1 -1
- package/lib/esm/gio-actions.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/markup.js +2 -2
- 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/tags.js +1 -1
- 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 +88 -0
- package/lib/types/conformance/constructs.d.ts +4 -3
- 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 +12 -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 +21 -1
- package/lib/types/gio-actions.d.ts +67 -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 +202 -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 +13 -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/tags.d.ts +43 -1
- package/package.json +3 -3
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,9 @@ 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, } 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';
|
|
@@ -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;
|
package/lib/types/tags.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare const attributeOf: (prop: string) => string;
|
|
|
37
37
|
*/
|
|
38
38
|
export declare const propertyOf: (name: string) => string;
|
|
39
39
|
/**
|
|
40
|
-
* `GtkWidget`'s four margins, as the CSS property each
|
|
40
|
+
* `GtkWidget`'s four margins, as the CSS property each is — `start`/`end` the LOGICAL
|
|
41
41
|
* edges `gtk_widget_set_margin_start` documents, `top`/`bottom` physical as in GTK.
|
|
42
42
|
*
|
|
43
43
|
* A markup renderer writes them as inline style, because an attribute cannot carry a length
|
|
@@ -46,3 +46,45 @@ export declare const propertyOf: (name: string) => string;
|
|
|
46
46
|
* `./markup.ts`, whose markup has to parse back to exactly what that builder made.
|
|
47
47
|
*/
|
|
48
48
|
export declare const GTK_WIDGET_MARGIN_CSS: Readonly<Record<string, string>>;
|
|
49
|
+
/**
|
|
50
|
+
* `GtkWidget:hexpand` / `vexpand`, the two booleans whose `false` is an AUTHORED answer: the
|
|
51
|
+
* attribute's absence says "not written", and a widget that expands by default
|
|
52
|
+
* (`<gtk-scrolled-window>`) needs the author's `false` to stop. A renderer writes `true` as
|
|
53
|
+
* the bare attribute and `false` as `hexpand="false"`, which the stylesheet reads.
|
|
54
|
+
*/
|
|
55
|
+
export declare const GTK_WIDGET_EXPAND: readonly ["hexpand", "vexpand"];
|
|
56
|
+
/**
|
|
57
|
+
* `GtkWidget:width-request` / `height-request`, as the CSS minimum each one is. A size request
|
|
58
|
+
* is a MINIMUM in GTK (`gtk_widget_set_size_request`: the widget is never measured below it,
|
|
59
|
+
* and its natural size still wins when larger), so `min-*` is the same sentence and `width`
|
|
60
|
+
* would claim an exactness GTK does not give. -1 is the pspec's "not set".
|
|
61
|
+
*/
|
|
62
|
+
export declare const GTK_WIDGET_SIZE_CSS: Readonly<Record<string, string>>;
|
|
63
|
+
/**
|
|
64
|
+
* The inline-style declaration an authored GtkWidget length property stands for, or
|
|
65
|
+
* `undefined` when `attribute` is not one. `null` is a size request of -1: the author said
|
|
66
|
+
* "unset", so nothing is written (and an earlier value is to be cleared).
|
|
67
|
+
*/
|
|
68
|
+
export declare function widgetLengthStyle(attribute: string, value: string | number | boolean): readonly [property: string, length: string | null] | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Kebab-case attribute names of GTK boolean properties that default to TRUE.
|
|
71
|
+
* These are VALUE-BASED: `attr="false"` means false, absent means true (the default).
|
|
72
|
+
* Style classes like `flat`/`round`/`compact` are PRESENCE-BASED and NOT in this set.
|
|
73
|
+
* ADR 0049, ADR 0034 own the presence vs. value split.
|
|
74
|
+
*
|
|
75
|
+
* @deprecated Use {@link isValueBasedBooleanAttr} instead. This flat set cannot express
|
|
76
|
+
* that the same attribute name (e.g. `revealed`) is value-based for one widget
|
|
77
|
+
* (`gtk-action-bar`) but presence-based for another (`adw-banner`).
|
|
78
|
+
*/
|
|
79
|
+
export declare const VALUE_BASED_BOOLEAN_ATTRS: Set<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the given attribute on the given widget tag is VALUE-BASED.
|
|
82
|
+
*
|
|
83
|
+
* Value-based means: `attr="false"` spells false, absent spells the default (TRUE).
|
|
84
|
+
* Presence-based means: the attribute's PRESENCE spells true, absence spells false.
|
|
85
|
+
*
|
|
86
|
+
* @param tagName The element's tag name (e.g. `adw-banner`, `gtk-action-bar`).
|
|
87
|
+
* @param attrName The kebab-case attribute name (e.g. `revealed`, `can-pop`).
|
|
88
|
+
* @returns True if the attribute should be written as `attr="true"|"false"`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function isValueBasedBooleanAttr(tagName: string, attrName: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.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.57.0",
|
|
62
|
+
"@gjsify/unit": "^0.57.0",
|
|
63
63
|
"@types/node": "^25.9.2",
|
|
64
64
|
"typescript": "^6.0.3"
|
|
65
65
|
},
|