@gjsify/gtk-host 0.51.1 → 0.52.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 +154 -1
- 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/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/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 +61 -1
- package/lib/types/font-dir.d.ts +5 -3
- package/lib/types/fonts.d.ts +6 -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 +1 -1
- package/lib/types/policies.d.ts +58 -1
- package/lib/types/props.d.ts +10 -5
- package/lib/types/react-jsx-runtime.d.ts +2 -2
- package/lib/types/types.d.ts +52 -0
- package/package.json +17 -15
|
@@ -6,6 +6,16 @@ export declare const OWN_SIGNALS: Readonly<Record<string, readonly string[]>>;
|
|
|
6
6
|
export declare const DECLS: Readonly<Record<string, readonly string[]>>;
|
|
7
7
|
/** Enum GType -> the nicks the surface offers. */
|
|
8
8
|
export declare const ENUM_NICKS: Readonly<Record<string, readonly string[]>>;
|
|
9
|
+
/**
|
|
10
|
+
* Bitfield GType -> the member nicks the surface offers, for the bitfields a property
|
|
11
|
+
* of this surface carries.
|
|
12
|
+
*
|
|
13
|
+
* Derived from `FLAG_VALUES`' KEYS rather than from a nick list, because `@girs`
|
|
14
|
+
* publishes none for a bitfield — GObject resolves no nick SET, so the vocabulary says
|
|
15
|
+
* nothing about sets and the members keep their names in the value table. Held against
|
|
16
|
+
* the installed library the same way `ENUM_NICKS` is.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FLAG_NICKS: Readonly<Record<string, readonly string[]>>;
|
|
9
19
|
/** Widget GType -> its kebab tag. */
|
|
10
20
|
export declare const TAGS: Readonly<Record<string, string>>;
|
|
11
21
|
/**
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The libraries these rows were read from, in the same provenance grammar
|
|
3
|
+
* `methods.mts` uses so one parser reads both lines.
|
|
4
|
+
*/
|
|
5
|
+
export declare const VALUE_TYPES_PROVENANCE = "Adw-1/1.9.3 Gio-2.0 Gtk-4.0/4.22.5";
|
|
6
|
+
/**
|
|
7
|
+
* `<Namespace>.<Member>` -> what the typelib says that type is.
|
|
8
|
+
*
|
|
9
|
+
* One row per entry of `CONSTRUCTIBLE_VALUES` in `scripts/value-types.mjs`: the ledger is
|
|
10
|
+
* the INPUT, this is the answer. `gtype` is the GType the class registers; `widget` is
|
|
11
|
+
* whether its declared parent chain reaches `GtkWidget`, and a `true` here is the
|
|
12
|
+
* finding the whole ledger is guarded for — a widget excused as a value would be the
|
|
13
|
+
* second place a widget is declared.
|
|
14
|
+
*/
|
|
15
|
+
export declare const VALUE_TYPES: Readonly<Record<string, {
|
|
16
|
+
gtype: string;
|
|
17
|
+
widget: boolean;
|
|
18
|
+
}>>;
|
|
19
|
+
/**
|
|
20
|
+
* `<Namespace>.<Member>` -> the loaded typelib that declares no such GObject.
|
|
21
|
+
*
|
|
22
|
+
* The declared remainder, so "every ledger entry has an answer" can be a rule rather than
|
|
23
|
+
* a hope: a member in NEITHER table is a ledger the artifact predates, and the gate says
|
|
24
|
+
* so instead of passing over it. An entry here is a ledger entry that is simply wrong —
|
|
25
|
+
* unlike the sibling artifacts' remainders, it cannot be a version gap, because nothing
|
|
26
|
+
* in this repository may excuse a member whose type the installed GIR has never heard of.
|
|
27
|
+
*/
|
|
28
|
+
export declare const VALUE_TYPES_UNDECLARED: Readonly<Record<string, string>>;
|
|
@@ -40,6 +40,28 @@ export interface EmittedFile {
|
|
|
40
40
|
readonly text: string;
|
|
41
41
|
}
|
|
42
42
|
export declare function emitProps(model: SurfaceModel, provenance: string): EmittedFile;
|
|
43
|
+
/**
|
|
44
|
+
* Emit GTK's ARIA surface: the slot table the runtime reads, and the props interface.
|
|
45
|
+
*
|
|
46
|
+
* WHY THIS FILE EXISTS AND `props.ts` COULD NOT CARRY IT. Every other name a renderer can
|
|
47
|
+
* write on a widget is a GObject property, and the host resolves those through the
|
|
48
|
+
* ParamSpec of the INSTALLED class — the table travels with the package, the coercion
|
|
49
|
+
* travels with the user's GTK. An ARIA slot has no ParamSpec. `GtkAccessible` installs
|
|
50
|
+
* exactly one property, `accessible-role`; the other 53 names live in three ENUMS and are
|
|
51
|
+
* written through three calls, and the value type of each is stated only in that enum
|
|
52
|
+
* member's GIR DOCUMENTATION. So the type has to SHIP, and this is the one generated file
|
|
53
|
+
* whose data the runtime cannot re-derive from the object in front of it.
|
|
54
|
+
*
|
|
55
|
+
* WHY THE TABLE AND THE INTERFACE ARE IN ONE FILE. They are the two halves of one answer
|
|
56
|
+
* and they are keyed identically; split, the day a GTK release adds a name is the day the
|
|
57
|
+
* type surface and the runtime refusal disagree about whether it exists.
|
|
58
|
+
*
|
|
59
|
+
* THE FLOOR IS THE LOAD-BEARING GATE, as it is in `emit.mts`: a reader that silently
|
|
60
|
+
* yields three rows and a generator reporting success over it look identical, and here
|
|
61
|
+
* an under-read does not fail loudly downstream — it emits a smaller vocabulary, and
|
|
62
|
+
* every name it dropped becomes `unknown-aria` at a user's call site.
|
|
63
|
+
*/
|
|
64
|
+
export declare function emitAccessibility(model: SurfaceModel, provenance: string, floor?: number): EmittedFile;
|
|
43
65
|
/**
|
|
44
66
|
* Emit the data the runtime cross-check reads.
|
|
45
67
|
*
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* of that format instead of two. Only the shape survived, which is why the file is
|
|
15
15
|
* `model.mts` and no longer `surface.mts`: `surface` now names the `@girs` subpath.
|
|
16
16
|
*/
|
|
17
|
+
import type { AriaSlot } from '../types.js';
|
|
17
18
|
import type { WidgetRow } from './emit.mjs';
|
|
18
19
|
export interface PropMember {
|
|
19
20
|
readonly kebab: string;
|
|
@@ -75,9 +76,28 @@ export interface SurfaceModel {
|
|
|
75
76
|
readonly closure: ReadonlyMap<string, readonly string[]>;
|
|
76
77
|
/** Enum GType -> nicks, for the emitted aliases and for the runtime nick check. */
|
|
77
78
|
readonly enumNicks: ReadonlyMap<string, readonly string[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Bitfield GType -> member nicks, for the bitfields this surface's properties carry.
|
|
81
|
+
*
|
|
82
|
+
* Separate from `enumNicks`, because the two answer different questions and one map
|
|
83
|
+
* would hide it: an enum property takes ONE nick, so the union IS the type, while a
|
|
84
|
+
* bitfield property takes a `|`-joined SET and the union is only its members.
|
|
85
|
+
* `emit-types.mts` renders each kind accordingly.
|
|
86
|
+
*/
|
|
87
|
+
readonly flagNicks: ReadonlyMap<string, readonly string[]>;
|
|
78
88
|
readonly namespacesUsed: ReadonlySet<string>;
|
|
79
89
|
/** Namespace -> the `@girs` package that types it, so the emitter needs no second source. */
|
|
80
90
|
readonly packages: Readonly<Record<string, string>>;
|
|
91
|
+
/**
|
|
92
|
+
* ARIA name -> its table, value kind and enum, merged over every vocabulary read.
|
|
93
|
+
*
|
|
94
|
+
* Keyed by the NAME alone, not by `<table>.<name>` the way `@girs` keys it, and that
|
|
95
|
+
* is a measured property rather than a convenience: across the three tables of gtk4
|
|
96
|
+
* 4.23.3 the 53 names are distinct, so one authored key can only ever mean one slot.
|
|
97
|
+
* `girs-vocabulary.mts` re-checks it on every run, because the day GTK adds a name a
|
|
98
|
+
* second table already carries, a map would silently keep one of the two.
|
|
99
|
+
*/
|
|
100
|
+
readonly aria: ReadonlyMap<string, AriaSlot>;
|
|
81
101
|
/**
|
|
82
102
|
* Base -> members it must not contribute, because a nearer declaration disagrees.
|
|
83
103
|
*
|
package/lib/types/host.d.ts
CHANGED
|
@@ -21,6 +21,32 @@ export declare const isText: (node: HostNode) => node is HostText;
|
|
|
21
21
|
export declare function materialize(el: HostElement): GObject.Object;
|
|
22
22
|
export declare function setProp(el: HostElement, key: string, next: unknown, _prev?: unknown): void;
|
|
23
23
|
export declare function setEventHandler(el: HostElement, prop: string, next: ((...args: unknown[]) => unknown) | null): void;
|
|
24
|
+
/**
|
|
25
|
+
* The ARIA object, diffed against the one it replaces.
|
|
26
|
+
*
|
|
27
|
+
* ONE GROUPED PROP RATHER THAN 53 FLAT `aria*` ONES, and the reasons are measured rather
|
|
28
|
+
* than aesthetic. (1) TypeScript exempts every hyphen-containing JSX attribute from
|
|
29
|
+
* excess-property checking — the measurement `emit-types.mts` already records for the
|
|
30
|
+
* kebab property spellings — so a flat `aria-labell` would be accepted in silence, while a
|
|
31
|
+
* key inside a fresh object literal IS checked. (2) The ARIA names are not the widget's
|
|
32
|
+
* properties and collide with them: `label`, `orientation`, `checked`, `expanded` and
|
|
33
|
+
* `selected` are all both, and `orientation` is settable on a `GtkLabel` that implements no
|
|
34
|
+
* `GtkOrientable` at all — one object keeps the two vocabularies apart by construction
|
|
35
|
+
* instead of by prefix. (3) The other surface over this same vocabulary already spells it
|
|
36
|
+
* this way: a `.blp` author writes `accessibility { label: "…"; }` (ADR 0034). (4) `setProp`
|
|
37
|
+
* already has this shape for `layout` — a structured, non-ParamSpec prop routed to its own
|
|
38
|
+
* mechanism — so this adds one reserved key to the host, not 53.
|
|
39
|
+
*
|
|
40
|
+
* REFUSED ON THE CLASS, not on the widget: every framework builds bottom-up, so props are
|
|
41
|
+
* authored long before materialisation, and asking the instance would report
|
|
42
|
+
* `<gtk-string-list accessibility={…}>` from inside a later `materialize` rather than at the
|
|
43
|
+
* call that wrote it.
|
|
44
|
+
*
|
|
45
|
+
* The plan is built BEFORE anything is recorded, for the reason the property path states:
|
|
46
|
+
* `el.accessibility` is replayed verbatim by `replayInto`, so a refused value kept there
|
|
47
|
+
* would poison the next rebuild.
|
|
48
|
+
*/
|
|
49
|
+
export declare function setAccessibility(el: HostElement, next: unknown): void;
|
|
24
50
|
export declare function setSlot(el: HostElement, slot: string | null): void;
|
|
25
51
|
export declare function setText(node: HostText | HostAnchor, data: string): void;
|
|
26
52
|
/** Vue's bulk path and React's `shouldSetTextContent`: drop children, set the sink. */
|
package/lib/types/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export { toSignalName, isEventProp } from './signals.js';
|
|
|
6
6
|
export { constructOnlyNames, isConstructOnly, isWritable, lookupEnumNick, paramSpecs, toPropertyName, } from './props.js';
|
|
7
7
|
export { assertInjective, tagOf } from './tags.js';
|
|
8
8
|
export { blankReason, checkRendered, probeEnabled, runHostProbe, runHostProbeApp, shotEvidence, type CaptureWidget, type HostProbe, type HostProbeApp, type ProbeCheck, type ShotEvidence, } from './probe.js';
|
|
9
|
-
export type { ElementChild, ElementChildren, JsxAttributes, RawSignalAttributes, SlotAttribute, VueAttributes, WithOnce, } from './attrs.js';
|
|
9
|
+
export type { AccessibilityAttribute, ElementChild, ElementChildren, JsxAttributes, RawSignalAttributes, SlotAttribute, VueAttributes, WithOnce, } from './attrs.js';
|
|
10
10
|
export { clearRegistry, hasWidget, lookupWidget, nearestRegistered, registerWidget, registerWidgets, registeredTags, } from './registry.js';
|
|
11
11
|
export { ADW_DESCRIPTORS, BUILTIN_DESCRIPTORS, CURATED_DESCRIPTORS, GENERATED_PROVENANCE, GENERATED_WIDGETS, GTK_DESCRIPTORS, mergeGenerated, registerBuiltinWidgets, tableProvenance, } from './descriptors/index.js';
|
package/lib/types/policies.d.ts
CHANGED
|
@@ -3,6 +3,63 @@ import Gtk from 'gi://Gtk?version=4.0';
|
|
|
3
3
|
import type { ChildPolicy, HostElement, NodePlacement, WidgetDescriptor } from './types.js';
|
|
4
4
|
/** The object the PARENT addresses: a wrapper row when the policy demands one. */
|
|
5
5
|
export declare function addressOf(el: HostElement): Gtk.Widget;
|
|
6
|
+
/**
|
|
7
|
+
* The property a one-child slot method writes — `set_title_widget` -> `title-widget`.
|
|
8
|
+
*
|
|
9
|
+
* GTK SPELLS ONE PLACEMENT TWICE and both spellings reach the same widget:
|
|
10
|
+
* `adw_header_bar_buildable_add_child`'s `<child type="title">` branch calls
|
|
11
|
+
* `adw_header_bar_set_title_widget`, i.e. writes the `title-widget` property. An authored
|
|
12
|
+
* tree carries whichever spelling its SOURCE had — a Blueprint `[title]` bracket is the
|
|
13
|
+
* first, a `title-widget:` property-valued child the second — and `SharedTreeNode.slot`
|
|
14
|
+
* conflates the two by construction (the projection's own header records that, and that it
|
|
15
|
+
* cannot be inverted). A descriptor declaring only the buildable type would therefore refuse
|
|
16
|
+
* a placement GTK itself accepts.
|
|
17
|
+
*
|
|
18
|
+
* A CASE RULE OVER THE SETTER'S OWN NAME, never a table: an ADDER (`pack_start`,
|
|
19
|
+
* `add_top_bar`, `add_prefix`) writes no property, so such a slot answers to its buildable
|
|
20
|
+
* type alone — which is why `[start]` has no second spelling to admit.
|
|
21
|
+
*/
|
|
22
|
+
export declare function slotPropertyOf(method: string): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Every name a policy answers to — what a refusal lists.
|
|
25
|
+
*
|
|
26
|
+
* Each declared key is followed by the property spelling it also answers to, so the order is
|
|
27
|
+
* `['start', 'title', 'title-widget', 'end']` and not the keys first. That is deliberate: a
|
|
28
|
+
* reader matching their own `slot="title-widget"` against the list finds it beside the key it
|
|
29
|
+
* resolves to, rather than in a second group they have to pair up themselves.
|
|
30
|
+
*/
|
|
31
|
+
export declare function slotNames(policy: ChildPolicy): string[];
|
|
32
|
+
/**
|
|
33
|
+
* The DECLARED slot key an authored name asks for, or the default when it asks for nothing.
|
|
34
|
+
*
|
|
35
|
+
* EVERY read of `child.slot` in this file goes through here, so the property spelling
|
|
36
|
+
* {@link slotPropertyOf} admits is canonical everywhere at once: a placement resolved
|
|
37
|
+
* through `title-widget` and a detach resolved through `title` would otherwise be two
|
|
38
|
+
* different keys to `policy.slots[…]`, and the child would leak at unmount.
|
|
39
|
+
*
|
|
40
|
+
* THE DEFAULT IS CHECKED LIKE ANY OTHER NAME, and it is the one that has no author to
|
|
41
|
+
* blame. `defaultSlot` and `slots` are two fields of a descriptor, and an application
|
|
42
|
+
* registers descriptors of its own — nothing else in this package holds the two together.
|
|
43
|
+
* An unchecked default reaches `policy.slots[slot]` as `undefined` and the caller calls it:
|
|
44
|
+
* `TypeError: host[undefined] is not a function`, which is exactly the shape
|
|
45
|
+
* {@link errors.unknownSlot} exists to replace. Returning only keys that are IN `slots` is
|
|
46
|
+
* what makes the lookup at every call site total.
|
|
47
|
+
*/
|
|
48
|
+
export declare function slottedSlot(policy: Extract<ChildPolicy, {
|
|
49
|
+
kind: 'slotted';
|
|
50
|
+
}>, authored: string | null | undefined, gtype: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* A slot the parent cannot honour is refused BY NAME, whatever its policy kind.
|
|
53
|
+
*
|
|
54
|
+
* `slotted` already refused an unknown slot; every OTHER kind read `child.slot` as nothing
|
|
55
|
+
* at all, so a name it has no destination for put the widget in the one place it does have
|
|
56
|
+
* and said nothing. That is the defect measured on a real `.blp`: an authored placement
|
|
57
|
+
* dropped, the widget on screen in the wrong container, exit 0. A `single` parent accepts
|
|
58
|
+
* the property its own setter writes (`AdwApplicationWindow` + `set_content` accepts
|
|
59
|
+
* `content`) and nothing else; `keyed` reads the slot as its page NAME, which is a
|
|
60
|
+
* destination, so it is left alone.
|
|
61
|
+
*/
|
|
62
|
+
export declare function refuseUnknownSlot(parent: HostElement, child: HostElement): void;
|
|
6
63
|
/**
|
|
7
64
|
* `Gtk.ListBox` and `Gtk.FlowBox` wrap arbitrary children; the wrap is the host's job.
|
|
8
65
|
*
|
|
@@ -17,7 +74,7 @@ export declare function addressOf(el: HostElement): Gtk.Widget;
|
|
|
17
74
|
* is that `gtk_list_box_remove` does not unwrap, so without this the child leaks behind
|
|
18
75
|
* one `Gtk-WARNING` at unmount.
|
|
19
76
|
*/
|
|
20
|
-
export declare function makeWrapper(
|
|
77
|
+
export declare function makeWrapper(descriptor: WidgetDescriptor, child: Gtk.Widget, slot: string | null): Gtk.Widget | null;
|
|
21
78
|
/**
|
|
22
79
|
* A container the host owns that no window shows — the DOM's detached `<div>`.
|
|
23
80
|
*
|
package/lib/types/props.d.ts
CHANGED
|
@@ -24,23 +24,28 @@ export declare const isConstructOnly: (spec: GObject.ParamSpec) => boolean;
|
|
|
24
24
|
/** Construct-only property names of a class, in declaration order. */
|
|
25
25
|
export declare function constructOnlyNames(klass: GObject.ObjectClass, gtypeName: string): string[];
|
|
26
26
|
/**
|
|
27
|
-
* The value a nick names on an enum GType, or undefined if it names none.
|
|
27
|
+
* The value a nick names on an enum or bitfield GType, or undefined if it names none.
|
|
28
28
|
*
|
|
29
29
|
* Exported for the generated surface's own check: the type surface offers a union
|
|
30
30
|
* of nicks per enum, and a nick this host cannot resolve would type-check and then
|
|
31
31
|
* be refused at runtime. `generated.spec.ts` resolves every emitted nick through
|
|
32
32
|
* this function, so the GIR-member-to-nick spelling is measured rather than
|
|
33
33
|
* assumed. Also the primitive a renderer needs for a "did you mean" diagnostic.
|
|
34
|
+
*
|
|
35
|
+
* The NAME is kept in the signature although a GType would need no lookup, because
|
|
36
|
+
* every caller has the name and not the type — the check reads it off a generated
|
|
37
|
+
* table, a renderer off `GObject.type_name(spec.value_type)`.
|
|
34
38
|
*/
|
|
35
39
|
export declare const lookupEnumNick: (gtypeName: string, nick: string) => number | undefined;
|
|
36
40
|
/**
|
|
37
|
-
* The member names an installed enum registers, or `undefined` if this
|
|
41
|
+
* The member names an installed enum or bitfield registers, or `undefined` if this
|
|
42
|
+
* host has none.
|
|
38
43
|
*
|
|
39
44
|
* The INVERSE of {@link lookupEnumNick}, and it exists for the one question that
|
|
40
45
|
* function cannot answer: a nick the vocabulary never emitted is absent from every
|
|
41
|
-
* list a check could iterate, so only the host's own members can reveal it.
|
|
42
|
-
*
|
|
43
|
-
*
|
|
46
|
+
* list a check could iterate, so only the host's own members can reveal it. GJS
|
|
47
|
+
* offers no route to a `GEnumClass`, so the members come off the namespace object —
|
|
48
|
+
* which is the whole remaining reason {@link GI_NAMESPACES} exists.
|
|
44
49
|
*
|
|
45
50
|
* `$gtype` and anything non-numeric are not members; GJS puts both on the same object.
|
|
46
51
|
*/
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import type { Key, ReactElement, ReactNode, Ref } from 'react';
|
|
35
35
|
import type { WidgetClassByTag, WidgetPropsByTag } from './generated/props.js';
|
|
36
|
-
import type { RawSignalAttributes, SlotAttribute, WithOnce, WithPortableValues } from './attrs.js';
|
|
36
|
+
import type { AccessibilityAttribute, RawSignalAttributes, SlotAttribute, WithOnce, WithPortableValues } from './attrs.js';
|
|
37
37
|
export { Fragment } from 'react/jsx-runtime';
|
|
38
38
|
/**
|
|
39
39
|
* React's own factories, RE-TYPED over this package's element list.
|
|
@@ -67,7 +67,7 @@ type GtkJsxDevFactory = (type: GtkElementType, props: unknown, key: Key | undefi
|
|
|
67
67
|
* element TS2559. `children` must also be optional, or a self-closing tag is
|
|
68
68
|
* TS2741.
|
|
69
69
|
*/
|
|
70
|
-
export interface ReactWidgetAttributes<T> extends SlotAttribute, RawSignalAttributes {
|
|
70
|
+
export interface ReactWidgetAttributes<T> extends AccessibilityAttribute, SlotAttribute, RawSignalAttributes {
|
|
71
71
|
children?: ReactNode;
|
|
72
72
|
ref?: Ref<T> | undefined;
|
|
73
73
|
key?: Key | null | undefined;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type GObject from '@girs/gobject-2.0';
|
|
2
2
|
import type Gtk from '@girs/gtk-4.0';
|
|
3
|
+
import type { AriaValueType } from '@girs/gtk-4.0/vocabulary';
|
|
3
4
|
export type NodeKind = 'element' | 'text' | 'anchor';
|
|
4
5
|
export interface HostNodeBase {
|
|
5
6
|
readonly kind: NodeKind;
|
|
@@ -50,6 +51,15 @@ export interface HostElement extends HostNodeBase {
|
|
|
50
51
|
listeners: Map<string, (...args: unknown[]) => unknown>;
|
|
51
52
|
/** Positional data for `coords` parents (`Gtk.Grid`), read off the child. */
|
|
52
53
|
layout: Record<string, unknown> | null;
|
|
54
|
+
/**
|
|
55
|
+
* The authored ARIA object, or null — the accessibility GTK holds for this widget.
|
|
56
|
+
*
|
|
57
|
+
* A field of its own and NOT a key in `props`, for the reason `layout` is one: `props`
|
|
58
|
+
* is replayed into `g_object_new` by `materialize`, and none of these names is a
|
|
59
|
+
* construct property. It is the LAST authored value, so a patch can compute which
|
|
60
|
+
* slots the new object no longer sets and reset exactly those.
|
|
61
|
+
*/
|
|
62
|
+
accessibility: Record<string, unknown> | null;
|
|
53
63
|
/** True once text CHILDREN wrote the sink, so removing the last one clears it
|
|
54
64
|
* instead of leaving the stale string an authored prop never set. */
|
|
55
65
|
textFromChildren: boolean;
|
|
@@ -452,3 +462,45 @@ export interface WidgetDescriptor {
|
|
|
452
462
|
*/
|
|
453
463
|
readonly requiresProps?: readonly string[];
|
|
454
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* The three enums whose MEMBERS are GTK's ARIA names.
|
|
467
|
+
*
|
|
468
|
+
* `GtkAccessibleProperty`, `GtkAccessibleState` and `GtkAccessibleRelation` are three
|
|
469
|
+
* tables and three calls — `update_property`, `update_state`, `update_relation` — and
|
|
470
|
+
* which name belongs to which is GTK's answer, never ours. The runtime derives the call
|
|
471
|
+
* from this string, which is why a fourth table is refused at generation time rather
|
|
472
|
+
* than emitted: a call that does not exist is a `TypeError` inside a render.
|
|
473
|
+
*/
|
|
474
|
+
export type AriaTable = 'GtkAccessibleProperty' | 'GtkAccessibleRelation' | 'GtkAccessibleState';
|
|
475
|
+
/**
|
|
476
|
+
* One ARIA slot: the table it lives in, and the kind of value GTK collects for it.
|
|
477
|
+
*
|
|
478
|
+
* WHY THIS EXISTS AT ALL, and why it is not a ParamSpec. An ARIA slot is not a GObject
|
|
479
|
+
* property and never can be: `gtk_accessible_update_property()` takes a `GValue` the
|
|
480
|
+
* CALLER builds, and GTK reads it back with a fixed `g_value_get_*` per slot. There is
|
|
481
|
+
* nothing on the object to interrogate — so the type this table carries is the only
|
|
482
|
+
* thing standing between an authored value and the measured failure below.
|
|
483
|
+
*
|
|
484
|
+
* MEASURED on gjs 1.88.1 / GTK 4.22.5, one process per line. GJS guesses a GValue type
|
|
485
|
+
* from the JS value, and the guess is made on the value's INTEGRALITY:
|
|
486
|
+
*
|
|
487
|
+
* update_property([VALUE_NOW], [3]) g_value_get_double: G_VALUE_HOLDS_DOUBLE failed
|
|
488
|
+
* update_property([LEVEL], [3.5]) g_value_get_int: G_VALUE_HOLDS_INT failed
|
|
489
|
+
* update_property([SORT], ['ascending']) g_value_get_int: G_VALUE_HOLDS_INT failed
|
|
490
|
+
* update_state([CHECKED], [true]) g_value_get_int: G_VALUE_HOLDS_INT failed
|
|
491
|
+
*
|
|
492
|
+
* Every one of those is a CRITICAL at exit 0 with the slot left unset — the silent
|
|
493
|
+
* mis-store this package exists to refuse — and the last is the one a DOM author writes
|
|
494
|
+
* first, because `checked` is a `GtkAccessibleTristate` and not a boolean.
|
|
495
|
+
*/
|
|
496
|
+
export interface AriaSlot {
|
|
497
|
+
/**
|
|
498
|
+
* The table this name lives in. The NAME itself is the key the slot is stored under —
|
|
499
|
+
* kebab, as GTK spells the enum nick (`has-popup`, `row-index`) — and is deliberately
|
|
500
|
+
* not repeated in the row: a second copy of a map key is a second thing to keep in step.
|
|
501
|
+
*/
|
|
502
|
+
readonly table: AriaTable;
|
|
503
|
+
readonly kind: AriaValueType;
|
|
504
|
+
/** `kind: 'enum'` only — the GType whose nicks the value takes. */
|
|
505
|
+
readonly enumGType?: string;
|
|
506
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/gtk-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"description": "Framework-agnostic GTK4/Adwaita host: the element model UI-framework renderers bind to",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"test:gjs-on-node": "gjsify run build:gjsify && gjsify run build:test:node && node dist/test.node.mjs",
|
|
83
83
|
"generate": "gjsify build src/generator/main.mts --app gjs --outfile tmp/generate.gjs.mjs && gjsify run tmp/generate.gjs.mjs -- --out src/generated && gjsify format src/generated",
|
|
84
84
|
"generate:enum-values": "gjs -m ../../../scripts/generate-enum-values.mjs",
|
|
85
|
-
"generate:methods": "gjs -m ../../../scripts/generate-widget-methods.mjs"
|
|
85
|
+
"generate:methods": "gjs -m ../../../scripts/generate-widget-methods.mjs",
|
|
86
|
+
"generate:value-types": "gjs -m ../../../scripts/generate-value-types.mjs"
|
|
86
87
|
},
|
|
87
88
|
"keywords": [
|
|
88
89
|
"gjs",
|
|
@@ -92,16 +93,16 @@
|
|
|
92
93
|
"host"
|
|
93
94
|
],
|
|
94
95
|
"dependencies": {
|
|
95
|
-
"@girs/adw-1": "5.
|
|
96
|
-
"@girs/gdk-4.0": "5.
|
|
97
|
-
"@girs/gio-2.0": "5.
|
|
98
|
-
"@girs/gjs": "5.
|
|
99
|
-
"@girs/glib-2.0": "5.
|
|
100
|
-
"@girs/gobject-2.0": "5.
|
|
101
|
-
"@girs/gtk-4.0": "5.
|
|
102
|
-
"@girs/pango-1.0": "5.
|
|
103
|
-
"@girs/pangocairo-1.0": "5.
|
|
104
|
-
"@gjsify/adwaita-core": "^0.
|
|
96
|
+
"@girs/adw-1": "5.4.0",
|
|
97
|
+
"@girs/gdk-4.0": "5.4.0",
|
|
98
|
+
"@girs/gio-2.0": "5.4.0",
|
|
99
|
+
"@girs/gjs": "5.4.0",
|
|
100
|
+
"@girs/glib-2.0": "5.4.0",
|
|
101
|
+
"@girs/gobject-2.0": "5.4.0",
|
|
102
|
+
"@girs/gtk-4.0": "5.4.0",
|
|
103
|
+
"@girs/pango-1.0": "5.4.0",
|
|
104
|
+
"@girs/pangocairo-1.0": "5.4.0",
|
|
105
|
+
"@gjsify/adwaita-core": "^0.52.0"
|
|
105
106
|
},
|
|
106
107
|
"peerDependencies": {
|
|
107
108
|
"@vue/runtime-core": "^3.5.0",
|
|
@@ -124,10 +125,10 @@
|
|
|
124
125
|
}
|
|
125
126
|
},
|
|
126
127
|
"devDependencies": {
|
|
127
|
-
"@gjsify/cli": "^0.
|
|
128
|
+
"@gjsify/cli": "^0.52.0",
|
|
128
129
|
"@vue/runtime-core": "^3.5.0",
|
|
129
130
|
"solid-js": "^1.9.0",
|
|
130
|
-
"@gjsify/unit": "^0.
|
|
131
|
+
"@gjsify/unit": "^0.52.0",
|
|
131
132
|
"@types/node": "^25.9.2",
|
|
132
133
|
"typescript": "^6.0.3",
|
|
133
134
|
"@gjsify/node-gi": "file:../../node-gi/node-gi",
|
|
@@ -136,7 +137,8 @@
|
|
|
136
137
|
"react": "^19.2.0",
|
|
137
138
|
"react-reconciler": "^0.33.0",
|
|
138
139
|
"@types/react": "^19.2.2",
|
|
139
|
-
"@types/react-reconciler": "^0.33.0"
|
|
140
|
+
"@types/react-reconciler": "^0.33.0",
|
|
141
|
+
"@girs/girepository-3.0": "5.4.0"
|
|
140
142
|
},
|
|
141
143
|
"gjsify": {
|
|
142
144
|
"runtimes": {
|