@gjsify/gtk-host 0.53.0 → 0.55.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.
@@ -24,23 +24,22 @@ export declare function setEventHandler(el: HostElement, prop: string, next: ((.
24
24
  /**
25
25
  * The ARIA object, diffed against the one it replaces.
26
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.
27
+ * ONE GROUPED PROP RATHER THAN 53 FLAT `aria*` ONES, for measured reasons. (1)
28
+ * TypeScript exempts every hyphen-containing JSX attribute from excess-property checking —
29
+ * the measurement `emit-types.mts` already records for the kebab property spellings — so a
30
+ * flat `aria-labell` would be accepted in silence, while a key inside a fresh object literal
31
+ * IS checked. (2) The ARIA names collide with the widget's own properties: `label`,
32
+ * `orientation`, `checked`, `expanded` and `selected` are all both, and `orientation` is
33
+ * settable on a `GtkLabel` that implements no `GtkOrientable` at all — one object keeps the
34
+ * two vocabularies apart by construction instead of by prefix. (3) The other surface over
35
+ * this vocabulary already spells it this way: a `.blp` author writes `accessibility {
36
+ * label: "…"; }` (ADR 0034). (4) `setProp` already has this shape for `layout`, so this adds
37
+ * one reserved key to the host, not 53.
39
38
  *
40
39
  * REFUSED ON THE CLASS, not on the widget: every framework builds bottom-up, so props are
41
40
  * 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.
41
+ * `<gtk-string-list accessibility={…}>` from inside a later `materialize` rather than at
42
+ * the call that wrote it.
44
43
  *
45
44
  * The plan is built BEFORE anything is recorded, for the reason the property path states:
46
45
  * `el.accessibility` is replayed verbatim by `replayInto`, so a refused value kept there
@@ -55,32 +54,23 @@ export declare function insert(node: HostNode, parent: HostElement, anchor?: Hos
55
54
  /**
56
55
  * TWO facts, not one: it says it is an element, and it carries a descriptor.
57
56
  *
58
- * `kind` alone is a plain string a GObject wrapper could carry; the descriptor is
59
- * what every host op actually dereferences. Checking both keeps the refusal from
60
- * being either paranoid or fooled.
57
+ * `kind` alone is a plain string a GObject wrapper could carry; the descriptor is what
58
+ * every host op actually dereferences. Checking both keeps the refusal from being either
59
+ * paranoid or fooled.
61
60
  *
62
- * Exported because the Vue adapter had these same two lines VERBATIM, and its own
63
- * comment said so — it needs the question before `adopt`, to tell a host parent
64
- * from the raw widget `<Teleport :to="el">` hands through. A predicate stated in
65
- * two places is a predicate that can disagree with itself about what a node is.
61
+ * Exported because the Vue adapter needs the question before `adopt`, to tell a host
62
+ * parent from the raw widget `<Teleport :to="el">` hands through.
66
63
  */
67
64
  export declare function isHostElement(value: unknown): value is HostElement;
68
65
  /**
69
66
  * Name a foreign value the way its owner would recognise it.
70
67
  *
71
- * ONE function, because there were two and each was wrong for the other's input.
72
- * The host's read `constructor.$gtype`, so it could not name a DOM element — the
73
- * single most likely thing to arrive from a Solid app that imported `<Dynamic>`
74
- * from `solid-js/web`. The Solid adapter's read `tagName`, so it answered
75
- * `a Object` for the GObject wrapper `<Teleport :to="el">` hands over. Both are
76
- * asking "what did I get instead of a node", so both answers belong to one place.
77
- *
78
- * ORDER IS LOAD-BEARING, and it is measured rather than reasoned: under gjs
79
- * 1.88.1 `({}).constructor.$gtype` EXISTS and `GObject.type_name` calls it
80
- * `JSObject`. So a `$gtype`-first version names every object literal — and every
81
- * DOM-ish stub, which is an object literal — `JSObject`, and the host's own
82
- * documented `a plain object` fallback was unreachable for exactly the shape it
83
- * names. `tagName` first, and `JSObject` treated as the absence of a GType.
68
+ * ORDER IS LOAD-BEARING, and it is measured rather than reasoned: under gjs 1.88.1
69
+ * `({}).constructor.$gtype` EXISTS and `GObject.type_name` calls it `JSObject`. A
70
+ * `$gtype`-first version would therefore name every object literal — and every DOM-ish
71
+ * stub, which is an object literal — `JSObject`, and the `a plain object` fallback would be
72
+ * unreachable for exactly the shape it names. `tagName` first, `JSObject` treated as the
73
+ * absence of a GType.
84
74
  */
85
75
  export declare function describeValue(value: unknown): string;
86
76
  /** Detach only — reversible. Frameworks move nodes; `remove` must not destroy one. */
@@ -88,30 +78,25 @@ export declare function remove(node: HostNode): void;
88
78
  /**
89
79
  * Destroy every child of `parent`, bounded.
90
80
  *
91
- * Exported because both adapters wrote their OWN `childSnapshot` to do exactly this
92
- * — byte-identical to each other, and both walking `next` raw. That is the one walk
93
- * the bound above exists to make unforgettable, and it is the walk where the
94
- * malformed link actually appears: `insert(node, parent, node)` is a defined DOM
95
- * no-op, so Solid's adjacent-swap fast path emits it against a CONTAINER's child
96
- * list. Unbounded, that is a hang rather than GTK's usual exit 0.
97
- *
98
- * This replaces a `clearContainer` that had no callers anywhere and DETACHED rather
99
- * than destroyed — the wrong half for every caller that wanted it, and a name React's
100
- * own HostConfig already uses for the destroying kind.
81
+ * Every walk over `next` goes through `childSnapshot` so the bound cannot be forgotten at a
82
+ * new call site, and this is the walk where the malformed link actually appears: `insert(
83
+ * node, parent, node)` is a defined DOM no-op, so Solid's adjacent-swap fast path emits it
84
+ * against a CONTAINER's child list. Unbounded, that is a hang rather than GTK's usual
85
+ * exit 0.
101
86
  */
102
87
  export declare function destroyChildren(parent: HostElement): void;
103
88
  /**
104
89
  * Disconnect a node's handlers WITHOUT touching the tree.
105
90
  *
106
- * The narrow half of `destroy`, and it exists because a framework can tell us "this
107
- * node is gone" while still holding its sibling links: Solid disposes a per-node
108
- * scope BEFORE its reconciler runs, and `reconcileArrays` opens with
109
- * `getNextSibling(last)`. Unlinking there made every trailing insertion append at
110
- * the end of the parent instead of before the marker.
91
+ * The narrow half of `destroy`, and it exists because a framework can tell us "this node is
92
+ * gone" while still holding its sibling links: Solid disposes a per-node scope BEFORE its
93
+ * reconciler runs, and `reconcileArrays` opens with `getNextSibling(last)`. Unlinking there
94
+ * made every trailing insertion append at the end of the parent instead of before the
95
+ * marker.
111
96
  *
112
- * The leak this closes is about handlers, not links — GJS blocks JS callbacks
113
- * during GC, so an undisconnected handler outlives its widget. The framework's own
114
- * `removeNode` still does the unlinking, in its own order.
97
+ * The leak this closes is about handlers, not links — GJS blocks JS callbacks during GC, so
98
+ * an undisconnected handler outlives its widget. The framework's own `removeNode` still
99
+ * does the unlinking, in its own order.
115
100
  */
116
101
  export declare function disconnectHandlers(el: HostElement): void;
117
102
  /**
@@ -128,43 +113,36 @@ export declare function destroy(node: HostNode): void;
128
113
  /**
129
114
  * Put a host tree inside an existing GTK container the application owns.
130
115
  *
131
- * The container is resolved through the SAME table as every other parent —
132
- * `nearestRegistered` walks the real type hierarchy, so an application's own
133
- * `GObject.registerClass` subclass inherits its ancestor's policy. Guessing a
134
- * method name here would be the generic `add` that GTK4 deliberately removed.
116
+ * The container is resolved through the SAME table as every other parent, so an
117
+ * application's own `GObject.registerClass` subclass inherits its ancestor's policy.
118
+ * Guessing a method name here would be the generic `add` that GTK4 deliberately removed.
135
119
  */
136
120
  export declare function mountRoot(el: HostElement, container: GObject.Object): void;
137
121
  /**
138
122
  * The materialised widget of a host node — for a `ref`, or for a test.
139
123
  *
140
- * ONE implementation. The Solid and React adapters each carried this function,
141
- * identical apart from two comment lines, and Vue carried none — so a Vue app had
142
- * no supported way to reach a widget at all and its only route was
143
- * `materialize()`, which is exactly the call the `destroyed` guard below exists to
144
- * intercept.
124
+ * ONE implementation, because a caller reaching `materialize()` directly is exactly what the
125
+ * `destroyed` guard below exists to intercept.
145
126
  *
146
- * The flag is exact and the obvious heuristic is not: `materialize` would happily
147
- * build a fresh, propertyless, unparented widget for a destroyed node — `destroy`
148
- * clears `props` and `layout` precisely so one cannot look re-materialisable — and
149
- * "no widget, not attached, no props" also describes a brand-new element.
127
+ * The flag is exact and the obvious heuristic is not: `materialize` would happily build a
128
+ * fresh, propertyless, unparented widget for a destroyed node — `destroy` clears `props`
129
+ * and `layout` precisely so one cannot look re-materialisable — and "no widget, not
130
+ * attached, no props" also describes a brand-new element.
150
131
  */
151
132
  export declare function widgetOf(node: HostNode): Gtk.Widget;
152
133
  /**
153
134
  * An off-screen container the host owns — the analogue of the DOM's detached `<div>`.
154
135
  *
155
- * `<KeepAlive>` and `<Suspense>` ask a renderer for one: `KeepAliveImpl.setup`
156
- * opens with `createElement("div")` and `SuspenseImpl` does the same for its
157
- * `hiddenContainer`. Forwarded as a TAG, "div" reached `lookupWidget` and threw
158
- * `unknown-tag` inside `callWithErrorHandling`, whose production arm is
159
- * `console.error` with no rethrow: `mount()` returned normally, the container held
160
- * zero children, GTK said nothing, exit 0.
161
- *
162
- * The Vue adapter answered that with `adopt(new Gtk.Box())` — the one runtime
163
- * `gi://` import and the one concrete widget class in any adapter, i.e. the widget
164
- * knowledge ADR 0027 § 7 forbids. Which widget backs it is the table's business
165
- * (`makeDetachedContainer`), and this op is what leaves the adapter with nothing to
166
- * know: the deactivated subtree is really unparented from the visible tree and
167
- * really held alive, so reactivating it moves the SAME widgets back.
136
+ * `<KeepAlive>` and `<Suspense>` ask a renderer for one: `KeepAliveImpl.setup` opens with
137
+ * `createElement("div")` and `SuspenseImpl` does the same for its `hiddenContainer`.
138
+ * Forwarded as a TAG, "div" reached `lookupWidget` and threw `unknown-tag` inside
139
+ * `callWithErrorHandling`, whose production arm is `console.error` with no rethrow:
140
+ * `mount()` returned normally, the container held zero children, GTK said nothing, exit 0.
141
+ *
142
+ * Which widget backs it is the table's business (`makeDetachedContainer`), and this op is
143
+ * what leaves the adapter with nothing to know — the widget knowledge ADR 0027 § 7 forbids.
144
+ * The deactivated subtree is really unparented from the visible tree and really held
145
+ * alive, so reactivating it moves the SAME widgets back.
168
146
  */
169
147
  export declare const createDetachedContainer: () => HostElement;
170
148
  /**