@tamagui/cli 2.7.7 → 3.0.0-beta.643.1

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/generate.cjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -6,71 +7,62 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
9
  var __export = (target, all) => {
9
- for (var name in all) __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true
12
- });
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
13
14
  };
14
15
  var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: () => from[key],
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- }
21
- return to;
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
22
23
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
- value: mod,
30
- enumerable: true
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
31
27
  }) : target, mod));
32
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
33
- value: true
34
- }), mod);
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
29
  var generate_exports = {};
36
30
  __export(generate_exports, {
37
- generateTypes: () => generateTypes,
38
- getTypes: () => getTypes
31
+ generateTypes: () => generateTypes,
32
+ getTypes: () => getTypes
39
33
  });
40
34
  module.exports = __toCommonJS(generate_exports);
41
35
  var import_fs_extra = __toESM(require("fs-extra"));
42
36
  var import_ts_morph = require("ts-morph");
43
37
  var import_utils = require("./utils.cjs");
44
38
  async function generateTypes(options) {
45
- const types = await getTypes(options);
46
- await import_fs_extra.default.writeJSON(options.paths.types, types, {
47
- spaces: 2
48
- });
39
+ const types = await getTypes(options);
40
+ await import_fs_extra.default.writeJSON(options.paths.types, types, { spaces: 2 });
49
41
  }
50
42
  async function getTypes(options) {
51
- const tamagui = await (0, import_utils.loadTamagui)(options.tamaguiOptions);
52
- if (!tamagui) {
53
- throw new Error(`No tamagui config`);
54
- }
55
- const nameToPaths = tamagui.nameToPaths || [];
56
- const uniqueViewExportingPaths = new Set(Object.keys(nameToPaths).map(name => {
57
- return `${[...nameToPaths[name]][0]}.ts*`;
58
- }));
59
- const project = new import_ts_morph.Project({
60
- compilerOptions: {
61
- noEmit: false,
62
- declaration: true,
63
- emitDeclarationOnly: true
64
- },
65
- skipAddingFilesFromTsConfig: true,
66
- tsConfigFilePath: options.tsconfigPath
67
- });
68
- const files = project.addSourceFilesAtPaths([...uniqueViewExportingPaths]);
69
- return Object.fromEntries(files.flatMap(x => {
70
- return [...x.getExportedDeclarations()].map(([k, v]) => {
71
- return [k, v[0].getType().getApparentType().getProperties().map(prop => {
72
- return [prop.getEscapedName(), prop.getValueDeclaration()?.getType().getText()];
73
- })];
74
- });
75
- }));
76
- }
43
+ const tamagui = await (0, import_utils.loadTamagui)(options.tamaguiOptions);
44
+ if (!tamagui) {
45
+ throw new Error(`No tamagui config`);
46
+ }
47
+ const nameToPaths = tamagui.nameToPaths || [];
48
+ const uniqueViewExportingPaths = new Set(Object.keys(nameToPaths).map((name) => {
49
+ return `${[...nameToPaths[name]][0]}.ts*`;
50
+ }));
51
+ const project = new import_ts_morph.Project({
52
+ compilerOptions: {
53
+ noEmit: false,
54
+ declaration: true,
55
+ emitDeclarationOnly: true
56
+ },
57
+ skipAddingFilesFromTsConfig: true,
58
+ tsConfigFilePath: options.tsconfigPath
59
+ });
60
+ const files = project.addSourceFilesAtPaths([...uniqueViewExportingPaths]);
61
+ return Object.fromEntries(files.flatMap((x) => {
62
+ return [...x.getExportedDeclarations()].map(([k, v]) => {
63
+ return [k, v[0].getType().getApparentType().getProperties().map((prop) => {
64
+ return [prop.getEscapedName(), prop.getValueDeclaration()?.getType().getText()];
65
+ })];
66
+ });
67
+ }));
68
+ }
package/dist/index.cjs CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
- require("./cli.cjs");
2
+
3
+ require("./cli.cjs");
@@ -0,0 +1,370 @@
1
+
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var migrate_exports = {};
23
+ __export(migrate_exports, {
24
+ getMigrationPrompt: () => getMigrationPrompt,
25
+ printMigrationPrompt: () => printMigrationPrompt
26
+ });
27
+ module.exports = __toCommonJS(migrate_exports);
28
+ function printMigrationPrompt({ from }) {
29
+ process.stdout.write(getMigrationPrompt({ from }));
30
+ }
31
+ function getMigrationPrompt({ from } = {}) {
32
+ const source = normalizeFrom(from);
33
+ if (source === "v1") {
34
+ return `${promptHeader("v1", "v3")}
35
+
36
+ ${v1ToV2Prompt}
37
+
38
+ After the v1 to v2 pass is complete, apply the v2 to v3 pass below.
39
+
40
+ ${v2ToV3Prompt}
41
+ `;
42
+ }
43
+ return `${promptHeader("v2", "v3")}
44
+
45
+ ${v2ToV3Prompt}
46
+ `;
47
+ }
48
+ function normalizeFrom(from) {
49
+ const value = (from || "v2").toLowerCase().replace(/^from-?/, "");
50
+ if (value === "1" || value === "v1") return "v1";
51
+ if (value === "2" || value === "v2") return "v2";
52
+ throw new Error("Usage: tamagui migrate --from v2 | --from v1");
53
+ }
54
+ function promptHeader(from, to) {
55
+ return `You are migrating a Tamagui app from ${from} to ${to}.
56
+
57
+ Work like a careful coding agent:
58
+
59
+ - Read the app's Tamagui config, package manager, bundler, and component usage before editing.
60
+ - Keep changes scoped to the migration.
61
+ - Run the codemods listed below, then review the diff by hand.
62
+ - Do not publish packages, rotate secrets, or change production infrastructure.
63
+ - Validate with typecheck/build and at least one real app run or browser/native smoke test.
64
+ - Report any behavior that cannot be migrated mechanically.`;
65
+ }
66
+ const v2ToV3Prompt = `## v2 -> v3 migration prompt
67
+
68
+ ### 1. Update dependencies
69
+
70
+ - Bump every \`tamagui\` and \`@tamagui/*\` package together to v3.
71
+ - Keep \`@tamagui/core\`, \`@tamagui/web\`, and \`tamagui\` deduped in the lockfile.
72
+ - Run:
73
+
74
+ \`\`\`bash
75
+ npx tamagui check
76
+ \`\`\`
77
+
78
+ ### 2. Migrate tokens and conditional styles
79
+
80
+ V3 accepts bare token/theme names and flat clauses only. Run the transactional
81
+ flat-values codemod from your project root, dry run first:
82
+
83
+ \`\`\`bash
84
+ npx @tamagui/codemod-flat-values --report flat-values-report.md ./src
85
+ npx @tamagui/codemod-flat-values --write \\
86
+ --report flat-values-report.md \\
87
+ --json flat-values-report.json \\
88
+ ./src
89
+ \`\`\`
90
+
91
+ For example, this V2 input:
92
+
93
+ \`\`\`tsx
94
+ <View bg="$background" hoverStyle={{ bg: '$backgroundHover' }} $sm={{ p: '$6' }} p="$4" />
95
+ \`\`\`
96
+
97
+ becomes:
98
+
99
+ \`\`\`tsx
100
+ <View bg="background hover:background-hover" p="4 sm:6" />
101
+ \`\`\`
102
+
103
+ Resolve every report row and rerun until the app has no V2 authoring. Do not
104
+ add a compatibility setting or restore condition-object parsing.
105
+
106
+ ### 3. Migrate config and themes
107
+
108
+ - New applications should use \`defaultConfig\` from \`@tamagui/config/v6\`.
109
+ - Existing V5 applications can keep \`@tamagui/config/v5\` or \`/v5-subtle\` while migrating incrementally. These are frozen static compatibility packs, so they preserve the V5 token and theme values but will not receive new theme-builder features.
110
+ - Import animations from \`@tamagui/config/animations-css\`, \`animations-rn\`, \`animations-reanimated\`, or \`animations-motion\`.
111
+ - Remove \`@tamagui/theme-builder\` and any V5 builder imports. Static \`@tamagui/themes/v5\`, \`/v5-subtle\`, and \`/v5-tokens\` imports remain supported.
112
+ - Use \`createThemes\`, \`levels\`, scales, and the other recipe helpers from \`@tamagui/themes/builder\`.
113
+ - Remove \`componentThemes\`, \`templates\`, \`masks\`, \`childrenThemes\`, and \`grandChildrenThemes\`. Express hierarchy in the recipe tree, semantic values in scales, and exact one-theme overrides in \`values\`.
114
+ - Component names no longer select uppercase theme segments automatically. Replace component themes with explicit normal theme or \`level2\` boundaries in component skins.
115
+
116
+ Rename the adaptive 12-step ramp approximately:
117
+
118
+ - \`color1\` -> \`color1\`
119
+ - \`color2\` -> \`color2\`
120
+ - \`color3\` -> \`color3\`
121
+ - \`color4\` -> \`color4\`
122
+ - \`color5\` -> \`color5\`
123
+ - \`color6\` and \`color7\` -> \`color6\`
124
+ - \`color8\` -> \`color7\`
125
+ - \`color9\` -> \`color8\`
126
+ - \`color10\` -> \`color9\`
127
+ - \`color11\` -> \`color10\`
128
+ - \`color12\` -> \`color11\`
129
+
130
+ The endpoints are exact; inspect contrast in the compressed middle. Replace
131
+ \`surface1\` with \`level2\`, \`surface2\` with \`level3\`, and \`surface3\`
132
+ or \`surface4\` with \`level4\`. Levels are relative and preserve a surrounding
133
+ color theme when nested.
134
+
135
+ Search the config and application together:
136
+
137
+ \`\`\`bash
138
+ rg "@tamagui/theme-builder|v5-builder|createV5Theme|componentThemes|grandChildrenThemes|surface[1-4]|color12"
139
+ \`\`\`
140
+
141
+ ### 4. Run the Sheet codemod
142
+
143
+ Run the codemod, then inspect every changed Sheet:
144
+
145
+ \`\`\`bash
146
+ node ./node_modules/tamagui/scripts/codemods/sheet-frame-to-container.js "src/**/*.{ts,tsx}"
147
+ \`\`\`
148
+
149
+ If working inside a Tamagui checkout, this path is also valid:
150
+
151
+ \`\`\`bash
152
+ node ./scripts/codemods/sheet-frame-to-container.js "src/**/*.{ts,tsx}"
153
+ \`\`\`
154
+
155
+ Migration rules:
156
+
157
+ - Replace \`Sheet.Frame\` with \`Sheet.Container\` plus \`Sheet.Background\`.
158
+ - Keep layout props such as \`padding\`, \`gap\`, \`height\`, \`maxHeight\`, and flex props on \`Sheet.Container\`.
159
+ - Move visual surface props such as \`bg\`, \`borderRadius\`, \`elevation\`, and \`shadow*\` to \`Sheet.Background\`.
160
+ - Keep \`Sheet.Overlay\` as a direct child of \`Sheet\`.
161
+ - Add explicit clipping if old \`Sheet.Frame\` overflow clipping mattered.
162
+ - \`disableHideBottomOverflow\` belongs on \`Sheet.Background\`.
163
+
164
+ Before:
165
+
166
+ \`\`\`tsx
167
+ <Sheet>
168
+ <Sheet.Overlay />
169
+ <Sheet.Frame padding="$4" bg="$background" borderTopRadius="$6">
170
+ <Sheet.ScrollView>{children}</Sheet.ScrollView>
171
+ </Sheet.Frame>
172
+ </Sheet>
173
+ \`\`\`
174
+
175
+ After:
176
+
177
+ \`\`\`tsx
178
+ <Sheet>
179
+ <Sheet.Overlay />
180
+ <Sheet.Container padding="4">
181
+ <Sheet.Background bg="background" borderTopRadius="6" />
182
+ <Sheet.ScrollView>{children}</Sheet.ScrollView>
183
+ </Sheet.Container>
184
+ </Sheet>
185
+ \`\`\`
186
+
187
+ ### 5. Remove deprecated v2 APIs
188
+
189
+ Search:
190
+
191
+ \`\`\`bash
192
+ rg "focusable|fullscreen|themeInverse|<Theme inverse|Sheet\\.Frame|styleable\\(|inlineWhenUnflattened|\\$true|getTokenRelative|stepTokenUpOrDown|forceRemoveScrollEnabled|sizeAdjust"
193
+ \`\`\`
194
+
195
+ Replace:
196
+
197
+ - \`focusable\` -> \`tabIndex\`.
198
+ - \`fullscreen\` -> explicit \`position\` and \`inset\` props.
199
+ - \`themeInverse\` -> \`theme="inverse"\`.
200
+ - \`<Theme inverse>\` -> \`<Theme name="inverse">\`.
201
+ - \`Sheet.Frame\` -> \`Sheet.Container\` plus \`Sheet.Background\`.
202
+ - \`Component.styleable(fn)\` -> \`createStyledHOC(Component, fn)\` (same behavior, standalone function).
203
+ - forwardRef wrapper statics -> direct refs and normal composition.
204
+ - \`inlineWhenUnflattened\` -> remove it.
205
+ - deprecated UI kit aliases -> current component names.
206
+ - old platform style keys -> flat \`web:\`, \`native:\`, \`ios:\`, and \`android:\` clauses.
207
+ - \`forceRemoveScrollEnabled\` -> \`disableRemoveScroll\` with inverted intent.
208
+ - \`createCheckbox\` \`sizeAdjust\` -> explicit sizing math or component styles.
209
+
210
+ ### 6. Replace true tokens
211
+
212
+ - Default v3 configs no longer export the legacy \`$true\` token key.
213
+ - Component default size resolves to bare \`4\`.
214
+ - Replace authored \`$true\` tokens with real bare keys such as \`4\`.
215
+ - Do not change unrelated boolean props or boolean variant values.
216
+
217
+ ### 7. Replace token stepping
218
+
219
+ Removed from \`@tamagui/get-token\`:
220
+
221
+ - \`stepTokenUpOrDown\`
222
+ - \`getTokenRelative\`
223
+ - the second options argument to \`getSize\`, \`getSpace\`, and \`getRadius\`
224
+ - \`shift\`, \`bounds\`, and \`excludeHalfSteps\`
225
+
226
+ Before:
227
+
228
+ \`\`\`tsx
229
+ const padding = getSize(size, { shift: -2 })
230
+ \`\`\`
231
+
232
+ After:
233
+
234
+ \`\`\`tsx
235
+ const padding = getVariableValue(getSize(size)) * 0.6
236
+ \`\`\`
237
+
238
+ Use explicit token keys when you need a named smaller or larger token. Use numeric multiplication when proportional sizing is intended.
239
+
240
+ ### 8. Audit font size values
241
+
242
+ - \`fontSize={17}\` is a raw numeric platform value and keeps platform-default line-height behavior.
243
+ - \`fontSize="17px"\` is an exact pixel value.
244
+ - Configured font \`size\` and \`lineHeight\` tokens should use px strings when exact web pixels are intended.
245
+ - Convert custom config font tokens to px strings if exact pixels were intended.
246
+
247
+ ### 9. Update FocusScope
248
+
249
+ - Function-as-children is removed. Pass JSX children directly.
250
+ - FocusScope renders a \`display: contents\` wrapper.
251
+ - Use \`noFocus\` for zero-focus mode when focus should be rejected entirely.
252
+
253
+ Before:
254
+
255
+ \`\`\`tsx
256
+ <FocusScope loop>
257
+ {({ ref, onKeyDown, tabIndex }) => (
258
+ <View ref={ref} onKeyDown={onKeyDown} tabIndex={tabIndex} />
259
+ )}
260
+ </FocusScope>
261
+ \`\`\`
262
+
263
+ After:
264
+
265
+ \`\`\`tsx
266
+ <FocusScope loop>
267
+ <View />
268
+ </FocusScope>
269
+ \`\`\`
270
+
271
+ ### 10. Update Dialog, Popover, Select, and Adapt flows
272
+
273
+ - Dialog, Popover, and Select use one Adapt handoff model.
274
+ - Adapted Sheet content stays mounted through the sheet slide-out.
275
+ - Parts own their presence animation lifecycles.
276
+ - The \`onDidAnimate\` prop is replaced by the typed \`onTransition\` lifecycle: \`onTransition={(e) => e.phase === 'end' && e.cause === 'enter' && done()}\`.
277
+ - \`Popover.Content forceMount\` now matches Dialog semantics.
278
+ - \`Dialog.Content\` no longer accepts the old no-op \`size\` variant.
279
+ - Non-modal Dialog content no longer enables RemoveScroll while open.
280
+ - Remove internal imports such as \`useShowPopoverSheet\`, \`PopoverAdaptHiddenContext\`, or \`useSelectBreakpointActive\` if the app used them.
281
+
282
+ ### 11. Update Select
283
+
284
+ - Keep \`name\` when Select participates in a form. Remove the unsupported \`autoComplete\` prop.
285
+ - Use \`Select.Separator\` for visual grouping.
286
+ - \`Select.Content\` accepts \`onEscapeKeyDown\` and \`onInteractOutside\`.
287
+ - \`Select.Trigger\` and web \`Select.Viewport\` expose \`data-state="open" | "closed"\`.
288
+
289
+ ### 12. Update themed icons
290
+
291
+ - \`<Icon size="4" />\` now resolves through the current font's \`font.size['4']\` scale.
292
+ - Raw numeric icon sizes are unchanged.
293
+ - Themed icons no longer accept Tamagui media or pseudo props directly.
294
+ - Wrap icons in a styled \`View\` for media and state clauses.
295
+
296
+ ### 13. Check ScrollView web usage
297
+
298
+ \`@tamagui/scroll-view\` now has its own web implementation. It supports \`scrollTo\`, \`scrollToEnd\`, \`getScrollableNode\`, RN-shaped \`onScroll\`, \`contentContainerStyle\`, \`horizontal\`, and indicator props.
299
+
300
+ Replace unsupported old web/lite usage such as momentum events, \`snapTo*\`, and \`keyboardDismissMode\`.
301
+
302
+ ### 14. Optional Tailwind frontend
303
+
304
+ Tailwind authoring is selected by the component package, with no global config:
305
+
306
+ \`\`\`tsx
307
+ import { View, Text, styled } from '@tamagui/tailwind'
308
+ \`\`\`
309
+
310
+ Keep importing regular Tamagui components from \`tamagui\` or
311
+ \`@tamagui/core\`. Do not mix utility classes and Tamagui style props on the
312
+ same component; choose the import whose styling language that component uses.
313
+
314
+ ### 15. Verification
315
+
316
+ - Run \`npx tamagui check\`.
317
+ - Run typecheck and build.
318
+ - Start the app and manually test screens using Sheet, Dialog, Popover, Select, FocusScope, icons, and ScrollView.
319
+ - Test Adapt breakpoints where popovers/selects/dialogs become sheets.
320
+ - Verify keyboard focus, Escape, outside click, scroll locking, and close animations.
321
+ - Inspect icon alignment next to text at each app size token.
322
+ - If the Tailwind frontend is used, compare web and native output for the classes used.`;
323
+ const v1ToV2Prompt = `## v1 -> v2 migration pass
324
+
325
+ Bring the app to the v2 baseline before applying v3 changes.
326
+
327
+ ### Requirements
328
+
329
+ - React 19+
330
+ - React Native 0.81+ with New Architecture support
331
+ - TypeScript 5+
332
+
333
+ ### Config
334
+
335
+ - Move to \`@tamagui/config/v6\`.
336
+ - Import animations separately from \`@tamagui/config/animations-css\`, \`animations-rn\`, \`animations-reanimated\`, or \`animations-motion\`.
337
+ - Move root \`createTamagui\` settings into \`settings\`.
338
+ - Account for the defaults \`flexBasis: 0\` and \`position: static\`. Use \`styleCompat: 'legacy'\` or explicit props if needed.
339
+ - Rename media queries: \`$2xl\` -> \`$xxl\`, \`$2xs\` -> \`$xxs\`, and max queries to kebab-case such as \`$max-md\`.
340
+ - Update colors and themes to the v3 recipe helpers in \`@tamagui/themes/builder\`.
341
+
342
+ ### v1 prop and API changes
343
+
344
+ - \`animation\` -> \`transition\`.
345
+ - \`AnimationProp\` -> \`TransitionProp\`.
346
+ - \`tag\` -> \`render\`.
347
+ - \`Stack\` -> \`View\`.
348
+ - \`StackProps\` -> \`ViewProps\`.
349
+ - \`space\` and \`spaceDirection\` -> \`gap\`.
350
+ - \`themeInverse\` and \`<Theme inverse>\` -> \`theme="inverse"\` and \`<Theme name="inverse">\`.
351
+ - \`onHoverIn\` / \`onHoverOut\` -> \`onPointerEnter\` / \`onPointerLeave\` or mouse events.
352
+ - \`ellipse\` -> \`numberOfLines={1}\`.
353
+ - React Native accessibility props -> ARIA/web equivalents where applicable.
354
+ - React Native shadow props -> \`boxShadow\`.
355
+
356
+ ### v1 component changes
357
+
358
+ - Input and Image prefer web-standard props such as \`type\`, \`inputMode\`, \`src\`, \`alt\`, and \`objectFit\`.
359
+ - Button and ListItem no longer take direct text style props. Style text through child components.
360
+ - Tabs uses \`Tabs.Tab\` instead of \`Tabs.Trigger\`; \`activationMode\` defaults to \`manual\`.
361
+ - Group requires \`Group.Item\`; remove old separator/space/scrollable auto-cloning props.
362
+ - Replace old \`Popover.Sheet\` subcomponents with standalone \`Sheet\` inside \`Adapt\`.
363
+ - Add native setup imports where needed: \`@tamagui/native/setup-teleport\`, \`setup-gesture-handler\`, \`setup-expo-ui-menu\` or \`setup-zeego\`, \`setup-burnt\`, and linear-gradient setup.
364
+
365
+ ### v1 -> v2 verification
366
+
367
+ - Run the app before starting v3 changes.
368
+ - Verify layout affected by flex/position defaults.
369
+ - Verify forms, tabs, groups, portals, native sheets, and Input/Image behavior.
370
+ - Commit the v1 -> v2 migration separately if possible.`;
@@ -0,0 +1,158 @@
1
+
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var setup_prompt_exports = {};
23
+ __export(setup_prompt_exports, {
24
+ getSetupPrompt: () => getSetupPrompt,
25
+ printSetupPrompt: () => printSetupPrompt
26
+ });
27
+ module.exports = __toCommonJS(setup_prompt_exports);
28
+ function printSetupPrompt() {
29
+ process.stdout.write(getSetupPrompt());
30
+ }
31
+ function getSetupPrompt() {
32
+ return `You are adding Tamagui v3 to a project that does not use it yet.
33
+
34
+ Work like a careful coding agent:
35
+
36
+ - Read the project first: package manager, bundler, framework, TypeScript config,
37
+ and whether it targets web, native, or both. Every choice below depends on it.
38
+ - Make the smallest install that actually runs, then verify it before adding more.
39
+ - Do not restyle existing components as part of setup.
40
+ - Do not publish packages, rotate secrets, or change production infrastructure.
41
+ - Stop and report if a step cannot be completed rather than guessing around it.
42
+
43
+ ## 1. Check the baseline
44
+
45
+ Tamagui v3 requires React 19+, TypeScript 5+, and, for native apps, React Native
46
+ 0.81+ with the New Architecture enabled. Web-only apps have no React Native
47
+ version requirement. If the project is below any of these, say so and stop.
48
+
49
+ ## 2. Install
50
+
51
+ Tamagui v3 is currently a beta on the \`beta\` dist-tag. Resolve it once and pin
52
+ every package to the same version, because a mixed install silently produces two
53
+ copies of the runtime and styles that do nothing.
54
+
55
+ \`\`\`bash
56
+ V=$(npm view tamagui@beta version)
57
+ npm i tamagui@$V @tamagui/config@$V
58
+ \`\`\`
59
+
60
+ \`tamagui\` is a superset of \`@tamagui/core\`. Install \`@tamagui/core\` alone
61
+ only for a styling-only install with no UI kit.
62
+
63
+ ## 3. Create the config
64
+
65
+ \`\`\`tsx
66
+ // tamagui.config.ts
67
+ import { defaultConfig } from '@tamagui/config/v6'
68
+ import { createTamagui } from 'tamagui'
69
+
70
+ export const config = createTamagui(defaultConfig)
71
+
72
+ declare module 'tamagui' {
73
+ interface TamaguiCustomConfig extends typeof config {}
74
+ }
75
+ \`\`\`
76
+
77
+ Pick an animation driver explicitly and import it from \`@tamagui/config\`:
78
+ \`animations-css\` (web), \`animations-rn\`, \`animations-reanimated\`, or
79
+ \`animations-motion\`. Do not install \`@tamagui/theme-builder\` or any v5 builder
80
+ package; they are not part of v3.
81
+
82
+ ## 4. Wrap the app
83
+
84
+ \`\`\`tsx
85
+ import { TamaguiProvider, View } from 'tamagui'
86
+ import { config } from './tamagui.config'
87
+
88
+ export default function App() {
89
+ return (
90
+ <TamaguiProvider config={config} defaultTheme="light">
91
+ <View width={200} height={200} bg="background" />
92
+ </TamaguiProvider>
93
+ )
94
+ }
95
+ \`\`\`
96
+
97
+ ## 5. Wire the bundler
98
+
99
+ Add the adapter for the bundler this project actually uses, and no others:
100
+
101
+ - Vite: \`@tamagui/vite-plugin\`, or \`@tamagui/cli/vite\`
102
+ - Metro: \`@tamagui/metro-plugin\`, or \`@tamagui/cli/metro\`
103
+ - Next.js: \`@tamagui/next-plugin\`
104
+ - Turbopack: the \`tamagui build\` precompile step
105
+
106
+ There is no Webpack plugin in v3.
107
+
108
+ The compiler is an optimization, not a requirement. If wiring it is not
109
+ straightforward, skip it, note that you skipped it, and confirm the app runs
110
+ first.
111
+
112
+ ## 6. Write styles the v3 way
113
+
114
+ This is the part most likely to be written as if it were v2. In v3, token and
115
+ theme names are bare, and conditions are flat clauses inside the value:
116
+
117
+ \`\`\`tsx
118
+ <View bg="background hover:background-hover" p="4 sm:6" />
119
+ \`\`\`
120
+
121
+ - No \`$\` sigils: \`bg="background"\`, not \`bg="$background"\`.
122
+ - No condition objects: there is no \`hoverStyle={{ ... }}\` and no \`$sm={{ ... }}\`.
123
+ - Modifiers chain left to right and read as prefixes: \`hover:sm:small\`.
124
+ - Clauses work on variant props too, not just style props, so
125
+ \`size="large sm:small"\` selects a different variant value per condition.
126
+ - When two clauses both apply, the winner is decided by specificity, not by
127
+ source order: first by platform (\`ios:\` beats \`native:\` beats unprefixed),
128
+ then by how many conditions the clause carries, then by category
129
+ (media < container < theme < group < state). Writing a clause later in the
130
+ string does not make it win.
131
+ - A chain is capped at five distinct non-platform conditions.
132
+
133
+ ## 7. Verify before reporting success
134
+
135
+ \`\`\`bash
136
+ npx tamagui check
137
+ \`\`\`
138
+
139
+ \`tamagui check\` reports version mismatches, duplicate installs, lockfile
140
+ problems, a missing config, and any v2 style syntax left in source. Then run the
141
+ project's own typecheck and build, and start the app and confirm a Tamagui
142
+ component renders with its styles applied. A passing typecheck is not sufficient:
143
+ flat values are strings, so a misspelled token compiles cleanly and only shows up
144
+ at runtime.
145
+
146
+ ## 8. Give the agent the project's own vocabulary
147
+
148
+ Once the app runs, generate a description of this project's actual tokens,
149
+ themes, and components so later prompts do not guess at them:
150
+
151
+ \`\`\`bash
152
+ npx tamagui generate-prompt
153
+ \`\`\`
154
+
155
+ That writes \`tamagui-prompt.md\`. Keep it in the repo and regenerate it when the
156
+ config changes.
157
+ `;
158
+ }