react-native-gtkx 0.1.0-alpha.3 → 0.1.0-alpha.4
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 +37 -3
- package/dist/animated/create-animated.js +1 -1
- package/dist/animated/create-animated.js.map +1 -1
- package/dist/animated/index.js +3 -3
- package/dist/animated/index.js.map +1 -1
- package/dist/components/pressable.js +4 -4
- package/dist/components/pressable.js.map +1 -1
- package/dist/components/text-input.js +3 -2
- package/dist/components/text-input.js.map +1 -1
- package/dist/contracts.js +2 -3
- package/dist/contracts.js.map +1 -1
- package/dist/gtkx/bridge/index.js +1 -1
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/theme.js +1 -1
- package/dist/gtkx/bridge/theme.js.map +1 -1
- package/dist/gtkx/bridge/use-signal.js +11 -10
- package/dist/gtkx/bridge/use-signal.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runner/index.js +3 -2
- package/dist/runner/index.js.map +1 -1
- package/dist/style/colors.js +3 -1
- package/dist/style/colors.js.map +1 -1
- package/dist/style/index.js +2 -2
- package/dist/style/index.js.map +1 -1
- package/dist/style/registry.gtkx.js +1 -1
- package/dist/style/registry.gtkx.js.map +1 -1
- package/dist/style/split-style.js +1 -1
- package/dist/style/split-style.js.map +1 -1
- package/dist/style/text-align.js +1 -1
- package/dist/style/text-align.js.map +1 -1
- package/dist/vite/index.js +1 -0
- package/dist/vite/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ And the portability proof — `examples/profile` renders ONE source file with bo
|
|
|
31
31
|
|
|
32
32
|
- [x] Yoga + GtkFixed spike — **GO** (0 px accuracy, 500-node reflow in 0.17 ms, 60 fps — `docs/research/yoga-gtk-spike.md`)
|
|
33
33
|
- [x] Dev environment (UTM VM with a native GNOME session, headless sway for tests) and dev workflow
|
|
34
|
-
- [x] gtkx bridge (isolation from the RC API; [
|
|
34
|
+
- [x] gtkx bridge (isolation from the RC API; [workaround catalog](https://github.com/itsmepetrov/react-native-gtkx/blob/main/docs/gtkx-rc2-notes.md))
|
|
35
35
|
- [x] Layout engine (Yoga shadow tree, measure via Pango, batching, diffing, onLayout)
|
|
36
36
|
- [x] StyleSheet: layout/visual split, CSS Color 4 colors, PlatformColor → Adwaita
|
|
37
37
|
- [x] View / Text / Image / AppRegistry — first RN render in GTK
|
|
@@ -42,8 +42,40 @@ And the portability proof — `examples/profile` renders ONE source file with bo
|
|
|
42
42
|
- [x] Windowed lists: virtualization (10k rows), sticky headers, SectionList, scrollToIndex, viewability, inverted (RN chat semantics), refresh parity
|
|
43
43
|
- [x] Linux as an RN **out-of-tree platform**: the standard Metro/Babel toolchain, `react-native.config.js` declared by the dependency, `npx react-native run-linux`, compiled package distribution (attw-checked) — see `examples/rn-app` (a cli-init app with ios + android + linux)
|
|
44
44
|
- [x] **Fast Refresh on both toolchains**: `run-linux --dev` (Metro dev server + HMR in the GTK host, state preserved) and `gtkx dev` (vite)
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
- [x] **Navigation on real Adwaita widgets**: react-navigation navigators backed by `Adw.NavigationView` and `Adw.NavigationSplitView` — see below
|
|
46
|
+
|
|
47
|
+
Verified live: `examples/hn-app` (a Hacker News reader on the Metro path), `examples/gallery` (the whole surface) and the interactive `examples/playground` — 448 tests (unit + component tests under headless Wayland).
|
|
48
|
+
|
|
49
|
+
## Navigation is native, not redrawn
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import {
|
|
53
|
+
createStackNavigator,
|
|
54
|
+
NavigationContainer,
|
|
55
|
+
} from "react-native-gtkx/navigation"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Screens are real `Adw.NavigationPage`s inside an `Adw.NavigationView`, and
|
|
59
|
+
react-navigation state stays the source of truth. The consequence: the back
|
|
60
|
+
button, the slide transition, Escape, the back gesture and the back-history
|
|
61
|
+
menu are the platform's, not a JS re-implementation — and a native pop is
|
|
62
|
+
reported back into react-navigation state instead of fighting it. Screen
|
|
63
|
+
options map onto the real chrome (`title`, `headerShown`, `gestureEnabled`
|
|
64
|
+
→ the page's `can-pop`, which is also what makes `usePreventRemove` work),
|
|
65
|
+
`headerLeft`/`headerRight` accept ordinary React Native content rendered
|
|
66
|
+
_inside_ the HeaderBar, and `createSidebarNavigator` gives the desktop
|
|
67
|
+
answer to a drawer: a persistent `Adw.NavigationSplitView` sidebar
|
|
68
|
+
(`examples/gallery` runs on it).
|
|
69
|
+
|
|
70
|
+
**No other out-of-tree React Native platform does this.** react-native-screens
|
|
71
|
+
lists Windows support, but it is an old-architecture stub that does not build
|
|
72
|
+
against modern react-native-windows — Microsoft's own showcase app falls back
|
|
73
|
+
to the JS drawer; react-native-macos is not supported by it at all, because
|
|
74
|
+
AppKit has no navigation-stack primitive to bind to. GTK4/libadwaita does have
|
|
75
|
+
one, so the model here is the iOS `native-stack` one:
|
|
76
|
+
[docs/research/navigation-extensibility.md](https://github.com/itsmepetrov/react-native-gtkx/blob/main/docs/research/navigation-extensibility.md)
|
|
77
|
+
maps every native-stack option against what we support, what is coming, and
|
|
78
|
+
what is meaningless on a desktop.
|
|
47
79
|
|
|
48
80
|
## Performance architecture
|
|
49
81
|
|
|
@@ -67,6 +99,8 @@ docs/research/layout-manager.md).
|
|
|
67
99
|
|
|
68
100
|
- [Getting Started](https://github.com/itsmepetrov/react-native-gtkx/blob/main/docs/getting-started.md) — a new project in a minute, and adding Linux to an existing RN app;
|
|
69
101
|
- [API v1](https://github.com/itsmepetrov/react-native-gtkx/blob/main/docs/api.md) — the full surface and differences from RN;
|
|
102
|
+
- [Navigation research](https://github.com/itsmepetrov/react-native-gtkx/blob/main/docs/research/navigation-extensibility.md) — every native-stack option mapped, how an existing react-navigation app ports, and why the other desktop RN platforms never got native navigation;
|
|
103
|
+
- [What we need from gtkx](https://github.com/itsmepetrov/react-native-gtkx/blob/main/docs/upstream-gtkx.md) — the standing upstream agenda (bugs with repros, API asks, workarounds we want to delete);
|
|
70
104
|
- [CONTRIBUTING](https://github.com/itsmepetrov/react-native-gtkx/blob/main/CONTRIBUTING.md) — developing the library (from macOS — via the UTM VM).
|
|
71
105
|
|
|
72
106
|
## Requirements
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Factory wiring the frame driver into the whole Animated API. The GTK side
|
|
2
|
-
// passes a scheduler backed by the frame clock
|
|
2
|
+
// passes a scheduler backed by the frame clock;
|
|
3
3
|
// tests pass a manual scheduler and drive frames by hand.
|
|
4
4
|
import { createDelay, loop, parallel, sequence } from "./composite";
|
|
5
5
|
import { createSpring } from "./spring";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-animated.js","sourceRoot":"","sources":["../../src/animated/create-animated.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"create-animated.js","sourceRoot":"","sources":["../../src/animated/create-animated.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gDAAgD;AAChD,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AASvC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAevC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAyB,EAAe,EAAE,CAAC,CAAC;IACzE,KAAK,EAAE,aAAa;IACpB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC;IACjE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC;IACjE,QAAQ;IACR,QAAQ;IACR,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,CAAC;IACzC,IAAI;CACL,CAAC,CAAA","sourcesContent":["// Factory wiring the frame driver into the whole Animated API. The GTK side\n// passes a scheduler backed by the frame clock;\n// tests pass a manual scheduler and drive frames by hand.\n\nimport { createDelay, loop, parallel, sequence } from \"./composite\"\nimport { createSpring } from \"./spring\"\nimport { createTiming } from \"./timing\"\nimport type {\n CompositeAnimation,\n FrameScheduler,\n LoopConfig,\n ParallelConfig,\n SpringConfig,\n TimingConfig,\n} from \"./types\"\nimport { AnimatedValue } from \"./value\"\n\nexport type AnimatedApi = {\n Value: typeof AnimatedValue\n timing(value: AnimatedValue, config: TimingConfig): CompositeAnimation\n spring(value: AnimatedValue, config: SpringConfig): CompositeAnimation\n sequence(animations: CompositeAnimation[]): CompositeAnimation\n parallel(\n animations: CompositeAnimation[],\n config?: ParallelConfig,\n ): CompositeAnimation\n delay(ms: number): CompositeAnimation\n loop(animation: CompositeAnimation, config?: LoopConfig): CompositeAnimation\n}\n\nexport const createAnimated = (scheduler: FrameScheduler): AnimatedApi => ({\n Value: AnimatedValue,\n timing: (value, config) => createTiming(scheduler, value, config),\n spring: (value, config) => createSpring(scheduler, value, config),\n sequence,\n parallel,\n delay: (ms) => createDelay(scheduler, ms),\n loop,\n})\n"]}
|
package/dist/animated/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Animated module entry point
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Animated module entry point. Pure by contract: everything is driven by an
|
|
2
|
+
// injected FrameScheduler — the GTK frame clock is connected where the
|
|
3
|
+
// Animated.* components are built.
|
|
4
4
|
export { createAnimated } from "./create-animated";
|
|
5
5
|
export { Easing } from "./easing";
|
|
6
6
|
export { AnimatedInterpolation, AnimatedValue } from "./value";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animated/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animated/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,uEAAuE;AACvE,mCAAmC;AAGnC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAejC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA","sourcesContent":["// Animated module entry point. Pure by contract: everything is driven by an\n// injected FrameScheduler — the GTK frame clock is connected where the\n// Animated.* components are built.\n\nexport type { AnimatedApi } from \"./create-animated\"\nexport { createAnimated } from \"./create-animated\"\nexport type { EasingFunction } from \"./easing\"\nexport { Easing } from \"./easing\"\nexport type {\n CompositeAnimation,\n EndCallback,\n EndResult,\n ExtrapolateType,\n FrameScheduler,\n InterpolationConfig,\n InterpolationListener,\n LoopConfig,\n ParallelConfig,\n SpringConfig,\n TimingConfig,\n ValueListener,\n} from \"./types\"\nexport { AnimatedInterpolation, AnimatedValue } from \"./value\"\n"]}
|
|
@@ -15,10 +15,10 @@ export const Pressable = ({ style, children, onPress, onPressIn, onPressOut, onL
|
|
|
15
15
|
const longPressTimer = useRef(null);
|
|
16
16
|
const longPressFired = useRef(false);
|
|
17
17
|
const state = { pressed, hovered };
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
18
|
+
// Gestures are attached imperatively even though rc.2 has a declarative
|
|
19
|
+
// `controllers` slot: the controllers are wired exactly once per widget and
|
|
20
|
+
// the handlers read the latest props through a ref, so a re-render never
|
|
21
|
+
// detaches and re-adds a gesture mid-press.
|
|
22
22
|
const handlersRef = useRef({
|
|
23
23
|
handlePressed: (n, x, y) => {
|
|
24
24
|
void n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressable.js","sourceRoot":"","sources":["../../src/components/pressable.tsx"],"names":[],"mappings":";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AC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,YAEtC,KAAC,eAAe,CAAC,QAAQ,IACvB,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAE9C,gBAAgB,GACQ,GACpB,CACV,CAAA;AACH,CAAC,CAAA;AAOD,sEAAsE;AACtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,KAAK,EACL,aAAa,GAAG,GAAG,EACnB,GAAG,IAAI,EACe,EAAE,EAAE,CAAC,CAC3B,KAAC,SAAS,OACJ,IAAI,EACR,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,GACtE,CACH,CAAA","sourcesContent":["import { useLayoutEffect, useRef, useState, type ReactNode } from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport { Gtk, GtkBox } from \"../gtkx/bridge/index\"\nimport { HostNodeContext } from \"./host-node\"\nimport {\n useLayoutChild,\n useRnContainer,\n type LayoutEvent,\n} from \"./use-layout-child\"\n\nexport type PressableStateCallbackType = {\n pressed: boolean\n hovered: boolean\n}\n\nexport type PressEvent = { nativeEvent: { x: number; y: number } }\n\nexport type PressableProps = {\n style?: StyleProp | ((state: PressableStateCallbackType) => StyleProp)\n children?: ReactNode | ((state: PressableStateCallbackType) => ReactNode)\n onPress?: (event: PressEvent) => void\n onPressIn?: (event: PressEvent) => void\n onPressOut?: (event: PressEvent) => void\n onLongPress?: (event: PressEvent) => void\n onHoverIn?: () => void\n onHoverOut?: () => void\n disabled?: boolean\n delayLongPress?: number\n onLayout?: (event: LayoutEvent) => void\n testID?: string\n}\n\nconst pressEvent = (x: number, y: number): PressEvent => ({\n nativeEvent: { x, y },\n})\n\n// A View with a click gesture and hover tracking. State-dependent style and\n// children follow the RN Pressable function-prop contract.\nexport const Pressable = ({\n style,\n children,\n onPress,\n onPressIn,\n onPressOut,\n onLongPress,\n onHoverIn,\n onHoverOut,\n disabled = false,\n delayLongPress = 500,\n onLayout,\n testID,\n}: PressableProps) => {\n const widgetRef = useRef<Gtk.Box | null>(null)\n const [pressed, setPressed] = useState(false)\n const [hovered, setHovered] = useState(false)\n const longPressTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const longPressFired = useRef(false)\n\n const state: PressableStateCallbackType = { pressed, hovered }\n\n // RC1-WORKAROUND(controllers-as-children): see docs/gtkx-rc1-vs-main.md\n // rc.1 has no controller-as-JSX-children support (main-only feature):\n // gestures are attached imperatively; handlers read the latest props via a\n // ref so the controllers are wired exactly once.\n const handlersRef = useRef({\n handlePressed: (n: number, x: number, y: number): void => {\n void n\n void x\n void y\n },\n handleReleased: (n: number, x: number, y: number): void => {\n void n\n void x\n void y\n },\n handleCancel: (): void => {},\n handleEnter: (): void => {},\n handleLeave: (): void => {},\n })\n const resolvedStyle = typeof style === \"function\" ? style(state) : style\n const resolvedChildren =\n typeof children === \"function\" ? children(state) : children\n\n const { host, node, cssClass } = useLayoutChild(widgetRef, {\n style: resolvedStyle,\n onLayout,\n })\n useRnContainer(widgetRef, node)\n\n const clearLongPress = (): void => {\n if (longPressTimer.current !== null) {\n clearTimeout(longPressTimer.current)\n longPressTimer.current = null\n }\n }\n\n const handlePressed = (_n: number, x: number, y: number): void => {\n if (disabled) {\n return\n }\n longPressFired.current = false\n setPressed(true)\n onPressIn?.(pressEvent(x, y))\n if (onLongPress) {\n clearLongPress()\n longPressTimer.current = setTimeout(() => {\n longPressFired.current = true\n onLongPress(pressEvent(x, y))\n }, delayLongPress)\n }\n }\n\n const handleReleased = (_n: number, x: number, y: number): void => {\n if (disabled) {\n return\n }\n clearLongPress()\n setPressed(false)\n onPressOut?.(pressEvent(x, y))\n if (!longPressFired.current) {\n onPress?.(pressEvent(x, y))\n }\n }\n\n const handleCancel = (): void => {\n clearLongPress()\n setPressed(false)\n }\n\n handlersRef.current = {\n handlePressed,\n handleReleased,\n handleCancel,\n handleEnter: () => {\n setHovered(true)\n onHoverIn?.()\n },\n handleLeave: () => {\n setHovered(false)\n onHoverOut?.()\n },\n }\n\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const click = new Gtk.GestureClick()\n click.on(\"pressed\", (n: number, x: number, y: number) =>\n handlersRef.current.handlePressed(n, x, y),\n )\n click.on(\"released\", (n: number, x: number, y: number) =>\n handlersRef.current.handleReleased(n, x, y),\n )\n click.on(\"cancel\", () => handlersRef.current.handleCancel())\n widget.addController(click)\n\n const motion = new Gtk.EventControllerMotion()\n motion.on(\"enter\", () => handlersRef.current.handleEnter())\n motion.on(\"leave\", () => handlersRef.current.handleLeave())\n widget.addController(motion)\n\n return () => {\n widget.removeController(click)\n widget.removeController(motion)\n }\n }, [])\n\n return (\n <GtkBox\n ref={widgetRef}\n name={testID}\n cssClasses={cssClass ? [cssClass] : []}\n >\n <HostNodeContext.Provider\n value={{ engine: host.engine, node, widgetRef }}\n >\n {resolvedChildren}\n </HostNodeContext.Provider>\n </GtkBox>\n )\n}\n\nexport type TouchableOpacityProps = Omit<PressableProps, \"style\"> & {\n style?: StyleProp\n activeOpacity?: number\n}\n\n// Classic RN touchable: dims itself while pressed via widget opacity.\nexport const TouchableOpacity = ({\n style,\n activeOpacity = 0.5,\n ...rest\n}: TouchableOpacityProps) => (\n <Pressable\n {...rest}\n style={({ pressed }) => [style, pressed && { opacity: activeOpacity }]}\n />\n)\n"]}
|
|
1
|
+
{"version":3,"file":"pressable.js","sourceRoot":"","sources":["../../src/components/pressable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EACL,cAAc,EACd,cAAc,GAEf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sEAAsE;AACtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,KAAK,EACL,aAAa,GAAG,GAAG,EACnB,GAAG,IAAI,EACe,EAAE,EAAE,CAAC,CAC3B,KAAC,SAAS,OACJ,IAAI,EACR,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,GACtE,CACH,CAAA","sourcesContent":["import { useLayoutEffect, useRef, useState, type ReactNode } from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport { Gtk, GtkBox } from \"../gtkx/bridge/index\"\nimport { HostNodeContext } from \"./host-node\"\nimport {\n useLayoutChild,\n useRnContainer,\n type LayoutEvent,\n} from \"./use-layout-child\"\n\nexport type PressableStateCallbackType = {\n pressed: boolean\n hovered: boolean\n}\n\nexport type PressEvent = { nativeEvent: { x: number; y: number } }\n\nexport type PressableProps = {\n style?: StyleProp | ((state: PressableStateCallbackType) => StyleProp)\n children?: ReactNode | ((state: PressableStateCallbackType) => ReactNode)\n onPress?: (event: PressEvent) => void\n onPressIn?: (event: PressEvent) => void\n onPressOut?: (event: PressEvent) => void\n onLongPress?: (event: PressEvent) => void\n onHoverIn?: () => void\n onHoverOut?: () => void\n disabled?: boolean\n delayLongPress?: number\n onLayout?: (event: LayoutEvent) => void\n testID?: string\n}\n\nconst pressEvent = (x: number, y: number): PressEvent => ({\n nativeEvent: { x, y },\n})\n\n// A View with a click gesture and hover tracking. State-dependent style and\n// children follow the RN Pressable function-prop contract.\nexport const Pressable = ({\n style,\n children,\n onPress,\n onPressIn,\n onPressOut,\n onLongPress,\n onHoverIn,\n onHoverOut,\n disabled = false,\n delayLongPress = 500,\n onLayout,\n testID,\n}: PressableProps) => {\n const widgetRef = useRef<Gtk.Box | null>(null)\n const [pressed, setPressed] = useState(false)\n const [hovered, setHovered] = useState(false)\n const longPressTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n const longPressFired = useRef(false)\n\n const state: PressableStateCallbackType = { pressed, hovered }\n\n // Gestures are attached imperatively even though rc.2 has a declarative\n // `controllers` slot: the controllers are wired exactly once per widget and\n // the handlers read the latest props through a ref, so a re-render never\n // detaches and re-adds a gesture mid-press.\n const handlersRef = useRef({\n handlePressed: (n: number, x: number, y: number): void => {\n void n\n void x\n void y\n },\n handleReleased: (n: number, x: number, y: number): void => {\n void n\n void x\n void y\n },\n handleCancel: (): void => {},\n handleEnter: (): void => {},\n handleLeave: (): void => {},\n })\n const resolvedStyle = typeof style === \"function\" ? style(state) : style\n const resolvedChildren =\n typeof children === \"function\" ? children(state) : children\n\n const { host, node, cssClass } = useLayoutChild(widgetRef, {\n style: resolvedStyle,\n onLayout,\n })\n useRnContainer(widgetRef, node)\n\n const clearLongPress = (): void => {\n if (longPressTimer.current !== null) {\n clearTimeout(longPressTimer.current)\n longPressTimer.current = null\n }\n }\n\n const handlePressed = (_n: number, x: number, y: number): void => {\n if (disabled) {\n return\n }\n longPressFired.current = false\n setPressed(true)\n onPressIn?.(pressEvent(x, y))\n if (onLongPress) {\n clearLongPress()\n longPressTimer.current = setTimeout(() => {\n longPressFired.current = true\n onLongPress(pressEvent(x, y))\n }, delayLongPress)\n }\n }\n\n const handleReleased = (_n: number, x: number, y: number): void => {\n if (disabled) {\n return\n }\n clearLongPress()\n setPressed(false)\n onPressOut?.(pressEvent(x, y))\n if (!longPressFired.current) {\n onPress?.(pressEvent(x, y))\n }\n }\n\n const handleCancel = (): void => {\n clearLongPress()\n setPressed(false)\n }\n\n handlersRef.current = {\n handlePressed,\n handleReleased,\n handleCancel,\n handleEnter: () => {\n setHovered(true)\n onHoverIn?.()\n },\n handleLeave: () => {\n setHovered(false)\n onHoverOut?.()\n },\n }\n\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const click = new Gtk.GestureClick()\n click.on(\"pressed\", (n: number, x: number, y: number) =>\n handlersRef.current.handlePressed(n, x, y),\n )\n click.on(\"released\", (n: number, x: number, y: number) =>\n handlersRef.current.handleReleased(n, x, y),\n )\n click.on(\"cancel\", () => handlersRef.current.handleCancel())\n widget.addController(click)\n\n const motion = new Gtk.EventControllerMotion()\n motion.on(\"enter\", () => handlersRef.current.handleEnter())\n motion.on(\"leave\", () => handlersRef.current.handleLeave())\n widget.addController(motion)\n\n return () => {\n widget.removeController(click)\n widget.removeController(motion)\n }\n }, [])\n\n return (\n <GtkBox\n ref={widgetRef}\n name={testID}\n cssClasses={cssClass ? [cssClass] : []}\n >\n <HostNodeContext.Provider\n value={{ engine: host.engine, node, widgetRef }}\n >\n {resolvedChildren}\n </HostNodeContext.Provider>\n </GtkBox>\n )\n}\n\nexport type TouchableOpacityProps = Omit<PressableProps, \"style\"> & {\n style?: StyleProp\n activeOpacity?: number\n}\n\n// Classic RN touchable: dims itself while pressed via widget opacity.\nexport const TouchableOpacity = ({\n style,\n activeOpacity = 0.5,\n ...rest\n}: TouchableOpacityProps) => (\n <Pressable\n {...rest}\n style={({ pressed }) => [style, pressed && { opacity: activeOpacity }]}\n />\n)\n"]}
|
|
@@ -10,8 +10,9 @@ const INPUT_PURPOSE = {
|
|
|
10
10
|
"phone-pad": Gtk.InputPurpose.PHONE,
|
|
11
11
|
url: Gtk.InputPurpose.URL,
|
|
12
12
|
};
|
|
13
|
-
//
|
|
14
|
-
//
|
|
13
|
+
// The focus controller is attached imperatively (rc.2 also offers a
|
|
14
|
+
// declarative `controllers` slot): one wiring per widget, handlers read from a
|
|
15
|
+
// ref, so changing onFocus/onBlur never re-creates the controller.
|
|
15
16
|
const useFocusController = (widgetRef, onFocus, onBlur) => {
|
|
16
17
|
const handlers = useRef({ onFocus, onBlur });
|
|
17
18
|
handlers.current = { onFocus, onBlur };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.js","sourceRoot":"","sources":["../../src/components/text-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,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GAAG,CAAC,KAAqB,EAAE,EAAE,CACjD,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAChB,KAAC,kBAAkB,OAAK,KAAK,GAAI,CAClC,CAAC,CAAC,CAAC,CACF,KAAC,mBAAmB,OAAK,KAAK,GAAI,CACnC,CAAA","sourcesContent":["import { useLayoutEffect, useRef, useState } from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport {\n Gtk,\n GtkEntry,\n GtkLabel,\n GtkScrolledWindow,\n GtkTextView,\n type Gtk as GtkNs,\n} from \"../gtkx/bridge/index\"\nimport { useLayoutChild, type LayoutEvent } from \"./use-layout-child\"\nimport { View } from \"./view\"\n\nexport type TextInputProps = {\n value?: string\n defaultValue?: string\n onChangeText?: (text: string) => void\n onSubmitEditing?: (event: { nativeEvent: { text: string } }) => void\n onFocus?: () => void\n onBlur?: () => void\n placeholder?: string\n secureTextEntry?: boolean\n editable?: boolean\n keyboardType?: \"default\" | \"numeric\" | \"email-address\" | \"phone-pad\" | \"url\"\n // RN: a multiline input needs a height in the style; Enter inserts a\n // newline and never fires onSubmitEditing.\n multiline?: boolean\n // RN's iOS-only clear affordance, native here: GtkEntry's built-in\n // secondary icon (inside the field, so nothing shifts around it).\n // Single-line only, like RN.\n clearButtonMode?: \"never\" | \"while-editing\" | \"unless-editing\" | \"always\"\n style?: StyleProp\n onLayout?: (event: LayoutEvent) => void\n testID?: string\n}\n\nconst INPUT_PURPOSE: Record<\n NonNullable<TextInputProps[\"keyboardType\"]>,\n Gtk.InputPurpose\n> = {\n default: Gtk.InputPurpose.FREE_FORM,\n numeric: Gtk.InputPurpose.NUMBER,\n \"email-address\": Gtk.InputPurpose.EMAIL,\n \"phone-pad\": Gtk.InputPurpose.PHONE,\n url: Gtk.InputPurpose.URL,\n}\n\n// RC1-WORKAROUND(controllers-as-children): see docs/gtkx-rc1-vs-main.md\n// rc.1: controllers attach imperatively (JSX children work on main only).\nconst useFocusController = (\n widgetRef: React.RefObject<GtkNs.Widget | null>,\n onFocus?: () => void,\n onBlur?: () => void,\n): void => {\n const handlers = useRef({ onFocus, onBlur })\n handlers.current = { onFocus, onBlur }\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const focus = new Gtk.EventControllerFocus()\n const enter = (): void => handlers.current.onFocus?.()\n const leave = (): void => handlers.current.onBlur?.()\n focus.on(\"enter\", enter)\n focus.on(\"leave\", leave)\n widget.addController(focus)\n return () => {\n widget.removeController(focus)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\n// Single-line input over GtkEntry. gtkx's controlled-text behavior keeps the\n// widget in sync with the `text` prop (RN controlled semantics); uncontrolled\n// usage passes defaultValue once.\nconst SingleLineTextInput = ({\n value,\n defaultValue,\n onChangeText,\n onSubmitEditing,\n onFocus,\n onBlur,\n placeholder,\n secureTextEntry = false,\n editable = true,\n keyboardType = \"default\",\n clearButtonMode = \"never\",\n style,\n onLayout,\n testID,\n}: TextInputProps) => {\n const widgetRef = useRef<GtkNs.Entry | null>(null)\n const [focused, setFocused] = useState(false)\n\n useLayoutChild(widgetRef, {\n style,\n onLayout,\n // The entry measures itself (theme-accurate height); width is driven by\n // the style (flex/width), with a small floor for usability.\n measureFromWidget: true,\n extraLayout: { minWidth: 60 },\n })\n\n const controlled = value !== undefined\n\n useFocusController(\n widgetRef,\n () => {\n setFocused(true)\n onFocus?.()\n },\n () => {\n setFocused(false)\n onBlur?.()\n },\n )\n\n // RN semantics: the affordance only shows when there is something to\n // clear, and while-editing / unless-editing follow focus.\n const text = controlled ? value : undefined\n const hasText =\n text !== undefined\n ? text.length > 0\n : (widgetRef.current?.getText().length ?? 0) > 0\n const showClear =\n hasText &&\n (clearButtonMode === \"always\" ||\n (clearButtonMode === \"while-editing\" && focused) ||\n (clearButtonMode === \"unless-editing\" && !focused))\n\n return (\n <GtkEntry\n ref={widgetRef}\n name={testID}\n secondaryIconName={showClear ? \"edit-clear-symbolic\" : null}\n secondaryIconActivatable={showClear}\n secondaryIconTooltipText={showClear ? \"Clear\" : null}\n onIconRelease={() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n // Uncontrolled inputs clear themselves; controlled ones report an\n // empty string and let the owner drive the value (RN contract).\n if (!controlled) {\n widget.setText(\"\")\n }\n onChangeText?.(\"\")\n }}\n text={controlled ? value : (defaultValue ?? \"\")}\n placeholderText={placeholder ?? \"\"}\n visibility={!secureTextEntry}\n editable={editable}\n sensitive={editable}\n inputPurpose={INPUT_PURPOSE[keyboardType]}\n onChanged={() => {\n const widget = widgetRef.current\n if (widget) {\n onChangeText?.(widget.getText())\n }\n }}\n onActivate={() => {\n const widget = widgetRef.current\n if (widget) {\n onSubmitEditing?.({ nativeEvent: { text: widget.getText() } })\n }\n }}\n />\n )\n}\n\nconst readBuffer = (buffer: GtkNs.TextBuffer): string =>\n buffer.getText(buffer.getStartIter(), buffer.getEndIter(), true)\n\n// GtkTextView has no native placeholder — a dim, click-transparent label\n// sits over the empty view (RN shows the placeholder while empty, focused\n// or not).\nconst MultilinePlaceholder = ({ text }: { text: string }) => {\n const labelRef = useRef<GtkNs.Label | null>(null)\n useLayoutChild(labelRef, {\n style: { position: \"absolute\", left: 12, top: 8 },\n onLayout: undefined,\n })\n useLayoutEffect(() => {\n labelRef.current?.setCanTarget(false)\n labelRef.current?.addCssClass(\"dim-label\")\n }, [])\n return (\n <GtkLabel\n ref={labelRef}\n label={text}\n />\n )\n}\n\n// Multiline input over GtkTextView in a GtkScrolledWindow: word wrap, the\n// style sets the box (RN requires a height for multiline), overflowing\n// content scrolls inside. The buffer syncs with `value` under RN controlled\n// semantics; Enter inserts a newline (onSubmitEditing never fires — RN\n// multiline behavior).\nconst MultilineTextInput = ({\n value,\n defaultValue,\n onChangeText,\n onFocus,\n onBlur,\n placeholder,\n editable = true,\n style,\n onLayout,\n testID,\n}: TextInputProps) => {\n const scrolledRef = useRef<GtkNs.ScrolledWindow | null>(null)\n const viewRef = useRef<GtkNs.TextView | null>(null)\n const controlled = value !== undefined\n const [empty, setEmpty] = useState(\n (controlled ? (value ?? \"\") : (defaultValue ?? \"\")) === \"\",\n )\n\n const suppressEcho = useRef(false)\n const latest = useRef({ onChangeText })\n latest.current = { onChangeText }\n\n useLayoutEffect(() => {\n const view = viewRef.current\n if (!view) {\n return\n }\n // Breathing room akin to GtkEntry's built-in padding.\n view.setLeftMargin(10)\n view.setRightMargin(10)\n view.setTopMargin(8)\n view.setBottomMargin(8)\n const buffer = view.getBuffer()\n const initial = controlled ? (value ?? \"\") : (defaultValue ?? \"\")\n if (initial !== \"\") {\n suppressEcho.current = true\n buffer.setText(initial, -1)\n suppressEcho.current = false\n }\n const changed = (): void => {\n const text = readBuffer(buffer)\n setEmpty(text === \"\")\n if (!suppressEcho.current) {\n latest.current.onChangeText?.(text)\n }\n }\n buffer.on(\"changed\", changed)\n return () => {\n buffer.off(\"changed\", changed)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // RN controlled semantics: the prop wins over whatever was typed.\n useLayoutEffect(() => {\n if (!controlled) {\n return\n }\n const view = viewRef.current\n if (!view) {\n return\n }\n const buffer = view.getBuffer()\n const next = value ?? \"\"\n if (readBuffer(buffer) !== next) {\n suppressEcho.current = true\n buffer.setText(next, -1)\n suppressEcho.current = false\n setEmpty(next === \"\")\n }\n }, [controlled, value])\n\n useFocusController(viewRef, onFocus, onBlur)\n\n return (\n <View\n style={[style, { minHeight: 36, minWidth: 60 }]}\n onLayout={onLayout}\n >\n <ScrolledFill scrolledRef={scrolledRef}>\n <GtkTextView\n ref={viewRef}\n name={testID}\n editable={editable}\n sensitive={editable}\n wrapMode={Gtk.WrapMode.WORD_CHAR}\n />\n </ScrolledFill>\n {empty && placeholder ? (\n <MultilinePlaceholder text={placeholder} />\n ) : null}\n </View>\n )\n}\n\n// The scrolled window fills the styled box exactly (its own layout child).\nconst ScrolledFill = ({\n scrolledRef,\n children,\n}: {\n scrolledRef: React.RefObject<GtkNs.ScrolledWindow | null>\n children: React.ReactNode\n}) => {\n useLayoutChild(scrolledRef, {\n style: { position: \"absolute\", left: 0, right: 0, top: 0, bottom: 0 },\n onLayout: undefined,\n })\n return <GtkScrolledWindow ref={scrolledRef}>{children}</GtkScrolledWindow>\n}\n\nexport const TextInput = (props: TextInputProps) =>\n props.multiline ? (\n <MultilineTextInput {...props} />\n ) : (\n <SingleLineTextInput {...props} />\n )\n"]}
|
|
1
|
+
{"version":3,"file":"text-input.js","sourceRoot":"","sources":["../../src/components/text-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEzD,OAAO,EACL,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,WAAW,GAEZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAyB7B,MAAM,aAAa,GAGf;IACF,OAAO,EAAE,GAAG,CAAC,YAAY,CAAC,SAAS;IACnC,OAAO,EAAE,GAAG,CAAC,YAAY,CAAC,MAAM;IAChC,eAAe,EAAE,GAAG,CAAC,YAAY,CAAC,KAAK;IACvC,WAAW,EAAE,GAAG,CAAC,YAAY,CAAC,KAAK;IACnC,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG;CAC1B,CAAA;AAED,oEAAoE;AACpE,+EAA+E;AAC/E,mEAAmE;AACnE,MAAM,kBAAkB,GAAG,CACzB,SAA+C,EAC/C,OAAoB,EACpB,MAAmB,EACb,EAAE;IACR,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IAC5C,QAAQ,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;IACtC,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAA;QAChC,IAAI,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,EACX,QAAQ,GAIT,EAAE,EAAE;IACH,cAAc,CAAC,WAAW,EAAE;QAC1B,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;QACrE,QAAQ,EAAE,SAAS;KACpB,CAAC,CAAA;IACF,OAAO,KAAC,iBAAiB,IAAC,GAAG,EAAE,WAAW,YAAG,QAAQ,GAAqB,CAAA;AAC5E,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE,CACjD,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAChB,KAAC,kBAAkB,OAAK,KAAK,GAAI,CAClC,CAAC,CAAC,CAAC,CACF,KAAC,mBAAmB,OAAK,KAAK,GAAI,CACnC,CAAA","sourcesContent":["import { useLayoutEffect, useRef, useState } from \"react\"\nimport type { StyleProp } from \"../contracts\"\nimport {\n Gtk,\n GtkEntry,\n GtkLabel,\n GtkScrolledWindow,\n GtkTextView,\n type Gtk as GtkNs,\n} from \"../gtkx/bridge/index\"\nimport { useLayoutChild, type LayoutEvent } from \"./use-layout-child\"\nimport { View } from \"./view\"\n\nexport type TextInputProps = {\n value?: string\n defaultValue?: string\n onChangeText?: (text: string) => void\n onSubmitEditing?: (event: { nativeEvent: { text: string } }) => void\n onFocus?: () => void\n onBlur?: () => void\n placeholder?: string\n secureTextEntry?: boolean\n editable?: boolean\n keyboardType?: \"default\" | \"numeric\" | \"email-address\" | \"phone-pad\" | \"url\"\n // RN: a multiline input needs a height in the style; Enter inserts a\n // newline and never fires onSubmitEditing.\n multiline?: boolean\n // RN's iOS-only clear affordance, native here: GtkEntry's built-in\n // secondary icon (inside the field, so nothing shifts around it).\n // Single-line only, like RN.\n clearButtonMode?: \"never\" | \"while-editing\" | \"unless-editing\" | \"always\"\n style?: StyleProp\n onLayout?: (event: LayoutEvent) => void\n testID?: string\n}\n\nconst INPUT_PURPOSE: Record<\n NonNullable<TextInputProps[\"keyboardType\"]>,\n Gtk.InputPurpose\n> = {\n default: Gtk.InputPurpose.FREE_FORM,\n numeric: Gtk.InputPurpose.NUMBER,\n \"email-address\": Gtk.InputPurpose.EMAIL,\n \"phone-pad\": Gtk.InputPurpose.PHONE,\n url: Gtk.InputPurpose.URL,\n}\n\n// The focus controller is attached imperatively (rc.2 also offers a\n// declarative `controllers` slot): one wiring per widget, handlers read from a\n// ref, so changing onFocus/onBlur never re-creates the controller.\nconst useFocusController = (\n widgetRef: React.RefObject<GtkNs.Widget | null>,\n onFocus?: () => void,\n onBlur?: () => void,\n): void => {\n const handlers = useRef({ onFocus, onBlur })\n handlers.current = { onFocus, onBlur }\n useLayoutEffect(() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n const focus = new Gtk.EventControllerFocus()\n const enter = (): void => handlers.current.onFocus?.()\n const leave = (): void => handlers.current.onBlur?.()\n focus.on(\"enter\", enter)\n focus.on(\"leave\", leave)\n widget.addController(focus)\n return () => {\n widget.removeController(focus)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\n// Single-line input over GtkEntry. gtkx's controlled-text behavior keeps the\n// widget in sync with the `text` prop (RN controlled semantics); uncontrolled\n// usage passes defaultValue once.\nconst SingleLineTextInput = ({\n value,\n defaultValue,\n onChangeText,\n onSubmitEditing,\n onFocus,\n onBlur,\n placeholder,\n secureTextEntry = false,\n editable = true,\n keyboardType = \"default\",\n clearButtonMode = \"never\",\n style,\n onLayout,\n testID,\n}: TextInputProps) => {\n const widgetRef = useRef<GtkNs.Entry | null>(null)\n const [focused, setFocused] = useState(false)\n\n useLayoutChild(widgetRef, {\n style,\n onLayout,\n // The entry measures itself (theme-accurate height); width is driven by\n // the style (flex/width), with a small floor for usability.\n measureFromWidget: true,\n extraLayout: { minWidth: 60 },\n })\n\n const controlled = value !== undefined\n\n useFocusController(\n widgetRef,\n () => {\n setFocused(true)\n onFocus?.()\n },\n () => {\n setFocused(false)\n onBlur?.()\n },\n )\n\n // RN semantics: the affordance only shows when there is something to\n // clear, and while-editing / unless-editing follow focus.\n const text = controlled ? value : undefined\n const hasText =\n text !== undefined\n ? text.length > 0\n : (widgetRef.current?.getText().length ?? 0) > 0\n const showClear =\n hasText &&\n (clearButtonMode === \"always\" ||\n (clearButtonMode === \"while-editing\" && focused) ||\n (clearButtonMode === \"unless-editing\" && !focused))\n\n return (\n <GtkEntry\n ref={widgetRef}\n name={testID}\n secondaryIconName={showClear ? \"edit-clear-symbolic\" : null}\n secondaryIconActivatable={showClear}\n secondaryIconTooltipText={showClear ? \"Clear\" : null}\n onIconRelease={() => {\n const widget = widgetRef.current\n if (!widget) {\n return\n }\n // Uncontrolled inputs clear themselves; controlled ones report an\n // empty string and let the owner drive the value (RN contract).\n if (!controlled) {\n widget.setText(\"\")\n }\n onChangeText?.(\"\")\n }}\n text={controlled ? value : (defaultValue ?? \"\")}\n placeholderText={placeholder ?? \"\"}\n visibility={!secureTextEntry}\n editable={editable}\n sensitive={editable}\n inputPurpose={INPUT_PURPOSE[keyboardType]}\n onChanged={() => {\n const widget = widgetRef.current\n if (widget) {\n onChangeText?.(widget.getText())\n }\n }}\n onActivate={() => {\n const widget = widgetRef.current\n if (widget) {\n onSubmitEditing?.({ nativeEvent: { text: widget.getText() } })\n }\n }}\n />\n )\n}\n\nconst readBuffer = (buffer: GtkNs.TextBuffer): string =>\n buffer.getText(buffer.getStartIter(), buffer.getEndIter(), true)\n\n// GtkTextView has no native placeholder — a dim, click-transparent label\n// sits over the empty view (RN shows the placeholder while empty, focused\n// or not).\nconst MultilinePlaceholder = ({ text }: { text: string }) => {\n const labelRef = useRef<GtkNs.Label | null>(null)\n useLayoutChild(labelRef, {\n style: { position: \"absolute\", left: 12, top: 8 },\n onLayout: undefined,\n })\n useLayoutEffect(() => {\n labelRef.current?.setCanTarget(false)\n labelRef.current?.addCssClass(\"dim-label\")\n }, [])\n return (\n <GtkLabel\n ref={labelRef}\n label={text}\n />\n )\n}\n\n// Multiline input over GtkTextView in a GtkScrolledWindow: word wrap, the\n// style sets the box (RN requires a height for multiline), overflowing\n// content scrolls inside. The buffer syncs with `value` under RN controlled\n// semantics; Enter inserts a newline (onSubmitEditing never fires — RN\n// multiline behavior).\nconst MultilineTextInput = ({\n value,\n defaultValue,\n onChangeText,\n onFocus,\n onBlur,\n placeholder,\n editable = true,\n style,\n onLayout,\n testID,\n}: TextInputProps) => {\n const scrolledRef = useRef<GtkNs.ScrolledWindow | null>(null)\n const viewRef = useRef<GtkNs.TextView | null>(null)\n const controlled = value !== undefined\n const [empty, setEmpty] = useState(\n (controlled ? (value ?? \"\") : (defaultValue ?? \"\")) === \"\",\n )\n\n const suppressEcho = useRef(false)\n const latest = useRef({ onChangeText })\n latest.current = { onChangeText }\n\n useLayoutEffect(() => {\n const view = viewRef.current\n if (!view) {\n return\n }\n // Breathing room akin to GtkEntry's built-in padding.\n view.setLeftMargin(10)\n view.setRightMargin(10)\n view.setTopMargin(8)\n view.setBottomMargin(8)\n const buffer = view.getBuffer()\n const initial = controlled ? (value ?? \"\") : (defaultValue ?? \"\")\n if (initial !== \"\") {\n suppressEcho.current = true\n buffer.setText(initial, -1)\n suppressEcho.current = false\n }\n const changed = (): void => {\n const text = readBuffer(buffer)\n setEmpty(text === \"\")\n if (!suppressEcho.current) {\n latest.current.onChangeText?.(text)\n }\n }\n buffer.on(\"changed\", changed)\n return () => {\n buffer.off(\"changed\", changed)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // RN controlled semantics: the prop wins over whatever was typed.\n useLayoutEffect(() => {\n if (!controlled) {\n return\n }\n const view = viewRef.current\n if (!view) {\n return\n }\n const buffer = view.getBuffer()\n const next = value ?? \"\"\n if (readBuffer(buffer) !== next) {\n suppressEcho.current = true\n buffer.setText(next, -1)\n suppressEcho.current = false\n setEmpty(next === \"\")\n }\n }, [controlled, value])\n\n useFocusController(viewRef, onFocus, onBlur)\n\n return (\n <View\n style={[style, { minHeight: 36, minWidth: 60 }]}\n onLayout={onLayout}\n >\n <ScrolledFill scrolledRef={scrolledRef}>\n <GtkTextView\n ref={viewRef}\n name={testID}\n editable={editable}\n sensitive={editable}\n wrapMode={Gtk.WrapMode.WORD_CHAR}\n />\n </ScrolledFill>\n {empty && placeholder ? (\n <MultilinePlaceholder text={placeholder} />\n ) : null}\n </View>\n )\n}\n\n// The scrolled window fills the styled box exactly (its own layout child).\nconst ScrolledFill = ({\n scrolledRef,\n children,\n}: {\n scrolledRef: React.RefObject<GtkNs.ScrolledWindow | null>\n children: React.ReactNode\n}) => {\n useLayoutChild(scrolledRef, {\n style: { position: \"absolute\", left: 0, right: 0, top: 0, bottom: 0 },\n onLayout: undefined,\n })\n return <GtkScrolledWindow ref={scrolledRef}>{children}</GtkScrolledWindow>\n}\n\nexport const TextInput = (props: TextInputProps) =>\n props.multiline ? (\n <MultilineTextInput {...props} />\n ) : (\n <SingleLineTextInput {...props} />\n )\n"]}
|
package/dist/contracts.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// Shared contracts between the layout engine
|
|
2
|
-
//
|
|
3
|
-
// FROZEN during parallel development: changes go through the orchestrator only.
|
|
1
|
+
// Shared contracts between the layout engine, the style system, the API
|
|
2
|
+
// modules and the components — the one module every layer may import.
|
|
4
3
|
export {};
|
|
5
4
|
//# sourceMappingURL=contracts.js.map
|
package/dist/contracts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,sEAAsE","sourcesContent":["// Shared contracts between the layout engine, the style system, the API\n// modules and the components — the one module every layer may import.\n\n// --- style ------------------------------------------------------------------\n\nexport type DimensionValue = number | `${number}%` | \"auto\"\n\nexport type FlexAlignType =\n \"flex-start\" | \"flex-end\" | \"center\" | \"stretch\" | \"baseline\"\n\n// Layout-affecting props: classified by the style system, consumed by the\n// layout engine, which maps them onto Yoga node setters.\nexport type LayoutStyle = Partial<{\n alignContent:\n | \"flex-start\"\n | \"flex-end\"\n | \"center\"\n | \"stretch\"\n | \"space-between\"\n | \"space-around\"\n alignItems: FlexAlignType\n alignSelf: \"auto\" | FlexAlignType\n aspectRatio: number | string\n bottom: DimensionValue\n columnGap: number\n direction: \"inherit\" | \"ltr\" | \"rtl\"\n display: \"none\" | \"flex\"\n flex: number\n flexBasis: DimensionValue\n flexDirection: \"row\" | \"row-reverse\" | \"column\" | \"column-reverse\"\n flexGrow: number\n flexShrink: number\n flexWrap: \"wrap\" | \"nowrap\" | \"wrap-reverse\"\n gap: number\n height: DimensionValue\n justifyContent:\n | \"flex-start\"\n | \"flex-end\"\n | \"center\"\n | \"space-between\"\n | \"space-around\"\n | \"space-evenly\"\n left: DimensionValue\n margin: DimensionValue\n marginBottom: DimensionValue\n marginHorizontal: DimensionValue\n marginLeft: DimensionValue\n marginRight: DimensionValue\n marginTop: DimensionValue\n marginVertical: DimensionValue\n maxHeight: DimensionValue\n maxWidth: DimensionValue\n minHeight: DimensionValue\n minWidth: DimensionValue\n overflow: \"visible\" | \"hidden\" | \"scroll\"\n padding: DimensionValue\n paddingBottom: DimensionValue\n paddingHorizontal: DimensionValue\n paddingLeft: DimensionValue\n paddingRight: DimensionValue\n paddingTop: DimensionValue\n paddingVertical: DimensionValue\n position: \"absolute\" | \"relative\" | \"static\"\n right: DimensionValue\n rowGap: number\n top: DimensionValue\n width: DimensionValue\n}>\n\nexport type TransformPart =\n | { translateX: number }\n | { translateY: number }\n | { scale: number }\n | { scaleX: number }\n | { scaleY: number }\n | { rotate: `${number}deg` | `${number}rad` }\n\n// Visual props: classified by the style system, compiled into GTK CSS\n// classes via the bridge `css` helper. Text-specific props apply to <Text>.\nexport type VisualStyle = Partial<{\n backgroundColor: string\n borderBottomColor: string\n borderBottomLeftRadius: number\n borderBottomRightRadius: number\n borderBottomWidth: number\n borderColor: string\n borderLeftColor: string\n borderLeftWidth: number\n borderRadius: number\n borderRightColor: string\n borderRightWidth: number\n borderStyle: \"solid\" | \"dotted\" | \"dashed\"\n borderTopColor: string\n borderTopLeftRadius: number\n borderTopRightRadius: number\n borderTopWidth: number\n borderWidth: number\n color: string\n fontFamily: string\n fontSize: number\n fontStyle: \"normal\" | \"italic\"\n fontWeight:\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\"\n letterSpacing: number\n lineHeight: number\n opacity: number\n // NOT emitted to CSS (no such GTK CSS property): the Text component applies\n // it via label props using the pure style/text-align helper.\n textAlign: \"auto\" | \"left\" | \"right\" | \"center\" | \"justify\"\n // NOT emitted to CSS: applied by the engine through the layout manager\n // layout-child transforms (Animated fast path).\n transform: TransformPart[]\n}>\n\n// RN pointerEvents (also allowed in styles since RN 0.71); behavioral, so\n// it belongs to neither the layout nor the visual bucket — splitStyle\n// ignores it and View reads it from the flattened style.\nexport type PointerEventsValue = \"auto\" | \"none\" | \"box-none\" | \"box-only\"\n\nexport type FlatStyle = LayoutStyle &\n VisualStyle & {\n pointerEvents?: PointerEventsValue\n }\n\n// Style prop as components accept it: single object, array (with falsy holes).\nexport type StyleProp<T = FlatStyle> =\n T | null | undefined | false | ReadonlyArray<StyleProp<T>>\n\n// Result of classifying a flattened style (produced by the style system):\nexport type SplitStyle = {\n layout: LayoutStyle\n visual: VisualStyle\n}\n\n// --- layout engine ----------------------------------------------------------\n\nexport type Rect = {\n x: number\n y: number\n width: number\n height: number\n}\n\nexport type MeasureConstraintMode = \"undefined\" | \"exactly\" | \"at-most\"\n\nexport type MeasureSize = { width: number; height: number }\n\n// Measure callback for leaf nodes (text, images): implemented by components\n// using bridge probes; called by the engine during Yoga layout passes.\nexport type MeasureFn = (\n width: number,\n widthMode: MeasureConstraintMode,\n height: number,\n heightMode: MeasureConstraintMode,\n) => MeasureSize\n\n// Handle the layout engine gives every mounted component.\nexport interface LayoutNodeApi {\n setStyle(style: LayoutStyle): void\n setMeasureFn(measure: MeasureFn | null): void\n markDirty(): void\n getRect(): Rect | null\n setOnLayout(callback: ((rect: Rect) => void) | null): void\n}\n\n// --- subscriptions ----------------------------------------------------------\n\nexport type SubscriptionHandle = { remove(): void }\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The ONLY module allowed to import @gtkx/* (enforced by eslint no-restricted-imports).
|
|
2
2
|
// gtkx is an RC dependency: when its API moves, this bridge absorbs the change.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
4
|
+
// Caveats baked into this surface (catalogued in docs/gtkx-rc2-notes.md):
|
|
5
5
|
// - 64-bit FFI values arrive as BigInt → normalize with toNumber() at this boundary
|
|
6
6
|
// import-then-export (not `export * as`): the latter is the one syntax the
|
|
7
7
|
// stock @react-native/babel-preset cannot transform — this form keeps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,gFAAgF;AAChF,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/index.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,gFAAgF;AAChF,EAAE;AACF,0EAA0E;AAC1E,oFAAoF;AAEpF,2EAA2E;AAC3E,sEAAsE;AACtE,qDAAqD;AACrD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;AAEzD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,GACf,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,cAAc,EACd,eAAe,EACf,WAAW,GAEZ,MAAM,aAAa,CAAA;AAEpB,+EAA+E;AAC/E,yCAAyC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,WAAW,GAGZ,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA","sourcesContent":["// The ONLY module allowed to import @gtkx/* (enforced by eslint no-restricted-imports).\n// gtkx is an RC dependency: when its API moves, this bridge absorbs the change.\n//\n// Caveats baked into this surface (catalogued in docs/gtkx-rc2-notes.md):\n// - 64-bit FFI values arrive as BigInt → normalize with toNumber() at this boundary\n\n// import-then-export (not `export * as`): the latter is the one syntax the\n// stock @react-native/babel-preset cannot transform — this form keeps\n// consumer apps on their unmodified RN Babel config.\nimport * as Adw from \"@gtkx/gi/adw\"\nimport * as Gdk from \"@gtkx/gi/gdk\"\nimport * as Gio from \"@gtkx/gi/gio\"\nimport * as GLib from \"@gtkx/gi/glib\"\nimport * as Graphene from \"@gtkx/gi/graphene\"\nimport * as Gsk from \"@gtkx/gi/gsk\"\nimport * as Gtk from \"@gtkx/gi/gtk\"\nimport * as Pango from \"@gtkx/gi/pango\"\n\nexport { Adw, Gdk, Gio, GLib, Graphene, Gsk, Gtk, Pango }\n\nexport {\n AdwApplicationWindow,\n AdwHeaderBar,\n AdwNavigationPage,\n AdwNavigationSplitView,\n AdwNavigationView,\n AdwToolbarView,\n} from \"@gtkx/jsx/adw\"\n\nexport {\n GtkApplication,\n GtkApplicationWindow,\n GtkBox,\n GtkButton,\n GtkEntry,\n GtkGestureClick,\n GtkLabel,\n GtkListBox,\n GtkListBoxRow,\n GtkPicture,\n GtkScrolledWindow,\n GtkSpinner,\n GtkSwitch,\n GtkTextView,\n GtkWindow,\n} from \"@gtkx/jsx/gtk\"\n\nexport {\n createPortal,\n createRoot,\n quit,\n useApplication,\n useParentWindow,\n useProperty,\n type Root,\n} from \"@gtkx/react\"\n\n// useSignal comes from ./use-signal, not @gtkx/react — see the workaround note\n// there (rc.2 delivers a stale handler).\nexport { useSignal } from \"./use-signal\"\n\nexport { css, cx, injectGlobal } from \"@gtkx/css\"\n\nexport { createTextProbe, measureWidget, toNumber } from \"./measure\"\nexport { getViewBoxComponent, setBoxPassthrough } from \"./view-box\"\nexport {\n allocateChild,\n attachRnLayout,\n detachRnLayout,\n queueAllocate,\n queueResize,\n type RnLayoutHooks,\n type RnLayoutOrientation,\n} from \"./layout-manager\"\nexport { colorScheme, styleManager } from \"./theme\"\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Adw from "@gtkx/gi/adw";
|
|
2
2
|
export const styleManager = () => Adw.StyleManager.getDefault();
|
|
3
|
-
// Appearance API
|
|
3
|
+
// The Appearance API subscribes to notify::dark on the style manager.
|
|
4
4
|
export const colorScheme = () => styleManager().getDark() ? "dark" : "light";
|
|
5
5
|
//# sourceMappingURL=theme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAInC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAqB,EAAE,CACjD,GAAG,CAAC,YAAY,CAAC,UAAU,EAAE,CAAA;AAE/B,
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAInC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAqB,EAAE,CACjD,GAAG,CAAC,YAAY,CAAC,UAAU,EAAE,CAAA;AAE/B,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAgB,EAAE,CAC3C,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA","sourcesContent":["import * as Adw from \"@gtkx/gi/adw\"\n\nexport type ColorScheme = \"light\" | \"dark\"\n\nexport const styleManager = (): Adw.StyleManager =>\n Adw.StyleManager.getDefault()\n\n// The Appearance API subscribes to notify::dark on the style manager.\nexport const colorScheme = (): ColorScheme =>\n styleManager().getDark() ? \"dark\" : \"light\"\n"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
// RC2-WORKAROUND(use-signal-stale-handler):
|
|
2
|
-
// that "each emission runs the handler from
|
|
3
|
-
// delivered that by pinning the handler in a ref
|
|
4
|
-
// React's useEffectEvent instead, and under
|
|
5
|
-
// stops refreshing for components deep in
|
|
6
|
-
// its 8th render still ran the closure
|
|
7
|
-
//
|
|
8
|
-
// consequence is not subtle — the
|
|
9
|
-
// VirtualizedList against the data it saw
|
|
10
|
-
// arrive from a fetch renders EMPTY as soon as
|
|
1
|
+
// RC2-WORKAROUND(use-signal-stale-handler): see docs/gtkx-rc2-notes.md
|
|
2
|
+
// @gtkx/react's useSignal documents that "each emission runs the handler from
|
|
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.
|
|
11
12
|
//
|
|
12
13
|
// Restore the documented contract at the bridge: keep the latest handler in a
|
|
13
14
|
// ref of our own and hand gtkx a stable wrapper (stable so the connection is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-signal.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/use-signal.ts"],"names":[],"mappings":"AAAA,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,+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"]}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Public surface of react-native-gtkx, mirroring the `react-native` module.
|
|
2
|
-
// Components
|
|
2
|
+
// Components · APIs · StyleSheet, with the Yoga layout engine underneath.
|
|
3
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";
|
|
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";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,
|
|
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,GA0BL,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;AAYzD,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 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 ImageProps,\n type ImageSource,\n type LayoutEvent,\n type ListRenderItemInfo,\n type ModalProps,\n type PressableProps,\n type PressableStateCallbackType,\n type IntrinsicRootProps,\n type NestedRootProps,\n type PressEvent,\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 TouchableOpacityProps,\n type ViewabilityConfig,\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 DimensionValue,\n FlatStyle,\n LayoutStyle,\n PointerEventsValue,\n StyleProp,\n TransformPart,\n VisualStyle,\n} from \"./contracts\"\n\nexport const version = \"0.1.0\"\n"]}
|
package/dist/runner/index.js
CHANGED
|
@@ -30,10 +30,11 @@ const binOf = (requireFrom, packageName, binName) => {
|
|
|
30
30
|
}
|
|
31
31
|
return join(dirname(packageJsonPath), bin);
|
|
32
32
|
};
|
|
33
|
+
// RC2-WORKAROUND(codegen-cwd): see docs/gtkx-rc2-notes.md
|
|
33
34
|
// The codegen store lives in the node_modules that hosts the @gtkx
|
|
34
35
|
// packages — run the gtkx CLI from the project that OWNS that node_modules:
|
|
35
|
-
// with cwd inside node_modules itself the CLI reports "up to date"
|
|
36
|
-
// ever creating the store.
|
|
36
|
+
// with cwd inside node_modules itself the CLI reports "bindings up to date"
|
|
37
|
+
// without ever creating the store.
|
|
37
38
|
const ensureCodegenStore = () => {
|
|
38
39
|
const hostingNodeModules = dirname(dirname(dirname(fromPackage.resolve("@gtkx/react/package.json"))));
|
|
39
40
|
const gtkxRoot = dirname(hostingNodeModules);
|
package/dist/runner/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runner/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,2EAA2E;AAC3E,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,uEAAuE;AACvE,4CAA4C;AAC5C,EAAE;AACF,kEAAkE;AAClE,qCAAqC;AACrC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAqB,MAAM,oBAAoB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,CAAA;IAC7C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IAChE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC,CAAA;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,kFAAkF;QACpF,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EAAE,4BAA4B;gBACzC,OAAO,EAAE,UAAU;aACpB;YACD;gBACE,IAAI,EAAE,wBAAwB;gBAC9B,WAAW,EACT,sFAAsF;aACzF;YACD;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,8CAA8C;aAC5D;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,oFAAoF;aACvF;YACD;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,iDAAiD;aAC/D;SACF;QACD,IAAI,EAAE,QAAQ;KACf;CACF,CAAA","sourcesContent":["// The `run-linux` CLI command (registered through the package's\n// react-native.config.js, the react-native-windows model): ensure the gtkx\n// codegen store, then either build a release jsbundle with Metro and run\n// it in the Node+GTK host (./host.ts), or — with --dev — start/reuse a\n// Metro dev server and supervise the DEV host (./host-dev.ts): Fast\n// Refresh applies edits to the live window, and a full-refresh request\n// (exit code 65) restarts the host process.\n//\n// Like the hosts, this module must stay runnable under bare Node:\n// builtins and bare specifiers only.\nimport { spawn, spawnSync, type ChildProcess } from \"node:child_process\"\nimport { mkdirSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { basename, dirname, extname, join } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nconst fromPackage = createRequire(import.meta.url)\n\ntype CliConfig = { root: string }\ntype RunLinuxArgs = {\n entryFile: string\n bundleOutput?: string\n skipBundling?: boolean\n dev?: boolean\n port?: string\n}\n\n/** Exit code host-dev.ts uses to request a supervisor restart. */\nconst FULL_REFRESH_EXIT_CODE = 65\n\nconst run = (command: string, args: string[], cwd: string): number => {\n const result = spawnSync(command, args, { cwd, stdio: \"inherit\" })\n return result.status ?? 1\n}\n\n/** Resolve an executable script shipped by a dependency's bin field. */\nconst binOf = (\n requireFrom: NodeJS.Require,\n packageName: string,\n binName: string,\n): string => {\n const packageJsonPath = requireFrom.resolve(`${packageName}/package.json`)\n const manifest = requireFrom(`${packageName}/package.json`) as {\n bin?: string | Record<string, string>\n }\n const bin =\n typeof manifest.bin === \"string\" ? manifest.bin : manifest.bin?.[binName]\n if (!bin) {\n throw new Error(`${packageName} does not expose a \"${binName}\" binary`)\n }\n return join(dirname(packageJsonPath), bin)\n}\n\n// The codegen store lives in the node_modules that hosts the @gtkx\n// packages — run the gtkx CLI from the project that OWNS that node_modules:\n// with cwd inside node_modules itself the CLI reports \"up to date\" without\n// ever creating the store.\nconst ensureCodegenStore = (): void => {\n const hostingNodeModules = dirname(\n dirname(dirname(fromPackage.resolve(\"@gtkx/react/package.json\"))),\n )\n const gtkxRoot = dirname(hostingNodeModules)\n console.warn(\"[react-native-gtkx] ensuring gtkx codegen store…\")\n const status = run(\n process.execPath,\n [binOf(fromPackage, \"@gtkx/cli\", \"gtkx\"), \"codegen\"],\n gtkxRoot,\n )\n if (status !== 0) {\n console.error(\n \"[react-native-gtkx] gtkx codegen failed — are GTK4/libadwaita \" +\n \"development files installed?\",\n )\n process.exit(status)\n }\n}\n\nconst bundle = (root: string, entryFile: string, output: string): void => {\n const appRequire = createRequire(join(root, \"package.json\"))\n const status = run(\n process.execPath,\n [\n binOf(appRequire, \"react-native\", \"react-native\"),\n \"bundle\",\n \"--platform\",\n \"linux\",\n \"--dev\",\n \"false\",\n \"--entry-file\",\n entryFile,\n \"--bundle-output\",\n output,\n ],\n root,\n )\n if (status !== 0) {\n process.exit(status)\n }\n}\n\nconst isMetroRunning = async (server: string): Promise<boolean> => {\n try {\n const response = await fetch(`${server}/status`)\n return (await response.text()).includes(\"packager-status:running\")\n } catch {\n return false\n }\n}\n\nconst waitForMetro = async (server: string): Promise<void> => {\n for (let attempt = 0; attempt < 120; attempt += 1) {\n if (await isMetroRunning(server)) {\n return\n }\n await new Promise((resolve) => setTimeout(resolve, 500))\n }\n console.error(\n `[react-native-gtkx] Metro dev server never came up (${server}).`,\n )\n process.exit(1)\n}\n\nlet activeHost: ChildProcess | null = null\n\nconst spawnHost = (\n script: string,\n argument: string,\n cwd: string,\n): Promise<number> =>\n new Promise((resolve) => {\n // join over `new URL(script, import.meta.url)`: the global URL and the\n // node:url URL come from different type copies when the dependency tree\n // splits @types/node, and the two structurally diverge.\n const hostPath = join(dirname(fileURLToPath(import.meta.url)), script)\n const child = spawn(process.execPath, [hostPath, argument], {\n cwd,\n stdio: \"inherit\",\n })\n activeHost = child\n child.on(\"exit\", (code) => {\n activeHost = null\n resolve(code ?? 1)\n })\n })\n\nconst runLinuxDev = async (\n config: CliConfig,\n args: RunLinuxArgs,\n): Promise<never> => {\n const port = args.port ?? \"8081\"\n const server = `http://localhost:${port}`\n let metro: ChildProcess | null = null\n if (await isMetroRunning(server)) {\n console.warn(\n `[react-native-gtkx] reusing the Metro dev server at ${server}`,\n )\n } else {\n console.warn(\n `[react-native-gtkx] starting the Metro dev server at ${server}…`,\n )\n const appRequire = createRequire(join(config.root, \"package.json\"))\n metro = spawn(\n process.execPath,\n [\n binOf(appRequire, \"react-native\", \"react-native\"),\n \"start\",\n \"--port\",\n port,\n ],\n { cwd: config.root, stdio: \"inherit\" },\n )\n await waitForMetro(server)\n }\n const entry = basename(args.entryFile, extname(args.entryFile))\n const bundleUrl = `${server}/${entry}.bundle?platform=linux&dev=true&minify=false`\n const shutdown = (code: number): never => {\n activeHost?.kill()\n metro?.kill()\n process.exit(code)\n }\n process.on(\"SIGINT\", () => shutdown(0))\n process.on(\"SIGTERM\", () => shutdown(0))\n // Supervisor: a full-refresh request restarts the host with the window\n // reopening on the fresh bundle; any other exit ends the session.\n for (;;) {\n const code = await spawnHost(\"./host-dev.js\", bundleUrl, config.root)\n if (code !== FULL_REFRESH_EXIT_CODE) {\n shutdown(code)\n }\n console.warn(\"[react-native-gtkx] restarting the app after a full refresh…\")\n }\n}\n\nconst runLinux = async (\n _argv: string[],\n config: CliConfig,\n args: RunLinuxArgs,\n): Promise<void> => {\n ensureCodegenStore()\n if (args.dev) {\n await runLinuxDev(config, args)\n return\n }\n const output =\n args.bundleOutput ??\n join(config.root, \"node_modules\", \".react-native-gtkx\", \"main.jsbundle\")\n if (!args.skipBundling) {\n mkdirSync(dirname(output), { recursive: true })\n bundle(config.root, args.entryFile, output)\n }\n const status = await spawnHost(\"./host.js\", output, config.root)\n process.exit(status)\n}\n\n/** Commands contributed to the RN CLI by the package's react-native.config.js. */\nexport const commands = [\n {\n name: \"run-linux\",\n description:\n \"Bundle the app with Metro for the linux platform and run it in the Node+GTK host\",\n options: [\n {\n name: \"--entry-file <path>\",\n description: \"Path to the app entry file\",\n default: \"index.js\",\n },\n {\n name: \"--bundle-output <path>\",\n description:\n \"Where to write the jsbundle (default: node_modules/.react-native-gtkx/main.jsbundle)\",\n },\n {\n name: \"--skip-bundling\",\n description: \"Reuse the existing bundle at --bundle-output\",\n },\n {\n name: \"--dev\",\n description:\n \"Development mode: Metro dev server + Fast Refresh (edits apply to the live window)\",\n },\n {\n name: \"--port <number>\",\n description: \"Metro dev server port for --dev (default: 8081)\",\n },\n ],\n func: runLinux,\n },\n]\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runner/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,2EAA2E;AAC3E,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,uEAAuE;AACvE,4CAA4C;AAC5C,EAAE;AACF,kEAAkE;AAClE,qCAAqC;AACrC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAqB,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAA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AC7C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IAChE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC,CAAA;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,kFAAkF;QACpF,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EAAE,4BAA4B;gBACzC,OAAO,EAAE,UAAU;aACpB;YACD;gBACE,IAAI,EAAE,wBAAwB;gBAC9B,WAAW,EACT,sFAAsF;aACzF;YACD;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,8CAA8C;aAC5D;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,oFAAoF;aACvF;YACD;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,iDAAiD;aAC/D;SACF;QACD,IAAI,EAAE,QAAQ;KACf;CACF,CAAA","sourcesContent":["// The `run-linux` CLI command (registered through the package's\n// react-native.config.js, the react-native-windows model): ensure the gtkx\n// codegen store, then either build a release jsbundle with Metro and run\n// it in the Node+GTK host (./host.ts), or — with --dev — start/reuse a\n// Metro dev server and supervise the DEV host (./host-dev.ts): Fast\n// Refresh applies edits to the live window, and a full-refresh request\n// (exit code 65) restarts the host process.\n//\n// Like the hosts, this module must stay runnable under bare Node:\n// builtins and bare specifiers only.\nimport { spawn, spawnSync, type ChildProcess } from \"node:child_process\"\nimport { mkdirSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { basename, dirname, extname, join } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nconst fromPackage = createRequire(import.meta.url)\n\ntype CliConfig = { root: string }\ntype RunLinuxArgs = {\n entryFile: string\n bundleOutput?: string\n skipBundling?: boolean\n dev?: boolean\n port?: string\n}\n\n/** Exit code host-dev.ts uses to request a supervisor restart. */\nconst FULL_REFRESH_EXIT_CODE = 65\n\nconst run = (command: string, args: string[], cwd: string): number => {\n const result = spawnSync(command, args, { cwd, stdio: \"inherit\" })\n return result.status ?? 1\n}\n\n/** Resolve an executable script shipped by a dependency's bin field. */\nconst binOf = (\n requireFrom: NodeJS.Require,\n packageName: string,\n binName: string,\n): string => {\n const packageJsonPath = requireFrom.resolve(`${packageName}/package.json`)\n const manifest = requireFrom(`${packageName}/package.json`) as {\n bin?: string | Record<string, string>\n }\n const bin =\n typeof manifest.bin === \"string\" ? manifest.bin : manifest.bin?.[binName]\n if (!bin) {\n throw new Error(`${packageName} does not expose a \"${binName}\" binary`)\n }\n return join(dirname(packageJsonPath), bin)\n}\n\n// RC2-WORKAROUND(codegen-cwd): see docs/gtkx-rc2-notes.md\n// The codegen store lives in the node_modules that hosts the @gtkx\n// packages — run the gtkx CLI from the project that OWNS that node_modules:\n// with cwd inside node_modules itself the CLI reports \"bindings up to date\"\n// without ever creating the store.\nconst ensureCodegenStore = (): void => {\n const hostingNodeModules = dirname(\n dirname(dirname(fromPackage.resolve(\"@gtkx/react/package.json\"))),\n )\n const gtkxRoot = dirname(hostingNodeModules)\n console.warn(\"[react-native-gtkx] ensuring gtkx codegen store…\")\n const status = run(\n process.execPath,\n [binOf(fromPackage, \"@gtkx/cli\", \"gtkx\"), \"codegen\"],\n gtkxRoot,\n )\n if (status !== 0) {\n console.error(\n \"[react-native-gtkx] gtkx codegen failed — are GTK4/libadwaita \" +\n \"development files installed?\",\n )\n process.exit(status)\n }\n}\n\nconst bundle = (root: string, entryFile: string, output: string): void => {\n const appRequire = createRequire(join(root, \"package.json\"))\n const status = run(\n process.execPath,\n [\n binOf(appRequire, \"react-native\", \"react-native\"),\n \"bundle\",\n \"--platform\",\n \"linux\",\n \"--dev\",\n \"false\",\n \"--entry-file\",\n entryFile,\n \"--bundle-output\",\n output,\n ],\n root,\n )\n if (status !== 0) {\n process.exit(status)\n }\n}\n\nconst isMetroRunning = async (server: string): Promise<boolean> => {\n try {\n const response = await fetch(`${server}/status`)\n return (await response.text()).includes(\"packager-status:running\")\n } catch {\n return false\n }\n}\n\nconst waitForMetro = async (server: string): Promise<void> => {\n for (let attempt = 0; attempt < 120; attempt += 1) {\n if (await isMetroRunning(server)) {\n return\n }\n await new Promise((resolve) => setTimeout(resolve, 500))\n }\n console.error(\n `[react-native-gtkx] Metro dev server never came up (${server}).`,\n )\n process.exit(1)\n}\n\nlet activeHost: ChildProcess | null = null\n\nconst spawnHost = (\n script: string,\n argument: string,\n cwd: string,\n): Promise<number> =>\n new Promise((resolve) => {\n // join over `new URL(script, import.meta.url)`: the global URL and the\n // node:url URL come from different type copies when the dependency tree\n // splits @types/node, and the two structurally diverge.\n const hostPath = join(dirname(fileURLToPath(import.meta.url)), script)\n const child = spawn(process.execPath, [hostPath, argument], {\n cwd,\n stdio: \"inherit\",\n })\n activeHost = child\n child.on(\"exit\", (code) => {\n activeHost = null\n resolve(code ?? 1)\n })\n })\n\nconst runLinuxDev = async (\n config: CliConfig,\n args: RunLinuxArgs,\n): Promise<never> => {\n const port = args.port ?? \"8081\"\n const server = `http://localhost:${port}`\n let metro: ChildProcess | null = null\n if (await isMetroRunning(server)) {\n console.warn(\n `[react-native-gtkx] reusing the Metro dev server at ${server}`,\n )\n } else {\n console.warn(\n `[react-native-gtkx] starting the Metro dev server at ${server}…`,\n )\n const appRequire = createRequire(join(config.root, \"package.json\"))\n metro = spawn(\n process.execPath,\n [\n binOf(appRequire, \"react-native\", \"react-native\"),\n \"start\",\n \"--port\",\n port,\n ],\n { cwd: config.root, stdio: \"inherit\" },\n )\n await waitForMetro(server)\n }\n const entry = basename(args.entryFile, extname(args.entryFile))\n const bundleUrl = `${server}/${entry}.bundle?platform=linux&dev=true&minify=false`\n const shutdown = (code: number): never => {\n activeHost?.kill()\n metro?.kill()\n process.exit(code)\n }\n process.on(\"SIGINT\", () => shutdown(0))\n process.on(\"SIGTERM\", () => shutdown(0))\n // Supervisor: a full-refresh request restarts the host with the window\n // reopening on the fresh bundle; any other exit ends the session.\n for (;;) {\n const code = await spawnHost(\"./host-dev.js\", bundleUrl, config.root)\n if (code !== FULL_REFRESH_EXIT_CODE) {\n shutdown(code)\n }\n console.warn(\"[react-native-gtkx] restarting the app after a full refresh…\")\n }\n}\n\nconst runLinux = async (\n _argv: string[],\n config: CliConfig,\n args: RunLinuxArgs,\n): Promise<void> => {\n ensureCodegenStore()\n if (args.dev) {\n await runLinuxDev(config, args)\n return\n }\n const output =\n args.bundleOutput ??\n join(config.root, \"node_modules\", \".react-native-gtkx\", \"main.jsbundle\")\n if (!args.skipBundling) {\n mkdirSync(dirname(output), { recursive: true })\n bundle(config.root, args.entryFile, output)\n }\n const status = await spawnHost(\"./host.js\", output, config.root)\n process.exit(status)\n}\n\n/** Commands contributed to the RN CLI by the package's react-native.config.js. */\nexport const commands = [\n {\n name: \"run-linux\",\n description:\n \"Bundle the app with Metro for the linux platform and run it in the Node+GTK host\",\n options: [\n {\n name: \"--entry-file <path>\",\n description: \"Path to the app entry file\",\n default: \"index.js\",\n },\n {\n name: \"--bundle-output <path>\",\n description:\n \"Where to write the jsbundle (default: node_modules/.react-native-gtkx/main.jsbundle)\",\n },\n {\n name: \"--skip-bundling\",\n description: \"Reuse the existing bundle at --bundle-output\",\n },\n {\n name: \"--dev\",\n description:\n \"Development mode: Metro dev server + Fast Refresh (edits apply to the live window)\",\n },\n {\n name: \"--port <number>\",\n description: \"Metro dev server port for --dev (default: 8081)\",\n },\n ],\n func: runLinux,\n },\n]\n"]}
|
package/dist/style/colors.js
CHANGED
|
@@ -245,7 +245,9 @@ const hslToRgb = (h, s, l) => {
|
|
|
245
245
|
const chroma = (1 - Math.abs(2 * l - 1)) * s;
|
|
246
246
|
const hh = h / 60;
|
|
247
247
|
const x = chroma * (1 - Math.abs((hh % 2) - 1));
|
|
248
|
-
|
|
248
|
+
// Every branch assigns, so the sextant picks the triple outright — the
|
|
249
|
+
// placeholder initialiser it used to start from was dead.
|
|
250
|
+
let rgb;
|
|
249
251
|
if (hh < 1) {
|
|
250
252
|
rgb = [chroma, x, 0];
|
|
251
253
|
}
|
package/dist/style/colors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/style/colors.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,mEAAmE;AACnE,2EAA2E;AAC3E,mEAAmE;AAEnE,yEAAyE;AACzE,MAAM,YAAY,GAA2B;IAC3C,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,SAAS;IACvB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,SAAS;IAChB,cAAc,EAAE,SAAS;IACzB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,aAAa,EAAE,SAAS;IACxB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,cAAc,EAAE,SAAS;IACzB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,SAAS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CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAA;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,KAAe,EAAU,EAAE;IAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IAC9E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;IACnE,CAAC;IACD,IAAI,UAAU,GAAkB,IAAI,CAAA;IACpC,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,4DAA4D;YAC5D,UAAU,GAAG,IAAI,CAAA;YACjB,SAAQ;QACV,CAAC;QACD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACxC,UAAU;YACR,UAAU,KAAK,IAAI;gBACjB,CAAC,CAAC,OAAO,QAAQ,GAAG;gBACpB,CAAC,CAAC,OAAO,QAAQ,KAAK,UAAU,GAAG,CAAA;IACzC,CAAC;IACD,OAAO,UAAU,IAAI,EAAE,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// Pure color handling: parses React Native color strings and normalizes them\n// into GTK4 CSS color values. No bridge imports — unit-testable on any OS.\n//\n// Every parseable color is normalized to `rgb(r, g, b)` / `rgba(r, g, b, a)`\n// so the output does not depend on which color syntaxes the GTK CSS parser of\n// a particular version accepts. Two values pass through untouched:\n// - `var(--name[, fallback])` — CSS variables (GTK 4.16+, Adwaita palette)\n// - `@name` — legacy GTK named colors (`@define-color` references)\n\n// CSS Color Module Level 4 named colors (the set React Native supports).\nconst NAMED_COLORS: Record<string, string> = {\n aliceblue: \"#f0f8ff\",\n antiquewhite: \"#faebd7\",\n aqua: \"#00ffff\",\n aquamarine: \"#7fffd4\",\n azure: \"#f0ffff\",\n beige: \"#f5f5dc\",\n bisque: \"#ffe4c4\",\n black: \"#000000\",\n blanchedalmond: \"#ffebcd\",\n blue: \"#0000ff\",\n blueviolet: \"#8a2be2\",\n brown: \"#a52a2a\",\n burlywood: \"#deb887\",\n cadetblue: \"#5f9ea0\",\n chartreuse: \"#7fff00\",\n chocolate: \"#d2691e\",\n coral: \"#ff7f50\",\n cornflowerblue: \"#6495ed\",\n cornsilk: \"#fff8dc\",\n crimson: \"#dc143c\",\n cyan: \"#00ffff\",\n darkblue: \"#00008b\",\n darkcyan: \"#008b8b\",\n darkgoldenrod: \"#b8860b\",\n darkgray: \"#a9a9a9\",\n darkgreen: \"#006400\",\n darkgrey: \"#a9a9a9\",\n darkkhaki: \"#bdb76b\",\n darkmagenta: \"#8b008b\",\n darkolivegreen: \"#556b2f\",\n darkorange: \"#ff8c00\",\n darkorchid: \"#9932cc\",\n darkred: \"#8b0000\",\n darksalmon: \"#e9967a\",\n darkseagreen: \"#8fbc8f\",\n darkslateblue: \"#483d8b\",\n darkslategray: \"#2f4f4f\",\n darkslategrey: \"#2f4f4f\",\n darkturquoise: \"#00ced1\",\n darkviolet: \"#9400d3\",\n deeppink: \"#ff1493\",\n deepskyblue: \"#00bfff\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n dodgerblue: \"#1e90ff\",\n firebrick: \"#b22222\",\n floralwhite: \"#fffaf0\",\n forestgreen: \"#228b22\",\n fuchsia: \"#ff00ff\",\n gainsboro: \"#dcdcdc\",\n ghostwhite: \"#f8f8ff\",\n gold: \"#ffd700\",\n goldenrod: \"#daa520\",\n gray: \"#808080\",\n green: \"#008000\",\n greenyellow: \"#adff2f\",\n grey: \"#808080\",\n honeydew: \"#f0fff0\",\n hotpink: \"#ff69b4\",\n indianred: \"#cd5c5c\",\n indigo: \"#4b0082\",\n ivory: \"#fffff0\",\n khaki: \"#f0e68c\",\n lavender: \"#e6e6fa\",\n lavenderblush: \"#fff0f5\",\n lawngreen: \"#7cfc00\",\n lemonchiffon: \"#fffacd\",\n lightblue: \"#add8e6\",\n lightcoral: \"#f08080\",\n lightcyan: \"#e0ffff\",\n lightgoldenrodyellow: \"#fafad2\",\n lightgray: \"#d3d3d3\",\n lightgreen: \"#90ee90\",\n lightgrey: \"#d3d3d3\",\n lightpink: \"#ffb6c1\",\n lightsalmon: \"#ffa07a\",\n lightseagreen: \"#20b2aa\",\n lightskyblue: \"#87cefa\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n lightsteelblue: \"#b0c4de\",\n lightyellow: \"#ffffe0\",\n lime: \"#00ff00\",\n limegreen: \"#32cd32\",\n linen: \"#faf0e6\",\n magenta: \"#ff00ff\",\n maroon: \"#800000\",\n mediumaquamarine: \"#66cdaa\",\n mediumblue: \"#0000cd\",\n mediumorchid: \"#ba55d3\",\n mediumpurple: \"#9370db\",\n mediumseagreen: \"#3cb371\",\n mediumslateblue: \"#7b68ee\",\n mediumspringgreen: \"#00fa9a\",\n mediumturquoise: \"#48d1cc\",\n mediumvioletred: \"#c71585\",\n midnightblue: \"#191970\",\n mintcream: \"#f5fffa\",\n mistyrose: \"#ffe4e1\",\n moccasin: \"#ffe4b5\",\n navajowhite: \"#ffdead\",\n navy: \"#000080\",\n oldlace: \"#fdf5e6\",\n olive: \"#808000\",\n olivedrab: \"#6b8e23\",\n orange: \"#ffa500\",\n orangered: \"#ff4500\",\n orchid: \"#da70d6\",\n palegoldenrod: \"#eee8aa\",\n palegreen: \"#98fb98\",\n paleturquoise: \"#afeeee\",\n palevioletred: \"#db7093\",\n papayawhip: \"#ffefd5\",\n peachpuff: \"#ffdab9\",\n peru: \"#cd853f\",\n pink: \"#ffc0cb\",\n plum: \"#dda0dd\",\n powderblue: \"#b0e0e6\",\n purple: \"#800080\",\n rebeccapurple: \"#663399\",\n red: \"#ff0000\",\n rosybrown: \"#bc8f8f\",\n royalblue: \"#4169e1\",\n saddlebrown: \"#8b4513\",\n salmon: \"#fa8072\",\n sandybrown: \"#f4a460\",\n seagreen: \"#2e8b57\",\n seashell: \"#fff5ee\",\n sienna: \"#a0522d\",\n silver: \"#c0c0c0\",\n skyblue: \"#87ceeb\",\n slateblue: \"#6a5acd\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n snow: \"#fffafa\",\n springgreen: \"#00ff7f\",\n steelblue: \"#4682b4\",\n tan: \"#d2b48c\",\n teal: \"#008080\",\n thistle: \"#d8bfd8\",\n tomato: \"#ff6347\",\n turquoise: \"#40e0d0\",\n violet: \"#ee82ee\",\n wheat: \"#f5deb3\",\n white: \"#ffffff\",\n whitesmoke: \"#f5f5f5\",\n yellow: \"#ffff00\",\n yellowgreen: \"#9acd32\",\n}\n\ntype Rgba = { r: number; g: number; b: number; a: number }\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(max, Math.max(min, value))\n\nconst formatRgba = ({ r, g, b, a }: Rgba): string => {\n const alpha = Math.round(clamp(a, 0, 1) * 1000) / 1000\n return alpha >= 1\n ? `rgb(${r}, ${g}, ${b})`\n : `rgba(${r}, ${g}, ${b}, ${alpha})`\n}\n\nconst HEX_PATTERN = /^#([0-9a-f]+)$/i\n\nconst hexPair = (digits: string, index: number): number =>\n Number.parseInt(digits.slice(index, index + 2), 16)\n\nconst hexSingle = (digits: string, index: number): number =>\n Number.parseInt(digits.charAt(index).repeat(2), 16)\n\nconst parseHex = (input: string): Rgba | null => {\n const match = HEX_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const digits = match[1] ?? \"\"\n switch (digits.length) {\n case 3:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: 1,\n }\n case 4:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: hexSingle(digits, 3) / 255,\n }\n case 6:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: 1,\n }\n case 8:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: hexPair(digits, 6) / 255,\n }\n default:\n return null\n }\n}\n\nconst NUMBER_PATTERN = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/\n\nconst parseNumber = (token: string): number | null =>\n NUMBER_PATTERN.test(token) ? Number.parseFloat(token) : null\n\n// 0-255 integer or percentage → 0-255 integer.\nconst parseRgbChannel = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n // (percent * 255) / 100 avoids float drift: 50 * 2.55 === 127.4999...\n return percent === null\n ? null\n : Math.round((clamp(percent, 0, 100) * 255) / 100)\n }\n const value = parseNumber(token)\n return value === null ? null : Math.round(clamp(value, 0, 255))\n}\n\n// 0-1 float or percentage → 0-1 float.\nconst parseAlpha = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n }\n const value = parseNumber(token)\n return value === null ? null : clamp(value, 0, 1)\n}\n\nconst parsePercentage = (token: string): number | null => {\n if (!token.endsWith(\"%\")) {\n return null\n }\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n}\n\nconst parseHue = (token: string): number | null => {\n const raw = token.toLowerCase().endsWith(\"deg\") ? token.slice(0, -3) : token\n const degrees = parseNumber(raw)\n return degrees === null ? null : ((degrees % 360) + 360) % 360\n}\n\nconst hslToRgb = (\n h: number,\n s: number,\n l: number,\n): [number, number, number] => {\n const chroma = (1 - Math.abs(2 * l - 1)) * s\n const hh = h / 60\n const x = chroma * (1 - Math.abs((hh % 2) - 1))\n let rgb: [number, number, number] = [0, 0, 0]\n if (hh < 1) {\n rgb = [chroma, x, 0]\n } else if (hh < 2) {\n rgb = [x, chroma, 0]\n } else if (hh < 3) {\n rgb = [0, chroma, x]\n } else if (hh < 4) {\n rgb = [0, x, chroma]\n } else if (hh < 5) {\n rgb = [x, 0, chroma]\n } else {\n rgb = [chroma, 0, x]\n }\n const m = l - chroma / 2\n return [\n Math.round((rgb[0] + m) * 255),\n Math.round((rgb[1] + m) * 255),\n Math.round((rgb[2] + m) * 255),\n ]\n}\n\nconst FUNCTION_PATTERN = /^(rgba?|hsla?)\\(([^()]*)\\)$/i\n\n// Accepts legacy comma syntax and modern space syntax with optional \"/ alpha\".\nconst splitFunctionBody = (body: string): string[] =>\n body\n .replace(/\\//g, \" \")\n .split(/[,\\s]+/)\n .filter((token) => token.length > 0)\n\nconst parseColorFunction = (input: string): Rgba | null => {\n const match = FUNCTION_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const name = (match[1] ?? \"\").toLowerCase()\n const tokens = splitFunctionBody(match[2] ?? \"\")\n if (tokens.length < 3 || tokens.length > 4) {\n return null\n }\n const alpha = tokens.length === 4 ? parseAlpha(tokens[3] ?? \"\") : 1\n if (alpha === null) {\n return null\n }\n if (name === \"rgb\" || name === \"rgba\") {\n const r = parseRgbChannel(tokens[0] ?? \"\")\n const g = parseRgbChannel(tokens[1] ?? \"\")\n const b = parseRgbChannel(tokens[2] ?? \"\")\n if (r === null || g === null || b === null) {\n return null\n }\n return { r, g, b, a: alpha }\n }\n const h = parseHue(tokens[0] ?? \"\")\n const s = parsePercentage(tokens[1] ?? \"\")\n const l = parsePercentage(tokens[2] ?? \"\")\n if (h === null || s === null || l === null) {\n return null\n }\n const [r, g, b] = hslToRgb(h, s, l)\n return { r, g, b, a: alpha }\n}\n\nconst CSS_VARIABLE_PATTERN = /^var\\(--[\\w-]+.*\\)$/i\nconst GTK_NAMED_COLOR_PATTERN = /^@[A-Za-z_][\\w-]*$/\n\n/**\n * Parses a React Native color string into a GTK4 CSS color value.\n * Returns null for values that cannot be understood.\n */\nexport const parseColor = (value: string): string | null => {\n if (typeof value !== \"string\") {\n return null\n }\n const input = value.trim()\n if (input === \"\") {\n return null\n }\n // Adwaita/custom CSS variable references pass through untouched. The\n // pattern is permissive on purpose: nested var() fallbacks stay valid.\n if (input.toLowerCase().startsWith(\"var(\")) {\n return CSS_VARIABLE_PATTERN.test(input) ? input : null\n }\n if (GTK_NAMED_COLOR_PATTERN.test(input)) {\n return input\n }\n const lower = input.toLowerCase()\n if (lower === \"transparent\") {\n return \"rgba(0, 0, 0, 0)\"\n }\n const named = NAMED_COLORS[lower]\n const rgba = parseHex(named ?? input) ?? parseColorFunction(input)\n return rgba === null ? null : formatRgba(rgba)\n}\n\nconst toCssVariableName = (name: string): string =>\n name.startsWith(\"--\") ? name : `--${name}`\n\n/**\n * React Native's PlatformColor for GTK: references theme colors by name.\n * Names map onto CSS variables (Adwaita exposes its palette as\n * `--accent-bg-color`, `--window-bg-color`, ... since libadwaita 1.6);\n * extra names become var() fallbacks, tried in order. A name starting with\n * \"@\" is a legacy GTK named color (`@define-color`) and terminates the\n * fallback chain, because var() fallbacks cannot resolve further after it.\n *\n * PlatformColor(\"accent-bg-color\") → \"var(--accent-bg-color)\"\n * PlatformColor(\"accent-bg-color\", \"@blue_3\") → \"var(--accent-bg-color, @blue_3)\"\n */\nexport const PlatformColor = (...names: string[]): string => {\n const cleaned = names.map((name) => name.trim()).filter((name) => name !== \"\")\n if (cleaned.length === 0) {\n throw new Error(\"PlatformColor requires at least one color name\")\n }\n let expression: string | null = null\n for (let i = cleaned.length - 1; i >= 0; i -= 1) {\n const name = cleaned[i] ?? \"\"\n if (name.startsWith(\"@\")) {\n // Terminal value: names after it are unreachable fallbacks.\n expression = name\n continue\n }\n const variable = toCssVariableName(name)\n expression =\n expression === null\n ? `var(${variable})`\n : `var(${variable}, ${expression})`\n }\n return expression ?? \"\"\n}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O,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IAC9E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;IACnE,CAAC;IACD,IAAI,UAAU,GAAkB,IAAI,CAAA;IACpC,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,4DAA4D;YAC5D,UAAU,GAAG,IAAI,CAAA;YACjB,SAAQ;QACV,CAAC;QACD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACxC,UAAU;YACR,UAAU,KAAK,IAAI;gBACjB,CAAC,CAAC,OAAO,QAAQ,GAAG;gBACpB,CAAC,CAAC,OAAO,QAAQ,KAAK,UAAU,GAAG,CAAA;IACzC,CAAC;IACD,OAAO,UAAU,IAAI,EAAE,CAAA;AACzB,CAAC,CAAA","sourcesContent":["// Pure color handling: parses React Native color strings and normalizes them\n// into GTK4 CSS color values. No bridge imports — unit-testable on any OS.\n//\n// Every parseable color is normalized to `rgb(r, g, b)` / `rgba(r, g, b, a)`\n// so the output does not depend on which color syntaxes the GTK CSS parser of\n// a particular version accepts. Two values pass through untouched:\n// - `var(--name[, fallback])` — CSS variables (GTK 4.16+, Adwaita palette)\n// - `@name` — legacy GTK named colors (`@define-color` references)\n\n// CSS Color Module Level 4 named colors (the set React Native supports).\nconst NAMED_COLORS: Record<string, string> = {\n aliceblue: \"#f0f8ff\",\n antiquewhite: \"#faebd7\",\n aqua: \"#00ffff\",\n aquamarine: \"#7fffd4\",\n azure: \"#f0ffff\",\n beige: \"#f5f5dc\",\n bisque: \"#ffe4c4\",\n black: \"#000000\",\n blanchedalmond: \"#ffebcd\",\n blue: \"#0000ff\",\n blueviolet: \"#8a2be2\",\n brown: \"#a52a2a\",\n burlywood: \"#deb887\",\n cadetblue: \"#5f9ea0\",\n chartreuse: \"#7fff00\",\n chocolate: \"#d2691e\",\n coral: \"#ff7f50\",\n cornflowerblue: \"#6495ed\",\n cornsilk: \"#fff8dc\",\n crimson: \"#dc143c\",\n cyan: \"#00ffff\",\n darkblue: \"#00008b\",\n darkcyan: \"#008b8b\",\n darkgoldenrod: \"#b8860b\",\n darkgray: \"#a9a9a9\",\n darkgreen: \"#006400\",\n darkgrey: \"#a9a9a9\",\n darkkhaki: \"#bdb76b\",\n darkmagenta: \"#8b008b\",\n darkolivegreen: \"#556b2f\",\n darkorange: \"#ff8c00\",\n darkorchid: \"#9932cc\",\n darkred: \"#8b0000\",\n darksalmon: \"#e9967a\",\n darkseagreen: \"#8fbc8f\",\n darkslateblue: \"#483d8b\",\n darkslategray: \"#2f4f4f\",\n darkslategrey: \"#2f4f4f\",\n darkturquoise: \"#00ced1\",\n darkviolet: \"#9400d3\",\n deeppink: \"#ff1493\",\n deepskyblue: \"#00bfff\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n dodgerblue: \"#1e90ff\",\n firebrick: \"#b22222\",\n floralwhite: \"#fffaf0\",\n forestgreen: \"#228b22\",\n fuchsia: \"#ff00ff\",\n gainsboro: \"#dcdcdc\",\n ghostwhite: \"#f8f8ff\",\n gold: \"#ffd700\",\n goldenrod: \"#daa520\",\n gray: \"#808080\",\n green: \"#008000\",\n greenyellow: \"#adff2f\",\n grey: \"#808080\",\n honeydew: \"#f0fff0\",\n hotpink: \"#ff69b4\",\n indianred: \"#cd5c5c\",\n indigo: \"#4b0082\",\n ivory: \"#fffff0\",\n khaki: \"#f0e68c\",\n lavender: \"#e6e6fa\",\n lavenderblush: \"#fff0f5\",\n lawngreen: \"#7cfc00\",\n lemonchiffon: \"#fffacd\",\n lightblue: \"#add8e6\",\n lightcoral: \"#f08080\",\n lightcyan: \"#e0ffff\",\n lightgoldenrodyellow: \"#fafad2\",\n lightgray: \"#d3d3d3\",\n lightgreen: \"#90ee90\",\n lightgrey: \"#d3d3d3\",\n lightpink: \"#ffb6c1\",\n lightsalmon: \"#ffa07a\",\n lightseagreen: \"#20b2aa\",\n lightskyblue: \"#87cefa\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n lightsteelblue: \"#b0c4de\",\n lightyellow: \"#ffffe0\",\n lime: \"#00ff00\",\n limegreen: \"#32cd32\",\n linen: \"#faf0e6\",\n magenta: \"#ff00ff\",\n maroon: \"#800000\",\n mediumaquamarine: \"#66cdaa\",\n mediumblue: \"#0000cd\",\n mediumorchid: \"#ba55d3\",\n mediumpurple: \"#9370db\",\n mediumseagreen: \"#3cb371\",\n mediumslateblue: \"#7b68ee\",\n mediumspringgreen: \"#00fa9a\",\n mediumturquoise: \"#48d1cc\",\n mediumvioletred: \"#c71585\",\n midnightblue: \"#191970\",\n mintcream: \"#f5fffa\",\n mistyrose: \"#ffe4e1\",\n moccasin: \"#ffe4b5\",\n navajowhite: \"#ffdead\",\n navy: \"#000080\",\n oldlace: \"#fdf5e6\",\n olive: \"#808000\",\n olivedrab: \"#6b8e23\",\n orange: \"#ffa500\",\n orangered: \"#ff4500\",\n orchid: \"#da70d6\",\n palegoldenrod: \"#eee8aa\",\n palegreen: \"#98fb98\",\n paleturquoise: \"#afeeee\",\n palevioletred: \"#db7093\",\n papayawhip: \"#ffefd5\",\n peachpuff: \"#ffdab9\",\n peru: \"#cd853f\",\n pink: \"#ffc0cb\",\n plum: \"#dda0dd\",\n powderblue: \"#b0e0e6\",\n purple: \"#800080\",\n rebeccapurple: \"#663399\",\n red: \"#ff0000\",\n rosybrown: \"#bc8f8f\",\n royalblue: \"#4169e1\",\n saddlebrown: \"#8b4513\",\n salmon: \"#fa8072\",\n sandybrown: \"#f4a460\",\n seagreen: \"#2e8b57\",\n seashell: \"#fff5ee\",\n sienna: \"#a0522d\",\n silver: \"#c0c0c0\",\n skyblue: \"#87ceeb\",\n slateblue: \"#6a5acd\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n snow: \"#fffafa\",\n springgreen: \"#00ff7f\",\n steelblue: \"#4682b4\",\n tan: \"#d2b48c\",\n teal: \"#008080\",\n thistle: \"#d8bfd8\",\n tomato: \"#ff6347\",\n turquoise: \"#40e0d0\",\n violet: \"#ee82ee\",\n wheat: \"#f5deb3\",\n white: \"#ffffff\",\n whitesmoke: \"#f5f5f5\",\n yellow: \"#ffff00\",\n yellowgreen: \"#9acd32\",\n}\n\ntype Rgba = { r: number; g: number; b: number; a: number }\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(max, Math.max(min, value))\n\nconst formatRgba = ({ r, g, b, a }: Rgba): string => {\n const alpha = Math.round(clamp(a, 0, 1) * 1000) / 1000\n return alpha >= 1\n ? `rgb(${r}, ${g}, ${b})`\n : `rgba(${r}, ${g}, ${b}, ${alpha})`\n}\n\nconst HEX_PATTERN = /^#([0-9a-f]+)$/i\n\nconst hexPair = (digits: string, index: number): number =>\n Number.parseInt(digits.slice(index, index + 2), 16)\n\nconst hexSingle = (digits: string, index: number): number =>\n Number.parseInt(digits.charAt(index).repeat(2), 16)\n\nconst parseHex = (input: string): Rgba | null => {\n const match = HEX_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const digits = match[1] ?? \"\"\n switch (digits.length) {\n case 3:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: 1,\n }\n case 4:\n return {\n r: hexSingle(digits, 0),\n g: hexSingle(digits, 1),\n b: hexSingle(digits, 2),\n a: hexSingle(digits, 3) / 255,\n }\n case 6:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: 1,\n }\n case 8:\n return {\n r: hexPair(digits, 0),\n g: hexPair(digits, 2),\n b: hexPair(digits, 4),\n a: hexPair(digits, 6) / 255,\n }\n default:\n return null\n }\n}\n\nconst NUMBER_PATTERN = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/\n\nconst parseNumber = (token: string): number | null =>\n NUMBER_PATTERN.test(token) ? Number.parseFloat(token) : null\n\n// 0-255 integer or percentage → 0-255 integer.\nconst parseRgbChannel = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n // (percent * 255) / 100 avoids float drift: 50 * 2.55 === 127.4999...\n return percent === null\n ? null\n : Math.round((clamp(percent, 0, 100) * 255) / 100)\n }\n const value = parseNumber(token)\n return value === null ? null : Math.round(clamp(value, 0, 255))\n}\n\n// 0-1 float or percentage → 0-1 float.\nconst parseAlpha = (token: string): number | null => {\n if (token.endsWith(\"%\")) {\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n }\n const value = parseNumber(token)\n return value === null ? null : clamp(value, 0, 1)\n}\n\nconst parsePercentage = (token: string): number | null => {\n if (!token.endsWith(\"%\")) {\n return null\n }\n const percent = parseNumber(token.slice(0, -1))\n return percent === null ? null : clamp(percent / 100, 0, 1)\n}\n\nconst parseHue = (token: string): number | null => {\n const raw = token.toLowerCase().endsWith(\"deg\") ? token.slice(0, -3) : token\n const degrees = parseNumber(raw)\n return degrees === null ? null : ((degrees % 360) + 360) % 360\n}\n\nconst hslToRgb = (\n h: number,\n s: number,\n l: number,\n): [number, number, number] => {\n const chroma = (1 - Math.abs(2 * l - 1)) * s\n const hh = h / 60\n const x = chroma * (1 - Math.abs((hh % 2) - 1))\n // Every branch assigns, so the sextant picks the triple outright — the\n // placeholder initialiser it used to start from was dead.\n let rgb: [number, number, number]\n if (hh < 1) {\n rgb = [chroma, x, 0]\n } else if (hh < 2) {\n rgb = [x, chroma, 0]\n } else if (hh < 3) {\n rgb = [0, chroma, x]\n } else if (hh < 4) {\n rgb = [0, x, chroma]\n } else if (hh < 5) {\n rgb = [x, 0, chroma]\n } else {\n rgb = [chroma, 0, x]\n }\n const m = l - chroma / 2\n return [\n Math.round((rgb[0] + m) * 255),\n Math.round((rgb[1] + m) * 255),\n Math.round((rgb[2] + m) * 255),\n ]\n}\n\nconst FUNCTION_PATTERN = /^(rgba?|hsla?)\\(([^()]*)\\)$/i\n\n// Accepts legacy comma syntax and modern space syntax with optional \"/ alpha\".\nconst splitFunctionBody = (body: string): string[] =>\n body\n .replace(/\\//g, \" \")\n .split(/[,\\s]+/)\n .filter((token) => token.length > 0)\n\nconst parseColorFunction = (input: string): Rgba | null => {\n const match = FUNCTION_PATTERN.exec(input)\n if (match === null) {\n return null\n }\n const name = (match[1] ?? \"\").toLowerCase()\n const tokens = splitFunctionBody(match[2] ?? \"\")\n if (tokens.length < 3 || tokens.length > 4) {\n return null\n }\n const alpha = tokens.length === 4 ? parseAlpha(tokens[3] ?? \"\") : 1\n if (alpha === null) {\n return null\n }\n if (name === \"rgb\" || name === \"rgba\") {\n const r = parseRgbChannel(tokens[0] ?? \"\")\n const g = parseRgbChannel(tokens[1] ?? \"\")\n const b = parseRgbChannel(tokens[2] ?? \"\")\n if (r === null || g === null || b === null) {\n return null\n }\n return { r, g, b, a: alpha }\n }\n const h = parseHue(tokens[0] ?? \"\")\n const s = parsePercentage(tokens[1] ?? \"\")\n const l = parsePercentage(tokens[2] ?? \"\")\n if (h === null || s === null || l === null) {\n return null\n }\n const [r, g, b] = hslToRgb(h, s, l)\n return { r, g, b, a: alpha }\n}\n\nconst CSS_VARIABLE_PATTERN = /^var\\(--[\\w-]+.*\\)$/i\nconst GTK_NAMED_COLOR_PATTERN = /^@[A-Za-z_][\\w-]*$/\n\n/**\n * Parses a React Native color string into a GTK4 CSS color value.\n * Returns null for values that cannot be understood.\n */\nexport const parseColor = (value: string): string | null => {\n if (typeof value !== \"string\") {\n return null\n }\n const input = value.trim()\n if (input === \"\") {\n return null\n }\n // Adwaita/custom CSS variable references pass through untouched. The\n // pattern is permissive on purpose: nested var() fallbacks stay valid.\n if (input.toLowerCase().startsWith(\"var(\")) {\n return CSS_VARIABLE_PATTERN.test(input) ? input : null\n }\n if (GTK_NAMED_COLOR_PATTERN.test(input)) {\n return input\n }\n const lower = input.toLowerCase()\n if (lower === \"transparent\") {\n return \"rgba(0, 0, 0, 0)\"\n }\n const named = NAMED_COLORS[lower]\n const rgba = parseHex(named ?? input) ?? parseColorFunction(input)\n return rgba === null ? null : formatRgba(rgba)\n}\n\nconst toCssVariableName = (name: string): string =>\n name.startsWith(\"--\") ? name : `--${name}`\n\n/**\n * React Native's PlatformColor for GTK: references theme colors by name.\n * Names map onto CSS variables (Adwaita exposes its palette as\n * `--accent-bg-color`, `--window-bg-color`, ... since libadwaita 1.6);\n * extra names become var() fallbacks, tried in order. A name starting with\n * \"@\" is a legacy GTK named color (`@define-color`) and terminates the\n * fallback chain, because var() fallbacks cannot resolve further after it.\n *\n * PlatformColor(\"accent-bg-color\") → \"var(--accent-bg-color)\"\n * PlatformColor(\"accent-bg-color\", \"@blue_3\") → \"var(--accent-bg-color, @blue_3)\"\n */\nexport const PlatformColor = (...names: string[]): string => {\n const cleaned = names.map((name) => name.trim()).filter((name) => name !== \"\")\n if (cleaned.length === 0) {\n throw new Error(\"PlatformColor requires at least one color name\")\n }\n let expression: string | null = null\n for (let i = cleaned.length - 1; i >= 0; i -= 1) {\n const name = cleaned[i] ?? \"\"\n if (name.startsWith(\"@\")) {\n // Terminal value: names after it are unreachable fallbacks.\n expression = name\n continue\n }\n const variable = toCssVariableName(name)\n expression =\n expression === null\n ? `var(${variable})`\n : `var(${variable}, ${expression})`\n }\n return expression ?? \"\"\n}\n"]}
|
package/dist/style/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Style pipeline
|
|
1
|
+
// Style pipeline: StyleSheet → flatten → splitStyle →
|
|
2
2
|
// visualStyleToCss → memoized class registry.
|
|
3
3
|
//
|
|
4
4
|
// Everything exported here is pure (no bridge imports) and unit-testable on
|
|
5
5
|
// any OS. The production registry that talks to the gtkx `css` helper lives
|
|
6
|
-
// in ./registry.gtkx.ts and is imported directly by components
|
|
6
|
+
// in ./registry.gtkx.ts and is imported directly by the components.
|
|
7
7
|
export { parseColor, PlatformColor } from "./colors";
|
|
8
8
|
export { resetDevWarnings } from "./dev-warning";
|
|
9
9
|
export { createCssRegistry } from "./registry";
|
package/dist/style/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/style/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/style/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8CAA8C;AAC9C,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,oEAAoE;AAEpE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAgC,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,OAAO,EACP,aAAa,EACb,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,qBAAqB,GAGtB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA","sourcesContent":["// Style pipeline: StyleSheet → flatten → splitStyle →\n// visualStyleToCss → memoized class registry.\n//\n// Everything exported here is pure (no bridge imports) and unit-testable on\n// any OS. The production registry that talks to the gtkx `css` helper lives\n// in ./registry.gtkx.ts and is imported directly by the components.\n\nexport { parseColor, PlatformColor } from \"./colors\"\nexport { resetDevWarnings } from \"./dev-warning\"\nexport { createCssRegistry, type CssFn, type CssRegistry } from \"./registry\"\nexport { splitStyle } from \"./split-style\"\nexport {\n absoluteFill,\n absoluteFillObject,\n compose,\n create,\n flatten,\n hairlineWidth,\n StyleSheet,\n} from \"./style-sheet\"\nexport {\n textAlignToLabelProps,\n type LabelAlignProps,\n type TextAlign,\n} from \"./text-align\"\nexport { visualStyleToCss } from \"./visual-css\"\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Production adapter — the ONLY style module that touches the bridge.
|
|
2
|
-
// Components
|
|
2
|
+
// Components import the default registry from here; everything
|
|
3
3
|
// else in src/style is pure and must not depend on this file. It is also
|
|
4
4
|
// deliberately not re-exported from src/style/index.ts so that unit tests
|
|
5
5
|
// (and any pure consumer) never pull in @gtkx bindings transitively.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.gtkx.js","sourceRoot":"","sources":["../../src/style/registry.gtkx.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE
|
|
1
|
+
{"version":3,"file":"registry.gtkx.js","sourceRoot":"","sources":["../../src/style/registry.gtkx.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,+DAA+D;AAC/D,yEAAyE;AACzE,0EAA0E;AAC1E,qEAAqE;AAErE,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAoB,MAAM,YAAY,CAAA;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAgB,iBAAiB,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3E,GAAG,CAAC,OAAO,CAAC,CACb,CAAA","sourcesContent":["// Production adapter — the ONLY style module that touches the bridge.\n// Components import the default registry from here; everything\n// else in src/style is pure and must not depend on this file. It is also\n// deliberately not re-exported from src/style/index.ts so that unit tests\n// (and any pure consumer) never pull in @gtkx bindings transitively.\n\nimport { css } from \"../gtkx/bridge/index\"\nimport { createCssRegistry, type CssRegistry } from \"./registry\"\n\nexport const defaultCssRegistry: CssRegistry = createCssRegistry((cssText) =>\n css(cssText),\n)\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Classifies a flattened style into layout props (consumed by the Yoga
|
|
2
|
-
// engine
|
|
2
|
+
// engine) and visual props (compiled into GTK CSS). Pure module.
|
|
3
3
|
import { warnOnce } from "./dev-warning";
|
|
4
4
|
// Exhaustive over the frozen contract: adding a key to LayoutStyle in
|
|
5
5
|
// contracts.ts fails compilation here until the key is classified.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-style.js","sourceRoot":"","sources":["../../src/style/split-style.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"split-style.js","sourceRoot":"","sources":["../../src/style/split-style.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,iEAAiE;AAQjE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,sEAAsE;AACtE,mEAAmE;AACnE,MAAM,WAAW,GAAoC;IACnD,YAAY,EAAE,IAAI;IAClB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,IAAI;IACd,GAAG,EAAE,IAAI;IACT,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,IAAI;IACpB,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,YAAY,EAAE,IAAI;IAClB,gBAAgB,EAAE,IAAI;IACtB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,cA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AC,IAAe,EAAc,EAAE;IACxD,MAAM,MAAM,GAAgB,EAAE,CAAA;IAC9B,MAAM,MAAM,GAAgB,EAAE,CAAA;IAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAQ;QACV,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;YACpC,CAAC;YAAC,MAAkC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACnD,CAAC;aAAM,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;YAC3C,CAAC;YAAC,MAAkC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACnD,CAAC;aAAM,CAAC;YACN,QAAQ,CACN,sBAAsB,GAAG,EAAE,EAC3B,+CAA+C,GAAG,wCAAwC,CAC3F,CAAA;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAC3B,CAAC,CAAA","sourcesContent":["// Classifies a flattened style into layout props (consumed by the Yoga\n// engine) and visual props (compiled into GTK CSS). Pure module.\n\nimport type {\n FlatStyle,\n LayoutStyle,\n SplitStyle,\n VisualStyle,\n} from \"../contracts\"\nimport { warnOnce } from \"./dev-warning\"\n\n// Exhaustive over the frozen contract: adding a key to LayoutStyle in\n// contracts.ts fails compilation here until the key is classified.\nconst LAYOUT_KEYS: Record<keyof LayoutStyle, true> = {\n alignContent: true,\n alignItems: true,\n alignSelf: true,\n aspectRatio: true,\n bottom: true,\n columnGap: true,\n direction: true,\n display: true,\n flex: true,\n flexBasis: true,\n flexDirection: true,\n flexGrow: true,\n flexShrink: true,\n flexWrap: true,\n gap: true,\n height: true,\n justifyContent: true,\n left: true,\n margin: true,\n marginBottom: true,\n marginHorizontal: true,\n marginLeft: true,\n marginRight: true,\n marginTop: true,\n marginVertical: true,\n maxHeight: true,\n maxWidth: true,\n minHeight: true,\n minWidth: true,\n overflow: true,\n padding: true,\n paddingBottom: true,\n paddingHorizontal: true,\n paddingLeft: true,\n paddingRight: true,\n paddingTop: true,\n paddingVertical: true,\n position: true,\n right: true,\n rowGap: true,\n top: true,\n width: true,\n}\n\n// Note: `transform` is visual by contract — it is applied by the layout\n// engine through Fixed.Child matrices, not through CSS, and is passed\n// through here untouched.\nconst VISUAL_KEYS: Record<keyof VisualStyle, true> = {\n backgroundColor: true,\n borderBottomColor: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderBottomWidth: true,\n borderColor: true,\n borderLeftColor: true,\n borderLeftWidth: true,\n borderRadius: true,\n borderRightColor: true,\n borderRightWidth: true,\n borderStyle: true,\n borderTopColor: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderTopWidth: true,\n borderWidth: true,\n color: true,\n fontFamily: true,\n fontSize: true,\n fontStyle: true,\n fontWeight: true,\n letterSpacing: true,\n lineHeight: true,\n opacity: true,\n textAlign: true,\n transform: true,\n}\n\n/**\n * Splits a flattened style into { layout, visual }. Unknown properties are\n * ignored with a one-time dev warning per key; undefined values are dropped.\n */\nexport const splitStyle = (flat: FlatStyle): SplitStyle => {\n const layout: LayoutStyle = {}\n const visual: VisualStyle = {}\n for (const [key, value] of Object.entries(flat)) {\n if (value === undefined) {\n continue\n }\n if (Object.hasOwn(LAYOUT_KEYS, key)) {\n ;(layout as Record<string, unknown>)[key] = value\n } else if (Object.hasOwn(VISUAL_KEYS, key)) {\n ;(visual as Record<string, unknown>)[key] = value\n } else {\n warnOnce(\n `unknown-style-prop:${key}`,\n `[react-native-gtkx] Unknown style property \"${key}\" is not supported and will be ignored`,\n )\n }\n }\n return { layout, visual }\n}\n"]}
|
package/dist/style/text-align.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// GTK4 CSS has no text-align property, so textAlign never reaches the CSS
|
|
2
|
-
// generator: the Text component
|
|
2
|
+
// generator: the Text component maps it onto GtkLabel properties with
|
|
3
3
|
// this pure helper (no bridge imports).
|
|
4
4
|
//
|
|
5
5
|
// - xalign positions the whole text block inside the label allocation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-align.js","sourceRoot":"","sources":["../../src/style/text-align.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"text-align.js","sourceRoot":"","sources":["../../src/style/text-align.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,wCAAwC;AACxC,EAAE;AACF,uEAAuE;AACvE,4EAA4E;AAC5E,gDAAgD;AAWhD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,SAAgC,EACf,EAAE;IACnB,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,CAAA;QAC9C,KAAK,QAAQ;YACX,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;QACjD,KAAK,SAAS;YACZ,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA;QAC7C,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,SAAS;YACZ,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAA;IAC/C,CAAC;AACH,CAAC,CAAA","sourcesContent":["// GTK4 CSS has no text-align property, so textAlign never reaches the CSS\n// generator: the Text component maps it onto GtkLabel properties with\n// this pure helper (no bridge imports).\n//\n// - xalign positions the whole text block inside the label allocation;\n// - justification aligns wrapped lines relative to each other (values match\n// Gtk.Justification: left/right/center/fill).\n\nimport type { VisualStyle } from \"../contracts\"\n\nexport type TextAlign = NonNullable<VisualStyle[\"textAlign\"]>\n\nexport type LabelAlignProps = {\n xalign: number\n justification: \"left\" | \"right\" | \"center\" | \"fill\"\n}\n\nexport const textAlignToLabelProps = (\n textAlign: TextAlign | undefined,\n): LabelAlignProps => {\n switch (textAlign) {\n case \"right\":\n return { xalign: 1, justification: \"right\" }\n case \"center\":\n return { xalign: 0.5, justification: \"center\" }\n case \"justify\":\n return { xalign: 0, justification: \"fill\" }\n case \"auto\":\n case \"left\":\n case undefined:\n return { xalign: 0, justification: \"left\" }\n }\n}\n"]}
|
package/dist/vite/index.js
CHANGED
|
@@ -128,6 +128,7 @@ export const reactNativeGtkx = (options = {}) => ({
|
|
|
128
128
|
noExternal: ["react-native-gtkx", "react-native", /^@react-navigation\//],
|
|
129
129
|
},
|
|
130
130
|
resolve: {
|
|
131
|
+
// RC2-WORKAROUND(runtime-dedupe): see docs/gtkx-rc2-notes.md
|
|
131
132
|
// The gtkx runtime and react are single-instance hosts: when the app
|
|
132
133
|
// and react-native-gtkx resolve them from different node_modules
|
|
133
134
|
// (file:-installed package, nested installs), two bundled copies
|
package/dist/vite/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;AAC3E,4BAA4B;AAC5B,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,2EAA2E;AAC3E,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAgBjE,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CA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AU,EAAE,CAAC,mBAAmB,EAAE,cAAc,EAAE,sBAAsB,CAAC;SAC1E;QACD,OAAO,EAAE;YACP,qEAAqE;YACrE,iEAAiE;YACjE,iEAAiE;YACjE,qEAAqE;YACrE,gCAAgC;YAChC,MAAM,EAAE;gBACN,WAAW;gBACX,UAAU;gBACV,WAAW;gBACX,cAAc;gBACd,aAAa;gBACb,eAAe;gBACf,gEAAgE;gBAChE,kDAAkD;gBAClD,wBAAwB;gBACxB,0BAA0B;gBAC1B,OAAO;aACR;SACF;KACF,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ;QAC9B,MAAM,OAAO,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAA;QAChD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;YAC1E,OAAO,QAAQ,IAAI,OAAO,CAAA;QAC5B,CAAC;QACD,OAAO,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACxE,CAAC;CACF,CAAC,CAAA;AAEF,eAAe,eAAe,CAAA","sourcesContent":["// react-native-gtkx/vite — makes a gtkx project React Native compatible.\n// The gtkx CLI (dev and build) starts vite with an inline config that never\n// sets `configFile: false`, so vite picks up the project's vite.config.ts\n// from the root and merges it beneath the CLI config; this preset plugs in\n// there as a single plugin.\n//\n// Single self-contained file on purpose: vite loads the config's imported\n// packages with BARE Node, so this subpath (like ./metro and ./runner) must\n// not contain extensionless relative imports — the pure resolution helpers\n// live here rather than in a sibling module.\nimport { existsSync } from \"node:fs\"\nimport { dirname, extname, isAbsolute, resolve } from \"node:path\"\nimport type { Plugin } from \"vite\"\n\n// --- pure resolution logic (unit-tested directly) -----------------------\n\n/** Options shared by the preset factory and the pure resolver helpers. */\nexport type PlatformResolutionOptions = {\n /** Platform suffix priority, most specific first. Default: [\"linux\", \"native\"]. */\n platforms?: readonly string[]\n /** Source extensions tried for every platform suffix. Default: [\"tsx\", \"ts\", \"jsx\", \"js\"]. */\n extensions?: readonly string[]\n}\n\n/** Predicate the plugin injects as fs.existsSync; tests inject fakes. */\nexport type FileExists = (filePath: string) => boolean\n\nexport const DEFAULT_PLATFORMS: readonly string[] = [\"linux\", \"native\"]\nexport const DEFAULT_EXTENSIONS: readonly string[] = [\"tsx\", \"ts\", \"jsx\", \"js\"]\n\nconst REACT_NATIVE = \"react-native\"\nconst REACT_NATIVE_GTKX = \"react-native-gtkx\"\n\n/**\n * Maps `react-native` (and its subpaths) to `react-native-gtkx`.\n * Returns null for every other specifier, including `react-native-gtkx`\n * itself and lookalikes such as `react-native-web`.\n */\nexport const rewriteReactNativeImport = (source: string): string | null => {\n if (source === REACT_NATIVE) {\n return REACT_NATIVE_GTKX\n }\n if (source.startsWith(`${REACT_NATIVE}/`)) {\n return `${REACT_NATIVE_GTKX}${source.slice(REACT_NATIVE.length)}`\n }\n return null\n}\n\n/** Splits a vite specifier into its path part and its `?query` suffix. */\nexport const splitQuery = (\n source: string,\n): { specifier: string; query: string } => {\n const index = source.indexOf(\"?\")\n if (index === -1) {\n return { specifier: source, query: \"\" }\n }\n return { specifier: source.slice(0, index), query: source.slice(index) }\n}\n\nconst isRelative = (specifier: string): boolean =>\n specifier.startsWith(\"./\") || specifier.startsWith(\"../\")\n\n/**\n * Ordered platform suffixes, platform-major: every extension of the first\n * platform is tried before any extension of the next one\n * (`.linux.tsx`, `.linux.ts`, …, `.native.tsx`, …).\n */\nexport const platformSuffixes = (\n options: PlatformResolutionOptions = {},\n): string[] => {\n const platforms = options.platforms ?? DEFAULT_PLATFORMS\n const extensions = options.extensions ?? DEFAULT_EXTENSIONS\n return platforms.flatMap((platform) =>\n extensions.map((extension) => `.${platform}.${extension}`),\n )\n}\n\n/**\n * Candidate file paths for an extensionless base path, in priority order:\n * direct platform files first, then platform index files of a directory —\n * mirroring Metro, which exhausts file resolution before directory resolution.\n * The base file itself is not a candidate: when no platform file exists the\n * plugin bails out and the default resolver picks the base module.\n */\nexport const platformCandidates = (\n base: string,\n options: PlatformResolutionOptions = {},\n): string[] => {\n const suffixes = platformSuffixes(options)\n return [\n ...suffixes.map((suffix) => `${base}${suffix}`),\n ...suffixes.map((suffix) => `${base}/index${suffix}`),\n ]\n}\n\n// Source extensions Metro strips before trying platform variants: an\n// import of \"./useLinking.js\" (the TS-ESM style react-navigation and most\n// compiled RN libraries use) must still find useLinking.native.tsx /\n// useLinking.native.js — Metro resolves the BASE name platform-first, the\n// literal file is only the fallback.\nconst STRIPPABLE_EXTENSIONS = new Set([\".js\", \".jsx\", \".mjs\", \".ts\", \".tsx\"])\n\n/**\n * Metro platform-extension resolution for a single import: relative (or\n * absolute) specifiers that are extensionless — or carry a strippable\n * source extension — try platform candidates first; the first existing\n * candidate wins; the `?query` suffix is carried over. Returns null when\n * the import is out of scope or no platform file exists, handing the\n * import back to the default resolver.\n */\nexport const resolvePlatformSpecifier = (\n source: string,\n importer: string | undefined,\n exists: FileExists,\n options: PlatformResolutionOptions = {},\n): string | null => {\n if (importer === undefined || source.startsWith(\"\\0\")) {\n return null\n }\n const { specifier, query } = splitQuery(source)\n if (!isRelative(specifier) && !isAbsolute(specifier)) {\n return null\n }\n const extension = extname(specifier)\n if (extension !== \"\" && !STRIPPABLE_EXTENSIONS.has(extension)) {\n return null\n }\n const withExtension = isAbsolute(specifier)\n ? specifier\n : resolve(dirname(splitQuery(importer).specifier), specifier)\n const base =\n extension === \"\" ? withExtension : withExtension.slice(0, -extension.length)\n for (const candidate of platformCandidates(base, options)) {\n if (exists(candidate)) {\n return candidate + query\n }\n }\n return null\n}\n\n// --- the vite plugin ----------------------------------------------------\n\nexport type ReactNativeGtkxOptions = PlatformResolutionOptions\n\n/**\n * Vite plugin: aliases `react-native` (and subpaths) to `react-native-gtkx`\n * and resolves Metro-style platform extensions\n * (`.linux.tsx` → `.native.tsx` → base) for extensionless imports.\n */\nexport const reactNativeGtkx = (\n options: ReactNativeGtkxOptions = {},\n): Plugin => ({\n name: \"react-native-gtkx:preset\",\n // Before vite's own resolver and the gtkx CLI plugins: the alias must win\n // over node resolution and platform files must win over the base file.\n enforce: \"pre\",\n\n config: () => ({\n ssr: {\n // `gtkx dev` runs vite with ssr.external: true, which would hand\n // react-native-gtkx straight to node. Keep the package inside the\n // vite pipeline; noExternal wins over external: true.\n //\n // \"react-native\" must be listed too: with ssr.external: true vite\n // externalizes a bare import BEFORE the plugin pipeline whenever the\n // package resolves natively — and the real react-native (a Flow\n // codebase Node cannot parse) exists in RN monorepos. noExternal\n // forces the full plugin resolution, where the alias rewrites the\n // import to react-native-gtkx.\n // @react-navigation must go through the pipeline too: it imports\n // \"react-native\", and an externalized copy resolves that to the real\n // Flow package (SyntaxError: Unexpected token 'typeof') instead of\n // our alias. Only bites on the dev path — a production build inlines\n // everything anyway.\n noExternal: [\"react-native-gtkx\", \"react-native\", /^@react-navigation\\//],\n },\n resolve: {\n // The gtkx runtime and react are single-instance hosts: when the app\n // and react-native-gtkx resolve them from different node_modules\n // (file:-installed package, nested installs), two bundled copies\n // double-init the runtime and GLib aborts. dedupe pins every copy to\n // the project's own resolution.\n dedupe: [\n \"@gtkx/css\",\n \"@gtkx/gi\",\n \"@gtkx/jsx\",\n \"@gtkx/native\",\n \"@gtkx/react\",\n \"@gtkx/runtime\",\n // react-navigation is context-based: two bundled copies of core\n // fail with \"couldn't find a navigation context\".\n \"@react-navigation/core\",\n \"@react-navigation/native\",\n \"react\",\n ],\n },\n }),\n\n async resolveId(source, importer) {\n const aliased = rewriteReactNativeImport(source)\n if (aliased !== null) {\n const resolved = await this.resolve(aliased, importer, { skipSelf: true })\n return resolved ?? aliased\n }\n return resolvePlatformSpecifier(source, importer, existsSync, options)\n },\n})\n\nexport default reactNativeGtkx\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index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AAA;IACxE,CAAC;CACF,CAAC,CAAA;AAEF,eAAe,eAAe,CAAA","sourcesContent":["// react-native-gtkx/vite — makes a gtkx project React Native compatible.\n// The gtkx CLI (dev and build) starts vite with an inline config that never\n// sets `configFile: false`, so vite picks up the project's vite.config.ts\n// from the root and merges it beneath the CLI config; this preset plugs in\n// there as a single plugin.\n//\n// Single self-contained file on purpose: vite loads the config's imported\n// packages with BARE Node, so this subpath (like ./metro and ./runner) must\n// not contain extensionless relative imports — the pure resolution helpers\n// live here rather than in a sibling module.\nimport { existsSync } from \"node:fs\"\nimport { dirname, extname, isAbsolute, resolve } from \"node:path\"\nimport type { Plugin } from \"vite\"\n\n// --- pure resolution logic (unit-tested directly) -----------------------\n\n/** Options shared by the preset factory and the pure resolver helpers. */\nexport type PlatformResolutionOptions = {\n /** Platform suffix priority, most specific first. Default: [\"linux\", \"native\"]. */\n platforms?: readonly string[]\n /** Source extensions tried for every platform suffix. Default: [\"tsx\", \"ts\", \"jsx\", \"js\"]. */\n extensions?: readonly string[]\n}\n\n/** Predicate the plugin injects as fs.existsSync; tests inject fakes. */\nexport type FileExists = (filePath: string) => boolean\n\nexport const DEFAULT_PLATFORMS: readonly string[] = [\"linux\", \"native\"]\nexport const DEFAULT_EXTENSIONS: readonly string[] = [\"tsx\", \"ts\", \"jsx\", \"js\"]\n\nconst REACT_NATIVE = \"react-native\"\nconst REACT_NATIVE_GTKX = \"react-native-gtkx\"\n\n/**\n * Maps `react-native` (and its subpaths) to `react-native-gtkx`.\n * Returns null for every other specifier, including `react-native-gtkx`\n * itself and lookalikes such as `react-native-web`.\n */\nexport const rewriteReactNativeImport = (source: string): string | null => {\n if (source === REACT_NATIVE) {\n return REACT_NATIVE_GTKX\n }\n if (source.startsWith(`${REACT_NATIVE}/`)) {\n return `${REACT_NATIVE_GTKX}${source.slice(REACT_NATIVE.length)}`\n }\n return null\n}\n\n/** Splits a vite specifier into its path part and its `?query` suffix. */\nexport const splitQuery = (\n source: string,\n): { specifier: string; query: string } => {\n const index = source.indexOf(\"?\")\n if (index === -1) {\n return { specifier: source, query: \"\" }\n }\n return { specifier: source.slice(0, index), query: source.slice(index) }\n}\n\nconst isRelative = (specifier: string): boolean =>\n specifier.startsWith(\"./\") || specifier.startsWith(\"../\")\n\n/**\n * Ordered platform suffixes, platform-major: every extension of the first\n * platform is tried before any extension of the next one\n * (`.linux.tsx`, `.linux.ts`, …, `.native.tsx`, …).\n */\nexport const platformSuffixes = (\n options: PlatformResolutionOptions = {},\n): string[] => {\n const platforms = options.platforms ?? DEFAULT_PLATFORMS\n const extensions = options.extensions ?? DEFAULT_EXTENSIONS\n return platforms.flatMap((platform) =>\n extensions.map((extension) => `.${platform}.${extension}`),\n )\n}\n\n/**\n * Candidate file paths for an extensionless base path, in priority order:\n * direct platform files first, then platform index files of a directory —\n * mirroring Metro, which exhausts file resolution before directory resolution.\n * The base file itself is not a candidate: when no platform file exists the\n * plugin bails out and the default resolver picks the base module.\n */\nexport const platformCandidates = (\n base: string,\n options: PlatformResolutionOptions = {},\n): string[] => {\n const suffixes = platformSuffixes(options)\n return [\n ...suffixes.map((suffix) => `${base}${suffix}`),\n ...suffixes.map((suffix) => `${base}/index${suffix}`),\n ]\n}\n\n// Source extensions Metro strips before trying platform variants: an\n// import of \"./useLinking.js\" (the TS-ESM style react-navigation and most\n// compiled RN libraries use) must still find useLinking.native.tsx /\n// useLinking.native.js — Metro resolves the BASE name platform-first, the\n// literal file is only the fallback.\nconst STRIPPABLE_EXTENSIONS = new Set([\".js\", \".jsx\", \".mjs\", \".ts\", \".tsx\"])\n\n/**\n * Metro platform-extension resolution for a single import: relative (or\n * absolute) specifiers that are extensionless — or carry a strippable\n * source extension — try platform candidates first; the first existing\n * candidate wins; the `?query` suffix is carried over. Returns null when\n * the import is out of scope or no platform file exists, handing the\n * import back to the default resolver.\n */\nexport const resolvePlatformSpecifier = (\n source: string,\n importer: string | undefined,\n exists: FileExists,\n options: PlatformResolutionOptions = {},\n): string | null => {\n if (importer === undefined || source.startsWith(\"\\0\")) {\n return null\n }\n const { specifier, query } = splitQuery(source)\n if (!isRelative(specifier) && !isAbsolute(specifier)) {\n return null\n }\n const extension = extname(specifier)\n if (extension !== \"\" && !STRIPPABLE_EXTENSIONS.has(extension)) {\n return null\n }\n const withExtension = isAbsolute(specifier)\n ? specifier\n : resolve(dirname(splitQuery(importer).specifier), specifier)\n const base =\n extension === \"\" ? withExtension : withExtension.slice(0, -extension.length)\n for (const candidate of platformCandidates(base, options)) {\n if (exists(candidate)) {\n return candidate + query\n }\n }\n return null\n}\n\n// --- the vite plugin ----------------------------------------------------\n\nexport type ReactNativeGtkxOptions = PlatformResolutionOptions\n\n/**\n * Vite plugin: aliases `react-native` (and subpaths) to `react-native-gtkx`\n * and resolves Metro-style platform extensions\n * (`.linux.tsx` → `.native.tsx` → base) for extensionless imports.\n */\nexport const reactNativeGtkx = (\n options: ReactNativeGtkxOptions = {},\n): Plugin => ({\n name: \"react-native-gtkx:preset\",\n // Before vite's own resolver and the gtkx CLI plugins: the alias must win\n // over node resolution and platform files must win over the base file.\n enforce: \"pre\",\n\n config: () => ({\n ssr: {\n // `gtkx dev` runs vite with ssr.external: true, which would hand\n // react-native-gtkx straight to node. Keep the package inside the\n // vite pipeline; noExternal wins over external: true.\n //\n // \"react-native\" must be listed too: with ssr.external: true vite\n // externalizes a bare import BEFORE the plugin pipeline whenever the\n // package resolves natively — and the real react-native (a Flow\n // codebase Node cannot parse) exists in RN monorepos. noExternal\n // forces the full plugin resolution, where the alias rewrites the\n // import to react-native-gtkx.\n // @react-navigation must go through the pipeline too: it imports\n // \"react-native\", and an externalized copy resolves that to the real\n // Flow package (SyntaxError: Unexpected token 'typeof') instead of\n // our alias. Only bites on the dev path — a production build inlines\n // everything anyway.\n noExternal: [\"react-native-gtkx\", \"react-native\", /^@react-navigation\\//],\n },\n resolve: {\n // RC2-WORKAROUND(runtime-dedupe): see docs/gtkx-rc2-notes.md\n // The gtkx runtime and react are single-instance hosts: when the app\n // and react-native-gtkx resolve them from different node_modules\n // (file:-installed package, nested installs), two bundled copies\n // double-init the runtime and GLib aborts. dedupe pins every copy to\n // the project's own resolution.\n dedupe: [\n \"@gtkx/css\",\n \"@gtkx/gi\",\n \"@gtkx/jsx\",\n \"@gtkx/native\",\n \"@gtkx/react\",\n \"@gtkx/runtime\",\n // react-navigation is context-based: two bundled copies of core\n // fail with \"couldn't find a navigation context\".\n \"@react-navigation/core\",\n \"@react-navigation/native\",\n \"react\",\n ],\n },\n }),\n\n async resolveId(source, importer) {\n const aliased = rewriteReactNativeImport(source)\n if (aliased !== null) {\n const resolved = await this.resolve(aliased, importer, { skipSelf: true })\n return resolved ?? aliased\n }\n return resolvePlatformSpecifier(source, importer, existsSync, options)\n },\n})\n\nexport default reactNativeGtkx\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gtkx",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"description": "React Native components and APIs for Linux desktop, rendered as native GTK4 widgets via gtkx",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Anton Petrov <anton@itsmepetrov.com>",
|