create-proto 0.7.4 → 0.7.6

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.
@@ -20,7 +20,10 @@ async function walk(srcDir, destDir, substitutions) {
20
20
  const entries = await fs.promises.readdir(srcDir, { withFileTypes: true });
21
21
  for (const entry of entries) {
22
22
  const srcPath = path.join(srcDir, entry.name);
23
- const destPath = path.join(destDir, entry.name);
23
+ // npm strips ".gitignore" files from published tarballs, so the template
24
+ // ships it undotted and the scaffold restores the real name.
25
+ const destName = entry.name === 'gitignore' ? '.gitignore' : entry.name;
26
+ const destPath = path.join(destDir, destName);
24
27
  if (entry.isDirectory()) {
25
28
  await walk(srcPath, destPath, substitutions);
26
29
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"copy-template.js","sourceRoot":"","sources":["../src/copy-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAS7B,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,OAAO;CACR,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAoB;IACrD,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACvE,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,EAAE,CAAC;IAClE,MAAM,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,KAAK,UAAU,IAAI,CACjB,MAAc,EACd,OAAe,EACf,aAAqC;IAErC,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAA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3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "Scaffold a new Proto prototype: `npm create proto@latest myapp`. Describe a screen, watch your prototype run natively on iPhone — designer-first, paired with Claude Code.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -16,7 +16,24 @@ You're the design tool inside a Prototo project. The designer prompts you in pla
16
16
  - `@expo/ui/swift-ui` — `Button`, `Toggle`, `Form`, `Section`, etc.
17
17
  - `expo-glass-effect` `GlassView` — Liquid Glass surfaces
18
18
 
19
- **Prototo primitives** in `/components/proto` — small set of themed fallbacks: `Screen`, `Stack`, `Row`, `Text`, `Card`, `Button`, `Toggle`, `Slider`, `Stepper`, `Divider`, `Modal`. Read the file when you need the API. `Toggle`, `Slider`, and `Stepper` render real native SwiftUI (`@expo/ui`) on iOS, tinted with the app accent. Card's `glass={true}` uses `expo-glass-effect`'s native iOS 26 material; on older iOS it falls back to a plain View.
19
+ **Prototo primitives** in `/components/proto` — small set of themed fallbacks. Props cheat sheet (source is read-only; only read a file if something here doesn't match):
20
+
21
+ | Primitive | Props |
22
+ |---|---|
23
+ | `Screen` | `scrollable?: boolean` (default true) |
24
+ | `Stack` | `gap?`, `padding?`, `align?: 'start'\|'center'\|'end'` (unset = full-width stretch), `style?` |
25
+ | `Row` | `gap?`, `align?: 'start'\|'center'\|'end'` (default 'start'), `style?` |
26
+ | `Text` | `size?: 'title'\|'headline'\|'body'\|'caption'\|'label'`, `color?: 'primary'\|'secondary'\|'accent'\|'destructive'`, `style?` |
27
+ | `Card` | `glass?: boolean`, `padding?: number` |
28
+ | `Button` | `label: string`, `variant?: 'primary'\|'secondary'\|'ghost'\|'destructive'`, `onPress?`, `disabled?`, `icon?`, `style?`, `textStyle?` |
29
+ | `Toggle` | `label: string`, `value: boolean`, `onChange?(value)` |
30
+ | `Slider` | `value: number`, `onChange?`, `min?`, `max?`, `step?`, `label?` |
31
+ | `Stepper` | `label: string`, `value: number`, `onChange(value)`, `min?`, `max?`, `step?` |
32
+ | `Divider` | `label?: string` |
33
+ | `Input` | React Native `TextInputProps` passthrough |
34
+ | `Modal` | `title: string`, `visible: boolean`, `onClose?` |
35
+ | `Lottie` | `source`, `autoPlay?`, `loop?`, `style?` |
36
+ `Toggle`, `Slider`, and `Stepper` render real native SwiftUI (`@expo/ui`) on iOS, tinted with the app accent. Card's `glass={true}` uses `expo-glass-effect`'s native iOS 26 material; on older iOS it falls back to a plain View.
20
37
 
21
38
  **Prototo motion + graphics** — four subpath modules in `/components/proto` cover animation and drawing. Pick by what the prompt actually asks for:
22
39
 
@@ -32,7 +49,7 @@ Never import `react-native-ease`, `react-native-reanimated`, `lottie-react-nativ
32
49
 
33
50
  ## Adding a library
34
51
 
35
- To add any npm package (a font, an icon set, a utility), run `proto add <package>` — never `npm install` / `pnpm add` directly. `proto add` installs through `expo install`, which picks the version that matches this project and resolves dependencies cleanly, so the project doesn't break. If the package needs native code this Prototo doesn't bundle, `proto add` will say so — that feature won't appear on the device until the Proto team ships an updated Prototo.
52
+ To add any npm package (a font, an icon set, a utility), run `npx proto add <package>` — never `npm install` / `pnpm add` directly (and `proto` alone isn't on PATH — always `npx proto`). `proto add` installs through `expo install`, which picks the version that matches this project and resolves dependencies cleanly, so the project doesn't break. If the package needs native code this Prototo doesn't bundle, `proto add` will say so — that feature won't appear on the device until the Proto team ships an updated Prototo.
36
53
 
37
54
  ## File layout
38
55
 
@@ -48,6 +65,29 @@ To add any npm package (a font, an icon set, a utility), run `proto add <package
48
65
  A new screen `screens/Settings.tsx` needs:
49
66
  - `app/settings.tsx` re-exporting it (`import Settings from '../screens/Settings'; export default function SettingsRoute() { return <Settings />; }`)
50
67
  - A title set in `app/_layout.tsx`: `<Stack.Screen name="settings" options={{ title: 'Settings' }} />`
68
+
69
+ **Tabs (NativeTabs)** — exact shape for this project's pinned `expo-router` (the flat `Icon`/`Label` imports you may know do NOT exist here; they're nested under `Trigger`):
70
+
71
+ ```tsx
72
+ import { NativeTabs } from 'expo-router/unstable-native-tabs';
73
+
74
+ export default function Layout() {
75
+ return (
76
+ <NativeTabs>
77
+ <NativeTabs.Trigger name="index">
78
+ <NativeTabs.Trigger.Icon sf="house.fill" />
79
+ <NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>
80
+ </NativeTabs.Trigger>
81
+ <NativeTabs.Trigger name="profile">
82
+ <NativeTabs.Trigger.Icon sf="person.fill" />
83
+ <NativeTabs.Trigger.Label>Profile</NativeTabs.Trigger.Label>
84
+ </NativeTabs.Trigger>
85
+ </NativeTabs>
86
+ );
87
+ }
88
+ ```
89
+
90
+ **Root-layout changes need a cold restart.** Swapping the navigator in `app/_layout.tsx` (Stack ↔ NativeTabs) does NOT apply via Fast Refresh, and the stale UI in a screenshot can look plausible. After editing `_layout.tsx`, call the `reload_app` MCP tool, then screenshot.
51
91
  - Route filenames are lowercase kebab-case.
52
92
 
53
93
  ## DESIGN.md is alive
@@ -78,7 +118,7 @@ Do this especially after layout, color, typography, or spacing changes. If `prot
78
118
 
79
119
  ## Proto MCP tools
80
120
 
81
- When the designer runs `proto start`, a local MCP server (`prototo`) connects automatically — no setup. It gives you three tools that close the feedback loop, so you can see what you built instead of asking the designer to relay it.
121
+ When the designer runs `proto start`, a local MCP server (`prototo`) connects automatically — no setup. It gives you four tools that close the feedback loop, so you can see what you built instead of asking the designer to relay it.
82
122
 
83
123
  **At the start of any fix session** (the designer says something is broken, red, or not working):
84
124
 
@@ -89,6 +129,8 @@ When the designer runs `proto start`, a local MCP server (`prototo`) connects au
89
129
  1. Call `compile_check` with the screen name — it type-checks the project and reports any problems in plain language. Fix anything it surfaces before moving on.
90
130
  2. Call `get_simulator_screenshot` — it returns what the prototype actually renders right now. Inspect it for the same defects as above.
91
131
 
132
+ **After editing `app/_layout.tsx` or any navigator:** call `reload_app` — root-layout changes don't Fast-Refresh, and a stale screenshot looks plausible.
133
+
92
134
  Never assume a screen rendered correctly — check the screenshot. Never ask the designer to describe an error you can catch with `get_metro_errors` or `compile_check`. If a tool says the Simulator isn't running (or Metro reports clean while the designer still sees an error), the designer needs to run `proto start` first.
93
135
 
94
136
  (`get_simulator_screenshot` is the automated form of the `proto shot` loop above — prefer the tool when it's available.)
@@ -4,13 +4,29 @@ import type { ReactNode } from 'react';
4
4
  export type StackProps = {
5
5
  gap?: number;
6
6
  padding?: number;
7
+ // same values as Row — the asymmetry was a guessable-wrong API paper cut
8
+ align?: 'start' | 'center' | 'end';
7
9
  children?: ReactNode;
8
10
  style?: ViewProps['style'];
9
11
  };
10
12
 
11
- export function Stack({ gap = 0, padding = 0, style, children }: StackProps) {
13
+ const alignMap = {
14
+ start: 'flex-start',
15
+ center: 'center',
16
+ end: 'flex-end',
17
+ } as const;
18
+
19
+ // No default: an unset align keeps RN's column default (stretch — children fill
20
+ // the width), so existing prototypes don't reflow.
21
+ export function Stack({ gap = 0, padding = 0, align, style, children }: StackProps) {
12
22
  return (
13
- <View style={[{ flexDirection: 'column', gap, padding }, style]}>
23
+ <View
24
+ style={[
25
+ { flexDirection: 'column', gap, padding },
26
+ align ? { alignItems: alignMap[align] } : null,
27
+ style,
28
+ ]}
29
+ >
14
30
  {children}
15
31
  </View>
16
32
  );
@@ -0,0 +1,9 @@
1
+ node_modules/
2
+ .expo/
3
+ .metro-cache/
4
+ .proto/last-shot.png
5
+ .proto/metro-errors.json
6
+ .proto/tsconfig.mcp.json
7
+ dist/
8
+ *.log
9
+ .DS_Store