@codyswann/lisa 2.111.0 → 2.113.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdk/package-lisa/package.lisa.json +1 -0
- package/dist/core/lisa.d.ts +42 -0
- package/dist/core/lisa.d.ts.map +1 -1
- package/dist/core/lisa.js +67 -0
- package/dist/core/lisa.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +1 -0
- package/nestjs/package-lisa/package.lisa.json +1 -0
- package/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.mcp.json +3 -3
- package/plugins/lisa-expo/THIRD-PARTY-NOTICES.md +57 -0
- package/plugins/lisa-expo/skills/add-app-clip/SKILL.md +280 -0
- package/plugins/lisa-expo/skills/add-app-clip/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/add-app-clip/references/native-module.md +96 -0
- package/plugins/lisa-expo/skills/building-native-ui/SKILL.md +321 -0
- package/plugins/lisa-expo/skills/building-native-ui/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/animations.md +220 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/controls.md +272 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/form-sheet.md +253 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/gradients.md +106 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/icons.md +213 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/media.md +198 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/route-structure.md +229 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/search.md +248 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/storage.md +121 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/tabs.md +433 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/toolbar-and-headers.md +284 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/visual-effects.md +197 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/webgpu-three.md +605 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/zoom-transitions.md +158 -0
- package/plugins/lisa-expo/skills/eas-update-insights/SKILL.md +228 -0
- package/plugins/lisa-expo/skills/eas-update-insights/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/eas-update-insights/references/channel-insights-schema.md +47 -0
- package/plugins/lisa-expo/skills/eas-update-insights/references/update-insights-schema.md +69 -0
- package/plugins/lisa-expo/skills/expo-api-routes/SKILL.md +369 -0
- package/plugins/lisa-expo/skills/expo-api-routes/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-brownfield/SKILL.md +54 -0
- package/plugins/lisa-expo/skills/expo-brownfield/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-brownfield/references/brownfield-integrated.md +526 -0
- package/plugins/lisa-expo/skills/expo-brownfield/references/brownfield-isolated.md +402 -0
- package/plugins/lisa-expo/skills/expo-brownfield/references/comparison.md +63 -0
- package/plugins/lisa-expo/skills/expo-brownfield/references/troubleshooting.md +88 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/SKILL.md +92 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/scripts/fetch.js +113 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/scripts/package.json +11 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/scripts/validate.js +85 -0
- package/plugins/lisa-expo/skills/expo-deployment/SKILL.md +190 -0
- package/plugins/lisa-expo/skills/expo-deployment/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/app-store-metadata.md +479 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/ios-app-store.md +355 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/play-store.md +246 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/testflight.md +58 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/workflows.md +200 -0
- package/plugins/lisa-expo/skills/expo-dev-client/SKILL.md +164 -0
- package/plugins/lisa-expo/skills/expo-dev-client/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-module/SKILL.md +141 -0
- package/plugins/lisa-expo/skills/expo-module/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-module/references/config-plugin.md +90 -0
- package/plugins/lisa-expo/skills/expo-module/references/create-expo-module.md +206 -0
- package/plugins/lisa-expo/skills/expo-module/references/lifecycle.md +127 -0
- package/plugins/lisa-expo/skills/expo-module/references/module-config.md +48 -0
- package/plugins/lisa-expo/skills/expo-module/references/native-module.md +286 -0
- package/plugins/lisa-expo/skills/expo-module/references/native-view.md +171 -0
- package/plugins/lisa-expo/skills/expo-tailwind-setup/SKILL.md +480 -0
- package/plugins/lisa-expo/skills/expo-tailwind-setup/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-ui-jetpack-compose/SKILL.md +40 -0
- package/plugins/lisa-expo/skills/expo-ui-jetpack-compose/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-ui-swift-ui/SKILL.md +39 -0
- package/plugins/lisa-expo/skills/expo-ui-swift-ui/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/native-data-fetching/SKILL.md +507 -0
- package/plugins/lisa-expo/skills/native-data-fetching/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/native-data-fetching/references/expo-router-loaders.md +344 -0
- package/plugins/lisa-expo/skills/upgrading-expo/SKILL.md +134 -0
- package/plugins/lisa-expo/skills/upgrading-expo/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/expo-av-to-audio.md +132 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/expo-av-to-video.md +160 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/native-tabs.md +124 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/new-architecture.md +79 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/react-19.md +79 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/react-compiler.md +59 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/react-navigation-to-expo-router.md +61 -0
- package/plugins/lisa-expo/skills/use-dom/SKILL.md +417 -0
- package/plugins/lisa-expo/skills/use-dom/agents/openai.yaml +4 -0
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/src/expo/.mcp.json +3 -3
- package/plugins/src/expo/THIRD-PARTY-NOTICES.md +57 -0
- package/plugins/src/expo/skills/add-app-clip/SKILL.md +280 -0
- package/plugins/src/expo/skills/add-app-clip/references/native-module.md +96 -0
- package/plugins/src/expo/skills/building-native-ui/SKILL.md +321 -0
- package/plugins/src/expo/skills/building-native-ui/references/animations.md +220 -0
- package/plugins/src/expo/skills/building-native-ui/references/controls.md +272 -0
- package/plugins/src/expo/skills/building-native-ui/references/form-sheet.md +253 -0
- package/plugins/src/expo/skills/building-native-ui/references/gradients.md +106 -0
- package/plugins/src/expo/skills/building-native-ui/references/icons.md +213 -0
- package/plugins/src/expo/skills/building-native-ui/references/media.md +198 -0
- package/plugins/src/expo/skills/building-native-ui/references/route-structure.md +229 -0
- package/plugins/src/expo/skills/building-native-ui/references/search.md +248 -0
- package/plugins/src/expo/skills/building-native-ui/references/storage.md +121 -0
- package/plugins/src/expo/skills/building-native-ui/references/tabs.md +433 -0
- package/plugins/src/expo/skills/building-native-ui/references/toolbar-and-headers.md +284 -0
- package/plugins/src/expo/skills/building-native-ui/references/visual-effects.md +197 -0
- package/plugins/src/expo/skills/building-native-ui/references/webgpu-three.md +605 -0
- package/plugins/src/expo/skills/building-native-ui/references/zoom-transitions.md +158 -0
- package/plugins/src/expo/skills/eas-update-insights/SKILL.md +228 -0
- package/plugins/src/expo/skills/eas-update-insights/references/channel-insights-schema.md +47 -0
- package/plugins/src/expo/skills/eas-update-insights/references/update-insights-schema.md +69 -0
- package/plugins/src/expo/skills/expo-api-routes/SKILL.md +369 -0
- package/plugins/src/expo/skills/expo-brownfield/SKILL.md +54 -0
- package/plugins/src/expo/skills/expo-brownfield/references/brownfield-integrated.md +526 -0
- package/plugins/src/expo/skills/expo-brownfield/references/brownfield-isolated.md +402 -0
- package/plugins/src/expo/skills/expo-brownfield/references/comparison.md +63 -0
- package/plugins/src/expo/skills/expo-brownfield/references/troubleshooting.md +88 -0
- package/plugins/src/expo/skills/expo-cicd-workflows/SKILL.md +92 -0
- package/plugins/src/expo/skills/expo-cicd-workflows/scripts/fetch.js +113 -0
- package/plugins/src/expo/skills/expo-cicd-workflows/scripts/package.json +11 -0
- package/plugins/src/expo/skills/expo-cicd-workflows/scripts/validate.js +85 -0
- package/plugins/src/expo/skills/expo-deployment/SKILL.md +190 -0
- package/plugins/src/expo/skills/expo-deployment/references/app-store-metadata.md +479 -0
- package/plugins/src/expo/skills/expo-deployment/references/ios-app-store.md +355 -0
- package/plugins/src/expo/skills/expo-deployment/references/play-store.md +246 -0
- package/plugins/src/expo/skills/expo-deployment/references/testflight.md +58 -0
- package/plugins/src/expo/skills/expo-deployment/references/workflows.md +200 -0
- package/plugins/src/expo/skills/expo-dev-client/SKILL.md +164 -0
- package/plugins/src/expo/skills/expo-module/SKILL.md +141 -0
- package/plugins/src/expo/skills/expo-module/references/config-plugin.md +90 -0
- package/plugins/src/expo/skills/expo-module/references/create-expo-module.md +206 -0
- package/plugins/src/expo/skills/expo-module/references/lifecycle.md +127 -0
- package/plugins/src/expo/skills/expo-module/references/module-config.md +48 -0
- package/plugins/src/expo/skills/expo-module/references/native-module.md +286 -0
- package/plugins/src/expo/skills/expo-module/references/native-view.md +171 -0
- package/plugins/src/expo/skills/expo-tailwind-setup/SKILL.md +480 -0
- package/plugins/src/expo/skills/expo-ui-jetpack-compose/SKILL.md +40 -0
- package/plugins/src/expo/skills/expo-ui-swift-ui/SKILL.md +39 -0
- package/plugins/src/expo/skills/native-data-fetching/SKILL.md +507 -0
- package/plugins/src/expo/skills/native-data-fetching/references/expo-router-loaders.md +344 -0
- package/plugins/src/expo/skills/upgrading-expo/SKILL.md +134 -0
- package/plugins/src/expo/skills/upgrading-expo/references/expo-av-to-audio.md +132 -0
- package/plugins/src/expo/skills/upgrading-expo/references/expo-av-to-video.md +160 -0
- package/plugins/src/expo/skills/upgrading-expo/references/native-tabs.md +124 -0
- package/plugins/src/expo/skills/upgrading-expo/references/new-architecture.md +79 -0
- package/plugins/src/expo/skills/upgrading-expo/references/react-19.md +79 -0
- package/plugins/src/expo/skills/upgrading-expo/references/react-compiler.md +59 -0
- package/plugins/src/expo/skills/upgrading-expo/references/react-navigation-to-expo-router.md +61 -0
- package/plugins/src/expo/skills/use-dom/SKILL.md +417 -0
- package/scripts/generate-codex-plugin-artifacts.mjs +7 -2
- package/scripts/install-claude-plugins.sh +23 -7
- package/typescript/package-lisa/package.lisa.json +2 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: use-dom
|
|
3
|
+
description: Use Expo DOM components to run web code in a webview on native and as-is on web. Migrate web code to native incrementally.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
license: MIT
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## What are DOM Components?
|
|
9
|
+
|
|
10
|
+
DOM components allow web code to run verbatim in a webview on native platforms while rendering as-is on web. This enables using web-only libraries like `recharts`, `react-syntax-highlighter`, or any React web library in your Expo app without modification.
|
|
11
|
+
|
|
12
|
+
## When to Use DOM Components
|
|
13
|
+
|
|
14
|
+
Use DOM components when you need:
|
|
15
|
+
|
|
16
|
+
- **Web-only libraries** — Charts (recharts, chart.js), syntax highlighters, rich text editors, or any library that depends on DOM APIs
|
|
17
|
+
- **Migrating web code** — Bring existing React web components to native without rewriting
|
|
18
|
+
- **Complex HTML/CSS layouts** — When CSS features aren't available in React Native
|
|
19
|
+
- **iframes or embeds** — Embedding external content that requires a browser context
|
|
20
|
+
- **Canvas or WebGL** — Web graphics APIs not available natively
|
|
21
|
+
|
|
22
|
+
## When NOT to Use DOM Components
|
|
23
|
+
|
|
24
|
+
Avoid DOM components when:
|
|
25
|
+
|
|
26
|
+
- **Native performance is critical** — Webviews add overhead
|
|
27
|
+
- **Simple UI** — React Native components are more efficient for basic layouts
|
|
28
|
+
- **Deep native integration** — Use local modules instead for native APIs
|
|
29
|
+
- **Layout routes** — `_layout` files cannot be DOM components
|
|
30
|
+
|
|
31
|
+
## Basic DOM Component
|
|
32
|
+
|
|
33
|
+
Create a new file with the `'use dom';` directive at the top:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// components/WebChart.tsx
|
|
37
|
+
"use dom";
|
|
38
|
+
|
|
39
|
+
export default function WebChart({
|
|
40
|
+
data,
|
|
41
|
+
}: {
|
|
42
|
+
data: number[];
|
|
43
|
+
dom: import("expo/dom").DOMProps;
|
|
44
|
+
}) {
|
|
45
|
+
return (
|
|
46
|
+
<div style={{ padding: 20 }}>
|
|
47
|
+
<h2>Chart Data</h2>
|
|
48
|
+
<ul>
|
|
49
|
+
{data.map((value, i) => (
|
|
50
|
+
<li key={i}>{value}</li>
|
|
51
|
+
))}
|
|
52
|
+
</ul>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Rules for DOM Components
|
|
59
|
+
|
|
60
|
+
1. **Must have `'use dom';` directive** at the top of the file
|
|
61
|
+
2. **Single default export** — One React component per file
|
|
62
|
+
3. **Own file** — Cannot be defined inline or combined with native components
|
|
63
|
+
4. **Serializable props only** — Strings, numbers, booleans, arrays, plain objects
|
|
64
|
+
5. **Include CSS in the component file** — DOM components run in isolated context
|
|
65
|
+
|
|
66
|
+
## The `dom` Prop
|
|
67
|
+
|
|
68
|
+
Every DOM component receives a special `dom` prop for webview configuration. Always type it in your props:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
"use dom";
|
|
72
|
+
|
|
73
|
+
interface Props {
|
|
74
|
+
content: string;
|
|
75
|
+
dom: import("expo/dom").DOMProps;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default function MyComponent({ content }: Props) {
|
|
79
|
+
return <div>{content}</div>;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Common `dom` Prop Options
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
// Disable body scrolling
|
|
87
|
+
<DOMComponent dom={{ scrollEnabled: false }} />
|
|
88
|
+
|
|
89
|
+
// Flow under the notch (disable safe area insets)
|
|
90
|
+
<DOMComponent dom={{ contentInsetAdjustmentBehavior: "never" }} />
|
|
91
|
+
|
|
92
|
+
// Control size manually
|
|
93
|
+
<DOMComponent dom={{ style: { width: 300, height: 400 } }} />
|
|
94
|
+
|
|
95
|
+
// Combine options
|
|
96
|
+
<DOMComponent
|
|
97
|
+
dom={{
|
|
98
|
+
scrollEnabled: false,
|
|
99
|
+
contentInsetAdjustmentBehavior: "never",
|
|
100
|
+
style: { width: '100%', height: 500 }
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Exposing Native Actions to the Webview
|
|
106
|
+
|
|
107
|
+
Pass async functions as props to expose native functionality to the DOM component:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
// app/index.tsx (native)
|
|
111
|
+
import { Alert } from "react-native";
|
|
112
|
+
import DOMComponent from "@/components/dom-component";
|
|
113
|
+
|
|
114
|
+
export default function Screen() {
|
|
115
|
+
return (
|
|
116
|
+
<DOMComponent
|
|
117
|
+
showAlert={async (message: string) => {
|
|
118
|
+
Alert.alert("From Web", message);
|
|
119
|
+
}}
|
|
120
|
+
saveData={async (data: { name: string; value: number }) => {
|
|
121
|
+
// Save to native storage, database, etc.
|
|
122
|
+
console.log("Saving:", data);
|
|
123
|
+
return { success: true };
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
// components/dom-component.tsx
|
|
132
|
+
"use dom";
|
|
133
|
+
|
|
134
|
+
interface Props {
|
|
135
|
+
showAlert: (message: string) => Promise<void>;
|
|
136
|
+
saveData: (data: {
|
|
137
|
+
name: string;
|
|
138
|
+
value: number;
|
|
139
|
+
}) => Promise<{ success: boolean }>;
|
|
140
|
+
dom?: import("expo/dom").DOMProps;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export default function DOMComponent({ showAlert, saveData }: Props) {
|
|
144
|
+
const handleClick = async () => {
|
|
145
|
+
await showAlert("Hello from the webview!");
|
|
146
|
+
const result = await saveData({ name: "test", value: 42 });
|
|
147
|
+
console.log("Save result:", result);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return <button onClick={handleClick}>Trigger Native Action</button>;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Using Web Libraries
|
|
155
|
+
|
|
156
|
+
DOM components can use any web library:
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
// components/syntax-highlight.tsx
|
|
160
|
+
"use dom";
|
|
161
|
+
|
|
162
|
+
import SyntaxHighlighter from "react-syntax-highlighter";
|
|
163
|
+
import { docco } from "react-syntax-highlighter/dist/esm/styles/hljs";
|
|
164
|
+
|
|
165
|
+
interface Props {
|
|
166
|
+
code: string;
|
|
167
|
+
language: string;
|
|
168
|
+
dom?: import("expo/dom").DOMProps;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export default function SyntaxHighlight({ code, language }: Props) {
|
|
172
|
+
return (
|
|
173
|
+
<SyntaxHighlighter language={language} style={docco}>
|
|
174
|
+
{code}
|
|
175
|
+
</SyntaxHighlighter>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
// components/chart.tsx
|
|
182
|
+
"use dom";
|
|
183
|
+
|
|
184
|
+
import {
|
|
185
|
+
LineChart,
|
|
186
|
+
Line,
|
|
187
|
+
XAxis,
|
|
188
|
+
YAxis,
|
|
189
|
+
CartesianGrid,
|
|
190
|
+
Tooltip,
|
|
191
|
+
} from "recharts";
|
|
192
|
+
|
|
193
|
+
interface Props {
|
|
194
|
+
data: Array<{ name: string; value: number }>;
|
|
195
|
+
dom: import("expo/dom").DOMProps;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export default function Chart({ data }: Props) {
|
|
199
|
+
return (
|
|
200
|
+
<LineChart width={400} height={300} data={data}>
|
|
201
|
+
<CartesianGrid strokeDasharray="3 3" />
|
|
202
|
+
<XAxis dataKey="name" />
|
|
203
|
+
<YAxis />
|
|
204
|
+
<Tooltip />
|
|
205
|
+
<Line type="monotone" dataKey="value" stroke="#8884d8" />
|
|
206
|
+
</LineChart>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## CSS in DOM Components
|
|
212
|
+
|
|
213
|
+
CSS imports must be in the DOM component file since they run in isolated context:
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
// components/styled-component.tsx
|
|
217
|
+
"use dom";
|
|
218
|
+
|
|
219
|
+
import "@/styles.css"; // CSS file in same directory
|
|
220
|
+
|
|
221
|
+
export default function StyledComponent({
|
|
222
|
+
dom,
|
|
223
|
+
}: {
|
|
224
|
+
dom: import("expo/dom").DOMProps;
|
|
225
|
+
}) {
|
|
226
|
+
return (
|
|
227
|
+
<div className="container">
|
|
228
|
+
<h1 className="title">Styled Content</h1>
|
|
229
|
+
</div>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Or use inline styles / CSS-in-JS:
|
|
235
|
+
|
|
236
|
+
```tsx
|
|
237
|
+
"use dom";
|
|
238
|
+
|
|
239
|
+
const styles = {
|
|
240
|
+
container: {
|
|
241
|
+
padding: 20,
|
|
242
|
+
backgroundColor: "#f0f0f0",
|
|
243
|
+
},
|
|
244
|
+
title: {
|
|
245
|
+
fontSize: 24,
|
|
246
|
+
color: "#333",
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export default function StyledComponent({
|
|
251
|
+
dom,
|
|
252
|
+
}: {
|
|
253
|
+
dom: import("expo/dom").DOMProps;
|
|
254
|
+
}) {
|
|
255
|
+
return (
|
|
256
|
+
<div style={styles.container}>
|
|
257
|
+
<h1 style={styles.title}>Styled Content</h1>
|
|
258
|
+
</div>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Expo Router in DOM Components
|
|
264
|
+
|
|
265
|
+
The expo-router `<Link />` component and router API work inside DOM components:
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
"use dom";
|
|
269
|
+
|
|
270
|
+
import { Link, useRouter } from "expo-router";
|
|
271
|
+
|
|
272
|
+
export default function Navigation({
|
|
273
|
+
dom,
|
|
274
|
+
}: {
|
|
275
|
+
dom: import("expo/dom").DOMProps;
|
|
276
|
+
}) {
|
|
277
|
+
const router = useRouter();
|
|
278
|
+
|
|
279
|
+
return (
|
|
280
|
+
<nav>
|
|
281
|
+
<Link href="/about">About</Link>
|
|
282
|
+
<button onClick={() => router.push("/settings")}>Settings</button>
|
|
283
|
+
</nav>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Router APIs That Require Props
|
|
289
|
+
|
|
290
|
+
These hooks don't work directly in DOM components because they need synchronous access to native routing state:
|
|
291
|
+
|
|
292
|
+
- `useLocalSearchParams()`
|
|
293
|
+
- `useGlobalSearchParams()`
|
|
294
|
+
- `usePathname()`
|
|
295
|
+
- `useSegments()`
|
|
296
|
+
- `useRootNavigation()`
|
|
297
|
+
- `useRootNavigationState()`
|
|
298
|
+
|
|
299
|
+
**Solution:** Read these values in the native parent and pass as props:
|
|
300
|
+
|
|
301
|
+
```tsx
|
|
302
|
+
// app/[id].tsx (native)
|
|
303
|
+
import { useLocalSearchParams, usePathname } from "expo-router";
|
|
304
|
+
import DOMComponent from "@/components/dom-component";
|
|
305
|
+
|
|
306
|
+
export default function Screen() {
|
|
307
|
+
const { id } = useLocalSearchParams();
|
|
308
|
+
const pathname = usePathname();
|
|
309
|
+
|
|
310
|
+
return <DOMComponent id={id as string} pathname={pathname} />;
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
// components/dom-component.tsx
|
|
316
|
+
"use dom";
|
|
317
|
+
|
|
318
|
+
interface Props {
|
|
319
|
+
id: string;
|
|
320
|
+
pathname: string;
|
|
321
|
+
dom?: import("expo/dom").DOMProps;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export default function DOMComponent({ id, pathname }: Props) {
|
|
325
|
+
return (
|
|
326
|
+
<div>
|
|
327
|
+
<p>Current ID: {id}</p>
|
|
328
|
+
<p>Current Path: {pathname}</p>
|
|
329
|
+
</div>
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Detecting DOM Environment
|
|
335
|
+
|
|
336
|
+
Check if code is running in a DOM component:
|
|
337
|
+
|
|
338
|
+
```tsx
|
|
339
|
+
"use dom";
|
|
340
|
+
|
|
341
|
+
import { IS_DOM } from "expo/dom";
|
|
342
|
+
|
|
343
|
+
export default function Component({
|
|
344
|
+
dom,
|
|
345
|
+
}: {
|
|
346
|
+
dom?: import("expo/dom").DOMProps;
|
|
347
|
+
}) {
|
|
348
|
+
return <div>{IS_DOM ? "Running in DOM component" : "Running natively"}</div>;
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Assets
|
|
353
|
+
|
|
354
|
+
Prefer requiring assets instead of using the public directory:
|
|
355
|
+
|
|
356
|
+
```tsx
|
|
357
|
+
"use dom";
|
|
358
|
+
|
|
359
|
+
// Good - bundled with the component
|
|
360
|
+
const logo = require("../assets/logo.png");
|
|
361
|
+
|
|
362
|
+
export default function Component({
|
|
363
|
+
dom,
|
|
364
|
+
}: {
|
|
365
|
+
dom: import("expo/dom").DOMProps;
|
|
366
|
+
}) {
|
|
367
|
+
return <img src={logo} alt="Logo" />;
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Usage from Native Components
|
|
372
|
+
|
|
373
|
+
Import and use DOM components like regular components:
|
|
374
|
+
|
|
375
|
+
```tsx
|
|
376
|
+
// app/index.tsx
|
|
377
|
+
import { View, Text } from "react-native";
|
|
378
|
+
import WebChart from "@/components/web-chart";
|
|
379
|
+
import CodeBlock from "@/components/code-block";
|
|
380
|
+
|
|
381
|
+
export default function HomeScreen() {
|
|
382
|
+
return (
|
|
383
|
+
<View style={{ flex: 1 }}>
|
|
384
|
+
<Text>Native content above</Text>
|
|
385
|
+
|
|
386
|
+
<WebChart data={[10, 20, 30, 40, 50]} dom={{ style: { height: 300 } }} />
|
|
387
|
+
|
|
388
|
+
<CodeBlock
|
|
389
|
+
code="const x = 1;"
|
|
390
|
+
language="javascript"
|
|
391
|
+
dom={{ scrollEnabled: true }}
|
|
392
|
+
/>
|
|
393
|
+
|
|
394
|
+
<Text>Native content below</Text>
|
|
395
|
+
</View>
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Platform Behavior
|
|
401
|
+
|
|
402
|
+
| Platform | Behavior |
|
|
403
|
+
| -------- | ----------------------------------- |
|
|
404
|
+
| iOS | Rendered in WKWebView |
|
|
405
|
+
| Android | Rendered in WebView |
|
|
406
|
+
| Web | Rendered as-is (no webview wrapper) |
|
|
407
|
+
|
|
408
|
+
On web, the `dom` prop is ignored since no webview is needed.
|
|
409
|
+
|
|
410
|
+
## Tips
|
|
411
|
+
|
|
412
|
+
- DOM components hot reload during development
|
|
413
|
+
- Keep DOM components focused — don't put entire screens in webviews
|
|
414
|
+
- Use native components for navigation chrome, DOM components for specialized content
|
|
415
|
+
- Test on all platforms — web rendering may differ slightly from native webviews
|
|
416
|
+
- Large DOM components may impact performance — profile if needed
|
|
417
|
+
- The webview has its own JavaScript context — cannot directly share state with native
|
|
@@ -284,12 +284,17 @@ function summarizeDescription(description) {
|
|
|
284
284
|
*/
|
|
285
285
|
export function deriveSkillInterface(frontmatter, skillName) {
|
|
286
286
|
const name = frontmatter?.name?.trim() || skillName;
|
|
287
|
+
// Codex invokes skills by their canonical kebab `$<slug>` token, which is the
|
|
288
|
+
// skill directory name — NOT the (possibly humanized) frontmatter `name`. Some
|
|
289
|
+
// vendored skills (e.g. Expo's) set `name:` to a Title Cased label, which would
|
|
290
|
+
// otherwise yield an invalid handle like `$Expo UI Jetpack Compose`.
|
|
291
|
+
const token = skillName;
|
|
287
292
|
const description = frontmatter?.description?.trim() || "";
|
|
288
293
|
const shortDescription = summarizeDescription(description);
|
|
289
294
|
const starter =
|
|
290
295
|
shortDescription === ""
|
|
291
|
-
? `Use $${
|
|
292
|
-
: `Use $${
|
|
296
|
+
? `Use $${token}`
|
|
297
|
+
: `Use $${token}: ${shortDescription}.`;
|
|
293
298
|
return {
|
|
294
299
|
display_name: humanizeName(name),
|
|
295
300
|
short_description: shortDescription,
|
|
@@ -16,13 +16,29 @@ if [ "$PACKAGE_NAME" = "@codyswann/lisa" ]; then exit 0; fi
|
|
|
16
16
|
|
|
17
17
|
cd "$PROJECT_ROOT"
|
|
18
18
|
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
# the
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
19
|
+
# Apply Lisa templates non-interactively (init when missing, update when present),
|
|
20
|
+
# EXCEPT in CI. --skip-git-check bypasses the dirty working directory check since
|
|
21
|
+
# package.json and the lockfile are always uncommitted during postinstall.
|
|
22
|
+
#
|
|
23
|
+
# CI skip: matches the established Lisa philosophy (see ensure-lisa-postinstall
|
|
24
|
+
# migration and tests/unit/config/postinstall-ci-guard.test.ts) — in CI the
|
|
25
|
+
# committed tree is the source of truth and the PR diff is the drift detector, so
|
|
26
|
+
# silently re-applying templates during `bun install --frozen-lockfile` would
|
|
27
|
+
# churn package.json/lockfile and mask drift. Local installs self-heal; CI does not.
|
|
28
|
+
#
|
|
29
|
+
# Crash safety (local path): pre-#318 this could leave a half-applied tree — the
|
|
30
|
+
# TypeScript phase wrote tsconfig.json/eslint.config.ts and a child stack
|
|
31
|
+
# (expo/cdk/nestjs) phase was expected to overwrite them; if the package manager
|
|
32
|
+
# killed the lifecycle process between those phases, the child stack was left with
|
|
33
|
+
# the TypeScript versions. The apply now pre-resolves copy-overwrite ownership so
|
|
34
|
+
# each path is written exactly once by its most-specific stack — there is no
|
|
35
|
+
# intermediate clobbered state to be interrupted in. See src/core/lisa.ts
|
|
36
|
+
# loadCopyOverwriteOwnership.
|
|
37
|
+
if [ -z "${CI:-}" ]; then
|
|
38
|
+
if ! node "$LISA_DIR/dist/index.js" --yes --skip-git-check "$PROJECT_ROOT"; then
|
|
39
|
+
echo "⚠️ Warning: Lisa template application failed. Migration may be incomplete." >&2
|
|
40
|
+
fi
|
|
41
|
+
fi
|
|
26
42
|
|
|
27
43
|
# Strip only hook entries that reference deleted .claude/hooks/*.sh scripts
|
|
28
44
|
# (hooks moved to plugin.json; file-path hooks would produce "No such file or directory" errors).
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"prepare": "node -e \"if (process.env.INIT_CWD && process.env.INIT_CWD.includes('.serverless')) { process.exit(0); }\" && husky install || true"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@codyswann/lisa": "^2.106.0",
|
|
21
22
|
"eslint-plugin-oxlint": "^1.62.0",
|
|
22
23
|
"oxlint": "^1.62.0",
|
|
23
24
|
"oxlint-tsgolint": "^0.22.1"
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"defaults": {
|
|
37
38
|
"scripts": {
|
|
38
39
|
"build": "tsc",
|
|
40
|
+
"postinstall": "[ -n \"$CI\" ] || node node_modules/@codyswann/lisa/dist/index.js --yes --skip-git-check . 2>/dev/null || true",
|
|
39
41
|
"test:integration": "vitest run tests/integration --passWithNoTests"
|
|
40
42
|
},
|
|
41
43
|
"engines": {
|