react-native-gtkx 0.1.0-alpha.4 → 0.2.0-alpha.1

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.
Files changed (176) hide show
  1. package/README.md +12 -8
  2. package/dist/adw/index.d.ts +3 -0
  3. package/dist/adw/index.js +41 -0
  4. package/dist/adw/index.js.map +1 -0
  5. package/dist/adw/widgets.generated.d.ts +63 -0
  6. package/dist/adw/widgets.generated.js +125 -0
  7. package/dist/adw/widgets.generated.js.map +1 -0
  8. package/dist/common/content.d.ts +69 -0
  9. package/dist/common/content.js +84 -0
  10. package/dist/common/content.js.map +1 -0
  11. package/dist/common/index.d.ts +3 -0
  12. package/dist/common/index.js +19 -0
  13. package/dist/common/index.js.map +1 -0
  14. package/dist/common/navigation-stack.d.ts +84 -0
  15. package/dist/common/navigation-stack.js +313 -0
  16. package/dist/common/navigation-stack.js.map +1 -0
  17. package/dist/common/widget.d.ts +83 -0
  18. package/dist/common/widget.js +142 -0
  19. package/dist/common/widget.js.map +1 -0
  20. package/dist/components/animated.d.ts +3 -2
  21. package/dist/components/animated.js +85 -66
  22. package/dist/components/animated.js.map +1 -1
  23. package/dist/components/app-registry.d.ts +10 -1
  24. package/dist/components/app-registry.js +8 -3
  25. package/dist/components/app-registry.js.map +1 -1
  26. package/dist/components/pressable.js +105 -12
  27. package/dist/components/pressable.js.map +1 -1
  28. package/dist/components/rect-store.d.ts +11 -1
  29. package/dist/components/rect-store.js +27 -3
  30. package/dist/components/rect-store.js.map +1 -1
  31. package/dist/components/svg/animated-support.d.ts +19 -0
  32. package/dist/components/svg/animated-support.js +64 -0
  33. package/dist/components/svg/animated-support.js.map +1 -0
  34. package/dist/components/svg/context.d.ts +8 -0
  35. package/dist/components/svg/context.js +15 -0
  36. package/dist/components/svg/context.js.map +1 -0
  37. package/dist/components/svg/gradients.d.ts +31 -0
  38. package/dist/components/svg/gradients.js +93 -0
  39. package/dist/components/svg/gradients.js.map +1 -0
  40. package/dist/components/svg/group.d.ts +8 -0
  41. package/dist/components/svg/group.js +30 -0
  42. package/dist/components/svg/group.js.map +1 -0
  43. package/dist/components/svg/index.d.ts +6 -0
  44. package/dist/components/svg/index.js +5 -0
  45. package/dist/components/svg/index.js.map +1 -0
  46. package/dist/components/svg/node.d.ts +7 -0
  47. package/dist/components/svg/node.js +7 -0
  48. package/dist/components/svg/node.js.map +1 -0
  49. package/dist/components/svg/paint.d.ts +24 -0
  50. package/dist/components/svg/paint.js +57 -0
  51. package/dist/components/svg/paint.js.map +1 -0
  52. package/dist/components/svg/shapes.d.ts +47 -0
  53. package/dist/components/svg/shapes.js +51 -0
  54. package/dist/components/svg/shapes.js.map +1 -0
  55. package/dist/components/svg/svg.d.ts +14 -0
  56. package/dist/components/svg/svg.js +48 -0
  57. package/dist/components/svg/svg.js.map +1 -0
  58. package/dist/components/svg/use-shape-node.d.ts +12 -0
  59. package/dist/components/svg/use-shape-node.js +52 -0
  60. package/dist/components/svg/use-shape-node.js.map +1 -0
  61. package/dist/components/text.js +11 -2
  62. package/dist/components/text.js.map +1 -1
  63. package/dist/components/use-layout-child.js +47 -4
  64. package/dist/components/use-layout-child.js.map +1 -1
  65. package/dist/contracts.d.ts +12 -1
  66. package/dist/contracts.js.map +1 -1
  67. package/dist/gtk/index.d.ts +6 -0
  68. package/dist/gtk/index.js +39 -0
  69. package/dist/gtk/index.js.map +1 -0
  70. package/dist/gtk/widgets.generated.d.ts +103 -0
  71. package/dist/gtk/widgets.generated.js +206 -0
  72. package/dist/gtk/widgets.generated.js.map +1 -0
  73. package/dist/gtkx/bridge/index.d.ts +9 -4
  74. package/dist/gtkx/bridge/index.js +40 -4
  75. package/dist/gtkx/bridge/index.js.map +1 -1
  76. package/dist/gtkx/bridge/layout-manager.d.ts +2 -1
  77. package/dist/gtkx/bridge/layout-manager.js +31 -9
  78. package/dist/gtkx/bridge/layout-manager.js.map +1 -1
  79. package/dist/gtkx/bridge/svg-node.d.ts +79 -0
  80. package/dist/gtkx/bridge/svg-node.js +367 -0
  81. package/dist/gtkx/bridge/svg-node.js.map +1 -0
  82. package/dist/gtkx/bridge/use-signal.js +18 -8
  83. package/dist/gtkx/bridge/use-signal.js.map +1 -1
  84. package/dist/gtkx/bridge/widgets.generated.d.ts +2 -0
  85. package/dist/gtkx/bridge/widgets.generated.js +14 -0
  86. package/dist/gtkx/bridge/widgets.generated.js.map +1 -0
  87. package/dist/mcp/bin.d.ts +2 -0
  88. package/dist/mcp/bin.js +17 -0
  89. package/dist/mcp/bin.js.map +1 -0
  90. package/dist/mcp/data/generated.d.ts +1282 -0
  91. package/dist/mcp/data/generated.js +1148 -0
  92. package/dist/mcp/data/generated.js.map +1 -0
  93. package/dist/mcp/index.d.ts +5 -0
  94. package/dist/mcp/index.js +9 -0
  95. package/dist/mcp/index.js.map +1 -0
  96. package/dist/mcp/list.d.ts +4 -0
  97. package/dist/mcp/list.js +56 -0
  98. package/dist/mcp/list.js.map +1 -0
  99. package/dist/mcp/resolve.d.ts +55 -0
  100. package/dist/mcp/resolve.js +151 -0
  101. package/dist/mcp/resolve.js.map +1 -0
  102. package/dist/mcp/search.d.ts +13 -0
  103. package/dist/mcp/search.js +48 -0
  104. package/dist/mcp/search.js.map +1 -0
  105. package/dist/mcp/server.d.ts +7 -0
  106. package/dist/mcp/server.js +135 -0
  107. package/dist/mcp/server.js.map +1 -0
  108. package/dist/mcp/tool.d.ts +21 -0
  109. package/dist/mcp/tool.js +36 -0
  110. package/dist/mcp/tool.js.map +1 -0
  111. package/dist/metro/index.js +10 -0
  112. package/dist/metro/index.js.map +1 -1
  113. package/dist/navigation/index.d.ts +50 -13
  114. package/dist/navigation/index.js +183 -148
  115. package/dist/navigation/index.js.map +1 -1
  116. package/dist/navigation/option-warnings.js +9 -1
  117. package/dist/navigation/option-warnings.js.map +1 -1
  118. package/dist/navigation/sidebar.d.ts +177 -9
  119. package/dist/navigation/sidebar.js +284 -10
  120. package/dist/navigation/sidebar.js.map +1 -1
  121. package/dist/runner/index.d.ts +22 -2
  122. package/dist/runner/index.js +163 -13
  123. package/dist/runner/index.js.map +1 -1
  124. package/dist/sea/assemble.d.ts +29 -0
  125. package/dist/sea/assemble.js +129 -0
  126. package/dist/sea/assemble.js.map +1 -0
  127. package/dist/sea/bundle.d.ts +61 -0
  128. package/dist/sea/bundle.js +202 -0
  129. package/dist/sea/bundle.js.map +1 -0
  130. package/dist/sea/gtkx-config-module.d.ts +18 -0
  131. package/dist/sea/gtkx-config-module.js +67 -0
  132. package/dist/sea/gtkx-config-module.js.map +1 -0
  133. package/dist/sea/native-shim.d.ts +40 -0
  134. package/dist/sea/native-shim.js +121 -0
  135. package/dist/sea/native-shim.js.map +1 -0
  136. package/dist/sea/react-anchor-plugin.d.ts +2 -0
  137. package/dist/sea/react-anchor-plugin.js +30 -0
  138. package/dist/sea/react-anchor-plugin.js.map +1 -0
  139. package/dist/style/index.d.ts +1 -0
  140. package/dist/style/index.js +1 -0
  141. package/dist/style/index.js.map +1 -1
  142. package/dist/style/split-style.js +2 -2
  143. package/dist/style/split-style.js.map +1 -1
  144. package/dist/style/transform.d.ts +22 -0
  145. package/dist/style/transform.js +137 -0
  146. package/dist/style/transform.js.map +1 -0
  147. package/dist/style/visual-css.js +3 -2
  148. package/dist/style/visual-css.js.map +1 -1
  149. package/dist/svg/geometry.d.ts +19 -0
  150. package/dist/svg/geometry.js +80 -0
  151. package/dist/svg/geometry.js.map +1 -0
  152. package/dist/svg/gradient-geometry.d.ts +15 -0
  153. package/dist/svg/gradient-geometry.js +18 -0
  154. package/dist/svg/gradient-geometry.js.map +1 -0
  155. package/dist/svg/transform.d.ts +22 -0
  156. package/dist/svg/transform.js +74 -0
  157. package/dist/svg/transform.js.map +1 -0
  158. package/dist/svg/view-box.d.ts +34 -0
  159. package/dist/svg/view-box.js +108 -0
  160. package/dist/svg/view-box.js.map +1 -0
  161. package/dist/svg-compat/index.d.ts +1 -0
  162. package/dist/svg-compat/index.js +16 -0
  163. package/dist/svg-compat/index.js.map +1 -0
  164. package/dist/testing/index.d.ts +14 -0
  165. package/dist/testing/index.js +14 -0
  166. package/dist/testing/index.js.map +1 -0
  167. package/dist/vite/index.d.ts +7 -3
  168. package/dist/vite/index.js +15 -3
  169. package/dist/vite/index.js.map +1 -1
  170. package/dist/vitest/index.d.ts +52 -0
  171. package/dist/vitest/index.js +58 -0
  172. package/dist/vitest/index.js.map +1 -0
  173. package/dist/vitest/setup.d.ts +4 -0
  174. package/dist/vitest/setup.js +22 -0
  175. package/dist/vitest/setup.js.map +1 -0
  176. package/package.json +47 -8
@@ -0,0 +1,367 @@
1
+ // RnGtkxSvgNode — one GObject class (registerClass, same mechanism as
2
+ // RnGtkxLayout/RnGtkxViewBox) reused for the <Svg> root AND every descendant
3
+ // (<G>, <Path>, <Rect>, ..., <Defs>, <LinearGradient>, <Stop>). Descendants
4
+ // are ordinary GTK children (the reconciler's generic set_parent/insert_after
5
+ // attachment — the same one View relies on) that GTK never snapshots on its
6
+ // own, because nothing ever calls snapshotChild() on them: only the mounted
7
+ // <Svg> instance's snapshot() vfunc actually runs, and it walks
8
+ // getFirstChild()/getNextSibling() itself, reading each node's role from a
9
+ // WeakMap (native wrappers get re-created by the runtime, so per-instance
10
+ // state cannot live on `this` — same reasoning as hooksByManager in
11
+ // layout-manager.ts).
12
+ //
13
+ // `Gtk.Widget.snapshot()` is a real, working vfunc in gtkx's codegen
14
+ // (node_modules/@gtkx/gi/gtk/gtk.js, registerWrapperClass(Widget, ...) lists
15
+ // it with byteOffset 320) even though it is missing from the shipped
16
+ // `gtk.d.ts` — the type generator drops it, the codegen that actually wires
17
+ // vfuncs does not. Verified by reading the generated registry before writing
18
+ // any of this; see epic.md.
19
+ import * as Gdk from "@gtkx/gi/gdk";
20
+ import * as Graphene from "@gtkx/gi/graphene";
21
+ import * as Gsk from "@gtkx/gi/gsk";
22
+ import * as Gtk from "@gtkx/gi/gtk";
23
+ import { createElementComponent } from "@gtkx/react/internal";
24
+ import { registerClass } from "@gtkx/runtime";
25
+ import { parseColor } from "../../style/colors";
26
+ import { resolveGradientPoint, resolveGradientRadius, } from "../../svg/gradient-geometry";
27
+ import { resolveViewBoxTransform, } from "../../svg/view-box";
28
+ const nodeDescriptors = new WeakMap();
29
+ export const setSvgNodeDescriptor = (widget, descriptor) => {
30
+ nodeDescriptors.set(widget, descriptor);
31
+ };
32
+ export const getSvgNodeDescriptor = (widget) => nodeDescriptors.get(widget);
33
+ // --- paint resolution ----------------------------------------------------
34
+ // `parseColor` also passes CSS variables (`var(--x)`) and legacy GTK named
35
+ // colors (`@name`) through unchanged, for the CSS-cascade styling path
36
+ // elsewhere in this codebase. Raw Gsk paint nodes have no cascade to resolve
37
+ // those against — deliberate cut (epic.md): SVG fill/stroke only accepts
38
+ // static CSS colors (hex/rgb/hsl/named/transparent), not PlatformColor.
39
+ export const resolveSvgColor = (spec) => {
40
+ if (!spec) {
41
+ return null;
42
+ }
43
+ const normalized = parseColor(spec);
44
+ if (!normalized ||
45
+ normalized.startsWith("var(") ||
46
+ normalized.startsWith("@")) {
47
+ return null;
48
+ }
49
+ const rgba = new Gdk.RGBA();
50
+ return rgba.parse(normalized) ? rgba : null;
51
+ };
52
+ const URL_REF_PATTERN = /^url\(#(.+)\)$/;
53
+ export const resolveSvgPaint = (spec) => {
54
+ if (!spec || spec === "none") {
55
+ return null;
56
+ }
57
+ const match = URL_REF_PATTERN.exec(spec.trim());
58
+ if (match) {
59
+ return { kind: "ref", id: match[1] };
60
+ }
61
+ const rgba = resolveSvgColor(spec);
62
+ return rgba ? { kind: "color", rgba } : null;
63
+ };
64
+ const scaledAlpha = (rgba, factor) => factor >= 1
65
+ ? rgba
66
+ : new Gdk.RGBA({
67
+ red: rgba.red,
68
+ green: rgba.green,
69
+ blue: rgba.blue,
70
+ alpha: rgba.alpha * factor,
71
+ });
72
+ const clamp01 = (value) => Math.max(0, Math.min(1, value));
73
+ // RC2-WORKAROUND(gsk-colorstop-boxed-write) — row in docs/gtkx-rc2-notes.md.
74
+ // Writing a Gdk.RGBA into a Gsk.ColorStop's `color` field crashes in the
75
+ // native addon (@gtkx/native)
76
+ // with "Expected an Object for Boxed field write type, got Object" —
77
+ // verified through THREE independent paths, all hitting the same native
78
+ // code: the generated constructor (uses the wrong of two RGBA descriptors,
79
+ // _desc1 instead of the inline _desc2 — a real codegen bug), the property
80
+ // setter (uses the documented-correct _desc2 descriptor and STILL fails,
81
+ // which rules out a simple descriptor mix-up as the whole story), and a
82
+ // bypass that skips ColorStop construction and hands appendLinearGradient a
83
+ // plain {offset, color} object array instead (fails differently, with "No
84
+ // native handle associated with Object" — the array marshaling genuinely
85
+ // requires a native-backed instance per element, so there is no JS-level
86
+ // escape hatch). This is a native-addon bug, not something fixable from
87
+ // application code.
88
+ //
89
+ // Rather than crash every app that uses a gradient, or drop the gradient
90
+ // components from the API while their descriptor-building is fully correct
91
+ // and tested, a stop that fails to construct is treated exactly like a
92
+ // missing gradient reference (see the url(#missing) test): the shape using
93
+ // it simply paints no fill/stroke for that paint, instead of throwing.
94
+ const makeColorStop = (offset, color) => {
95
+ try {
96
+ const stop = new Gsk.ColorStop();
97
+ stop.offset = offset;
98
+ stop.color = color;
99
+ return stop;
100
+ }
101
+ catch {
102
+ return null;
103
+ }
104
+ };
105
+ const collectStops = (gradientWidget) => {
106
+ const stops = [];
107
+ let child = gradientWidget.getFirstChild();
108
+ while (child) {
109
+ const descriptor = nodeDescriptors.get(child);
110
+ if (descriptor?.kind === "stop") {
111
+ const stop = makeColorStop(descriptor.offset, descriptor.color);
112
+ if (stop) {
113
+ stops.push(stop);
114
+ }
115
+ }
116
+ child = child.getNextSibling();
117
+ }
118
+ return stops;
119
+ };
120
+ // Only DIRECT <Defs> children of <Svg> are scanned (a deliberate simplicity
121
+ // cut — every real react-native-svg example keeps Defs at the top).
122
+ const collectGradients = (root) => {
123
+ const gradients = new Map();
124
+ let child = root.getFirstChild();
125
+ while (child) {
126
+ if (nodeDescriptors.get(child)?.kind === "defs") {
127
+ let gradientNode = child.getFirstChild();
128
+ while (gradientNode) {
129
+ const descriptor = nodeDescriptors.get(gradientNode);
130
+ if (descriptor?.kind === "gradient") {
131
+ gradients.set(descriptor.id, {
132
+ descriptor,
133
+ stops: collectStops(gradientNode),
134
+ });
135
+ }
136
+ gradientNode = gradientNode.getNextSibling();
137
+ }
138
+ }
139
+ child = child.getNextSibling();
140
+ }
141
+ return gradients;
142
+ };
143
+ const asBoundingBox = (rect) => ({
144
+ x: rect.origin.x,
145
+ y: rect.origin.y,
146
+ width: rect.size.width,
147
+ height: rect.size.height,
148
+ });
149
+ const appendGradient = (snapshot, path, entry, opacity) => {
150
+ if (entry.stops.length === 0) {
151
+ return;
152
+ }
153
+ const rescaled = opacity >= 1
154
+ ? entry.stops
155
+ : entry.stops
156
+ .map((stop) => makeColorStop(stop.offset, scaledAlpha(stop.color, opacity)))
157
+ .filter((stop) => stop !== null);
158
+ // fillOpacity/strokeOpacity < 1 on a gradient re-builds each stop with a
159
+ // scaled alpha (see makeColorStop's WORKAROUND note); if that rebuild
160
+ // itself fails, fall back to the already-working full-opacity stops
161
+ // rather than losing the gradient entirely over an opacity nuance.
162
+ const stops = rescaled.length > 0 ? rescaled : entry.stops;
163
+ const [hasBounds, tightBounds] = path.getBounds();
164
+ const bounds = hasBounds ? tightBounds : Graphene.Rect.zero();
165
+ const box = asBoundingBox(bounds);
166
+ const { descriptor } = entry;
167
+ if (descriptor.type === "linear") {
168
+ const start = resolveGradientPoint(box, descriptor.x1, descriptor.y1, descriptor.units);
169
+ const end = resolveGradientPoint(box, descriptor.x2, descriptor.y2, descriptor.units);
170
+ snapshot.appendLinearGradient(bounds, new Graphene.Point(start), new Graphene.Point(end), stops);
171
+ return;
172
+ }
173
+ const center = resolveGradientPoint(box, descriptor.cx, descriptor.cy, descriptor.units);
174
+ const { hradius, vradius } = resolveGradientRadius(box, descriptor.r, descriptor.units);
175
+ snapshot.appendRadialGradient(bounds, new Graphene.Point(center), hradius, vradius, 0, 1, stops);
176
+ };
177
+ // --- drawing ---------------------------------------------------------------
178
+ const applyTransformOps = (snapshot, ops) => {
179
+ for (const op of ops) {
180
+ switch (op.type) {
181
+ case "translate":
182
+ snapshot.translate(new Graphene.Point({ x: op.x, y: op.y }));
183
+ break;
184
+ case "scale":
185
+ snapshot.scale(op.x, op.y);
186
+ break;
187
+ case "rotate":
188
+ snapshot.rotate(op.angleDeg);
189
+ break;
190
+ case "matrix":
191
+ snapshot.transform(Gsk.Transform.new().matrix2d(op.a, op.b, op.c, op.d, op.e, op.f));
192
+ break;
193
+ }
194
+ }
195
+ };
196
+ const paintFill = (snapshot, path, paint, opacity, fillRule, gradients) => {
197
+ if (paint.kind === "color") {
198
+ snapshot.appendFill(path, fillRule, scaledAlpha(paint.rgba, opacity));
199
+ return;
200
+ }
201
+ const gradient = gradients.get(paint.id);
202
+ if (!gradient) {
203
+ // url(#missing-id): SVG renders nothing for that paint, not an error.
204
+ return;
205
+ }
206
+ snapshot.pushFill(path, fillRule);
207
+ appendGradient(snapshot, path, gradient, opacity);
208
+ snapshot.pop();
209
+ };
210
+ const paintStroke = (snapshot, path, shape, paint, opacity, gradients) => {
211
+ const stroke = Gsk.Stroke.new(shape.strokeWidth);
212
+ stroke.setLineCap(shape.strokeLinecap);
213
+ stroke.setLineJoin(shape.strokeLinejoin);
214
+ stroke.setMiterLimit(shape.strokeMiterlimit);
215
+ if (shape.strokeDasharray && shape.strokeDasharray.length > 0) {
216
+ stroke.setDash(shape.strokeDasharray);
217
+ stroke.setDashOffset(shape.strokeDashoffset);
218
+ }
219
+ if (paint.kind === "color") {
220
+ snapshot.appendStroke(path, stroke, scaledAlpha(paint.rgba, opacity));
221
+ return;
222
+ }
223
+ const gradient = gradients.get(paint.id);
224
+ if (!gradient) {
225
+ return;
226
+ }
227
+ snapshot.pushStroke(path, stroke);
228
+ appendGradient(snapshot, path, gradient, opacity);
229
+ snapshot.pop();
230
+ };
231
+ const drawShape = (snapshot, shape, gradients) => {
232
+ const path = shape.path;
233
+ if (!path || path.isEmpty()) {
234
+ return;
235
+ }
236
+ const groupOpacity = clamp01(shape.opacity);
237
+ const needsGroup = groupOpacity < 1;
238
+ if (needsGroup) {
239
+ snapshot.pushOpacity(groupOpacity);
240
+ }
241
+ if (shape.fill) {
242
+ paintFill(snapshot, path, shape.fill, clamp01(shape.fillOpacity), shape.fillRule, gradients);
243
+ }
244
+ if (shape.stroke && shape.strokeWidth > 0) {
245
+ paintStroke(snapshot, path, shape, shape.stroke, clamp01(shape.strokeOpacity), gradients);
246
+ }
247
+ if (needsGroup) {
248
+ snapshot.pop();
249
+ }
250
+ };
251
+ const drawChildren = (snapshot, parent, gradients) => {
252
+ let child = parent.getFirstChild();
253
+ while (child) {
254
+ drawNode(snapshot, child, gradients);
255
+ child = child.getNextSibling();
256
+ }
257
+ };
258
+ const drawNode = (snapshot, widget, gradients) => {
259
+ const descriptor = nodeDescriptors.get(widget);
260
+ if (!descriptor) {
261
+ return;
262
+ }
263
+ switch (descriptor.kind) {
264
+ case "shape":
265
+ drawShape(snapshot, descriptor, gradients);
266
+ return;
267
+ case "g": {
268
+ const opacity = clamp01(descriptor.opacity);
269
+ const needsOpacity = opacity < 1;
270
+ snapshot.save();
271
+ applyTransformOps(snapshot, descriptor.transformOps);
272
+ if (needsOpacity) {
273
+ snapshot.pushOpacity(opacity);
274
+ }
275
+ drawChildren(snapshot, widget, gradients);
276
+ if (needsOpacity) {
277
+ snapshot.pop();
278
+ }
279
+ snapshot.restore();
280
+ return;
281
+ }
282
+ // defs/gradient/stop are resources, not paint; a nested <Svg> is not a
283
+ // supported composition (undocumented, no-op rather than a crash).
284
+ case "defs":
285
+ case "gradient":
286
+ case "stop":
287
+ case "svg":
288
+ return;
289
+ }
290
+ };
291
+ // --- widget registration ---------------------------------------------------
292
+ let RnGtkxSvgNodeClass = null;
293
+ const ensureRegistered = () => {
294
+ if (RnGtkxSvgNodeClass) {
295
+ return RnGtkxSvgNodeClass;
296
+ }
297
+ // Box, not a bare Widget: the reconciler only auto-attaches JSX children
298
+ // (generic set_parent/insert_after) for widget types that carry a
299
+ // registered "children" behavior, resolved by walking the GType ancestry
300
+ // chain (@gtkx/react's typeInfoFor/buildTypeInfo). Plain GtkWidget has no
301
+ // such behavior — only concrete container types like Box do — which is
302
+ // also why RnGtkxViewBox (view-box.ts) is a Box subclass, not a bare
303
+ // Widget one. GtkBox's own default BoxLayout then measures/allocates
304
+ // these children, but harmlessly: they report a natural size of 0x0 (no
305
+ // style, no content) and their own snapshot() no-ops for anything that
306
+ // is not the mounted <Svg> root (see below), so nothing is ever
307
+ // double-painted through GTK's normal child-snapshot path.
308
+ class RnGtkxSvgNode extends Gtk.Box {
309
+ // Only ever invoked by GTK on the mounted <Svg> root (nothing calls
310
+ // snapshotChild() on the inert descendant instances). Defensive no-op
311
+ // otherwise, so a stray direct call never throws.
312
+ snapshot(snapshot) {
313
+ const descriptor = nodeDescriptors.get(this);
314
+ if (!descriptor || descriptor.kind !== "svg") {
315
+ return;
316
+ }
317
+ const width = this.getWidth();
318
+ const height = this.getHeight();
319
+ if (width <= 0 || height <= 0) {
320
+ return;
321
+ }
322
+ const transform = resolveViewBoxTransform(descriptor.viewBox, width, height, descriptor.preserveAspectRatio);
323
+ const gradients = collectGradients(this);
324
+ // RC2-WORKAROUND(graphene-rect-nested-boxed-props) — row in
325
+ // docs/gtkx-rc2-notes.md. `new Graphene.Rect({ origin: new
326
+ // Graphene.Point(...), size: new Graphene.Size(...) })` hits the same
327
+ // native "Expected an Object for Boxed field write type, got Object"
328
+ // as Gsk.ColorStop's `color` field (see makeColorStop below) — Rect
329
+ // has a working escape hatch, `.alloc().init(x, y, w, h)`, that
330
+ // ColorStop does not.
331
+ //
332
+ // SVG clips to the viewport by default (no overflow:visible opt-out
333
+ // in this API — deliberate cut, see epic.md).
334
+ snapshot.pushClip(Graphene.Rect.alloc().init(0, 0, width, height));
335
+ snapshot.save();
336
+ snapshot.translate(new Graphene.Point({
337
+ x: transform.translateX,
338
+ y: transform.translateY,
339
+ }));
340
+ snapshot.scale(transform.scaleX, transform.scaleY);
341
+ drawChildren(snapshot, this, gradients);
342
+ snapshot.restore();
343
+ snapshot.pop();
344
+ }
345
+ }
346
+ // Explicit typeName: bundlers minify class names (same reasoning as
347
+ // RnGtkxLayout/RnGtkxViewBox).
348
+ registerClass(RnGtkxSvgNode, { typeName: "RnGtkxSvgNode" });
349
+ RnGtkxSvgNodeClass = RnGtkxSvgNode;
350
+ return RnGtkxSvgNode;
351
+ };
352
+ let component = null;
353
+ export const getSvgNodeComponent = () => {
354
+ if (component) {
355
+ return component;
356
+ }
357
+ ensureRegistered();
358
+ component = createElementComponent("RnGtkxSvgNode");
359
+ return component;
360
+ };
361
+ /** Imperative invalidation channel for SVG: paint-only changes (including
362
+ * Animated-driven ones) call this instead of queueAllocate/queueResize —
363
+ * nothing here ever touches Yoga. */
364
+ export const queueSvgRedraw = (rootWidget) => {
365
+ rootWidget.queueDraw();
366
+ };
367
+ //# sourceMappingURL=svg-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-node.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/svg-node.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,gEAAgE;AAChE,2EAA2E;AAC3E,0EAA0E;AAC1E,oEAAoE;AACpE,sBAAsB;AACtB,EAAE;AACF,qEAAqE;AACrE,6EAA6E;AAC7E,qEAAqE;AACrE,4EAA4E;AAC5E,6EAA6E;AAC7E,4BAA4B;AAC5B,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM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;IAC7D,UAAU,CAAC,SAAS,EAAE,CAAA;AACxB,CAAC,CAAA","sourcesContent":["// RnGtkxSvgNode — one GObject class (registerClass, same mechanism as\n// RnGtkxLayout/RnGtkxViewBox) reused for the <Svg> root AND every descendant\n// (<G>, <Path>, <Rect>, ..., <Defs>, <LinearGradient>, <Stop>). Descendants\n// are ordinary GTK children (the reconciler's generic set_parent/insert_after\n// attachment — the same one View relies on) that GTK never snapshots on its\n// own, because nothing ever calls snapshotChild() on them: only the mounted\n// <Svg> instance's snapshot() vfunc actually runs, and it walks\n// getFirstChild()/getNextSibling() itself, reading each node's role from a\n// WeakMap (native wrappers get re-created by the runtime, so per-instance\n// state cannot live on `this` — same reasoning as hooksByManager in\n// layout-manager.ts).\n//\n// `Gtk.Widget.snapshot()` is a real, working vfunc in gtkx's codegen\n// (node_modules/@gtkx/gi/gtk/gtk.js, registerWrapperClass(Widget, ...) lists\n// it with byteOffset 320) even though it is missing from the shipped\n// `gtk.d.ts` — the type generator drops it, the codegen that actually wires\n// vfuncs does not. Verified by reading the generated registry before writing\n// any of this; see epic.md.\nimport * as Gdk from \"@gtkx/gi/gdk\"\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport * as Gsk from \"@gtkx/gi/gsk\"\nimport * as Gtk from \"@gtkx/gi/gtk\"\nimport { createElementComponent } from \"@gtkx/react/internal\"\nimport { registerClass } from \"@gtkx/runtime\"\nimport { parseColor } from \"../../style/colors\"\nimport {\n resolveGradientPoint,\n resolveGradientRadius,\n type BoundingBox,\n} from \"../../svg/gradient-geometry\"\nimport type { SvgTransformOp } from \"../../svg/transform\"\nimport {\n resolveViewBoxTransform,\n type PreserveAspectRatio,\n type ViewBox,\n} from \"../../svg/view-box\"\n\n// --- descriptors --------------------------------------------------------\n\nexport type SvgPaintSpec =\n { kind: \"color\"; rgba: Gdk.RGBA } | { kind: \"ref\"; id: string }\n\nexport type SvgGradientUnits = \"objectBoundingBox\" | \"userSpaceOnUse\"\n\nexport type SvgSvgDescriptor = {\n kind: \"svg\"\n viewBox: ViewBox | null\n preserveAspectRatio: PreserveAspectRatio\n}\n\nexport type SvgGroupDescriptor = {\n kind: \"g\"\n transformOps: SvgTransformOp[]\n opacity: number\n}\n\nexport type SvgShapeDescriptor = {\n kind: \"shape\"\n path: Gsk.Path | null\n fill: SvgPaintSpec | null\n fillOpacity: number\n fillRule: Gsk.FillRule\n stroke: SvgPaintSpec | null\n strokeOpacity: number\n strokeWidth: number\n strokeLinecap: Gsk.LineCap\n strokeLinejoin: Gsk.LineJoin\n strokeMiterlimit: number\n strokeDasharray: number[] | null\n strokeDashoffset: number\n opacity: number\n}\n\nexport type SvgDefsDescriptor = { kind: \"defs\" }\n\nexport type SvgLinearGradientDescriptor = {\n kind: \"gradient\"\n type: \"linear\"\n id: string\n units: SvgGradientUnits\n x1: number\n y1: number\n x2: number\n y2: number\n}\n\nexport type SvgRadialGradientDescriptor = {\n kind: \"gradient\"\n type: \"radial\"\n id: string\n units: SvgGradientUnits\n cx: number\n cy: number\n r: number\n}\n\nexport type SvgStopDescriptor = {\n kind: \"stop\"\n offset: number\n color: Gdk.RGBA\n}\n\nexport type SvgNodeDescriptor =\n | SvgSvgDescriptor\n | SvgGroupDescriptor\n | SvgShapeDescriptor\n | SvgDefsDescriptor\n | SvgLinearGradientDescriptor\n | SvgRadialGradientDescriptor\n | SvgStopDescriptor\n\nconst nodeDescriptors = new WeakMap<Gtk.Widget, SvgNodeDescriptor>()\n\nexport const setSvgNodeDescriptor = (\n widget: Gtk.Widget,\n descriptor: SvgNodeDescriptor,\n): void => {\n nodeDescriptors.set(widget, descriptor)\n}\n\nexport const getSvgNodeDescriptor = (\n widget: Gtk.Widget,\n): SvgNodeDescriptor | undefined => nodeDescriptors.get(widget)\n\n// --- paint resolution ----------------------------------------------------\n\n// `parseColor` also passes CSS variables (`var(--x)`) and legacy GTK named\n// colors (`@name`) through unchanged, for the CSS-cascade styling path\n// elsewhere in this codebase. Raw Gsk paint nodes have no cascade to resolve\n// those against — deliberate cut (epic.md): SVG fill/stroke only accepts\n// static CSS colors (hex/rgb/hsl/named/transparent), not PlatformColor.\nexport const resolveSvgColor = (spec: string | undefined): Gdk.RGBA | null => {\n if (!spec) {\n return null\n }\n const normalized = parseColor(spec)\n if (\n !normalized ||\n normalized.startsWith(\"var(\") ||\n normalized.startsWith(\"@\")\n ) {\n return null\n }\n const rgba = new Gdk.RGBA()\n return rgba.parse(normalized) ? rgba : null\n}\n\nconst URL_REF_PATTERN = /^url\\(#(.+)\\)$/\n\nexport const resolveSvgPaint = (\n spec: string | undefined,\n): SvgPaintSpec | null => {\n if (!spec || spec === \"none\") {\n return null\n }\n const match = URL_REF_PATTERN.exec(spec.trim())\n if (match) {\n return { kind: \"ref\", id: match[1]! }\n }\n const rgba = resolveSvgColor(spec)\n return rgba ? { kind: \"color\", rgba } : null\n}\n\nconst scaledAlpha = (rgba: Gdk.RGBA, factor: number): Gdk.RGBA =>\n factor >= 1\n ? rgba\n : new Gdk.RGBA({\n red: rgba.red,\n green: rgba.green,\n blue: rgba.blue,\n alpha: rgba.alpha * factor,\n })\n\nconst clamp01 = (value: number): number => Math.max(0, Math.min(1, value))\n\n// --- gradients -------------------------------------------------------------\n\ntype GradientEntry = {\n descriptor: SvgLinearGradientDescriptor | SvgRadialGradientDescriptor\n stops: Gsk.ColorStop[]\n}\n\n// RC2-WORKAROUND(gsk-colorstop-boxed-write) — row in docs/gtkx-rc2-notes.md.\n// Writing a Gdk.RGBA into a Gsk.ColorStop's `color` field crashes in the\n// native addon (@gtkx/native)\n// with \"Expected an Object for Boxed field write type, got Object\" —\n// verified through THREE independent paths, all hitting the same native\n// code: the generated constructor (uses the wrong of two RGBA descriptors,\n// _desc1 instead of the inline _desc2 — a real codegen bug), the property\n// setter (uses the documented-correct _desc2 descriptor and STILL fails,\n// which rules out a simple descriptor mix-up as the whole story), and a\n// bypass that skips ColorStop construction and hands appendLinearGradient a\n// plain {offset, color} object array instead (fails differently, with \"No\n// native handle associated with Object\" — the array marshaling genuinely\n// requires a native-backed instance per element, so there is no JS-level\n// escape hatch). This is a native-addon bug, not something fixable from\n// application code.\n//\n// Rather than crash every app that uses a gradient, or drop the gradient\n// components from the API while their descriptor-building is fully correct\n// and tested, a stop that fails to construct is treated exactly like a\n// missing gradient reference (see the url(#missing) test): the shape using\n// it simply paints no fill/stroke for that paint, instead of throwing.\nconst makeColorStop = (\n offset: number,\n color: Gdk.RGBA,\n): Gsk.ColorStop | null => {\n try {\n const stop = new Gsk.ColorStop()\n stop.offset = offset\n stop.color = color\n return stop\n } catch {\n return null\n }\n}\n\nconst collectStops = (gradientWidget: Gtk.Widget): Gsk.ColorStop[] => {\n const stops: Gsk.ColorStop[] = []\n let child = gradientWidget.getFirstChild()\n while (child) {\n const descriptor = nodeDescriptors.get(child)\n if (descriptor?.kind === \"stop\") {\n const stop = makeColorStop(descriptor.offset, descriptor.color)\n if (stop) {\n stops.push(stop)\n }\n }\n child = child.getNextSibling()\n }\n return stops\n}\n\n// Only DIRECT <Defs> children of <Svg> are scanned (a deliberate simplicity\n// cut — every real react-native-svg example keeps Defs at the top).\nconst collectGradients = (root: Gtk.Widget): Map<string, GradientEntry> => {\n const gradients = new Map<string, GradientEntry>()\n let child = root.getFirstChild()\n while (child) {\n if (nodeDescriptors.get(child)?.kind === \"defs\") {\n let gradientNode = child.getFirstChild()\n while (gradientNode) {\n const descriptor = nodeDescriptors.get(gradientNode)\n if (descriptor?.kind === \"gradient\") {\n gradients.set(descriptor.id, {\n descriptor,\n stops: collectStops(gradientNode),\n })\n }\n gradientNode = gradientNode.getNextSibling()\n }\n }\n child = child.getNextSibling()\n }\n return gradients\n}\n\nconst asBoundingBox = (rect: Graphene.Rect): BoundingBox => ({\n x: rect.origin.x,\n y: rect.origin.y,\n width: rect.size.width,\n height: rect.size.height,\n})\n\nconst appendGradient = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n entry: GradientEntry,\n opacity: number,\n): void => {\n if (entry.stops.length === 0) {\n return\n }\n const rescaled =\n opacity >= 1\n ? entry.stops\n : entry.stops\n .map((stop) =>\n makeColorStop(stop.offset, scaledAlpha(stop.color, opacity)),\n )\n .filter((stop): stop is Gsk.ColorStop => stop !== null)\n // fillOpacity/strokeOpacity < 1 on a gradient re-builds each stop with a\n // scaled alpha (see makeColorStop's WORKAROUND note); if that rebuild\n // itself fails, fall back to the already-working full-opacity stops\n // rather than losing the gradient entirely over an opacity nuance.\n const stops = rescaled.length > 0 ? rescaled : entry.stops\n const [hasBounds, tightBounds] = path.getBounds()\n const bounds = hasBounds ? tightBounds : Graphene.Rect.zero()\n const box = asBoundingBox(bounds)\n const { descriptor } = entry\n\n if (descriptor.type === \"linear\") {\n const start = resolveGradientPoint(\n box,\n descriptor.x1,\n descriptor.y1,\n descriptor.units,\n )\n const end = resolveGradientPoint(\n box,\n descriptor.x2,\n descriptor.y2,\n descriptor.units,\n )\n snapshot.appendLinearGradient(\n bounds,\n new Graphene.Point(start),\n new Graphene.Point(end),\n stops,\n )\n return\n }\n\n const center = resolveGradientPoint(\n box,\n descriptor.cx,\n descriptor.cy,\n descriptor.units,\n )\n const { hradius, vradius } = resolveGradientRadius(\n box,\n descriptor.r,\n descriptor.units,\n )\n snapshot.appendRadialGradient(\n bounds,\n new Graphene.Point(center),\n hradius,\n vradius,\n 0,\n 1,\n stops,\n )\n}\n\n// --- drawing ---------------------------------------------------------------\n\nconst applyTransformOps = (\n snapshot: Gtk.Snapshot,\n ops: SvgTransformOp[],\n): void => {\n for (const op of ops) {\n switch (op.type) {\n case \"translate\":\n snapshot.translate(new Graphene.Point({ x: op.x, y: op.y }))\n break\n case \"scale\":\n snapshot.scale(op.x, op.y)\n break\n case \"rotate\":\n snapshot.rotate(op.angleDeg)\n break\n case \"matrix\":\n snapshot.transform(\n Gsk.Transform.new().matrix2d(op.a, op.b, op.c, op.d, op.e, op.f),\n )\n break\n }\n }\n}\n\nconst paintFill = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n paint: SvgPaintSpec,\n opacity: number,\n fillRule: Gsk.FillRule,\n gradients: Map<string, GradientEntry>,\n): void => {\n if (paint.kind === \"color\") {\n snapshot.appendFill(path, fillRule, scaledAlpha(paint.rgba, opacity))\n return\n }\n const gradient = gradients.get(paint.id)\n if (!gradient) {\n // url(#missing-id): SVG renders nothing for that paint, not an error.\n return\n }\n snapshot.pushFill(path, fillRule)\n appendGradient(snapshot, path, gradient, opacity)\n snapshot.pop()\n}\n\nconst paintStroke = (\n snapshot: Gtk.Snapshot,\n path: Gsk.Path,\n shape: SvgShapeDescriptor,\n paint: SvgPaintSpec,\n opacity: number,\n gradients: Map<string, GradientEntry>,\n): void => {\n const stroke = Gsk.Stroke.new(shape.strokeWidth)\n stroke.setLineCap(shape.strokeLinecap)\n stroke.setLineJoin(shape.strokeLinejoin)\n stroke.setMiterLimit(shape.strokeMiterlimit)\n if (shape.strokeDasharray && shape.strokeDasharray.length > 0) {\n stroke.setDash(shape.strokeDasharray)\n stroke.setDashOffset(shape.strokeDashoffset)\n }\n if (paint.kind === \"color\") {\n snapshot.appendStroke(path, stroke, scaledAlpha(paint.rgba, opacity))\n return\n }\n const gradient = gradients.get(paint.id)\n if (!gradient) {\n return\n }\n snapshot.pushStroke(path, stroke)\n appendGradient(snapshot, path, gradient, opacity)\n snapshot.pop()\n}\n\nconst drawShape = (\n snapshot: Gtk.Snapshot,\n shape: SvgShapeDescriptor,\n gradients: Map<string, GradientEntry>,\n): void => {\n const path = shape.path\n if (!path || path.isEmpty()) {\n return\n }\n const groupOpacity = clamp01(shape.opacity)\n const needsGroup = groupOpacity < 1\n if (needsGroup) {\n snapshot.pushOpacity(groupOpacity)\n }\n if (shape.fill) {\n paintFill(\n snapshot,\n path,\n shape.fill,\n clamp01(shape.fillOpacity),\n shape.fillRule,\n gradients,\n )\n }\n if (shape.stroke && shape.strokeWidth > 0) {\n paintStroke(\n snapshot,\n path,\n shape,\n shape.stroke,\n clamp01(shape.strokeOpacity),\n gradients,\n )\n }\n if (needsGroup) {\n snapshot.pop()\n }\n}\n\nconst drawChildren = (\n snapshot: Gtk.Snapshot,\n parent: Gtk.Widget,\n gradients: Map<string, GradientEntry>,\n): void => {\n let child = parent.getFirstChild()\n while (child) {\n drawNode(snapshot, child, gradients)\n child = child.getNextSibling()\n }\n}\n\nconst drawNode = (\n snapshot: Gtk.Snapshot,\n widget: Gtk.Widget,\n gradients: Map<string, GradientEntry>,\n): void => {\n const descriptor = nodeDescriptors.get(widget)\n if (!descriptor) {\n return\n }\n switch (descriptor.kind) {\n case \"shape\":\n drawShape(snapshot, descriptor, gradients)\n return\n case \"g\": {\n const opacity = clamp01(descriptor.opacity)\n const needsOpacity = opacity < 1\n snapshot.save()\n applyTransformOps(snapshot, descriptor.transformOps)\n if (needsOpacity) {\n snapshot.pushOpacity(opacity)\n }\n drawChildren(snapshot, widget, gradients)\n if (needsOpacity) {\n snapshot.pop()\n }\n snapshot.restore()\n return\n }\n // defs/gradient/stop are resources, not paint; a nested <Svg> is not a\n // supported composition (undocumented, no-op rather than a crash).\n case \"defs\":\n case \"gradient\":\n case \"stop\":\n case \"svg\":\n return\n }\n}\n\n// --- widget registration ---------------------------------------------------\n\nlet RnGtkxSvgNodeClass: (new () => Gtk.Widget) | null = null\n\nconst ensureRegistered = (): new () => Gtk.Widget => {\n if (RnGtkxSvgNodeClass) {\n return RnGtkxSvgNodeClass\n }\n\n // Box, not a bare Widget: the reconciler only auto-attaches JSX children\n // (generic set_parent/insert_after) for widget types that carry a\n // registered \"children\" behavior, resolved by walking the GType ancestry\n // chain (@gtkx/react's typeInfoFor/buildTypeInfo). Plain GtkWidget has no\n // such behavior — only concrete container types like Box do — which is\n // also why RnGtkxViewBox (view-box.ts) is a Box subclass, not a bare\n // Widget one. GtkBox's own default BoxLayout then measures/allocates\n // these children, but harmlessly: they report a natural size of 0x0 (no\n // style, no content) and their own snapshot() no-ops for anything that\n // is not the mounted <Svg> root (see below), so nothing is ever\n // double-painted through GTK's normal child-snapshot path.\n class RnGtkxSvgNode extends Gtk.Box {\n // Only ever invoked by GTK on the mounted <Svg> root (nothing calls\n // snapshotChild() on the inert descendant instances). Defensive no-op\n // otherwise, so a stray direct call never throws.\n snapshot(snapshot: Gtk.Snapshot): void {\n const descriptor = nodeDescriptors.get(this)\n if (!descriptor || descriptor.kind !== \"svg\") {\n return\n }\n const width = this.getWidth()\n const height = this.getHeight()\n if (width <= 0 || height <= 0) {\n return\n }\n const transform = resolveViewBoxTransform(\n descriptor.viewBox,\n width,\n height,\n descriptor.preserveAspectRatio,\n )\n const gradients = collectGradients(this)\n // RC2-WORKAROUND(graphene-rect-nested-boxed-props) — row in\n // docs/gtkx-rc2-notes.md. `new Graphene.Rect({ origin: new\n // Graphene.Point(...), size: new Graphene.Size(...) })` hits the same\n // native \"Expected an Object for Boxed field write type, got Object\"\n // as Gsk.ColorStop's `color` field (see makeColorStop below) — Rect\n // has a working escape hatch, `.alloc().init(x, y, w, h)`, that\n // ColorStop does not.\n //\n // SVG clips to the viewport by default (no overflow:visible opt-out\n // in this API — deliberate cut, see epic.md).\n snapshot.pushClip(Graphene.Rect.alloc().init(0, 0, width, height))\n snapshot.save()\n snapshot.translate(\n new Graphene.Point({\n x: transform.translateX,\n y: transform.translateY,\n }),\n )\n snapshot.scale(transform.scaleX, transform.scaleY)\n drawChildren(snapshot, this, gradients)\n snapshot.restore()\n snapshot.pop()\n }\n }\n // Explicit typeName: bundlers minify class names (same reasoning as\n // RnGtkxLayout/RnGtkxViewBox).\n registerClass(RnGtkxSvgNode, { typeName: \"RnGtkxSvgNode\" })\n RnGtkxSvgNodeClass = RnGtkxSvgNode\n return RnGtkxSvgNode\n}\n\ntype SvgNodeComponent = ReturnType<typeof createElementComponent>\n\nlet component: SvgNodeComponent | null = null\n\nexport const getSvgNodeComponent = (): SvgNodeComponent => {\n if (component) {\n return component\n }\n ensureRegistered()\n component = createElementComponent(\"RnGtkxSvgNode\")\n return component\n}\n\n/** Imperative invalidation channel for SVG: paint-only changes (including\n * Animated-driven ones) call this instead of queueAllocate/queueResize —\n * nothing here ever touches Yoga. */\nexport const queueSvgRedraw = (rootWidget: Gtk.Widget): void => {\n rootWidget.queueDraw()\n}\n"]}
@@ -1,14 +1,19 @@
1
1
  // RC2-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc2-notes.md
2
2
  // @gtkx/react's useSignal documents that "each emission runs the handler from
3
3
  // the latest render", and rc.1 delivered that by pinning the handler in a ref
4
- // of its own. rc.2 routes it through React's useEffectEvent instead, and under
5
- // the gtkx reconciler that event ref stops refreshing for components deep in
6
- // the tree: a ScrollView measured at its 8th render still ran the closure
7
- // captured at mount (a plain ref in the same component reported 8, the
8
- // useEffectEvent one reported 1). The consequence is not subtle — the
9
- // mount-time scroll handler windows a VirtualizedList against the data it saw
10
- // at mount, so a list whose rows arrive from a fetch renders EMPTY as soon as
11
- // it is scrolled.
4
+ // of its own. rc.2 routes it through React's useEffectEvent instead, and
5
+ // react-reconciler@0.33.0 only refreshes useEffectEvent in
6
+ // commitBeforeMutationEffects for `case 0` (FunctionComponent) `case 11`
7
+ // (ForwardRef) and `case 15` (SimpleMemoComponent) fall through unrefreshed.
8
+ // Any useEffectEvent inside a memo or forwardRef component is pinned to its
9
+ // mount closure permanently; this has nothing to do with useSignal
10
+ // specifically (confirmed upstream: gtkx-org/gtkx#467) plain
11
+ // useEffectEvent called from an Effect fails identically. It reproduced for
12
+ // us because our ScrollView is a forwardRef (components/scroll-view.tsx) with
13
+ // the useSignal calls inside it; tree depth was a coincidence, not the
14
+ // trigger. The consequence is not subtle — the mount-time scroll handler
15
+ // windows a VirtualizedList against the data it saw at mount, so a list
16
+ // whose rows arrive from a fetch renders EMPTY as soon as it is scrolled.
12
17
  //
13
18
  // Restore the documented contract at the bridge: keep the latest handler in a
14
19
  // ref of our own and hand gtkx a stable wrapper (stable so the connection is
@@ -16,6 +21,11 @@
16
21
  // refreshed in an INSERTION effect — the earliest commit phase, ahead of every
17
22
  // layout effect, so a signal emitted from one (the list's own scroll
18
23
  // corrections) already sees the handler from the render being committed.
24
+ // React fixed the refresh on the 19.3 line (moved into
25
+ // commitMutationEffectsOnFiber, covering `case 0/11/14/15` ahead of child
26
+ // traversal), but there is no stable 0.34.x gtkx release yet and the React
27
+ // canaries pin an exact prerelease peer, so this wrapper stays until a
28
+ // stable React 19.3 ships — not "when useSignal is fixed" (see gtkx#467).
19
29
  import { useSignal as useGtkxSignal } from "@gtkx/react";
20
30
  import { useCallback, useInsertionEffect, useRef } from "react";
21
31
  export const useSignal = (object, signal, handler, options) => {
@@ -1 +1 @@
1
- {"version":3,"file":"use-signal.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/use-signal.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AACtE,8EAA8E;AAC9E,8EAA8E;AAC9E,kBAAkB;AAClB,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,qEAAqE;AACrE,yEAAyE;AACzE,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAI/D,MAAM,CAAC,MAAM,SAAS,GAAyB,CAC7C,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,EAAE;IACF,4EAA4E;IAC5E,iEAAiE;IACjE,MAAM,MAAM,GAAG,MAAM,CAAa,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAClD,kBAAkB,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,OAAO,GAAG,OAAgC,CAAA;IACnD,CAAC,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,EACpC,EAAE,CACH,CAAA;IACD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAmC,EAAE,OAAO,CAAC,CAAA;AAC7E,CAAC,CAAA","sourcesContent":["// RC2-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc2-notes.md\n// @gtkx/react's useSignal documents that \"each emission runs the handler from\n// the latest render\", and rc.1 delivered that by pinning the handler in a ref\n// of its own. rc.2 routes it through React's useEffectEvent instead, and under\n// the gtkx reconciler that event ref stops refreshing for components deep in\n// the tree: a ScrollView measured at its 8th render still ran the closure\n// captured at mount (a plain ref in the same component reported 8, the\n// useEffectEvent one reported 1). The consequence is not subtle — the\n// mount-time scroll handler windows a VirtualizedList against the data it saw\n// at mount, so a list whose rows arrive from a fetch renders EMPTY as soon as\n// it is scrolled.\n//\n// Restore the documented contract at the bridge: keep the latest handler in a\n// ref of our own and hand gtkx a stable wrapper (stable so the connection is\n// never re-established, which is what its useEffectEvent was for). The ref is\n// refreshed in an INSERTION effect — the earliest commit phase, ahead of every\n// layout effect, so a signal emitted from one (the list's own scroll\n// corrections) already sees the handler from the render being committed.\nimport { useSignal as useGtkxSignal } from \"@gtkx/react\"\nimport { useCallback, useInsertionEffect, useRef } from \"react\"\n\ntype AnyHandler = (...args: unknown[]) => unknown\n\nexport const useSignal: typeof useGtkxSignal = (\n object,\n signal,\n handler,\n options,\n) => {\n // The handler type is generic in the signal name; the wrapper only forwards\n // arguments, so it crosses that boundary as an untyped callable.\n const latest = useRef<AnyHandler>(() => undefined)\n useInsertionEffect(() => {\n latest.current = handler as unknown as AnyHandler\n })\n const stable = useCallback<AnyHandler>(\n (...args) => latest.current(...args),\n [],\n )\n useGtkxSignal(object, signal, stable as unknown as typeof handler, options)\n}\n"]}
1
+ {"version":3,"file":"use-signal.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/use-signal.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,8EAA8E;AAC9E,8EAA8E;AAC9E,yEAAyE;AACzE,2DAA2D;AAC3D,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAC5E,mEAAmE;AACnE,+DAA+D;AAC/D,4EAA4E;AAC5E,8EAA8E;AAC9E,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,qEAAqE;AACrE,yEAAyE;AACzE,uDAAuD;AACvD,0EAA0E;AAC1E,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAI/D,MAAM,CAAC,MAAM,SAAS,GAAyB,CAC7C,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,EAAE;IACF,4EAA4E;IAC5E,iEAAiE;IACjE,MAAM,MAAM,GAAG,MAAM,CAAa,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAClD,kBAAkB,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,OAAO,GAAG,OAAgC,CAAA;IACnD,CAAC,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,WAAW,CACxB,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,EACpC,EAAE,CACH,CAAA;IACD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAmC,EAAE,OAAO,CAAC,CAAA;AAC7E,CAAC,CAAA","sourcesContent":["// RC2-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc2-notes.md\n// @gtkx/react's useSignal documents that \"each emission runs the handler from\n// the latest render\", and rc.1 delivered that by pinning the handler in a ref\n// of its own. rc.2 routes it through React's useEffectEvent instead, and\n// react-reconciler@0.33.0 only refreshes useEffectEvent in\n// commitBeforeMutationEffects for `case 0` (FunctionComponent) `case 11`\n// (ForwardRef) and `case 15` (SimpleMemoComponent) fall through unrefreshed.\n// Any useEffectEvent inside a memo or forwardRef component is pinned to its\n// mount closure permanently; this has nothing to do with useSignal\n// specifically (confirmed upstream: gtkx-org/gtkx#467) plain\n// useEffectEvent called from an Effect fails identically. It reproduced for\n// us because our ScrollView is a forwardRef (components/scroll-view.tsx) with\n// the useSignal calls inside it; tree depth was a coincidence, not the\n// trigger. The consequence is not subtle — the mount-time scroll handler\n// windows a VirtualizedList against the data it saw at mount, so a list\n// whose rows arrive from a fetch renders EMPTY as soon as it is scrolled.\n//\n// Restore the documented contract at the bridge: keep the latest handler in a\n// ref of our own and hand gtkx a stable wrapper (stable so the connection is\n// never re-established, which is what its useEffectEvent was for). The ref is\n// refreshed in an INSERTION effect — the earliest commit phase, ahead of every\n// layout effect, so a signal emitted from one (the list's own scroll\n// corrections) already sees the handler from the render being committed.\n// React fixed the refresh on the 19.3 line (moved into\n// commitMutationEffectsOnFiber, covering `case 0/11/14/15` ahead of child\n// traversal), but there is no stable 0.34.x gtkx release yet and the React\n// canaries pin an exact prerelease peer, so this wrapper stays until a\n// stable React 19.3 ships — not \"when useSignal is fixed\" (see gtkx#467).\nimport { useSignal as useGtkxSignal } from \"@gtkx/react\"\nimport { useCallback, useInsertionEffect, useRef } from \"react\"\n\ntype AnyHandler = (...args: unknown[]) => unknown\n\nexport const useSignal: typeof useGtkxSignal = (\n object,\n signal,\n handler,\n options,\n) => {\n // The handler type is generic in the signal name; the wrapper only forwards\n // arguments, so it crosses that boundary as an untyped callable.\n const latest = useRef<AnyHandler>(() => undefined)\n useInsertionEffect(() => {\n latest.current = handler as unknown as AnyHandler\n })\n const stable = useCallback<AnyHandler>(\n (...args) => latest.current(...args),\n [],\n )\n useGtkxSignal(object, signal, stable as unknown as typeof handler, options)\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { GtkAboutDialog, GtkActionBar, GtkAppChooserButton, GtkAppChooserDialog, GtkAppChooserWidget, GtkApplicationWindow, GtkAspectFrame, GtkAssistant, GtkBox, GtkButton, GtkCalendar, GtkCellView, GtkCenterBox, GtkCheckButton, GtkColorButton, GtkColorChooserDialog, GtkColorChooserWidget, GtkColorDialogButton, GtkColumnView, GtkComboBox, GtkComboBoxText, GtkDialog, GtkDragIcon, GtkDrawingArea, GtkDropDown, GtkEditableLabel, GtkEmojiChooser, GtkEntry, GtkExpander, GtkFileChooserDialog, GtkFileChooserWidget, GtkFixed, GtkFlowBox, GtkFlowBoxChild, GtkFontButton, GtkFontChooserDialog, GtkFontChooserWidget, GtkFontDialogButton, GtkFrame, GtkGLArea, GtkGraphicsOffload, GtkGrid, GtkGridView, GtkHeaderBar, GtkIconView, GtkImage, GtkInfoBar, GtkInscription, GtkLabel, GtkLevelBar, GtkLinkButton, GtkListBox, GtkListBoxRow, GtkListView, GtkLockButton, GtkMediaControls, GtkMenuButton, GtkMessageDialog, GtkNotebook, GtkOverlay, GtkPageSetupUnixDialog, GtkPaned, GtkPasswordEntry, GtkPicture, GtkPopover, GtkPopoverBin, GtkPopoverMenu, GtkPopoverMenuBar, GtkPrintUnixDialog, GtkProgressBar, GtkRange, GtkRevealer, GtkScale, GtkScaleButton, GtkScrollbar, GtkScrolledWindow, GtkSearchBar, GtkSearchEntry, GtkSeparator, GtkShortcutLabel, GtkShortcutsGroup, GtkShortcutsSection, GtkShortcutsShortcut, GtkShortcutsWindow, GtkSpinButton, GtkSpinner, GtkStack, GtkStackSidebar, GtkStackSwitcher, GtkStatusbar, GtkSwitch, GtkText, GtkTextView, GtkToggleButton, GtkTreeExpander, GtkTreeView, GtkVideo, GtkViewport, GtkVolumeButton, GtkWindow, GtkWindowControls, GtkWindowHandle, } from "@gtkx/jsx/gtk";
2
+ export { AdwAboutDialog, AdwAboutWindow, AdwActionRow, AdwAlertDialog, AdwApplicationWindow, AdwAvatar, AdwBanner, AdwBin, AdwBottomSheet, AdwBreakpointBin, AdwButtonContent, AdwButtonRow, AdwCarousel, AdwCarouselIndicatorDots, AdwCarouselIndicatorLines, AdwClamp, AdwClampScrollable, AdwComboRow, AdwDialog, AdwEntryRow, AdwExpanderRow, AdwFlap, AdwHeaderBar, AdwInlineViewSwitcher, AdwLayoutSlot, AdwLeaflet, AdwMessageDialog, AdwMultiLayoutView, AdwNavigationPage, AdwNavigationSplitView, AdwNavigationView, AdwOverlaySplitView, AdwPasswordEntryRow, AdwPreferencesDialog, AdwPreferencesGroup, AdwPreferencesPage, AdwPreferencesRow, AdwPreferencesWindow, AdwShortcutLabel, AdwShortcutsDialog, AdwSidebar, AdwSpinRow, AdwSpinner, AdwSplitButton, AdwSqueezer, AdwStatusPage, AdwSwitchRow, AdwTabBar, AdwTabButton, AdwTabOverview, AdwTabView, AdwToastOverlay, AdwToggleGroup, AdwToolbarView, AdwViewStack, AdwViewSwitcher, AdwViewSwitcherBar, AdwViewSwitcherSidebar, AdwViewSwitcherTitle, AdwWindow, AdwWindowTitle, AdwWrapBox, } from "@gtkx/jsx/adw";
@@ -0,0 +1,14 @@
1
+ // GENERATED FILE — do not edit by hand.
2
+ // Produced by scripts/generate-widget-surface.ts. Re-run it inside the VM
3
+ // after `npm run codegen` picks up a gtkx update; see
4
+ // scripts/widget-surface/classification.json for the full classification
5
+ // and .claude/epics/widget-surface/ for the rules behind it.
6
+ //
7
+ // Every widget the classifier resolved to a Gtk.Widget subclass, re-exported
8
+ // RAW. This is the only generated file (besides the hand-written bridge
9
+ // modules) allowed to import @gtkx/jsx directly — src/gtk/widgets.generated
10
+ // and src/adw/widgets.generated pull from here instead, so the
11
+ // no-restricted-imports carve-out for src/gtkx/bridge/** stays the only door.
12
+ export { GtkAboutDialog, GtkActionBar, GtkAppChooserButton, GtkAppChooserDialog, GtkAppChooserWidget, GtkApplicationWindow, GtkAspectFrame, GtkAssistant, GtkBox, GtkButton, GtkCalendar, GtkCellView, GtkCenterBox, GtkCheckButton, GtkColorButton, GtkColorChooserDialog, GtkColorChooserWidget, GtkColorDialogButton, GtkColumnView, GtkComboBox, GtkComboBoxText, GtkDialog, GtkDragIcon, GtkDrawingArea, GtkDropDown, GtkEditableLabel, GtkEmojiChooser, GtkEntry, GtkExpander, GtkFileChooserDialog, GtkFileChooserWidget, GtkFixed, GtkFlowBox, GtkFlowBoxChild, GtkFontButton, GtkFontChooserDialog, GtkFontChooserWidget, GtkFontDialogButton, GtkFrame, GtkGLArea, GtkGraphicsOffload, GtkGrid, GtkGridView, GtkHeaderBar, GtkIconView, GtkImage, GtkInfoBar, GtkInscription, GtkLabel, GtkLevelBar, GtkLinkButton, GtkListBox, GtkListBoxRow, GtkListView, GtkLockButton, GtkMediaControls, GtkMenuButton, GtkMessageDialog, GtkNotebook, GtkOverlay, GtkPageSetupUnixDialog, GtkPaned, GtkPasswordEntry, GtkPicture, GtkPopover, GtkPopoverBin, GtkPopoverMenu, GtkPopoverMenuBar, GtkPrintUnixDialog, GtkProgressBar, GtkRange, GtkRevealer, GtkScale, GtkScaleButton, GtkScrollbar, GtkScrolledWindow, GtkSearchBar, GtkSearchEntry, GtkSeparator, GtkShortcutLabel, GtkShortcutsGroup, GtkShortcutsSection, GtkShortcutsShortcut, GtkShortcutsWindow, GtkSpinButton, GtkSpinner, GtkStack, GtkStackSidebar, GtkStackSwitcher, GtkStatusbar, GtkSwitch, GtkText, GtkTextView, GtkToggleButton, GtkTreeExpander, GtkTreeView, GtkVideo, GtkViewport, GtkVolumeButton, GtkWindow, GtkWindowControls, GtkWindowHandle, } from "@gtkx/jsx/gtk";
13
+ export { AdwAboutDialog, AdwAboutWindow, AdwActionRow, AdwAlertDialog, AdwApplicationWindow, AdwAvatar, AdwBanner, AdwBin, AdwBottomSheet, AdwBreakpointBin, AdwButtonContent, AdwButtonRow, AdwCarousel, AdwCarouselIndicatorDots, AdwCarouselIndicatorLines, AdwClamp, AdwClampScrollable, AdwComboRow, AdwDialog, AdwEntryRow, AdwExpanderRow, AdwFlap, AdwHeaderBar, AdwInlineViewSwitcher, AdwLayoutSlot, AdwLeaflet, AdwMessageDialog, AdwMultiLayoutView, AdwNavigationPage, AdwNavigationSplitView, AdwNavigationView, AdwOverlaySplitView, AdwPasswordEntryRow, AdwPreferencesDialog, AdwPreferencesGroup, AdwPreferencesPage, AdwPreferencesRow, AdwPreferencesWindow, AdwShortcutLabel, AdwShortcutsDialog, AdwSidebar, AdwSpinRow, AdwSpinner, AdwSplitButton, AdwSqueezer, AdwStatusPage, AdwSwitchRow, AdwTabBar, AdwTabButton, AdwTabOverview, AdwTabView, AdwToastOverlay, AdwToggleGroup, AdwToolbarView, AdwViewStack, AdwViewSwitcher, AdwViewSwitcherBar, AdwViewSwitcherSidebar, AdwViewSwitcherTitle, AdwWindow, AdwWindowTitle, AdwWrapBox, } from "@gtkx/jsx/adw";
14
+ //# sourceMappingURL=widgets.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.generated.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/widgets.generated.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,0EAA0E;AAC1E,sDAAsD;AACtD,yEAAyE;AACzE,6DAA6D;AAC7D,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,4EAA4E;AAC5E,+DAA+D;AAC/D,8EAA8E;AAE9E,OAAO,EACL,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,MAAM,EACN,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,eAAe,EACf,SAAS,EACT,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,mBAA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ACpB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,UAAU,GACX,MAAM,eAAe,CAAA","sourcesContent":["// GENERATED FILE — do not edit by hand.\n// Produced by scripts/generate-widget-surface.ts. Re-run it inside the VM\n// after `npm run codegen` picks up a gtkx update; see\n// scripts/widget-surface/classification.json for the full classification\n// and .claude/epics/widget-surface/ for the rules behind it.\n//\n// Every widget the classifier resolved to a Gtk.Widget subclass, re-exported\n// RAW. This is the only generated file (besides the hand-written bridge\n// modules) allowed to import @gtkx/jsx directly — src/gtk/widgets.generated\n// and src/adw/widgets.generated pull from here instead, so the\n// no-restricted-imports carve-out for src/gtkx/bridge/** stays the only door.\n\nexport {\n GtkAboutDialog,\n GtkActionBar,\n GtkAppChooserButton,\n GtkAppChooserDialog,\n GtkAppChooserWidget,\n GtkApplicationWindow,\n GtkAspectFrame,\n GtkAssistant,\n GtkBox,\n GtkButton,\n GtkCalendar,\n GtkCellView,\n GtkCenterBox,\n GtkCheckButton,\n GtkColorButton,\n GtkColorChooserDialog,\n GtkColorChooserWidget,\n GtkColorDialogButton,\n GtkColumnView,\n GtkComboBox,\n GtkComboBoxText,\n GtkDialog,\n GtkDragIcon,\n GtkDrawingArea,\n GtkDropDown,\n GtkEditableLabel,\n GtkEmojiChooser,\n GtkEntry,\n GtkExpander,\n GtkFileChooserDialog,\n GtkFileChooserWidget,\n GtkFixed,\n GtkFlowBox,\n GtkFlowBoxChild,\n GtkFontButton,\n GtkFontChooserDialog,\n GtkFontChooserWidget,\n GtkFontDialogButton,\n GtkFrame,\n GtkGLArea,\n GtkGraphicsOffload,\n GtkGrid,\n GtkGridView,\n GtkHeaderBar,\n GtkIconView,\n GtkImage,\n GtkInfoBar,\n GtkInscription,\n GtkLabel,\n GtkLevelBar,\n GtkLinkButton,\n GtkListBox,\n GtkListBoxRow,\n GtkListView,\n GtkLockButton,\n GtkMediaControls,\n GtkMenuButton,\n GtkMessageDialog,\n GtkNotebook,\n GtkOverlay,\n GtkPageSetupUnixDialog,\n GtkPaned,\n GtkPasswordEntry,\n GtkPicture,\n GtkPopover,\n GtkPopoverBin,\n GtkPopoverMenu,\n GtkPopoverMenuBar,\n GtkPrintUnixDialog,\n GtkProgressBar,\n GtkRange,\n GtkRevealer,\n GtkScale,\n GtkScaleButton,\n GtkScrollbar,\n GtkScrolledWindow,\n GtkSearchBar,\n GtkSearchEntry,\n GtkSeparator,\n GtkShortcutLabel,\n GtkShortcutsGroup,\n GtkShortcutsSection,\n GtkShortcutsShortcut,\n GtkShortcutsWindow,\n GtkSpinButton,\n GtkSpinner,\n GtkStack,\n GtkStackSidebar,\n GtkStackSwitcher,\n GtkStatusbar,\n GtkSwitch,\n GtkText,\n GtkTextView,\n GtkToggleButton,\n GtkTreeExpander,\n GtkTreeView,\n GtkVideo,\n GtkViewport,\n GtkVolumeButton,\n GtkWindow,\n GtkWindowControls,\n GtkWindowHandle,\n} from \"@gtkx/jsx/gtk\"\n\nexport {\n AdwAboutDialog,\n AdwAboutWindow,\n AdwActionRow,\n AdwAlertDialog,\n AdwApplicationWindow,\n AdwAvatar,\n AdwBanner,\n AdwBin,\n AdwBottomSheet,\n AdwBreakpointBin,\n AdwButtonContent,\n AdwButtonRow,\n AdwCarousel,\n AdwCarouselIndicatorDots,\n AdwCarouselIndicatorLines,\n AdwClamp,\n AdwClampScrollable,\n AdwComboRow,\n AdwDialog,\n AdwEntryRow,\n AdwExpanderRow,\n AdwFlap,\n AdwHeaderBar,\n AdwInlineViewSwitcher,\n AdwLayoutSlot,\n AdwLeaflet,\n AdwMessageDialog,\n AdwMultiLayoutView,\n AdwNavigationPage,\n AdwNavigationSplitView,\n AdwNavigationView,\n AdwOverlaySplitView,\n AdwPasswordEntryRow,\n AdwPreferencesDialog,\n AdwPreferencesGroup,\n AdwPreferencesPage,\n AdwPreferencesRow,\n AdwPreferencesWindow,\n AdwShortcutLabel,\n AdwShortcutsDialog,\n AdwSidebar,\n AdwSpinRow,\n AdwSpinner,\n AdwSplitButton,\n AdwSqueezer,\n AdwStatusPage,\n AdwSwitchRow,\n AdwTabBar,\n AdwTabButton,\n AdwTabOverview,\n AdwTabView,\n AdwToastOverlay,\n AdwToggleGroup,\n AdwToolbarView,\n AdwViewStack,\n AdwViewSwitcher,\n AdwViewSwitcherBar,\n AdwViewSwitcherSidebar,\n AdwViewSwitcherTitle,\n AdwWindow,\n AdwWindowTitle,\n AdwWrapBox,\n} from \"@gtkx/jsx/adw\"\n"]}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ // The react-native-gtkx-mcp bin: run from a consumer project (npx picks up
3
+ // the locally installed react-native-gtkx first, so this always answers
4
+ // for the exact version that project has — see docs/getting-started.md).
5
+ // Executed by bare `node` (no bundler in the way, same reason
6
+ // src/runner/src/metro/src/vite stay self-contained) — hence every
7
+ // relative import in src/mcp/** carries an explicit .js extension.
8
+ import process from "node:process";
9
+ import { main } from "./server.js";
10
+ try {
11
+ await main();
12
+ }
13
+ catch (error) {
14
+ console.error("[react-native-gtkx-mcp] fatal error:", error);
15
+ process.exit(1);
16
+ }
17
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/mcp/bin.ts"],"names":[],"mappings":";AACA,2EAA2E;AAC3E,wEAAwE;AACxE,yEAAyE;AACzE,8DAA8D;AAC9D,mEAAmE;AACnE,mEAAmE;AACnE,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,IAAI,CAAC;IACH,MAAM,IAAI,EAAE,CAAA;AACd,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAA;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC","sourcesContent":["#!/usr/bin/env node\n// The react-native-gtkx-mcp bin: run from a consumer project (npx picks up\n// the locally installed react-native-gtkx first, so this always answers\n// for the exact version that project has — see docs/getting-started.md).\n// Executed by bare `node` (no bundler in the way, same reason\n// src/runner/src/metro/src/vite stay self-contained) — hence every\n// relative import in src/mcp/** carries an explicit .js extension.\nimport process from \"node:process\"\nimport { main } from \"./server.js\"\n\ntry {\n await main()\n} catch (error) {\n console.error(\"[react-native-gtkx-mcp] fatal error:\", error)\n process.exit(1)\n}\n"]}