@tamagui/cli 2.7.7 → 3.0.0-0.canary.1791056644527

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.
Files changed (54) hide show
  1. package/dist/add.cjs +76 -87
  2. package/dist/build.cjs +421 -278
  3. package/dist/cli.cjs +410 -340
  4. package/dist/generate-prompt.cjs +37 -386
  5. package/dist/generate.cjs +45 -54
  6. package/dist/icons.cjs +263 -0
  7. package/dist/index.cjs +1 -1
  8. package/dist/migrate.cjs +443 -0
  9. package/dist/preview-theme.cjs +70 -0
  10. package/dist/setup-prompt.cjs +216 -0
  11. package/dist/to-tailwind-default-config.cjs +874 -0
  12. package/dist/to-tailwind.cjs +213 -0
  13. package/dist/update-template.cjs +43 -52
  14. package/dist/update.cjs +14 -18
  15. package/dist/upgrade.cjs +417 -401
  16. package/dist/utils.cjs +84 -101
  17. package/metro.cjs +1 -0
  18. package/metro.d.ts +1 -0
  19. package/metro.mjs +1 -0
  20. package/package.json +45 -14
  21. package/src/build.ts +579 -361
  22. package/src/cli.ts +171 -24
  23. package/src/generate-prompt.ts +18 -526
  24. package/src/icons.ts +308 -0
  25. package/src/migrate.ts +428 -0
  26. package/src/preview-theme.ts +54 -0
  27. package/src/setup-prompt.ts +192 -0
  28. package/src/to-tailwind-default-config.ts +852 -0
  29. package/src/to-tailwind.ts +313 -0
  30. package/src/upgrade.ts +30 -33
  31. package/src/utils.ts +11 -9
  32. package/types/add.d.ts +1 -1
  33. package/types/add.d.ts.map +1 -1
  34. package/types/build.d.ts +2 -1
  35. package/types/build.d.ts.map +1 -1
  36. package/types/generate-prompt.d.ts +2 -2
  37. package/types/generate-prompt.d.ts.map +1 -1
  38. package/types/icons.d.ts +14 -0
  39. package/types/icons.d.ts.map +1 -0
  40. package/types/migrate.d.ts +7 -0
  41. package/types/migrate.d.ts.map +1 -0
  42. package/types/preview-theme.d.ts +8 -0
  43. package/types/preview-theme.d.ts.map +1 -0
  44. package/types/setup-prompt.d.ts +5 -0
  45. package/types/setup-prompt.d.ts.map +1 -0
  46. package/types/to-tailwind-default-config.d.ts +53 -0
  47. package/types/to-tailwind-default-config.d.ts.map +1 -0
  48. package/types/to-tailwind.d.ts +16 -0
  49. package/types/to-tailwind.d.ts.map +1 -0
  50. package/types/upgrade.d.ts.map +1 -1
  51. package/types/utils.d.ts.map +1 -1
  52. package/vite.cjs +1 -0
  53. package/vite.d.ts +1 -0
  54. package/vite.mjs +1 -0
@@ -0,0 +1,443 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var migrate_exports = {};
22
+ __export(migrate_exports, {
23
+ getMigrationPrompt: () => getMigrationPrompt,
24
+ printMigrationPrompt: () => printMigrationPrompt
25
+ });
26
+ module.exports = __toCommonJS(migrate_exports);
27
+ function printMigrationPrompt({ from }) {
28
+ process.stdout.write(getMigrationPrompt({ from }));
29
+ }
30
+ function getMigrationPrompt({ from } = {}) {
31
+ const source = normalizeFrom(from);
32
+ if (source === "v1") {
33
+ return `${promptHeader("v1", "v3")}
34
+
35
+ ${v1ToV2Prompt}
36
+
37
+ After the v1 to v2 pass is complete, apply the v2 to v3 pass below.
38
+
39
+ ${v2ToV3Prompt}
40
+ `;
41
+ }
42
+ return `${promptHeader("v2", "v3")}
43
+
44
+ ${v2ToV3Prompt}
45
+ `;
46
+ }
47
+ function normalizeFrom(from) {
48
+ const value = (from || "v2").toLowerCase().replace(/^from-?/, "");
49
+ if (value === "1" || value === "v1") return "v1";
50
+ if (value === "2" || value === "v2") return "v2";
51
+ throw new Error("Usage: tamagui migrate --from v2 | --from v1");
52
+ }
53
+ function promptHeader(from, to) {
54
+ return `You are migrating a Tamagui app from ${from} to ${to}.
55
+
56
+ Work like a careful coding agent:
57
+
58
+ - Read the app's Tamagui config, package manager, bundler, and component usage before editing.
59
+ - Keep changes scoped to the migration.
60
+ - Run the codemods listed below, then review the diff by hand.
61
+ - Do not publish packages, rotate secrets, or change production infrastructure.
62
+ - Validate with typecheck/build and at least one real app run or browser/native smoke test.
63
+ - Report any behavior that cannot be migrated mechanically.`;
64
+ }
65
+ const v2ToV3Prompt = `## v2 -> v3 migration prompt
66
+
67
+ ### 0. Choose the intermediate checkpoint before editing
68
+
69
+ The Tamagui package version and the config version are separate. Tamagui V3
70
+ supports Config v5; upgrading the runtime does not require Config v6.
71
+
72
+ - Coming from V2: first reach V3 packages and APIs with the app's existing token, theme, font, media, and animation values. Keep custom config values. If an old config entry is no longer exported, preserve its resolved values in an app-owned config; do not substitute v6 defaults.
73
+ - Coming from Config v5 or v5-subtle: keep that config during the V3 API upgrade. Keep the 12-step adaptive colors, spacing, radii, font scales, and breakpoint meanings. Do not remap them to the v6 scale.
74
+ - Already running V3 with Config v5: this intermediate checkpoint is valid. Inventory remaining V2 APIs before applying codemods; do not repeat completed work or treat Config v5 as an upgrade failure.
75
+ - Do not combine this pass with wholesale \`html.*\` adoption, Tailwind conversion, new skins, or a theme redesign unless separately requested.
76
+
77
+ Record the starting package/config versions and representative light/dark,
78
+ responsive, and native screenshots. Name the intended checkpoint in the plan:
79
+ "V3 API, existing design values." Visual changes during this pass need an
80
+ explanation or a fix, not automatic screenshot acceptance.
81
+
82
+ The checkpoint is complete when the required API migration, report review,
83
+ typecheck/build, and real app checks in step 15 pass. Leave Config v6 and other
84
+ optional design changes in a separate follow-up; do not start them just because
85
+ the V3 API work is finished.
86
+
87
+ ### 1. Update dependencies
88
+
89
+ - Bump every \`tamagui\` and \`@tamagui/*\` package together to v3.
90
+ - Keep \`@tamagui/core\`, \`@tamagui/web\`, and \`tamagui\` deduped in the lockfile.
91
+ - Run:
92
+
93
+ \`\`\`bash
94
+ npx tamagui check
95
+ \`\`\`
96
+
97
+ ### 2. Migrate tokens and conditional styles
98
+
99
+ V3 accepts bare token/theme names and flat clauses only. Run the transactional
100
+ flat-values codemod from your project root, dry run first:
101
+
102
+ \`\`\`bash
103
+ npx @tamagui/codemod-flat-values --source-semantics v2-pixels \\
104
+ --report flat-values-report.md ./src
105
+ npx @tamagui/codemod-flat-values --write \\
106
+ --source-semantics v2-pixels \\
107
+ --report flat-values-report.md \\
108
+ --json flat-values-report.json \\
109
+ ./src
110
+ \`\`\`
111
+
112
+ For example, this V2 input:
113
+
114
+ \`\`\`tsx
115
+ <View bg="$background" hoverStyle={{ bg: '$backgroundHover' }} $sm={{ p: '$6' }} p="$4" />
116
+ \`\`\`
117
+
118
+ becomes:
119
+
120
+ \`\`\`tsx
121
+ <View bg="background hover:background-hover" p="4 sm:6" />
122
+ \`\`\`
123
+
124
+ Resolve every report row and rerun until the app has no V2 authoring. Do not
125
+ add a compatibility setting or restore condition-object parsing.
126
+
127
+ ### 3. Preserve config values while migrating required APIs
128
+
129
+ - Existing Config v5 applications should 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.
130
+ - Import animations from \`@tamagui/config/animations-css\`, \`animations-rn\`, \`animations-reanimated\`, or \`animations-motion\`.
131
+ - Apps using Sheet or animated-number hooks with the CSS driver must import \`createAnimations\` from \`@tamagui/animations-css/extras\`. The root entry omits those hooks.
132
+ - Remove \`@tamagui/theme-builder\` and V5 builder imports from packages that no longer export them. Static \`@tamagui/themes/v5\`, \`/v5-subtle\`, and \`/v5-tokens\` imports remain supported.
133
+ - An app that GENERATES its v5 themes (\`createV5Theme\`, \`subtleChildrenThemes\`, \`createPalettes\`) has two ways to stay on v5 for this migration: run the builder once and serialize the result to a static literal, or import the same builders from \`@tamagui/config-v5\` (and \`@tamagui/config-v5/builder\`), the opt-in package that carries them. Take one of those when the themes are built from values the app only knows at runtime; the optional v6 recipe move in the appendix is a separate migration.
134
+ - Component names no longer select uppercase theme segments automatically. Replace component themes with explicit normal theme or \`level2\` boundaries in component skins.
135
+
136
+ Do not apply the v6 color remap or recipe conversion in the optional appendix
137
+ while keeping Config v5. Reserved API/theme-key spelling changes still apply;
138
+ preserve the resolved values behind the renamed keys.
139
+
140
+ ### 4. Migrate Sheet anatomy
141
+
142
+ The flat-values codemod from step 2 rewrites every provable \`Sheet.Frame\` to
143
+ \`Sheet.Container\` with a \`Sheet.Background\` first child carrying the surface
144
+ props, and reports spreads and \`styled(Sheet.Frame, \u2026)\` targets for review.
145
+ Check each rewritten callsite against these rules:
146
+
147
+ - Replace \`Sheet.Frame\` with \`Sheet.Container\` plus \`Sheet.Background\`.
148
+ - Keep layout props such as \`padding\`, \`gap\`, \`height\`, \`maxHeight\`, and flex props on \`Sheet.Container\`.
149
+ - Move visual surface props such as \`bg\`, \`borderRadius\`, \`elevation\`, and \`shadow*\` to \`Sheet.Background\`.
150
+ - Keep \`Sheet.Overlay\` as a direct child of \`Sheet\`.
151
+ - Add explicit clipping if old \`Sheet.Frame\` overflow clipping mattered.
152
+ - \`disableHideBottomOverflow\` belongs on \`Sheet.Background\`.
153
+
154
+ Before:
155
+
156
+ \`\`\`tsx
157
+ <Sheet>
158
+ <Sheet.Overlay />
159
+ <Sheet.Frame padding="$4" bg="$background" borderTopRadius="$6">
160
+ <Sheet.ScrollView>{children}</Sheet.ScrollView>
161
+ </Sheet.Frame>
162
+ </Sheet>
163
+ \`\`\`
164
+
165
+ After:
166
+
167
+ \`\`\`tsx
168
+ <Sheet>
169
+ <Sheet.Overlay />
170
+ <Sheet.Container padding="4">
171
+ <Sheet.Background bg="background" borderTopRadius="6" />
172
+ <Sheet.ScrollView>{children}</Sheet.ScrollView>
173
+ </Sheet.Container>
174
+ </Sheet>
175
+ \`\`\`
176
+
177
+ ### 5. Remove deprecated v2 APIs
178
+
179
+ Search:
180
+
181
+ \`\`\`bash
182
+ rg "focusable|fullscreen|themeInverse|<Theme inverse|Sheet\\.Frame|styleable\\(|inlineWhenUnflattened|\\$true|getTokenRelative|stepTokenUpOrDown|forceRemoveScrollEnabled|sizeAdjust|getExpandedShorthands|usePropsAndStyle|useProps|useStyle|Unspaced|spacedChildren"
183
+ \`\`\`
184
+
185
+ Replace:
186
+
187
+ - \`focusable\` -> \`tabIndex\`.
188
+ - \`fullscreen\` -> explicit \`position\` and \`inset\` props.
189
+ - \`themeInverse\` -> \`theme="inverse"\`.
190
+ - \`<Theme inverse>\` -> \`<Theme name="inverse">\`.
191
+ - \`Sheet.Frame\` -> \`Sheet.Container\` plus \`Sheet.Background\`.
192
+ - \`Component.styleable(fn)\` -> \`createStyledHOC(Component, fn)\` (same behavior, standalone function).
193
+ - forwardRef wrapper statics -> direct refs and normal composition.
194
+ - \`inlineWhenUnflattened\` -> remove it.
195
+ - deprecated UI kit aliases -> current component names.
196
+ - old platform style keys -> flat \`web:\`, \`native:\`, \`ios:\`, and \`android:\` clauses.
197
+ - \`forceRemoveScrollEnabled\` -> \`disableRemoveScroll\` with inverted intent.
198
+ - \`createCheckbox\` \`sizeAdjust\` -> explicit sizing math or component styles.
199
+ - \`getExpandedShorthands\` -> \`getExpandedShorthand(key, props)\` when behavior code needs one authored prop and must accept its configured shorthand.
200
+ - \`useProps\`, \`useStyle\`, and \`usePropsAndStyle\` -> keep conditional values on styled Tamagui components; use \`splitStyleProps\` only when a wrapper must partition authored props.
201
+ - \`<Unspaced>\` -> its children, and \`spacedChildren\` -> \`gap\`: stacks no longer insert spacers.
202
+ - a \`theme\`, handler, or other non-style key inside \`variants\` -> set it on a wrapper one level up. Variants hold styles and aria/data attributes only; type checking flags the rest.
203
+
204
+ V2 could spread one style across its base prop, pseudo-style objects, media
205
+ objects, and platform objects. The removed hooks gathered those separate
206
+ objects into resolved props and styles. V3 keeps every base and conditional
207
+ clause for a style on that style's single property, for example
208
+ \`opacity="1 hover:0.7 sm:0.8"\`. The styled component interprets that value,
209
+ so a wrapper should pass it through instead of flattening the component's
210
+ styles in JavaScript.
211
+
212
+ \`splitStyleProps(props)\` returns \`[styleProps, regularProps]\` in one pass.
213
+ Pass \`{ expandShorthands: true }\` to canonicalize selected keys. Its optional
214
+ filter map selects only those canonical keys, leaving rejected style props in
215
+ the second object. The filter may instead be a callback receiving
216
+ \`(key, value, originalKey, isStyleProp)\`.
217
+
218
+ \`getExpandedShorthand(key, props)\` only chooses the longhand or configured
219
+ shorthand for one property. It does not resolve tokens or select the active
220
+ clause. Neither does \`splitStyleProps\`. Use \`useMedia()\` or \`useTheme()\`
221
+ when behavior itself needs active responsive or theme state.
222
+
223
+ ### 6. Replace true tokens
224
+
225
+ - Default v3 configs no longer export the legacy \`$true\` token key.
226
+ - The codemod writes \`$true\` on style props as \`4\` and reports a \`legacy-true-token\` warning; confirm the app's config aliased it there.
227
+ - On \`size\`, \`elevation\`, and \`iconSize\` it writes the boolean \`true\`, which resolves to the component default size.
228
+ - Token definitions and custom variants are not edited; search them for the alias by hand.
229
+ - Do not change unrelated boolean props or boolean variant values.
230
+
231
+ ### 7. Replace token stepping
232
+
233
+ Removed from \`@tamagui/get-token\`:
234
+
235
+ - \`stepTokenUpOrDown\`
236
+ - \`getTokenRelative\`
237
+ - the second options argument to \`getSize\`, \`getSpace\`, and \`getRadius\`
238
+ - \`shift\`, \`bounds\`, and \`excludeHalfSteps\`
239
+
240
+ Before:
241
+
242
+ \`\`\`tsx
243
+ const padding = getSize(size, { shift: -2 })
244
+ \`\`\`
245
+
246
+ After:
247
+
248
+ \`\`\`tsx
249
+ const padding = getVariableValue(getSize(size)) * 0.6
250
+ \`\`\`
251
+
252
+ Use explicit token keys when you need a named smaller or larger token. Use numeric multiplication when proportional sizing is intended.
253
+
254
+ ### 8. Migrate line heights and audit font size values
255
+
256
+ - \`fontSize={17}\` is a raw numeric platform value and keeps platform-default line-height behavior.
257
+ - \`fontSize="17px"\` is an exact pixel value.
258
+ - V3 interprets numeric Tamagui \`lineHeight\` props as ratios on web and native. The flat-values command above explicitly selects \`v2-pixels\`, so old numeric Tamagui styles become px strings, including values below 4.
259
+ - Keep raw React Native and Restyle numeric styles unchanged. Review every \`ambiguous-line-height-*\` report entry where a shared object, untyped expression, or extracted token value needs a boundary-specific decision.
260
+ - Configured font \`lineHeight\` numbers remain absolute pixels. Numeric strings such as \`"1.5"\` are ratios, while \`"24px"\` is explicit. The codemod does not rewrite font configuration.
261
+ - Rerun the codemod with the same source semantics until it reports no remaining line-height work. Explicit px output is idempotent.
262
+
263
+ ### 9. Update FocusScope
264
+
265
+ - Function-as-children is removed. Pass JSX children directly.
266
+ - FocusScope renders a \`display: contents\` wrapper.
267
+ - Use \`noFocus\` for zero-focus mode when focus should be rejected entirely.
268
+
269
+ Before:
270
+
271
+ \`\`\`tsx
272
+ <FocusScope loop>
273
+ {({ ref, onKeyDown, tabIndex }) => (
274
+ <View ref={ref} onKeyDown={onKeyDown} tabIndex={tabIndex} />
275
+ )}
276
+ </FocusScope>
277
+ \`\`\`
278
+
279
+ After:
280
+
281
+ \`\`\`tsx
282
+ <FocusScope loop>
283
+ <View />
284
+ </FocusScope>
285
+ \`\`\`
286
+
287
+ ### 10. Update Dialog, Popover, Select, and Adapt flows
288
+
289
+ - Dialog, Popover, and Select use one Adapt handoff model.
290
+ - Adapted Sheet content stays mounted through the sheet slide-out.
291
+ - Parts own their presence animation lifecycles.
292
+ - The \`onDidAnimate\` prop is replaced by the typed \`onTransition\` lifecycle: \`onTransition={(e) => e.phase === 'end' && e.cause === 'enter' && done()}\`.
293
+ - \`Popover.Content forceMount\` now matches Dialog semantics.
294
+ - \`Dialog.Content\` no longer accepts the old no-op \`size\` variant.
295
+ - Non-modal Dialog content no longer enables RemoveScroll while open.
296
+ - Remove internal imports such as \`useShowPopoverSheet\`, \`PopoverAdaptHiddenContext\`, or \`useSelectBreakpointActive\` if the app used them.
297
+
298
+ ### 11. Update Select
299
+
300
+ - Keep \`name\` when Select participates in a form. Remove the unsupported \`autoComplete\` prop.
301
+ - Use \`Select.Separator\` for visual grouping.
302
+ - \`Select.Content\` accepts \`onEscapeKeyDown\` and \`onInteractOutside\`.
303
+ - \`Select.Trigger\` and web \`Select.Viewport\` expose \`data-state="open" | "closed"\`.
304
+
305
+ ### 12. Update themed icons
306
+
307
+ - \`<Icon size="4" />\` now resolves through the current font's \`font.size['4']\` scale.
308
+ - Raw numeric icon sizes are unchanged.
309
+ - Themed icons no longer accept Tamagui media or pseudo props directly.
310
+ - Wrap icons in a styled \`View\` for media and state clauses.
311
+
312
+ ### 13. Check ScrollView web usage
313
+
314
+ \`@tamagui/scroll-view\` now has its own web implementation. It supports \`scrollTo\`, \`scrollToEnd\`, \`getScrollableNode\`, RN-shaped \`onScroll\`, \`contentContainerStyle\`, \`horizontal\`, and indicator props.
315
+
316
+ Replace unsupported old web/lite usage such as momentum events, \`snapTo*\`, and \`keyboardDismissMode\`.
317
+
318
+ ### 14. Optional Tailwind frontend
319
+
320
+ Skip this in the intermediate V3 API checkpoint unless Tailwind adoption was
321
+ separately requested. It does not require changing the whole app to Config v6.
322
+
323
+ Tailwind authoring is selected by the component package, with no global config:
324
+
325
+ \`\`\`tsx
326
+ import { View, Text, styled } from '@tamagui/tailwind'
327
+ \`\`\`
328
+
329
+ Keep importing regular Tamagui components from \`tamagui\` or
330
+ \`@tamagui/core\`. Do not mix utility classes and Tamagui style props on the
331
+ same component; choose the import whose styling language that component uses.
332
+
333
+ ### Required API follow-ups
334
+
335
+ - Transition values: replace arrays with \`{ preset: 'quick', opacity: 'lazy' }\`, rename the transition object's \`default\` to \`preset\`, and place physics under \`spring\`. Move \`animateOnly\` into \`transition.properties\`. Read the upgrade guide's transition section before converting driver-specific options.
336
+ - Groups and containers: \`group="card"\` enables \`group-hover/card:\` and other group states. Size queries require \`container="card"\` and use \`@sm/card:\`; a group alone no longer enables container measurement.
337
+ - Control sizes: Config v6 uses \`xs | sm | md | lg | xl\` (default \`md\`). Keep numeric token keys while retaining Config v5, then map control sizes when separately adopting v6. Shape and icon geometry still uses size tokens or numbers.
338
+ - Remove top-level \`createTamagui({ defaultProps })\`. Put default styles in \`styled()\` definitions and inherited non-style defaults in \`Component.Props\`.
339
+ - Toast: replace \`useToastController().show(title, { message })\` with \`toast(title, { description: message })\`. Import \`Toast\` and \`toast\` from \`tamagui/toast\`; mount \`Toast.Root\` and \`Toast.List\` with the desired parts once in the app. The old provider/controller API is removed.
340
+ - Replace \`ThemeableStack\` and \`SizableStack\` with \`YStack\` or \`XStack\` plus explicit styles; use \`elevation\` for elevation and border width/color for borders.
341
+ - Checked/selected states: Checkbox, Switch, Tabs and ToggleGroup read \`background-press\`; customize \`activeStyle\` to override it per instance. Audit the resulting active background against the previous app and customize its theme or skin where needed.
342
+
343
+ ### 15. Verification
344
+
345
+ - Run \`npx tamagui check --strict\`.
346
+ - Run typecheck and build.
347
+ - Start the app and manually test screens using Sheet, Dialog, Popover, Select, FocusScope, icons, and ScrollView.
348
+ - Test Adapt breakpoints where popovers/selects/dialogs become sheets.
349
+ - Verify keyboard focus, Escape, outside click, scroll locking, and close animations.
350
+ - Inspect icon alignment next to text at each app size token.
351
+ - If the Tailwind frontend is used, compare web and native output for the classes used.
352
+ - Compare the same screens and resolved control dimensions with the baseline. Keeping Config v5 preserves the scales, but does not prove that changed component APIs preserve every layout.
353
+ - Report the final package version, retained config, manual fixes, runtime evidence, and deferred optional work. A validated V3 app on Config v5 is a completed migration.
354
+
355
+ ### Optional follow-up: Config v6, only when separately requested
356
+
357
+ This appendix is not part of the intermediate V3 API checkpoint. Start a new
358
+ reviewable change after that checkpoint is validated. Record new visual
359
+ acceptance criteria before changing design values.
360
+
361
+ - New apps can start with \`defaultConfig\` from \`@tamagui/config/v6\`.
362
+ - For an existing app, inventory and compare resolved spacing, size, radius, font, icon, and media values. Map by resolved value when preserving appearance; the same token name can mean a different number in v6.
363
+ - Preserve breakpoint meaning: changing a max-width key to a min-width key can invert responsive behavior.
364
+
365
+ - Use \`createThemes\`, \`levels\`, scales, and the other recipe helpers from \`@tamagui/themes/builder\`.
366
+ - Remove \`componentThemes\`, \`templates\`, \`masks\`, \`childrenThemes\`, and \`grandChildrenThemes\`. Express hierarchy in the recipe tree, semantic values in scales, and exact one-theme overrides in \`values\`.
367
+
368
+ Rename the adaptive 12-step ramp approximately:
369
+
370
+ - \`color1\` -> \`color-1\`
371
+ - \`color2\` -> \`color-2\`
372
+ - \`color3\` -> \`color-3\`
373
+ - \`color4\` -> \`color-4\`
374
+ - \`color5\` -> \`color-5\`
375
+ - \`color6\` and \`color7\` -> \`color-6\`
376
+ - \`color8\` -> \`color-7\`
377
+ - \`color9\` -> \`color-8\`
378
+ - \`color10\` -> \`color-9\`
379
+ - \`color11\` -> \`color-10\`
380
+ - \`color12\` -> \`color-11\`
381
+
382
+ The endpoints are exact; inspect contrast in the compressed middle. Replace
383
+ \`surface1\` with \`level2\`, \`surface2\` with \`level3\`, and \`surface3\`
384
+ or \`surface4\` with \`level4\`. Levels are relative and preserve a surrounding
385
+ color theme when nested.
386
+
387
+ Search the config and application together:
388
+
389
+ \`\`\`bash
390
+ rg "@tamagui/theme-builder|v5-builder|createV5Theme|componentThemes|grandChildrenThemes|surface[1-4]|color12"
391
+ \`\`\`
392
+
393
+ Validate the config change separately with light/dark screenshots, responsive
394
+ layouts, text and icon alignment, and every platform the app ships. Do not
395
+ accept visual drift merely because the codemod and typecheck are green.`;
396
+ const v1ToV2Prompt = `## v1 -> v2 migration pass
397
+
398
+ Bring the app to the v2 baseline before applying v3 changes.
399
+
400
+ ### Requirements
401
+
402
+ - React 19+
403
+ - React Native 0.81+ with New Architecture support
404
+ - TypeScript 5+
405
+
406
+ ### Config
407
+
408
+ - Preserve the app's existing token, theme, font, and breakpoint values while reaching the v2 API baseline. Keep supported Config v5 imports or serialize the old generated config into app-owned values when an entry is no longer exported. Config v6 is a separate optional migration after the v3 checkpoint below.
409
+ - Import animations separately from \`@tamagui/config/animations-css\`, \`animations-rn\`, \`animations-reanimated\`, or \`animations-motion\`.
410
+ - Move root \`createTamagui\` settings into \`settings\`.
411
+ - Account for the defaults \`flexBasis: 0\` and \`position: static\`. Use \`styleCompat: 'legacy'\` or explicit props if needed.
412
+ - Rename media queries: \`$2xl\` -> \`$xxl\`, \`$2xs\` -> \`$xxs\`, and max queries to kebab-case such as \`$max-md\`.
413
+ - Preserve resolved colors and themes; defer v6 recipe conversion to the optional follow-up below.
414
+
415
+ ### v1 prop and API changes
416
+
417
+ - \`animation\` -> \`transition\`.
418
+ - \`AnimationProp\` -> \`TransitionProp\`.
419
+ - \`tag\` -> \`render\`.
420
+ - \`Stack\` -> \`View\`.
421
+ - \`StackProps\` -> \`ViewProps\`.
422
+ - \`space\` and \`spaceDirection\` -> \`gap\`.
423
+ - \`themeInverse\` and \`<Theme inverse>\` -> \`theme="inverse"\` and \`<Theme name="inverse">\`.
424
+ - \`onHoverIn\` / \`onHoverOut\` -> \`onPointerEnter\` / \`onPointerLeave\` or mouse events.
425
+ - \`ellipse\` -> \`numberOfLines={1}\`.
426
+ - React Native accessibility props -> ARIA/web equivalents where applicable.
427
+ - React Native shadow props -> \`boxShadow\`.
428
+
429
+ ### v1 component changes
430
+
431
+ - Input and Image prefer web-standard props such as \`type\`, \`inputMode\`, \`src\`, \`alt\`, and \`objectFit\`.
432
+ - Button and ListItem no longer take direct text style props. Style text through child components.
433
+ - Tabs uses \`Tabs.Tab\` instead of \`Tabs.Trigger\`; \`activationMode\` defaults to \`manual\`.
434
+ - Group requires \`Group.Item\`; remove old separator/space/scrollable auto-cloning props.
435
+ - Replace old \`Popover.Sheet\` subcomponents with standalone \`Sheet\` inside \`Adapt\`.
436
+ - 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.
437
+
438
+ ### v1 -> v2 verification
439
+
440
+ - Run the app before starting v3 changes.
441
+ - Verify layout affected by flex/position defaults.
442
+ - Verify forms, tabs, groups, portals, native sheets, and Input/Image behavior.
443
+ - Commit the v1 -> v2 migration separately if possible.`;
@@ -0,0 +1,70 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var preview_theme_exports = {};
28
+ __export(preview_theme_exports, { previewTheme: () => previewTheme });
29
+ module.exports = __toCommonJS(preview_theme_exports);
30
+ var import_node_fs = __toESM(require("node:fs"));
31
+ var import_node_path = __toESM(require("node:path"));
32
+ var import_chalk = __toESM(require("chalk"));
33
+ var import_opener = __toESM(require("opener"));
34
+ async function previewTheme(options) {
35
+ const themeInput = (options.theme || options.themeArg || "").trim();
36
+ let themeData = null;
37
+ if (themeInput) {
38
+ if (themeInput.startsWith("{") || themeInput.startsWith("[")) {
39
+ try {
40
+ themeData = JSON.parse(themeInput);
41
+ } catch (err) {
42
+ throw new Error(`Invalid JSON provided for --theme: ${err.message}`);
43
+ }
44
+ } else {
45
+ const filePath = import_node_path.default.resolve(process.cwd(), themeInput);
46
+ if (!import_node_fs.default.existsSync(filePath)) {
47
+ throw new Error(`Theme file not found at: ${filePath}`);
48
+ }
49
+ try {
50
+ const fileContent = import_node_fs.default.readFileSync(filePath, "utf-8");
51
+ themeData = JSON.parse(fileContent);
52
+ } catch (err) {
53
+ throw new Error(`Failed to read theme file ${filePath}: ${err.message}`);
54
+ }
55
+ }
56
+ }
57
+ const baseUrl = options.url || "https://tamagui.dev/theme";
58
+ let targetUrl = baseUrl;
59
+ if (themeData) {
60
+ const jsonStr = JSON.stringify(themeData);
61
+ const base64 = Buffer.from(jsonStr).toString("base64");
62
+ targetUrl = `${baseUrl}#theme=${encodeURIComponent(base64)}`;
63
+ }
64
+ if (options.print) {
65
+ console.info(targetUrl);
66
+ return;
67
+ }
68
+ console.info(import_chalk.default.green(`Opening theme preview:`), targetUrl);
69
+ (0, import_opener.default)(targetUrl);
70
+ }