@gjsify/devtools-protocol 0.48.0 → 0.49.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/types/types.d.ts +81 -0
- package/package.json +3 -3
package/lib/types/types.d.ts
CHANGED
|
@@ -30,6 +30,80 @@ export interface ActionList {
|
|
|
30
30
|
app: ActionDescriptor[];
|
|
31
31
|
win: ActionDescriptor[];
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* What a widget WAS GIVEN beside what it ASKED FOR — the pair that says whether a
|
|
35
|
+
* layout is right, and the one an introspection tree could not previously answer.
|
|
36
|
+
*
|
|
37
|
+
* `mapped` says a widget is on screen and a property read says its properties are what
|
|
38
|
+
* the code set; neither distinguishes a label allocated the width it asked for from one
|
|
39
|
+
* allocated less and now showing two thirds of its text. The workaround was to
|
|
40
|
+
* rasterise the widget through `Screenshot(<path>)` and read the PNG header, which is
|
|
41
|
+
* three round trips per widget and answers only the allocation — never the request, so
|
|
42
|
+
* it says THAT a widget is the wrong size and never whose arithmetic made it so.
|
|
43
|
+
*
|
|
44
|
+
* The measured case: a `Gtk.Label` in a `flex-row` masthead came out 170x23 at every
|
|
45
|
+
* window width from 700 to 1400, while one line of its text needs 206. Everything
|
|
46
|
+
* readable about it was correct — `wrap: true`, `max-width-chars: -1`, `hexpand: false`
|
|
47
|
+
* — and the defect is entirely in the two numbers that were not readable.
|
|
48
|
+
*
|
|
49
|
+
* NO POSITION. Only a size: x/y would need the widget's bounds resolved against an
|
|
50
|
+
* ancestor and a `Graphene.Rect` carried across the bridge, and the question this exists
|
|
51
|
+
* for is answered without it. `Screenshot(<path>)` already says where a widget is by
|
|
52
|
+
* showing it.
|
|
53
|
+
*
|
|
54
|
+
* GTK ONLY, for now. The shape is shared with the DOM and NativeScript adapters (see
|
|
55
|
+
* {@link NodeInfo}) and neither fills it in, so an absent `geometry` means "this adapter
|
|
56
|
+
* does not measure", never "this widget was not measured" — the one distinction a caller
|
|
57
|
+
* sweeping a tree for {@link NodeGeometry.short} has to make before reading a clean sweep
|
|
58
|
+
* as good news.
|
|
59
|
+
*/
|
|
60
|
+
export interface NodeGeometry {
|
|
61
|
+
/**
|
|
62
|
+
* Allocation in logical pixels, in the MARGIN box — content plus CSS padding, border
|
|
63
|
+
* and margin.
|
|
64
|
+
*
|
|
65
|
+
* That box and not another one because it is the box a size request speaks, so these
|
|
66
|
+
* two numbers and the two below are comparable. GTK has FOUR and three of them are
|
|
67
|
+
* readable: `get_width()` answers the content box, `compute_bounds()` the border box,
|
|
68
|
+
* `get_allocation()` the CSS margin box, and `measure()` the box outside all of them —
|
|
69
|
+
* CSS margin plus the widget's own `margin-*` properties, which is the only rectangle
|
|
70
|
+
* with no accessor of its own and has to be summed. Mixing them is not a rounding
|
|
71
|
+
* error. Measured on GTK 4.22.4, a `Gtk.Label` with `padding: 3px 5px` over a 68x17
|
|
72
|
+
* content box asks 78x23; asked for its height at 68 — its content width read as a
|
|
73
|
+
* margin-box width — it answers 40, because 58 is left for text that then wraps. The
|
|
74
|
+
* table behind all four columns is on `geometryOf` in `@gjsify/devtools`.
|
|
75
|
+
*/
|
|
76
|
+
width: number;
|
|
77
|
+
height: number;
|
|
78
|
+
/** [minimum, natural] width, measured with no height given. */
|
|
79
|
+
widthRequest: [number, number];
|
|
80
|
+
/**
|
|
81
|
+
* [minimum, natural] height, measured AT THE ALLOCATED WIDTH.
|
|
82
|
+
*
|
|
83
|
+
* At the allocated width and not at `-1`, because that is the whole question. A
|
|
84
|
+
* wrapping label asked for its height at its natural width answers one line; asked
|
|
85
|
+
* at the width it actually got, it answers two. A parent that measured the first
|
|
86
|
+
* and allocated the second is exactly the bug, and the two numbers differ only when
|
|
87
|
+
* it happened.
|
|
88
|
+
*/
|
|
89
|
+
heightRequest: [number, number];
|
|
90
|
+
/**
|
|
91
|
+
* The allocation is below the minimum the widget asked for, so it is CLIPPED.
|
|
92
|
+
*
|
|
93
|
+
* Present only when true, like {@link NodeInfo.truncated}: a caller sweeping a tree
|
|
94
|
+
* for this key finds the defective widgets without a hypothesis about which one to
|
|
95
|
+
* suspect, which is the difference between an instrument and a readout.
|
|
96
|
+
*
|
|
97
|
+
* NOT every one of them is a bug, and the exception is structural rather than rare. A
|
|
98
|
+
* `GtkViewport` inside a `GtkScrolledWindow` reports its child's request and is
|
|
99
|
+
* deliberately allocated less — that IS scrolling — so it carries this key in every
|
|
100
|
+
* window that scrolls (measured: the only `short` node in an Adwaita preferences
|
|
101
|
+
* window is its viewport, 900x613 against a minimum of 520x720). The key says the
|
|
102
|
+
* allocation is under the request, which is the fact; whether that is a defect is the
|
|
103
|
+
* reader's call, and a widget under a scrolled window is where the answer is no.
|
|
104
|
+
*/
|
|
105
|
+
short?: true;
|
|
106
|
+
}
|
|
33
107
|
/**
|
|
34
108
|
* A node in an introspection tree — a GTK widget or a DOM element. The
|
|
35
109
|
* shape is shared so the same MCP tools render both runtimes.
|
|
@@ -46,6 +120,13 @@ export interface NodeInfo {
|
|
|
46
120
|
visible: boolean;
|
|
47
121
|
/** Shallow scalar properties, when requested. */
|
|
48
122
|
props?: Record<string, unknown>;
|
|
123
|
+
/**
|
|
124
|
+
* Allocation and size request. Present for a MAPPED widget only — an unmapped one
|
|
125
|
+
* has no allocation, and measuring it reports what it would ask for in a place it
|
|
126
|
+
* is not, which is a number that reads like an answer and is not one. Filled in by
|
|
127
|
+
* the GTK adapter alone; see {@link NodeGeometry}.
|
|
128
|
+
*/
|
|
129
|
+
geometry?: NodeGeometry;
|
|
49
130
|
children: NodeInfo[];
|
|
50
131
|
/**
|
|
51
132
|
* This node HAS children the dump did not walk, because the depth bound
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/devtools-protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "Transport-agnostic devtools contract (methods, JSON envelope, method-kinds, transport interface) shared by every gjsify devtools adapter and the MCP bridge",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@gjsify/cli": "^0.
|
|
39
|
-
"@gjsify/unit": "^0.
|
|
38
|
+
"@gjsify/cli": "^0.49.0",
|
|
39
|
+
"@gjsify/unit": "^0.49.0",
|
|
40
40
|
"@types/node": "^25.9.2",
|
|
41
41
|
"typescript": "^6.0.3"
|
|
42
42
|
},
|