@gjsify/gtk-host 0.51.1 → 0.53.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/README.md +207 -7
- package/lib/esm/accessibility.js +1 -0
- package/lib/esm/conformance/at-context.js +1 -0
- package/lib/esm/conformance/index.js +1 -1
- package/lib/esm/conformance/shared-tree-builder.js +1 -0
- package/lib/esm/errors.js +1 -1
- package/lib/esm/fonts.js +1 -1
- package/lib/esm/generated/accessibility.js +1 -0
- package/lib/esm/host.js +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/menu.js +1 -1
- package/lib/esm/policies.js +1 -1
- package/lib/esm/props.js +1 -1
- package/lib/esm/registry.js +1 -1
- package/lib/types/accessibility.d.ts +56 -0
- package/lib/types/accessibility.spec.d.ts +2 -0
- package/lib/types/attrs.d.ts +15 -2
- package/lib/types/conformance/at-context.d.ts +31 -0
- package/lib/types/conformance/index.d.ts +2 -0
- package/lib/types/conformance/nick-vectors.d.mts +26 -0
- package/lib/types/conformance/shared-tree-builder.d.ts +26 -0
- package/lib/types/errors.d.ts +80 -1
- package/lib/types/font-dir.d.ts +5 -3
- package/lib/types/fonts.d.ts +29 -3
- package/lib/types/generated/accessibility.d.ts +208 -0
- package/lib/types/generated/enum-values.d.mts +1 -1
- package/lib/types/generated/props.d.ts +3310 -186
- package/lib/types/generated/surface-data.d.mts +10 -0
- package/lib/types/generated/value-types.d.mts +28 -0
- package/lib/types/generator/emit-types.d.mts +22 -0
- package/lib/types/generator/model.d.mts +20 -0
- package/lib/types/host.d.ts +26 -0
- package/lib/types/index.d.ts +3 -3
- package/lib/types/policies.d.ts +58 -1
- package/lib/types/props.d.ts +32 -5
- package/lib/types/react-jsx-runtime.d.ts +3 -3
- package/lib/types/registry.d.ts +54 -0
- package/lib/types/testing/gate.d.mts +3 -3
- package/lib/types/types.d.ts +66 -0
- package/package.json +20 -17
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import GObject from 'gi://GObject?version=2.0';
|
|
2
|
+
import type { AriaTable } from './types.js';
|
|
3
|
+
/** What `accessibility={{ … }}` carries. Keys are ARIA names; `null` clears a slot. */
|
|
4
|
+
export type AccessibilityInput = Readonly<Record<string, unknown>>;
|
|
5
|
+
interface AriaWrite {
|
|
6
|
+
readonly table: AriaTable;
|
|
7
|
+
readonly member: number;
|
|
8
|
+
readonly value: GObject.Value;
|
|
9
|
+
}
|
|
10
|
+
interface AriaReset {
|
|
11
|
+
readonly table: AriaTable;
|
|
12
|
+
readonly member: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Everything the three GTK calls need, resolved and refused BEFORE the first one runs.
|
|
16
|
+
*
|
|
17
|
+
* Built whole, then applied, for the same reason `setProp` validates before recording:
|
|
18
|
+
* a refusal half-way through would leave the widget carrying some of the authored
|
|
19
|
+
* accessibility and the element carrying all of it, and the next patch would compute its
|
|
20
|
+
* resets against a state that never existed.
|
|
21
|
+
*/
|
|
22
|
+
export interface AccessibilityPlan {
|
|
23
|
+
readonly writes: readonly AriaWrite[];
|
|
24
|
+
readonly resets: readonly AriaReset[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolve an authored accessibility object against the one it replaces.
|
|
28
|
+
*
|
|
29
|
+
* Total: every name is looked up, every value is built, and anything GTK would take
|
|
30
|
+
* silently and wrongly throws here instead. Nothing touches a widget.
|
|
31
|
+
*/
|
|
32
|
+
export declare function planAccessibility(tag: string, previous: AccessibilityInput | null, next: AccessibilityInput | null): AccessibilityPlan;
|
|
33
|
+
/**
|
|
34
|
+
* Run a plan against a widget, one `update_*` call per table.
|
|
35
|
+
*
|
|
36
|
+
* BATCHED PER TABLE because that is the shape of the call: `gtk_accessible_update_state`
|
|
37
|
+
* takes parallel arrays and applies them together, so three names in one table are one
|
|
38
|
+
* call and one notification rather than three.
|
|
39
|
+
*
|
|
40
|
+
* The method names are DERIVED from the table name (`GtkAccessibleState` -> `update_state`),
|
|
41
|
+
* which is why `girs-vocabulary.mts` refuses a table it does not know rather than emitting
|
|
42
|
+
* its names: a derived call into a method GTK never installed is a `TypeError` in the middle
|
|
43
|
+
* of a render. `generated.spec.ts` holds all six derived names against the installed GTK.
|
|
44
|
+
*/
|
|
45
|
+
export declare function applyAccessibilityPlan(widget: GObject.Object, plan: AccessibilityPlan): void;
|
|
46
|
+
/**
|
|
47
|
+
* Whether a class can carry accessibility at all.
|
|
48
|
+
*
|
|
49
|
+
* Asked of the CLASS, before the widget exists, so `<gtk-string-list accessibility={…}>`
|
|
50
|
+
* is refused at the call that authored it rather than at materialisation. Not every row of
|
|
51
|
+
* the generated table is a widget — the list carriers are `GObject`s that hold one — and
|
|
52
|
+
* `Gtk.StringList` has no `update_property` at all (measured), which would otherwise be a
|
|
53
|
+
* `TypeError` naming a method instead of a tag.
|
|
54
|
+
*/
|
|
55
|
+
export declare const isAccessibleClass: (klass: GObject.ObjectClass) => boolean;
|
|
56
|
+
export {};
|
package/lib/types/attrs.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type Gio from '@girs/gio-2.0';
|
|
|
2
2
|
import type GObject from '@girs/gobject-2.0';
|
|
3
3
|
import type Gtk from '@girs/gtk-4.0';
|
|
4
4
|
import type { AdwAdjustmentInput, AdwListModelInput, AdwMenuInput } from '@gjsify/adwaita-core';
|
|
5
|
+
import type { AccessibilityAttributes } from './generated/accessibility.js';
|
|
5
6
|
import type { HostNode } from './types.js';
|
|
6
7
|
/**
|
|
7
8
|
* A `notify::` handler.
|
|
@@ -61,6 +62,18 @@ export type WithOnce<T> = T & {
|
|
|
61
62
|
export interface SlotAttribute {
|
|
62
63
|
slot?: string | null;
|
|
63
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* GTK's ARIA surface, on every element of every dialect. Read by `setAccessibility()`.
|
|
67
|
+
*
|
|
68
|
+
* ONE OBJECT, not 53 flat `aria*` props, and the four reasons are in `setAccessibility`'s
|
|
69
|
+
* own header — the load-bearing one being that TypeScript exempts a hyphenated JSX
|
|
70
|
+
* attribute from excess-property checking while a key in a fresh object literal is
|
|
71
|
+
* checked. `AccessibilityAttributes` is GENERATED, because the names and their value
|
|
72
|
+
* types are GTK's and are stated nowhere a ParamSpec can be read from.
|
|
73
|
+
*/
|
|
74
|
+
export interface AccessibilityAttribute {
|
|
75
|
+
accessibility?: AccessibilityAttributes | null;
|
|
76
|
+
}
|
|
64
77
|
/**
|
|
65
78
|
* The `on:<raw-signal-name>` escape hatch, typed.
|
|
66
79
|
*
|
|
@@ -87,7 +100,7 @@ export interface RawSignalAttributes {
|
|
|
87
100
|
* `T` is the widget's own instance type, so `ref={(el) => …}` infers `el` as
|
|
88
101
|
* `Gtk.Box` rather than the `unknown` a DOM renderer settles for.
|
|
89
102
|
*/
|
|
90
|
-
export interface JsxAttributes<T> extends SlotAttribute, RawSignalAttributes {
|
|
103
|
+
export interface JsxAttributes<T> extends AccessibilityAttribute, SlotAttribute, RawSignalAttributes {
|
|
91
104
|
children?: ElementChild;
|
|
92
105
|
ref?: T | ((el: T) => void) | undefined;
|
|
93
106
|
}
|
|
@@ -100,7 +113,7 @@ export interface JsxAttributes<T> extends SlotAttribute, RawSignalAttributes {
|
|
|
100
113
|
* leave the property unusable, so the Vue surface adds only what Vue does not —
|
|
101
114
|
* and `children` is a SLOT in Vue, never a prop.
|
|
102
115
|
*/
|
|
103
|
-
export interface VueAttributes extends SlotAttribute, RawSignalAttributes {
|
|
116
|
+
export interface VueAttributes extends AccessibilityAttribute, SlotAttribute, RawSignalAttributes {
|
|
104
117
|
}
|
|
105
118
|
/**
|
|
106
119
|
* The properties whose GObject type is a `GMenuModel`, in both spellings.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type Gtk from '@girs/gtk-4.0';
|
|
2
|
+
/**
|
|
3
|
+
* Give this process an in-process accessibility backend, before anything asks for one.
|
|
4
|
+
*
|
|
5
|
+
* OVERWRITE is deliberate: CI sets `GTK_A11Y=none` explicitly, and honouring it would
|
|
6
|
+
* keep the vectors measuring an absent layer rather than the code under test.
|
|
7
|
+
*
|
|
8
|
+
* AND THE ORDER IS LOAD-BEARING, which is why this belongs at a test ENTRY POINT and
|
|
9
|
+
* not beside a `Gtk.init()`. GTK reads the variable lazily but exactly ONCE, at the
|
|
10
|
+
* first `get_at_context()`, and caches the answer — measured on gtk 4.22.5 starting
|
|
11
|
+
* from `GTK_A11Y=none`: set after `Gtk.init()` and before any widget is asked for its
|
|
12
|
+
* context, `test` takes; set after ONE widget has been asked, the answer is `null`
|
|
13
|
+
* forever. A module body runs after every `import` above it, so an entry point is
|
|
14
|
+
* early enough only for as long as nothing it imports touches an AT context while
|
|
15
|
+
* being evaluated. {@link withAtContext} is what NAMES the day that stops being true.
|
|
16
|
+
*/
|
|
17
|
+
export declare function installAccessibilityBackend(): void;
|
|
18
|
+
/**
|
|
19
|
+
* The widget, or a refusal that says why an ARIA assertion about it cannot mean anything.
|
|
20
|
+
*
|
|
21
|
+
* A THROW rather than an `expect`, because the SENTENCE is the whole value here. Without
|
|
22
|
+
* it the symptom is `Expected: true (boolean) / Actual: false (boolean)`, six times over,
|
|
23
|
+
* on three OS legs at once — and that shape reads as a marshalling defect in whichever
|
|
24
|
+
* runtime those legs happen to share. It is not one; it is this.
|
|
25
|
+
*
|
|
26
|
+
* It also guards the assertions that expect FALSE, and those are the ones that make this
|
|
27
|
+
* a gate rather than a nicety: with no AT context they pass VACUOUSLY. A reset vector, a
|
|
28
|
+
* "nothing was authored here" vector — every one of them is green against a layer that
|
|
29
|
+
* was never there.
|
|
30
|
+
*/
|
|
31
|
+
export declare function withAtContext<T extends Gtk.Accessible>(widget: T): T;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { describeLogRecord, installDiagnosticsGate, isEnvironmentDiagnostic, type DiagnosticsGate, } from './diagnostics.js';
|
|
2
2
|
export { windowChromeCensus, windowChromeProblems, type WindowChromeCensus } from './window-chrome.js';
|
|
3
|
+
export { buildSharedTree } from './shared-tree-builder.js';
|
|
4
|
+
export { installAccessibilityBackend, withAtContext } from './at-context.js';
|
|
3
5
|
import type Gtk from '@girs/gtk-4.0';
|
|
4
6
|
import type { ChildPolicy, HostElement, NodePlacement, WidgetDescriptor } from '../types.js';
|
|
5
7
|
/** Every method name a policy names, so the check does not have to know the shapes. */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** What GObject must end up holding, or the refusal that must reach the caller. */
|
|
2
|
+
export type NickOutcome = {
|
|
3
|
+
readonly holds: number;
|
|
4
|
+
} | {
|
|
5
|
+
readonly refuses: string;
|
|
6
|
+
};
|
|
7
|
+
export interface NickVector {
|
|
8
|
+
/** What this row is about — a failing row prints it. */
|
|
9
|
+
readonly what: string;
|
|
10
|
+
readonly tag: string;
|
|
11
|
+
/** Kebab, as GObject knows the property. */
|
|
12
|
+
readonly prop: string;
|
|
13
|
+
/** What a template, a JSX file or a renderer writes. */
|
|
14
|
+
readonly authored: string | number;
|
|
15
|
+
readonly outcome: NickOutcome;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Every edge of nick resolution, against four bitfields and three enums.
|
|
19
|
+
*
|
|
20
|
+
* MORE THAN ONE BITFIELD TYPE ON PURPOSE. `GtkInputHints` alone would prove the
|
|
21
|
+
* parser and nothing about the JOIN that finds it: the type surface reaches a
|
|
22
|
+
* bitfield through `PROP_ENUMS`, keyed by the DECLARING type, so a property inherited
|
|
23
|
+
* from an interface (`GtkEditable`) and one declared on the class itself take
|
|
24
|
+
* different routes to the same answer.
|
|
25
|
+
*/
|
|
26
|
+
export declare const NICK_VECTORS: readonly NickVector[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SharedTreeNode } from '@gjsify/adwaita-core/conformance';
|
|
2
|
+
import type { HostElement } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A `SharedTreeNode`, realised: a tag, its authored properties, its placement, its children,
|
|
5
|
+
* in that order.
|
|
6
|
+
*
|
|
7
|
+
* Recursive and total — no tag list, no property list, no per-block case. The authored
|
|
8
|
+
* property NAMES go to `setProp` verbatim (through `createElement`), which is the point:
|
|
9
|
+
* `buttonLabel` reaching `button-label` is the host's own coercion, and a caller spelling the
|
|
10
|
+
* GObject name itself would be testing its own translation table instead of this one's.
|
|
11
|
+
*
|
|
12
|
+
* `built` COLLECTS THE ELEMENTS THIS CALL CREATED, in authored order, for a caller that has to
|
|
13
|
+
* tell them from the widgets libadwaita built AROUND them. Filtering a realised tree by CLASS
|
|
14
|
+
* cannot: the moment a corpus block authored a `GtkButton`, `AdwEntryRow`'s own apply button
|
|
15
|
+
* answered to the same name and the walk read one node too many. Identity is the only filter
|
|
16
|
+
* that stays right as the corpus grows, and only the builder knows it.
|
|
17
|
+
*
|
|
18
|
+
* THE SLOT GOES THROUGH THE SAME DOOR, and it is not a table here either. `setProp(el,
|
|
19
|
+
* 'slot', …)` is `setSlot`, and every framework adapter in this package already writes a
|
|
20
|
+
* `slot=` attribute through it; placement is then the parent descriptor's `ChildPolicy`,
|
|
21
|
+
* which refuses a name the parent has no destination for BY NAME. This builder read `tag`,
|
|
22
|
+
* `props` and `children` and dropped `slot` silently until a real `.blp` authored one — a
|
|
23
|
+
* `[top]` header bar landed in the content and the window title was then discarded by the
|
|
24
|
+
* bar's own construction, at exit 0.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildSharedTree(node: SharedTreeNode, built?: HostElement[]): HostElement;
|
package/lib/types/errors.d.ts
CHANGED
|
@@ -16,6 +16,25 @@ export declare class GtkHostError extends Error {
|
|
|
16
16
|
}
|
|
17
17
|
export declare const err: {
|
|
18
18
|
unknownTag: (tag: string) => GtkHostError;
|
|
19
|
+
/**
|
|
20
|
+
* A row of the table naming a class the RUNNING typelib does not carry.
|
|
21
|
+
*
|
|
22
|
+
* The one absence a version cannot explain. The table is generated from one
|
|
23
|
+
* platform's GIR, and a platform does not BUILD every class GTK describes:
|
|
24
|
+
* the Unix print stack is `#ifdef`-ed out on Windows, so its two dialogs are
|
|
25
|
+
* in the GIR and in no `Gtk-4.0.typelib` that a Windows build produces. The
|
|
26
|
+
* generated half is a claim about a library release, not about this host, so
|
|
27
|
+
* the row is right and the class is not here — and `GtkPageSetupUnixDialog`
|
|
28
|
+
* is NOT the whole shape of the failure, because the next absent class is not
|
|
29
|
+
* spelled "Unix" either.
|
|
30
|
+
*
|
|
31
|
+
* So nothing in this host dereferences a row's class before asking: the
|
|
32
|
+
* refusal names the tag instead of letting `undefined.list_properties()` or
|
|
33
|
+
* `undefined.$gtype` report a defect against whatever row the caller happened
|
|
34
|
+
* to be walking. Same shape as `unknownTag` — a tag this process cannot
|
|
35
|
+
* honour is refused BY NAME, because GTK's own failure mode here is silence.
|
|
36
|
+
*/
|
|
37
|
+
absentClass: (gtype: string) => GtkHostError;
|
|
19
38
|
missingConstructProp: (tag: string, prop: string) => GtkHostError;
|
|
20
39
|
unknownProp: (tag: string, prop: string) => GtkHostError;
|
|
21
40
|
readOnlyProp: (tag: string, prop: string) => GtkHostError;
|
|
@@ -35,6 +54,38 @@ export declare const err: {
|
|
|
35
54
|
*/
|
|
36
55
|
listModelMismatch: (tag: string, prop: string, gtypeName: string) => GtkHostError;
|
|
37
56
|
badAdjustment: (tag: string, prop: string, got: string) => GtkHostError;
|
|
57
|
+
/**
|
|
58
|
+
* The `accessibility` prop given something that is not an object of ARIA names.
|
|
59
|
+
*
|
|
60
|
+
* One grouped prop, so the shape of the value is the first thing that can be wrong —
|
|
61
|
+
* and a string or an array would reach `Object.entries` and produce refusals about
|
|
62
|
+
* index names rather than about the prop.
|
|
63
|
+
*/
|
|
64
|
+
badAccessibility: (tag: string, got: string) => GtkHostError;
|
|
65
|
+
unknownAria: (tag: string, name: string) => GtkHostError;
|
|
66
|
+
/**
|
|
67
|
+
* An ARIA name the SHIPPED table has and the INSTALLED GTK does not.
|
|
68
|
+
*
|
|
69
|
+
* The same version-gap question the generated widget table answers with `SINCE`, on the
|
|
70
|
+
* one axis where GTK's own failure is worst: `update_property` with an out-of-range
|
|
71
|
+
* member emits `gtk_accessible_value_collect_for_property_value: assertion failed`, then
|
|
72
|
+
* `gtk_accessible_attribute_set_remove: assertion failed`, and exits 0 (measured).
|
|
73
|
+
*/
|
|
74
|
+
ariaNotInstalled: (tag: string, name: string, table: string) => GtkHostError;
|
|
75
|
+
badAriaValue: (tag: string, name: string, wants: string, got: string) => GtkHostError;
|
|
76
|
+
badAriaEnum: (tag: string, name: string, nick: string, gtypeName: string) => GtkHostError;
|
|
77
|
+
/**
|
|
78
|
+
* A relation whose value is another widget — the one part of GTK's ARIA surface this
|
|
79
|
+
* host cannot express, named rather than half-built.
|
|
80
|
+
*
|
|
81
|
+
* `Gtk.AccessibleList.new_from_list([widget])` builds exactly the value GTK wants, so
|
|
82
|
+
* the MARSHALLING is not what is missing: the ADDRESSING is. This host has no `id` prop,
|
|
83
|
+
* and `ref` is resolved by each framework AFTER the props of the element that names it
|
|
84
|
+
* are applied — so a ref read at this point is null on the render that authored it, and
|
|
85
|
+
* GTK takes a null reference at exit 0.
|
|
86
|
+
*/
|
|
87
|
+
ariaReference: (tag: string, name: string) => GtkHostError;
|
|
88
|
+
notAccessible: (tag: string) => GtkHostError;
|
|
38
89
|
badEnum: (tag: string, prop: string, nick: string, gtypeName: string) => GtkHostError;
|
|
39
90
|
unknownSignal: (tag: string, prop: string, signal: string) => GtkHostError;
|
|
40
91
|
signalTaken: (tag: string, prop: string, other: string, signal: string) => GtkHostError;
|
|
@@ -54,10 +105,38 @@ export declare const err: {
|
|
|
54
105
|
eventModifier: (prop: string, modifier: string) => GtkHostError;
|
|
55
106
|
badString: (tag: string, prop: string, got: string) => GtkHostError;
|
|
56
107
|
badBoolean: (tag: string, prop: string, value: string) => GtkHostError;
|
|
108
|
+
/**
|
|
109
|
+
* A MEMBER of a flags value that names nothing — not the value as a whole.
|
|
110
|
+
*
|
|
111
|
+
* This used to refuse every string on a flags property, because resolving a nick
|
|
112
|
+
* set was nothing GObject exposed. GTK's `.ui` parser does resolve one, so what is
|
|
113
|
+
* left to refuse is the typo inside a set that otherwise reads fine, and the
|
|
114
|
+
* message has to name the SET as well as the type: `"spellcheck|lowecase"` fails
|
|
115
|
+
* on one member, and reporting only the type sends a reader looking at the wrong
|
|
116
|
+
* half of their own string.
|
|
117
|
+
*/
|
|
57
118
|
badFlags: (tag: string, prop: string, value: string, gtypeName: string) => GtkHostError;
|
|
58
|
-
|
|
119
|
+
/**
|
|
120
|
+
* The one flags input GTK's own parser answers SILENTLY, so this host does not.
|
|
121
|
+
*
|
|
122
|
+
* Measured on GTK 4.22.4: `""` and `" "` both parse to `[true, 0]`, and a leading
|
|
123
|
+
* empty member is dropped without a word. Zero is a legal flags value, so the
|
|
124
|
+
* caller gets every flag cleared, no diagnostic and exit 0 — while `"a||b"` and
|
|
125
|
+
* `"a|"` do raise. Refusing all of them by one name keeps the stray separator a
|
|
126
|
+
* spelling mistake rather than a value.
|
|
127
|
+
*/
|
|
128
|
+
blankFlags: (tag: string, prop: string, value: string, gtypeName: string) => GtkHostError;
|
|
59
129
|
textNotAccepted: (tag: string, text: string) => GtkHostError;
|
|
60
130
|
unclaimedChild: (parentTag: string, childTag: string) => GtkHostError;
|
|
131
|
+
/**
|
|
132
|
+
* A placement the parent has no destination for.
|
|
133
|
+
*
|
|
134
|
+
* The EMPTY case is the common one and it used to print `Known slots: .` — `ordered`,
|
|
135
|
+
* `indexed` and `none` parents declare no slot names at all, and those are exactly the
|
|
136
|
+
* parents a stray `slot=` lands on. A reader needs "this parent has none" to act; a
|
|
137
|
+
* trailing full stop after nothing reads like the message was cut off. Both other
|
|
138
|
+
* renderers already spell it out, so this is also what makes the three agree.
|
|
139
|
+
*/
|
|
61
140
|
unknownSlot: (parentTag: string, slot: string, known: string[]) => GtkHostError;
|
|
62
141
|
/**
|
|
63
142
|
* An adder-backed slot with nothing that takes the child back out.
|
package/lib/types/font-dir.d.ts
CHANGED
|
@@ -54,9 +54,11 @@ export declare function resolveFontSources(options?: ResolveFontSourcesOptions):
|
|
|
54
54
|
* which is the only party that knows whether the payload became `/usr`, a `--prefix` tree, `/app`,
|
|
55
55
|
* a bundle's `Contents/Resources` or a Windows program directory.
|
|
56
56
|
*
|
|
57
|
-
* There is NO system fallback,
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* There is NO system fallback, on ANY platform — where `resolveLocaleDir` keeps one for Linux,
|
|
58
|
+
* whose `/usr/share/locale` default is there both correct and free (it has none for darwin or
|
|
59
|
+
* win32, which have no such directory). The analogous
|
|
60
|
+
* `/usr/share/fonts` is correct on no platform: fontconfig has already scanned it, so walking it
|
|
61
|
+
* again would add
|
|
60
62
|
* hundreds of `add_font_file` calls to every startup to arrive at families the font map holds
|
|
61
63
|
* anyway. `undefined` therefore means "this application ships no faces of its own" — the ordinary
|
|
62
64
|
* case, and a quiet one, because the launcher exports the variable only when it staged a face.
|
package/lib/types/fonts.d.ts
CHANGED
|
@@ -133,6 +133,17 @@ export interface InitFontsResult {
|
|
|
133
133
|
* the map holds afterwards, which is what a match reads.
|
|
134
134
|
*/
|
|
135
135
|
readonly matches: readonly FontFamilyMatch[];
|
|
136
|
+
/**
|
|
137
|
+
* `true` when this call REPLACED the process's default font map with a fontconfig-backed one
|
|
138
|
+
* so the faces could be registered at all — see {@link adoptFontconfigMap}.
|
|
139
|
+
*
|
|
140
|
+
* Reported because it is a whole-application consequence of one call: every widget created
|
|
141
|
+
* afterwards renders through FreeType instead of the platform rasteriser. It happens only
|
|
142
|
+
* where the default map DECLINED registration (a CoreText map — `gjsify run` on a Homebrew
|
|
143
|
+
* GTK), the faces brought a family that map does not already hold, fontconfig has a
|
|
144
|
+
* configuration of its own, and nobody pinned `PANGOCAIRO_BACKEND` (ADR 0038 § Amendment 5).
|
|
145
|
+
*/
|
|
146
|
+
readonly fontconfigFallback: boolean;
|
|
136
147
|
}
|
|
137
148
|
/**
|
|
138
149
|
* Did the font map decline runtime registration outright?
|
|
@@ -150,11 +161,26 @@ export interface InitFontsResult {
|
|
|
150
161
|
* Keyed on the ERROR rather than on `process.platform`, which is the difference between a
|
|
151
162
|
* capability test and a guess about who is asking. It costs no `gjsify.os` declaration (this
|
|
152
163
|
* package makes no OS decision, and ADR 0018's candidate set is derived from the code that reads
|
|
153
|
-
* the host), it stays right
|
|
154
|
-
*
|
|
155
|
-
*
|
|
164
|
+
* the host), and it stays right for any other map that declines. The OS name was never the thing
|
|
165
|
+
* being asked — which stopped being hypothetical: the backend is whichever one is selected rather
|
|
166
|
+
* than one per platform, and `@gjsify/node-gi`'s loader selects `PANGOCAIRO_BACKEND=fc` on the
|
|
167
|
+
* bundled windowing runtime (ADR 0038 § Amendment 3), so a darwin process on it reaches this
|
|
168
|
+
* arm's other side and REGISTERS the faces. A `process.platform` branch would have had to be
|
|
169
|
+
* found and reversed instead.
|
|
156
170
|
*/
|
|
157
171
|
export declare function isUnsupportedByFontMap(error: unknown): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* `CAIRO_FONT_TYPE_FT` from `cairo.h` — the value `pango_cairo_font_map_new_for_font_type()` maps
|
|
174
|
+
* to its fontconfig backend.
|
|
175
|
+
*
|
|
176
|
+
* A literal rather than `gi://cairo`'s `FontType.FT`: this module runs on both legs (GJS and
|
|
177
|
+
* `@gjsify/node-gi`), and the enum is part of cairo's ABI, so importing a fourth namespace to
|
|
178
|
+
* spell one stable integer would add a load-time dependency for nothing.
|
|
179
|
+
*
|
|
180
|
+
* Exported so `fonts.spec.ts`'s independent probe spells the SAME integer rather than a second
|
|
181
|
+
* literal that could drift from this one silently — see § duplication instead of a helper.
|
|
182
|
+
*/
|
|
183
|
+
export declare const CAIRO_FONT_TYPE_FT = 1;
|
|
158
184
|
/**
|
|
159
185
|
* Register every face in the application's shipped font directory with the default font map.
|
|
160
186
|
*
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type Gtk from '@girs/gtk-4.0';
|
|
2
|
+
import type { AriaSlot } from '../types.js';
|
|
3
|
+
import type { GtkAccessibleAutocompleteNick, GtkAccessibleInvalidStateNick, GtkAccessibleSortNick, GtkAccessibleTristateNick, GtkOrientationNick } from './props.js';
|
|
4
|
+
/**
|
|
5
|
+
* ARIA name -> the table it belongs to and the kind of value GTK collects for it.
|
|
6
|
+
*
|
|
7
|
+
* Keyed by the NAME alone: across the three tables of this GTK the names are distinct,
|
|
8
|
+
* and `girs-vocabulary.mts` fails the generation rather than emit a map that silently
|
|
9
|
+
* kept one of two. The table name is what the runtime derives its GTK call from.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ARIA_SLOTS: Readonly<Record<string, AriaSlot>>;
|
|
12
|
+
/**
|
|
13
|
+
* What `accessibility={{ … }}` accepts.
|
|
14
|
+
*
|
|
15
|
+
* ONE OBJECT PROP, NOT 53 FLAT ONES, and the decision is measured rather than
|
|
16
|
+
* stylistic. Measured in this repo's own type surface: TypeScript exempts every
|
|
17
|
+
* hyphen-containing JSX attribute from excess-property checking, so a flat `aria-labell`
|
|
18
|
+
* would be accepted in silence, while a key inside a FRESH object literal is checked —
|
|
19
|
+
* `accessibility={{ labell: 'x' }}` is TS2561, naming the key and suggesting `label`. A grouped
|
|
20
|
+
* prop is also the spelling the other surface over this same vocabulary has: a `.blp` author
|
|
21
|
+
* writes `accessibility { label: "…"; }`, and ADR 0034 exists so two surfaces over one
|
|
22
|
+
* vocabulary do not invent two spellings for one name.
|
|
23
|
+
*
|
|
24
|
+
* KEBAB, THE SPELLING GTK ITSELF USES. A second camelCase spelling would double the
|
|
25
|
+
* surface for nothing: unlike a JSX attribute, a quoted key in an object literal IS
|
|
26
|
+
* excess-property checked, so the one spelling already catches the typo.
|
|
27
|
+
*
|
|
28
|
+
* `null` clears a slot, as it does for every property on this host — `gtk_accessible_reset_*`
|
|
29
|
+
* is what GTK offers and what the host calls.
|
|
30
|
+
*/
|
|
31
|
+
export interface AccessibilityAttributes {
|
|
32
|
+
/**
|
|
33
|
+
* `GtkAccessibleRelation.active-descendant` — a REFERENCE to another widget, and this host has no way
|
|
34
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
35
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
36
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
37
|
+
*/
|
|
38
|
+
'active-descendant'?: never;
|
|
39
|
+
/** `GtkAccessibleProperty.autocomplete` — a GtkAccessibleAutocomplete, which GTK collects as an int: the nick or the constant. */
|
|
40
|
+
autocomplete?: GtkAccessibleAutocompleteNick | Gtk.AccessibleAutocomplete | null;
|
|
41
|
+
/** `GtkAccessibleState.busy` — GTK collects it as a boolean. */
|
|
42
|
+
busy?: boolean | null;
|
|
43
|
+
/** `GtkAccessibleState.checked` — a GtkAccessibleTristate, which GTK collects as an int: the nick or the constant. */
|
|
44
|
+
checked?: GtkAccessibleTristateNick | Gtk.AccessibleTristate | null;
|
|
45
|
+
/** `GtkAccessibleRelation.col-count` — GTK collects it as an integer. */
|
|
46
|
+
'col-count'?: number | null;
|
|
47
|
+
/** `GtkAccessibleRelation.col-index` — GTK collects it as an integer. */
|
|
48
|
+
'col-index'?: number | null;
|
|
49
|
+
/** `GtkAccessibleRelation.col-index-text` — GTK collects it as a string. */
|
|
50
|
+
'col-index-text'?: string | null;
|
|
51
|
+
/** `GtkAccessibleRelation.col-span` — GTK collects it as an integer. */
|
|
52
|
+
'col-span'?: number | null;
|
|
53
|
+
/**
|
|
54
|
+
* `GtkAccessibleRelation.controlled-by` — a REFERENCE to another widget, and this host has no way
|
|
55
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
56
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
57
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
58
|
+
*/
|
|
59
|
+
'controlled-by'?: never;
|
|
60
|
+
/**
|
|
61
|
+
* `GtkAccessibleRelation.controls` — a REFERENCE to another widget, and this host has no way
|
|
62
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
63
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
64
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
65
|
+
*/
|
|
66
|
+
controls?: never;
|
|
67
|
+
/**
|
|
68
|
+
* `GtkAccessibleRelation.described-by` — a REFERENCE to another widget, and this host has no way
|
|
69
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
70
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
71
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
72
|
+
*/
|
|
73
|
+
'described-by'?: never;
|
|
74
|
+
/** `GtkAccessibleProperty.description` — GTK collects it as a string. */
|
|
75
|
+
description?: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* `GtkAccessibleRelation.description-for` — a REFERENCE to another widget, and this host has no way
|
|
78
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
79
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
80
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
81
|
+
*/
|
|
82
|
+
'description-for'?: never;
|
|
83
|
+
/**
|
|
84
|
+
* `GtkAccessibleRelation.details` — a REFERENCE to another widget, and this host has no way
|
|
85
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
86
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
87
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
88
|
+
*/
|
|
89
|
+
details?: never;
|
|
90
|
+
/**
|
|
91
|
+
* `GtkAccessibleRelation.details-for` — a REFERENCE to another widget, and this host has no way
|
|
92
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
93
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
94
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
95
|
+
*/
|
|
96
|
+
'details-for'?: never;
|
|
97
|
+
/** `GtkAccessibleState.disabled` — GTK collects it as a boolean. */
|
|
98
|
+
disabled?: boolean | null;
|
|
99
|
+
/**
|
|
100
|
+
* `GtkAccessibleRelation.error-message` — a REFERENCE to another widget, and this host has no way
|
|
101
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
102
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
103
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
104
|
+
*/
|
|
105
|
+
'error-message'?: never;
|
|
106
|
+
/**
|
|
107
|
+
* `GtkAccessibleRelation.error-message-for` — a REFERENCE to another widget, and this host has no way
|
|
108
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
109
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
110
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
111
|
+
*/
|
|
112
|
+
'error-message-for'?: never;
|
|
113
|
+
/** `GtkAccessibleState.expanded` — GTK collects it as a boolean. */
|
|
114
|
+
expanded?: boolean | null;
|
|
115
|
+
/**
|
|
116
|
+
* `GtkAccessibleRelation.flow-from` — a REFERENCE to another widget, and this host has no way
|
|
117
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
118
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
119
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
120
|
+
*/
|
|
121
|
+
'flow-from'?: never;
|
|
122
|
+
/**
|
|
123
|
+
* `GtkAccessibleRelation.flow-to` — a REFERENCE to another widget, and this host has no way
|
|
124
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
125
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
126
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
127
|
+
*/
|
|
128
|
+
'flow-to'?: never;
|
|
129
|
+
/** `GtkAccessibleProperty.has-popup` — GTK collects it as a boolean. */
|
|
130
|
+
'has-popup'?: boolean | null;
|
|
131
|
+
/** `GtkAccessibleProperty.help-text` — GTK collects it as a string. */
|
|
132
|
+
'help-text'?: string | null;
|
|
133
|
+
/** `GtkAccessibleState.hidden` — GTK collects it as a boolean. */
|
|
134
|
+
hidden?: boolean | null;
|
|
135
|
+
/** `GtkAccessibleState.invalid` — a GtkAccessibleInvalidState, which GTK collects as an int: the nick or the constant. */
|
|
136
|
+
invalid?: GtkAccessibleInvalidStateNick | Gtk.AccessibleInvalidState | null;
|
|
137
|
+
/** `GtkAccessibleProperty.key-shortcuts` — GTK collects it as a string. */
|
|
138
|
+
'key-shortcuts'?: string | null;
|
|
139
|
+
/** `GtkAccessibleProperty.label` — GTK collects it as a string. */
|
|
140
|
+
label?: string | null;
|
|
141
|
+
/**
|
|
142
|
+
* `GtkAccessibleRelation.label-for` — a REFERENCE to another widget, and this host has no way
|
|
143
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
144
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
145
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
146
|
+
*/
|
|
147
|
+
'label-for'?: never;
|
|
148
|
+
/**
|
|
149
|
+
* `GtkAccessibleRelation.labelled-by` — a REFERENCE to another widget, and this host has no way
|
|
150
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
151
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
152
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
153
|
+
*/
|
|
154
|
+
'labelled-by'?: never;
|
|
155
|
+
/** `GtkAccessibleProperty.level` — GTK collects it as an integer. */
|
|
156
|
+
level?: number | null;
|
|
157
|
+
/** `GtkAccessibleProperty.modal` — GTK collects it as a boolean. */
|
|
158
|
+
modal?: boolean | null;
|
|
159
|
+
/** `GtkAccessibleProperty.multi-line` — GTK collects it as a boolean. */
|
|
160
|
+
'multi-line'?: boolean | null;
|
|
161
|
+
/** `GtkAccessibleProperty.multi-selectable` — GTK collects it as a boolean. */
|
|
162
|
+
'multi-selectable'?: boolean | null;
|
|
163
|
+
/** `GtkAccessibleProperty.orientation` — a GtkOrientation, which GTK collects as an int: the nick or the constant. */
|
|
164
|
+
orientation?: GtkOrientationNick | Gtk.Orientation | null;
|
|
165
|
+
/**
|
|
166
|
+
* `GtkAccessibleRelation.owns` — a REFERENCE to another widget, and this host has no way
|
|
167
|
+
* to name one. There is no `id` prop and `ref` is resolved by the framework after the
|
|
168
|
+
* props are applied, so the value would be `null` on the render that authors it. Declared
|
|
169
|
+
* and unwritable rather than absent: GTK has this name, the gap is ours.
|
|
170
|
+
*/
|
|
171
|
+
owns?: never;
|
|
172
|
+
/** `GtkAccessibleProperty.placeholder` — GTK collects it as a string. */
|
|
173
|
+
placeholder?: string | null;
|
|
174
|
+
/** `GtkAccessibleRelation.pos-in-set` — GTK collects it as an integer. */
|
|
175
|
+
'pos-in-set'?: number | null;
|
|
176
|
+
/** `GtkAccessibleState.pressed` — a GtkAccessibleTristate, which GTK collects as an int: the nick or the constant. */
|
|
177
|
+
pressed?: GtkAccessibleTristateNick | Gtk.AccessibleTristate | null;
|
|
178
|
+
/** `GtkAccessibleProperty.read-only` — GTK collects it as a boolean. */
|
|
179
|
+
'read-only'?: boolean | null;
|
|
180
|
+
/** `GtkAccessibleProperty.required` — GTK collects it as a boolean. */
|
|
181
|
+
required?: boolean | null;
|
|
182
|
+
/** `GtkAccessibleProperty.role-description` — GTK collects it as a string. */
|
|
183
|
+
'role-description'?: string | null;
|
|
184
|
+
/** `GtkAccessibleRelation.row-count` — GTK collects it as an integer. */
|
|
185
|
+
'row-count'?: number | null;
|
|
186
|
+
/** `GtkAccessibleRelation.row-index` — GTK collects it as an integer. */
|
|
187
|
+
'row-index'?: number | null;
|
|
188
|
+
/** `GtkAccessibleRelation.row-index-text` — GTK collects it as a string. */
|
|
189
|
+
'row-index-text'?: string | null;
|
|
190
|
+
/** `GtkAccessibleRelation.row-span` — GTK collects it as an integer. */
|
|
191
|
+
'row-span'?: number | null;
|
|
192
|
+
/** `GtkAccessibleState.selected` — GTK collects it as a boolean. */
|
|
193
|
+
selected?: boolean | null;
|
|
194
|
+
/** `GtkAccessibleRelation.set-size` — GTK collects it as an integer. */
|
|
195
|
+
'set-size'?: number | null;
|
|
196
|
+
/** `GtkAccessibleProperty.sort` — a GtkAccessibleSort, which GTK collects as an int: the nick or the constant. */
|
|
197
|
+
sort?: GtkAccessibleSortNick | Gtk.AccessibleSort | null;
|
|
198
|
+
/** `GtkAccessibleProperty.value-max` — GTK collects it as a double. */
|
|
199
|
+
'value-max'?: number | null;
|
|
200
|
+
/** `GtkAccessibleProperty.value-min` — GTK collects it as a double. */
|
|
201
|
+
'value-min'?: number | null;
|
|
202
|
+
/** `GtkAccessibleProperty.value-now` — GTK collects it as a double. */
|
|
203
|
+
'value-now'?: number | null;
|
|
204
|
+
/** `GtkAccessibleProperty.value-text` — GTK collects it as a string. */
|
|
205
|
+
'value-text'?: string | null;
|
|
206
|
+
/** `GtkAccessibleState.visited` — GTK collects it as a boolean. */
|
|
207
|
+
visited?: boolean | null;
|
|
208
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* A value, not only a header comment: `generated.spec.ts` compares it with the
|
|
6
6
|
* running library to decide whether a disagreement is a defect or a version gap.
|
|
7
7
|
*/
|
|
8
|
-
export declare const VALUES_PROVENANCE = "Adw-1/1.9.3 Gtk-4.0/4.22.4 Pango-1.0/1.57.1";
|
|
8
|
+
export declare const VALUES_PROVENANCE = "Adw-1/1.9.3 Gio-2.0 Gtk-4.0/4.22.4 Pango-1.0/1.57.1";
|
|
9
9
|
/** `<enum GType>.<nick>` -> the integer the library registers for it. */
|
|
10
10
|
export declare const ENUM_VALUES: Readonly<Record<string, number>>;
|
|
11
11
|
/**
|