@tamagui/static 3.0.0-beta.1187.1 → 3.0.0-beta.1202.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.
@@ -24,7 +24,8 @@ __export(exports_exports, {
24
24
  clearFormatCache: () => import_detectModuleFormat.clearFormatCache,
25
25
  detectModuleFormat: () => import_detectModuleFormat.detectModuleFormat,
26
26
  esbundleTamaguiConfig: () => import_bundle.esbundleTamaguiConfig,
27
- evaluateComponentModule: () => import_bundleConfig.evaluateComponentModule
27
+ evaluateComponentModule: () => import_bundleConfig.evaluateComponentModule,
28
+ generateConfigMarkdown: () => import_generateConfigMarkdown.generateConfigMarkdown
28
29
  });
29
30
  module.exports = __toCommonJS(exports_exports);
30
31
  __reExport(exports_exports, require("./checkDeps.cjs"), module.exports);
@@ -42,3 +43,4 @@ var import_detectModuleFormat = require("./extractor/detectModuleFormat.cjs");
42
43
  var import_bundle = require("./extractor/bundle.cjs");
43
44
  __reExport(exports_exports, require("./getPragmaOptions.cjs"), module.exports);
44
45
  __reExport(exports_exports, require("./zero/index.cjs"), module.exports);
46
+ var import_generateConfigMarkdown = require("./extractor/generateConfigMarkdown.cjs");
@@ -0,0 +1,492 @@
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 generateConfigMarkdown_exports = {};
22
+ __export(generateConfigMarkdown_exports, { generateConfigMarkdown: () => generateConfigMarkdown });
23
+ module.exports = __toCommonJS(generateConfigMarkdown_exports);
24
+ function generateConfigMarkdown(config, options) {
25
+ const sections = [];
26
+ sections.push("# Tamagui Configuration\n\n");
27
+ sections.push("This document provides an overview of the Tamagui configuration for this project.\n\n");
28
+ const shorthands = config.tamaguiConfig?.shorthands || {};
29
+ const reverseShorthands = {};
30
+ for (const [short, full] of Object.entries(shorthands)) {
31
+ reverseShorthands[full] = short;
32
+ }
33
+ const getPropName = (fullProp) => {
34
+ const settings2 = config.tamaguiConfig?.settings || {};
35
+ if (settings2.onlyAllowShorthands) {
36
+ if (reverseShorthands[fullProp]) return reverseShorthands[fullProp];
37
+ if (fullProp === "backgroundColor" && reverseShorthands["background"]) {
38
+ return reverseShorthands["background"];
39
+ }
40
+ }
41
+ return fullProp;
42
+ };
43
+ const settings = config.tamaguiConfig?.settings || {};
44
+ const syntaxChoice = options?.styleValueSyntax || settings.styleValueSyntax || "both";
45
+ sections.push("## Configuration Settings\n\n");
46
+ sections.push("**IMPORTANT:** These settings affect how you write Tamagui code in this project.\n\n");
47
+ if (settings.defaultFont) {
48
+ sections.push(`### Default Font: \`${settings.defaultFont}\`
49
+
50
+ `);
51
+ sections.push(`All text components will use the "${settings.defaultFont}" font family by default.
52
+
53
+ `);
54
+ }
55
+ if (settings.onlyAllowShorthands !== void 0) {
56
+ sections.push(`### Only Allow Shorthands: \`${settings.onlyAllowShorthands}\`
57
+
58
+ `);
59
+ if (settings.onlyAllowShorthands) {
60
+ sections.push("**You MUST use shorthand properties in this project.**\n\n");
61
+ sections.push("Full property names are not allowed. For example:\n");
62
+ sections.push("- ✅ `<View w=\"10\" />` (correct)\n");
63
+ sections.push("- ❌ `<View width=\"10\" />` (will error)\n\n");
64
+ sections.push("See the Shorthand Properties section below for all available shorthands.\n\n");
65
+ } else {
66
+ sections.push("You can use either shorthand or full property names.\n\n");
67
+ }
68
+ }
69
+ if (syntaxChoice === "string") {
70
+ sections.push("### Style value syntax: `string`\n\n");
71
+ sections.push("Only the string form is allowed in this project (e.g. `bg=\"red hover:blue\"`).\n\n");
72
+ } else if (syntaxChoice === "object") {
73
+ sections.push("### Style value syntax: `object`\n\n");
74
+ sections.push("Only the object form is allowed in this project (e.g. `bg={{ default: 'red', hover: 'blue' }}`).\n\n");
75
+ } else {
76
+ sections.push("### Style value syntax\n\n");
77
+ sections.push("Both string and object style value syntax are allowed.\n\n");
78
+ }
79
+ if (settings.addThemeClassName !== void 0) {
80
+ sections.push(`### Theme Class Name: \`${settings.addThemeClassName}\`
81
+
82
+ `);
83
+ if (settings.addThemeClassName === "html") {
84
+ sections.push("Theme classes are applied to the root HTML element.\n\n");
85
+ }
86
+ }
87
+ if (settings.allowedStyleValues) {
88
+ sections.push("### Allowed Style Values\n\n");
89
+ sections.push(`Type validation: \`${JSON.stringify(settings.allowedStyleValues)}\`.
90
+
91
+ `);
92
+ sections.push("Single-token values are type-checked. Run `tamagui check --strict` to also validate conditional payloads.\n\n");
93
+ }
94
+ sections.push("## Flat Value Grammar\n\n");
95
+ sections.push("Conditional style values follow this grammar:\n\n");
96
+ sections.push("```txt\n");
97
+ sections.push("value := base? clause*\n");
98
+ sections.push("clause := modifier(:modifier)*:payload\n");
99
+ sections.push("```\n\n");
100
+ sections.push("- No `$` sigils: bare token names (`bg=\"background\"`, not `bg=\"$background\"`).\n");
101
+ sections.push("- Kebab-case theme names: `background-hover`, `border-color`, `shadow-color`.\n");
102
+ sections.push("- Numbers are px: `p={4}` is 4px, while `p=\"4\"` is space token 4.\n");
103
+ sections.push("- Specificity precedence: platform (`ios:` > `native:` > bare) > condition count > category (media < container < theme < group < state).\n\n");
104
+ const bgProp = getPropName("background");
105
+ const pProp = getPropName("padding");
106
+ if (syntaxChoice === "string") {
107
+ sections.push("**String form:**\n\n");
108
+ sections.push("```tsx\n");
109
+ sections.push(`<View ${bgProp}="background hover:background-hover dark:blue-500" ${pProp}="4 sm:6 max-sm:2" />
110
+ `);
111
+ sections.push("```\n\n");
112
+ } else if (syntaxChoice === "object") {
113
+ sections.push("**Object form:**\n\n");
114
+ sections.push("```tsx\n");
115
+ sections.push(`<View ${bgProp}={{ default: 'background', hover: 'background-hover', dark: 'blue-500' }} ${pProp}={{ default: '4', sm: '6', 'max-sm': '2' }} />
116
+ `);
117
+ sections.push("```\n\n");
118
+ } else {
119
+ sections.push("Both forms are allowed:\n\n");
120
+ sections.push("```tsx\n");
121
+ sections.push("// string form\n");
122
+ sections.push(`<View ${bgProp}="background hover:background-hover dark:blue-500" ${pProp}="4 sm:6 max-sm:2" />
123
+
124
+ `);
125
+ sections.push("// object form\n");
126
+ sections.push(`<View ${bgProp}={{ default: 'background', hover: 'background-hover', dark: 'blue-500' }} ${pProp}={{ default: '4', sm: '6', 'max-sm': '2' }} />
127
+ `);
128
+ sections.push("```\n\n");
129
+ }
130
+ sections.push("## Shorthand Properties\n\n");
131
+ sections.push("These shorthand properties are available for styling:\n\n");
132
+ const shorthandEntries = Object.entries(shorthands).sort(([a], [b]) => a.localeCompare(b));
133
+ sections.push(shorthandEntries.map(([short, full]) => `- \`${short}\` \u2192 \`${full}\``).join("\n"));
134
+ sections.push("\n\n");
135
+ const sizes = config.tamaguiConfig?.sizes;
136
+ if (sizes && typeof sizes === "object") {
137
+ sections.push("## Named Control Sizes\n\n");
138
+ sections.push(`Control components (Button, Input, etc.) use the configured names below. Default is \`${sizes.default ?? "md"}\`.
139
+
140
+ `);
141
+ sections.push("| Size | Configuration |\n");
142
+ sections.push("|---|---|\n");
143
+ for (const [sizeKey, val] of Object.entries(sizes)) {
144
+ if (sizeKey === "default") continue;
145
+ const valStr = typeof val === "object" && val !== null ? JSON.stringify(val) : String(val);
146
+ const isDefault = sizes.default === sizeKey ? " (default)" : "";
147
+ sections.push(`| \`${sizeKey}\`${isDefault} | ${valStr} |
148
+ `);
149
+ }
150
+ sections.push("\n");
151
+ }
152
+ sections.push("## Themes\n\n");
153
+ const themes = config.tamaguiConfig?.themes || {};
154
+ const themeNames = Object.keys(themes).sort();
155
+ sections.push(themeNames.map((name) => `- \`${name}\``).join("\n"));
156
+ sections.push("\n\nTheme names above are exact configured names. Nested themes resolve relative to their parent. Use an explicit theme boundary in a component skin.\n\n");
157
+ if (themeNames.length) {
158
+ sections.push("### Theme Usage\n\n");
159
+ sections.push(`\`\`\`tsx
160
+ <Theme name=${JSON.stringify(themeNames[0])}>
161
+ <Button>Uses this theme</Button>
162
+ </Theme>
163
+ \`\`\`
164
+
165
+ `);
166
+ }
167
+ sections.push("**Accessing theme values:**\n\n");
168
+ sections.push("Components access theme values by their bare names:\n\n");
169
+ const colorProp = getPropName("color");
170
+ if (syntaxChoice === "string") {
171
+ sections.push("```tsx\n");
172
+ sections.push(`<View ${bgProp}="background hover:background-hover" ${colorProp}="color" />
173
+ `);
174
+ sections.push("```\n\n");
175
+ } else if (syntaxChoice === "object") {
176
+ sections.push("```tsx\n");
177
+ sections.push(`<View ${bgProp}={{ default: 'background', hover: 'background-hover' }} ${colorProp}={{ default: 'color' }} />
178
+ `);
179
+ sections.push("```\n\n");
180
+ } else {
181
+ sections.push("```tsx\n");
182
+ sections.push("// string form\n");
183
+ sections.push(`<View ${bgProp}="background hover:background-hover" ${colorProp}="color" />
184
+
185
+ `);
186
+ sections.push("// object form\n");
187
+ sections.push(`<View ${bgProp}={{ default: 'background', hover: 'background-hover' }} ${colorProp}={{ default: 'color' }} />
188
+ `);
189
+ sections.push("```\n\n");
190
+ }
191
+ sections.push("**Special props:**\n\n");
192
+ sections.push("- `theme=\"inverse\"`: Uses the opposite light or dark sub-theme\n");
193
+ sections.push("## Tokens\n\n");
194
+ sections.push("Tokens are design system values referenced by their bare names.\n\n");
195
+ const tokens = config.tamaguiConfig?.tokens || {};
196
+ if (tokens.space && Object.keys(tokens.space).length > 0) {
197
+ sections.push("### Space Tokens\n\n");
198
+ const spaceTokens = Object.entries(tokens.space).sort(([a], [b]) => {
199
+ const numA = parseFloat(a);
200
+ const numB = parseFloat(b);
201
+ if (!isNaN(numA) && !isNaN(numB)) {
202
+ return numA - numB;
203
+ }
204
+ return a.localeCompare(b);
205
+ });
206
+ sections.push(spaceTokens.map(([key, value]) => `- \`${key}\`: ${formatTokenValue(value)}`).join("\n"));
207
+ sections.push("\n\n");
208
+ }
209
+ if (tokens.size && Object.keys(tokens.size).length > 0) {
210
+ sections.push("### Size Tokens\n\n");
211
+ const sizeTokens = Object.entries(tokens.size).sort(([a], [b]) => {
212
+ const numA = parseFloat(a);
213
+ const numB = parseFloat(b);
214
+ if (!isNaN(numA) && !isNaN(numB)) {
215
+ return numA - numB;
216
+ }
217
+ return a.localeCompare(b);
218
+ });
219
+ sections.push(sizeTokens.map(([key, value]) => `- \`${key}\`: ${formatTokenValue(value)}`).join("\n"));
220
+ sections.push("\n\n");
221
+ }
222
+ if (tokens.radius && Object.keys(tokens.radius).length > 0) {
223
+ sections.push("### Radius Tokens\n\n");
224
+ const radiusTokens = Object.entries(tokens.radius).sort(([a], [b]) => {
225
+ const numA = parseFloat(a);
226
+ const numB = parseFloat(b);
227
+ if (!isNaN(numA) && !isNaN(numB)) {
228
+ return numA - numB;
229
+ }
230
+ return a.localeCompare(b);
231
+ });
232
+ sections.push(radiusTokens.map(([key, value]) => `- \`${key}\`: ${formatTokenValue(value)}`).join("\n"));
233
+ sections.push("\n\n");
234
+ }
235
+ if (tokens.zIndex && Object.keys(tokens.zIndex).length > 0) {
236
+ sections.push("### Z-Index Tokens\n\n");
237
+ const zIndexTokens = Object.entries(tokens.zIndex).sort(([a], [b]) => {
238
+ const numA = parseFloat(a);
239
+ const numB = parseFloat(b);
240
+ if (!isNaN(numA) && !isNaN(numB)) {
241
+ return numA - numB;
242
+ }
243
+ return a.localeCompare(b);
244
+ });
245
+ sections.push(zIndexTokens.map(([key, value]) => `- \`${key}\`: ${formatTokenValue(value)}`).join("\n"));
246
+ sections.push("\n\n");
247
+ }
248
+ let sampleColorBg = "blue-500";
249
+ let sampleColorText = "color";
250
+ if (tokens.color && Object.keys(tokens.color).length > 0) {
251
+ sections.push("### Color Tokens\n\n");
252
+ const colorKeys = Object.keys(tokens.color).sort();
253
+ const paletteMap = /* @__PURE__ */ new Map();
254
+ const standaloneColors = [];
255
+ for (const key of colorKeys) {
256
+ const match = key.match(/^([a-z]+)-(\d+)$/);
257
+ if (match) {
258
+ const [, palette, step] = match;
259
+ if (!paletteMap.has(palette)) {
260
+ paletteMap.set(palette, /* @__PURE__ */ new Set());
261
+ }
262
+ paletteMap.get(palette).add(step);
263
+ } else {
264
+ standaloneColors.push([key, tokens.color[key]]);
265
+ }
266
+ }
267
+ if (paletteMap.size >= 4) {
268
+ const palettes = Array.from(paletteMap.keys()).sort().join(", ");
269
+ sections.push(`**Tailwind Palettes (\`<name>-<50..950>\`):** ${palettes}
270
+
271
+ `);
272
+ if (standaloneColors.length > 0) {
273
+ sections.push("**Named Colors:**\n\n");
274
+ sections.push(standaloneColors.map(([k, v]) => `- \`${k}\`: ${formatTokenValue(v)}`).join("\n"));
275
+ sections.push("\n\n");
276
+ }
277
+ sampleColorBg = colorKeys.find((k) => k.startsWith("blue-")) || colorKeys[0];
278
+ sampleColorText = colorKeys.find((k) => k.startsWith("gray-") || k.startsWith("zinc-")) || colorKeys[1] || "color";
279
+ } else {
280
+ sections.push(colorKeys.map((key) => `- \`${key}\`: ${formatTokenValue(tokens.color[key])}`).join("\n"));
281
+ sections.push("\n\n");
282
+ sampleColorBg = colorKeys[0] || "background";
283
+ sampleColorText = colorKeys[1] || "color";
284
+ }
285
+ } else {
286
+ sampleColorBg = "background";
287
+ sampleColorText = "color";
288
+ }
289
+ sections.push("### Token Usage\n\n");
290
+ sections.push("Tokens can be used in component props by their bare names:\n\n");
291
+ const paddingProp = getPropName("padding");
292
+ const gapProp = getPropName("gap");
293
+ const marginProp = getPropName("margin");
294
+ const widthProp = getPropName("width");
295
+ const heightProp = getPropName("height");
296
+ const radiusProp = getPropName("borderRadius");
297
+ const sampleRadius = tokens.radius?.md ? "md" : Object.keys(tokens.radius || {})[0] || "0px";
298
+ if (syntaxChoice === "string") {
299
+ sections.push("```tsx\n");
300
+ sections.push(`// Space tokens - for margin, padding, gap
301
+ <View ${paddingProp}="4 sm:6" ${gapProp}="2" ${marginProp}="3" />
302
+
303
+ `);
304
+ sections.push(`// Size tokens - for width, height, dimensions
305
+ <View ${widthProp}="10 sm:12" ${heightProp}="6" />
306
+
307
+ `);
308
+ sections.push(`// Color tokens - for colors and backgrounds
309
+ <View ${bgProp}="${sampleColorBg} hover:${sampleColorBg}" ${colorProp}="${sampleColorText}" />
310
+
311
+ `);
312
+ sections.push(`// Radius tokens - for border-radius
313
+ <View ${radiusProp}="${sampleRadius}" />
314
+ `);
315
+ sections.push("```\n\n");
316
+ } else if (syntaxChoice === "object") {
317
+ sections.push("```tsx\n");
318
+ sections.push(`// Space tokens - for margin, padding, gap
319
+ <View ${paddingProp}={{ default: '4', sm: '6' }} ${gapProp}="2" ${marginProp}="3" />
320
+
321
+ `);
322
+ sections.push(`// Size tokens - for width, height, dimensions
323
+ <View ${widthProp}={{ default: '10', sm: '12' }} ${heightProp}="6" />
324
+
325
+ `);
326
+ sections.push(`// Color tokens - for colors and backgrounds
327
+ <View ${bgProp}={{ default: '${sampleColorBg}', hover: '${sampleColorBg}' }} ${colorProp}={{ default: '${sampleColorText}' }} />
328
+
329
+ `);
330
+ sections.push(`// Radius tokens - for border-radius
331
+ <View ${radiusProp}="${sampleRadius}" />
332
+ `);
333
+ sections.push("```\n\n");
334
+ } else {
335
+ sections.push("```tsx\n");
336
+ sections.push("// String form\n");
337
+ sections.push(`<View ${paddingProp}="4 sm:6" ${widthProp}="10 sm:12" ${bgProp}="${sampleColorBg}" />
338
+
339
+ `);
340
+ sections.push("// Object form\n");
341
+ sections.push(`<View ${paddingProp}={{ default: '4', sm: '6' }} ${widthProp}={{ default: '10', sm: '12' }} ${bgProp}={{ default: '${sampleColorBg}' }} />
342
+
343
+ `);
344
+ sections.push(`// Space and radius tokens
345
+ <View ${gapProp}="2" ${marginProp}="3" ${heightProp}="6" ${radiusProp}="${sampleRadius}" />
346
+ `);
347
+ sections.push("```\n\n");
348
+ }
349
+ if (config.tamaguiConfig?.media) {
350
+ sections.push("## Media Queries\n\n");
351
+ sections.push("Available responsive breakpoints:\n\n");
352
+ const media = config.tamaguiConfig.media;
353
+ const mediaEntries = Object.entries(media).sort(([a], [b]) => a.localeCompare(b));
354
+ for (const [name, query] of mediaEntries) {
355
+ sections.push(`- **${name}**: ${formatMediaQuery(query)}
356
+ `);
357
+ }
358
+ sections.push("\n");
359
+ sections.push("### Media Query Usage\n\n");
360
+ sections.push("Media queries can be used as style props or with the `useMedia` hook:\n\n");
361
+ const representative = mediaEntries.find(([n]) => n === "sm" || n === "md")?.[0] || mediaEntries.find(([n]) => !n.includes("-"))?.[0] || mediaEntries[0]?.[0];
362
+ if (representative) {
363
+ const isIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(representative);
364
+ const mediaAccess = isIdentifier ? `media.${representative}` : `media['${representative}']`;
365
+ sections.push("```tsx\n");
366
+ if (syntaxChoice === "string") {
367
+ sections.push("// As a clause in the same style value\n");
368
+ sections.push(`<View ${widthProp}="100% ${representative}:50%" />
369
+
370
+ `);
371
+ } else if (syntaxChoice === "object") {
372
+ sections.push("// Using the object form\n");
373
+ sections.push(`<View ${widthProp}={{ default: '100%', '${representative}': '50%' }} />
374
+
375
+ `);
376
+ } else {
377
+ sections.push("// String form and object form\n");
378
+ sections.push(`<View ${widthProp}="100% ${representative}:50%" />
379
+ `);
380
+ sections.push(`<View ${widthProp}={{ default: '100%', '${representative}': '50%' }} />
381
+
382
+ `);
383
+ }
384
+ sections.push("// Using the useMedia hook\n");
385
+ sections.push("const media = useMedia()\n");
386
+ sections.push(`if (${mediaAccess}) {
387
+ `);
388
+ sections.push(" // Render for this breakpoint\n");
389
+ sections.push("}\n");
390
+ sections.push("```\n\n");
391
+ }
392
+ }
393
+ if (config.tamaguiConfig?.fonts) {
394
+ sections.push("## Fonts\n\n");
395
+ sections.push("Available font families:\n\n");
396
+ const fonts = config.tamaguiConfig.fonts;
397
+ const fontNames = Object.keys(fonts).sort();
398
+ sections.push(fontNames.map((name) => `- ${name}`).join("\n"));
399
+ sections.push("\n\n");
400
+ }
401
+ if (config.tamaguiConfig?.animations) {
402
+ sections.push("## Animations\n\n");
403
+ sections.push("Available animation presets:\n\n");
404
+ const animations = config.tamaguiConfig.animations;
405
+ if (animations.animations) {
406
+ const animationNames = Object.keys(animations.animations).sort();
407
+ sections.push(animationNames.map((name) => `- ${name}`).join("\n"));
408
+ sections.push("\n\n");
409
+ }
410
+ }
411
+ const componentsSection = [];
412
+ const componentSet = /* @__PURE__ */ new Set();
413
+ let barrelExported = false;
414
+ const candidateModules = ["tamagui", ...(config.components || []).map((c) => c.moduleName)];
415
+ for (const modName of candidateModules) {
416
+ if (!modName) continue;
417
+ try {
418
+ const mod = require(modName);
419
+ for (const [key, val] of Object.entries(mod)) {
420
+ if (/^[A-Z]/.test(key) && (typeof val === "function" || typeof val === "object" && val !== null)) {
421
+ if (!key.endsWith("Context") && !key.endsWith("Provider") && key !== "Fragment") {
422
+ componentSet.add(key);
423
+ barrelExported = true;
424
+ }
425
+ }
426
+ }
427
+ if (barrelExported) break;
428
+ } catch {}
429
+ }
430
+ if (!barrelExported && config.components) {
431
+ for (const componentModule of config.components) {
432
+ for (const name of Object.keys(componentModule.nameToInfo || {})) {
433
+ componentSet.add(name);
434
+ }
435
+ }
436
+ }
437
+ const allComponents = Array.from(componentSet).filter((name) => {
438
+ if (name.endsWith("Frame")) {
439
+ const base = name.replace(/Frame$/, "");
440
+ if (componentSet.has(base) || name.startsWith("Popper") || name.startsWith("DialogPortal") || name.startsWith("SelectScrollButton")) {
441
+ return false;
442
+ }
443
+ }
444
+ return true;
445
+ });
446
+ componentsSection.push("## Components\n\n");
447
+ componentsSection.push("Available named exports (import these names directly):\n\n");
448
+ for (const name of allComponents.sort()) {
449
+ componentsSection.push(`- ${name}
450
+ `);
451
+ }
452
+ componentsSection.push("\n");
453
+ sections.push(...componentsSection);
454
+ return sections.join("");
455
+ }
456
+ function formatTokenValue(value) {
457
+ if (typeof value === "object" && value !== null && "val" in value) {
458
+ return String(value.val);
459
+ }
460
+ return String(value);
461
+ }
462
+ function formatMediaQuery(query) {
463
+ if (typeof query !== "object" || query === null) {
464
+ return String(query);
465
+ }
466
+ const parts = [];
467
+ if (query.minWidth !== void 0) {
468
+ parts.push(`min-width: ${query.minWidth}px (screens >= ${query.minWidth}px wide)`);
469
+ }
470
+ if (query.maxWidth !== void 0) {
471
+ parts.push(`max-width: ${query.maxWidth}px (screens <= ${query.maxWidth}px wide)`);
472
+ }
473
+ if (query.minHeight !== void 0) {
474
+ parts.push(`min-height: ${query.minHeight}px (screens >= ${query.minHeight}px tall)`);
475
+ }
476
+ if (query.maxHeight !== void 0) {
477
+ parts.push(`max-height: ${query.maxHeight}px (screens <= ${query.maxHeight}px tall)`);
478
+ }
479
+ if (query.hover !== void 0) {
480
+ parts.push(`pointer: hover (${query.hover})`);
481
+ }
482
+ if (query.pointer !== void 0) {
483
+ parts.push(`pointer: ${query.pointer}`);
484
+ }
485
+ if (query.prefersReducedMotion !== void 0) {
486
+ parts.push(`prefers-reduced-motion: ${query.prefersReducedMotion}`);
487
+ }
488
+ if (parts.length === 0) {
489
+ return JSON.stringify(query);
490
+ }
491
+ return parts.join(", ");
492
+ }
@@ -117,6 +117,7 @@ async function loadTamaguiFromModules(propsIn, evaluated) {
117
117
  if (props.outputCSS) {
118
118
  await (0, import_bundleConfig.writeTamaguiCSS)(props.outputCSS, projectInfo.tamaguiConfig);
119
119
  }
120
+ await (0, import_regenerateConfig.regenerateConfig)(props, projectInfo);
120
121
  return projectInfo;
121
122
  }
122
123
  let waiting = false;
@@ -37,33 +37,35 @@ var import_generate_themes = require("@tamagui/generate-themes");
37
37
  var import_helpers = require("@tamagui/helpers");
38
38
  var import_tooling = require("@tamagui/style-grammar/tooling");
39
39
  var import_fs_extra = __toESM(require("fs-extra"), 1);
40
+ var import_generateConfigMarkdown = require("./generateConfigMarkdown.cjs");
40
41
  var import_requireTamaguiCore = require("../helpers/requireTamaguiCore.cjs");
41
42
  var import_bundleConfig = require("./bundleConfig.cjs");
42
43
  async function regenerateConfig(tamaguiOptions, configIn, rebuild = false) {
43
- try {
44
- const config = configIn ?? await (0, import_bundleConfig.getBundledConfig)(tamaguiOptions, rebuild);
45
- if (!config) return;
46
- const out = transformConfig(config, tamaguiOptions.platform || "web");
47
- const confFile = getConfigFile(tamaguiOptions);
48
- await import_fs_extra.default.ensureDir((0, import_node_path.dirname)(confFile));
49
- await import_fs_extra.default.writeJSON(confFile, out, { spaces: 2 });
50
- } catch (err) {
51
- if (process.env.DEBUG?.includes("tamagui") || process.env.IS_TAMAGUI_DEV) {
52
- console.warn("regenerateConfig error", err);
44
+ const config = configIn ?? await (0, import_bundleConfig.getBundledConfig)(tamaguiOptions, rebuild);
45
+ if (!config) return;
46
+ const outputs = getConfigOutputs(tamaguiOptions, config);
47
+ await import_fs_extra.default.ensureDir((0, import_node_path.dirname)(outputs[0][0]));
48
+ await Promise.all(outputs.map(async ([file, content]) => {
49
+ if (await import_fs_extra.default.pathExists(file)) {
50
+ if (await import_fs_extra.default.readFile(file, "utf8") === content) return;
53
51
  }
54
- }
52
+ await import_fs_extra.default.writeFile(file, content);
53
+ }));
55
54
  }
56
55
  function regenerateConfigSync(tamaguiOptions, config) {
57
- try {
58
- const confFile = getConfigFile(tamaguiOptions);
59
- import_fs_extra.default.ensureDirSync((0, import_node_path.dirname)(confFile));
60
- import_fs_extra.default.writeJSONSync(confFile, transformConfig(config, tamaguiOptions.platform || "web"), { spaces: 2 });
61
- } catch (err) {
62
- if (process.env.DEBUG?.includes("tamagui") || process.env.IS_TAMAGUI_DEV) {
63
- console.warn("regenerateConfig error", err);
64
- }
56
+ const outputs = getConfigOutputs(tamaguiOptions, config);
57
+ import_fs_extra.default.ensureDirSync((0, import_node_path.dirname)(outputs[0][0]));
58
+ for (const [file, content] of outputs) {
59
+ if (import_fs_extra.default.existsSync(file) && import_fs_extra.default.readFileSync(file, "utf8") === content) continue;
60
+ import_fs_extra.default.writeFileSync(file, content);
65
61
  }
66
62
  }
63
+ function getConfigOutputs(options, config) {
64
+ const out = transformConfig(config, options.platform || "web");
65
+ const confFile = getConfigFile(options);
66
+ return [[confFile, `${JSON.stringify(out, null, 2)}
67
+ `], [(0, import_node_path.join)((0, import_node_path.dirname)(confFile), "prompt.md"), (0, import_generateConfigMarkdown.generateConfigMarkdown)(out)]];
68
+ }
67
69
  async function generateTamaguiThemes(tamaguiOptions, force = false) {
68
70
  if (!tamaguiOptions.themeBuilder) {
69
71
  return;
@@ -1,6 +1,7 @@
1
1
  import { evaluateComponentModule } from "./extractor/bundleConfig.mjs";
2
2
  import { clearFormatCache, detectModuleFormat } from "./extractor/detectModuleFormat.mjs";
3
3
  import { esbundleTamaguiConfig } from "./extractor/bundle.mjs";
4
+ import { generateConfigMarkdown } from "./extractor/generateConfigMarkdown.mjs";
4
5
 
5
6
  export * from "./checkDeps.mjs"
6
7
 
@@ -26,4 +27,4 @@ export * from "./getPragmaOptions.mjs"
26
27
 
27
28
  export * from "./zero/index.mjs"
28
29
 
29
- export { clearFormatCache, detectModuleFormat, esbundleTamaguiConfig, evaluateComponentModule };
30
+ export { clearFormatCache, detectModuleFormat, esbundleTamaguiConfig, evaluateComponentModule, generateConfigMarkdown };