@lattix/react-native 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import type { LattixAction } from "@lattix/core";
2
+ /**
3
+ * Handler invoked when a semantic action fires (e.g. button onPress).
4
+ * Receives the normalized action object so consumers can dispatch, navigate, etc.
5
+ */
6
+ export type LattixActionHandler = (action: LattixAction) => void;
7
+ /** React context carrying the action handler for the current renderer subtree. */
8
+ export declare const LattixActionContext: import("react").Context<LattixActionHandler | undefined>;
9
+ /** Read the current action handler from context. Returns a no-op if none is provided. */
10
+ export declare const useLattixAction: () => LattixActionHandler;
11
+ //# sourceMappingURL=action-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-context.d.ts","sourceRoot":"","sources":["../src/action-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;AAEjE,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,0DAE/B,CAAC;AAEF,yFAAyF;AACzF,eAAO,MAAM,eAAe,QAAO,mBAGlC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { createContext, useContext } from "react";
2
+ /** React context carrying the action handler for the current renderer subtree. */
3
+ export const LattixActionContext = createContext(undefined);
4
+ /** Read the current action handler from context. Returns a no-op if none is provided. */
5
+ export const useLattixAction = () => {
6
+ const handler = useContext(LattixActionContext);
7
+ return handler ?? noop;
8
+ };
9
+ const noop = () => { };
10
+ //# sourceMappingURL=action-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-context.js","sourceRoot":"","sources":["../src/action-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AASlD,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC9C,SAAS,CACV,CAAC;AAEF,yFAAyF;AACzF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAwB,EAAE;IACvD,MAAM,OAAO,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAChD,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,IAAI,GAAwB,GAAG,EAAE,GAAE,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { LattixNativeRenderer, type LattixNativeRendererProps } from "./renderer-native.js";
2
+ export { RenderNodeNative, setRNComponents, type LattixNodeProps } from "./render-node-native.js";
3
+ export { LattixActionContext, useLattixAction, type LattixActionHandler, } from "./action-context.js";
4
+ export { LattixRegistryContext, useTokenRegistry, } from "./registry-context.js";
5
+ export { resolveStyleToNative, type ResolveNativeStyleOptions } from "./resolve-style-native.js";
6
+ export type { RNViewStyle, RNTextStyle, RNImageStyle, RNStyle, } from "./rn-types.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACjG,YAAY,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,OAAO,GACR,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { LattixNativeRenderer } from "./renderer-native.js";
2
+ export { RenderNodeNative, setRNComponents } from "./render-node-native.js";
3
+ export { LattixActionContext, useLattixAction, } from "./action-context.js";
4
+ export { LattixRegistryContext, useTokenRegistry, } from "./registry-context.js";
5
+ export { resolveStyleToNative } from "./resolve-style-native.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAkC,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAwB,MAAM,yBAAyB,CAAC;AAClG,OAAO,EACL,mBAAmB,EACnB,eAAe,GAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAkC,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type TokenRegistry } from "@lattix/tokens";
2
+ /** React context carrying the token registry for style resolution. */
3
+ export declare const LattixRegistryContext: import("react").Context<Readonly<Record<string, import("@lattix/core").LattixStyleValue>>>;
4
+ /** Read the current token registry from context. */
5
+ export declare const useTokenRegistry: () => TokenRegistry;
6
+ //# sourceMappingURL=registry-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-context.d.ts","sourceRoot":"","sources":["../src/registry-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE1E,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,4FAEjC,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,QAAO,aACD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { createContext, useContext } from "react";
2
+ import { defaultTokenRegistry } from "@lattix/tokens";
3
+ /** React context carrying the token registry for style resolution. */
4
+ export const LattixRegistryContext = createContext(defaultTokenRegistry);
5
+ /** Read the current token registry from context. */
6
+ export const useTokenRegistry = () => useContext(LattixRegistryContext);
7
+ //# sourceMappingURL=registry-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-context.js","sourceRoot":"","sources":["../src/registry-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,gBAAgB,CAAC;AAE1E,sEAAsE;AACtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAChD,oBAAoB,CACrB,CAAC;AAEF,oDAAoD;AACpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAkB,EAAE,CAClD,UAAU,CAAC,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import type { LattixNode } from "@lattix/core";
3
+ import type { RNViewProps, RNTextProps, RNImageProps, RNTextInputProps, RNPressableProps, RNScrollViewProps } from "./rn-types.js";
4
+ /** Props passed to every node renderer. */
5
+ export interface LattixNodeProps {
6
+ readonly node: LattixNode;
7
+ }
8
+ /**
9
+ * Lazy accessor for react-native components.
10
+ * At runtime `react-native` must be available as a peer dependency.
11
+ * During unit tests the module is replaced with mocks.
12
+ */
13
+ declare let _rn: {
14
+ View: React.ComponentType<RNViewProps>;
15
+ Text: React.ComponentType<RNTextProps>;
16
+ Image: React.ComponentType<RNImageProps>;
17
+ TextInput: React.ComponentType<RNTextInputProps>;
18
+ Pressable: React.ComponentType<RNPressableProps>;
19
+ ScrollView: React.ComponentType<RNScrollViewProps>;
20
+ } | undefined;
21
+ /**
22
+ * Inject mock RN components for testing (avoids real react-native dependency).
23
+ * Call with `undefined` to reset.
24
+ */
25
+ export declare const setRNComponents: (components: typeof _rn) => void;
26
+ /**
27
+ * Render a single semantic node by dispatching to the appropriate kind renderer.
28
+ * Unknown kinds render a diagnostic View with a testID.
29
+ */
30
+ export declare const RenderNodeNative: React.FC<LattixNodeProps>;
31
+ export {};
32
+ //# sourceMappingURL=render-node-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-node-native.d.ts","sourceRoot":"","sources":["../src/render-node-native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAM7D,OAAO,KAAK,EAIV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED;;;;GAIG;AACH,QAAA,IAAI,GAAG,EAAE;IACP,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACvC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACvC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IACzC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;CACpD,GAAG,SAAS,CAAC;AAYd;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,OAAO,GAAG,KAAG,IAExD,CAAC;AAoOF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAWtD,CAAC"}
@@ -0,0 +1,158 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { normalizeAction } from "@lattix/core";
3
+ import { resolveMotionToNative } from "@lattix/motion";
4
+ import { useLattixAction } from "./action-context.js";
5
+ import { useTokenRegistry } from "./registry-context.js";
6
+ import { resolveStyleToNative } from "./resolve-style-native.js";
7
+ /**
8
+ * Lazy accessor for react-native components.
9
+ * At runtime `react-native` must be available as a peer dependency.
10
+ * During unit tests the module is replaced with mocks.
11
+ */
12
+ let _rn;
13
+ const getRN = () => {
14
+ if (!_rn) {
15
+ throw new Error("React Native components not available. " +
16
+ "Call setRNComponents() or ensure react-native is loaded before rendering.");
17
+ }
18
+ return _rn;
19
+ };
20
+ /**
21
+ * Inject mock RN components for testing (avoids real react-native dependency).
22
+ * Call with `undefined` to reset.
23
+ */
24
+ export const setRNComponents = (components) => {
25
+ _rn = components;
26
+ };
27
+ /** Resolve node styles and initial motion state for RN-compatible renderers. */
28
+ const useNodeStyle = (node) => {
29
+ const registry = useTokenRegistry();
30
+ const style = resolveStyleToNative(node.normalizedStyle, { registry }, node.style);
31
+ const motion = resolveMotionToNative(node.animation);
32
+ return { ...style, ...motion.initialStyle };
33
+ };
34
+ /** Recursively render children of a container node. */
35
+ const RenderChildren = ({ children, }) => {
36
+ if (!children || children.length === 0) {
37
+ return null;
38
+ }
39
+ return (_jsx(_Fragment, { children: children.map((child, i) => (_jsx(RenderNodeNative, { node: child }, child.id ?? `${child.kind}-${i}`))) }));
40
+ };
41
+ /** Resolve an action prop (string id or LattixAction) into a press handler. */
42
+ const useActionHandler = (actionProp) => {
43
+ const dispatch = useLattixAction();
44
+ if (actionProp === undefined || actionProp === null) {
45
+ return undefined;
46
+ }
47
+ return () => {
48
+ const action = typeof actionProp === "string"
49
+ ? normalizeAction(actionProp)
50
+ : actionProp;
51
+ dispatch(action);
52
+ };
53
+ };
54
+ const ScreenRenderer = ({ node }) => {
55
+ const { ScrollView } = getRN();
56
+ const style = useNodeStyle(node);
57
+ return (_jsx(ScrollView, { testID: `lattix-screen-${node.id ?? "root"}`, contentContainerStyle: { flexGrow: 1, ...style }, children: _jsx(RenderChildren, { children: node.children }) }));
58
+ };
59
+ const StackRenderer = ({ node }) => {
60
+ const { View } = getRN();
61
+ const style = useNodeStyle(node);
62
+ return (_jsx(View, { testID: "lattix-stack", style: { flexDirection: "column", ...style }, children: _jsx(RenderChildren, { children: node.children }) }));
63
+ };
64
+ const RowRenderer = ({ node }) => {
65
+ const { View } = getRN();
66
+ const style = useNodeStyle(node);
67
+ return (_jsx(View, { testID: "lattix-row", style: { flexDirection: "row", ...style }, children: _jsx(RenderChildren, { children: node.children }) }));
68
+ };
69
+ const BoxRenderer = ({ node }) => {
70
+ const { View } = getRN();
71
+ const style = useNodeStyle(node);
72
+ return (_jsx(View, { testID: "lattix-box", style: style, children: _jsx(RenderChildren, { children: node.children }) }));
73
+ };
74
+ const TextRenderer = ({ node }) => {
75
+ const { Text } = getRN();
76
+ const style = useNodeStyle(node);
77
+ const content = node.props.content;
78
+ return (_jsx(Text, { testID: "lattix-text", style: style, children: content ?? "" }));
79
+ };
80
+ const ImageRenderer = ({ node }) => {
81
+ const { Image } = getRN();
82
+ const style = useNodeStyle(node);
83
+ const source = node.props.source;
84
+ const alt = node.props.alt ?? "";
85
+ return (_jsx(Image, { testID: "lattix-image", source: { uri: source ?? "" }, accessibilityLabel: alt, style: style }));
86
+ };
87
+ const ButtonRenderer = ({ node }) => {
88
+ const { Pressable, Text } = getRN();
89
+ const style = useNodeStyle(node);
90
+ const label = node.props.label;
91
+ const onPress = useActionHandler(node.props.onPress);
92
+ return (_jsx(Pressable, { testID: "lattix-button", accessibilityRole: "button", onPress: onPress, style: style, children: node.children && node.children.length > 0 ? (_jsx(RenderChildren, { children: node.children })) : (_jsx(Text, { children: label ?? "" })) }));
93
+ };
94
+ const InputRenderer = ({ node }) => {
95
+ const { TextInput } = getRN();
96
+ const dispatch = useLattixAction();
97
+ const style = useNodeStyle(node);
98
+ const placeholder = node.props.placeholder;
99
+ const handleChangeText = (text) => {
100
+ const onChangeProp = node.props.onChange;
101
+ if (onChangeProp !== undefined && onChangeProp !== null) {
102
+ const action = typeof onChangeProp === "string"
103
+ ? normalizeAction(onChangeProp)
104
+ : onChangeProp;
105
+ dispatch({ ...action, payload: { ...action.payload, value: text } });
106
+ }
107
+ };
108
+ return (_jsx(TextInput, { testID: "lattix-input", placeholder: placeholder, onChangeText: handleChangeText, style: style }));
109
+ };
110
+ const BadgeRenderer = ({ node }) => {
111
+ const { View, Text } = getRN();
112
+ const style = useNodeStyle(node);
113
+ const label = node.props.label;
114
+ return (_jsx(View, { testID: "lattix-badge", style: style, children: _jsx(Text, { children: label ?? "" }) }));
115
+ };
116
+ const DividerRenderer = ({ node }) => {
117
+ const { View } = getRN();
118
+ const style = useNodeStyle(node);
119
+ return (_jsx(View, { testID: "lattix-divider", style: { height: 1, backgroundColor: "#e5e7eb", ...style } }));
120
+ };
121
+ const SpacerRenderer = ({ node }) => {
122
+ const { View } = getRN();
123
+ const style = useNodeStyle(node);
124
+ return _jsx(View, { testID: "lattix-spacer", style: { flex: 1, ...style } });
125
+ };
126
+ const ListRenderer = ({ node }) => {
127
+ const { View } = getRN();
128
+ const style = useNodeStyle(node);
129
+ return (_jsx(View, { testID: "lattix-list", accessibilityRole: "list", style: { flexDirection: "column", ...style }, children: node.children?.map((child, i) => (_jsx(View, { children: _jsx(RenderNodeNative, { node: child }) }, child.id ?? `${child.kind}-${i}`))) }));
130
+ };
131
+ /** Built-in node kind → renderer mapping. */
132
+ const NODE_RENDERERS = {
133
+ screen: ScreenRenderer,
134
+ stack: StackRenderer,
135
+ row: RowRenderer,
136
+ box: BoxRenderer,
137
+ text: TextRenderer,
138
+ image: ImageRenderer,
139
+ button: ButtonRenderer,
140
+ input: InputRenderer,
141
+ badge: BadgeRenderer,
142
+ divider: DividerRenderer,
143
+ spacer: SpacerRenderer,
144
+ list: ListRenderer,
145
+ };
146
+ /**
147
+ * Render a single semantic node by dispatching to the appropriate kind renderer.
148
+ * Unknown kinds render a diagnostic View with a testID.
149
+ */
150
+ export const RenderNodeNative = ({ node }) => {
151
+ const Renderer = NODE_RENDERERS[node.kind];
152
+ if (Renderer) {
153
+ return _jsx(Renderer, { node: node });
154
+ }
155
+ const { View, Text } = getRN();
156
+ return (_jsx(View, { testID: `lattix-unknown-${node.kind}`, children: _jsx(Text, { children: `[unsupported node kind: ${node.kind}]` }) }));
157
+ };
158
+ //# sourceMappingURL=render-node-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-node-native.js","sourceRoot":"","sources":["../src/render-node-native.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAkBjE;;;;GAIG;AACH,IAAI,GAOS,CAAC;AAEd,MAAM,KAAK,GAAG,GAA4B,EAAE;IAC1C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,yCAAyC;YACzC,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAsB,EAAQ,EAAE;IAC9D,GAAG,GAAG,UAAU,CAAC;AACnB,CAAC,CAAC;AAEF,gFAAgF;AAChF,MAAM,YAAY,GAAG,CAAC,IAAgB,EAA4C,EAAE;IAClF,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACnF,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrD,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;AAC9C,CAA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J,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import type { LattixTree } from "@lattix/core";
3
+ import type { TokenRegistry } from "@lattix/tokens";
4
+ import { type LattixActionHandler } from "./action-context.js";
5
+ /** Props for the top-level Lattix React Native renderer. */
6
+ export interface LattixNativeRendererProps {
7
+ /** The validated semantic tree to render. */
8
+ readonly tree: LattixTree;
9
+ /** Handler invoked when a semantic action fires (e.g. button onPress). */
10
+ readonly onAction?: LattixActionHandler;
11
+ /** Custom token registry for style resolution. Defaults to `defaultTokenRegistry`. */
12
+ readonly registry?: TokenRegistry;
13
+ }
14
+ /**
15
+ * Top-level React Native component that renders a Lattix semantic tree.
16
+ *
17
+ * Wraps the tree in action and registry context providers so that all
18
+ * descendant node renderers can resolve tokens and dispatch actions.
19
+ *
20
+ * ```tsx
21
+ * import { LattixNativeRenderer } from "@lattix/react-native";
22
+ * import { Screen } from "@lattix/dsl";
23
+ *
24
+ * const tree = Screen("Home", s => s.text("Hello")).toTree();
25
+ *
26
+ * function App() {
27
+ * return (
28
+ * <LattixNativeRenderer
29
+ * tree={tree}
30
+ * onAction={(action) => console.log("action:", action)}
31
+ * />
32
+ * );
33
+ * }
34
+ * ```
35
+ */
36
+ export declare const LattixNativeRenderer: React.FC<LattixNativeRendererProps>;
37
+ //# sourceMappingURL=renderer-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-native.d.ts","sourceRoot":"","sources":["../src/renderer-native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAI7B,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IACxC,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAwBpE,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { LattixActionContext, } from "./action-context.js";
3
+ import { LattixRegistryContext } from "./registry-context.js";
4
+ import { RenderNodeNative } from "./render-node-native.js";
5
+ /**
6
+ * Top-level React Native component that renders a Lattix semantic tree.
7
+ *
8
+ * Wraps the tree in action and registry context providers so that all
9
+ * descendant node renderers can resolve tokens and dispatch actions.
10
+ *
11
+ * ```tsx
12
+ * import { LattixNativeRenderer } from "@lattix/react-native";
13
+ * import { Screen } from "@lattix/dsl";
14
+ *
15
+ * const tree = Screen("Home", s => s.text("Hello")).toTree();
16
+ *
17
+ * function App() {
18
+ * return (
19
+ * <LattixNativeRenderer
20
+ * tree={tree}
21
+ * onAction={(action) => console.log("action:", action)}
22
+ * />
23
+ * );
24
+ * }
25
+ * ```
26
+ */
27
+ export const LattixNativeRenderer = ({ tree, onAction, registry, }) => {
28
+ const content = _jsx(RenderNodeNative, { node: tree.root });
29
+ const withAction = onAction ? (_jsx(LattixActionContext.Provider, { value: onAction, children: content })) : (content);
30
+ if (registry) {
31
+ return (_jsx(LattixRegistryContext.Provider, { value: registry, children: withAction }));
32
+ }
33
+ return withAction;
34
+ };
35
+ //# sourceMappingURL=renderer-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer-native.js","sourceRoot":"","sources":["../src/renderer-native.tsx"],"names":[],"mappings":";AAGA,OAAO,EACL,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CAAC,EACxE,IAAI,EACJ,QAAQ,EACR,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CAAC;IAEtD,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,CAC5B,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAC1C,OAAO,GACqB,CAChC,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CAAC;IAEF,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAC5C,UAAU,GACoB,CAClC,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { NormalizedLattixStyle, LattixStyle } from "@lattix/core";
2
+ import { type TokenRegistry } from "@lattix/tokens";
3
+ import type { RNStyle } from "./rn-types.js";
4
+ export interface ResolveNativeStyleOptions {
5
+ readonly registry?: TokenRegistry;
6
+ }
7
+ /**
8
+ * Resolve semantic styles into a React Native StyleSheet-compatible object.
9
+ *
10
+ * Uses `normalizedStyle` when available, falling back to `rawStyle` for
11
+ * properties not normalized at build time.
12
+ */
13
+ export declare const resolveStyleToNative: (normalizedStyle: NormalizedLattixStyle | undefined, options?: ResolveNativeStyleOptions, rawStyle?: LattixStyle) => RNStyle;
14
+ //# sourceMappingURL=resolve-style-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-style-native.d.ts","sourceRoot":"","sources":["../src/resolve-style-native.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAErB,WAAW,EAEZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AA0E7C,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;CACnC;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,iBAAiB,qBAAqB,GAAG,SAAS,EAClD,UAAS,yBAA8B,EACvC,WAAW,WAAW,KACrB,OAiCF,CAAC"}
@@ -0,0 +1,101 @@
1
+ import { isTokenReference } from "@lattix/core";
2
+ import { resolveToken } from "@lattix/tokens";
3
+ /** React Native style property names mapped from semantic style property names. */
4
+ const RN_PROPERTY_MAP = {
5
+ color: "color",
6
+ background: "backgroundColor",
7
+ backgroundColor: "backgroundColor",
8
+ padding: "padding",
9
+ paddingTop: "paddingTop",
10
+ paddingBottom: "paddingBottom",
11
+ paddingLeft: "paddingLeft",
12
+ paddingRight: "paddingRight",
13
+ margin: "margin",
14
+ marginTop: "marginTop",
15
+ marginBottom: "marginBottom",
16
+ marginLeft: "marginLeft",
17
+ marginRight: "marginRight",
18
+ gap: "gap",
19
+ borderRadius: "borderRadius",
20
+ borderWidth: "borderWidth",
21
+ borderColor: "borderColor",
22
+ fontSize: "fontSize",
23
+ fontWeight: "fontWeight",
24
+ width: "width",
25
+ height: "height",
26
+ flex: "flex",
27
+ flexDirection: "flexDirection",
28
+ alignItems: "alignItems",
29
+ justifyContent: "justifyContent",
30
+ lineHeight: "lineHeight",
31
+ textAlign: "textAlign",
32
+ };
33
+ /** Convert a resolved value to a React Native-compatible value. */
34
+ const toNativeValue = (value) => {
35
+ if (typeof value === "number") {
36
+ return value;
37
+ }
38
+ if (typeof value === "string") {
39
+ const num = Number(value);
40
+ if (!Number.isNaN(num) && /^\d+(\.\d+)?$/.test(value)) {
41
+ return num;
42
+ }
43
+ }
44
+ return String(value);
45
+ };
46
+ /** Resolve a single normalized style entry to a native value. */
47
+ const resolveEntry = (entry, registry) => {
48
+ if (entry.kind === "literal") {
49
+ return toNativeValue(entry.value);
50
+ }
51
+ const resolved = resolveToken(entry.ref, registry);
52
+ if (resolved === undefined) {
53
+ return undefined;
54
+ }
55
+ return toNativeValue(resolved);
56
+ };
57
+ /** Resolve a raw style value using the registry. */
58
+ const resolveRawValue = (value, registry) => {
59
+ if (typeof value === "string" && isTokenReference(value)) {
60
+ const resolved = resolveToken(value, registry);
61
+ return resolved !== undefined ? toNativeValue(resolved) : undefined;
62
+ }
63
+ return toNativeValue(value);
64
+ };
65
+ /**
66
+ * Resolve semantic styles into a React Native StyleSheet-compatible object.
67
+ *
68
+ * Uses `normalizedStyle` when available, falling back to `rawStyle` for
69
+ * properties not normalized at build time.
70
+ */
71
+ export const resolveStyleToNative = (normalizedStyle, options = {}, rawStyle) => {
72
+ if (!normalizedStyle && !rawStyle) {
73
+ return {};
74
+ }
75
+ const style = {};
76
+ const seen = new Set();
77
+ if (normalizedStyle) {
78
+ for (const [prop, entry] of Object.entries(normalizedStyle)) {
79
+ seen.add(prop);
80
+ const rnKey = RN_PROPERTY_MAP[prop] ?? prop;
81
+ const value = resolveEntry(entry, options.registry);
82
+ if (value !== undefined) {
83
+ style[rnKey] = value;
84
+ }
85
+ }
86
+ }
87
+ if (rawStyle) {
88
+ for (const [prop, value] of Object.entries(rawStyle)) {
89
+ if (seen.has(prop)) {
90
+ continue;
91
+ }
92
+ const rnKey = RN_PROPERTY_MAP[prop] ?? prop;
93
+ const resolved = resolveRawValue(value, options.registry);
94
+ if (resolved !== undefined) {
95
+ style[rnKey] = resolved;
96
+ }
97
+ }
98
+ }
99
+ return style;
100
+ };
101
+ //# sourceMappingURL=resolve-style-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-style-native.js","sourceRoot":"","sources":["../src/resolve-style-native.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAA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eAAe,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACf,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;YAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrD,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnB,SAAS;YACX,CAAC;YACD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;YAC5C,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC1D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,KAAK,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAgB,CAAC;AAC1B,CAAC,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Minimal React Native type surface used by the renderer.
3
+ *
4
+ * At runtime the real `react-native` module is imported dynamically.
5
+ * These types exist so the package compiles without react-native installed
6
+ * as a direct dependency (it is a peerDependency).
7
+ */
8
+ import type React from "react";
9
+ /** Subset of RN ViewStyle used by the renderer. */
10
+ export interface RNViewStyle {
11
+ readonly flex?: number;
12
+ readonly flexGrow?: number;
13
+ readonly flexShrink?: number;
14
+ readonly flexDirection?: "row" | "column";
15
+ readonly alignItems?: "flex-start" | "flex-end" | "center" | "stretch" | "baseline";
16
+ readonly justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
17
+ readonly gap?: number;
18
+ readonly padding?: number;
19
+ readonly paddingTop?: number;
20
+ readonly paddingBottom?: number;
21
+ readonly paddingLeft?: number;
22
+ readonly paddingRight?: number;
23
+ readonly margin?: number;
24
+ readonly marginTop?: number;
25
+ readonly marginBottom?: number;
26
+ readonly marginLeft?: number;
27
+ readonly marginRight?: number;
28
+ readonly backgroundColor?: string;
29
+ readonly borderRadius?: number;
30
+ readonly borderWidth?: number;
31
+ readonly borderColor?: string;
32
+ readonly width?: number | string;
33
+ readonly height?: number | string;
34
+ readonly minHeight?: number | string;
35
+ readonly overflow?: "visible" | "hidden" | "scroll";
36
+ }
37
+ /** Subset of RN TextStyle used by the renderer. */
38
+ export interface RNTextStyle extends RNViewStyle {
39
+ readonly color?: string;
40
+ readonly fontSize?: number;
41
+ readonly fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900";
42
+ readonly textAlign?: "auto" | "left" | "right" | "center" | "justify";
43
+ readonly lineHeight?: number;
44
+ }
45
+ /** Subset of RN ImageStyle used by the renderer. */
46
+ export interface RNImageStyle extends RNViewStyle {
47
+ readonly resizeMode?: "cover" | "contain" | "stretch" | "center";
48
+ }
49
+ /** Union of all RN style types the renderer produces. */
50
+ export type RNStyle = RNViewStyle | RNTextStyle | RNImageStyle;
51
+ /** Props accepted by RN View component. */
52
+ export interface RNViewProps {
53
+ readonly style?: RNViewStyle;
54
+ readonly testID?: string;
55
+ readonly accessibilityRole?: string;
56
+ readonly children?: React.ReactNode;
57
+ }
58
+ /** Props accepted by RN Text component. */
59
+ export interface RNTextProps {
60
+ readonly style?: RNTextStyle;
61
+ readonly testID?: string;
62
+ readonly children?: React.ReactNode;
63
+ }
64
+ /** Props accepted by RN Image component. */
65
+ export interface RNImageProps {
66
+ readonly style?: RNImageStyle;
67
+ readonly testID?: string;
68
+ readonly source: {
69
+ readonly uri: string;
70
+ } | number;
71
+ readonly accessibilityLabel?: string;
72
+ }
73
+ /** Props accepted by RN TextInput component. */
74
+ export interface RNTextInputProps {
75
+ readonly style?: RNTextStyle;
76
+ readonly testID?: string;
77
+ readonly placeholder?: string;
78
+ readonly onChangeText?: (text: string) => void;
79
+ }
80
+ /** Props accepted by RN Pressable component. */
81
+ export interface RNPressableProps {
82
+ readonly style?: RNViewStyle;
83
+ readonly testID?: string;
84
+ readonly onPress?: () => void;
85
+ readonly accessibilityRole?: string;
86
+ readonly children?: React.ReactNode;
87
+ }
88
+ /** Props accepted by RN ScrollView component. */
89
+ export interface RNScrollViewProps {
90
+ readonly style?: RNViewStyle;
91
+ readonly contentContainerStyle?: RNViewStyle;
92
+ readonly testID?: string;
93
+ readonly children?: React.ReactNode;
94
+ }
95
+ //# sourceMappingURL=rn-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rn-types.d.ts","sourceRoot":"","sources":["../src/rn-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IACpF,QAAQ,CAAC,cAAc,CAAC,EACpB,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,eAAe,GACf,cAAc,GACd,cAAc,CAAC;IACnB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE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AAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACrC;AAED,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,qBAAqB,CAAC,EAAE,WAAW,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACrC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rn-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rn-types.js","sourceRoot":"","sources":["../src/rn-types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@lattix/react-native",
3
+ "version": "0.1.0",
4
+ "description": "React Native renderer for Lattix semantic trees",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.json",
20
+ "clean": "rm -rf dist *.tsbuildinfo",
21
+ "test": "vitest run",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit"
23
+ },
24
+ "license": "MIT",
25
+ "dependencies": {
26
+ "@lattix/core": "0.1.0",
27
+ "@lattix/motion": "0.1.0",
28
+ "@lattix/tokens": "0.1.0"
29
+ },
30
+ "devDependencies": {
31
+ "@lattix/diagnostics": "0.1.0",
32
+ "@lattix/dsl": "0.1.0",
33
+ "@types/react": "^18.2.0",
34
+ "react": "^18.3.1",
35
+ "typescript": "^5.7.3",
36
+ "vitest": "^3.0.5"
37
+ },
38
+ "peerDependencies": {
39
+ "react": ">=18",
40
+ "react-native": ">=0.71"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "react-native": {
44
+ "optional": true
45
+ }
46
+ }
47
+ }