@lotics/cli 0.22.0 → 0.23.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/dist/src/starter_template.js +96 -9
- package/package.json +1 -1
|
@@ -161,6 +161,20 @@ export default defineConfig({
|
|
|
161
161
|
<meta charset="UTF-8" />
|
|
162
162
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
163
163
|
<title>${escapeHtml(args.app_name)}</title>
|
|
164
|
+
<style>
|
|
165
|
+
/*
|
|
166
|
+
* Full-viewport container chain for iframe apps. @lotics/ui's DataGrid
|
|
167
|
+
* (and any layout that uses \`flex: 1\` to fill available space) relies
|
|
168
|
+
* on a measured parent height. The browser default of html/body being
|
|
169
|
+
* content-sized collapses every \`flex: 1\` to 0 and the surface shrinks
|
|
170
|
+
* to fit only its rendered content.
|
|
171
|
+
*
|
|
172
|
+
* Also: #root is made a flex column so the outermost RN \`<View flex:1>\`
|
|
173
|
+
* inside App.tsx claims the full iframe height.
|
|
174
|
+
*/
|
|
175
|
+
html, body, #root { height: 100%; margin: 0; }
|
|
176
|
+
#root { display: flex; flex-direction: column; }
|
|
177
|
+
</style>
|
|
164
178
|
</head>
|
|
165
179
|
<body>
|
|
166
180
|
<div id="root"></div>
|
|
@@ -180,34 +194,55 @@ mount(<App />);
|
|
|
180
194
|
},
|
|
181
195
|
{
|
|
182
196
|
path: "src/App.tsx",
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
//
|
|
197
|
+
// Welcome screen demonstrates the full-container layout pattern that
|
|
198
|
+
// real apps (data grids, dashboards, full-page surfaces) rely on:
|
|
199
|
+
// - Outer <View flex:1> claims the full iframe height (works because
|
|
200
|
+
// index.html sets html/body/#root to 100% + #root is a flex column).
|
|
201
|
+
// - Inner View is content-sized + centered for a card layout.
|
|
202
|
+
//
|
|
203
|
+
// We deliberately do NOT use @lotics/ui/stack for the outer chain.
|
|
204
|
+
// Stack wraps each child in an unstyled <View>, which breaks `flex: 1`
|
|
205
|
+
// propagation to children that need to claim flexible height (e.g., a
|
|
206
|
+
// DataGrid that fills the remaining space below a header + search).
|
|
207
|
+
// Use plain <View> with `flexDirection` + `gap` for any outer layout
|
|
208
|
+
// that hosts a flex-filling child; Stack is fine for content-sized
|
|
209
|
+
// groupings inside such a chain.
|
|
186
210
|
content: `import { View } from "react-native";
|
|
187
|
-
import { Stack } from "@lotics/ui/stack";
|
|
188
211
|
import { Card } from "@lotics/ui/card";
|
|
189
212
|
import { Text } from "@lotics/ui/text";
|
|
190
213
|
import { Button } from "@lotics/ui/button";
|
|
191
214
|
|
|
215
|
+
// Outer <View flex:1> claims the full iframe height — works because
|
|
216
|
+
// index.html sets html/body/#root to 100% and #root is a flex column.
|
|
217
|
+
// For real layouts with a fill-remaining-space child (DataGrid etc.),
|
|
218
|
+
// keep this flex chain plain — @lotics/ui/stack wraps each child in an
|
|
219
|
+
// unstyled <View> that breaks \`flex: 1\` propagation.
|
|
192
220
|
export default function App() {
|
|
193
221
|
return (
|
|
194
|
-
<View
|
|
195
|
-
|
|
222
|
+
<View
|
|
223
|
+
style={{
|
|
224
|
+
flex: 1,
|
|
225
|
+
padding: 24,
|
|
226
|
+
justifyContent: "center",
|
|
227
|
+
alignItems: "center",
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
230
|
+
<View style={{ maxWidth: 640, width: "100%", gap: 16 }}>
|
|
196
231
|
<Text size="xl" weight="semibold">${escapeHtml(args.app_name)}</Text>
|
|
197
232
|
<Card>
|
|
198
|
-
<
|
|
233
|
+
<View style={{ padding: 16, gap: 8 }}>
|
|
199
234
|
<Text>This is your new Lotics app.</Text>
|
|
200
235
|
<Text color="muted">
|
|
201
236
|
Edit <Text weight="medium">src/App.tsx</Text> and run{" "}
|
|
202
237
|
<Text weight="medium">lotics app deploy</Text> to publish.
|
|
203
238
|
</Text>
|
|
204
|
-
</
|
|
239
|
+
</View>
|
|
205
240
|
</Card>
|
|
206
241
|
<Text color="muted" size="sm">
|
|
207
242
|
Hooks from @lotics/app-sdk: useTable, useMutate, useAction, useQuery, useWorkflow.
|
|
208
243
|
</Text>
|
|
209
244
|
<Button title="Get started" onPress={() => {}} color="primary" />
|
|
210
|
-
</
|
|
245
|
+
</View>
|
|
211
246
|
</View>
|
|
212
247
|
);
|
|
213
248
|
}
|
|
@@ -230,6 +265,58 @@ declare module "lucide-react-native/dist/esm/icons/*" {
|
|
|
230
265
|
}>;
|
|
231
266
|
export default Icon;
|
|
232
267
|
}
|
|
268
|
+
`,
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
path: "src/css_modules.d.ts",
|
|
272
|
+
content: `declare module "*.module.css" {
|
|
273
|
+
const classes: { [key: string]: string };
|
|
274
|
+
export default classes;
|
|
275
|
+
}
|
|
276
|
+
`,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
path: "src/react_native.d.ts",
|
|
280
|
+
content: `import "react-native";
|
|
281
|
+
|
|
282
|
+
// Augments react-native's types with the web-only fields @lotics/ui consumes:
|
|
283
|
+
// Pressable's \`hovered\` callback state, plus web-only ViewStyle / TextStyle
|
|
284
|
+
// properties (cursor, outline, boxShadow, etc.) used by the grid + primitives.
|
|
285
|
+
// Each iframe app needs its own copy — TypeScript doesn't auto-pick-up
|
|
286
|
+
// \`.d.ts\` files inside dependencies. \`@lotics/ui\`'s grid sources include a
|
|
287
|
+
// triple-slash reference to its own copy of this file so the augmentation
|
|
288
|
+
// kicks in transitively.
|
|
289
|
+
declare module "react-native" {
|
|
290
|
+
interface PressableStateCallbackType {
|
|
291
|
+
hovered: boolean;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
interface ViewStyle {
|
|
295
|
+
backdropFilter?: string;
|
|
296
|
+
backgroundImage?: string;
|
|
297
|
+
boxShadow?: string;
|
|
298
|
+
boxSizing?: string;
|
|
299
|
+
cursor?: string;
|
|
300
|
+
touchAction?: string;
|
|
301
|
+
transitionDuration?: string;
|
|
302
|
+
transitionProperty?: string;
|
|
303
|
+
appearance?: string;
|
|
304
|
+
outline?: string;
|
|
305
|
+
outlineColor?: string;
|
|
306
|
+
outlineStyle?: string;
|
|
307
|
+
outlineWidth?: number;
|
|
308
|
+
outlineOffset?: number;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface TextStyle {
|
|
312
|
+
outline?: string;
|
|
313
|
+
outlineColor?: string;
|
|
314
|
+
outlineStyle?: string;
|
|
315
|
+
outlineWidth?: number;
|
|
316
|
+
outlineOffset?: number;
|
|
317
|
+
appearance?: string;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
233
320
|
`,
|
|
234
321
|
},
|
|
235
322
|
{
|