react-native-gtkx 0.1.0-alpha.4 → 0.2.0-alpha.2
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 +22 -9
- package/dist/adw/index.d.ts +3 -0
- package/dist/adw/index.js +41 -0
- package/dist/adw/index.js.map +1 -0
- package/dist/adw/widgets.generated.d.ts +63 -0
- package/dist/adw/widgets.generated.js +125 -0
- package/dist/adw/widgets.generated.js.map +1 -0
- package/dist/animated/create-animated.d.ts +2 -0
- package/dist/animated/create-animated.js +2 -0
- package/dist/animated/create-animated.js.map +1 -1
- package/dist/animated/index.d.ts +2 -0
- package/dist/animated/index.js +1 -0
- package/dist/animated/index.js.map +1 -1
- package/dist/animated/value-xy.d.ts +41 -0
- package/dist/animated/value-xy.js +90 -0
- package/dist/animated/value-xy.js.map +1 -0
- package/dist/animated/value.d.ts +9 -0
- package/dist/animated/value.js +30 -2
- package/dist/animated/value.js.map +1 -1
- package/dist/common/content.d.ts +69 -0
- package/dist/common/content.js +84 -0
- package/dist/common/content.js.map +1 -0
- package/dist/common/icon.d.ts +23 -0
- package/dist/common/icon.js +14 -0
- package/dist/common/icon.js.map +1 -0
- package/dist/common/index.d.ts +5 -0
- package/dist/common/index.js +21 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/list.d.ts +82 -0
- package/dist/common/list.js +166 -0
- package/dist/common/list.js.map +1 -0
- package/dist/common/navigation-stack.d.ts +84 -0
- package/dist/common/navigation-stack.js +313 -0
- package/dist/common/navigation-stack.js.map +1 -0
- package/dist/common/widget.d.ts +62 -0
- package/dist/common/widget.js +209 -0
- package/dist/common/widget.js.map +1 -0
- package/dist/components/animated.d.ts +7 -4
- package/dist/components/animated.js +88 -67
- package/dist/components/animated.js.map +1 -1
- package/dist/components/app-registry.d.ts +36 -1
- package/dist/components/app-registry.js +8 -3
- package/dist/components/app-registry.js.map +1 -1
- package/dist/components/host-node.d.ts +7 -0
- package/dist/components/host-node.js +26 -1
- package/dist/components/host-node.js.map +1 -1
- package/dist/components/index.d.ts +6 -2
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/measure.d.ts +13 -0
- package/dist/components/measure.js +51 -0
- package/dist/components/measure.js.map +1 -0
- package/dist/components/modal.d.ts +1 -1
- package/dist/components/press-event.d.ts +28 -0
- package/dist/components/press-event.js +46 -0
- package/dist/components/press-event.js.map +1 -0
- package/dist/components/pressable.d.ts +2 -6
- package/dist/components/pressable.js +119 -20
- package/dist/components/pressable.js.map +1 -1
- package/dist/components/rect-store.d.ts +11 -1
- package/dist/components/rect-store.js +27 -3
- package/dist/components/rect-store.js.map +1 -1
- package/dist/components/scroll-view.d.ts +4 -0
- package/dist/components/scroll-view.js +8 -2
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/svg/animated-support.d.ts +19 -0
- package/dist/components/svg/animated-support.js +64 -0
- package/dist/components/svg/animated-support.js.map +1 -0
- package/dist/components/svg/context.d.ts +8 -0
- package/dist/components/svg/context.js +15 -0
- package/dist/components/svg/context.js.map +1 -0
- package/dist/components/svg/gradients.d.ts +31 -0
- package/dist/components/svg/gradients.js +93 -0
- package/dist/components/svg/gradients.js.map +1 -0
- package/dist/components/svg/group.d.ts +8 -0
- package/dist/components/svg/group.js +30 -0
- package/dist/components/svg/group.js.map +1 -0
- package/dist/components/svg/index.d.ts +6 -0
- package/dist/components/svg/index.js +5 -0
- package/dist/components/svg/index.js.map +1 -0
- package/dist/components/svg/node.d.ts +7 -0
- package/dist/components/svg/node.js +7 -0
- package/dist/components/svg/node.js.map +1 -0
- package/dist/components/svg/paint.d.ts +24 -0
- package/dist/components/svg/paint.js +57 -0
- package/dist/components/svg/paint.js.map +1 -0
- package/dist/components/svg/shapes.d.ts +47 -0
- package/dist/components/svg/shapes.js +51 -0
- package/dist/components/svg/shapes.js.map +1 -0
- package/dist/components/svg/svg.d.ts +14 -0
- package/dist/components/svg/svg.js +48 -0
- package/dist/components/svg/svg.js.map +1 -0
- package/dist/components/svg/use-shape-node.d.ts +12 -0
- package/dist/components/svg/use-shape-node.js +52 -0
- package/dist/components/svg/use-shape-node.js.map +1 -0
- package/dist/components/text-input.js +1 -1
- package/dist/components/text-input.js.map +1 -1
- package/dist/components/text.js +36 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/use-layout-child.js +50 -4
- package/dist/components/use-layout-child.js.map +1 -1
- package/dist/components/view.d.ts +9 -4
- package/dist/components/view.js +8 -2
- package/dist/components/view.js.map +1 -1
- package/dist/contracts.d.ts +31 -4
- package/dist/contracts.js.map +1 -1
- package/dist/gtk/index.d.ts +7 -0
- package/dist/gtk/index.js +46 -0
- package/dist/gtk/index.js.map +1 -0
- package/dist/gtk/widgets.generated.d.ts +103 -0
- package/dist/gtk/widgets.generated.js +205 -0
- package/dist/gtk/widgets.generated.js.map +1 -0
- package/dist/gtk/window-actions.d.ts +77 -0
- package/dist/gtk/window-actions.js +193 -0
- package/dist/gtk/window-actions.js.map +1 -0
- package/dist/gtkx/bridge/geometry.d.ts +15 -0
- package/dist/gtkx/bridge/geometry.js +38 -0
- package/dist/gtkx/bridge/geometry.js.map +1 -0
- package/dist/gtkx/bridge/index.d.ts +11 -4
- package/dist/gtkx/bridge/index.js +47 -6
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/layout-manager.d.ts +2 -1
- package/dist/gtkx/bridge/layout-manager.js +31 -9
- package/dist/gtkx/bridge/layout-manager.js.map +1 -1
- package/dist/gtkx/bridge/slot-portal.d.ts +12 -0
- package/dist/gtkx/bridge/slot-portal.js +17 -0
- package/dist/gtkx/bridge/slot-portal.js.map +1 -0
- package/dist/gtkx/bridge/svg-node.d.ts +79 -0
- package/dist/gtkx/bridge/svg-node.js +323 -0
- package/dist/gtkx/bridge/svg-node.js.map +1 -0
- package/dist/gtkx/bridge/use-signal.js +19 -9
- package/dist/gtkx/bridge/use-signal.js.map +1 -1
- package/dist/gtkx/bridge/widgets.generated.d.ts +2 -0
- package/dist/gtkx/bridge/widgets.generated.js +14 -0
- package/dist/gtkx/bridge/widgets.generated.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/bin.d.ts +2 -0
- package/dist/mcp/bin.js +17 -0
- package/dist/mcp/bin.js.map +1 -0
- package/dist/mcp/data/generated.d.ts +1304 -0
- package/dist/mcp/data/generated.js +1179 -0
- package/dist/mcp/data/generated.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.js +9 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/list.d.ts +4 -0
- package/dist/mcp/list.js +56 -0
- package/dist/mcp/list.js.map +1 -0
- package/dist/mcp/resolve.d.ts +55 -0
- package/dist/mcp/resolve.js +151 -0
- package/dist/mcp/resolve.js.map +1 -0
- package/dist/mcp/search.d.ts +13 -0
- package/dist/mcp/search.js +48 -0
- package/dist/mcp/search.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +135 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool.d.ts +21 -0
- package/dist/mcp/tool.js +36 -0
- package/dist/mcp/tool.js.map +1 -0
- package/dist/metro/index.js +10 -0
- package/dist/metro/index.js.map +1 -1
- package/dist/navigation/index.d.ts +50 -13
- package/dist/navigation/index.js +183 -148
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/option-warnings.js +9 -1
- package/dist/navigation/option-warnings.js.map +1 -1
- package/dist/navigation/sidebar.d.ts +207 -9
- package/dist/navigation/sidebar.js +294 -10
- package/dist/navigation/sidebar.js.map +1 -1
- package/dist/responder/system.d.ts +27 -0
- package/dist/responder/system.js +184 -0
- package/dist/responder/system.js.map +1 -0
- package/dist/responder/touch-history.d.ts +10 -0
- package/dist/responder/touch-history.js +78 -0
- package/dist/responder/touch-history.js.map +1 -0
- package/dist/responder/types.d.ts +63 -0
- package/dist/responder/types.js +29 -0
- package/dist/responder/types.js.map +1 -0
- package/dist/responder/use-responder.d.ts +12 -0
- package/dist/responder/use-responder.js +98 -0
- package/dist/responder/use-responder.js.map +1 -0
- package/dist/runner/host-dev.js +3 -1
- package/dist/runner/host-dev.js.map +1 -1
- package/dist/runner/host.js +5 -1
- package/dist/runner/host.js.map +1 -1
- package/dist/runner/index.d.ts +22 -2
- package/dist/runner/index.js +163 -13
- package/dist/runner/index.js.map +1 -1
- package/dist/sea/assemble.d.ts +29 -0
- package/dist/sea/assemble.js +129 -0
- package/dist/sea/assemble.js.map +1 -0
- package/dist/sea/bundle.d.ts +61 -0
- package/dist/sea/bundle.js +202 -0
- package/dist/sea/bundle.js.map +1 -0
- package/dist/sea/gtkx-config-module.d.ts +18 -0
- package/dist/sea/gtkx-config-module.js +67 -0
- package/dist/sea/gtkx-config-module.js.map +1 -0
- package/dist/sea/native-shim.d.ts +40 -0
- package/dist/sea/native-shim.js +121 -0
- package/dist/sea/native-shim.js.map +1 -0
- package/dist/sea/react-anchor-plugin.d.ts +2 -0
- package/dist/sea/react-anchor-plugin.js +30 -0
- package/dist/sea/react-anchor-plugin.js.map +1 -0
- package/dist/style/box-shadow.d.ts +7 -0
- package/dist/style/box-shadow.js +197 -0
- package/dist/style/box-shadow.js.map +1 -0
- package/dist/style/index.d.ts +3 -0
- package/dist/style/index.js +3 -0
- package/dist/style/index.js.map +1 -1
- package/dist/style/split-style.d.ts +5 -2
- package/dist/style/split-style.js +33 -5
- package/dist/style/split-style.js.map +1 -1
- package/dist/style/text-decoration.d.ts +15 -0
- package/dist/style/text-decoration.js +26 -0
- package/dist/style/text-decoration.js.map +1 -0
- package/dist/style/transform.d.ts +22 -0
- package/dist/style/transform.js +137 -0
- package/dist/style/transform.js.map +1 -0
- package/dist/style/visual-css.js +40 -3
- package/dist/style/visual-css.js.map +1 -1
- package/dist/svg/geometry.d.ts +19 -0
- package/dist/svg/geometry.js +80 -0
- package/dist/svg/geometry.js.map +1 -0
- package/dist/svg/gradient-geometry.d.ts +15 -0
- package/dist/svg/gradient-geometry.js +15 -0
- package/dist/svg/gradient-geometry.js.map +1 -0
- package/dist/svg/transform.d.ts +22 -0
- package/dist/svg/transform.js +74 -0
- package/dist/svg/transform.js.map +1 -0
- package/dist/svg/view-box.d.ts +34 -0
- package/dist/svg/view-box.js +108 -0
- package/dist/svg/view-box.js.map +1 -0
- package/dist/svg-compat/index.d.ts +1 -0
- package/dist/svg-compat/index.js +16 -0
- package/dist/svg-compat/index.js.map +1 -0
- package/dist/testing/index.d.ts +14 -0
- package/dist/testing/index.js +14 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/vendor/react-native/pan-responder.d.ts +102 -0
- package/dist/vendor/react-native/pan-responder.js +196 -0
- package/dist/vendor/react-native/pan-responder.js.map +1 -0
- package/dist/vendor/react-native/touch-history-math.d.ts +18 -0
- package/dist/vendor/react-native/touch-history-math.js +102 -0
- package/dist/vendor/react-native/touch-history-math.js.map +1 -0
- package/dist/vite/index.d.ts +7 -3
- package/dist/vite/index.js +16 -4
- package/dist/vite/index.js.map +1 -1
- package/dist/vitest/index.d.ts +52 -0
- package/dist/vitest/index.js +58 -0
- package/dist/vitest/index.js.map +1 -0
- package/dist/vitest/setup.d.ts +4 -0
- package/dist/vitest/setup.js +22 -0
- package/dist/vitest/setup.js.map +1 -0
- package/package.json +52 -13
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as Gdk from "@gtkx/gi/gdk";
|
|
2
|
+
import * as Gsk from "@gtkx/gi/gsk";
|
|
3
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
4
|
+
import { createElementComponent } from "@gtkx/react/internal";
|
|
5
|
+
import type { SvgTransformOp } from "../../svg/transform";
|
|
6
|
+
import { type PreserveAspectRatio, type ViewBox } from "../../svg/view-box";
|
|
7
|
+
export type SvgPaintSpec = {
|
|
8
|
+
kind: "color";
|
|
9
|
+
rgba: Gdk.RGBA;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "ref";
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
export type SvgGradientUnits = "objectBoundingBox" | "userSpaceOnUse";
|
|
15
|
+
export type SvgSvgDescriptor = {
|
|
16
|
+
kind: "svg";
|
|
17
|
+
viewBox: ViewBox | null;
|
|
18
|
+
preserveAspectRatio: PreserveAspectRatio;
|
|
19
|
+
};
|
|
20
|
+
export type SvgGroupDescriptor = {
|
|
21
|
+
kind: "g";
|
|
22
|
+
transformOps: SvgTransformOp[];
|
|
23
|
+
opacity: number;
|
|
24
|
+
};
|
|
25
|
+
export type SvgShapeDescriptor = {
|
|
26
|
+
kind: "shape";
|
|
27
|
+
path: Gsk.Path | null;
|
|
28
|
+
fill: SvgPaintSpec | null;
|
|
29
|
+
fillOpacity: number;
|
|
30
|
+
fillRule: Gsk.FillRule;
|
|
31
|
+
stroke: SvgPaintSpec | null;
|
|
32
|
+
strokeOpacity: number;
|
|
33
|
+
strokeWidth: number;
|
|
34
|
+
strokeLinecap: Gsk.LineCap;
|
|
35
|
+
strokeLinejoin: Gsk.LineJoin;
|
|
36
|
+
strokeMiterlimit: number;
|
|
37
|
+
strokeDasharray: number[] | null;
|
|
38
|
+
strokeDashoffset: number;
|
|
39
|
+
opacity: number;
|
|
40
|
+
};
|
|
41
|
+
export type SvgDefsDescriptor = {
|
|
42
|
+
kind: "defs";
|
|
43
|
+
};
|
|
44
|
+
export type SvgLinearGradientDescriptor = {
|
|
45
|
+
kind: "gradient";
|
|
46
|
+
type: "linear";
|
|
47
|
+
id: string;
|
|
48
|
+
units: SvgGradientUnits;
|
|
49
|
+
x1: number;
|
|
50
|
+
y1: number;
|
|
51
|
+
x2: number;
|
|
52
|
+
y2: number;
|
|
53
|
+
};
|
|
54
|
+
export type SvgRadialGradientDescriptor = {
|
|
55
|
+
kind: "gradient";
|
|
56
|
+
type: "radial";
|
|
57
|
+
id: string;
|
|
58
|
+
units: SvgGradientUnits;
|
|
59
|
+
cx: number;
|
|
60
|
+
cy: number;
|
|
61
|
+
r: number;
|
|
62
|
+
};
|
|
63
|
+
export type SvgStopDescriptor = {
|
|
64
|
+
kind: "stop";
|
|
65
|
+
offset: number;
|
|
66
|
+
color: Gdk.RGBA;
|
|
67
|
+
};
|
|
68
|
+
export type SvgNodeDescriptor = SvgSvgDescriptor | SvgGroupDescriptor | SvgShapeDescriptor | SvgDefsDescriptor | SvgLinearGradientDescriptor | SvgRadialGradientDescriptor | SvgStopDescriptor;
|
|
69
|
+
export declare const setSvgNodeDescriptor: (widget: Gtk.Widget, descriptor: SvgNodeDescriptor) => void;
|
|
70
|
+
export declare const getSvgNodeDescriptor: (widget: Gtk.Widget) => SvgNodeDescriptor | undefined;
|
|
71
|
+
export declare const resolveSvgColor: (spec: string | undefined) => Gdk.RGBA | null;
|
|
72
|
+
export declare const resolveSvgPaint: (spec: string | undefined) => SvgPaintSpec | null;
|
|
73
|
+
type SvgNodeComponent = ReturnType<typeof createElementComponent>;
|
|
74
|
+
export declare const getSvgNodeComponent: () => SvgNodeComponent;
|
|
75
|
+
/** Imperative invalidation channel for SVG: paint-only changes (including
|
|
76
|
+
* Animated-driven ones) call this instead of queueAllocate/queueResize —
|
|
77
|
+
* nothing here ever touches Yoga. */
|
|
78
|
+
export declare const queueSvgRedraw: (rootWidget: Gtk.Widget) => void;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,323 @@
|
|
|
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
|
+
const makeColorStop = (offset, color) => new Gsk.ColorStop({ offset, color });
|
|
74
|
+
const collectStops = (gradientWidget) => {
|
|
75
|
+
const stops = [];
|
|
76
|
+
let child = gradientWidget.getFirstChild();
|
|
77
|
+
while (child) {
|
|
78
|
+
const descriptor = nodeDescriptors.get(child);
|
|
79
|
+
if (descriptor?.kind === "stop") {
|
|
80
|
+
stops.push(makeColorStop(descriptor.offset, descriptor.color));
|
|
81
|
+
}
|
|
82
|
+
child = child.getNextSibling();
|
|
83
|
+
}
|
|
84
|
+
return stops;
|
|
85
|
+
};
|
|
86
|
+
// Only DIRECT <Defs> children of <Svg> are scanned (a deliberate simplicity
|
|
87
|
+
// cut — every real react-native-svg example keeps Defs at the top).
|
|
88
|
+
const collectGradients = (root) => {
|
|
89
|
+
const gradients = new Map();
|
|
90
|
+
let child = root.getFirstChild();
|
|
91
|
+
while (child) {
|
|
92
|
+
if (nodeDescriptors.get(child)?.kind === "defs") {
|
|
93
|
+
let gradientNode = child.getFirstChild();
|
|
94
|
+
while (gradientNode) {
|
|
95
|
+
const descriptor = nodeDescriptors.get(gradientNode);
|
|
96
|
+
if (descriptor?.kind === "gradient") {
|
|
97
|
+
gradients.set(descriptor.id, {
|
|
98
|
+
descriptor,
|
|
99
|
+
stops: collectStops(gradientNode),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
gradientNode = gradientNode.getNextSibling();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
child = child.getNextSibling();
|
|
106
|
+
}
|
|
107
|
+
return gradients;
|
|
108
|
+
};
|
|
109
|
+
const asBoundingBox = (rect) => ({
|
|
110
|
+
x: rect.origin.x,
|
|
111
|
+
y: rect.origin.y,
|
|
112
|
+
width: rect.size.width,
|
|
113
|
+
height: rect.size.height,
|
|
114
|
+
});
|
|
115
|
+
const appendGradient = (snapshot, path, entry, opacity) => {
|
|
116
|
+
if (entry.stops.length === 0) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// fillOpacity/strokeOpacity < 1 on a gradient re-builds each stop with a
|
|
120
|
+
// scaled alpha.
|
|
121
|
+
const stops = opacity >= 1
|
|
122
|
+
? entry.stops
|
|
123
|
+
: entry.stops.map((stop) => makeColorStop(stop.offset, scaledAlpha(stop.color, opacity)));
|
|
124
|
+
const [hasBounds, tightBounds] = path.getBounds();
|
|
125
|
+
const bounds = hasBounds ? tightBounds : Graphene.Rect.zero();
|
|
126
|
+
const box = asBoundingBox(bounds);
|
|
127
|
+
const { descriptor } = entry;
|
|
128
|
+
if (descriptor.type === "linear") {
|
|
129
|
+
const start = resolveGradientPoint(box, descriptor.x1, descriptor.y1, descriptor.units);
|
|
130
|
+
const end = resolveGradientPoint(box, descriptor.x2, descriptor.y2, descriptor.units);
|
|
131
|
+
snapshot.appendLinearGradient(bounds, new Graphene.Point(start), new Graphene.Point(end), stops);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const center = resolveGradientPoint(box, descriptor.cx, descriptor.cy, descriptor.units);
|
|
135
|
+
const { hradius, vradius } = resolveGradientRadius(box, descriptor.r, descriptor.units);
|
|
136
|
+
snapshot.appendRadialGradient(bounds, new Graphene.Point(center), hradius, vradius, 0, 1, stops);
|
|
137
|
+
};
|
|
138
|
+
// --- drawing ---------------------------------------------------------------
|
|
139
|
+
const applyTransformOps = (snapshot, ops) => {
|
|
140
|
+
for (const op of ops) {
|
|
141
|
+
switch (op.type) {
|
|
142
|
+
case "translate":
|
|
143
|
+
snapshot.translate(new Graphene.Point({ x: op.x, y: op.y }));
|
|
144
|
+
break;
|
|
145
|
+
case "scale":
|
|
146
|
+
snapshot.scale(op.x, op.y);
|
|
147
|
+
break;
|
|
148
|
+
case "rotate":
|
|
149
|
+
snapshot.rotate(op.angleDeg);
|
|
150
|
+
break;
|
|
151
|
+
case "matrix":
|
|
152
|
+
snapshot.transform(Gsk.Transform.new().matrix2d(op.a, op.b, op.c, op.d, op.e, op.f));
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const paintFill = (snapshot, path, paint, opacity, fillRule, gradients) => {
|
|
158
|
+
if (paint.kind === "color") {
|
|
159
|
+
snapshot.appendFill(path, fillRule, scaledAlpha(paint.rgba, opacity));
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const gradient = gradients.get(paint.id);
|
|
163
|
+
if (!gradient) {
|
|
164
|
+
// url(#missing-id): SVG renders nothing for that paint, not an error.
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
snapshot.pushFill(path, fillRule);
|
|
168
|
+
appendGradient(snapshot, path, gradient, opacity);
|
|
169
|
+
snapshot.pop();
|
|
170
|
+
};
|
|
171
|
+
const paintStroke = (snapshot, path, shape, paint, opacity, gradients) => {
|
|
172
|
+
const stroke = Gsk.Stroke.new(shape.strokeWidth);
|
|
173
|
+
stroke.setLineCap(shape.strokeLinecap);
|
|
174
|
+
stroke.setLineJoin(shape.strokeLinejoin);
|
|
175
|
+
stroke.setMiterLimit(shape.strokeMiterlimit);
|
|
176
|
+
if (shape.strokeDasharray && shape.strokeDasharray.length > 0) {
|
|
177
|
+
stroke.setDash(shape.strokeDasharray);
|
|
178
|
+
stroke.setDashOffset(shape.strokeDashoffset);
|
|
179
|
+
}
|
|
180
|
+
if (paint.kind === "color") {
|
|
181
|
+
snapshot.appendStroke(path, stroke, scaledAlpha(paint.rgba, opacity));
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const gradient = gradients.get(paint.id);
|
|
185
|
+
if (!gradient) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
snapshot.pushStroke(path, stroke);
|
|
189
|
+
appendGradient(snapshot, path, gradient, opacity);
|
|
190
|
+
snapshot.pop();
|
|
191
|
+
};
|
|
192
|
+
const drawShape = (snapshot, shape, gradients) => {
|
|
193
|
+
const path = shape.path;
|
|
194
|
+
if (!path || path.isEmpty()) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const groupOpacity = clamp01(shape.opacity);
|
|
198
|
+
const needsGroup = groupOpacity < 1;
|
|
199
|
+
if (needsGroup) {
|
|
200
|
+
snapshot.pushOpacity(groupOpacity);
|
|
201
|
+
}
|
|
202
|
+
if (shape.fill) {
|
|
203
|
+
paintFill(snapshot, path, shape.fill, clamp01(shape.fillOpacity), shape.fillRule, gradients);
|
|
204
|
+
}
|
|
205
|
+
if (shape.stroke && shape.strokeWidth > 0) {
|
|
206
|
+
paintStroke(snapshot, path, shape, shape.stroke, clamp01(shape.strokeOpacity), gradients);
|
|
207
|
+
}
|
|
208
|
+
if (needsGroup) {
|
|
209
|
+
snapshot.pop();
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const drawChildren = (snapshot, parent, gradients) => {
|
|
213
|
+
let child = parent.getFirstChild();
|
|
214
|
+
while (child) {
|
|
215
|
+
drawNode(snapshot, child, gradients);
|
|
216
|
+
child = child.getNextSibling();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const drawNode = (snapshot, widget, gradients) => {
|
|
220
|
+
const descriptor = nodeDescriptors.get(widget);
|
|
221
|
+
if (!descriptor) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
switch (descriptor.kind) {
|
|
225
|
+
case "shape":
|
|
226
|
+
drawShape(snapshot, descriptor, gradients);
|
|
227
|
+
return;
|
|
228
|
+
case "g": {
|
|
229
|
+
const opacity = clamp01(descriptor.opacity);
|
|
230
|
+
const needsOpacity = opacity < 1;
|
|
231
|
+
snapshot.save();
|
|
232
|
+
applyTransformOps(snapshot, descriptor.transformOps);
|
|
233
|
+
if (needsOpacity) {
|
|
234
|
+
snapshot.pushOpacity(opacity);
|
|
235
|
+
}
|
|
236
|
+
drawChildren(snapshot, widget, gradients);
|
|
237
|
+
if (needsOpacity) {
|
|
238
|
+
snapshot.pop();
|
|
239
|
+
}
|
|
240
|
+
snapshot.restore();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
// defs/gradient/stop are resources, not paint; a nested <Svg> is not a
|
|
244
|
+
// supported composition (undocumented, no-op rather than a crash).
|
|
245
|
+
case "defs":
|
|
246
|
+
case "gradient":
|
|
247
|
+
case "stop":
|
|
248
|
+
case "svg":
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
// --- widget registration ---------------------------------------------------
|
|
253
|
+
let RnGtkxSvgNodeClass = null;
|
|
254
|
+
const ensureRegistered = () => {
|
|
255
|
+
if (RnGtkxSvgNodeClass) {
|
|
256
|
+
return RnGtkxSvgNodeClass;
|
|
257
|
+
}
|
|
258
|
+
// Box, not a bare Widget: the reconciler only auto-attaches JSX children
|
|
259
|
+
// (generic set_parent/insert_after) for widget types that carry a
|
|
260
|
+
// registered "children" behavior, resolved by walking the GType ancestry
|
|
261
|
+
// chain (@gtkx/react's typeInfoFor/buildTypeInfo). Plain GtkWidget has no
|
|
262
|
+
// such behavior — only concrete container types like Box do — which is
|
|
263
|
+
// also why RnGtkxViewBox (view-box.ts) is a Box subclass, not a bare
|
|
264
|
+
// Widget one. GtkBox's own default BoxLayout then measures/allocates
|
|
265
|
+
// these children, but harmlessly: they report a natural size of 0x0 (no
|
|
266
|
+
// style, no content) and their own snapshot() no-ops for anything that
|
|
267
|
+
// is not the mounted <Svg> root (see below), so nothing is ever
|
|
268
|
+
// double-painted through GTK's normal child-snapshot path.
|
|
269
|
+
class RnGtkxSvgNode extends Gtk.Box {
|
|
270
|
+
// Only ever invoked by GTK on the mounted <Svg> root (nothing calls
|
|
271
|
+
// snapshotChild() on the inert descendant instances). Defensive no-op
|
|
272
|
+
// otherwise, so a stray direct call never throws.
|
|
273
|
+
snapshot(snapshot) {
|
|
274
|
+
const descriptor = nodeDescriptors.get(this);
|
|
275
|
+
if (!descriptor || descriptor.kind !== "svg") {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const width = this.getWidth();
|
|
279
|
+
const height = this.getHeight();
|
|
280
|
+
if (width <= 0 || height <= 0) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const transform = resolveViewBoxTransform(descriptor.viewBox, width, height, descriptor.preserveAspectRatio);
|
|
284
|
+
const gradients = collectGradients(this);
|
|
285
|
+
// SVG clips to the viewport by default (no overflow:visible opt-out
|
|
286
|
+
// in this API — deliberate cut, see epic.md).
|
|
287
|
+
snapshot.pushClip(new Graphene.Rect({
|
|
288
|
+
origin: new Graphene.Point({ x: 0, y: 0 }),
|
|
289
|
+
size: new Graphene.Size({ width, height }),
|
|
290
|
+
}));
|
|
291
|
+
snapshot.save();
|
|
292
|
+
snapshot.translate(new Graphene.Point({
|
|
293
|
+
x: transform.translateX,
|
|
294
|
+
y: transform.translateY,
|
|
295
|
+
}));
|
|
296
|
+
snapshot.scale(transform.scaleX, transform.scaleY);
|
|
297
|
+
drawChildren(snapshot, this, gradients);
|
|
298
|
+
snapshot.restore();
|
|
299
|
+
snapshot.pop();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// Explicit typeName: bundlers minify class names (same reasoning as
|
|
303
|
+
// RnGtkxLayout/RnGtkxViewBox).
|
|
304
|
+
registerClass(RnGtkxSvgNode, { typeName: "RnGtkxSvgNode" });
|
|
305
|
+
RnGtkxSvgNodeClass = RnGtkxSvgNode;
|
|
306
|
+
return RnGtkxSvgNode;
|
|
307
|
+
};
|
|
308
|
+
let component = null;
|
|
309
|
+
export const getSvgNodeComponent = () => {
|
|
310
|
+
if (component) {
|
|
311
|
+
return component;
|
|
312
|
+
}
|
|
313
|
+
ensureRegistered();
|
|
314
|
+
component = createElementComponent("RnGtkxSvgNode");
|
|
315
|
+
return component;
|
|
316
|
+
};
|
|
317
|
+
/** Imperative invalidation channel for SVG: paint-only changes (including
|
|
318
|
+
* Animated-driven ones) call this instead of queueAllocate/queueResize —
|
|
319
|
+
* nothing here ever touches Yoga. */
|
|
320
|
+
export const queueSvgRedraw = (rootWidget) => {
|
|
321
|
+
rootWidget.queueDraw();
|
|
322
|
+
};
|
|
323
|
+
//# 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;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EAAE,SAAS,CAAC,UAAU;aACxB,CAAC,CACH,CAAA;YACD,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;YAClD,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;YACvC,QAAQ,CAAC,OAAO,EAAE,CAAA;YAClB,QAAQ,CAAC,GAAG,EAAE,CAAA;QAChB,CAAC;KACF;IACD,oEAAoE;IACpE,+BAA+B;IAC/B,aAAa,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAA;IAC3D,kBAAkB,GAAG,aAAa,CAAA;IAClC,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAID,IAAI,SAAS,GAA4B,IAAI,CAAA;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAqB,EAAE;IACxD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,gBAAgB,EAAE,CAAA;IAClB,SAAS,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAA;IACnD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED;;qCAEqC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAsB,EAAQ,EAAE;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\nconst makeColorStop = (offset: number, color: Gdk.RGBA): Gsk.ColorStop =>\n new Gsk.ColorStop({ offset, color })\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 stops.push(makeColorStop(descriptor.offset, descriptor.color))\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 // fillOpacity/strokeOpacity < 1 on a gradient re-builds each stop with a\n // scaled alpha.\n const stops =\n opacity >= 1\n ? entry.stops\n : entry.stops.map((stop) =>\n makeColorStop(stop.offset, scaledAlpha(stop.color, opacity)),\n )\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 // SVG clips to the viewport by default (no overflow:visible opt-out\n // in this API — deliberate cut, see epic.md).\n snapshot.pushClip(\n new Graphene.Rect({\n origin: new Graphene.Point({ x: 0, y: 0 }),\n size: new Graphene.Size({ width, height }),\n }),\n )\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
|
+
// RC3-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc3-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.
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// useEffectEvent
|
|
9
|
-
// mount
|
|
10
|
-
//
|
|
11
|
-
//
|
|
4
|
+
// of its own. rc.3 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,+
|
|
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":["// RC3-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc3-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.3 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":[],"m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,EACR,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,OAAO,EACP,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,QAAQ,EACR,WAAW,EACX,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,eAAe,GAChB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,MAAM,EACN,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,wBAAwB,EACxB,yBAAyB,EACzB,QAAQ,EACR,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,WAAW,EACX,cAAc,EACd,OAAO,EACP,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,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"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { ActivityIndicator, Animated, AppRegistry, Easing, FlatList, Image, Modal, IntrinsicRoot, NestedRoot, Pressable, Root, SafeAreaView, ScrollView, SectionList, StatusBar, Switch, Text, TextInput, TouchableOpacity, View, type ActivityIndicatorProps, type FlatListProps, type ImageProps, type ImageSource, type LayoutEvent, type ListRenderItemInfo, type ModalProps, type PressableProps, type PressableStateCallbackType, type IntrinsicRootProps, type NestedRootProps, type PressEvent, type RootProps, type RunApplicationParams, type ScrollEvent, type ScrollViewHandle, type ScrollViewProps, type SectionListProps, type SwitchProps, type TextInputProps, type TextProps, type TouchableOpacityProps, type ViewabilityConfig, type ViewProps, type ViewToken, } from "./components/index";
|
|
1
|
+
export { ActivityIndicator, Animated, AppRegistry, Easing, FlatList, Image, Modal, IntrinsicRoot, PanResponder, NestedRoot, Pressable, Root, SafeAreaView, ScrollView, SectionList, StatusBar, Switch, Text, TextInput, TouchableOpacity, View, type ActivityIndicatorProps, type FlatListProps, type GestureResponderEvent, type ImageProps, type ImageSource, type LayoutEvent, type ListRenderItemInfo, type MeasureHandle, type MeasureInWindowOnSuccessCallback, type MeasureLayoutOnSuccessCallback, type MeasureOnSuccessCallback, type ModalProps, type NativeTouch, type PanResponderCallbacks, type PanResponderGestureState, type PanResponderInstance, type PressableProps, type PressableStateCallbackType, type IntrinsicRootProps, type NestedRootProps, type PressEvent, type ResponderProps, type RootProps, type RunApplicationParams, type ScrollEvent, type ScrollViewHandle, type ScrollViewProps, type SectionListProps, type SwitchProps, type TextInputProps, type TextProps, type TouchHistory, type TouchRecord, type TouchableOpacityProps, type ViewabilityConfig, type ViewHandle, type ViewProps, type ViewToken, } from "./components/index";
|
|
2
2
|
export type { FlatListHandle } from "./components/flat-list";
|
|
3
3
|
export { Alert, Appearance, AppState, BackHandler, DevSettings, Dimensions, I18nManager, InteractionManager, Linking, Platform, useColorScheme, useWindowDimensions, type AlertButton, type AlertButtonStyle, type AlertOptions, type AppearancePreferences, type AppStateEvent, type AppStateStatus, type ColorSchemeName, type DimensionKey, type DimensionsPayload, type InteractionPromise, type PlatformSelectSpec, type ScaledSize, } from "./apis/index";
|
|
4
4
|
export { PlatformColor, StyleSheet } from "./style/index";
|
|
5
|
-
export type { DimensionValue, FlatStyle, LayoutStyle, PointerEventsValue, StyleProp, TransformPart, VisualStyle, } from "./contracts";
|
|
5
|
+
export type { BoxShadowValue, DimensionValue, FlatStyle, LayoutStyle, PointerEventsValue, StyleProp, TextDecorationLine, TransformPart, VisualStyle, } from "./contracts";
|
|
6
6
|
export declare const version = "0.1.0";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Public surface of react-native-gtkx, mirroring the `react-native` module.
|
|
2
2
|
// Components · APIs · StyleSheet, with the Yoga layout engine underneath.
|
|
3
|
-
export { ActivityIndicator, Animated, AppRegistry, Easing, FlatList, Image, Modal, IntrinsicRoot, NestedRoot, Pressable, Root, SafeAreaView, ScrollView, SectionList, StatusBar, Switch, Text, TextInput, TouchableOpacity, View, } from "./components/index";
|
|
3
|
+
export { ActivityIndicator, Animated, AppRegistry, Easing, FlatList, Image, Modal, IntrinsicRoot, PanResponder, NestedRoot, Pressable, Root, SafeAreaView, ScrollView, SectionList, StatusBar, Switch, Text, TextInput, TouchableOpacity, View, } from "./components/index";
|
|
4
4
|
export { Alert, Appearance, AppState, BackHandler, DevSettings, Dimensions, I18nManager, InteractionManager, Linking, Platform, useColorScheme, useWindowDimensions, } from "./apis/index";
|
|
5
5
|
export { PlatformColor, StyleSheet } from "./style/index";
|
|
6
6
|
export const version = "0.1.0";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0EAA0E;AAE1E,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,MAAM,EACN,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0EAA0E;AAE1E,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,YAAY,EACZ,UAAU,EACV,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,MAAM,EACN,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,IAAI,GAuCL,MAAM,oBAAoB,CAAA;AAM3B,OAAO,EACL,KAAK,EACL,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,cAAc,EACd,mBAAmB,GAapB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAczD,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Public surface of react-native-gtkx, mirroring the `react-native` module.\n// Components · APIs · StyleSheet, with the Yoga layout engine underneath.\n\nexport {\n ActivityIndicator,\n Animated,\n AppRegistry,\n Easing,\n FlatList,\n Image,\n Modal,\n IntrinsicRoot,\n PanResponder,\n NestedRoot,\n Pressable,\n Root,\n SafeAreaView,\n ScrollView,\n SectionList,\n StatusBar,\n Switch,\n Text,\n TextInput,\n TouchableOpacity,\n View,\n type ActivityIndicatorProps,\n type FlatListProps,\n type GestureResponderEvent,\n type ImageProps,\n type ImageSource,\n type LayoutEvent,\n type ListRenderItemInfo,\n type MeasureHandle,\n type MeasureInWindowOnSuccessCallback,\n type MeasureLayoutOnSuccessCallback,\n type MeasureOnSuccessCallback,\n type ModalProps,\n type NativeTouch,\n type PanResponderCallbacks,\n type PanResponderGestureState,\n type PanResponderInstance,\n type PressableProps,\n type PressableStateCallbackType,\n type IntrinsicRootProps,\n type NestedRootProps,\n type PressEvent,\n type ResponderProps,\n type RootProps,\n type RunApplicationParams,\n type ScrollEvent,\n type ScrollViewHandle,\n type ScrollViewProps,\n type SectionListProps,\n type SwitchProps,\n type TextInputProps,\n type TextProps,\n type TouchHistory,\n type TouchRecord,\n type TouchableOpacityProps,\n type ViewabilityConfig,\n type ViewHandle,\n type ViewProps,\n type ViewToken,\n} from \"./components/index\"\n\n// List scroll handle (scrollTo/scrollToEnd/scrollToIndex/scrollToItem/\n// scrollToOffset) — exported straight from the component module.\nexport type { FlatListHandle } from \"./components/flat-list\"\n\nexport {\n Alert,\n Appearance,\n AppState,\n BackHandler,\n DevSettings,\n Dimensions,\n I18nManager,\n InteractionManager,\n Linking,\n Platform,\n useColorScheme,\n useWindowDimensions,\n type AlertButton,\n type AlertButtonStyle,\n type AlertOptions,\n type AppearancePreferences,\n type AppStateEvent,\n type AppStateStatus,\n type ColorSchemeName,\n type DimensionKey,\n type DimensionsPayload,\n type InteractionPromise,\n type PlatformSelectSpec,\n type ScaledSize,\n} from \"./apis/index\"\n\nexport { PlatformColor, StyleSheet } from \"./style/index\"\n\nexport type {\n BoxShadowValue,\n DimensionValue,\n FlatStyle,\n LayoutStyle,\n PointerEventsValue,\n StyleProp,\n TextDecorationLine,\n TransformPart,\n VisualStyle,\n} from \"./contracts\"\n\nexport const version = \"0.1.0\"\n"]}
|